feat(ui): open in new tab @ hoverable image

This commit is contained in:
psychedelicious 2023-04-24 22:11:37 +10:00
parent bee29714d9
commit c1b10b2222
2 changed files with 9 additions and 1 deletions

View File

@ -99,7 +99,8 @@
"loading": "Loading", "loading": "Loading",
"loadingInvokeAI": "Loading Invoke AI", "loadingInvokeAI": "Loading Invoke AI",
"random": "Random", "random": "Random",
"generate": "Generate" "generate": "Generate",
"openInNewTab": "Open in New Tab"
}, },
"gallery": { "gallery": {
"generations": "Generations", "generations": "Generations",

View File

@ -169,11 +169,18 @@ const HoverableImage = memo((props: HoverableImageProps) => {
// dispatch(setIsLightboxOpen(true)); // dispatch(setIsLightboxOpen(true));
}; };
const handleOpenInNewTab = () => {
window.open(getUrl(image.url), '_blank');
};
return ( return (
<ContextMenu<HTMLDivElement> <ContextMenu<HTMLDivElement>
menuProps={{ size: 'sm', isLazy: true }} menuProps={{ size: 'sm', isLazy: true }}
renderMenu={() => ( renderMenu={() => (
<MenuList> <MenuList>
<MenuItem onClickCapture={handleOpenInNewTab}>
{t('common.openInNewTab')}
</MenuItem>
{!disabledFeatures.includes('lightbox') && ( {!disabledFeatures.includes('lightbox') && (
<MenuItem onClickCapture={handleLightBox}> <MenuItem onClickCapture={handleLightBox}>
{t('parameters.openInViewer')} {t('parameters.openInViewer')}