This commit is contained in:
Tomas Dvorak
2025-05-28 12:01:22 +02:00
parent 44c53f4f76
commit b3f7e7ea77
2 changed files with 16 additions and 3 deletions
+10 -3
View File
@@ -1310,6 +1310,7 @@ function updateBannerPreview() {
bannerPreview.style.margin = '0 auto'; bannerPreview.style.margin = '0 auto';
bannerPreview.style.maxWidth = '1200px'; bannerPreview.style.maxWidth = '1200px';
bannerPreview.style.padding = '0 1rem'; bannerPreview.style.padding = '0 1rem';
bannerPreview.style.position = 'relative'; // Ensure proper positioning context
// Update banner content styles to exactly match index.html // Update banner content styles to exactly match index.html
Object.assign(bannerPreviewContent.style, { Object.assign(bannerPreviewContent.style, {
@@ -1344,8 +1345,12 @@ function updateBannerPreview() {
// Apply the same border radius to the image as to the container // Apply the same border radius to the image as to the container
const imageRadius = Math.max(bannerBorderRadius, 0); const imageRadius = Math.max(bannerBorderRadius, 0);
// Get image dimensions
const imageWidth = parseInt(document.getElementById('bannerImageWidth')?.value || '100');
const imageHeight = parseInt(document.getElementById('bannerImageHeight')?.value || '200');
// Determine image style based on position - exactly match index.html // Determine image style based on position - exactly match index.html
let imageStyle = `max-width: 100%; max-height: 200px; border-radius: ${imageRadius}px;`; let imageStyle = `max-width: ${imageWidth}px; max-height: ${imageHeight}px; border-radius: ${imageRadius}px;`;
let containerStyle = 'margin-bottom: 15px;'; let containerStyle = 'margin-bottom: 15px;';
switch(imagePosition) { switch(imagePosition) {
@@ -1401,9 +1406,11 @@ function updateBannerPreview() {
bannerPreview.classList.remove('with-image'); bannerPreview.classList.remove('with-image');
} }
// Wrap in link if provided - exactly match index.html // Wrap in link if provided - exactly match index.html but prevent clicks
if (bannerLink) { if (bannerLink) {
content = `<a href="${bannerLink}" style="color: inherit; text-decoration: none; display: block;">${content}</a>`; content = `<a href="${bannerLink}"
style="color: inherit; text-decoration: none; display: block; pointer-events: none; cursor: default;"
onclick="event.preventDefault(); return false;">${content}</a>`;
} }
// Update content // Update content
+6
View File
@@ -68,6 +68,12 @@ type BannerStyle struct {
Margin string `json:"margin"` Margin string `json:"margin"`
BorderRadius string `json:"borderRadius"` BorderRadius string `json:"borderRadius"`
IsVisible bool `json:"isVisible"` IsVisible bool `json:"isVisible"`
ImageWidth int `json:"imageWidth"` // Width in pixels
ImageHeight int `json:"imageHeight"` // Height in pixels
ImagePosition string `json:"imagePosition"` // center, left, right, custom
ImageX int `json:"imageX"` // X position for custom
ImageY int `json:"imageY"` // Y position for custom
}
ImagePosition string `json:"imagePosition"` // left, right, center, or custom ImagePosition string `json:"imagePosition"` // left, right, center, or custom
ImageX string `json:"imageX"` // X position for custom placement ImageX string `json:"imageX"` // X position for custom placement
ImageY string `json:"imageY"` // Y position for custom placement ImageY string `json:"imageY"` // Y position for custom placement