yjs / y-prosemirror

ProseMirror editor binding for Yjs
https://demos.yjs.dev/prosemirror/prosemirror.html
MIT License
339 stars 118 forks source link

Bug: prosemiror-table columnResizing not compatible with YJS sync #27

Open zlv-thisF opened 3 years ago

zlv-thisF commented 3 years ago

Describe the bug if anyone is resizing the table columns, and others are keep typing in the table, prosemirror collapse due to unexpected position after tr.mapping

To Reproduce Steps to reproduce the behavior: https://codesandbox.io/s/relaxed-herschel-el656?file=/src/App.js site: https://el656.csb.app/

  1. open incognito chrome
  2. open chrome
  3. in incognito chrome page, setInterval insert innerText on chrome dev console in first table cell to simulate edit for example, setInterval(() => { document.querySelector('td').innerText += "1" }, 1000 )
  4. in chrome page, resize the table column
  5. chrome page collapse

Expected behavior The columnResizing in prosemirror-table can get correct position instead of null which lead to error in handleDecorations.

Screenshots image

Additional context It seems that after editor got update from server, yjs will turn the whole yXmlElement into prosemirror's slice, so tr.mapping cannot get correct position derivation from the tr.steps. image image

cobbcheng commented 2 years ago

Is there a way to fix this issue?

ascott18 commented 2 years ago

This looks like a combination of https://github.com/ProseMirror/prosemirror-tables/issues/141 and #113

cobbcheng commented 2 years ago

This looks like a combination of ProseMirror/prosemirror-tables#141 and #113

thanks a lot!