FIX: Quoted text wasn't inserted when replying as new topic
This commit is contained in:
parent
eeafa67984
commit
2998fe1ee5
|
@ -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({
|
export default Ember.View.extend({
|
||||||
classNames: ['quote-button'],
|
classNames: ['quote-button'],
|
||||||
classNameBindings: ['visible'],
|
classNameBindings: ['visible'],
|
||||||
|
@ -45,11 +53,7 @@ export default Ember.View.extend({
|
||||||
.on("mousedown.quote-button", function(e) {
|
.on("mousedown.quote-button", function(e) {
|
||||||
view.set('isMouseDown', true);
|
view.set('isMouseDown', true);
|
||||||
|
|
||||||
const $target = $(e.target);
|
if (ignoreElements(e)) { return; }
|
||||||
// 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;
|
|
||||||
|
|
||||||
// deselects only when the user left click
|
// deselects only when the user left click
|
||||||
// (allows anyone to `extend` their selection using shift+click)
|
// (allows anyone to `extend` their selection using shift+click)
|
||||||
|
@ -58,6 +62,8 @@ export default Ember.View.extend({
|
||||||
!e.shiftKey) controller.deselectText();
|
!e.shiftKey) controller.deselectText();
|
||||||
})
|
})
|
||||||
.on('mouseup.quote-button', function(e) {
|
.on('mouseup.quote-button', function(e) {
|
||||||
|
if (ignoreElements(e)) { return; }
|
||||||
|
|
||||||
view.selectText(e.target, controller);
|
view.selectText(e.target, controller);
|
||||||
view.set('isMouseDown', false);
|
view.set('isMouseDown', false);
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue