From 1b1fe5987719be906a5bfe87790e4c79f9cb68ca Mon Sep 17 00:00:00 2001 From: Kato Twofold Date: Tue, 7 Jun 2022 00:04:49 +0300 Subject: [PATCH] * Fixed preview not updating --- static/js/ws.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/static/js/ws.js b/static/js/ws.js index c920897..5f8675f 100644 --- a/static/js/ws.js +++ b/static/js/ws.js @@ -164,6 +164,8 @@ class PadSocket { this.sendMessage(`padUpdate`, { "content": padContents, }); + + updatePadContent(padContents, false); } } @@ -172,9 +174,9 @@ class PadSocket { * Update the contents of the pad * @param {String} newContent */ -function updatePadContent(newContent) { +function updatePadContent(newContent, textArea = true) { // Update the textarea - document.getElementById(`pad-content`).value = newContent; + if ( textArea ) document.getElementById(`pad-content`).value = newContent; // Update the preview document.getElementById(`textarea-preview`).innerHTML = newContent; // TODO: Re-run the syntax highlight