|
@@ -1,7 +1,7 @@
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
import { useStore, type IMappingValue } from '@/util/store'
|
|
import { useStore, type IMappingValue } from '@/util/store'
|
|
const store = useStore()
|
|
const store = useStore()
|
|
-import { ref, shallowRef } from 'vue'
|
|
|
|
|
|
+import { computed, shallowRef } from 'vue'
|
|
|
|
|
|
//see https://github.com/imguolao/monaco-vue#vite
|
|
//see https://github.com/imguolao/monaco-vue#vite
|
|
import { loader } from "@guolao/vue-monaco-editor"
|
|
import { loader } from "@guolao/vue-monaco-editor"
|
|
@@ -29,17 +29,32 @@ self.MonacoEnvironment = {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
loader.config({ monaco })
|
|
loader.config({ monaco })
|
|
-
|
|
|
|
-
|
|
|
|
const MONACO_EDITOR_OPTIONS = {
|
|
const MONACO_EDITOR_OPTIONS = {
|
|
automaticLayout: true,
|
|
automaticLayout: true,
|
|
formatOnType: true,
|
|
formatOnType: true,
|
|
formatOnPaste: true,
|
|
formatOnPaste: true,
|
|
}
|
|
}
|
|
|
|
|
|
-const code = ref('')
|
|
|
|
|
|
+const node = computed(() => {
|
|
|
|
+ return store.selectedNode;
|
|
|
|
+});
|
|
|
|
+
|
|
|
|
+const code = computed(():string => {
|
|
|
|
+ if(!node.value)
|
|
|
|
+ return "";
|
|
|
|
+ if(!node.value.nodeId.value)
|
|
|
|
+ return "";
|
|
|
|
+ const m=store.mapping.get(node.value.nodeId.value.toString());
|
|
|
|
+ if(m)
|
|
|
|
+ return m.read;
|
|
|
|
+ return "";
|
|
|
|
+});
|
|
|
|
+
|
|
const editorRef = shallowRef()
|
|
const editorRef = shallowRef()
|
|
-const handleMount = (editor: any) => (editorRef.value = editor)
|
|
|
|
|
|
+const handleMount = (editor: any) => {
|
|
|
|
+ editorRef.value = editor
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
|
|
const onChange = (value: string | undefined, event: monaco.editor.IModelContentChangedEvent) => {
|
|
const onChange = (value: string | undefined, event: monaco.editor.IModelContentChangedEvent) => {
|
|
if(!store.selectedNode)
|
|
if(!store.selectedNode)
|