diff --git a/www/code/main.js b/www/code/main.js index 3af11316d..9a37efa99 100644 --- a/www/code/main.js +++ b/www/code/main.js @@ -684,8 +684,9 @@ define([ module.patchText(shjson2); } } - - notify(); + if (oldDoc !== remoteDoc) { + notify(); + } }; var onAbort = config.onAbort = function (info) { diff --git a/www/pad/main.js b/www/pad/main.js index 852ad7cd5..60f64bce5 100644 --- a/www/pad/main.js +++ b/www/pad/main.js @@ -477,6 +477,8 @@ define([ var onRemote = realtimeOptions.onRemote = function (info) { if (initializing) { return; } + var oldShjson = stringifyDOM(inner); + var shjson = info.realtime.getUserDoc(); // remember where the cursor is @@ -485,6 +487,11 @@ define([ // Update the user list (metadata) from the hyperjson updateMetadata(shjson); + var newInner = JSON.parse(shjson); + if (newInner.length > 2) { + var newSInner = stringify(newInner[2]); + } + // build a dom from HJSON, diff, and patch the editor applyHjson(shjson); @@ -518,7 +525,12 @@ define([ } } } - notify(); + + // Notify only when the content has changed, not when someone has joined/left + var oldSInner = stringify(JSON.parse(oldShjson)[2]); + if (newSInner !== oldSInner) { + notify(); + } }; var getHTML = function (Dom) { diff --git a/www/slide/main.js b/www/slide/main.js index a44f11c85..b580c8ed8 100644 --- a/www/slide/main.js +++ b/www/slide/main.js @@ -768,7 +768,9 @@ define([ } Slide.update(remoteDoc); - notify(); + if (oldDoc !== newDoc) { + notify(); + } }; var onAbort = config.onAbort = function (info) {