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

Broken parsing from DraftJS content to Markdown when adding an emoji after bolded text #62

Closed
aroc opened this issue Aug 24, 2020 · 3 comments · Fixed by #63
Closed

Comments

@aroc
Copy link

aroc commented Aug 24, 2020

What is happening?

When adding an emoji specifically after bolded text in DraftJS, the conversion to markdown breaks.

Here is a full reproduction:
https://repl.it/@EricAnderson7/SweetSneakyExecutable#index.js

@aroc
Copy link
Author

aroc commented Aug 24, 2020

Also here is the same example but with the single emoji replace with a single letter. The markdown bolding characters are properly placed in this case:
https://repl.it/@EricAnderson7/SweetSneakyExecutable-1

@aroc
Copy link
Author

aroc commented Aug 24, 2020

Ok it turns out we can simply use Array.from(block.text) instead of block.text.split(''). Of course, this means no support for Internet Explorer as per MDN.

@kadikraman
Copy link
Owner

Nice, thanks for posting the code examples! Using Array.from resolves it like you said. I'll raise a PR for it.

As for IE - good spot! The latest version doesn't support IE11 either as there are already instances of Array.from in the bundle, so this isn't a regression.

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

Successfully merging a pull request may close this issue.

2 participants