Unplanned
Last Updated: 12 May 2020 08:54 by ADMIN
Tanya
Created on: 12 May 2020 08:54
Category: RichTextBox
Type: Bug Report
0
RichTextBox: HtmlFormatProvider: Br elements between list items or at their end should not be included

Scenario 1:

The <br/> tags after </li> are treated as separate paragraphs and inherit the list styling of the previous paragraphs resulting in duplicate bullets.

Workaround

var paragraphsToRemove = this.radRichTextBox.Document.EnumerateChildrenOfType<Paragraph>().Where(p => p.IsInList && p.Inlines.First() is Break);
foreach (var p in paragraphsToRemove)
{
    p.ListId = -1;
}
 
this.radRichTextBox.UpdateEditorLayout();

Scenario 2:
The <br/> tags added as the last element of <li> are treated as break elements in the content, causing additional new lines in the document.

Workaround:

var paragraphsWithLineBreak = document.EnumerateChildrenOfType<Paragraph>().Where(p => p.IsInList && p.Inlines.Last() is Break);
foreach (var p in paragraphsWithLineBreak)
{
    p.Inlines.Remove(p.Inlines.Last);
}
 
this.richtextbox.Document = document;


0 comments