vollyimnetz / crop-thumbnails

"Crop Thumbnails" made it easy to get exacly that specific image-detail you want to show. Crop your images the simple way.
GNU General Public License v3.0
47 stars 21 forks source link

Elementor conflict #87

Open MonsieurPilou opened 8 months ago

MonsieurPilou commented 8 months ago

Hello, I'm using the Elementor plugin and when I open the media window from an Elementor block, the "Crop featured image" button doesn't work. There seems to be a conflict between elementor and this plugin: the plugin's JS is not loaded in the DOM.

I've managed to fix this by combining the 'init' and 'wp_footer' hooks and using 'wp_enqueue_script': wp_enqueue_script( 'crop-thumbnails', WP_PLUGIN_URL . /crop-thumbnails/app/main.js', array('jquery'), '1.0', true );

At this point, app/main.js returns an error: ajaxurl is not defined

Is there a clean way of making Elementor work (elementor works as an iframe) with this plugin (WP media modal is inserted at the root of the DOM)?

Thanks

vollyimnetz commented 3 weeks ago

Hi @MonsieurPilou, sorry for the long response time. Unfortunately i could not find any solution to this problem, tried multiple hours but i didn't manage to get an javascript running once the media dialog is opened on the elementor edit page.

If anyone could provide me with an example code to fire i.e. a console.log once the dialog opens then i will add the functionality.