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

Document BlockControls component as preferred controls rendering #1172

Merged
merged 2 commits into from
Jun 15, 2017

Conversation

aduth
Copy link
Member

@aduth aduth commented Jun 14, 2017

Related: #468, #830, #1019

This pull request seeks to update blocks documentation, removing references to controls and wp.blocks.registerControl, the latter of which was never implemented. In their place is new documentation for the BlockControls component, which can be returned in the edit rendered result to populate a block's toolbars. See #830 for real-world example usage.

View documentation

Open questions:

How should we approach ES2015+/JSX vs. ES5 in documentation? Thus far the majority of documentation has been written as ES5 style, with assumption that ES2015 will not be a prerequisite for registering blocks. An exception to this is that an external link is included to an equivalent ES2015+/JSX implementation of the example block, but this has been difficult to maintain especially as changes have been made to the original code snippet. GitHub Markdown files support the <details> element, which could be useful for collapsible equivalent implementations. As we move toward integrating documentation into the WordPress developer site, it might be nice to consider tabbable previews like PouchDB Callbacks/Promises/Async functions demonstrations or Stripe language demonstrations.

Testing instructions:

There are only documentation changes included in this pull request.

aduth added 2 commits June 14, 2017 14:46
More pain than it's worth to try to pretend they're anything different than props. Also not accurate as a block instance, which includes only `uid`, `name`, and `attributes` (props include more e.g. `setAttributes`).
@aduth aduth added [Feature] Block API API that allows to express the block paradigm. [Type] Developer Documentation Documentation for developers labels Jun 14, 2017
@youknowriad
Copy link
Contributor

How should we approach ES2015+/JSX vs. ES5 in documentation?

My approach here would be to use ESnext. ESnext is now pretty commonly used in the JavaScript world. Maybe not in the WordPress world yet but we should make sure it gets more ❤️
I also think we should JSX to match the code.

But regardless this PR is 👍

@aduth
Copy link
Member Author

aduth commented Jun 15, 2017

For consistency's sake, I'm going to keep this as-is with the ES5 syntax, then we can revisit in a separate pull request which can be more targeted at the conversion (and hopefully invite more discussion in so doing).

@aduth aduth merged commit 95d50ca into master Jun 15, 2017
@aduth aduth deleted the update/docs-blocks-controls branch June 15, 2017 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Block API API that allows to express the block paradigm. [Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants