This commit is contained in:
2026-01-15 01:49:28 +01:00
parent 88500abc04
commit 6dfc59cd24

View File

@@ -332,12 +332,15 @@ export function initEditor() {
      (async() => {
try {
const row = await apiGet(current.resource, current.id);
jsonState = row?.content ?? row?.item?.content ?? '';
hasJson = !!jsonState;
const rawContent = row?.content ?? row?.item?.content ?? '';
const trimmed = String(rawContent || '').trim();
const looksJson = trimmed.startsWith('{') || trimmed.startsWith('[');
jsonState = looksJson ? rawContent : '';
hasJson = looksJson;
// API liefert jetzt top-level html/content; fallback auf item.*
fresh = row?.html ?? row?.item?.html ?? '';
if (!fresh && !hasJson) {
fresh = row?.content ?? row?.item?.content ?? '';
if (!fresh && !looksJson) {
fresh = rawContent;
}
} catch {}
      })(),