WordPress.org

Forums

Non-breaking spaces (5 posts)

  1. rpali
    Member
    Posted 6 years ago #

    I'm trying to use non-breaking spaces without success in WP 2.7.

    First off, I am not entering code into the HTML or visual editor. I know what a mess that can be. I'm using the "Insert Custom Character" button and choose the non-breaking space. It does insert a space, but it does indeed break at that point when the post is saved.

    I've used this procedure many times in 2.5 and 2.6 without a problem. It seems that it simply does not work in 2.7. Is this a known problem? Known as in acknowledged and slated to be fixed, I mean?

  2. rpali
    Member
    Posted 6 years ago #

    Seriously? No one else is having this problem?!

  3. benjamin.lupu@gmail.com
    Member
    Posted 6 years ago #

    Hi, unfortunatly, I have the same problem. Using the native special characters table or the TinyMCE nonbreaking plugin (through WP Super Edit), WP doesn't insert the famous   entity. Instead, it inserts a plain white space.

    Working on it and hoping to resolve it...

  4. Benjamin Lupu
    Member
    Posted 6 years ago #

    @rpali - Hi again !

    Found a solution.

    It appears that the WordPress TinyMCE configuration doesn't allow by default the non-breaking space HTML entity.

    Under the 2.6.3, you may see that in the wp-includes/js/tinymce/tiny_mce_config.php (line 163).

    Under the 2.7, you may see that in the wp-includes/post.php (line 1264).

    The idea of course is to add the entity we needed. For that, TinyMCE expects the hex code and the entity text. For the non-breaking space : 160 and nbsp.

    You may add it by hand in the code simply by extending the lines cited above (eg. '38,amp,60,lt,62,gt' to '38,amp,60,lt,62,gt,160,nbsp').

    However it is not safe regarding WP upgrades.

    So, I jump into the idea to build a simple plugin to secure that (my first one; so be indulgent).

    http://www.benjaminlupu.net/misc/2009-01-29/tiny-mce-configuration-plugin.zip

    Enjoy :-) (I have tested on the 2.7 only).

  5. Benjamin Lupu
    Member
    Posted 6 years ago #

    @rpali - Hi again

    Please note that for 2.6.3 after installing the plugin, you can insert nbsp entity from the charmap.

    However, this feature is broken in the 2.7 for FF. It still works for IE.

    The problem comes from TinyMCE itself.

    http://sourceforge.net/tracker/index.php?func=detail&aid=1628509&group_id=103281&atid=635682

    It appears that TinyMCE has a bug when inserting nbsp entity (from charmap or using the nonbreaking plugin).

    However the bug affects only FF. I have tested the insert from charmap under IE7 and it works fine (WP 2.7).

    So I guess we have to wait that somebody fixes the thing.

    Please note that even the TinyMCE demo on http://tinymce.moxiecode.com/ has the bug (works with IE and not working with FF).

Topic Closed

This topic has been closed to new replies.

About this Topic