mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-17 06:16:59 +08:00
feat: seperate createDoc and createStore (#11182)
This commit is contained in:
@@ -15,8 +15,8 @@ export async function importFromSnapshot(
|
||||
schema: new Schema().register(AffineSchemas),
|
||||
blobCRUD: collection.blobSync,
|
||||
docCRUD: {
|
||||
create: (id: string) => collection.createDoc({ id }),
|
||||
get: (id: string) => collection.getDoc(id),
|
||||
create: (id: string) => collection.createDoc(id).getStore({ id }),
|
||||
get: (id: string) => collection.getDoc(id)?.getStore({ id }) ?? null,
|
||||
delete: (id: string) => collection.removeDoc(id),
|
||||
},
|
||||
middlewares: [replaceIdMiddleware(collection.idGenerator)],
|
||||
|
||||
@@ -50,7 +50,7 @@ function createCollectionOptions() {
|
||||
}
|
||||
|
||||
function initCollection(collection: TestWorkspace) {
|
||||
const doc = collection.createDoc({ id: 'doc:home' });
|
||||
const doc = collection.createDoc('doc:home').getStore();
|
||||
|
||||
doc.load(() => {
|
||||
const rootId = doc.addBlock('affine:page', {
|
||||
|
||||
Reference in New Issue
Block a user