- commit
- 347ad92c7108afa626ea1827b30e85e6b80e4949
- parent
- 228463c6688b234eb8636a35c7a82ce88b587f20
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2020-05-12 06:48
clear stagedChanges on broadcast instead of submit
Diffstat
M | static/pad.js | 16 | ++++++++-------- |
1 files changed, 8 insertions, 8 deletions
diff --git a/static/pad.js b/static/pad.js
@@ -29,9 +29,7 @@ var sendChanges = utils.throttled(function() { 29 29 } else { 30 30 stagedChanges = localChanges; 31 31 localChanges = [];32 -1 via.send(room, [id, 'changes', stagedChanges]).then(() => {33 -1 stagedChanges = [];34 -1 }).catch(() => {-1 32 via.send(room, [id, 'changes', stagedChanges]).catch(() => { 35 33 localChanges = stagedChanges.concat(localChanges); 36 34 stagedChanges = []; 37 35 sendChanges(); @@ -67,9 +65,7 @@ el.addEventListener('input', function() { 67 65 }); 68 66 69 67 via.listen(room, function(msg) {70 -1 if (msg[0] === id) {71 -1 return;72 -1 } else if (msg[1] === 'open') {-1 68 if (msg[1] === 'open') { 73 69 // request current document from peers 74 70 via.send(room, [id, 'request']); 75 71 @@ -87,8 +83,12 @@ via.listen(room, function(msg) { 87 83 } 88 84 }, 1000); 89 85 } else if (msg[1] === 'changes' && !el.readOnly) {90 -1 applyChanges(msg[2]);91 -1 } else if (msg[1] === 'request') {-1 86 if (msg[0] === id) { -1 87 stagedChanges = []; -1 88 } else { -1 89 applyChanges(msg[2]); -1 90 } -1 91 } else if (msg[1] === 'request' && msg[0] !== id) { 92 92 via.send(room, [id, 'text', el.value]); 93 93 } else if (msg[1] === 'text' && !el.value) { 94 94 el.value = msg[2];