Skip to content

Build your personal knowledge base with Trilium Notes

Open in a new tab and activate notes when ctrl+click in tree

SiriusXTd3a6079d9b05
diff --git a/apps/client/src/widgets/note_tree.ts b/apps/client/src/widgets/note_tree.ts
index cbc3ec0555..6f5f09585c 100644
--- a/apps/client/src/widgets/note_tree.ts
+++ b/apps/client/src/widgets/note_tree.ts
@@ -230,7 +230,9 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
const notePath = treeService.getNotePath(node);
if (notePath) {
- appContext.tabManager.openTabWithNoteWithHoisting(notePath);
+ appContext.tabManager.openTabWithNoteWithHoisting(notePath, {
+ activate: e.shiftKey ? true : false
+ });
}
e.stopPropagation();
@@ -343,11 +345,12 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
},
scrollParent: this.$tree,
minExpandLevel: 2, // root can't be collapsed
- click: (event, data): boolean => {
+ click: (event: MouseEvent | JQuery.ClickEvent | JQuery.MouseDownEvent | React.PointerEvent<HTMLCanvasElement>, data): boolean => {
this.activityDetected();
const targetType = data.targetType;
const node = data.node;
+ const ctrlKey = utils.isCtrlKey(event);
if (node.isSelected() && targetType === "icon") {
this.triggerCommand("openBulkActionsDialog", {
@@ -356,7 +359,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
return false;
} else if (targetType === "title" || targetType === "icon") {
- if (event.shiftKey) {
+ if (event.shiftKey && !ctrlKey) {
const activeNode = this.getActiveNode();
if (activeNode.getParent() !== node.getParent()) {
@@ -381,9 +384,11 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
}
node.setFocus(true);
- } else if ((!utils.isMac() && event.ctrlKey) || (utils.isMac() && event.metaKey)) {
+ } else if (ctrlKey) {
const notePath = treeService.getNotePath(node);
- appContext.tabManager.openTabWithNoteWithHoisting(notePath);
+ appContext.tabManager.openTabWithNoteWithHoisting(notePath, {
+ activate: event.shiftKey ? true : false
+ });
} else if (event.altKey) {
node.setSelected(!node.isSelected());
node.setFocus(true);