forked from raghunandangupta1992/CollaborativeTextEditor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathace.html
More file actions
63 lines (54 loc) · 1.95 KB
/
ace.html
File metadata and controls
63 lines (54 loc) · 1.95 KB
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
<!doctype html>
<!-- See http://www.firepad.io/docs/ for detailed embedding docs. -->
<html>
<head>
<meta charset="utf-8" />
<!-- Include Firebase -->
<script src="https://cdn.firebase.com/v0/firebase.js"></script>
<!-- Include ACE and its JavaScript mode and theme files -->
<script src="ace/ace.js"></script>
<script src="ace/mode-javascript.js"></script>
<script src="ace/theme-textmate.js"></script>
<!-- Include Firepad -->
<script src="firepad.js"></script>
<link rel="stylesheet" href="firepad.css" />
<!-- Helper for generating URLs / Firebase references for example purposes.
Not necessary in production apps. -->
<script src="example-helper.js"></script>
<style>
html { height: 100%; }
body { margin: 0; height: 100%; position: relative; }
/* Height / width / positioning can be customized for your use case.
For demo purposes, we make firepad fill the entire browser. */
#firepad-container {
position: absolute; left: 0; top: 0; bottom: 0; right: 0;
}
</style>
</head>
<body>
<div id="firepad-container"></div>
<script>
window.onload = function() {
//// Initialize Firebase.
var firepadRef = getExampleRef();
// TODO: Replace above line with:
// var ref = new Firebase('<YOUR FIREBASE URL>');
//// Create ACE
var editor = ace.edit("firepad-container");
editor.setTheme("ace/theme/textmate");
var session = editor.getSession();
session.setUseWrapMode(true);
session.setUseWorker(false);
session.setMode("ace/mode/javascript");
//// Create Firepad.
var firepad = Firepad.fromACE(firepadRef, editor);
//// Initialize contents.
firepad.on('ready', function() {
if (firepad.isHistoryEmpty()) {
firepad.setText('// JavaScript Editing with Firepad!\nfunction go() {\n var message = "Hello, world.";\n console.log(message);\n}');
}
});
};
</script>
</body>
</html>