When quoting on the index, only change the target thread if the textarea is empty. Close #879

This commit is contained in:
Nicolas Stepien 2013-01-03 15:34:15 +01:00
parent 0477eb595c
commit c720b90a86
2 changed files with 4 additions and 4 deletions

View File

@ -1993,7 +1993,8 @@
e.preventDefault();
}
QR.open();
if (!g.REPLY) {
ta = $('textarea', QR.el);
if (!(g.REPLY || ta.value)) {
QR.threadSelector.value = $.x('ancestor::div[parent::div[@class="board"]]', this).id.slice(1);
}
id = this.previousSibling.hash.slice(2);
@ -2003,7 +2004,6 @@
s = s.replace(/\n/g, '\n>');
text += ">" + s + "\n";
}
ta = $('textarea', QR.el);
caretPos = ta.selectionStart;
ta.value = ta.value.slice(0, caretPos) + text + ta.value.slice(ta.selectionEnd);
range = caretPos + text.length;

View File

@ -1550,7 +1550,8 @@ QR =
quote: (e) ->
e?.preventDefault()
QR.open()
unless g.REPLY
ta = $ 'textarea', QR.el
unless g.REPLY or ta.value
QR.threadSelector.value = $.x('ancestor::div[parent::div[@class="board"]]', @).id[1..]
# Make sure we get the correct number, even with XXX censors
id = @previousSibling.hash[2..]
@ -1562,7 +1563,6 @@ QR =
s = s.replace /\n/g, '\n>'
text += ">#{s}\n"
ta = $ 'textarea', QR.el
caretPos = ta.selectionStart
# Replace selection for text.
ta.value = ta.value[...caretPos] + text + ta.value[ta.selectionEnd..]