mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 20:35:17 +02:00
Fix stuck-spinners in entity properties
This commit is contained in:
parent
fe482b35ff
commit
b6942e2300
1 changed files with 6 additions and 2 deletions
|
@ -508,18 +508,22 @@
|
||||||
// To make this work we block the first mouseup event after the elements
|
// To make this work we block the first mouseup event after the elements
|
||||||
// received focus. If we block all mouseup events the user will not
|
// received focus. If we block all mouseup events the user will not
|
||||||
// be able to click within the selected text.
|
// be able to click within the selected text.
|
||||||
|
// We also check to see if the value has changed to make sure we aren't
|
||||||
|
// blocking a mouse-up event when clicking on an input spinner.
|
||||||
var els = document.querySelectorAll("input, textarea");
|
var els = document.querySelectorAll("input, textarea");
|
||||||
for (var i = 0; i < els.length; i++) {
|
for (var i = 0; i < els.length; i++) {
|
||||||
var clicked = false;
|
var clicked = false;
|
||||||
|
var originalText;
|
||||||
els[i].onfocus = function() {
|
els[i].onfocus = function() {
|
||||||
|
originalText = this.value;
|
||||||
this.select();
|
this.select();
|
||||||
clicked = false;
|
clicked = false;
|
||||||
};
|
};
|
||||||
els[i].onmouseup = function(e) {
|
els[i].onmouseup = function(e) {
|
||||||
if (!clicked) {
|
if (!clicked && originalText == this.value) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
clicked = true;
|
|
||||||
}
|
}
|
||||||
|
clicked = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue