Comments (9)
I see. We should definitely implement this filter in the project.
I like the idea of defining a list of elements you can remove from rendering if empty, but I think it would be better if we remove all heading elements if they have empty text. Empty headings will affect SEO, and we don't want this to happen.
About the other elements, I don't see any problem in rendering if empty. Images, Videos, iframes will never be empty. And elements like blockquote and lists don't need to be removed IMO.
from rich-text.
Hey, I've published 0.1.3 on NPM that fixes the issue!
Thanks for your help @KaterBasilisk6 ❤️
from rich-text.
Great! Thank you for fixing this so quickly! :)
from rich-text.
Hey @KaterBasilisk6, glad you have been using the project!
Do you have an image example of how it looks with this bug?
I'd love to review your PR. Let me know if you need anything to set up your environment.
from rich-text.
Hey @jpedroschmitz, thank you for your quick reply.
I do not think it should be marked as a bug, because it's caused by users providing an empty row after, for example the heading which is not converted into a paragraph. It would be an enhancement for users and developers to easily remove those elements on creation if they want to. (Maybe we could provide a default list for empty elements to remove and check if the given element belongs to this list, so the developer can keep empty tags like paragraphs, or table cells but remove a second empty heading which would also cause problems in SEO).
/// Structure of Rich Text content
{
h2: Lorem ipsum dolor sit amet
h2:
p: Lorem ipsum dolor...
}
How it currently looks like:
<h2>Lorem ipsum dolor sit amet</h2>
<h2></h2>
<p>Lorem ipsum dolor...</p>
How it's intended to look like:
<h2>Lorem ipsum dolor sit amet</h2>
<p>Lorem ipsum dolor...</p>
from rich-text.
You welcome @jpedroschmitz
from rich-text.
Hi!
I'm having a similar issue with rendering empty theads. I get a validateDOMNesting error that says "Whitespace text nodes cannot appear as a child of <thead>
." In the editor I have a table that has 1 row and 2 columns, and no header.
Would it be possible to include tables in the rule regulating the rendering of empty elements?
Thanks for this package btw!
from rich-text.
Hey @Endorel, sorry for the late reply. I missed this notification :(
Yeah, we can! I'll be working on this project for the next few days! I'll let you know when I add this rule =D
from rich-text.
Hey @Endorel, I just published 0.1.5 that fixes this issue! Thanks a lot for reporting it ❤️
from rich-text.
Related Issues (20)
- Accessing image properties from renderer isn't working. HOT 1
- Add anchor tag support for Page Navigation HOT 3
- Update @graphcms/html-to-slate-ast to use newer versions of Slate HOT 3
- <p> tag className formatting "overwrites" <a> tag ClassName formatting HOT 2
- Import element fuctions to reuse on my own code HOT 3
- Impossible to render a clickable image with Reactjs and rich-text HOT 9
- Video Props typings are not correct HOT 5
- Error: Cannot find module './xhr-sync-worker.js' HOT 7
- ClientError: expected RichText raw value to be object: HOT 1
- Newline added by astToHtmlString for link object
- <p></p> returned in empty rich text box
- Feature request: Allow assign class name directly to image in rich text editor
- GraphCMS Marcom website says to use children as prop HOT 1
- React duplicate key issue HOT 3
- [help wanted] How to zoom an image rendered by rich-text-renderer with react-awesome-lightbox library HOT 1
- Is there a way to render iFrame? HOT 1
- Link is not recognized HOT 3
- Images are being parsed as links HOT 1
- RichText rendering nested li's causing nextjs hydration errors HOT 2
- Link embed with Assets not working HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rich-text.