feat(ui): save the current staging image with shift+s

This commit is contained in:
Thomas Mello 2024-01-29 02:50:02 +03:00 committed by psychedelicious
parent b93695b78f
commit 30e11b4b42
2 changed files with 15 additions and 4 deletions

View File

@ -107,6 +107,17 @@ const IAICanvasStagingAreaToolbar = () => {
); );
}, [dispatch, imageDTO]); }, [dispatch, imageDTO]);
useHotkeys(
['shift+s'],
() => {
shouldShowStagingImage && handleSaveToGallery();
},
{
preventDefault: true,
},
[shouldShowStagingImage, handleSaveToGallery]
);
const handleDiscardStagingArea = useCallback(() => { const handleDiscardStagingArea = useCallback(() => {
dispatch(discardStagedImages()); dispatch(discardStagedImages());
}, [dispatch]); }, [dispatch]);
@ -167,7 +178,7 @@ const IAICanvasStagingAreaToolbar = () => {
colorScheme="invokeBlue" colorScheme="invokeBlue"
/> />
<IconButton <IconButton
tooltip={t('unifiedCanvas.saveToGallery')} tooltip={`${t('unifiedCanvas.saveToGallery')} (Shift+S)`}
aria-label={t('unifiedCanvas.saveToGallery')} aria-label={t('unifiedCanvas.saveToGallery')}
isDisabled={!imageDTO || !imageDTO.is_intermediate} isDisabled={!imageDTO || !imageDTO.is_intermediate}
icon={<PiFloppyDiskBold />} icon={<PiFloppyDiskBold />}

View File

@ -88,13 +88,13 @@ const IAICanvasToolbar = () => {
useHotkeys( useHotkeys(
['shift+s'], ['shift+s'],
() => { () => {
handleSaveToGallery(); !isStaging && handleSaveToGallery();
}, },
{ {
enabled: () => !isStaging, enabled: true,
preventDefault: true, preventDefault: true,
}, },
[] [isStaging]
); );
useHotkeys( useHotkeys(