Copy pasting html that doesn't contain a block node strips marks away


Another bug report here. I noticed that pm doesn’t add marks properly to text that was copy pasted from outside of pm, if the html didn’t have a wrapper block node.

So if pasted html was something like <strong>foo<strong>, strong is not applied to foo when pasted. This doesn’t happen if html had wrapping block nodes (<p><strong>foo</strong></p>) which doesn’t happen frequently unless you had copied multiple blocks.

The bug is easily reproducible as this happens consistently. Gif added to showcase the bug. The console is showing clipboard data on paste.

Not sure if this is really the offending code, but just fyi - I see that the call doesn’t add the new marks because the node context doesn’t have type:

  addMark(mark) {
    let old = this.activeMarks
    if (this.type && this.type.allowsMarkType(mark.type))
      this.activeMarks = mark.addToSet(old)
    return old


This was a regression since prosemirror-model 1.4.1. I’ve released 1.4.3 with a fix.


I was just trying to upgrade from 1.4.0 to 1.4.3, but I’m still seeing a regression in my tests. The code looks something like this:

const wrapper = new JSDOM().window.document.createElement('div')
wrapper.innerHTML = '<a href="">Example</a>'
const parser = DOMParser.fromSchema(schema)
const node = parser.parse(wrapper)

With 1.4.0 I get the expected result with a link mark:


With 1.4.3 the link mark is missing:



That’s a different problem, but yeah, I’ve released 1.4.4 with a fix.


awesome, thank you for the fast fix!


That was fast, thanks so much!