mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user