@wordpress/block-library 6.0.17 → 6.0.18
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/columns/index.js +1 -2
- package/build/columns/index.js.map +1 -1
- package/build/navigation/index.js +1 -5
- package/build/navigation/index.js.map +1 -1
- package/build/post-author/edit.js +1 -1
- package/build/post-author/edit.js.map +1 -1
- package/build/post-content/edit.js +1 -1
- package/build/post-content/edit.js.map +1 -1
- package/build/post-date/edit.js +1 -1
- package/build/post-date/edit.js.map +1 -1
- package/build/post-excerpt/edit.js +1 -1
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +1 -1
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-title/edit.js +1 -1
- package/build/post-title/edit.js.map +1 -1
- package/build/site-logo/edit.js +108 -10
- package/build/site-logo/edit.js.map +1 -1
- package/build/site-logo/index.js +5 -1
- package/build/site-logo/index.js.map +1 -1
- package/build/template-part/index.js +25 -1
- package/build/template-part/index.js.map +1 -1
- package/build-module/columns/index.js +1 -2
- package/build-module/columns/index.js.map +1 -1
- package/build-module/navigation/index.js +1 -5
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/post-author/edit.js +1 -1
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-content/edit.js +1 -1
- package/build-module/post-content/edit.js.map +1 -1
- package/build-module/post-date/edit.js +1 -1
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-excerpt/edit.js +1 -1
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +1 -1
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-title/edit.js +1 -1
- package/build-module/post-title/edit.js.map +1 -1
- package/build-module/site-logo/edit.js +109 -11
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/site-logo/index.js +5 -1
- package/build-module/site-logo/index.js.map +1 -1
- package/build-module/template-part/index.js +25 -1
- package/build-module/template-part/index.js.map +1 -1
- package/build-style/editor-rtl.css +18 -8
- package/build-style/editor.css +18 -8
- package/build-style/navigation/editor-rtl.css +13 -6
- package/build-style/navigation/editor.css +13 -6
- package/package.json +7 -7
- package/src/columns/block.json +1 -2
- package/src/editor.scss +5 -2
- package/src/navigation/block.json +1 -11
- package/src/navigation/editor.scss +18 -8
- package/src/post-author/edit.js +1 -1
- package/src/post-content/edit.js +1 -1
- package/src/post-content/index.php +6 -1
- package/src/post-date/edit.js +1 -1
- package/src/post-excerpt/edit.js +1 -1
- package/src/post-excerpt/index.php +1 -1
- package/src/post-featured-image/edit.js +1 -1
- package/src/post-title/edit.js +1 -1
- package/src/post-title/index.php +1 -1
- package/src/site-logo/block.json +5 -1
- package/src/site-logo/edit.js +124 -7
- package/src/site-logo/index.php +17 -0
- package/src/template-part/index.js +28 -0
package/build/columns/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/columns/index.js"],"names":["name","metadata","settings","icon","variations","example","viewportWidth","innerBlocks","attributes","content","url","deprecated","edit","save","transforms"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAEA;;AACA;;AACA;;AAdA;AACA;AACA;;AAIA;AACA;AACA
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/columns/index.js"],"names":["name","metadata","settings","icon","variations","example","viewportWidth","innerBlocks","attributes","content","url","deprecated","edit","save","transforms"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAEA;;AACA;;AACA;;AAdA;AACA;AACA;;AAIA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAIO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,cADuB;AAEvBC,EAAAA,UAAU,EAAVA,mBAFuB;AAGvBC,EAAAA,OAAO,EAAE;AACRC,IAAAA,aAAa,EAAE,GADP;AACY;AACpBC,IAAAA,WAAW,EAAE,CACZ;AACCP,MAAAA,IAAI,EAAE,aADP;AAECO,MAAAA,WAAW,EAAE,CACZ;AACCP,QAAAA,IAAI,EAAE,gBADP;AAECQ,QAAAA,UAAU,EAAE;AACX;AACAC,UAAAA,OAAO,EAAE,cACR,qFADQ;AAFE;AAFb,OADY,EAUZ;AACCT,QAAAA,IAAI,EAAE,YADP;AAECQ,QAAAA,UAAU,EAAE;AACXE,UAAAA,GAAG,EACF;AAFU;AAFb,OAVY,EAiBZ;AACCV,QAAAA,IAAI,EAAE,gBADP;AAECQ,QAAAA,UAAU,EAAE;AACX;AACAC,UAAAA,OAAO,EAAE,cACR,6DADQ;AAFE;AAFb,OAjBY;AAFd,KADY,EA+BZ;AACCT,MAAAA,IAAI,EAAE,aADP;AAECO,MAAAA,WAAW,EAAE,CACZ;AACCP,QAAAA,IAAI,EAAE,gBADP;AAECQ,QAAAA,UAAU,EAAE;AACX;AACAC,UAAAA,OAAO,EAAE,cACR,+JADQ;AAFE;AAFb,OADY,EAUZ;AACCT,QAAAA,IAAI,EAAE,gBADP;AAECQ,QAAAA,UAAU,EAAE;AACX;AACAC,UAAAA,OAAO,EAAE,cACR,yGADQ;AAFE;AAFb,OAVY;AAFd,KA/BY;AAFL,GAHc;AA6DvBE,EAAAA,UAAU,EAAVA,mBA7DuB;AA8DvBC,EAAAA,IAAI,EAAJA,aA9DuB;AA+DvBC,EAAAA,IAAI,EAAJA,aA/DuB;AAgEvBC,EAAAA,UAAU,EAAVA;AAhEuB,CAAjB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { columns as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport variations from './variations';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tvariations,\n\texample: {\n\t\tviewportWidth: 600, // Columns collapse \"@media (max-width: 599px)\".\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/column',\n\t\t\t\tinnerBlocks: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'core/paragraph',\n\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t/* translators: example text. */\n\t\t\t\t\t\t\tcontent: __(\n\t\t\t\t\t\t\t\t'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent et eros eu felis.'\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\t{\n\t\t\t\t\t\tname: 'core/image',\n\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\turl:\n\t\t\t\t\t\t\t\t'https://s.w.org/images/core/5.3/Windbuchencom.jpg',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'core/paragraph',\n\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t/* translators: example text. */\n\t\t\t\t\t\t\tcontent: __(\n\t\t\t\t\t\t\t\t'Suspendisse commodo neque lacus, a dictum orci interdum et.'\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],\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/column',\n\t\t\t\tinnerBlocks: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'core/paragraph',\n\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t/* translators: example text. */\n\t\t\t\t\t\t\tcontent: __(\n\t\t\t\t\t\t\t\t'Etiam et egestas lorem. Vivamus sagittis sit amet dolor quis lobortis. Integer sed fermentum arcu, id vulputate lacus. Etiam fermentum sem eu quam hendrerit.'\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\t{\n\t\t\t\t\t\tname: 'core/paragraph',\n\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t/* translators: example text. */\n\t\t\t\t\t\t\tcontent: __(\n\t\t\t\t\t\t\t\t'Nam risus massa, ullamcorper consectetur eros fermentum, porta aliquet ligula. Sed vel mauris nec enim.'\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],\n\t\t\t},\n\t\t],\n\t},\n\tdeprecated,\n\tedit,\n\tsave,\n\ttransforms,\n};\n"]}
|
|
@@ -117,11 +117,7 @@ const metadata = {
|
|
|
117
117
|
}
|
|
118
118
|
},
|
|
119
119
|
spacing: {
|
|
120
|
-
|
|
121
|
-
units: ["px", "em", "rem", "vh", "vw"],
|
|
122
|
-
__experimentalDefaultControls: {
|
|
123
|
-
blockGap: true
|
|
124
|
-
}
|
|
120
|
+
units: ["px", "em", "rem", "vh", "vw"]
|
|
125
121
|
},
|
|
126
122
|
__experimentalLayout: {
|
|
127
123
|
allowSwitching: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/navigation/index.js"],"names":["name","metadata","settings","icon","example","innerBlocks","attributes","label","url","edit","save","deprecated"],"mappings":";;;;;;;;;AAGA;;AACA;;AAMA;;AACA;;AACA;;AAZA;AACA;AACA;;AAIA;AACA;AACA
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/navigation/index.js"],"names":["name","metadata","settings","icon","example","innerBlocks","attributes","label","url","edit","save","deprecated"],"mappings":";;;;;;;;;AAGA;;AACA;;AAMA;;AACA;;AACA;;AAZA;AACA;AACA;;AAIA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAIO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,iBADuB;AAEvBC,EAAAA,OAAO,EAAE;AACRC,IAAAA,WAAW,EAAE,CACZ;AACCL,MAAAA,IAAI,EAAE,sBADP;AAECM,MAAAA,UAAU,EAAE;AACX;AACAC,QAAAA,KAAK,EAAE,cAAI,MAAJ,CAFI;AAGXC,QAAAA,GAAG,EAAE;AAHM;AAFb,KADY,EASZ;AACCR,MAAAA,IAAI,EAAE,sBADP;AAECM,MAAAA,UAAU,EAAE;AACX;AACAC,QAAAA,KAAK,EAAE,cAAI,OAAJ,CAFI;AAGXC,QAAAA,GAAG,EAAE;AAHM;AAFb,KATY,EAiBZ;AACCR,MAAAA,IAAI,EAAE,sBADP;AAECM,MAAAA,UAAU,EAAE;AACX;AACAC,QAAAA,KAAK,EAAE,cAAI,SAAJ,CAFI;AAGXC,QAAAA,GAAG,EAAE;AAHM;AAFb,KAjBY;AADL,GAFc;AA8BvBC,EAAAA,IAAI,EAAJA,aA9BuB;AA+BvBC,EAAAA,IAAI,EAAJA,aA/BuB;AAgCvBC,EAAAA,UAAU,EAAVA;AAhCuB,CAAjB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { navigation as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/navigation-link',\n\t\t\t\tattributes: {\n\t\t\t\t\t// translators: 'Home' as in a website's home page.\n\t\t\t\t\tlabel: __( 'Home' ),\n\t\t\t\t\turl: 'https://make.wordpress.org/',\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/navigation-link',\n\t\t\t\tattributes: {\n\t\t\t\t\t// translators: 'About' as in a website's about page.\n\t\t\t\t\tlabel: __( 'About' ),\n\t\t\t\t\turl: 'https://make.wordpress.org/',\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/navigation-link',\n\t\t\t\tattributes: {\n\t\t\t\t\t// translators: 'Contact' as in a website's contact page.\n\t\t\t\t\tlabel: __( 'Contact' ),\n\t\t\t\t\turl: 'https://make.wordpress.org/',\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\tedit,\n\tsave,\n\tdeprecated,\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/post-author/edit.js"],"names":["PostAuthorEdit","isSelected","context","postType","postId","queryId","attributes","setAttributes","isDescendentOfQueryLoop","authorId","authorDetails","authors","select","getEditedEntityRecord","getUser","getUsers","coreStore","_authorId","author","who","editEntityRecord","textAlign","showAvatar","showBio","byline","avatarSizes","avatar_urls","url","size","push","value","label","blockProps","className","length","map","id","name","nextAuthorId","avatarSize","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/post-author/edit.js"],"names":["PostAuthorEdit","isSelected","context","postType","postId","queryId","attributes","setAttributes","isDescendentOfQueryLoop","Number","isFinite","authorId","authorDetails","authors","select","getEditedEntityRecord","getUser","getUsers","coreStore","_authorId","author","who","editEntityRecord","textAlign","showAvatar","showBio","byline","avatarSizes","avatar_urls","url","size","push","value","label","blockProps","className","length","map","id","name","nextAuthorId","avatarSize","nextAlign","RichText","isEmpty","description"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AAOA;;AACA;;AACA;;AACA;;AAnBA;AACA;AACA;;AAIA;AACA;AACA;AAaA,SAASA,cAAT,OAKI;AAAA,MALqB;AACxBC,IAAAA,UADwB;AAExBC,IAAAA,OAAO,EAAE;AAAEC,MAAAA,QAAF;AAAYC,MAAAA,MAAZ;AAAoBC,MAAAA;AAApB,KAFe;AAGxBC,IAAAA,UAHwB;AAIxBC,IAAAA;AAJwB,GAKrB;AACH,QAAMC,uBAAuB,GAAGC,MAAM,CAACC,QAAP,CAAiBL,OAAjB,CAAhC;AACA,QAAM;AAAEM,IAAAA,QAAF;AAAYC,IAAAA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,aADH,uBACGA,aAAa,CAAEiC,WADlB,CAjBF,CAdD,CA/DD,CADD;AAuGA;;eAEc7C,c","sourcesContent":["/**\n * External dependencies\n */\nimport { forEach } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { PanelBody, SelectControl, ToggleControl } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\nfunction PostAuthorEdit( {\n\tisSelected,\n\tcontext: { postType, postId, queryId },\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst { authorId, authorDetails, authors } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, getUser, getUsers } = select(\n\t\t\t\tcoreStore\n\t\t\t);\n\t\t\tconst _authorId = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t)?.author;\n\n\t\t\treturn {\n\t\t\t\tauthorId: _authorId,\n\t\t\t\tauthorDetails: _authorId ? getUser( _authorId ) : null,\n\t\t\t\tauthors: getUsers( { who: 'authors' } ),\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\n\tconst { textAlign, showAvatar, showBio, byline } = attributes;\n\n\tconst avatarSizes = [];\n\tif ( authorDetails ) {\n\t\tforEach( authorDetails.avatar_urls, ( url, size ) => {\n\t\t\tavatarSizes.push( {\n\t\t\t\tvalue: size,\n\t\t\t\tlabel: `${ size } x ${ size }`,\n\t\t\t} );\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\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Author Settings' ) }>\n\t\t\t\t\t{ ! isDescendentOfQueryLoop && !! authors?.length && (\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\tlabel={ __( 'Author' ) }\n\t\t\t\t\t\t\tvalue={ authorId }\n\t\t\t\t\t\t\toptions={ authors.map( ( { id, name } ) => {\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\tvalue: id,\n\t\t\t\t\t\t\t\t\tlabel: name,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\tonChange={ ( nextAuthorId ) => {\n\t\t\t\t\t\t\t\teditEntityRecord(\n\t\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\t\tpostType,\n\t\t\t\t\t\t\t\t\tpostId,\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tauthor: nextAuthorId,\n\t\t\t\t\t\t\t\t\t}\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) }\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Show avatar' ) }\n\t\t\t\t\t\tchecked={ showAvatar }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showAvatar: ! showAvatar } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t{ showAvatar && (\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\tlabel={ __( 'Avatar size' ) }\n\t\t\t\t\t\t\tvalue={ attributes.avatarSize }\n\t\t\t\t\t\t\toptions={ avatarSizes }\n\t\t\t\t\t\t\tonChange={ ( size ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tavatarSize: Number( size ),\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) }\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Show bio' ) }\n\t\t\t\t\t\tchecked={ showBio }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showBio: ! showBio } )\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\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{ showAvatar && authorDetails && (\n\t\t\t\t\t<div className=\"wp-block-post-author__avatar\">\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\twidth={ attributes.avatarSize }\n\t\t\t\t\t\t\tsrc={\n\t\t\t\t\t\t\t\tauthorDetails.avatar_urls[\n\t\t\t\t\t\t\t\t\tattributes.avatarSize\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\talt={ authorDetails.name }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<div className=\"wp-block-post-author__content\">\n\t\t\t\t\t{ ( ! RichText.isEmpty( byline ) || isSelected ) && (\n\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\tclassName=\"wp-block-post-author__byline\"\n\t\t\t\t\t\t\tmultiline={ false }\n\t\t\t\t\t\t\taria-label={ __( 'Post author byline text' ) }\n\t\t\t\t\t\t\tplaceholder={ __( 'Write byline…' ) }\n\t\t\t\t\t\t\tvalue={ byline }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { byline: value } )\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\t<p className=\"wp-block-post-author__name\">\n\t\t\t\t\t\t{ authorDetails?.name || __( 'Post Author' ) }\n\t\t\t\t\t</p>\n\t\t\t\t\t{ showBio && (\n\t\t\t\t\t\t<p className=\"wp-block-post-author__bio\">\n\t\t\t\t\t\t\t{ authorDetails?.description }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default PostAuthorEdit;\n"]}
|
|
@@ -78,7 +78,7 @@ function Content(props) {
|
|
|
78
78
|
postId
|
|
79
79
|
} = {}
|
|
80
80
|
} = props;
|
|
81
|
-
const isDescendentOfQueryLoop =
|
|
81
|
+
const isDescendentOfQueryLoop = Number.isFinite(queryId);
|
|
82
82
|
const userCanEdit = (0, _hooks.useCanEditEntity)('postType', postType, postId);
|
|
83
83
|
const isEditable = userCanEdit && !isDescendentOfQueryLoop;
|
|
84
84
|
return isEditable ? (0, _element.createElement)(EditableContent, props) : (0, _element.createElement)(ReadOnlyContent, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/post-content/edit.js"],"names":["ReadOnlyContent","userCanEdit","postType","postId","content","blockProps","protected","rendered","EditableContent","layout","context","themeSupportsLayout","select","getSettings","blockEditorStore","supportsLayout","defaultLayout","usedLayout","inherit","blocks","onInput","onChange","id","props","className","value","__experimentalLayout","undefined","Content","queryId","isDescendentOfQueryLoop","isEditable","Placeholder","RecursionError","PostContentEdit","attributes","contextPostId","contextPostType","hasAlreadyRendered","RecursionProvider"],"mappings":";;;;;;;AAKA;;AAFA;;AACA;;AAEA;;AAQA;;AAKA;;AAnBA;AACA;AACA;;AAcA;AACA;AACA;AAGA,SAASA,eAAT,OAA8D;AAAA,MAApC;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,QAAf;AAAyBC,IAAAA;AAAzB,GAAoC;AAC7D,QAAM,IAAMC,OAAN,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CC,IAAAA,QAHD;AAICK,IAAAA,oBAAoB,EAAEf,mBAAmB,GAAGM,UAAH,GAAgBU;AAJ1D,GAFa,CAAd;AASA,SAAO,mCAAUJ,KAAV,CAAP;AACA;;AAED,SAASK,OAAT,CAAkBL,KAAlB,EAA0B;AACzB,QAAM;AAAEb,IAAAA,OAAO,EAAE;AAAEmB,MAAAA,OAAF;AAAW3B,MAAAA,QAAX;AAAqBC,MAAAA;AAArB,QAAgC;AAA3C,MAAkDoB,KAAxD;AACA,QAAMO,uBAAuB,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/post-content/edit.js"],"names":["ReadOnlyContent","userCanEdit","postType","postId","content","blockProps","protected","rendered","EditableContent","layout","context","themeSupportsLayout","select","getSettings","blockEditorStore","supportsLayout","defaultLayout","usedLayout","inherit","blocks","onInput","onChange","id","props","className","value","__experimentalLayout","undefined","Content","queryId","isDescendentOfQueryLoop","Number","isFinite","isEditable","Placeholder","RecursionError","PostContentEdit","attributes","contextPostId","contextPostType","hasAlreadyRendered","RecursionProvider"],"mappings":";;;;;;;AAKA;;AAFA;;AACA;;AAEA;;AAQA;;AAKA;;AAnBA;AACA;AACA;;AAcA;AACA;AACA;AAGA,SAASA,eAAT,OAA8D;AAAA,MAApC;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,QAAf;AAAyBC,IAAAA;AAAzB,GAAoC;AAC7D,QAAM,IAAMC,OAAN,IAAkB,6BACvB,UADuB,EAEvBF,QAFuB,EAGvB,SAHuB,EAIvBC,MAJuB,CAAxB;AAMA,QAAME,UAAU,GAAG,iCAAnB;AACA,SAAOD,OAAO,SAAP,IAAAA,OAAO,WAAP,IAAAA,OAAO,CAAEE,SAAT,IAAsB,CAAEL,WAAxB,GACN,mCAAUI,UAAV,EACC,4BAAC,oBAAD,QAAW,cAAI,qCAAJ,CAAX,CADD,CADM,GAKN,mCAAUA,UAAV,EACC,4BAAC,gBAAD;AAAS,IAAA,GAAG,EAAC;AAAb,KAAsBD,OAAt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**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { RawHTML } from '@wordpress/element';\nimport {\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tuseSetting,\n\t__experimentalUseNoRecursiveRenders as useNoRecursiveRenders,\n\tstore as blockEditorStore,\n\tWarning,\n} from '@wordpress/block-editor';\nimport { useEntityProp, useEntityBlockEditor } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useCanEditEntity } from '../utils/hooks';\n\nfunction ReadOnlyContent( { userCanEdit, postType, postId } ) {\n\tconst [ , , content ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'content',\n\t\tpostId\n\t);\n\tconst blockProps = useBlockProps();\n\treturn content?.protected && ! userCanEdit ? (\n\t\t<div { ...blockProps }>\n\t\t\t<Warning>{ __( 'This content is password protected.' ) }</Warning>\n\t\t</div>\n\t) : (\n\t\t<div { ...blockProps }>\n\t\t\t<RawHTML key=\"html\">{ content?.rendered }</RawHTML>\n\t\t</div>\n\t);\n}\n\nfunction EditableContent( { layout, context = {} } ) {\n\tconst { postType, postId } = context;\n\tconst themeSupportsLayout = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings()?.supportsLayout;\n\t}, [] );\n\tconst defaultLayout = useSetting( 'layout' ) || {};\n\tconst usedLayout = !! layout && layout.inherit ? defaultLayout : layout;\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\tpostType,\n\t\t{ id: postId }\n\t);\n\n\tconst props = useInnerBlocksProps(\n\t\tuseBlockProps( { className: 'entry-content' } ),\n\t\t{\n\t\t\tvalue: blocks,\n\t\t\tonInput,\n\t\t\tonChange,\n\t\t\t__experimentalLayout: themeSupportsLayout ? usedLayout : undefined,\n\t\t}\n\t);\n\treturn <div { ...props } />;\n}\n\nfunction Content( props ) {\n\tconst { context: { queryId, postType, postId } = {} } = props;\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst userCanEdit = useCanEditEntity( 'postType', postType, postId );\n\tconst isEditable = userCanEdit && ! isDescendentOfQueryLoop;\n\n\treturn isEditable ? (\n\t\t<EditableContent { ...props } />\n\t) : (\n\t\t<ReadOnlyContent\n\t\t\tuserCanEdit={ userCanEdit }\n\t\t\tpostType={ postType }\n\t\t\tpostId={ postId }\n\t\t/>\n\t);\n}\n\nfunction Placeholder() {\n\tconst blockProps = useBlockProps();\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<p>{ __( 'Post Content' ) }</p>\n\t\t</div>\n\t);\n}\n\nfunction RecursionError() {\n\tconst blockProps = useBlockProps();\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<Warning>\n\t\t\t\t{ __( 'Block cannot be rendered inside itself.' ) }\n\t\t\t</Warning>\n\t\t</div>\n\t);\n}\n\nexport default function PostContentEdit( { context, attributes } ) {\n\tconst { postId: contextPostId, postType: contextPostType } = context;\n\tconst { layout = {} } = attributes;\n\tconst [ hasAlreadyRendered, RecursionProvider ] = useNoRecursiveRenders(\n\t\tcontextPostId\n\t);\n\n\tif ( contextPostId && contextPostType && hasAlreadyRendered ) {\n\t\treturn <RecursionError />;\n\t}\n\n\treturn (\n\t\t<RecursionProvider>\n\t\t\t{ contextPostId && contextPostType ? (\n\t\t\t\t<Content context={ context } layout={ layout } />\n\t\t\t) : (\n\t\t\t\t<Placeholder />\n\t\t\t) }\n\t\t</RecursionProvider>\n\t);\n}\n"]}
|
package/build/post-date/edit.js
CHANGED
|
@@ -46,7 +46,7 @@ function PostDateEdit(_ref) {
|
|
|
46
46
|
},
|
|
47
47
|
setAttributes
|
|
48
48
|
} = _ref;
|
|
49
|
-
const isDescendentOfQueryLoop =
|
|
49
|
+
const isDescendentOfQueryLoop = Number.isFinite(queryId);
|
|
50
50
|
const [siteFormat] = (0, _coreData.useEntityProp)('root', 'site', 'date_format');
|
|
51
51
|
const [date, setDate] = (0, _coreData.useEntityProp)('postType', postType, 'date', postId);
|
|
52
52
|
const settings = (0, _date.__experimentalGetSettings)(); // To know if the current time format is a 12 hour time, look for "a".
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/post-date/edit.js"],"names":["PostDateEdit","attributes","textAlign","format","isLink","context","postId","postType","queryId","setAttributes","isDescendentOfQueryLoop","siteFormat","date","setDate","settings","is12Hour","test","formats","time","toLowerCase","replace","split","reverse","join","formatOptions","Object","values","map","formatOption","key","name","resolvedFormat","blockProps","className","timeRef","postDate","event","preventDefault","nextAlign","anchorRef","current","isOpen","onToggle","openOnArrowDown","keyCode","DOWN","edit","selectedItem","find","option"],"mappings":";;;;;;;;;AASA;;AANA;;AAKA;;AAEA;;AACA;;AAMA;;AASA;;AACA;;AACA;;AA5BA;AACA;AACA;;AAGA;AACA;AACA;AAuBe,SAASA,YAAT,OAIX;AAAA,MAJkC;AACrCC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,SAAF;AAAaC,MAAAA,MAAb;AAAqBC,MAAAA;AAArB,KADyB;AAErCC,IAAAA,OAAO,EAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA,QAAV;AAAoBC,MAAAA;AAApB,KAF4B;AAGrCC,IAAAA;AAHqC,GAIlC;AACH,QAAMC,uBAAuB,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/post-date/edit.js"],"names":["PostDateEdit","attributes","textAlign","format","isLink","context","postId","postType","queryId","setAttributes","isDescendentOfQueryLoop","Number","isFinite","siteFormat","date","setDate","settings","is12Hour","test","formats","time","toLowerCase","replace","split","reverse","join","formatOptions","Object","values","map","formatOption","key","name","resolvedFormat","blockProps","className","timeRef","postDate","event","preventDefault","nextAlign","anchorRef","current","isOpen","onToggle","openOnArrowDown","keyCode","DOWN","edit","selectedItem","find","option"],"mappings":";;;;;;;;;AASA;;AANA;;AAKA;;AAEA;;AACA;;AAMA;;AASA;;AACA;;AACA;;AA5BA;AACA;AACA;;AAGA;AACA;AAC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AAA,KAAK,CAACC,cAAN;AACAK,UAAAA,QAAQ;AACR;AACD,OALD;;AAMA,aACC,4BAAC,yBAAD;AACC,yBAAgBD,MADjB;AAEC,QAAA,IAAI,EAAGK,WAFR;AAGC,QAAA,KAAK,EAAG,cAAI,aAAJ,CAHT;AAIC,QAAA,OAAO,EAAGJ,QAJX;AAKC,QAAA,SAAS,EAAGC;AALb,QADD;AASA;AAzBF,IADD,CATF,CADD,EA0CC,4BAAC,8BAAD,QACC,4BAAC,qBAAD;AAAW,IAAA,KAAK,EAAG,cAAI,iBAAJ;AAAnB,KACC,4BAAC,+BAAD;AACC,IAAA,mBAAmB,MADpB;AAEC,IAAA,KAAK,EAAG,cAAI,aAAJ,CAFT;AAGC,IAAA,OAAO,EAAGnB,aAHX;AAIC,IAAA,QAAQ,EAAG;AAAA,UAAE;AAAEuB,QAAAA;AAAF,OAAF;AAAA,aACVxC,aAAa,CAAE;AACdN,QAAAA,MAAM,EAAE8C,YAAY,CAAClB;AADP,OAAF,CADH;AAAA,KAJZ;AASC,IAAA,KAAK,EAAGL,aAAa,CAACwB,IAAd,CACLC,MAAF,IAAcA,MAAM,CAACpB,GAAP,KAAeE,cADtB;AATT,IADD,CADD,EAgBC,4BAAC,qBAAD;AAAW,IAAA,KAAK,EAAG,cAAI,eAAJ;AAAnB,KACC,4BAAC,yBAAD;AACC,IAAA,KAAK,EAAG,oBACP;AACA,kBAAI,YAAJ,CAFO,EAGP1B,QAHO,CADT;AAMC,IAAA,QAAQ,EAAG,MAAME,aAAa,CAAE;AAAEL,MAAAA,MAAM,EAAE,CAAEA;AAAZ,KAAF,CAN/B;AAOC,IAAA,OAAO,EAAGA;AAPX,IADD,CAhBD,CA1CD,EAsEC,mCAAU8B,UAAV,EAAyBG,QAAzB,CAtED,CADD;AA0EA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useRef } from '@wordpress/element';\nimport { __experimentalGetSettings, dateI18n } from '@wordpress/date';\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport {\n\tDropdown,\n\tToolbarGroup,\n\tToolbarButton,\n\tToggleControl,\n\tDateTimePicker,\n\tPanelBody,\n\tCustomSelectControl,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { edit } from '@wordpress/icons';\nimport { DOWN } from '@wordpress/keycodes';\n\nexport default function PostDateEdit( {\n\tattributes: { textAlign, format, isLink },\n\tcontext: { postId, postType, queryId },\n\tsetAttributes,\n} ) {\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst [ siteFormat ] = useEntityProp( 'root', 'site', 'date_format' );\n\tconst [ date, setDate ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'date',\n\t\tpostId\n\t);\n\tconst settings = __experimentalGetSettings();\n\t// To know if the current time format is a 12 hour time, look for \"a\".\n\t// Also make sure this \"a\" is not escaped by a \"/\".\n\tconst is12Hour = /a(?!\\\\)/i.test(\n\t\tsettings.formats.time\n\t\t\t.toLowerCase() // Test only for the lower case \"a\".\n\t\t\t.replace( /\\\\\\\\/g, '' ) // Replace \"//\" with empty strings.\n\t\t\t.split( '' )\n\t\t\t.reverse()\n\t\t\t.join( '' ) // Reverse the string and test for \"a\" not followed by a slash.\n\t);\n\tconst formatOptions = Object.values( settings.formats ).map(\n\t\t( formatOption ) => ( {\n\t\t\tkey: formatOption,\n\t\t\tname: dateI18n( formatOption, date ),\n\t\t} )\n\t);\n\tconst resolvedFormat = format || siteFormat || settings.formats.date;\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 timeRef = useRef();\n\n\tlet postDate = date ? (\n\t\t<time dateTime={ dateI18n( 'c', date ) } ref={ timeRef }>\n\t\t\t{ dateI18n( resolvedFormat, date ) }\n\t\t</time>\n\t) : (\n\t\t__( 'Post Date' )\n\t);\n\tif ( isLink && date ) {\n\t\tpostDate = (\n\t\t\t<a\n\t\t\t\thref=\"#post-date-pseudo-link\"\n\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t>\n\t\t\t\t{ postDate }\n\t\t\t</a>\n\t\t);\n\t}\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\n\t\t\t\t{ date && ! isDescendentOfQueryLoop && (\n\t\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\tpopoverProps={ { anchorRef: timeRef.current } }\n\t\t\t\t\t\t\trenderContent={ () => (\n\t\t\t\t\t\t\t\t<DateTimePicker\n\t\t\t\t\t\t\t\t\tcurrentDate={ date }\n\t\t\t\t\t\t\t\t\tonChange={ setDate }\n\t\t\t\t\t\t\t\t\tis12Hour={ is12Hour }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => {\n\t\t\t\t\t\t\t\tconst openOnArrowDown = ( event ) => {\n\t\t\t\t\t\t\t\t\tif ( ! isOpen && event.keyCode === DOWN ) {\n\t\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\t\tonToggle();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\t\t\t\t\ticon={ edit }\n\t\t\t\t\t\t\t\t\t\ttitle={ __( 'Change Date' ) }\n\t\t\t\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\t\t\t\tonKeyDown={ openOnArrowDown }\n\t\t\t\t\t\t\t\t\t/>\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</ToolbarGroup>\n\t\t\t\t) }\n\t\t\t</BlockControls>\n\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Format settings' ) }>\n\t\t\t\t\t<CustomSelectControl\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\tlabel={ __( 'Date Format' ) }\n\t\t\t\t\t\toptions={ formatOptions }\n\t\t\t\t\t\tonChange={ ( { selectedItem } ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tformat: selectedItem.key,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvalue={ formatOptions.find(\n\t\t\t\t\t\t\t( option ) => option.key === resolvedFormat\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t\t<PanelBody title={ __( 'Link settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"post\".\n\t\t\t\t\t\t\t__( 'Link to %s' ),\n\t\t\t\t\t\t\tpostType\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonChange={ () => setAttributes( { isLink: ! isLink } ) }\n\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>{ postDate }</div>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -47,7 +47,7 @@ function PostExcerptEditor(_ref) {
|
|
|
47
47
|
queryId
|
|
48
48
|
}
|
|
49
49
|
} = _ref;
|
|
50
|
-
const isDescendentOfQueryLoop =
|
|
50
|
+
const isDescendentOfQueryLoop = Number.isFinite(queryId);
|
|
51
51
|
const userCanEdit = (0, _hooks.useCanEditEntity)('postType', postType, postId);
|
|
52
52
|
const isEditable = userCanEdit && !isDescendentOfQueryLoop;
|
|
53
53
|
const [rawExcerpt, setExcerpt, {
|
|
@@ -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","userCanEdit","isEditable","rawExcerpt","setExcerpt","rendered","renderedExcerpt","protected","isProtected","blockProps","className","strippedRenderedExcerpt","document","window","DOMParser","parseFromString","body","textContent","innerText","readMoreLink","newMoreText","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,
|
|
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","excerptContent","newAlign","newShowMoreOnNewLine"],"mappings":";;;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AAAb,KAAF;AAHf,IADD,CADD,EASC,4BAAC,8BAAD,QACC,4BAAC,qBAAD;AAAW,IAAA,KAAK,EAAG,cAAI,uBAAJ;AAAnB,KACC,4BAAC,yBAAD;AACC,IAAA,KAAK,EAAG,cAAI,uBAAJ,CADT;AAEC,IAAA,OAAO,EAAG/B,iBAFX;AAGC,IAAA,QAAQ,EAAKgC,oBAAF,IACV/B,aAAa,CAAE;AACdD,MAAAA,iBAAiB,EAAEgC;AADL,KAAF;AAJf,IADD,CADD,CATD,EAsBC,mCAAUd,UAAV,EACGY,cADH,EAEG,CAAE9B,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, RawHTML } from '@wordpress/element';\nimport {\n\tAlignmentToolbar,\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\tWarning,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { PanelBody, ToggleControl, Disabled } 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 excerptContent = isEditable ? (\n\t\t<RichText\n\t\t\tclassName={\n\t\t\t\t! showMoreOnNewLine &&\n\t\t\t\t'wp-block-post-excerpt__excerpt is-inline'\n\t\t\t}\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/>\n\t) : (\n\t\t( renderedExcerpt && (\n\t\t\t<Disabled>\n\t\t\t\t<RawHTML key=\"html\">{ renderedExcerpt }</RawHTML>\n\t\t\t</Disabled>\n\t\t) ) ||\n\t\t__( 'No post excerpt found' )\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 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/post-featured-image/edit.js"],"names":["placeholderIllustration","ALLOWED_MEDIA_TYPES","placeholderChip","PostFeaturedImageDisplay","attributes","setAttributes","context","postId","postType","queryId","isDescendentOfQueryLoop","isLink","height","width","scale","featuredImage","setFeaturedImage","media","select","coreStore","getMedia","blockProps","style","placeholder","content","onSelectImage","value","id","createErrorNotice","noticesStore","onUploadError","message","type","image","label","open","upload","source_url","alt_text","objectFit","PostFeaturedImageEdit","props"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAMA;;AAOA;;AACA;;AACA;;AACA;;AAKA;;AA1BA;AACA;AACA;;AAqBA;AACA;AACA;AAGA,MAAMA,uBAAuB,GAC5B,4BAAC,eAAD;AACC,EAAA,SAAS,EAAC,sCADX;AAEC,EAAA,IAAI,EAAC,MAFN;AAGC,EAAA,KAAK,EAAC,4BAHP;AAIC,EAAA,OAAO,EAAC,WAJT;AAKC,EAAA,mBAAmB,EAAC;AALrB,GAOC,4BAAC,gBAAD;AAAM,EAAA,YAAY,EAAC,oBAAnB;AAAwC,EAAA,CAAC,EAAC;AAA1C,EAPD,CADD;AAYA,MAAMC,mBAAmB,GAAG,CAAE,OAAF,CAA5B;AACA,MAAMC,eAAe,GACpB;AAAK,EAAA,SAAS,EAAC;AAAf,GACGF,uBADH,CADD;;AAMA,SAASG,wBAAT,OAII;AAAA,MAJ+B;AAClCC,IAAAA,UADkC;AAElCC,IAAAA,aAFkC;AAGlCC,IAAAA,OAAO,EAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA,QAAV;AAAoBC,MAAAA;AAApB;AAHyB,GAI/B;AACH,QAAMC,uBAAuB,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/post-featured-image/edit.js"],"names":["placeholderIllustration","ALLOWED_MEDIA_TYPES","placeholderChip","PostFeaturedImageDisplay","attributes","setAttributes","context","postId","postType","queryId","isDescendentOfQueryLoop","Number","isFinite","isLink","height","width","scale","featuredImage","setFeaturedImage","media","select","coreStore","getMedia","blockProps","style","placeholder","content","onSelectImage","value","id","createErrorNotice","noticesStore","onUploadError","message","type","image","label","open","upload","source_url","alt_text","objectFit","PostFeaturedImageEdit","props"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAMA;;AAOA;;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AAhC,EAAwC;AAAA;;AACtD,QAAMpB,UAAU,GAAG,iCAAnB;;AACA,MAAK,oBAAEoB,KAAK,CAACrC,OAAR,2CAAE,eAAeC,MAAjB,CAAL,EAA+B;AAC9B,WAAO,mCAAUgB,UAAV,EAAyBrB,eAAzB,CAAP;AACA;;AACD,SAAO,4BAAC,wBAAD,EAA+ByC,KAA/B,CAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tToggleControl,\n\tPanelBody,\n\tPlaceholder,\n\tButton,\n} from '@wordpress/components';\nimport {\n\tInspectorControls,\n\tBlockControls,\n\tMediaPlaceholder,\n\tMediaReplaceFlow,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { upload } from '@wordpress/icons';\nimport { SVG, Path } from '@wordpress/primitives';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport DimensionControls from './dimension-controls';\n\nconst placeholderIllustration = (\n\t<SVG\n\t\tclassName=\"components-placeholder__illustration\"\n\t\tfill=\"none\"\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\tviewBox=\"0 0 60 60\"\n\t\tpreserveAspectRatio=\"none\"\n\t>\n\t\t<Path vectorEffect=\"non-scaling-stroke\" d=\"M60 60 0 0\" />\n\t</SVG>\n);\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\nconst placeholderChip = (\n\t<div className=\"wp-block-post-featured-image__placeholder\">\n\t\t{ placeholderIllustration }\n\t</div>\n);\n\nfunction PostFeaturedImageDisplay( {\n\tattributes,\n\tsetAttributes,\n\tcontext: { postId, postType, queryId },\n} ) {\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst { isLink, height, width, scale } = attributes;\n\tconst [ featuredImage, setFeaturedImage ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'featured_media',\n\t\tpostId\n\t);\n\n\tconst media = useSelect(\n\t\t( select ) =>\n\t\t\tfeaturedImage &&\n\t\t\tselect( coreStore ).getMedia( featuredImage, { context: 'view' } ),\n\t\t[ featuredImage ]\n\t);\n\n\tconst blockProps = useBlockProps( {\n\t\tstyle: { width, height },\n\t} );\n\n\tconst placeholder = ( content ) => {\n\t\treturn (\n\t\t\t<Placeholder className=\"block-editor-media-placeholder\">\n\t\t\t\t{ placeholderIllustration }\n\t\t\t\t{ content }\n\t\t\t</Placeholder>\n\t\t);\n\t};\n\n\tconst onSelectImage = ( value ) => {\n\t\tif ( value?.id ) {\n\t\t\tsetFeaturedImage( value.id );\n\t\t}\n\t};\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message[ 2 ], { type: 'snackbar' } );\n\t};\n\n\tlet image;\n\tif ( ! featuredImage && isDescendentOfQueryLoop ) {\n\t\treturn <div { ...blockProps }>{ placeholderChip }</div>;\n\t}\n\n\tconst label = __( 'Add a featured image' );\n\n\tif ( ! featuredImage ) {\n\t\timage = (\n\t\t\t<MediaPlaceholder\n\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\taccept=\"image/*\"\n\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\tonError={ onUploadError }\n\t\t\t\tplaceholder={ placeholder }\n\t\t\t\tmediaLibraryButton={ ( { open } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\ttooltipPosition=\"top center\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\topen();\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} }\n\t\t\t/>\n\t\t);\n\t} else {\n\t\t// We have a Featured image so show a Placeholder if is loading.\n\t\timage = ! media ? (\n\t\t\tplaceholderChip\n\t\t) : (\n\t\t\t<img\n\t\t\t\tsrc={ media.source_url }\n\t\t\t\talt={ media.alt_text || __( 'Featured image' ) }\n\t\t\t\tstyle={ { height, objectFit: height && scale } }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<DimensionControls\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t/>\n\t\t\t\t<PanelBody title={ __( 'Link settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"post\".\n\t\t\t\t\t\t\t__( 'Link to %s' ),\n\t\t\t\t\t\t\tpostType\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonChange={ () => setAttributes( { isLink: ! isLink } ) }\n\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ !! media && ! isDescendentOfQueryLoop && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\t\tmediaId={ featuredImage }\n\t\t\t\t\t\tmediaURL={ media.source_url }\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\taccept=\"image/*\"\n\t\t\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t<figure { ...blockProps }>{ image }</figure>\n\t\t</>\n\t);\n}\n\nexport default function PostFeaturedImageEdit( props ) {\n\tconst blockProps = useBlockProps();\n\tif ( ! props.context?.postId ) {\n\t\treturn <div { ...blockProps }>{ placeholderChip }</div>;\n\t}\n\treturn <PostFeaturedImageDisplay { ...props } />;\n}\n"]}
|
package/build/post-title/edit.js
CHANGED
|
@@ -53,7 +53,7 @@ function PostTitleEdit(_ref) {
|
|
|
53
53
|
}
|
|
54
54
|
} = _ref;
|
|
55
55
|
const TagName = 0 === level ? 'p' : 'h' + level;
|
|
56
|
-
const isDescendentOfQueryLoop =
|
|
56
|
+
const isDescendentOfQueryLoop = Number.isFinite(queryId);
|
|
57
57
|
const userCanEdit = (0, _hooks.useCanEditEntity)('postType', postType, postId);
|
|
58
58
|
const [rawTitle = '', setTitle, fullTitle] = (0, _coreData.useEntityProp)('postType', postType, 'title', postId);
|
|
59
59
|
const [link] = (0, _coreData.useEntityProp)('postType', postType, 'link', postId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/post-title/edit.js"],"names":["PostTitleEdit","attributes","level","textAlign","isLink","rel","linkTarget","setAttributes","context","postType","postId","queryId","TagName","isDescendentOfQueryLoop","userCanEdit","rawTitle","setTitle","fullTitle","link","blockProps","className","titleElement","rendered","length","event","preventDefault","newLevel","nextAlign","value","newRel"],"mappings":";;;;;;;;;AAeA;;;;AAZA;;AAKA;;AAQA;;AACA;;AACA;;AAKA;;AACA;;AAxBA;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;AAIe,SAASA,aAAT,OAIX;AAAA,MAJmC;AACtCC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,KAAF;AAASC,MAAAA,SAAT;AAAoBC,MAAAA,MAApB;AAA4BC,MAAAA,GAA5B;AAAiCC,MAAAA;AAAjC,KAD0B;AAEtCC,IAAAA,aAFsC;AAGtCC,IAAAA,OAAO,EAAE;AAAEC,MAAAA,QAAF;AAAYC,MAAAA,MAAZ;AAAoBC,MAAAA;AAApB;AAH6B,GAInC;AACH,QAAMC,OAAO,GAAG,MAAMV,KAAN,GAAc,GAAd,GAAoB,MAAMA,KAA1C;AACA,QAAMW,uBAAuB,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/post-title/edit.js"],"names":["PostTitleEdit","attributes","level","textAlign","isLink","rel","linkTarget","setAttributes","context","postType","postId","queryId","TagName","isDescendentOfQueryLoop","Number","isFinite","userCanEdit","rawTitle","setTitle","fullTitle","link","blockProps","className","titleElement","rendered","length","event","preventDefault","newLevel","nextAlign","value","newRel"],"mappings":";;;;;;;;;AAeA;;;;AAZA;;AAKA;;AAQA;;AACA;;AACA;;AAKA;;AACA;;AAxBA;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;AAIe,SAASA,aAAT,OAIX;AAAA,MAJmC;AACtCC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,KAAF;AAASC,MAAAA,SAAT;AAAoBC,MAAAA,MAApB;AAA4BC,MAAAA,GAA5B;AAAiCC,MAAAA;AAAjC,KAD0B;AAEtCC,IAAAA,aAFsC;AAGtCC,IAAAA,OAAO,EAAE;AAAEC,MAAAA,QAAF;AAAYC,MAAAA,MAAZ;AAAoBC,MAAAA;AAApB;AAH6B,GAInC;AACH,QAAMC,OAAO,GAAG,MAAMV,KAAN,GAAc,GAAd,GAAoB,MAAMA,KAA1C;AACA,QAAMW,uBAAuB,GAAGC,MAAM,CAACC,QAAP,CAAiBJ,OAAjB,CAAhC;AACA,QAAMK,WAAW,GAAG,6BAAkB,UAAlB,EAA8BP,QAA9B,EAAwCC,MAAxC,CAApB;AACA,QAAM,CAAEO,QAAQ,GAAG,EAAb,EAAiBC,QAAjB,EAA2BC,SAA3B,IAAyC,6BAC9C,UAD8C,EAE9CV,QAF8C,EAG9C,OAH8C,EAI9CC,MAJ8C,CAA/C;AAMA,QAAM,CAAEU,IAAF,IAAW,6BAAe,UAAf,EAA2BX,QAA3B,EAAqC,MAArC,EAA6CC,MAA7C,CAAjB;AACA,QAAMW,UAAU,GAAG,gCAAe;AACjCC,IAAAA,SAAS,EAAE,yBAAY;AACtB,OAAG,kBAAkBnB,SAAW,EAAhC,GAAqCA;AADf,KAAZ;AADsB,GAAf,CAAnB;AAM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AE0B;AAAP,KAAF;AAJf,IAVD,CAPF,CADD,CAfD,EA4CGR,YA5CH,CADD;AAgDA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\tPlainText,\n} from '@wordpress/block-editor';\nimport { RawHTML } from '@wordpress/element';\nimport { ToggleControl, TextControl, PanelBody } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityProp } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport HeadingLevelDropdown from '../heading/heading-level-dropdown';\nimport { useCanEditEntity } from '../utils/hooks';\n\nexport default function PostTitleEdit( {\n\tattributes: { level, textAlign, isLink, rel, linkTarget },\n\tsetAttributes,\n\tcontext: { postType, postId, queryId },\n} ) {\n\tconst TagName = 0 === level ? 'p' : 'h' + level;\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst userCanEdit = useCanEditEntity( 'postType', postType, postId );\n\tconst [ rawTitle = '', setTitle, fullTitle ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'title',\n\t\tpostId\n\t);\n\tconst [ link ] = useEntityProp( 'postType', postType, 'link', postId );\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\tlet titleElement = (\n\t\t<TagName { ...blockProps }>{ __( 'Post Title' ) }</TagName>\n\t);\n\n\tif ( postType && postId ) {\n\t\ttitleElement =\n\t\t\tuserCanEdit && ! isDescendentOfQueryLoop ? (\n\t\t\t\t<PlainText\n\t\t\t\t\ttagName={ TagName }\n\t\t\t\t\tplaceholder={ __( 'No Title' ) }\n\t\t\t\t\tvalue={ rawTitle }\n\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t__experimentalVersion={ 2 }\n\t\t\t\t\t{ ...blockProps }\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t<RawHTML key=\"html\">{ fullTitle?.rendered }</RawHTML>\n\t\t\t\t</TagName>\n\t\t\t);\n\t}\n\n\tif ( isLink && postType && postId ) {\n\t\ttitleElement =\n\t\t\tuserCanEdit && ! isDescendentOfQueryLoop ? (\n\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t<PlainText\n\t\t\t\t\t\ttagName=\"a\"\n\t\t\t\t\t\thref={ link }\n\t\t\t\t\t\ttarget={ linkTarget }\n\t\t\t\t\t\trel={ rel }\n\t\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t\t! rawTitle.length ? __( 'No Title' ) : null\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvalue={ rawTitle }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\t__experimentalVersion={ 2 }\n\t\t\t\t\t/>\n\t\t\t\t</TagName>\n\t\t\t) : (\n\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t<a\n\t\t\t\t\t\thref={ link }\n\t\t\t\t\t\ttarget={ linkTarget }\n\t\t\t\t\t\trel={ rel }\n\t\t\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t\t\t>\n\t\t\t\t\t\t<RawHTML key=\"html\">{ fullTitle?.rendered }</RawHTML>\n\t\t\t\t\t</a>\n\t\t\t\t</TagName>\n\t\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<HeadingLevelDropdown\n\t\t\t\t\tselectedLevel={ level }\n\t\t\t\t\tonChange={ ( newLevel ) =>\n\t\t\t\t\t\tsetAttributes( { level: newLevel } )\n\t\t\t\t\t}\n\t\t\t\t/>\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<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Link settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Make title a link' ) }\n\t\t\t\t\t\tonChange={ () => setAttributes( { isLink: ! isLink } ) }\n\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t/>\n\t\t\t\t\t{ isLink && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlinkTarget: value ? '_blank' : '_self',\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\t\t\t\t\tvalue={ rel }\n\t\t\t\t\t\t\t\tonChange={ ( newRel ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { rel: newRel } )\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) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ titleElement }\n\t\t</>\n\t);\n}\n"]}
|
package/build/site-logo/edit.js
CHANGED
|
@@ -63,7 +63,8 @@ const SiteLogo = _ref => {
|
|
|
63
63
|
width,
|
|
64
64
|
height,
|
|
65
65
|
isLink,
|
|
66
|
-
linkTarget
|
|
66
|
+
linkTarget,
|
|
67
|
+
shouldSyncIcon
|
|
67
68
|
},
|
|
68
69
|
containerRef,
|
|
69
70
|
isSelected,
|
|
@@ -71,7 +72,10 @@ const SiteLogo = _ref => {
|
|
|
71
72
|
setLogo,
|
|
72
73
|
logoUrl,
|
|
73
74
|
siteUrl,
|
|
74
|
-
logoId
|
|
75
|
+
logoId,
|
|
76
|
+
iconId,
|
|
77
|
+
setIcon,
|
|
78
|
+
canUserEdit
|
|
75
79
|
} = _ref;
|
|
76
80
|
const clientWidth = (0, _useClientWidth.default)(containerRef, [align]);
|
|
77
81
|
const isLargeViewport = (0, _compose.useViewportMatch)('medium');
|
|
@@ -102,6 +106,16 @@ const SiteLogo = _ref => {
|
|
|
102
106
|
...(0, _lodash.pick)(getSettings(), ['imageEditing', 'maxWidth'])
|
|
103
107
|
};
|
|
104
108
|
}, []);
|
|
109
|
+
(0, _element.useEffect)(() => {
|
|
110
|
+
// Turn the `Use as site icon` toggle off if it is on but the logo and icon have
|
|
111
|
+
// fallen out of sync. This can happen if the toggle is saved in the `on` position,
|
|
112
|
+
// but changes are later made to the site icon in the Customizer.
|
|
113
|
+
if (shouldSyncIcon && logoId !== iconId) {
|
|
114
|
+
setAttributes({
|
|
115
|
+
shouldSyncIcon: false
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}, []);
|
|
105
119
|
(0, _element.useEffect)(() => {
|
|
106
120
|
if (!isSelected) {
|
|
107
121
|
setIsEditingImage(false);
|
|
@@ -250,6 +264,14 @@ const SiteLogo = _ref => {
|
|
|
250
264
|
});
|
|
251
265
|
}
|
|
252
266
|
}, imgWrapper);
|
|
267
|
+
const syncSiteIconHelpText = (0, _element.createInterpolateElement)((0, _i18n.__)('Site Icons are what you see in browser tabs, bookmark bars, and within the WordPress mobile apps. To use a custom icon that is different from your site logo, use the <a>Site Icon settings</a>.'), {
|
|
268
|
+
a: // eslint-disable-next-line jsx-a11y/anchor-has-content
|
|
269
|
+
(0, _element.createElement)("a", {
|
|
270
|
+
href: siteUrl + '/wp-admin/customize.php?autofocus[section]=title_tagline',
|
|
271
|
+
target: "_blank",
|
|
272
|
+
rel: "noopener noreferrer"
|
|
273
|
+
})
|
|
274
|
+
});
|
|
253
275
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_blockEditor.InspectorControls, null, (0, _element.createElement)(_components.PanelBody, {
|
|
254
276
|
title: (0, _i18n.__)('Settings')
|
|
255
277
|
}, (0, _element.createElement)(_components.RangeControl, {
|
|
@@ -274,6 +296,16 @@ const SiteLogo = _ref => {
|
|
|
274
296
|
linkTarget: value ? '_blank' : '_self'
|
|
275
297
|
}),
|
|
276
298
|
checked: linkTarget === '_blank'
|
|
299
|
+
})), canUserEdit && (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.ToggleControl, {
|
|
300
|
+
label: (0, _i18n.__)('Use as site icon'),
|
|
301
|
+
onChange: value => {
|
|
302
|
+
setAttributes({
|
|
303
|
+
shouldSyncIcon: value
|
|
304
|
+
});
|
|
305
|
+
setIcon(value ? logoId : undefined);
|
|
306
|
+
},
|
|
307
|
+
checked: !!shouldSyncIcon,
|
|
308
|
+
help: syncSiteIconHelpText
|
|
277
309
|
})))), (0, _element.createElement)(_blockEditor.BlockControls, {
|
|
278
310
|
group: "block"
|
|
279
311
|
}, canEditImage && !isEditingImage && (0, _element.createElement)(_components.ToolbarButton, {
|
|
@@ -291,7 +323,9 @@ function LogoEdit(_ref2) {
|
|
|
291
323
|
isSelected
|
|
292
324
|
} = _ref2;
|
|
293
325
|
const {
|
|
294
|
-
|
|
326
|
+
className: styleClass,
|
|
327
|
+
width,
|
|
328
|
+
shouldSyncIcon
|
|
295
329
|
} = attributes;
|
|
296
330
|
const [logoUrl, setLogoUrl] = (0, _element.useState)();
|
|
297
331
|
const ref = (0, _element.useRef)();
|
|
@@ -299,6 +333,7 @@ function LogoEdit(_ref2) {
|
|
|
299
333
|
siteLogoId,
|
|
300
334
|
canUserEdit,
|
|
301
335
|
url,
|
|
336
|
+
siteIconId,
|
|
302
337
|
mediaItemData,
|
|
303
338
|
isRequestingMediaItem
|
|
304
339
|
} = (0, _data.useSelect)(select => {
|
|
@@ -318,6 +353,8 @@ function LogoEdit(_ref2) {
|
|
|
318
353
|
|
|
319
354
|
const _siteLogoId = _canUserEdit ? _siteLogo : _readOnlyLogo;
|
|
320
355
|
|
|
356
|
+
const _siteIconId = siteSettings === null || siteSettings === void 0 ? void 0 : siteSettings.site_icon;
|
|
357
|
+
|
|
321
358
|
const mediaItem = _siteLogoId && select(_coreData.store).getMedia(_siteLogoId, {
|
|
322
359
|
context: 'view'
|
|
323
360
|
});
|
|
@@ -335,15 +372,54 @@ function LogoEdit(_ref2) {
|
|
|
335
372
|
url: mediaItem.source_url,
|
|
336
373
|
alt: mediaItem.alt_text
|
|
337
374
|
},
|
|
338
|
-
isRequestingMediaItem: _isRequestingMediaItem
|
|
375
|
+
isRequestingMediaItem: _isRequestingMediaItem,
|
|
376
|
+
siteIconId: _siteIconId
|
|
339
377
|
};
|
|
340
378
|
}, []);
|
|
379
|
+
const {
|
|
380
|
+
getGlobalBlockCount
|
|
381
|
+
} = (0, _data.useSelect)(_blockEditor.store);
|
|
341
382
|
const {
|
|
342
383
|
editEntityRecord
|
|
343
384
|
} = (0, _data.useDispatch)(_coreData.store);
|
|
385
|
+
(0, _element.useEffect)(() => {
|
|
386
|
+
// Cleanup function to discard unsaved changes to the icon and logo when
|
|
387
|
+
// the block is removed.
|
|
388
|
+
return () => {
|
|
389
|
+
// Do nothing if the block is being rendered in the styles preview or the
|
|
390
|
+
// block inserter.
|
|
391
|
+
if (styleClass !== null && styleClass !== void 0 && styleClass.includes('block-editor-block-types-list__site-logo-example') || styleClass !== null && styleClass !== void 0 && styleClass.includes('block-editor-block-styles__block-preview-container')) {
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
const logoBlockCount = getGlobalBlockCount('core/site-logo'); // Only discard unsaved changes if we are removing the last Site Logo block
|
|
396
|
+
// on the page.
|
|
397
|
+
|
|
398
|
+
if (logoBlockCount === 0) {
|
|
399
|
+
editEntityRecord('root', 'site', undefined, {
|
|
400
|
+
site_logo: undefined,
|
|
401
|
+
site_icon: undefined
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
};
|
|
405
|
+
}, []);
|
|
406
|
+
|
|
407
|
+
const setLogo = function (newValue) {
|
|
408
|
+
let shouldForceSync = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
409
|
+
|
|
410
|
+
// `shouldForceSync` is used to force syncing when the attribute
|
|
411
|
+
// may not have updated yet.
|
|
412
|
+
if (shouldSyncIcon || shouldForceSync) {
|
|
413
|
+
setIcon(newValue);
|
|
414
|
+
}
|
|
344
415
|
|
|
345
|
-
|
|
346
|
-
|
|
416
|
+
editEntityRecord('root', 'site', undefined, {
|
|
417
|
+
site_logo: newValue
|
|
418
|
+
});
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
const setIcon = newValue => editEntityRecord('root', 'site', undefined, {
|
|
422
|
+
site_icon: newValue
|
|
347
423
|
});
|
|
348
424
|
|
|
349
425
|
let alt = null;
|
|
@@ -356,7 +432,26 @@ function LogoEdit(_ref2) {
|
|
|
356
432
|
}
|
|
357
433
|
}
|
|
358
434
|
|
|
359
|
-
const
|
|
435
|
+
const onInitialSelectLogo = media => {
|
|
436
|
+
// Initialize the syncSiteIcon toggle. If we currently have no Site logo and no
|
|
437
|
+
// site icon, automatically sync the logo to the icon.
|
|
438
|
+
if (shouldSyncIcon === undefined) {
|
|
439
|
+
const shouldForceSync = !siteIconId;
|
|
440
|
+
setAttributes({
|
|
441
|
+
shouldSyncIcon: shouldForceSync
|
|
442
|
+
}); // Because we cannot rely on the `shouldSyncIcon` attribute to have updated by
|
|
443
|
+
// the time `setLogo` is called, pass an argument to force the syncing.
|
|
444
|
+
|
|
445
|
+
onSelectLogo(media, shouldForceSync);
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
onSelectLogo(media);
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
const onSelectLogo = function (media) {
|
|
453
|
+
let shouldForceSync = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
454
|
+
|
|
360
455
|
if (!media) {
|
|
361
456
|
return;
|
|
362
457
|
}
|
|
@@ -368,7 +463,7 @@ function LogoEdit(_ref2) {
|
|
|
368
463
|
return;
|
|
369
464
|
}
|
|
370
465
|
|
|
371
|
-
setLogo(media.id);
|
|
466
|
+
setLogo(media.id, shouldForceSync);
|
|
372
467
|
};
|
|
373
468
|
|
|
374
469
|
const onRemoveLogo = () => {
|
|
@@ -418,7 +513,10 @@ function LogoEdit(_ref2) {
|
|
|
418
513
|
logoUrl: logoUrl,
|
|
419
514
|
setLogo: setLogo,
|
|
420
515
|
logoId: (mediaItemData === null || mediaItemData === void 0 ? void 0 : mediaItemData.id) || siteLogoId,
|
|
421
|
-
siteUrl: url
|
|
516
|
+
siteUrl: url,
|
|
517
|
+
setIcon: setIcon,
|
|
518
|
+
iconId: siteIconId,
|
|
519
|
+
canUserEdit: canUserEdit
|
|
422
520
|
});
|
|
423
521
|
}
|
|
424
522
|
|
|
@@ -451,7 +549,7 @@ function LogoEdit(_ref2) {
|
|
|
451
549
|
}, isLoading && (0, _element.createElement)("span", {
|
|
452
550
|
className: "components-placeholder__preview"
|
|
453
551
|
}, (0, _element.createElement)(_components.Spinner, null))), !logoUrl && canUserEdit && (0, _element.createElement)(_blockEditor.MediaPlaceholder, {
|
|
454
|
-
onSelect:
|
|
552
|
+
onSelect: onInitialSelectLogo,
|
|
455
553
|
accept: ACCEPT_MEDIA_STRING,
|
|
456
554
|
allowedTypes: ALLOWED_MEDIA_TYPES,
|
|
457
555
|
onError: onUploadError,
|