是否可以在 Monaco Editor 中获得拆分 Pane ?类似于 VSCode 中所做的或摩纳哥本身提供的 Diff Editor 中使用的内容。
最佳答案
您必须在像这样的编辑器之间共享模型
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 中测试该代码
关于monaco-editor - 是否可以在 Monaco Editor 中使用拆分 Pane ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46779773/