@wordpress/block-library 7.3.5 → 7.3.8
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/comments-title/deprecated.js +110 -0
- package/build/comments-title/deprecated.js.map +1 -0
- package/build/comments-title/edit.js +35 -37
- package/build/comments-title/edit.js.map +1 -1
- package/build/comments-title/index.js +4 -7
- package/build/comments-title/index.js.map +1 -1
- package/build/cover/edit.js +4 -1
- package/build/cover/edit.js.map +1 -1
- package/build/index.js +1 -3
- package/build/index.js.map +1 -1
- package/build/navigation/edit/index.js +5 -28
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/index.js +0 -1
- package/build/navigation/index.js.map +1 -1
- package/build/post-comments/edit.js +33 -15
- package/build/post-comments/edit.js.map +1 -1
- package/build-module/comments-title/deprecated.js +102 -0
- package/build-module/comments-title/deprecated.js.map +1 -0
- package/build-module/comments-title/edit.js +38 -40
- package/build-module/comments-title/edit.js.map +1 -1
- package/build-module/comments-title/index.js +3 -7
- package/build-module/comments-title/index.js.map +1 -1
- package/build-module/cover/edit.js +4 -1
- package/build-module/cover/edit.js.map +1 -1
- package/build-module/index.js +1 -2
- package/build-module/index.js.map +1 -1
- package/build-module/navigation/edit/index.js +6 -28
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/index.js +0 -1
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/post-comments/edit.js +34 -15
- package/build-module/post-comments/edit.js.map +1 -1
- package/build-style/post-comments/style-rtl.css +7 -0
- package/build-style/post-comments/style.css +7 -0
- package/build-style/post-comments-form/style-rtl.css +1 -3
- package/build-style/post-comments-form/style.css +1 -3
- package/build-style/style-rtl.css +8 -3
- package/build-style/style.css +8 -3
- package/package.json +7 -7
- package/src/comment-template/index.php +4 -0
- package/src/comments-pagination/index.php +4 -0
- package/src/comments-title/block.json +0 -6
- package/src/comments-title/deprecated.js +34 -0
- package/src/comments-title/edit.js +44 -100
- package/src/comments-title/index.js +2 -0
- package/src/comments-title/index.php +43 -22
- package/src/cover/edit.js +5 -0
- package/src/cover/index.php +20 -37
- package/src/index.js +0 -2
- package/src/latest-posts/index.php +12 -6
- package/src/navigation/block.json +0 -1
- package/src/navigation/edit/index.js +6 -36
- package/src/navigation/index.php +40 -0
- package/src/post-author/index.php +1 -1
- package/src/post-comments/edit.js +53 -21
- package/src/post-comments/style.scss +8 -0
- package/src/post-comments-form/index.php +5 -1
- package/src/post-comments-form/style.scss +1 -4
- package/src/post-template/index.php +30 -0
- package/build/navigation-area/edit.js +0 -110
- package/build/navigation-area/edit.js.map +0 -1
- package/build/navigation-area/index.js +0 -62
- package/build/navigation-area/index.js.map +0 -1
- package/build/navigation-area/inner-blocks.js +0 -34
- package/build/navigation-area/inner-blocks.js.map +0 -1
- package/build/navigation-area/save.js +0 -18
- package/build/navigation-area/save.js.map +0 -1
- package/build-module/navigation-area/edit.js +0 -94
- package/build-module/navigation-area/edit.js.map +0 -1
- package/build-module/navigation-area/index.js +0 -48
- package/build-module/navigation-area/index.js.map +0 -1
- package/build-module/navigation-area/inner-blocks.js +0 -26
- package/build-module/navigation-area/inner-blocks.js.map +0 -1
- package/build-module/navigation-area/save.js +0 -10
- package/build-module/navigation-area/save.js.map +0 -1
- package/src/navigation-area/block.json +0 -23
- package/src/navigation-area/edit.js +0 -111
- package/src/navigation-area/index.js +0 -26
- package/src/navigation-area/index.php +0 -22
- package/src/navigation-area/inner-blocks.js +0 -24
- package/src/navigation-area/save.js +0 -8
|
@@ -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","PostCommentsEdit","attributes","textAlign","setAttributes","context","postType","postId","postTitle","commentStatus","avatarURL","defaultCommentStatus","select","getSettings","__experimentalDiscussionSettings","isSiteEditor","undefined","postTypeSupportsComments","getPostType","supports","comments","warning","showPlacholder","blockProps","className","disabledRef","textareaId","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,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,aAAT,EAAwBL,KAAK,IAAIM,SAAjC,QAAkD,sBAAlD;AACA,SACCC,yBAAyB,IAAIC,WAD9B,EAECC,aAFD,QAGO,oBAHP;AAKA,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,IAAgBZ,aAAa,CAAE,UAAF,EAAcU,QAAd,EAAwB,OAAxB,EAAiCC,MAAjC,CAAjC;AACAC,EAAAA,SAAS,GAAGA,SAAS,IAAIf,EAAE,CAAE,YAAF,CAA3B;AAEA,QAAM,CAAEgB,aAAF,IAAoBb,aAAa,CACtC,UADsC,EAEtCU,QAFsC,EAGtC,gBAHsC,EAItCC,MAJsC,CAAvC;AAOA,QAAM;AAAEG,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAAsChB,SAAS,CAClDiB,MAAF,IACCA,MAAM,CAAEpB,gBAAF,CAAN,CAA2BqB,WAA3B,GACEC,gCAHiD,CAArD;AAMA,QAAMC,YAAY,GAAGT,QAAQ,KAAKU,SAAb,IAA0BT,MAAM,KAAKS,SAA1D;AAEA,QAAMC,wBAAwB,GAAGtB,SAAS,CAAIiB,MAAF;AAAA;;AAAA,WAC3CN,QAAQ,GACL,CAAC,yBAAEM,MA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AAWiC,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,EAAGjC,EAAE,CAAE,cAAF;AAJX,IADD,CAhBD,CALD,CArGD,CAJF,CAVD,CADD;AAwJA","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';\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{ __( 'One response to' ) } “{ postTitle }”\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<b className=\"fn\">\n\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"#top\" className=\"url\">\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'A WordPress Commenter'\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</a>\n\t\t\t\t\t\t\t\t\t\t\t</b>{ ' ' }\n\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{ __( 'says' ) }:\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\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-01T00: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 00: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{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Commenter avatars come from'\n\t\t\t\t\t\t\t\t\t\t\t) }{ ' ' }\n\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\tGravatar\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.\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=\"Reply to A WordPress Commenter\"\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","__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","blockProps","className","disabledRef","textareaId","nextAlign","span","a","cite"],"mappings":";;AAAA;AACA;AACA;AACA,OAA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KC;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"]}
|
|
@@ -144,6 +144,13 @@
|
|
|
144
144
|
.wp-block-post-comments .comment-form-cookies-consent #wp-comment-cookies-consent {
|
|
145
145
|
margin-top: 0.35em;
|
|
146
146
|
}
|
|
147
|
+
.wp-block-post-comments .comment-reply-title {
|
|
148
|
+
margin-bottom: 0;
|
|
149
|
+
}
|
|
150
|
+
.wp-block-post-comments .comment-reply-title :where(small) {
|
|
151
|
+
font-size: var(--wp--preset--font-size--medium, smaller);
|
|
152
|
+
margin-right: 0.5em;
|
|
153
|
+
}
|
|
147
154
|
.wp-block-post-comments .reply {
|
|
148
155
|
font-size: 0.875em;
|
|
149
156
|
margin-bottom: 1.4em;
|
|
@@ -144,6 +144,13 @@
|
|
|
144
144
|
.wp-block-post-comments .comment-form-cookies-consent #wp-comment-cookies-consent {
|
|
145
145
|
margin-top: 0.35em;
|
|
146
146
|
}
|
|
147
|
+
.wp-block-post-comments .comment-reply-title {
|
|
148
|
+
margin-bottom: 0;
|
|
149
|
+
}
|
|
150
|
+
.wp-block-post-comments .comment-reply-title :where(small) {
|
|
151
|
+
font-size: var(--wp--preset--font-size--medium, smaller);
|
|
152
|
+
margin-left: 0.5em;
|
|
153
|
+
}
|
|
147
154
|
.wp-block-post-comments .reply {
|
|
148
155
|
font-size: 0.875em;
|
|
149
156
|
margin-bottom: 1.4em;
|
|
@@ -130,11 +130,9 @@
|
|
|
130
130
|
margin-top: 0.35em;
|
|
131
131
|
}
|
|
132
132
|
.wp-block-post-comments-form .comment-reply-title {
|
|
133
|
-
align-items: baseline;
|
|
134
|
-
display: flex;
|
|
135
|
-
justify-content: space-between;
|
|
136
133
|
margin-bottom: 0;
|
|
137
134
|
}
|
|
138
135
|
.wp-block-post-comments-form .comment-reply-title :where(small) {
|
|
139
136
|
font-size: var(--wp--preset--font-size--medium, smaller);
|
|
137
|
+
margin-right: 0.5em;
|
|
140
138
|
}
|
|
@@ -130,11 +130,9 @@
|
|
|
130
130
|
margin-top: 0.35em;
|
|
131
131
|
}
|
|
132
132
|
.wp-block-post-comments-form .comment-reply-title {
|
|
133
|
-
align-items: baseline;
|
|
134
|
-
display: flex;
|
|
135
|
-
justify-content: space-between;
|
|
136
133
|
margin-bottom: 0;
|
|
137
134
|
}
|
|
138
135
|
.wp-block-post-comments-form .comment-reply-title :where(small) {
|
|
139
136
|
font-size: var(--wp--preset--font-size--medium, smaller);
|
|
137
|
+
margin-left: 0.5em;
|
|
140
138
|
}
|
|
@@ -2171,6 +2171,13 @@ p.has-background {
|
|
|
2171
2171
|
.wp-block-post-comments .comment-form-cookies-consent #wp-comment-cookies-consent {
|
|
2172
2172
|
margin-top: 0.35em;
|
|
2173
2173
|
}
|
|
2174
|
+
.wp-block-post-comments .comment-reply-title {
|
|
2175
|
+
margin-bottom: 0;
|
|
2176
|
+
}
|
|
2177
|
+
.wp-block-post-comments .comment-reply-title :where(small) {
|
|
2178
|
+
font-size: var(--wp--preset--font-size--medium, smaller);
|
|
2179
|
+
margin-right: 0.5em;
|
|
2180
|
+
}
|
|
2174
2181
|
.wp-block-post-comments .reply {
|
|
2175
2182
|
font-size: 0.875em;
|
|
2176
2183
|
margin-bottom: 1.4em;
|
|
@@ -2245,13 +2252,11 @@ p.has-background {
|
|
|
2245
2252
|
margin-top: 0.35em;
|
|
2246
2253
|
}
|
|
2247
2254
|
.wp-block-post-comments-form .comment-reply-title {
|
|
2248
|
-
align-items: baseline;
|
|
2249
|
-
display: flex;
|
|
2250
|
-
justify-content: space-between;
|
|
2251
2255
|
margin-bottom: 0;
|
|
2252
2256
|
}
|
|
2253
2257
|
.wp-block-post-comments-form .comment-reply-title :where(small) {
|
|
2254
2258
|
font-size: var(--wp--preset--font-size--medium, smaller);
|
|
2259
|
+
margin-right: 0.5em;
|
|
2255
2260
|
}
|
|
2256
2261
|
|
|
2257
2262
|
.wp-block-post-excerpt__more-link {
|
package/build-style/style.css
CHANGED
|
@@ -2197,6 +2197,13 @@ p.has-background {
|
|
|
2197
2197
|
.wp-block-post-comments .comment-form-cookies-consent #wp-comment-cookies-consent {
|
|
2198
2198
|
margin-top: 0.35em;
|
|
2199
2199
|
}
|
|
2200
|
+
.wp-block-post-comments .comment-reply-title {
|
|
2201
|
+
margin-bottom: 0;
|
|
2202
|
+
}
|
|
2203
|
+
.wp-block-post-comments .comment-reply-title :where(small) {
|
|
2204
|
+
font-size: var(--wp--preset--font-size--medium, smaller);
|
|
2205
|
+
margin-left: 0.5em;
|
|
2206
|
+
}
|
|
2200
2207
|
.wp-block-post-comments .reply {
|
|
2201
2208
|
font-size: 0.875em;
|
|
2202
2209
|
margin-bottom: 1.4em;
|
|
@@ -2271,13 +2278,11 @@ p.has-background {
|
|
|
2271
2278
|
margin-top: 0.35em;
|
|
2272
2279
|
}
|
|
2273
2280
|
.wp-block-post-comments-form .comment-reply-title {
|
|
2274
|
-
align-items: baseline;
|
|
2275
|
-
display: flex;
|
|
2276
|
-
justify-content: space-between;
|
|
2277
2281
|
margin-bottom: 0;
|
|
2278
2282
|
}
|
|
2279
2283
|
.wp-block-post-comments-form .comment-reply-title :where(small) {
|
|
2280
2284
|
font-size: var(--wp--preset--font-size--medium, smaller);
|
|
2285
|
+
margin-left: 0.5em;
|
|
2281
2286
|
}
|
|
2282
2287
|
|
|
2283
2288
|
.wp-block-post-excerpt__more-link {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-library",
|
|
3
|
-
"version": "7.3.
|
|
3
|
+
"version": "7.3.8",
|
|
4
4
|
"description": "Block library for the WordPress editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -37,11 +37,11 @@
|
|
|
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.
|
|
40
|
+
"@wordpress/block-editor": "^8.5.6",
|
|
41
41
|
"@wordpress/blocks": "^11.5.3",
|
|
42
|
-
"@wordpress/components": "^19.8.
|
|
42
|
+
"@wordpress/components": "^19.8.4",
|
|
43
43
|
"@wordpress/compose": "^5.4.1",
|
|
44
|
-
"@wordpress/core-data": "^4.4.
|
|
44
|
+
"@wordpress/core-data": "^4.4.5",
|
|
45
45
|
"@wordpress/data": "^6.6.1",
|
|
46
46
|
"@wordpress/date": "^4.6.1",
|
|
47
47
|
"@wordpress/deprecated": "^3.6.1",
|
|
@@ -54,9 +54,9 @@
|
|
|
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.
|
|
57
|
+
"@wordpress/reusable-blocks": "^3.4.6",
|
|
58
58
|
"@wordpress/rich-text": "^5.4.2",
|
|
59
|
-
"@wordpress/server-side-render": "^3.4.
|
|
59
|
+
"@wordpress/server-side-render": "^3.4.5",
|
|
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": "
|
|
77
|
+
"gitHead": "767a07ec93bc2563bcbe4f3d680879c958d58370"
|
|
78
78
|
}
|
|
@@ -79,6 +79,10 @@ function render_block_core_comment_template( $attributes, $content, $block ) {
|
|
|
79
79
|
return '';
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
if ( post_password_required( $block->context['postId'] ) ) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
82
86
|
$comment_query = new WP_Comment_Query(
|
|
83
87
|
build_comment_query_vars_from_block( $block )
|
|
84
88
|
);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import metadata from './block.json';
|
|
5
|
+
|
|
6
|
+
const { attributes, supports } = metadata;
|
|
7
|
+
|
|
8
|
+
export default [
|
|
9
|
+
{
|
|
10
|
+
attributes: {
|
|
11
|
+
...attributes,
|
|
12
|
+
singleCommentLabel: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
},
|
|
15
|
+
multipleCommentsLabel: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
supports,
|
|
20
|
+
migrate: ( oldAttributes ) => {
|
|
21
|
+
/* eslint-disable no-unused-vars */
|
|
22
|
+
const {
|
|
23
|
+
singleCommentLabel,
|
|
24
|
+
multipleCommentsLabel,
|
|
25
|
+
...newAttributes
|
|
26
|
+
} = oldAttributes;
|
|
27
|
+
/* eslint-enable no-unused-vars */
|
|
28
|
+
return newAttributes;
|
|
29
|
+
},
|
|
30
|
+
isEligible: ( { multipleCommentsLabel, singleCommentLabel } ) =>
|
|
31
|
+
multipleCommentsLabel || singleCommentLabel,
|
|
32
|
+
save: () => null,
|
|
33
|
+
},
|
|
34
|
+
];
|
|
@@ -10,17 +10,11 @@ import {
|
|
|
10
10
|
AlignmentControl,
|
|
11
11
|
BlockControls,
|
|
12
12
|
useBlockProps,
|
|
13
|
-
PlainText,
|
|
14
13
|
InspectorControls,
|
|
15
14
|
} from '@wordpress/block-editor';
|
|
16
|
-
import { __ } from '@wordpress/i18n';
|
|
15
|
+
import { __, _n, sprintf } from '@wordpress/i18n';
|
|
17
16
|
import { useEntityProp } from '@wordpress/core-data';
|
|
18
|
-
import {
|
|
19
|
-
PanelBody,
|
|
20
|
-
ToggleControl,
|
|
21
|
-
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
22
|
-
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
|
|
23
|
-
} from '@wordpress/components';
|
|
17
|
+
import { PanelBody, ToggleControl } from '@wordpress/components';
|
|
24
18
|
import { useState, useEffect } from '@wordpress/element';
|
|
25
19
|
import apiFetch from '@wordpress/api-fetch';
|
|
26
20
|
import { addQueryArgs } from '@wordpress/url';
|
|
@@ -31,20 +25,12 @@ import { addQueryArgs } from '@wordpress/url';
|
|
|
31
25
|
import HeadingLevelDropdown from '../heading/heading-level-dropdown';
|
|
32
26
|
|
|
33
27
|
export default function Edit( {
|
|
34
|
-
attributes: {
|
|
35
|
-
textAlign,
|
|
36
|
-
singleCommentLabel,
|
|
37
|
-
multipleCommentsLabel,
|
|
38
|
-
showPostTitle,
|
|
39
|
-
showCommentsCount,
|
|
40
|
-
level,
|
|
41
|
-
},
|
|
28
|
+
attributes: { textAlign, showPostTitle, showCommentsCount, level },
|
|
42
29
|
setAttributes,
|
|
43
30
|
context: { postType, postId },
|
|
44
31
|
} ) {
|
|
45
32
|
const TagName = 'h' + level;
|
|
46
33
|
const [ commentsCount, setCommentsCount ] = useState();
|
|
47
|
-
const [ editingMode, setEditingMode ] = useState( 'plural' );
|
|
48
34
|
const [ rawTitle ] = useEntityProp( 'postType', postType, 'title', postId );
|
|
49
35
|
const isSiteEditor = typeof postId === 'undefined';
|
|
50
36
|
const blockProps = useBlockProps( {
|
|
@@ -100,22 +86,6 @@ export default function Edit( {
|
|
|
100
86
|
const inspectorControls = (
|
|
101
87
|
<InspectorControls>
|
|
102
88
|
<PanelBody title={ __( 'Settings' ) }>
|
|
103
|
-
{ isSiteEditor && (
|
|
104
|
-
<ToggleGroupControl
|
|
105
|
-
label={ __( 'Editing mode' ) }
|
|
106
|
-
onChange={ setEditingMode }
|
|
107
|
-
value={ editingMode }
|
|
108
|
-
>
|
|
109
|
-
<ToggleGroupControlOption
|
|
110
|
-
label={ __( 'Singular' ) }
|
|
111
|
-
value="singular"
|
|
112
|
-
/>
|
|
113
|
-
<ToggleGroupControlOption
|
|
114
|
-
label={ __( 'Plural' ) }
|
|
115
|
-
value="plural"
|
|
116
|
-
/>
|
|
117
|
-
</ToggleGroupControl>
|
|
118
|
-
) }
|
|
119
89
|
<ToggleControl
|
|
120
90
|
label={ __( 'Show post title' ) }
|
|
121
91
|
checked={ showPostTitle }
|
|
@@ -136,78 +106,52 @@ export default function Edit( {
|
|
|
136
106
|
|
|
137
107
|
const postTitle = isSiteEditor ? __( '"Post Title"' ) : `"${ rawTitle }"`;
|
|
138
108
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
109
|
+
let placeholder;
|
|
110
|
+
if ( showCommentsCount && commentsCount !== undefined ) {
|
|
111
|
+
if ( showPostTitle ) {
|
|
112
|
+
if ( commentsCount === 1 ) {
|
|
113
|
+
/* translators: %s: Post title. */
|
|
114
|
+
placeholder = sprintf( __( 'One response to %s' ), postTitle );
|
|
115
|
+
} else {
|
|
116
|
+
placeholder = sprintf(
|
|
117
|
+
/* translators: 1: Number of comments, 2: Post title. */
|
|
118
|
+
_n(
|
|
119
|
+
'%1$s response to %2$s',
|
|
120
|
+
'%1$s responses to %2$s',
|
|
121
|
+
commentsCount
|
|
122
|
+
),
|
|
123
|
+
commentsCount,
|
|
124
|
+
postTitle
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
} else if ( commentsCount === 1 ) {
|
|
128
|
+
placeholder = __( 'One response' );
|
|
129
|
+
} else {
|
|
130
|
+
placeholder = sprintf(
|
|
131
|
+
/* translators: %s: Number of comments. */
|
|
132
|
+
_n( '%s responses', '%s responses', commentsCount ),
|
|
133
|
+
commentsCount
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
} else if ( showPostTitle ) {
|
|
137
|
+
if ( commentsCount === 1 ) {
|
|
138
|
+
/* translators: %s: Post title. */
|
|
139
|
+
placeholder = sprintf( __( 'Response to %s' ), postTitle );
|
|
140
|
+
} else {
|
|
141
|
+
/* translators: %s: Post title. */
|
|
142
|
+
placeholder = sprintf( __( 'Responses to %s' ), postTitle );
|
|
143
|
+
}
|
|
144
|
+
} else if ( commentsCount === 1 ) {
|
|
145
|
+
placeholder = __( 'Response' );
|
|
146
|
+
} else {
|
|
147
|
+
placeholder = __( 'Responses' );
|
|
148
|
+
}
|
|
154
149
|
|
|
155
150
|
return (
|
|
156
151
|
<>
|
|
157
152
|
{ blockControls }
|
|
158
153
|
{ inspectorControls }
|
|
159
|
-
<TagName { ...blockProps }>
|
|
160
|
-
{ editingMode === 'singular' || commentsCount === 1 ? (
|
|
161
|
-
<>
|
|
162
|
-
<PlainText
|
|
163
|
-
__experimentalVersion={ 2 }
|
|
164
|
-
tagName="span"
|
|
165
|
-
aria-label={
|
|
166
|
-
showCommentsCount
|
|
167
|
-
? singlePlaceholder
|
|
168
|
-
: singlePlaceholderNoCount
|
|
169
|
-
}
|
|
170
|
-
placeholder={
|
|
171
|
-
showCommentsCount
|
|
172
|
-
? singlePlaceholder
|
|
173
|
-
: singlePlaceholderNoCount
|
|
174
|
-
}
|
|
175
|
-
value={ singleCommentLabel }
|
|
176
|
-
onChange={ ( newLabel ) =>
|
|
177
|
-
setAttributes( {
|
|
178
|
-
singleCommentLabel: newLabel,
|
|
179
|
-
} )
|
|
180
|
-
}
|
|
181
|
-
/>
|
|
182
|
-
{ showPostTitle ? postTitle : null }
|
|
183
|
-
</>
|
|
184
|
-
) : (
|
|
185
|
-
<>
|
|
186
|
-
{ showCommentsCount ? commentsCount : null }
|
|
187
|
-
<PlainText
|
|
188
|
-
__experimentalVersion={ 2 }
|
|
189
|
-
tagName="span"
|
|
190
|
-
aria-label={
|
|
191
|
-
showCommentsCount
|
|
192
|
-
? ` ${ multiplePlaceholder }`
|
|
193
|
-
: multiplePlaceholderNoCount
|
|
194
|
-
}
|
|
195
|
-
placeholder={
|
|
196
|
-
showCommentsCount
|
|
197
|
-
? ` ${ multiplePlaceholder }`
|
|
198
|
-
: multiplePlaceholderNoCount
|
|
199
|
-
}
|
|
200
|
-
value={ multipleCommentsLabel }
|
|
201
|
-
onChange={ ( newLabel ) =>
|
|
202
|
-
setAttributes( {
|
|
203
|
-
multipleCommentsLabel: newLabel,
|
|
204
|
-
} )
|
|
205
|
-
}
|
|
206
|
-
/>
|
|
207
|
-
{ showPostTitle ? postTitle : null }
|
|
208
|
-
</>
|
|
209
|
-
) }
|
|
210
|
-
</TagName>
|
|
154
|
+
<TagName { ...blockProps }>{ placeholder }</TagName>
|
|
211
155
|
</>
|
|
212
156
|
);
|
|
213
157
|
}
|
|
@@ -8,6 +8,7 @@ import { commentTitle as icon } from '@wordpress/icons';
|
|
|
8
8
|
*/
|
|
9
9
|
import metadata from './block.json';
|
|
10
10
|
import edit from './edit';
|
|
11
|
+
import deprecated from './deprecated';
|
|
11
12
|
|
|
12
13
|
const { name } = metadata;
|
|
13
14
|
export { metadata, name };
|
|
@@ -15,4 +16,5 @@ export { metadata, name };
|
|
|
15
16
|
export const settings = {
|
|
16
17
|
icon,
|
|
17
18
|
edit,
|
|
19
|
+
deprecated,
|
|
18
20
|
};
|
|
@@ -14,12 +14,16 @@
|
|
|
14
14
|
*/
|
|
15
15
|
function render_block_core_comments_title( $attributes ) {
|
|
16
16
|
|
|
17
|
+
if ( post_password_required() ) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
|
|
17
21
|
$align_class_name = empty( $attributes['textAlign'] ) ? '' : "has-text-align-{$attributes['textAlign']}";
|
|
18
22
|
$show_post_title = ! empty( $attributes['showPostTitle'] ) && $attributes['showPostTitle'];
|
|
19
23
|
$show_comments_count = ! empty( $attributes['showCommentsCount'] ) && $attributes['showCommentsCount'];
|
|
20
24
|
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $align_class_name ) );
|
|
21
|
-
$
|
|
22
|
-
$
|
|
25
|
+
$comments_count = get_comments_number();
|
|
26
|
+
$post_title = '“' . get_the_title() . '”';
|
|
23
27
|
$tag_name = 'h2';
|
|
24
28
|
if ( isset( $attributes['level'] ) ) {
|
|
25
29
|
$tag_name = 'h' . $attributes['level'];
|
|
@@ -29,29 +33,46 @@ function render_block_core_comments_title( $attributes ) {
|
|
|
29
33
|
return;
|
|
30
34
|
}
|
|
31
35
|
|
|
32
|
-
$single_default_comment_label = $show_post_title ? __( 'Response to' ) : __( 'Response' );
|
|
33
|
-
if ( $show_comments_count ) {
|
|
34
|
-
$single_default_comment_label = $show_post_title ? __( 'One response to' ) : __( 'One response' );
|
|
35
|
-
}
|
|
36
|
-
$single_comment_label = ! empty( $attributes['singleCommentLabel'] ) ? $attributes['singleCommentLabel'] : $single_default_comment_label;
|
|
37
|
-
|
|
38
|
-
$multiple_default_comment_label = $show_post_title ? __( 'Responses to' ) : __( 'Responses' );
|
|
39
36
|
if ( $show_comments_count ) {
|
|
40
|
-
|
|
37
|
+
if ( $show_post_title ) {
|
|
38
|
+
if ( '1' === $comments_count ) {
|
|
39
|
+
/* translators: %s: Post title. */
|
|
40
|
+
$comments_title = sprintf( __( 'One response to %s' ), $post_title );
|
|
41
|
+
} else {
|
|
42
|
+
$comments_title = sprintf(
|
|
43
|
+
/* translators: 1: Number of comments, 2: Post title. */
|
|
44
|
+
_n(
|
|
45
|
+
'%1$s response to %2$s',
|
|
46
|
+
'%1$s responses to %2$s',
|
|
47
|
+
$comments_count
|
|
48
|
+
),
|
|
49
|
+
number_format_i18n( $comments_count ),
|
|
50
|
+
$post_title
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
} elseif ( '1' === $comments_count ) {
|
|
54
|
+
$comments_title = __( 'One response' );
|
|
55
|
+
} else {
|
|
56
|
+
$comments_title = sprintf(
|
|
57
|
+
/* translators: %s: Number of comments. */
|
|
58
|
+
_n( '%s responses', '%s responses', $comments_count ),
|
|
59
|
+
number_format_i18n( $comments_count )
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
} elseif ( $show_post_title ) {
|
|
63
|
+
if ( '1' === $comments_count ) {
|
|
64
|
+
/* translators: %s: Post title. */
|
|
65
|
+
$comments_title = sprintf( __( 'Response to %s' ), $post_title );
|
|
66
|
+
} else {
|
|
67
|
+
/* translators: %s: Post title. */
|
|
68
|
+
$comments_title = sprintf( __( 'Responses to %s' ), $post_title );
|
|
69
|
+
}
|
|
70
|
+
} elseif ( '1' === $comments_count ) {
|
|
71
|
+
$comments_title = __( 'Response' );
|
|
72
|
+
} else {
|
|
73
|
+
$comments_title = __( 'Responses' );
|
|
41
74
|
}
|
|
42
75
|
|
|
43
|
-
$multiple_comment_label = ! empty( $attributes['multipleCommentsLabel'] ) ? $attributes['multipleCommentsLabel'] : $multiple_default_comment_label;
|
|
44
|
-
|
|
45
|
-
$comments_title = '%1$s %2$s %3$s';
|
|
46
|
-
|
|
47
|
-
$comments_title = sprintf(
|
|
48
|
-
$comments_title,
|
|
49
|
-
// If there is only one comment, only display the label.
|
|
50
|
-
'1' !== $comments_count && $show_comments_count ? $comments_count : null,
|
|
51
|
-
'1' === $comments_count ? $single_comment_label : $multiple_comment_label,
|
|
52
|
-
$post_title
|
|
53
|
-
);
|
|
54
|
-
|
|
55
76
|
return sprintf(
|
|
56
77
|
'<%1$s id="comments" %2$s>%3$s</%1$s>',
|
|
57
78
|
$tag_name,
|
package/src/cover/edit.js
CHANGED
|
@@ -403,8 +403,13 @@ function CoverEdit( {
|
|
|
403
403
|
|
|
404
404
|
const toggleUseFeaturedImage = () => {
|
|
405
405
|
setAttributes( {
|
|
406
|
+
id: undefined,
|
|
407
|
+
url: undefined,
|
|
406
408
|
useFeaturedImage: ! useFeaturedImage,
|
|
407
409
|
dimRatio: dimRatio === 100 ? 50 : dimRatio,
|
|
410
|
+
backgroundType: useFeaturedImage
|
|
411
|
+
? IMAGE_BACKGROUND_TYPE
|
|
412
|
+
: undefined,
|
|
408
413
|
} );
|
|
409
414
|
};
|
|
410
415
|
|