1

Seems like a basic question but I can’t figure out a way to do this out of the box, or reference to it in the Redactor docs. ‘ ’ always gets stripped out.

  • The one-click button seems like a reasonable option. Otherwise, resolving why something gets stripped when it shouldn’t is still an issue. When i’m putting content in markup, I use this same method but we cannot expect the casual content editor to make sure the html it inserts is done properly. – Jeremy Dec 29 '19 at 20:50
3

What about using CSS white-space: nowrap; instead of   characters? I guess that's semantically more correct and this also allows you to prevent your text to break at any other character (great for phone numbers etc.).

CSS:

.nobr {
  white-space: nowrap;
}

Markup:

<p>my phone number is <span class="nobr">+1 800-275-8777</span></p>

To add this easily to your Redactor fields markup, have a look at the inline format API or the formattingAdd config setting (I actually had mixed experiences with that setting).

If you'd like to be able to add this with the click of a button, I also just added this to my Redactor Inline Styles plugin, which is a collection of (optional) buttons to apply inline styles to your Redactor texts (Quotes, Code, etc.).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.