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 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

By pgplast - June 8, 2022

Dave:

Sorry to waste your time. I found where to put it in your code and the captions are working!

At line 50 in wysiwyg.php, changed to:

<script language="javascript" type="text/javascript"><!--
tinyMCE.init({
mode: "exact",
theme: "modern",
branding: false,
selector: "textarea",
plugins: "image",
menubar: "insert",
toolbar: "image",
image_caption: true,
language: "{$SETTINGS['wysiwyg']['wysiwygLang']}",

Thanks

pgplast