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

View File

@@ -1,13 +1,10 @@
import { useRefEffect } from '@affine/component';
import { EditorLoading } from '@affine/component/page-detail-skeleton';
import {
BookmarkBlockService,
customImageProxyMiddleware,
type DocMode,
EmbedGithubBlockService,
EmbedLoomBlockService,
EmbedYoutubeBlockService,
ImageBlockService,
LinkPreviewerService,
} from '@blocksuite/affine/blocks';
import { DisposableGroup } from '@blocksuite/affine/global/utils';
import type { AffineEditorContainer } from '@blocksuite/affine/presets';
@@ -71,19 +68,9 @@ const BlockSuiteEditorImpl = ({
);
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
);
editor.host?.doc
.get(LinkPreviewerService)
.setEndpoint(BUILD_CONFIG.linkPreviewUrl);
return editor.host?.updateComplete;
})