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

StoryblokRichText not working with all characters #1315

Open
1 task done
esilver-automox opened this issue Jan 10, 2025 · 2 comments · May be fixed by #1314
Open
1 task done

StoryblokRichText not working with all characters #1315

esilver-automox opened this issue Jan 10, 2025 · 2 comments · May be fixed by #1314
Assignees
Labels
bug [Issue] Something isn't working

Comments

@esilver-automox
Copy link

Describe the issue you're facing

I am trying to use the StoryblokRichText component with default resolvers to render my richtext field but the characters for <, >, ', ", and & come out as escaped html characters instead of those symbols.
Screenshot 2025-01-10 at 3 04 11 PM
Screenshot 2025-01-10 at 3 04 04 PM

Reproduction

https://github.com/esilver-automox/richtext-storyblok

Steps to reproduce

Set up a block with a richtext field
use the StoryblokRichText component to render your rich text as described in the library documentation
use any of these characters in your richtext field: <, >, ', ", or &
see the characters displayed as escaped html instead of the correct symbols

System Info

System:
    OS: macOS 15.2
    CPU: (11) arm64 Apple M3 Pro
    Memory: 83.66 MB / 18.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.15.0 - ~/.nvm/versions/node/v20.15.0/bin/node
    npm: 10.7.0 - ~/.nvm/versions/node/v20.15.0/bin/npm
  Browsers:
    Chrome: 131.0.6778.265
    Safari: 18.2

Used Package Manager

npm

Error logs (Optional)

No response

Validations

@esilver-automox esilver-automox added pending-author [Issue] Awaiting further information or action from the issue author pending-triage [Issue] Ticket is pending to be prioritised labels Jan 10, 2025
@edodusi
Copy link
Contributor

edodusi commented Jan 21, 2025

This is being worked in #1314

@edodusi edodusi added bug [Issue] Something isn't working and removed pending-author [Issue] Awaiting further information or action from the issue author pending-triage [Issue] Ticket is pending to be prioritised labels Jan 21, 2025
@alvarosabu alvarosabu linked a pull request Jan 22, 2025 that will close this issue
@oddcelot
Copy link

if someone else struggles with this, here is a not very well refined workaround for the meantime 😅

 <StoryblokRichText
  doc={content}
  resolvers={{
    paragraph: (node, res) => {
      return node.content.map((child) =>
        child?.marks === undefined ? (
          <p>{child.text}</p>
        ) : (
          <StoryblokRichText doc={{ type: "doc", content: [child] }} />
        )
      );
    },
  }}
/>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug [Issue] Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants