From 004af588e4da7695e75073379801775e89512860 Mon Sep 17 00:00:00 2001 From: Lars Gebhardt-Kusche Date: Tue, 20 Jan 2026 21:26:15 +0100 Subject: [PATCH] aewr --- public/assets/js/ui-editor.js | 6 +++--- src/ApiKernel.php | 20 +++++++++----------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/public/assets/js/ui-editor.js b/public/assets/js/ui-editor.js index 926d8fb..8ffae09 100644 --- a/public/assets/js/ui-editor.js +++ b/public/assets/js/ui-editor.js @@ -107,7 +107,7 @@ export function initEditor() { } async function loadVersionsForCurrent() { - if (!current?.id || !current?.section?.is_template) { + if (!current?.id) { renderVersionOptions([]); return; } @@ -353,7 +353,7 @@ export function initEditor() { window.__currentEditorCtx = { id: current.id, mode: current.section.slug, section: current.section }; setSendContext(current.section?.is_template ? current.id : 0, current.name); if (btnTest) btnTest.classList.toggle('hidden', !current.section?.is_template); - setVersionUiVisible(!!current.section?.is_template); + setVersionUiVisible(!!current.section);     // Neuen Token erzeugen & alten Listener entfernen     reqToken++; @@ -657,7 +657,7 @@ export function initEditor() { sendForm && (sendForm.onsubmit = doSend); editorSelect && (editorSelect.onchange = () => switchEditor(editorSelect.value)); btnRestoreVersion && (btnRestoreVersion.onclick = async () => { - if (!current?.id || !current?.section?.is_template) return; + if (!current?.id) return; const versionId = Number(versionSelect?.value || 0); if (!versionId) { err('Bitte eine Version auswählen'); diff --git a/src/ApiKernel.php b/src/ApiKernel.php index 054b15b..801ee59 100644 --- a/src/ApiKernel.php +++ b/src/ApiKernel.php @@ -954,19 +954,17 @@ class ApiKernel return; } - if (!empty($section['is_template'])) { - $versionCols = array_filter([$jsonCol, $htmlCol, $craftCol, $settingsCol, $editorCol]); - $shouldSnapshot = false; - foreach ($versionCols as $col) { - if (array_key_exists($col, $data)) { - $shouldSnapshot = true; - break; - } - } - if ($shouldSnapshot) { - $this->createContentVersion($current, $itemCols, $customerId, (int)($section['id'] ?? 0)); + $versionCols = array_filter([$jsonCol, $htmlCol, $craftCol, $settingsCol, $editorCol]); + $shouldSnapshot = false; + foreach ($versionCols as $col) { + if (array_key_exists($col, $data)) { + $shouldSnapshot = true; + break; } } + if ($shouldSnapshot) { + $this->createContentVersion($current, $itemCols, $customerId, (int)($section['id'] ?? 0)); + } $set = implode(',', array_map(static fn($c) => "`$c` = :$c", array_keys($data))); $data['id'] = $id;