in src/ts/utils/text-between.ts [8:20]
export default (from: number, to: number, doc: Node): Position[] => {
const positions: Position[] = [];
doc.nodesBetween(from, to, (node, pos) => {
if (node.isText) {
const offset = Math.max(from, pos) - pos;
positions.push({
pos: pos + offset,
text: node.text?.slice(offset, to - pos) || "",
});
}
});
return positions;
};