Skip to content

Commit 681428d

Browse files
committed
Revert fontsize attribute deletion, fix link color not applied in site editor
1 parent 7bac2a9 commit 681428d

File tree

7 files changed

+29
-30
lines changed

7 files changed

+29
-30
lines changed

docs/reference-guides/core-blocks.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ Displays the name of the author of the comment. ([Source](https://github.com/Wor
123123
- **Name:** core/comment-author-name
124124
- **Category:** theme
125125
- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~
126-
- **Attributes:** isLink, linkTarget, textAlign
126+
- **Attributes:** fontSize, isLink, linkTarget, textAlign
127127

128128
## Comment Content
129129

@@ -141,7 +141,7 @@ Displays the date on which the comment was posted. ([Source](https://github.com/
141141
- **Name:** core/comment-date
142142
- **Category:** theme
143143
- **Supports:** color (background, gradients, link, text), typography (fontSize, lineHeight), ~~html~~
144-
- **Attributes:** format, isLink
144+
- **Attributes:** fontSize, format, isLink
145145

146146
## Comment Edit Link
147147

@@ -150,7 +150,7 @@ Displays a link to edit the comment in the WordPress Dashboard. This link is onl
150150
- **Name:** core/comment-edit-link
151151
- **Category:** theme
152152
- **Supports:** color (background, gradients, link, ~~text~~), typography (fontSize, lineHeight), ~~html~~
153-
- **Attributes:** linkTarget, textAlign
153+
- **Attributes:** fontSize, linkTarget, textAlign
154154

155155
## Comment Reply Link
156156

@@ -159,7 +159,7 @@ Displays a link to reply to a comment. ([Source](https://github.com/WordPress/gu
159159
- **Name:** core/comment-reply-link
160160
- **Category:** theme
161161
- **Supports:** color (background, gradients, link, ~~text~~), typography (fontSize, lineHeight), ~~html~~
162-
- **Attributes:** textAlign
162+
- **Attributes:** fontSize, textAlign
163163

164164
## Comment Template
165165

packages/block-library/src/comment-author-name/block.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
},
1919
"textAlign": {
2020
"type": "string"
21+
},
22+
"fontSize": {
23+
"type": "string"
2124
}
2225
},
2326
"usesContext": [ "commentId" ],

packages/block-library/src/comment-author-name/edit.js

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default function Edit( {
4141
[ `has-text-align-${ textAlign }` ]: textAlign,
4242
} ),
4343
} );
44-
const displayName = useSelect(
44+
let displayName = useSelect(
4545
( select ) => {
4646
const { getEntityRecord } = select( coreStore );
4747

@@ -92,15 +92,7 @@ export default function Edit( {
9292
);
9393

9494
if ( ! commentId || ! displayName ) {
95-
return (
96-
<>
97-
{ inspectorControls }
98-
{ blockControls }
99-
<div { ...blockProps }>
100-
{ _x( 'Comment Author', 'block title' ) }
101-
</div>
102-
</>
103-
);
95+
displayName = _x( 'Comment Author', 'block title' );
10496
}
10597

10698
const displayAuthor = isLink ? (
@@ -111,9 +103,8 @@ export default function Edit( {
111103
{ displayName }
112104
</a>
113105
) : (
114-
{ displayName }
106+
displayName
115107
);
116-
117108
return (
118109
<>
119110
{ inspectorControls }

packages/block-library/src/comment-date/block.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
"isLink": {
1515
"type": "boolean",
1616
"default": true
17+
},
18+
"fontSize": {
19+
"type": "string"
1720
}
1821
},
1922
"usesContext": [ "commentId" ],

packages/block-library/src/comment-date/edit.js

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default function Edit( {
3333
setAttributes,
3434
} ) {
3535
const blockProps = useBlockProps();
36-
const [ date ] = useEntityProp( 'root', 'comment', 'date', commentId );
36+
let [ date ] = useEntityProp( 'root', 'comment', 'date', commentId );
3737
const [ siteFormat = getDateSettings().formats.date ] = useEntityProp(
3838
'root',
3939
'site',
@@ -60,21 +60,17 @@ export default function Edit( {
6060
);
6161

6262
if ( ! commentId || ! date ) {
63-
return (
64-
<>
65-
{ inspectorControls }
66-
<div { ...blockProps }>
67-
<time>{ _x( 'Comment Date', 'block title' ) }</time>
68-
</div>
69-
</>
70-
);
63+
date = _x( 'Comment Date', 'block title' );
7164
}
7265

73-
let commentDate = (
74-
<time dateTime={ dateI18n( 'c', date ) }>
75-
{ dateI18n( format || siteFormat, date ) }
76-
</time>
77-
);
66+
let commentDate =
67+
date instanceof Date ? (
68+
<time dateTime={ dateI18n( 'c', date ) }>
69+
{ dateI18n( format || siteFormat, date ) }
70+
</time>
71+
) : (
72+
date
73+
);
7874

7975
if ( isLink ) {
8076
commentDate = (

packages/block-library/src/comment-edit-link/block.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
},
1616
"textAlign": {
1717
"type": "string"
18+
},
19+
"fontSize": {
20+
"type": "string"
1821
}
1922
},
2023
"supports": {

packages/block-library/src/comment-reply-link/block.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
"attributes": {
1212
"textAlign": {
1313
"type": "string"
14+
},
15+
"fontSize": {
16+
"type": "string"
1417
}
1518
},
1619
"supports": {

0 commit comments

Comments
 (0)