kallookoo / wp-color-picker-alpha

Overwrite Automattic Iris for enabled Alpha Channel in wpColorPicker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error using inside WordPress Widget

kallookoo opened this issue · comments

HI kallookoo,

thanks on quick answer. Here is the video showing the issue https://www.screencast.com/t/77bakoIH As you can see, problem is that button for save is never in disabled state with saved label. Also, remove label is not shown. Maybe the biggest problem is that when you use colorpicker with alpha on widget page, when you want to navigate off, confirmation dialog is displayed on top of the window and users get confused, everything is saved, but confirmation dialog is displayed. Could you please consider some improvement regarding this?

Thanks in advance,
Uros

Originally posted by @urosmil in #22 (comment)

Hi @urosmil
Would it be possible to send me the widget code, so I do not have to do it?

test-color.zip

Hi @kallookoo In the attachment you can find widget php file, js for color picker in admin and alpha script. Add them to theme root and then in functions.php add following code

include_once 'test-color.php';

function load_test_color_script() {
	wp_enqueue_style( 'wp-color-picker' );
	wp_enqueue_script( 'wp-color-picker-alpha',MASTERDS_FRAMEWORK_INC_URL_PATH . '/common/assets/js/plugins/wp-color-picker-alpha.min.js', array( 'wp-color-picker'));
	wp_enqueue_script( 'test-color-js', get_template_directory_uri() . '/test-color.js', array( 'jquery' ), false, true );
}

add_action( 'admin_enqueue_scripts', 'load_test_color_script' );

Thanks @urosmil
I'll use it in the default WordPress theme (Twenty Sixteen) and check what exactly happens.
I guess for the weekend, you will have an answer.

Hi @kallookoo Any update on this? Tnx

Hi @urosmil
Sorry, I thought I answered you.
Apparently it's not the script's fault, it's your code.
I recommend you check the Text Widget code and adapt it.
Sources:
/wp-includes/widgets/class-wp-widget-text.php and
/wp-admin/js/widgets/text-widgets.js

Hi @kallookoo thanks for the answer. I must disappoint you but I have just tested the code on 2017 theme. No plugins active, just pure 2017 theme, included scripts and widget, problem still remains. Can you please double check it? :/

Sorry, this is an automatic translation

Hi kallookoo,
I confirm the urosmil problem, both on my work theme (Genesis child) and on clean installation WP 4.9.8 and Twenty Sixteen theme: 1.6

TEST
WP 4.9.8
Twenty Sixteen themeVersion: 1.6
File: test-color.zip sent by urosmil

Note
I unlike urosmil, I use a different JS code, but the error is the same.
Thanks, Claudio_

I close it. I have created a widget in the plugin and it works perfectly.