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:
+9
-1
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user