This commit is contained in:
Tomas Dvorak
2025-05-29 12:53:39 +02:00
parent d2d12ba482
commit 454ba18c5e
+18 -8
View File
@@ -168,7 +168,7 @@
text-align: ${textAlign}; text-align: ${textAlign};
font-size: ${fontSize}; font-size: ${fontSize};
"> ">
${bannerLink ? `<a href="${bannerLink}" target="_blank" style="color: inherit; text-decoration: none;">${bannerText.replace(/\n/g, '<br>')}</a>` : bannerText.replace(/\n/g, '<br>')} ${bannerText.replace(/\n/g, '<br>')}
</div> </div>
</div> </div>
</div>`; </div>`;
@@ -190,7 +190,7 @@
font-size: ${fontSize}; font-size: ${fontSize};
display: block; display: block;
"> ">
${bannerLink ? `<a href="${bannerLink}" target="_blank" style="color: inherit; text-decoration: none;">${bannerText.replace(/\n/g, '<br>')}</a>` : bannerText.replace(/\n/g, '<br>')} ${bannerText.replace(/\n/g, '<br>')}
</div>`; </div>`;
} }
@@ -215,10 +215,8 @@
font-size: ${fontSize}; font-size: ${fontSize};
`; `;
// Wrap text in link if URL is provided // Just use the text, link will be applied to the whole banner
const textElement = bannerLink const textElement = bannerText;
? `<a href="${bannerLink}" target="_blank" style="color: inherit; text-decoration: none;">${bannerText}</a>`
: bannerText;
content += ` content += `
<div class="banner-text" style="${textStyle}"> <div class="banner-text" style="${textStyle}">
@@ -229,8 +227,20 @@
// Text is already added in the previous conditions // Text is already added in the previous conditions
// Set the content and make banner visible // Wrap the entire content in a link if bannerLink exists
bannerContent.innerHTML = content; if (bannerLink) {
bannerContent.innerHTML = `
<a href="${bannerLink}" target="_blank" style="
display: block;
text-decoration: none;
color: inherit;
">
${content}
</a>
`;
} else {
bannerContent.innerHTML = content;
}
// Log the content for debugging // Log the content for debugging
console.log('Banner content:', content); console.log('Banner content:', content);