mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-06-04 16:54:11 -04:00
Upgrade CodeMirror to 5.10.1 and now support fullscreen, jump-to-line in editor
This commit is contained in:
parent
ce65e58096
commit
eaa8ccaccb
381 changed files with 6726 additions and 2636 deletions
47
public/vendor/codemirror/addon/display/autorefresh.js
vendored
Normal file
47
public/vendor/codemirror/addon/display/autorefresh.js
vendored
Normal file
|
@ -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)
|
||||
}
|
||||
});
|
2
public/vendor/codemirror/addon/display/fullscreen.css
vendored
Executable file → Normal file
2
public/vendor/codemirror/addon/display/fullscreen.css
vendored
Executable file → Normal file
|
@ -2,5 +2,5 @@
|
|||
position: fixed;
|
||||
top: 0; left: 0; right: 0; bottom: 0;
|
||||
height: auto;
|
||||
z-index: 9;
|
||||
z-index: 2000;
|
||||
}
|
||||
|
|
0
public/vendor/codemirror/addon/display/fullscreen.js
vendored
Executable file → Normal file
0
public/vendor/codemirror/addon/display/fullscreen.js
vendored
Executable file → Normal file
0
public/vendor/codemirror/addon/display/panel.js
vendored
Executable file → Normal file
0
public/vendor/codemirror/addon/display/panel.js
vendored
Executable file → Normal file
4
public/vendor/codemirror/addon/display/placeholder.js
vendored
Executable file → Normal file
4
public/vendor/codemirror/addon/display/placeholder.js
vendored
Executable file → Normal file
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
0
public/vendor/codemirror/addon/display/rulers.js
vendored
Executable file → Normal file
0
public/vendor/codemirror/addon/display/rulers.js
vendored
Executable file → Normal file
Loading…
Add table
Add a link
Reference in a new issue