let found = -1
doc.nodesBetween(pos, doc.content.length, (node, pos) => {
if (found > -1) return false
if (isMyNode(node)) found = pos
})
if (found > -1) console.log("there's a node at", found)
Hey @tslocke, I adapted this logic to work to my needs, but the general idea of the shared code helped me with the solution, on the specific case of looking backward I ended up searching from position 0 up to the node in question.
let found = -1
editor.view.state.doc.nodesBetween(0, pos, (node, pos) => {
if (isMyNode(node)) {
found = pos;
}
})
if (found > -1) {
return {pos: found}
}
return null```