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

Commit d3a6079

Browse files
committed
Open in a new tab and activate notes when ctrl+click in tree
1 parent f0c735e commit d3a6079

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

apps/client/src/widgets/note_tree.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,9 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
230230
const notePath = treeService.getNotePath(node);
231231

232232
if (notePath) {
233-
appContext.tabManager.openTabWithNoteWithHoisting(notePath);
233+
appContext.tabManager.openTabWithNoteWithHoisting(notePath, {
234+
activate: e.shiftKey ? true : false
235+
});
234236
}
235237

236238
e.stopPropagation();
@@ -343,11 +345,12 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
343345
},
344346
scrollParent: this.$tree,
345347
minExpandLevel: 2, // root can't be collapsed
346-
click: (event, data): boolean => {
348+
click: (event: MouseEvent | JQuery.ClickEvent | JQuery.MouseDownEvent | React.PointerEvent<HTMLCanvasElement>, data): boolean => {
347349
this.activityDetected();
348350

349351
const targetType = data.targetType;
350352
const node = data.node;
353+
const ctrlKey = utils.isCtrlKey(event);
351354

352355
if (node.isSelected() && targetType === "icon") {
353356
this.triggerCommand("openBulkActionsDialog", {
@@ -356,7 +359,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
356359

357360
return false;
358361
} else if (targetType === "title" || targetType === "icon") {
359-
if (event.shiftKey) {
362+
if (event.shiftKey && !ctrlKey) {
360363
const activeNode = this.getActiveNode();
361364

362365
if (activeNode.getParent() !== node.getParent()) {
@@ -381,9 +384,11 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
381384
}
382385

383386
node.setFocus(true);
384-
} else if ((!utils.isMac() && event.ctrlKey) || (utils.isMac() && event.metaKey)) {
387+
} else if (ctrlKey) {
385388
const notePath = treeService.getNotePath(node);
386-
appContext.tabManager.openTabWithNoteWithHoisting(notePath);
389+
appContext.tabManager.openTabWithNoteWithHoisting(notePath, {
390+
activate: event.shiftKey ? true : false
391+
});
387392
} else if (event.altKey) {
388393
node.setSelected(!node.isSelected());
389394
node.setFocus(true);

0 commit comments

Comments
 (0)