Closed aroc closed 4 years ago
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
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.
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.
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