Fix IE problem with caret disappearing or not moving on ENTER.
Happens with EnterKeyHandling plugin when blockNodeForEnter=BR (the default setting
for an editor without any plugins explicitly specified).

Also fixes FF problem on ENTER with caret moving to beginning of current line,
rather than beginning of next line.

Code changes:

- this.editor.selection.collapse(true) doesn't work well when the selection is the \n at the end of a document.
  So trim() whitespace from the end of the document on load.
- Don't call remove() on the current selection as it causes havoc with the caret.
  Code to call remove() was added in 08c381738d5c1da53099db51848d94fde3c3249d for #12008,
  to remove the &nbsp added, but now I'm handling this in _stripTrailingEmptyNodes()

Unfortunately this change needs to be manually tested,
since doh/robot doesn't know where the caret appears visually.

Fixes #17745, refs #12008.
(cherry picked from commit f569ab4d48ab9a225f12eae3bdf423abcd25e84f)