From 4d0e89f9d41ee42f62ffb94f6049c484a6eb1d36 Mon Sep 17 00:00:00 2001 From: discomrade Date: Tue, 28 Sep 2021 03:11:24 +0000 Subject: [PATCH] Improve citing in replies --- templates/main.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/templates/main.js b/templates/main.js index 024b748e..dc858dc7 100755 --- a/templates/main.js +++ b/templates/main.js @@ -322,10 +322,13 @@ function citeReply(id, with_link) { 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) { + // commenting out this condition, not sure of the purpose and gets in the way of citing +// var index = body.text().indexOf(select.replace('\n', '')); // for some reason this only works like this +// if (index > -1) { + // quote each line in the selection + select = select.replace(/\n(.)/g, '\n>$1'); textarea.value += '>' + select + '\n'; - } +// } } $(window).trigger('cite', [id, with_link]);