refactor(editor): remove unused code (#12142)

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

- **Refactor**
  - Streamlined internal logic for handling block operations to improve efficiency.
  - Removed unused reactive subject and related code from document handling classes.
  - Renamed a private initialization method for improved clarity.

- **Chores**
  - Cleaned up redundant code and imports to simplify maintenance.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Saul-Mirone
2025-05-06 09:00:40 +00:00
parent 1994dd6d9d
commit 1e89aa48cb
3 changed files with 2 additions and 15 deletions

View File

@@ -601,9 +601,7 @@ export class Store {
this._yBlocks.observeDeep(this._handleYEvents);
this._yBlocks.forEach((_, id) => {
this._handleYBlockAdd(id, false);
});
this._yBlocks.forEach((_, id) => {
if (id in this._blocks.peek()) {
return;
}

View File

@@ -1,4 +1,3 @@
import { Subject } from 'rxjs';
import * as Y from 'yjs';
import type { YBlock } from '../model/block/types.js';
@@ -28,7 +27,6 @@ export class TestDoc implements Doc {
});
this.rootDoc.getMap('spaces').set(this.id, subDoc);
this._loaded = true;
this._onLoadSlot.next();
} else {
this._loaded = false;
this.rootDoc.on('subdocs', this._onSubdocEvent);
@@ -39,8 +37,6 @@ export class TestDoc implements Doc {
private _loaded!: boolean;
private readonly _onLoadSlot = new Subject<void>();
private readonly _onSubdocEvent = ({
loaded,
}: {
@@ -54,7 +50,6 @@ export class TestDoc implements Doc {
}
this.rootDoc.off('subdocs', this._onSubdocEvent);
this._loaded = true;
this._onLoadSlot.next();
};
/** Indicate whether the block tree is ready */
@@ -132,7 +127,6 @@ export class TestDoc implements Doc {
private _destroy() {
this._ySpaceDoc.destroy();
this._onLoadSlot.complete();
this._loaded = false;
}