   initFormat: (format, eventName) ->
     input = this._getInput(format)
     return unless input?
+    triggering = false
     DOM.addEventListener(input, eventName, =>
+      return if triggering
+      triggering = true
       value = if eventName == 'change' then input.options[input.selectedIndex].value else !DOM.hasClass(input, 'sc-active')
       @quill.focus()
       range = @quill.getSelection()

    container: null

  @formats:
    BUTTON: {'bold', 'italic', 'strike', 'underline'}
    SELECT: {'align', 'background', 'color', 'font', 'size'}

  constructor: (@quill, @editorContainer, @options) ->
    throw new Error('container required for toolbar', @options) unless @options.container?
    @container = if _.isString(@options.container) then document.querySelector(@options.container) else @options.container
    _.each(@quill.options.formats, (format) =>
      if Toolbar.formats.BUTTON[format]?
        this.initFormat(format, 'click')


  _getActive: (range) ->
    if range?
      if range.isCollapsed()
        contents = @quill.getContents(range)
      else
        index = Math.max(0, range.start - 1)
        contents = @quill.getContents(index, index)
      formatsArr = _.pluck(contents, 'attributes')
      activeFormats = formatsArr[0] or {}
      _.each(formatsArr.slice(1), (formats) ->
        _.each(_.keys(activeFormats), (name) ->
          if formats[name]
