Skip to content

Commit

Permalink
update monaco language on change
Browse files Browse the repository at this point in the history
  • Loading branch information
madeindjs committed Jan 10, 2025
1 parent 45a7951 commit dd3d23e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ui/src/builder/BuilderEmbeddedCodeEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const props = defineProps<{
disabled?: boolean;
}>();
const { modelValue, disabled } = toRefs(props);
const { modelValue, disabled, language } = toRefs(props);
const emit = defineEmits(["update:modelValue"]);
const VARIANTS_SETTINGS: Record<
Expand Down Expand Up @@ -55,6 +55,10 @@ watch(modelValue, (newCode) => {
editor.getModel().setValue(newCode);
});
watch(language, () => {
monaco.editor.setModelLanguage(editor.getModel(), language.value);
});
onMounted(() => {
editor = monaco.editor.create(editorContainerEl.value, {
value: modelValue.value,
Expand Down

0 comments on commit dd3d23e

Please sign in to comment.