trimSelection = (selection) => {
  trimSelectionLeft(selection);
  trimSelectionRight(selection);
}
Trims selection until both start and end are text nodes. We need this to make selection.move()
work properly. With non-text nodes it jumps into inner/outer blocks instead of actually moving.
Also removes leading and trailing spaces from selection.
@param {Selection} selection