selection
This commit is contained in:
parent
a6693e9f3a
commit
a10cac59f7
@ -1392,14 +1392,23 @@
|
||||
return QR.submit();
|
||||
},
|
||||
quote: function(e) {
|
||||
var i, ss, ta, text, v;
|
||||
var i, id, qr, s, sel, ss, ta, text, v, _ref;
|
||||
e.preventDefault();
|
||||
text = ">>" + this.textContent + "\n";
|
||||
if (!QR.qr) {
|
||||
id = this.textContent;
|
||||
text = ">>" + id + "\n";
|
||||
sel = getSelection();
|
||||
if (id === ((_ref = $.x('preceding::input[@type="checkbox"][1]', sel.anchorNode)) != null ? _ref.name : void 0)) {
|
||||
if (s = sel.toString().replace(/\n/g, '\n>')) {
|
||||
text += ">" + s + "\n";
|
||||
}
|
||||
}
|
||||
qr = QR.qr;
|
||||
if (!qr) {
|
||||
QR.dialog(text);
|
||||
return;
|
||||
}
|
||||
ta = $('textarea', QR.qr);
|
||||
$('#autohide', qr).checked = false;
|
||||
ta = $('textarea', qr);
|
||||
v = ta.value;
|
||||
ss = ta.selectionStart;
|
||||
ta.value = v.slice(0, ss) + text + v.slice(ss);
|
||||
|
||||
@ -1096,11 +1096,18 @@ QR =
|
||||
QR.submit() #derpy, but prevents calling QR.hasContent twice
|
||||
quote: (e) ->
|
||||
e.preventDefault()
|
||||
text = ">>#{@textContent}\n"
|
||||
if not QR.qr
|
||||
id = @textContent
|
||||
text = ">>#{id}\n"
|
||||
sel = getSelection()
|
||||
if id == $.x('preceding::input[@type="checkbox"][1]', sel.anchorNode)?.name
|
||||
if s = sel.toString().replace /\n/g, '\n>'
|
||||
text += ">#{s}\n"
|
||||
{qr} = QR
|
||||
if not qr
|
||||
QR.dialog text
|
||||
return
|
||||
ta = $ 'textarea', QR.qr
|
||||
$('#autohide', qr).checked = false
|
||||
ta = $ 'textarea', qr
|
||||
v = ta.value
|
||||
ss = ta.selectionStart
|
||||
ta.value = v[0...ss] + text + v[ss..]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user