Render widget decorations inside inline decorations

Is it possible to render widget decorations inside inline decorations?

In prosemirror-invisibles, we’d like to ensure that our decorations representing invisible characters appear ‘inside’ the notes created by prosemirror-noting. This mostly works out of the box, but there are situations where the spans rendered by inline decorations that represent notes are broken by other nodes, or parent node boundaries – for example, when a hard break node is present. We’d like to keep the hard-break and pilcrow invisible chars inside the note, but at the moment, they appear outside:

Screenshot 2022-09-21 at 08.39.16

At first I reached for the widget deco’s side property, before experimenting and remembering that widget decorations do not render within inline decorations at all.

Because of the nature of the invisible chars we’d like to include, we can probably hack around this with styling, but am I right in thinking that this is currently not possible?

I think the marks option Decoration.widget should allow you to do this.

1 Like

Ah, yep – it might not have been clear, but I’d forgotten that the spans I was seeing were generated by marks, not inline decorations :man_facepalming: – thanks!