yjs / y-prosemirror

ProseMirror editor binding for Yjs

Home Page:https://demos.yjs.dev/prosemirror/prosemirror.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`ySyncPlugin` ignores `addToHistory:false` meta of `appendedTransaction`

romansp opened this issue · comments

Describe the bug
ySyncPlugin ignores addToHistory: false of appendedTransaction thus root transaction gets added onto undo/redo stack.

To Reproduce
Steps to reproduce the behavior:

  1. Clone fork with a test repro: https://github.com/romansp/y-prosemirror/tree/appendedTransaction-addToHistory-false
  2. Checkout the commit before the fix
  3. Run npm run test
  4. See that test named add to history ignore with append transaction plugin has failed

Expected behavior
addToHistory: false should be respected if it comes from appendedTransaction. Root transaction should not appear on the undo/redo stack, and undoing/redoing should not have any affect.

Actual behavior
Transaction is added onto undo stack.

Environment Information

  • Browser, Microsoft Edge 116.0.1938.76 (Official build) (arm64)
  • y-prosemirror v1.2.1
  • yjs v13.6.7

Additional context
Original prosemirror-history plugin does indeed check appendedTransaction and inspects for possible addToHistory: false as demonstrated here https://github.com/ProseMirror/prosemirror-history/blob/40d274a74d0fc0787aeca03634a64d0c78f18a50/src/history.ts#L277C15-L277C15