diff --git a/files/assets/js/comments_v.js b/files/assets/js/comments_v.js index 5f5ba40749..086c496450 100644 --- a/files/assets/js/comments_v.js +++ b/files/assets/js/comments_v.js @@ -62,18 +62,22 @@ function getSelectionTextHtml() { return html; } -function openReplyBox(id) { +function ToggleReplyBox(id) { const element = document.getElementById(id); const textarea = element.getElementsByTagName('textarea')[0] - let text = getSelection().toString().trim() - if (text) + element.classList.toggle('d-none') + + if (!element.classList.contains('d-none')) { - textarea.value = '> ' + text - textarea.value = textarea.value.replace(/\n/g,"\n> ").replace(/\*/g,"\\*") - if (!textarea.value.endsWith('\n')) textarea.value += '\n' + let text = getSelection().toString().trim() + if (text) + { + textarea.value = '> ' + text + textarea.value = textarea.value.replace(/\n/g,"\n> ").replace(/\*/g,"\\*") + if (!textarea.value.endsWith('\n')) textarea.value += '\n' + } + textarea.focus() } - element.classList.remove('d-none') - textarea.focus() } function toggleEdit(id){ diff --git a/files/templates/comments.html b/files/templates/comments.html index 3dd4b1861f..13166cabe4 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -352,7 +352,7 @@ {% if v %} - + {% endif %}
  • @@ -449,7 +449,7 @@ {% if v %} - + @@ -611,7 +611,7 @@ {% endif %} {% if request.path.startswith('/notifications') and c.level == 1 and c.sentto and not c.parent_submission and c.author_id != AUTOJANNY_ID %} - Reply + Reply