feat: seperate createDoc and createStore (#11182)
This commit is contained in:
@@ -206,8 +206,8 @@ export class DocsService extends Service {
|
||||
schema: getAFFiNEWorkspaceSchema(),
|
||||
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)],
|
||||
|
||||
@@ -21,7 +21,11 @@ export class DocsStore extends Store {
|
||||
}
|
||||
|
||||
getBlockSuiteDoc(id: string) {
|
||||
return this.workspaceService.workspace.docCollection.getDoc(id);
|
||||
return (
|
||||
this.workspaceService.workspace.docCollection
|
||||
.getDoc(id)
|
||||
?.getStore({ id }) ?? null
|
||||
);
|
||||
}
|
||||
|
||||
getBlocksuiteCollection() {
|
||||
@@ -29,7 +33,8 @@ export class DocsStore extends Store {
|
||||
}
|
||||
|
||||
createBlockSuiteDoc() {
|
||||
return this.workspaceService.workspace.docCollection.createDoc();
|
||||
const doc = this.workspaceService.workspace.docCollection.createDoc();
|
||||
return doc.getStore({ id: doc.id });
|
||||
}
|
||||
|
||||
watchDocIds() {
|
||||
|
||||
Reference in New Issue
Block a user