From 5657109aa2a14b38c0510e6807fdd560544904fa Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Sun, 21 Mar 2021 16:37:16 +0100 Subject: [PATCH] Fix preview button on new article --- articles/static/live-preview.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/articles/static/live-preview.js b/articles/static/live-preview.js index f2e8c26..17c1cad 100644 --- a/articles/static/live-preview.js +++ b/articles/static/live-preview.js @@ -2,7 +2,9 @@ let preview = null; window.onload = function () { const previewButton = document.querySelector("input#_live_preview"); - previewButton.addEventListener("click", openPreviewPopup); + if (previewButton) { + previewButton.addEventListener("click", openPreviewPopup); + } }; window.onbeforeunload = function () { if (preview !== null) {