Merge pull request #107 from elisee/middleclick-closes-tab
Close tab on middle-click (fixes #106)
This commit is contained in:
commit
9abc53b958
2 changed files with 11 additions and 0 deletions
|
@ -59,6 +59,7 @@ define([
|
|||
document.body.on("click", function(e) {
|
||||
//cancel on inputs, selectboxes
|
||||
if (["input", "select"].indexOf(e.target.tagName.toLowerCase()) >= 0) return;
|
||||
if (e.button != 0) return;
|
||||
//delegate all items with a command attribute
|
||||
if (e.target.hasAttribute("command")) {
|
||||
var command = e.target.getAttribute("command");
|
||||
|
|
|
@ -313,6 +313,15 @@ define([
|
|||
});
|
||||
};
|
||||
|
||||
var enableTabMiddleClick = function() {
|
||||
var tabContainer = document.find(".tabs");
|
||||
tabContainer.on("click", function(e) {
|
||||
if (!e.target.matches(".tab")) return;
|
||||
if (e.button != 1) return;
|
||||
command.fire("session:close-tab", e.target.getAttribute("argument"));
|
||||
});
|
||||
};
|
||||
|
||||
var init = function() {
|
||||
cfg.modes.forEach(function(mode) {
|
||||
var option = document.createElement("option");
|
||||
|
@ -323,6 +332,7 @@ define([
|
|||
addTab("");
|
||||
renderTabs();
|
||||
enableTabDragDrop();
|
||||
enableTabMiddleClick();
|
||||
reset();
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue