1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-07-17 03:51:13 +02:00

Codeeditor: run code on editor initialize

This commit is contained in:
Kushagra Gour
2019-01-17 20:09:42 +05:30
parent 31e401d185
commit 9a1f1cca87

View File

@@ -156,10 +156,12 @@ export default class CodeEditor extends Component {
if (!window.monaco) return;
if (this.props.type === 'monaco') {
monaco.editor.setModelLanguage(
this.instance.getModel(),
this.getMonacoLanguageFromMode(modes[value].cmMode)
);
this.monacoEditorReadyDeferred.promise.then(() => {
monaco.editor.setModelLanguage(
this.instance.getModel(),
this.getMonacoLanguageFromMode(modes[value].cmMode)
);
});
} else {
this.instance.setOption('mode', modes[value].cmMode);
CodeMirror.autoLoadMode(