mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-22 04:26:23 +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 {
|
|
EmbedEdgelessIcon,
|
|
EmbedPageIcon,
|
|
getLoadingIconWith,
|
|
ReloadIcon,
|
|
} from '@blocksuite/affine-components/icons';
|
|
import { ColorScheme } from '@blocksuite/affine-model';
|
|
import type { TemplateResult } from 'lit';
|
|
|
|
import {
|
|
DarkSyncedDocDeletedBanner,
|
|
DarkSyncedDocEmptyBanner,
|
|
DarkSyncedDocErrorBanner,
|
|
LightSyncedDocDeletedBanner,
|
|
LightSyncedDocEmptyBanner,
|
|
LightSyncedDocErrorBanner,
|
|
SyncedDocDeletedIcon,
|
|
SyncedDocErrorIcon,
|
|
} from './styles.js';
|
|
|
|
type SyncedCardImages = {
|
|
LoadingIcon: TemplateResult<1>;
|
|
SyncedDocIcon: TemplateResult<1>;
|
|
SyncedDocErrorIcon: TemplateResult<1>;
|
|
SyncedDocDeletedIcon: TemplateResult<1>;
|
|
ReloadIcon: TemplateResult<1>;
|
|
SyncedDocEmptyBanner: TemplateResult<1>;
|
|
SyncedDocErrorBanner: TemplateResult<1>;
|
|
SyncedDocDeletedBanner: TemplateResult<1>;
|
|
};
|
|
|
|
export function getSyncedDocIcons(
|
|
theme: ColorScheme,
|
|
editorMode: 'page' | 'edgeless'
|
|
): SyncedCardImages {
|
|
const LoadingIcon = getLoadingIconWith(theme);
|
|
if (theme === ColorScheme.Light) {
|
|
return {
|
|
LoadingIcon,
|
|
SyncedDocIcon: editorMode === 'page' ? EmbedPageIcon : EmbedEdgelessIcon,
|
|
SyncedDocErrorIcon,
|
|
SyncedDocDeletedIcon,
|
|
ReloadIcon,
|
|
SyncedDocEmptyBanner: LightSyncedDocEmptyBanner,
|
|
SyncedDocErrorBanner: LightSyncedDocErrorBanner,
|
|
SyncedDocDeletedBanner: LightSyncedDocDeletedBanner,
|
|
};
|
|
} else {
|
|
return {
|
|
LoadingIcon,
|
|
SyncedDocIcon: editorMode === 'page' ? EmbedPageIcon : EmbedEdgelessIcon,
|
|
SyncedDocErrorIcon,
|
|
SyncedDocDeletedIcon,
|
|
ReloadIcon,
|
|
SyncedDocEmptyBanner: DarkSyncedDocEmptyBanner,
|
|
SyncedDocErrorBanner: DarkSyncedDocErrorBanner,
|
|
SyncedDocDeletedBanner: DarkSyncedDocDeletedBanner,
|
|
};
|
|
}
|
|
}
|