From 520b87a198e5181071d4d111b8e731d195d4fdb9 Mon Sep 17 00:00:00 2001 From: Chuck Date: Thu, 8 Jan 2026 13:31:34 -0500 Subject: [PATCH] fix: Expose renderArrayObjectItem to window for addArrayObjectItem Fix scope issue where renderArrayObjectItem is defined inside IIFE but window.addArrayObjectItem is defined outside, causing the function check to always fail and fallback to degraded HTML rendering. Problem: - renderArrayObjectItem (line 2469) is inside IIFE (lines 796-6417) - window.addArrayObjectItem (line 6422) is outside IIFE - Check 'typeof renderArrayObjectItem === function' at line 6454 always fails - Fallback code lacks file upload widgets, URL input types, descriptions, styling Solution: - Expose renderArrayObjectItem to window object before IIFE closes - Function maintains closure access to escapeHtml and other IIFE-scoped functions - Newly added items now have full functionality matching initially rendered items --- web_interface/static/v3/plugins_manager.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web_interface/static/v3/plugins_manager.js b/web_interface/static/v3/plugins_manager.js index ce4330e5..5360a8c0 100644 --- a/web_interface/static/v3/plugins_manager.js +++ b/web_interface/static/v3/plugins_manager.js @@ -6414,6 +6414,9 @@ window.updateImageScheduleDay = function(fieldId, imageId, imageIdx, day) { window.updateImageList(fieldId, currentImages); } +// Expose renderArrayObjectItem to window for use by window.addArrayObjectItem +window.renderArrayObjectItem = renderArrayObjectItem; + })(); // End IIFE // Functions to handle array-of-objects @@ -6446,8 +6449,8 @@ if (typeof window !== 'undefined') { const newIndex = currentItems.length; // Use renderArrayObjectItem if available, otherwise create basic HTML let itemHtml = ''; - if (typeof renderArrayObjectItem === 'function') { - itemHtml = renderArrayObjectItem(fieldId, fullKey, itemsSchema.properties, {}, newIndex, itemsSchema); + if (typeof window.renderArrayObjectItem === 'function') { + itemHtml = window.renderArrayObjectItem(fieldId, fullKey, itemsSchema.properties, {}, newIndex, itemsSchema); } else { // Fallback: create basic HTML structure itemHtml = `
`;