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

add note about wp-editor dependancy #12731

Merged
merged 3 commits into from
Jan 25, 2019
Merged

Conversation

greenhornet79
Copy link
Contributor

If you don't add wp-editor as a dependency, the example code will throw an error.

Description

How has this been tested?

Screenshots

Types of changes

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.

If you don't add wp-editor as a dependency, the example code will throw an error.
@earnjam earnjam added the [Type] Developer Documentation Documentation for developers label Dec 9, 2018
Copy link
Contributor

@chrisvanpatten chrisvanpatten left a comment

Choose a reason for hiding this comment

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

Small request for a code sample otherwise this is great! Thanks for the contribution :)

@@ -120,6 +120,8 @@ Earlier examples used the `createElement` function to create DOM nodes, but it's

The `RichText` component can be considered as a super-powered `textarea` element, enabling rich content editing including bold, italics, hyperlinks, etc. It is not too much unlike the single editor region of the legacy post editor, and is in fact powered by the same TinyMCE library.

To use the `RichText` component, add `wp-editor` to the array of registered script handles when calling `wp_register_script`.
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be awesome to get a code example here, if possible (presumably just taking the example from the first page in the tutorial and updating it)

Copy link
Contributor

Choose a reason for hiding this comment

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

@greenhornet79 Could you put this code sample below the "To use the RichText component" sentence so it's a little clearer what the code sample is explaining?

I think also instead of the entire block registration function, it would be easier to just show the wp_register_script segment, calling out the change:

wp_register_script(
	'gutenberg-boilerplate-es5-step03',
	plugins_url( 'step-03/block.js', __FILE__ ),
	array(
		'wp-blocks',
		'wp-element'
		'wp-editor', // Note the addition of wp-editor to the dependencies
	)
);

@gziolo gziolo added this to the Documentation & Handbook milestone Dec 14, 2018
@gziolo
Copy link
Member

gziolo commented Dec 14, 2018

It should be good after the latest changes applied. I will leave it to @chrisvanpatten to make the final call as there might be some guidelines for the examples themselves. It seems like the slug for the script and block in the example could be shorter.

Copy link
Contributor

@chrisvanpatten chrisvanpatten left a comment

Choose a reason for hiding this comment

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

Small changes; thanks for your patience and sorry for the delay!

@@ -120,6 +120,8 @@ Earlier examples used the `createElement` function to create DOM nodes, but it's

The `RichText` component can be considered as a super-powered `textarea` element, enabling rich content editing including bold, italics, hyperlinks, etc. It is not too much unlike the single editor region of the legacy post editor, and is in fact powered by the same TinyMCE library.

To use the `RichText` component, add `wp-editor` to the array of registered script handles when calling `wp_register_script`.
Copy link
Contributor

Choose a reason for hiding this comment

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

@greenhornet79 Could you put this code sample below the "To use the RichText component" sentence so it's a little clearer what the code sample is explaining?

I think also instead of the entire block registration function, it would be easier to just show the wp_register_script segment, calling out the change:

wp_register_script(
	'gutenberg-boilerplate-es5-step03',
	plugins_url( 'step-03/block.js', __FILE__ ),
	array(
		'wp-blocks',
		'wp-element'
		'wp-editor', // Note the addition of wp-editor to the dependencies
	)
);

@chrisvanpatten
Copy link
Contributor

@greenhornet79 Just want to follow up and see if you're open to making this change :) Thanks!

@greenhornet79
Copy link
Contributor Author

@chrisvanpatten Just pushed that change.

Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

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

It looks like all feedback got addressed 👍

@gziolo gziolo merged commit 306f454 into WordPress:master Jan 25, 2019
@gziolo
Copy link
Member

gziolo commented Jan 25, 2019

@greenhornet79 congrats on your first code contribution to this repository 🎉

@greenhornet79 greenhornet79 deleted the patch-1 branch January 25, 2019 21:09
@greenhornet79
Copy link
Contributor Author

Thanks!

youknowriad pushed a commit that referenced this pull request Mar 6, 2019
* add note about wp-editor dependancy

If you don't add wp-editor as a dependency, the example code will throw an error.

* Update introducing-attributes-and-editable-fields.md

* move sample code below description
youknowriad pushed a commit that referenced this pull request Mar 6, 2019
* add note about wp-editor dependancy

If you don't add wp-editor as a dependency, the example code will throw an error.

* Update introducing-attributes-and-editable-fields.md

* move sample code below description
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants