UI kit reference
code/editor/useRevealLine
import { … } from 'zidane-ui/code/editor'ui/src/code/editor/useRevealLine.ts
Functions#
useRevealLineFunction#
Scrolls a CodeEditor to reveal, selects its line and, when caret, places the caret there; see the module comment.
function useRevealLine(
editor: RefObject<CodeEditorHandle | null>,
reveal: RevealTarget | null | undefined,
select: (line: number) => void,
caret: boolean,
): voidParameters
| Name | Type | Description |
|---|---|---|
| editor | RefObject<CodeEditorHandle | null> | The editor's handle. |
| reveal | RevealTarget | null | undefined | Where to go, once per nonce. |
| select | (line: number) => void | Selects the line (the owner's selection state). |
| caret | boolean | Whether to place the caret (an editable view). |
Interfaces#
RevealTargetInterface#
A 1-based position to reveal; a new nonce reveals the same one again.
interface RevealTargetProperties
| Name | Type | Description |
|---|---|---|
| column | number | 1-based column where the caret lands. |
| line | number | 1-based line to select and centre. |
| nonce | number | Bump it to reveal the same position again. |