Fine text selection to quote on Opera.
This commit is contained in:
parent
4f8cfa82d8
commit
0b26a4d817
@ -1562,6 +1562,9 @@
|
||||
text = ">>" + id + "\n";
|
||||
sel = window.getSelection();
|
||||
if ((s = sel.toString()) && id === ((_ref = $.x('ancestor-or-self::blockquote', sel.anchorNode)) != null ? _ref.id.match(/\d+$/)[0] : void 0)) {
|
||||
if ($.engine === 'presto') {
|
||||
s = d.getSelection();
|
||||
}
|
||||
s = s.replace(/\n/g, '\n>');
|
||||
text += ">" + s + "\n";
|
||||
}
|
||||
@ -1571,7 +1574,7 @@
|
||||
ta.focus();
|
||||
range = caretPos + text.length;
|
||||
if ($.engine === 'presto') {
|
||||
range++;
|
||||
range += text.match(/\n/g).length;
|
||||
}
|
||||
ta.setSelectionRange(range, range);
|
||||
e = d.createEvent('Event');
|
||||
|
||||
@ -1145,6 +1145,8 @@ QR =
|
||||
|
||||
sel = window.getSelection()
|
||||
if (s = sel.toString()) and id is $.x('ancestor-or-self::blockquote', sel.anchorNode)?.id.match(/\d+$/)[0]
|
||||
# XXX Opera needs d.getSelection() to retain linebreaks from the selected text
|
||||
s = d.getSelection() if $.engine is 'presto'
|
||||
s = s.replace /\n/g, '\n>'
|
||||
text += ">#{s}\n"
|
||||
|
||||
@ -1156,7 +1158,7 @@ QR =
|
||||
# Move the caret to the end of the new quote.
|
||||
range = caretPos + text.length
|
||||
# XXX Opera counts newlines as double
|
||||
range++ if $.engine is 'presto'
|
||||
range += text.match(/\n/g).length if $.engine is 'presto'
|
||||
ta.setSelectionRange range, range
|
||||
|
||||
# Fire the 'input' event
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user