Based off two previous threads, Defining a container node, that gets removed when empty? and Remove a node if the node is empty on leave, I made a plugin using
appendTransactions that removes the entire figure node when the image is deleted.
I do this iterating through the document of the newState and checking if the image src of any figure equals the fault. If so, then I append a
deleteRange to a transaction and return that.
The problem is, instead of deleting the entire figure node, it only seems to delete the image node only and reinitialize that image node to default settings.