-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
way to implement tabs #604
Comments
After monaco.editor.create, you will get a instance as a moncao editor. code example like this: this.editor = monaco.editor.create(this.node, {
value: value,
language: 'json'
});
this.editor.onDidChangeModelContent(evt => {
const value = this.editor.getValue();
console.log(value);
}); |
@linhuiw I'm not quite understand what you mean. I'll take a example. // tab A
alert('I am tab A'); // tab B
alert('I am tab B'); change code to // tab A
alert('I am new tab A'); then switch to tab |
@troy351 yes, you may need to create multiple editor instance for multi editor in different tab. |
@linhuiw I'm concern about the memory problem when there are lots of tabs. |
@troy351 I think multi instance may be the right choice; |
To implement tabs, the recommended way is:
e.g. the code of the playground -- https://github.com/Microsoft/monaco-editor/blob/bad3c34056624dca34ac8be5028ae3454172125c/website/playground/playground.js#L108 |
@alexandrudima works pretty well |
monaco-editor version: 0.10.1
Browser: Chrome 61
OS: Windows 10
Steps or JS usage snippet reproducing the issue:
I am building a multi-tab code editor with one monaco-editor instance and using
setValue
to switch code between tabs.And I want each tab has its own undo stack.
What should I do?
The text was updated successfully, but these errors were encountered: