Scroll

Scroll position and scroll-into-view for the editor.

Access:

app.scroll
app.getModule('scroll')
app.invoke('scroll.method', …)

isTarget#

Returns whether a custom scroll target is configured.

Returns: boolean

app.scroll.isTarget();

getTarget#

Returns current scroll target element or window.

Returns: HTMLElement|Window

app.scroll.getTarget();

setTarget#

Sets scroll target and emits scroll:target.

Parameters:

  • target (string) — scroll target selector or element
app.scroll.setTarget('.scroll-container');

resetTarget#

Restores previously reserved scroll target.

app.scroll.resetTarget();

getStickyViewportRect#

Returns viewport rect for sticky positioning relative to scroll target.

Returns: { top, left, right, bottom }

app.scroll.getStickyViewportRect();

getStickyTopOffset#

Returns top offset for sticky UI including scroll target position.

Parameters:

  • baseOffset (number) — base character offset to measure from

Returns: number

app.scroll.getStickyTopOffset(8);

getStickyBottomOffset#

Returns bottom offset gap between viewport and scroll target.

Returns: number

app.scroll.getStickyBottomOffset();