This commit is contained in:
Tomas Dvorak
2025-05-28 13:50:38 +02:00
parent c3a9acefa7
commit 6b2117b849
+25 -16
View File
@@ -826,6 +826,9 @@ document.addEventListener('DOMContentLoaded', () => {
if (saveBannerBtn) { if (saveBannerBtn) {
saveBannerBtn.addEventListener('click', saveBanner); saveBannerBtn.addEventListener('click', saveBanner);
} }
// Set up color input listeners
setupColorInputListeners();
}); });
// Handle dropped files // Handle dropped files
@@ -1524,25 +1527,31 @@ const debouncedUpdatePreview = debounce(() => {
updateBannerPreview(); updateBannerPreview();
}, 300); }, 300);
bannerBgColor.addEventListener('input', () => { // This function will be called after DOM is loaded
// Update color preview immediately function setupColorInputListeners() {
const bgColorPreview = document.getElementById('bgColorPreview'); if (bannerBgColor) {
if (bgColorPreview) { bannerBgColor.addEventListener('input', () => {
bgColorPreview.style.backgroundColor = bannerBgColor.value; // Update color preview immediately
if (bgColorPreview) {
bgColorPreview.style.backgroundColor = bannerBgColor.value;
}
// Debounce the full preview update
debouncedUpdatePreview();
});
} }
// Debounce the full preview update
debouncedUpdatePreview();
});
bannerTextColor.addEventListener('input', () => {
// Update color preview immediately if (bannerTextColor) {
const textColorPreview = document.getElementById('textColorPreview'); bannerTextColor.addEventListener('input', () => {
if (textColorPreview) { // Update color preview immediately
textColorPreview.style.backgroundColor = bannerTextColor.value; if (textColorPreview) {
textColorPreview.style.backgroundColor = bannerTextColor.value;
}
// Debounce the full preview update
debouncedUpdatePreview();
});
} }
// Debounce the full preview update }
debouncedUpdatePreview();
});
// Connect color pickers to input fields // Connect color pickers to input fields
const bannerBgColorPicker = document.getElementById('bannerBgColorPicker'); const bannerBgColorPicker = document.getElementById('bannerBgColorPicker');