Add a callback to toggle full screen

When dealing webiste with headers.
It could be tricky to hide the headers when simpleMDE is full screen.
Adding a callback will largely simplify the case
This commit is contained in:
Junchao Wang 2017-07-31 14:18:14 +10:00 committed by GitHub
parent 6abda7ab68
commit 2db7b11222

View File

@ -224,6 +224,9 @@ function toggleFullScreen(editor) {
var sidebyside = cm.getWrapperElement().nextSibling; var sidebyside = cm.getWrapperElement().nextSibling;
if(/editor-preview-active-side/.test(sidebyside.className)) if(/editor-preview-active-side/.test(sidebyside.className))
toggleSideBySide(editor); toggleSideBySide(editor);
// Add toggle fullscreen callback
if ('fullScreenCallback' in editor.options)
editor.options.fullScreenCallback(cm.getOption("fullScreen"));
} }
@ -2025,4 +2028,4 @@ SimpleMDE.prototype.toTextArea = function() {
} }
}; };
module.exports = SimpleMDE; module.exports = SimpleMDE;