TinyMCE images

4 posts by 2 authors in: Forums > CMS Builder
Last Post: June 8, 2022   (RSS)

By pgplast - June 6, 2022

I believe that there is a way to modify tinyMCE to allow the addition of captions to images inserted into wysiwyg fields inside a CMSB section. However, it is not as yet clear to me how to modify things in a CMSB install to allow this.

Can this be done?

By Dave - June 7, 2022

Hi pgplast, 

Yea, we're currently using TinyMCE v4 and you can find a list of their plugins here: 
https://www.tiny.cloud/docs-4x/plugins/

If you can find (or make) a plugin that does what you want you can include it in the list of tinymce plugins loaded by CMSB in this file:

/cmsb/lib/wysiwyg.php

Just search for the word "plugins" and find this line that loads the various plugins: 

    // Load Plugins - list of available plugins can be found here: https://www.tiny.cloud/docs-4x/plugins/
    plugins: "table,fullscreen,paste,media,lists,charmap,textcolor,link,anchor,hr,paste,image,code,codesample",

Hope that helps!  Let me know any questions.

Dave Edis - Senior Developer
interactivetools.com

By pgplast - June 8, 2022

Hi, Dave. And thanls for the reply.

I was given to understand that the functionality I seek was provided in the image plugin you already have in your list. I was curious as to how to turn it on, though.

The tinyMCE docs say that the image plugin can do this:

his option lets users enable captions for images. When this option is enabled the image dialog will have an extra checkbox called "Caption". When a user checks the checkbox the image will get wrapped in an HTML5 figure element with a figcaption inside it. The user will then be able to type caption content inside the editor.

It then provides as example this code:

tinymce.init({selector:"textarea",// change this value according to your HTMLplugins:"image",menubar:"insert",toolbar:"image",image_caption:true});I was hoping you could point out where in the tinyMCE code one would add this boolean.

Thanks.
pgplast