Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions nx2/blocks/ew-actions/ew-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,30 @@ class NXEwActions extends LitElement {
this._dialog = undefined;
this._busy = true;

// Flush pending collab updates to da-admin before AEM reads it,
// otherwise the last ~2s of edits (held in da-collab's debounce) are missed.
const editorDoc = document.querySelector('ew-editor-doc');
if (editorDoc?.forceSave) {
const flushResult = await editorDoc.forceSave();
if (!flushResult?.ok) {
await Promise.all([
import('../shared/dialog/dialog.js'),
import(`${NX_BASE}/public/sl/components.js`),
]);
this._busy = false;
this._hasError = true;
this._dialog = {
phase: 'error',
error: {
action,
type: 'error',
message: flushResult?.error || 'Unable to confirm save. Please retry or reload the editor.',
},
};
return;
}
}

const result = await runAemPreviewOrPublish({ aemPath, action });
if (!result.ok) {
await Promise.all([
Expand Down
Loading