Copy-pasting overlapping marks of the same type

I have a highlight mark set up so that it is possible to have overlapping unique highlights. I achieved this by setting excludes: "" in the spec and assigning each highlight a unique id attribute.

const highlightNodeSpec = {
  attrs: {
    id: {default: null}
  excludes: "",
  toDOM: mark => { return ["highlight", {id:}] },
  parseDOM: [{
    tag: "highlight[id]",
    getAttrs: dom => {
      return {id: dom.getAttribute("id")}

When overlapping highlights are created the state stores multiple marks in a TextNode corresponding to the overlapping part of the highlights.


The overlapping highlights are rendered in the DOM as nested elements.


I inspected the clipboard when copying overlapping highlights and the document fragment stored there contained the nested elements like in the DOM, however when I paste the overlapping highlights the inner highlight of the overlapping portion is lost.

I’m curious if anyone has has a similar issue with overlapping, unique marks of the same type. It seems like I could write a clipboardParser to to handle this, but I wanted to make sure it’s not just an issue with parseDOM in the schema.

That sounds a bit like a bug in DOMParser. You could try creating a test case in the test suite (prosemirror-model/test/test-dom.js) to verify this, and maybe debug what’s going on.