简体   繁体   English

摩纳哥编辑器中的选项卡

[英]Tabs in Monaco Editor

How do I make tabs in the Monaco editor like Visual Studio Code?如何在 Visual Studio Code 等 Monaco 编辑器中制作选项卡? For example, this is what I mean.例如,这就是我的意思。 在此处输入图片说明

There is a quite good explanation on monaco-editor GitHub . monaco-editor GitHub上有很好的解释。

The tab is just a visual representation of Radio Button or Simple Button for example, where you have to subscribe onChange event.例如,该选项卡只是 Radio Button 或 Simple Button 的可视化表示,您必须在其中订阅 onChange 事件。 In the event handler, you have to update the model and view state, eg switching between foo.js & foo1.js files.在事件处理程序中,您必须更新模型和视图状态,例如在 foo.js 和 foo1.js 文件之间切换。

editor.setModel(data[desiredModelId].model);
editor.restoreViewState(data[desiredModelId].state);

I had the requirement for Monaco editor with tabs and built this project which you can use as the license is MIT:我需要带有选项卡的摩纳哥编辑器并构建了这个项目,您可以使用该项目,因为许可证是 MIT:

https://github.com/bootrino/reactoxide https://github.com/bootrino/reactoxide

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

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