فهرست منبع

[editor] Use the snippet ID as editor ID with the AceEditor component

Johan Ahlen 5 سال پیش
والد
کامیت
1d86938ff8

+ 1 - 1
desktop/core/src/desktop/js/apps/notebook2/components/aceEditor/AceEditor.vue

@@ -46,7 +46,7 @@
   export default class AceEditor extends Vue {
     @Prop()
     value!: string;
-    @Prop({ default: UUID() })
+    @Prop()
     id!: string;
     @Prop()
     executor!: Executor;

+ 2 - 2
desktop/core/src/desktop/js/apps/notebook2/components/aceEditor/AceEditorKoBridge.vue

@@ -17,8 +17,8 @@
 -->
 
 <template>
-  <div v-if="initialized">
-    <ace-editor :executor="executor" :ace-options="aceOptions" @ace-created="aceCreated" />
+  <div v-if="initialized && editorId">
+    <ace-editor :id="editorId" :executor="executor" :ace-options="aceOptions" @ace-created="aceCreated" />
   </div>
 </template>
 

+ 1 - 1
desktop/core/src/desktop/js/apps/notebook2/snippet.js

@@ -366,7 +366,7 @@ export default class Snippet {
     huePubSub.subscribe(
       ACTIVE_STATEMENT_CHANGED_EVENT,
       statementDetails => {
-        if (this.ace() && this.ace().container.id === statementDetails.id) {
+        if (this.id() === statementDetails.id) {
           for (let i = statementDetails.precedingStatements.length - 1; i >= 0; i--) {
             if (statementDetails.precedingStatements[i].database) {
               this.availableDatabases().some(availableDatabase => {