Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] nested spans font-sizes parsed into incorrect marks #1483

Closed
qlp-mathias opened this issue Aug 21, 2024 · 5 comments
Closed

[Bug] nested spans font-sizes parsed into incorrect marks #1483

qlp-mathias opened this issue Aug 21, 2024 · 5 comments

Comments

@qlp-mathias
Copy link

qlp-mathias commented Aug 21, 2024

Note: I originally posted this as a Re-Mirror issue but was re-directed here.

I'm dealing with some HTML created by a legacy rich text editor. This editor sometimes seems to have produced some unnecessary - albeit valid - nesting, which is not getting parsed correctly.

Steps to reproduce

Given a Remirror instance with

  • stringHandler: 'html'
  • TextSizeExtension
  • and the following HTML content
<!-- Input -->
<p>
<span style="font-size: 18px;">
  Text in 18px
  <span style="font-size: 24px;">
    Text in 24px
    <span style="font-size: 18px;"><!-- this is sanitised, even though it's a valid new font-size -->
      Text in 18px
      <span style="font-size: 24px;"><!-- this is sanitised, but not noticeable in the end result because the parent 18px is sanitised -->
        Text in 24px
      </span>
    </span>
  </span>
</span>
</p>

This results in the following rendered HTML (Notice that the text in the red box should also have a font-size of 18px)
Screenshot 2024-07-23 at 10 18 08

It also seems to be scoped to font-size. If I instead replace the font-size style with, say, font-weight in a similar fashion it renders as expected.

@qlp-mathias qlp-mathias changed the title [Bug] nested spans font-sizes parsed into correct marks [Bug] nested spans font-sizes parsed into incorrect marks Aug 21, 2024
@qlp-mathias
Copy link
Author

I just noticed that this might be a duplicate of #907

@zunsthy
Copy link

zunsthy commented Jan 16, 2025

the same problem as you. i think it was resolved in prosemirror-model@1.22.3

@marijnh
Copy link
Member

marijnh commented Jan 16, 2025

Yes, this should be fixed now. Are you still seeing it @zunsthy, or did you mean to say that it is resolved for you?

@zunsthy
Copy link

zunsthy commented Jan 17, 2025

i mean it is resolved after 1.22.3 : )

@marijnh
Copy link
Member

marijnh commented Jan 17, 2025

Wonderful!

@marijnh marijnh closed this as completed Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants