kallookoo / wp-color-picker-alpha

Overwrite Automattic Iris for enabled Alpha Channel in wpColorPicker
GNU General Public License v2.0
132 stars 88 forks source link

Version 3.0.3 self is undefined #55

Closed hupe13 closed 3 months ago

hupe13 commented 3 months ago

I would like to use wp-color-picker-alpha.min.js with my plugin. Version 3.0.0 works. Version 3.0.3 produces an error:

Uncaught TypeError: self is undefined
    _change https://my-domain.tld/wp-content/plugins/myplugin/js/wp-color-picker-alpha.min.303.js:11
    x.widget/</r[e]< jQuery
    _create https://my-domain.tld/wp-admin/js/iris.min.js?ver=1.1.1:5
    jQuery 2
    _create https://my-domain.tld/wp-content/plugins/myplugin/js/wp-color-picker-alpha.min.303.js:11
    jQuery 7
    _create https://my-domain.tld/wp-admin/js/color-picker.min.js?ver=6.6.1:2
    jQuery 2
    _create https://my-domain.tld/wp-content/plugins/myplugin/js/wp-color-picker-alpha.min.303.js:11
    jQuery 7
    <anonymous> https://my-domain.tld/wp-content/plugins/myplugin/js/colorpicker.js:9
    jQuery 13
[wp-color-picker-alpha.min.303.js:11:3619](https://my-domain.tld/wp-content/plugins/myplugin/js/wp-color-picker-alpha.min.303.js)
    _change https://my-domain.tld/wp-content/plugins/myplugin/js/wp-color-picker-alpha.min.303.js:11
    x.widget/</r[e]< jQuery
    _create https://my-domain.tld/wp-admin/js/iris.min.js?ver=1.1.1:5
    jQuery 2
    _create https://my-domain.tld/wp-content/plugins/myplugin/js/wp-color-picker-alpha.min.303.js:11
    jQuery 7
    _create https://my-domain.tld/wp-admin/js/color-picker.min.js?ver=6.6.1:2
    jQuery 2
    _create https://my-domain.tld/wp-content/plugins/myplugin/js/wp-color-picker-alpha.min.303.js:11
    jQuery 7
    <anonym> https://my-domain.tld/wp-content/plugins/myplugin/js/colorpicker.js:9
    jQuery 13

The content of myplugin/js/colorpicker.js is:

jQuery( document ).ready(
    function () {
        jQuery( ".color-picker" ).wpColorPicker();
    }
);

The input field is:

echo '<input type="text" class="color-picker" id="mycolor" name="mycolor"
    data-alpha-enabled="true" data-default-color="' . $defcolor . '" value="' . $value . '">';

Thank you very much.

hupe13 commented 3 months ago

The pull request solves this also.