parseDOM rule with a class

Hi, I want to create a parse rule for a mark based on a class. So my mark is called ‘highlight’, i’m applying a certain class by having

toDOM() { return [“span”,{class: “highlight”}, 0] }

for parsing I tried parseDOM: [‘span’, {class: “highlight”}, 0] but that doesn’t seem to work. My guess is that I need to use getAttrs to make it work? Is that right? Is there a better way?

Thanks, Ivan

You can use a CSS selector "span.highlight" (though your parseDOM spec seems generally invalid—check the docs for how parse rule objects should look)

Ah yes, I pasted the wrong thing, I was meant to write [{class: ‘highlight’}].

Anyway, [{tag: ‘span.highlight’}] works, missed the bit where it says it’s css selector and thought it’s just a tag.