You need to be logged in to post in the forum - Log In

An active JCE Pro Subscription is required to post in the forum - Buy a Subscription

  1. BigStef
  2. Suggestons/Feature Requests
  3. Monday, 26 October 2020
Hi JCE Team,
In french, there's a non-breaking space before a colon, something like "Example : my texte"
I would like to know if ther's anyway to change that space automatically so the space is non-breaking (modify a " " to a " " ) only for colon (":" ).
That would be so nice! Maybe have I miss a param somewhere ?
Accepted Answer
Accepted Answer Pending Moderation
You could use a custom script to convert the space to a non-breaking space for you. Create an editor.js file in media/jce/js/ and add the following:


(function() {
tinyMCE.onAddEditor.add(function (mgr, ed) {
ed.onSetContent.add(function(ed, o) {
o.content = o.content.replace(/\s:/g, ' :');
});

ed.onGetContent.add(function(ed, o) {
o.content = o.content.replace(/\s:/g, ' :');
});
});
})();
Just because you're not paranoid doesn't mean everybody isn't out to get you.
Accepted Answer Pending Moderation
Use the Non-breaking space button to add the space before the colon, instead of using the space bar.

The space bar will only create a non-breaking space for every consecutive space after the first.
Just because you're not paranoid doesn't mean everybody isn't out to get you.
  1. more than a month ago
  2. Suggestons/Feature Requests
  3. # 1
Accepted Answer Pending Moderation
Hi Ryan, thank you very much for your answer.
Actually I was wondering if there was a way to check automatically if the space before colon is non-breaking, and change from simple space to non-breaking if needed.
As I'm working on websites where I adda lot of content each days, sent to me in Word file. I just wanted to avoid this repetitive and really demanding task.
  1. more than a month ago
  2. Suggestons/Feature Requests
  3. # 2
Accepted Answer Pending Moderation
HI ryan, you are full of good ideas :), but...
Should I not write :
'&nbsp:'

instead of
' :'
  1. more than a month ago
  2. Suggestons/Feature Requests
  3. # 3
Accepted Answer Pending Moderation
Yes, the forum converted the non-breaking space to an actual space when it displayed the post.

See this - https://gist.github.com/ryandemmer/18714ea584a7f63b527503038823fa30
Just because you're not paranoid doesn't mean everybody isn't out to get you.
  1. more than a month ago
  2. Suggestons/Feature Requests
  3. # 4
Accepted Answer Pending Moderation
Great Ryan, works like a charm!
Thanks you so much for your tip!
  1. more than a month ago
  2. Suggestons/Feature Requests
  3. # 5
Accepted Answer Pending Moderation
Bonjour,

Je vais me permettre de répondre en français, mais traduire aussi en anglais.

Mon astuce, pour les espaces insécables (par exemple avant ou après les signes de ponctuation, mais aussi dans de nombreuses autres situations) consiste à utiliser un correcteur de langue française capable de mettre des espaces insécables partout où cela est réquis en fonction des règles typographiques de la langue française. Ensuite, je fais un copier-coller depuis mon éditeur de texte (Word, TextEdit…) dans l'éditeur JCE. Et là, je conserve tous mes espaces insécables (automatiquement remplacés par le code html correspondant).

On peut aussi utiliser la fonction de rechercher-remplacer de JCE, en mode code.

+++

Hello,

I will take the liberty of answering in French, but will also translate into English.

My trick, for unbreakable spaces (for example before or after punctuation marks, but also in many other situations) is to use a French language proofreader capable of putting unbreakable spaces wherever required according to the typographical rules of the French language. Then, I make a copy-paste from my text editor (Word, TextEdit...) in the JCE editor. And there, I keep all my unbreakable spaces (automatically replaced by the corresponding html code).

You can also use the search-replace function of JCE, in code mode.
  1. more than a month ago
  2. Suggestons/Feature Requests
  3. # 6
  • Page :
  • 1


There are no replies made for this post yet.
Be one of the first to reply to this post!