mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-22 12:36:24 +08:00
refactor(editor): refactor page note empty checker (#9570)
Close [BS-2320](https://linear.app/affine-design/issue/BS-2320/内容为空的状态判断)
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user