Shared history across multiple editor instances but not related to collaboration. #3650
Unanswered
githubbob42
asked this question in
Questions & Help
Replies: 2 comments
-
Dear @githubbob42 Did you manage to solve this? I have the same problem, but i think i should implement it at ProseMirror level, maybe it should be a custom history plugin Thanks |
Beta Was this translation helpful? Give feedback.
0 replies
-
+1, has this been solved? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all,
We are writing a PDF editor with TipTap v2 and React and it works pretty darned good (thanks TipTap - y'all are awesome).
However, because of the nature of how PDF docs are constructed, the header, body and footer are considered separate sections (for lack of a better term) with each section essentially being absolutely positioned with its own margins, etc. (PDFs don't "flow" like markup languages). So in our editor, we have 3 separate editor instances - for the header, body and footer.
Unfortunately, each editor maintains it's own history, so clicking
ctrl-z
performs an undo only in the currently selected editor instance and gives unexpected/unpredictable results to the end user.Screenshare.-.2023-01-23.5_36_13.PM.mp4
Is there a way to share history across multiple editor instances?
The only thing I can think of is to hook into the
onUpdate
event on each editor and create a single history stack to track updates across the editors and overridectrl-z
so that it callseditor.commands.undo()
for the editor on the current history element on the stack and pops them off in turn.Sounds fairly easy on the surface but there is a lot going on under the hood in
prosemirror-history
; like keeping track of undo and redo histories (branches),depth
,newGroupDelay
, etc on top of the fact that we can drag elements (words, paragraphs, tables, etc) between the editors.Any ideas would be appreciated. Thanks in advanced...
Beta Was this translation helpful? Give feedback.
All reactions