-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
99 lines (81 loc) Β· 1.71 KB
/
index.html
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<!DOCTYPE html>
<html>
<head>
<title>Live Html IDE</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ace.js" integrity="sha512-GZ1RIgZaSc8rnco/8CXfRdCpDxRCphenIiZ2ztLy3XQfCbQUSCuk8IudvNHxkRA3oUg6q0qejgN/qqyG1duv5Q==" crossorigin="anonymous"></script>
<style>
html,body{
margin:0;
padding:0;
height:100%;
width:100%;
overflow:hidden;
}
#editor{
height:100%;
width:50%;
display:inline-block;
}
#iframe{
height:100%;
display:inline-block;
width:50%;
}
#container{
height:100%;
width:auto;
white-space:nowrap;
overflow:hidden;
}
</style>
</head>
<body onload='ready()'>
<div id='container'>
<div id='editor'>
</div>
<iframe id='iframe' frameBorder="0">
</iframe>
</div>
<script>
function update()
{
var idoc = document.getElementById('iframe').contentWindow.document;
idoc.open();
idoc.write(editor.getValue());
idoc.close();
}
function setupEditor()
{
window.editor = ace.edit("editor");
editor.setTheme("ace/theme/monokai");
editor.getSession().setMode("ace/mode/html");
editor.setValue(`<!--Enter Html Code -->
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>`,1); //1 = moves cursor to end
editor.getSession().on('change', function() {
update();
});
editor.focus();
editor.setOptions({
fontSize: "16pt",
showLineNumbers: false,
showGutter: false,
vScrollBarAlwaysVisible:true,
enableBasicAutocompletion: false, enableLiveAutocompletion: false
});
editor.setShowPrintMargin(false);
editor.setBehavioursEnabled(false);
}
function ready(){
setupEditor();
update();
}
</script>
</body>
</html>