我想即时更新摩纳哥编辑器主题,但我发现它不起作用:
this.editorOptions = {
...this.editorOptions,
readOnly: true, // this.readOnly,
value: this.code,
language: 'java',
theme: 'vs'
};
this.currentEditor.updateOptions(this.editorOptions);
如果我更改只读,它工作正常,但主题根本没有更新。
创建逻辑是这样的:
this.editorOptions = {
...this.editorOptions,
readOnly: this.readOnly,
value: this.code,
language: this.updatedType.toLowerCase(),
//theme: 'vs-dark'
theme: t === 'light' ? 'dv-light-theme' : 'dv-dark-theme'
};
this.currentEditor = monaco.editor.create(this._editorContainer.nativeElement, this.editorOptions);
请帮助并展示如何动态更新主题。