【发布时间】:2021-07-20 14:26:33
【问题描述】:
以下代码中的“universal: true”语句是干什么用的?
isAziendaMarkActive(editor) {
const [match] = Editor.nodes(editor, {
match: n => n.isAzienda === true,
universal: true,
})
非常感谢, 埃琳娜
【问题讨论】:
标签: slate
以下代码中的“universal: true”语句是干什么用的?
isAziendaMarkActive(editor) {
const [match] = Editor.nodes(editor, {
match: n => n.isAzienda === true,
universal: true,
})
非常感谢, 埃琳娜
【问题讨论】:
标签: slate
设置 universal: true 当且仅当 所有 所选节点与您的查询匹配时返回匹配节点。
因此,在您的情况下,isAziendaMarkActive() 将为以下选择返回 false:
<AziendaMark> A </AziendaMark> B <AziendaMark> C </AziendaMark>
但确实如此:
<AziendaMark> A B C </AziendaMark>
见:https://github.com/ianstormtaylor/slate/issues/3248#issue-533523682
【讨论】: