5
if (typeof exports == "object" && typeof module == "object")
6
mod(require("../../lib/codemirror"));
7
else if (typeof define == "function" && define.amd)
8
define(["../../lib/codemirror"], mod);
11
})(function(CodeMirror) {
14
CodeMirror.defineOption("fullScreen", false, function(cm, val, old) {
15
if (old == CodeMirror.Init) old = false;
16
if (!old == !val) return;
17
if (val) setFullscreen(cm);
21
function setFullscreen(cm) {
22
var wrap = cm.getWrapperElement();
23
cm.state.fullScreenRestore = {scrollTop: window.pageYOffset, scrollLeft: window.pageXOffset,
24
width: wrap.style.width, height: wrap.style.height};
25
wrap.style.width = "";
26
wrap.style.height = "auto";
27
wrap.className += " CodeMirror-fullscreen";
28
document.documentElement.style.overflow = "hidden";
32
function setNormal(cm) {
33
var wrap = cm.getWrapperElement();
34
wrap.className = wrap.className.replace(/\s*CodeMirror-fullscreen\b/, "");
35
document.documentElement.style.overflow = "";
36
var info = cm.state.fullScreenRestore;
37
wrap.style.width = info.width; wrap.style.height = info.height;
38
window.scrollTo(info.scrollLeft, info.scrollTop);