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();