Closed mapsteps closed 4 years ago
I'm having the same problem. After a bit of troubleshooting, I have ended up here!
Hi guys After one o two weeks update the repo for add compatibility or create new version for overwrite all scripts because I think it could be improved.
Same issue
I am also facing this issue. Any help will be greatly appreciated? We have to remove the alpha color picker because without resolving the JS error we can update the WP version against our plugins.
@sehrish-iftikhar as a workaround, while the issue is fixed, localizing the strings that aren't localized anymore in the core seems to do fine.
wp_register_script( 'wp-color-picker-alpha', $url_to_picker_script . '/wp-color-picker-alpha.min.js', $dependencies, $version, true );
$color_picker_strings = array(
'clear' => __( 'Clear', 'textdomain' ),
'clearAriaLabel' => __( 'Clear color', 'textdomain' ),
'defaultString' => __( 'Default', 'textdomain' ),
'defaultAriaLabel' => __( 'Select default color', 'textdomain' ),
'pick' => __( 'Select Color', 'textdomain' ),
'defaultLabel' => __( 'Color value', 'textdomain' ),
);
wp_localize_script( 'wp-color-picker-alpha', 'wpColorPickerL10n', $color_picker_strings );
wp_enqueue_script( 'wp-color-picker-alpha' );
Glad to learn if there's a better approach.
@kallookoo Please checkout the pull request :
@prince5ingh your solution will not work and is not a proper way. Please check @a-danae solution.
@pzstar well i tested at my end and is working, secondly did you check the official WP commit which caused this issue ? https://github.com/WordPress/WordPress/commit/7e7b70cd1ae5772229abb769d0823411112c748b
Oh i see the WP commit and it looks incorrect as well because the translation value passed in javascript file like this __( 'Color value' ) can never be translated.
lol, instead of making comments would have been better if you would have read the code & tried to understand it
__
is local function which is an alias of global method wp.i18n.__
. since 5.5 its being used and wpColorPickerL10n
is removed completely which was coming through localize script.
Ok. Thanks for the explanation :)
@prince5ingh thank you!
@prince5ingh Tested, amazing it works like a charm 👍
Have just submitted a PR for this.
This PR takes in account comments that were raised on a previous PR submitted by @prince5ingh including compatibility with previous WP versions.
Has been tested with WordPress 4.8.14, 4.9.15, 5.4.2 and 5.5
@a-danae Your solution is not the best, since others could also use this script and each time it is included the same variables would be created, also thank you for your contribution.
@maddisondesigns Thanks for this PR but there are other issues as I am reviewing all the original code to solve all you can.
For all those who can't wait, you have this modification created by @maddisondesigns that works when it comes to translating the texts.
Hey guys, any updates for this?
@ArrayIterator It's not like that. Everything is updated to improve or facilitate its use, security, etc ... If you use something old it is normal that it does not work. The point is that it takes time to update as well, but you don't earn money, or at least I do, as with this script for example. I am the creator and I have a certain responsibility to make it work, but no obligation to fix it at the moment so that certain plugins or paid themes, take their profits. (If I had a vulnerability it would be different.) I do not know if I explained well what I mean. Soon there will be an update, as I already mentioned.
Make sense, @kallookoo.
Has anyone tested against jQuery 3.5? That's what will be shipped in December.
@mweichert I just tested my PR that I submitted above, with jQuery 3.5.1 (on WP 5.5.1) and everything works fine.
If you want to test it yourself, you can do it easily by installing the Test jQuery Updates plugin and enabling v3.5.1 in the settings.
Hi, Try the branch 3.0.0 and comment please.
@kallookoo Have just tried this new version and it's not working for me unfortunately.
I've just updated my script to the new 3.0.0 version and the customizer controls render as per the screenshot above. It's not showing the Alpha slider.
This was tested on WP 5.5.1
@a-danae your suggestion worked like a charm to solve these type of warnings in console:
wpColorPickerL10n.defaultLabel is deprecated since version 5.5.0! Use wp.i18n instead.
Thanks!
Resolved. Thank you all for the collaboration and I am sorry to wait but in my tests it already works well and if you want you have examples of how to use it in this repository
@kallookoo Thanks again for all your work on this control. I've been updating my own Customizer code with your new script and after implementing the changes that you've made to the data attributes, I have the color picker showing as expected, in the Customizer. The problem is, whenever I select a colour, the change isn't being triggered and the Publish button is never becoming enabled.
Here's a short vid: https://share.getcloudapp.com/7Ku8NJn7
Is there something else that I'm missing? When I start the script, the only option I'm passing is the palette colors.
Hi @maddisondesigns it is fixed. Look at the changes in the plugin repository as it was a plugin problem not this script.
@kallookoo This is a problem I'm having with this new version of the script. I've deactivated your test plugin, but I'm still having issues with the changes not being triggered in my own Customizer controls, using this new version of the script.
Umm, Please open a new issue and if possible add your customize code, thank you.
Just download WP Downgrade plugin and down grade to a more stable and compatible WP version until most plugins of that theme meets the recent WP version.
I was just testing this with WordPress 5.5 and I'm getting the following error:
Uncaught ReferenceError: wpColorPickerL10n is not defined
Reference - https://github.com/WordPress/WordPress/commit/7e7b70cd1ae5772229abb769d0823411112c748b