FIX: Clicking on quote button was tricky

This commit is contained in:
Robin Ward 2017-10-06 21:29:16 -04:00
parent 193244f8c1
commit 4da4f986ee
1 changed files with 1 additions and 7 deletions

View File

@ -1,11 +1,5 @@
import { selectedText } from 'discourse/lib/utilities';
// we don't want to deselect when we click on buttons that use it
function willQuote(e) {
const $target = $(e.target);
return $target.hasClass('quote-button') || $target.closest('.create, .share, .reply-new').length;
}
export default Ember.Component.extend({
classNames: ['quote-button'],
classNameBindings: ['visible'],
@ -109,7 +103,7 @@ export default Ember.Component.extend({
$(document).on("mousedown.quote-button", e => {
this._isMouseDown = true;
this._reselected = false;
if (!willQuote(e)) {
if ($(e.target).closest('.quote-button, .create, .share, .reply-new').length === 0) {
this._hideButton();
}
}).on("mouseup.quote-button", () => {