mirror of
https://ark.sudovanilla.org/Korbs/electron-tabs.git
synced 2024-12-22 19:43:53 +00:00
Middle click on a tab closes it
This commit is contained in:
parent
77e36dbffd
commit
9f50d55dcd
11
index.js
11
index.js
|
@ -108,9 +108,8 @@ class Tab {
|
|||
this.setIcon(this.iconURL);
|
||||
this.setButtons();
|
||||
|
||||
tab.addEventListener("click", this.activate.bind(this), false);
|
||||
tab.addEventListener("click", this.tabClickHandler.bind(this), false);
|
||||
this.tabGroup.tabContainer.appendChild(this.tab);
|
||||
// TODO: handle middle click
|
||||
}
|
||||
|
||||
initWebview () {
|
||||
|
@ -158,6 +157,14 @@ class Tab {
|
|||
}
|
||||
}
|
||||
|
||||
tabClickHandler (e) {
|
||||
if (e.which === 1) {
|
||||
this.activate();
|
||||
} else if (e.which === 2) {
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
|
||||
activate () {
|
||||
let activeTab = this.tabGroup.getActiveTab();
|
||||
if (activeTab) {
|
||||
|
|
Loading…
Reference in a new issue