Skip to content

Commit 25ef456

Browse files
hikerpigRokt33r
authored andcommitted
feat: should scroll to top after selecting another note, also fix #3023
1 parent 084deca commit 25ef456

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

browser/components/MarkdownPreview.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,11 @@ export default class MarkdownPreview extends React.Component {
591591
if (needsRewriteIframe) {
592592
this.rewriteIframe()
593593
}
594+
595+
// Should scroll to top after selecting another note
596+
if (prevProps.noteKey !== this.props.noteKey) {
597+
this.getWindow().scrollTo(0, 0)
598+
}
594599
}
595600

596601
getStyleParams () {
@@ -962,8 +967,6 @@ export default class MarkdownPreview extends React.Component {
962967
overlay.appendChild(zoomImg)
963968
document.body.appendChild(overlay)
964969
}
965-
966-
this.getWindow().scrollTo(0, 0)
967970
}
968971

969972
focus () {

0 commit comments

Comments
 (0)