mirror of
https://github.com/livebook-dev/livebook.git
synced 2024-09-20 01:55:56 +08:00
Improve go-to-definition scroll to position the cursor near the viewport top
This commit is contained in:
parent
2468fa3397
commit
7430843c9b
|
@ -365,11 +365,16 @@ const Cell = {
|
|||
scrollEditorCursorIntoViewIfNeeded() {
|
||||
const element = this.currentEditor().getElementAtCursor();
|
||||
|
||||
// Scroll to the cursor, positioning it near the top of the viewport
|
||||
element.style.scrollMarginTop = "128px";
|
||||
|
||||
scrollIntoView(element, {
|
||||
scrollMode: "if-needed",
|
||||
behavior: "instant",
|
||||
block: "center",
|
||||
block: "start",
|
||||
});
|
||||
|
||||
element.style.scrollMarginTop = undefined;
|
||||
},
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue