mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-25 06:18:45 +08:00
fix: fix quick search
This commit is contained in:
@@ -7,6 +7,7 @@ import type {
|
||||
Workspace as StoreWorkspace,
|
||||
} from '@blocksuite/store';
|
||||
import type { EditorContainer } from '@blocksuite/editor';
|
||||
import { QueryContent } from '@blocksuite/store/dist/workspace/search';
|
||||
|
||||
export interface AppStateValue {
|
||||
user: AccessTokenMessage | null;
|
||||
@@ -32,6 +33,7 @@ export interface AppStateContext extends AppStateValue {
|
||||
getPageMeta: (pageId: string) => PageMeta | null;
|
||||
toggleFavoritePage: (pageId: string) => void;
|
||||
toggleDeletePage: (pageId: string) => void;
|
||||
search: (query: QueryContent) => Map<string, string | undefined>;
|
||||
}
|
||||
|
||||
export const AppState = createContext<AppStateContext>({
|
||||
@@ -54,6 +56,7 @@ export const AppState = createContext<AppStateContext>({
|
||||
getPageMeta: () => null,
|
||||
toggleFavoritePage: () => {},
|
||||
toggleDeletePage: () => {},
|
||||
search: () => new Map<string, string>(),
|
||||
});
|
||||
|
||||
export const useAppState = () => {
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
} from '@pathfinder/data-services';
|
||||
import { AppState } from './context';
|
||||
import type { AppStateValue, AppStateContext } from './context';
|
||||
import { QueryContent } from '@blocksuite/store/dist/workspace/search';
|
||||
|
||||
const DynamicBlocksuite = dynamic(() => import('./dynamic-blocksuite'), {
|
||||
ssr: false,
|
||||
@@ -150,6 +151,10 @@ export const AppStateProvider = ({ children }: { children?: ReactNode }) => {
|
||||
});
|
||||
}
|
||||
},
|
||||
search: (query: QueryContent) => {
|
||||
const { currentWorkspace } = state;
|
||||
return currentWorkspace!.search(query);
|
||||
},
|
||||
}),
|
||||
[state, setState, loadWorkspaceHandler, createEditorHandler]
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user