H2 not recognized when pasting HTML?

Hi,

I’m having some problems with performing copy+paste into Prosemirror. The following code illustrates my problem:

pm.on("transformPastedHTML", function(text)
{
    return "<h2>alpha</h2><p>beta</p>";
});

The result, after pasting some random HTML into the editor is that the <h2> element is not recognized as such.

What could be wrong?

This sounds like the same problem as issue #231. Is it?

Yes I guess so. If I add another <p> element in front, then the <h2> is recognized correctly.

But still I find it curious, because as I understand it, a H2 element cannot exist inside a P element in HTML, [1].

As a user, I would expect that if I paste a block consisting of a heading followed by a paragraph (perhaps repeated a number of times), that the heading styles would be preserved.

Anyway, this is not super important for me right now. I bumped into this because of another issue.

[1] http://stackoverflow.com/questions/15656785/should-a-heading-be-inside-or-outside-a-p

Yes, it’s bad. That’s why the issue is still open.