yjs / y-monaco

Monaco editor bindings for Yjs
MIT License
163 stars 31 forks source link

Fix incorrect remote selection after undo/redo #23

Open mosquitochang opened 8 months ago

mosquitochang commented 8 months ago

This PR is to resolve issue #19.

The root cause is on the monaco-editor side, which is related to the incorrect event order of onDidChangeModelContent and onDidChangeCursorSelection on undo/redo. Please refer to https://github.com/microsoft/monaco-editor/issues/2774 for more details.

Before:

https://github.com/yjs/y-monaco/assets/11325684/a7eedb44-bff6-4392-ab59-9f050bc8c276

After:

https://github.com/yjs/y-monaco/assets/11325684/21c9cb7d-44c0-49f4-831b-057323e2a55b


Review PR in StackBlitz Submitted with StackBlitz.