Use mousedown instead of click for toolbar buttons

Prevents flickering of the placeholder text when clicking block formatting buttons on an empty document.
This commit is contained in:
Sam Stephenson
2014-11-19 16:18:27 -06:00
parent b047c70bbf
commit c4b9d5b5f1
2 changed files with 3 additions and 3 deletions
@@ -10,8 +10,8 @@ class Trix.ToolbarController
constructor: (@element) ->
@attributes = {}
handleEvent "click", onElement: @element, matchingSelector: actionButtonSelector, withCallback: @didClickActionButton
handleEvent "click", onElement: @element, matchingSelector: attributeButtonSelector, withCallback: @didClickAttributeButton
handleEvent "mousedown", onElement: @element, matchingSelector: actionButtonSelector, withCallback: @didClickActionButton
handleEvent "mousedown", onElement: @element, matchingSelector: attributeButtonSelector, withCallback: @didClickAttributeButton
handleEvent "click", onElement: @element, matchingSelector: dialogButtonSelector, withCallback: @didClickDialogButton
# Event handlers
+1 -1
View File
@@ -3,7 +3,7 @@ getToolbarButton = ({attribute, action}) ->
@clickToolbarButton = (selector, callback) ->
button = getToolbarButton(selector)
triggerEvent(button, "click")
triggerEvent(button, "mousedown")
defer(callback)
@clickToolbarDialogButton = ({method}, callback) ->