@wordpress/block-library 7.3.11 → 7.3.12

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.
Files changed (80) hide show
  1. package/build/avatar/hooks.js +2 -2
  2. package/build/avatar/hooks.js.map +1 -1
  3. package/build/comment-author-name/edit.js +3 -3
  4. package/build/comment-author-name/edit.js.map +1 -1
  5. package/build/comment-author-name/index.js +0 -4
  6. package/build/comment-author-name/index.js.map +1 -1
  7. package/build/comment-date/edit.js +4 -4
  8. package/build/comment-date/edit.js.map +1 -1
  9. package/build/comment-date/index.js +0 -4
  10. package/build/comment-date/index.js.map +1 -1
  11. package/build/comment-edit-link/index.js +0 -4
  12. package/build/comment-edit-link/index.js.map +1 -1
  13. package/build/comment-reply-link/index.js +0 -4
  14. package/build/comment-reply-link/index.js.map +1 -1
  15. package/build/comments-query-loop/edit.js +10 -2
  16. package/build/comments-query-loop/edit.js.map +1 -1
  17. package/build/latest-posts/edit.js +30 -4
  18. package/build/latest-posts/edit.js.map +1 -1
  19. package/build/media-text/edit.js +0 -1
  20. package/build/media-text/edit.js.map +1 -1
  21. package/build/post-comments/edit.js +12 -33
  22. package/build/post-comments/edit.js.map +1 -1
  23. package/build/post-comments-form/edit.js +48 -25
  24. package/build/post-comments-form/edit.js.map +1 -1
  25. package/build/post-comments-form/form.js +48 -0
  26. package/build/post-comments-form/form.js.map +1 -0
  27. package/build-module/avatar/hooks.js +2 -2
  28. package/build-module/avatar/hooks.js.map +1 -1
  29. package/build-module/comment-author-name/edit.js +3 -3
  30. package/build-module/comment-author-name/edit.js.map +1 -1
  31. package/build-module/comment-author-name/index.js +0 -4
  32. package/build-module/comment-author-name/index.js.map +1 -1
  33. package/build-module/comment-date/edit.js +4 -4
  34. package/build-module/comment-date/edit.js.map +1 -1
  35. package/build-module/comment-date/index.js +0 -4
  36. package/build-module/comment-date/index.js.map +1 -1
  37. package/build-module/comment-edit-link/index.js +0 -4
  38. package/build-module/comment-edit-link/index.js.map +1 -1
  39. package/build-module/comment-reply-link/index.js +0 -4
  40. package/build-module/comment-reply-link/index.js.map +1 -1
  41. package/build-module/comments-query-loop/edit.js +10 -2
  42. package/build-module/comments-query-loop/edit.js.map +1 -1
  43. package/build-module/latest-posts/edit.js +29 -5
  44. package/build-module/latest-posts/edit.js.map +1 -1
  45. package/build-module/media-text/edit.js +0 -1
  46. package/build-module/media-text/edit.js.map +1 -1
  47. package/build-module/post-comments/edit.js +12 -34
  48. package/build-module/post-comments/edit.js.map +1 -1
  49. package/build-module/post-comments-form/edit.js +49 -28
  50. package/build-module/post-comments-form/edit.js.map +1 -1
  51. package/build-module/post-comments-form/form.js +39 -0
  52. package/build-module/post-comments-form/form.js.map +1 -0
  53. package/build-style/editor-rtl.css +3 -0
  54. package/build-style/editor.css +3 -0
  55. package/build-style/navigation/style-rtl.css +3 -0
  56. package/build-style/navigation/style.css +3 -0
  57. package/build-style/post-comments-form/editor-rtl.css +3 -0
  58. package/build-style/post-comments-form/editor.css +3 -0
  59. package/build-style/style-rtl.css +3 -0
  60. package/build-style/style.css +3 -0
  61. package/package.json +7 -7
  62. package/src/avatar/hooks.js +9 -6
  63. package/src/comment-author-name/block.json +0 -4
  64. package/src/comment-author-name/edit.js +3 -12
  65. package/src/comment-date/block.json +0 -4
  66. package/src/comment-date/edit.js +10 -14
  67. package/src/comment-date/index.php +0 -3
  68. package/src/comment-edit-link/block.json +0 -4
  69. package/src/comment-reply-link/block.json +0 -4
  70. package/src/comments-query-loop/edit.js +24 -4
  71. package/src/cover/index.php +9 -6
  72. package/src/gallery/index.php +2 -1
  73. package/src/latest-posts/edit.js +27 -2
  74. package/src/media-text/edit.js +0 -1
  75. package/src/navigation/style.scss +3 -0
  76. package/src/post-comments/edit.js +13 -42
  77. package/src/post-comments-form/edit.js +68 -59
  78. package/src/post-comments-form/editor.scss +4 -0
  79. package/src/post-comments-form/form.js +43 -0
  80. package/src/post-template/index.php +15 -3
@@ -12,8 +12,13 @@ import { AlignmentControl, BlockControls, Warning, useBlockProps, store as block
12
12
  import { __, sprintf } from '@wordpress/i18n';
13
13
  import { useSelect } from '@wordpress/data';
14
14
  import { useEntityProp, store as coreStore } from '@wordpress/core-data';
15
- import { __experimentalUseDisabled as useDisabled, useInstanceId } from '@wordpress/compose';
16
15
  import { createInterpolateElement } from '@wordpress/element';
16
+ import { __experimentalUseDisabled as useDisabled } from '@wordpress/compose';
17
+ /**
18
+ * Internal dependencies
19
+ */
20
+
21
+ import CommentsForm from '../post-comments-form/form';
17
22
  export default function PostCommentsEdit(_ref) {
18
23
  let {
19
24
  attributes: {
@@ -41,22 +46,22 @@ export default function PostCommentsEdit(_ref) {
41
46
 
42
47
  let warning = __('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.');
43
48
 
44
- let showPlacholder = true;
49
+ let showPlaceholder = true;
45
50
 
46
51
  if (!isSiteEditor && 'open' !== commentStatus) {
47
52
  if ('closed' === commentStatus) {
48
53
  warning = sprintf(
49
54
  /* translators: 1: Post type (i.e. "post", "page") */
50
55
  __('Post Comments block: Comments to this %s are not allowed.'), postType);
51
- showPlacholder = false;
56
+ showPlaceholder = false;
52
57
  } else if (!postTypeSupportsComments) {
53
58
  warning = sprintf(
54
59
  /* translators: 1: Post type (i.e. "post", "page") */
55
60
  __('Post Comments block: Comments for this post type (%s) are not enabled.'), postType);
56
- showPlacholder = false;
61
+ showPlaceholder = false;
57
62
  } else if ('open' !== defaultCommentStatus) {
58
63
  warning = __('Post Comments block: Comments are not enabled.');
59
- showPlacholder = false;
64
+ showPlaceholder = false;
60
65
  }
61
66
  }
62
67
 
@@ -66,7 +71,6 @@ export default function PostCommentsEdit(_ref) {
66
71
  })
67
72
  });
68
73
  const disabledRef = useDisabled();
69
- const textareaId = useInstanceId(PostCommentsEdit);
70
74
  return createElement(Fragment, null, createElement(BlockControls, {
71
75
  group: "block"
72
76
  }, createElement(AlignmentControl, {
@@ -76,7 +80,7 @@ export default function PostCommentsEdit(_ref) {
76
80
  textAlign: nextAlign
77
81
  });
78
82
  }
79
- })), createElement("div", blockProps, createElement(Warning, null, warning), showPlacholder && createElement("div", {
83
+ })), createElement("div", blockProps, createElement(Warning, null, warning), showPlaceholder && createElement("div", {
80
84
  className: "wp-block-post-comments__placeholder",
81
85
  ref: disabledRef
82
86
  }, createElement("h3", null,
@@ -162,32 +166,6 @@ export default function PostCommentsEdit(_ref) {
162
166
  className: "alignright"
163
167
  }, createElement("a", {
164
168
  href: "#top"
165
- }, __('Newer Comments'), " \xBB"))), createElement("div", {
166
- className: "comment-respond"
167
- }, createElement("h3", {
168
- className: "comment-reply-title"
169
- }, __('Leave a Reply')), createElement("form", {
170
- className: "comment-form",
171
- noValidate: true
172
- }, createElement("p", {
173
- className: "comment-form-comment"
174
- }, createElement("label", {
175
- htmlFor: `comment-${textareaId}`
176
- }, __('Comment'), ' ', createElement("span", {
177
- className: "required"
178
- }, "*")), createElement("textarea", {
179
- id: `comment-${textareaId}`,
180
- name: "comment",
181
- cols: "45",
182
- rows: "8",
183
- required: true
184
- })), createElement("p", {
185
- className: "form-submit wp-block-button"
186
- }, createElement("input", {
187
- name: "submit",
188
- type: "submit",
189
- className: "submit wp-block-button__link",
190
- value: __('Post Comment')
191
- })))))));
169
+ }, __('Newer Comments'), " \xBB"))), createElement(CommentsForm, null))));
192
170
  }
193
171
  //# sourceMappingURL=edit.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/post-comments/edit.js"],"names":["classnames","AlignmentControl","BlockControls","Warning","useBlockProps","store","blockEditorStore","__","sprintf","useSelect","useEntityProp","coreStore","__experimentalUseDisabled","useDisabled","useInstanceId","createInterpolateElement","PostCommentsEdit","attributes","textAlign","setAttributes","context","postType","postId","postTitle","commentStatus","avatarURL","defaultCommentStatus","select","getSettings","__experimentalDiscussionSettings","isSiteEditor","undefined","postTypeSupportsComments","getPostType","supports","comments","warning","showPlacholder","blockPro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;AAAI,IAAA,SAAS,EAAC;AAAd,KACGA,EAAE,CAAE,eAAF,CADL,CADD,EAKC;AAAM,IAAA,SAAS,EAAC,cAAhB;AAA+B,IAAA,UAAU;AAAzC,KACC;AAAG,IAAA,SAAS,EAAC;AAAb,KACC;AACC,IAAA,OAAO,EAAI,WAAWkC,UAAY;AADnC,KAGGlC,EAAE,CAAE,SAAF,CAHL,EAGsB,GAHtB,EAIC;AAAM,IAAA,SAAS,EAAC;AAAhB,SAJD,CADD,EAOC;AACC,IAAA,EAAE,EAAI,WAAWkC,UAAY,EAD9B;AAEC,IAAA,IAAI,EAAC,SAFN;AAGC,IAAA,IAAI,EAAC,IAHN;AAIC,IAAA,IAAI,EAAC,GAJN;AAKC,IAAA,QAAQ;AALT,IAPD,CADD,EAgBC;AAAG,IAAA,SAAS,EAAC;AAAb,KACC;AACC,IAAA,IAAI,EAAC,QADN;AAEC,IAAA,IAAI,EAAC,QAFN;AAGC,IAAA,SAAS,EAAC,8BAHX;AAIC,IAAA,KAAK,EAAGlC,EAAE,CAAE,cAAF;AAJX,IADD,CAhBD,CALD,CApID,CAJF,CAVD,CADD;AAuLA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tWarning,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport {\n\t__experimentalUseDisabled as useDisabled,\n\tuseInstanceId,\n} from '@wordpress/compose';\nimport { createInterpolateElement } from '@wordpress/element';\n\nexport default function PostCommentsEdit( {\n\tattributes: { textAlign },\n\tsetAttributes,\n\tcontext: { postType, postId },\n} ) {\n\tlet [ postTitle ] = useEntityProp( 'postType', postType, 'title', postId );\n\tpostTitle = postTitle || __( 'Post Title' );\n\n\tconst [ commentStatus ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'comment_status',\n\t\tpostId\n\t);\n\n\tconst { avatarURL, defaultCommentStatus } = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings()\n\t\t\t\t.__experimentalDiscussionSettings\n\t);\n\n\tconst isSiteEditor = postType === undefined || postId === undefined;\n\n\tconst postTypeSupportsComments = useSelect( ( select ) =>\n\t\tpostType\n\t\t\t? !! select( coreStore ).getPostType( postType )?.supports.comments\n\t\t\t: false\n\t);\n\n\tlet warning = __(\n\t\t'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.'\n\t);\n\tlet showPlacholder = true;\n\n\tif ( ! isSiteEditor && 'open' !== commentStatus ) {\n\t\tif ( 'closed' === commentStatus ) {\n\t\t\twarning = sprintf(\n\t\t\t\t/* translators: 1: Post type (i.e. \"post\", \"page\") */\n\t\t\t\t__(\n\t\t\t\t\t'Post Comments block: Comments to this %s are not allowed.'\n\t\t\t\t),\n\t\t\t\tpostType\n\t\t\t);\n\t\t\tshowPlacholder = false;\n\t\t} else if ( ! postTypeSupportsComments ) {\n\t\t\twarning = sprintf(\n\t\t\t\t/* translators: 1: Post type (i.e. \"post\", \"page\") */\n\t\t\t\t__(\n\t\t\t\t\t'Post Comments block: Comments for this post type (%s) are not enabled.'\n\t\t\t\t),\n\t\t\t\tpostType\n\t\t\t);\n\t\t\tshowPlacholder = false;\n\t\t} else if ( 'open' !== defaultCommentStatus ) {\n\t\t\twarning = __( 'Post Comments block: Comments are not enabled.' );\n\t\t\tshowPlacholder = false;\n\t\t}\n\t}\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\tconst disabledRef = useDisabled();\n\n\tconst textareaId = useInstanceId( PostCommentsEdit );\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<AlignmentControl\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\tsetAttributes( { textAlign: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Warning>{ warning }</Warning>\n\n\t\t\t\t{ showPlacholder && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"wp-block-post-comments__placeholder\"\n\t\t\t\t\t\tref={ disabledRef }\n\t\t\t\t\t>\n\t\t\t\t\t\t<h3>\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t/* translators: %s: Post title. */\n\t\t\t\t\t\t\t\tsprintf( __( 'One response to %s' ), postTitle )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</h3>\n\n\t\t\t\t\t\t<div className=\"navigation\">\n\t\t\t\t\t\t\t<div className=\"alignleft\">\n\t\t\t\t\t\t\t\t<a href=\"#top\">« { __( 'Older Comments' ) }</a>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div className=\"alignright\">\n\t\t\t\t\t\t\t\t<a href=\"#top\">{ __( 'Newer Comments' ) } »</a>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<ol className=\"commentlist\">\n\t\t\t\t\t\t\t<li className=\"comment even thread-even depth-1\">\n\t\t\t\t\t\t\t\t<article className=\"comment-body\">\n\t\t\t\t\t\t\t\t\t<footer className=\"comment-meta\">\n\t\t\t\t\t\t\t\t\t\t<div className=\"comment-author vcard\">\n\t\t\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\t\t\talt=\"Commenter Avatar\"\n\t\t\t\t\t\t\t\t\t\t\t\tsrc={ avatarURL }\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"avatar avatar-32 photo\"\n\t\t\t\t\t\t\t\t\t\t\t\theight=\"32\"\n\t\t\t\t\t\t\t\t\t\t\t\twidth=\"32\"\n\t\t\t\t\t\t\t\t\t\t\t\tloading=\"lazy\"\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: Comment author link. */\n\t\t\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'%s <span>says:</span>'\n\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'<cite><a>%s</a></cite>',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'A WordPress Commenter'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\tspan: (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span className=\"says\" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/* eslint-disable jsx-a11y/anchor-has-content */\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\thref=\"#top\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"url\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/* eslint-enable jsx-a11y/anchor-has-content */\n\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\tcite: (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<cite className=\"fn\" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t\t\t<div className=\"comment-metadata\">\n\t\t\t\t\t\t\t\t\t\t\t<a href=\"#top\">\n\t\t\t\t\t\t\t\t\t\t\t\t<time dateTime=\"2000-01-01T12:00:00+00:00\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'January 1, 2000 at 12:00 am'\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t</time>\n\t\t\t\t\t\t\t\t\t\t\t</a>{ ' ' }\n\t\t\t\t\t\t\t\t\t\t\t<span className=\"edit-link\">\n\t\t\t\t\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"comment-edit-link\"\n\t\t\t\t\t\t\t\t\t\t\t\t\thref=\"#top\"\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</footer>\n\n\t\t\t\t\t\t\t\t\t<div className=\"comment-content\">\n\t\t\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Hi, this is a comment.' ) }\n\t\t\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'To get started with moderating, editing, and deleting comments, please visit the Comments screen in the dashboard.'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Commenter avatars come from <a>Gravatar</a>'\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/* eslint-disable-next-line jsx-a11y/anchor-has-content */\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"https://gravatar.com/\" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t\t<div className=\"reply\">\n\t\t\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"comment-reply-link\"\n\t\t\t\t\t\t\t\t\t\t\thref=\"#top\"\n\t\t\t\t\t\t\t\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t/* translators: Comment reply button text. %s: Comment author name. */\n\t\t\t\t\t\t\t\t\t\t\t\t__( 'Reply to %s' ),\n\t\t\t\t\t\t\t\t\t\t\t\t__( 'A WordPress Commenter' )\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Reply' ) }\n\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</article>\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t</ol>\n\n\t\t\t\t\t\t<div className=\"navigation\">\n\t\t\t\t\t\t\t<div className=\"alignleft\">\n\t\t\t\t\t\t\t\t<a href=\"#top\">« { __( 'Older Comments' ) }</a>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div className=\"alignright\">\n\t\t\t\t\t\t\t\t<a href=\"#top\">{ __( 'Newer Comments' ) } »</a>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<div className=\"comment-respond\">\n\t\t\t\t\t\t\t<h3 className=\"comment-reply-title\">\n\t\t\t\t\t\t\t\t{ __( 'Leave a Reply' ) }\n\t\t\t\t\t\t\t</h3>\n\n\t\t\t\t\t\t\t<form className=\"comment-form\" noValidate>\n\t\t\t\t\t\t\t\t<p className=\"comment-form-comment\">\n\t\t\t\t\t\t\t\t\t<label\n\t\t\t\t\t\t\t\t\t\thtmlFor={ `comment-${ textareaId }` }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Comment' ) }{ ' ' }\n\t\t\t\t\t\t\t\t\t\t<span className=\"required\">*</span>\n\t\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t\t\t<textarea\n\t\t\t\t\t\t\t\t\t\tid={ `comment-${ textareaId }` }\n\t\t\t\t\t\t\t\t\t\tname=\"comment\"\n\t\t\t\t\t\t\t\t\t\tcols=\"45\"\n\t\t\t\t\t\t\t\t\t\trows=\"8\"\n\t\t\t\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t<p className=\"form-submit wp-block-button\">\n\t\t\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t\t\tname=\"submit\"\n\t\t\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"submit wp-block-button__link\"\n\t\t\t\t\t\t\t\t\t\tvalue={ __( 'Post Comment' ) }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t</form>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/post-comments/edit.js"],"names":["classnames","AlignmentControl","BlockControls","Warning","useBlockProps","store","blockEditorStore","__","sprintf","useSelect","useEntityProp","coreStore","createInterpolateElement","__experimentalUseDisabled","useDisabled","CommentsForm","PostCommentsEdit","attributes","textAlign","setAttributes","context","postType","postId","postTitle","commentStatus","avatarURL","defaultCommentStatus","select","getSettings","__experimentalDiscussionSettings","isSiteEditor","undefined","postTypeSupportsComments","getPostType","supports","comments","warning","showPlaceholder","blockProps","className","disabledRef","nextAlign","span","a","cite"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,gBADD,EAECC,aAFD,EAGCC,OAHD,EAICC,aAJD,EAKCC,KAAK,IAAIC,gBALV,QAMO,yBANP;AAOA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,aAAT,EAAwBL,KAAK,IAAIM,SAAjC,QAAkD,sBAAlD;AAEA,SAASC,wBAAT,QAAyC,oBAAzC;AACA,SAASC,yBAAyB,IAAIC,WAAtC,QAAyD,oBAAzD;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,4BAAzB;AAEA,eAAe,SAASC,gBAAT,OAIX;AAAA,MAJsC;AACzCC,IAAAA,UAAU,EAAE;AAAEC,MAAAA;AAAF,KAD6B;AAEzCC,IAAAA,aAFyC;AAGzCC,IAAAA,OAAO,EAAE;AAAEC,MAAAA,QAAF;AAAYC,MAAAA;AAAZ;AAHgC,GAItC;AACH,MAAI,CAAEC,SAAF,IAAgBb,aAAa,CAAE,UAAF,EAAcW,QAAd,EAAwB,OAAxB,EAAiCC,MAAjC,CAAjC;AACAC,EAAAA,SAAS,GAAGA,SAAS,IAAIhB,EAAE,CAAE,YAAF,CAA3B;AAEA,QAAM,CAAEiB,aAAF,I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CADD,CApFD,CADD,CADD,CApBD,EA2HC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAG,IAAA,IAAI,EAAC;AAAR,cAAmBA,EAAE,CAAE,gBAAF,CAArB,CADD,CADD,EAIC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAG,IAAA,IAAI,EAAC;AAAR,KAAiBA,EAAE,CAAE,gBAAF,CAAnB,UADD,CAJD,CA3HD,EAoIC,cAAC,YAAD,OApID,CAJF,CAVD,CADD;AAyJA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tWarning,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\n\nimport { createInterpolateElement } from '@wordpress/element';\nimport { __experimentalUseDisabled as useDisabled } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport CommentsForm from '../post-comments-form/form';\n\nexport default function PostCommentsEdit( {\n\tattributes: { textAlign },\n\tsetAttributes,\n\tcontext: { postType, postId },\n} ) {\n\tlet [ postTitle ] = useEntityProp( 'postType', postType, 'title', postId );\n\tpostTitle = postTitle || __( 'Post Title' );\n\n\tconst [ commentStatus ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'comment_status',\n\t\tpostId\n\t);\n\n\tconst { avatarURL, defaultCommentStatus } = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings()\n\t\t\t\t.__experimentalDiscussionSettings\n\t);\n\n\tconst isSiteEditor = postType === undefined || postId === undefined;\n\n\tconst postTypeSupportsComments = useSelect( ( select ) =>\n\t\tpostType\n\t\t\t? !! select( coreStore ).getPostType( postType )?.supports.comments\n\t\t\t: false\n\t);\n\n\tlet warning = __(\n\t\t'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.'\n\t);\n\tlet showPlaceholder = true;\n\n\tif ( ! isSiteEditor && 'open' !== commentStatus ) {\n\t\tif ( 'closed' === commentStatus ) {\n\t\t\twarning = sprintf(\n\t\t\t\t/* translators: 1: Post type (i.e. \"post\", \"page\") */\n\t\t\t\t__(\n\t\t\t\t\t'Post Comments block: Comments to this %s are not allowed.'\n\t\t\t\t),\n\t\t\t\tpostType\n\t\t\t);\n\t\t\tshowPlaceholder = false;\n\t\t} else if ( ! postTypeSupportsComments ) {\n\t\t\twarning = sprintf(\n\t\t\t\t/* translators: 1: Post type (i.e. \"post\", \"page\") */\n\t\t\t\t__(\n\t\t\t\t\t'Post Comments block: Comments for this post type (%s) are not enabled.'\n\t\t\t\t),\n\t\t\t\tpostType\n\t\t\t);\n\t\t\tshowPlaceholder = false;\n\t\t} else if ( 'open' !== defaultCommentStatus ) {\n\t\t\twarning = __( 'Post Comments block: Comments are not enabled.' );\n\t\t\tshowPlaceholder = false;\n\t\t}\n\t}\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\tconst disabledRef = useDisabled();\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<AlignmentControl\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\tsetAttributes( { textAlign: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Warning>{ warning }</Warning>\n\n\t\t\t\t{ showPlaceholder && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"wp-block-post-comments__placeholder\"\n\t\t\t\t\t\tref={ disabledRef }\n\t\t\t\t\t>\n\t\t\t\t\t\t<h3>\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t/* translators: %s: Post title. */\n\t\t\t\t\t\t\t\tsprintf( __( 'One response to %s' ), postTitle )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</h3>\n\n\t\t\t\t\t\t<div className=\"navigation\">\n\t\t\t\t\t\t\t<div className=\"alignleft\">\n\t\t\t\t\t\t\t\t<a href=\"#top\">« { __( 'Older Comments' ) }</a>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div className=\"alignright\">\n\t\t\t\t\t\t\t\t<a href=\"#top\">{ __( 'Newer Comments' ) } »</a>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<ol className=\"commentlist\">\n\t\t\t\t\t\t\t<li className=\"comment even thread-even depth-1\">\n\t\t\t\t\t\t\t\t<article className=\"comment-body\">\n\t\t\t\t\t\t\t\t\t<footer className=\"comment-meta\">\n\t\t\t\t\t\t\t\t\t\t<div className=\"comment-author vcard\">\n\t\t\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\t\t\talt=\"Commenter Avatar\"\n\t\t\t\t\t\t\t\t\t\t\t\tsrc={ avatarURL }\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"avatar avatar-32 photo\"\n\t\t\t\t\t\t\t\t\t\t\t\theight=\"32\"\n\t\t\t\t\t\t\t\t\t\t\t\twidth=\"32\"\n\t\t\t\t\t\t\t\t\t\t\t\tloading=\"lazy\"\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: Comment author link. */\n\t\t\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'%s <span>says:</span>'\n\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'<cite><a>%s</a></cite>',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'A WordPress Commenter'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\tspan: (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span className=\"says\" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/* eslint-disable jsx-a11y/anchor-has-content */\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\thref=\"#top\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"url\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/* eslint-enable jsx-a11y/anchor-has-content */\n\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\tcite: (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<cite className=\"fn\" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t\t\t<div className=\"comment-metadata\">\n\t\t\t\t\t\t\t\t\t\t\t<a href=\"#top\">\n\t\t\t\t\t\t\t\t\t\t\t\t<time dateTime=\"2000-01-01T12:00:00+00:00\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'January 1, 2000 at 12:00 am'\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t</time>\n\t\t\t\t\t\t\t\t\t\t\t</a>{ ' ' }\n\t\t\t\t\t\t\t\t\t\t\t<span className=\"edit-link\">\n\t\t\t\t\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"comment-edit-link\"\n\t\t\t\t\t\t\t\t\t\t\t\t\thref=\"#top\"\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</footer>\n\n\t\t\t\t\t\t\t\t\t<div className=\"comment-content\">\n\t\t\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Hi, this is a comment.' ) }\n\t\t\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'To get started with moderating, editing, and deleting comments, please visit the Comments screen in the dashboard.'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Commenter avatars come from <a>Gravatar</a>'\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/* eslint-disable-next-line jsx-a11y/anchor-has-content */\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"https://gravatar.com/\" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t\t<div className=\"reply\">\n\t\t\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"comment-reply-link\"\n\t\t\t\t\t\t\t\t\t\t\thref=\"#top\"\n\t\t\t\t\t\t\t\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t/* translators: Comment reply button text. %s: Comment author name. */\n\t\t\t\t\t\t\t\t\t\t\t\t__( 'Reply to %s' ),\n\t\t\t\t\t\t\t\t\t\t\t\t__( 'A WordPress Commenter' )\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Reply' ) }\n\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</article>\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t</ol>\n\n\t\t\t\t\t\t<div className=\"navigation\">\n\t\t\t\t\t\t\t<div className=\"alignleft\">\n\t\t\t\t\t\t\t\t<a href=\"#top\">« { __( 'Older Comments' ) }</a>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div className=\"alignright\">\n\t\t\t\t\t\t\t\t<a href=\"#top\">{ __( 'Newer Comments' ) } »</a>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<CommentsForm />\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"]}
@@ -8,10 +8,16 @@ import classnames from 'classnames';
8
8
  * WordPress dependencies
9
9
  */
10
10
 
11
- import { AlignmentControl, BlockControls, Warning, useBlockProps } from '@wordpress/block-editor';
12
- import { useEntityProp } from '@wordpress/core-data';
13
- import { __, sprintf } from '@wordpress/i18n';
14
- import { __experimentalUseDisabled as useDisabled, useInstanceId } from '@wordpress/compose';
11
+ import { AlignmentControl, BlockControls, Warning, useBlockProps, store as blockEditorStore } from '@wordpress/block-editor';
12
+ import { Button } from '@wordpress/components';
13
+ import { useEntityProp, store as coreStore } from '@wordpress/core-data';
14
+ import { __, _x, sprintf } from '@wordpress/i18n';
15
+ import { useSelect } from '@wordpress/data';
16
+ /**
17
+ * Internal dependencies
18
+ */
19
+
20
+ import CommentsForm from './form';
15
21
  export default function PostCommentsFormEdit(_ref) {
16
22
  let {
17
23
  attributes,
@@ -25,15 +31,47 @@ export default function PostCommentsFormEdit(_ref) {
25
31
  postId,
26
32
  postType
27
33
  } = context;
28
- const [commentStatus] = useEntityProp('postType', postType, 'comment_status', postId);
34
+ const [commentStatus, setCommentStatus] = useEntityProp('postType', postType, 'comment_status', postId);
29
35
  const blockProps = useBlockProps({
30
36
  className: classnames({
31
37
  [`has-text-align-${textAlign}`]: textAlign
32
38
  })
33
39
  });
34
- const isInSiteEditor = postType === undefined || postId === undefined;
35
- const disabledFormRef = useDisabled();
36
- const instanceId = useInstanceId(PostCommentsFormEdit);
40
+ const isSiteEditor = postType === undefined || postId === undefined;
41
+ const {
42
+ defaultCommentStatus
43
+ } = useSelect(select => select(blockEditorStore).getSettings().__experimentalDiscussionSettings);
44
+ const postTypeSupportsComments = useSelect(select => {
45
+ var _select$getPostType;
46
+
47
+ return postType ? !!((_select$getPostType = select(coreStore).getPostType(postType)) !== null && _select$getPostType !== void 0 && _select$getPostType.supports.comments) : false;
48
+ });
49
+ let warning = false;
50
+ let actions;
51
+ let showPlaceholder = true;
52
+
53
+ if (!isSiteEditor && 'open' !== commentStatus) {
54
+ if ('closed' === commentStatus) {
55
+ warning = sprintf(
56
+ /* translators: 1: Post type (i.e. "post", "page") */
57
+ __('Post Comments Form block: Comments on this %s are not allowed.'), postType);
58
+ actions = [createElement(Button, {
59
+ key: "enableComments",
60
+ onClick: () => setCommentStatus('open'),
61
+ variant: "primary"
62
+ }, _x('Enable comments', 'action that affects the current post'))];
63
+ showPlaceholder = false;
64
+ } else if (!postTypeSupportsComments) {
65
+ warning = sprintf(
66
+ /* translators: 1: Post type (i.e. "post", "page") */
67
+ __('Post Comments Form block: Comments for this post type (%s) are not enabled.'), postType);
68
+ showPlaceholder = false;
69
+ } else if ('open' !== defaultCommentStatus) {
70
+ warning = __('Post Comments Form block: Comments are not enabled.');
71
+ showPlaceholder = false;
72
+ }
73
+ }
74
+
37
75
  return createElement(Fragment, null, createElement(BlockControls, {
38
76
  group: "block"
39
77
  }, createElement(AlignmentControl, {
@@ -43,25 +81,8 @@ export default function PostCommentsFormEdit(_ref) {
43
81
  textAlign: nextAlign
44
82
  });
45
83
  }
46
- })), createElement("div", blockProps, !commentStatus && !isInSiteEditor && createElement(Warning, null, __('Post Comments Form block: comments are not enabled for this post type.')), 'open' !== commentStatus && !isInSiteEditor && createElement(Warning, null, sprintf(
47
- /* translators: 1: Post type (i.e. "post", "page") */
48
- __('Post Comments Form block: comments to this %s are not allowed.'), postType)), ('open' === commentStatus || isInSiteEditor) && createElement("div", null, createElement("h3", null, __('Leave a Reply')), createElement("form", {
49
- noValidate: true,
50
- className: "comment-form",
51
- ref: disabledFormRef
52
- }, createElement("p", null, createElement("label", {
53
- htmlFor: `comment-${instanceId}`
54
- }, __('Comment')), createElement("textarea", {
55
- id: `comment-${instanceId}`,
56
- name: "comment",
57
- cols: "45",
58
- rows: "8"
59
- })), createElement("p", null, createElement("input", {
60
- name: "submit",
61
- className: "submit wp-block-button__link",
62
- label: __('Post Comment'),
63
- value: __('Post Comment'),
64
- readOnly: true
65
- }))))));
84
+ })), createElement("div", blockProps, warning && createElement(Warning, {
85
+ actions: actions
86
+ }, warning), showPlaceholder ? createElement(CommentsForm, null) : null));
66
87
  }
67
88
  //# sourceMappingURL=edit.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/post-comments-form/edit.js"],"names":["classnames","AlignmentControl","BlockControls","Warning","useBlockProps","useEntityProp","__","sprintf","__experimentalUseDisabled","useDisabled","useInstanceId","PostCommentsFormEdit","attributes","context","setAttributes","textAlign","postId","postType","commentStatus","blockProps","className","isInSiteEditor","undefined","disabledFormRef","instanceId","nextAlign"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,gBADD,EAECC,aAFD,EAGCC,OAHD,EAICC,aAJD,QAKO,yBALP;AAMA,SAASC,aAAT,QAA8B,sBAA9B;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,yBAAyB,IAAIC,WAD9B,EAECC,aAFD,QAGO,oBAHP;AAKA,eAAe,SAASC,oBAAT,OAIX;AAAA,MAJ0C;AAC7CC,IAAAA,UAD6C;AAE7CC,IAAAA,OAF6C;AAG7CC,IAAAA;AAH6C,GAI1C;AACH,QAAM;AAAEC,IAAAA;AAAF,MAAgBH,UAAtB;AACA,QAAM;AAAEI,IAAAA,MAAF;AAAUC,IAAAA;AAAV,MAAuBJ,OAA7B;AACA,QAAM,CAAEK,aAAF,IAAoBb,aAAa,CACtC,UADsC,EAEtCY,QAFsC,EAGtC,gBAHsC,EAItCD,MAJsC,CAAvC;AAMA,QAAMG,UAAU,GAAGf,aAAa,CAAE;AACjCgB,IAAAA,SAAS,EAAEpB,UAAU,CAAE;AACtB,OAAG,kBAAkBe,SAAW,EAAhC,GAAqCA;AADf,KAAF;AADY,GAAF,CAAhC;AAMA,QAAMM,cAAc,GAAGJ,QAAQ,KAAKK,SAAb,IAA0BN,MAAM,KAAKM,SAA5D;AAEA,QAAMC,eAAe,GAAGd,WAAW,EAAnC;AAEA,QAAMe,UAAU,GAAGd,aAAa,CAAEC,oBAAF,CAAhC;AAEA,SACC,8BACC,cAAC,aAAD;AAAe,IAAA,KAAK,EAAC;AAArB,KACC,cAAC,gBAAD;AACC,IAAA,KAAK,EAAGI,SADT;AAEC,IAAA,QAAQ,EAAKU,SAAF,IAAiB;AAC3BX,MAAAA,aAAa,CAAE;AAAEC,QAAAA,SAAS,EAAEU;AAAb,OAAF,CAAb;AACA;AAJF,IADD,CADD,EASC,qBAAUN,UAAV,EACG,CAAED,aAAF,IAAmB,CAAEG,cAArB,IACD,cAAC,OAAD,QACGf,EAAE,CACH,wEADG,CADL,CAFF,EASG,WAAWY,aAAX,IAA4B,CAAEG,cAA9B,IACD,cAAC,OAAD,QACGd,OAAO;AACR;AACAD,EAAAA,EAAE,CACD,gEADC,CAFM,EAKRW,QALQ,CADV,CAVF,EAqBG,CAAE,WAAWC,aAAX,IAA4BG,cAA9B,KACD,2BACC,0BAAMf,EAAE,CAAE,eAAF,CAAR,CADD,EAEC;AACC,IAAA,UAAU,MADX;AAEC,IAAA,SAAS,EAAC,cAFX;AAGC,IAAA,GAAG,EAAGiB;AAHP,KAKC,yBACC;AAAO,IAAA,OAAO,EAAI,WAAWC,UAAY;AAAzC,KACGlB,EAAE,CAAE,SAAF,CADL,CADD,EAIC;AACC,IAAA,EAAE,EAAI,WAAWkB,UAAY,EAD9B;AAEC,IAAA,IAAI,EAAC,SAFN;AAGC,IAAA,IAAI,EAAC,IAHN;AAIC,IAAA,IAAI,EAAC;AAJN,IAJD,CALD,EAgBC,yBACC;AACC,IAAA,IAAI,EAAC,QADN;AAEC,IAAA,SAAS,EAAC,8BAFX;AAGC,IAAA,KAAK,EAAGlB,EAAE,CAAE,cAAF,CAHX;AAIC,IAAA,KAAK,EAAGA,EAAE,CAAE,cAAF,CAJX;AAKC,IAAA,QAAQ;AALT,IADD,CAhBD,CAFD,CAtBF,CATD,CADD;AAiEA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tWarning,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__experimentalUseDisabled as useDisabled,\n\tuseInstanceId,\n} from '@wordpress/compose';\n\nexport default function PostCommentsFormEdit( {\n\tattributes,\n\tcontext,\n\tsetAttributes,\n} ) {\n\tconst { textAlign } = attributes;\n\tconst { postId, postType } = context;\n\tconst [ commentStatus ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'comment_status',\n\t\tpostId\n\t);\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\tconst isInSiteEditor = postType === undefined || postId === undefined;\n\n\tconst disabledFormRef = useDisabled();\n\n\tconst instanceId = useInstanceId( PostCommentsFormEdit );\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<AlignmentControl\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\tsetAttributes( { textAlign: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ ! commentStatus && ! isInSiteEditor && (\n\t\t\t\t\t<Warning>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Post Comments Form block: comments are not enabled for this post type.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Warning>\n\t\t\t\t) }\n\n\t\t\t\t{ 'open' !== commentStatus && ! isInSiteEditor && (\n\t\t\t\t\t<Warning>\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t/* translators: 1: Post type (i.e. \"post\", \"page\") */\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'Post Comments Form block: comments to this %s are not allowed.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tpostType\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Warning>\n\t\t\t\t) }\n\n\t\t\t\t{ ( 'open' === commentStatus || isInSiteEditor ) && (\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<h3>{ __( 'Leave a Reply' ) }</h3>\n\t\t\t\t\t\t<form\n\t\t\t\t\t\t\tnoValidate\n\t\t\t\t\t\t\tclassName=\"comment-form\"\n\t\t\t\t\t\t\tref={ disabledFormRef }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t<label htmlFor={ `comment-${ instanceId }` }>\n\t\t\t\t\t\t\t\t\t{ __( 'Comment' ) }\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t\t<textarea\n\t\t\t\t\t\t\t\t\tid={ `comment-${ instanceId }` }\n\t\t\t\t\t\t\t\t\tname=\"comment\"\n\t\t\t\t\t\t\t\t\tcols=\"45\"\n\t\t\t\t\t\t\t\t\trows=\"8\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t\tname=\"submit\"\n\t\t\t\t\t\t\t\t\tclassName=\"submit wp-block-button__link\"\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Post Comment' ) }\n\t\t\t\t\t\t\t\t\tvalue={ __( 'Post Comment' ) }\n\t\t\t\t\t\t\t\t\treadOnly\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</form>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/post-comments-form/edit.js"],"names":["classnames","AlignmentControl","BlockControls","Warning","useBlockProps","store","blockEditorStore","Button","useEntityProp","coreStore","__","_x","sprintf","useSelect","CommentsForm","PostCommentsFormEdit","attributes","context","setAttributes","textAlign","postId","postType","commentStatus","setCommentStatus","blockProps","className","isSiteEditor","undefined","defaultCommentStatus","select","getSettings","__experimentalDiscussionSettings","postTypeSupportsComments","getPostType","supports","comments","warning","actions","showPlaceholder","nextAlign"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,gBADD,EAECC,aAFD,EAGCC,OAHD,EAICC,aAJD,EAKCC,KAAK,IAAIC,gBALV,QAMO,yBANP;AAOA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,aAAT,EAAwBH,KAAK,IAAII,SAAjC,QAAkD,sBAAlD;AACA,SAASC,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,QAAgC,iBAAhC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,QAAzB;AAEA,eAAe,SAASC,oBAAT,OAIX;AAAA,MAJ0C;AAC7CC,IAAAA,UAD6C;AAE7CC,IAAAA,OAF6C;AAG7CC,IAAAA;AAH6C,GAI1C;AACH,QAAM;AAAEC,IAAAA;AAAF,MAAgBH,UAAtB;AACA,QAAM;AAAEI,IAAAA,MAAF;AAAUC,IAAAA;AAAV,MAAuBJ,OAA7B;AACA,QAAM,CAAEK,aAAF,EAAiBC,gBAAjB,IAAsCf,aAAa,CACxD,UADwD,EAExDa,QAFwD,EAGxD,gBAHwD,EAIxDD,MAJwD,CAAzD;AAMA,QAAMI,UAAU,GAAGpB,aAAa,CAAE;AACjCqB,IAAAA,SAAS,EAAEzB,UAAU,CAAE;AACtB,OAAG,kBAAkBmB,SAAW,EAAhC,GAAqCA;AADf,KAAF;AADY,GAAF,CAAhC;AAMA,QAAMO,YAAY,GAAGL,QAAQ,KAAKM,SAAb,IAA0BP,MAAM,KAAKO,SAA1D;AAEA,QAAM;AAAEC,IAAAA;AAAF,MAA2Bf,SAAS,CACvCgB,MAAF,IACCA,MAAM,CAAEvB,gBAAF,CAAN,CAA2BwB,WAA3B,GACEC,gCAHsC,CAA1C;AAMA,QAAMC,wBAAwB,GAAGnB,SAAS,CAAI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QAAAA,SAAS,EAAEoB;AAAb,OAAF,CAAb;AACA;AAJF,IADD,CADD,EASC,qBAAUf,UAAV,EACGY,OAAO,IACR,cAAC,OAAD;AAAS,IAAA,OAAO,EAAGC;AAAnB,KAA+BD,OAA/B,CAFF,EAKGE,eAAe,GAAG,cAAC,YAAD,OAAH,GAAsB,IALxC,CATD,CADD;AAmBA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tWarning,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport CommentsForm from './form';\n\nexport default function PostCommentsFormEdit( {\n\tattributes,\n\tcontext,\n\tsetAttributes,\n} ) {\n\tconst { textAlign } = attributes;\n\tconst { postId, postType } = context;\n\tconst [ commentStatus, setCommentStatus ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'comment_status',\n\t\tpostId\n\t);\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\tconst isSiteEditor = postType === undefined || postId === undefined;\n\n\tconst { defaultCommentStatus } = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings()\n\t\t\t\t.__experimentalDiscussionSettings\n\t);\n\n\tconst postTypeSupportsComments = useSelect( ( select ) =>\n\t\tpostType\n\t\t\t? !! select( coreStore ).getPostType( postType )?.supports.comments\n\t\t\t: false\n\t);\n\n\tlet warning = false;\n\tlet actions;\n\tlet showPlaceholder = true;\n\n\tif ( ! isSiteEditor && 'open' !== commentStatus ) {\n\t\tif ( 'closed' === commentStatus ) {\n\t\t\twarning = sprintf(\n\t\t\t\t/* translators: 1: Post type (i.e. \"post\", \"page\") */\n\t\t\t\t__(\n\t\t\t\t\t'Post Comments Form block: Comments on this %s are not allowed.'\n\t\t\t\t),\n\t\t\t\tpostType\n\t\t\t);\n\t\t\tactions = [\n\t\t\t\t<Button\n\t\t\t\t\tkey=\"enableComments\"\n\t\t\t\t\tonClick={ () => setCommentStatus( 'open' ) }\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t>\n\t\t\t\t\t{ _x(\n\t\t\t\t\t\t'Enable comments',\n\t\t\t\t\t\t'action that affects the current post'\n\t\t\t\t\t) }\n\t\t\t\t</Button>,\n\t\t\t];\n\t\t\tshowPlaceholder = false;\n\t\t} else if ( ! postTypeSupportsComments ) {\n\t\t\twarning = sprintf(\n\t\t\t\t/* translators: 1: Post type (i.e. \"post\", \"page\") */\n\t\t\t\t__(\n\t\t\t\t\t'Post Comments Form block: Comments for this post type (%s) are not enabled.'\n\t\t\t\t),\n\t\t\t\tpostType\n\t\t\t);\n\t\t\tshowPlaceholder = false;\n\t\t} else if ( 'open' !== defaultCommentStatus ) {\n\t\t\twarning = __(\n\t\t\t\t'Post Comments Form block: Comments are not enabled.'\n\t\t\t);\n\t\t\tshowPlaceholder = false;\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<AlignmentControl\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\tsetAttributes( { textAlign: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ warning && (\n\t\t\t\t\t<Warning actions={ actions }>{ warning }</Warning>\n\t\t\t\t) }\n\n\t\t\t\t{ showPlaceholder ? <CommentsForm /> : null }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"]}
@@ -0,0 +1,39 @@
1
+ import { createElement } from "@wordpress/element";
2
+
3
+ /**
4
+ * WordPress dependencies
5
+ */
6
+ import { __ } from '@wordpress/i18n';
7
+ import { __experimentalUseDisabled as useDisabled, useInstanceId } from '@wordpress/compose';
8
+
9
+ const CommentsForm = () => {
10
+ const disabledFormRef = useDisabled();
11
+ const instanceId = useInstanceId(CommentsForm);
12
+ return createElement("div", {
13
+ className: "comment-respond"
14
+ }, createElement("h3", {
15
+ className: "comment-reply-title"
16
+ }, __('Leave a Reply')), createElement("form", {
17
+ noValidate: true,
18
+ className: "comment-form",
19
+ ref: disabledFormRef
20
+ }, createElement("p", null, createElement("label", {
21
+ htmlFor: `comment-${instanceId}`
22
+ }, __('Comment')), createElement("textarea", {
23
+ id: `comment-${instanceId}`,
24
+ name: "comment",
25
+ cols: "45",
26
+ rows: "8"
27
+ })), createElement("p", {
28
+ className: "form-submit wp-block-button"
29
+ }, createElement("input", {
30
+ name: "submit",
31
+ type: "submit",
32
+ className: "submit wp-block-button__link",
33
+ label: __('Post Comment'),
34
+ value: __('Post Comment')
35
+ }))));
36
+ };
37
+
38
+ export default CommentsForm;
39
+ //# sourceMappingURL=form.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-library/src/post-comments-form/form.js"],"names":["__","__experimentalUseDisabled","useDisabled","useInstanceId","CommentsForm","disabledFormRef","instanceId"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SACCC,yBAAyB,IAAIC,WAD9B,EAECC,aAFD,QAGO,oBAHP;;AAKA,MAAMC,YAAY,GAAG,MAAM;AAC1B,QAAMC,eAAe,GAAGH,WAAW,EAAnC;AACA,QAAMI,UAAU,GAAGH,aAAa,CAAEC,YAAF,CAAhC;AAEA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAI,IAAA,SAAS,EAAC;AAAd,KAAsCJ,EAAE,CAAE,eAAF,CAAxC,CADD,EAEC;AAAM,IAAA,UAAU,MAAhB;AAAiB,IAAA,SAAS,EAAC,cAA3B;AAA0C,IAAA,GAAG,EAAGK;AAAhD,KACC,yBACC;AAAO,IAAA,OAAO,EAAI,WAAWC,UAAY;AAAzC,KACGN,EAAE,CAAE,SAAF,CADL,CADD,EAIC;AACC,IAAA,EAAE,EAAI,WAAWM,UAAY,EAD9B;AAEC,IAAA,IAAI,EAAC,SAFN;AAGC,IAAA,IAAI,EAAC,IAHN;AAIC,IAAA,IAAI,EAAC;AAJN,IAJD,CADD,EAYC;AAAG,IAAA,SAAS,EAAC;AAAb,KACC;AACC,IAAA,IAAI,EAAC,QADN;AAEC,IAAA,IAAI,EAAC,QAFN;AAGC,IAAA,SAAS,EAAC,8BAHX;AAIC,IAAA,KAAK,EAAGN,EAAE,CAAE,cAAF,CAJX;AAKC,IAAA,KAAK,EAAGA,EAAE,CAAE,cAAF;AALX,IADD,CAZD,CAFD,CADD;AA2BA,CA/BD;;AAiCA,eAAeI,YAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__experimentalUseDisabled as useDisabled,\n\tuseInstanceId,\n} from '@wordpress/compose';\n\nconst CommentsForm = () => {\n\tconst disabledFormRef = useDisabled();\n\tconst instanceId = useInstanceId( CommentsForm );\n\n\treturn (\n\t\t<div className=\"comment-respond\">\n\t\t\t<h3 className=\"comment-reply-title\">{ __( 'Leave a Reply' ) }</h3>\n\t\t\t<form noValidate className=\"comment-form\" ref={ disabledFormRef }>\n\t\t\t\t<p>\n\t\t\t\t\t<label htmlFor={ `comment-${ instanceId }` }>\n\t\t\t\t\t\t{ __( 'Comment' ) }\n\t\t\t\t\t</label>\n\t\t\t\t\t<textarea\n\t\t\t\t\t\tid={ `comment-${ instanceId }` }\n\t\t\t\t\t\tname=\"comment\"\n\t\t\t\t\t\tcols=\"45\"\n\t\t\t\t\t\trows=\"8\"\n\t\t\t\t\t/>\n\t\t\t\t</p>\n\t\t\t\t<p className=\"form-submit wp-block-button\">\n\t\t\t\t\t<input\n\t\t\t\t\t\tname=\"submit\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\tclassName=\"submit wp-block-button__link\"\n\t\t\t\t\t\tlabel={ __( 'Post Comment' ) }\n\t\t\t\t\t\tvalue={ __( 'Post Comment' ) }\n\t\t\t\t\t/>\n\t\t\t\t</p>\n\t\t\t</form>\n\t\t</div>\n\t);\n};\n\nexport default CommentsForm;\n"]}
@@ -2701,6 +2701,9 @@ div[data-type="core/post-featured-image"] img {
2701
2701
  .wp-block-post-comments-form * {
2702
2702
  pointer-events: none;
2703
2703
  }
2704
+ .wp-block-post-comments-form *.block-editor-warning * {
2705
+ pointer-events: auto;
2706
+ }
2704
2707
 
2705
2708
  :root .editor-styles-wrapper {
2706
2709
  /*
@@ -2712,6 +2712,9 @@ div[data-type="core/post-featured-image"] img {
2712
2712
  .wp-block-post-comments-form * {
2713
2713
  pointer-events: none;
2714
2714
  }
2715
+ .wp-block-post-comments-form *.block-editor-warning * {
2716
+ pointer-events: auto;
2717
+ }
2715
2718
 
2716
2719
  :root .editor-styles-wrapper {
2717
2720
  /*
@@ -271,6 +271,9 @@ button.wp-block-navigation-item__content {
271
271
  font-size: inherit;
272
272
  font-family: inherit;
273
273
  line-height: inherit;
274
+ font-style: inherit;
275
+ font-weight: inherit;
276
+ text-transform: inherit;
274
277
  text-align: right;
275
278
  }
276
279
 
@@ -271,6 +271,9 @@ button.wp-block-navigation-item__content {
271
271
  font-size: inherit;
272
272
  font-family: inherit;
273
273
  line-height: inherit;
274
+ font-style: inherit;
275
+ font-weight: inherit;
276
+ text-transform: inherit;
274
277
  text-align: left;
275
278
  }
276
279
 
@@ -76,4 +76,7 @@
76
76
  */
77
77
  .wp-block-post-comments-form * {
78
78
  pointer-events: none;
79
+ }
80
+ .wp-block-post-comments-form *.block-editor-warning * {
81
+ pointer-events: auto;
79
82
  }
@@ -76,4 +76,7 @@
76
76
  */
77
77
  .wp-block-post-comments-form * {
78
78
  pointer-events: none;
79
+ }
80
+ .wp-block-post-comments-form *.block-editor-warning * {
81
+ pointer-events: auto;
79
82
  }
@@ -1753,6 +1753,9 @@ button.wp-block-navigation-item__content {
1753
1753
  font-size: inherit;
1754
1754
  font-family: inherit;
1755
1755
  line-height: inherit;
1756
+ font-style: inherit;
1757
+ font-weight: inherit;
1758
+ text-transform: inherit;
1756
1759
  text-align: right;
1757
1760
  }
1758
1761
 
@@ -1779,6 +1779,9 @@ button.wp-block-navigation-item__content {
1779
1779
  font-size: inherit;
1780
1780
  font-family: inherit;
1781
1781
  line-height: inherit;
1782
+ font-style: inherit;
1783
+ font-weight: inherit;
1784
+ text-transform: inherit;
1782
1785
  text-align: left;
1783
1786
  }
1784
1787
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-library",
3
- "version": "7.3.11",
3
+ "version": "7.3.12",
4
4
  "description": "Block library for the WordPress editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -37,9 +37,9 @@
37
37
  "@wordpress/api-fetch": "^6.3.1",
38
38
  "@wordpress/autop": "^3.6.1",
39
39
  "@wordpress/blob": "^3.6.1",
40
- "@wordpress/block-editor": "^8.5.8",
40
+ "@wordpress/block-editor": "^8.5.9",
41
41
  "@wordpress/blocks": "^11.5.3",
42
- "@wordpress/components": "^19.8.4",
42
+ "@wordpress/components": "^19.8.5",
43
43
  "@wordpress/compose": "^5.4.1",
44
44
  "@wordpress/core-data": "^4.4.5",
45
45
  "@wordpress/data": "^6.6.1",
@@ -50,13 +50,13 @@
50
50
  "@wordpress/hooks": "^3.6.1",
51
51
  "@wordpress/html-entities": "^3.6.1",
52
52
  "@wordpress/i18n": "^4.6.1",
53
- "@wordpress/icons": "^8.2.2",
53
+ "@wordpress/icons": "^8.2.3",
54
54
  "@wordpress/keycodes": "^3.6.1",
55
55
  "@wordpress/notices": "^3.6.1",
56
56
  "@wordpress/primitives": "^3.4.1",
57
- "@wordpress/reusable-blocks": "^3.4.8",
57
+ "@wordpress/reusable-blocks": "^3.4.9",
58
58
  "@wordpress/rich-text": "^5.4.2",
59
- "@wordpress/server-side-render": "^3.4.5",
59
+ "@wordpress/server-side-render": "^3.4.6",
60
60
  "@wordpress/url": "^3.7.1",
61
61
  "@wordpress/viewport": "^4.4.1",
62
62
  "classnames": "^2.3.1",
@@ -74,5 +74,5 @@
74
74
  "publishConfig": {
75
75
  "access": "public"
76
76
  },
77
- "gitHead": "988fb5256118af4ed0546345c26a690ac9b7316b"
77
+ "gitHead": "b83ec0e0f8bc80a73f7d606c7db10f0b3ec34a1c"
78
78
  }
@@ -76,12 +76,15 @@ export function useUserAvatar( { userId, postId, postType } ) {
76
76
  },
77
77
  [ postType, postId, userId ]
78
78
  );
79
- const avatarUrls = authorDetails
80
- ? Object.values( authorDetails.avatar_urls )
81
- : null;
82
- const sizes = authorDetails
83
- ? Object.keys( authorDetails.avatar_urls )
84
- : null;
79
+
80
+ const avatarUrls =
81
+ authorDetails && authorDetails?.avatar_urls
82
+ ? Object.values( authorDetails.avatar_urls )
83
+ : null;
84
+ const sizes =
85
+ authorDetails && authorDetails?.avatar_urls
86
+ ? Object.keys( authorDetails.avatar_urls )
87
+ : null;
85
88
  const { minSize, maxSize } = getAvatarSizes( sizes );
86
89
  const defaultAvatar = useDefaultAvatar();
87
90
  return {
@@ -18,10 +18,6 @@
18
18
  },
19
19
  "textAlign": {
20
20
  "type": "string"
21
- },
22
- "fontSize": {
23
- "type": "string",
24
- "default": "small"
25
21
  }
26
22
  },
27
23
  "usesContext": [ "commentId" ],
@@ -41,7 +41,7 @@ export default function Edit( {
41
41
  [ `has-text-align-${ textAlign }` ]: textAlign,
42
42
  } ),
43
43
  } );
44
- const displayName = useSelect(
44
+ let displayName = useSelect(
45
45
  ( select ) => {
46
46
  const { getEntityRecord } = select( coreStore );
47
47
 
@@ -92,15 +92,7 @@ export default function Edit( {
92
92
  );
93
93
 
94
94
  if ( ! commentId || ! displayName ) {
95
- return (
96
- <>
97
- { inspectorControls }
98
- { blockControls }
99
- <div { ...blockProps }>
100
- <p>{ _x( 'Comment Author', 'block title' ) }</p>
101
- </div>
102
- </>
103
- );
95
+ displayName = _x( 'Comment Author', 'block title' );
104
96
  }
105
97
 
106
98
  const displayAuthor = isLink ? (
@@ -111,9 +103,8 @@ export default function Edit( {
111
103
  { displayName }
112
104
  </a>
113
105
  ) : (
114
- <p>{ displayName }</p>
106
+ displayName
115
107
  );
116
-
117
108
  return (
118
109
  <>
119
110
  { inspectorControls }
@@ -14,10 +14,6 @@
14
14
  "isLink": {
15
15
  "type": "boolean",
16
16
  "default": true
17
- },
18
- "fontSize": {
19
- "type": "string",
20
- "default": "small"
21
17
  }
22
18
  },
23
19
  "usesContext": [ "commentId" ],
@@ -33,7 +33,7 @@ export default function Edit( {
33
33
  setAttributes,
34
34
  } ) {
35
35
  const blockProps = useBlockProps();
36
- const [ date ] = useEntityProp( 'root', 'comment', 'date', commentId );
36
+ let [ date ] = useEntityProp( 'root', 'comment', 'date', commentId );
37
37
  const [ siteFormat = getDateSettings().formats.date ] = useEntityProp(
38
38
  'root',
39
39
  'site',
@@ -60,21 +60,17 @@ export default function Edit( {
60
60
  );
61
61
 
62
62
  if ( ! commentId || ! date ) {
63
- return (
64
- <>
65
- { inspectorControls }
66
- <div { ...blockProps }>
67
- <p>{ _x( 'Comment Date', 'block title' ) }</p>
68
- </div>
69
- </>
70
- );
63
+ date = _x( 'Comment Date', 'block title' );
71
64
  }
72
65
 
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
+ <time>{ date }</time>
73
+ );
78
74
 
79
75
  if ( isLink ) {
80
76
  commentDate = (
@@ -24,9 +24,6 @@ function render_block_core_comment_date( $attributes, $content, $block ) {
24
24
  }
25
25
 
26
26
  $classes = '';
27
- if ( isset( $attributes['fontSize'] ) ) {
28
- $classes .= 'has-' . esc_attr( $attributes['fontSize'] ) . '-font-size';
29
- }
30
27
 
31
28
  $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
32
29
  $formatted_date = get_comment_date(