-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Added explanation of isEmpty function; extra line removed #61300
base: trunk
Are you sure you want to change the base?
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
||
Helper function to test if supplied variable (e.g. content of RichText) is empty. It tests if value of variable is empty or if variable is an empty array. | ||
|
||
### `value: String | Array` |
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.
Array is deprecated so I wouldn't document it here. Note that it can also be RichTextData
@@ -121,14 +121,22 @@ registerBlockType( /* ... */, { | |||
} ); | |||
``` | |||
|
|||
## RichText.isEmpty | |||
|
|||
Helper function to test if supplied variable (e.g. content of RichText) is empty. It tests if value of variable is empty or if variable is an empty array. |
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.
Maybe the first line is explanatory enough?
|
||
### Example | ||
|
||
Some [attributes in paragraph block](https://github.com/WordPress/gutenberg/blob/59ed45e2d9db32e50b17b5801f0841f6d7489b0c/packages/block-library/src/paragraph/edit.js#L174) are set differrently if content of `RichText` is empty. |
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's probably better to give an inline example as done in other places.
Thank you for the PR! Looks good, just left some comments. |
isEmpty method of RichText object was not documented