Skip to content

Commit

Permalink
Site Tagline: Add example so that it will display in style book (#48300)
Browse files Browse the repository at this point in the history
* Site Tagline: Add example so that it will display in style book

* Add placeholder attribute
  • Loading branch information
andrewserong authored and ntsekouras committed Feb 27, 2023
1 parent 82549ea commit efc8ad9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/reference-guides/core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ Describe in a few words what the site is about. The tagline can be used in searc
- **Name:** core/site-tagline
- **Category:** theme
- **Supports:** align (full, wide), anchor, color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~
- **Attributes:** textAlign
- **Attributes:** placeholder, textAlign

## Site Title

Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/site-tagline/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"keywords": [ "description" ],
"textdomain": "default",
"attributes": {
"placeholder": {
"type": "string"
},
"textAlign": {
"type": "string"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/site-tagline/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function SiteTaglineEdit( {
setAttributes,
insertBlocksAfter,
} ) {
const { textAlign } = attributes;
const { placeholder, textAlign } = attributes;
const { canUserEdit, tagline } = useSelect( ( select ) => {
const { canUser, getEntityRecord, getEditedEntityRecord } =
select( coreStore );
Expand Down Expand Up @@ -57,7 +57,7 @@ export default function SiteTaglineEdit( {
allowedFormats={ [] }
onChange={ setTagline }
aria-label={ __( 'Site tagline text' ) }
placeholder={ __( 'Write site tagline…' ) }
placeholder={ placeholder || __( 'Write site tagline…' ) }
tagName="p"
value={ tagline }
disableLineBreaks
Expand Down
10 changes: 10 additions & 0 deletions packages/block-library/src/site-tagline/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
*/
Expand All @@ -13,6 +18,11 @@ export { metadata, name };
export const settings = {
icon,
edit,
example: {
attributes: {
placeholder: __( 'A site tagline.' ),
},
},
deprecated,
};

Expand Down

0 comments on commit efc8ad9

Please sign in to comment.