Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WordPress 5.5 incompatibility #35

Closed
mapsteps opened this issue Jul 14, 2020 · 28 comments
Closed

WordPress 5.5 incompatibility #35

mapsteps opened this issue Jul 14, 2020 · 28 comments
Labels

Comments

@mapsteps
Copy link

I was just testing this with WordPress 5.5 and I'm getting the following error:

Uncaught ReferenceError: wpColorPickerL10n is not defined

Reference - WordPress/WordPress@7e7b70c

@bwmarkle
Copy link

I'm having the same problem. After a bit of troubleshooting, I have ended up here!

@kallookoo
Copy link
Owner

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.

@wayheming
Copy link

Same issue

@sehrish-iftikhar
Copy link

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.

@a-danae
Copy link

a-danae commented Aug 7, 2020

@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.

prince5ingh added a commit to prince5ingh/wp-color-picker-alpha that referenced this issue Aug 12, 2020
@prince5ingh
Copy link

@kallookoo Please checkout the pull request :

#38

@pzstar
Copy link

pzstar commented Aug 12, 2020

@prince5ingh your solution will not work and is not a proper way. Please check @a-danae solution.

@prince5ingh
Copy link

@pzstar well i tested at my end and is working, secondly did you check the official WP commit which caused this issue ?
WordPress/WordPress@7e7b70c

@pzstar
Copy link

pzstar commented Aug 12, 2020

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.

@prince5ingh
Copy link

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.

@pzstar
Copy link

pzstar commented Aug 12, 2020

Ok. Thanks for the explanation :)

@wayheming
Copy link

@prince5ingh thank you!

@shivapoudel
Copy link

@prince5ingh Tested, amazing it works like a charm 👍

maddisondesigns added a commit to maddisondesigns/wp-color-picker-alpha that referenced this issue Aug 26, 2020
@maddisondesigns
Copy link

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

@kallookoo kallookoo pinned this issue Aug 27, 2020
@kallookoo kallookoo unpinned this issue Aug 27, 2020
@kallookoo
Copy link
Owner

kallookoo commented Aug 27, 2020

@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.

@kallookoo kallookoo pinned this issue Aug 27, 2020
@rilwis
Copy link

rilwis commented Aug 30, 2020

Hey guys, any updates for this?

@kallookoo
Copy link
Owner

@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.

@mweichert
Copy link

Make sense, @kallookoo.

Has anyone tested against jQuery 3.5? That's what will be shipped in December.

@maddisondesigns
Copy link

@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.

@kallookoo
Copy link
Owner

Hi,
Try the branch 3.0.0 and comment please.

@maddisondesigns
Copy link

@kallookoo Have just tried this new version and it's not working for me unfortunately.

screenshot_488

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

@htmgarcia
Copy link

@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!

@kallookoo
Copy link
Owner

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 kallookoo unpinned this issue Nov 1, 2020
@maddisondesigns
Copy link

maddisondesigns commented Nov 3, 2020

@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.

@kallookoo
Copy link
Owner

Hi @maddisondesigns it is fixed.
Look at the changes in the plugin repository as it was a plugin problem not this script.

@maddisondesigns
Copy link

@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.

@kallookoo
Copy link
Owner

Umm, Please open a new issue and if possible add your customize code, thank you.

@leadpresence
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests