src/main/range-util.js/findCommonAncestor
function findCommonAncestor(startNodeAndParents, endNodeAndParents) {
  const startNodeAndAncestors = [
    startNodeAndParents.node,
    ...startNodeAndParents.parentNodes,
  ];
  const endNodeAndAncestors = new Set([
    endNodeAndParents.node,
    ...endNodeAndParents.parentNodes,
  ]);
  return startNodeAndAncestors.find(
    (node) => jsonSourceElements.has(node.type) && endNodeAndAncestors.has(node)
  );
}