mirror of
https://github.com/zadam/trilium.git
synced 2025-11-18 03:00:41 +01:00
context menu on tab and "close all except for this tab"
This commit is contained in:
@@ -8,6 +8,7 @@ import NoteFull from "../entities/note_full.js";
|
||||
import bundleService from "./bundle.js";
|
||||
import utils from "./utils.js";
|
||||
import importDialog from "../dialogs/import.js";
|
||||
import contextMenuService from "./context_menu.js";
|
||||
|
||||
const chromeTabsEl = document.querySelector('.chrome-tabs');
|
||||
const chromeTabs = new ChromeTabs();
|
||||
@@ -263,6 +264,23 @@ chromeTabsEl.addEventListener('tabRemove', ({ detail }) => {
|
||||
console.log(`Removed tab ${tabId}`);
|
||||
});
|
||||
|
||||
$(chromeTabsEl).on('contextmenu', '.chrome-tab', e => {
|
||||
const tab = $(e.target).closest(".chrome-tab");
|
||||
|
||||
contextMenuService.initContextMenu(e, {
|
||||
getContextMenuItems: () => {
|
||||
return [
|
||||
{title: "Close all tabs except for this", cmd: "removeAllTabsExceptForThis", uiIcon: "empty"}
|
||||
];
|
||||
},
|
||||
selectContextMenuItem: (e, cmd) => {
|
||||
if (cmd === 'removeAllTabsExceptForThis') {
|
||||
chromeTabs.removeAllTabsExceptForThis(tab[0]);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
if (utils.isElectron()) {
|
||||
utils.bindShortcut('ctrl+w', () => {
|
||||
if (noteContexts.length === 1) {
|
||||
|
||||
Reference in New Issue
Block a user