feat(editor): add editor store (#9584)

This commit is contained in:
Saul-Mirone
2025-01-08 07:47:43 +00:00
parent 0554df6bc2
commit fe727412be
25 changed files with 203 additions and 67 deletions
@@ -7,7 +7,7 @@ import { createPageModeSpecs } from '@affine/core/components/blocksuite/block-su
import type { AffineDNDData } from '@affine/core/types/dnd';
import { BlockStdScope } from '@blocksuite/affine/block-std';
import { DndApiExtensionIdentifier } from '@blocksuite/affine/blocks';
import { type SliceSnapshot } from '@blocksuite/affine/store';
import { type SliceSnapshot, Store } from '@blocksuite/affine/store';
import { Service } from '@toeverything/infra';
import type { DocsService } from '../../doc';
@@ -69,7 +69,7 @@ export class DndService extends Service {
}
const std = new BlockStdScope({
doc,
store: new Store({ blocks: doc }),
extensions: createPageModeSpecs(this.framework),
});
const dndAPI = std.get(DndApiExtensionIdentifier);
@@ -1,7 +1,7 @@
import { DebugLogger } from '@affine/debug';
import { BlockStdScope } from '@blocksuite/affine/block-std';
import { PageEditorBlockSpecs } from '@blocksuite/affine/blocks';
import type { Blocks } from '@blocksuite/affine/store';
import { type Blocks, Store } from '@blocksuite/affine/store';
import { LiveData } from '@toeverything/infra';
import { useMemo } from 'react';
import { Observable } from 'rxjs';
@@ -45,7 +45,7 @@ export function signalToLiveData<T>(
export function createBlockStdScope(doc: Blocks) {
logger.debug('createBlockStdScope', doc.id);
const std = new BlockStdScope({
doc,
store: new Store({ blocks: doc }),
extensions: PageEditorBlockSpecs,
});
return std;