Skip to content

Commit

Permalink
Build
Browse files Browse the repository at this point in the history
  • Loading branch information
artf committed Aug 4, 2022
1 parent df9dabd commit 3183fc5
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 15 deletions.
11 changes: 0 additions & 11 deletions dist/grapesjs-plugin-export.min.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/grapesjs-plugin-export.min.js.map

This file was deleted.

67 changes: 67 additions & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import grapesjs from 'grapesjs';

export declare type Editor = grapesjs.Editor;
export declare type PluginOptions = {
/**
* Type id used to register the new storage.
* You can use this option in case you want to replace the already available storages (eg. `local`).
* @default 'indexeddb'
*/
type?: string;
/**
* Add a button inside the export dialog
* @default true
*/
addExportBtn?: boolean;
/**
* Label of the export button
* @default 'Export to ZIP'
*/
btnLabel?: string;
/**
* ZIP filename prefix
* @default 'grapesjs_template'
*/
filenamePfx?: string;
/**
* Use a function to generate the filename, eg. `filename: editor => 'my-file.zip',`
*/
filename?: (editor: Editor) => string;
/**
* Callback to execute once the export is completed
*/
done?: () => void;
/**
* Callback to execute on export error
*/
onError?: (error: Error) => void;
/**
* Use the root object to create the folder structure of your zip (async functions are supported)
* @example
* root: {
* 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>`
* }
*/
root?: Record<string, unknown>;
/**
* Custom function for checking if the file content is binary
*/
isBinary?: (content: string, name: string) => boolean;
};
declare const plugin: grapesjs.Plugin<PluginOptions>;

export {
plugin as default,
};

export {};
3 changes: 3 additions & 0 deletions dist/index.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "grapesjs-plugin-export",
"version": "1.0.10",
"version": "1.0.11",
"description": "Export GrapesJS templates to ZIP",
"main": "dist/grapesjs-plugin-export.min.js",
"main": "dist/index.js",
"files": ["dist/*"],
"scripts": {
"start": "grapesjs-cli serve",
"build": "grapesjs-cli build"
Expand Down

0 comments on commit 3183fc5

Please sign in to comment.