I implemented a custom handlePaste method using EditorProps interface where I use Transaction.replaceSelection(), pretty similar way to the original pasting implementation, I just update a couple nodes in the slice before doing the replacement.
However I noticed that the first Node in my Slice has its attributes overriden by those of the Node that is the selection (they share the same NodeType). Every other node in the slice keeps their attributes as expected.
I was diving a bit into the code with breakpoints and noticed that it happens within Fitter.findFittable(), most specifically in this highlighted line:
It makes so the fragment being added (for the first line) is the TextNode and not the Node itself. So when pasting a number of nodes, the first one loses all its data, only the TextNode is preserved.
Is this expected behavior when using replaceSelection? If so, how can I work around it so the entire pasted content remains unchanged, wherever it gets pasted?