forked from dragon-drop-scratch/dragonscript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
editor.html
83 lines (77 loc) · 2.45 KB
/
editor.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
<!DOCTYPE html>
<html>
<head>
<title>DragonScript</title>
<script src="JS/DS_file_viewer.js"></script>
<style>
@font-face {
font-family:'DragonDrop';
src: url('Scratch Pen.ttf');
}
body {
margin: 0;
}
#code_area {
width: 88.45vw;
margin: 0;
padding: 0;
height: 50vh;
background-color: #f8f8f8;
resize: none;
border: 10px solid #f0f0f0;
border-radius: 10px;
padding: 5px;
font-family:'DragonDrop';
font-size: 20px;
}
#code_area:focus {
outline: none;
}
#side {
background-color: #999;
width: 10vw;
height: 100vh;
position: fixed;
margin: 0;
top: 0;
margin-left: 90vw;
}
#code_area::-webkit-scrollbar {
width: 10px;
}
#code_area::-webkit-scrollbar-track {
//box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
//-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
}
#code_area::-webkit-scrollbar-thumb {
border-radius: 10px;
background-color: darkgrey;
}
</style>
</head>
<body>
<textarea id="code_area" spellcheck="false">
\***
Welcome to DragonScript!
From the makers of DragonDrop
Syntax Guide:
dragon-drop-scratch.github.io/dragonscript/syntax.html
***/</textarea>
<canvas style="width: 90vw;height: 45vh;background-color: #F0F0F0;"></canvas>
<div id="side"></div>
<script>
var textareas = document.getElementsByTagName('textarea');
var count = textareas.length;
for (var i = 0; i < count; i++) {
textareas[i].onkeydown = function(e) {
if (e.keyCode == 9 || e.which == 9) {
e.preventDefault();
var s = this.selectionStart;
this.value = this.value.substring(0, this.selectionStart) + "\t" + this.value.substring(this.selectionEnd);
this.selectionEnd = s + 1;
}
}
}
</script>
</body>
</html>