escapeMarkup

This commit is contained in:
2026-03-09 21:49:02 +01:00
parent 3bb9f302ed
commit 1d9a521595

View File

@@ -59,11 +59,15 @@ class Settings {
$('#skinURLSelect').select2({ $('#skinURLSelect').select2({
templateResult: state => templateResult: state =>
state.id state.id
? $(`<img class="option result" src="${state.id}" title="${state.text}" loading="lazy"/>`) ? $(
`<img class="option result" src="${state.id}" title="${state.text}" loading="lazy"/>`,
)
: state.text, : state.text,
templateSelection: state => templateSelection: state =>
state.id state.id
? $(`<span class="option selection" style="--skin-url: url(${state.id})" title="${state.text}" loading="lazy"></span>`) ? $(
`<span class="option selection" style="--skin-url: url(${state.id})" title="${state.text}" loading="lazy"></span>`,
)
: state.text, : state.text,
theme: 'bootstrap-5', theme: 'bootstrap-5',
width: '100%', width: '100%',
@@ -72,6 +76,13 @@ class Settings {
dropdownParent: $('#settingsModal'), dropdownParent: $('#settingsModal'),
placeholder: "URL de l'image", placeholder: "URL de l'image",
tags: true, tags: true,
createTag: function (params) {
return {
id: $.fn.select2.defaults.defaults.escapeMarkup(params.term),
text: 'Ajouté manuellement',
newTag: true,
};
},
}); });
if (localStorage['skinURL']) { if (localStorage['skinURL']) {
if ( if (