Editor.destroy()
See original GitHub issueI want to destroy the editor instance manually and then set it again when the component is updated. I am using ReactJs but I am not using the react wrapper. Whenever I try to call the destroy function I got the error that destroy is not a function.
const MyEditor = () => {
const [editor, setEditor] = useState([]);
useEffect(() => {
if (editor.length != 0) {
editor.destroy();
}
setEditor(
new EditorJS({
holder: "editor",
placeholder: "Insert your text here!",
tools: {
header: Header,
list: List,
quote: Quote,
checklist: Checklist,
code: Code,
table: Table,
image: {
class: ImageTool,
config: {
endpoints: {
byFile: "myFile",
byUrl: "myUrl"
}
}
}
},
data: {
blocks: myBlocks
}
})
);
}, [myData]);
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:11 (3 by maintainers)
Top Results From Across the Web
Destroyer - Editor.js
You can destroy Editor.js instance by calling a destroy method. /** * Create an instance */ const editor = new EditorJS(); /** *...
Read more >destroy() - DataTables Editor
Editor instances are no different and this method provides that ability. It will clean up any events added by Editor, fields and DOM...
Read more >destroy - API Reference - Kendo UI Editor - Documentation
destroy. Prepares the widget for safe removal from DOM. Detaches all event handlers and removes jQuery.data attributes to avoid memory leaks.
Read more >editor destroy - Gijgo.com
<button class="gj-button-md" onclick="editor.destroy()">Destroy</button><br/> <textarea id="editor"></textarea> <script> var editor = $('#editor').editor(); ...
Read more >Destroy / Init Editor - Froala
The buttons here will destroy and init the rich text editor again. ... preventDefault(); if (editor) { editor.destroy() } }); // Initialize action....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
you can use it inside
isReady
editor.isReady .then(() => { // editor.destroy(); /** Do anything you need after editor initialization */ });
getting this now with read only mode