How we can reinitialise editor
Question
Hi @artf, Hope you are doing good.
How we can reinitialise the editor with json data. We want to reinitialise editor with some of the previous saved json data so that we can compare that. Is there any option so that we can change the content of editor based on json data without reloading the page ? All the Undo, Redo and CSS composer and other setting should be reset after that so that it will not affect the current template or add in the current template after re initialisation.
I have an option editor.setComponents(data); editor.setStyle(data);
But I think it do not reset the css composer, undo redo and other changes which are done for the previous template.
Thanks in advance
Answers (2)
I think this should be enough
editor.DomComponents.clear(); // Clear components
editor.CssComposer.clear(); // Clear styles
editor.UndoManager.clear(); // Clear undo history
editor.setComponents([{}, {}, ...]) // Add components
editor.setStyle([{}, {}, ...]) // Add rules
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1334
How to import previous saved templates in new template.
@artf I have saved some templates created by grapejs and want to use/import it in new template as a section / block. I do not want import a...
Issue #1683
How to change id/class when new element drop on editor or render element with dynamic ip?
Hello @artf , Hope you are doing well. I have two questions regards dynamic blocks adding, 1) Is it possible to render the block with dynam...
Issue #1719
Event while click on image from asset modal
Hello @artf , Hope you are doing well. I am working on asset-manager. I have total 5 images as a default asset-manager image. I want to do...
Issue #1469
Check canvas event
Hi @artf, Is there any common method where we can know something updated on canvas. We want to create a custom undo manager and also want t...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.