WordPress.org

Ready to get started?Download WordPress

Forums

Force line break inspite of Tiny MCE editor using a Mac (48 posts)

  1. Ciryaquen
    Member
    Posted 8 years ago #

    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.)

  2. Ciryaquen
    Member
    Posted 8 years ago #

    Any other Mac users figure out how to force line breaks in WordPress 2?

  3. Ciryaquen
    Member
    Posted 8 years ago #

    Actually, I give up. Even disabling the rich text editor won't stop this thing from stripping out my line breaks.

    How do you un-install this TINY MCE thing so you can just write your own xhtml?

    or do I have to downgrade back to WP 1.5?

  4. Chris_K
    Member
    Posted 8 years ago #

    Just disable it.

    As admin, click on Users.

    Scroll to the bottom of the page. Uncheck the box that mentions use RTE editor...

  5. Ciryaquen
    Member
    Posted 8 years ago #

    I've already tried disabling the RTE (i.e. rich text editor). It doesn't work. The darn thing continues to strip out line breaks and every other suggested work-around to make a line break.

    E.g., I've even tried making an invisible class in my CSS and the blasted thing will strip out my invisible paragraphs and spanned text from the posts and pages.

    For example
    <p class="invisible">gosh darn it I want a line break here!</p>

    gets stripped out! Poof! Just removed from the post!

    As the Smiths put it in song years ago it's "enough to make a shy, bald, buddhist reflect and plan a mass murder".

    I'd really like to delete this text editor now. If anyone can advise how to get rid of it I will be very grateful.

  6. Chris_K
    Member
    Posted 8 years ago #

    Ok, I'll bite. How did you try to disable it?

  7. Ciryaquen
    Member
    Posted 8 years ago #

    Hi,

    First method was (as Admin)
    a) In Users > Your Profile> Personal Options deselecting "Use the visual rich editor when writing"
    b) In Options > Writing deselecting all 3 choices under Formatting "Users should use the visual rich editor by default", "Convert emoticons like :-) and :-P to graphics on display", "WordPress should correct invalidly nested XHTML automatically"

    It didn't work on 3 installations: 2 Linux shared hosting sites, and my local OS X copy.

    Second method was
    a) hacking the above mentioned js/tinymce/tiny_mce.js file as described in that linked thread. I deleted the file then ftp'd the modified one to the site.

    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);

    [snip]

    this.defParam("remove_linebreaks", false);'

    The problem is consistent on 2 installations: a Linux shared hosting site and my local OS X copy. It's as if nothing was changed in the hacked tiny_mce file on the sites compared to the 3rd installation with the un-hacked copy of the file.

    Shift-enter does nothing; that's some Microsoft thing.

    p.s. forgot to add, I've tried inserting a line break in Safari, Firefox, and Opera.

  8. MaineWebworks
    Member
    Posted 8 years ago #

    @Ciryaquen: It appears not to be just a Mac or linux thing.

    I've been trying to get my arms around this for a while now. Earlier today, I tried #2 you mentioned above and tested in MSIE6 and FF1.5 in Win XP Pro SP2. (I already use method #1).

    Here's what I tried -

    this.defParam("force_br_newlines", true);
    this.defParam("force_p_newlines", false);
    this.defParam("convert_newlines_to_brs", true);
    this.defParam("remove_linebreaks", false);


    this.defParam("verify_css_classes", false);
    this.defParam("verify_html", true);
    this.defParam("apply_source_formatting", true);
    this.defParam("inline_styles", false);
    this.defParam("trim_span_elements", false);
    this.defParam("convert_fonts_to_spans", true);
    this.defParam("font_size_classes", 'fontSize1,fontSize2,fontSize3,fontSize4,fontSize5,fontSize6,fontSize7');
    this.defParam("font_size_style_values", '');
    this.defParam("doctype", '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
    this.defParam("table_inline_editing", false);
    this.defParam("fix_list_elements", true);
    this.defParam("fix_table_elements", true);

    FMI, here's the link to the moxiecode reference for the configs above:
    http://tinymce.moxiecode.com/tinymce/docs/reference_configuration.html

    The doctype default was set to html 4.0...? and not even with a DTD using a URL.

    But nothing above helped. I also modified the this.defParam("valid_elements",""); to allow better xhtml markup.

    I wonder if the tiny_mce_gzip.php plays a role, but I can't find any documentation about the changes made to it for the port to WP and what role it plays.

    My main complaint is the RTE html source editor and the non RTE editor would change my html to use </p> without the opening tag instead of the <br /> I wrote. And it would try to wrap everything into a paragraph.

    Now after the changes I made to tinymce, it doesn't try to wrap everything in a <p></p> but uses my source div's as a container for text.

    For example, assume I have a container div and I want to insert text following the opening div tag. Before changes to the tiny_mce.js file, I'd get this garbage with and without the RTE on

    <div id="CSS-P">
    Text for testing </p>
    <h2> blah blah h2 header</h2>
    [other code...]
    </div>

    With RTE on TinyMCE changes the html source like this after uploading the modified tiny_mce.js

    <div id="CSS-P">
    <div id="CSS-P">Text for testing</div>
    <h2> blah blah h2 header</h2>
    [other code...]
    </div>

    when the correct source should be

    <div id="CSS-P">
    <p>Text for testing</p>
    <h2> blah blah h2 header</h2>
    [other code...]
    </div>

    Right?

    The site I'm working on validates because I stopped using <br /> or empty <p> </p> while pasting my code into the "non" RTE form - they're not well-formed xhtml in the strict sense anyway. It just means more CSS.

    While pasting my html into the "non" RTE is ok for me to develop the blog's initial look and feel, when the end-user gets it and edits pages, creates new posts, and etc., it appears that the Rich Text Editor, will make a mess of the code.

    Worse case is it disrupts the layout and accessibility.

  9. Ciryaquen
    Member
    Posted 8 years ago #

    MaineWebwo, I followed the link, but I'm afraid almost everything on that moxiecode site is over my head. I'm an amateur.

    All I know is that I never had this problem with WP 1.5, and that turning off the RTE in WP doesn't exorcize Tiny MCE's interference with my code.

    All I want is to use a line break. Why should that be so hard?

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

  10. amarie
    Member
    Posted 8 years ago #

    I'm using WP 2.0.2 on a Linux server and use Mac OSX Tiger for admin and have no problem doing line breaks with QuickTags.

    Of course I can only *see* the QuickTags with Firefox, not Safari ...

    Anyway to add a line break on a Mac you use Shift-Return. That's a typical "soft return" (line break) keyboard shortcut found in most design programs as well. I don't know why it's not working for you.

    I just checked and when viewing the HTML that the quicktag made, it used <br />. (hope that code made it through ... trying to enter the XHTML code for a break tag.)

    AM

  11. amarie
    Member
    Posted 8 years ago #

    btw I might be confused re quicktags vs rich tag editor. I'm a newbie with a whole week of experience so far.

    By "quicktags" I'm referring to the little icons that appear above the text entry box in the Write > Post page in admin. (is that the same as the rich text editor?)

    But even in Safari where the tags aren't available, hitting return causes a regular paragraph break and hitting Shift-return causes a line break ... at least in my install.

    AM

  12. Ciryaquen
    Member
    Posted 8 years ago #

    amarie,

    Thanks for the post. Now I wonder if the download of WordPress or as installed is corrupt.

    I also get quicktags with Firefox 1.0.6, Opera 8.52, but not with Safari 1.2.4.

    With all 3 installations (2 with the hacked Tiny MCE file, and one with the default file), shift-return does nothing. No changes in the code, no <br /> inserted. It just strips everything out. I can put in 50 returns, or 50 shift-returns, and it will strip them out.

    It's maddening!

  13. jwvelez
    Member
    Posted 8 years ago #

    Ciryaquen:

    I have the EXACT same problem. I have tried every single "supposed" solution to this problem, including mofifying the Tiny MCE .js file. Nothing works. I am desperate.

    Have you found a solution? I'll appreciate your help.

  14. Ciryaquen
    Member
    Posted 8 years ago #

    Hi jwvelez,

    No solution yet.

    I do understand your desperation. I've gone from being desperate to to use a line break to a smoldering white hot hatred of Tiny MCE.

    If anyone knows anyone who knows how to code WordPress or this blasted TinyMCE please send them over here where help in removing it is needed.

    Thanks!

  15. Nazgul
    Member
    Posted 8 years ago #

    After reading this and your other post I think it's not TinyMCE that's causing your trouble.

    By default WordPress run's the wpautop filter on every post, which (among other things) replaces multiple succesive occurances of newlines or BR tags by a single one.

    You can find it in wp-include/wpautop.php.

  16. jwvelez
    Member
    Posted 8 years ago #

    Even though I did not find the wpautop.php file in the wp-includes folder, I managed to find a disable-wpautop.php Plugin for WP that supposedly resolved this issue. It made it worse. Didn't work for me.

    If anything new comes up, let me know.

  17. Nazgul
    Member
    Posted 8 years ago #

    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.

  18. jwvelez
    Member
    Posted 8 years ago #

    Nazul:

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

    Thanks though.

  19. Nazgul
    Member
    Posted 8 years ago #

    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

  20. Ciryaquen
    Member
    Posted 8 years ago #

    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>

  21. Nazgul
    Member
    Posted 8 years ago #

    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 */

    ?>

  22. Ciryaquen
    Member
    Posted 8 years ago #

    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?

  23. Nazgul
    Member
    Posted 8 years ago #

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

  24. jwvelez
    Member
    Posted 8 years ago #

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

  25. Nazgul
    Member
    Posted 8 years ago #

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

  26. jwvelez
    Member
    Posted 8 years ago #

    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.

  27. Nazgul
    Member
    Posted 8 years ago #

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

  28. jwvelez
    Member
    Posted 8 years ago #

    No news??

  29. jwvelez
    Member
    Posted 8 years ago #

    Did anyone figure out how to fix this annyoing bug?

  30. 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?

Topic Closed

This topic has been closed to new replies.

About this Topic