I defined a NodeSpec:
test: {
content: "paragraph+",
isolating: true,
parseDOM: [{tag: `div[data-name="test"]`}],
toDOM() { return ["div", {"data-name": test, data-value: "..."}, 0] }
}
When I call state.toJSON()
, it generates for this node something like this:
"type": "test",
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": ""
}
]
}
]
I want to have some attributes, say data-value
, in the output as well.
At first I guessed I might add a function property toJSON
to the NodeSpec to make it work.
Then I checked the reference. There is no such property in NodeSpec interface.