mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-03 18:40:00 +08:00
feat(core): unify all new created page IDs to nanoid (#4884)
This commit is contained in:
@@ -1,14 +1,10 @@
|
||||
import type { Page, Workspace } from '@blocksuite/store';
|
||||
import { useMemo } from 'react';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
|
||||
export function useBlockSuiteWorkspaceHelper(blockSuiteWorkspace: Workspace) {
|
||||
return useMemo(
|
||||
() => ({
|
||||
createPage: (pageId?: string): Page => {
|
||||
if (!pageId) {
|
||||
pageId = uuid();
|
||||
}
|
||||
return blockSuiteWorkspace.createPage({ id: pageId });
|
||||
},
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user