mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-02 09:59:55 +08:00
feat: add lifecycle hook in editor provider
This commit is contained in:
@@ -1,14 +1,28 @@
|
||||
import { PropsWithChildren } from 'react';
|
||||
import { Page } from '@blocksuite/store';
|
||||
import { QueryContent } from '@blocksuite/store/dist/workspace/search';
|
||||
import { PageMeta as OriginalPageMeta } from '@blocksuite/store';
|
||||
import { EditorContainer } from '@blocksuite/editor';
|
||||
|
||||
export interface PageMeta {
|
||||
id: string;
|
||||
title: string;
|
||||
export type EventCallBack<T> = (callback: (props: T) => void) => void;
|
||||
export type EditorContextProps = PropsWithChildren<{}>;
|
||||
|
||||
export type EditorContextValue = {
|
||||
mode: EditorContainer['mode'];
|
||||
setMode: (mode: EditorContainer['mode']) => void;
|
||||
page: Page | void;
|
||||
editor: EditorContainer | void;
|
||||
pageList: PageMeta[];
|
||||
onHistoryUpdated: EventCallBack<Page>;
|
||||
onPropsUpdated: EventCallBack<EditorContainer>;
|
||||
} & EditorHandlers;
|
||||
|
||||
export type PageMeta = {
|
||||
favorite: boolean;
|
||||
trash: boolean;
|
||||
createDate: number;
|
||||
trashDate: number | null;
|
||||
}
|
||||
trashDate: number | void;
|
||||
updatedDate: number | void;
|
||||
} & OriginalPageMeta;
|
||||
|
||||
export type EditorHandlers = {
|
||||
createPage: (pageId?: string) => Promise<Page>;
|
||||
|
||||
Reference in New Issue
Block a user