mercredi 30 novembre 2016

JS Checkbox works just for one time in TinyMCE

I got a problem with a checkbox, i added a checkbox into TinyMCE adimage in magento. It just put some code around the inserted image, that the lightbox addon will work and you don't have to add the code manually. It is in the backend of magento.

i added this to image.htm:

                        <td class="column1"><label id="lightboxlabel" for="lightbox">{#advimage_dlg.lightbox}</label></td>
                        <td><table role="presentation" border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td><input type="checkbox" id="lightbox" name="lightbox" class="checkbox" checked="checked" /></td>
                                <!-- <td><label id="lightboxlabel" for="lightbox">{#advimage_dlg.lightbox}</label></td> -->
                            </tr>
                        </table></td>

and this to image.js in insertAndClose():

            if (f.lightbox.checked) {

           ed.execCommand('mceInsertContent', false, '<a href="' + args.src + '"}} data-lightbox="' + args.alt + '" data-title="' + args.title + '">' );
        }

now, when i make a new cms page and wanna add an image with wysiwyg editor i can add the first image with the code and every image after that won't get the code. if a delete "if (f.lightbox.checked)" it will put the code around it every time, so probably there is a problem with the get of the checkbox boolean.




Aucun commentaire:

Enregistrer un commentaire