Reputation: 2846
What is the proper way of setting a Monaco editors text content, without worrying about the undo stack? monacoEditor.setValue("text")
seems to crash somewhere deep inside:
vue.esm.js?efeb:1741 TypeError: (intermediate value)(intermediate value)(intermediate value).create is not a function
at D (textModel.ts:90)
at f.setValue (textModel.ts:385)
at t.setValue (commonCodeEditor.ts:211)
at VueComponent.loadFile (ResourceViewer.vue?d447:85)
Upvotes: 10
Views: 16823
Reputation: 3250
For the future traveler from google, the following code works for 0.2.0, after you have initialized the editor:
editor.getModel().setValue('some value');
Upvotes: 32
Reputation: 2846
The issue turned out that I was not passing in a string, but a JSON object. Testing with "text" did not work either because amdRequire turned out to be asynchronous.
Upvotes: 0