From 74153c7814fc4cef988066ef04e38731a943bc12 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Thu, 9 Jul 2026 04:03:00 -0400 Subject: feat(admin): nested condition/action buttons to manage complex YAML --- internal/admin/static/cardeditor.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'internal/admin/static/cardeditor.js') diff --git a/internal/admin/static/cardeditor.js b/internal/admin/static/cardeditor.js index a11388b..e430e1d 100644 --- a/internal/admin/static/cardeditor.js +++ b/internal/admin/static/cardeditor.js @@ -2,6 +2,13 @@ // Used by mobeditor, objecteditor, itemeditor, and future editors. // Prefix all exports with ced_ to avoid collisions with editor.js globals. +// Hide any open search-results dropdown when clicking outside a search input. +document.addEventListener('click', function(e) { + if (!e.target.closest('.search-results') && !e.target.closest('.search-input')) { + document.querySelectorAll('.search-results').forEach(function(r) { r.style.display = 'none'; }); + } +}); + // ---- Path helpers ---- function ced_cardPath(sec) { @@ -153,12 +160,6 @@ function ced_setupSearchFields() { } }); }); - - document.addEventListener('click', function(e) { - if (!e.target.closest('.search-results') && !e.target.closest('.search-input')) { - document.querySelectorAll('.search-results').forEach(function(r) { r.style.display = 'none'; }); - } - }); } function ced_selectSearchResult(el) { @@ -235,6 +236,11 @@ function ced_syncDOMToData(ed) { } ced_setPathInData(ed, dataPath, val); } + // Condition & action DOM→data sync lives in renderCurrent() + // (the _ieRenderCurrent path) to avoid stale-DOM overwrites when + // mutation handlers call _ieRenderOnly after modifying in-memory data. + // Do NOT call _ieSyncAll here — it would collect stale DOM and undo + // the mutation before the next render. } function ced_resolveDataPath(obj, path) { -- cgit v1.2.3