I have a problem parsing the content of CKEditor. I have saved the data into mongoDB but when I retrieve the content to display, it shows the tags instead of parsing them.
The content had this formatting when I saved it. This is how I want it to display when I retrieve it from the database.
But this is the content I am getting when I retrieve from the database. I want it to apply the tags but not displaying them. so I can have the same formatting as I entered.
<p>The <strong>content had thi</strong>s formatting <em>when I saved it. This is how</em> I want it to display <strong><em>when I retrieve it from the database</em></strong>.</p>
My html page is the following when I tried to display the content:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<script src="https://cdn.ckeditor.com/4.8.0/standard/ckeditor.js"></script>
</head>
<body>
<div id="pgContent">
<div class="container">
<span class="line"></span>
<div id="msgContent" style="max-width:800px; font-size:16px;"><p>The <strong>content had thi</strong>s formatting <em>when I saved it. This is how</em> I want it to display <strong><em>when I retrieve it from the database</em></strong>.</p></div></div></div>
</body>
There is not jquery/javascript added to it. I added javascript but it is transforming the div into an editor again:
CKEDITOR.replace('msgContent',
{
entities: false,
basicEntities: false,
entities_greek: false,
entities_latin: false,
htmlDecodeOutput:true,
}
I used the following when writing the message:'
CKEDITOR.replace('msgEditor')
Update : The data in the database (mongoDB) is shown as follow:
<p>The <strong>content had thi</strong>s formatting <em>when I saved it. This is how</em> I want it to display <strong><em>when I retrieve it from the database</em></strong>.</p>\r\n
Thank you for now
According to Handlebars docs:
So, in your template change
{{message.content}}
to{{{message.content}}}