This commit is contained in:
Tomas Dvorak
2025-05-29 11:36:24 +02:00
parent 24eec9a867
commit 7f52f29d62
+9 -3
View File
@@ -1096,9 +1096,9 @@ document.addEventListener('DOMContentLoaded', () => {
const dropArea = document.getElementById('dropArea'); const dropArea = document.getElementById('dropArea');
// Initialize image position buttons // Initialize image position buttons
document.querySelectorAll('.position-btn').forEach(btn => { document.querySelectorAll('.image-pos-btn, .position-btn').forEach(btn => {
btn.addEventListener('click', function() { btn.addEventListener('click', function() {
document.querySelectorAll('.position-btn').forEach(b => { document.querySelectorAll('.image-pos-btn, .position-btn').forEach(b => {
b.classList.remove('active', 'btn-primary'); b.classList.remove('active', 'btn-primary');
b.classList.add('btn-outline-secondary'); b.classList.add('btn-outline-secondary');
}); });
@@ -1903,11 +1903,14 @@ function updateBannerPreview() {
const bannerTextContent = bannerText || 'Náhled banneru'; const bannerTextContent = bannerText || 'Náhled banneru';
if (hasImage && currentImage) { if (hasImage && currentImage) {
// Get image dimensions from inputs or use defaults // Get image dimensions and position from inputs or use defaults
const imageWidth = parseInt(document.getElementById('bannerImageWidth')?.value || '300'); const imageWidth = parseInt(document.getElementById('bannerImageWidth')?.value || '300');
const imageHeight = parseInt(document.getElementById('bannerImageHeight')?.value || '200'); const imageHeight = parseInt(document.getElementById('bannerImageHeight')?.value || '200');
const imagePosition = document.getElementById('bannerImagePosition')?.value || 'right'; const imagePosition = document.getElementById('bannerImagePosition')?.value || 'right';
// Log the current position for debugging
console.log('Image position:', imagePosition);
// Create image container with proper styling and positioning // Create image container with proper styling and positioning
const isSideBySide = imagePosition === 'left' || imagePosition === 'right'; const isSideBySide = imagePosition === 'left' || imagePosition === 'right';
const maxWidth = isSideBySide ? '40%' : '100%'; const maxWidth = isSideBySide ? '40%' : '100%';
@@ -1978,6 +1981,9 @@ function updateBannerPreview() {
margin: (template.margin ? `${template.margin}px` : '20px').trim(), margin: (template.margin ? `${template.margin}px` : '20px').trim(),
borderRadius: (template.borderRadius ? `${template.borderRadius}px` : '8px').trim(), borderRadius: (template.borderRadius ? `${template.borderRadius}px` : '8px').trim(),
// Image position
imagePosition: imagePosition,
// Container styles // Container styles
containerStyle: (template.containerStyle || '').trim() containerStyle: (template.containerStyle || '').trim()
}; };