fix reply and quote btns

This commit is contained in:
Luna D 2021-10-01 16:03:42 +02:00
parent 46802d3061
commit 6dc5bbe7ac
No known key found for this signature in database
GPG key ID: 81AF416F2CC36FC8

View file

@ -17,14 +17,14 @@ function handleError(response) {
} }
function commentReply(user, url, textarea, quote) { function commentReply(user, url, textarea, quote) {
const text = `"@${user}":${url}`; const text = `[${user}](${url})`;
let newval = textarea.value; let newval = textarea.value;
if (newval && /\n$/.test(newval)) newval += '\n'; if (newval && /\n$/.test(newval)) newval += '\n';
newval += `${text}\n`; newval += `${text}\n`;
if (quote) { if (quote) {
newval += `[bq="${user.replace('"', '\'')}"] ${quote} [/bq]\n`; newval += `> ${quote.replaceAll('\n', '\n> ')}\n\n`;
} }
textarea.value = newval; textarea.value = newval;