
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()
}
