diff --git a/public/assets/js/ui-list.js b/public/assets/js/ui-list.js index c5dae63..f76c06e 100644 --- a/public/assets/js/ui-list.js +++ b/public/assets/js/ui-list.js @@ -17,11 +17,13 @@ async function openSnippetEditor(id){ const btnCancel = document.getElementById('editSnippetCancel'); // Daten laden - let row = {}; - try { row = await apiGet('snippets', id) || {}; } catch(e){} + let resp = {}; + try { resp = await apiGet('snippets', id) || {}; } catch(e){} + const row = resp?.item || resp?.data || resp || {}; + const contentValue = resp?.content ?? row.content ?? ''; if (inpName) inpName.value = row.name || ''; - if (taContent) taContent.value = row.content || ''; + if (taContent) taContent.value = contentValue; function cleanup(){ form && form.removeEventListener('submit', onSubmit); @@ -167,4 +169,3 @@ export function initLists(){ // Backwards compat (falls woanders genutzt) window.loadList = loadList; } -