LaravelTest
41 строка · 1.5 Кб
1// CodeMirror, copyright (c) by Marijn Haverbeke and others
2// Distributed under an MIT license: https://codemirror.net/LICENSE
3
4(function(mod) {5if (typeof exports == "object" && typeof module == "object") // CommonJS6mod(require("../../lib/codemirror"));7else if (typeof define == "function" && define.amd) // AMD8define(["../../lib/codemirror"], mod);9else // Plain browser env10mod(CodeMirror);11})(function(CodeMirror) {12"use strict";13
14CodeMirror.defineOption("fullScreen", false, function(cm, val, old) {15if (old == CodeMirror.Init) old = false;16if (!old == !val) return;17if (val) setFullscreen(cm);18else setNormal(cm);19});20
21function setFullscreen(cm) {22var wrap = cm.getWrapperElement();23cm.state.fullScreenRestore = {scrollTop: window.pageYOffset, scrollLeft: window.pageXOffset,24width: wrap.style.width, height: wrap.style.height};25wrap.style.width = "";26wrap.style.height = "auto";27wrap.className += " CodeMirror-fullscreen";28document.documentElement.style.overflow = "hidden";29cm.refresh();30}31
32function setNormal(cm) {33var wrap = cm.getWrapperElement();34wrap.className = wrap.className.replace(/\s*CodeMirror-fullscreen\b/, "");35document.documentElement.style.overflow = "";36var info = cm.state.fullScreenRestore;37wrap.style.width = info.width; wrap.style.height = info.height;38window.scrollTo(info.scrollLeft, info.scrollTop);39cm.refresh();40}41});42