fix(web): only copy images via canvas (#22225)

This commit is contained in:
Jason Rasmussen 2025-09-21 15:34:10 -04:00 committed by GitHub
parent afc4085b55
commit 0bbeb20595
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 8 additions and 34 deletions

View file

@ -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'));
}