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 -->
This commit is contained in:
donteatfriedrice
2025-05-13 05:11:33 +00:00
parent cfe7b7cf29
commit 0d518adc5b
42 changed files with 830 additions and 169 deletions

View File

@@ -27,7 +27,6 @@ import {
customImageProxyMiddleware,
ImageProxyService,
} from '@blocksuite/affine/shared/adapters';
import { LinkPreviewerService } from '@blocksuite/affine/shared/services';
import {
FrameworkScope,
useLiveData,
@@ -139,11 +138,6 @@ const DetailPageImpl = () => {
server.baseUrl
).toString();
const linkPreviewUrl = new URL(
BUILD_CONFIG.linkPreviewUrl,
server.baseUrl
).toString();
editorContainer.std.clipboard.use(
customImageProxyMiddleware(imageProxyUrl)
);
@@ -151,9 +145,6 @@ const DetailPageImpl = () => {
.get(ImageProxyService)
.setImageProxyURL(imageProxyUrl);
// provide link preview endpoint to blocksuite
editorContainer.doc.get(LinkPreviewerService).setEndpoint(linkPreviewUrl);
// provide page mode and updated date to blocksuite
const refNodeService =
editorContainer.std.getOptional(RefNodeSlotsProvider);