-
Notifications
You must be signed in to change notification settings - Fork 0
/
code_editor.html
146 lines (95 loc) · 3.93 KB
/
code_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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<link href="css/plugins/codemirror/codemirror.css" rel="stylesheet">
<link href="css/plugins/codemirror/ambiance.css" rel="stylesheet">
<div class="wrapper wrapper-content animated fadeInRight">
<div class="row">
<div class="col-lg-6">
<div class="ibox ">
<div class="ibox-title">
<h5>Code Editor - Basic example</h5>
</div>
<div class="ibox-content">
<p class="m-b-lg">
<strong>CodeMirror</strong> is a versatile text editor implemented in JavaScript for the browser. It is specialized for editing code, and comes with a number of language modes and addons that implement more advanced editing functionality.
</p>
<textarea id="code1">
<script>
// Code goes here
// For demo purpose - animation css script
function animationHover(element, animation){
element = $(element);
element.hover(
function(){
element.addClass('animated ' + animation);
},
function(){
//wait for animation to finish before removing classes
window.setTimeout( function(){
element.removeClass('animated ' + animation);
}, 2000);
});
}
</script>
</textarea>
</div>
</div>
</div>
<div class="col-lg-6">
<div class="ibox ">
<div class="ibox-title">
<h5>Code Editor - Theme Example</h5>
</div>
<div class="ibox-content">
<p class="m-b-lg">
A rich programming API and a CSS theming system are available for customizing CodeMirror to fit your application, and extending it with new functionality. For mor info go to
<a href="http://codemirror.net/" target="_blank">http://codemirror.net/</a>
</p>
<textarea id="code2">
var SpeechApp = angular.module('SpeechApp', []);
function VoiceCtrl($scope)
$scope.said='...';
$scope.helloWorld = function()
$scope.said = "Hello world!";
}
$scope.commands =
'hello (world)': function()
if (typeof console !== "undefined") console.log('hello world!')
$scope.$apply($scope.helloWorld);
},
'hey': function()
if (typeof console !== "undefined") console.log('hey!')
$scope.$apply($scope.helloWorld);
}
};
annyang.debug();
annyang.init($scope.commands);
annyang.start();
}
</textarea>
</div>
</div>
</div>
</div>
</div>
<!-- Mainly scripts -->
<!-- CodeMirror -->
<script src="js/plugins/codemirror/codemirror.js"></script>
<script src="js/plugins/codemirror/mode/javascript/javascript.js"></script>
<!-- Custom and plugin javascript -->
<script src="js/common.js"></script>
<script>
$(document).ready(function(){
var editor_one = CodeMirror.fromTextArea(document.getElementById("code1"), {
lineNumbers: true,
matchBrackets: true,
styleActiveLine: true,
theme:"ambiance"
});
var editor_two = CodeMirror.fromTextArea(document.getElementById("code2"), {
lineNumbers: true,
matchBrackets: true,
styleActiveLine: true
});
});
</script>
<style>
</style>