ex-grapesjs
v19.0.22
Published
Angular wrapper library for GrapesJS
Downloads
33
Readme
Ex-grapesjs is an Angular library that wraps basic functionality of the GrapesJS editor. It currently supports two modes for editing content: webpage and newsletter. The newsletter mode is preferable when you want to work with email content such as templates.
Install
- Install the core GrapesJS library
npm install grapesjs- Install one of the following GrapesJS plugins according to the editor mode that you want to use.
For webpage mode:
npm install grapesjs-preset-webpage grapesjs-blocks-basicFor newsletter mode:
npm install grapesjs-preset-newsletter- Install
ex-grapesjs
ng add ex-grapesjsThe previous command will ask you which editor mode you want to use and it will make all the necessary modifications in the Angular workspace so that you can get started.
Usage
Import
ExWebpageEditorComponentorExNewsletterEditorComponentfrom theex-grapesjslibrary, according to the editor mode that you want to use and add it to theimportsarray of your Angular component or module.Create an Angular component and add one of the following HTML snippets according to the editor mode that you want to use:
For webpage mode:
<ex-grapes-webpage-editor></ex-grapes-webpage-editor>For newsletter mode:
<ex-grapes-newsletter-editor></ex-grapes-newsletter-editor>
Both editors support passing the following input properties:
template: the HTML content of the editor in string formatstoragePrefix: the prefix that GrapesJS will use for persisting data to the local storage. By default it uses thegjs-prefix.
It is recommended to use a custom prefix when running multiple instances of the editor such as when opening or editing content in different tabs.
Additionally, the newsletter editor component supports the following options:
placeholders: an input property which is a list of variables with a predefined format that represent custom data in the template
