mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-17 18:16:15 +08:00
refactor(editor): should not rely on doc collection type (#9501)
This commit is contained in:
@@ -23,7 +23,7 @@ export class TagStore extends Store {
|
||||
|
||||
subscribe(cb: () => void) {
|
||||
const disposable =
|
||||
this.workspaceService.workspace.docCollection.meta.docMetaUpdated.on(cb);
|
||||
this.workspaceService.workspace.docCollection.slots.docListUpdated.on(cb);
|
||||
return disposable.dispose;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { DocCollection } from '@blocksuite/affine/store';
|
||||
import {
|
||||
DocCollection,
|
||||
type Workspace as BSWorkspace,
|
||||
} from '@blocksuite/affine/store';
|
||||
import { Entity, LiveData } from '@toeverything/infra';
|
||||
import { nanoid } from 'nanoid';
|
||||
import { Observable } from 'rxjs';
|
||||
@@ -22,7 +25,7 @@ export class Workspace extends Entity {
|
||||
|
||||
readonly flavour = this.meta.flavour;
|
||||
|
||||
_docCollection: DocCollection | null = null;
|
||||
_docCollection: BSWorkspace | null = null;
|
||||
|
||||
get docCollection() {
|
||||
if (!this._docCollection) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { DocCollection } from '@blocksuite/affine/store';
|
||||
import type { Workspace as BSWorkspace } from '@blocksuite/affine/store';
|
||||
import {
|
||||
type AwarenessConnection,
|
||||
type BlobStorage,
|
||||
@@ -27,7 +27,7 @@ export interface WorkspaceFlavourProvider {
|
||||
|
||||
createWorkspace(
|
||||
initial: (
|
||||
docCollection: DocCollection,
|
||||
docCollection: BSWorkspace,
|
||||
blobStorage: BlobStorage,
|
||||
docStorage: DocStorage
|
||||
) => Promise<void>
|
||||
|
||||
@@ -3,8 +3,6 @@ import { Scope } from '@toeverything/infra';
|
||||
import type { WorkspaceOpenOptions } from '../open-options';
|
||||
import type { WorkspaceEngineProvider } from '../providers/flavour';
|
||||
|
||||
export type { DocCollection } from '@blocksuite/affine/store';
|
||||
|
||||
export class WorkspaceScope extends Scope<{
|
||||
openOptions: WorkspaceOpenOptions;
|
||||
engineProvider: WorkspaceEngineProvider;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { DocCollection } from '@blocksuite/affine/store';
|
||||
import type { Workspace } from '@blocksuite/affine/store';
|
||||
import {
|
||||
type BlobStorage,
|
||||
type DocStorage,
|
||||
@@ -21,7 +21,7 @@ export class WorkspaceFactoryService extends Service {
|
||||
create = async (
|
||||
flavour: string,
|
||||
initial: (
|
||||
docCollection: DocCollection,
|
||||
docCollection: Workspace,
|
||||
blobStorage: BlobStorage,
|
||||
docStorage: DocStorage
|
||||
) => Promise<void> = () => Promise.resolve()
|
||||
|
||||
Reference in New Issue
Block a user