mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-15 05:37:32 +00:00
feat(editor): replace spec provider with extension manager (#11861)
Closes: BS-3273
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import type { StoreExtensionManager } from '@blocksuite/affine/ext-loader';
|
||||
import { AffineSchemas } from '@blocksuite/affine/schemas';
|
||||
import { SpecProvider } from '@blocksuite/affine/shared/utils';
|
||||
import { nanoid, Schema, Transformer } from '@blocksuite/affine/store';
|
||||
import {
|
||||
createAutoIncrementIdGenerator,
|
||||
@@ -23,7 +23,9 @@ const room = params.get('room');
|
||||
const isE2E = room?.startsWith('playwright');
|
||||
const blobSourceArgs = (params.get('blobSource') ?? '').split(',');
|
||||
|
||||
export function createStarterDocCollection() {
|
||||
export function createStarterDocCollection(
|
||||
storeExtensionManager: StoreExtensionManager
|
||||
) {
|
||||
const collectionId = room ?? 'starter';
|
||||
const schema = new Schema();
|
||||
schema.register(AffineSchemas);
|
||||
@@ -56,7 +58,7 @@ export function createStarterDocCollection() {
|
||||
blobSources,
|
||||
};
|
||||
const collection = new TestWorkspace(options);
|
||||
collection.storeExtensions = SpecProvider._.getSpec('store').value;
|
||||
collection.storeExtensions = storeExtensionManager.get('store');
|
||||
collection.start();
|
||||
|
||||
// debug info
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
import {
|
||||
EdgelessEditorBlockSpecs,
|
||||
PageEditorBlockSpecs,
|
||||
} from '@blocksuite/affine/extensions';
|
||||
import { RefNodeSlotsProvider } from '@blocksuite/affine/inlines/reference';
|
||||
import {
|
||||
CommunityCanvasTextFonts,
|
||||
@@ -13,6 +9,7 @@ import {
|
||||
} from '@blocksuite/affine/shared/services';
|
||||
import type { ExtensionType, Store, Workspace } from '@blocksuite/affine/store';
|
||||
import { type TestAffineEditorContainer } from '@blocksuite/integration-test';
|
||||
import { getTestViewManager } from '@blocksuite/integration-test/view';
|
||||
|
||||
import {
|
||||
mockDocModeService,
|
||||
@@ -20,6 +17,8 @@ import {
|
||||
mockParseDocUrlService,
|
||||
} from '../../_common/mock-services';
|
||||
|
||||
const viewManager = getTestViewManager();
|
||||
|
||||
export function getTestCommonExtensions(
|
||||
editor: TestAffineEditorContainer
|
||||
): ExtensionType[] {
|
||||
@@ -48,8 +47,8 @@ export function createTestEditor(store: Store, workspace: Workspace) {
|
||||
editor.doc = store;
|
||||
|
||||
const defaultExtensions = getTestCommonExtensions(editor);
|
||||
editor.pageSpecs = [...PageEditorBlockSpecs, ...defaultExtensions];
|
||||
editor.edgelessSpecs = [...EdgelessEditorBlockSpecs, ...defaultExtensions];
|
||||
editor.pageSpecs = [...viewManager.get('page'), ...defaultExtensions];
|
||||
editor.edgelessSpecs = [...viewManager.get('edgeless'), ...defaultExtensions];
|
||||
|
||||
editor.std
|
||||
.get(RefNodeSlotsProvider)
|
||||
|
||||
Reference in New Issue
Block a user