- commit
- 1512c83683b34f882d78557e642fc59d68c343f6
- parent
- 1b79334855f8bc9ca06e40fc0668a6549ddbe739
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2020-05-03 12:57
exchange full document on join
Diffstat
M | static/index.mjs | 13 | ++++++++++++- |
1 files changed, 12 insertions, 1 deletions
diff --git a/static/index.mjs b/static/index.mjs
@@ -17,8 +17,17 @@ el.addEventListener('input', function() { 17 17 }); 18 18 19 19 signal.listen(room, function(msg) {20 -1 if (msg.sender !== id && msg.changes) {-1 20 if (msg.sender === id) { -1 21 return -1 22 } else if (msg.changes) { 21 23 remoteChanges = remoteChanges.concat(msg.changes); -1 24 } else if (msg.request === 'text') { -1 25 signal.post(room, {sender: id, text: el.value}); -1 26 } else if (msg.text && !el.value) { -1 27 el.value = msg.text; -1 28 old = msg.text; -1 29 el.selectionStart = 0; -1 30 el.selectionEnd = 0; 22 31 } 23 32 }); 24 33 @@ -43,3 +52,5 @@ setInterval(function() { 43 52 old = text; 44 53 } 45 54 }, 500); -1 55 -1 56 signal.post(room, {sender: id, request: 'text'});