EditorView
Unofficial
Import:
import type { EditorView } from '@codemirror/view';Signature:
export interface EditorViewProperties
| Property | Type | Description | |
|---|---|---|---|
| cm? | VimEditor | The Vim editor instance attached to this view, if Vim mode is enabled. | |
| viewState | EditorViewState | Internal view state tracking properties like printing mode. |
Methods
| Method | Returns | Description | |
|---|---|---|---|
| bidiSpans(line) | readonly BidiSpan[] | Returns the bidirectional text structure of the given line. | |
| coordsAtPos(pos, side?) | null | Rect | Get the screen coordinates at the given document position. | |
| coordsForChar(pos) | null | Rect | Return the rectangle around a given character. | |
| destroy() | void | Clean up this editor view. | |
| dispatch(tr) | void | All regular editor state updates should go through this. | |
| dispatch(trs) | void | Dispatch an array of transactions. | |
| dispatch(specs?) | void | Dispatch one or more transaction specs. | |
| domAtPos(pos) | EditorViewDomPosition | Find the DOM parent node and offset at the given document position. | |
| elementAtHeight(height) | BlockInfo | Find the text line or block widget at the given vertical position. | |
| focus() | void | Put focus on the editor. | |
| lineBlockAt(pos) | BlockInfo | Find the line block around the given document position. | |
| lineBlockAtHeight(height) | BlockInfo | Find the line block at the given height. | |
| measure() | void | Request a layout measurement pass on the editor. | |
| moveByChar(start, forward, by?) | SelectionRange | Move a cursor position by grapheme cluster. | |
| moveByGroup(start, forward) | SelectionRange | Move a cursor position across the next group of letters or non-letter non-whitespace characters. | |
| moveToLineBoundary(start, forward, includeWrap?) | SelectionRange | Move to the next line boundary in the given direction. | |
| moveVertically(start, forward, distance?) | SelectionRange | Move a cursor position vertically. | |
| plugin(plugin) | null | T | Get the value of a specific plugin, if present. | |
| posAtCoords(coords) | null | number | Get the document position at the given screen coordinates. Returns null if not found. | |
| posAtCoords(coords, precise) | number | Get the document position at the given screen coordinates with imprecise mode. | |
| posAtDOM(node, offset?) | number | Find the document position at the given DOM node. | |
| requestMeasure(request?) | void | Schedule a layout measurement, optionally providing callbacks to do custom DOM measuring followed by a DOM write phase. | |
| scrollSnapshot() | StateEffect<unknown> | Return an effect that resets the editor to its current scroll position. | |
| setRoot(root) | void | Update the root in which the editor lives. | |
| setState(newState) | void | Reset the view to the given state. | |
| setTabFocusMode(to?) | void | Enable or disable tab-focus mode. | |
| textDirectionAt(pos) | Direction | Find the text direction of the block at the given position. | |
| update(transactions) | void | Update the view for the given array of transactions. | |
| visualLineSide(line, end) | SelectionRange | Get the cursor position visually at the start or end of a line. |
Links to this page: