yyc
This commit is contained in:
@@ -17,11 +17,13 @@ async function openSnippetEditor(id){
|
|||||||
const btnCancel = document.getElementById('editSnippetCancel');
|
const btnCancel = document.getElementById('editSnippetCancel');
|
||||||
|
|
||||||
// Daten laden
|
// Daten laden
|
||||||
let row = {};
|
let resp = {};
|
||||||
try { row = await apiGet('snippets', id) || {}; } catch(e){}
|
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 (inpName) inpName.value = row.name || '';
|
||||||
if (taContent) taContent.value = row.content || '';
|
if (taContent) taContent.value = contentValue;
|
||||||
|
|
||||||
function cleanup(){
|
function cleanup(){
|
||||||
form && form.removeEventListener('submit', onSubmit);
|
form && form.removeEventListener('submit', onSubmit);
|
||||||
@@ -167,4 +169,3 @@ export function initLists(){
|
|||||||
// Backwards compat (falls woanders genutzt)
|
// Backwards compat (falls woanders genutzt)
|
||||||
window.loadList = loadList;
|
window.loadList = loadList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user