question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why is React Quill matchVisuals not working?

See original GitHub issue

I am trying to remove the extra <p><br></p> tags that are present as line breaks while using React Quill. I tried implementing the matchVisual parameter outlined here, but it still seems to be giving me that paragraph and br tags in the output. Here is a code pen showing simple changes to the Quill demo setup, and it still doesn’t work.

I declare the modules for Quill in the constructor like:

 constructor (props) {
    super(props)
    this.state = { editorHtml: '', theme: 'snow' }
    this.handleChange = this.handleChange.bind(this)
    this.modules = {
            toolbar: [
                [{ 'header': '1'}, {'header': '2'}],
                [{size: []}],
                ['bold', 'italic', 'underline', 'strike', 'blockquote'],
                [{'list': 'ordered'}, {'list': 'bullet'}, 
                {'indent': '-1'}, {'indent': '+1'}],
                [{ align: '' }, { align: 'center' }, { align: 'right' }, { align: 'justify' }],
                ['link', 'image'],
                ['clean']
            ],
            clipboard: {
              matchVisual: false,
            }
          }
        
    this.formats = [
      'header', 'size',
      'bold', 'italic', 'underline', 'strike', 'blockquote',
      'list', 'bullet', 'indent',
      'link', 'image', 'align'
    ]
  }

I am probably doing something just a tad bit wrong, any ideas?

React-Quill version

  • master (^1.3.3)
  • 0.4.1
  • 1.0.0-beta-1
  • 1.0.0-beta-2
  • 1.0.0-beta-3
  • 1.0.0-beta-4
  • 1.0.0-beta-5
  • 1.0.0-rc-1
  • 1.0.0-rc-2
  • 1.0.0-rc-3
  • 1.0.0
  • 1.1.0
  • Other (fork)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
filipgrkiniccommented, May 6, 2020

Thanks for sharing! I ended up just doing the following, before storing it in the database. text.replace(/<p><br><\/p>/g, "")

0reactions
douglasrcjamescommented, May 6, 2020

I like your solution more, I might implement yours in the future haha!

Read more comments on GitHub >

github_iconTop Results From Across the Web

matchVisual is not working in React Quill 2.0 - Stack Overflow
The problem is that matchVisual has been removed as an option. This change occurred with Quill 2.0, as noted in the release notes...
Read more >
Why is React Quill matchVisuals not working? - Bountysource
I tried implementing the matchVisual parameter outlined here, but it still seems to be giving me that paragraph and br tags in the...
Read more >
React-Quill matchVisual: false - CodePen
Insecure Resource. The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https....
Read more >
react-quill - npm
Start using react-quill in your project by running `npm i react-quill`. ... We expect this release to be a drop-in upgrade – if...
Read more >
Include functions in a plugin out of the constructor - React Studio
No problem with that, I just include the line like the next one inside ... getReactWebJSXCode = function(exporter) { var jsx = `<ReactQuill...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found