refactor(editor): implement uni-component in AFFiNE (#10747)

This commit is contained in:
zzj3720
2025-03-10 14:23:24 +00:00
parent 027d3a51dc
commit 4a45cc9ba4
23 changed files with 177 additions and 63 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ import type {
} from '@blocksuite/affine-model';
import type { BlockComponent } from '@blocksuite/block-std';
import type { BlockModel } from '@blocksuite/store';
export * from './uni-component';
export interface EditingState {
element: BlockComponent;
model: BlockModel;
@@ -0,0 +1,15 @@
export type ExposeWrapper<
Expose extends NonNullable<unknown> = NonNullable<unknown>,
> = (value?: Expose) => void;
export type UniComponentReturn<Props = NonNullable<unknown>> = {
update: (props: Props) => void;
unmount: () => void;
};
export type UniComponent<
Props = NonNullable<unknown>,
Expose extends NonNullable<unknown> = NonNullable<unknown>,
> = (
ele: HTMLElement,
props: Props,
expose: ExposeWrapper<Expose>
) => UniComponentReturn<Props>;