简体   繁体   English

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

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

I installed "summernote: summernote" in "mpowaga:autoform-summernote". 我在“ mpowaga:autoform-summernote”中安装了“ summernote:summernote”。 Data entered in the editor Summernote writes in the collection of data using "SimpleSchema "in the form: 在编辑器Summernote中输入的数据使用“ SimpleSchema”以以下形式写入数据集合:

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

This is the example given in the database: 这是数据库中给出的示例:

"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>"

How to read data 'content' of data collection in order to display the contained content as HTML rather than as text. 如何读取数据收集的数据“内容”以将包含的内容显示为HTML而不是文本。

Just to make it formal, I'm gonna add this as an answer as well and quote Ronak Nagda in his post : 为了正式起见,我也将其添加为答案,并在Ronak Nagda 的帖子中引用:

Triple-curly braced template tags {{{…}}} are used to include raw HTML within your page. 三元括号模板标签{{{…}}}用于在页面中包含原始HTML。 You should use these tags cautiously and make sure the HTML content here is safe and free from syntax errors. 您应谨慎使用这些标签,并确保此处的HTML内容安全且没有语法错误。

In this case it would be {{{wydarzenie.content}}} 在这种情况下,它将是{{{wydarzenie.content}}}

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

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