From f4f246b38ebc85a68f59bde43b3640d8bc50cec9 Mon Sep 17 00:00:00 2001 From: Deimos Date: Tue, 30 Apr 2019 20:26:46 -0600 Subject: [PATCH] Clear markdown preview when toggling back to Edit This fixes the issue with previewing empty markdown (though maybe we should really prevent that), as well as making sure they don't get a misleading obsolete preview if they lose internet or something similar. --- tildes/static/js/behaviors/markdown-edit-tab.js | 1 + 1 file changed, 1 insertion(+) diff --git a/tildes/static/js/behaviors/markdown-edit-tab.js b/tildes/static/js/behaviors/markdown-edit-tab.js index 02cd5b0..dcf26b6 100644 --- a/tildes/static/js/behaviors/markdown-edit-tab.js +++ b/tildes/static/js/behaviors/markdown-edit-tab.js @@ -8,5 +8,6 @@ $.onmount('[data-js-markdown-edit-tab]', function() { $editTextarea.removeClass('d-none'); $previewDiv.addClass('d-none'); + $previewDiv.empty(); }); });