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.
This commit is contained in:
Dries Peeters
2026-01-22 14:14:40 +01:00
parent 1de4615696
commit a22919c51f
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -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);
+2 -1
View File
@@ -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);