Skip to content

Commit bbfdf87

Browse files
authored
Revert "Fix: New md file scrolls to Top. (microsoft#164999)" (microsoft#168224) (microsoft#168356)
This reverts commit 54543cf.
1 parent d1b4aa4 commit bbfdf87

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

extensions/markdown-language-features/preview-src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ function doAfterImagesLoaded(cb: () => void) {
5757
}
5858

5959
onceDocumentLoaded(() => {
60-
const scrollTo = !isNaN(state.line) ? state.line : state.scrollProgress;
60+
const scrollProgress = state.scrollProgress;
6161

62-
if (typeof scrollTo === 'number' && !settings.settings.fragment) {
62+
if (typeof scrollProgress === 'number' && !settings.settings.fragment) {
6363
doAfterImagesLoaded(() => {
6464
scrollDisabledCount += 1;
65-
window.scrollTo(0, scrollTo * document.body.clientHeight);
65+
window.scrollTo(0, scrollProgress * document.body.clientHeight);
6666
});
6767
return;
6868
}

extensions/markdown-language-features/src/preview/preview.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -755,8 +755,6 @@ export class DynamicMarkdownPreview extends Disposable implements IManagedMarkdo
755755
default:
756756
return;
757757
}
758-
} else if (!scrollLocation) {
759-
scrollLocation = new StartingScrollLine(0);
760758
}
761759

762760
this._preview.dispose();

0 commit comments

Comments
 (0)