dsasdas
This commit is contained in:
@@ -327,6 +327,18 @@ export function initEditor() {
|
||||
const isActive = !!(currentVersionMeta && Number(currentVersionMeta.is_active) === 1);
|
||||
versionActiveBadge.classList.toggle('hidden', !isActive);
|
||||
}
|
||||
const win = iframe?.contentWindow;
|
||||
if (win && win.BridgeParts) {
|
||||
const canOverwrite = !!(currentVersionMeta
|
||||
&& Number(currentVersionMeta.is_active) === 0
|
||||
&& Number(currentVersionMeta.was_active) === 0);
|
||||
win.BridgeParts.CURRENT_VERSION_ID = canOverwrite ? currentVersionId : 0;
|
||||
} else if (win) {
|
||||
const canOverwrite = !!(currentVersionMeta
|
||||
&& Number(currentVersionMeta.is_active) === 0
|
||||
&& Number(currentVersionMeta.was_active) === 0);
|
||||
win.CURRENT_VERSION_ID = canOverwrite ? currentVersionId : 0;
|
||||
}
|
||||
}
|
||||
|
||||
function renderVersionOptions(items, opts = {}) {
|
||||
@@ -856,6 +868,12 @@ export function initEditor() {
|
||||
activateNext = decision === 'yes';
|
||||
}
|
||||
|
||||
const overwriteVersionId = (currentVersionMeta
|
||||
&& Number(currentVersionMeta.is_active) === 0
|
||||
&& Number(currentVersionMeta.was_active) === 0)
|
||||
? Number(currentVersionId || 0)
|
||||
: 0;
|
||||
|
||||
if (currentEditorType === 'craftjs') {
|
||||
const html = craftEditor ? craftEditor.getContent() : '';
|
||||
const craftJson = craftEditor && craftEditor.getCraftJson
|
||||
@@ -863,6 +881,7 @@ export function initEditor() {
|
||||
: JSON.stringify({ html });
|
||||
const payload = { html, craft_json: craftJson, editor_type: 'craftjs', section_id: current.section.id };
|
||||
if (activateNext) payload.activate_version = 1;
|
||||
if (overwriteVersionId) payload.version_id = overwriteVersionId;
|
||||
const res = await apiUpdate('content', current.id, payload);
|
||||
if (res?.ok) ok('Gespeichert');
|
||||
else err(res?.error || 'Speichern fehlgeschlagen');
|
||||
@@ -878,6 +897,14 @@ export function initEditor() {
|
||||
win.NEXT_ACTIVATE_VERSION = 1;
|
||||
}
|
||||
}
|
||||
if (overwriteVersionId) {
|
||||
const win = iframe?.contentWindow;
|
||||
if (win && win.BridgeParts) {
|
||||
win.BridgeParts.CURRENT_VERSION_ID = overwriteVersionId;
|
||||
} else if (win) {
|
||||
win.CURRENT_VERSION_ID = overwriteVersionId;
|
||||
}
|
||||
}
|
||||
const okSave = await delegateCommand('save-data');
|
||||
if (okSave) {
|
||||
setTimeout(async () => {
|
||||
|
||||
Reference in New Issue
Block a user