Browse Source

quote selected text on cite

pull/40/head
Bui 10 years ago
committed by czaks
parent
commit
1edaea309b
  1. 9
      templates/main.js

9
templates/main.js

@ -208,6 +208,15 @@ function citeReply(id, with_link) {
textarea.value += '>>' + id + '\n';
}
if (typeof $ != 'undefined') {
var select = document.getSelection().toString();
if (select) {
var body = $('#reply_' + id).find('div.body'); // TODO: support for OPs
var index = body.text().indexOf(select.replace('\n', '')); // for some reason this only works like this
if (index > -1) {
textarea.value += '>' + select + '\n';
}
}
$(window).trigger('cite', [id, with_link]);
$(textarea).change();
}

Loading…
Cancel
Save