Cannot specify sequence of nodes in node schema

I’m getting started working with Schemas, and I’m trying to specify sequence of different nodes as the “content” for a given node.

I’m approaching this according to schema documentation on “Content Expressions”:

Such expressions can be combined to create a sequence, for example “heading paragraph+” means ‘first a heading, then one or more paragraphs’.

However, when using such a sequence, the content does not render.

Example in Glitch. This is a remix of the prosemirror-basic-example, I’ve just edited mySchema and the contents of the HTML #content div.

Based on the documentation I referenced above, I’d expect that setting the “content” for “exchange” as “foo bar” should mean “Exactly one ‘foo’, followed by exactly one ‘bar’.” However, despite providing this format, it doesn’t render.

There doesn’t seem to be any issue with rendering either “foo” or “bar” individually. If I comment out the HTML & schema for “foo” and leave exchange’s “content” as just “bar” it renders “bar” as expected, and the reverse works as expected too.

But having exchange’s content as “foo bar” renders nothing.

Schema:

const mySchema = new Schema({
  nodes: {
    doc: {content: "exchange+"},
    exchange: {
      content: "foo bar",
      toDOM(node) { return ["exchange", 0] },
      parseDom: [{tag:"exchange"}],
    },
    foo: {
      toDOM(node) { return ["foo", 0] },
      parseDom: [{tag:"foo"}],
      content: "text*"
    },
    bar: {
      toDOM(node) { return ["bar", 0] },
      parseDom: [{tag:"bar"}],
      content: "text*"
    },
    text: {inline: true}
  }
});

HTML “content” div:

<div style="display: none" id="content">
  <exchange>
    <foo>
      This is Foo
    </foo>
    <bar>
      This is Bar
    </bar>
  </exchange>
</div>

The problem is that you’re using parseDom instead of parseDOM as property names, which is causing the library to ignore your parse rules.

Oops… thank you!