Forum
Redactor: customising editor buttons; disabling asset manager
I'm using Redactor in Perch 3. I've added a few Redactor plugins (source, table, alignment) as described here: https://docs.grabaperch.com/api/editors/
- I'd like to customise which buttons are displayed - for example setting up different Redactor options like "content", "simple", "minimal" as described here: https://forum.grabaperch.com/forum/12-08-2015-quick-tip-custom-redactor-editors-by-using-the-editor-config-attribute (applies to the Redactor add-on in Perch 2).
Is there a way of customising the buttons for Redactor in Perch 3?
- Redactor in Perch 3 uses the Asset Manager for image and file uploads. Is there a way to disable that for textareas edited using Redactor? I know for any image field, I can specify disable-asset-panel="true". Is there a similar method that can be used in textareas?
See "Editor configuration sets" in the docs you linked to.
Yes, they're all just plugins, so you customise them exactly as you are doing. If you don't want our asset plugin, you can replace it with one of the defaults.
Hi Drew,
Thanks for the reply, but I'm not getting this at all. I've got a textarea field set up to load a "minimal" config of Redactor.
The "Editor configuration sets" part of the doc refers to PERCH_EDITOR_CONFIG in your _config.inc file. I just don't get what needs to be included in _config.inc to set up a customised Redactor configuration.
In Perch 2 with Redactor as an add-on, I had this in _config.inc
How do I set up the same options in Perch 3?
There is not
_config.inc
any more.The first argument to
Perch.UserConfig.redactor.get()
is the name of the profile you've selected in theeditor-config
attribute. Use that to branch your code and supply different configs.Thanks Drew. So I'm assuming this needs to go in addons/plugins/editors/config.js. I've amended this to add various plugins and then attempted to set up the different configs of the Redactor editor. Here's my entire config.js:
This isn't changing the buttons. Can you point me in the right direction with the code defining the editor config options?
When you have this:
That will always be false. Those two strings are not the same. They'll never be the same. I think you want this: