-
Notifications
You must be signed in to change notification settings - Fork 0
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
Create a dynamic block for the [nivo] slider #10
Comments
Having found that I can import partial from lodash ( ah... must be an alias for underscore... that's what Andrew said ) I'm now trying to implement some of the parameters as SelectControl's. |
It appears that importing from lodash is causing the same problems as was reported in WordPress/gutenberg#4043 (comment) The fix appears to be the same.
to the list of plugins. |
The parameters passed to the iteratee function for |
It’s possible to use both a TextField and a Select control against the same attribute. This will allow the user to pick a common value from the select control or type a different value in the entry field. Thi can be used for parameters such as |
While checking the current status of this block I edited the documentation at https://s.b/oikcom/wp-admin/post.php?post=33956&action=edit There were 6 of the slide up messages. WordPress 5.8.1, Gutenberg 12.3.0 Explanation
|
These messages were a known problem in Gutenberg. It's been removed in WordPress 5.9-RC2. |
Having battled with multiple attributes in the Countdown block I now want to try to implement a generic solution that uses the techniques suggested by @aduth.
We'll try doing this for the [nivo] shortcode.
These are the helpful notes from Andrew Duthie.
These aren’t really specific to Gutenberg, but to your questions on generalization, seems like it can be solved with a few functions, and maybe some partial application via
Function#bind
(https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind) or Lodash/Underscore_.partial
http://underscorejs.org/#partialonChange={ partial( handleChange, 'someKey' ) }
/// ...
function handleChange( key, value ) {
var nextAttributes = {};
nextAttributes[ key ] = value;
setAttributes( nextAttributes );
// ES6: setAttributes( { [ key ]: value } );
}
I’d suggest reading more on the keys article, as the answer is not “add key to everything”, it’s specific to when you’re returning an array from a component (you can also return Fragment to avoid this,
wp.element.Fragment
https://reactjs.org/docs/fragments.html) or when mapping over arraysAnd for the distinction on controlled and uncontrolled form components https://reactjs.org/docs/forms.html
The text was updated successfully, but these errors were encountered: