change default action of clicking note to open in new tab

This commit is contained in:
Teven Feng 2023-04-28 03:51:54 +00:00
parent 0896000fcd
commit 81ca4f3309
2 changed files with 16 additions and 1 deletions

View File

@ -293,6 +293,15 @@ export default class TabManager extends Component {
const hoistedNoteId = opts.hoistedNoteId || 'root';
const viewMode = opts.viewMode || "default";
const targetNoteId = await treeService.getNoteIdFromNotePath(notePath);
for (const openedNoteContext of this.getNoteContexts()) {
if (openedNoteContext.note && openedNoteContext.note.noteId === targetNoteId) {
this.activateNoteContext(openedNoteContext.ntxId, true);
return;
}
}
const noteContext = await this.openEmptyTab(ntxId, hoistedNoteId, mainNtxId);
if (notePath) {

View File

@ -363,7 +363,13 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
this.tree.reactivate(true);
}
else {
node.setActive();
const noteId = node.data.noteId;
const notePath = treeService.getNotePath(node);
if (noteId.startsWith('_')) {
node.setActive();
} else {
appContext.tabManager.openTabWithNoteWithHoisting(notePath, true);
}
}
return false;