React-quill: Strange behavior on headers (h1,h2,etc) dropdown on toolbar

Created on 15 Mar 2017  路  5Comments  路  Source: zenoamaro/react-quill

Hello,

I'm having a strange behavior when I try to use the header dropdown on the toolbar to use <h1>, <h2>, etc. tags.

Basically what happens is that when I click the dropdown, is open and close immediately. I don't have time to select a header, but... when I left the click button down, and I move to the options container, I can select a header.

Here's my component code:

ReactQuill = require 'react-quill'

class QuillWrapper extends React.Component

  constructor: (props)->
    super props

    @modules = {
      toolbar: [
        [{ 'header': [1, 2, 3, 4, 5, 6, false] }],
        ['bold', 'italic', 'underline','strike', 'blockquote'],
        [{'list': 'ordered'}, {'list': 'bullet'}, {'indent': '-1'}, {'indent': '+1'}],
        ['link'],
        ['clean']
      ],
    }

    @formats = [
      'header',
      'bold', 'italic', 'underline', 'strike', 'blockquote',
      'list', 'bullet', 'indent',
      'link'
    ]

  displayName: 'QuillWrapper'

  shouldComponentUpdate: (nextProps,nextState)->
    nextProps.value isnt @props.value

  changeHandler: (value, delta, source)=>
    console.log "On Change..."

  onEditorChangeSelection: (range, source)=>

  render: =>

    return(

        <ReactQuill theme="snow"
                    modules={@modules}
                    formats={@formats}
                    readOnly=false
                    onChange={@changeHandler}
                    onChangeSelection={@onEditorChangeSelection}
                    value={@props.value}/>

    )

module.exports = QuillWrapper if module?.exports?

Can be this caused because it's used as a component called from other components?

That's the only toolbar option with problems, other buttons works fine.

Quill version:

  • [ ] 1.0.0-beta-3

Most helpful comment

Ok, the issue was that the parent component had a

Sorry for the inconvenient :)

All 5 comments

Ok, the issue was that the parent component had a

Sorry for the inconvenient :)

Hey @gustavoelizalde can you explain what was the problem? I'm having the same exact issue you described

@gsimone @gustavoelizalde can anyone post the solution to this? I'm experiencing the same thing.

@gavinpatkinson in my case the issue was a

tag I had wrapping the Quill-component.

Are you using the last version of 'react-quill' ?

I had the same problem, tried to figure it out for a long time and finally found this solution, thanks

Don't wrap the ReactQuill component with a label tag

Was this page helpful?
0 / 5 - 0 ratings

Related issues

levous picture levous  路  3Comments

pooriamo picture pooriamo  路  3Comments

shaneshearer-andculture picture shaneshearer-andculture  路  4Comments

sophyphreak picture sophyphreak  路  5Comments

ycjcl868 picture ycjcl868  路  5Comments