【问题标题】:Apostrophe removing characters in help in schema when using a pipe使用管道时删除模式帮助中的撇号
【发布时间】:2020-03-10 08:35:24
【问题描述】:

我正在创建的作品中有一个字段架构。为它添加一个带有管道的帮助值会删除管道之前的所有文本。

例如

{
  name: 'text_example'
  type: 'string',
  help: 'Key value pairs, e.g. key|value',
  textarea: true
}

导致字段上的帮助文本显示“值”

它正在被清洗吗?有必要吗?我已经尝试了所有类型的方法来尝试让它工作,使用 html 和 ascii 代码添加转义字符 \。使用 String.fromCharCode(124)。文本中不允许有竖线。

【问题讨论】:

    标签: apostrophe-cms


    【解决方案1】:

    help 字符串正在通过 i18n 模块运行,该模块在管道字符周围存在已知问题。

    一种解决方法是使用htmlHelp 属性而不是标准的help 字段属性并像这样转义管道

     {
      name: 'test',
      label: 'Test',
      htmlHelp: 'Extending this logic, the chive of \| a rocket becomes an undamped wholesaler.',
      type: 'string'
     }
    

    这通过 Nunjucks safe 过滤器运行,该过滤器翻译实体。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-07-18
      • 1970-01-01
      • 2022-08-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-08
      相关资源
      最近更新 更多