From: Alexander Ebert Date: Mon, 8 May 2023 16:20:44 +0000 (+0200) Subject: Fix the detection of `


` X-Git-Tag: 6.0.0_Alpha_1~136^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5ee2636244d34301fd773d5d39ff0d43b2d747b4;p=GitHub%2FWoltLab%2FWCF.git Fix the detection of `


` --- diff --git a/ts/WoltLabSuite/Core/Component/Ckeditor/Cleanup.ts b/ts/WoltLabSuite/Core/Component/Ckeditor/Cleanup.ts index cb7f75c273..9b6447c646 100644 --- a/ts/WoltLabSuite/Core/Component/Ckeditor/Cleanup.ts +++ b/ts/WoltLabSuite/Core/Component/Ckeditor/Cleanup.ts @@ -70,9 +70,11 @@ function getPossibleSpacerParagraphs(div: HTMLElement): HTMLParagraphElement[] { const paragraphs: HTMLParagraphElement[] = []; div.querySelectorAll("p").forEach((paragraph) => { - if (paragraph.childElementCount === 1) { - const child = paragraph.children[0] as HTMLElement; - if (child.tagName === "BR" && child.dataset.ckeFiller !== "true") { + paragraph.normalize(); + + if (paragraph.childNodes.length === 1) { + const child = paragraph.childNodes[0]; + if (child instanceof HTMLBRElement && child.dataset.ckeFiller !== "true") { paragraphs.push(paragraph); } } diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Ckeditor/Cleanup.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Ckeditor/Cleanup.js index ccbe5f0a33..46f0f41c68 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Ckeditor/Cleanup.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Ckeditor/Cleanup.js @@ -63,9 +63,10 @@ define(["require", "exports", "tslib", "../../Dom/Util"], function (require, exp function getPossibleSpacerParagraphs(div) { const paragraphs = []; div.querySelectorAll("p").forEach((paragraph) => { - if (paragraph.childElementCount === 1) { - const child = paragraph.children[0]; - if (child.tagName === "BR" && child.dataset.ckeFiller !== "true") { + paragraph.normalize(); + if (paragraph.childNodes.length === 1) { + const child = paragraph.childNodes[0]; + if (child instanceof HTMLBRElement && child.dataset.ckeFiller !== "true") { paragraphs.push(paragraph); } }