diff --git a/files/assets/js/comments_v.js b/files/assets/js/comments_v.js index 563902de6..8b0e6665b 100644 --- a/files/assets/js/comments_v.js +++ b/files/assets/js/comments_v.js @@ -82,16 +82,20 @@ function toggleReplyBox(t, id) { } function toggleEdit(id){ - comment = document.getElementById("comment-text-"+id); - form = document.getElementById("comment-edit-"+id); - box = document.getElementById('comment-edit-body-'+id); - actions = document.getElementById('comment-' + id +'-actions'); + const comment = document.getElementById("comment-text-"+id); + const form = document.getElementById("comment-edit-"+id); + const box = document.getElementById('comment-edit-body-'+id); + const actions = document.getElementById('comment-' + id +'-actions'); comment.classList.toggle("d-none"); form.classList.toggle("d-none"); actions.classList.toggle("d-none"); - autoExpand(box); - markdown(box); + + if (comment.classList.contains('d-none')) { + autoExpand(box); + markdown(box); + charLimit(box.id, 'charcount-edit-' + id) + } close_inline_speed_emoji_modal(); }; diff --git a/files/assets/js/edit_post.js b/files/assets/js/edit_post.js index 7423de010..da1c0e301 100644 --- a/files/assets/js/edit_post.js +++ b/files/assets/js/edit_post.js @@ -7,11 +7,15 @@ function togglePostEdit(id) { title.classList.toggle("d-none"); form.classList.toggle("d-none"); - box = document.getElementById("post-edit-box-"+id); - autoExpand(box); - markdown(box); - box = document.getElementById("post-edit-title"); - autoExpand(box); + if (body.classList.contains('d-none')) { + let box = document.getElementById("post-edit-box-"+id); + autoExpand(box); + markdown(box); + charLimit(box.id, 'charcount-post-edit') + + box = document.getElementById("post-edit-title"); + autoExpand(box); + } close_inline_speed_emoji_modal(); };