From 9951d3195b3b06bebe3b1f463c50e30f6d33def8 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 5 May 2023 11:56:34 +0200 Subject: [PATCH] Strip trailing `
` in `` --- ts/WoltLabSuite/Core/Component/Ckeditor/Cleanup.ts | 10 +++++----- .../js/WoltLabSuite/Core/Component/Ckeditor/Cleanup.js | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) 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(); -- 2.20.1