From 18f8256a4a164bbd0d0a28c764c063eadd3e1370 Mon Sep 17 00:00:00 2001 From: Luca Zeug Date: Wed, 22 Feb 2017 20:37:52 +0100 Subject: [PATCH] Fix toggleFullscreen() if icon is hidden --- src/js/simplemde.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/js/simplemde.js b/src/js/simplemde.js index 3565d9d..8bb2889 100644 --- a/src/js/simplemde.js +++ b/src/js/simplemde.js @@ -211,12 +211,14 @@ function toggleFullScreen(editor) { // Update toolbar button - var toolbarButton = editor.toolbarElements.fullscreen; + if (editor.toolbarElements.fullscreen) { + var toolbarButton = editor.toolbarElements.fullscreen; - if(!/active/.test(toolbarButton.className)) { - toolbarButton.className += " active"; - } else { - toolbarButton.className = toolbarButton.className.replace(/\s*active\s*/g, ""); + if(!/active/.test(toolbarButton.className)) { + toolbarButton.className += " active"; + } else { + toolbarButton.className = toolbarButton.className.replace(/\s*active\s*/g, ""); + } }