What is the meaning of "universal: true" from a slate.js example?

Viewed 82

What is the "universal: true" statement in the following code for?

isAziendaMarkActive(editor) {
    const [match] = Editor.nodes(editor, {
    match: n => n.isAzienda === true,
    universal: true,
})

Thanks so much, Elena

1 Answers

Setting universal: true returns the matching nodes if and only if all of the selected nodes match your query.

So, in your case, isAziendaMarkActive() would return false for the following selection:

<AziendaMark> A </AziendaMark>   B   <AziendaMark> C </AziendaMark>

but true for this:

<AziendaMark> A B C </AziendaMark>

See: https://github.com/ianstormtaylor/slate/issues/3248#issue-533523682

Related