I have a custom node view called ProductCardNodeView
When I select the custom node, selectionFrom is 5 and selectionTo is 6 (just a example for more clarity)
now I call
tr.delete(5, 6);
dispatch(tr);
then this node is removed, and also ProductCardNodeView’s destroy method called
But in fact, I want to replace ProductCardNodeView with a paragraphNode, So I need to insert a paragraphNode.
Nodes don’t have identity in this system, so node views just indicate that a given node is in the document at a given position, it’s not actually tied to a specific node object. If you delete a node and replace it with another node of that type, you’ll be able to reuse your node view.