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

View File

@@ -103,6 +103,10 @@ export class SurfaceBlockModel extends BlockModel<SurfaceBlockProps> {
return Object.keys(this._elementCtorMap);
}
override isEmpty(): boolean {
return this._elementModels.size === 0 && this.children.length === 0;
}
constructor() {
super();
this.created.once(() => this._init());