Summernote editor. Reading data from a database MongoDB

I installed “summernote: summernote” in “mpowaga:autoform-summernote”. Data entered in the editor Summernote writes in the collection of data using "SimpleSchema "in the form:
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 thetypeattribute to yourafFieldInputcomponent, or to a component that wraps anafFieldInput(such asafFormGrouporafQuickField), or to theautoformobject 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.

After baking such code:
<p> {{wydarzenie.content}} </ p>

in the template receives such a result in the browser:
<p> "<div> Beginning with AutoForm 4.0, there is advanced support for input types, Including the ability that easily add custom input types (AKA forms of controls or" widgets "). ...</ div> "</ p >

Use triple braced template tags like {{{wydarzenie.content}}} to insert raw HTML (but be careful - you’ll have to make sure the HTML is safe).

1 Like

Thanks for the help.
When it comes to security, you mean sanitize packages

Yes exactly - either make sure you have complete control over the generated HTML, or make sure it’s sanitized (since you’re getting it from a WYSIWYG you will want to sanitize it).