refactor(editor): implement uni-component in AFFiNE (#10747)
This commit is contained in:
1 parent
027d3a51dc
commit
4a45cc9ba4
23 files changed
+177
-63
No files matched your search
@@ -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