Skip to:
Content
Pages
Categories
Search
Top
Bottom

tinyMCE losing <p> formatting on Edit


  • chilledfresh
    Member

    @chilledfresh

    I’m using the latest version of tinyMCE in my bbPress forum, but have run into an issue while editing posts. This problem occurs in both TinyMCE AND FCKeditor, so it must be related to how bbPress handles these types of plugins.

    I can post new topics fine and everything works. However, when I go in to edit a post the WYSIWYG editor loses all <p> tags, forcing everything to appear on a single line. All other formatting is retained correctly by the editor.

    Any idea on how I can fix this problem?

Viewing 8 replies - 1 through 8 (of 8 total)
  • This also happens to me! However, I’ve never looked into it…

    I just looked, and bbPress uses newlines to indicate breaks. This is parsed into <p>’s by a filter upon display. However, the edit textarea shows the unparsed text with just the newlines, and this gets mangled by tinymce.

    If you set this tinymce config value, though, it will turn newlines into br’s, which should fix this problem for new posts:

    * http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/convert_newlines_to_brs

    I just tested this, and it works on new posts! (It won’t work on old posts…)


    Sam Bauers
    Participant

    @sambauers

    bbPress turns < p > tags back into double line breaks and < code > back into backticks ( ` ).

    You will need to somehow override this or force reconversion in TinyMCE or FCKeditor

    Sam, you’re right, but upon making that config change I described above, the editing problem that chilledfresh described went away on my site.

    I didn’t dig deeper, but that config change seems to resolve this issue.


    Florian
    Member

    @gquann

    Just in case anyone else (like me) stumbles over this thread on the search for an WYSIWYG editor. The problems discussed above seem to have disappeared. I just added TinyMCE 3.2.5 to my bbPress 1.0.1 installation and it works like a charm without modifications besides the removal of obviously unsupported elements.

    Cool. :)


    _Kumori_
    Member

    @_kumori_

    In functions.bb-formatting.php on line 62 there is this function:

    function bb_code_trick_reverse( $text ) {
    $text = preg_replace_callback("!(<pre><code>|<code>)(.*?)(</code></pre>|</code>)!s", 'bb_decodeit', $text);
    $text = str_replace(array('<p>', '<br />'), '', $text);
    $text = str_replace('</p>', "n", $text);
    $text = str_replace('<br />', '<br />', $text);
    $text = str_replace('<p>', '<p>', $text);
    $text = str_replace('</p>', '</p>', $text);
    return $text;
    }

    In my theme’s functions.php file I made a filter that replaces this function with my own that simply removes the $text = str_replace('</p>', "n", $text); and $text = str_replace(array('<p>', '<br />'), '', $text); lines and that took care of it for me when I integrated FCKeditor into my forum.


    Florian
    Member

    @gquann

    Oops, you’re right. Upon closer inspection it did not work without changes for me.

    Instead of changing the bbPress side, I decided to make TinyMCE a bit more bbPress compliant. I wrote a little plugin which posts double line breaks instead of paragraphs. You can find it here:

    http://www.kreativrauschen.com/blog/2009/07/12/bbpress-compatibility-plugin-for-tinymce/

    I’m having a problem with bbpress 1.01 and tinyMCE, when I post an image I find a ‘br’ (linebreak) inside the image’s ‘alt’ value. Same thing with a link…I find a ‘br’ inside the ‘href’ value..

    Anyone experiencing the same problem?


    chrishajer
    Participant

    @chrishajer

    Are you using the Allow Images plugin, or allowing images some other way?

    There was a recent thread about this exact problem but I can’t find it offhand.

    UPDATE: Never mind, it was you posting the same problem:

    http://bbpress.org/forums/topic/tinymce-and-allow-images-installed-but-images-doesnt-work#post-59771

Viewing 8 replies - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.