mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): fix copying image link
This commit is contained in:
parent
7bfb5640ad
commit
fcf9c63049
@ -553,6 +553,7 @@
|
|||||||
"downloadImageStarted": "Image Download Started",
|
"downloadImageStarted": "Image Download Started",
|
||||||
"imageCopied": "Image Copied",
|
"imageCopied": "Image Copied",
|
||||||
"imageLinkCopied": "Image Link Copied",
|
"imageLinkCopied": "Image Link Copied",
|
||||||
|
"problemCopyingImageLink": "Unable to Copy Image Link",
|
||||||
"imageNotLoaded": "No Image Loaded",
|
"imageNotLoaded": "No Image Loaded",
|
||||||
"imageNotLoadedDesc": "Could not find image",
|
"imageNotLoadedDesc": "Could not find image",
|
||||||
"imageSavedToGallery": "Image Saved to Gallery",
|
"imageSavedToGallery": "Image Saved to Gallery",
|
||||||
|
@ -184,13 +184,32 @@ const CurrentImageButtons = (props: CurrentImageButtonsProps) => {
|
|||||||
// }, [getUrl, t, image?.url, toast]);
|
// }, [getUrl, t, image?.url, toast]);
|
||||||
|
|
||||||
const handleCopyImageLink = useCallback(() => {
|
const handleCopyImageLink = useCallback(() => {
|
||||||
const url = image
|
const getImageUrl = () => {
|
||||||
? shouldTransformUrls
|
if (!image) {
|
||||||
? getUrl(image.url)
|
return;
|
||||||
: window.location.toString() + image.url
|
}
|
||||||
: '';
|
|
||||||
|
if (shouldTransformUrls) {
|
||||||
|
return getUrl(image.url);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (image.url.startsWith('http')) {
|
||||||
|
return image.url;
|
||||||
|
}
|
||||||
|
|
||||||
|
return window.location.toString() + image.url;
|
||||||
|
};
|
||||||
|
|
||||||
|
const url = getImageUrl();
|
||||||
|
|
||||||
if (!url) {
|
if (!url) {
|
||||||
|
toast({
|
||||||
|
title: t('toast.problemCopyingImageLink'),
|
||||||
|
status: 'error',
|
||||||
|
duration: 2500,
|
||||||
|
isClosable: true,
|
||||||
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user