diff options
-rw-r--r-- | subprojects/frontend/src/editor/scrollbarViewPlugin.ts | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/subprojects/frontend/src/editor/scrollbarViewPlugin.ts b/subprojects/frontend/src/editor/scrollbarViewPlugin.ts index 8f165e89..f54251a9 100644 --- a/subprojects/frontend/src/editor/scrollbarViewPlugin.ts +++ b/subprojects/frontend/src/editor/scrollbarViewPlugin.ts | |||
@@ -238,6 +238,8 @@ export default function scrollbarViewPlugin( | |||
238 | 238 | ||
239 | let gutters: Element | undefined; | 239 | let gutters: Element | undefined; |
240 | 240 | ||
241 | let firstRun = true; | ||
242 | let firstRunTimeout: number | undefined; | ||
241 | let requested = false; | 243 | let requested = false; |
242 | let rebuildRequested = false; | 244 | let rebuildRequested = false; |
243 | 245 | ||
@@ -260,7 +262,18 @@ export default function scrollbarViewPlugin( | |||
260 | const { scrollTop, scrollLeft, scrollWidth } = scrollDOM; | 262 | const { scrollTop, scrollLeft, scrollWidth } = scrollDOM; |
261 | const scrollHeight = | 263 | const scrollHeight = |
262 | view.contentHeight + scrollerHeight - view.defaultLineHeight; | 264 | view.contentHeight + scrollerHeight - view.defaultLineHeight; |
263 | spacer.style.minHeight = `${scrollHeight}px`; | 265 | if (firstRun) { |
266 | if (firstRunTimeout !== undefined) { | ||
267 | clearTimeout(firstRunTimeout); | ||
268 | } | ||
269 | // @ts-expect-error `@types/node` typings should not be in effect here. | ||
270 | firstRunTimeout = setTimeout(() => { | ||
271 | spacer.style.minHeight = `${scrollHeight}px`; | ||
272 | firstRun = false; | ||
273 | }, 0); | ||
274 | } else { | ||
275 | spacer.style.minHeight = `${scrollHeight}px`; | ||
276 | } | ||
264 | gutterWidth = gutters?.clientWidth ?? 0; | 277 | gutterWidth = gutters?.clientWidth ?? 0; |
265 | let trackYHeight = scrollerHeight; | 278 | let trackYHeight = scrollerHeight; |
266 | 279 | ||