简体   繁体   English

如何将monaco编辑器从只读设置为可写?

[英]How do you set monaco-editor from readonly to writeable?

In my code I created an editor like so: 在我的代码中,我创建了一个编辑器,如下所示:

this.monacoEditor = monaco.editor
  .create(
    document.getElementById('ide'), {
      model: null,
      readOnly: true,
      contextmenu: false,
    }
  );

So now that editor is readonly. 因此,该编辑器现在是只读的。 How would I change this.monacoEditor to be writable/editable? 我如何将this.monacoEditor更改为可写/可编辑?

I figured it out. 我想到了。 In the context of the code above: 在以上代码的上下文中:

this.monacoEditor.updateOptions({readOnly: false});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM