Upload new version

This commit is contained in:
2026-01-20 01:12:22 +01:00
parent abd74a9a50
commit 3d559924a9
15 changed files with 1632 additions and 517 deletions

View File

@@ -74,29 +74,9 @@ async function handleEditorMessages(ev) {
if (msg.source !== 'email-editor' || msg.type !== 'save') return;
try {
const ctx = window.__currentEditorCtx || {};
const id = ctx.id;
const mode = (ctx.mode || msg.mode || '').toLowerCase();
const refs = Array.isArray(msg.refs) ? msg.refs : [];
if (!id || !mode) return;
if (mode === 'templates') {
await fetch('./api.php?resource=template_items&action=sync', {
method: 'POST',
credentials: 'include',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ template_id: id, items: refs })
});
} else if (mode === 'sections') {
await fetch('./api.php?resource=section_items&action=sync', {
method: 'POST',
credentials: 'include',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ section_id: id, items: refs.filter(r => r.ref_type === 'block') })
});
}
return;
} catch (e) {
console.error('refs sync failed', e);
console.error('refs sync skipped', e);
}
}