I’m wrestling with some unexpected paste behavior and am wondering if I’ve found a bug in one of the ProseMirror projects.
If I copy some editor text that includes part of a table and the table comes before some normal text, and then paste that content into the editor, the content of the first cell is lifted to a paragraph
before the table and the rest of the content is inserted as expected.
In this case, the clipboard has data that looks like:
<table data-pm-slice="4 1 []">.....</table><p>...</p>
However, if the beginning of the selection includes normal text before the table, then everything is fine:
In this case, the clipboard has data that looks like:
<p data-pm-slice="1 4 []">.....</p><table>...</table>
I’m just not sure if this is a bug with how the data-pm-slice
value is being calculated during copy
, if its how the content is being fitted
in prosemirror-transform
, or if there’s something wrong in the prosemirror-tables
project.
If I manipulate the first test case so that the table
node in the clipboard does not have a data-pm-slice
attribute, then everything pastes as expected.
This behavior can be easily recreated on the demo page for prosemirror-tables
: https://prosemirror-tables.netlify.app/