Context
We’re building an application using TipTap editor which uses ProseMirror behind the scenes. As part of this application, we have a file menu bar where we let the user perform basic Clipboard Actions. This is, copy / cut / paste / duplicate current selection, not via keyboard shortcuts but buttons on the menu instead. We’re interested on supporting these features for text / images / tables and it’s worth noting we need to preserve styles (bold, underline, etc) when copy / pasting text.
Ask
- What would be the high level approach to solve this via ProseMirror primitives?
- The way we’ve been thinking about this is:
- Get current selection
- Get nodes associated to that selection
- Get HTML associated to nodes
- Write HTML to Clipboard via
Clipboard API
.
- The way we’ve been thinking about this is:
While above idea works nicely for most cases, it still doesn’t cover all. (e.g. text with marks etc). So we’re starting to question whether or not our approach might be the correct one.
Thoughts?