diff --git a/src/lib/Util/util.ts b/src/lib/Util/util.ts index 16cc4754..38508e0c 100644 --- a/src/lib/Util/util.ts +++ b/src/lib/Util/util.ts @@ -1,5 +1,10 @@ -import { loadState } from './state'; +import { initURLSubscription, loadState } from './state'; export const loadStateFromURL = (): void => { loadState(window.location.hash.slice(1)); }; + +export const initHandler = (): void => { + loadStateFromURL(); + initURLSubscription(); +}; diff --git a/src/lib/components/actions.svelte b/src/lib/components/actions.svelte new file mode 100644 index 00000000..c76e886a --- /dev/null +++ b/src/lib/components/actions.svelte @@ -0,0 +1 @@ + diff --git a/src/lib/components/preset.svelte b/src/lib/components/preset.svelte index b288384f..7a3f8475 100644 --- a/src/lib/components/preset.svelte +++ b/src/lib/components/preset.svelte @@ -78,8 +78,9 @@
{#each Object.keys(samples) as sample} - loadSampleDiagram(sample)}>{sample} {/each}
diff --git a/src/routes/edit.svelte b/src/routes/edit.svelte index e8bbbefe..56ae317e 100644 --- a/src/routes/edit.svelte +++ b/src/routes/edit.svelte @@ -7,7 +7,7 @@ import Tabs from '$lib/components/tabs.svelte'; import History from '$lib/components/history/index.svelte'; import { initURLSubscription, updateCode, updateConfig, codeStore } from '$lib/util/state'; - import { loadStateFromURL } from '$lib/util/util'; + import { initHandler, loadStateFromURL } from '$lib/util/util'; import { errorStore } from '$lib/util/error'; import { onMount } from 'svelte'; import type monaco from 'monaco-editor'; @@ -90,12 +90,8 @@ console.error(e); } }; - loadStateFromURL(); - onMount(() => { - syncDiagram(); - initURLSubscription(); - }); + onMount(initHandler); @@ -128,9 +124,9 @@ -
+
@@ -143,7 +139,6 @@ - diff --git a/src/routes/view.svelte b/src/routes/view.svelte new file mode 100644 index 00000000..216251f0 --- /dev/null +++ b/src/routes/view.svelte @@ -0,0 +1,8 @@ + + +