- gitlist.git
- public
- js
- code-mirror.js
This file ( 1kB ) exceeds the allowed full mode (48 kb) size.
The editor full hight is disabled, only scrolling is allowed..
If you wish to edit a file, it is recommended to use the scroll mode as some users do not like the full height
mode, although some users like it.
document.addEventListener("DOMContentLoaded", function(event) {
function setCodeMirrorTheme(theme) {
if (gitlist.viewer === undefined) {
return;
}
const actualTheme = theme.split('-')[1]
if (window.gitlist.isDark(actualTheme)) {
gitlist.viewer.setOption("theme", 'blackboard');
} else {
gitlist.viewer.setOption("theme", 'default');
}
}
window.gitlist.setCodeMirrorTheme = setCodeMirrorTheme;
const sourceCode = $('#sourcecode');
if (sourceCode.length) {
const value = sourceCode.text();
const mode = sourceCode.attr('language');
const pre = sourceCode.get(0);
gitlist.viewer = CodeMirror(function(elt) {
pre.parentNode.replaceChild(elt, pre);
}, {
value: value,
lineNumbers: true,
matchBrackets: true,
lineWrapping: true,
readOnly: true,
mode: mode,
});
const setCodeMirror = function() {
if (gitlist.getThemeCookie !== undefined) {
setCodeMirrorTheme(gitlist.getThemeCookie())
} else {
setTimeout(function() {
setCodeMirror()
}, 250)
}
}
setCodeMirror()
}
})