From: Alexander Ebert Date: Fri, 5 May 2023 09:56:34 +0000 (+0200) Subject: Strip trailing `
` in `` X-Git-Tag: 6.0.0_Alpha_1~136^2~11 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9951d3195b3b06bebe3b1f463c50e30f6d33def8;p=GitHub%2FWoltLab%2FWCF.git Strip trailing `
` in `` --- diff --git a/ts/WoltLabSuite/Core/Component/Ckeditor/Cleanup.ts b/ts/WoltLabSuite/Core/Component/Ckeditor/Cleanup.ts index 88edda2f39..6ed22489e2 100644 --- a/ts/WoltLabSuite/Core/Component/Ckeditor/Cleanup.ts +++ b/ts/WoltLabSuite/Core/Component/Ckeditor/Cleanup.ts @@ -52,17 +52,17 @@ function removeTrailingBr(div: HTMLElement): void { return; } - const paragraph = br.closest("p"); - if (paragraph === null) { + const paragraphOrTableCell = br.closest("p, td"); + if (paragraphOrTableCell === null) { return; } - if (!DomUtil.isAtNodeEnd(br, paragraph)) { + if (!DomUtil.isAtNodeEnd(br, paragraphOrTableCell)) { return; } - if (paragraph.innerHTML === "
") { - paragraph.remove(); + if (paragraphOrTableCell.tagName === "P" && paragraphOrTableCell.innerHTML === "
") { + paragraphOrTableCell.remove(); } else { br.remove(); } 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 a40ec4aa1f..aff6a7c7ae 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Ckeditor/Cleanup.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Ckeditor/Cleanup.js @@ -49,15 +49,15 @@ define(["require", "exports", "tslib", "../../Dom/Util"], function (require, exp if (br.dataset.ckeFiller === "true") { return; } - const paragraph = br.closest("p"); - if (paragraph === null) { + const paragraphOrTableCell = br.closest("p, td"); + if (paragraphOrTableCell === null) { return; } - if (!Util_1.default.isAtNodeEnd(br, paragraph)) { + if (!Util_1.default.isAtNodeEnd(br, paragraphOrTableCell)) { return; } - if (paragraph.innerHTML === "
") { - paragraph.remove(); + if (paragraphOrTableCell.tagName === "P" && paragraphOrTableCell.innerHTML === "
") { + paragraphOrTableCell.remove(); } else { br.remove();