asdad
This commit is contained in:
@@ -477,6 +477,15 @@
|
||||
|
||||
const resource = EDITOR_MODE;
|
||||
const action = `${resource}.update`;
|
||||
const debugSave = (() => {
|
||||
try {
|
||||
const params = new URLSearchParams(window.location.search || '');
|
||||
if (params.get('debug_save') === '1') return true;
|
||||
return localStorage.getItem('et_debug_save') === '1';
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
})();
|
||||
|
||||
log('SAVE START', 'Starte Speichern des Inhalts an die API...', '#FF4500');
|
||||
|
||||
@@ -488,6 +497,17 @@
|
||||
// 🚨 KRITISCH: Server erwartet das Feld 'json'
|
||||
json: jsonProjectDataRaw,
|
||||
};
|
||||
if (debugSave) {
|
||||
dataToSend.debug = 1;
|
||||
console.log('[ET DEBUG] save-data payload', {
|
||||
id: CURRENT_ENTITY_ID,
|
||||
mode: resource,
|
||||
htmlLength: htmlContent.length,
|
||||
jsonLength: jsonProjectDataRaw.length,
|
||||
htmlPreview: htmlContent.slice(0, 200),
|
||||
jsonPreview: jsonProjectDataRaw.slice(0, 200),
|
||||
});
|
||||
}
|
||||
|
||||
if (B.CURRENT_ENTITY_NAME) {
|
||||
dataToSend.name = B.CURRENT_ENTITY_NAME;
|
||||
@@ -536,8 +556,8 @@
|
||||
});
|
||||
|
||||
// Tastenkürzel für Speichern hinzufügen
|
||||
editor.Keymaps.add('ctrl-s', 'save-data', 'ctrl+s');
|
||||
editor.Keymaps.add('cmd-s', 'save-data', 'cmd+s');
|
||||
editor.Keymaps.add('save-data-ctrl', 'ctrl+s', 'save-data');
|
||||
editor.Keymaps.add('save-data-cmd', 'cmd+s', 'save-data');
|
||||
|
||||
log('Speichern-Command und Button/Keymap registriert.', '#FF4500');
|
||||
};
|
||||
|
||||
@@ -696,6 +696,7 @@ class ApiKernel
|
||||
if ($blk !== null && in_array('block_id', $allCols, true)) $data['block_id'] = $blk;
|
||||
|
||||
if ($updCol) $data[$updCol] = date('Y-m-d H:i:s');
|
||||
$this->debugSavePayload($kind, $id, $html, $json);
|
||||
if (!$data) $this->fail('nothing to update', null, 422);
|
||||
|
||||
[$tw, $tp] = $this->tenantWhere($auth);
|
||||
@@ -903,6 +904,27 @@ class ApiKernel
|
||||
}
|
||||
}
|
||||
|
||||
private function debugSavePayload(string $kind, $id, $html, $json): void
|
||||
{
|
||||
if (empty($this->in['debug'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$payload = [
|
||||
'time' => date(DATE_ATOM),
|
||||
'kind' => $kind,
|
||||
'id' => $id,
|
||||
'html_length' => is_string($html) ? strlen($html) : null,
|
||||
'json_length' => is_string($json) ? strlen($json) : null,
|
||||
'html_preview' => is_string($html) ? substr($html, 0, 200) : null,
|
||||
'json_preview' => is_string($json) ? substr($json, 0, 200) : null,
|
||||
'json_is_empty' => is_string($json) ? trim($json) === '' : ($json === null),
|
||||
];
|
||||
|
||||
$line = json_encode($payload, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "\n";
|
||||
@file_put_contents(sys_get_temp_dir() . '/emailtemplate_debug_save.log', $line, FILE_APPEND);
|
||||
}
|
||||
|
||||
private function replacePlaceholders(string $html, array $placeholders): string
|
||||
{
|
||||
if ($html === '' || !$placeholders) {
|
||||
|
||||
Reference in New Issue
Block a user