@wordpress/block-library 7.3.6 → 7.3.9
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/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/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 +4 -4
- 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 +41 -23
- package/src/cover/edit.js +5 -0
- package/src/cover/index.php +20 -37
- package/src/latest-posts/index.php +12 -6
- 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 +1 -1
- package/src/post-comments-form/style.scss +1 -4
- package/src/post-template/index.php +30 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/post-comments/edit.js"],"names":["PostCommentsEdit","attributes","textAlign","setAttributes","context","postType","postId","postTitle","commentStatus","avatarURL","defaultCommentStatus","select","blockEditorStore","getSettings","__experimentalDiscussionSettings","isSiteEditor","undefined","postTypeSupportsComments","coreStore","getPostType","supports","comments","warning","showPlacholder","blockProps","className","disabledRef","textareaId","nextAlign"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AAOA;;AACA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;AAgBe,SAASA,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,IAAgB,6BAAe,UAAf,EAA2BF,QAA3B,EAAqC,OAArC,EAA8CC,MAA9C,CAApB;AACAC,EAAAA,SAAS,GAAGA,SAAS,IAAI,cAAI,YAAJ,CAAzB;AAEA,QAAM,CAAEC,aAAF,IAAoB,6BACzB,UADyB,EAEzBH,QAFyB,EAGzB,gBAHyB,EAIzBC,MAJyB,CAA1B;AAOA,QAAM;AAAEG,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAAsC,qBACzCC,MAAF,IACCA,MAAM,CAAEC,kBAAF,CAAN,CAA2BC,WAA3B,GACEC,gCAHwC,CAA5C;AAMA,QAAMC,YAAY,GAAGV,QAAQ,KAAKW,SAAb,IAA0BV,MAAM,KAAKU,SAA1D;AAEA,QAAMC,wBAAwB,GAAG,qBAAaN,MAAF;AAAA;;AAAA,WAC3CN,QAAQ,GACL,CAAC,yBAAEM,MAAM,CAAEO,eAAF,CAAN,CAAoBC,WAApB,CAAiCd,QAAjC,CAAF,gDAAE,oBAA6Ce,QAA7C,CAAsDC,QAAxD,CADI,GAEL,KAHwC;AAAA,GAAX,CAAjC;AAMA,MAAIC,OAAO,GAAG,cACb,4QADa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cesContent":["/**\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":["PostCommentsEdit","attributes","textAlign","setAttributes","context","postType","postId","postTitle","commentStatus","avatarURL","defaultCommentStatus","select","blockEditorStore","getSettings","__experimentalDiscussionSettings","isSiteEditor","undefined","postTypeSupportsComments","coreStore","getPostType","supports","comments","warning","showPlacholder","blockProps","className","disabledRef","textareaId","nextAlign","span","a","cite"],"mappings":";;;;;;;;;AAsBA;;AAnBA;;AAKA;;AAOA;;AACA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;AAiBe,SAASA,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,IAAgB,6BAAe,UAAf,EAA2BF,QAA3B,EAAqC,OAArC,EAA8CC,MAA9C,CAApB;AACAC,EAAAA,SAAS,GAAGA,SAAS,IAAI,cAAI,YAAJ,CAAzB;AAEA,QAAM,CAAEC,aAAF,IAAoB,6BACzB,UADyB,EAEzBH,QA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AjB,UADD,CAJD,CA3HD,EAoIC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAI,IAAA,SAAS,EAAC;AAAd,KACG,cAAI,eAAJ,CADH,CADD,EAKC;AAAM,IAAA,SAAS,EAAC,cAAhB;AAA+B,IAAA,UAAU;AAAzC,KACC;AAAG,IAAA,SAAS,EAAC;AAAb,KACC;AACC,IAAA,OAAO,EAAI,WAAWH,UAAY;AADnC,KAGG,cAAI,SAAJ,CAHH,EAGsB,GAHtB,EAIC;AAAM,IAAA,SAAS,EAAC;AAAhB,SAJD,CADD,EAOC;AACC,IAAA,EAAE,EAAI,WAAWA,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,EAAG,cAAI,cAAJ;AAJT,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"]}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
const metadata = {
|
|
5
|
+
$schema: "https://schemas.wp.org/trunk/block.json",
|
|
6
|
+
apiVersion: 2,
|
|
7
|
+
name: "core/comments-title",
|
|
8
|
+
title: "Comments Title",
|
|
9
|
+
category: "theme",
|
|
10
|
+
ancestor: ["core/comments-query-loop"],
|
|
11
|
+
description: "Displays a title with the number of comments",
|
|
12
|
+
textdomain: "default",
|
|
13
|
+
usesContext: ["postId", "postType"],
|
|
14
|
+
attributes: {
|
|
15
|
+
textAlign: {
|
|
16
|
+
type: "string"
|
|
17
|
+
},
|
|
18
|
+
showPostTitle: {
|
|
19
|
+
type: "boolean",
|
|
20
|
+
"default": true
|
|
21
|
+
},
|
|
22
|
+
showCommentsCount: {
|
|
23
|
+
type: "boolean",
|
|
24
|
+
"default": true
|
|
25
|
+
},
|
|
26
|
+
level: {
|
|
27
|
+
type: "number",
|
|
28
|
+
"default": 2
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
supports: {
|
|
32
|
+
anchor: false,
|
|
33
|
+
align: true,
|
|
34
|
+
html: false,
|
|
35
|
+
__experimentalBorder: {
|
|
36
|
+
radius: true,
|
|
37
|
+
color: true,
|
|
38
|
+
width: true,
|
|
39
|
+
style: true
|
|
40
|
+
},
|
|
41
|
+
color: {
|
|
42
|
+
gradients: true,
|
|
43
|
+
__experimentalDefaultControls: {
|
|
44
|
+
background: true,
|
|
45
|
+
text: true
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
spacing: {
|
|
49
|
+
margin: true,
|
|
50
|
+
padding: true
|
|
51
|
+
},
|
|
52
|
+
typography: {
|
|
53
|
+
fontSize: true,
|
|
54
|
+
lineHeight: true,
|
|
55
|
+
__experimentalFontStyle: true,
|
|
56
|
+
__experimentalFontWeight: true,
|
|
57
|
+
__experimentalFontFamily: true,
|
|
58
|
+
__experimentalTextTransform: true,
|
|
59
|
+
__experimentalDefaultControls: {
|
|
60
|
+
fontSize: true,
|
|
61
|
+
__experimentalFontFamily: true,
|
|
62
|
+
__experimentalFontStyle: true,
|
|
63
|
+
__experimentalFontWeight: true
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const {
|
|
69
|
+
attributes,
|
|
70
|
+
supports
|
|
71
|
+
} = metadata;
|
|
72
|
+
export default [{
|
|
73
|
+
attributes: { ...attributes,
|
|
74
|
+
singleCommentLabel: {
|
|
75
|
+
type: 'string'
|
|
76
|
+
},
|
|
77
|
+
multipleCommentsLabel: {
|
|
78
|
+
type: 'string'
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
supports,
|
|
82
|
+
migrate: oldAttributes => {
|
|
83
|
+
/* eslint-disable no-unused-vars */
|
|
84
|
+
const {
|
|
85
|
+
singleCommentLabel,
|
|
86
|
+
multipleCommentsLabel,
|
|
87
|
+
...newAttributes
|
|
88
|
+
} = oldAttributes;
|
|
89
|
+
/* eslint-enable no-unused-vars */
|
|
90
|
+
|
|
91
|
+
return newAttributes;
|
|
92
|
+
},
|
|
93
|
+
isEligible: _ref => {
|
|
94
|
+
let {
|
|
95
|
+
multipleCommentsLabel,
|
|
96
|
+
singleCommentLabel
|
|
97
|
+
} = _ref;
|
|
98
|
+
return multipleCommentsLabel || singleCommentLabel;
|
|
99
|
+
},
|
|
100
|
+
save: () => null
|
|
101
|
+
}];
|
|
102
|
+
//# sourceMappingURL=deprecated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/comments-title/deprecated.js"],"names":["attributes","supports","metadata","singleCommentLabel","type","multipleCommentsLabel","migrate","oldAttributes","newAttributes","isEligible","save"],"mappings":"AAAA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAM;AAAEA,EAAAA,UAAF;AAAcC,EAAAA;AAAd,IAA2BC,QAAjC;AAEA,eAAe,CACd;AACCF,EAAAA,UAAU,EAAE,EACX,GAAGA,UADQ;AAEXG,IAAAA,kBAAkB,EAAE;AACnBC,MAAAA,IAAI,EAAE;AADa,KAFT;AAKXC,IAAAA,qBAAqB,EAAE;AACtBD,MAAAA,IAAI,EAAE;AADgB;AALZ,GADb;AAUCH,EAAAA,QAVD;AAWCK,EAAAA,OAAO,EAAIC,aAAF,IAAqB;AAC7B;AACA,UAAM;AACLJ,MAAAA,kBADK;AAELE,MAAAA,qBAFK;AAGL,SAAGG;AAHE,QAIFD,aAJJ;AAKA;;AACA,WAAOC,aAAP;AACA,GApBF;AAqBCC,EAAAA,UAAU,EAAE;AAAA,QAAE;AAAEJ,MAAAA,qBAAF;AAAyBF,MAAAA;AAAzB,KAAF;AAAA,WACXE,qBAAqB,IAAIF,kBADd;AAAA,GArBb;AAuBCO,EAAAA,IAAI,EAAE,MAAM;AAvBb,CADc,CAAf","sourcesContent":["/**\n * Internal dependencies\n */\nimport metadata from './block.json';\n\nconst { attributes, supports } = metadata;\n\nexport default [\n\t{\n\t\tattributes: {\n\t\t\t...attributes,\n\t\t\tsingleCommentLabel: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tmultipleCommentsLabel: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t},\n\t\tsupports,\n\t\tmigrate: ( oldAttributes ) => {\n\t\t\t/* eslint-disable no-unused-vars */\n\t\t\tconst {\n\t\t\t\tsingleCommentLabel,\n\t\t\t\tmultipleCommentsLabel,\n\t\t\t\t...newAttributes\n\t\t\t} = oldAttributes;\n\t\t\t/* eslint-enable no-unused-vars */\n\t\t\treturn newAttributes;\n\t\t},\n\t\tisEligible: ( { multipleCommentsLabel, singleCommentLabel } ) =>\n\t\t\tmultipleCommentsLabel || singleCommentLabel,\n\t\tsave: () => null,\n\t},\n];\n"]}
|
|
@@ -8,10 +8,10 @@ import classnames from 'classnames';
|
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { AlignmentControl, BlockControls, useBlockProps,
|
|
12
|
-
import { __ } from '@wordpress/i18n';
|
|
11
|
+
import { AlignmentControl, BlockControls, useBlockProps, InspectorControls } from '@wordpress/block-editor';
|
|
12
|
+
import { __, _n, sprintf } from '@wordpress/i18n';
|
|
13
13
|
import { useEntityProp } from '@wordpress/core-data';
|
|
14
|
-
import { PanelBody, ToggleControl
|
|
14
|
+
import { PanelBody, ToggleControl } from '@wordpress/components';
|
|
15
15
|
import { useState, useEffect } from '@wordpress/element';
|
|
16
16
|
import apiFetch from '@wordpress/api-fetch';
|
|
17
17
|
import { addQueryArgs } from '@wordpress/url';
|
|
@@ -24,8 +24,6 @@ export default function Edit(_ref) {
|
|
|
24
24
|
let {
|
|
25
25
|
attributes: {
|
|
26
26
|
textAlign,
|
|
27
|
-
singleCommentLabel,
|
|
28
|
-
multipleCommentsLabel,
|
|
29
27
|
showPostTitle,
|
|
30
28
|
showCommentsCount,
|
|
31
29
|
level
|
|
@@ -38,7 +36,6 @@ export default function Edit(_ref) {
|
|
|
38
36
|
} = _ref;
|
|
39
37
|
const TagName = 'h' + level;
|
|
40
38
|
const [commentsCount, setCommentsCount] = useState();
|
|
41
|
-
const [editingMode, setEditingMode] = useState('plural');
|
|
42
39
|
const [rawTitle] = useEntityProp('postType', postType, 'title', postId);
|
|
43
40
|
const isSiteEditor = typeof postId === 'undefined';
|
|
44
41
|
const blockProps = useBlockProps({
|
|
@@ -84,17 +81,7 @@ export default function Edit(_ref) {
|
|
|
84
81
|
}));
|
|
85
82
|
const inspectorControls = createElement(InspectorControls, null, createElement(PanelBody, {
|
|
86
83
|
title: __('Settings')
|
|
87
|
-
},
|
|
88
|
-
label: __('Editing mode'),
|
|
89
|
-
onChange: setEditingMode,
|
|
90
|
-
value: editingMode
|
|
91
|
-
}, createElement(ToggleGroupControlOption, {
|
|
92
|
-
label: __('Singular'),
|
|
93
|
-
value: "singular"
|
|
94
|
-
}), createElement(ToggleGroupControlOption, {
|
|
95
|
-
label: __('Plural'),
|
|
96
|
-
value: "plural"
|
|
97
|
-
})), createElement(ToggleControl, {
|
|
84
|
+
}, createElement(ToggleControl, {
|
|
98
85
|
label: __('Show post title'),
|
|
99
86
|
checked: showPostTitle,
|
|
100
87
|
onChange: value => setAttributes({
|
|
@@ -108,28 +95,39 @@ export default function Edit(_ref) {
|
|
|
108
95
|
})
|
|
109
96
|
})));
|
|
110
97
|
const postTitle = isSiteEditor ? __('"Post Title"') : `"${rawTitle}"`;
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
})
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
98
|
+
let placeholder;
|
|
99
|
+
|
|
100
|
+
if (showCommentsCount && commentsCount !== undefined) {
|
|
101
|
+
if (showPostTitle) {
|
|
102
|
+
if (commentsCount === 1) {
|
|
103
|
+
/* translators: %s: Post title. */
|
|
104
|
+
placeholder = sprintf(__('One response to %s'), postTitle);
|
|
105
|
+
} else {
|
|
106
|
+
placeholder = sprintf(
|
|
107
|
+
/* translators: 1: Number of comments, 2: Post title. */
|
|
108
|
+
_n('%1$s response to %2$s', '%1$s responses to %2$s', commentsCount), commentsCount, postTitle);
|
|
109
|
+
}
|
|
110
|
+
} else if (commentsCount === 1) {
|
|
111
|
+
placeholder = __('One response');
|
|
112
|
+
} else {
|
|
113
|
+
placeholder = sprintf(
|
|
114
|
+
/* translators: %s: Number of comments. */
|
|
115
|
+
_n('%s responses', '%s responses', commentsCount), commentsCount);
|
|
116
|
+
}
|
|
117
|
+
} else if (showPostTitle) {
|
|
118
|
+
if (commentsCount === 1) {
|
|
119
|
+
/* translators: %s: Post title. */
|
|
120
|
+
placeholder = sprintf(__('Response to %s'), postTitle);
|
|
121
|
+
} else {
|
|
122
|
+
/* translators: %s: Post title. */
|
|
123
|
+
placeholder = sprintf(__('Responses to %s'), postTitle);
|
|
124
|
+
}
|
|
125
|
+
} else if (commentsCount === 1) {
|
|
126
|
+
placeholder = __('Response');
|
|
127
|
+
} else {
|
|
128
|
+
placeholder = __('Responses');
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return createElement(Fragment, null, blockControls, inspectorControls, createElement(TagName, blockProps, placeholder));
|
|
134
132
|
}
|
|
135
133
|
//# sourceMappingURL=edit.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/comments-title/edit.js"],"names":["classnames","AlignmentControl","BlockControls","useBlockProps","PlainText","InspectorControls","__","useEntityProp","PanelBody","ToggleControl","__experimentalToggleGroupControl","ToggleGroupControl","__experimentalToggleGroupControlOption","ToggleGroupControlOption","useState","useEffect","apiFetch","addQueryArgs","HeadingLevelDropdown","Edit","attributes","textAlign","singleCommentLabel","multipleCommentsLabel","showPostTitle","showCommentsCount","level","setAttributes","context","postType","postId","TagName","commentsCount","setCommentsCount","editingMode","setEditingMode","rawTitle","isSiteEditor","blockProps","className","currentPostId","path","post","_fields","method","parse","then","res","parseInt","headers","get","catch","blockControls","newAlign","newLevel","inspectorControls","value","postTitle","singlePlaceholder","singlePlaceholderNoCount","multiplePlaceholder","multiplePlaceholderNoCount","newLabel"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,gBADD,EAECC,aAFD,EAGCC,aAHD,EAICC,SAJD,EAKCC,iBALD,QAMO,yBANP;AAOA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC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AAK,CAAhD,GACD,8BACC,cAAC,SAAD;AACC,IAAA,qBAAqB,EAAG,CADzB;AAEC,IAAA,OAAO,EAAC,MAFT;AAGC,kBACCP,iBAAiB,GACdiC,iBADc,GAEdC,wBANL;AAQC,IAAA,WAAW,EACVlC,iBAAiB,GACdiC,iBADc,GAEdC,wBAXL;AAaC,IAAA,KAAK,EAAGrC,kBAbT;AAcC,IAAA,QAAQ,EAAKwC,QAAF,IACVnC,aAAa,CAAE;AACdL,MAAAA,kBAAkB,EAAEwC;AADN,KAAF;AAff,IADD,EAqBGtC,aAAa,GAAGiC,SAAH,GAAe,IArB/B,CADC,GAyBD,8BACGhC,iBAAiB,GAAGO,aAAH,GAAmB,IADvC,EAEC,cAAC,SAAD;AACC,IAAA,qBAAqB,EAAG,CADzB;AAEC,IAAA,OAAO,EAAC,MAFT;AAGC,kBACCP,iBAAiB,GACb,IAAImC,mBAAqB,EADZ,GAEdC,0BANL;AAQC,IAAA,WAAW,EACVpC,iBAAiB,GACb,IAAImC,mBAAqB,EADZ,GAEdC,0BAXL;AAaC,IAAA,KAAK,EAAGtC,qBAbT;AAcC,IAAA,QAAQ,EAAKuC,QAAF,IACVnC,aAAa,CAAE;AACdJ,MAAAA,qBAAqB,EAAEuC;AADT,KAAF;AAff,IAFD,EAsBGtC,aAAa,GAAGiC,SAAH,GAAe,IAtB/B,CA1BF,CAHD,CADD;AA0DA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tuseBlockProps,\n\tPlainText,\n\tInspectorControls,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityProp } from '@wordpress/core-data';\nimport {\n\tPanelBody,\n\tToggleControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n} from '@wordpress/components';\nimport { useState, useEffect } from '@wordpress/element';\nimport apiFetch from '@wordpress/api-fetch';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport HeadingLevelDropdown from '../heading/heading-level-dropdown';\n\nexport default function Edit( {\n\tattributes: {\n\t\ttextAlign,\n\t\tsingleCommentLabel,\n\t\tmultipleCommentsLabel,\n\t\tshowPostTitle,\n\t\tshowCommentsCount,\n\t\tlevel,\n\t},\n\tsetAttributes,\n\tcontext: { postType, postId },\n} ) {\n\tconst TagName = 'h' + level;\n\tconst [ commentsCount, setCommentsCount ] = useState();\n\tconst [ editingMode, setEditingMode ] = useState( 'plural' );\n\tconst [ rawTitle ] = useEntityProp( 'postType', postType, 'title', postId );\n\tconst isSiteEditor = typeof postId === 'undefined';\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\tuseEffect( () => {\n\t\tif ( isSiteEditor ) {\n\t\t\tsetCommentsCount( 3 );\n\t\t\treturn;\n\t\t}\n\t\tconst currentPostId = postId;\n\t\tapiFetch( {\n\t\t\tpath: addQueryArgs( '/wp/v2/comments', {\n\t\t\t\tpost: postId,\n\t\t\t\t_fields: 'id',\n\t\t\t} ),\n\t\t\tmethod: 'HEAD',\n\t\t\tparse: false,\n\t\t} )\n\t\t\t.then( ( res ) => {\n\t\t\t\t// Stale requests will have the `currentPostId` of an older closure.\n\t\t\t\tif ( currentPostId === postId ) {\n\t\t\t\t\tsetCommentsCount(\n\t\t\t\t\t\tparseInt( res.headers.get( 'X-WP-Total' ) )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} )\n\t\t\t.catch( () => {\n\t\t\t\tsetCommentsCount( 0 );\n\t\t\t} );\n\t}, [ postId ] );\n\n\tconst blockControls = (\n\t\t<BlockControls group=\"block\">\n\t\t\t<AlignmentControl\n\t\t\t\tvalue={ textAlign }\n\t\t\t\tonChange={ ( newAlign ) =>\n\t\t\t\t\tsetAttributes( { textAlign: newAlign } )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t<HeadingLevelDropdown\n\t\t\t\tselectedLevel={ level }\n\t\t\t\tonChange={ ( newLevel ) =>\n\t\t\t\t\tsetAttributes( { level: newLevel } )\n\t\t\t\t}\n\t\t\t/>\n\t\t</BlockControls>\n\t);\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t{ isSiteEditor && (\n\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\tlabel={ __( 'Editing mode' ) }\n\t\t\t\t\t\tonChange={ setEditingMode }\n\t\t\t\t\t\tvalue={ editingMode }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tlabel={ __( 'Singular' ) }\n\t\t\t\t\t\t\tvalue=\"singular\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tlabel={ __( 'Plural' ) }\n\t\t\t\t\t\t\tvalue=\"plural\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t) }\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Show post title' ) }\n\t\t\t\t\tchecked={ showPostTitle }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { showPostTitle: value } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Show comments count' ) }\n\t\t\t\t\tchecked={ showCommentsCount }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { showCommentsCount: value } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n\n\tconst postTitle = isSiteEditor ? __( '\"Post Title\"' ) : `\"${ rawTitle }\"`;\n\n\tconst singlePlaceholder = showPostTitle\n\t\t? __( 'One response to ' )\n\t\t: __( 'One response' );\n\n\tconst singlePlaceholderNoCount = showPostTitle\n\t\t? __( 'Response to ' )\n\t\t: __( 'Response' );\n\n\tconst multiplePlaceholder = showPostTitle\n\t\t? __( 'responses to ' )\n\t\t: __( 'responses' );\n\n\tconst multiplePlaceholderNoCount = showPostTitle\n\t\t? __( 'Responses to ' )\n\t\t: __( 'Responses' );\n\n\treturn (\n\t\t<>\n\t\t\t{ blockControls }\n\t\t\t{ inspectorControls }\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t{ editingMode === 'singular' || commentsCount === 1 ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<PlainText\n\t\t\t\t\t\t\t__experimentalVersion={ 2 }\n\t\t\t\t\t\t\ttagName=\"span\"\n\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\tshowCommentsCount\n\t\t\t\t\t\t\t\t\t? singlePlaceholder\n\t\t\t\t\t\t\t\t\t: singlePlaceholderNoCount\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t\t\tshowCommentsCount\n\t\t\t\t\t\t\t\t\t? singlePlaceholder\n\t\t\t\t\t\t\t\t\t: singlePlaceholderNoCount\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvalue={ singleCommentLabel }\n\t\t\t\t\t\t\tonChange={ ( newLabel ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tsingleCommentLabel: newLabel,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ showPostTitle ? postTitle : null }\n\t\t\t\t\t</>\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ showCommentsCount ? commentsCount : null }\n\t\t\t\t\t\t<PlainText\n\t\t\t\t\t\t\t__experimentalVersion={ 2 }\n\t\t\t\t\t\t\ttagName=\"span\"\n\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\tshowCommentsCount\n\t\t\t\t\t\t\t\t\t? ` ${ multiplePlaceholder }`\n\t\t\t\t\t\t\t\t\t: multiplePlaceholderNoCount\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t\t\tshowCommentsCount\n\t\t\t\t\t\t\t\t\t? ` ${ multiplePlaceholder }`\n\t\t\t\t\t\t\t\t\t: multiplePlaceholderNoCount\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvalue={ multipleCommentsLabel }\n\t\t\t\t\t\t\tonChange={ ( newLabel ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tmultipleCommentsLabel: newLabel,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ showPostTitle ? postTitle : null }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</TagName>\n\t\t</>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/comments-title/edit.js"],"names":["classnames","AlignmentControl","BlockControls","useBlockProps","InspectorControls","__","_n","sprintf","useEntityProp","PanelBody","ToggleControl","useState","useEffect","apiFetch","addQueryArgs","HeadingLevelDropdown","Edit","attributes","textAlign","showPostTitle","showCommentsCount","level","setAttributes","context","postType","postId","TagName","commentsCount","setCommentsCount","rawTitle","isSiteEditor","blockProps","className","currentPostId","path","post","_fields","method","parse","then","res","parseInt","headers","get","catch","blockControls","newAlign","newLevel","inspectorControls","value","postTitle","placeholder","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,gBADD,EAECC,aAFD,EAGCC,aAHD,EAICC,iBAJD,QAKO,yBALP;AAMA,SAASC,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,QAAgC,iBAAhC;AACA,SAASC,aAAT,QAA8B,sBAA9B;AACA,SAASC,SAAT,EAAoBC,aAApB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AAA,WAAW,GAAG9C,EAAE,CAAE,WAAF,CAAhB;AACA;;AAED,SACC,8BACGwC,aADH,EAEGG,iBAFH,EAGC,cAAC,OAAD,EAAcjB,UAAd,EAA6BoB,WAA7B,CAHD,CADD;AAOA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tuseBlockProps,\n\tInspectorControls,\n} from '@wordpress/block-editor';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { PanelBody, ToggleControl } from '@wordpress/components';\nimport { useState, useEffect } from '@wordpress/element';\nimport apiFetch from '@wordpress/api-fetch';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport HeadingLevelDropdown from '../heading/heading-level-dropdown';\n\nexport default function Edit( {\n\tattributes: { textAlign, showPostTitle, showCommentsCount, level },\n\tsetAttributes,\n\tcontext: { postType, postId },\n} ) {\n\tconst TagName = 'h' + level;\n\tconst [ commentsCount, setCommentsCount ] = useState();\n\tconst [ rawTitle ] = useEntityProp( 'postType', postType, 'title', postId );\n\tconst isSiteEditor = typeof postId === 'undefined';\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\tuseEffect( () => {\n\t\tif ( isSiteEditor ) {\n\t\t\tsetCommentsCount( 3 );\n\t\t\treturn;\n\t\t}\n\t\tconst currentPostId = postId;\n\t\tapiFetch( {\n\t\t\tpath: addQueryArgs( '/wp/v2/comments', {\n\t\t\t\tpost: postId,\n\t\t\t\t_fields: 'id',\n\t\t\t} ),\n\t\t\tmethod: 'HEAD',\n\t\t\tparse: false,\n\t\t} )\n\t\t\t.then( ( res ) => {\n\t\t\t\t// Stale requests will have the `currentPostId` of an older closure.\n\t\t\t\tif ( currentPostId === postId ) {\n\t\t\t\t\tsetCommentsCount(\n\t\t\t\t\t\tparseInt( res.headers.get( 'X-WP-Total' ) )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} )\n\t\t\t.catch( () => {\n\t\t\t\tsetCommentsCount( 0 );\n\t\t\t} );\n\t}, [ postId ] );\n\n\tconst blockControls = (\n\t\t<BlockControls group=\"block\">\n\t\t\t<AlignmentControl\n\t\t\t\tvalue={ textAlign }\n\t\t\t\tonChange={ ( newAlign ) =>\n\t\t\t\t\tsetAttributes( { textAlign: newAlign } )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t<HeadingLevelDropdown\n\t\t\t\tselectedLevel={ level }\n\t\t\t\tonChange={ ( newLevel ) =>\n\t\t\t\t\tsetAttributes( { level: newLevel } )\n\t\t\t\t}\n\t\t\t/>\n\t\t</BlockControls>\n\t);\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Show post title' ) }\n\t\t\t\t\tchecked={ showPostTitle }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { showPostTitle: value } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Show comments count' ) }\n\t\t\t\t\tchecked={ showCommentsCount }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { showCommentsCount: value } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n\n\tconst postTitle = isSiteEditor ? __( '\"Post Title\"' ) : `\"${ rawTitle }\"`;\n\n\tlet placeholder;\n\tif ( showCommentsCount && commentsCount !== undefined ) {\n\t\tif ( showPostTitle ) {\n\t\t\tif ( commentsCount === 1 ) {\n\t\t\t\t/* translators: %s: Post title. */\n\t\t\t\tplaceholder = sprintf( __( 'One response to %s' ), postTitle );\n\t\t\t} else {\n\t\t\t\tplaceholder = sprintf(\n\t\t\t\t\t/* translators: 1: Number of comments, 2: Post title. */\n\t\t\t\t\t_n(\n\t\t\t\t\t\t'%1$s response to %2$s',\n\t\t\t\t\t\t'%1$s responses to %2$s',\n\t\t\t\t\t\tcommentsCount\n\t\t\t\t\t),\n\t\t\t\t\tcommentsCount,\n\t\t\t\t\tpostTitle\n\t\t\t\t);\n\t\t\t}\n\t\t} else if ( commentsCount === 1 ) {\n\t\t\tplaceholder = __( 'One response' );\n\t\t} else {\n\t\t\tplaceholder = sprintf(\n\t\t\t\t/* translators: %s: Number of comments. */\n\t\t\t\t_n( '%s responses', '%s responses', commentsCount ),\n\t\t\t\tcommentsCount\n\t\t\t);\n\t\t}\n\t} else if ( showPostTitle ) {\n\t\tif ( commentsCount === 1 ) {\n\t\t\t/* translators: %s: Post title. */\n\t\t\tplaceholder = sprintf( __( 'Response to %s' ), postTitle );\n\t\t} else {\n\t\t\t/* translators: %s: Post title. */\n\t\t\tplaceholder = sprintf( __( 'Responses to %s' ), postTitle );\n\t\t}\n\t} else if ( commentsCount === 1 ) {\n\t\tplaceholder = __( 'Response' );\n\t} else {\n\t\tplaceholder = __( 'Responses' );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ blockControls }\n\t\t\t{ inspectorControls }\n\t\t\t<TagName { ...blockProps }>{ placeholder }</TagName>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -20,12 +20,6 @@ const metadata = {
|
|
|
20
20
|
textAlign: {
|
|
21
21
|
type: "string"
|
|
22
22
|
},
|
|
23
|
-
singleCommentLabel: {
|
|
24
|
-
type: "string"
|
|
25
|
-
},
|
|
26
|
-
multipleCommentsLabel: {
|
|
27
|
-
type: "string"
|
|
28
|
-
},
|
|
29
23
|
showPostTitle: {
|
|
30
24
|
type: "boolean",
|
|
31
25
|
"default": true
|
|
@@ -77,12 +71,14 @@ const metadata = {
|
|
|
77
71
|
}
|
|
78
72
|
};
|
|
79
73
|
import edit from './edit';
|
|
74
|
+
import deprecated from './deprecated';
|
|
80
75
|
const {
|
|
81
76
|
name
|
|
82
77
|
} = metadata;
|
|
83
78
|
export { metadata, name };
|
|
84
79
|
export const settings = {
|
|
85
80
|
icon,
|
|
86
|
-
edit
|
|
81
|
+
edit,
|
|
82
|
+
deprecated
|
|
87
83
|
};
|
|
88
84
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/comments-title/index.js"],"names":["commentTitle","icon","edit","name","metadata","settings"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,IAAIC,IAAzB,QAAqC,kBAArC;AAEA;AACA;AACA
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/comments-title/index.js"],"names":["commentTitle","icon","edit","deprecated","name","metadata","settings"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,IAAIC,IAAzB,QAAqC,kBAArC;AAEA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAOC,IAAP,MAAiB,QAAjB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAWC,QAAjB;AACA,SAASA,QAAT,EAAmBD,IAAnB;AAEA,OAAO,MAAME,QAAQ,GAAG;AACvBL,EAAAA,IADuB;AAEvBC,EAAAA,IAFuB;AAGvBC,EAAAA;AAHuB,CAAjB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { commentTitle as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tdeprecated,\n};\n"]}
|
|
@@ -346,8 +346,11 @@ function CoverEdit(_ref5) {
|
|
|
346
346
|
|
|
347
347
|
const toggleUseFeaturedImage = () => {
|
|
348
348
|
setAttributes({
|
|
349
|
+
id: undefined,
|
|
350
|
+
url: undefined,
|
|
349
351
|
useFeaturedImage: !useFeaturedImage,
|
|
350
|
-
dimRatio: dimRatio === 100 ? 50 : dimRatio
|
|
352
|
+
dimRatio: dimRatio === 100 ? 50 : dimRatio,
|
|
353
|
+
backgroundType: useFeaturedImage ? IMAGE_BACKGROUND_TYPE : undefined
|
|
351
354
|
});
|
|
352
355
|
};
|
|
353
356
|
|