Issue #1662Opened December 14, 2018by Deepak8130 reactions

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)

artfDecember 20, 20180 reactions

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
lock[bot]December 20, 20190 reactions

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.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.