diff --git a/public/src/modules/settings/sorted-list.js b/public/src/modules/settings/sorted-list.js index 90d5de1c90..806c6b148f 100644 --- a/public/src/modules/settings/sorted-list.js +++ b/public/src/modules/settings/sorted-list.js @@ -22,9 +22,7 @@ define('settings/sorted-list', [ var itemUUID = $(item).attr('data-sorted-list-uuid'); var formData = Settings.helper.serializeForm($('[data-sorted-list-object="' + key + '"][data-sorted-list-uuid="' + itemUUID + '"]')); - Object.entries(formData || {}).forEach(([field, value]) => { - formData[field] = utils.stripHTMLTags(value, utils.stripTags); - }); + stripTags(formData); values[key].push(formData); }); }, @@ -103,6 +101,7 @@ define('settings/sorted-list', [ var data = Settings.helper.serializeForm(form); + stripTags(data); app.parseAndTranslate(itemTpl, data, function (itemHtml) { itemHtml = $(itemHtml); @@ -123,9 +122,7 @@ define('settings/sorted-list', [ var $list = $container.find('[data-type="list"]'); var itemTpl = $container.attr('data-item-template'); - Object.entries(data || {}).forEach(([field, value]) => { - data[field] = utils.stripHTMLTags(value, utils.stripTags); - }); + stripTags(data); return new Promise((resolve) => { app.parseAndTranslate(itemTpl, data, function (itemHtml) { @@ -140,5 +137,11 @@ define('settings/sorted-list', [ }); } + function stripTags(data) { + return Object.entries(data || {}).forEach(([field, value]) => { + data[field] = utils.stripHTMLTags(value, utils.stripTags); + }); + } + return SortedList; });