Fix quoting text selection when a quote is inlined. close #268

This commit is contained in:
Nicolas Stepien 2011-09-28 14:18:13 +02:00
parent 579b425cae
commit 66648b0f17
2 changed files with 5 additions and 3 deletions

View File

@ -1628,7 +1628,7 @@
return QR.submit(); return QR.submit();
}, },
quote: function(e, blank) { quote: function(e, blank) {
var i, id, qr, s, sel, ss, ta, text, tid, v, _base, _ref, _ref2; var bq, i, id, qr, s, sel, ss, ta, text, tid, v, _base, _ref;
if (e != null) { if (e != null) {
e.preventDefault(); e.preventDefault();
} }
@ -1636,7 +1636,8 @@
id = this.textContent; id = this.textContent;
text = ">>" + id + "\n"; text = ">>" + id + "\n";
sel = getSelection(); sel = getSelection();
if (id === ((_ref2 = $.x('preceding::input[@type="checkbox"][1]', sel.anchorNode)) != null ? _ref2.name : void 0)) { bq = $.x('ancestor::blockquote', sel.anchorNode);
if (id === $.x('preceding-sibling::input', bq).name) {
if (s = sel.toString().replace(/\n/g, '\n>')) { if (s = sel.toString().replace(/\n/g, '\n>')) {
text += ">" + s + "\n"; text += ">" + s + "\n";
} }

View File

@ -1215,7 +1215,8 @@ QR =
id = @textContent id = @textContent
text = ">>#{id}\n" text = ">>#{id}\n"
sel = getSelection() sel = getSelection()
if id == $.x('preceding::input[@type="checkbox"][1]', sel.anchorNode)?.name bq = $.x('ancestor::blockquote', sel.anchorNode)
if id == $.x('preceding-sibling::input', bq).name
if s = sel.toString().replace /\n/g, '\n>' if s = sel.toString().replace /\n/g, '\n>'
text += ">#{s}\n" text += ">#{s}\n"
{qr} = QR {qr} = QR