From f563d6b93294485ad5629dfa9c439d0d96aa4cf6 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 11 Aug 2022 13:39:38 +0200 Subject: [PATCH] fix https://rdrama.org/post/18459/marseycapywalking-megathread-for-bugs-and-suggestions/2402363?context=8#context --- files/assets/js/emoji_modal.js | 1 + files/assets/js/marked.js | 7 ++++--- files/templates/comments.html | 6 +++--- files/templates/submission.html | 4 ++-- files/templates/userpage.html | 4 ++-- files/templates/util/assetcache.html | 4 ++-- 6 files changed, 14 insertions(+), 12 deletions(-) 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 @@