From 8bc927bfcd48287ee85443794c902665976c6ef8 Mon Sep 17 00:00:00 2001 From: Lars Gebhardt-Kusche Date: Fri, 16 Jan 2026 02:46:28 +0100 Subject: [PATCH] asd --- public/assets/js/ui-list.js | 46 ++++++++----------------------------- 1 file changed, 10 insertions(+), 36 deletions(-) diff --git a/public/assets/js/ui-list.js b/public/assets/js/ui-list.js index 8204516..d5031cd 100644 --- a/public/assets/js/ui-list.js +++ b/public/assets/js/ui-list.js @@ -34,47 +34,21 @@ function normalizeApiName(v=''){ } async function openSnippetEditor(id){ - const dlg = document.getElementById('editSnippetDialog'); - const form = document.getElementById('editSnippetForm'); - const inpName = document.getElementById('edit_snip_name'); - const taContent = document.getElementById('edit_snip_content'); - const btnCancel = document.getElementById('editSnippetCancel'); - - // Daten laden let resp = {}; try { resp = await apiGet('snippets', id) || {}; } catch(e){} const row = resp?.item || resp?.data || resp || {}; - const contentValue = (row?.content ?? resp?.html ?? resp?.content ?? ''); + const name = row?.name || ''; - if (inpName) inpName.value = row.name || ''; - if (taContent) taContent.value = contentValue; - - function cleanup(){ - form && form.removeEventListener('submit', onSubmit); - btnCancel && (btnCancel.onclick = null); + if (window.EditorUI && typeof window.EditorUI.open === 'function') { + window.EditorUI.open({ id: Number(id), name }, 'snippets'); + return; } - - async function onSubmit(ev){ - ev.preventDefault(); - try{ - const res = await apiUpdate('snippets', id, { - name: inpName ? inpName.value : '', - content: taContent ? taContent.value : '' - }); - toast(res && res.ok ? 'Snippet gespeichert' : 'Speichern fehlgeschlagen', !!(res && res.ok)); - dlg && dlg.close(); - cleanup(); - // Liste neu laden - loadList('snippets'); - }catch(e){ - toast('Speichern fehlgeschlagen', false); - } + if (window.__openEditor) { + window.__openEditor({ resource: 'snippets', id: Number(id), name }); + return; } - - if (form) form.addEventListener('submit', onSubmit, { once:false }); - if (btnCancel) btnCancel.onclick = () => { dlg && dlg.close(); cleanup(); }; - - dlg && dlg.showModal(); + console.warn('Kein Editor-Entry-Point gefunden (EditorUI.open / __openEditor).'); + toast('Editor ist nicht initialisiert.', false); } async function openTemplateEditor(id){ @@ -166,7 +140,7 @@ export async function loadList(resource){ ? `` : ''; const editBtn = (resource==='snippets') - ? `` : ''; + ? `` : ''; const editTplBtn = (resource==='templates') ? `` : '';