Blog post images with captions?

59 views
Skip to first unread message

Lee H.

unread,
May 7, 2015, 8:46:30 PM5/7/15
to mezzani...@googlegroups.com
Hi,

As far as a I can see, the tinyMCE default editor does not provide a way to add captions to images embedded in a blog post? (the description/title are there, but not a caption field).
Are captions really missing or am I being blind? Seems pretty basic functionality...

If they are missing, can someone recommend an alternative rich text editor or another custom way of implementing captions?

Cheers

Mathias Ettinger

unread,
May 9, 2015, 4:08:58 PM5/9/15
to mezzani...@googlegroups.com
I’m not sure of a way to add captions through the builtin widgets of tinyMCE but you can edit the HTML directly whenever you want. Just click the HTML button to open the editor and add your caption tag directly in there.

This editor will allow you to add nearly all the tags you can't (or don't know how to) access from the widgets.

Have a look at the RICHTEXT_ALLOWED_TAGS setting (http://mezzanine.jupo.org/docs/configuration.html#richtext-allowed-tags) to know which one are available with no particular configuration tweak.
The RICHTEXT_FILTER_LEVEL and the RICHTEXT_FILTER(S) settings can also help improve your control over the rendering of whatever you put into your tinyMCE editor.

Lee H.

unread,
May 10, 2015, 1:07:41 AM5/10/15
to mezzani...@googlegroups.com


Thanks for the reply. I know I can edit the HTML directly, but wanted this to be more user friendly for your average blogger. 

Ultimately I wrote a tiny snippet of jQuery that selects images with the '.caption' class, wraps them with a div and appends a caption paragraph with text from the images Description field (css then styles this up as an overlay). I then copied the tinymce init static js into the theme/static/mezzanine/js dir of my theme and customized it to add 'Image with Caption' as an option in the image class drop down menu (so user can select this class from the menu to give the image the needed 'caption' class that will trigger the jquery to add the caption).

Not sure if this was the easiest way to achieve this, but it seems to work OK.

Mathias Ettinger

unread,
May 10, 2015, 4:53:38 PM5/10/15
to mezzani...@googlegroups.com
I would have used either RICHTEXT_FILTER or RICHTEXT_FILTERS to achieve the same result. But I think it ils ultimately a matter of taste.
Reply all
Reply to author
Forward
0 new messages