蒙纳科编辑器是否支持分割窗格?

12

在Monaco编辑器中是否可以获得分割窗格?类似于VSCode中所做的或Monaco自身提供的差异编辑器中使用的内容。

1个回答

8
你需要像共享文件一样分享模型给编辑人员,例如:
const ed1 = monaco.editor.create(document.getElementById("container1"), {
    value: "function hello() {\n\talert('Hello world!');\n}",
    language: "javascript"
})
const model = ed1.getModel()

monaco.editor.create(document.getElementById("container2"), {
    model,
})

<div id="container1" style="height:50%;"></div>
<div id="container2" style="height:50%;"></div>

您可以在代码测试平台中测试该代码,https://microsoft.github.io/monaco-editor/playground.html

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接