From eaa8ccaccb1091820d0a8d1223996a6dd057347d Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Sun, 17 Jan 2016 14:28:04 -0600 Subject: Upgrade CodeMirror to 5.10.1 and now support fullscreen, jump-to-line in editor --- .../vendor/codemirror/addon/display/autorefresh.js | 47 ++++++++++++++++++++++ .../vendor/codemirror/addon/display/fullscreen.css | 2 +- .../vendor/codemirror/addon/display/fullscreen.js | 0 public/vendor/codemirror/addon/display/panel.js | 0 .../vendor/codemirror/addon/display/placeholder.js | 4 +- public/vendor/codemirror/addon/display/rulers.js | 0 6 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 public/vendor/codemirror/addon/display/autorefresh.js mode change 100755 => 100644 public/vendor/codemirror/addon/display/fullscreen.css mode change 100755 => 100644 public/vendor/codemirror/addon/display/fullscreen.js mode change 100755 => 100644 public/vendor/codemirror/addon/display/panel.js mode change 100755 => 100644 public/vendor/codemirror/addon/display/placeholder.js mode change 100755 => 100644 public/vendor/codemirror/addon/display/rulers.js (limited to 'public/vendor/codemirror/addon/display') diff --git a/public/vendor/codemirror/addon/display/autorefresh.js b/public/vendor/codemirror/addon/display/autorefresh.js new file mode 100644 index 00000000..1e0e8504 --- /dev/null +++ b/public/vendor/codemirror/addon/display/autorefresh.js @@ -0,0 +1,47 @@ +// 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 + 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("autoRefresh", false, function(cm, val) { + if (cm.state.autoRefresh) { + stopListening(cm, cm.state.autoRefresh) + cm.state.autoRefresh = null + } + if (val && cm.display.wrapper.offsetHeight == 0) + startListening(cm, cm.state.autoRefresh = {delay: val.delay || 250}) + }) + + function startListening(cm, state) { + function check() { + if (cm.display.wrapper.offsetHeight) { + stopListening(cm, state) + if (cm.display.lastWrapHeight != cm.display.wrapper.clientHeight) + cm.refresh() + } else { + state.timeout = setTimeout(check, state.delay) + } + } + state.timeout = setTimeout(check, state.delay) + state.hurry = function() { + clearTimeout(state.timeout) + state.timeout = setTimeout(check, 50) + } + CodeMirror.on(window, "mouseup", state.hurry) + CodeMirror.on(window, "keyup", state.hurry) + } + + function stopListening(_cm, state) { + clearTimeout(state.timeout) + CodeMirror.off(window, "mouseup", state.hurry) + CodeMirror.off(window, "keyup", state.hurry) + } +}); diff --git a/public/vendor/codemirror/addon/display/fullscreen.css b/public/vendor/codemirror/addon/display/fullscreen.css old mode 100755 new mode 100644 index 437acd89..e258ad66 --- a/public/vendor/codemirror/addon/display/fullscreen.css +++ b/public/vendor/codemirror/addon/display/fullscreen.css @@ -2,5 +2,5 @@ position: fixed; top: 0; left: 0; right: 0; bottom: 0; height: auto; - z-index: 9; + z-index: 2000; } diff --git a/public/vendor/codemirror/addon/display/fullscreen.js b/public/vendor/codemirror/addon/display/fullscreen.js old mode 100755 new mode 100644 diff --git a/public/vendor/codemirror/addon/display/panel.js b/public/vendor/codemirror/addon/display/panel.js old mode 100755 new mode 100644 diff --git a/public/vendor/codemirror/addon/display/placeholder.js b/public/vendor/codemirror/addon/display/placeholder.js old mode 100755 new mode 100644 index bb0c3931..babddfb1 --- a/public/vendor/codemirror/addon/display/placeholder.js +++ b/public/vendor/codemirror/addon/display/placeholder.js @@ -37,7 +37,9 @@ var elt = cm.state.placeholder = document.createElement("pre"); elt.style.cssText = "height: 0; overflow: visible"; elt.className = "CodeMirror-placeholder"; - elt.appendChild(document.createTextNode(cm.getOption("placeholder"))); + var placeHolder = cm.getOption("placeholder") + if (typeof placeHolder == "string") placeHolder = document.createTextNode(placeHolder) + elt.appendChild(placeHolder) cm.display.lineSpace.insertBefore(elt, cm.display.lineSpace.firstChild); } diff --git a/public/vendor/codemirror/addon/display/rulers.js b/public/vendor/codemirror/addon/display/rulers.js old mode 100755 new mode 100644 -- cgit v1.2.3