Support » Fixing WordPress » Force line break inspite of Tiny MCE editor using a Mac

  • Hi,

    Found the suggestion that Tiny MCE editor could be hacked to permit line breaks.

    If you use shift-enter instead of enter you should be in luck. Depending on your configuration, you might also have to edit the initialization settings in the js/tinymce/tiny_mce.js file and change these values to reflect:
    this.defParam(“force_br_newlines”, true);
    this.defParam(“force_p_newlines”, false);
    this.defParam(“convert_newlines_to_brs”, true);

    http://wordpress.org/support/topic/52958?replies=19#post-289814

    I think I finally figured out which lines to modify, but it doesn’t work. As far as I can tell “shift-return” does absolutely nothing ( i.e. it’s the same as “return”). I think that’s some sort of PC thing.

    Please can someone tell me how do you force line breaks using a Mac?

    (p.s. The WP 2.0.2 installation is on a Linux server and locally on my Mac for testing, neither works.)

Viewing 15 replies - 16 through 30 (of 47 total)
  • My bad, I meant the wp-include/functions-formatting.php file. It should contain the wpautop function.

    If you look in that file, you should find, around line 73, the following line:
    if ($br) $pee = preg_replace('|(?<!)s*n|', "n", $pee); // optionally make line breaks

    Try prefixing that line with // to comment it out and see if that fixes your problems.

    Nazul:

    Did it. No luck. Didn’t see any change on the text.

    Thanks though.

    Another attempt:

    Undo the change I gave previously and redo it on this line (same function):
    $pee = preg_replace(“/\n\n+/”, “\n\n”, $pee); // take care of duplicates

    Just to check in here… Thanks for the help Nazgul!

    So far both changes you recommended, line #73 and take care of duplicates, has exactly the same effect.

    1. One and only 1 line break can be inserted into the text and won’t be removed.
    2. Two or more line breaks within <p> will be converted to one line break.
    3. Text without <p> still get wrapped in them and if there are any <br /> where the <p> are inserted the <br /> are removed.

    Example
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus dolor. Morbi quis turpis. Ut convallis ultricies urna. Ut pharetra fermentum ipsum.
    <br />
    <br />
    <br />Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Proin velit magna, luctus vel, volutpat ut, viverra ut, elit. In quis est id sapien consectetuer blandit. Cras sed odio sed mi bibendum eleifend. Ut et enim. Nullam blandit luctus ipsum. Maecenas ut sem.
    <br />
    <br />Maecenas tincidunt tortor in risus. Maecenas auctor velit. Nam lobortis dolor eu justo. Aliquam lacinia. <br />
    Vestibulum quis purus. <br />
    Nunc blandit, nisi eu ullamcorper faucibus, orci pede egestas lectus, id faucibus ipsum ligula eu dui. <br />
    <br />
    In non est. Fusce massa odio, bibendum a, condimentum et, faucibus ac, dui. <br />
    <br />
    <br />
    <br />
    <br />
    Praesent ante. Nulla facilisi. Vestibulum sagittis, tellus ac varius venenatis, lacus dui dignissim sem, sit amet volutpat elit elit et mauris.
    <br /><br />
    Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nunc pede massa, condimentum tristique, congue nec, pharetra id, dui. Aliquam feugiat tortor in lectus.
    <p>
    Donec iaculis ultricies velit. Pellentesque ullamcorper, enim at rhoncus fermentum, velit lorem blandit nibh, eget tincidunt est orci id metus. Sed nec dui at lacus semper imperdiet.
    <br />Donec scelerisque dignissim mi. In turpis justo, consectetuer porttitor, sollicitudin vestibulum, faucibus quis, metus. Fusce sit amet enim quis dolor dictum sagittis.
    <br />Aliquam non libero sed nunc fringilla tempus. Duis elementum eleifend pede. Mauris sit amet odio. Ut volutpat dignissim lacus.
    <br />Morbi sit amet pede. Nullam cursus tortor et urna. Ut fringilla, libero volutpat tincidunt rhoncus, nunc orci porta velit, sit amet molestie metus erat in tellus. Etiam eu felis.
    </p>

    gets turned into this xhtml
    <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus dolor. Morbi quis turpis. Ut convallis ultricies urna. Ut pharetra fermentum ipsum.
    </p>
    <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Proin velit magna, luctus vel, volutpat ut, viverra ut, elit. In quis est id sapien consectetuer blandit. Cras sed odio sed mi bibendum eleifend. Ut et enim. Nullam blandit luctus ipsum. Maecenas ut sem.
    </p>
    <p>Maecenas tincidunt tortor in risus. Maecenas auctor velit. Nam lobortis dolor eu justo. Aliquam lacinia. <br />
    Vestibulum quis purus. <br />
    Nunc blandit, nisi eu ullamcorper faucibus, orci pede egestas lectus, id faucibus ipsum ligula eu dui.
    </p>
    <p>In non est. Fusce massa odio, bibendum a, condimentum et, faucibus ac, dui. </p>
    <p>
    Praesent ante. Nulla facilisi. Vestibulum sagittis, tellus ac varius venenatis, lacus dui dignissim sem, sit amet volutpat elit elit et mauris.
    </p>
    <p>Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nunc pede massa, condimentum tristique, congue nec, pharetra id, dui. Aliquam feugiat tortor in lectus.
    </p>
    <p>
    Donec iaculis ultricies velit. Pellentesque ullamcorper, enim at rhoncus fermentum, velit lorem blandit nibh, eget tincidunt est orci id metus. Sed nec dui at lacus semper imperdiet.<br />
    <br />Donec scelerisque dignissim mi. In turpis justo, consectetuer porttitor, sollicitudin vestibulum, faucibus quis, metus. Fusce sit amet enim quis dolor dictum sagittis.<br />
    <br />Aliquam non libero sed nunc fringilla tempus. Duis elementum eleifend pede. Mauris sit amet odio. Ut volutpat dignissim lacus.<br />
    <br />Morbi sit amet pede. Nullam cursus tortor et urna. Ut fringilla, libero volutpat tincidunt rhoncus, nunc orci porta velit, sit amet molestie metus erat in tellus. Etiam eu felis.
    </p>

    Ok. Last attempt:

    – Undo my previous suggestions
    – Open the functions.php in your themes directory and add the following line in there. (If the file doesn’t exist. Create it)
    <?php
    remove_filter('the_content','wpautop');

    /* Any content that's already in there */

    ?>

    OK. So if I remove this stupid filter while I’m setting up the pages, and then put it back in for the end user will it retroactively “correct” my pages?

    That filter is run everytime a post is displayed, so if you put it back in it will start ‘misbehaving’ again.

    I tried this and still no luck…thaks for your help Nazgul

    Another thing popped into my mind, what happens if you put an &nbsp; on your empty lines?

    I tried this already, since I read it in a forum, and someone said it worked, but no luck for me. WP removed them as well.

    Then I’m affraid I’ve run out of options.
    Maybe someone else has another suggestion?

    No news??

    Did anyone figure out how to fix this annyoing bug?

    Did anyone try removing the TinyMCE folder from their installtion to see if they got the same results?

    (I know, I know – it’s an old thread. Was looking for something related 🙂 )

    “Someone please tell me how to un-install Tiny MCE from WP 2.”

    Delete the folder from the server?

    This sounds like a pretty crazy epic — I came across here after googling for some related stuff, and indeed, this is really annoying.

    Doesn’t make sense to me line breaks get stripped — if I didn’t want so many line breaks, I’d press the Backspace key! And yes, a couple or even three line breaks helps a lot when presenting certain kinds of content in sections.

Viewing 15 replies - 16 through 30 (of 47 total)
  • The topic ‘Force line break inspite of Tiny MCE editor using a Mac’ is closed to new replies.