mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 21:27:20 +00:00
feat: support subpage (#1663)
This commit is contained in:
@@ -9,9 +9,9 @@ export function useBlockSuiteWorkspaceHelper(
|
||||
) {
|
||||
return useMemo(
|
||||
() => ({
|
||||
createPage: (pageId: string, title?: string): Page => {
|
||||
createPage: (pageId: string, parentId?: string): Page => {
|
||||
assertExists(blockSuiteWorkspace);
|
||||
return blockSuiteWorkspace.createPage(pageId);
|
||||
return blockSuiteWorkspace.createPage(pageId, parentId);
|
||||
},
|
||||
}),
|
||||
[blockSuiteWorkspace]
|
||||
|
||||
@@ -22,7 +22,6 @@ declare global {
|
||||
callback: Set<() => void>;
|
||||
};
|
||||
}
|
||||
|
||||
if (!globalThis.featureFlag) {
|
||||
globalThis.featureFlag = featureFlag;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import type { BlockSuiteWorkspace } from '../shared';
|
||||
declare module '@blocksuite/store' {
|
||||
interface PageMeta {
|
||||
favorite?: boolean;
|
||||
subpageIds: string[];
|
||||
trash?: boolean;
|
||||
trashDate?: number;
|
||||
// whether to create the page with the default template
|
||||
@@ -45,6 +46,12 @@ export function usePageMetaHelper(blockSuiteWorkspace: BlockSuiteWorkspace) {
|
||||
setPageMeta: (pageId: string, pageMeta: Partial<PageMeta>) => {
|
||||
blockSuiteWorkspace.meta.setPageMeta(pageId, pageMeta);
|
||||
},
|
||||
getPageMeta: (pageId: string) => {
|
||||
return blockSuiteWorkspace.meta.getPageMeta(pageId);
|
||||
},
|
||||
shiftPageMeta: (pageId: string, index: number) => {
|
||||
return blockSuiteWorkspace.meta.shiftPageMeta(pageId, index);
|
||||
},
|
||||
}),
|
||||
[blockSuiteWorkspace]
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user