mirror of
https://github.com/laurent22/joplin.git
synced 2026-06-18 20:16:34 +02:00
This commit is contained in:
1 parent
a4854fcde8
commit
f87ff54e3d
1 file changed
+7
-2
@@ -70,8 +70,13 @@ export function useScrollHandler(editorRef: any, webviewRef: any, onScroll: Func
|
|||||||
|
|
||||||
if (editorRef.current) {
|
if (editorRef.current) {
|
||||||
const percent = editorRef.current.getScrollPercent();
|
const percent = editorRef.current.getScrollPercent();
|
||||||
|
if (!isNaN(percent)) {
|
||||||
setViewerPercentScroll(percent);
|
// when switching to another note, the percent can sometimes be NaN
|
||||||
|
// this is coming from `gui/NoteEditor/NoteBody/CodeMirror/utils/useScrollUtils.ts`
|
||||||
|
// when CodeMirror returns scroll info with heigth == clientHeigth
|
||||||
|
// https://github.com/laurent22/joplin/issues/4797
|
||||||
|
setViewerPercentScroll(percent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, [setViewerPercentScroll]);
|
}, [setViewerPercentScroll]);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user