Skip to content

Commit 0cbacc5

Browse files
committed
Synchronize the model and editor
1 parent 470c43c commit 0cbacc5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/utils/monaco-editor/editor.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,13 @@ export function useMonacoEditor(
7070

7171
const mode = ref(mode_ ?? defaultMode);
7272

73-
const { model, source, beforeSetValue, afterSetValue } = useModel(modelOptions);
73+
const {
74+
model,
75+
source,
76+
beforeSetValue,
77+
afterSetValue,
78+
ready: readyModel,
79+
} = useModel(modelOptions);
7480

7581
const editor = shallowRef<Monaco.editor.IStandaloneCodeEditor>();
7682

@@ -116,6 +122,7 @@ export function useMonacoEditor(
116122
async function loadMonaco() {
117123
await useColorThemeOnMonacoEditor();
118124
monaco.value = await import("monaco-editor");
125+
await readyModel;
119126
}
120127

121128
const ready = loadMonaco();

0 commit comments

Comments
 (0)