Fix bug in markdown preview of new objects
authorMagnus Hagander <magnus@hagander.net>
Tue, 16 Mar 2021 17:19:53 +0000 (18:19 +0100)
committerMagnus Hagander <magnus@hagander.net>
Tue, 16 Mar 2021 17:27:01 +0000 (18:27 +0100)
Whens submitting a new object, the instructions for how to do markdown
didn't show up until after the object had been saved once.

This turns out to be because the performance optimization to take an
empty string markdown and turn it into an empty string html wrote the
(empty) result to the wrong field, thereby overwriting the instructions.

media/js/markdown_preview.js

index fdf9bdd6119a11c31ffb626a05e3b2475d4cd7de..5546e26570f94b2a6b9e619ed958a82dbf3175d2 100644 (file)
@@ -67,7 +67,7 @@ function update_markdown(obj) {
 function _do_update_markdown(obj) {
     if (obj.value == '') {
         /* Short-circuit the empty field case */
-        obj.infospan.innerHTML = '';
+        obj.preview_div.innerHTML = '';
         return;
     }