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