feat(ui): discard all staging images in canvas on escape

This commit is contained in:
Thomas Mello 2024-01-29 01:36:02 +03:00 committed by psychedelicious
parent b01311813b
commit b93695b78f

View File

@ -79,6 +79,16 @@ const IAICanvasStagingAreaToolbar = () => {
preventDefault: true, preventDefault: true,
}); });
useHotkeys(
['esc'],
() => {
handleDiscardStagingArea();
},
{
preventDefault: true,
}
);
const { data: imageDTO } = useGetImageDTOQuery(currentStagingAreaImage?.imageName ?? skipToken); const { data: imageDTO } = useGetImageDTOQuery(currentStagingAreaImage?.imageName ?? skipToken);
const handleToggleShouldShowStagingImage = useCallback(() => { const handleToggleShouldShowStagingImage = useCallback(() => {
@ -165,7 +175,7 @@ const IAICanvasStagingAreaToolbar = () => {
colorScheme="invokeBlue" colorScheme="invokeBlue"
/> />
<IconButton <IconButton
tooltip={t('unifiedCanvas.discardAll')} tooltip={`${t('unifiedCanvas.discardAll')} (Esc)`}
aria-label={t('unifiedCanvas.discardAll')} aria-label={t('unifiedCanvas.discardAll')}
icon={<PiXBold />} icon={<PiXBold />}
onClick={handleDiscardStagingArea} onClick={handleDiscardStagingArea}