Hey,
How can I trigger some event when any new block or content inside canvas is updated?
Something like editor.onCanvasUpdate()
Thanks!
Hi @fsaiyedOB,
I've been able to accomplish this with the component:update event listed here: https://github.com/artf/grapesjs/wiki/API-Editor#available-events
My code looks something like
editor.on("component:update", function() {
// do stuff here
});
When I asked to find out when the canvas is dirty to provide an indicator, @artf told me:
editor.on('change:changesCount', (editorModel, changes) => {
if (changes) {
// do something with changes
} else {
// do something else with no changes
}
});
I'd add also a block specific event
editor.on('block:drag:stop', model => console.log('dropped ', model))
@artf what about doing this only for specific blocks?
@chrisrobbins85kw I'd put some check (eg. some attribute/property) inside the callback
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.