跳到主要内容

Code (2d)

Code editor component.

Properties

PropertyTypeDescription
codeSimpleSignal<string, this>Code content
languageSimpleSignal<string, this>Programming language
highlighterSignal<any, any, this>Syntax highlighter
selectionSimpleSignal<CodeRange, this>Current selection
fontSizeSimpleSignal<number, this>Font size

Methods

findAllRanges(query: string): CodeRange[]

Finds all matching code ranges.

findFirstRange(query: string): CodeRange | null

Finds the first matching code range.

findLastRange(query: string): CodeRange | null

Finds the last matching code range.

getPointBBox(point: number): BBox

Gets the bounding box of the specified character position.

getSelectionBBox(): BBox

Gets the bounding box of the selection.