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:
parent
ab9dcaf09c
commit
d5829c75cf
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in New Issue