diff --git a/src/lib/components/Editor.svelte b/src/lib/components/Editor.svelte index 2d5d3cc3..2c6c964e 100644 --- a/src/lib/components/Editor.svelte +++ b/src/lib/components/Editor.svelte @@ -6,7 +6,7 @@ import * as monaco from 'monaco-editor'; import monacoJsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker'; import monacoEditorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker'; - import { onMount } from 'svelte'; + import { onMount, onDestroy } from 'svelte'; import { initEditor } from '$lib/util/monacoExtra'; import { logEvent } from '$lib/util/stats'; @@ -110,7 +110,7 @@ }); if (divEl.parentElement) { - resizeObserver.observe(divEl.parentElement); + resizeObserver.observe(divEl); } // @ts-ignore @@ -118,11 +118,27 @@ // @ts-ignore window.editorLoaded = true; } - return () => { - // console.log(`editor disposed`); - editor?.dispose(); - }; + }); + + onDestroy(() => { + editor?.dispose(); }); -
+
+
+ {#if $stateStore.error instanceof Error} +
+
+
+