You need to be logged in to post in the forum - Log In

An active JCE Pro Subscription is required to post in the forum - Buy a Subscription

Support is currently Offline

Official support hours
Monday to Friday
09:00 - 17:00 Europe/London (BST)

Please create a new Ticket and we will get back to you as soon as we can.

#117177 Console error when trying to add an image in a site module

Posted in ‘Editor’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Latest post by buro26 on Thursday, 24 April 2025 10:31 BST

buro26

Hi,

We are having some issues with the file editor in the site modules from Joomla. When trying to add or replace an image the modal is not adding the image and closing after inserting. For now i added a quick fix. Can you please check if this is a bug in JCE.

Best regards,

Jamie

 windowManager: {
            params: {
                window: window.parent,

                callback: function (selected, data) {
                    var win = window.parent, values = data[0], url = values.url;
                
                    var elm = win.document.getElementById(tinymce.settings.element);
                
                    // Check if jQuery is available in the parent window
                    if (typeof win.jQuery !== 'function') {
                        console.warn("jQuery is not available in the parent window context. Attempting to load it dynamically.");
                
                        // Dynamically load jQuery into the parent window
                        var script = win.document.createElement('script');
                        script.src="https://code.jquery.com/jquery-3.6.0.min.js"; // Use a CDN or local path
                        script.type = "text/javascript";
                        script.onload = function () {
                            console.log("jQuery loaded successfully in the parent window.");
                            proceedWithCallback();
                        };
                        script.onerror = function () {
                            console.error("Failed to load jQuery in the parent window.");
                        };
                        win.document.head.appendChild(script);
                    } else {
                        proceedWithCallback();
                    }
                
                    function proceedWithCallback() {
                        // Joomla 3.5.x / 4.x Media Field
                        var $wrapper = win.jQuery(elm).parents('.field-media-wrapper'),
                            inst = $wrapper.data('fieldMedia') || $wrapper.get(0);
                
                        if (inst && inst.setValue) {
                            return inst.setValue(url, values);
                        }
                
                        win.jQuery(elm).val(url).trigger('change');
                    }
                }

            },

Attachments

Ryan

Please try JCE Pro 2.9.85 Beta 7 - https://www.joomlacontenteditor.net/downloads/editor/pro/development

This removes the use of jQuery in this instance.

Clear your browser cache after install.

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

buro26

Thanks Ryan,

Got it working after installing the update.