mirror of
https://github.com/Ionaru/easy-markdown-editor
synced 2025-07-02 23:54:28 -06:00
Improve fullscreen, fix responsiveness
This commit is contained in:
parent
10ee1e70b5
commit
ebabe1c48b
@ -59,7 +59,10 @@
|
|||||||
|
|
||||||
.editor-toolbar.fullscreen {
|
.editor-toolbar.fullscreen {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-height: 50px;
|
height: 50px;
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border: 0;
|
border: 0;
|
||||||
position: fixed;
|
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) {
|
(function(mod) {
|
||||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||||
@ -27,7 +26,6 @@
|
|||||||
wrap.style.height = "auto";
|
wrap.style.height = "auto";
|
||||||
wrap.className += " CodeMirror-fullscreen";
|
wrap.className += " CodeMirror-fullscreen";
|
||||||
document.documentElement.style.overflow = "hidden";
|
document.documentElement.style.overflow = "hidden";
|
||||||
wrap.previousSibling.className += " fullscreen";
|
|
||||||
cm.refresh();
|
cm.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,7 +36,6 @@
|
|||||||
var info = cm.state.fullScreenRestore;
|
var info = cm.state.fullScreenRestore;
|
||||||
wrap.style.width = info.width; wrap.style.height = info.height;
|
wrap.style.width = info.width; wrap.style.height = info.height;
|
||||||
window.scrollTo(info.scrollLeft, info.scrollTop);
|
window.scrollTo(info.scrollLeft, info.scrollTop);
|
||||||
wrap.previousSibling.className = wrap.previousSibling.className.replace(/\s*fullscreen\b/, "");
|
|
||||||
cm.refresh();
|
cm.refresh();
|
||||||
}
|
}
|
||||||
});
|
});
|
@ -96,9 +96,22 @@ function getState(cm, pos) {
|
|||||||
* Toggle full screen of the editor.
|
* Toggle full screen of the editor.
|
||||||
*/
|
*/
|
||||||
function toggleFullScreen(editor) {
|
function toggleFullScreen(editor) {
|
||||||
|
// Set fullscreen
|
||||||
var cm = editor.codemirror;
|
var cm = editor.codemirror;
|
||||||
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
|
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;
|
var toolbarButton = editor.toolbarElements.fullscreen;
|
||||||
|
|
||||||
if(!/active/.test(toolbarButton.className)) {
|
if(!/active/.test(toolbarButton.className)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user