@wordpress/block-library 7.3.2 → 7.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/comment-template/hooks.js +11 -3
- package/build/comment-template/hooks.js.map +1 -1
- package/build/comments-pagination/edit.js +18 -1
- package/build/comments-pagination/edit.js.map +1 -1
- package/build/comments-query-loop/edit.js +2 -2
- package/build/comments-query-loop/edit.js.map +1 -1
- package/build/comments-title/edit.js +151 -0
- package/build/comments-title/edit.js.map +1 -0
- package/build/comments-title/index.js +101 -0
- package/build/comments-title/index.js.map +1 -0
- package/build/index.js +4 -2
- package/build/index.js.map +1 -1
- package/build/navigation/edit/index.js +17 -1
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/inner-blocks.js +5 -7
- package/build/navigation/edit/inner-blocks.js.map +1 -1
- package/build/navigation/edit/navigation-menu-selector.js +7 -2
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build/navigation-link/edit.js +29 -30
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-submenu/edit.js +14 -14
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/post-comments/edit.js +141 -35
- package/build/post-comments/edit.js.map +1 -1
- package/build/post-comments/index.js +2 -1
- package/build/post-comments/index.js.map +1 -1
- package/build/post-comments-form/edit.js +22 -1
- package/build/post-comments-form/edit.js.map +1 -1
- package/build/post-comments-form/index.js +1 -0
- package/build/post-comments-form/index.js.map +1 -1
- package/build/post-content/edit.js +1 -1
- package/build/post-content/edit.js.map +1 -1
- package/build/post-excerpt/edit.js +1 -1
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/query-no-results/edit.js +1 -1
- package/build/query-no-results/edit.js.map +1 -1
- package/build-module/comment-template/hooks.js +11 -3
- package/build-module/comment-template/hooks.js.map +1 -1
- package/build-module/comments-pagination/edit.js +19 -2
- package/build-module/comments-pagination/edit.js.map +1 -1
- package/build-module/comments-query-loop/edit.js +2 -2
- package/build-module/comments-query-loop/edit.js.map +1 -1
- package/build-module/comments-title/edit.js +135 -0
- package/build-module/comments-title/edit.js.map +1 -0
- package/build-module/comments-title/index.js +88 -0
- package/build-module/comments-title/index.js.map +1 -0
- package/build-module/index.js +3 -2
- package/build-module/index.js.map +1 -1
- package/build-module/navigation/edit/index.js +17 -1
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/inner-blocks.js +5 -7
- package/build-module/navigation/edit/inner-blocks.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.js +6 -2
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/navigation-link/edit.js +29 -30
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +14 -14
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/post-comments/edit.js +143 -38
- package/build-module/post-comments/edit.js.map +1 -1
- package/build-module/post-comments/index.js +2 -1
- package/build-module/post-comments/index.js.map +1 -1
- package/build-module/post-comments-form/edit.js +21 -1
- package/build-module/post-comments-form/edit.js.map +1 -1
- package/build-module/post-comments-form/index.js +1 -0
- package/build-module/post-comments-form/index.js.map +1 -1
- package/build-module/post-content/edit.js +1 -1
- package/build-module/post-content/edit.js.map +1 -1
- package/build-module/post-excerpt/edit.js +1 -1
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/query-no-results/edit.js +1 -1
- package/build-module/query-no-results/edit.js.map +1 -1
- package/build-style/comment-content/style-rtl.css +81 -0
- package/build-style/comment-content/style.css +81 -0
- package/build-style/comments-title/editor-rtl.css +79 -0
- package/build-style/comments-title/editor.css +79 -0
- package/build-style/cover/style-rtl.css +1 -1
- package/build-style/cover/style.css +1 -1
- package/build-style/editor-rtl.css +12 -0
- package/build-style/editor.css +12 -0
- package/build-style/latest-posts/style-rtl.css +2 -0
- package/build-style/latest-posts/style.css +4 -0
- package/build-style/post-comments/editor-rtl.css +79 -0
- package/build-style/post-comments/editor.css +79 -0
- package/build-style/post-comments/style-rtl.css +6 -4
- package/build-style/post-comments/style.css +6 -4
- package/build-style/post-comments-form/editor-rtl.css +79 -0
- package/build-style/post-comments-form/editor.css +79 -0
- package/build-style/post-comments-form/style-rtl.css +9 -0
- package/build-style/post-comments-form/style.css +9 -0
- package/build-style/style-rtl.css +18 -5
- package/build-style/style.css +20 -5
- package/package.json +10 -10
- package/src/comment-author-name/index.php +7 -5
- package/src/comment-content/index.php +25 -3
- package/src/comment-content/style.scss +5 -0
- package/src/comment-edit-link/index.php +1 -4
- package/src/comment-reply-link/index.php +1 -4
- package/src/comment-template/hooks.js +13 -1
- package/src/comment-template/index.php +13 -4
- package/src/comments-pagination/edit.js +23 -0
- package/src/comments-query-loop/edit.js +2 -0
- package/src/comments-title/block.json +70 -0
- package/src/comments-title/edit.js +213 -0
- package/src/comments-title/editor.scss +4 -0
- package/src/comments-title/index.js +18 -0
- package/src/comments-title/index.php +75 -0
- package/src/cover/index.php +1 -1
- package/src/cover/style.scss +1 -1
- package/src/editor.scss +3 -0
- package/src/index.js +4 -1
- package/src/latest-posts/style.scss +4 -0
- package/src/navigation/edit/index.js +24 -0
- package/src/navigation/edit/inner-blocks.js +5 -7
- package/src/navigation/edit/navigation-menu-selector.js +15 -9
- package/src/navigation-link/edit.js +40 -43
- package/src/navigation-submenu/edit.js +13 -17
- package/src/post-comments/block.json +2 -1
- package/src/post-comments/edit.js +204 -44
- package/src/post-comments/editor.scss +3 -0
- package/src/post-comments/style.scss +6 -7
- package/src/post-comments-form/block.json +1 -0
- package/src/post-comments-form/edit.js +39 -2
- package/src/post-comments-form/editor.scss +3 -0
- package/src/post-comments-form/index.php +4 -1
- package/src/post-comments-form/style.scss +11 -0
- package/src/post-content/edit.js +15 -1
- package/src/post-excerpt/edit.js +14 -1
- package/src/query-no-results/edit.js +1 -1
|
@@ -309,37 +309,33 @@ export default function NavigationSubmenuEdit( {
|
|
|
309
309
|
isTopLevelItem,
|
|
310
310
|
isParentOfSelectedBlock,
|
|
311
311
|
isImmediateParentOfSelectedBlock,
|
|
312
|
-
|
|
313
|
-
|
|
312
|
+
hasChildren,
|
|
313
|
+
selectedBlockHasChildren,
|
|
314
314
|
userCanCreatePages,
|
|
315
315
|
userCanCreatePosts,
|
|
316
316
|
onlyDescendantIsEmptyLink,
|
|
317
317
|
} = useSelect(
|
|
318
318
|
( select ) => {
|
|
319
319
|
const {
|
|
320
|
-
getClientIdsOfDescendants,
|
|
321
320
|
hasSelectedInnerBlock,
|
|
322
321
|
getSelectedBlockClientId,
|
|
323
322
|
getBlockParentsByBlockName,
|
|
324
323
|
getBlock,
|
|
324
|
+
getBlockCount,
|
|
325
|
+
getBlockOrder,
|
|
325
326
|
} = select( blockEditorStore );
|
|
326
327
|
|
|
327
328
|
let _onlyDescendantIsEmptyLink;
|
|
328
329
|
|
|
329
330
|
const selectedBlockId = getSelectedBlockClientId();
|
|
330
331
|
|
|
331
|
-
const
|
|
332
|
-
.length;
|
|
333
|
-
|
|
334
|
-
const selectedBlockDescendants = getClientIdsOfDescendants( [
|
|
335
|
-
selectedBlockId,
|
|
336
|
-
] );
|
|
332
|
+
const selectedBlockChildren = getBlockOrder( selectedBlockId );
|
|
337
333
|
|
|
338
334
|
// Check for a single descendant in the submenu. If that block
|
|
339
335
|
// is a link block in a "placeholder" state with no label then
|
|
340
336
|
// we can consider as an "empty" link.
|
|
341
|
-
if (
|
|
342
|
-
const singleBlock = getBlock(
|
|
337
|
+
if ( selectedBlockChildren?.length === 1 ) {
|
|
338
|
+
const singleBlock = getBlock( selectedBlockChildren[ 0 ] );
|
|
343
339
|
|
|
344
340
|
_onlyDescendantIsEmptyLink =
|
|
345
341
|
singleBlock?.name === 'core/navigation-link' &&
|
|
@@ -360,8 +356,8 @@ export default function NavigationSubmenuEdit( {
|
|
|
360
356
|
clientId,
|
|
361
357
|
false
|
|
362
358
|
),
|
|
363
|
-
|
|
364
|
-
|
|
359
|
+
hasChildren: !! getBlockCount( clientId ),
|
|
360
|
+
selectedBlockHasChildren: !! selectedBlockChildren?.length,
|
|
365
361
|
userCanCreatePages: select( coreStore ).canUser(
|
|
366
362
|
'create',
|
|
367
363
|
'pages'
|
|
@@ -481,7 +477,7 @@ export default function NavigationSubmenuEdit( {
|
|
|
481
477
|
'is-editing': isSelected || isParentOfSelectedBlock,
|
|
482
478
|
'is-dragging-within': isDraggingWithin,
|
|
483
479
|
'has-link': !! url,
|
|
484
|
-
'has-child':
|
|
480
|
+
'has-child': hasChildren,
|
|
485
481
|
'has-text-color': !! textColor || !! customTextColor,
|
|
486
482
|
[ getColorClassName( 'color', textColor ) ]: !! textColor,
|
|
487
483
|
'has-background': !! backgroundColor || customBackgroundColor,
|
|
@@ -538,9 +534,9 @@ export default function NavigationSubmenuEdit( {
|
|
|
538
534
|
renderAppender:
|
|
539
535
|
isSelected ||
|
|
540
536
|
( isImmediateParentOfSelectedBlock &&
|
|
541
|
-
!
|
|
537
|
+
! selectedBlockHasChildren ) ||
|
|
542
538
|
// Show the appender while dragging to allow inserting element between item and the appender.
|
|
543
|
-
|
|
539
|
+
hasChildren
|
|
544
540
|
? InnerBlocks.ButtonBlockAppender
|
|
545
541
|
: false,
|
|
546
542
|
}
|
|
@@ -554,7 +550,7 @@ export default function NavigationSubmenuEdit( {
|
|
|
554
550
|
}
|
|
555
551
|
|
|
556
552
|
const canConvertToLink =
|
|
557
|
-
!
|
|
553
|
+
! selectedBlockHasChildren || onlyDescendantIsEmptyLink;
|
|
558
554
|
|
|
559
555
|
return (
|
|
560
556
|
<Fragment>
|
|
@@ -6,65 +6,89 @@ import classnames from 'classnames';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { useSelect } from '@wordpress/data';
|
|
10
9
|
import {
|
|
11
10
|
AlignmentControl,
|
|
12
11
|
BlockControls,
|
|
13
12
|
Warning,
|
|
14
13
|
useBlockProps,
|
|
14
|
+
store as blockEditorStore,
|
|
15
15
|
} from '@wordpress/block-editor';
|
|
16
|
-
import { __ } from '@wordpress/i18n';
|
|
17
|
-
import {
|
|
18
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const comments = select( coreStore ).getEntityRecords(
|
|
24
|
-
'root',
|
|
25
|
-
'comment',
|
|
26
|
-
{
|
|
27
|
-
post: postId,
|
|
28
|
-
}
|
|
29
|
-
);
|
|
30
|
-
// TODO: "No Comments" placeholder should be editable.
|
|
31
|
-
return comments && comments.length
|
|
32
|
-
? comments.map( ( comment ) => (
|
|
33
|
-
<RawHTML
|
|
34
|
-
className="wp-block-post-comments__comment"
|
|
35
|
-
key={ comment.id }
|
|
36
|
-
>
|
|
37
|
-
{ comment.content.rendered }
|
|
38
|
-
</RawHTML>
|
|
39
|
-
) )
|
|
40
|
-
: __( 'No comments.' );
|
|
41
|
-
},
|
|
42
|
-
[ postId ]
|
|
43
|
-
);
|
|
44
|
-
}
|
|
16
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
17
|
+
import { useSelect } from '@wordpress/data';
|
|
18
|
+
import { useEntityProp, store as coreStore } from '@wordpress/core-data';
|
|
19
|
+
import {
|
|
20
|
+
__experimentalUseDisabled as useDisabled,
|
|
21
|
+
useInstanceId,
|
|
22
|
+
} from '@wordpress/compose';
|
|
45
23
|
|
|
46
24
|
export default function PostCommentsEdit( {
|
|
47
|
-
attributes,
|
|
25
|
+
attributes: { textAlign },
|
|
48
26
|
setAttributes,
|
|
49
|
-
context,
|
|
27
|
+
context: { postType, postId },
|
|
50
28
|
} ) {
|
|
51
|
-
|
|
52
|
-
|
|
29
|
+
let [ postTitle ] = useEntityProp( 'postType', postType, 'title', postId );
|
|
30
|
+
postTitle = postTitle || __( 'Post Title' );
|
|
31
|
+
|
|
32
|
+
const [ commentStatus ] = useEntityProp(
|
|
33
|
+
'postType',
|
|
34
|
+
postType,
|
|
35
|
+
'comment_status',
|
|
36
|
+
postId
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
const { avatarURL, defaultCommentStatus } = useSelect(
|
|
40
|
+
( select ) =>
|
|
41
|
+
select( blockEditorStore ).getSettings()
|
|
42
|
+
.__experimentalDiscussionSettings
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
const isSiteEditor = postType === undefined || postId === undefined;
|
|
46
|
+
|
|
47
|
+
const postTypeSupportsComments = useSelect( ( select ) =>
|
|
48
|
+
postType
|
|
49
|
+
? !! select( coreStore ).getPostType( postType )?.supports.comments
|
|
50
|
+
: false
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
let warning = __(
|
|
54
|
+
'Post Comments block: This is just a placeholder, not a real comment. The final styling may differ because it also depends on the current theme. For better compatibility with the Block Editor, please consider replacing this block with the "Comments Query Loop" block.'
|
|
55
|
+
);
|
|
56
|
+
let showPlacholder = true;
|
|
57
|
+
|
|
58
|
+
if ( ! isSiteEditor && 'open' !== commentStatus ) {
|
|
59
|
+
if ( 'closed' === commentStatus ) {
|
|
60
|
+
warning = sprintf(
|
|
61
|
+
/* translators: 1: Post type (i.e. "post", "page") */
|
|
62
|
+
__(
|
|
63
|
+
'Post Comments block: Comments to this %s are not allowed.'
|
|
64
|
+
),
|
|
65
|
+
postType
|
|
66
|
+
);
|
|
67
|
+
showPlacholder = false;
|
|
68
|
+
} else if ( ! postTypeSupportsComments ) {
|
|
69
|
+
warning = sprintf(
|
|
70
|
+
/* translators: 1: Post type (i.e. "post", "page") */
|
|
71
|
+
__(
|
|
72
|
+
'Post Comments block: Comments for this post type (%s) are not enabled.'
|
|
73
|
+
),
|
|
74
|
+
postType
|
|
75
|
+
);
|
|
76
|
+
showPlacholder = false;
|
|
77
|
+
} else if ( 'open' !== defaultCommentStatus ) {
|
|
78
|
+
warning = __( 'Post Comments block: Comments are not enabled.' );
|
|
79
|
+
showPlacholder = false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
53
83
|
const blockProps = useBlockProps( {
|
|
54
84
|
className: classnames( {
|
|
55
85
|
[ `has-text-align-${ textAlign }` ]: textAlign,
|
|
56
86
|
} ),
|
|
57
87
|
} );
|
|
58
88
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
<Warning>
|
|
63
|
-
{ __( 'Post comments block: no post found.' ) }
|
|
64
|
-
</Warning>
|
|
65
|
-
</div>
|
|
66
|
-
);
|
|
67
|
-
}
|
|
89
|
+
const disabledRef = useDisabled();
|
|
90
|
+
|
|
91
|
+
const textareaId = useInstanceId( PostCommentsEdit );
|
|
68
92
|
|
|
69
93
|
return (
|
|
70
94
|
<>
|
|
@@ -78,7 +102,143 @@ export default function PostCommentsEdit( {
|
|
|
78
102
|
</BlockControls>
|
|
79
103
|
|
|
80
104
|
<div { ...blockProps }>
|
|
81
|
-
<
|
|
105
|
+
<Warning>{ warning }</Warning>
|
|
106
|
+
|
|
107
|
+
{ showPlacholder && (
|
|
108
|
+
<div
|
|
109
|
+
className="wp-block-post-comments__placeholder"
|
|
110
|
+
ref={ disabledRef }
|
|
111
|
+
>
|
|
112
|
+
<h3>
|
|
113
|
+
{ __( 'One response to' ) } “{ postTitle }”
|
|
114
|
+
</h3>
|
|
115
|
+
|
|
116
|
+
<div className="navigation">
|
|
117
|
+
<div className="alignleft">
|
|
118
|
+
<a href="#top">« { __( 'Older Comments' ) }</a>
|
|
119
|
+
</div>
|
|
120
|
+
<div className="alignright">
|
|
121
|
+
<a href="#top">{ __( 'Newer Comments' ) } »</a>
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
|
|
125
|
+
<ol className="commentlist">
|
|
126
|
+
<li className="comment even thread-even depth-1">
|
|
127
|
+
<article className="comment-body">
|
|
128
|
+
<footer className="comment-meta">
|
|
129
|
+
<div className="comment-author vcard">
|
|
130
|
+
<img
|
|
131
|
+
alt="Commenter Avatar"
|
|
132
|
+
src={ avatarURL }
|
|
133
|
+
className="avatar avatar-32 photo"
|
|
134
|
+
height="32"
|
|
135
|
+
width="32"
|
|
136
|
+
loading="lazy"
|
|
137
|
+
/>
|
|
138
|
+
<b className="fn">
|
|
139
|
+
<a href="#top" className="url">
|
|
140
|
+
{ __(
|
|
141
|
+
'A WordPress Commenter'
|
|
142
|
+
) }
|
|
143
|
+
</a>
|
|
144
|
+
</b>{ ' ' }
|
|
145
|
+
<span className="says">
|
|
146
|
+
{ __( 'says' ) }:
|
|
147
|
+
</span>
|
|
148
|
+
</div>
|
|
149
|
+
|
|
150
|
+
<div className="comment-metadata">
|
|
151
|
+
<a href="#top">
|
|
152
|
+
<time dateTime="2000-01-01T00:00:00+00:00">
|
|
153
|
+
{ __(
|
|
154
|
+
'January 1, 2000 at 00:00 am'
|
|
155
|
+
) }
|
|
156
|
+
</time>
|
|
157
|
+
</a>{ ' ' }
|
|
158
|
+
<span className="edit-link">
|
|
159
|
+
<a
|
|
160
|
+
className="comment-edit-link"
|
|
161
|
+
href="#top"
|
|
162
|
+
>
|
|
163
|
+
{ __( 'Edit' ) }
|
|
164
|
+
</a>
|
|
165
|
+
</span>
|
|
166
|
+
</div>
|
|
167
|
+
</footer>
|
|
168
|
+
|
|
169
|
+
<div className="comment-content">
|
|
170
|
+
<p>
|
|
171
|
+
{ __( 'Hi, this is a comment.' ) }
|
|
172
|
+
<br />
|
|
173
|
+
{ __(
|
|
174
|
+
'To get started with moderating, editing, and deleting comments, please visit the Comments screen in the dashboard.'
|
|
175
|
+
) }
|
|
176
|
+
<br />
|
|
177
|
+
{ __(
|
|
178
|
+
'Commenter avatars come from'
|
|
179
|
+
) }{ ' ' }
|
|
180
|
+
<a href="https://gravatar.com/">
|
|
181
|
+
Gravatar
|
|
182
|
+
</a>
|
|
183
|
+
.
|
|
184
|
+
</p>
|
|
185
|
+
</div>
|
|
186
|
+
|
|
187
|
+
<div className="reply">
|
|
188
|
+
<a
|
|
189
|
+
className="comment-reply-link"
|
|
190
|
+
href="#top"
|
|
191
|
+
aria-label="Reply to A WordPress Commenter"
|
|
192
|
+
>
|
|
193
|
+
{ __( 'Reply' ) }
|
|
194
|
+
</a>
|
|
195
|
+
</div>
|
|
196
|
+
</article>
|
|
197
|
+
</li>
|
|
198
|
+
</ol>
|
|
199
|
+
|
|
200
|
+
<div className="navigation">
|
|
201
|
+
<div className="alignleft">
|
|
202
|
+
<a href="#top">« { __( 'Older Comments' ) }</a>
|
|
203
|
+
</div>
|
|
204
|
+
<div className="alignright">
|
|
205
|
+
<a href="#top">{ __( 'Newer Comments' ) } »</a>
|
|
206
|
+
</div>
|
|
207
|
+
</div>
|
|
208
|
+
|
|
209
|
+
<div className="comment-respond">
|
|
210
|
+
<h3 className="comment-reply-title">
|
|
211
|
+
{ __( 'Leave a Reply' ) }
|
|
212
|
+
</h3>
|
|
213
|
+
|
|
214
|
+
<form className="comment-form" noValidate>
|
|
215
|
+
<p className="comment-form-comment">
|
|
216
|
+
<label
|
|
217
|
+
htmlFor={ `comment-${ textareaId }` }
|
|
218
|
+
>
|
|
219
|
+
{ __( 'Comment' ) }{ ' ' }
|
|
220
|
+
<span className="required">*</span>
|
|
221
|
+
</label>
|
|
222
|
+
<textarea
|
|
223
|
+
id={ `comment-${ textareaId }` }
|
|
224
|
+
name="comment"
|
|
225
|
+
cols="45"
|
|
226
|
+
rows="8"
|
|
227
|
+
required
|
|
228
|
+
/>
|
|
229
|
+
</p>
|
|
230
|
+
<p className="form-submit wp-block-button">
|
|
231
|
+
<input
|
|
232
|
+
name="submit"
|
|
233
|
+
type="submit"
|
|
234
|
+
className="submit wp-block-button__link"
|
|
235
|
+
value={ __( 'Post Comment' ) }
|
|
236
|
+
/>
|
|
237
|
+
</p>
|
|
238
|
+
</form>
|
|
239
|
+
</div>
|
|
240
|
+
</div>
|
|
241
|
+
) }
|
|
82
242
|
</div>
|
|
83
243
|
</>
|
|
84
244
|
);
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
.wp-block-post-comments {
|
|
2
|
-
// Remove extraneous top padding added to the first heading of the block.
|
|
3
|
-
> h3:first-of-type {
|
|
4
|
-
margin-top: 0;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
2
|
.commentlist {
|
|
3
|
+
clear: both;
|
|
8
4
|
list-style: none;
|
|
9
5
|
margin: 0;
|
|
10
6
|
padding: 0;
|
|
@@ -48,11 +44,14 @@
|
|
|
48
44
|
.comment-meta {
|
|
49
45
|
font-size: 0.875em;
|
|
50
46
|
line-height: 1.5;
|
|
51
|
-
margin-left: -3.25em;
|
|
52
|
-
|
|
53
47
|
b {
|
|
54
48
|
font-weight: normal;
|
|
55
49
|
}
|
|
50
|
+
.comment-awaiting-moderation {
|
|
51
|
+
margin-top: 1em;
|
|
52
|
+
margin-bottom: 1em;
|
|
53
|
+
display: block;
|
|
54
|
+
}
|
|
56
55
|
}
|
|
57
56
|
|
|
58
57
|
.comment-body .commentmetadata {
|
|
@@ -14,6 +14,10 @@ import {
|
|
|
14
14
|
} from '@wordpress/block-editor';
|
|
15
15
|
import { useEntityProp } from '@wordpress/core-data';
|
|
16
16
|
import { __, sprintf } from '@wordpress/i18n';
|
|
17
|
+
import {
|
|
18
|
+
__experimentalUseDisabled as useDisabled,
|
|
19
|
+
useInstanceId,
|
|
20
|
+
} from '@wordpress/compose';
|
|
17
21
|
|
|
18
22
|
export default function PostCommentsFormEdit( {
|
|
19
23
|
attributes,
|
|
@@ -36,6 +40,10 @@ export default function PostCommentsFormEdit( {
|
|
|
36
40
|
|
|
37
41
|
const isInSiteEditor = postType === undefined || postId === undefined;
|
|
38
42
|
|
|
43
|
+
const disabledFormRef = useDisabled();
|
|
44
|
+
|
|
45
|
+
const instanceId = useInstanceId( PostCommentsFormEdit );
|
|
46
|
+
|
|
39
47
|
return (
|
|
40
48
|
<>
|
|
41
49
|
<BlockControls group="block">
|
|
@@ -67,8 +75,37 @@ export default function PostCommentsFormEdit( {
|
|
|
67
75
|
</Warning>
|
|
68
76
|
) }
|
|
69
77
|
|
|
70
|
-
{ ( 'open' === commentStatus || isInSiteEditor ) &&
|
|
71
|
-
|
|
78
|
+
{ ( 'open' === commentStatus || isInSiteEditor ) && (
|
|
79
|
+
<div>
|
|
80
|
+
<h3>{ __( 'Leave a Reply' ) }</h3>
|
|
81
|
+
<form
|
|
82
|
+
noValidate
|
|
83
|
+
className="comment-form"
|
|
84
|
+
ref={ disabledFormRef }
|
|
85
|
+
>
|
|
86
|
+
<p>
|
|
87
|
+
<label htmlFor={ `comment-${ instanceId }` }>
|
|
88
|
+
{ __( 'Comment' ) }
|
|
89
|
+
</label>
|
|
90
|
+
<textarea
|
|
91
|
+
id={ `comment-${ instanceId }` }
|
|
92
|
+
name="comment"
|
|
93
|
+
cols="45"
|
|
94
|
+
rows="8"
|
|
95
|
+
/>
|
|
96
|
+
</p>
|
|
97
|
+
<p>
|
|
98
|
+
<input
|
|
99
|
+
name="submit"
|
|
100
|
+
className="submit wp-block-button__link"
|
|
101
|
+
label={ __( 'Post Comment' ) }
|
|
102
|
+
value={ __( 'Post Comment' ) }
|
|
103
|
+
readOnly
|
|
104
|
+
/>
|
|
105
|
+
</p>
|
|
106
|
+
</form>
|
|
107
|
+
</div>
|
|
108
|
+
) }
|
|
72
109
|
</div>
|
|
73
110
|
</>
|
|
74
111
|
);
|
|
@@ -25,10 +25,14 @@ function render_block_core_post_comments_form( $attributes, $content, $block ) {
|
|
|
25
25
|
|
|
26
26
|
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
|
|
27
27
|
|
|
28
|
+
add_filter( 'comment_form_defaults', 'post_comments_form_block_form_defaults' );
|
|
29
|
+
|
|
28
30
|
ob_start();
|
|
29
31
|
comment_form( array(), $block->context['postId'] );
|
|
30
32
|
$form = ob_get_clean();
|
|
31
33
|
|
|
34
|
+
remove_filter( 'comment_form_defaults', 'post_comments_form_block_form_defaults' );
|
|
35
|
+
|
|
32
36
|
// We use the outermost wrapping `<div />` returned by `comment_form()`
|
|
33
37
|
// which is identified by its default classname `comment-respond` to inject
|
|
34
38
|
// our wrapper attributes. This way, it is guaranteed that all styling applied
|
|
@@ -70,4 +74,3 @@ function post_comments_form_block_form_defaults( $fields ) {
|
|
|
70
74
|
|
|
71
75
|
return $fields;
|
|
72
76
|
}
|
|
73
|
-
add_filter( 'comment_form_defaults', 'post_comments_form_block_form_defaults' );
|
|
@@ -67,4 +67,15 @@
|
|
|
67
67
|
margin-top: 0.35em;
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
+
|
|
71
|
+
.comment-reply-title {
|
|
72
|
+
align-items: baseline;
|
|
73
|
+
display: flex;
|
|
74
|
+
justify-content: space-between;
|
|
75
|
+
margin-bottom: 0;
|
|
76
|
+
|
|
77
|
+
:where(small) {
|
|
78
|
+
font-size: var(--wp--preset--font-size--medium, smaller);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
70
81
|
}
|
package/src/post-content/edit.js
CHANGED
|
@@ -85,7 +85,21 @@ function Placeholder() {
|
|
|
85
85
|
const blockProps = useBlockProps();
|
|
86
86
|
return (
|
|
87
87
|
<div { ...blockProps }>
|
|
88
|
-
<p>
|
|
88
|
+
<p>
|
|
89
|
+
{ __(
|
|
90
|
+
'This is the Post Content block, it will display all the blocks in any single post or page.'
|
|
91
|
+
) }
|
|
92
|
+
</p>
|
|
93
|
+
<p>
|
|
94
|
+
{ __(
|
|
95
|
+
'That might be a simple arrangement like consecutive paragraphs in a blog post, or a more elaborate composition that includes image galleries, videos, tables, columns, and any other block types.'
|
|
96
|
+
) }
|
|
97
|
+
</p>
|
|
98
|
+
<p>
|
|
99
|
+
{ __(
|
|
100
|
+
'If there are any Custom Post Types registered at your site, the Post Content block can display the contents of those entries as well.'
|
|
101
|
+
) }
|
|
102
|
+
</p>
|
|
89
103
|
</div>
|
|
90
104
|
);
|
|
91
105
|
}
|
package/src/post-excerpt/edit.js
CHANGED
|
@@ -57,7 +57,20 @@ export default function PostExcerptEditor( {
|
|
|
57
57
|
return document.body.textContent || document.body.innerText || '';
|
|
58
58
|
}, [ renderedExcerpt ] );
|
|
59
59
|
if ( ! postType || ! postId ) {
|
|
60
|
-
return
|
|
60
|
+
return (
|
|
61
|
+
<div { ...blockProps }>
|
|
62
|
+
<p>
|
|
63
|
+
{ __(
|
|
64
|
+
'This is the Post Excerpt block, it will display the excerpt from single posts.'
|
|
65
|
+
) }
|
|
66
|
+
</p>
|
|
67
|
+
<p>
|
|
68
|
+
{ __(
|
|
69
|
+
'If there are any Custom Post Types with support for excerpts, the Post Excerpt block can display the excerpts of those entries as well.'
|
|
70
|
+
) }
|
|
71
|
+
</p>
|
|
72
|
+
</div>
|
|
73
|
+
);
|
|
61
74
|
}
|
|
62
75
|
if ( isProtected && ! userCanEdit ) {
|
|
63
76
|
return (
|