mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-04 19:15:33 +08:00
26 lines
814 B
TypeScript
26 lines
814 B
TypeScript
import type { getCurrentBlockRange } from '@blocksuite/blocks';
|
|
import type { EditorContainer } from '@blocksuite/editor';
|
|
import type { Page } from '@blocksuite/store';
|
|
import type { FC } from 'react';
|
|
|
|
export type Part = 'headerItem' | 'editor' | 'window' | 'setting' | 'formatBar';
|
|
|
|
export type CallbackMap = {
|
|
headerItem: (root: HTMLElement) => () => void;
|
|
window: (root: HTMLElement) => () => void;
|
|
editor: (root: HTMLElement, editor: EditorContainer) => () => void;
|
|
setting: (root: HTMLElement) => () => void;
|
|
formatBar: (
|
|
root: HTMLElement,
|
|
page: Page,
|
|
getBlockRange: () => ReturnType<typeof getCurrentBlockRange>
|
|
) => () => void;
|
|
};
|
|
|
|
export interface PluginContext {
|
|
register: <T extends Part>(part: T, callback: CallbackMap[T]) => void;
|
|
utils: {
|
|
PluginProvider: FC;
|
|
};
|
|
}
|