Listen to any change in the canvas
Hello Folks,
I have a requirement where I added a button which saves the configuration to the remote DB.Now I would like to listen to any change in the canvas to enable/disable the button.For example, If there is any change, enable the save button for user to save it.I have gone through available events but I found nothing which listen to any change (Style,Component add/remove).
Any help? @artf
Warm regards Milap
I'm not sure if there's one exclusive event that listens for any changes to the canvas. Perhaps you could have your method run on all of the canvas events instead?
https://github.com/artf/grapesjs/blob/dev/src/editor/index.js#L53 `* ## Canvas
-
canvas:dragenter- When something is dragged inside the canvas,DataTransferinstance passed as an argument
-
canvas:dragover- When something is dragging on canvas,DataTransferinstance passed as an argument
-
canvas:drop- Something is dropped in canvas,DataTransferinstance and the dropped model are passed as arguments
-
canvas:dragend- When a drag operation is ended,DataTransferinstance passed as an argument
-
canvas:dragdata- On any dataTransfer parse,DataTransferinstance and theresultare passed as arguments.`
Actually I think there is an event that could serve this purpose. Could you try defining your method callback on 'change:changesCount'?
grapesjs\src\editor\model\Editor.js:64
this.on('change:changesCount', this.updateChanges, this);
@IStirton10 Let me try it out.I guess this should work.
Warm regards Milap
@IStirton10 Its working.Thank you.
Is there a method which makes button disabled and not clickable.The Enable property is just about making it selected.Do we have anything to disable the button.
@artf Any thoughts?
Warm regards Milap
@milapshah15 hi ,bro.i am doing this.Have you implemented the disable button function
Its working.Thank you.
I'm closing this then
Is there a method which makes button disabled and not clickable.The Enable property is just about making it selected.Do we have anything to disable the button.
btnModel.set('disable', true);
@ionic666 No I did not find any method which can disable the button
Warm regards Milap
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.