chore: merge blocksuite source code (#9213)

This commit is contained in:
Mirone
2024-12-20 15:38:06 +08:00
committed by GitHub
parent 2c9ef916f4
commit 30200ff86d
2031 changed files with 238888 additions and 229 deletions
@@ -0,0 +1,34 @@
import type { InlineEditor } from '../inline-editor.js';
import type { InlineRange } from '../types.js';
import type { BaseTextAttributes } from '../utils/base-attributes.js';
export interface BeforeinputHookCtx<TextAttributes extends BaseTextAttributes> {
inlineEditor: InlineEditor<TextAttributes>;
raw: InputEvent;
inlineRange: InlineRange;
data: string | null;
attributes: TextAttributes;
}
export interface CompositionEndHookCtx<
TextAttributes extends BaseTextAttributes,
> {
inlineEditor: InlineEditor<TextAttributes>;
raw: CompositionEvent;
inlineRange: InlineRange;
data: string | null;
attributes: TextAttributes;
}
export type HookContext<TextAttributes extends BaseTextAttributes> =
| BeforeinputHookCtx<TextAttributes>
| CompositionEndHookCtx<TextAttributes>;
export class InlineHookService<TextAttributes extends BaseTextAttributes> {
constructor(
readonly editor: InlineEditor<TextAttributes>,
readonly hooks: {
beforeinput?: (props: BeforeinputHookCtx<TextAttributes>) => void;
compositionEnd?: (props: CompositionEndHookCtx<TextAttributes>) => void;
} = {}
) {}
}