INNER CODE UNIT · TypeScript

from

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

      const from = Math.max(0, rest.map(newStart, -1) - 1);
      const to = Math.min(docSize, rest.map(newEnd, 1) + 1);

      doc.nodesBetween(from, to, (node, pos) => {
        if (node.type.name === 'codeBlock') return false;

        if (node.inlineContent && !blocks.has(pos)) {
          blocks.set(pos, node);
          return false;
        }

        return true;
      });
    });
  });

  return Array.from(blocks, ([pos, node]) => ({ pos, node }));
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…