kadikraman / draftjs-md-converter

Converts content from Draft.js blocks to Markdown and vice versa.
https://kadikraman.github.io/draftjs-md-converter/
MIT License
145 stars 37 forks source link

Duplicate text and formatting issues when using formatted instances of the same word on one line. #14

Closed robotmonkey closed 7 years ago

robotmonkey commented 7 years ago

Hi @kadikraman, we're noticing a bug where when you use multiple (at least 2) instances of the same word on a single line, and if one of those instances is formatted using bold, italics, or bold & italics, you will see duplicatation of text and some formatting issues - https://cl.ly/iOSO.

To reproduce this:

Please let me know if I can follow up with more details. Thanks.

bradbirnbaum commented 7 years ago

@robotmonkey I'm bumping into this as well. I have isolated it to the fixWhitespacesInsideStyle function at this line

https://github.com/kadikraman/draftjs-md-converter/blob/master/src/draftjsToMd.js#L86

Essentially text.indexOf(bodyT) is finding the first instance of the string but the assumption that its the first occurence is incorrect. Would love to see a fix

kadikraman commented 7 years ago

Hi @robotmonkey - which version of Draft.js are you using?

rickhanlonii commented 7 years ago

Fixed on https://github.com/kadikraman/draftjs-md-converter/issues/15

kadikraman commented 7 years ago

Thank you @rickhanlonii I've published the change, the new version is 0.1.1