Hello,
I was wondering if there was a way to automatically replace space with
in some specific cases ?
I would like to replace:
- " ?" with
?
- " :" with
:
- " !" with
!
Thanks!
Jean-Philippe
Hello,
I was wondering if there was a way to automatically replace space with
in some specific cases ?
I would like to replace:
?
:
!
Thanks!
Jean-Philippe
If you’re looking for a quick fix you could try adding an output modifier:
[[*content:replace=` ?== ?`:replace=` !== !`]]
I’m sure there is a nicer solution though…
There’s a norphan plugin that you can enable (redactor.plugin_norphan
setting) that will add the non breaking space in between the last two words, but that’s not quite what you’re looking for… If you’d like it to be done in the editor itself, and you’re comfortable writing javascript, you could use that as a starting point for writing a plugin: https://github.com/modmore/redactor-plugins/blob/master/src/norphan.js
Alternatively though, @jonleverrier’s solution sounds good to me as well! It might be nice to turn it into a quick snippet rather than the output modifiers, but it works either way.
Thank you @jonleverrier and @mhamstra for your answers. I think I will start with a snippet as a quick fix. In the meantime I will take a look at the plugin since I might use it on all my sites.
Thanks again!