refactor(editor): reorg block specs (#9421)
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
import type { EditorHost, ExtensionType } from '@blocksuite/block-std';
|
||||
import {
|
||||
CommunityCanvasTextFonts,
|
||||
@@ -10,7 +9,6 @@ import {
|
||||
NotificationExtension,
|
||||
OverrideThemeExtension,
|
||||
ParseDocUrlExtension,
|
||||
RefNodeSlotsExtension,
|
||||
RefNodeSlotsProvider,
|
||||
SpecProvider,
|
||||
} from '@blocksuite/blocks';
|
||||
@@ -47,15 +45,8 @@ export async function mountDefaultDocEditor(collection: DocCollection) {
|
||||
|
||||
const editor = new AffineEditorContainer();
|
||||
const specs = getExampleSpecs();
|
||||
const refNodeSlotsExtension = RefNodeSlotsExtension();
|
||||
editor.pageSpecs = patchPageRootSpec([
|
||||
refNodeSlotsExtension,
|
||||
...specs.pageModeSpecs,
|
||||
]);
|
||||
editor.edgelessSpecs = patchPageRootSpec([
|
||||
refNodeSlotsExtension,
|
||||
...specs.edgelessModeSpecs,
|
||||
]);
|
||||
editor.pageSpecs = patchPageRootSpec([...specs.pageModeSpecs]);
|
||||
editor.edgelessSpecs = patchPageRootSpec([...specs.edgelessModeSpecs]);
|
||||
|
||||
SpecProvider.getInstance().extendSpec('edgeless:preview', [
|
||||
OverrideThemeExtension(themeExtension),
|
||||
|
||||
@@ -13,7 +13,6 @@ import {
|
||||
FontConfigExtension,
|
||||
ParseDocUrlProvider,
|
||||
QuickSearchProvider,
|
||||
RefNodeSlotsExtension,
|
||||
RefNodeSlotsProvider,
|
||||
} from '@blocksuite/blocks';
|
||||
import { effects as blocksEffects } from '@blocksuite/blocks/effects';
|
||||
@@ -60,12 +59,10 @@ async function main() {
|
||||
},
|
||||
defaultExtensions: (): ExtensionType[] => [
|
||||
FontConfigExtension(CommunityCanvasTextFonts),
|
||||
RefNodeSlotsExtension(),
|
||||
],
|
||||
extensions: {
|
||||
FontConfigExtension: FontConfigExtension(CommunityCanvasTextFonts),
|
||||
WidgetViewMapExtension,
|
||||
RefNodeSlotsExtension: RefNodeSlotsExtension(),
|
||||
},
|
||||
mockServices: {
|
||||
mockDocModeService,
|
||||
|
||||
@@ -13,7 +13,6 @@ import {
|
||||
OverrideThemeExtension,
|
||||
type PageRootService,
|
||||
ParseDocUrlExtension,
|
||||
RefNodeSlotsExtension,
|
||||
RefNodeSlotsProvider,
|
||||
SpecProvider,
|
||||
toolbarDefaultConfig,
|
||||
@@ -73,9 +72,7 @@ export async function mountDefaultDocEditor(collection: DocCollection) {
|
||||
}
|
||||
}
|
||||
|
||||
const refNodeSlotsExtension = RefNodeSlotsExtension();
|
||||
const extensions: ExtensionType[] = [
|
||||
refNodeSlotsExtension,
|
||||
PatchPageServiceWatcher,
|
||||
FontConfigExtension(CommunityCanvasTextFonts),
|
||||
ParseDocUrlExtension(mockParseDocUrlService(collection)),
|
||||
|
||||
Reference in New Issue
Block a user