0.0.3 • Published 5 years ago

grapesjs-plugin-call-save v0.0.3

Weekly downloads
1
License
BSD-3-Clause
Repository
github
Last release
5 years ago

GrapesJS Call Save

This plugin call save templates

Summary

  • Plugin name: grapesjs-plugin-call-save
  • Commands: gjs-call-save

Options

OptionDescriptionDefault
callFunction call save
rootUse the root object to data of call save (async functions are supported), eg. `
{
  css: ed => ed.getCss(),
  html: ed => ed.getHtml(),
}

|{ ...check the source }` |

Download

  • NPM
    • npm i grapesjs-plugin-call-save
  • GIT
    • git clone https://github.com/NortonPerson/grapesjs-plugin-call-save.git

Usage

Directly in the browser

<link href="https://unpkg.com/grapesjs/dist/css/grapes.min.css" rel="stylesheet"/>
<script src="https://unpkg.com/grapesjs"></script>
<script src="path/to/grapesjs-plugin-call-save.min.js"></script>

<div id="gjs"></div>

<script type="text/javascript">
  var editor = grapesjs.init({
      container : '#gjs',
      // ...
      plugins: ['grapesjs-plugin-call-save'],
      pluginsOpts: {
        'grapesjs-plugin-call-save': { /* options */ }
      }
  });

  // You can also call the command wherever you want in this way
  editor.runCommand('gjs-export-zip');
</script>

Modern javascript

import grapesjs from 'grapesjs';
import thePlugin from 'grapesjs-plugin-call-save';

const editor = grapesjs.init({
  container : '#gjs',
  // ...
  plugins: [thePlugin],
  pluginsOpts: {
    [thePlugin]: { /* options */ }
  }
  // or
  plugins: [
    editor => thePlugin(editor, { /* options */ }),
  ],
});

Development

Clone the repository

$ git clone https://github.com/NortonPerson/grapesjs-plugin-call-save.git
$ cd grapesjs-plugin-call-save

Install it

$ npm i

Start the dev server

$ npm start

License

BSD 3-Clause