You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible to disable the global undo state? Currently it seems that when I press Ctrl + Z it will undo text input including whatever any other connected user has typed. This has caused confusion at times when we start to wonder where our text has gone!
Can undo states just be local to the user?
The text was updated successfully, but these errors were encountered:
Hey! I missed this issue.. it's a good question. I think it can be fixed, probably need to handle Undo/Redo shortcuts manually and only apply these actions on the focused editor. I'll take a look.
It seems we have to specify trackedOrigins in the UndoManager by for example adding the user id or user name as an Origin, so when undo-ing the UndoManager only tracks the edits from the user:
But then we have to add the origin to the "transaction" made by the User. And for this they give the example to use the beforeTransaction listener with a callback function:
doc.on('beforeTransaction',(tr,doc)=>{if(!tr.origin)tr.origin='the origin for UndoManager';});
I tried this but it seems you implemented the y-codemirror.next a bit differently so this .on() is not available in the doc.session. That is where I got stuck, if you have pointers I'm happy to continue (or maybe this already helps you to implement the feature?
Update:
I was able to get 'beforeTransaction' working, but it seems this is not what we need and this is called for all users. It has to be an extra argument to .transaction I guess.
I tried disabling by setting history: false to see if that helped but that actually made the history not work anymore so I don't think this is the fix.
On the y-codermirror.next github they do mention that individual undo/redo-history is a separate plugin, but is not clear what that plugin is, or maybe they mean the UndoManager with that.
Is it possible to disable the global undo state? Currently it seems that when I press Ctrl + Z it will undo text input including whatever any other connected user has typed. This has caused confusion at times when we start to wonder where our text has gone!
Can undo states just be local to the user?
The text was updated successfully, but these errors were encountered: