Skip to content

Commit

Permalink
watch for language changes and update the snippet editor
Browse files Browse the repository at this point in the history
  • Loading branch information
sadnub committed Oct 29, 2023
1 parent 7dc2f5a commit 021a066
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/scripts/ScriptSnippetFormModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@

<script setup lang="ts">
// composable imports
import { ref, reactive, computed } from "vue";
import { ref, watch, reactive, computed } from "vue";
import { useStore } from "vuex";
import { useQuasar } from "quasar";
import { generateScript } from "@/api/core";
Expand Down Expand Up @@ -193,6 +193,11 @@ function loadEditor() {
editor.onDidChangeModelContent(() => {
snippet.code = editor.getValue();
});
// watch for changes in language
watch(lang, () => {
monaco.editor.setModelLanguage(model, lang.value);
});
}
function unloadEditor() {
Expand Down

0 comments on commit 021a066

Please sign in to comment.