Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ITextModel.applyEdits to prevent reverts of local changes while remote changes are applied to the model #8

Merged
merged 3 commits into from
Jan 8, 2021

Conversation

raedle
Copy link
Contributor

@raedle raedle commented Jan 7, 2021

The ITextModel.pushEditOperations will eventually create delete IModelContentChanges for local changes while remote changes are applied to the model with pushEditOperations. The changes revert the local changes immediately. It is unclear why that is happening. However, applying edits with (although discouraged) ITextModel.applyEdits circumvents these delete ops.

…lete ops when local ops are applied, which can lead to inconsistent ITextModels on the different clients. Using the ITextModel.applyEdits prevents these ops
…lete ops when local ops are applied, which can lead to inconsistent ITextModels on the different clients. Using the ITextModel.applyEdits prevents these ops
…lete ops when local ops are applied, which can lead to inconsistent ITextModels on the different clients. Using the ITextModel.applyEdits prevents these ops
@dmonad dmonad mentioned this pull request Jan 8, 2021
@dmonad
Copy link
Member

dmonad commented Jan 8, 2021

This is great, thank you!

Now undoing leads to fragmented documents if another user is also editing the document, but that is much better than having sync issues.

When I created this editor binding initially I wanted to keep the native undo manager. Now I think it makes sense to switch to the Yjs UndoManager. I created a separate ticket to track this feature #9.

I will merge this PR and publish a new release.

@dmonad dmonad merged commit 800420f into yjs:master Jan 8, 2021
@domagojk domagojk mentioned this pull request Mar 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants