我看到有一种方法可以在摩纳哥编辑器中设置scrolltop.如何滚动到特定行而不是特定像素?
解决方法:
如在文档中:https://microsoft.github.io/monaco-editor/api/interfaces/monaco.editor.icodeeditor.html
滚动到顶部,在px中:
editor.setScrollPosition({scrollTop: 0});
滚动到特定行:
editor.revealLine(15);
滚动到特定行,使其在编辑器的中心结束:
editor.revealLineInCenter(15);
移动当前活动行:
editor.setPosition({column: 1, lineNumber: 3});