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')
? `` : '';