From 03919854ce5dc2f2d49c892dbd9dc9523717aa11 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 5 Sep 2017 14:09:29 +0200 Subject: [PATCH] Reset FontAweosme search filter on show Fixes #2396 --- .../files/js/WoltLabSuite/Core/Ui/ItemList/Filter.js | 11 +++++++++-- .../js/WoltLabSuite/Core/Ui/Style/FontAwesome.js | 7 +++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/ItemList/Filter.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/ItemList/Filter.js index 8c717fe229..42a7de9a28 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/ItemList/Filter.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/ItemList/Filter.js @@ -78,8 +78,7 @@ define(['Core', 'EventKey', 'Language', 'List', 'StringUtil', 'Dom/Util'], funct clearButton.addEventListener('click', (function(event) { event.preventDefault(); - this._input.value = ''; - this._keyup(); + this.reset(); }).bind(this)); inputAddon.appendChild(input); @@ -94,6 +93,14 @@ define(['Core', 'EventKey', 'Language', 'List', 'StringUtil', 'Dom/Util'], funct this._fragment = null; }, + /** + * Resets the filter. + */ + reset: function () { + this._input.value = ''; + this._keyup(); + }, + /** * Builds the item list and rebuilds the items' DOM for easier manipulation. * diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Style/FontAwesome.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Style/FontAwesome.js index bb18f8aca1..e77213bb8c 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Style/FontAwesome.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Style/FontAwesome.js @@ -20,7 +20,7 @@ define(['Language', 'Ui/Dialog', 'WoltLabSuite/Core/Ui/ItemList/Filter'], functi return Fake; } - var _callback, _iconList; + var _callback, _iconList, _itemListFilter; var _icons = []; /** @@ -88,7 +88,7 @@ define(['Language', 'Ui/Dialog', 'WoltLabSuite/Core/Ui/ItemList/Filter'], functi _iconList.innerHTML = html; _iconList.addEventListener(WCF_CLICK_EVENT, this._click.bind(this)); - new UiItemListFilter('fontAwesomeIcons', { + _itemListFilter = new UiItemListFilter('fontAwesomeIcons', { callbackPrepareItem: function (item) { var small = elBySel('small', item); var text = small.textContent.trim(); @@ -101,6 +101,9 @@ define(['Language', 'Ui/Dialog', 'WoltLabSuite/Core/Ui/ItemList/Filter'], functi } }); }).bind(this), + onShow: function () { + _itemListFilter.reset(); + }, title: Language.get('wcf.global.fontAwesome.selectIcon') }, source: '' -- 2.20.1