From 1de04d49088f367b48f8549d8022a94048987acf Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Fri, 7 Aug 2026 23:06:36 -0400 Subject: [PATCH] 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.) --- assets/js/ticket.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/assets/js/ticket.js b/assets/js/ticket.js index 09155a0..aa4a6ea 100644 --- a/assets/js/ticket.js +++ b/assets/js/ticket.js @@ -284,7 +284,15 @@ function addComment() { // Clear the comment box const nc = document.getElementById('newComment'); 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 let displayText; if (isMarkdownEnabled) {