Calling undo from the context menu after pasting text does not undo it. Maybe the context menu command does not go through the editor undo/redo stack? Either way, this is confusing for users, as it undoes some text, but not all.
Reported in ticket ID 901851
Two years later there is still no suitable event to handle the undo command from the context menu. Theoretically, the input event is the one we could use (InputEvent). Where the inputType property shows the type of the change occurred. This, however, is available only for Chrome and Opera.
Another solution is to prevent the native context menu and implement a custom one. If this is what we are after, this should be logged as an enhancement.
At the time of writing, I was considering detecting input events after the contextmenu event is triggered. Not sure if this is a viable option implementation-wise, though.
There are several troubles with that:
Closing this issue due to impossibility to be handled in all browsers consistently. If there is further demand, the solution would be to entirely prevent the context menu and show a custom one. This, however, should be processed as a feature request.