From 98e76855bedb0b4319ad82c62d712228af19938a Mon Sep 17 00:00:00 2001 From: viloria Date: Tue, 5 Nov 2024 15:47:35 -0500 Subject: [PATCH] initial commit publish --- libs/blocks/fragment/fragment.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/libs/blocks/fragment/fragment.js b/libs/blocks/fragment/fragment.js index 1d671ee17d..545ef8cc89 100644 --- a/libs/blocks/fragment/fragment.js +++ b/libs/blocks/fragment/fragment.js @@ -41,7 +41,7 @@ const updateFragMap = (fragment, a, href) => { } }; -const insertInlineFrag = (sections, a, relHref, mep, handleMepCommands) => { +const insertInlineFrag = (sections, a, relHref) => { // Inline fragments only support one section, other sections are ignored const fragChildren = [...sections[0].children]; if (a.parentElement.nodeName === 'DIV' && !a.parentElement.attributes.length) { @@ -49,10 +49,7 @@ const insertInlineFrag = (sections, a, relHref, mep, handleMepCommands) => { } else { a.replaceWith(...fragChildren); } - fragChildren.forEach((child) => { - child.setAttribute('data-path', relHref); - if (handleMepCommands) mep.commands = handleMepCommands(mep.commands, child); - }); + fragChildren.forEach((child) => child.setAttribute('data-path', relHref)); }; function replaceDotMedia(path, doc) { @@ -132,16 +129,14 @@ export default async function init(a) { const { updateFragDataProps } = await import('../../features/personalization/personalization.js'); updateFragDataProps(a, inline, sections, fragment); } - let handleMepCommands = false; if (mep?.commands?.length) { const { handleCommands } = await import('../../features/personalization/personalization.js'); - handleMepCommands = handleCommands; + handleCommands(mep?.commands, fragment, false, true); } if (inline) { - insertInlineFrag(sections, a, relHref, mep, handleMepCommands); + insertInlineFrag(sections, a, relHref, mep); } else { a.parentElement.replaceChild(fragment, a); - if (handleMepCommands) handleMepCommands(mep?.commands, fragment); await loadArea(fragment); } }