mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 19:14:59 +02:00
Update edit.js to auto close dropdowns when clicking outside
This commit is contained in:
parent
8faff57033
commit
fcfb1b7a4a
1 changed files with 9 additions and 0 deletions
|
@ -3018,6 +3018,13 @@ function toggleDropdown(event) {
|
|||
element.setAttribute("dropped", isDropped !== "true" ? "true" : "false");
|
||||
}
|
||||
|
||||
function closeAllDropdowns() {
|
||||
elDropdowns = document.querySelectorAll("div.dropdown > dl");
|
||||
for (let i = 0; i < elDropdowns.length; ++i) {
|
||||
elDropdowns[i].setAttribute('dropped', 'false');
|
||||
}
|
||||
}
|
||||
|
||||
function setDropdownValue(event) {
|
||||
let dt = event.target.parentNode.parentNode.previousSibling;
|
||||
dt.value = event.target.getAttribute("value");
|
||||
|
@ -3780,6 +3787,8 @@ function loaded() {
|
|||
property.elInput = dt;
|
||||
dt.addEventListener('change', createEmitTextPropertyUpdateFunction(property));
|
||||
}
|
||||
|
||||
document.addEventListener('click', function(ev) { closeAllDropdowns() }, true);
|
||||
|
||||
elDropdowns = document.getElementsByTagName("select");
|
||||
while (elDropdowns.length > 0) {
|
||||
|
|
Loading…
Reference in a new issue