Table issues
Description
A few issues with tables
Crashes with pasting a plate table selection into a plate table cell
The path parameters for setting the selection after inserting a table fragment into an existing table is not quite correct. It passes the existing tests somewhat by coincidence, but breaks with other syntax trees.
I used a workaround similar to that used in other places in Plate,
if (lastCellPath) {
select(editor, {
anchor: getStartPoint(editor, startCellPath),
focus: getEndPoint(editor, lastCellPath),
});
}
which works fairly well. Existing tests still pass, and it no longer crashes in my app. Unfortunately I've not really been able to clearly isolate a failing unit test that I trust.
However, sometimes copy/paste then inserts an extra cell, overwriting an additional cell in the table or adding an empty row to the right side. The source copy/paste buffer seems to be hanging over the cell but it isn't visually. I think the selection mechanism may be grabbing just over the boundary of the cell but not the children.
It's also a bit odd that copy/paste always overwrites the cell, even if the new cell doesn't have its contents highlighted. I would expect a single cell copy to be treated as if you wanted to insert content into the cell, not replace it. Perhaps the current behavior matches spreadsheets, but it's not really clear in the UI how to just grab a portion of the table cell's contents rather than all of the contents.
Selection in Firefox is very broken.
The resize splitters are a bit flaky (I tested in Firefox, but perhaps in other browsers as well).
This could be split into separate issues, but it might make sense to work on these issues together so I'll leave it as one issue for now. Environment
- plate: 16.0.1
- slate: 0.82.0
- slate-react: 0.82.0
- browser: all