grapesjs-plugin-export

WebJar for grapesjs-plugin-export

License

License

BSD 3-Clause
Categories

Categories

JavaScript Languages
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

grapesjs-plugin-export
Last Version

Last Version

0.1.5
Release Date

Release Date

Type

Type

jar
Description

Description

grapesjs-plugin-export
WebJar for grapesjs-plugin-export
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/artf/grapesjs-plugin-export

Download grapesjs-plugin-export

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/grapesjs-plugin-export/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>grapesjs-plugin-export</artifactId>
    <version>0.1.5</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/grapesjs-plugin-export/
implementation 'org.webjars.npm:grapesjs-plugin-export:0.1.5'
// https://jarcasting.com/artifacts/org.webjars.npm/grapesjs-plugin-export/
implementation ("org.webjars.npm:grapesjs-plugin-export:0.1.5")
'org.webjars.npm:grapesjs-plugin-export:jar:0.1.5'
<dependency org="org.webjars.npm" name="grapesjs-plugin-export" rev="0.1.5">
  <artifact name="grapesjs-plugin-export" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='grapesjs-plugin-export', version='0.1.5')
)
libraryDependencies += "org.webjars.npm" % "grapesjs-plugin-export" % "0.1.5"
[org.webjars.npm/grapesjs-plugin-export "0.1.5"]

Dependencies

compile (2)

Group / Artifact Type Version
org.webjars.npm : file-saver jar [1.3.2,2)
org.webjars.npm : jszip jar [3.0.0,4)

Project Modules

There are no modules declared in this project.

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

Option Description Default
addExportBtn Add a button inside the export dialog true
btnLabel Label to the export button Export to ZIP
filenamePfx ZIP filename prefix grapesjs_template
filename Use a function to generate the filename, eg. filename: editor => 'my-file.zip', null
root Use 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/artf/grapesjs-plugin-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/artf/grapesjs-plugin-export.git
$ cd grapesjs-plugin-export

Install it

$ npm i

Start the dev server

$ npm start

License

BSD 3-Clause

Versions

Version
0.1.5