How to handle page breaks? #4960
-
I'm using TipTap in a React application and need to implement page breaks at regular intervals (every 1,056px to be exact). Turns out that page breaks are actually super tricky in TipTap/ProseMirror, I've looked at [this community extension] (#3408) that creates a custom node, but this is not that helpful in my context as it can be moved around, deleted etc. I've looked at this "Should I use a state based plugin or a view based one" discussion in the ProseMirror forums and it provided some insight but nothing very specific, and I've also looked at this discussion which helps in handling printing but not dynamic page breaks. Given all this, it's clear this will be super tricky. My two main options seem to be:
My main question is whether or not option 2 is possible. It seems like lots of logic is abstracted away in |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Same here. Did you manage to do it @EricHasegawa ? |
Beta Was this translation helpful? Give feedback.
-
I'm still thinking about this in general. I've seen solutions using specific Page breaks then would just be the insertion of a new "Page" node below the current one and moving the cursor in there. Setting this up is actually quite easy (as it's just a Tiptap Node with attributes that should be rendered in a specific way). The complicated parts then are:
Those are the things I currently had issues with the most and didn't had time to invest more here. |
Beta Was this translation helpful? Give feedback.
good insights. I have figured out a way, but not 100% functional, since tables and other more complex structures are super hard to split and accomodate.
Maybe we can continue the discussion on #5719 ?