mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-23 20:18:42 +08:00
feat: seperate createDoc and createStore (#11182)
This commit is contained in:
@@ -66,8 +66,8 @@ export function createStarterDocCollection() {
|
||||
schema,
|
||||
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),
|
||||
},
|
||||
});
|
||||
|
||||
@@ -52,7 +52,7 @@ export function createTestEditor(store: Store, workspace: Workspace) {
|
||||
editor.std
|
||||
.get(RefNodeSlotsProvider)
|
||||
.docLinkClicked.subscribe(({ pageId: docId }) => {
|
||||
const target = workspace.getDoc(docId);
|
||||
const target = workspace.getDoc(docId)?.getStore();
|
||||
if (!target) {
|
||||
throw new Error(`Failed to jump to doc ${docId}`);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ async function getStore(
|
||||
): Promise<Store> {
|
||||
if (!noInit) {
|
||||
collection.meta.initialize();
|
||||
const doc = collection.createDoc({ id: 'doc:home' });
|
||||
const doc = collection.createDoc('doc:home').getStore();
|
||||
window.doc = doc;
|
||||
return doc;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user