mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-30 10:58:31 -05:00
don't error out if no range is selected
This commit is contained in:
parent
c29390386f
commit
ab9c55689e
1 changed files with 6 additions and 1 deletions
|
@ -35,8 +35,13 @@ Discourse.QuoteButtonController = Discourse.Controller.extend({
|
|||
// don't display the "quote-reply" button if we can't create a post
|
||||
if (!this.get('controllers.topic.content.can_create_post')) return;
|
||||
|
||||
var selection = window.getSelection();
|
||||
|
||||
// no selections
|
||||
if (selection.type !== "Range") return;
|
||||
|
||||
// retrieve the selected range
|
||||
var range = window.getSelection().getRangeAt(0),
|
||||
var range = selection.getRangeAt(0),
|
||||
cloned = range.cloneRange(),
|
||||
$ancestor = $(range.commonAncestorContainer);
|
||||
|
||||
|
|
Loading…
Reference in a new issue