[QUESTION] Best way to listen to changes on the final HTML?
See original GitHub issueHi,
I just had a quick question because I could not figure out how to do it or did not find an issue related to it.
I am just trying to call a function when any changes is done on the canvas.
For example, I am adding a block or removing a block. I am changing the attributes using the style manager. Or drag and dropping the blocks within the canvas. Or even updating the traits.
Is there a global event I can listen to it trigger my function?
I am not talking about any actual changes in the Canvas itself but changes that apply to the final HTML when I call the method editor.getHtml().
Any help or guidance is appreciated, thanks!
Update:
For the moment I figured out I could use the storage manager to achieve this, by doing:
storageManager: { type: 'onChange'; }
and
editor.on('storage:start', callback);
If there is a simpler solution without having to do it this way, I am open to suggestions.
Thanks!
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (4 by maintainers)
Top GitHub Comments
@simplecommerce , try also this, maybe fit better for you
The way you did is the simplest way to achieve that in my opinion.