parseDOM for tab

I created a node for inserting tabs:

tab: {
	inline: true,
	group: "inline",
	parseDOM: ???
	toDOM() { return ["span", { style: "white-space:pre" }, "\t"] }	}

which I then use in buildKeymap like this:

  function insertTab(state, dispatch) {
    return true
  if (type = {
    bind("Tab", insertTab)

This all works quite well.

I need help writing the parseDOM method for the node. How do I parse the tag (span), white-space:pre style and the internal tab character ?

thanks !

1 Like

Iā€™d give the span a class of tab and a parse rule like [{tag: ""}].

1 Like