22 lines
556 B
JavaScript
22 lines
556 B
JavaScript
|
|
window.GetEditor = () => document.querySelector(".CodeMirror")
|
|
|
|
window.InitEditor = (code) => {
|
|
if (window.GetEditor())
|
|
window.GetEditor().remove()
|
|
document.getElementById("code").innerHTML = code
|
|
const editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
|
lineNumbers: true,
|
|
mode: "nginx",
|
|
styleActiveLine: true,
|
|
matchBrackets: true,
|
|
theme: "solarized light"
|
|
})
|
|
}
|
|
|
|
window.DeleteEditor = () => {
|
|
document.getElementById("code").innerHTML = ''
|
|
if (window.GetEditor())
|
|
window.GetEditor().remove()
|
|
}
|