mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
fix(web): only copy images via canvas (#22225)
This commit is contained in:
parent
afc4085b55
commit
0bbeb20595
4 changed files with 8 additions and 34 deletions
|
|
@ -23,6 +23,7 @@
|
|||
import ButtonContextMenu from '$lib/components/shared-components/context-menu/button-context-menu.svelte';
|
||||
import MenuOption from '$lib/components/shared-components/context-menu/menu-option.svelte';
|
||||
import { AppRoute } from '$lib/constants';
|
||||
import { photoViewerImgElement } from '$lib/stores/assets-store.svelte';
|
||||
import { featureFlags } from '$lib/stores/server-config.store';
|
||||
import { user } from '$lib/stores/user.store';
|
||||
import { photoZoomState } from '$lib/stores/zoom-image.store';
|
||||
|
|
@ -151,7 +152,7 @@
|
|||
onclick={onZoomImage}
|
||||
/>
|
||||
{/if}
|
||||
{#if canCopyImageToClipboard() && asset.type === AssetTypeEnum.Image}
|
||||
{#if canCopyImageToClipboard() && asset.type === AssetTypeEnum.Image && $photoViewerImgElement}
|
||||
<IconButton
|
||||
color="secondary"
|
||||
variant="ghost"
|
||||
|
|
|
|||
|
|
@ -92,20 +92,13 @@
|
|||
};
|
||||
|
||||
copyImage = async () => {
|
||||
if (!canCopyImageToClipboard()) {
|
||||
if (!canCopyImageToClipboard() || !$photoViewerImgElement) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const result = await copyImageToClipboard($photoViewerImgElement ?? assetFileUrl);
|
||||
if (result.success) {
|
||||
notificationController.show({ type: NotificationType.Info, message: $t('copied_image_to_clipboard') });
|
||||
} else {
|
||||
notificationController.show({
|
||||
type: NotificationType.Error,
|
||||
message: $t('errors.clipboard_unsupported_mime_type', { values: { mimeType: result.mimeType } }),
|
||||
});
|
||||
}
|
||||
await copyImageToClipboard($photoViewerImgElement);
|
||||
notificationController.show({ type: NotificationType.Info, message: $t('copied_image_to_clipboard') });
|
||||
} catch (error) {
|
||||
handleError(error, $t('copy_error'));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue