Support pasting clipboard text into TextFields.

Based on #6364, with some changes to improve pasting into length-limited fields.