WordPress.org

Ready to get started?Download WordPress

Ideas

Let us force a line break

  1. mfmh
    Member

    I found the solution for line break.

    first. Open the file.
    "/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js"

    line 243:
    content = content.replace(new RegExp('<p>(\\s| )*</p>', 'mg'), '');

    -->

    // content = content.replace(new RegExp('<p>(\\s| )*</p>', 'mg'), '');

    line 297-300:
    content = content.replace(new RegExp('\\s*<p>', 'mgi'), '');
    content = content.replace(new RegExp('\\s*</p>\\s*', 'mgi'), '\n\n');
    content = content.replace(new RegExp('\\n\\s*\\n', 'mgi'), '\n\n');
    content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'gi'), '\n');

    -->

    //content = content.replace(new RegExp('\\s*<p>', 'mgi'), '');
    //content = content.replace(new RegExp('\\s*</p>\\s*', 'mgi'), '\n\n');
    //content = content.replace(new RegExp('\\n\\s*\\n', 'mgi'), '\n\n');
    //content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'gi'), '\n');

    line 572-588:
    pee = pee + "\n\n";
    pee = pee.replace(new RegExp('\\s*', 'gi'), "\n\n");
    .
    .
    .
    pee = pee.replace(new RegExp('(</?(?:table|thead|tfoot|caption|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\\s*
    ', 'gi'), "$1");
    pee = pee.replace(new RegExp('(\\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)', 'gi'), '$1');

    -->

    //pee = pee + "\n\n";
    //pee = pee.replace(new RegExp('\\s*', 'gi'), "\n\n");
    .
    .
    .
    //pee = pee.replace(new RegExp('(</?(?:table|thead|tfoot|caption|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\\s*
    ', 'gi'), "$1");
    //pee = pee.replace(new RegExp('(\\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)', 'gi'), '$1');

    But some problem left yet.
    Good luck to you.

    Posted: 7 years ago #
  2. pcpoet
    Member

    The one bit of code it doesn't seem to muck with is & nbsp;

    So...

    & nbsp;
    & nbsp;
    & nbsp;

    forces a line break every time. (without the space between & and nbsp;).

    Best I can do. Hope it helps.

    Posted: 7 years ago #
  3. Miral
    Member

    This really bugs me. Trying to enter code in the visual editor in WP2.2 (within
    <pre> tags) was a raving nightmare. Nearly every time I switched between the visual and code tabs it doubled the linebreaks -- and when it didn't do that, it removed them entirely. Until this is sorted out the visual editor is getting avoided like the plague it is.

    Posted: 7 years ago #
  4. Pictorian
    Member

    I'm new to WordPress but not to HTML. Whenever I put a «br» tag in my entry... it' changes to «br /». I'm going effing crazy! Why can't I put in line breaks?! Arrrghgghh! PLEASE can somebody fix this?

    Posted: 7 years ago #
  5. Harvey
    Member

    The most annoying thing about this, is that if you use pcpoets fix, the

    & nbsp;
    & nbsp;
    & nbsp;

    The next time you go into the post to edit it, all of that code has been stripped and you must enter it again!

    This is most annoying.

    Posted: 7 years ago #
  6. kheldon
    Member

    Just chiming in...very annoying that code doesn't show all the code and that the WYSIWYG doesn't give me what I see. :P

    Posted: 7 years ago #
  7. Andreamly
    Member

    wow - I tried everything - this was ruining my business since I would spend 5 hours trying to manipulate every stupid blog post... Just after reading this, used the

    & nbsp;'s as suggested above a few times... works like a charm!

    Best of luck !

    Posted: 7 years ago #
  8. xino
    Member

    Ok. So I think I've found a solution to our problem that works everytime when formatting and making line breaks in any text. Finally I am seeing separate paragraphs... and in a short moment, you should be too...

    The great thing about this, is that the code does not disappear or get removed by the WordPress coding. It remains there even if you have to return to edit your text...

    ++

    First, you'll need to install the "Text Control" Plugin.. You can find this here:
    http://dev.wp-plugins.org/wiki/TextControl

    Once you have downloaded and installed this plugin, you will have to "Activate" it..

    Navigate to your "Options" Screen via your Admin Control Panel in your WordPress...

    Choose the "Text Control Config" Tab.

    Then, in the "Posts & Excerpts" area, change the first pull-down menu to "No Formatting"

    Then the second pull-down menu, to "No Character Encoding"

    Click on the button labelled "Change Default Post/Excerpt Formatting" right next to it to update your settings...

    That's it. You've done the hard part....

    Now you will simply use the following...

    <br _extended="true" />

    to create your line breaks in your post's text, or any page for that matter...

    Note:
    YOU MUST BE EDITING YOUR PAGE OR POST USING THE "CODE" TAB ONLY, AND NOT THE "VISUAL" TAB.

    ++

    Should be smooth sailing from there until WordPress finds a way to make this easier for us...

    Hope this helps everyone..

    Posted: 7 years ago #
  9. webwide
    Member

    Wow - plugins required to fix known issues! This is the craziest thing WP has ever done. What a pain in the ass.

    Look, just because you guys are currently the king of the hill doesn't mean that problems like this won't cause people to start Googling for your competitors. All because of break and paragraph tags? Is that really worth it?

    Unbelievable...

    Posted: 7 years ago #
  10. FlameOn
    Member

    I've tried the <br _extended="true" /> code and procedure, but it wasn't a go. Where exactly do I put it? I probably sound moronic, but apparently we're not dealing with simple HTML, where inserting a usual break is as easy as 123. I tried putting in between texts, texts inside of it, a couple of methods and no go. Can anyone be more specific on where to put the code, please?

    Posted: 6 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.

  • Rating

    12345
    426 Votes
  • Status

    Sorry, not right now