refactor(editor): refactor page note empty checker (#9570)

Close [BS-2320](https://linear.app/affine-design/issue/BS-2320/内容为空的状态判断)
This commit is contained in:
L-Sun
2025-01-07 11:24:40 +00:00
parent 482b534a90
commit 440239809c
11 changed files with 187 additions and 18 deletions
@@ -111,6 +111,17 @@ export class NoteBlockModel
if (!this._isSelectable()) return false;
return super.intersectsBound(bound);
}
override isEmpty(): boolean {
if (this.children.length === 0) return true;
if (this.children.length === 1) {
const firstChild = this.children[0];
if (firstChild.flavour === 'affine:paragraph') {
return firstChild.isEmpty();
}
}
return false;
}
}
declare global {