mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
fix(editor): support copying single image from edgeless and pasting to page (#12709)
Closes: [BS-3586](https://linear.app/affine-design/issue/BS-3586/复制白板图片,然后粘贴到-page,图片失败) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Copying a single selected image in edgeless mode now places the image directly onto the system clipboard as a native image blob for smoother pasting. - **Bug Fixes** - Enhanced clipboard handling to better manage image and text data inclusion, with improved fallback for snapshot HTML. - **Tests** - Added an end-to-end test verifying image copy-paste functionality between edgeless and page editor modes. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -34,12 +34,12 @@ export const copyLinkToBlockStdScopeClipboard = async (
|
||||
|
||||
if (clipboardWriteIsSupported) {
|
||||
try {
|
||||
await clipboard.writeToClipboard(items => {
|
||||
items['text/plain'] = text;
|
||||
await clipboard.writeToClipboard(items => ({
|
||||
...items,
|
||||
'text/plain': text,
|
||||
// wrap a link
|
||||
items['text/html'] = `<a href="${text}">${text}</a>`;
|
||||
return items;
|
||||
});
|
||||
'text/html': `<a href="${text}">${text}</a>`,
|
||||
}));
|
||||
success = true;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
|
||||
Reference in New Issue
Block a user