function getLastLeaf(node: any): Node {
  while (
    node.lastChild &&
    // data-blocks has no offset
    ((isElement(node.lastChild) &&
      node.lastChild.getAttribute('data-blocks') === 'true') ||
      getSelectionOffsetKeyForNode(node.lastChild))
  ) {
    node = node.lastChild;
  }
  return node;
}
Identify the last leaf descendant for the given node.