withspectrum / draft-js-markdown-plugin

An opinionated DraftJS plugin for supporting Markdown syntax shortcuts
https://markdown-plugin.spectrum.chat/
MIT License
139 stars 42 forks source link

Pasting code breaks format #77

Closed andrewfan closed 6 years ago

andrewfan commented 6 years ago

Formatting breaks after pasting the code when I paste https://www.dropbox.com/s/cshujh5l3tc6ox6/Screenshot%202018-05-17%2018.44.30.png?dl=0 I see this https://www.dropbox.com/s/owsg95juumx8jfu/Screenshot%202018-05-17%2018.45.58.png?dl=0

I tried to debug and saw that if I remove code-block from here https://github.com/withspectrum/draft-js-markdown-plugin/blob/master/src/index.js#L234 everything works like intended so I have 2 questions

1) why does it happens? 2) is it very important to render code block as code tag or we can simply remove this rule from blockRenderMap?

mxstbr commented 6 years ago

Can you deploy a preview with that line removed? I'm sure it's gotta be there for a reason, something must break with it removed.

andrewfan commented 6 years ago

@mxstbr http://synonymous-liquid.surge.sh/ I think that bug comes from draft-js, I created the issue there https://github.com/facebook/draft-js/issues/1769 Please take a look at the example and if it is not critical for the project to wrap code block in <pre><code> I will remove code-block from blockRenderMap