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
I've been noticing that when you add content to a richText editor,
tags are automatically created. Is there a way to prevent this?
I ask because I've nested the umbraco content fields within their correctly styled
tags in the code already, so that only content is added in the content editor, and users do not have to worry about correctly styling the content they add to the richText editor.
For example, I pre-styled the umbraco content fields below:
Any suggestions? Also, any advice regarding best practice for this topic? I imagine it will be quicker to remove the
tags in the richText editors, than to remove them from every page of code (which will be quite tedious and take a very long time). Also, I imagine that best practice would be to prevent users from having to worry about styling paragraphs, etc., since that should already be done in the html5 code.
I've noticed that my code contains double
tags for every umbraco field added.
I ran into this problem on a recent project too. I opted to simply remove the paragraph tags. I also created a regex to validate the input so users are unable to enter more than one paragraph, and I added descriptions to those properties instructing users to enter only a single line of text.
Another option, probably much more involved, would be to create a custom property editor that uses a plugin (maybe not tinyMce) that has an option to allow for text to be entered without a surrounding paragraph.
If somebody has other approaches, I'd also be curious to hear them.
Maybe removeParagraphTags can solve this issue
What about RemoveFirstParagraphTag method? Did you try it?
Alex, where would we add this?
In place where do you want to render content from RTE
Thanks everyone, I will check the methods out.
To get around it quickly, I just inserted the fields without
tags surrounding it.
From the "dark ages" is this post...
Near the end of the tinyMceConfig.config file you can amend the validElements and change "#p" to "-p" which from memory did help prevent empty paragraphs being added by default.
Not sure it totally answers / solves the issue, but thought I'd mention it.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted