mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
fix(core): optimize performance when editing doc title (#7328)
This commit is contained in:
@@ -17,6 +17,7 @@ export class Doc extends Entity {
|
||||
readonly meta$ = this.record.meta$;
|
||||
readonly mode$ = this.record.mode$;
|
||||
readonly title$ = this.record.title$;
|
||||
readonly trash$ = this.record.trash$;
|
||||
|
||||
setMode(mode: DocMode) {
|
||||
return this.record.setMode(mode);
|
||||
@@ -33,4 +34,12 @@ export class Doc extends Entity {
|
||||
observeMode() {
|
||||
return this.record.observeMode();
|
||||
}
|
||||
|
||||
moveToTrash() {
|
||||
return this.record.moveToTrash();
|
||||
}
|
||||
|
||||
restoreFromTrash() {
|
||||
return this.record.restoreFromTrash();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,5 +50,14 @@ export class DocRecord extends Entity<{ id: string }> {
|
||||
return this.docsStore.watchDocModeSetting(this.id);
|
||||
}
|
||||
|
||||
moveToTrash() {
|
||||
return this.setMeta({ trash: true });
|
||||
}
|
||||
|
||||
restoreFromTrash() {
|
||||
return this.setMeta({ trash: false });
|
||||
}
|
||||
|
||||
title$ = this.meta$.map(meta => meta.title ?? '');
|
||||
trash$ = this.meta$.map(meta => meta.trash ?? false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user