如何使摩纳哥差异编辑器的左侧(原始代码)可编辑?

How to make left side (original code) of monaco diff editor editable?

我正在寻找在摩纳哥差异编辑器中编辑左右两侧代码的可能性。

我已经试过了:

var originalModel = monaco.editor.createModel("heLLo world!", "text/plain");
var modifiedModel = monaco.editor.createModel("hello orlando!", "text/plain");

var diffEditor = monaco.editor.createDiffEditor(
  document.getElementById("container"), 
  { readOnly: false }
);

diffEditor.setModel({
    original: originalModel,
    modified: modifiedModel
});

但是那个(只读)选项只影响右侧,默认情况下是可编辑的。

这是一个演示 link: creating-the-diffeditor-hello-diff-world

IDiffEditorOptions中设置originalEditable: true:

var originalModel = monaco.editor.createModel("heLLo world!", "text/plain");
var modifiedModel = monaco.editor.createModel("hello orlando!", "text/plain");

var diffEditor = monaco.editor.createDiffEditor(document.getElementById("container"), {
    originalEditable: true, // for left pane
    readOnly: true,         // for right pane
});
diffEditor.setModel({
    original: originalModel,
    modified: modifiedModel
});