diff --git a/packages/CodeEditor/Editor.vue b/packages/CodeEditor/Editor.vue index 3fceae9..bedd5dd 100644 --- a/packages/CodeEditor/Editor.vue +++ b/packages/CodeEditor/Editor.vue @@ -160,6 +160,8 @@ export default { data() { return { id: newId(), + cursorLocation: null, + updatingValue: false, editorHasFocus: false, autosave: true, messageIds: [], @@ -241,6 +243,14 @@ export default { }); editor.getModel().onDidChangeContent((event) => { this.update(); + if (this.updatingValue && this.cursorLocation) { + this.$refs.editor.pinstance.setPosition(this.cursorLocation); + } + }); + editor.onDidChangeCursorPosition(e => { + if (!this.updatingValue) { + this.cursorLocation = this.$refs.editor.pinstance.getPosition(); + } }); // HACK: if editor is attached to "this" it will freeze the system this.$refs.editor.pinstance = editor; @@ -447,7 +457,9 @@ export default { if (!this.$refs.editor || !this.$refs.editor.pinstance) { return; } - this.$refs.editor.pinstance.setValue(val, monaco.editor.StableMarker); + this.updatingValue = true; + this.$refs.editor.pinstance.setValue(val); + this.updatingValue = false; }, getValue() { return this.$refs.editor.pinstance.getValue(); @@ -507,10 +519,9 @@ export default { this.loadFromCache(); }, value() { - console.log('watch value update'); this.localValue = this.value; if (this.$refs.editor) { - this.$refs.editor.pinstance.value = this.localValue; + this.setValue(this.localValue); } }, navWidth() { diff --git a/packages/CompileTemplate/importVue.ts b/packages/CompileTemplate/importVue.ts index 17aeec5..146c3ec 100644 --- a/packages/CompileTemplate/importVue.ts +++ b/packages/CompileTemplate/importVue.ts @@ -26,6 +26,8 @@ const _createElementBlock = self.dependencies.vue.createElementBlock; const _resolveComponent = self.dependencies.vue.resolveComponent; const _withCtx = self.dependencies.vue.withCtx; const _createBlock = self.dependencies.vue.createBlock; +const _withDirectives = self.dependencies.vue.withDirectives; +const _vModelText = self.dependencies.vue.vModelText; `); const script = compiler.compileScript(blocks.descriptor, { diff --git a/packages/Node/Node.vue b/packages/Node/Node.vue index ccdd391..ba3610b 100644 --- a/packages/Node/Node.vue +++ b/packages/Node/Node.vue @@ -5,7 +5,7 @@ :nodeId="node.id" :hovered="localHoveredNode"/>
+
{{errorMessage}}
@@ -90,6 +92,9 @@ export default { graph: Graph, presentation: Boolean, }, + errorCaptured(err) { + this.mountError(err); + }, watch: { compiledTemplate: { handler: function () { @@ -169,7 +174,8 @@ export default { showSetEditor: false, longLoadingTimer: null, longLoading: false, - loaded: {} as any, + loaded: false, + errorMessage: "", localHoveredNode: null, localSelectedNodes: [], nodeEvents: {}, @@ -201,7 +207,7 @@ export default { }, 500); this.clearErrors(this.localNode.id); await this.importRoot(this.localNode); - this.loaded[this.nodeComponentName] = true; + this.loaded = true; }, methods: { ...mapActions(useOrchestratorStore, [ @@ -213,6 +219,10 @@ export default { "updateNodeData", "clearArtifact", ]), + mountError(err) { + this.broken = true; + this.raiseError(this.localNode.id, err, 'vue'); + }, setLinkedNode(e) { console.log("setLinkedNode", e); }, @@ -279,7 +289,7 @@ export default { }, async importGraph(g) { this.compiledTemplate = await compileTemplate(this, this.nodeComponentName, g.properties.presentationTemplate); - this.loaded[this.nodeComponentName] = true; + this.loaded = true; }, async importNode(v, artifactKey) { v.artifact = this.node.artifact; diff --git a/packages/Node/NodeComponent.vue b/packages/Node/NodeComponent.vue index cf70d46..11d3051 100644 --- a/packages/Node/NodeComponent.vue +++ b/packages/Node/NodeComponent.vue @@ -1,5 +1,5 @@