refactor(editor): refactor linkPreviewer as an extension and remove bookmark service (#9754)

[BS-2427](https://linear.app/affine-design/issue/BS-2427/移除-bookmark-block-service) [BS-2418](https://linear.app/affine-design/issue/BS-2418/linkpreviewer-重构成插件)
This commit is contained in:
donteatfriedrice
2025-01-20 04:18:00 +00:00
parent cc2958203b
commit 4bd43a698c
17 changed files with 42 additions and 105 deletions
@@ -22,12 +22,9 @@ import { ViewService } from '@affine/core/modules/workbench/services/view';
import { WorkspaceService } from '@affine/core/modules/workspace';
import { i18nTime } from '@affine/i18n';
import {
BookmarkBlockService,
customImageProxyMiddleware,
EmbedGithubBlockService,
EmbedLoomBlockService,
EmbedYoutubeBlockService,
ImageBlockService,
LinkPreviewerService,
RefNodeSlotsProvider,
} from '@blocksuite/affine/blocks';
import { DisposableGroup } from '@blocksuite/affine/global/utils';
@@ -159,14 +156,9 @@ const DetailPageImpl = () => {
ImageBlockService.setImageProxyURL(BUILD_CONFIG.imageProxyUrl);
// provide link preview endpoint to blocksuite
BookmarkBlockService.setLinkPreviewEndpoint(BUILD_CONFIG.linkPreviewUrl);
EmbedGithubBlockService.setLinkPreviewEndpoint(
BUILD_CONFIG.linkPreviewUrl
);
EmbedYoutubeBlockService.setLinkPreviewEndpoint(
BUILD_CONFIG.linkPreviewUrl
);
EmbedLoomBlockService.setLinkPreviewEndpoint(BUILD_CONFIG.linkPreviewUrl);
editorHost?.doc
.get(LinkPreviewerService)
.setEndpoint(BUILD_CONFIG.linkPreviewUrl);
// provide page mode and updated date to blocksuite
const refNodeService = editorHost?.std.getOptional(RefNodeSlotsProvider);