What problem does this address?
The use of multiple consecutive line breaks and empty paragraphs seems very limited. I only came up with few use cases. For example
one is to indicate an absence of text in a semantically correct manner:
<p>
Lorem ...<br><br><br><br><br><br><br><br>
</p>
Because the editor does not restrict these patterns while their use is only preferred in edge cases I would argue that allowing them only creates problems. Even experienced users can occasionally leave empty paragraphs or unintentional line breaks by mistake.
What is your proposed solution?
Implement an optional editor setting that will prevent such patterns.
Proposed logic to handle the user input:
Line-breaks
- Single line-breaks are allowed unless the line break is not at the start of the element.
- A linebreak at the end of an element should be removed as soon as the user focuses another element. Alternatively it can be removed when the post is saved.
- When user enters a second consecutive line-break a new paragraph is created. Alternatively nothing should happen.
Paragraphs
- When the caret is within an empty paragraph, pressing enter should do nothing.
- Abandoned, newly created and empty paragraphs: When a user creates a paragraph and while it is still empty creates a new block elsewhere in the post, the abandoned paragraph should be removed automatically.
Handling pasted content
- All empty paragraphs should be stripped.
- Line-breaks that are at the start and end of elements should be removed.
- Single line-breaks between elements/text are allowed.
- Multiple consecutive line-breaks between non-paragraph-elements/text should be treated as indicators for paragraph separation and thus should be converted in to paragraphs.
The most important thing when handling pasted content should be to remove occurrences of line-breaks or paragraphs that would otherwise not be possible to create within the block editor when the restriction is in effect.
What problem does this address?
The use of multiple consecutive line breaks and empty paragraphs seems very limited. I only came up with few use cases. For example
one is to indicate an absence of text in a semantically correct manner:
Because the editor does not restrict these patterns while their use is only preferred in edge cases I would argue that allowing them only creates problems. Even experienced users can occasionally leave empty paragraphs or unintentional line breaks by mistake.
What is your proposed solution?
Implement an optional editor setting that will prevent such patterns.
Proposed logic to handle the user input:
Line-breaks
Paragraphs
Handling pasted content
The most important thing when handling pasted content should be to remove occurrences of line-breaks or paragraphs that would otherwise not be possible to create within the block editor when the restriction is in effect.