This commit is contained in:
Tomas Dvorak
2025-05-29 10:52:15 +02:00
parent f50b64f876
commit 6f03f65e29
+32 -22
View File
@@ -153,41 +153,51 @@
</a>`; </a>`;
} }
// Add image to content based on position // Add content based on image position
if (['left', 'top'].includes(imagePosition)) { if (imagePosition === 'left' || imagePosition === 'right') {
content += imgContainer; // For side-by-side layout
} content += `
<div style="display: flex; flex-direction: ${imagePosition === 'left' ? 'row' : 'row-reverse'}; align-items: center; gap: 20px;">
// Add text content with proper spacing ${imgContainer}
if (bannerText) { <div style="flex: 1;">
const textStyle = ` <div class="banner-text" style="
margin: 0; margin: 0;
padding: 10px; padding: 10px;
line-height: 1.6; line-height: 1.6;
color: ${textColor}; color: ${textColor};
text-align: ${textAlign}; text-align: ${textAlign};
font-size: ${fontSize}; font-size: ${fontSize};
${['left', 'right'].includes(imagePosition) ? 'overflow: hidden;' : 'display: block;'} ">
${imagePosition === 'left' ? 'padding-left: 20px;' : ''} ${bannerLink ? `<a href="${bannerLink}" target="_blank" style="color: inherit; text-decoration: none;">${bannerText.replace(/\n/g, '<br>')}</a>` : bannerText.replace(/\n/g, '<br>')}
${imagePosition === 'right' ? 'padding-right: 20px;' : ''} </div>
`; </div>
</div>`;
// Wrap text in link if URL is provided } else {
const textContent = bannerText.replace(/\n/g, '<br>'); // For top/bottom layout
const textElement = bannerLink if (imagePosition === 'top' || imagePosition === 'bottom') {
? `<a href="${bannerLink}" target="_blank" style="color: inherit; text-decoration: none;">${textContent}</a>` content += imgContainer;
: textContent; }
// Add text
if (bannerText) {
content += ` content += `
<div class="banner-text" style="${textStyle}"> <div class="banner-text" style="
${textElement} margin: 0;
padding: 10px;
line-height: 1.6;
color: ${textColor};
text-align: ${textAlign};
font-size: ${fontSize};
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>')}
</div>`; </div>`;
} }
// Add image if position is right or bottom (only if not already added) if (imagePosition === 'bottom') {
if (['right', 'bottom'].includes(imagePosition) && !['left', 'top'].includes(imagePosition)) {
content += imgContainer; content += imgContainer;
} }
}
// Add clearfix if needed // Add clearfix if needed
if (['left', 'right'].includes(imagePosition)) { if (['left', 'right'].includes(imagePosition)) {