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

ColorPicker controls gets destroyed after widget save #1228

Open
rubengc opened this issue Feb 19, 2019 · 1 comment
Open

ColorPicker controls gets destroyed after widget save #1228

rubengc opened this issue Feb 19, 2019 · 1 comment

Comments

@rubengc
Copy link
Contributor

rubengc commented Feb 19, 2019

I'm using CMB2 fields on widgets area using this snippet taken from CMB2 library

I know that fields on widget area aren't built-in supported, but this issue could be easily fixed by simply adding a control initialization on widgets area replacing this lines by the following code:

// Auto Call plugin is class is color-picker
jQuery( document ).ready( function( $ ) {
	$( '.color-picker' ).wpColorPicker();

	 // Initialize on widgets area
	$(document).on('widget-updated widget-added', function(e, widget) {
		widget.find( '.color-picker, .cmb2-colorpicker' ).wpColorPicker();
	});
} );

If this fix isn't get released, those lines could be useful as a reminder when CMB2 fields on widgets area gets supported at any time

@tw2113
Copy link
Contributor

tw2113 commented Feb 19, 2019

hey @rubengc this is looking good. If you could issue a pull request on the develop branch, that would be awesome and we can get that merged in.

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

No branches or pull requests

2 participants