From a22919c51ff5f4540cf66f76afe25ad8ef3ca5cb Mon Sep 17 00:00:00 2001 From: Dries Peeters Date: Thu, 22 Jan 2026 14:14:40 +0100 Subject: [PATCH] Fix decorative image upload button not appearing after reselection The properties panel used strict equality check (attrs.name === 'decorative-image') which failed when the element name was modified (e.g., 'decorative-image element-overlap'). This caused the upload button to disappear when reselecting a decorative image that wasn't uploaded immediately after creation. Changed the check to use includes('decorative-image') to match the behavior of the event listeners, ensuring the upload button always appears for decorative image elements regardless of name modifications. Fixes issue where users couldn't upload images to decorative image elements after deselecting and reselecting them. --- app/templates/admin/quote_pdf_layout.html | 3 ++- templates/admin/pdf_layout.html | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/templates/admin/quote_pdf_layout.html b/app/templates/admin/quote_pdf_layout.html index 48fb87ae..026589df 100644 --- a/app/templates/admin/quote_pdf_layout.html +++ b/app/templates/admin/quote_pdf_layout.html @@ -3192,7 +3192,8 @@ function initializePDFEditor() { } // Decorative image properties - if (attrs.name === 'decorative-image') { + // Use includes() to handle cases where name might be modified (e.g., 'decorative-image element-overlap') + if (attrs.name && attrs.name.includes('decorative-image')) { // Use getAttr to ensure we get the imageUrl const imageUrl = node.getAttr('imageUrl') || attrs.imageUrl || ''; console.log('Properties panel - decorative image URL:', imageUrl); diff --git a/templates/admin/pdf_layout.html b/templates/admin/pdf_layout.html index 5bef9003..7849ef77 100644 --- a/templates/admin/pdf_layout.html +++ b/templates/admin/pdf_layout.html @@ -3606,7 +3606,8 @@ function initializePDFEditor() { } // Decorative image properties - if (attrs.name === 'decorative-image') { + // Use includes() to handle cases where name might be modified (e.g., 'decorative-image element-overlap') + if (attrs.name && attrs.name.includes('decorative-image')) { // Use getAttr to ensure we get the imageUrl const imageUrl = node.getAttr('imageUrl') || attrs.imageUrl || ''; console.log('Properties panel - decorative image URL:', imageUrl);