mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 20:20:43 +08:00
Fix some 'quote reply' button quirks
This commit is contained in:
parent
effb440de0
commit
dd4f24919f
|
@ -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 New Issue
Block a user