kallookoo / wp-color-picker-alpha

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

Error using inside WordPress Widget #23

Closed kallookoo closed 3 years ago

kallookoo commented 5 years ago

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 https://github.com/kallookoo/wp-color-picker-alpha/issues/22#issuecomment-422035462

kallookoo commented 5 years ago

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

urosmil commented 5 years ago

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' );
kallookoo commented 5 years ago

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.

urosmil commented 5 years ago

Thanks a lot @kallookoo

urosmil commented 5 years ago

Hi @kallookoo Any update on this? Tnx

kallookoo commented 5 years ago

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

urosmil commented 5 years ago

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? :/

K15Lmk98 commented 5 years ago

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_

kallookoo commented 3 years ago

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