diff --git a/files/assets/js/emoji_modal.js b/files/assets/js/emoji_modal.js index 5e713c285..54752ac8f 100644 --- a/files/assets/js/emoji_modal.js +++ b/files/assets/js/emoji_modal.js @@ -447,6 +447,7 @@ function emojiAddToInput(event) emoji_option.onclick = (e) => { speed_carot_modal.style.display = "none"; textbox.value = textbox.value.replace(new RegExp(current_word+"(?=\\s|$)", "g"), `:${result}:`) + markdown(textbox) }; // Pack emoji_option.appendChild(emoji_option_img); diff --git a/files/assets/js/marked.js b/files/assets/js/marked.js index 20dc868d5..48f96df39 100644 --- a/files/assets/js/marked.js +++ b/files/assets/js/marked.js @@ -31,8 +31,8 @@ marked.use({ const reDisableBeforeUnload = /^\/submit|^\/h\/[a-zA-Z0-9_\-]{3,20}\/submit/; -function markdown(first, second, dialog) { - let input = document.getElementById(first).value; +function markdown(t) { + let input = t.value; if (!reDisableBeforeUnload.test(location.pathname)) { @@ -96,7 +96,8 @@ function markdown(first, second, dialog) { input = marked(input) input = input.replace(/\n\n/g, '
') - document.getElementById(second).innerHTML = input + + document.getElementById(t.dataset.preview).innerHTML = input } function charLimit(form, text) { diff --git a/files/templates/comments.html b/files/templates/comments.html index 93773338f..dc931c975 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -309,7 +309,7 @@