Fix range errors on book change.

avoid rangeError by setting endOffset to 1 and calling collapse()