Refactors text validation to ensure that the cleanup process only proceeds with valid text selections. Removes the insertion position logic as it is no longer needed.
Refactors text validation to ensure that the cleanup process only proceeds with valid text selections. Removes the insertion position logic as it is no longer needed.