yjs / y-monaco

Monaco editor bindings for Yjs
MIT License
168 stars 33 forks source link

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

Closed raedle closed 3 years ago

raedle commented 3 years ago

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.

dmonad commented 3 years ago

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.