From 6a0708a63f5dc96a943b41dbb9c49741a47a718a Mon Sep 17 00:00:00 2001 From: Dirk Date: Wed, 21 Feb 2024 12:00:16 +0100 Subject: [PATCH] feat: handle move --- scripts/editor-support.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/editor-support.js b/scripts/editor-support.js index a096efcfa5..348dcfc3a6 100644 --- a/scripts/editor-support.js +++ b/scripts/editor-support.js @@ -17,12 +17,14 @@ async function applyChanges(event) { // redecorate default content and blocks on patches (in the properties rail) const { detail } = event; - const resource = detail?.request?.target?.resource - || detail?.request?.target?.container?.resource; + const resource = detail?.request?.target?.resource // update, patch components + || detail?.request?.target?.container?.resource // update, patch, add to sections + || detail?.request?.to?.container?.resource; // move in sections if (!resource) return false; const updates = detail?.response?.updates; if (!updates.length) return false; const { content } = updates[0]; + if (!content) return false; const parsedUpdate = new DOMParser().parseFromString(content, 'text/html'); const element = document.querySelector(`[data-aue-resource="${resource}"]`); @@ -94,6 +96,7 @@ function attachEventListners(main) { 'aue:content-patch', 'aue:content-update', 'aue:content-add', + 'aue:content-move', ].forEach((eventType) => main?.addEventListener(eventType, async (event) => { event.stopPropagation(); const applied = await applyChanges(event);