Merged cell node size issue

After merging two cells in a table, it looks like the merged cell retains the node size of the left or right cell instead of having a node size of both cells or at least bigger than one of the cells. This is causing problems when we try to use setNodeMarkup to style the merged cell. Am I thinking correctly?

It doesn’t look like mergedCell’s node size is updated in the mergeCell function

setNodeMarkup is designed to create a node when there’s no node where it thinks there should be a node. prosemirror/structure.js at b04565c9ed1b6fdfa575ff7a989fbc73257f2161 · ProseMirror/prosemirror · GitHub So it ends up creating a table cell and now the table cells are no longer merged. If this is true, how do I overcome it?

By node size you mean .nodeSize? That doesn’t need to be updated on the side of the command code—creating a transaction that merges nodes will cause a new node with the correct size to be created when the transaction is applied. Node objects are immutable, so the old objects won’t appear in the new document, and will indeed continue to have their original size.

Yes. Whenever I try to style a table with merged cells, I keep getting a RangeError “No node at given position”. Whenever I style a table with no merged cells, all is good. But when I merge two cells, then it can’t find a node, or if I style it, it works fine but goes back to unmerged cells :roll_eyes:. But I think I’m confused between editor.state and editor.view.state. Please what are the differences? Thank you.

I don’t know what editor is here—it sounds like it is something defined outside of ProseMirror.

It’s Tip Tap, which is built on top of Prose Mirror