API / Nabu

nabu.internals

Stability: unstable

Unstable: may change in any minor version

Nothing reached through nabu.internals is a promise. A key, its type or its behaviour can change, move or disappear in any minor version. The door itself (the getter) is part of the stable contract; what is behind it is not.

Prefer the stable members of Nabu, Block and the other classes of the contract. If you must use this, pin the version of the package.

Related guide: Extensions: Stability →

Access

TypeScript
get internals(): NabuInternals

The door itself is part of the stable contract; @unstable is everything behind it: nothing reached through internals is a promise, it may change, move or disappear in ANY minor version. Prefer the stable members; use this when you must, and pin the version of the package. The set of keys is frozen by a test, so a change shows up in the changelog.

Keys 48

The set of keys is pinned by a test, so a change always shows in the changelog. Types: see NabuInternals.

Keys of nabu.internals
KeyTypeDescription
beforeinput(e: InputEvent) => anyn/a
captureUndoSelection(source?: 'user' | 'settle') => void

Remember the selection for the undo step now being recorded.

clearStoredMarks() => voidn/a
commandConfirmCommandConfirmation

The confirmation controller of commands (hold / invite / choose): start, stop, offer, choose, cancel, pending.

contentLoroMap<Record<string, unknown>>

The free-form content map of the document.

deleteNode(nodeId: string) => void

Delete a block by node id (no commit).

dispatchEventToSelection(handlerName: string, e: Event, hookName?: string) => void

Route a native event to the block that holds the selection.

dropAt(dt: DataTransfer, position: DropPosition, opts?: { source?: { range: DeletionRange } | null }) => void

Drop a DataTransfer at a position, as the drag and drop does.

dropTargetDropTarget | null

The drop indicator being shown (reactive).

fileConfigFilesConfig

The resolved files option.

handleBeforeinput(e: InputEvent) => voidn/a
handleCompositionEnd(e: CompositionEvent) => voidn/a
handleCompositionStart(e: CompositionEvent) => voidn/a
handleCompositionUpdate(e: CompositionEvent) => voidn/a
handleCopy(e: ClipboardEvent) => void

Write the selection to a clipboard (every format).

handleCut(e: ClipboardEvent) => voidn/a
handleDragEnd(e?: DragEvent) => voidn/a
handleDragLeave(e: DragEvent) => voidn/a
handleDragOver(e: DragEvent) => voidn/a
handleDragStart(e: DragEvent) => voidn/a
handleDrop(e: DragEvent) => voidn/a
handleKeydown(e: KeyboardEvent) => void

The keydown pipeline (commands first, then hooks, then the block).

handleMousedown(e: MouseEvent) => voidn/a
handlePaste(e: ClipboardEvent) => void

The paste pipeline (interpreters, files, acceptPaste).

hookOwnersWeakMap<Function, string>

Hook function to the name of the extension that registered it.

hooksMap<string, ((nabu: Nabu, ...args: any[]) => any)[]>

Extension hooks by name, in registration order (the normalizers of onBeforeTransaction, the onBeforeInput handlers...).

inputRulesInputRule[]

The input rules collected from the extensions.

insertFragment(fragment: PasteFragment, opts?: { at?: DropPosition }) => void

Insert a PasteFragment at the selection (what a paste does after interpreting).

noteTextChange(block: Block) => voidn/a
pasteFileHandlersPasteFileHandler[]

The paste file handlers, by priority.

pasteInterpretersPasteInterpreter[]

The paste interpreters collected from the extensions.

pulsePulse<typeof PulseEvent>

The action bus behind exec(): pulse.on(topic, handler) observes or adds a topic at runtime.

rearmTab() => voidn/a
sealUndoEnd() => void

Close the "where did the last action end" mark of the undo history.

selection{ attachRoot: (el: HTMLElement) => () => void; normalize: () => boolean; owns: (node: Node | null | undefined) => boolean; placements: number; repairAfterRemoval: () => boolean; root: HTMLElement | null; scheduleRepair: () => void; scope: (live?: Selection | null) => 'mine' | 'foreign' | 'outside'; }

The selection's own repair machinery, and the engine's root element: attachRoot(el) (what Nabu.svelte calls on mount, it returns the detach function), root, owns(node) (inside MY root, not in a nested editor) and scope() ('mine' | 'outside' | 'foreign': whose business the live DOM selection is).

selection.attachRoot(el: HTMLElement) => () => voidn/a
selection.normalize() => booleann/a
selection.owns(node: Node | null | undefined) => booleann/a
selection.placementsnumbern/a
selection.repairAfterRemoval() => booleann/a
selection.rootHTMLElement | nulln/a
selection.scheduleRepair() => voidn/a
selection.scope(live?: Selection | null) => 'mine' | 'foreign' | 'outside'n/a
storedMarksRecord<string, boolean> | null

Pending inline marks for the next typed character (reactive; assignable).

tabDescriptionstring | undefined

The aria-description the root carries while tab traps the focus.

toggleStoredMark(name: string) => voidn/a
undoManagerUndoManager

The Loro undo manager (undo steps, merge window).

updateRoots(retyped?: Set<string>) => void

Re-read the root blocks from the tree.