rangeToGlobalOffset = (range, root) => {
  const globalOffsets = [
    findGlobalOffset(range.startContainer, range.startOffset, root),
    findGlobalOffset(range.endContainer, range.endOffset, root),
  ];

  return globalOffsets;
}
Convert Range to global offsets relative to a root
@param {Range} range
@param {Node} root