NicolasCARPi / jquery_jeditable

jQuery edit in place plugin. Extendable via plugin architecture. Plugins for plugin. Really.
https://jeditable.elabftw.net
MIT License
1.74k stars 458 forks source link

Error using plugin with Drupal 8 #205

Closed francesco-pesenti closed 5 years ago

francesco-pesenti commented 5 years ago

Hi, I'm using this great lib in a Drupal 8 project; all works fine except when I'm using a plugin (eg. datepicker). Since Drupal uses jQuery in a no-conflict mode other scripts need to be wrapped with:

(function($) {
})(jQuery);

From official documentation (https://www.drupal.org/docs/8/api/javascript-api/javascript-api-overview):

Note: Since Drupal uses jQuery.noConflict() and only loads JavaScript files when required, to use jQuery and the $ shortcode for jQuery you must include jQuery and Drupal as dependencies in the library definition in your MODULE.libraries.yml and add a wrapper around your function.

I saw you wrap the main script but not the plugins. Are there some issues on do this? If no and you agree I can made a patch.

NicolasCARPi commented 5 years ago

Hello,

Indeed the plugins are not wrapped, a patch would be much appreciated! :)

francesco-pesenti commented 5 years ago

Since I don't know how the dist files are minified, I changed only the src files.

https://github.com/NicolasCARPi/jquery_jeditable/pull/207