From a1ea852e5476279e7132972cd52304d69a8f7d64 Mon Sep 17 00:00:00 2001 From: Alexandre Capt Date: Thu, 15 Feb 2024 10:09:14 +0100 Subject: [PATCH] fix: handle nothing to preview case --- js/import/import.ui.js | 163 ++++++++++++++++++++++------------------- 1 file changed, 88 insertions(+), 75 deletions(-) diff --git a/js/import/import.ui.js b/js/import/import.ui.js index 3f0275df..565b201a 100644 --- a/js/import/import.ui.js +++ b/js/import/import.ui.js @@ -73,98 +73,111 @@ const setupUI = () => { }; const loadResult = ({ md, html: outputHTML }) => { - ui.transformedEditor.setValue(html_beautify(outputHTML.replaceAll(/\s+/g, ' '), { - indent_size: '2', - })); - ui.markdownEditor.setValue(md || ''); + if (outputHTML) { + ui.transformedEditor.setValue(html_beautify(outputHTML.replaceAll(/\s+/g, ' '), { + indent_size: '2', + })); + } - const mdPreview = WebImporter.md2html(md); - // XSS review: we need interpreted HTML here -