Skip to content

Find a node by attribute value #1946

Discussion options

You must be logged in to vote

Answered in discord, but for future reference if it might have somebody looking for similar issue, here's a possible solution (that I didn't test):

editor.state.doc.forEach(node, offset) => {
  if (node.attrs.id === yourId) {
    editor.chain().setNodeSelection(offset).scrollIntoView().run();
  }
});

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by iamursky
Comment options

You must be logged in to vote
1 reply
@iamursky
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants