I see. So, yes you are correct: there are some synchronization issues
you'll need to solve, but here's one approach I can imagine:
-Two versions of the same document loaded into two separate browsers.
-Each document has a MutationSummary observing it and using TreeMirror
to serialize changes which originate from user input to the other
side.
So the key thing you'll want to avoid is having changes which come in
from the remote editor detected by the local MutationSummary and sent
back to it. Thankfully, there's an easy way to do that:
disconnect()/reconnect(). Basically in each side, when you receive
remote changes, perform a disconnect() on the local MutationSummary
while you apply the changes, then reconnect() when the changes are
complete.
Be aware that disconnect() returns a collection of summaries
representing any changes which have occurred since the last callback
and the time you call disconnect(). In most instances this should be
empty (and return undefined). Just be aware -- and maybe log an error
if you there are any changes at that point so you can try to figure
out why.
It's been a while since I looked at the TreeMirror code, so I can
imagine you may need to modify it to do this correctly. Hopefully, the
code is readable enough that doing this won't be too hard.
Good luck!
>> >
mutation-summary-d...@googlegroups.com.
> --
> You received this message because you are subscribed to the Google Groups
> "mutation-summary-discuss" group.
> To view this discussion on the web visit
>
https://groups.google.com/d/msg/mutation-summary-discuss/-/kcZdSlxhyqIJ.
>
mutation-summary-d...@googlegroups.com.