quote selected text on cite
This commit is contained in:
parent
2ece97d685
commit
1edaea309b
@ -208,6 +208,15 @@ function citeReply(id, with_link) {
|
|||||||
textarea.value += '>>' + id + '\n';
|
textarea.value += '>>' + id + '\n';
|
||||||
}
|
}
|
||||||
if (typeof $ != 'undefined') {
|
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]);
|
$(window).trigger('cite', [id, with_link]);
|
||||||
$(textarea).change();
|
$(textarea).change();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user