INNER CODE UNIT · TypeScript

removeAutoLinksInRange

software-mansion/react-native-enriched-html · src/web/pmPlugins/AutolinkPlugin/index.ts:29

function removeAutoLinksInRange(
  doc: Node,
  tr: Transaction,
  linkType: MarkType,
  from: number,
  to: number
): void {
  if (from >= to) return;

  doc.nodesBetween(from, to, (node, pos) => {
    if (!node.isText) return true;

    const link = linkType.isInSet(node.marks);
    if (link?.attrs.auto === true) {
      tr.removeMark(
        Math.max(from, pos),
        Math.min(to, pos + node.nodeSize),
        linkType

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…