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

View File

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