empty paragraph in richtext renders as 0px height content on page
See original GitHub issueIt looks like the template for paragraphs in the richtextfield render as <p></p>
rather than as <p> </p>
, which makes the empty paragraph show up in the richtextfield in the admin, but does not get reflected in the page content, as <p></p>
is considered a kind of “non-content” by the DOM, and is rendered as if it’s not even there. The template for this block probably needs a fix that injects
if the block’s value is empty.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Visualforce rich text input area spacing
Everything appears correct except the paragraph spacing is double spaced. Does anyone know how to control the vertical spacing? Is it a style ......
Read more >How to set an empty paragraph element to the minimum ...
If a paragraph element is empty it has no height. How to set the minimum height to the text height (font-size)?. I know...
Read more >How To Use Document Fields - Keystone 6 Documentation
Learn how to configure Keystone's highly customizable Rich Text editor. The Document field is built with Slate and stores your content as JSON-structured ......
Read more >Safari Technology Preview Release Notes - Apple Developer
Rendering. Added width and height content attributes to <model> (257294@main) ... Implemented support for the Clear-Site-Data HTTP header (254745@main) ...
Read more >Change line space in a rich text editor - Oracle Communities
I thought it will display it with the same line height but that did not happen. It was still displayed with a large...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
My idea is to allow control over this with CSS, and an
:empty
selector. Would that work for you, eg. setting a height for those blocks? This way your writers would get what they expect.Of course having some control over the HTML itself would be even better, but we’re not there yet.
Note that
<br>
isn’t any better than just leaving the<p></p>
, as the br element is intended for introducing a line break inside of text content, rather than being used between paragraph elements. Leaving the empty paragraph is actually semantically preferred, and then folks can still make it look however they want by adding custom CSS for.richtext p:empty
.But, it would be even better if there was a post-processing step that added a class that effects extra spacing below the preceding paragraph while removing the
<p></p>
altogether, so that:becomes something like:
With default styling along the lines of:
Essentially making sure that the paragraph uses the bottom margin it’s supposed to plus an extra paragraph worth or top and bottom margin.