our TableCell node has a hardcoded list of node types it supports as children (text, paragraph, lists, code blocks and images).
Now I want to make sure that pasting to the cell doesn’t break the table, so I search for a way to filter the pasted nodes and transform all nodes that are not allowed as cell children into their text content.
I guess because the slice is expected to be immuable, it’s best to build a new slice, but there I fail. Can I do this somehow using slice.content.descendants()?
By the way, this is for adding multiline table support in Nextcloud Text, an editor built on top of ProseMirror and Tiptap. We cannot support arbitrary block nodes in table cells as everything needs to get serialized from and to markdown.
Seems like my solution is not working as expected. What I try to do is rebuild the slice in a way that unsupported nodes get replaced with a text node and supported nodes stay. Any hints?