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 how developers can use block editor notices #13592

Closed
danielbachhuber opened this issue Jan 30, 2019 · 10 comments
Closed

Document how developers can use block editor notices #13592

danielbachhuber opened this issue Jan 30, 2019 · 10 comments
Assignees
Labels
[Package] Notices /packages/notices [Type] Developer Documentation Documentation for developers

Comments

@danielbachhuber
Copy link
Member

Following up on the conversation in #11604 (comment), developers would benefit from some documentation on how to use block editor notices.

I've started a draft in this Dropbox Paper document: https://paper.dropbox.com/doc/Using-notices-in-the-block-editor--AWl6LauVA0RqsUxyGQBY~W~dAg-PlWYEgAxvNn1e4ul5Ba42

Feel free to leave comments directly. Or, if you'd like to help collaborate, ping me on WordPress.org Slack with your Dropbox account email address.

Once this document is in a mostly final state, I'll submit it as a pull request to wherever it needs to go.

@danielbachhuber
Copy link
Member Author

Now that I have a full draft in my Dropbox Paper document, I'm not quite sure where this would fit. Any suggestions?

@aduth
Copy link
Member

aduth commented Jan 30, 2019

I could imagine one of either:

@danielbachhuber
Copy link
Member Author

@chrisvanpatten Do you have any preference, or know who might have an opinion?

@danielbachhuber
Copy link
Member Author

@youknowriad Could I get some final determination? I'd love to get this landed.

@danielbachhuber
Copy link
Member Author

I could also just publish it to my blog, if it's not entirely appropriate for WordPress.org

@youknowriad
Copy link
Contributor

youknowriad commented Feb 5, 2019

My personal preference would be a tutorial.

@chrisvanpatten
Copy link
Member

@danielbachhuber Sorry just seeing my tag (started a new job and still catching up w/ life haha). I think in the tutorials section is appropriate!

@aduth
Copy link
Member

aduth commented Feb 5, 2019

As a continuation of #13593, I'd propose the issue here account for:

  • Consistency across modules which provide some data store, as far as documenting access to data behaviors (viewport is a similar "data-only" module, but same could be applied to any module's store)
  • Clarification that the data store is only registered if defined as a dependency to one's script
  • Clarification that dispatch is intended for effecting change, and including reference to data retrieval (i.e. select in addition to just a reference to dispatch).

I wonder if, for these modules, it might make sense to have a section specifically dedicated to usage in a WordPress context. Cordoning off in this way could prove to be a reasonable compromise between usefulness to a WordPress developer and respect toward the fact that these modules are published as standalone to npm.

Example:

## Usage in WordPress

In WordPress, the [x] module is [registered](https://developer.wordpress.org/reference/functions/wp_register_script/) using the `wp-[x]` script handle. When enqueuing your own scripts which make use of the [x] module, be sure to define this as a dependency.

In your JavaScript scripts, the public interface of the module can be referenced on the `window` global via `wp.[x]`.

To access [data methods](https://wordpress.org/gutenberg/handbook/designers-developers/developers/packages/packages-data/#data-access-and-manipulation) provided through the [x] module's registered store, reference it via the `core/[x]` namespace:

```js
wp.data.select( 'core/[x]' );
wp.data.dispatch( 'core/[x]' );
```

@danielbachhuber
Copy link
Member Author

@aduth Can you create a new issue? That seems like a much broader scope that I don't feel comfortable owning.

Related to this, would you like to land the document I've already created, or do you want to hold off until the broader scope is addressed?

@aduth
Copy link
Member

aduth commented Feb 5, 2019

@aduth Can you create a new issue? That seems like a much broader scope that I don't feel comfortable owning.

#13674

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Notices /packages/notices [Type] Developer Documentation Documentation for developers
Projects
None yet
Development

No branches or pull requests

4 participants