What’s the recommended way to unfurl some links in Prosemirror? e.g. replace
<a href="youtube.com/myvid">My Vid</a> with
<a href="youtube.com/myvid"><img src="thumbnail.jpg"></a>
- Not all links should be unfurled (depends on what they are linking to or user preference)
- Links that are not unfurled should be transparent (their inner content should be editable as usual)
- Unfurled links should be opaque (their inner content should not be editable)
- Links are unfurled asynchronously. They initially appear as normal until the thumbnail/metadata is retrieved.
Possible solution using custom markview:
You can conditionally assign a custom MarkView to links that should be unfurled so the
dom of the MarkView would include the unfurled representation. However, the MarkView does not support a customDOM element necessary for making the inner content of the link editable while the thumbnail/metadata is being retrieved. There is an open PR for allowing markview to specify a contentDOM element.
Perhaps someone knows of an alternative solution. There was a question of whether decorations could be used but I don’t see how.