How to customise Redactor editor in Perch
Summary: Adding a View Source button to Redactor editor in Perch. Customising the editor using other Redactor plugins.
Perch 3.0 comes with several textarea editors (Redactor, Simple MDE, Markitup) installed by default. It's easy to create a Perch template to use your preferred editor (Redactor in my case). However, you might want to customise the editor, perhaps expanding what it can do by adding more buttons. So, this is what I did to add a View Source button (Redactor Source plugin) to the default Redactor editor in Perch. This can be used with other Redactor plugins too.
I followed the section "Custom configurations for default editors" on this page. Only this section. It's at the end of the page. That's different to the section before it where you are creating a new editor.
The "Custom configurations" section is how to configure the default editor.
define('PERCH_CUSTOM_EDITOR_CONFIGS', true);to your overall Perch config file.
- Create a
config.jsfile like the example on this page (amend as necessary) and put it in
- Download plugins you need from Redactor site, e.g https://imperavi.com/redactor/plugins/source/, and put these in
- Test on local dev site. Upload new files to live site.
That should be it.
Login to Perch and admire your new editor functionality :-)