1

Using Redactor Custom Styles plugin we're adding a button with options to toggle classes on figures. It mostly works except for images. Here's an entry in our redactor config.

"customStyles": {
  "figureStyles": {
      "icon": "<span class='fas fa-images'></span>",
      "dropdown": {
        "Center Max 70%": {
          "api": "module.block.format",
          "args": {
            "tag": "figure",
            "class": "image-center-max-70",
            "type": "toggle"
          }
        }
2

I've never had a lot of luck using the custom styles drop down to do things like this, so I created a Redactor plugin that inserts a class name drop down directly to the image edit modal.

enter image description here

Full code and documentation is here:

https://github.com/simplicate-web/redactor-image-class

When I saw your question I realized I could whip this up pretty quickly by basing it off of another plugin I wrote for managing class names on links.

So if you notice any bugs, shoot me a message and I'll try to get them cleared up for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.