Seenginx/Seenginx/wwwroot/js/index.js

22 lines
556 B
JavaScript
Raw Normal View History

2020-04-23 01:32:20 +02:00

2020-04-23 16:23:56 +02:00
window.GetEditor = () => document.querySelector(".CodeMirror")
2020-04-23 01:32:20 +02:00
window.InitEditor = (code) => {
2020-04-23 16:23:56 +02:00
if (window.GetEditor())
window.GetEditor().remove()
2020-04-23 01:32:20 +02:00
document.getElementById("code").innerHTML = code
const editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
2020-04-23 16:23:56 +02:00
mode: "nginx",
styleActiveLine: true,
matchBrackets: true,
theme: "solarized light"
2020-04-23 01:32:20 +02:00
})
}
window.DeleteEditor = () => {
document.getElementById("code").innerHTML = ''
2020-04-23 16:23:56 +02:00
if (window.GetEditor())
window.GetEditor().remove()
2020-04-23 01:32:20 +02:00
}