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

时间:2016-01-27 11:24:30

标签: javascript meteor meteor-blaze

我在“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而不是文本。

1 个答案:

答案 0 :(得分:1)

为了使它正式化,我还要将其作为答案添加,并在his post中引用Ronak Nagda:

  

三重花括号模板标签{{{...}}}用于包含原始HTML   在你的页面内。您应谨慎使用这些标签并确保   这里的HTML内容是安全的,没有语法错误。

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