NabuInternals
The engine machinery behind Nabu#internals. Unstable: may change in any version (see docs/guides/extensions.md,
"Stability"). Methods are bound to the editor; their signatures are those of the Nabu methods of the same name.
Unstable This shape may change in any minor version. See nabu.internals.
Related guide: Extensions: Stability →
Definition
import type { NabuInternals } from '@aionbuilders/nabu/extend';interface NabuInternals {
beforeinput: (e: InputEvent) => any;
captureUndoSelection: (source?: 'user' | 'settle') => void;
clearStoredMarks: () => void;
commandConfirm: CommandConfirmation;
content: LoroMap<Record<string, unknown>>;
deleteNode: (nodeId: string) => void;
dispatchEventToSelection: (handlerName: string, e: Event, hookName?: string) => void;
dropAt: (dt: DataTransfer, position: DropPosition, opts?: { source?: { range: DeletionRange } | null }) => void;
dropTarget: DropTarget | null;
fileConfig: FilesConfig;
handleBeforeinput: (e: InputEvent) => void;
handleCompositionEnd: (e: CompositionEvent) => void;
handleCompositionStart: (e: CompositionEvent) => void;
handleCompositionUpdate: (e: CompositionEvent) => void;
handleCopy: (e: ClipboardEvent) => void;
handleCut: (e: ClipboardEvent) => void;
handleDragEnd: (e?: DragEvent) => void;
handleDragLeave: (e: DragEvent) => void;
handleDragOver: (e: DragEvent) => void;
handleDragStart: (e: DragEvent) => void;
handleDrop: (e: DragEvent) => void;
handleKeydown: (e: KeyboardEvent) => void;
handleMousedown: (e: MouseEvent) => void;
handlePaste: (e: ClipboardEvent) => void;
hookOwners: WeakMap<Function, string>;
hooks: Map<string, ((nabu: Nabu, ...args: any[]) => any)[]>;
inputRules: InputRule[];
insertFragment: (fragment: PasteFragment, opts?: { at?: DropPosition }) => void;
noteTextChange: (block: Block) => void;
pasteFileHandlers: PasteFileHandler[];
pasteInterpreters: PasteInterpreter[];
pulse: Pulse<typeof PulseEvent>;
rearmTab: () => void;
sealUndoEnd: () => void;
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';
};
selection.attachRoot: (el: HTMLElement) => () => void;
selection.normalize: () => boolean;
selection.owns: (node: Node | null | undefined) => boolean;
selection.placements: number;
selection.repairAfterRemoval: () => boolean;
selection.root: HTMLElement | null;
selection.scheduleRepair: () => void;
selection.scope: (live?: Selection | null) => 'mine' | 'foreign' | 'outside';
storedMarks: Record<string, boolean> | null;
tabDescription: string | undefined;
toggleStoredMark: (name: string) => void;
undoManager: UndoManager;
updateRoots: (retyped?: Set<string>) => void;
}Properties
| Property | Type | Description |
|---|---|---|
beforeinput | (e: InputEvent) => any | n/a |
captureUndoSelection | (source?: 'user' | 'settle') => void | Remember the selection for the undo step now being recorded. |
clearStoredMarks | () => void | n/a |
commandConfirm | CommandConfirmation | The confirmation controller of commands (hold / invite / choose): |
content | LoroMap<Record<string, unknown>> | The free-form |
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 |
dropTarget | DropTarget | null | The drop indicator being shown (reactive). |
fileConfig | FilesConfig | The resolved |
handleBeforeinput | (e: InputEvent) => void | n/a |
handleCompositionEnd | (e: CompositionEvent) => void | n/a |
handleCompositionStart | (e: CompositionEvent) => void | n/a |
handleCompositionUpdate | (e: CompositionEvent) => void | n/a |
handleCopy | (e: ClipboardEvent) => void | Write the selection to a clipboard (every format). |
handleCut | (e: ClipboardEvent) => void | n/a |
handleDragEnd | (e?: DragEvent) => void | n/a |
handleDragLeave | (e: DragEvent) => void | n/a |
handleDragOver | (e: DragEvent) => void | n/a |
handleDragStart | (e: DragEvent) => void | n/a |
handleDrop | (e: DragEvent) => void | n/a |
handleKeydown | (e: KeyboardEvent) => void | The keydown pipeline (commands first, then hooks, then the block). |
handleMousedown | (e: MouseEvent) => void | n/a |
handlePaste | (e: ClipboardEvent) => void | The paste pipeline (interpreters, files, |
hookOwners | WeakMap<Function, string> | Hook function to the name of the extension that registered it. |
hooks | Map<string, ((nabu: Nabu, ...args: any[]) => any)[]> | Extension hooks by name, in registration order (the normalizers of |
inputRules | InputRule[] | The input rules collected from the extensions. |
insertFragment | (fragment: PasteFragment, opts?: { at?: DropPosition }) => void | Insert a |
noteTextChange | (block: Block) => void | n/a |
pasteFileHandlers | PasteFileHandler[] | The paste file handlers, by priority. |
pasteInterpreters | PasteInterpreter[] | The paste interpreters collected from the extensions. |
pulse | Pulse<typeof PulseEvent> | The action bus behind |
rearmTab | () => void | n/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: |
selection.attachRoot | (el: HTMLElement) => () => void | n/a |
selection.normalize | () => boolean | n/a |
selection.owns | (node: Node | null | undefined) => boolean | n/a |
selection.placements | number | n/a |
selection.repairAfterRemoval | () => boolean | n/a |
selection.root | HTMLElement | null | n/a |
selection.scheduleRepair | () => void | n/a |
selection.scope | (live?: Selection | null) => 'mine' | 'foreign' | 'outside' | n/a |
storedMarks | Record<string, boolean> | null | Pending inline marks for the next typed character (reactive; assignable). |
tabDescription | string | undefined | The |
toggleStoredMark | (name: string) => void | n/a |
undoManager | UndoManager | The Loro undo manager (undo steps, merge window). |
updateRoots | (retyped?: Set<string>) => void | Re-read the root blocks from the tree. |
Source: src/lib/blocks/nabu.svelte.js:108