1

Topic: Dont want text wrapped in <p> tags

I've read the wiki and tried the suggestions, but I can't seem to get the tinymce to stop wrapping the text in paragraph tags <p>....

<p>text that I added to the site that I dont want wrapped in a paragraph tag</p>

Basically, all I want the tinymce wysiwyg is to allow people to create line breaks.  I'm very aware that wrapping text in a paragraph tag is valid xhtml, but I dont need or want this for my particular application of it's use.  How do I stop it from doing it?

Thank you in advance!

2

Re: Dont want text wrapped in <p> tags

Perhaps my question isn't understood.

I dont care if the tinymce WYSIWYG adds paragraph (<p>) tags within the text, however, I dont want it to wrap the content in them.  The reason being, I have several situations where I have several dynamic elements, and I can't have them display inline because the paragraph tag will bump it down.  I already have the region wrapped in paragraph tags making it valid xhtml strict.  How do I stop tinymce from wrapping all of the text in <p> tags.?

3

Re: Dont want text wrapped in <p> tags

I have the same p-problem!

Quite a few dynamic elements and they need to be inline with adjoined description texts. Also I dont want no extra white space on dynamically created pages. In my case TinyMCE is most of the time "off", not in use. User writes the content in to a textarea with plain text and predefined css takes care of all the fonts, colors, sizes etc. But to allow user occasionally enhance his or hers text, one can turn TinyMCE "on" and it can be done - only there is these <p> tags everywhere changing the layout.
Is there a way to go around that? That is, without paragraph-tags aroud an entry?

Did you "cmiwebstudio" ever find a solution to this?

4

Re: Dont want text wrapped in <p> tags

http://wiki.moxiecode.com/index.php/Tin … lements.3F

Best regards,
Spocke - Main developer of TinyMCE

5

Re: Dont want text wrapped in <p> tags

Thank you.  I've already read that and it really doesn't address my question.  I dont want tinymce to wrap the text in any kind of html tag... not P, not BR... nothing.  Within the text, I don't care what it does, as long as it does wrap the entire lot of content in an html tag.

6

Re: Dont want text wrapped in <p> tags

"simply post process them away by replacing <p with <span and </p> with </span><br />"

Best regards,
Spocke - Main developer of TinyMCE

7

Re: Dont want text wrapped in <p> tags

how do i do that?

8

Re: Dont want text wrapped in <p> tags

css seems to do the trick for me. I just need to make sure there is no p-tag elsewhere in my pages that I need.
Interested to see if "spocke" tells us how to post processing p to span etc. happens.

Anyway, thanks for the "p { margin:0; padding:0 }"

9

Re: Dont want text wrapped in <p> tags

Do it on the server side before presentation. In PHP or .NET or what ever. But styling the paragraphs is the way to go. This is exactly how Office works. And we use Office as a benchmark for TinyMCE since most non technical users need a similar environment.

Best regards,
Spocke - Main developer of TinyMCE

10

Re: Dont want text wrapped in <p> tags

Wouldn't that just run all the paragraphs together rather then removing the wrapping P tag that tinymce adds?  I dont want to effect all the text formatted within the user input, only remove P tags from the outer container of that content, as added by tinymce.  It's a simple question and it appears no one has that answer.

11

Re: Dont want text wrapped in <p> tags

This statement in the documentation is utterly amazing:
--------------------
We have never seen one single valid reason why paragraphs must not be used unless it's for e-mail software or for integration with Flash, and both cases can and should be solved with post processing if you want the user to be able to modify the contents again with TinyMCE. If you have a good reason please drop us a e-mail describing it and I will put it on my exceptions list.
--------------------

The reason is quite simple.  <p> tags are styled by the user.  Why would we want to change the user's code?

I don't want <p> tags inserted.  Period. I have tried the suggested init below and I am still getting <p> tags everytime I add a line and hit the 'enter' key.   <p> tags should only be inserted when the user highlights a text and then selects the 'paragraph' in the styles dropdown.   Post-processing cannot determine which tags were added by TinyMCE and which were originally in the code.

Why is TinyMCE still inserting <p> tags?

forced_root_block : false,
    force_p_newlines : 'false',
    remove_linebreaks : false,
    force_br_newlines : true,              //btw, I still get <p> tags if this is false
    remove_trailing_nbsp : false,   
    verify_html : false,

12

Re: Dont want text wrapped in <p> tags

Just style the p tag and remove all margin/padding.

As explained countless times, P tags are there for a reason.

Afraithe
TinyMCE Developer
Moxiecode Systems

13

Re: Dont want text wrapped in <p> tags

If you do that, then you remove all margin / padding for all p tags for the text generated.... which you don't want.  I don't want to remove Paragraph tags from the text either per instructions I've read, nor do I want to remove the padding/margin for them, I want to remove the paragraph tag that tinyMCE adds to wrap the text.  There's a big difference in this request.  This requires a minor modification of the script that powers tinyMCE, and I'm asking for directions with how to get there so I don't have to sift through lots of code unnecessarily.

14

Re: Dont want text wrapped in <p> tags

It is by no means a minor modification, <p> tags are a basic building block for WYSIWYG editors, without it you could not properly do lists etc.

Wrap your image in a container and assign a css to all <p> tags only in that container, then it will be localized.

Afraithe
TinyMCE Developer
Moxiecode Systems

15

Re: Dont want text wrapped in <p> tags

TinyMCE is wrapping tables in a p-tag too. So you get invalid html code.

16

Re: Dont want text wrapped in <p> tags

Fix your site. And use paragraphs as blocks of texts like they are intended and you should have no problems and a valid XHTML site. Or post process the P tags away before presentation like it's suggested in the FAQ.

Best regards,
Spocke - Main developer of TinyMCE

17

Re: Dont want text wrapped in <p> tags

It's definitely no problem of my site! Go to

http://tinymce.moxiecode.com/examples/full.php

Delete the content,
insert a table,
look at the HTML source,
you get:

<p>
<table border="0">
<tbody>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
</p>

This is invalid code in HTML and XHTML.

18

Re: Dont want text wrapped in <p> tags

I have to add:

In Firefox 3.0.5 and Opera 9.62 the table is wrapped in a p-Tag.

In Internet Explorer 7 and in Safari the table is not wrapped in a paragraph.

19

Re: Dont want text wrapped in <p> tags

There is an option that solves this issue. But we have been looking into making a more elegant solution for this problem.

http://wiki.moxiecode.com/index.php/Tin … e_elements

Best regards,
Spocke - Main developer of TinyMCE

20

Re: Dont want text wrapped in <p> tags

I've just implemented TinyMCE into a CMS that I'm building, in place of a custom jQuery-based rich-text-editor that I built myself.

The issue mentioned at the top of this thread is the main thing stopping me from using TinyMCE in the CMS, so a fix would be really appreciated.

I don't agree that this option isn't necessary in TinyMCE -

If the text coming from the database is:

  "example"
...then I don't want that to be turned into "<p>example</p>" when the user clicks save.


Similarly, I can't filter out the <p> tags on the server because if the text coming from the database is:

  "<p>example</p>"
then I don't want this to be turned into "example" when the user clicks save.

Is there any way to fix this yet?

Also, I don't understand Afraithe's comment:
"<p> tags are a basic building block for WYSIWYG editors, without it you could not properly do lists etc."

The rich text editor I've just built can do lists just fine, and doesn't rely on wrapping plain text content with a p tag. Unfortunately what I have is too basic so I was hoping to move to TinyMCE.

21

Re: Dont want text wrapped in <p> tags

Correction - after writing all that I saw the following options listed above:

    forced_root_block : false,
    force_p_newlines : 'false',
    remove_linebreaks : false,
    force_br_newlines : true,              //btw, I still get <p> tags if this is false
    remove_trailing_nbsp : false,   
    verify_html : false,

Setting all of these has fixed it for me.

22

Re: Dont want text wrapped in <p> tags

penx wrote:

Correction - after writing all that I saw the following options listed above:

    forced_root_block : false,
    force_p_newlines : 'false',
    remove_linebreaks : false,
    force_br_newlines : true,              //btw, I still get <p> tags if this is false
    remove_trailing_nbsp : false,   
    verify_html : false,

Setting all of these has fixed it for me.

This worked for me too.  Godsend...as the <p> tag was really screwing some stuff up for me.  Couldn't to a stylesheet to format the tag...that messed up more than it fixed.

23

Re: Dont want text wrapped in <p> tags

From reading this thread, it seems that changing those settings removes <p> tags from everything in the editor, but that's not what I'm looking to do. The CMS I'm working with uses certain tags within content on a page to display images, (placing {image_1} inbetween lines now outputs <p><img /></p> but should just output <img />). I've tried removing all formatting, but it still spits out the <p> tags. I've tried editing the HTML with the HTML button, but it still reverts back to <p> tags. Any help on removing TinyMCE formatting just where I'd like it to would be greatly appreciated! Great product otherwise!

24

Re: Dont want text wrapped in <p> tags

Use a server-side cleanup!

Greetings from Germany,

Felix Riesterer.
(-> about me and this forum <-)

25

Re: Dont want text wrapped in <p> tags

Thanks Felix. I've never done a server-side cleanup of code, so am not sure where to begin or what functionality that approach would have. Could you point me to some resources or beginner guides? Much appreciated!