-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Conversation
If you don't add wp-editor as a dependency, the example code will throw an error.
There was a problem hiding this 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`. |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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
)
);
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. |
There was a problem hiding this 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`. |
There was a problem hiding this comment.
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
)
);
@greenhornet79 Just want to follow up and see if you're open to making this change :) Thanks! |
@chrisvanpatten Just pushed that change. |
There was a problem hiding this 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 👍
@greenhornet79 congrats on your first code contribution to this repository 🎉 |
Thanks! |
* 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
* 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
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: