Mastodon
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 of Publii with an additional button for this function.

Publii's WYSIWYG editor is based on TinyMCE which is extensible. Today we want to show you how the WYSIWYG editor can be easily extended with a button for 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 an additional button for non-breaking space in the second line of your toolbar on the far left.

Source: https://github.com/GetPublii/Publii/issues/1062

 

Comments