Fix scrolling of markdown preview. Close #65504 (#111094)

* Fix scrolling of markdown preview.

* Use scrollDisabledCount.

* Stop initializing scrollDisabledCount.

* Make scrollTo enough large to occur scroll events.

* Should resolve when the error event occurs.
This commit is contained in:
Takashi Tamura
2021-01-15 10:24:08 +09:00
committed by GitHub
parent 64496f8219
commit a34e751b01
2 changed files with 32 additions and 11 deletions

View File

@@ -143,6 +143,7 @@ export function scrollToRevealSourceLine(line: number) {
const progressInElement = line - Math.floor(line);
scrollTo = previousTop + (rect.height * progressInElement);
}
scrollTo = Math.abs(scrollTo) < 1 ? Math.sign(scrollTo) : scrollTo;
window.scroll(window.scrollX, Math.max(1, window.scrollY + scrollTo));
}