feat: add lifecycle hook in editor provider

This commit is contained in:
QiShaoXuan
2022-12-14 16:47:33 +08:00
parent 7734fe8928
commit 9253e9af0b
13 changed files with 155 additions and 61 deletions
@@ -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>;