Trevixal API
    Preparing search index...

    Class EditorView

    Index
    dom: HTMLElement
    editor: Editor
    renderer: DOMRenderer

    Advanced API: the renderer's DOM↔model mapping, used by adapters.

    • get currentHighlights(): readonly SearchMatch[]

      Returns readonly SearchMatch[]

    • get isEditable(): boolean

      Returns boolean

    • get spellcheck(): boolean

      Whether the surface is spell checked; the browser default until set.

      Returns boolean

    • Intercept keydown before the keymap runs; return true to consume the event (suggestion popups take Enter/Arrows while open). Returns a disposer.

      Parameters

      • interceptor: (event: KeyboardEvent) => boolean

      Returns () => void

    • Returns void

    • Give the surface keyboard focus without moving the page.

      A bare HTMLElement.focus() scrolls the caret into view, and the caret can be thousands of pixels from whatever the reader is actually looking at. Every caller of this method is handing focus back after a piece of chrome took it (a menu, the command palette, a dialog) and none of them means "take me to the caret": the page simply jumped. So focus moves and the viewport does not. To deliberately reveal the caret, which is a different intention, call scrollSelectionIntoView.

      Returns void

    • Scroll the caret into view, the least the scrollers involved allow.

      The counterpart to focus: navigation (an outline entry, a search hit) means to move the reader, so it says so rather than relying on a side effect of focusing.

      Parameters

      • options: ScrollIntoViewOptions = ...

      Returns void

    • Install (or clear, with null) an independent decoration layer. Extensions each own a key: code highlighting, search matches and track-change ranges compose without clobbering one another.

      Parameters

      Returns void

    • Toggle read-only mode.

      Parameters

      • editable: boolean

      Returns void

    • Highlight inline ranges (find & replace matches) as decorations, never stored in the document. Pass an empty array to clear.

      Parameters

      Returns void

    • Turn the browser's spell checking of the surface on or off. Set as the content attribute rather than the IDL property, so it survives a DOM that does not reflect spellcheck (and shows up in the markup for tests).

      Switching it off is enough on its own. The browser drops the marks it has already drawn. Switching it back on is not: the text is not new to the spell checker, so nothing is re-scanned and the surface stays unmarked until the next edit happens to touch a block. refreshTextNodes below is what makes it look new.

      Parameters

      • enabled: boolean

      Returns void

    • Pull the browser selection into the model. selectionchange is asynchronous, so anything acting outside the input pipeline, a toolbar button, which suppresses focus changes, must call this first to avoid operating on a stale selection.

      Returns void

    • Re-render from the editor state and push the selection into the DOM.

      Returns void