mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-25 22:38:56 +08:00
feat: create first page (#1410)
This commit is contained in:
@@ -26,18 +26,12 @@ export function useCreateFirstWorkspace() {
|
||||
const workspace = await LocalPlugin.CRUD.get(id);
|
||||
assertExists(workspace);
|
||||
assertEquals(workspace.id, id);
|
||||
const newPageId = nanoid();
|
||||
workspace.blockSuiteWorkspace.slots.pageAdded.once(pageId => {
|
||||
assertEquals(pageId, newPageId);
|
||||
set(workspaces => [
|
||||
...workspaces,
|
||||
{
|
||||
id: workspace.id,
|
||||
flavour: RemWorkspaceFlavour.LOCAL,
|
||||
},
|
||||
]);
|
||||
});
|
||||
workspace.blockSuiteWorkspace.createPage(newPageId);
|
||||
set([
|
||||
{
|
||||
id: workspace.id,
|
||||
flavour: RemWorkspaceFlavour.LOCAL,
|
||||
},
|
||||
]);
|
||||
}
|
||||
if (
|
||||
jotaiWorkspaces.length === 0 &&
|
||||
|
||||
@@ -9,6 +9,8 @@ declare module '@blocksuite/store' {
|
||||
favorite?: boolean;
|
||||
trash?: boolean;
|
||||
trashDate?: number;
|
||||
// whether to create the page with the default template
|
||||
init?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user