feat: seperate createDoc and createStore (#11182)

This commit is contained in:
Saul-Mirone
2025-03-26 11:03:47 +00:00
parent d6093e1d66
commit 0a8d8e0a6b
70 changed files with 337 additions and 312 deletions
+1 -1
View File
@@ -92,7 +92,7 @@ export async function switchToPage(page: Page, docId?: string) {
docId = docMetas[0].id;
}
const doc = collection.getDoc(docId);
const doc = collection.getDoc(docId)?.getStore();
if (!doc) return;
editor.doc = doc;
}, docId);
@@ -66,7 +66,7 @@ export enum ConnectorMode {
export async function getNoteRect(page: Page, noteId: string) {
const xywh: string | null = await page.evaluate(
([noteId]) => {
const doc = window.collection.getDoc('doc:home');
const doc = window.collection.getDoc('doc:home')?.getStore();
const block = doc?.getModelById(noteId);
if (block?.flavour === 'affine:note') {
return (block as NoteBlockModel).xywh;
@@ -84,7 +84,7 @@ export async function getNoteRect(page: Page, noteId: string) {
export async function getNoteProps(page: Page, noteId: string) {
const props = await page.evaluate(
([id]) => {
const doc = window.collection.getDoc('doc:home');
const doc = window.collection.getDoc('doc:home')?.getStore();
const block = doc?.getModelById(id);
if (block?.flavour === 'affine:note') {
return (block as NoteBlockModel).keys.reduce(