You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Wow, why is the standalone version of wpColorPicker different from the build in, so bad. The documentation of iris.js says false on palettes.
Good.
Same as 1, the standalone version of wpColorPicker is different from WordPress's. But adding all options that are relevant isn't so hard, just time consuming :)
Activity
frozzare commentedon Jul 29, 2016
I think there is a problem with the color picker in wp, I will take another look at this and see if I can do anything in Papi to fix it.
nlemoine commentedon Oct 21, 2016
I can confirm this issue too. I'm currently looking into it.
Here's what I found out:
1 - There's an issue with
palettesproperty.Default is an array: https://github.com/wp-papi/papi/blob/master/src/properties/class-papi-property-color.php#L16
If no settings are provided, this returns an empty array to the
palettesproperty of the options object passed towpColorPicker. Default should betrue.2 - There's another issue (palettes are buggy when clicked) caused by this: https://github.com/wp-papi/papi/blob/master/src/assets/js/properties/color.js#L44-L46
Is there any reason you want to trigger
changeon the input? I didn't look deeper but looks like no function is binded to this event.Actually, some options in papi doesn't exist in
wpColorPicker: https://github.com/WordPress/WordPress/blob/master/wp-admin/js/color-picker.js#L13-L20Is there a reason here too?
frozzare commentedon Oct 21, 2016
Remove change event from color picker #179
frozzare commentedon Oct 23, 2016
palettesoptions that will give a a empty array isn't a problem since it's checked in the js code https://github.com/wp-papi/papi/blob/f546c80/src/assets/js/properties/color.js#L44changeevent and it's seems that it works better. Could you try it out @nlemoine or @richardsweeney? (3.xbranch)wpColorPickerto the property? (maybe not thetargetoption)nlemoine commentedon Oct 24, 2016
1 - If
palettesarray is empty, palettes should returntrue, notfalse(I think most people expect the ability to choose colors, not only some colors from black to white):!palettes.length ? true : palettesBut even when passing
trueto palettes, an empty array is still passed toiris: https://github.com/WordPress/WordPress/blob/master/wp-admin/js/color-picker.js#L58. If you take a look at WordPress color picker code, options passed towpColorPickerare merged with the ones found in element data: https://github.com/WordPress/WordPress/blob/master/wp-admin/js/color-picker.js#L31And Papi uses a data attributes named
data-palettesto get the palettes array. So the empty array found in data attributes overrrides thetruevalue returned by Papi.So there's no need to pass palettes (or any other options) through papi JS, these lines could actually be removed:
papi/src/assets/js/properties/color.js
Line 36 in f546c80
papi/src/assets/js/properties/color.js
Line 44 in f546c80
The only thing you need is set the data attribute
data-paletteson the input element accordingly:papi/src/properties/class-papi-property-color.php
Line 32 in f546c80
'data-palettes' => $settings->palettes ? $settings->palettes : true,And eventually other options could be passed as data-dattributes.
2 - Yes, this resolves the palettes click issue.
3 - Why not. What's the target option, I can't see it? https://github.com/WordPress/WordPress/blob/master/wp-admin/js/color-picker.js#L13-L21
frozzare commentedon Oct 24, 2016
wpColorPickerdifferent from the build in, so bad. The documentation of iris.js saysfalseonpalettes.wpColorPickeris different from WordPress's. But adding all options that are relevant isn't so hard, just time consuming :)Fix palettes array for color picker #179
Fix palettes array for color picker #179
frozzare commentedon Oct 25, 2016
wpColorPickerand notiris.jssince the diff.nlemoine commentedon Oct 25, 2016
Thanks! 👍