Fix #853
This commit is contained in:
parent
642519834a
commit
f28bfd4e7e
@ -1991,23 +1991,17 @@
|
|||||||
}
|
}
|
||||||
id = this.previousSibling.hash.slice(2);
|
id = this.previousSibling.hash.slice(2);
|
||||||
text = ">>" + id + "\n";
|
text = ">>" + id + "\n";
|
||||||
sel = window.getSelection();
|
sel = d.getSelection();
|
||||||
if ((s = sel.toString().trim()) && id === ((_ref = $.x('ancestor-or-self::blockquote', sel.anchorNode)) != null ? _ref.id.match(/\d+$/)[0] : void 0)) {
|
if ((s = sel.toString().trim()) && id === ((_ref = $.x('ancestor-or-self::blockquote', sel.anchorNode)) != null ? _ref.id.match(/\d+$/)[0] : void 0)) {
|
||||||
if ($.engine === 'presto') {
|
|
||||||
s = d.getSelection().trim();
|
|
||||||
}
|
|
||||||
s = s.replace(/\n/g, '\n>');
|
s = s.replace(/\n/g, '\n>');
|
||||||
text += ">" + s + "\n";
|
text += ">" + s + "\n";
|
||||||
}
|
}
|
||||||
ta = $('textarea', QR.el);
|
ta = $('textarea', QR.el);
|
||||||
caretPos = ta.selectionStart;
|
caretPos = ta.selectionStart;
|
||||||
ta.value = ta.value.slice(0, caretPos) + text + ta.value.slice(ta.selectionEnd);
|
ta.value = ta.value.slice(0, caretPos) + text + ta.value.slice(ta.selectionEnd);
|
||||||
ta.focus();
|
|
||||||
range = caretPos + text.length;
|
range = caretPos + text.length;
|
||||||
if ($.engine === 'presto') {
|
|
||||||
range += text.match(/\n/g).length;
|
|
||||||
}
|
|
||||||
ta.setSelectionRange(range, range);
|
ta.setSelectionRange(range, range);
|
||||||
|
ta.focus();
|
||||||
return $.event(ta, new Event('input'));
|
return $.event(ta, new Event('input'));
|
||||||
},
|
},
|
||||||
characterCount: function() {
|
characterCount: function() {
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
master
|
master
|
||||||
|
- Mayhem
|
||||||
|
Fix selection quoting on Opera.
|
||||||
|
|
||||||
2.37.0
|
2.37.0
|
||||||
- noface
|
- noface
|
||||||
|
|||||||
@ -1552,10 +1552,9 @@ QR =
|
|||||||
id = @previousSibling.hash[2..]
|
id = @previousSibling.hash[2..]
|
||||||
text = ">>#{id}\n"
|
text = ">>#{id}\n"
|
||||||
|
|
||||||
sel = window.getSelection()
|
sel = d.getSelection()
|
||||||
if (s = sel.toString().trim()) and id is $.x('ancestor-or-self::blockquote', sel.anchorNode)?.id.match(/\d+$/)[0]
|
if (s = sel.toString().trim()) 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
|
# XXX Opera doesn't retain `\n`s?
|
||||||
s = d.getSelection().trim() if $.engine is 'presto'
|
|
||||||
s = s.replace /\n/g, '\n>'
|
s = s.replace /\n/g, '\n>'
|
||||||
text += ">#{s}\n"
|
text += ">#{s}\n"
|
||||||
|
|
||||||
@ -1563,12 +1562,10 @@ QR =
|
|||||||
caretPos = ta.selectionStart
|
caretPos = ta.selectionStart
|
||||||
# Replace selection for text.
|
# Replace selection for text.
|
||||||
ta.value = ta.value[...caretPos] + text + ta.value[ta.selectionEnd..]
|
ta.value = ta.value[...caretPos] + text + ta.value[ta.selectionEnd..]
|
||||||
ta.focus()
|
|
||||||
# Move the caret to the end of the new quote.
|
# Move the caret to the end of the new quote.
|
||||||
range = caretPos + text.length
|
range = caretPos + text.length
|
||||||
# XXX Opera counts newlines as double
|
|
||||||
range += text.match(/\n/g).length if $.engine is 'presto'
|
|
||||||
ta.setSelectionRange range, range
|
ta.setSelectionRange range, range
|
||||||
|
ta.focus()
|
||||||
|
|
||||||
# Fire the 'input' event
|
# Fire the 'input' event
|
||||||
$.event ta, new Event 'input'
|
$.event ta, new Event 'input'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user