Feature Request: RenderHTML should receive a position #5030
matthewfinger
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
It would be very helpful if, along with the
HTMLAttributes
, therenderHTML
method of a Node or mark received apos
attribute so we can see things like it's path and parent offset (for example viathis.editor.$pos(pos)
).Use Case
There are cases where the type of Element a node uses depends on it's location.
For some background on my team's specific use case, we have basic 'box' feature in our built where each box can have a title, float behavior, and the box's content is
boxtitle block*
. The challenge comes in when we added a collapsible option: in this case it should use details/summary. Then I could do something likeNow, for me I could use the details/summary pro plugin but imo checking the position would be simpler. specifically we decided to just make the collapsible option a global attribute for the box and title, then set the title's attribute when changing the box itself.
I'm also sure as people attempt more complex features it will come up more often
Type
New Tiptap API
Beta Was this translation helpful? Give feedback.
All reactions