mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
handle middle click hide-tab in onclick handler
This commit is contained in:
parent
3fae03da98
commit
67e716466f
@ -365,7 +365,10 @@ RED.tabs = (function() {
|
||||
|
||||
var thisTabA = thisTab.find("a");
|
||||
if (options.onclick) {
|
||||
options.onclick(tabs[thisTabA.attr('href').slice(1)]);
|
||||
options.onclick(tabs[thisTabA.attr('href').slice(1)], evt);
|
||||
if (evt.isDefaultPrevented() && evt.isPropagationStopped()) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
activateTab(thisTabA);
|
||||
if (fireSelectionChanged) {
|
||||
@ -548,6 +551,7 @@ RED.tabs = (function() {
|
||||
ul.find("li.red-ui-tab a")
|
||||
.on("mousedown", function(evt) { mousedownTab = evt.currentTarget })
|
||||
.on("mouseup",onTabClick)
|
||||
.on("auxclick", function(evt) { evt.preventDefault() })
|
||||
.on("click", function(evt) {evt.preventDefault(); })
|
||||
.on("dblclick", function(evt) {evt.stopPropagation(); evt.preventDefault(); })
|
||||
|
||||
@ -816,15 +820,9 @@ RED.tabs = (function() {
|
||||
}
|
||||
link.on("mousedown", function(evt) { mousedownTab = evt.currentTarget })
|
||||
link.on("mouseup",onTabClick);
|
||||
link.on("auxclick", function(evt) { evt.preventDefault() })
|
||||
link.on("click", function(evt) { evt.preventDefault(); })
|
||||
link.on("dblclick", function(evt) { evt.stopPropagation(); evt.preventDefault(); })
|
||||
// on middle click, close the tab
|
||||
link.on("auxclick", function(evt) {
|
||||
if (evt.which === 2) {
|
||||
evt.preventDefault();
|
||||
removeTab(tab.id);
|
||||
}
|
||||
});
|
||||
|
||||
$('<span class="red-ui-tabs-fade"></span>').appendTo(li);
|
||||
|
||||
|
@ -359,11 +359,17 @@ RED.workspaces = (function() {
|
||||
RED.sidebar.config.refresh();
|
||||
RED.view.focus();
|
||||
},
|
||||
onclick: function(tab) {
|
||||
onclick: function(tab, evt) {
|
||||
if(evt.which === 2) {
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
RED.actions.invoke("core:hide-flow", tab)
|
||||
} else {
|
||||
if (tab.id !== activeWorkspace) {
|
||||
addToViewStack(activeWorkspace);
|
||||
}
|
||||
RED.view.focus();
|
||||
}
|
||||
},
|
||||
ondblclick: function(tab) {
|
||||
if (tab.type != "subflow") {
|
||||
|
Loading…
x
Reference in New Issue
Block a user