Make the RTE handle inline elements gracefully for JSON (#17983)

This commit is contained in:
Kenn Jacobsen
2025-01-15 11:26:03 +01:00
committed by GitHub
parent 4dd8fbe25d
commit 8f42a3a0ea
2 changed files with 44 additions and 1 deletions

View File

@@ -101,8 +101,9 @@ internal sealed class ApiRichTextElementParser : ApiRichTextParserBase, IApiRich
// - non-#comment nodes
// - non-#text nodes
// - non-empty #text nodes
// - empty #text between inline elements (see #17037)
HtmlNode[] childNodes = element.ChildNodes
.Where(c => c.Name != CommentNodeName && (c.Name != TextNodeName || string.IsNullOrWhiteSpace(c.InnerText) is false))
.Where(c => c.Name != CommentNodeName && (c.Name != TextNodeName || c.NextSibling is not null || string.IsNullOrWhiteSpace(c.InnerText) is false))
.ToArray();
var tag = TagName(element);