mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
Merge pull request #621 from ZogStriP/fix-some-quote-reply-button-quirks
Fix some 'quote reply' button quirks
This commit is contained in:
commit
9bb950ab37
2 changed files with 12 additions and 1 deletions
|
@ -64,7 +64,10 @@ Discourse.QuoteButtonController = Discourse.Controller.extend({
|
|||
|
||||
// move the quote button at the beginning of the selection
|
||||
var $quoteButton = $('.quote-button');
|
||||
$quoteButton.css({ top: top - $quoteButton.outerHeight(), left: left });
|
||||
$quoteButton.css({
|
||||
top: top - $quoteButton.outerHeight() - 5,
|
||||
left: left
|
||||
});
|
||||
|
||||
// remove the marker
|
||||
markerElement.parentNode.removeChild(markerElement);
|
||||
|
|
|
@ -43,6 +43,10 @@ Discourse.PostView = Discourse.View.extend({
|
|||
this.set('context', this.get('content'));
|
||||
},
|
||||
|
||||
mouseDown: function(e) {
|
||||
this.set('isMouseDown', true);
|
||||
},
|
||||
|
||||
mouseUp: function(e) {
|
||||
if (this.get('controller.multiSelect') && (e.metaKey || e.ctrlKey)) {
|
||||
this.toggleProperty('post.selected');
|
||||
|
@ -56,6 +60,8 @@ Discourse.PostView = Discourse.View.extend({
|
|||
e.context = this.get('post');
|
||||
qbc.selectText(e);
|
||||
}
|
||||
|
||||
this.set('isMouseDown', false);
|
||||
},
|
||||
|
||||
selectText: (function() {
|
||||
|
@ -260,6 +266,8 @@ Discourse.PostView = Discourse.View.extend({
|
|||
$(document).on('selectionchange', function(e) {
|
||||
// quoting as been disabled by the user
|
||||
if (!Discourse.get('currentUser.enable_quoting')) return;
|
||||
// there is no need to handle this event when the mouse is down
|
||||
if (postView.get('isMouseDown')) return;
|
||||
// find out whether we currently are selecting inside a post
|
||||
var closestPosts = $(window.getSelection().anchorNode).closest('.topic-post');
|
||||
if (closestPosts.length === 0) return;
|
||||
|
|
Loading…
Reference in a new issue