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