Fix some undo / redo issues and text edit mode handling

[#74712160]