FIX: Quoted text wasn't inserted when replying as new topic

This commit is contained in:
Robin Ward 2016-02-09 14:42:20 -05:00
parent eeafa67984
commit 2998fe1ee5
1 changed files with 11 additions and 5 deletions

View File

@ -1,3 +1,11 @@
// we don't want to deselect when we click on buttons that use it
function ignoreElements(e) {
const $target = $(e.target);
return $target.hasClass('quote-button') ||
$target.closest('.create').length ||
$target.closest('.reply-new').length;
}
export default Ember.View.extend({
classNames: ['quote-button'],
classNameBindings: ['visible'],
@ -45,11 +53,7 @@ export default Ember.View.extend({
.on("mousedown.quote-button", function(e) {
view.set('isMouseDown', true);
const $target = $(e.target);
// we don't want to deselect when we click on buttons that use it
if ($target.hasClass('quote-button') ||
$target.closest('.create').length ||
$target.closest('.reply-new').length) return;
if (ignoreElements(e)) { return; }
// deselects only when the user left click
// (allows anyone to `extend` their selection using shift+click)
@ -58,6 +62,8 @@ export default Ember.View.extend({
!e.shiftKey) controller.deselectText();
})
.on('mouseup.quote-button', function(e) {
if (ignoreElements(e)) { return; }
view.selectText(e.target, controller);
view.set('isMouseDown', false);
})