I would like to define custom NodeView
that could also render some editable content from attributes based on mode. For example to define LinkView
that could expand from:
<a href="#address" title="title"><span>link<span></a>
to following when cursor is with-in the node range:
<a href=#address title=title>
<span class=markup>[</span>
<span class=name>link<span>
<span class=markup>](</span>
<span class=address>#address<span>
<span class=markup> </span>
<span class=title>"title"</span>
</a>
Problem I’ve run into is that if I expose span.name
as contentDOM
prose mirror treats my LinkView
as if it’s only content was link
(cursor positions anywhere in the address or markup fields remain same & edits there make cursor jump back to the end of the link|
).
Would it be possible & also make sense to let nodeView’s expose contentSize
field ? That would allow NodeView to render attribute and computed data with in itself.
Another alternative could be to allowing NodeView
to expose multiple fields for it’s content instead of just (contentDOM) to allow ProseMirror
to take care of rendering node’s children into designated containers.