From 629f4d2a76c62e82c104598bf42a53a6d32015a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20K=C3=BChn?= Date: Fri, 17 Dec 2021 09:42:22 +0100 Subject: [PATCH] Revert "fix: Make sure editor is available on first render (#2282), fix #2040, fix #2182" This reverts commit 2436e2c8fe88cdce6685ae3d712e5f2d3e70851d. --- packages/react/src/useEditor.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/packages/react/src/useEditor.ts b/packages/react/src/useEditor.ts index f42635de..32896f23 100644 --- a/packages/react/src/useEditor.ts +++ b/packages/react/src/useEditor.ts @@ -9,18 +9,13 @@ function useForceUpdate() { } export const useEditor = (options: Partial = {}, deps: DependencyList = []) => { - const [editor, setEditor] = useState(() => new Editor(options)) + const [editor, setEditor] = useState(null) const forceUpdate = useForceUpdate() useEffect(() => { - let instance: Editor + const instance = new Editor(options) - if (editor.isDestroyed) { - instance = new Editor(options) - setEditor(instance) - } else { - instance = editor - } + setEditor(instance) instance.on('transaction', () => { requestAnimationFrame(() => {