function setSelection (range) {
  if (range) {
    if (window.getSelection) {
      const sel = window.getSelection()
      sel.removeAllRanges()
      sel.addRange(range)
    }
  }
}
Set text selection
http://stackoverflow.com/questions/4687808/contenteditable-selected-text-save-and-restore
@param {Range | TextRange | null} range