-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample.html
51 lines (44 loc) · 1.31 KB
/
example.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>ACE in Action</title>
<style type="text/css" media="screen">
#editor {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
</style>
</head>
<body>
<!--
Run the tornado server (server.py) and look at http://localhost:8888
Useful URLs:
* https://github.com/ajaxorg/ace-builds/ - where this example started from
* http://ajaxorg.github.com/ace-builds/kitchen-sink.html - their big example
* http://api.jquery.com/jQuery.ajax/ - using jQuery for Ajax
-->
<div id="editor">
def foo(items):
x = "All this is syntax highlighted: '%s'"%item
yield x
print x
x += ' and fred'
return x
</div>
<script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script>
var editor = ace.edit("editor");
editor.setTheme("ace/theme/chrome");
editor.getSession().setMode("ace/mode/python");
editor.getSession().on('change', function(e) {
console.log(e.data.action);
console.log(e.data.text);
$.post("/test", e.data.action + " with '" + e.data.text + "'");
});
</script>
</body>
</html>