【问题标题】:What is the meaning of "universal: true" from a slate.js example?slate.js 示例中的“universal:true”是什么意思?
【发布时间】:2021-07-20 14:26:33
【问题描述】:

以下代码中的“universal: true”语句是干什么用的?

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

非常感谢, 埃琳娜

【问题讨论】:

    标签: slate


    【解决方案1】:

    设置 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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-18
      • 1970-01-01
      • 2017-12-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多