mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 21:27:20 +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:
@@ -9,7 +9,6 @@ import {
|
||||
type Workspace,
|
||||
type YBlock,
|
||||
} from '@blocksuite/affine/store';
|
||||
import { Subject } from 'rxjs';
|
||||
import { Awareness } from 'y-protocols/awareness.js';
|
||||
import * as Y from 'yjs';
|
||||
|
||||
@@ -24,7 +23,7 @@ export class DocImpl implements Doc {
|
||||
|
||||
private readonly _storeMap = new Map<string, Store>();
|
||||
|
||||
private readonly _initSubDoc = () => {
|
||||
private readonly _initSpaceDoc = () => {
|
||||
{
|
||||
// This is a piece of old version compatible code. The old version relies on the subdoc instance on `spaces`.
|
||||
// So if there is no subdoc on spaces, we will create it.
|
||||
@@ -47,9 +46,6 @@ export class DocImpl implements Doc {
|
||||
|
||||
private _loaded!: boolean;
|
||||
|
||||
// eslint-disable-next-line rxjs/finnish
|
||||
private readonly _onLoadSlot = new Subject();
|
||||
|
||||
/** Indicate whether the block tree is ready */
|
||||
private _ready = false;
|
||||
|
||||
@@ -104,7 +100,7 @@ export class DocImpl implements Doc {
|
||||
constructor({ id, collection, doc }: DocOptions) {
|
||||
this.id = id;
|
||||
this.rootDoc = doc;
|
||||
this._ySpaceDoc = this._initSubDoc() as Y.Doc;
|
||||
this._ySpaceDoc = this._initSpaceDoc() as Y.Doc;
|
||||
this.awarenessStore = new AwarenessStore(new Awareness(this._ySpaceDoc));
|
||||
|
||||
this._yBlocks = this._ySpaceDoc.getMap('blocks');
|
||||
@@ -127,7 +123,6 @@ export class DocImpl implements Doc {
|
||||
private _destroy() {
|
||||
this.awarenessStore.destroy();
|
||||
this._ySpaceDoc.destroy();
|
||||
this._onLoadSlot.unsubscribe();
|
||||
this._loaded = false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user