summaryrefslogtreecommitdiff
path: root/lib/workers
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/workers
parent1e276fb37a4ed8e19234de7192d8593314f53799 (diff)
parentac2b100d35bd9dd9bcbca8e622a5e7ed48222598 (diff)
Merge branch 'master' into frontend-next
Diffstat (limited to 'lib/workers')
-rw-r--r--lib/workers/dmpWorker.js14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/workers/dmpWorker.js b/lib/workers/dmpWorker.js
index fae36191..8e69636e 100644
--- a/lib/workers/dmpWorker.js
+++ b/lib/workers/dmpWorker.js
@@ -1,5 +1,4 @@
// external modules
-var LZString = require('lz-string');
var DiffMatchPatch = require('diff-match-patch');
var dmp = new DiffMatchPatch();
@@ -58,7 +57,6 @@ process.on('message', function(data) {
function createPatch(lastDoc, currDoc) {
var ms_start = (new Date()).getTime();
var diff = dmp.diff_main(lastDoc, currDoc);
- dmp.diff_cleanupSemantic(diff);
var patch = dmp.patch_make(lastDoc, diff);
patch = dmp.patch_toText(patch);
var ms_end = (new Date()).getTime();
@@ -80,10 +78,10 @@ function getRevision(revisions, count) {
for (var i = 0; i < count; i++) {
var revision = revisions[i];
if (i == 0) {
- startContent = LZString.decompressFromBase64(revision.content || revision.lastContent);
+ startContent = revision.content || revision.lastContent;
}
if (i != count - 1) {
- var patch = dmp.patch_fromText(LZString.decompressFromBase64(revision.patch));
+ var patch = dmp.patch_fromText(revision.patch);
applyPatches = applyPatches.concat(patch);
}
lastPatch = revision.patch;
@@ -105,11 +103,11 @@ function getRevision(revisions, count) {
for (var i = l; i >= count - 1; i--) {
var revision = revisions[i];
if (i == l) {
- startContent = LZString.decompressFromBase64(revision.lastContent);
+ startContent = revision.lastContent;
authorship = revision.authorship;
}
if (revision.patch) {
- var patch = dmp.patch_fromText(LZString.decompressFromBase64(revision.patch));
+ var patch = dmp.patch_fromText(revision.patch);
applyPatches = applyPatches.concat(patch);
}
lastPatch = revision.patch;
@@ -123,8 +121,8 @@ function getRevision(revisions, count) {
}
var data = {
content: finalContent,
- patch: dmp.patch_fromText(LZString.decompressFromBase64(lastPatch)),
- authorship: authorship ? JSON.parse(LZString.decompressFromBase64(authorship)) : null
+ patch: dmp.patch_fromText(lastPatch),
+ authorship: authorship
};
var ms_end = (new Date()).getTime();
if (config.debug) {