hackerwins / codepair-old

Real-time markdown editor for interviews, meetings and more...
https://codepair.yorkie.dev
Apache License 2.0
90 stars 29 forks source link

Add snapshot event observer to document #199

Closed Eithea closed 2 years ago

Eithea commented 2 years ago

What this PR does / why we need it?

When a client receives a snapshot, doc.root is replaced by the snapshot. It is not detected by the remote change obsever, causing problems with synchronization.

By adding snapshot event observer to document, value of the editor is synced and the onChange handler re-setted for the replaced new root.

Any background context you want to provide?

What are the relevant tickets?

Fixes https://github.com/yorkie-team/yorkie-js-sdk/issues/347

Checklist