mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
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:
@@ -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 ?? '');
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user