mirror of
https://github.com/Dvorinka/PPve.git
synced 2026-06-04 20:42:59 +00:00
f
This commit is contained in:
+14
-4
@@ -1003,7 +1003,8 @@ function updateBannerPreview() {
|
|||||||
|
|
||||||
// Add image if exists
|
// Add image if exists
|
||||||
if (hasImage) {
|
if (hasImage) {
|
||||||
const imagePosition = document.querySelector('.image-pos-btn.active')?.dataset.pos || 'center';
|
const activePosBtn = document.querySelector('.image-pos-btn.active, .position-btn.active');
|
||||||
|
const imagePosition = activePosBtn ? activePosBtn.dataset.pos : (template?.imagePosition || 'right');
|
||||||
let imageStyle = 'max-width: 100%; max-height: 100%; object-fit: contain;';
|
let imageStyle = 'max-width: 100%; max-height: 100%; object-fit: contain;';
|
||||||
|
|
||||||
// Apply position based on selection
|
// Apply position based on selection
|
||||||
@@ -1046,7 +1047,8 @@ let template = {
|
|||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
padding: 20,
|
padding: 20,
|
||||||
margin: 20,
|
margin: 20,
|
||||||
borderRadius: 8
|
borderRadius: 8,
|
||||||
|
imagePosition: 'right' // Default to right
|
||||||
};
|
};
|
||||||
|
|
||||||
// Initialize when DOM is loaded
|
// Initialize when DOM is loaded
|
||||||
@@ -1903,10 +1905,18 @@ function updateBannerPreview() {
|
|||||||
const bannerTextContent = bannerText || 'Náhled banneru';
|
const bannerTextContent = bannerText || 'Náhled banneru';
|
||||||
|
|
||||||
if (hasImage && currentImage) {
|
if (hasImage && currentImage) {
|
||||||
// Get image dimensions and position from inputs or use defaults
|
// Get image dimensions 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';
|
|
||||||
|
// Get image position from active button or template
|
||||||
|
const activePosBtn = document.querySelector('.image-pos-btn.active, .position-btn.active');
|
||||||
|
let imagePosition = activePosBtn ? activePosBtn.dataset.pos : (template?.imagePosition || 'right');
|
||||||
|
|
||||||
|
// Update template with current position
|
||||||
|
if (template) {
|
||||||
|
template.imagePosition = imagePosition;
|
||||||
|
}
|
||||||
|
|
||||||
// Log the current position for debugging
|
// Log the current position for debugging
|
||||||
console.log('Image position:', imagePosition);
|
console.log('Image position:', imagePosition);
|
||||||
|
|||||||
Reference in New Issue
Block a user