summaryrefslogtreecommitdiff
path: root/lib/ot
diff options
context:
space:
mode:
authorYukai Huang2017-01-02 15:09:19 +0800
committerYukai Huang2017-01-02 15:09:19 +0800
commit65acaea8cf47629c7e5710e444973a04526b047d (patch)
treef09efeaab513ffd7fb58d2af17a1ea1070a02251 /lib/ot
parent1e276fb37a4ed8e19234de7192d8593314f53799 (diff)
parentac2b100d35bd9dd9bcbca8e622a5e7ed48222598 (diff)
Merge branch 'master' into frontend-next
Diffstat (limited to 'lib/ot')
-rwxr-xr-xlib/ot/editor-socketio-server.js8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/ot/editor-socketio-server.js b/lib/ot/editor-socketio-server.js
index d062fa19..7b204539 100755
--- a/lib/ot/editor-socketio-server.js
+++ b/lib/ot/editor-socketio-server.js
@@ -7,7 +7,6 @@ var Server = require('./server');
var Selection = require('./selection');
var util = require('util');
-var LZString = require('lz-string');
var logger = require('../logger');
function EditorSocketIOServer(document, operations, docId, mayWrite, operationCallback) {
@@ -40,10 +39,8 @@ EditorSocketIOServer.prototype.addClient = function (socket) {
revision: this.operations.length,
clients: this.users
};
- socket.emit('doc', LZString.compressToUTF16(JSON.stringify(docOut)));
+ socket.emit('doc', docOut);
socket.on('operation', function (revision, operation, selection) {
- operation = LZString.decompressFromUTF16(operation);
- operation = JSON.parse(operation);
socket.origin = 'operation';
self.mayWrite(socket, function (mayWrite) {
if (!mayWrite) {
@@ -62,7 +59,7 @@ EditorSocketIOServer.prototype.addClient = function (socket) {
clients: self.users,
force: true
};
- socket.emit('doc', LZString.compressToUTF16(JSON.stringify(docOut)));
+ socket.emit('doc', docOut);
}, 100);
}
});
@@ -129,7 +126,6 @@ EditorSocketIOServer.prototype.onGetOperations = function (socket, base, head) {
var operations = this.operations.slice(base, head).map(function (op) {
return op.wrapped.toJSON();
});
- operations = LZString.compressToUTF16(JSON.stringify(operations));
socket.emit('operations', head, operations);
};