From 7386a5c421caca5e18ea840604c8cb9dd37ac56b Mon Sep 17 00:00:00 2001 From: Dirk Date: Tue, 13 Feb 2024 12:01:28 +0100 Subject: [PATCH] fix: dont wrap empty cells --- scripts/aem.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/aem.js b/scripts/aem.js index 785ba9668b..8bb351a05a 100644 --- a/scripts/aem.js +++ b/scripts/aem.js @@ -625,7 +625,8 @@ function decorateBlock(block) { // wrap plain text and inline elements in a

block.querySelectorAll(':scope > div > div').forEach((cell) => { const firstChild = cell.firstElementChild; - if (!firstChild || ['STRONG', 'EM', 'A', 'PICTURE'].includes(firstChild.tagName)) { + if ((!firstChild && cell.textContent.trim()) + || (firstChild && ['STRONG', 'EM', 'A', 'PICTURE'].includes(firstChild.tagName))) { const p = document.createElement('p'); p.append(...cell.childNodes); cell.replaceChildren(p);