Clear the markdown live preview after posting a comment

Setting the textarea's .value programmatically does not fire an 'input' event,
so updatePreview() never ran and the preview kept showing the just-posted
comment's rendered markdown underneath an empty composer.

(This change was already present in the working tree at the start of the
session; committing it on its own rather than folding it into an unrelated fix.)
This commit is contained in:
2026-08-07 23:06:36 -04:00
parent 0a7201d754
commit 1de04d4908
+8
View File
@@ -285,6 +285,14 @@ function addComment() {
const nc = document.getElementById('newComment'); const nc = document.getElementById('newComment');
if (nc) nc.value = ''; if (nc) nc.value = '';
// Clear the live preview — clearing the textarea programmatically
// does not fire 'input', so updatePreview() never runs
const previewDiv = document.getElementById('markdownPreview');
if (previewDiv) {
previewDiv.innerHTML = '';
previewDiv.classList.add('is-hidden');
}
// Format the comment text for display // Format the comment text for display
let displayText; let displayText;
if (isMarkdownEnabled) { if (isMarkdownEnabled) {