Skip to content

ExtensionShape

type ExtensionShape = {
name: string;
onAsyncEvent?: (name, state, ctx) => Promise<unknown> | unknown;
onTransaction?: (tx, ctx) => void;
registeredActions?: ActionDescriptor[];
registeredBlocks?: (editor) => BlockDescriptor[];
registeredMarks?: (editor) => MarkDescriptor[];
transformPaste?: (data, ctx) => boolean | undefined | void;
};

Defined in: extension.ts:7

PropertyTypeDescriptionDefined in
namestring-extension.ts:8
onAsyncEvent?(name, state, ctx) => Promise<unknown> | unknown-extension.ts:13
onTransaction?(tx, ctx) => void-extension.ts:12
registeredActions?ActionDescriptor[]-extension.ts:11
registeredBlocks?(editor) => BlockDescriptor[]-extension.ts:9
registeredMarks?(editor) => MarkDescriptor[]-extension.ts:10
transformPaste?(data, ctx) => boolean | undefined | voidPaste-pipeline hook. Receives the normalised clipboard payload and the editor’s action context. Return true to signal the extension has fully handled the paste (it committed its own transaction); return any falsy value (undefined/false) to let the next extension — or the built-in pipeline — try. Extensions are consulted in registration order, so the first one to return true wins. Typical use cases: paste-as-image (read data.files, upload, insert an image block), custom embed unfurling, replacing pasted JSON with a structured block, or just sniffing for a vendor-specific payload.extension.ts:26