簡體   English   中英

在摩納哥編輯器中滾動到一行

[英]Scroll to line in Monaco editor

我看到有一種方法可以在摩納哥編輯器中設置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});

我只想補充一點,如果你想滾動到最后一行,你可以使用

editor.revealLine(editor.getModel().getLineCount())

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM