Files
AFFiNE-Mirror/blocksuite/affine/foundation/src/view.ts
T
donteatfriedrice 0d518adc5b refactor(editor): add cache extension for link preview service (#12196)
Closes: [BS-2578](https://linear.app/affine-design/issue/BS-2578/优化-footnote-预览的逻辑:支持缓存结果,避免重复-loading)

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
  - Introduced a link preview caching mechanism, enabling faster and more efficient reuse of link preview data across the app.
  - Added a feature flag for enabling or disabling link preview cache, configurable through workspace experimental settings.
  - Enhanced localization with new entries describing the link preview cache feature.

- **Improvements**
  - Updated link preview service architecture for better extensibility and maintainability.
  - Improved integration of feature flags throughout chat and rendering components.

- **Bug Fixes**
  - Fixed tooltip formatting for footnote URLs.

- **Chores**
  - Updated dependencies and localization completeness tracking.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-13 05:11:34 +00:00

61 lines
1.5 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,
FileSizeLimitService,
FontLoaderService,
LinkPreviewCache,
LinkPreviewService,
PageViewportServiceExtension,
ThemeService,
ToolbarRegistryExtension,
} from '@blocksuite/affine-shared/services';
import { InteractivityManager, ToolController } from '@blocksuite/std/gfx';
import { clipboardConfigs } from './clipboard';
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,
FileSizeLimitService,
LinkPreviewCache,
LinkPreviewService,
]);
context.register(clipboardConfigs);
if (this.isEdgeless(context.scope)) {
context.register([InteractivityManager, ToolController]);
}
}
}