From a3295380e589af44b9fc06c8d1981c58a90c185f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Grabowski?= Date: Mon, 14 Nov 2022 13:54:35 +0100 Subject: [PATCH] fixes after cr --- .../public/js/scripts/helpers/middle.ellipsis.js | 13 +++++++++---- .../Resources/views/themes/admin/ui/tag.html.twig | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/bundle/Resources/public/js/scripts/helpers/middle.ellipsis.js b/src/bundle/Resources/public/js/scripts/helpers/middle.ellipsis.js index 6a81a83c60..d0f1206efa 100644 --- a/src/bundle/Resources/public/js/scripts/helpers/middle.ellipsis.js +++ b/src/bundle/Resources/public/js/scripts/helpers/middle.ellipsis.js @@ -4,12 +4,14 @@ parseAll(entry.target); }); }); - const parseAll = (baseElement = doc) => { + const parse = (baseElement = doc) => { if (!baseElement) { + console.warn('No baseElement provided'); + return; } - const middleEllipsisContainers = [...doc.querySelectorAll('.ibexa-middle-ellipsis')]; + const middleEllipsisContainers = [...baseElement.querySelectorAll('.ibexa-middle-ellipsis')]; if (baseElement instanceof Element) { middleEllipsisContainers.push(baseElement); @@ -24,12 +26,15 @@ resizeEllipsisObserver.observe(middleEllipsisContainer); }); }; + // @deprecated, will be removed in 5.0 + const parseAll = () => parse(doc); const update = (baseElement, content) => { const contentElements = [...baseElement.querySelectorAll('.ibexa-middle-ellipsis__name-ellipsized')]; + const contentEscaped = ibexa.helpers.text.escapeHTML(content); - baseElement.dataset.bsOriginalTitle = content; + baseElement.dataset.bsOriginalTitle = contentEscaped; contentElements.forEach((contentElement) => { - contentElement.innerHTML = content; + contentElement.innerHTML = contentEscaped; }); parseAll(baseElement); }; diff --git a/src/bundle/Resources/views/themes/admin/ui/tag.html.twig b/src/bundle/Resources/views/themes/admin/ui/tag.html.twig index fd6c01db06..303d4fa3a9 100644 --- a/src/bundle/Resources/views/themes/admin/ui/tag.html.twig +++ b/src/bundle/Resources/views/themes/admin/ui/tag.html.twig @@ -2,7 +2,7 @@ {% set is_deletable = is_deletable is defined ? is_deletable : true %} {% set tag_attributes = tag_attributes|default({})|merge({ - 'class': (tag_attributes.class|default('') ~ ' ibexa-tag' ~ (is_deletable ? ' ibexa-tag--deletable'))|trim + class: (tag_attributes.class|default('') ~ ' ibexa-tag' ~ (is_deletable ? ' ibexa-tag--deletable'))|trim }) %}