Skip to content

Build your personal knowledge base with Trilium Notes

Open an image in a new tab using ctrl+shift+click

SiriusXT5944d0acf4f4
diff --git a/apps/client/src/widgets/type_widgets/abstract_text_type_widget.ts b/apps/client/src/widgets/type_widgets/abstract_text_type_widget.ts
index 2ff3e02bba..71bd2a57c7 100644
--- a/apps/client/src/widgets/type_widgets/abstract_text_type_widget.ts
+++ b/apps/client/src/widgets/type_widgets/abstract_text_type_widget.ts
@@ -20,9 +20,10 @@ export default class AbstractTextTypeWidget extends TypeWidget {
const isLeftClick = e.which === 1;
const isMiddleClick = e.which === 2;
const ctrlKey = utils.isCtrlKey(e);
+ const activate = (isLeftClick && ctrlKey && e.shiftKey) || (isMiddleClick && e.shiftKey);
if ((isLeftClick && ctrlKey) || isMiddleClick) {
- this.openImageInNewTab($(e.target));
+ this.openImageInNewTab($(e.target), activate);
} else if (isLeftClick && singleClickOpens) {
this.openImageInCurrentTab($(e.target));
}
@@ -39,11 +40,11 @@ export default class AbstractTextTypeWidget extends TypeWidget {
}
}
- async openImageInNewTab($img: JQuery<HTMLElement>) {
+ async openImageInNewTab($img: JQuery<HTMLElement>, activate: boolean = false) {
const parsedImage = await this.parseFromImage($img);
if (parsedImage) {
- appContext.tabManager.openTabWithNoteWithHoisting(parsedImage.noteId, { viewScope: parsedImage.viewScope });
+ appContext.tabManager.openTabWithNoteWithHoisting(parsedImage.noteId, { activate, viewScope: parsedImage.viewScope });
} else {
window.open($img.prop("src"), "_blank");
}