Hi All,
When i write html (like & nbsp; or just < br>) its shown as it is.
I mean that its not processed as hard space or newline but i really see it as & nbsp; or just < br>
is possible somehow to turn html processing on?
Could you please provide a code sample.
for example in this template its not transformated
<template>
<!-- Left panel with cover effect-->
<div class="panel panel-left panel-cover panel-init">
<div class="view">
<div class="page">
<div class="page-content">
<div class="list no-hairlines-between no-chevron no-hairlines">
<ul>
<li> </li>
<li> </li>
<li> </li>
</ul>
</div>
</div>
</div>
</div>
</div>
</template>
What Javascript are you using to render the HTML?
just fix the<br>
tag . so <br>
must be <br/>
For template before i not use javascript its writen derectly to page as hardcoded text
New note: if < br/> is used directly in template then it works (& nbsp; not working)
but when i try to insert it like ${MY_VARIABLE_WITH_BR_INSIDE} then its encoded (& lt;br/& gt;)
Found the solution
Problem is that if you use variable ${MY_VARIABLE_WITH_BR_INSIDE} thne BR tag is encoded
so now in app,js I have function
window.nl2br = function (text,reverse = false){
if(text != null && text.length > 0) {
if(reverse){
return text.replace(/(<br>|<br\/>|<br \/>)/mgi, '\n');
}else{
return text.replace(/(?:\r\n|\r|\n)/g, '<br/>');
}
}else{
return text;
}
};
in app.css
.text-wrap {
overflow: visible;
word-break: break-all !important;
white-space: pre-line !important;
}
next in html
<p class="padding text-wrap"> ${nl2br(MY_VARIABLE_WITH_BR_INSIDE,true)} </p>