Shuffled around some assertions and logs
This commit is contained in:
parent
420a7098a6
commit
f62ec85a4c
@ -197,6 +197,11 @@ define([
|
|||||||
// build a dom from HJSON, diff, and patch the editor
|
// build a dom from HJSON, diff, and patch the editor
|
||||||
applyHjson(shjson);
|
applyHjson(shjson);
|
||||||
//updateDebugTextarea(shjson);
|
//updateDebugTextarea(shjson);
|
||||||
|
|
||||||
|
var shjson2 = JSON.stringify(Convert.core.hyperjson.fromDOM(inner));
|
||||||
|
if (shjson2 !== shjson) {
|
||||||
|
throw new Error("change after conversion");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var onInit = function (info) {
|
var onInit = function (info) {
|
||||||
@ -260,9 +265,7 @@ define([
|
|||||||
var rti = module.realtimeInput = window.rti = realtimeInput.start(realtimeOptions);
|
var rti = module.realtimeInput = window.rti = realtimeInput.start(realtimeOptions);
|
||||||
|
|
||||||
var propogate = window.cryptpad_propogate = function () {
|
var propogate = window.cryptpad_propogate = function () {
|
||||||
var hjson = Convert.core.hyperjson.fromDOM(inner, isNotMagicLine);
|
var shjson = JSON.stringify(Convert.core.hyperjson.fromDOM(inner, isNotMagicLine));
|
||||||
var shjson = JSON.stringify(hjson);
|
|
||||||
|
|
||||||
if (!rti.propogate(shjson)) { return; }
|
if (!rti.propogate(shjson)) { return; }
|
||||||
rti.onEvent(shjson);
|
rti.onEvent(shjson);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -211,7 +211,6 @@ define([
|
|||||||
warn("realtime.getUserDoc() !== newText");
|
warn("realtime.getUserDoc() !== newText");
|
||||||
}
|
}
|
||||||
//try{throw new Error();}catch(e){console.log(e.stack);}
|
//try{throw new Error();}catch(e){console.log(e.stack);}
|
||||||
console.log("2: " + realtime.Sha.hex_sha256(realtime.getUserDoc()));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// pass your shiny new realtime into initialization functions
|
// pass your shiny new realtime into initialization functions
|
||||||
@ -276,10 +275,7 @@ define([
|
|||||||
allMessages.push(message);
|
allMessages.push(message);
|
||||||
if (!initializing) {
|
if (!initializing) {
|
||||||
// FIXME this is out of sync with the application logic
|
// FIXME this is out of sync with the application logic
|
||||||
console.log("xxx");
|
|
||||||
window.cryptpad_propogate();
|
window.cryptpad_propogate();
|
||||||
} else {
|
|
||||||
console.log("init");
|
|
||||||
}
|
}
|
||||||
realtime.message(message);
|
realtime.message(message);
|
||||||
if (/\[5,/.test(message)) { verbose("pong"); }
|
if (/\[5,/.test(message)) { verbose("pong"); }
|
||||||
|
|||||||
@ -35,6 +35,7 @@ var applyChange = function(ctx, oldval, newval) {
|
|||||||
if (newval.length !== commonStart + commonEnd) {
|
if (newval.length !== commonStart + commonEnd) {
|
||||||
if (ctx.localChange) { ctx.localChange(true); }
|
if (ctx.localChange) { ctx.localChange(true); }
|
||||||
ctx.insert(commonStart, newval.slice(commonStart, newval.length - commonEnd));
|
ctx.insert(commonStart, newval.slice(commonStart, newval.length - commonEnd));
|
||||||
|
console.log("insert: " + newval.slice(commonStart, newval.length - commonEnd));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -63,10 +64,8 @@ var attachTextarea = function(config) {
|
|||||||
if (ctx.getUserDoc() !== newContent) {
|
if (ctx.getUserDoc() !== newContent) {
|
||||||
console.log("Expected that: `ctx.getUserDoc() === newContent`!");
|
console.log("Expected that: `ctx.getUserDoc() === newContent`!");
|
||||||
}
|
}
|
||||||
console.log("1: " + ctx.Sha.hex_sha256(ctx.getUserDoc()));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
console.log("no change");
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user