繁体   English   中英

Meteor.js Summernote编辑器。 从数据库MongoDB读取数据

[英]Meteor.js Summernote editor. Reading data from a database MongoDB

我在“ mpowaga:autoform-summernote”中安装了“ summernote:summernote”。 在编辑器Summernote中输入的数据使用“ SimpleSchema”以以下形式写入数据集合:

content: {
      type: String,
      label: "Treść wydarzenia",
      autoform: {
        afFieldInput: {
          type: 'summernote',
          class: 'editor',
          placeholder: 'Please add content...',
          settings:{
            height: 150
          }
        }
      }
    },

这是数据库中给出的示例:

"content" : "<div>Beginning with AutoForm 4.0, there is advanced support for input types, including the ability to easily add custom input types (AKA form controls or \"widgets\"). An input type definition is essentially just a small template containing the markup plus a function that tells AutoForm how to obtain an input value from that template.</div><div><br></div><div>By default, AutoForm still automatically selects an appropriate input type based on examining the schema for each field. To override that behavior and choose your own type, you only need to add the `type` attribute to your `afFieldInput` component, or to a component that wraps an `afFieldInput` (such as `afFormGroup` or `afQuickField`), or to the `autoform` object in your schema for the field.</div><div><br></div><div>Select an input type to see all the different ways in which that type can be used in your form. Select a schema type, open your browser console, enter a value, and click Submit to see how the value of the field is converted to the proper type requested by the schema.</div>"

如何读取数据收集的数据“内容”以将包含的内容显示为HTML而不是文本。

为了正式起见,我也将其添加为答案,并在Ronak Nagda 的帖子中引用:

三元括号模板标签{{{…}}}用于在页面中包含原始HTML。 您应谨慎使用这些标签,并确保此处的HTML内容安全且没有语法错误。

在这种情况下,它将是{{{wydarzenie.content}}}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM