Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hello, Umbracians.
I want to make very simple RTE as a one string or small sentence, and render it into the h tag with styles (like font color), like below
<h1>Hello <em>bright</em> world</h1>
But RTE always includes its content into paragraph. I want to clean up the RTE and render only content without paragraphs.
How to do it? Or may be some other aproach to make single string with styles and keep visual of result right in backoffice?
On your view, you can wrap this around your content to remove the <p> tag:
<p>
@umbraco.library.RemoveFirstParagraphTag(yourFieldHere)
I know about that way, but it removes only first paragraph. If user will create more then single one, it does't help :(
What about replacing all instances of <p> & </p> with an empty string? You could create a function to do it. Essentially it would be something like this:
</p>
@Html.Raw(yourField.ToString().Replace("<p>","").Replace("</p>",""))
Maybe someone else will have a more efficient answer, but that would be a quick fix for now.
Seems I need to sleep, don't know why I did't thought about it at first =)
Thanks. Darren!
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
How to clean up RTE from <p> tags?
Hello, Umbracians.
I want to make very simple RTE as a one string or small sentence, and render it into the h tag with styles (like font color), like below
But RTE always includes its content into paragraph. I want to clean up the RTE and render only content without paragraphs.
How to do it? Or may be some other aproach to make single string with styles and keep visual of result right in backoffice?
On your view, you can wrap this around your content to remove the
<p>
tag:@umbraco.library.RemoveFirstParagraphTag(yourFieldHere)
I know about that way, but it removes only first paragraph. If user will create more then single one, it does't help :(
What about replacing all instances of
<p>
&</p>
with an empty string? You could create a function to do it. Essentially it would be something like this:Maybe someone else will have a more efficient answer, but that would be a quick fix for now.
Seems I need to sleep, don't know why I did't thought about it at first =)
Thanks. Darren!
is working on a reply...