"Advanced" history usage

Hi there :wave:

I would like create some kind of advanced history feature with ProseMirror. The idea would be to :

  • List history entries (with some kind of label associated with the change(s))
  • Revert any changes in that list (like undo but, no only latest one)

I recently dig into prosemirror-history plugin (& some other threads here) & I have some questions :

From prosemirror-history description :

[…] history is selective, meaning it does not just roll back to a previous state but can undo some changes while keeping other, later changes intact.

How this can be achieve ? I didn’t find any example or api related method/informations

Plus, can you confirm, that currently, the prosemirror-history is not exposing history entries ? (“HistoryState” ). I assuming, that HistoryState, can be retrieved by using plugin state, but currently, type & related stuff is not expored by prosemirror-history…

Could it be something that would make sense if exposed by the prosemirror-history plugin package ?

Thanks !

The addToHistory: false transaction metadata.

No. it sounds like what you are trying to do would have to be done in a separate implementation of an undo history (which, given that prosemirror-history is just a plugin, is definitely possible).

Thanks @marijn for the quick answer.

The addToHistory: false transaction metadata.

I probably misunderstood the documentation statement about " can undo some changes while keeping other"…

What I was meaning, is not about having changes that are not part of history, but something like :

Let say I have 3 changes in the history (N, N-1 & N-2), all are part of history & can be undone the regular way (undo command). What I’m wondering is: it is possible to undo the “N-1” changes, without undo the “N” changes ?

No. it sounds like what you are trying to do would have to be done in a separate implementation of an undo history (which, given that prosemirror-history is just a plugin, is definitely possible).

Yes, it makes sense.

I just found this ProseMirror change tracking example

It looks like it could answer a lot of our needs :heart_eyes: