mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 14:58:03 +02:00
Merge pull request #12438 from ctrlaltdavid/21757
Fix selecting values when tabbing between entity properties fields
This commit is contained in:
commit
cfbe082074
1 changed files with 7 additions and 37 deletions
|
@ -509,15 +509,6 @@ function unbindAllInputs() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearSelection() {
|
|
||||||
if (document.selection && document.selection.empty) {
|
|
||||||
document.selection.empty();
|
|
||||||
} else if (window.getSelection) {
|
|
||||||
var sel = window.getSelection();
|
|
||||||
sel.removeAllRanges();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function showParentMaterialNameBox(number, elNumber, elString) {
|
function showParentMaterialNameBox(number, elNumber, elString) {
|
||||||
if (number) {
|
if (number) {
|
||||||
$('#property-parent-material-id-number-container').show();
|
$('#property-parent-material-id-number-container').show();
|
||||||
|
@ -827,8 +818,10 @@ function loaded() {
|
||||||
if (lastEntityID !== '"' + properties.id + '"' && lastEntityID !== null && editor !== null) {
|
if (lastEntityID !== '"' + properties.id + '"' && lastEntityID !== null && editor !== null) {
|
||||||
saveJSONUserData(true);
|
saveJSONUserData(true);
|
||||||
}
|
}
|
||||||
// the event bridge and json parsing handle our avatar id string differently.
|
|
||||||
|
|
||||||
|
var doSelectElement = lastEntityID === '"' + properties.id + '"';
|
||||||
|
|
||||||
|
// the event bridge and json parsing handle our avatar id string differently.
|
||||||
lastEntityID = '"' + properties.id + '"';
|
lastEntityID = '"' + properties.id + '"';
|
||||||
elID.value = properties.id;
|
elID.value = properties.id;
|
||||||
|
|
||||||
|
@ -1193,12 +1186,10 @@ function loaded() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var activeElement = document.activeElement;
|
var activeElement = document.activeElement;
|
||||||
|
if (doSelectElement && typeof activeElement.select !== "undefined") {
|
||||||
if (typeof activeElement.select !== "undefined") {
|
|
||||||
activeElement.select();
|
activeElement.select();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
clearSelection();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1761,34 +1752,13 @@ function loaded() {
|
||||||
};
|
};
|
||||||
|
|
||||||
// For input and textarea elements, select all of the text on focus
|
// For input and textarea elements, select all of the text on focus
|
||||||
// WebKit-based browsers, such as is used with QWebView, have a quirk
|
|
||||||
// where the mouseup event comes after the focus event, causing the
|
|
||||||
// text to be deselected immediately after selecting all of the text.
|
|
||||||
// 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
|
|
||||||
// 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;
|
els[i].onfocus = function (e) {
|
||||||
var originalText;
|
e.target.select();
|
||||||
// TODO FIXME: (JSHint) Functions declared within loops referencing
|
|
||||||
// an outer scoped variable may lead to confusing semantics.
|
|
||||||
els[i].onfocus = function(e) {
|
|
||||||
originalText = this.value;
|
|
||||||
this.select();
|
|
||||||
clicked = false;
|
|
||||||
};
|
|
||||||
// TODO FIXME: (JSHint) Functions declared within loops referencing
|
|
||||||
// an outer scoped variable may lead to confusing semantics.
|
|
||||||
els[i].onmouseup = function(e) {
|
|
||||||
if (!clicked && originalText === this.value) {
|
|
||||||
e.preventDefault();
|
|
||||||
}
|
|
||||||
clicked = true;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
bindAllNonJSONEditorElements();
|
bindAllNonJSONEditorElements();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue