Overview

The View component handles what is related with the viewport, such as the editor dimensions and scrolling.

Properties

lines

get

Returns the latest Lines instance. This is an alias of Code#Lines.


i18n

get

Returns the i18n collection. This is an alias of this.options.i18n.


emitResize

readonly emitResize: Throttle<() => void>

Emits the resize event with reducing frequency by the animation frame.

Methods

jump()

jump( row: number, middle?: boolean, lineOffset: number ): void

Jumps to the specified row if it's not visible in the scroller. If the middle is true, this method try to vertically center the target line.

Params

row

A row index to jump to.

middle

Optional. Determines whether to jump to the middle of the viewport or not.

lineOffset

Optional. A number of lines to offset.


autoWidth()

autoWidth(): void

Adjusts the width of the container element so that it can contain the longest line in the chunk.


autoHeight()

autoHeight( skipLengthCheck?: boolean ): void

Adjusts the height of the container element so that it can contain all lines. It won't be smaller than the scroller element when the editor has explicit height.

Params

skipLengthCheck

Optional. Whether to skip checking the number of lines or not.


isVisible()

isVisible( row: number, lineOffset: number ): boolean

Checks if the specified row is visible in the scroller or not.

Params

row

A row index to check.

lineOffset

Optional. A number of lines to offset top and bottom borders.

Return

true if the row is in the scroller viewport, or otherwise false.