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');
}
}
}, 