Replies: 5 comments
-
i have the same question on vue3.x |
Beta Was this translation helpful? Give feedback.
-
I have solved this problem, here is my solution: Don’t let your editor instance be a reactive variable, but as an ordinary variable change
to
|
Beta Was this translation helpful? Give feedback.
-
you solved my problem, thank you very much |
Beta Was this translation helpful? Give feedback.
-
@Month7 I don't think that works for my use case, since the editor must be converted to a proxy to be shared between Vue blocks (e.g. between setup, mounted, and methods), or to be shared with other Vue components. However, I found a hack that seems to work, // Vue stuff
data(component) {
return {
editor: null as editor.IStandaloneCodeEditor | null,
};
},
mounted() {
const editor = monaco.editor.create(element, {});
this.editor = Object.freeze(editor);
console.log(this.editor.getValue()); // Prints correctly.
}
// More Vue stuff |
Beta Was this translation helpful? Give feedback.
-
Note: I ran into the same issue again, this time with context keys. Also fixed with freeze. this.editor = Object.freeze(monaco.editor.create(element, {}));
this.contextKey = Object.freeze(this.editor.createContextKey('myContextKey', false));
this.contextKey.set(true); |
Beta Was this translation helpful? Give feedback.
-
monaco-editor version: 0.29.1
Browser: chrome
OS:
Playground code that reproduces the issue:
this step
Beta Was this translation helpful? Give feedback.
All reactions