Ensure we aren’t inserting a string outside of the length of the content editable string. Fixes #780.