Socket
Socket
Sign inDemoInstall

grapesjs-plugin-export

Package Overview
Dependencies
1
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    grapesjs-plugin-export

Export GrapesJS templates to ZIP


Version published
Weekly downloads
8.3K
increased by9.36%
Maintainers
1
Install size
363 kB
Created
Weekly downloads
 

Readme

Source

GrapesJS Export

This plugin adds the possibility to export template in a zip archive. Demo: http://grapesjs.com/demo.html

Summary

  • Plugin name: grapesjs-plugin-export
  • Commands: gjs-export-zip

Options

OptionDescriptionDefault
addExportBtnAdd a button inside the export dialogtrue
btnLabelLabel to the export buttonExport to ZIP
filenamePfxZIP filename prefixgrapesjs_template
filenameUse a function to generate the filename, eg. filename: editor => 'my-file.zip',null
rootUse the root object to create the folder structure of your zip (async functions are supported), eg. `
{
  css: {
    'style.css': ed => ed.getCss(),
    'some-file.txt': 'My custom content',
  },
  img: async ed => {
    const images = await fetchImagesByStructue(ed.getComponents());
    return images;
    // Where `images` is an object like this:
    // { 'img1.png': '...png content', 'img2.jpg': '...jpg content' }
  },
  'index.html': ed => `<body>${ed.getHtml()}</body>`
}

|{ ...check the source }` |

Download

  • CDN
    • https://unpkg.com/grapesjs-plugin-export
  • NPM
    • npm i grapesjs-plugin-export
  • GIT
    • git clone https://github.com/GrapesJS/export.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-export.min.js"></script>

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

<script type="text/javascript">
  var editor = grapesjs.init({
      container : '#gjs',
      // ...
      plugins: ['grapesjs-plugin-export'],
      pluginsOpts: {
        'grapesjs-plugin-export': { /* 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-export';

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/GrapesJS/export.git.git
$ cd grapesjs-plugin-export

Install it

$ npm i

Start the dev server

$ npm start

License

BSD 3-Clause

Keywords

FAQs

Last updated on 12 Jun 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc