-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
43 lines (33 loc) · 882 Bytes
/
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
<html>
<head>
<title>Elm Text Editor</title>
<script src="elm.js"></script>
</head>
<body>
<div id="column">
<div id="editor"></div>
</div>
</body>
<script type="text/javascript">
// function to possibly override keypress
trapfunction = function(event) {
var keynum;
if (window.event) { // eg. IE
keynum = window.event.keyCode;
} else if (event.which) { // eg. Firefox
keynum = event.which;
}
if (keynum == 8) { // backspace has code 8
return false;
}
return true;
}
document.onkeyup = function(event) {
return true;
}
document.onkeydown = trapfunction; // IE, Firefox, Safari
document.onkeypress = trapfunction; // only Opera needs the backspace nullifying in onkeypress
var div = document.getElementById('editor');
var editor = Elm.embed(Elm.Editor, div, {});
</script>
</html>