mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 02:45:54 +01:00
bookmark buttons should behave similarly as other launcher buttons in respect to context menu, ctrl-click, left click
This commit is contained in:
@@ -42,30 +42,18 @@ export default class NoteLauncher extends AbstractLauncher {
|
||||
|
||||
if (!evt) {
|
||||
// keyboard shortcut
|
||||
await this.openInSameTab(targetNoteId, hoistedNoteId);
|
||||
await appContext.tabManager.openInSameTab(targetNoteId, hoistedNoteId);
|
||||
} else {
|
||||
const ctrlKey = utils.isCtrlKey(evt);
|
||||
|
||||
if ((evt.which === 1 && ctrlKey) || evt.which === 2) {
|
||||
await this.openInNewTab(targetNoteId, hoistedNoteId);
|
||||
await appContext.tabManager.openInNewTab(targetNoteId, hoistedNoteId);
|
||||
} else {
|
||||
await this.openInSameTab(targetNoteId, hoistedNoteId);
|
||||
await appContext.tabManager.openInSameTab(targetNoteId, hoistedNoteId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async openInNewTab(targetNoteId, hoistedNoteId) {
|
||||
const noteContext = await appContext.tabManager.openEmptyTab(null, hoistedNoteId);
|
||||
|
||||
await noteContext.setNote(targetNoteId);
|
||||
}
|
||||
|
||||
async openInSameTab(targetNoteId, hoistedNoteId) {
|
||||
const activeContext = appContext.tabManager.getActiveContext();
|
||||
await activeContext.setHoistedNoteId(hoistedNoteId);
|
||||
await activeContext.setNote(targetNoteId);
|
||||
}
|
||||
|
||||
getTargetNoteId() {
|
||||
const targetNoteId = this.launcherNote.getRelationValue('targetNote');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user