Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit 5944d0a

Browse files
committed
Open an image in a new tab using ctrl+shift+click
1 parent 9765f2f commit 5944d0a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

apps/client/src/widgets/type_widgets/abstract_text_type_widget.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ export default class AbstractTextTypeWidget extends TypeWidget {
2020
const isLeftClick = e.which === 1;
2121
const isMiddleClick = e.which === 2;
2222
const ctrlKey = utils.isCtrlKey(e);
23+
const activate = (isLeftClick && ctrlKey && e.shiftKey) || (isMiddleClick && e.shiftKey);
2324

2425
if ((isLeftClick && ctrlKey) || isMiddleClick) {
25-
this.openImageInNewTab($(e.target));
26+
this.openImageInNewTab($(e.target), activate);
2627
} else if (isLeftClick && singleClickOpens) {
2728
this.openImageInCurrentTab($(e.target));
2829
}
@@ -39,11 +40,11 @@ export default class AbstractTextTypeWidget extends TypeWidget {
3940
}
4041
}
4142

42-
async openImageInNewTab($img: JQuery<HTMLElement>) {
43+
async openImageInNewTab($img: JQuery<HTMLElement>, activate: boolean = false) {
4344
const parsedImage = await this.parseFromImage($img);
4445

4546
if (parsedImage) {
46-
appContext.tabManager.openTabWithNoteWithHoisting(parsedImage.noteId, { viewScope: parsedImage.viewScope });
47+
appContext.tabManager.openTabWithNoteWithHoisting(parsedImage.noteId, { activate, viewScope: parsedImage.viewScope });
4748
} else {
4849
window.open($img.prop("src"), "_blank");
4950
}

0 commit comments

Comments
 (0)