aewr
This commit is contained in:
@@ -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');
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user