Sha256: 1e1286d3a21bfb167a458be605aa7cb34a2cf8211758f02b3827ade1568c13a4

Contents?: true

Size: 1.46 KB

Versions: 25

Compression:

Stored size: 1.46 KB

Contents

// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE

(function(mod) {
  if (typeof exports == "object" && typeof module == "object") // CommonJS
    mod(require("../../lib/codemirror"));
  else if (typeof define == "function" && define.amd) // AMD
    define(["../../lib/codemirror"], mod);
  else // Plain browser env
    mod(CodeMirror);
})(function(CodeMirror) {
  "use strict";

  CodeMirror.defineOption("fullScreen", false, function(cm, val, old) {
    if (old == CodeMirror.Init) old = false;
    if (!old == !val) return;
    if (val) setFullscreen(cm);
    else setNormal(cm);
  });

  function setFullscreen(cm) {
    var wrap = cm.getWrapperElement();
    cm.state.fullScreenRestore = {scrollTop: window.pageYOffset, scrollLeft: window.pageXOffset,
                                  width: wrap.style.width, height: wrap.style.height};
    wrap.style.width = "";
    wrap.style.height = "auto";
    wrap.className += " CodeMirror-fullscreen";
    document.documentElement.style.overflow = "hidden";
    cm.refresh();
  }

  function setNormal(cm) {
    var wrap = cm.getWrapperElement();
    wrap.className = wrap.className.replace(/\s*CodeMirror-fullscreen\b/, "");
    document.documentElement.style.overflow = "";
    var info = cm.state.fullScreenRestore;
    wrap.style.width = info.width; wrap.style.height = info.height;
    window.scrollTo(info.scrollLeft, info.scrollTop);
    cm.refresh();
  }
});

Version data entries

25 entries across 25 versions & 3 rubygems

Version Path
rails_db-2.4.5 app/assets/javascripts/codemirror/codemirror/addons/display/fullscreen.js
rails_db-2.4.4 app/assets/javascripts/codemirror/codemirror/addons/display/fullscreen.js
rails_db-2.4.3 app/assets/javascripts/codemirror/codemirror/addons/display/fullscreen.js
wallaby-7.0.0.beta2 vendor/assets/javascripts/codemirror/5.49.2/addon/display/fullscreen.js
wallaby-7.0.0.beta1 vendor/assets/javascripts/codemirror/5.49.2/addon/display/fullscreen.js
wallaby-6.1.6 vendor/assets/javascripts/codemirror/5.49.2/addon/display/fullscreen.js
rails_db-2.4.2 app/assets/javascripts/codemirror/codemirror/addons/display/fullscreen.js
wallaby-6.1.5 vendor/assets/javascripts/codemirror/5.49.2/addon/display/fullscreen.js
wallaby-6.1.4 vendor/assets/javascripts/codemirror/5.49.2/addon/display/fullscreen.js
rails_db-2.4.1 app/assets/javascripts/codemirror/codemirror/addons/display/fullscreen.js
rails_db-2.4.0 app/assets/javascripts/codemirror/codemirror/addons/display/fullscreen.js
wallaby-6.1.3 vendor/assets/javascripts/codemirror/5.49.2/addon/display/fullscreen.js
wallaby-6.1.2 vendor/assets/javascripts/codemirror/5.49.2/addon/display/fullscreen.js
wallaby-6.1.1 vendor/assets/javascripts/codemirror/5.49.2/addon/display/fullscreen.js
wallaby-6.1.0 vendor/assets/javascripts/codemirror/5.49.2/addon/display/fullscreen.js
rails_db-2.3.1 app/assets/javascripts/codemirror/codemirror/addons/display/fullscreen.js
rails_db-2.3.0 app/assets/javascripts/codemirror/codemirror/addons/display/fullscreen.js
wallaby-6.0.2 vendor/assets/javascripts/codemirror/5.49.2/addon/display/fullscreen.js
wallaby-6.0.1 vendor/assets/javascripts/codemirror/5.49.2/addon/display/fullscreen.js
rails_db-2.2.1 app/assets/javascripts/codemirror/codemirror/addons/display/fullscreen.js