1
votes

We are using TinyMCE as our text editor for the Wordpress portion of our site. Our problem is that TinyMCE does not wrap our copy in

tags by default, but instead it uses <span>.

This is not cool, because the person who updates our posts has to literally go into the html editor instead of the visual editor and manually add <p> tags. This is the only way she can guarantee that our post is not one big long paragraph. This person does not know anything about code, so this is a hardship for her.

I need to make TinyMCE react so that when she types a paragraph, and hits enter/return, it breaks to a new paragraph and wraps proper <p></p> tags around the text.

I tried to switch to CKEditor, but I was not able to embed YouTube videos or images with it. This is a major part of our blog, so I'm forced for now to stick with TinyMCE.

here's an example of what is generated for us:

<span style="color: #373737; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 19.5px;">
    ... sample text ...
</span>

I need this block of copy to look like this:

<p>
    ... sample text ...
</p>
2
by default tinymce created <p> tags not <span> tags - have you changed something in the configuration? - malta
not to my knowledge, but another dev could have. Where in the config files can i check this? - eloist
it depends on how it has been setup but there should be a linked .js file in each page where it is being used. - malta
would resetting the defaults change this behavior back to p instead of span? - eloist
could be any name... you need to look for tinyMCE.init({ }); - malta

2 Answers

0
votes

This is strange because normally Tinymce would break it into paragraphs. You do not need to add <p> tags in Wordpress html as this is done automatically even though it does not show inside the editor. Could it be a plugin conflict? --- Try disabling all plugins except TinyMce and then try typing a paragraph, and hit enter, to see if it breaks to a new paragraph and wraps. Does the paragraph break when you press enter with TinyMce disabled (so you know for sure its TinyMce causing the issue )? Then try again with all plugins disabled to make sure its not a theme issue. and if that all fails it may be a theme conflict with the plugin, are you using a pre-made theme or did you create it?

0
votes

You should check if the following tinymce parameter is set correctly (forced_root_block):

forced_root_block : 'p',