ExtensionInit
What an extension is made of: a block class and its component, hooks, serializers, actions, commands, paste interpreters and
file handlers, input rules, slash menu entries and Loro text styles. Every field is optional; pass it to extension(name, init).
Related guide: Extensions →
Definition
import type { ExtensionInit } from '@aionbuilders/nabu/extend';interface ExtensionInit {
actions?: Record<string, (nabu: Nabu, data: any, topic: string) => any>;
block?: typeof Block;
commandContext?: (nabu: Nabu, ctx: CommandContext) => void | Record<string, any>;
commands?: Record<string, CommandDef>;
component?: Component<any, any, string>;
defaultBlock?: boolean;
hooks?: Partial<ExtensionHooks>;
inputRules?: InputRule[];
loroTextStyles?: Record<string, { expand: 'none' | 'after' | 'before' | 'both' }>;
name?: string;
pasteFileHandlers?: PasteFileHandler[];
pasteInterpreters?: PasteInterpreter[];
serializers?: Record<string, (nabu: Nabu) => any>;
slashCommands?: SlashCommand[];
}Properties
| Property | Type | Description |
|---|---|---|
actionsoptional | Record<string, (nabu: Nabu, data: any, topic: string) => any> | Handlers of the action bus, by topic ( |
blockoptional | typeof Block | n/a |
commandContextoptional | (nabu: Nabu, ctx: CommandContext) => void | Record<string, any> | Contributes FACTS to the context given to the |
commandsoptional | Record<string, CommandDef> | Commands (ADR 017): |
componentoptional | Component<any, any, string> | n/a |
defaultBlockoptional | boolean | Marks |
hooksoptional | Partial<ExtensionHooks> | n/a |
inputRulesoptional | InputRule[] | Declarative text-replacement rules applied while typing (e.g. markdown shortcuts, smart typography). Tested against the text before the cursor. |
loroTextStylesoptional | Record<string, { expand: 'none' | 'after' | 'before' | 'both' }> | Loro text style configuration required by this extension.
Passed to |
nameoptional | string | n/a |
pasteFileHandlersoptional | PasteFileHandler[] | Make a block of a file pasted from the clipboard (see |
pasteInterpretersoptional | PasteInterpreter[] | n/a |
serializersoptional | Record<string, (nabu: Nabu) => any> | n/a |
slashCommandsoptional | SlashCommand[] | Entries this extension adds to the slash menu (collected in |
Source: src/lib/utils/extensions.js:163