Browse Source

Improve citing in replies

main
discomrade 3 years ago
parent
commit
39d2ad5212
  1. 9
      templates/main.js

9
templates/main.js

@ -292,11 +292,10 @@ function citeReply(id, with_link) {
if (typeof $ != 'undefined') { if (typeof $ != 'undefined') {
var select = document.getSelection().toString(); var select = document.getSelection().toString();
if (select) { if (select) {
var body = $('#reply_' + id + ', #op_' + id).find('div.body'); // TODO: support for OPs var body = $('#reply_' + id + ', #op_' + id).find('div.body');
var index = body.text().indexOf(select.replace('\n', '')); // for some reason this only works like this // quote each line in the selection
if (index > -1) { select = select.replace(/\n(.)/g, '\n>$1');
textarea.value += '>' + select + '\n'; textarea.value += '>' + select + '\n';
}
} }
$(window).trigger('cite', [id, with_link]); $(window).trigger('cite', [id, with_link]);

Loading…
Cancel
Save