mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat: add copy image in share menu
This commit is contained in:
parent
9ad76fe80c
commit
5478d2a15e
@ -48,6 +48,7 @@
|
|||||||
"sendTo": "Send to",
|
"sendTo": "Send to",
|
||||||
"sendToImg2Img": "Send to Image to Image",
|
"sendToImg2Img": "Send to Image to Image",
|
||||||
"sendToUnifiedCanvas": "Send To Unified Canvas",
|
"sendToUnifiedCanvas": "Send To Unified Canvas",
|
||||||
|
"copyImage": "Copy Image",
|
||||||
"copyImageToLink": "Copy Image To Link",
|
"copyImageToLink": "Copy Image To Link",
|
||||||
"downloadImage": "Download Image",
|
"downloadImage": "Download Image",
|
||||||
"openInViewer": "Open In Viewer",
|
"openInViewer": "Open In Viewer",
|
||||||
|
@ -133,6 +133,22 @@ const CurrentImageButtons = () => {
|
|||||||
dispatch(setActiveTab('img2img'));
|
dispatch(setActiveTab('img2img'));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleCopyImage = async () => {
|
||||||
|
if (!currentImage) return;
|
||||||
|
|
||||||
|
const blob = await fetch(currentImage.url).then((res) => res.blob());
|
||||||
|
const data = [new ClipboardItem({ [blob.type]: blob })];
|
||||||
|
|
||||||
|
await navigator.clipboard.write(data);
|
||||||
|
|
||||||
|
toast({
|
||||||
|
title: t('toast:imageCopied'),
|
||||||
|
status: 'success',
|
||||||
|
duration: 2500,
|
||||||
|
isClosable: true,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const handleCopyImageLink = () => {
|
const handleCopyImageLink = () => {
|
||||||
navigator.clipboard
|
navigator.clipboard
|
||||||
.writeText(
|
.writeText(
|
||||||
@ -412,6 +428,14 @@ const CurrentImageButtons = () => {
|
|||||||
>
|
>
|
||||||
{t('parameters:sendToUnifiedCanvas')}
|
{t('parameters:sendToUnifiedCanvas')}
|
||||||
</IAIButton>
|
</IAIButton>
|
||||||
|
|
||||||
|
<IAIButton
|
||||||
|
size={'sm'}
|
||||||
|
onClick={handleCopyImage}
|
||||||
|
leftIcon={<FaCopy />}
|
||||||
|
>
|
||||||
|
{t('parameters:copyImage')}
|
||||||
|
</IAIButton>
|
||||||
<IAIButton
|
<IAIButton
|
||||||
size={'sm'}
|
size={'sm'}
|
||||||
onClick={handleCopyImageLink}
|
onClick={handleCopyImageLink}
|
||||||
|
Loading…
Reference in New Issue
Block a user