@wordpress/block-library 7.3.4 → 7.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -72,7 +72,7 @@ function PostExcerptEditor(_ref) {
72
72
  }, [renderedExcerpt]);
73
73
 
74
74
  if (!postType || !postId) {
75
- return (0, _element.createElement)("div", blockProps, (0, _i18n.__)('Post Excerpt'));
75
+ return (0, _element.createElement)("div", blockProps, (0, _element.createElement)("p", null, (0, _i18n.__)('This is the Post Excerpt block, it will display the excerpt from single posts.')), (0, _element.createElement)("p", null, (0, _i18n.__)('If there are any Custom Post Types with support for excerpts, the Post Excerpt block can display the excerpts of those entries as well.')));
76
76
  }
77
77
 
78
78
  if (isProtected && !userCanEdit) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/post-excerpt/edit.js"],"names":["PostExcerptEditor","attributes","textAlign","moreText","showMoreOnNewLine","setAttributes","isSelected","context","postId","postType","queryId","isDescendentOfQueryLoop","Number","isFinite","userCanEdit","isEditable","rawExcerpt","setExcerpt","rendered","renderedExcerpt","protected","isProtected","blockProps","className","strippedRenderedExcerpt","document","window","DOMParser","parseFromString","body","textContent","innerText","readMoreLink","newMoreText","excerptClassName","excerptContent","newAlign","newShowMoreOnNewLine"],"mappings":";;;;;;;;;AASA;;AANA;;AAKA;;AAEA;;AAQA;;AACA;;AAKA;;AAxBA;AACA;AACA;;AAGA;AACA;AACA;;AAcA;AACA;AACA;AAGe,SAASA,iBAAT,OAKX;AAAA,MALuC;AAC1CC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,SAAF;AAAaC,MAAAA,QAAb;AAAuBC,MAAAA;AAAvB,KAD8B;AAE1CC,IAAAA,aAF0C;AAG1CC,IAAAA,UAH0C;AAI1CC,IAAAA,OAAO,EAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA,QAAV;AAAoBC,MAAAA;AAApB;AAJiC,GAKvC;AACH,QAAMC,uBAAuB,GAAGC,MA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E/B,iBAAF,IAAuB,GAF1B,EAGGA,iBAAiB,GAClB;AAAG,IAAA,SAAS,EAAC;AAAb,KACG4B,YADH,CADkB,GAKlBA,YARF,CAtBD,CADD;AAoCA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport {\n\tAlignmentToolbar,\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\tWarning,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { PanelBody, ToggleControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useCanEditEntity } from '../utils/hooks';\n\nexport default function PostExcerptEditor( {\n\tattributes: { textAlign, moreText, showMoreOnNewLine },\n\tsetAttributes,\n\tisSelected,\n\tcontext: { postId, postType, queryId },\n} ) {\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst userCanEdit = useCanEditEntity( 'postType', postType, postId );\n\tconst isEditable = userCanEdit && ! isDescendentOfQueryLoop;\n\tconst [\n\t\trawExcerpt,\n\t\tsetExcerpt,\n\t\t{ rendered: renderedExcerpt, protected: isProtected } = {},\n\t] = useEntityProp( 'postType', postType, 'excerpt', postId );\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\t/**\n\t * When excerpt is editable, strip the html tags from\n\t * rendered excerpt. This will be used if the entity's\n\t * excerpt has been produced from the content.\n\t */\n\tconst strippedRenderedExcerpt = useMemo( () => {\n\t\tif ( ! renderedExcerpt ) return '';\n\t\tconst document = new window.DOMParser().parseFromString(\n\t\t\trenderedExcerpt,\n\t\t\t'text/html'\n\t\t);\n\t\treturn document.body.textContent || document.body.innerText || '';\n\t}, [ renderedExcerpt ] );\n\tif ( ! postType || ! postId ) {\n\t\treturn <div { ...blockProps }>{ __( 'Post Excerpt' ) }</div>;\n\t}\n\tif ( isProtected && ! userCanEdit ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'There is no excerpt because this is a protected post.'\n\t\t\t\t\t) }\n\t\t\t\t</Warning>\n\t\t\t</div>\n\t\t);\n\t}\n\tconst readMoreLink = (\n\t\t<RichText\n\t\t\tclassName=\"wp-block-post-excerpt__more-link\"\n\t\t\ttagName=\"a\"\n\t\t\taria-label={ __( '\"Read more\" link text' ) }\n\t\t\tplaceholder={ __( 'Add \"read more\" link text' ) }\n\t\t\tvalue={ moreText }\n\t\t\tonChange={ ( newMoreText ) =>\n\t\t\t\tsetAttributes( { moreText: newMoreText } )\n\t\t\t}\n\t\t\twithoutInteractiveFormatting={ true }\n\t\t/>\n\t);\n\tconst excerptClassName = classnames( 'wp-block-post-excerpt__excerpt', {\n\t\t'is-inline': ! showMoreOnNewLine,\n\t} );\n\tconst excerptContent = isEditable ? (\n\t\t<RichText\n\t\t\tclassName={ excerptClassName }\n\t\t\taria-label={ __( 'Post excerpt text' ) }\n\t\t\tvalue={\n\t\t\t\trawExcerpt ||\n\t\t\t\tstrippedRenderedExcerpt ||\n\t\t\t\t( isSelected ? '' : __( 'No post excerpt found' ) )\n\t\t\t}\n\t\t\tonChange={ setExcerpt }\n\t\t\ttagName=\"p\"\n\t\t/>\n\t) : (\n\t\t<p className={ excerptClassName }>\n\t\t\t{ strippedRenderedExcerpt || __( 'No post excerpt found' ) }\n\t\t</p>\n\t);\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<AlignmentToolbar\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( newAlign ) =>\n\t\t\t\t\t\tsetAttributes( { textAlign: newAlign } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Post Excerpt Settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Show link on new line' ) }\n\t\t\t\t\t\tchecked={ showMoreOnNewLine }\n\t\t\t\t\t\tonChange={ ( newShowMoreOnNewLine ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowMoreOnNewLine: newShowMoreOnNewLine,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ excerptContent }\n\t\t\t\t{ ! showMoreOnNewLine && ' ' }\n\t\t\t\t{ showMoreOnNewLine ? (\n\t\t\t\t\t<p className=\"wp-block-post-excerpt__more-text\">\n\t\t\t\t\t\t{ readMoreLink }\n\t\t\t\t\t</p>\n\t\t\t\t) : (\n\t\t\t\t\treadMoreLink\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-excerpt/edit.js"],"names":["PostExcerptEditor","attributes","textAlign","moreText","showMoreOnNewLine","setAttributes","isSelected","context","postId","postType","queryId","isDescendentOfQueryLoop","Number","isFinite","userCanEdit","isEditable","rawExcerpt","setExcerpt","rendered","renderedExcerpt","protected","isProtected","blockProps","className","strippedRenderedExcerpt","document","window","DOMParser","parseFromString","body","textContent","innerText","readMoreLink","newMoreText","excerptClassName","excerptContent","newAlign","newShowMoreOnNewLine"],"mappings":";;;;;;;;;AASA;;AANA;;AAKA;;AAEA;;AAQA;;AACA;;AAKA;;AAxBA;AACA;AACA;;AAGA;AACA;AACA;;AAcA;AACA;AACA;AAGe,SAASA,iBAAT,OAKX;AAAA,MALuC;AAC1CC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,SAAF;AAAaC,MAAAA,QAAb;AAAuBC,MAAAA;AAAvB,KAD8B;AAE1CC,IAAAA,aAF0C;AAG1CC,IAAAA,UAH0C;AAI1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iBAFX;AAGC,IAAA,QAAQ,EAAKiC,oBAAF,IACVhC,aAAa,CAAE;AACdD,MAAAA,iBAAiB,EAAEiC;AADL,KAAF;AAJf,IADD,CADD,CATD,EAsBC,mCAAUf,UAAV,EACGa,cADH,EAEG,CAAE/B,iBAAF,IAAuB,GAF1B,EAGGA,iBAAiB,GAClB;AAAG,IAAA,SAAS,EAAC;AAAb,KACG4B,YADH,CADkB,GAKlBA,YARF,CAtBD,CADD;AAoCA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport {\n\tAlignmentToolbar,\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\tWarning,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { PanelBody, ToggleControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useCanEditEntity } from '../utils/hooks';\n\nexport default function PostExcerptEditor( {\n\tattributes: { textAlign, moreText, showMoreOnNewLine },\n\tsetAttributes,\n\tisSelected,\n\tcontext: { postId, postType, queryId },\n} ) {\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst userCanEdit = useCanEditEntity( 'postType', postType, postId );\n\tconst isEditable = userCanEdit && ! isDescendentOfQueryLoop;\n\tconst [\n\t\trawExcerpt,\n\t\tsetExcerpt,\n\t\t{ rendered: renderedExcerpt, protected: isProtected } = {},\n\t] = useEntityProp( 'postType', postType, 'excerpt', postId );\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\t/**\n\t * When excerpt is editable, strip the html tags from\n\t * rendered excerpt. This will be used if the entity's\n\t * excerpt has been produced from the content.\n\t */\n\tconst strippedRenderedExcerpt = useMemo( () => {\n\t\tif ( ! renderedExcerpt ) return '';\n\t\tconst document = new window.DOMParser().parseFromString(\n\t\t\trenderedExcerpt,\n\t\t\t'text/html'\n\t\t);\n\t\treturn document.body.textContent || document.body.innerText || '';\n\t}, [ renderedExcerpt ] );\n\tif ( ! postType || ! postId ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<p>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'This is the Post Excerpt block, it will display the excerpt from single posts.'\n\t\t\t\t\t) }\n\t\t\t\t</p>\n\t\t\t\t<p>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'If there are any Custom Post Types with support for excerpts, the Post Excerpt block can display the excerpts of those entries as well.'\n\t\t\t\t\t) }\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t);\n\t}\n\tif ( isProtected && ! userCanEdit ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'There is no excerpt because this is a protected post.'\n\t\t\t\t\t) }\n\t\t\t\t</Warning>\n\t\t\t</div>\n\t\t);\n\t}\n\tconst readMoreLink = (\n\t\t<RichText\n\t\t\tclassName=\"wp-block-post-excerpt__more-link\"\n\t\t\ttagName=\"a\"\n\t\t\taria-label={ __( '\"Read more\" link text' ) }\n\t\t\tplaceholder={ __( 'Add \"read more\" link text' ) }\n\t\t\tvalue={ moreText }\n\t\t\tonChange={ ( newMoreText ) =>\n\t\t\t\tsetAttributes( { moreText: newMoreText } )\n\t\t\t}\n\t\t\twithoutInteractiveFormatting={ true }\n\t\t/>\n\t);\n\tconst excerptClassName = classnames( 'wp-block-post-excerpt__excerpt', {\n\t\t'is-inline': ! showMoreOnNewLine,\n\t} );\n\tconst excerptContent = isEditable ? (\n\t\t<RichText\n\t\t\tclassName={ excerptClassName }\n\t\t\taria-label={ __( 'Post excerpt text' ) }\n\t\t\tvalue={\n\t\t\t\trawExcerpt ||\n\t\t\t\tstrippedRenderedExcerpt ||\n\t\t\t\t( isSelected ? '' : __( 'No post excerpt found' ) )\n\t\t\t}\n\t\t\tonChange={ setExcerpt }\n\t\t\ttagName=\"p\"\n\t\t/>\n\t) : (\n\t\t<p className={ excerptClassName }>\n\t\t\t{ strippedRenderedExcerpt || __( 'No post excerpt found' ) }\n\t\t</p>\n\t);\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<AlignmentToolbar\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( newAlign ) =>\n\t\t\t\t\t\tsetAttributes( { textAlign: newAlign } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Post Excerpt Settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Show link on new line' ) }\n\t\t\t\t\t\tchecked={ showMoreOnNewLine }\n\t\t\t\t\t\tonChange={ ( newShowMoreOnNewLine ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowMoreOnNewLine: newShowMoreOnNewLine,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ excerptContent }\n\t\t\t\t{ ! showMoreOnNewLine && ' ' }\n\t\t\t\t{ showMoreOnNewLine ? (\n\t\t\t\t\t<p className=\"wp-block-post-excerpt__more-text\">\n\t\t\t\t\t\t{ readMoreLink }\n\t\t\t\t\t</p>\n\t\t\t\t) : (\n\t\t\t\t\treadMoreLink\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"]}
@@ -58,7 +58,7 @@ export default function PostExcerptEditor(_ref) {
58
58
  }, [renderedExcerpt]);
59
59
 
60
60
  if (!postType || !postId) {
61
- return createElement("div", blockProps, __('Post Excerpt'));
61
+ return createElement("div", blockProps, createElement("p", null, __('This is the Post Excerpt block, it will display the excerpt from single posts.')), createElement("p", null, __('If there are any Custom Post Types with support for excerpts, the Post Excerpt block can display the excerpts of those entries as well.')));
62
62
  }
63
63
 
64
64
  if (isProtected && !userCanEdit) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/post-excerpt/edit.js"],"names":["classnames","useEntityProp","useMemo","AlignmentToolbar","BlockControls","InspectorControls","RichText","Warning","useBlockProps","PanelBody","ToggleControl","__","useCanEditEntity","PostExcerptEditor","attributes","textAlign","moreText","showMoreOnNewLine","setAttributes","isSelected","context","postId","postType","queryId","isDescendentOfQueryLoop","Number","isFinite","userCanEdit","isEditable","rawExcerpt","setExcerpt","rendered","renderedExcerpt","protected","isProtected","blockProps","className","strippedRenderedExcerpt","document","window","DOMParser","parseFromString","body","textContent","innerText","readMoreLink","newMoreText","excerptClassName","excerptContent","newAlign","newShowMoreOnNewLine"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,aAAT,QAA8B,sBAA9B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SACCC,gBADD,EAECC,aAFD,EAGCC,iBAHD,EAICC,QAJD,EAKCC,OALD,EAMCC,aAND,QAOO,yBAPP;AAQA,SAASC,SAAT,EAAoBC,aAApB,QAAyC,uBAAzC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASC,gBAAT,QAAiC,gBAAjC;AAEA,eAAe,SAASC,iBAAT,OAKX;AAAA,MALuC;AAC1CC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,SAAF;AAAaC,MAAAA,QAAb;AAAuBC,MAAAA;AAAvB,KAD8B;AAE1CC,IAAAA,aAF0C;AAG1CC,IAAAA,UAH0C;AAI1CC,IAAAA,OAAO,EAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA,QAAV;AAAoBC,MAAAA;AAApB;AAJiC,GAKvC;AACH,QAAMC,uBAAuB,GAAGC,MAAM,CAACC,QAAP,CA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Jf,IADD,CADD,CATD,EAsBC,qBAAUf,UAAV,EACGa,cADH,EAEG,CAAE/B,iBAAF,IAAuB,GAF1B,EAGGA,iBAAiB,GAClB;AAAG,IAAA,SAAS,EAAC;AAAb,KACG4B,YADH,CADkB,GAKlBA,YARF,CAtBD,CADD;AAoCA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport {\n\tAlignmentToolbar,\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\tWarning,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { PanelBody, ToggleControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useCanEditEntity } from '../utils/hooks';\n\nexport default function PostExcerptEditor( {\n\tattributes: { textAlign, moreText, showMoreOnNewLine },\n\tsetAttributes,\n\tisSelected,\n\tcontext: { postId, postType, queryId },\n} ) {\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst userCanEdit = useCanEditEntity( 'postType', postType, postId );\n\tconst isEditable = userCanEdit && ! isDescendentOfQueryLoop;\n\tconst [\n\t\trawExcerpt,\n\t\tsetExcerpt,\n\t\t{ rendered: renderedExcerpt, protected: isProtected } = {},\n\t] = useEntityProp( 'postType', postType, 'excerpt', postId );\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\t/**\n\t * When excerpt is editable, strip the html tags from\n\t * rendered excerpt. This will be used if the entity's\n\t * excerpt has been produced from the content.\n\t */\n\tconst strippedRenderedExcerpt = useMemo( () => {\n\t\tif ( ! renderedExcerpt ) return '';\n\t\tconst document = new window.DOMParser().parseFromString(\n\t\t\trenderedExcerpt,\n\t\t\t'text/html'\n\t\t);\n\t\treturn document.body.textContent || document.body.innerText || '';\n\t}, [ renderedExcerpt ] );\n\tif ( ! postType || ! postId ) {\n\t\treturn <div { ...blockProps }>{ __( 'Post Excerpt' ) }</div>;\n\t}\n\tif ( isProtected && ! userCanEdit ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'There is no excerpt because this is a protected post.'\n\t\t\t\t\t) }\n\t\t\t\t</Warning>\n\t\t\t</div>\n\t\t);\n\t}\n\tconst readMoreLink = (\n\t\t<RichText\n\t\t\tclassName=\"wp-block-post-excerpt__more-link\"\n\t\t\ttagName=\"a\"\n\t\t\taria-label={ __( '\"Read more\" link text' ) }\n\t\t\tplaceholder={ __( 'Add \"read more\" link text' ) }\n\t\t\tvalue={ moreText }\n\t\t\tonChange={ ( newMoreText ) =>\n\t\t\t\tsetAttributes( { moreText: newMoreText } )\n\t\t\t}\n\t\t\twithoutInteractiveFormatting={ true }\n\t\t/>\n\t);\n\tconst excerptClassName = classnames( 'wp-block-post-excerpt__excerpt', {\n\t\t'is-inline': ! showMoreOnNewLine,\n\t} );\n\tconst excerptContent = isEditable ? (\n\t\t<RichText\n\t\t\tclassName={ excerptClassName }\n\t\t\taria-label={ __( 'Post excerpt text' ) }\n\t\t\tvalue={\n\t\t\t\trawExcerpt ||\n\t\t\t\tstrippedRenderedExcerpt ||\n\t\t\t\t( isSelected ? '' : __( 'No post excerpt found' ) )\n\t\t\t}\n\t\t\tonChange={ setExcerpt }\n\t\t\ttagName=\"p\"\n\t\t/>\n\t) : (\n\t\t<p className={ excerptClassName }>\n\t\t\t{ strippedRenderedExcerpt || __( 'No post excerpt found' ) }\n\t\t</p>\n\t);\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<AlignmentToolbar\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( newAlign ) =>\n\t\t\t\t\t\tsetAttributes( { textAlign: newAlign } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Post Excerpt Settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Show link on new line' ) }\n\t\t\t\t\t\tchecked={ showMoreOnNewLine }\n\t\t\t\t\t\tonChange={ ( newShowMoreOnNewLine ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowMoreOnNewLine: newShowMoreOnNewLine,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ excerptContent }\n\t\t\t\t{ ! showMoreOnNewLine && ' ' }\n\t\t\t\t{ showMoreOnNewLine ? (\n\t\t\t\t\t<p className=\"wp-block-post-excerpt__more-text\">\n\t\t\t\t\t\t{ readMoreLink }\n\t\t\t\t\t</p>\n\t\t\t\t) : (\n\t\t\t\t\treadMoreLink\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-excerpt/edit.js"],"names":["classnames","useEntityProp","useMemo","AlignmentToolbar","BlockControls","InspectorControls","RichText","Warning","useBlockProps","PanelBody","ToggleControl","__","useCanEditEntity","PostExcerptEditor","attributes","textAlign","moreText","showMoreOnNewLine","setAttributes","isSelected","context","postId","postType","queryId","isDescendentOfQueryLoop","Number","isFinite","userCanEdit","isEditable","rawExcerpt","setExcerpt","rendered","renderedExcerpt","protected","isProtected","blockProps","className","strippedRenderedExcerpt","document","window","DOMParser","parseFromString","body","textContent","innerText","readMoreLink","newMoreText","excerptClassName","excerptContent","newAlign","newShowMoreOnNewLine"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,aAAT,QAA8B,sBAA9B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SACC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ARZ;AASC,IAAA,OAAO,EAAC;AATT,IADgC,GAahC;AAAG,IAAA,SAAS,EAAGiB;AAAf,KACGV,uBAAuB,IAAI1B,EAAE,CAAE,uBAAF,CADhC,CAbD;AAiBA,SACC,8BACC,cAAC,aAAD,QACC,cAAC,gBAAD;AACC,IAAA,KAAK,EAAGI,SADT;AAEC,IAAA,QAAQ,EAAKkC,QAAF,IACV/B,aAAa,CAAE;AAAEH,MAAAA,SAAS,EAAEkC;AAAb,KAAF;AAHf,IADD,CADD,EASC,cAAC,iBAAD,QACC,cAAC,SAAD;AAAW,IAAA,KAAK,EAAGtC,EAAE,CAAE,uBAAF;AAArB,KACC,cAAC,aAAD;AACC,IAAA,KAAK,EAAGA,EAAE,CAAE,uBAAF,CADX;AAEC,IAAA,OAAO,EAAGM,iBAFX;AAGC,IAAA,QAAQ,EAAKiC,oBAAF,IACVhC,aAAa,CAAE;AACdD,MAAAA,iBAAiB,EAAEiC;AADL,KAAF;AAJf,IADD,CADD,CATD,EAsBC,qBAAUf,UAAV,EACGa,cADH,EAEG,CAAE/B,iBAAF,IAAuB,GAF1B,EAGGA,iBAAiB,GAClB;AAAG,IAAA,SAAS,EAAC;AAAb,KACG4B,YADH,CADkB,GAKlBA,YARF,CAtBD,CADD;AAoCA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport {\n\tAlignmentToolbar,\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\tWarning,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { PanelBody, ToggleControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useCanEditEntity } from '../utils/hooks';\n\nexport default function PostExcerptEditor( {\n\tattributes: { textAlign, moreText, showMoreOnNewLine },\n\tsetAttributes,\n\tisSelected,\n\tcontext: { postId, postType, queryId },\n} ) {\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst userCanEdit = useCanEditEntity( 'postType', postType, postId );\n\tconst isEditable = userCanEdit && ! isDescendentOfQueryLoop;\n\tconst [\n\t\trawExcerpt,\n\t\tsetExcerpt,\n\t\t{ rendered: renderedExcerpt, protected: isProtected } = {},\n\t] = useEntityProp( 'postType', postType, 'excerpt', postId );\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\t/**\n\t * When excerpt is editable, strip the html tags from\n\t * rendered excerpt. This will be used if the entity's\n\t * excerpt has been produced from the content.\n\t */\n\tconst strippedRenderedExcerpt = useMemo( () => {\n\t\tif ( ! renderedExcerpt ) return '';\n\t\tconst document = new window.DOMParser().parseFromString(\n\t\t\trenderedExcerpt,\n\t\t\t'text/html'\n\t\t);\n\t\treturn document.body.textContent || document.body.innerText || '';\n\t}, [ renderedExcerpt ] );\n\tif ( ! postType || ! postId ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<p>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'This is the Post Excerpt block, it will display the excerpt from single posts.'\n\t\t\t\t\t) }\n\t\t\t\t</p>\n\t\t\t\t<p>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'If there are any Custom Post Types with support for excerpts, the Post Excerpt block can display the excerpts of those entries as well.'\n\t\t\t\t\t) }\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t);\n\t}\n\tif ( isProtected && ! userCanEdit ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'There is no excerpt because this is a protected post.'\n\t\t\t\t\t) }\n\t\t\t\t</Warning>\n\t\t\t</div>\n\t\t);\n\t}\n\tconst readMoreLink = (\n\t\t<RichText\n\t\t\tclassName=\"wp-block-post-excerpt__more-link\"\n\t\t\ttagName=\"a\"\n\t\t\taria-label={ __( '\"Read more\" link text' ) }\n\t\t\tplaceholder={ __( 'Add \"read more\" link text' ) }\n\t\t\tvalue={ moreText }\n\t\t\tonChange={ ( newMoreText ) =>\n\t\t\t\tsetAttributes( { moreText: newMoreText } )\n\t\t\t}\n\t\t\twithoutInteractiveFormatting={ true }\n\t\t/>\n\t);\n\tconst excerptClassName = classnames( 'wp-block-post-excerpt__excerpt', {\n\t\t'is-inline': ! showMoreOnNewLine,\n\t} );\n\tconst excerptContent = isEditable ? (\n\t\t<RichText\n\t\t\tclassName={ excerptClassName }\n\t\t\taria-label={ __( 'Post excerpt text' ) }\n\t\t\tvalue={\n\t\t\t\trawExcerpt ||\n\t\t\t\tstrippedRenderedExcerpt ||\n\t\t\t\t( isSelected ? '' : __( 'No post excerpt found' ) )\n\t\t\t}\n\t\t\tonChange={ setExcerpt }\n\t\t\ttagName=\"p\"\n\t\t/>\n\t) : (\n\t\t<p className={ excerptClassName }>\n\t\t\t{ strippedRenderedExcerpt || __( 'No post excerpt found' ) }\n\t\t</p>\n\t);\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<AlignmentToolbar\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( newAlign ) =>\n\t\t\t\t\t\tsetAttributes( { textAlign: newAlign } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Post Excerpt Settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Show link on new line' ) }\n\t\t\t\t\t\tchecked={ showMoreOnNewLine }\n\t\t\t\t\t\tonChange={ ( newShowMoreOnNewLine ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowMoreOnNewLine: newShowMoreOnNewLine,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ excerptContent }\n\t\t\t\t{ ! showMoreOnNewLine && ' ' }\n\t\t\t\t{ showMoreOnNewLine ? (\n\t\t\t\t\t<p className=\"wp-block-post-excerpt__more-text\">\n\t\t\t\t\t\t{ readMoreLink }\n\t\t\t\t\t</p>\n\t\t\t\t) : (\n\t\t\t\t\treadMoreLink\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"]}
@@ -112,11 +112,15 @@
112
112
  .wp-block-post-comments .comment-meta {
113
113
  font-size: 0.875em;
114
114
  line-height: 1.5;
115
- margin-right: -3.25em;
116
115
  }
117
116
  .wp-block-post-comments .comment-meta b {
118
117
  font-weight: normal;
119
118
  }
119
+ .wp-block-post-comments .comment-meta .comment-awaiting-moderation {
120
+ margin-top: 1em;
121
+ margin-bottom: 1em;
122
+ display: block;
123
+ }
120
124
  .wp-block-post-comments .comment-body .commentmetadata {
121
125
  font-size: 0.875em;
122
126
  }
@@ -112,11 +112,15 @@
112
112
  .wp-block-post-comments .comment-meta {
113
113
  font-size: 0.875em;
114
114
  line-height: 1.5;
115
- margin-left: -3.25em;
116
115
  }
117
116
  .wp-block-post-comments .comment-meta b {
118
117
  font-weight: normal;
119
118
  }
119
+ .wp-block-post-comments .comment-meta .comment-awaiting-moderation {
120
+ margin-top: 1em;
121
+ margin-bottom: 1em;
122
+ display: block;
123
+ }
120
124
  .wp-block-post-comments .comment-body .commentmetadata {
121
125
  font-size: 0.875em;
122
126
  }
@@ -2139,11 +2139,15 @@ p.has-background {
2139
2139
  .wp-block-post-comments .comment-meta {
2140
2140
  font-size: 0.875em;
2141
2141
  line-height: 1.5;
2142
- margin-right: -3.25em;
2143
2142
  }
2144
2143
  .wp-block-post-comments .comment-meta b {
2145
2144
  font-weight: normal;
2146
2145
  }
2146
+ .wp-block-post-comments .comment-meta .comment-awaiting-moderation {
2147
+ margin-top: 1em;
2148
+ margin-bottom: 1em;
2149
+ display: block;
2150
+ }
2147
2151
  .wp-block-post-comments .comment-body .commentmetadata {
2148
2152
  font-size: 0.875em;
2149
2153
  }
@@ -2165,11 +2165,15 @@ p.has-background {
2165
2165
  .wp-block-post-comments .comment-meta {
2166
2166
  font-size: 0.875em;
2167
2167
  line-height: 1.5;
2168
- margin-left: -3.25em;
2169
2168
  }
2170
2169
  .wp-block-post-comments .comment-meta b {
2171
2170
  font-weight: normal;
2172
2171
  }
2172
+ .wp-block-post-comments .comment-meta .comment-awaiting-moderation {
2173
+ margin-top: 1em;
2174
+ margin-bottom: 1em;
2175
+ display: block;
2176
+ }
2173
2177
  .wp-block-post-comments .comment-body .commentmetadata {
2174
2178
  font-size: 0.875em;
2175
2179
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-library",
3
- "version": "7.3.4",
3
+ "version": "7.3.5",
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": "1fdd4758150247d6b690051aed18fa27c15f3a32"
77
+ "gitHead": "7efc8349abd18322bd93f318269ed2eaba25bcd8"
78
78
  }
@@ -44,11 +44,14 @@
44
44
  .comment-meta {
45
45
  font-size: 0.875em;
46
46
  line-height: 1.5;
47
- margin-left: -3.25em;
48
-
49
47
  b {
50
48
  font-weight: normal;
51
49
  }
50
+ .comment-awaiting-moderation {
51
+ margin-top: 1em;
52
+ margin-bottom: 1em;
53
+ display: block;
54
+ }
52
55
  }
53
56
 
54
57
  .comment-body .commentmetadata {
@@ -57,7 +57,20 @@ export default function PostExcerptEditor( {
57
57
  return document.body.textContent || document.body.innerText || '';
58
58
  }, [ renderedExcerpt ] );
59
59
  if ( ! postType || ! postId ) {
60
- return <div { ...blockProps }>{ __( 'Post Excerpt' ) }</div>;
60
+ return (
61
+ <div { ...blockProps }>
62
+ <p>
63
+ { __(
64
+ 'This is the Post Excerpt block, it will display the excerpt from single posts.'
65
+ ) }
66
+ </p>
67
+ <p>
68
+ { __(
69
+ 'If there are any Custom Post Types with support for excerpts, the Post Excerpt block can display the excerpts of those entries as well.'
70
+ ) }
71
+ </p>
72
+ </div>
73
+ );
61
74
  }
62
75
  if ( isProtected && ! userCanEdit ) {
63
76
  return (