diff --git a/packages/text-editor/src/components/TextEditor.svelte b/packages/text-editor/src/components/TextEditor.svelte index 54de1d993e..735e30db1a 100644 --- a/packages/text-editor/src/components/TextEditor.svelte +++ b/packages/text-editor/src/components/TextEditor.svelte @@ -214,6 +214,13 @@ // I need to copypaste original function and make a little change // with showContextMenu falg shouldShow: ({ editor, view, state, oldState, from, to }) => { + // For some reason shouldShow might be called after dismount and + // after destroing the editor. We should handle this just no to have + // any errors in runtime + if (!element) { + return false + } + const { doc, selection } = state const { empty } = selection