Skip to content

Commit

Permalink
'Clean', 'Redo' and 'Undo' action will not update component value #3
Browse files Browse the repository at this point in the history
(cherry picked from commit 9077f37)
  • Loading branch information
zaharchenko committed Feb 11, 2019
1 parent 46409a1 commit b95a4ed
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,8 @@ com_haulmont_addon_grapesjs_web_toolkit_ui_grapesjshtmleditorcomponent_GrapesJsH
if(confirm('Are you sure to clean the canvas?')) {
var comps = editor.DomComponents.clear();
setTimeout(function(){ localStorage.clear()}, 0)
var tmpl = editor.getHtml() + `<style>${editor.getCss()}</style>`;
connector.valueChanged(tmpl);
}
});

Expand Down Expand Up @@ -407,6 +409,16 @@ com_haulmont_addon_grapesjs_web_toolkit_ui_grapesjshtmleditorcomponent_GrapesJsH
connector.valueChanged(tmpl);
});

editor.on('undo', (component, argument) => {
var tmpl = editor.getHtml() + `<style>${editor.getCss()}</style>`;
connector.valueChanged(tmpl);
});

editor.on('redo', (component, argument) => {
var tmpl = editor.getHtml() + `<style>${editor.getCss()}</style>`;
connector.valueChanged(tmpl);
});

connector.onStateChange = function() {
var state = connector.getState();
editor.setComponents(state.html);
Expand Down

0 comments on commit b95a4ed

Please sign in to comment.