INNER CODE UNIT · TypeScript
rangeHasExactAutoLink
software-mansion/react-native-enriched-html · src/web/pmPlugins/AutolinkPlugin/index.ts:75
function rangeHasExactAutoLink(
doc: Node,
linkType: MarkType,
from: number,
to: number,
href: string
): boolean {
let hasExact = true;
let hasText = false;
doc.nodesBetween(from, to, (node) => {
if (!hasExact) return false;
if (!node.isText) return true;
hasText = true;
const link = linkType.isInSet(node.marks);
if (!link || link.attrs.auto !== true || link.attrs.href !== href) {
hasExact = false;