pad

minimal etherpad alternative  https://pad.ce9e.org
git clone https://git.ce9e.org/pad.git

commit
bdefa9a6250caa2bfe911e8bcd04ebf2d263c792
parent
0e5a89bf14522d6a80768a9d011ef5c8abc8230e
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2020-05-08 20:44
minify diff in _apply

Diffstat

M static/context.js 5 +++--

1 files changed, 3 insertions, 2 deletions


diff --git a/static/context.js b/static/context.js

@@ -1,9 +1,10 @@
    1     1 var _apply = function(text, [pos, before, after], selection) {
    2     2 	if (selection) {
    3    -1 		if (pos < selection[0]) {
   -1     3 		var d = diff(before, after, 0);
   -1     4 		if (pos + d[0] < selection[0]) {
    4     5 			selection[0] += after.length - before.length;
    5     6 		}
    6    -1 		if (pos < selection[1]) {
   -1     7 		if (pos + d[0] < selection[1]) {
    7     8 			selection[1] += after.length - before.length;
    8     9 		}
    9    10 	}