|
@@ -8,7 +8,7 @@ import $i from '../../scripts/i18n.js'
|
|
|
import { CommandsRegistry } from 'monaco-editor/esm/vs/platform/commands/common/commands'
|
|
|
import { KeybindingsRegistry } from 'monaco-editor/esm/vs/platform/keybinding/common/keybindingsRegistry.js'
|
|
|
import { ContextKeyExpr } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js'
|
|
|
-import { nextTick } from 'vue'
|
|
|
+import { nextTick, watch } from 'vue'
|
|
|
export default {
|
|
|
props: {
|
|
|
language: { type: String, required: true },
|
|
@@ -45,6 +45,9 @@ export default {
|
|
|
value: this.value || '',
|
|
|
automaticLayout: true
|
|
|
})
|
|
|
+ watch(() => this.language, () => {
|
|
|
+ nextTick(() => this.instance.setModel(monaco.editor.createModel(this.instance.getModel().getValue(), this.language)))
|
|
|
+ })
|
|
|
this.instance.onDidChangeModelContent((e) => {
|
|
|
this.$emit('update:value', this.instance.getValue())
|
|
|
this.$emit('change')
|