mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-09-01 19:49:54 +02:00
editor: keep the scroll steady with the pin alone
This commit is contained in:
@@ -278,7 +278,10 @@ export function viewportPlugin(heights: HeightMap): Plugin<ViewportState> {
|
||||
const resolved = findScrollParent(editorView.dom);
|
||||
if (!resolved || resolved === scrollParent) return;
|
||||
scrollParent?.removeEventListener("scroll", schedule);
|
||||
resolved.style.overflowAnchor = "auto";
|
||||
// The browser's own scroll anchoring compensates for the same height
|
||||
// changes the pin does, and the two corrections add up to twice the
|
||||
// shift. The pin is the one that knows which page to hold on to.
|
||||
resolved.style.overflowAnchor = "none";
|
||||
resolved.addEventListener("scroll", schedule, { passive: true });
|
||||
scrollParent = resolved;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user