Zuletzt aktualisiert am
Coverbild: Publii

Publii Hacks: Adding a button for non-breaking spaces to the WYSIWYG-Editor

Sometimes you want to use non-breakable spaces to avoid unfavorable wrapping. A simple two-liner inserted in the right file provides the WYSIWYG editor with a button for this function.

Publii's WYSIWYG editor is based on TinyMCE and is extensible. Today we want to show how the WYSIWYG editor can be easily extended with non-breaking spaces. Four simple steps are enough for this:

    1. In the Documents > Publii > config folder, create a text file named "tinymce.override.json".
    2. Insert the following text into this file:

      {   "toolbar2": "nonbreaking styleselect formatselect searchreplace hr readmore removeformat undo redo restoredraft sourcecode ",   "plugins": "nonbreaking advlist autolink autosave link image lists hr pagebreak searchreplace media table paste autoresize emoticons textpattern toc"  }
    3. Save this file.
    4. Restart Publii and you are done!

The before and after comparison looks like this::

There is now another non-breaking space button in the second row on the far left.