mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-20 11:36:25 +08:00
41d404f7f8
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Improved mobile experience by disabling certain toolbars and slash menu features on mobile devices. - Introduced new modular extension classes for editor and view customization, enabling more flexible configuration of themes, AI features, and editor enhancements. - Added clipboard adapter configurations for a wide range of data types, improving clipboard compatibility. - Added a new theme extension specifically for preview scenarios. - Provided new hooks for block scope management in document modules. - **Refactor** - Streamlined editor extension setup, consolidating options and reducing complexity for better maintainability. - Reorganized mobile-specific extension exports for clearer usage. - Refined React-to-Lit rendering API by introducing a typed alias and updating related function signatures. - Simplified extension registration by splitting monolithic view extension into separate common and editor view extensions. - **Bug Fixes** - Corrected naming inconsistencies in internal effect tracking. - **Chores** - Updated type exports and documentation comments for improved clarity and consistency. - Removed unused or redundant exports and functions to clean up the codebase. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
66 lines
1.5 KiB
TypeScript
66 lines
1.5 KiB
TypeScript
import {
|
|
AttachmentAdapter,
|
|
ClipboardAdapter,
|
|
HtmlAdapter,
|
|
ImageAdapter,
|
|
MixTextAdapter,
|
|
NotionTextAdapter,
|
|
} from '@blocksuite/affine-shared/adapters';
|
|
import { ClipboardAdapterConfigExtension } from '@blocksuite/std';
|
|
import type { ExtensionType } from '@blocksuite/store';
|
|
|
|
const SnapshotClipboardConfig = ClipboardAdapterConfigExtension({
|
|
mimeType: ClipboardAdapter.MIME,
|
|
adapter: ClipboardAdapter,
|
|
priority: 100,
|
|
});
|
|
|
|
const NotionClipboardConfig = ClipboardAdapterConfigExtension({
|
|
mimeType: 'text/_notion-text-production',
|
|
adapter: NotionTextAdapter,
|
|
priority: 95,
|
|
});
|
|
|
|
const HtmlClipboardConfig = ClipboardAdapterConfigExtension({
|
|
mimeType: 'text/html',
|
|
adapter: HtmlAdapter,
|
|
priority: 90,
|
|
});
|
|
|
|
const imageClipboardConfigs = [
|
|
'image/apng',
|
|
'image/avif',
|
|
'image/gif',
|
|
'image/jpeg',
|
|
'image/png',
|
|
'image/svg+xml',
|
|
'image/webp',
|
|
].map(mimeType => {
|
|
return ClipboardAdapterConfigExtension({
|
|
mimeType,
|
|
adapter: ImageAdapter,
|
|
priority: 80,
|
|
});
|
|
});
|
|
|
|
const PlainTextClipboardConfig = ClipboardAdapterConfigExtension({
|
|
mimeType: 'text/plain',
|
|
adapter: MixTextAdapter,
|
|
priority: 70,
|
|
});
|
|
|
|
const AttachmentClipboardConfig = ClipboardAdapterConfigExtension({
|
|
mimeType: '*/*',
|
|
adapter: AttachmentAdapter,
|
|
priority: 60,
|
|
});
|
|
|
|
export const clipboardConfigs: ExtensionType[] = [
|
|
SnapshotClipboardConfig,
|
|
NotionClipboardConfig,
|
|
HtmlClipboardConfig,
|
|
...imageClipboardConfigs,
|
|
PlainTextClipboardConfig,
|
|
AttachmentClipboardConfig,
|
|
];
|