mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-24 05:48:59 +08:00
Merge branch 'feat/dev' of github.com:toeverything/AFFiNE into feat/dev
This commit is contained in:
@@ -6,6 +6,7 @@ import Loading from './loading';
|
||||
import { Page, Workspace } from '@blocksuite/store';
|
||||
import { BlockSchema } from '@blocksuite/editor/dist/block-loader';
|
||||
import { useRouter } from 'next/router';
|
||||
import { QueryContent } from '@blocksuite/store/dist/workspace/search';
|
||||
export interface PageMeta {
|
||||
id: string;
|
||||
title: string;
|
||||
@@ -40,6 +41,7 @@ type EditorHandlers = {
|
||||
unFavoritePage: (pageId: string) => void;
|
||||
toggleFavoritePage: (pageId: string) => void;
|
||||
permanentlyDeletePage: (pageId: string) => void;
|
||||
search: (query: QueryContent) => any;
|
||||
};
|
||||
|
||||
type EditorContextProps = PropsWithChildren<{}>;
|
||||
@@ -61,6 +63,7 @@ export const EditorContext = createContext<EditorContextValue>({
|
||||
unFavoritePage: () => {},
|
||||
toggleFavoritePage: () => {},
|
||||
permanentlyDeletePage: () => {},
|
||||
search: () => {},
|
||||
});
|
||||
|
||||
export const useEditor = () => useContext(EditorContext);
|
||||
@@ -137,6 +140,11 @@ export const EditorProvider = ({
|
||||
workspace?.setPageMeta(pageId, { favorite: !pageMeta.favorite });
|
||||
}
|
||||
},
|
||||
search: (query: QueryContent) => {
|
||||
if (query) {
|
||||
return workspace?.search(query);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user