小编pla*_*box的帖子

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

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

我已经尝试过这个:

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
});
Run Code Online (Sandbox Code Playgroud)

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

这是一个演示链接: create-the-diffeditor-hello-diff-world

diff monaco-editor

4
推荐指数
1
解决办法
2554
查看次数

标签 统计

diff ×1

monaco-editor ×1