1

I'm looking to let editors determine the alignment of images in a Redactor field.

I wasn't sure if it worked out of the box with Craft 3 (I'm using 3.0.9).

I did find this plugin: https://github.com/picdorsey/craft-redactorimageposition but it looks like it is Craft 2 and I don't see any forks that are updated for Craft 3.

Any suggestions on how to let users in the Control Panel control alignment of images in a WYSIWYG field would be very helpful. (This link suggests using a Matrix field, but I'm not sure how that would give the user control: Using the Redactor rich text field, how can I dynamically wrap my images with a fancyBox link (with attributes as parameters)? )

1

It looks like the right way to do this is to tweak the redactor settings:

https://github.com/craftcms/redactor#redactor-configs

and

https://imperavi.com/redactor/docs/settings/image/#s-imageposition

All you have to do is add this key to your redactor config:

"imagePosition": true,

and clear your control panel cache.

The option for image position shows up on the 'edit image' screen.

If you want to use classes to control your image alignment and you want the redactor fields to continue to be WYSIWYG, you need to share those CSS classes between the CP and your front end. This answer will probably help: Where do I add custom css for the Redactor editor in the Craft control panel?

| improve this answer | |

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.