1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-29 09:44:28 +01:00

Merge pull request #126 from bui/quote-selection

quote selected text on cite
This commit is contained in:
Fredrick Brennan 2014-09-30 05:35:37 -04:00
commit 43923ec5a6
2 changed files with 10 additions and 1 deletions

View File

@ -214,6 +214,15 @@ function citeReply(id, with_link) {
textarea.value += '>>' + id + '\n';
}
if (typeof $ != 'undefined') {
var select = document.getSelection().toString();
if (select) {
var body = $('#reply_' + id + ', #op_' + 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();
}

View File

@ -5,7 +5,7 @@
{% if not index %}<a id="{{ post.id }}" class="post_anchor"></a>{% endif %}
{% include 'post/fileinfo.html' %}
<div class="post op" {%if post.num_files > 1%}style='clear:both'{%endif%}><p class="intro">
<div class="post op" id="op_{{ post.id }}" {%if post.num_files > 1%}style='clear:both'{%endif%}><p class="intro">
<input type="checkbox" class="delete" name="delete_{{ post.id }}" id="delete_{{ post.id }}" />
<label for="delete_{{ post.id }}">
{% include 'post/subject.html' %}