Skip to content

Commit ddfa32d

Browse files
feat(ui): middle-mouse click on image opens in new tab
Closes #6809
1 parent be9c65b commit ddfa32d

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

invokeai/frontend/web/src/common/components/IAIDndImage.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,13 @@ const IAIDndImage = (props: IAIDndImageProps) => {
155155
return styles;
156156
}, [isUploadDisabled, minSize]);
157157

158+
const openInNewTab = useCallback(() => {
159+
if (!imageDTO) {
160+
return;
161+
}
162+
window.open(imageDTO.image_url, '_blank');
163+
}, [imageDTO]);
164+
158165
return (
159166
<ImageContextMenu imageDTO={imageDTO}>
160167
{(ref) => (
@@ -212,7 +219,12 @@ const IAIDndImage = (props: IAIDndImageProps) => {
212219
)}
213220
{!imageDTO && isUploadDisabled && noContentFallback}
214221
{imageDTO && !isDragDisabled && (
215-
<IAIDraggable data={draggableData} disabled={isDragDisabled || !imageDTO} onClick={onClick} />
222+
<IAIDraggable
223+
data={draggableData}
224+
disabled={isDragDisabled || !imageDTO}
225+
onClick={onClick}
226+
onAuxClick={openInNewTab}
227+
/>
216228
)}
217229
{children}
218230
{!isDropDisabled && <IAIDroppable data={droppableData} disabled={isDropDisabled} dropLabel={dropLabel} />}

0 commit comments

Comments
 (0)