Hey, I am working on upgrading to the latest versions of the ProseMirror libraries. I suddenly ran into two issues of marks on block nodes:
I have an “insertion mark” that I put on inline content to mark some data about the content it uses a
<span> to wrap around the content that is marked. I noticed that differently from before, with the newest version of ProseMirror, in case a figure is inserted and it has this mark, in the DOM representation of it, the outermost
<figure>...</figure> is replaced with the
<span>...</span> from the insertion mark.
Secondly, I wondered why there is an insertion mark on the figure at all. After all, in the spec of the figure
inline=false and I’m using the
replaceSelectionWith function. I don’t specify
inheritMarks, but according to the documentation in the code , the marks will only be copied if the inserted node is an inline node.
I’ve tried to specify
inheritMarks when calling
replaceSelectionWith , and that seems to have fixed the problem.
PS: I think I may have misunderstood the documentation of
replaceSelectionWith. It says:
inheritMarksis true and the content is inline, it inherits the marks from the place where it is inserted.
I assumed that “content” was referring to the node that I am trying to insert. But it probably refers to the content into which I am trying to insert a new node. That would explain the second issue.