Fixes #780 (OutOfIndex).

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