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

WP 5.5 Incompatibility issue #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

moritzlang
Copy link

Since the Wordpress 5.5 Update there is a known incompatibility issue of the wp-color-picker-alpha vendor.
Updating the dependency resolves issues with styles and translations.

@7studio
Copy link
Owner

7studio commented Nov 20, 2020

Hi @moritzlang,

Thank you for your contribution.

You are right, we need to update the kallookoo/wp-color-picker-alpha dependency to 3.0.0. But it would be great to update also the way to load the script as that is recommended: https://github.com/kallookoo/wp-color-picker-alpha#usage.
Can you also fix this in your PR please?

@moritzlang
Copy link
Author

Hi @7studio!
I updated the PR. I am happy for any feedback since I am not very experienced in WP plugin development.

Comment on lines -198 to -219
global $wp_scripts;

$url = $this->settings['url'];
$version = $this->settings['version'];
$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';

// register if not already (on front end)
// http://wordpress.stackexchange.com/questions/82718/how-do-i-implement-the-wordpress-iris-picker-into-my-plugin-on-the-front-end
if ( ! isset( $wp_scripts->registered['iris'] ) ) {
wp_register_style( 'wp-color-picker', admin_url( 'css/color-picker.css' ), array(), '', true );

wp_register_script( 'iris', admin_url( 'js/iris.min.js' ), array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), '1.0.7', true );
wp_register_script( 'wp-color-picker', admin_url( 'js/color-picker.min.js' ), array( 'iris' ), '', true );

wp_localize_script( 'wp-color-picker', 'wpColorPickerL10n', array(
'clear' => __( 'Clear', 'swp-acf-cp' ),
'defaultString' => __( 'Default', 'swp-acf-cp' ),
'pick' => __( 'Select Color', 'swp-acf-cp' ),
'current' => __( 'Current Color', 'swp-acf-cp' )
) );

}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you restore this part please? That is no relation with the new way to load wp-color-picker-alpha ;)

@@ -176,7 +176,7 @@ function render_field( $field ) {
?>
<div class="acf-color-palette">
<?php acf_hidden_input( $hidden_input ); ?>
<input type="text" <?php echo acf_esc_attr( $text_input ); ?> data-alpha="true">
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the right way to operate because acf_esc_attr will output a class attribute too. That will be better to modify the variable $text_input like that: $text_input['class'] .= ' color-picker';.

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

Successfully merging this pull request may close these issues.

2 participants