diff --git a/projects/ngx-grapesjs/src/lib/grapesjs.model.ts b/projects/ngx-grapesjs/src/lib/grapesjs.model.ts index 7f028b1..24b5a8a 100644 --- a/projects/ngx-grapesjs/src/lib/grapesjs.model.ts +++ b/projects/ngx-grapesjs/src/lib/grapesjs.model.ts @@ -54,6 +54,9 @@ export interface Config { parser: { parserHtml: {} }; + storageManager: { + id: string + }; } export interface CommandSender { diff --git a/projects/ngx-grapesjs/src/lib/ngx-grapesjs.component.ts b/projects/ngx-grapesjs/src/lib/ngx-grapesjs.component.ts index 1c673b6..e2e49d0 100644 --- a/projects/ngx-grapesjs/src/lib/ngx-grapesjs.component.ts +++ b/projects/ngx-grapesjs/src/lib/ngx-grapesjs.component.ts @@ -19,6 +19,10 @@ export class NgxGrapesjsComponent implements OnInit { this.config.components = content; } @Input() placeholders: Placeholder[] = []; + @Input() + set storagePrefix(prefix: string) { + this.config.storageManager.id = prefix; + } private editor: GrapesJsEditor | undefined = undefined; private config: Config = { @@ -32,6 +36,9 @@ export class NgxGrapesjsComponent implements OnInit { }, parser: { parserHtml: {} + }, + storageManager: { + id: 'gjs-' } }; @@ -40,7 +47,6 @@ export class NgxGrapesjsComponent implements OnInit { ngOnInit(): void { // setup the default parser. It can be overriden by providing a custom implementation of the NgxGrapesjsService this.config.parser.parserHtml = this.ngxGrapesJsService?.parserHtml; - // initialize the editor this.editor = grapesjs.init(this.config);