import type { IBlockDefinition } from "../block/basic"; import type { Editor } from "../view/editor"; import type { SpanStyle } from "./spanRegistry"; import type { EmbedDefinition } from "./embedRegistry"; import { Subject } from "rxjs"; export type AfterFn = () => void; export interface BlockyPasteEvent { ctx: PluginContext; raw: ClipboardEvent; } export interface IPlugin { name: string; /** * The span registered by the plugin. */ spans?: SpanStyle[]; /** * The embed registered by the plugin. */ embeds?: EmbedDefinition[]; /** * The block registered by the plugin. */ blocks?: IBlockDefinition[]; /** * Will be triggered when the editor is initialized. */ onInitialized?(context: PluginContext): void; onPaste?(evt: BlockyPasteEvent): void; dispose?(): void; } export declare class PluginContext { editor: Editor; dispose$: Subject; constructor(editor: Editor); dispose(): void; } export declare class PluginRegistry { #private; plugins: Map; private contexts; constructor(plugins?: IPlugin[]); register(plugin: IPlugin): void; unload(name: string): void; initAllPlugins(editor: Editor): void; handlePaste(e: ClipboardEvent): void; dispose(): void; }