Description
The Rich Text editor can append an empty paragraph when saving an edited value, even when the content visibly ends after the final line.
For example, the stored HTML changes from:
<p class="dw-paragraph-0">
<a href="/about">About</a> | <a href="/contact">Contact</a>
</p>
to:
<p class="dw-paragraph-0">
<a href="/about">About</a> | <a href="/contact">Contact</a>
</p>
<p></p>
The empty paragraph reappears after subsequent edits, requiring the editor to remove the blank line each time the value is saved.
Steps to reproduce
- Configure an item field to use
Dynamicweb.Content.Items.Editors.RichTextEditor.
- Create or copy an item containing a single Rich Text paragraph with linked text.
- Edit the copied value and change only the text inside one of the links.
- Ensure there is no empty line after the content.
- Save the item.
- Reopen the item in the Visual Editor.
- Observe that an empty line has been appended.
- Inspect the rendered or stored HTML and observe the trailing
<p></p>.
Expected behavior
The Rich Text editor should preserve the submitted content without appending an additional empty paragraph.
An empty paragraph should only be stored when the editor explicitly adds one.
Actual behavior
The editor appends an empty trailing paragraph when the value is saved.
Impact
The additional element can affect frontend layout and spacing. For example, styles targeting the last child may be applied to the generated empty paragraph instead of the final element
containing actual content.
It also creates an editorial issue because the empty line must be removed again after subsequent edits.
Environment
Description
The Rich Text editor can append an empty paragraph when saving an edited value, even when the content visibly ends after the final line.
For example, the stored HTML changes from:
to:
The empty paragraph reappears after subsequent edits, requiring the editor to remove the blank line each time the value is saved.
Steps to reproduce
Dynamicweb.Content.Items.Editors.RichTextEditor.<p></p>.Expected behavior
The Rich Text editor should preserve the submitted content without appending an additional empty paragraph.
An empty paragraph should only be stored when the editor explicitly adds one.
Actual behavior
The editor appends an empty trailing paragraph when the value is saved.
Impact
The additional element can affect frontend layout and spacing. For example, styles targeting the last child may be applied to the generated empty paragraph instead of the final element
containing actual content.
It also creates an editorial issue because the empty line must be removed again after subsequent edits.
Environment