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

Fix default value support in editor components #1511

Closed

Conversation

papandreou
Copy link
Contributor

- Summary

Fix #1406 -- see the description in the issue.

Also includes a simple implementation of #1407 that's at least compatible with custom components (but there's no way to achieve dynamic default values via config.yml). I needed this myself to get my automatically issued uuids to work, but feel free to ignore that commit if a solution for #1409 is required to be a part of that feature.

- Test plan

I've tested it manually in my own application and found that the default values work with various widgets, including hidden.

- Description for the changelog

Editor components: Fix support for default field values

@verythorough
Copy link
Contributor

Deploy preview for netlify-cms-www ready!

Built with commit fe9c3fc

https://deploy-preview-1511--netlify-cms-www.netlify.com

@verythorough
Copy link
Contributor

Deploy preview for cms-demo ready!

Built with commit fe9c3fc

https://deploy-preview-1511--cms-demo.netlify.com

@papandreou
Copy link
Contributor Author

I chose to pass the plugin definition/collection to the default value function, but I don't actually need that myself, and it might be a bit too opinionated :)

@erquhart
Copy link
Contributor

erquhart commented Aug 3, 2018

We should hold off on the dynamic part in this PR and just support static default values. Fields in editor components should work exactly the same as fields that are not in an editor component, which is the basis for #1406 being considered a bug.

@papandreou
Copy link
Contributor Author

@erquhart, fair enough. Feel free to only pull in the first commit (3560a61), then.

@tech4him1
Copy link
Contributor

I'm pulling the static part of this out into a seperate PR, #1616. I'm going to close this one for now and just reference it in #1407 so we can look back at it later.

@tech4him1 tech4him1 closed this Aug 14, 2018
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.

Specifying a default value doesn't work for fields in editor components
4 participants