code: function isCaretAtStartOrEndOfBlock(start) {
            var walker, node, name;
  
            // Caret is in the middle of a text node like "a|b"
            if (container.nodeType == 3 && (start ? offset > 0 : offset < container.nodeValue.length)) {
              return false;
            }
  
            // If after the last element in block node edge case for #5091
            if (container.parentNode == parentBlock && isAfterLastNodeInContainer && !start) {
              return true;
            }
  
            // If the caret if before the first element in parentBlock
            if (start && container.nodeType == 1 && container == parentBlock.firstChild) {
              return true;
            }
  
            // Caret can be before/after a table
            if (container.nodeName === "TABLE" || (container.previousSibling && container.previousSibling.nodeName == "TABLE")) {
              return (isAfterLastNodeInContainer && !start) || (!isAfterLastNodeInContainer && start);
            }
  
            // Walk the DOM and look for text nodes or non empty elements
            walker = new TreeWalker(container, parentBlock);
  
            // If caret is in beginning or end of a text block then jump to the next/previous node
            if (container.nodeType == 3) {
              if (start && offset === 0) {
                walker.prev();
              } else if (!start && offset == container.nodeValue.length) {
                walker.next();
              }
            }
  
            while ((node = walker.current())) {
              if (node.nodeType === 1) {
                // Ignore bogus elements
                if (!node.getAttribute('data-mce-bogus')) {
                  // Keep empty elements like <img /> <input /> but not trailing br:s like <p>text|<br></p>
                  name = node.nodeName.toLowerCase();
                  if (nonEmptyElementsMap[name] && name !== 'br') {
                    return false;
                  }
                }
              } else if (node.nodeType === 3 && !/^[ \t\r\n]*$/.test(node.nodeValue)) {
                return false;
              }
  
              if (start) {
                walker.prev();
              } else {
                walker.next();
              }
            }
  
            return true;
          }
docs: Returns true/false if the caret is at the start/end of the parent block element