mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 13:02:59 +00:00
The data-item-properties attribute on the Add Item button was serialized
inside double-quoted HTML using {{ item_properties|tojson|e }}. Jinja2's
|tojson returns Markup (marked safe), making |e a no-op — the JSON
double quotes were not escaped to ". The browser truncated the
attribute at the first " in the JSON, so addArrayTableRow() parsed an
empty object and created rows with only a trash icon.
Fix: switch to single-quote attribute delimiters (JSON only uses double
quotes internally) and filter item_properties to only the display
columns, avoiding large nested objects in the attribute value.
Closes #302
Co-authored-by: Chuck <chuck@example.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -561,8 +561,8 @@
|
|||||||
data-full-key="{{ full_key }}"
|
data-full-key="{{ full_key }}"
|
||||||
data-max-items="{{ max_items }}"
|
data-max-items="{{ max_items }}"
|
||||||
data-plugin-id="{{ plugin_id }}"
|
data-plugin-id="{{ plugin_id }}"
|
||||||
data-item-properties="{{ item_properties|tojson|e }}"
|
data-item-properties='{% set ns = namespace(d={}) %}{% for k in display_columns %}{% if k in item_properties %}{% set _ = ns.d.update({k: item_properties[k]}) %}{% endif %}{% endfor %}{{ ns.d|tojson }}'
|
||||||
data-display-columns="{{ display_columns|tojson|e }}"
|
data-display-columns='{{ display_columns|tojson }}'
|
||||||
class="mt-3 px-4 py-2 text-sm bg-blue-600 hover:bg-blue-700 text-white rounded-md"
|
class="mt-3 px-4 py-2 text-sm bg-blue-600 hover:bg-blue-700 text-white rounded-md"
|
||||||
{% if array_value|length >= max_items %}disabled style="opacity: 0.5;"{% endif %}>
|
{% if array_value|length >= max_items %}disabled style="opacity: 0.5;"{% endif %}>
|
||||||
<i class="fas fa-plus mr-1"></i> Add Item
|
<i class="fas fa-plus mr-1"></i> Add Item
|
||||||
|
|||||||
Reference in New Issue
Block a user