m4rvr / storyblok-rich-text-renderer

Fast renderer for your rich-text content.
35 stars 15 forks source link

Duplicated Text For Multiple Mark Styles #20

Closed fanckush closed 2 years ago

fanckush commented 2 years ago

Hey Again,

There is a bug in this line https://github.com/MarvinRudolph/storyblok-rich-text-renderer/blob/0dd3f50d6fb45c3ba0e2ab550d35532599fd13a5/packages/storyblok-rich-text-vue-renderer/src/renderer.ts#L47

Let's say you have the following text in Storyblok Rich Text Editor (notice it is both bold and italic): I am text It will be rendered as fallows: I am textI am text

The referenced map() is likely causing the bug because it's creating as many nodes as there are marks instead of chaining them.

I might open a PR once I know how to solve it

m4rvr commented 2 years ago

Hey, thanks for reporting! Yeah, it's probably because I forgot the.reduce and used a simple .map. Fix is on the way. 🙂