-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdiffsyncview001.html
More file actions
38 lines (34 loc) · 851 Bytes
/
diffsyncview001.html
File metadata and controls
38 lines (34 loc) · 851 Bytes
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
<body>
<script src="https://invisible-college.github.io/diffsync/diffsync.js"></script>
<script>
var channel = document.location.hash ? document.location.hash.slice(1) : 'goop4'
document.location.hash = '#' + channel
var t = document.createElement('textarea')
t.style.width = '100%'
t.style.height = '100%'
document.body.append(t)
var ds = diffsync.create_client({
ws_url : 'wss://invisible.college:' + diffsync.port,
channel : channel,
get_text : function () {
return t.value
},
get_range : function () {
return [t.selectionStart, t.selectionEnd]
},
on_text : function (text, range) {
t.value = text
t.setSelectionRange(range[0], range[1])
},
on_range : null
})
t.onkeyup = function () {
ds.on_change()
}
t.onpaste = function () {
setTimeout(function () {
ds.on_change()
}, 0)
}
</script>
</body>