Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please describe your changes
This PR implements a new "NodePos" feature to Tiptap. It allows users to access the state of the document similar to the browser DOM to access specific elements.
As a first draft you'll be able to run things like
querySelector
,querySelectorAll
,closest
,before
,after
, and more.How did you accomplish your changes
I added a new class that will be used to track Node Positions and expose an API for easier traversion of nodes in the document itself. I added those as exported values but also to the editor object itself. It can be accessed via
for example
How have you tested your changes
I've run local tests for now to verify my changes were working. I'll probably add tests to this PR asap so we don't run into issues later down the line.
Remarks
I'd like to get this done and into a new major or minor version as this is quite a big new feature.
Checklist