Redactor: Allow customization of redactor plugins

Created on 3 May 2018  ·  13Comments  ·  Source: craftcms/redactor

The newest version of the Craft Redactor plugin comes with all of the Redactor plugins bundled in it, which is awesome!

But, these plugins don't give you the ability to customize with options passed from the Redactor configs. For example, the inlinestyles plugin, forces you to be locked into the styles provided (unless I'm missing something).

It would be awesome if we could pass in options from the Redactor config JSON files to override these.

Most helpful comment

It’s up to Imperavi to make their plugins configurable, so I’ll pass this feedback on to them.

That said if you need to make a change to one of the bundled plugins, you can just copy the plugin into your config/redactor/plugins/ folder, and make changes to it there. If the plugin is found in that directory, that one will take precidence over the bundled version.

All 13 comments

It’s up to Imperavi to make their plugins configurable, so I’ll pass this feedback on to them.

That said if you need to make a change to one of the bundled plugins, you can just copy the plugin into your config/redactor/plugins/ folder, and make changes to it there. If the plugin is found in that directory, that one will take precidence over the bundled version.

Ah ok cool, didn't realize that we could make a copy in config/redactor/plugins/. That'll work for now, thanks!

@brandonkelly I didn't realize it either and it's a great feature!
I recommend adding a reference to it in the README file...

@davist11 I wrote the Custom Styles plugin that does exactly what you’re after. Have a look at the example JSON file https://github.com/carlcs/craft-redactorcustomstyles/blob/v3/_examples/redactor/Example.json

@carlcs I'm having this same issue with your plugin too:

"button": {
    "args": {
        "tag": "a",
        "class": "button",
        "type": "toggle"
    }
}

2018-07-02 14_44_34

@davist11 yeah, I can replicate, it appends a new anchor tag instead of applying the format to the selected tag. Unfortunatelly there’s nothing I can do, as this seems to be a bug with the inline service functions.

https://imperavi.com/redactor/docs/api-services/inline/

Yup, that’s what I was experiencing too when creating a direct copy of the plugin file and modifying.

Just wanted to chime in here and second the comment made by @iMoses . Spent the better part of a day trying to put together a craft php plugin to add redactor functionality without knowing about the config/redactor/plugins/ folder. Very convenient! I'm sure a quick line about this in the docs would save a lot of people time @brandonkelly .

Is it possible to do a similar thing with the redactor js files?

I want to modify CraftCMS's original configuration for images.

I can modify these lines in vendor/craftcms/redactor/redactor.min.js

imagePosition: !1,
imageResizable: !1,

to

imagePosition: !0,
imageResizable: !0,

to get what I want. But this obviously isn't a good idea because now I can't run updates.

I tried creating a copy here config/redactor/redactor.min.js
But that didn't work. Is there a cool easy way to do this type of thing too?

If not, what do you think would be the easiest solution?

Have you tried to set the relevant options in the Redactor config?

@andris-sevcenko
Well I don't feel very smart now.
But I'm definitely happy about how stupid easy that was. Thanks!

@nickolasjadams I'm just glad you got what you needed :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lukeyouell picture lukeyouell  ·  26Comments

lindseydiloreto picture lindseydiloreto  ·  3Comments

diluno picture diluno  ·  3Comments

sidm1983 picture sidm1983  ·  7Comments

jsunsawyer picture jsunsawyer  ·  15Comments