This commit is contained in:
Tomas Dvorak
2025-05-29 08:48:56 +02:00
parent dcda6707f5
commit bdf382b218
+16 -3
View File
@@ -1016,6 +1016,19 @@ function updateBannerPreview() {
} }
} }
// Initialize template object if not exists
let template = {
containerStyle: '',
textStyle: '',
bgColor: '#f8f9fa',
textColor: '#212529',
textAlign: 'left',
fontSize: 16,
padding: 20,
margin: 20,
borderRadius: 8
};
// Initialize when DOM is loaded // Initialize when DOM is loaded
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
// Initialize banner preview elements // Initialize banner preview elements
@@ -1793,7 +1806,7 @@ function updateBannerPreview() {
margin: 0; margin: 0;
padding: 10px 0; padding: 10px 0;
line-height: 1.5; line-height: 1.5;
${template.textStyle || ''} ${template?.textStyle || ''}
`; `;
const textElement = ` const textElement = `
@@ -1804,7 +1817,7 @@ function updateBannerPreview() {
// Create container with proper layout // Create container with proper layout
bannerContent = ` bannerContent = `
<div class="banner-content" style=" <div class="banner-content" style="
${template.containerStyle || ''} ${template?.containerStyle || ''}
padding: 20px; padding: 20px;
overflow: hidden; overflow: hidden;
display: flex; display: flex;
@@ -1834,7 +1847,7 @@ function updateBannerPreview() {
// No image, just show text // No image, just show text
bannerContent = ` bannerContent = `
<div class="banner-content" style=" <div class="banner-content" style="
${template.containerStyle || ''} ${template?.containerStyle || ''}
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;