Allow tabs to be closed with middle click (#3633)

Enables closing backend tabs with the middle mouse click. Credit to @AxDSan. Fixes #1970.
This commit is contained in:
0x90 2018-07-25 13:54:49 -04:00 committed by Luke Towers
parent ab9dcaf09c
commit d5829c75cf
2 changed files with 7 additions and 0 deletions

View File

@ -38,6 +38,12 @@
var force = (data !== undefined && data.force !== undefined) ? data.force : false;
self.closeTab($(ev.target).closest('ul.nav-tabs > li, div.tab-content > div'), force)
})
this.$el.on('mousedown', "li[data-tab-id]", function (ev) {
if (ev.which === 2) {
$(ev.target).trigger('close.oc.tab');
}
})
this.$el.on('toggleCollapse.oc.tab', function(ev, data){
ev.preventDefault()

View File

@ -4440,6 +4440,7 @@ Tab.prototype.init=function(){var self=this;this.options.slidable=this.options.s
$('> li',this.$tabsContainer).each(function(index){self.initTab(this)})
this.$el.on('close.oc.tab',function(ev,data){ev.preventDefault()
var force=(data!==undefined&&data.force!==undefined)?data.force:false;self.closeTab($(ev.target).closest('ul.nav-tabs > li, div.tab-content > div'),force)})
this.$el.on('mousedown',"li[data-tab-id]",function(ev){if(ev.which===2){$(ev.target).trigger('close.oc.tab');}})
this.$el.on('toggleCollapse.oc.tab',function(ev,data){ev.preventDefault()
$(ev.target).closest('div.tab-content > div').toggleClass('collapsed')})
this.$el.on('modified.oc.tab',function(ev){ev.preventDefault()