mirror of
https://github.com/sparksuite/simplemde-markdown-editor.git
synced 2024-06-17 05:05:11 +02:00
Improve fullscreen, fix responsiveness
This commit is contained in:
parent
10ee1e70b5
commit
ebabe1c48b
|
@ -59,7 +59,10 @@
|
|||
|
||||
.editor-toolbar.fullscreen {
|
||||
width: 100%;
|
||||
min-height: 50px;
|
||||
height: 50px;
|
||||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
white-space: nowrap;
|
||||
background: #fff;
|
||||
border: 0;
|
||||
position: fixed;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// NOTE: This has been modified from the original version to add fullscreen class to the status bar too
|
||||
|
||||
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
(function(mod) {
|
||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||
|
@ -27,7 +26,6 @@
|
|||
wrap.style.height = "auto";
|
||||
wrap.className += " CodeMirror-fullscreen";
|
||||
document.documentElement.style.overflow = "hidden";
|
||||
wrap.previousSibling.className += " fullscreen";
|
||||
cm.refresh();
|
||||
}
|
||||
|
||||
|
@ -38,7 +36,6 @@
|
|||
var info = cm.state.fullScreenRestore;
|
||||
wrap.style.width = info.width; wrap.style.height = info.height;
|
||||
window.scrollTo(info.scrollLeft, info.scrollTop);
|
||||
wrap.previousSibling.className = wrap.previousSibling.className.replace(/\s*fullscreen\b/, "");
|
||||
cm.refresh();
|
||||
}
|
||||
});
|
|
@ -96,9 +96,22 @@ function getState(cm, pos) {
|
|||
* Toggle full screen of the editor.
|
||||
*/
|
||||
function toggleFullScreen(editor) {
|
||||
// Set fullscreen
|
||||
var cm = editor.codemirror;
|
||||
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
|
||||
|
||||
|
||||
// Update toolbar class
|
||||
var wrap = cm.getWrapperElement();
|
||||
|
||||
if(!/fullscreen/.test(wrap.previousSibling.className)) {
|
||||
wrap.previousSibling.className += " fullscreen";
|
||||
} else {
|
||||
wrap.previousSibling.className = wrap.previousSibling.className.replace(/\s*fullscreen\b/, "");
|
||||
}
|
||||
|
||||
|
||||
// Update toolbar button
|
||||
var toolbarButton = editor.toolbarElements.fullscreen;
|
||||
|
||||
if(!/active/.test(toolbarButton.className)) {
|
||||
|
|
Loading…
Reference in a new issue