React-quill: Extra paragraphs & line breaks are inserted

Created on 23 Oct 2017  路  4Comments  路  Source: zenoamaro/react-quill

Whenever the onChange fires, every time it encounters 1 or more paragraphs with line breaks, it adds an even more paragraphs with line breaks to the document.

If you take a look at the codepen below, the initial state only contains a sinlge paragraph with a line break, between the 2 headers.
Inspecting the document reveals 3 of them.

https://codepen.io/DrejerDK/pen/NaVPvo

Most helpful comment

Be aware that react-quill dependency requirement for quill is lower than v1.3, which is the version that implements matchVisual...
It took me a while to figure that's why it wasn't working. You config it like:

<ReactQuill
  modules={{
    clipboard: {
      matchVisual: false,
    },
  }}
  [...]
/>

All 4 comments

You probably want to add matchVisual: false to the clipboard module config to prevent Quill adding spacing around headings: http://quilljs.com/docs/modules/clipboard/#matchvisual

https://codepen.io/alexkrolick/pen/RLmvMd?editors=0010

Be aware that react-quill dependency requirement for quill is lower than v1.3, which is the version that implements matchVisual...
It took me a while to figure that's why it wasn't working. You config it like:

<ReactQuill
  modules={{
    clipboard: {
      matchVisual: false,
    },
  }}
  [...]
/>

@enapupe did you find any way to solve it with react-quill although the lower version it uses?

Yeah I just did yarn remove react-quill and added it back again.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ycjcl868 picture ycjcl868  路  5Comments

prosenjitchy picture prosenjitchy  路  3Comments

LiuChangFreeman picture LiuChangFreeman  路  3Comments

InsectEater picture InsectEater  路  4Comments

alexkrolick picture alexkrolick  路  4Comments