mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-01 17:39:55 +08:00
04531508cb
Closes: BS-3393 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new "Embed Doc" block, enabling embedding and rendering of linked and synced documents within cards, including support for banners and note previews. - Added new toolbar and quick search options for inserting embedded linked and synced documents. - **Improvements** - Updated dependencies and internal references to support the new embed doc functionality across related blocks and components. - Enhanced support for edgeless environments with new clipboard and configuration options for embedded docs. - **Refactor** - Streamlined and reorganized embed-related code, moving linked and synced doc logic into a dedicated embed doc module. - Removed obsolete adapter and utility files to simplify maintenance. - **Chores** - Updated project and TypeScript configuration files to include the new embed doc module in builds and references. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
61 lines
1.7 KiB
TypeScript
61 lines
1.7 KiB
TypeScript
import {
|
|
type ViewExtensionContext,
|
|
ViewExtensionProvider,
|
|
} from '@blocksuite/affine-ext-loader';
|
|
|
|
import { effects } from './effects';
|
|
import {
|
|
EdgelessClipboardEmbedFigmaConfig,
|
|
EmbedFigmaViewExtensions,
|
|
} from './embed-figma-block';
|
|
import {
|
|
EdgelessClipboardEmbedGithubConfig,
|
|
EmbedGithubViewExtensions,
|
|
} from './embed-github-block';
|
|
import {
|
|
EdgelessClipboardEmbedHtmlConfig,
|
|
EmbedHtmlViewExtensions,
|
|
} from './embed-html-block';
|
|
import {
|
|
EdgelessClipboardEmbedIframeConfig,
|
|
EmbedIframeViewExtensions,
|
|
} from './embed-iframe-block';
|
|
import {
|
|
EdgelessClipboardEmbedLoomConfig,
|
|
EmbedLoomViewExtensions,
|
|
} from './embed-loom-block';
|
|
import {
|
|
EdgelessClipboardEmbedYoutubeConfig,
|
|
EmbedYoutubeViewExtensions,
|
|
} from './embed-youtube-block';
|
|
|
|
export class EmbedViewExtension extends ViewExtensionProvider {
|
|
override name = 'affine-embed-block';
|
|
|
|
override effect(): void {
|
|
super.effect();
|
|
effects();
|
|
}
|
|
|
|
override setup(context: ViewExtensionContext) {
|
|
super.setup(context);
|
|
context.register(EmbedFigmaViewExtensions);
|
|
context.register(EmbedGithubViewExtensions);
|
|
context.register(EmbedLoomViewExtensions);
|
|
context.register(EmbedYoutubeViewExtensions);
|
|
context.register(EmbedHtmlViewExtensions);
|
|
context.register(EmbedIframeViewExtensions);
|
|
const isEdgeless = this.isEdgeless(context.scope);
|
|
if (isEdgeless) {
|
|
context.register([
|
|
EdgelessClipboardEmbedFigmaConfig,
|
|
EdgelessClipboardEmbedGithubConfig,
|
|
EdgelessClipboardEmbedHtmlConfig,
|
|
EdgelessClipboardEmbedLoomConfig,
|
|
EdgelessClipboardEmbedYoutubeConfig,
|
|
EdgelessClipboardEmbedIframeConfig,
|
|
]);
|
|
}
|
|
}
|
|
}
|