Home
TeamSite
tinymce - how to remove new line
System
I am just starting to implement tinymce and see that when you hit enter it puts in 2 lines. I read that using force_p_newlines=false would prevent this. I looked at the TeamSite FormsPublisher
Developer’s Guide and found the section relating to this but I don't understand how to do this.
Find more posts tagged with
Comments
Migrateduser
Figured it out. Added the following to custom_content.css
p {margin:0; padding: 0;}
Jamik
and I assume you've gone ahead and added that same style to your websites that will eventually use this same content and the styles used by preview?
what you've done isn't necessarily a fix. You're purposely styling the <p> tag so that it doesn't appear as it normally would by removing that extra space it adds around the top and bottom. However, the side effect you've created is that unless you've moved the same style definition to all your webservers your users will see incorrect styles in their WYSIWYG editor than what really appears on the websites that uses that content. So now you're users could potentially be confused why it's showing up one way in the editor and another way on the website or even in the preview.
Migrateduser
I figured there would be some issue. I discovered that users can use shift+enter to get a single line. But I don't think that will be acceptable.
Do you know of another way to prevent extra line breaks in the editor besides the css change?
Jamik
well, first I would suggest you should get a better understanding of HTML and figure out how you want your content structured. That extra space that's showing up is perfectly normal since that's the normal behavior of <p> tags. The only way you're going to avoid that extra space is by the CSS change you made (which I doubt you'll want to replicate on the live website) or you change TinyMCE to use <br> instead of <p> which you can do by setting the force_br_newline in the .js files that come with tinymce. However, my recommendation is you leave it the way it comes OOTB since that's normal HTML behavior and using <br> isn't good for semantically structured content. Basically, it just comes down to do you want to explain to your users why an extra space is there or make a change you'll have to keep track of and also explain to your users why it looks different in the WYSIWYG vs the live site.
Migrateduser
When I hit enter in the box on this forum, guess what, it just gives me one line, amazing!!! Ooohhhhh, awwwww!!! What's wrong with me asking for the same functionality out of TinyMCE? Notepad, Textpad, Wordpad, MSOffice. etc, etc, all give me a single line. If you truly understood end users requests, then you would understand why I think the enter key should only output one line. It's WYSIWG, shouldn't what you see in your editor window look the same as what you see on the page?