ReferencePackages
@mwillbanks/tuil-editor
Renderer-neutral editor contracts and tree-shakeable terminal editor implementations for tuil.
Overview
Renderer-neutral editor contracts and tree-shakeable terminal editor implementations for tuil.
@mwillbanks/tuil-editor is independently installable and also participates in the
umbrella @mwillbanks/tuil runtime where applicable.
Installation
npm install @mwillbanks/tuil-editorHow it operates
Editor providers own documents, selections, history, composition, clipboard, commands, static output, and buffer, Vim, or rich editing behavior behind one contract.
API
| API | Signature | Description |
|---|---|---|
applyEditorTransactions | function applyEditorTransactions | Public function applyEditorTransactions. |
assertEditorInvariant | function assertEditorInvariant | Public function assertEditorInvariant. |
BuiltInRichNodeType | type BuiltInRichNodeType | Public type BuiltInRichNodeType. |
EditorBackend | interface EditorBackend | Public interface EditorBackend. |
EditorCapability | type EditorCapability | Public type EditorCapability. |
EditorChange | interface EditorChange | Public interface EditorChange. |
EditorCommand | interface EditorCommand | Public interface EditorCommand. |
EditorDecoration | interface EditorDecoration | Public interface EditorDecoration. |
EditorDiagnostic | interface EditorDiagnostic | Public interface EditorDiagnostic. |
EditorDocument | interface EditorDocument | Public interface EditorDocument. |
EditorMode | type EditorMode | Public type EditorMode. |
EditorPosition | interface EditorPosition | Public interface EditorPosition. |
EditorProvider | interface EditorProvider | Public interface EditorProvider. |
EditorProviderFactory | type EditorProviderFactory | Public type EditorProviderFactory. |
EditorProviderOptions | interface EditorProviderOptions | Public interface EditorProviderOptions. |
EditorRange | interface EditorRange | Public interface EditorRange. |
EditorSelection | interface EditorSelection | Public interface EditorSelection. |
EditorSession | interface EditorSession | Public interface EditorSession. |
EditorSnapshot | interface EditorSnapshot | Public interface EditorSnapshot. |
EditorTransaction | interface EditorTransaction | Public interface EditorTransaction. |
insertText | function insertText | Public function insertText. |
RichDocument | interface RichDocument | Public interface RichDocument. |
RichDocumentSession | class RichDocumentSession | Public class RichDocumentSession. |
RichEditorDocument | interface RichEditorDocument | Public interface RichEditorDocument. |
RichEditorProviderOptions | interface RichEditorProviderOptions | Public interface RichEditorProviderOptions. |
RichMark | interface RichMark | Public interface RichMark. |
RichNode | interface RichNode | Public interface RichNode. |
RichNodeProvider | interface RichNodeProvider | Public interface RichNodeProvider. |
RichNodeType | type RichNodeType | Public type RichNodeType. |
RichTransaction | interface RichTransaction | Public interface RichTransaction. |
runEditorProviderConformance | function runEditorProviderConformance | Public function runEditorProviderConformance. |
textBufferProvider | constant textBufferProvider | Public constant textBufferProvider. |
TextBufferSession | class TextBufferSession | Public class TextBufferSession. |
vimEditorProvider | constant vimEditorProvider | Public constant vimEditorProvider. |
VimEditorSession | class VimEditorSession | Public class VimEditorSession. |
VimKeymap | interface VimKeymap | Public interface VimKeymap. |
VimMode | type VimMode | Public type VimMode. |
VimState | interface VimState | Public interface VimState. |
Events and lifecycle
Editors publish typed snapshots and command outcomes through provider-owned subscriptions.
All subscriptions and registrations return a disposer or belong to an owning runtime that disposes them in reverse order.
Example
import { TextBufferSession } from "@mwillbanks/tuil-editor";
import { TextBufferSession } from "@mwillbanks/tuil-editor/buffer";
const editor = new TextBufferSession({ value: "hello" });