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

Inline styles sometimes eating spaces #39

Closed tjkind closed 6 years ago

tjkind commented 6 years ago

I'm using this library along with react-draft-wysiwyg and I've found a scenario where the markdown will be missing a space after conversion. Pre conversion text: This is not fine Post conversion text: This is notfine Doesn't lose any spaces: This is fine Conversion code: draftjsToMd(convertToRaw(body.getCurrentContent())) RawDraftContentState: screen shot 2018-07-04 at 3 47 17 pm

I think I fixed it locally by adding totalOffset += endingStyle.symbol.length; after adding the closing symbol but I'm not confident enough in this fix to open a pull request

kadikraman commented 6 years ago

Thanks for the detail! I think it's fine to add it, because it doesn't break any of the existing tests and I was able to add a failing test based on your example 💯

Released as a patch v1.1.1 🎉