mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-12 23:56:36 +08:00
20 lines
527 B
TypeScript
20 lines
527 B
TypeScript
import type { Page } from '@blocksuite/store';
|
|
import { assertExists } from '@blocksuite/store';
|
|
import { useMemo } from 'react';
|
|
|
|
import type { BlockSuiteWorkspace } from '../shared';
|
|
|
|
export function useBlockSuiteWorkspaceHelper(
|
|
blockSuiteWorkspace: BlockSuiteWorkspace | null
|
|
) {
|
|
return useMemo(
|
|
() => ({
|
|
createPage: (pageId: string, title?: string): Page => {
|
|
assertExists(blockSuiteWorkspace);
|
|
return blockSuiteWorkspace.createPage(pageId);
|
|
},
|
|
}),
|
|
[blockSuiteWorkspace]
|
|
);
|
|
}
|