mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-24 05:07:06 +08:00
refactor(editor): implement uni-component in AFFiNE (#10747)
This commit is contained in:
@@ -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>;
|
||||
Reference in New Issue
Block a user