11<script setup lang="ts">
2- import { ref } from ' vue'
3- import { SourceMapConsumer } from ' source-map-js'
42import { baseCompile } from ' @intlify/message-compiler'
53import * as monaco from ' monaco-editor'
4+ import { SourceMapConsumer } from ' source-map-js'
5+ import { ref } from ' vue'
66import { debounce } from ' ./utils'
77
8- import Navigation from ' ./components/Navigation.vue'
98import Editor from ' ./components/Editor.vue'
9+ import Navigation from ' ./components/Navigation.vue'
1010import Options from ' ./components/Options.vue'
1111
1212import type { CompileError , CompileOptions } from ' @intlify/message-compiler'
@@ -23,6 +23,7 @@ interface PersistedState {
2323const genCodes = ref <string >(' ' )
2424const compileErrors = ref <CompileError []>([])
2525const persistedState: PersistedState = JSON .parse (
26+ // eslint-disable-next-line -- FIXME:
2627 decodeURIComponent (window .location .hash .slice (1 )) || localStorage .getItem (' state' ) || ` {} `
2728)
2829const initialCodes = persistedState .src || ' hello {name}!'
@@ -88,7 +89,9 @@ let outputEditor: monaco.editor.IStandaloneCodeEditor | null = null
8889const onChangeModel = async (message : string ): Promise <void > => {
8990 console .log (' onChangeModel' , message )
9091 const state = JSON .stringify ({ src: message } as PersistedState )
92+ // eslint-disable-next-line -- FIXME:
9193 localStorage .setItem (' state' , state )
94+ // eslint-disable-next-line -- FIXME:
9295 window .location .hash = encodeURIComponent (state )
9396 genCodes .value = await compile (message , _compilerOptions )
9497}
0 commit comments