-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
31 lines (27 loc) · 820 Bytes
/
Copy pathscript.js
File metadata and controls
31 lines (27 loc) · 820 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function setupEditor() {
//editor and preview area and settigns
editor = CodeMirror.fromTextArea(editingArea.elt, config);
editor.setSize(width,height);
editor.on("change",show);
}
function show() {
let text = getText();
if(text == ""){
mode.elt.style.opacity = 1;
label.elt.style.display = 'block';
preview.elt.classList.add('empty');
preview.elt.innerHTML = "<span id='default'><h2>GET ON <i>TYPING</i>👨💻👨💻</h2></span>";
}else{
mode.elt.style.opacity = 0.06;
label.elt.style.display = 'none';
preview.elt.classList.remove('empty');
preview.elt.innerHTML = text;
}
};
function getText(){
var text = editor.getValue();
if (mode.value() == "HTML")
return text;
else
return markdown.toHTML(text);
}