Skip to content

Commit 2d87c05

Browse files
committed
Add extra plugins to the editor
Closes #23
1 parent 04caf1a commit 2d87c05

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

projects/demo-editor/src/app/app.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { NgxNewsletterEditorComponent, NgxWebpageEditorComponent } from 'ngx-gra
1414
})
1515
export class AppComponent {
1616
editorMode = '';
17-
template = '<span>This is a test content</span>'
17+
template = '<span>This is a test content</span>';
1818
placeholders = [{
1919
value: 'MyPlaceholder',
2020
name: 'Custom placeholder',

projects/ngx-grapesjs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ Both editors support passing the following input properties:
5252

5353
- `template`: the HTML content of the editor in string format
5454
- `storagePrefix`: the prefix that GrapesJS will use for persisting data to the local storage. By default it uses the `gjs-` prefix.
55+
- `plugins`: additional GrapesJS plugins to use. It requires that the respective npm package of the plugins must have been installed previously.
5556

5657
>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.
5758

projects/ngx-grapesjs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngx-grapesjs",
3-
"version": "19.0.0",
3+
"version": "19.1.0",
44
"description": "Angular wrapper library for GrapesJS",
55
"scripts": {
66
"build": "tsc -p tsconfig.schematics.json",

projects/ngx-grapesjs/src/lib/editor.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export class NgxEditorComponent {
1111

1212
readonly template = input('');
1313
readonly storagePrefix = input('gjs-');
14+
readonly plugins = input<string[]>([]);
1415

1516
setup(customConfig: Partial<Config>) {
1617
const config: Partial<Config> = {
@@ -22,7 +23,8 @@ export class NgxEditorComponent {
2223

2324
return grapesjs.init({
2425
...config,
25-
...customConfig
26+
...customConfig,
27+
plugins: [...customConfig.plugins!, ...this.plugins()]
2628
});
2729
}
2830

0 commit comments

Comments
 (0)