fix(core): title could not be changed when creating a new doc (#8203)

Before change, the title could not be modified from outside the editor without refreshing:

https://github.com/user-attachments/assets/536acba1-4e31-418a-bc1a-8578e3128bba

after:

https://github.com/user-attachments/assets/30a4b270-b8b1-4787-acef-0ab2a72a8f74
This commit is contained in:
JimmFly
2024-09-12 07:55:22 +00:00
parent cc5a6e6d40
commit 2cba8a4ccd
27 changed files with 138 additions and 145 deletions

View File

@@ -39,11 +39,11 @@ export class DocRecord extends Entity<{ id: string }> {
}
moveToTrash() {
return this.setMeta({ trash: true });
return this.setMeta({ trash: true, trashDate: Date.now() });
}
restoreFromTrash() {
return this.setMeta({ trash: false });
return this.setMeta({ trash: false, trashDate: undefined });
}
title$ = this.meta$.map(meta => meta.title ?? '');

View File

@@ -35,6 +35,9 @@ export class Workspace extends Entity {
idGenerator: () => nanoid(),
schema: globalBlockSuiteSchema,
});
this._docCollection.slots.docCreated.on(id => {
this.engine.doc.markAsReady(id);
});
}
return this._docCollection;
}