diff options
Diffstat (limited to 'internal/admin/static/cardeditor.js')
| -rw-r--r-- | internal/admin/static/cardeditor.js | 18 |
1 files changed, 12 insertions, 6 deletions
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) { |
