ProseMirror / prosemirror

The ProseMirror WYSIWYM editor
http://prosemirror.net/
MIT License
7.59k stars 335 forks source link

could the rebaseSteps function be exported? #1426

Closed neil-sigma closed 9 months ago

neil-sigma commented 9 months ago

The codeMirror collab API exposes a rebaseUpdates function which fits nicely into our current approach since we can manage the version number state ourselves.

Could the rebaseSteps function also be exported? I made a branch for it here.

If not, why?

marijnh commented 9 months ago

What do you want to use it for?

neil-sigma commented 9 months ago

What do you want to use it for?

Great question!

I'm an engineer at the startup Sigma Computing and I worked on the Live Edit feature. Right now collaboratively editing text within a text box is a poor experience since it's last-writer wins.

If the rebaseSteps function was exposed we could easily fit the ProseMirror collaborative editing approach into our code. A single document within Sigma can contain multiple text boxes and other state that can be edited so we manage the versioning state outside of the ProseMirror state. Thus the ability to rebase the ProseMirror edits themselves is more useful and easier to reason about than multiple text boxes each with their own versioning state.

marijnh commented 9 months ago

I'd say just copy it—it's just 14 lines. That allows you to tailor it to your requirements, and doesn't require me to put a hard-to-use internal function in the public, documented API.

neil-sigma commented 9 months ago

Fair enough, that's what I'm doing now. I was just curious why the codemirror collab API and prosemirror collab API aren't symmetrical

marijnh commented 9 months ago

Their OT implementations work very differently, making some stuff that's easy in CodeMirror a lot harder to do correctly in ProseMirror.

neil-sigma commented 9 months ago

Their OT implementations work very differently, making some stuff that's easy in CodeMirror a lot harder to do correctly in ProseMirror.

Ah ok perfect this was what I was interested in. Could you give an example of something that's easier to get wrong in ProseMirror?