editor.js
editor.js copied to clipboard
Mark as changed
Hello,
I have been trying to find a way to mark a block as changed in a plugin extension. Since programmatically modifications don't trigger onChange anymore, I cannot find a way to mark a block as changed.
Is there a way to do so ?
Or maybe a "onSave" method in EditorJS declaration ?
Since programmatically modifications don't trigger onChange anymore
what do you mean?
Twicking html using JavaScript doesn't trigger onChange event and I would like to find a way to trigger onChange by myself.
@xkzl you can do this in your block:
/**
* @param {ImageToolData} tool.data - previously saved data
* @param {boolean} tool.readOnly - read-only mode flag
* @param {BlockAPI|{}} tool.block - current Block API
*/
constructor({ data, readOnly, block }) {
this.block = block;
}
someMethod() {
this.block.dispatchChange(); // will trigger 'block-changed'
}