From: Alexander Ebert Date: Sat, 15 Jan 2022 12:47:21 +0000 (+0100) Subject: Incorrect behavior of legacy inline editors X-Git-Tag: 5.5.0_Alpha_1~211^2~3 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0468fa19424460f1930faaf4408f0a7cb8a1b122;p=GitHub%2FWoltLab%2FWCF.git Incorrect behavior of legacy inline editors Fixes #4633 --- diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index 2f08e09c0b..375c435ddf 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -5535,6 +5535,8 @@ if (COMPILER_TARGET_DEFAULT) { * @var string */ _quickOption: null, + + _dropDownIdToElementId: new Map(), /** * Initializes a new inline editor. @@ -5621,10 +5623,17 @@ if (COMPILER_TARGET_DEFAULT) { /** * Closes all inline editors. */ - _closeAll: function () { - for (var $elementID in this._elements) { - this._hide($elementID); + _closeAll: function (origin, identifier) { + let skipElementId = ""; + if (origin === "dropdown") { + skipElementId = this._dropDownIdToElementId.get(identifier || "") || ""; } + + Object.keys(this._elements).forEach((elementId) => { + if (elementId !== skipElementId) { + this._hide(elementId); + } + }); }, /** @@ -5673,12 +5682,21 @@ if (COMPILER_TARGET_DEFAULT) { if (parent && parent.nodeName === 'LI' && parent.childElementCount === 1) { // do not add a wrapper element if the trigger is the only child parent.classList.add('dropdown'); - } - else { + } else if (parent && parent.classList.contains("contentInteractionButton")) { + // "Content interaction" buttons use plain `
` elements, using + // them as the drop-down target allows the drop-down to be aligned + // with the entire element and not just a `` within. + parent.classList.add("dropdown"); + } else { $trigger.wrap(''); } this._dropdowns[$elementID] = $('