-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.html
44 lines (38 loc) · 1.33 KB
/
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
44
<!doctype html>
<html>
<head>
<title>codeshare: codemirror + sharejs</title>
<link rel="stylesheet" href="../lib/codemirror.css">
<script src="../lib/codemirror.js"></script>
<script src="../mode/xml/xml.js"></script>
<link rel="stylesheet" href="../doc/docs.css">
<style type="text/css">
.codemirror {border-top: 1px solid black; border-bottom: 1px solid black;}
.activeline {background: #e8f2ff !important;}
</style>
</head>
<body>
<h1>codeshare: codemirror + sharejs</h1>
<form><textarea id="code" name="code">
</textarea></form>
<script src="/socket.io/socket.io.js"></script>
<script src="/share/share.js"></script>
<script src="/codemirror_attach.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
mode: "application/xml",
lineNumbers: true,
lineWrapping: true,
onCursorActivity: function() {
editor.setLineClass(hlLine, null);
hlLine = editor.setLineClass(editor.getCursor().line, "activeline");
}
});
var hlLine = editor.setLineClass(0, "activeline");
sharejs.open('hello', 'text', function(error, doc) {
doc.attach_codemirror(editor);
});
</script>
<p>CodeMirror + ShareJS integration, open a 2nd window and type in it</p>
</body>
</html>