Description
Describe a bug.
I need to call the editor.clear()
method to clear the existing content in the editor before calling the editor.blocks.renderFromHTML()
method.
However, doing so results in the error "Uncaught (in promise) Error: Can't find a Block to remove. "
The clear
method is supposed to remove all Blocks and create a new empty initial type Block. So, after calling the clear method, a new default block should have been created.
I'm wondering why calling renderFromHTML
after clear
is causing the error "Can't find a Block to remove".
Additionally, even if there is an error, why isn't it caught by using renderFromHTML().catch()
? Instead, the error is thrown directly. In a React development environment, this would result in a runtime error.
Steps to reproduce:
- call
editor.clear()
- call
editor.blocks.renderFromHTML( '<p>call renderFromHTML after editor.clear()</p>')
- The error message states "Can't find a Block to remove" and appeared in the console.
Expected behavior:
No error occur or some ways to avoid this, thanks!
Device, Browser, OS:
Editor.js version:
https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest
Plugins you use with their versions: