0

With the advent of many different screensizes, manual line ending (not sentence-endings) has become a bit of a guessing/repetitive task. I want to avoid having the first short word of a new sentence on the ending of the line all by itself on smaller screens.

After a period, at the start of a new sentence, is there a way to make 1, 2 or 3-letter words be followed automatically by a non-breaking-space instead of a normal space in tinymce?

4
  • 1
    Any solution wouldn't be related to TinyMCE, but I believe there are multiple pure CSS solutions. Any server side implementation would need you to post the code to be viable, otherwise any solution would be incredibly generic with no clues how/where to apply it. How are you using TinyMCE? And can you edit your question to include the code you have? How is the content saved/stored? Commented Oct 1, 2020 at 16:10
  • Thanks for your recation, however I fail to see your point, especially regarding the CSS bit. I'm asking how to get tinymce to replace a space with a nbsp; in the text view (html of old) under certain conditions (when, after a period, a word is 1 or 2 or 3 letters max, replace the space with a nbsp; behind it). Tinymce is used in a translation editor in WP, and vanilla for now. Commented Oct 2, 2020 at 17:12
  • I have added this to my child theme's functions.php to make tiny keep   and ­ in text view: // 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'); Commented Oct 2, 2020 at 17:18
  • 1
    Never mind, I found a brilliant javascript which solves his issue and others: link Commented Oct 5, 2020 at 6:43

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.