mirror of
https://github.com/chinchang/web-maker.git
synced 2025-07-17 20:11:12 +02:00
Codeeditor: run code on editor initialize
This commit is contained in:
@@ -156,10 +156,12 @@ export default class CodeEditor extends Component {
|
|||||||
if (!window.monaco) return;
|
if (!window.monaco) return;
|
||||||
|
|
||||||
if (this.props.type === 'monaco') {
|
if (this.props.type === 'monaco') {
|
||||||
monaco.editor.setModelLanguage(
|
this.monacoEditorReadyDeferred.promise.then(() => {
|
||||||
this.instance.getModel(),
|
monaco.editor.setModelLanguage(
|
||||||
this.getMonacoLanguageFromMode(modes[value].cmMode)
|
this.instance.getModel(),
|
||||||
);
|
this.getMonacoLanguageFromMode(modes[value].cmMode)
|
||||||
|
);
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
this.instance.setOption('mode', modes[value].cmMode);
|
this.instance.setOption('mode', modes[value].cmMode);
|
||||||
CodeMirror.autoLoadMode(
|
CodeMirror.autoLoadMode(
|
||||||
|
Reference in New Issue
Block a user