@wordpress/block-library 7.3.12 → 7.3.13
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.
|
@@ -68,9 +68,7 @@ function PostCommentsFormEdit(_ref) {
|
|
|
68
68
|
|
|
69
69
|
if (!isSiteEditor && 'open' !== commentStatus) {
|
|
70
70
|
if ('closed' === commentStatus) {
|
|
71
|
-
warning = (0, _i18n.
|
|
72
|
-
/* translators: 1: Post type (i.e. "post", "page") */
|
|
73
|
-
(0, _i18n.__)('Post Comments Form block: Comments on this %s are not allowed.'), postType);
|
|
71
|
+
warning = (0, _i18n.__)('Post Comments Form block: Comments are not enabled for this item.');
|
|
74
72
|
actions = [(0, _element.createElement)(_components.Button, {
|
|
75
73
|
key: "enableComments",
|
|
76
74
|
onClick: () => setCommentStatus('open'),
|
|
@@ -80,7 +78,7 @@ function PostCommentsFormEdit(_ref) {
|
|
|
80
78
|
} else if (!postTypeSupportsComments) {
|
|
81
79
|
warning = (0, _i18n.sprintf)(
|
|
82
80
|
/* translators: 1: Post type (i.e. "post", "page") */
|
|
83
|
-
(0, _i18n.__)('Post Comments Form block: Comments for this post type (%s)
|
|
81
|
+
(0, _i18n.__)('Post Comments Form block: Comments are not enabled for this post type (%s).'), postType);
|
|
84
82
|
showPlaceholder = false;
|
|
85
83
|
} else if ('open' !== defaultCommentStatus) {
|
|
86
84
|
warning = (0, _i18n.__)('Post Comments Form block: Comments are not enabled.');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/post-comments-form/edit.js"],"names":["PostCommentsFormEdit","attributes","context","setAttributes","textAlign","postId","postType","commentStatus","setCommentStatus","blockProps","className","isSiteEditor","undefined","defaultCommentStatus","select","blockEditorStore","getSettings","__experimentalDiscussionSettings","postTypeSupportsComments","coreStore","getPostType","supports","comments","warning","actions","showPlaceholder","nextAlign"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AAOA;;AACA;;AACA;;AAC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/edit.js"],"names":["PostCommentsFormEdit","attributes","context","setAttributes","textAlign","postId","postType","commentStatus","setCommentStatus","blockProps","className","isSiteEditor","undefined","defaultCommentStatus","select","blockEditorStore","getSettings","__experimentalDiscussionSettings","postTypeSupportsComments","coreStore","getPostType","supports","comments","warning","actions","showPlaceholder","nextAlign"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AAOA;;AACA;;AACA;;AACA;;AAKA;;AAvBA;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;AAGe,SAASA,oBAAT,OAIX;AAAA,MAJ0C;AAC7CC,IAAAA,UAD6C;AAE7CC,IAAAA,OAF6C;AAG7CC,IAAAA;AAH6C,GAI1C;AACH,QAAM;AAAEC,IAAAA;AAAF,MAAgBH,UAAtB;AACA,QAAM;AAAEI,IAAAA,MAAF;AAAUC,IAAAA;AAAV,MAAuBJ,OAA7B;AACA,QAAM,CAAEK,aAAF,EAAiBC,gBAAjB,IAAsC,6BAC3C,UAD2C,EAE3CF,QAF2C,EAG3C,gBAH2C,EAI3CD,MAJ2C,CAA5C;AAMA,QAAMI,UAAU,GAAG,gCAAe;AACjCC,IAAAA,SAAS,EAAE,yBAAY;AACtB,OAAG,kBAAkBN,SAAW,EAAhC,GAAqCA;AADf,KAAZ;AADsB,GAAf,CAAnB;AAMA,QAAMO,YAAY,GAAGL,QAAQ,KAAKM,SAAb,IAA0BP,MAAM,KAAKO,SAA1D;AAEA,QAAM;AAAEC,IAAAA;AAAF,MAA2B,qBAC9BC,MAAF,IACCA,MAAM,CAAEC,kBAAF,CAAN,CAA2BC,WAA3B,GACEC,gCAH6B,CAAjC;AAMA,QAAMC,wBAAwB,GAAG,qBAAaJ,MAAF;AAAA;;AAAA,WAC3CR,QAAQ,GACL,CAAC,yBAAEQ,MAAM,CAAEK,eAAF,CAAN,CAAoBC,WAApB,CAAiCd,QAAjC,CAAF,gDAAE,oBAA6Ce,QAA7C,CAAsDC,QAAxD,CADI,GAEL,KAHwC;AAAA,GAAX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WordPress dependencies\n */\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tWarning,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport CommentsForm from './form';\n\nexport default function PostCommentsFormEdit( {\n\tattributes,\n\tcontext,\n\tsetAttributes,\n} ) {\n\tconst { textAlign } = attributes;\n\tconst { postId, postType } = context;\n\tconst [ commentStatus, setCommentStatus ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'comment_status',\n\t\tpostId\n\t);\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\tconst isSiteEditor = postType === undefined || postId === undefined;\n\n\tconst { defaultCommentStatus } = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings()\n\t\t\t\t.__experimentalDiscussionSettings\n\t);\n\n\tconst postTypeSupportsComments = useSelect( ( select ) =>\n\t\tpostType\n\t\t\t? !! select( coreStore ).getPostType( postType )?.supports.comments\n\t\t\t: false\n\t);\n\n\tlet warning = false;\n\tlet actions;\n\tlet showPlaceholder = true;\n\n\tif ( ! isSiteEditor && 'open' !== commentStatus ) {\n\t\tif ( 'closed' === commentStatus ) {\n\t\t\twarning = __(\n\t\t\t\t'Post Comments Form block: Comments are not enabled for this item.'\n\t\t\t);\n\n\t\t\tactions = [\n\t\t\t\t<Button\n\t\t\t\t\tkey=\"enableComments\"\n\t\t\t\t\tonClick={ () => setCommentStatus( 'open' ) }\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t>\n\t\t\t\t\t{ _x(\n\t\t\t\t\t\t'Enable comments',\n\t\t\t\t\t\t'action that affects the current post'\n\t\t\t\t\t) }\n\t\t\t\t</Button>,\n\t\t\t];\n\t\t\tshowPlaceholder = false;\n\t\t} else if ( ! postTypeSupportsComments ) {\n\t\t\twarning = sprintf(\n\t\t\t\t/* translators: 1: Post type (i.e. \"post\", \"page\") */\n\t\t\t\t__(\n\t\t\t\t\t'Post Comments Form block: Comments are not enabled for this post type (%s).'\n\t\t\t\t),\n\t\t\t\tpostType\n\t\t\t);\n\t\t\tshowPlaceholder = false;\n\t\t} else if ( 'open' !== defaultCommentStatus ) {\n\t\t\twarning = __(\n\t\t\t\t'Post Comments Form block: Comments are not enabled.'\n\t\t\t);\n\t\t\tshowPlaceholder = false;\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<AlignmentControl\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\tsetAttributes( { textAlign: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ warning && (\n\t\t\t\t\t<Warning actions={ actions }>{ warning }</Warning>\n\t\t\t\t) }\n\n\t\t\t\t{ showPlaceholder ? <CommentsForm /> : null }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -52,9 +52,7 @@ export default function PostCommentsFormEdit(_ref) {
|
|
|
52
52
|
|
|
53
53
|
if (!isSiteEditor && 'open' !== commentStatus) {
|
|
54
54
|
if ('closed' === commentStatus) {
|
|
55
|
-
warning =
|
|
56
|
-
/* translators: 1: Post type (i.e. "post", "page") */
|
|
57
|
-
__('Post Comments Form block: Comments on this %s are not allowed.'), postType);
|
|
55
|
+
warning = __('Post Comments Form block: Comments are not enabled for this item.');
|
|
58
56
|
actions = [createElement(Button, {
|
|
59
57
|
key: "enableComments",
|
|
60
58
|
onClick: () => setCommentStatus('open'),
|
|
@@ -64,7 +62,7 @@ export default function PostCommentsFormEdit(_ref) {
|
|
|
64
62
|
} else if (!postTypeSupportsComments) {
|
|
65
63
|
warning = sprintf(
|
|
66
64
|
/* translators: 1: Post type (i.e. "post", "page") */
|
|
67
|
-
__('Post Comments Form block: Comments for this post type (%s)
|
|
65
|
+
__('Post Comments Form block: Comments are not enabled for this post type (%s).'), postType);
|
|
68
66
|
showPlaceholder = false;
|
|
69
67
|
} else if ('open' !== defaultCommentStatus) {
|
|
70
68
|
warning = __('Post Comments Form block: Comments are not enabled.');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/post-comments-form/edit.js"],"names":["classnames","AlignmentControl","BlockControls","Warning","useBlockProps","store","blockEditorStore","Button","useEntityProp","coreStore","__","_x","sprintf","useSelect","CommentsForm","PostCommentsFormEdit","attributes","context","setAttributes","textAlign","postId","postType","commentStatus","setCommentStatus","blockProps","className","isSiteEditor","undefined","defaultCommentStatus","select","getSettings","__experimentalDiscussionSettings","postTypeSupportsComments","getPostType","supports","comments","warning","actions","showPlaceholder","nextAlign"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,gBADD,EAECC,aAFD,EAGCC,OAHD,EAICC,aAJD,EAKCC,KAAK,IAAIC,gBALV,QAMO,yBANP;AAOA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,aAAT,EAAwBH,KAAK,IAAII,SAAjC,QAAkD,sBAAlD;AACA,SAASC,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,QAAgC,iBAAhC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,QAAzB;AAEA,eAAe,SAASC,oBAAT,OAIX;AAAA,MAJ0C;AAC7CC,IAAAA,UAD6C;AAE7CC,IAAAA,OAF6C;AAG7CC,IAAAA;AAH6C,GAI1C;AACH,QAAM;AAAEC,IAAAA;AAAF,MAAgBH,UAAtB;AACA,QAAM;AAAEI,IAAAA,MAAF;AAAUC,IAAAA;AAAV,MAAuBJ,OAA7B;AACA,QAAM,CAAEK,aAAF,EAAiBC,gBAAjB,IAAsCf,aAAa,CACxD,UADwD,EAExDa,QAFwD,EAGxD,gBAHwD,EAIxDD,MAJwD,CAAzD;AAMA,QAAMI,UAAU,GAAGpB,aAAa,CAAE;AACjCqB,IAAAA,SAAS,EAAEzB,UAAU,CAAE;AACtB,OAAG,kBAAkBmB,SAAW,EAAhC,GAAqCA;AADf,KAAF;AADY,GAAF,CAAhC;AAMA,QAAMO,YAAY,GAAGL,QAAQ,KAAKM,SAAb,IAA0BP,MAAM,KAAKO,SAA1D;AAEA,QAAM;AAAEC,IAAAA;AAAF,MAA2Bf,SAAS,CACvCgB,MAAF,IACCA,MAAM,CAAEvB,gBAAF,CAAN,CAA2BwB,WAA3B,GACEC,gCAHsC,CAA1C;AAMA,QAAMC,wBAAwB,GAAGnB,SAAS,CAAIgB,MAAF;AAAA;;AAAA,WAC3CR,QAAQ,GACL,CAAC,yBAAEQ,MAAM,CAAEpB,SAAF,CAAN,CAAoBwB,WAApB,CAAiCZ,QAAjC,CAAF,gDAAE,oBAA6Ca,QAA7C,CAAsDC,QAAxD,CADI,GAEL,KAHwC;AAAA,GAAF,CAA1C;AAMA,MAAIC,OAAO,GAAG,KAAd;AACA,MAAIC,OAAJ;AACA,MAAIC,eAAe,GAAG,IAAtB;;AAEA,MAAK,CAAEZ,YAAF,IAAkB,WAAWJ,aAAlC,EAAkD;AACjD,QAAK,aAAaA,aAAlB,EAAkC;AACjCc,MAAAA,OAAO,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/post-comments-form/edit.js"],"names":["classnames","AlignmentControl","BlockControls","Warning","useBlockProps","store","blockEditorStore","Button","useEntityProp","coreStore","__","_x","sprintf","useSelect","CommentsForm","PostCommentsFormEdit","attributes","context","setAttributes","textAlign","postId","postType","commentStatus","setCommentStatus","blockProps","className","isSiteEditor","undefined","defaultCommentStatus","select","getSettings","__experimentalDiscussionSettings","postTypeSupport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BAAUf,UAAV,EACGY,OAAO,IACR,cAAC,OAAD;AAAS,IAAA,OAAO,EAAGC;AAAnB,KAA+BD,OAA/B,CAFF,EAKGE,eAAe,GAAG,cAAC,YAAD,OAAH,GAAsB,IALxC,CATD,CADD;AAmBA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tWarning,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport CommentsForm from './form';\n\nexport default function PostCommentsFormEdit( {\n\tattributes,\n\tcontext,\n\tsetAttributes,\n} ) {\n\tconst { textAlign } = attributes;\n\tconst { postId, postType } = context;\n\tconst [ commentStatus, setCommentStatus ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'comment_status',\n\t\tpostId\n\t);\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\tconst isSiteEditor = postType === undefined || postId === undefined;\n\n\tconst { defaultCommentStatus } = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings()\n\t\t\t\t.__experimentalDiscussionSettings\n\t);\n\n\tconst postTypeSupportsComments = useSelect( ( select ) =>\n\t\tpostType\n\t\t\t? !! select( coreStore ).getPostType( postType )?.supports.comments\n\t\t\t: false\n\t);\n\n\tlet warning = false;\n\tlet actions;\n\tlet showPlaceholder = true;\n\n\tif ( ! isSiteEditor && 'open' !== commentStatus ) {\n\t\tif ( 'closed' === commentStatus ) {\n\t\t\twarning = __(\n\t\t\t\t'Post Comments Form block: Comments are not enabled for this item.'\n\t\t\t);\n\n\t\t\tactions = [\n\t\t\t\t<Button\n\t\t\t\t\tkey=\"enableComments\"\n\t\t\t\t\tonClick={ () => setCommentStatus( 'open' ) }\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t>\n\t\t\t\t\t{ _x(\n\t\t\t\t\t\t'Enable comments',\n\t\t\t\t\t\t'action that affects the current post'\n\t\t\t\t\t) }\n\t\t\t\t</Button>,\n\t\t\t];\n\t\t\tshowPlaceholder = false;\n\t\t} else if ( ! postTypeSupportsComments ) {\n\t\t\twarning = sprintf(\n\t\t\t\t/* translators: 1: Post type (i.e. \"post\", \"page\") */\n\t\t\t\t__(\n\t\t\t\t\t'Post Comments Form block: Comments are not enabled for this post type (%s).'\n\t\t\t\t),\n\t\t\t\tpostType\n\t\t\t);\n\t\t\tshowPlaceholder = false;\n\t\t} else if ( 'open' !== defaultCommentStatus ) {\n\t\t\twarning = __(\n\t\t\t\t'Post Comments Form block: Comments are not enabled.'\n\t\t\t);\n\t\t\tshowPlaceholder = false;\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<AlignmentControl\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\tsetAttributes( { textAlign: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ warning && (\n\t\t\t\t\t<Warning actions={ actions }>{ warning }</Warning>\n\t\t\t\t) }\n\n\t\t\t\t{ showPlaceholder ? <CommentsForm /> : null }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-library",
|
|
3
|
-
"version": "7.3.
|
|
3
|
+
"version": "7.3.13",
|
|
4
4
|
"description": "Block library for the WordPress editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"publishConfig": {
|
|
75
75
|
"access": "public"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "b2f4eb9e7da83e45e2f726cfdef4d4224c423da8"
|
|
78
78
|
}
|
|
@@ -62,13 +62,10 @@ export default function PostCommentsFormEdit( {
|
|
|
62
62
|
|
|
63
63
|
if ( ! isSiteEditor && 'open' !== commentStatus ) {
|
|
64
64
|
if ( 'closed' === commentStatus ) {
|
|
65
|
-
warning =
|
|
66
|
-
|
|
67
|
-
__(
|
|
68
|
-
'Post Comments Form block: Comments on this %s are not allowed.'
|
|
69
|
-
),
|
|
70
|
-
postType
|
|
65
|
+
warning = __(
|
|
66
|
+
'Post Comments Form block: Comments are not enabled for this item.'
|
|
71
67
|
);
|
|
68
|
+
|
|
72
69
|
actions = [
|
|
73
70
|
<Button
|
|
74
71
|
key="enableComments"
|
|
@@ -86,7 +83,7 @@ export default function PostCommentsFormEdit( {
|
|
|
86
83
|
warning = sprintf(
|
|
87
84
|
/* translators: 1: Post type (i.e. "post", "page") */
|
|
88
85
|
__(
|
|
89
|
-
'Post Comments Form block: Comments for this post type (%s)
|
|
86
|
+
'Post Comments Form block: Comments are not enabled for this post type (%s).'
|
|
90
87
|
),
|
|
91
88
|
postType
|
|
92
89
|
);
|