mirror of
https://github.com/zen-browser/desktop.git
synced 2025-09-05 19:08:18 +00:00
feat: Open new tab on middle click in tab bar
This commit adds the ability to open a new tab by middle-clicking the tab bar. The functionality is implemented by adding an event listener for the "mouseup" event on the tab bar and checking if the middle mouse button was clicked. If so, it calls the `BrowserCommands.openTab()` function to open a new tab and prevents the default behavior of the event.
This commit is contained in:
@@ -84,6 +84,20 @@ var gZenVerticalTabsManager = {
|
||||
gZenCompactModeManager.addEventListener(updateEvent);
|
||||
this._updateEvent();
|
||||
this.initRightSideOrderContextMenu();
|
||||
|
||||
let tabs = document.getElementById("tabbrowser-tabs");
|
||||
|
||||
if (tabs) {
|
||||
tabs.addEventListener("mouseup", this.openNewTabOnTabsMiddleClick.bind(this));
|
||||
}
|
||||
},
|
||||
|
||||
openNewTabOnTabsMiddleClick(event) {
|
||||
if (event.button === 1 && event.target.id === "tabbrowser-tabs") {
|
||||
BrowserCommands.openTab({ event });
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
}
|
||||
},
|
||||
|
||||
get navigatorToolbox() {
|
||||
|
Reference in New Issue
Block a user