Make WordPress Core

Opened 8 years ago

Closed 4 years ago

Last modified 5 months ago

#37069 closed defect (bug) (wontfix)

WP Color Picker has no appropriate disable / destroy method.

Reported by: aniruddh's profile Aniruddh Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.5.2
Component: General Keywords:
Focuses: javascript, administration Cc:

Description

It seems WP Color Picker has no appropriate disable or destroy method.

You can do

colorPicker.wpColorPicker('option','disabled', true);

Nothing happens except it adds wp-wpColorPicker-disabled class. The color picker works like it is in normal state.

The same thing happens with destroy method, you can do

colorPicker.wpColorPicker('destroy');

And nothing happens here, too.

Change History (4)

This ticket was mentioned in Slack in #core by noisysocks. View the logs.


4 years ago

#2 @isabel_brison
4 years ago

  • Resolution set to wontfix
  • Status changed from new to closed

Thanks for the suggestion @Aniruddh !

wpColorPicker is currently in maintenance mode so we're not adding enhancements/new features to it. Instead, we encourage you to try out our new color picker component over in the Gutenberg repo: https://github.com/WordPress/gutenberg/tree/master/packages/components/src/color-picker

#3 @joyously
4 years ago

How does that affect all the themes that use it currently?

#4 @alexvorn2
5 months ago

what I made to make this work, only this code:

$( DIV SELECTOR ).find( '.YOUR INPUT CLASS NAME' ).each( function() {
	var t = $( this );

	t.removeClass( 'wp-color-picker' );
	
	var t_clone = t.clone();

	var t_color_picker = t.parent().parent().parent();
	
	if ( t_color_picker.hasClass( 'wp-picker-container' ) ) {
		t_color_picker.before( t_clone );
		t_color_picker.detach();
	}


} );

Version 1, edited 5 months ago by alexvorn2 (previous) (next) (diff)
Note: See TracTickets for help on using tickets.