diff --git a/www/common/outer/async-store.js b/www/common/outer/async-store.js index 43fa364bc..56415dab6 100644 --- a/www/common/outer/async-store.js +++ b/www/common/outer/async-store.js @@ -1969,7 +1969,11 @@ define([ first = false; } msg = msg.replace(/cp\|(([A-Za-z0-9+\/=]+)\|)?/, ''); - msgs.push(msg); + msgs.push({ + msg: msg, + author: parsed[2][1], + time: parsed[2][5] + }); } }; diff --git a/www/common/sframe-common-history.js b/www/common/sframe-common-history.js index aae04ca95..be2793128 100644 --- a/www/common/sframe-common-history.js +++ b/www/common/sframe-common-history.js @@ -70,7 +70,11 @@ define([ if (!Array.isArray(data.messages)) { return void console.error('Not an array!'); } lastKnownHash = data.lastKnownHash; isComplete = data.isFull; - Array.prototype.unshift.apply(allMessages, data.messages); // Destructive concat + var messages = (data.messages || []).map(function (obj) { + return obj.msg; + }); + if (config.debug) { console.log(data.messages); } + Array.prototype.unshift.apply(allMessages, messages); // Destructive concat fillChainPad(realtime, allMessages); cb (null, realtime, data.isFull); }); diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index a7af0f6b6..b831436b3 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -859,10 +859,14 @@ define([ }, function (data) { cb({ isFull: data.isFull, - messages: data.messages.map(function (msg) { + messages: data.messages.map(function (obj) { // The 3rd parameter "true" means we're going to skip signature validation. // We don't need it since the message is already validated serverside by hk - return crypto.decrypt(msg, true, true); + return { + msg: crypto.decrypt(obj.msg, true, true), + author: obj.author, + time: obj.time + }; }), lastKnownHash: data.lastKnownHash }); diff --git a/www/pad/cursor.js b/www/pad/cursor.js index cdae97c8c..33308c24c 100644 --- a/www/pad/cursor.js +++ b/www/pad/cursor.js @@ -111,10 +111,13 @@ define([ } }; - exp.removeCursors = function () { + exp.removeCursors = function (inner) { for (var id in cursors) { deleteCursor(id); } + // If diffdom has changed the cursor element somehow, we'll have cursor elements + // in the dom but not in memory: remove them + $(inner).find('.cp-cursor-position').remove(); }; exp.cursorGetter = function (hjson) { diff --git a/www/pad/inner.js b/www/pad/inner.js index 3f6e717ce..8ce0bc55e 100644 --- a/www/pad/inner.js +++ b/www/pad/inner.js @@ -665,7 +665,7 @@ define([ // We have to remove the cursors before getting the content because they split // the text nodes and OT/ChainPad would freak out - cursors.removeCursors(); + cursors.removeCursors(inner); displayMediaTags(framework, inner, mediaTagMap); inner.normalize();