Upload new version
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user