File size: 757 Bytes
f56a29b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | import mitt, { type Emitter } from 'mitt';
export const enum EmitterEvents {
RICH_TEXT_COMMAND = 'RICH_TEXT_COMMAND',
SYNC_RICH_TEXT_ATTRS_TO_STORE = 'SYNC_RICH_TEXT_ATTRS_TO_STORE',
OPEN_CHART_DATA_EDITOR = 'OPEN_CHART_DATA_EDITOR',
OPEN_LATEX_EDITOR = 'OPEN_LATEX_EDITOR',
}
export interface RichTextAction {
command: string;
value?: string;
}
export interface RichTextCommand {
target?: string;
action: RichTextAction | RichTextAction[];
}
type Events = {
[EmitterEvents.RICH_TEXT_COMMAND]: RichTextCommand;
[EmitterEvents.SYNC_RICH_TEXT_ATTRS_TO_STORE]: void;
[EmitterEvents.OPEN_CHART_DATA_EDITOR]: void;
[EmitterEvents.OPEN_LATEX_EDITOR]: void;
};
const emitter: Emitter<Events> = mitt<Events>();
export default emitter;
|