codex-team / codex-team/editor.js
Editor.destroy()
- Dominant language
- TypeScript
- Stars
- 31.9k
- Forks
- 2.2k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
I 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]);
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.