Desktop: Fixes #6055: Preserve empty newlines created by pressing Enter repeatedly in the rich text editor #8549
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #6055.
TinyMCE was outputting
<p></p>
for empty newlines, which is both ignored byturndown
and renders to an element with zero height.Using
extended_valid_elements
rather thanvalid_elements
to allow additional HTML elements, however, causes TinyMCE to output<p> </p>
instead. This can be handled by TinyMCE without breaking existing tests that rely on TinyMCE ignoring empty<p>
elements.Note: This does not fix the issue where repeated newlines created by shift+enter are lost.
Testing
<div>
s instead of empty paragraphs. It may be necessary to add a non-empty line to the note and switch to another note before pressing enter adds paragraphs.In step 4, the same number of empty paragraphs should be present as in step 2.
Additionally, to verify that custom elements are still supported,
<x-custom-element>test</x-custom-element>
)To verify that KaTeX rendering still works:
$$ \int_0^1 x^2 dx $$