fix editor data component refresh and transition update loop
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, onBeforeUnmount, nextTick } from 'vue';
|
||||
import { ref, onMounted, onBeforeUnmount, nextTick, watch } from 'vue';
|
||||
import * as monaco from 'monaco-editor';
|
||||
import EditorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker';
|
||||
import JsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker';
|
||||
@@ -74,6 +74,17 @@ onBeforeUnmount(() => {
|
||||
}
|
||||
});
|
||||
|
||||
watch(
|
||||
() => props.source,
|
||||
value => {
|
||||
if (!editor) return;
|
||||
const currentValue = editor.getValue();
|
||||
if (value !== currentValue) {
|
||||
editor.setValue(value);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
async function initMonaco() {
|
||||
monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
|
||||
noSemanticValidation: false,
|
||||
|
||||
Reference in New Issue
Block a user