table
table copied to clipboard
I got the change event when I replace the old data using the render method
here is my code to reset data, it will replace the old data:
const resetData = async (id:string) => {
try {
await editor.isReady;
console.log('Editor.js is ready to work!')
const data = await getNoteById(id)
if (data) {
if (data?.editorBlocks) {
const editorData = {blocks: data?.editorBlocks ,version: data?.editorVersion,time: data?.editorTime} as OutputData;
await editor.render( editorData)
} else {
// removes all Blocks and creates new empty initial type Block
editor.clear()
}
}
} catch (reason) {
console.log(`Editor.js initialization failed because of ${reason}`)
}
}
if the editor contain the table block, it will trigger change event when I call the resetData method. It will save the wrong data.