mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Prevent rogue mouseup on tab from triggering tab change
This commit is contained in:
parent
785c349adc
commit
45afd06047
@ -29,6 +29,7 @@ RED.tabs = (function() {
|
|||||||
var currentTabWidth;
|
var currentTabWidth;
|
||||||
var currentActiveTabWidth = 0;
|
var currentActiveTabWidth = 0;
|
||||||
var collapsibleMenu;
|
var collapsibleMenu;
|
||||||
|
var mousedownTab;
|
||||||
var preferredOrder = options.order;
|
var preferredOrder = options.order;
|
||||||
var ul = options.element || $("#"+options.id);
|
var ul = options.element || $("#"+options.id);
|
||||||
var wrapper = ul.wrap( "<div>" ).parent();
|
var wrapper = ul.wrap( "<div>" ).parent();
|
||||||
@ -207,6 +208,11 @@ RED.tabs = (function() {
|
|||||||
if (dragActive) {
|
if (dragActive) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (evt.currentTarget !== mousedownTab) {
|
||||||
|
mousedownTab = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mousedownTab = null;
|
||||||
if (dblClickTime && Date.now()-dblClickTime < 400) {
|
if (dblClickTime && Date.now()-dblClickTime < 400) {
|
||||||
dblClickTime = 0;
|
dblClickTime = 0;
|
||||||
dblClickArmed = true;
|
dblClickArmed = true;
|
||||||
@ -445,6 +451,7 @@ RED.tabs = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ul.find("li.red-ui-tab a")
|
ul.find("li.red-ui-tab a")
|
||||||
|
.on("mousedown", function(evt) { mousedownTab = evt.currentTarget })
|
||||||
.on("mouseup",onTabClick)
|
.on("mouseup",onTabClick)
|
||||||
.on("click", function(evt) {evt.preventDefault(); })
|
.on("click", function(evt) {evt.preventDefault(); })
|
||||||
.on("dblclick", function(evt) {evt.stopPropagation(); evt.preventDefault(); })
|
.on("dblclick", function(evt) {evt.stopPropagation(); evt.preventDefault(); })
|
||||||
@ -636,6 +643,7 @@ RED.tabs = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
link.on("mousedown", function(evt) { mousedownTab = evt.currentTarget })
|
||||||
link.on("mouseup",onTabClick);
|
link.on("mouseup",onTabClick);
|
||||||
link.on("click", function(evt) { evt.preventDefault(); })
|
link.on("click", function(evt) { evt.preventDefault(); })
|
||||||
link.on("dblclick", function(evt) { evt.stopPropagation(); evt.preventDefault(); })
|
link.on("dblclick", function(evt) { evt.stopPropagation(); evt.preventDefault(); })
|
||||||
|
Loading…
Reference in New Issue
Block a user