Skip to content

Commit

Permalink
added wrapInnerHTMLInPTag for single line entries
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmparrish committed Aug 12, 2024
1 parent dddcfaa commit c5e717f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions libs/blocks/hero-marquee/hero-marquee.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ function decorateBg(el) {
el.remove();
}

function wrapInnerHTMLInPTag(el) {
const innerDiv = el.querySelector(':scope > div');
const containsPTag = [...innerDiv.childNodes].some((node) => node.nodeName === 'P');
if (!containsPTag) innerDiv.innerHTML = `<p>${innerDiv.innerHTML}</p>`;
}

function decorateText(el, classes) {
el.classList.add('norm');
const btnClass = classes?.find((c) => c.endsWith('-button'));
Expand All @@ -95,6 +101,7 @@ function decorateText(el, classes) {
} else {
decorateButtons(el, 'button-xl');
}
wrapInnerHTMLInPTag(el);
decorateBlockText(el, textDefault);
decorateTextOverrides(el, ['-heading', '-body', '-detail']);
}
Expand Down

0 comments on commit c5e717f

Please sign in to comment.