From: Alexander Ebert Date: Thu, 26 May 2022 11:45:20 +0000 (+0200) Subject: Show a text cursor while the item list accepts items X-Git-Tag: 5.5.0_Beta_4~15 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=76bf33b24896d2efe4c4c148a136d6b16e8d1b36;p=GitHub%2FWoltLab%2FWCF.git Show a text cursor while the item list accepts items --- diff --git a/ts/WoltLabSuite/Core/Ui/ItemList.ts b/ts/WoltLabSuite/Core/Ui/ItemList.ts index a9990cd35e..6807bc1609 100644 --- a/ts/WoltLabSuite/Core/Ui/ItemList.ts +++ b/ts/WoltLabSuite/Core/Ui/ItemList.ts @@ -26,6 +26,7 @@ function createUI(element: ItemListInputElement, options: ItemListOptions): UiDa const list = document.createElement("ol"); list.className = "inputItemList" + (element.disabled ? " disabled" : ""); + list.dataset.acceptsNewItems = "true"; list.dataset.elementId = element.id; list.addEventListener("click", (event) => { if (event.target === list) { @@ -123,9 +124,11 @@ function handleLimit(elementId: string): void { if (acceptsNewItems(elementId)) { DomUtil.show(data.element); DomUtil.hide(data.limitReached); + data.list.dataset.acceptsNewItems = "true"; } else { DomUtil.hide(data.element); DomUtil.show(data.limitReached); + data.list.dataset.acceptsNewItems = "false"; } } diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/ItemList.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/ItemList.js index 28a7853c56..0ead64c283 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/ItemList.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/ItemList.js @@ -25,6 +25,7 @@ define(["require", "exports", "tslib", "../Core", "../Dom/Traverse", "../Languag const parentElement = element.parentElement; const list = document.createElement("ol"); list.className = "inputItemList" + (element.disabled ? " disabled" : ""); + list.dataset.acceptsNewItems = "true"; list.dataset.elementId = element.id; list.addEventListener("click", (event) => { if (event.target === list) { @@ -109,10 +110,12 @@ define(["require", "exports", "tslib", "../Core", "../Dom/Traverse", "../Languag if (acceptsNewItems(elementId)) { Util_1.default.show(data.element); Util_1.default.hide(data.limitReached); + data.list.dataset.acceptsNewItems = "true"; } else { Util_1.default.hide(data.element); Util_1.default.show(data.limitReached); + data.list.dataset.acceptsNewItems = "false"; } } /** diff --git a/wcfsetup/install/files/style/ui/itemListInput.scss b/wcfsetup/install/files/style/ui/itemListInput.scss index 02902a8f81..3147587987 100644 --- a/wcfsetup/install/files/style/ui/itemListInput.scss +++ b/wcfsetup/install/files/style/ui/itemListInput.scss @@ -6,6 +6,10 @@ padding-bottom: 0; padding-top: 5px; + &[data-accepts-new-items="true"] { + cursor: text; + } + > .item, > .input { flex: 0 0 auto;