diff --git a/www/_socket/main.js b/www/_socket/main.js index d41274a98..d59acd28f 100644 --- a/www/_socket/main.js +++ b/www/_socket/main.js @@ -197,6 +197,11 @@ define([ // build a dom from HJSON, diff, and patch the editor applyHjson(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) { @@ -260,9 +265,7 @@ define([ var rti = module.realtimeInput = window.rti = realtimeInput.start(realtimeOptions); var propogate = window.cryptpad_propogate = function () { - var hjson = Convert.core.hyperjson.fromDOM(inner, isNotMagicLine); - var shjson = JSON.stringify(hjson); - + var shjson = JSON.stringify(Convert.core.hyperjson.fromDOM(inner, isNotMagicLine)); if (!rti.propogate(shjson)) { return; } rti.onEvent(shjson); }; diff --git a/www/_socket/realtime-input.js b/www/_socket/realtime-input.js index 3d36217b1..e40a19085 100644 --- a/www/_socket/realtime-input.js +++ b/www/_socket/realtime-input.js @@ -211,7 +211,6 @@ define([ warn("realtime.getUserDoc() !== newText"); } //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 @@ -276,10 +275,7 @@ define([ allMessages.push(message); if (!initializing) { // FIXME this is out of sync with the application logic - console.log("xxx"); window.cryptpad_propogate(); - } else { - console.log("init"); } realtime.message(message); if (/\[5,/.test(message)) { verbose("pong"); } diff --git a/www/_socket/sharejs_textarea-transport-only.js b/www/_socket/sharejs_textarea-transport-only.js index 910eca008..3e2ba7fc8 100644 --- a/www/_socket/sharejs_textarea-transport-only.js +++ b/www/_socket/sharejs_textarea-transport-only.js @@ -35,6 +35,7 @@ var applyChange = function(ctx, oldval, newval) { if (newval.length !== commonStart + commonEnd) { if (ctx.localChange) { ctx.localChange(true); } 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) { console.log("Expected that: `ctx.getUserDoc() === newContent`!"); } - console.log("1: " + ctx.Sha.hex_sha256(ctx.getUserDoc())); return true; } - console.log("no change"); return false; }; };