mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-22 03:33:06 +08:00
feat!: upgrade blocksuite version (#2833)
This commit is contained in:
@@ -1,10 +1,5 @@
|
||||
import type { Page, Workspace } from '@blocksuite/store';
|
||||
import { assertExists } from '@blocksuite/store';
|
||||
import {
|
||||
getMilestones,
|
||||
markMilestone,
|
||||
revertUpdate,
|
||||
} from '@toeverything/y-indexeddb';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
export function useBlockSuiteWorkspaceHelper(blockSuiteWorkspace: Workspace) {
|
||||
@@ -14,27 +9,6 @@ export function useBlockSuiteWorkspaceHelper(blockSuiteWorkspace: Workspace) {
|
||||
assertExists(blockSuiteWorkspace);
|
||||
return blockSuiteWorkspace.createPage({ id: pageId });
|
||||
},
|
||||
markMilestone: async (name: string) => {
|
||||
assertExists(blockSuiteWorkspace);
|
||||
const doc = blockSuiteWorkspace.doc;
|
||||
await markMilestone(blockSuiteWorkspace.id, doc, name);
|
||||
},
|
||||
revertMilestone: async (name: string) => {
|
||||
assertExists(blockSuiteWorkspace);
|
||||
const doc = blockSuiteWorkspace.doc;
|
||||
const list = await getMilestones(blockSuiteWorkspace.id);
|
||||
if (!list) {
|
||||
throw new Error('no milestone');
|
||||
}
|
||||
const milestone = list[name];
|
||||
if (milestone) {
|
||||
revertUpdate(doc, milestone, () => 'Map');
|
||||
}
|
||||
},
|
||||
listMilestone: async () => {
|
||||
assertExists(blockSuiteWorkspace);
|
||||
return await getMilestones(blockSuiteWorkspace.id);
|
||||
},
|
||||
}),
|
||||
[blockSuiteWorkspace]
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user