Code Monkey home page Code Monkey logo

Comments (9)

jpedroschmitz avatar jpedroschmitz commented on June 5, 2024 1

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.

jpedroschmitz avatar jpedroschmitz commented on June 5, 2024 1

Hey, I've published 0.1.3 on NPM that fixes the issue!

Thanks for your help @KaterBasilisk6 ❤️

from rich-text.

Endorel avatar Endorel commented on June 5, 2024 1

Great! Thank you for fixing this so quickly! :)

from rich-text.

jpedroschmitz avatar jpedroschmitz commented on June 5, 2024

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.

rpfaeffle avatar rpfaeffle commented on June 5, 2024

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:

Screenshot of <RichText /> result

<h2>Lorem ipsum dolor sit amet</h2>
<h2></h2>
<p>Lorem ipsum dolor...</p>

How it's intended to look like:

Screenshot of how it should look like

<h2>Lorem ipsum dolor sit amet</h2>
<p>Lorem ipsum dolor...</p>

from rich-text.

rpfaeffle avatar rpfaeffle commented on June 5, 2024

You welcome @jpedroschmitz

from rich-text.

Endorel avatar Endorel commented on June 5, 2024

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.

jpedroschmitz avatar jpedroschmitz commented on June 5, 2024

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.

jpedroschmitz avatar jpedroschmitz commented on June 5, 2024

Hey @Endorel, I just published 0.1.5 that fixes this issue! Thanks a lot for reporting it ❤️

from rich-text.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.