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

issue # 7 - Repeat Field inside editor #9

Merged
merged 1 commit into from
May 8, 2018
Merged

issue # 7 - Repeat Field inside editor #9

merged 1 commit into from
May 8, 2018

Conversation

timarney
Copy link
Contributor

@timarney timarney commented May 6, 2018

No description provided.

this.setState(function (prevState, props) {
return { items: prevState.items + 1 }
}, () => {
this.props.setAttributes && this.add();
Copy link
Owner

@zackify zackify May 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I see what you meant no need for local state because we can just set a new empty item 👍

@zackify zackify changed the base branch from master to develop May 8, 2018 00:34
@zackify zackify merged commit 49df7a7 into zackify:develop May 8, 2018
@zackify
Copy link
Owner

zackify commented May 8, 2018

Used what you had to make it not use state at all, thanks. Only thing is that it has to use onChange that you need to pass it, because that's what gets passed down and called on the nested inputs, so all you need in your code is the
onChange: (name, value) => data.setAttributes({ [name]: value }) inside the editor.

I might add a HOC so you dont have to do this in the editor, like editor-repeat that has the context and passes in the onChange and attributes

https://github.com/crossfield/gutenblock/releases/tag/0.6.3

@zackify
Copy link
Owner

zackify commented May 8, 2018

ok actually did it, so check this out https://github.com/crossfield/gutenblock/releases/tag/0.6.5 💯

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

Successfully merging this pull request may close these issues.

2 participants