Files
AFFiNE-Mirror/blocksuite/affine/foundation/src/view.ts
T
Saul-Mirone 3fdab1bec6 feat(editor): add bs affine foundation module (#12012)
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

- **New Features**
  - Introduced the Affine Foundation package, providing a centralized layer for initializing core UI effects, custom elements, and foundational services.
  - Added new foundational store and view extensions to improve core service registration and UI effect setup.

- **Refactor**
  - Streamlined and reorganized block, store, and view extension arrays to rely on the new foundation layer, reducing duplication and simplifying extension management.
  - Removed redundant or now-centralized services and UI effects from existing modules.

- **Chores**
  - Updated configuration files and workspace dependencies to support the new Affine Foundation package.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-04-28 06:38:42 +00:00

53 lines
1.3 KiB
TypeScript

import { FileDropExtension } from '@blocksuite/affine-components/drop-indicator';
import {
type ViewExtensionContext,
ViewExtensionProvider,
} from '@blocksuite/affine-ext-loader';
import {
AutoClearSelectionService,
DefaultOpenDocExtension,
DNDAPIExtension,
DocDisplayMetaService,
DocModeService,
EditPropsStore,
EmbedOptionService,
FontLoaderService,
PageViewportServiceExtension,
ThemeService,
ToolbarRegistryExtension,
} from '@blocksuite/affine-shared/services';
import { InteractivityManager, ToolController } from '@blocksuite/std/gfx';
import { effects } from './effects';
export class FoundationViewExtension extends ViewExtensionProvider {
override name = 'foundation';
override effect() {
super.effect();
effects();
}
override setup(context: ViewExtensionContext) {
super.setup(context);
context.register([
DocDisplayMetaService,
EditPropsStore,
DefaultOpenDocExtension,
FontLoaderService,
DocModeService,
ThemeService,
EmbedOptionService,
PageViewportServiceExtension,
DNDAPIExtension,
FileDropExtension,
ToolbarRegistryExtension,
AutoClearSelectionService,
]);
if (this.isEdgeless(context.scope)) {
context.register([InteractivityManager, ToolController]);
}
}
}