diff --git a/CHANGELOG.md b/CHANGELOG.md index e73be78084..7d0fbfce19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ HumHub Changelog - Fix #324: Focus on active and selected nav page after reload on mobile - Fix #7170: Fix rendering of new line on email messages - Fix #7178: Highlight only words with 3 or more characters +- Fix #7182: Fix initialization of several select2 inputs on the same page 1.16.1 (July 1, 2024) --------------------- diff --git a/static/js/humhub/humhub.ui.additions.js b/static/js/humhub/humhub.ui.additions.js index 9ef3735d6b..ca64379b24 100644 --- a/static/js/humhub/humhub.ui.additions.js +++ b/static/js/humhub/humhub.ui.additions.js @@ -192,17 +192,19 @@ humhub.module('ui.additions', function (module, require, $) { : item.text; }; - $match.select2({ - theme: 'humhub', - tags: typeof $match.data('ui-select2-allow-new') !== 'undefined', - insertTag: function (data, tag) { - if (typeof $match.data('ui-select2-new-sign') !== 'undefined') { - tag.text += ' ' + $match.data('ui-select2-new-sign'); - } - data.unshift(tag); - }, - templateResult: templateItem, - templateSelection: templateItem, + $match.each(function () { + $(this).select2({ + theme: 'humhub', + tags: typeof $(this).data('ui-select2-allow-new') !== 'undefined', + insertTag: function (data, tag) { + if (typeof $(this).data('ui-select2-new-sign') !== 'undefined') { + tag.text += ' ' + $(this).data('ui-select2-new-sign'); + } + data.unshift(tag); + }, + templateResult: templateItem, + templateSelection: templateItem, + }); }); });