-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
36 lines (27 loc) · 1.09 KB
/
index.js
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
32
33
34
35
36
const main_editero = document.getElementById("main_editer");
const run = document.getElementById("run");
const previwe = document.getElementById("previwe");
function editero_heart() {
run.addEventListener("click", function () {
var html = main_editero.textContent;
previwe.src = "data:text/html;charset=utf-8," + encodeURI(html);
});
main_editero.addEventListener("keyup", function () {
var html = main_editero.textContent;
previwe.src = "data:text/html;charset=utf-8," + encodeURI(html);
});
main_editero.addEventListener("paste", function (e) {
e.preventDefault();
var text = e.clipboardData.getData("text/plain");
document.execCommand("insertText", false, text);
});
}
editero_heart();
function div1(){
document.getElementById("previwe").style.display = "block";
document.getElementById("main_editer").style.display = "none"
}
function div2(){
document.getElementById("main_editer").style.display = "block";
document.getElementById("previwe").style.display = "none";
}