prevent default context menu on tab right click, closes #656

This commit is contained in:
zadam 2019-10-10 19:34:55 +02:00
parent a15be82f00
commit 98a6670cb4
3 changed files with 7 additions and 5 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "trilium", "name": "trilium",
"version": "0.35.1", "version": "0.35.2",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -113,7 +113,7 @@ function addTextToEditor(text) {
} }
} }
function tabContextMenu(e) { function newTabContextMenu(e) {
const $link = $(e.target); const $link = $(e.target);
const notePath = getNotePathFromLink($link); const notePath = getNotePathFromLink($link);
@ -138,9 +138,9 @@ function tabContextMenu(e) {
}); });
} }
$(document).on('contextmenu', '.note-detail-text a', tabContextMenu); $(document).on('contextmenu', '.note-detail-text a', newTabContextMenu);
$(document).on('contextmenu', "a[data-action='note']", tabContextMenu); $(document).on('contextmenu', "a[data-action='note']", newTabContextMenu);
$(document).on('contextmenu', ".note-detail-render a", tabContextMenu); $(document).on('contextmenu', ".note-detail-render a", newTabContextMenu);
// when click on link popup, in case of internal link, just go the the referenced note instead of default behavior // when click on link popup, in case of internal link, just go the the referenced note instead of default behavior
// of opening the link in new window/tab // of opening the link in new window/tab

View File

@ -385,6 +385,8 @@ tabRow.addListener('tabRemove', async ({ detail }) => {
}); });
$(tabRow.el).on('contextmenu', '.note-tab', e => { $(tabRow.el).on('contextmenu', '.note-tab', e => {
e.preventDefault();
const tab = $(e.target).closest(".note-tab"); const tab = $(e.target).closest(".note-tab");
contextMenuService.initContextMenu(e, { contextMenuService.initContextMenu(e, {