Grapesjs Undraw
Add undraw illustrations through a modal
HTML
<link href="https://unpkg.com/grapesjs/dist/css/grapes.min.css" rel="stylesheet">
<link href="https://unpkg.com/grapesjs-undraw/dist/grapesjs-undraw.min.css" rel="stylesheet">
<script src="https://unpkg.com/grapesjs"></script>
<script src="https://unpkg.com/grapesjs-undraw"></script>
<div id="gjs"></div>
JS
const editor = grapesjs.init({
container: '#gjs',
height: '100%',
fromElement: true,
storageManager: false,
plugins: ['grapesjs-undraw'],
});
CSS
body, html {
margin: 0;
height: 100%;
}
Summary
- Plugin name:
grapesjs-undraw
- Commands
undraw
- API
editor.Undraw
Options
Option | Description | Default |
---|---|---|
undrawEndpoint |
Endpoint for undraw svgs(can be self hosted) | https://42f2671d685f51e10fc6-b9fcecea3e50b3b59bdc28dead054ebc.ssl.cf5.rackcdn.com/illustrations/ |
undrawError |
Handle errors | check source |
modalUndrawTitle |
Modal title | Undraw |
Download
- CDN
https://unpkg.com/grapesjs-undraw
- NPM
npm i grapesjs-undraw
- GIT
git clone https://github.com/Ju99ernaut/grapesjs-undraw.git
Usage
Directly in the browser
<link href="https://unpkg.com/grapesjs/dist/css/grapes.min.css" rel="stylesheet"/>
<link href="https://unpkg.com/grapesjs-undraw/dist/grapesjs-undraw.min.css" rel="stylesheet">
<script src="https://unpkg.com/grapesjs"></script>
<script src="path/to/grapesjs-undraw.min.js"></script>
<div id="gjs"></div>
<script type="text/javascript">
var editor = grapesjs.init({
container: '#gjs',
// ...
plugins: ['grapesjs-undraw'],
pluginsOpts: {
'grapesjs-undraw': { /* options */ }
}
});
</script>
Modern javascript
import grapesjs from 'grapesjs';
import plugin from 'grapesjs-undraw';
import 'grapesjs/dist/css/grapes.min.css';
import 'grapesjs-undraw/dist/grapesjs-undraw.min.css'
const editor = grapesjs.init({
container : '#gjs',
// ...
plugins: [plugin],
pluginsOpts: {
[plugin]: { /* options */ }
}
// or
plugins: [
editor => plugin(editor, { /* options */ }),
],
});
Development
Clone the repository
$ git clone https://github.com/Ju99ernaut/grapesjs-undraw.git
$ cd grapesjs-undraw
Install dependencies
$ npm i
Watch sass
$ npm run watch:scss
Start the dev server
$ npm start
Build the source
$ npm run build
Build css
$ npm run build:css
License
MIT