Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1101737

    Hey guys,

    normally I’m using wp-Typography to sort out hyphenation, widow protection, etc.

    For a small website, I want to avoid the overhead. So I’ve opted to manually insert soft hyphens by using the corresponding HTML entity.
    So I open a Text-Block and insert the text. Then I switch to the text tab to insert ­ at the desired places in the text. The result makes me wonder a bit: when I save the page, everything works properly. But when editing again, I don’t see the entities I’ve inserted already!? But they must be there, otherwise hyphenation won’t work anymore after saving the page again.

    Can you elaborate on the issue, please?

    Thanks in advance,
    Jürgen

    #1102077

    Hey Jürgen,
    Sorry for the late reply, WordPress often strips HTML entitys in visual mode, but please try this solution

    Best regards,
    Mike

    #1102223

    Hey Mike,

    the problem is *not* the stripping in visual mode, but in text mode.
    Anyhow, thanks for pointing in the right direction!
    I’ve learned that my “problem” was basically caused by TinyMCE (and NOT Enfold!).

    Unfortunately the link you’ve posted is not what I would call a “clean solution”.
    Read about using the ‘entities’ element in tiny_mce_before_init here. As you can see, you always have to add value *pairs* (consisting of the character code and the character name).

    According to the TinyMCE spec, ‘entity_encoding’ must also be set to ‘named’ to show the defined names.
    This is the TinyMCE default, but apparently that gets changed to ‘raw’ somewhere before my tiny_mce_before_init filter function get’s called.
    So I ended up with the following code:

    
    /* Show ­ and   in TinyMCE editor's text mode */
    function override_mce_options($initArray) {
    	// Add entities to the default array (nbsp, shy) 
    	$initArray['entities'] .= ',160,nbsp,173,shy'; 
    	$initArray['entity_encoding'] = 'named';
    
    	return $initArray; 
    }
    add_filter('tiny_mce_before_init', 'override_mce_options');
    

    As the comment states, the code shows the two non-printable characters ‘soft hyphen’ and ‘non-breaking space’ as their corresponding HTML entities ‘­’, resp. ‘ ’ in the editor’s text mode.

    My suggestion ist to display all non-printable characters (think of en space, em space, thin space, …) as their corresponding HTML entities by default: that’s the only chance to identify them again after one has inserted them.

    Best regards,
    Jürgen

    #1102647

    Hi,
    Thank you for sharing your solution, perhaps others will benefit from it.
    As this is the default behavior of TinyMCE, a core element of WordPress, we typically don’t want to add overriding functions to Enfold, as it’s not good practice.
    Unless there is anything else we can assist with on this issue, shall we close this then?

    Best regards,
    Mike

    #1102749

    Hi,

    as my comment states, at least the parameter ‘entity_encoding’ is not at it’s default value as defined in the spec.

    Anyhow, you can close the topic, of course!

    Cheers,
    Jürgen

    #1103139

    Hi,
    Thank you again, we will close this now. Thank you for using Enfold.

    For your information, you can take a look at Enfold documentation here
    For any other questions or issues, feel free to start new threads in the Enfold forum and we will gladly try to help you :)

    Best regards,
    Mike

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Using soft hyphens (&shy) in Enfold Text-Blocks’ is closed to new replies.