From a573f91fcd09ebc523fdb0b32cd69fb02056c5e8 Mon Sep 17 00:00:00 2001 From: stuzer05 Date: Fri, 30 Dec 2022 13:23:24 +0200 Subject: [PATCH] Commit --- assets/js/scripts.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/assets/js/scripts.js b/assets/js/scripts.js index ff0fa2f..d201928 100644 --- a/assets/js/scripts.js +++ b/assets/js/scripts.js @@ -668,13 +668,17 @@ require(['vs/editor/editor.main'], function () { // On preview let el_btn_preview = document.querySelector('#wpPreview'); - el_btn_preview.addEventListener('click', event => { - el_stock_editor.value = window.monaco_editor.getValue(); - }); + if (el_btn_preview) { + el_btn_preview.addEventListener('click', event => { + el_stock_editor.value = window.monaco_editor.getValue(); + }); + } // On save let el_btn_save = document.querySelector('#wpSave'); - el_btn_save.addEventListener('click', event => { - el_stock_editor.value = window.monaco_editor.getValue(); - }); + if (el_btn_save) { + el_btn_save.addEventListener('click', event => { + el_stock_editor.value = window.monaco_editor.getValue(); + }); + } });