const clamp = function (offset, element) { const max = Node.isText(element) ? Text.get(element).length : Traverse.children(element).length + 1; if (offset > max) { return max; } else if (offset < 0) { return 0; } return offset; };
const isPaddingContents = function (elm) { return Node.isText(elm) ? Text.get(elm) === '\u00a0' : ElementType.isBr(elm); };
const isZeroWidth = (elem): boolean => { // TODO: I believe this is the same cursor used in tinymce (Unicode.zeroWidth)? return Node.isText(elem) && Text.get(elem) === Unicode.zeroWidth(); };
const checkLast = function (last) { return !Attr.has(last, 'data-mce-bogus') && Node.name(last) !== 'br' && !(Node.isText(last) && Text.get(last).length === 0); };