pull/1/head
Caleb James DeLisle 9 years ago
parent 62eabbc7ae
commit 98c85cef8b

@ -174,14 +174,11 @@ define([
// apply patches, and try not to lose the cursor in the process!
var applyHjson = function (shjson) {
//setEditable(false);
console.log(now());
var userDocStateDom = Convert.hjson.to.dom(JSON.parse(shjson));
userDocStateDom.setAttribute("contenteditable", "true"); // lol wtf
console.log(now());
//assertStateMatches();
var patch = (DD).diff(inner, userDocStateDom);
(DD).apply(inner, patch);
console.log(now());
// push back to the textarea so we get a userDocState
//setEditable(true);
};

@ -172,7 +172,7 @@ define([
// wrap up the reconnecting websocket with our additional stack logic
var socket = makeWebsocket(websocketUrl);
var allMessages = [];
var allMessages = window.chainpad_allMessages = [];
var isErrorState = false;
var initializing = true;
var recoverableErrorCount = 0;

@ -1033,13 +1033,13 @@ var handleMessage = ChainPad.handleMessage = function (realtime, msgStr) {
// toApply.length-1 because we do not want to apply the new patch.
for (var i = 0; i < toApply.length-1; i++) {
if (Common.PARANOIA) {
Common.assert(Sha.hex_sha256(authDocAtTimeOfPatch) === toApply[i].content.parentHash);
}
if (typeof(toApply[i].content.inverseOf) === 'undefined') {
toApply[i].content.inverseOf = Patch.invert(toApply[i].content, authDocAtTimeOfPatch);
toApply[i].content.inverseOf.inverseOf = toApply[i].content;
}
if (Common.PARANOIA) {
Common.assert(Sha.hex_sha256(authDocAtTimeOfPatch) === toApply[i].content.parentHash);
}
authDocAtTimeOfPatch = Patch.apply(toApply[i].content, authDocAtTimeOfPatch);
}

Loading…
Cancel
Save