@wordpress/editor 13.1.0 → 13.2.0

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.
Files changed (28) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/LICENSE.md +1 -1
  3. package/build/components/post-author/select.js +1 -0
  4. package/build/components/post-author/select.js.map +1 -1
  5. package/build/components/post-format/index.js +1 -0
  6. package/build/components/post-format/index.js.map +1 -1
  7. package/build/components/post-template/index.js +1 -0
  8. package/build/components/post-template/index.js.map +1 -1
  9. package/build/components/provider/use-block-editor-settings.js +1 -1
  10. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  11. package/build/hooks/custom-sources-backwards-compatibility.js +16 -8
  12. package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  13. package/build-module/components/post-author/select.js +1 -0
  14. package/build-module/components/post-author/select.js.map +1 -1
  15. package/build-module/components/post-format/index.js +1 -0
  16. package/build-module/components/post-format/index.js.map +1 -1
  17. package/build-module/components/post-template/index.js +1 -0
  18. package/build-module/components/post-template/index.js.map +1 -1
  19. package/build-module/components/provider/use-block-editor-settings.js +1 -1
  20. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  21. package/build-module/hooks/custom-sources-backwards-compatibility.js +17 -9
  22. package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  23. package/package.json +29 -29
  24. package/src/components/post-author/select.js +1 -0
  25. package/src/components/post-format/index.js +1 -0
  26. package/src/components/post-template/index.js +1 -0
  27. package/src/components/provider/use-block-editor-settings.js +1 -1
  28. package/src/hooks/custom-sources-backwards-compatibility.js +16 -13
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 13.2.0 (2023-01-11)
6
+
5
7
  ## 13.1.0 (2023-01-02)
6
8
 
7
9
  ## 13.0.0 (2022-12-14)
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ## Gutenberg
2
2
 
3
- Copyright 2016-2022 by the contributors
3
+ Copyright 2016-2023 by the contributors
4
4
 
5
5
  **License for Contributions (on and after April 15, 2021)**
6
6
 
@@ -58,6 +58,7 @@ function PostAuthorSelect() {
58
58
  };
59
59
 
60
60
  return (0, _element.createElement)(_components.SelectControl, {
61
+ __nextHasNoMarginBottom: true,
61
62
  className: "post-author-selector",
62
63
  label: (0, _i18n.__)('Author'),
63
64
  options: authorOptions,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-author/select.js"],"names":["PostAuthorSelect","editPost","editorStore","postAuthor","authors","select","getEditedPostAttribute","coreStore","getUsers","AUTHORS_QUERY","authorOptions","map","author","value","id","label","name","setAuthorId","Number"],"mappings":";;;;;;;AAIA;;AADA;;AAEA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAdA;AACA;AACA;;AAQA;AACA;AACA;AAIA,SAASA,gBAAT,GAA4B;AAC3B,QAAM;AAAEC,IAAAA;AAAF,MAAe,uBAAaC,YAAb,CAArB;AACA,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,MAA0B,qBAAaC,MAAF,IAAc;AACxD,WAAO;AACNF,MAAAA,UAAU,EACTE,MAAM,CAAEH,YAAF,CAAN,CAAsBI,sBAAtB,CAA8C,QAA9C,CAFK;AAGNF,MAAAA,OAAO,EAAEC,MAAM,CAAEE,eAAF,CAAN,CAAoBC,QAApB,CAA8BC,wBAA9B;AAHH,KAAP;AAKA,GAN+B,EAM7B,EAN6B,CAAhC;AAQA,QAAMC,aAAa,GAAG,sBAAS,MAAM;AACpC,WAAO,CAAEN,OAAF,aAAEA,OAAF,cAAEA,OAAF,GAAa,EAAb,EAAkBO,GAAlB,CAAyBC,MAAF,IAAc;AAC3C,aAAO;AACNC,QAAAA,KAAK,EAAED,MAAM,CAACE,EADR;AAENC,QAAAA,KAAK,EAAE,kCAAgBH,MAAM,CAACI,IAAvB;AAFD,OAAP;AAIA,KALM,CAAP;AAMA,GAPqB,EAOnB,CAAEZ,OAAF,CAPmB,CAAtB;;AASA,QAAMa,WAAW,GAAKJ,KAAF,IAAa;AAChC,UAAMD,MAAM,GAAGM,MAAM,CAAEL,KAAF,CAArB;AACAZ,IAAAA,QAAQ,CAAE;AAAEW,MAAAA;AAAF,KAAF,CAAR;AACA,GAHD;;AAKA,SACC,4BAAC,yBAAD;AACC,IAAA,SAAS,EAAC,sBADX;AAEC,IAAA,KAAK,EAAG,cAAI,QAAJ,CAFT;AAGC,IAAA,OAAO,EAAGF,aAHX;AAIC,IAAA,QAAQ,EAAGO,WAJZ;AAKC,IAAA,KAAK,EAAGd;AALT,IADD;AASA;;eAEcH,gB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { SelectControl } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { AUTHORS_QUERY } from './constants';\n\nfunction PostAuthorSelect() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { postAuthor, authors } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostAuthor:\n\t\t\t\tselect( editorStore ).getEditedPostAttribute( 'author' ),\n\t\t\tauthors: select( coreStore ).getUsers( AUTHORS_QUERY ),\n\t\t};\n\t}, [] );\n\n\tconst authorOptions = useMemo( () => {\n\t\treturn ( authors ?? [] ).map( ( author ) => {\n\t\t\treturn {\n\t\t\t\tvalue: author.id,\n\t\t\t\tlabel: decodeEntities( author.name ),\n\t\t\t};\n\t\t} );\n\t}, [ authors ] );\n\n\tconst setAuthorId = ( value ) => {\n\t\tconst author = Number( value );\n\t\teditPost( { author } );\n\t};\n\n\treturn (\n\t\t<SelectControl\n\t\t\tclassName=\"post-author-selector\"\n\t\t\tlabel={ __( 'Author' ) }\n\t\t\toptions={ authorOptions }\n\t\t\tonChange={ setAuthorId }\n\t\t\tvalue={ postAuthor }\n\t\t/>\n\t);\n}\n\nexport default PostAuthorSelect;\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-author/select.js"],"names":["PostAuthorSelect","editPost","editorStore","postAuthor","authors","select","getEditedPostAttribute","coreStore","getUsers","AUTHORS_QUERY","authorOptions","map","author","value","id","label","name","setAuthorId","Number"],"mappings":";;;;;;;AAIA;;AADA;;AAEA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAdA;AACA;AACA;;AAQA;AACA;AACA;AAIA,SAASA,gBAAT,GAA4B;AAC3B,QAAM;AAAEC,IAAAA;AAAF,MAAe,uBAAaC,YAAb,CAArB;AACA,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,MAA0B,qBAAaC,MAAF,IAAc;AACxD,WAAO;AACNF,MAAAA,UAAU,EACTE,MAAM,CAAEH,YAAF,CAAN,CAAsBI,sBAAtB,CAA8C,QAA9C,CAFK;AAGNF,MAAAA,OAAO,EAAEC,MAAM,CAAEE,eAAF,CAAN,CAAoBC,QAApB,CAA8BC,wBAA9B;AAHH,KAAP;AAKA,GAN+B,EAM7B,EAN6B,CAAhC;AAQA,QAAMC,aAAa,GAAG,sBAAS,MAAM;AACpC,WAAO,CAAEN,OAAF,aAAEA,OAAF,cAAEA,OAAF,GAAa,EAAb,EAAkBO,GAAlB,CAAyBC,MAAF,IAAc;AAC3C,aAAO;AACNC,QAAAA,KAAK,EAAED,MAAM,CAACE,EADR;AAENC,QAAAA,KAAK,EAAE,kCAAgBH,MAAM,CAACI,IAAvB;AAFD,OAAP;AAIA,KALM,CAAP;AAMA,GAPqB,EAOnB,CAAEZ,OAAF,CAPmB,CAAtB;;AASA,QAAMa,WAAW,GAAKJ,KAAF,IAAa;AAChC,UAAMD,MAAM,GAAGM,MAAM,CAAEL,KAAF,CAArB;AACAZ,IAAAA,QAAQ,CAAE;AAAEW,MAAAA;AAAF,KAAF,CAAR;AACA,GAHD;;AAKA,SACC,4BAAC,yBAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,SAAS,EAAC,sBAFX;AAGC,IAAA,KAAK,EAAG,cAAI,QAAJ,CAHT;AAIC,IAAA,OAAO,EAAGF,aAJX;AAKC,IAAA,QAAQ,EAAGO,WALZ;AAMC,IAAA,KAAK,EAAGd;AANT,IADD;AAUA;;eAEcH,gB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { SelectControl } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { AUTHORS_QUERY } from './constants';\n\nfunction PostAuthorSelect() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { postAuthor, authors } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostAuthor:\n\t\t\t\tselect( editorStore ).getEditedPostAttribute( 'author' ),\n\t\t\tauthors: select( coreStore ).getUsers( AUTHORS_QUERY ),\n\t\t};\n\t}, [] );\n\n\tconst authorOptions = useMemo( () => {\n\t\treturn ( authors ?? [] ).map( ( author ) => {\n\t\t\treturn {\n\t\t\t\tvalue: author.id,\n\t\t\t\tlabel: decodeEntities( author.name ),\n\t\t\t};\n\t\t} );\n\t}, [ authors ] );\n\n\tconst setAuthorId = ( value ) => {\n\t\tconst author = Number( value );\n\t\teditPost( { author } );\n\t};\n\n\treturn (\n\t\t<SelectControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tclassName=\"post-author-selector\"\n\t\t\tlabel={ __( 'Author' ) }\n\t\t\toptions={ authorOptions }\n\t\t\tonChange={ setAuthorId }\n\t\t\tvalue={ postAuthor }\n\t\t/>\n\t);\n}\n\nexport default PostAuthorSelect;\n"]}
@@ -117,6 +117,7 @@ function PostFormat() {
117
117
  return (0, _element.createElement)(_check.default, null, (0, _element.createElement)("div", {
118
118
  className: "editor-post-format"
119
119
  }, (0, _element.createElement)(_components.SelectControl, {
120
+ __nextHasNoMarginBottom: true,
120
121
  label: (0, _i18n.__)('Post Format'),
121
122
  value: postFormat,
122
123
  onChange: format => onUpdatePostFormat(format),
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-format/index.js"],"names":["POST_FORMATS","id","caption","sort","a","b","normalizedA","toUpperCase","normalizedB","PostFormat","instanceId","postFormatSelectorId","postFormat","suggestedFormat","supportedFormats","select","getEditedPostAttribute","getSuggestedPostFormat","editorStore","_postFormat","themeSupports","coreStore","getThemeSupports","formats","filter","format","includes","suggestion","find","editPost","onUpdatePostFormat","map","label","value"],"mappings":";;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAbA;AACA;AACA;;AAOA;AACA;AACA;AAIA;AACO,MAAMA,YAAY,GAAG,CAC3B;AAAEC,EAAAA,EAAE,EAAE,OAAN;AAAeC,EAAAA,OAAO,EAAE,cAAI,OAAJ;AAAxB,CAD2B,EAE3B;AAAED,EAAAA,EAAE,EAAE,OAAN;AAAeC,EAAAA,OAAO,EAAE,cAAI,OAAJ;AAAxB,CAF2B,EAG3B;AAAED,EAAAA,EAAE,EAAE,MAAN;AAAcC,EAAAA,OAAO,EAAE,cAAI,MAAJ;AAAvB,CAH2B,EAI3B;AAAED,EAAAA,EAAE,EAAE,SAAN;AAAiBC,EAAAA,OAAO,EAAE,cAAI,SAAJ;AAA1B,CAJ2B,EAK3B;AAAED,EAAAA,EAAE,EAAE,OAAN;AAAeC,EAAAA,OAAO,EAAE,cAAI,OAAJ;AAAxB,CAL2B,EAM3B;AAAED,EAAAA,EAAE,EAAE,MAAN;AAAcC,EAAAA,OAAO,EAAE,cAAI,MAAJ;AAAvB,CAN2B,EAO3B;AAAED,EAAAA,EAAE,EAAE,OAAN;AAAeC,EAAAA,OAAO,EAAE,cAAI,OAAJ;AAAxB,CAP2B,EAQ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A,gBAAI,4BAAJ,CAFC,EAGD0B,UAAU,CAACzB,OAHV,CANH,CADD,CAZF,CADD,CADD;AAgCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button, SelectControl } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostFormatCheck from './check';\nimport { store as editorStore } from '../../store';\n\n// All WP post formats, sorted alphabetically by translated name.\nexport const POST_FORMATS = [\n\t{ id: 'aside', caption: __( 'Aside' ) },\n\t{ id: 'audio', caption: __( 'Audio' ) },\n\t{ id: 'chat', caption: __( 'Chat' ) },\n\t{ id: 'gallery', caption: __( 'Gallery' ) },\n\t{ id: 'image', caption: __( 'Image' ) },\n\t{ id: 'link', caption: __( 'Link' ) },\n\t{ id: 'quote', caption: __( 'Quote' ) },\n\t{ id: 'standard', caption: __( 'Standard' ) },\n\t{ id: 'status', caption: __( 'Status' ) },\n\t{ id: 'video', caption: __( 'Video' ) },\n].sort( ( a, b ) => {\n\tconst normalizedA = a.caption.toUpperCase();\n\tconst normalizedB = b.caption.toUpperCase();\n\n\tif ( normalizedA < normalizedB ) {\n\t\treturn -1;\n\t}\n\tif ( normalizedA > normalizedB ) {\n\t\treturn 1;\n\t}\n\treturn 0;\n} );\n\nexport default function PostFormat() {\n\tconst instanceId = useInstanceId( PostFormat );\n\tconst postFormatSelectorId = `post-format-selector-${ instanceId }`;\n\n\tconst { postFormat, suggestedFormat, supportedFormats } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostAttribute, getSuggestedPostFormat } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst _postFormat = getEditedPostAttribute( 'format' );\n\t\t\tconst themeSupports = select( coreStore ).getThemeSupports();\n\t\t\treturn {\n\t\t\t\tpostFormat: _postFormat ?? 'standard',\n\t\t\t\tsuggestedFormat: getSuggestedPostFormat(),\n\t\t\t\tsupportedFormats: themeSupports.formats,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst formats = POST_FORMATS.filter( ( format ) => {\n\t\t// Ensure current format is always in the set.\n\t\t// The current format may not be a format supported by the theme.\n\t\treturn (\n\t\t\tsupportedFormats?.includes( format.id ) || postFormat === format.id\n\t\t);\n\t} );\n\tconst suggestion = formats.find(\n\t\t( format ) => format.id === suggestedFormat\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tconst onUpdatePostFormat = ( format ) => editPost( { format } );\n\n\treturn (\n\t\t<PostFormatCheck>\n\t\t\t<div className=\"editor-post-format\">\n\t\t\t\t<SelectControl\n\t\t\t\t\tlabel={ __( 'Post Format' ) }\n\t\t\t\t\tvalue={ postFormat }\n\t\t\t\t\tonChange={ ( format ) => onUpdatePostFormat( format ) }\n\t\t\t\t\tid={ postFormatSelectorId }\n\t\t\t\t\toptions={ formats.map( ( format ) => ( {\n\t\t\t\t\t\tlabel: format.caption,\n\t\t\t\t\t\tvalue: format.id,\n\t\t\t\t\t} ) ) }\n\t\t\t\t/>\n\t\t\t\t{ suggestion && suggestion.id !== postFormat && (\n\t\t\t\t\t<p className=\"editor-post-format__suggestion\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\tonUpdatePostFormat( suggestion.id )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: post format */\n\t\t\t\t\t\t\t\t__( 'Apply suggested format: %s' ),\n\t\t\t\t\t\t\t\tsuggestion.caption\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</PostFormatCheck>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-format/index.js"],"names":["POST_FORMATS","id","caption","sort","a","b","normalizedA","toUpperCase","normalizedB","PostFormat","instanceId","postFormatSelectorId","postFormat","suggestedFormat","supportedFormats","select","getEditedPostAttribute","getSuggestedPostFormat","editorStore","_postFormat","themeSupports","coreStore","getThemeSupports","formats","filter","format","includes","suggestion","find","editPost","onUpdatePostFormat","map","label","value"],"mappings":";;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAbA;AACA;AACA;;AAOA;AACA;AACA;AAIA;AACO,MAAMA,YAAY,GAAG,CAC3B;AAAEC,EAAAA,EAAE,EAAE,OAAN;AAAeC,EAAAA,OAAO,EAAE,cAAI,OAAJ;AAAxB,CAD2B,EAE3B;AAAED,EAAAA,EAAE,EAAE,OAAN;AAAeC,EAAAA,OAAO,EAAE,cAAI,OAAJ;AAAxB,CAF2B,EAG3B;AAAED,EAAAA,EAAE,EAAE,MAAN;AAAcC,EAAAA,OAAO,EAAE,cAAI,MAAJ;AAAvB,CAH2B,EAI3B;AAAED,EAAAA,EAAE,EAAE,SAAN;AAAiBC,EAAAA,OAAO,EAAE,cAAI,SAAJ;AAA1B,CAJ2B,EAK3B;AAAED,EAAAA,EAAE,EAAE,OAAN;AAAeC,EAAAA,OAAO,EAAE,cAAI,OAAJ;AAAxB,CAL2B,EAM3B;AAAED,EAAAA,EAAE,EAAE,MAAN;AAAcC,EAAAA,OAAO,EAAE,cAAI,MAAJ;AAAvB,CAN2B,EAO3B;AAAED,EAAAA,EAAE,EAAE,OAAN;AAAeC,EAAAA,OAAO,EAAE,cAAI,OAAJ;AAAxB,CAP2B,EAQ3B;AAAED,EAAAA,EAAE,EAAE,UAAN;AAAkBC,EAAAA,OAAO,EAAE,cAAI,UAAJ;AAA3B,CAR2B,EAS3B;AAAED,EAAAA,EAAE,EAAE,QAAN;AAAgBC,EAAAA,OAAO,EAAE,cAAI,QAAJ;AAAzB,CAT2B,EAU3B;AAAED,EAAAA,EAAE,EAAE,OAAN;AAAeC,E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AAM,CAACxB,EAAnC,MAA2CW,UAAU,KAAKa,MAAM,CAACxB,EADlE;AAGA,GANe,CAAhB;AAOA,QAAM0B,UAAU,GAAGJ,OAAO,CAACK,IAAR,CAChBH,MAAF,IAAcA,MAAM,CAACxB,EAAP,KAAcY,eADV,CAAnB;AAIA,QAAM;AAAEgB,IAAAA;AAAF,MAAe,uBAAaX,YAAb,CAArB;;AAEA,QAAMY,kBAAkB,GAAKL,MAAF,IAAcI,QAAQ,CAAE;AAAEJ,IAAAA;AAAF,GAAF,CAAjD;;AAEA,SACC,4BAAC,cAAD,QACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,yBAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAG,cAAI,aAAJ,CAFT;AAGC,IAAA,KAAK,EAAGb,UAHT;AAIC,IAAA,QAAQ,EAAKa,MAAF,IAAcK,kBAAkB,CAAEL,MAAF,CAJ5C;AAKC,IAAA,EAAE,EAAGd,oBALN;AAMC,IAAA,OAAO,EAAGY,OAAO,CAACQ,GAAR,CAAeN,MAAF,KAAgB;AACtCO,MAAAA,KAAK,EAAEP,MAAM,CAACvB,OADwB;AAEtC+B,MAAAA,KAAK,EAAER,MAAM,CAACxB;AAFwB,KAAhB,CAAb;AANX,IADD,EAYG0B,UAAU,IAAIA,UAAU,CAAC1B,EAAX,KAAkBW,UAAhC,IACD;AAAG,IAAA,SAAS,EAAC;AAAb,KACC,4BAAC,kBAAD;AACC,IAAA,OAAO,EAAC,MADT;AAEC,IAAA,OAAO,EAAG,MACTkB,kBAAkB,CAAEH,UAAU,CAAC1B,EAAb;AAHpB,KAMG;AACD;AACA,gBAAI,4BAAJ,CAFC,EAGD0B,UAAU,CAACzB,OAHV,CANH,CADD,CAbF,CADD,CADD;AAiCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button, SelectControl } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostFormatCheck from './check';\nimport { store as editorStore } from '../../store';\n\n// All WP post formats, sorted alphabetically by translated name.\nexport const POST_FORMATS = [\n\t{ id: 'aside', caption: __( 'Aside' ) },\n\t{ id: 'audio', caption: __( 'Audio' ) },\n\t{ id: 'chat', caption: __( 'Chat' ) },\n\t{ id: 'gallery', caption: __( 'Gallery' ) },\n\t{ id: 'image', caption: __( 'Image' ) },\n\t{ id: 'link', caption: __( 'Link' ) },\n\t{ id: 'quote', caption: __( 'Quote' ) },\n\t{ id: 'standard', caption: __( 'Standard' ) },\n\t{ id: 'status', caption: __( 'Status' ) },\n\t{ id: 'video', caption: __( 'Video' ) },\n].sort( ( a, b ) => {\n\tconst normalizedA = a.caption.toUpperCase();\n\tconst normalizedB = b.caption.toUpperCase();\n\n\tif ( normalizedA < normalizedB ) {\n\t\treturn -1;\n\t}\n\tif ( normalizedA > normalizedB ) {\n\t\treturn 1;\n\t}\n\treturn 0;\n} );\n\nexport default function PostFormat() {\n\tconst instanceId = useInstanceId( PostFormat );\n\tconst postFormatSelectorId = `post-format-selector-${ instanceId }`;\n\n\tconst { postFormat, suggestedFormat, supportedFormats } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostAttribute, getSuggestedPostFormat } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst _postFormat = getEditedPostAttribute( 'format' );\n\t\t\tconst themeSupports = select( coreStore ).getThemeSupports();\n\t\t\treturn {\n\t\t\t\tpostFormat: _postFormat ?? 'standard',\n\t\t\t\tsuggestedFormat: getSuggestedPostFormat(),\n\t\t\t\tsupportedFormats: themeSupports.formats,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst formats = POST_FORMATS.filter( ( format ) => {\n\t\t// Ensure current format is always in the set.\n\t\t// The current format may not be a format supported by the theme.\n\t\treturn (\n\t\t\tsupportedFormats?.includes( format.id ) || postFormat === format.id\n\t\t);\n\t} );\n\tconst suggestion = formats.find(\n\t\t( format ) => format.id === suggestedFormat\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tconst onUpdatePostFormat = ( format ) => editPost( { format } );\n\n\treturn (\n\t\t<PostFormatCheck>\n\t\t\t<div className=\"editor-post-format\">\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Post Format' ) }\n\t\t\t\t\tvalue={ postFormat }\n\t\t\t\t\tonChange={ ( format ) => onUpdatePostFormat( format ) }\n\t\t\t\t\tid={ postFormatSelectorId }\n\t\t\t\t\toptions={ formats.map( ( format ) => ( {\n\t\t\t\t\t\tlabel: format.caption,\n\t\t\t\t\t\tvalue: format.id,\n\t\t\t\t\t} ) ) }\n\t\t\t\t/>\n\t\t\t\t{ suggestion && suggestion.id !== postFormat && (\n\t\t\t\t\t<p className=\"editor-post-format__suggestion\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\tonUpdatePostFormat( suggestion.id )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: post format */\n\t\t\t\t\t\t\t\t__( 'Apply suggested format: %s' ),\n\t\t\t\t\t\t\t\tsuggestion.caption\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</PostFormatCheck>\n\t);\n}\n"]}
@@ -62,6 +62,7 @@ function PostTemplate() {
62
62
  }
63
63
 
64
64
  return (0, _element.createElement)(_components.SelectControl, {
65
+ __nextHasNoMarginBottom: true,
65
66
  label: (0, _i18n.__)('Template:'),
66
67
  value: selectedTemplate,
67
68
  onChange: templateSlug => {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-template/index.js"],"names":["PostTemplate","availableTemplates","selectedTemplate","isViewable","select","getEditedPostAttribute","getEditorSettings","getCurrentPostType","editorStore","getPostType","coreStore","viewable","editPost","templateSlug","template","templateName","value","label"],"mappings":";;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AAKA;;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAGO,SAASA,YAAT,GAAwB;AAC9B,QAAM;AAAEC,IAAAA,kBAAF;AAAsBC,IAAAA,gBAAtB;AAAwCC,IAAAA;AAAxC,MAAuD,qBAC1DC,MAAF,IAAc;AAAA;;AACb,UAAM;AACLC,MAAAA,sBADK;AAELC,MAAAA,iBAFK;AAGLC,MAAAA;AAHK,QAIFH,MAAM,CAAEI,YAAF,CAJV;AAKA,UAAM;AAAEC,MAAAA;AAAF,QAAkBL,MAAM,CAAEM,eAAF,CAA9B;AAEA,WAAO;AACNR,MAAAA,gBAAgB,EAAEG,sBAAsB,CAAE,UAAF,CADlC;AAENJ,MAAAA,kBAAkB,EAAEK,iBAAiB,GAAGL,kBAFlC;AAGNE,MAAAA,UAAU,2CACTM,WAAW,CAAEF,kBAAkB,EAApB,CADF,iDACT,aAAqCI,QAD5B,yEACwC;AAJ5C,KAAP;AAMA,GAf2D,EAgB5D,EAhB4D,CAA7D;AAmBA,QAAM;AAAEC,IAAAA;AAAF,MAAe,uBAAaJ,YAAb,CAArB;;AAEA,MAAK,CAAEL,UAAF,IAAgB,qBAASF,kBAAT,CAArB,EAAqD;AACpD,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,yBAAD;AACC,IAAA,KAAK,EAAG,cAAI,WAAJ,CADT;AAEC,IAAA,KAAK,EAAGC,gBAFT;AAGC,IAAA,QAAQ,EAAKW,YAAF,IAAoB;AAC9BD,MAAAA,QAAQ,CAAE;AACTE,QAAAA,QAAQ,EAAED,YAAY,IAAI;AADjB,OAAF,CAAR;AAGA,KAPF;AAQC,IAAA,OAAO,EAAG,iBACTZ,kBADS,EAET,CAAEc,YAAF,EAAgBF,YAAhB,MAAoC;AACnCG,MAAAA,KAAK,EAAEH,YAD4B;AAEnCI,MAAAA,KAAK,EAAEF;AAF4B,KAApC,CAFS;AARX,IADD;AAkBA;;eAEcf,Y","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty, map } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { SelectControl } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function PostTemplate() {\n\tconst { availableTemplates, selectedTemplate, isViewable } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t\tgetEditorSettings,\n\t\t\t\tgetCurrentPostType,\n\t\t\t} = select( editorStore );\n\t\t\tconst { getPostType } = select( coreStore );\n\n\t\t\treturn {\n\t\t\t\tselectedTemplate: getEditedPostAttribute( 'template' ),\n\t\t\t\tavailableTemplates: getEditorSettings().availableTemplates,\n\t\t\t\tisViewable:\n\t\t\t\t\tgetPostType( getCurrentPostType() )?.viewable ?? false,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tif ( ! isViewable || isEmpty( availableTemplates ) ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<SelectControl\n\t\t\tlabel={ __( 'Template:' ) }\n\t\t\tvalue={ selectedTemplate }\n\t\t\tonChange={ ( templateSlug ) => {\n\t\t\t\teditPost( {\n\t\t\t\t\ttemplate: templateSlug || '',\n\t\t\t\t} );\n\t\t\t} }\n\t\t\toptions={ map(\n\t\t\t\tavailableTemplates,\n\t\t\t\t( templateName, templateSlug ) => ( {\n\t\t\t\t\tvalue: templateSlug,\n\t\t\t\t\tlabel: templateName,\n\t\t\t\t} )\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nexport default PostTemplate;\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-template/index.js"],"names":["PostTemplate","availableTemplates","selectedTemplate","isViewable","select","getEditedPostAttribute","getEditorSettings","getCurrentPostType","editorStore","getPostType","coreStore","viewable","editPost","templateSlug","template","templateName","value","label"],"mappings":";;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AAKA;;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAGO,SAASA,YAAT,GAAwB;AAC9B,QAAM;AAAEC,IAAAA,kBAAF;AAAsBC,IAAAA,gBAAtB;AAAwCC,IAAAA;AAAxC,MAAuD,qBAC1DC,MAAF,IAAc;AAAA;;AACb,UAAM;AACLC,MAAAA,sBADK;AAELC,MAAAA,iBAFK;AAGLC,MAAAA;AAHK,QAIFH,MAAM,CAAEI,YAAF,CAJV;AAKA,UAAM;AAAEC,MAAAA;AAAF,QAAkBL,MAAM,CAAEM,eAAF,CAA9B;AAEA,WAAO;AACNR,MAAAA,gBAAgB,EAAEG,sBAAsB,CAAE,UAAF,CADlC;AAENJ,MAAAA,kBAAkB,EAAEK,iBAAiB,GAAGL,kBAFlC;AAGNE,MAAAA,UAAU,2CACTM,WAAW,CAAEF,kBAAkB,EAApB,CADF,iDACT,aAAqCI,QAD5B,yEACwC;AAJ5C,KAAP;AAMA,GAf2D,EAgB5D,EAhB4D,CAA7D;AAmBA,QAAM;AAAEC,IAAAA;AAAF,MAAe,uBAAaJ,YAAb,CAArB;;AAEA,MAAK,CAAEL,UAAF,IAAgB,qBAASF,kBAAT,CAArB,EAAqD;AACpD,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,yBAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAG,cAAI,WAAJ,CAFT;AAGC,IAAA,KAAK,EAAGC,gBAHT;AAIC,IAAA,QAAQ,EAAKW,YAAF,IAAoB;AAC9BD,MAAAA,QAAQ,CAAE;AACTE,QAAAA,QAAQ,EAAED,YAAY,IAAI;AADjB,OAAF,CAAR;AAGA,KARF;AASC,IAAA,OAAO,EAAG,iBACTZ,kBADS,EAET,CAAEc,YAAF,EAAgBF,YAAhB,MAAoC;AACnCG,MAAAA,KAAK,EAAEH,YAD4B;AAEnCI,MAAAA,KAAK,EAAEF;AAF4B,KAApC,CAFS;AATX,IADD;AAmBA;;eAEcf,Y","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty, map } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { SelectControl } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function PostTemplate() {\n\tconst { availableTemplates, selectedTemplate, isViewable } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t\tgetEditorSettings,\n\t\t\t\tgetCurrentPostType,\n\t\t\t} = select( editorStore );\n\t\t\tconst { getPostType } = select( coreStore );\n\n\t\t\treturn {\n\t\t\t\tselectedTemplate: getEditedPostAttribute( 'template' ),\n\t\t\t\tavailableTemplates: getEditorSettings().availableTemplates,\n\t\t\t\tisViewable:\n\t\t\t\t\tgetPostType( getCurrentPostType() )?.viewable ?? false,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tif ( ! isViewable || isEmpty( availableTemplates ) ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<SelectControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ __( 'Template:' ) }\n\t\t\tvalue={ selectedTemplate }\n\t\t\tonChange={ ( templateSlug ) => {\n\t\t\t\teditPost( {\n\t\t\t\t\ttemplate: templateSlug || '',\n\t\t\t\t} );\n\t\t\t} }\n\t\t\toptions={ map(\n\t\t\t\tavailableTemplates,\n\t\t\t\t( templateName, templateSlug ) => ( {\n\t\t\t\t\tvalue: templateSlug,\n\t\t\t\t\tlabel: templateName,\n\t\t\t\t} )\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nexport default PostTemplate;\n"]}
@@ -115,7 +115,7 @@ function useBlockEditorSettings(settings, hasTemplate) {
115
115
 
116
116
  return (0, _element.useMemo)(() => ({ ...Object.fromEntries(Object.entries(settings).filter(_ref2 => {
117
117
  let [key] = _ref2;
118
- return ['__experimentalBlockDirectory', '__experimentalBlockInspectorTabs', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalPreferredStyleVariations', '__experimentalSetIsInserterOpened', '__unstableGalleryWithImageBlocks', 'alignWide', 'allowedBlockTypes', 'bodyPlaceholder', 'canLockBlocks', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomSpacingSizes', 'disableCustomGradients', 'disableLayoutStyles', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'focusMode', 'fontSizes', 'gradients', 'generateAnchors', 'hasFixedToolbar', 'isDistractionFree', 'hasInlineToolbar', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'keepCaretInsideBlock', 'maxWidth', 'onUpdateDefaultBlockStyles', 'styles', 'template', 'templateLock', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock', '__unstableResolvedAssets'].includes(key);
118
+ return ['__experimentalBlockDirectory', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalPreferredStyleVariations', '__experimentalSetIsInserterOpened', '__unstableGalleryWithImageBlocks', 'alignWide', 'allowedBlockTypes', 'blockInspectorTabs', 'bodyPlaceholder', 'canLockBlocks', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomSpacingSizes', 'disableCustomGradients', 'disableLayoutStyles', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'focusMode', 'fontSizes', 'gradients', 'generateAnchors', 'hasFixedToolbar', 'isDistractionFree', 'hasInlineToolbar', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'keepCaretInsideBlock', 'maxWidth', 'onUpdateDefaultBlockStyles', 'styles', 'template', 'templateLock', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock', '__unstableResolvedAssets'].includes(key);
119
119
  })),
120
120
  mediaUpload: hasUploadPermissions ? _utils.mediaUpload : undefined,
121
121
  __experimentalReusableBlocks: reusableBlocks,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.js"],"names":["EMPTY_BLOCKS_LIST","useBlockEditorSettings","settings","hasTemplate","reusableBlocks","hasUploadPermissions","canUseUnfilteredHTML","userCanCreatePages","pageOnFront","postType","select","canUserUseUnfilteredHTML","getCurrentPostType","editorStore","isWeb","Platform","OS","canUser","getEntityRecord","coreStore","siteSettings","undefined","getEntityRecords","per_page","page_on_front","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","restBlockPatterns","restBlockPatternCategories","getBlockPatterns","getBlockPatternCategories","blockPatterns","filter","x","index","arr","findIndex","y","name","postTypes","Array","isArray","includes","blockPatternCategories","undo","saveEntityRecord","createPageEntity","options","Promise","reject","message","Object","fromEntries","entries","key","mediaUpload","__experimentalReusableBlocks","__experimentalFetchLinkSuggestions","search","searchOptions","__unstableFetchMedia","fetchMedia","__experimentalFetchRichUrlData","fetchUrlData","__experimentalCanUserUseUnfilteredHTML","__experimentalUndo","outlineMode","__experimentalCreatePageEntity","__experimentalUserCanCreatePages","__experimentalPreferPatternsOnRoot"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AAMA;;AAKA;;AACA;;AAjBA;AACA;AACA;;AAWA;AACA;AACA;AAIA,MAAMA,iBAAiB,GAAG,EAA1B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;A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CD,EA0CC,wCA1CD,EA2CC,0BA3CD,EA4CEZ,QA5CF,CA4CYY,GA5CZ,CADkC;AAAA,KAAnC,CADE,CADI;AAkDPC,IAAAA,WAAW,EAAEtD,oBAAoB,GAAGsD,kBAAH,GAAiBtC,SAlD3C;AAmDPuC,IAAAA,4BAA4B,EAAExD,cAnDvB;AAoDPuB,IAAAA,2BAA2B,EAAEQ,aApDtB;AAqDPL,IAAAA,oCAAoC,EAAEiB,sBArD/B;AAsDPc,IAAAA,kCAAkC,EAAE,CAAEC,MAAF,EAAUC,aAAV,KACnC,kDAAsBD,MAAtB,EAA8BC,aAA9B,EAA6C7D,QAA7C,CAvDM;AAwDP;AACA;AACA8D,IAAAA,oBAAoB,EAAEC,kCA1Df;AA2DPC,IAAAA,8BAA8B,EAAEC,oCA3DzB;AA4DPC,IAAAA,sCAAsC,EAAE9D,oBA5DjC;AA6DP+D,IAAAA,kBAAkB,EAAErB,IA7Db;AA8DPsB,IAAAA,WAAW,EAAEnE,WA9DN;AA+DPoE,IAAAA,8BAA8B,EAAErB,gBA/DzB;AAgEPsB,IAAAA,gCAAgC,EAAEjE,kBAhE3B;AAiEPC,IAAAA,WAjEO;AAkEPiE,IAAAA,kCAAkC,EAAEtE;AAlE7B,GAAR,CADM,EAqEN,CACCD,QADD,EAECG,oBAFD,EAGCD,cAHD,EAIC+B,aAJD,EAKCY,sBALD,EAMCzC,oBAND,EAOC0C,IAPD,EAQC7C,WARD,EASCI,kBATD,EAUCC,WAVD,CArEM,CAAP;AAkFA;;eAEcP,sB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Platform, useMemo } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as coreStore,\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n\t__experimentalFetchMedia as fetchMedia,\n} from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { mediaUpload } from '../../utils';\nimport { store as editorStore } from '../../store';\n\nconst EMPTY_BLOCKS_LIST = [];\n\n/**\n * React hook used to compute the block editor settings to use for the post editor.\n *\n * @param {Object} settings EditorProvider settings prop.\n * @param {boolean} hasTemplate Whether template mode is enabled.\n *\n * @return {Object} Block Editor Settings.\n */\nfunction useBlockEditorSettings( settings, hasTemplate ) {\n\tconst {\n\t\treusableBlocks,\n\t\thasUploadPermissions,\n\t\tcanUseUnfilteredHTML,\n\t\tuserCanCreatePages,\n\t\tpageOnFront,\n\t\tpostType,\n\t} = useSelect( ( select ) => {\n\t\tconst { canUserUseUnfilteredHTML, getCurrentPostType } =\n\t\t\tselect( editorStore );\n\t\tconst isWeb = Platform.OS === 'web';\n\t\tconst { canUser, getEntityRecord } = select( coreStore );\n\n\t\tconst siteSettings = canUser( 'read', 'settings' )\n\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\tcanUseUnfilteredHTML: canUserUseUnfilteredHTML(),\n\t\t\treusableBlocks: isWeb\n\t\t\t\t? select( coreStore ).getEntityRecords(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'wp_block',\n\t\t\t\t\t\t{ per_page: -1 }\n\t\t\t\t )\n\t\t\t\t: EMPTY_BLOCKS_LIST, // Reusable blocks are fetched in the native version of this hook.\n\t\t\thasUploadPermissions: canUser( 'create', 'media' ) ?? true,\n\t\t\tuserCanCreatePages: canUser( 'create', 'pages' ),\n\t\t\tpageOnFront: siteSettings?.page_on_front,\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t}, [] );\n\n\tconst settingsBlockPatterns =\n\t\tsettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tsettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst { restBlockPatterns, restBlockPatternCategories } = useSelect(\n\t\t( select ) => ( {\n\t\t\trestBlockPatterns: select( coreStore ).getBlockPatterns(),\n\t\t\trestBlockPatternCategories:\n\t\t\t\tselect( coreStore ).getBlockPatternCategories(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatterns || [] ),\n\t\t\t\t...( restBlockPatterns || [] ),\n\t\t\t]\n\t\t\t\t.filter(\n\t\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t\t)\n\t\t\t\t.filter( ( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( postType ) )\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t[ settingsBlockPatterns, restBlockPatterns, postType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\n\tconst { undo } = useDispatch( editorStore );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\t/**\n\t * Creates a Post entity.\n\t * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages.\n\t *\n\t * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord.\n\t * @return {Object} the post type object that was created.\n\t */\n\tconst createPageEntity = ( options ) => {\n\t\tif ( ! userCanCreatePages ) {\n\t\t\treturn Promise.reject( {\n\t\t\t\tmessage: __( 'You do not have permission to create Pages.' ),\n\t\t\t} );\n\t\t}\n\t\treturn saveEntityRecord( 'postType', 'page', options );\n\t};\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\t...Object.fromEntries(\n\t\t\t\tObject.entries( settings ).filter( ( [ key ] ) =>\n\t\t\t\t\t[\n\t\t\t\t\t\t'__experimentalBlockDirectory',\n\t\t\t\t\t\t'__experimentalBlockInspectorTabs',\n\t\t\t\t\t\t'__experimentalDiscussionSettings',\n\t\t\t\t\t\t'__experimentalFeatures',\n\t\t\t\t\t\t'__experimentalPreferredStyleVariations',\n\t\t\t\t\t\t'__experimentalSetIsInserterOpened',\n\t\t\t\t\t\t'__unstableGalleryWithImageBlocks',\n\t\t\t\t\t\t'alignWide',\n\t\t\t\t\t\t'allowedBlockTypes',\n\t\t\t\t\t\t'bodyPlaceholder',\n\t\t\t\t\t\t'canLockBlocks',\n\t\t\t\t\t\t'codeEditingEnabled',\n\t\t\t\t\t\t'colors',\n\t\t\t\t\t\t'disableCustomColors',\n\t\t\t\t\t\t'disableCustomFontSizes',\n\t\t\t\t\t\t'disableCustomSpacingSizes',\n\t\t\t\t\t\t'disableCustomGradients',\n\t\t\t\t\t\t'disableLayoutStyles',\n\t\t\t\t\t\t'enableCustomLineHeight',\n\t\t\t\t\t\t'enableCustomSpacing',\n\t\t\t\t\t\t'enableCustomUnits',\n\t\t\t\t\t\t'focusMode',\n\t\t\t\t\t\t'fontSizes',\n\t\t\t\t\t\t'gradients',\n\t\t\t\t\t\t'generateAnchors',\n\t\t\t\t\t\t'hasFixedToolbar',\n\t\t\t\t\t\t'isDistractionFree',\n\t\t\t\t\t\t'hasInlineToolbar',\n\t\t\t\t\t\t'imageDefaultSize',\n\t\t\t\t\t\t'imageDimensions',\n\t\t\t\t\t\t'imageEditing',\n\t\t\t\t\t\t'imageSizes',\n\t\t\t\t\t\t'isRTL',\n\t\t\t\t\t\t'keepCaretInsideBlock',\n\t\t\t\t\t\t'maxWidth',\n\t\t\t\t\t\t'onUpdateDefaultBlockStyles',\n\t\t\t\t\t\t'styles',\n\t\t\t\t\t\t'template',\n\t\t\t\t\t\t'templateLock',\n\t\t\t\t\t\t'titlePlaceholder',\n\t\t\t\t\t\t'supportsLayout',\n\t\t\t\t\t\t'widgetTypesToHideFromLegacyWidgetBlock',\n\t\t\t\t\t\t'__unstableResolvedAssets',\n\t\t\t\t\t].includes( key )\n\t\t\t\t)\n\t\t\t),\n\t\t\tmediaUpload: hasUploadPermissions ? mediaUpload : undefined,\n\t\t\t__experimentalReusableBlocks: reusableBlocks,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t\t__experimentalFetchLinkSuggestions: ( search, searchOptions ) =>\n\t\t\t\tfetchLinkSuggestions( search, searchOptions, settings ),\n\t\t\t// TODO: We should find a proper way to consolidate similar cases\n\t\t\t// like reusable blocks, fetch entities, etc.\n\t\t\t__unstableFetchMedia: fetchMedia,\n\t\t\t__experimentalFetchRichUrlData: fetchUrlData,\n\t\t\t__experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,\n\t\t\t__experimentalUndo: undo,\n\t\t\toutlineMode: hasTemplate,\n\t\t\t__experimentalCreatePageEntity: createPageEntity,\n\t\t\t__experimentalUserCanCreatePages: userCanCreatePages,\n\t\t\tpageOnFront,\n\t\t\t__experimentalPreferPatternsOnRoot: hasTemplate,\n\t\t} ),\n\t\t[\n\t\t\tsettings,\n\t\t\thasUploadPermissions,\n\t\t\treusableBlocks,\n\t\t\tblockPatterns,\n\t\t\tblockPatternCategories,\n\t\t\tcanUseUnfilteredHTML,\n\t\t\tundo,\n\t\t\thasTemplate,\n\t\t\tuserCanCreatePages,\n\t\t\tpageOnFront,\n\t\t]\n\t);\n}\n\nexport default useBlockEditorSettings;\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.js"],"names":["EMPTY_BLOCKS_LIST","useBlockEditorSettings","settings","hasTemplate","reusableBlocks","hasUploadPermissions","canUseUnfilteredHTML","userCanCreatePages","pageOnFront","postType","select","canUserUseUnfilteredHTML","getCurrentPostType","editorStore","isWeb","Platform","OS","canUser","getEntityRecord","coreStore","siteSettings","undefined","getEntityRecords","per_page","page_on_front","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","restBlockPatterns","restBlockPatternCategories","getBlockPatterns","getBlockPatternCategories","blockPatterns","filter","x","index","arr","findIndex","y","name","postTypes","Array","isArray","includes","blockPatternCategories","undo","saveEntityRecord","createPageEntity","options","Promise","reject","message","Object","fromEntries","entries","key","mediaUpload","__experimentalReusableBlocks","__experimentalFetchLinkSuggestions","search","searchOptions","__unstableFetchMedia","fetchMedia","__experimentalFetchRichUrlData","fetchUrlData","__experimentalCanUserUseUnfilteredHTML","__experimentalUndo","outlineMode","__experimentalCreatePageEntity","__experimentalUserCanCreatePages","__experimentalPreferPatternsOnRoot"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AAMA;;AAKA;;AACA;;AAjBA;AACA;AACA;;AAWA;AACA;AACA;AAIA,MAAMA,iBAAiB,GAAG,EAA1B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,sBAAT,CAAiCC,QAAjC,EAA2CC,WAA3C,EAAyD;AAAA;;AACxD,QAAM;AACLC,IAAAA,cADK;AAELC,IAAAA,oBAFK;AAGLC,IAAAA,oBAHK;AAILC,IAAAA,kBAJK;AAKLC,IAAAA,WALK;AAMLC,IAAAA;AANK,MAOF,qBAAaC,MAAF,IAAc;AAAA;;AAC5B,UAAM;AAAEC,MAAAA,wBAAF;AAA4BC,MAAAA;AAA5B,QACLF,MAAM,CAAEG,YAAF,CADP;AAEA,UAAMC,KAAK,GAAGC,kBAASC,EAAT,KAAgB,KAA9B;AACA,UAAM;AAAEC,MAAAA,OAAF;AAAWC,MAAAA;AAAX,QAA+BR,MAAM,CAAES,eAAF,CAA3C;AAEA,UAAMC,YAAY,GAAGH,O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8B,EAAEC,oCA3DzB;AA4DPC,IAAAA,sCAAsC,EAAE9D,oBA5DjC;AA6DP+D,IAAAA,kBAAkB,EAAErB,IA7Db;AA8DPsB,IAAAA,WAAW,EAAEnE,WA9DN;AA+DPoE,IAAAA,8BAA8B,EAAErB,gBA/DzB;AAgEPsB,IAAAA,gCAAgC,EAAEjE,kBAhE3B;AAiEPC,IAAAA,WAjEO;AAkEPiE,IAAAA,kCAAkC,EAAEtE;AAlE7B,GAAR,CADM,EAqEN,CACCD,QADD,EAECG,oBAFD,EAGCD,cAHD,EAIC+B,aAJD,EAKCY,sBALD,EAMCzC,oBAND,EAOC0C,IAPD,EAQC7C,WARD,EASCI,kBATD,EAUCC,WAVD,CArEM,CAAP;AAkFA;;eAEcP,sB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Platform, useMemo } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as coreStore,\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n\t__experimentalFetchMedia as fetchMedia,\n} from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { mediaUpload } from '../../utils';\nimport { store as editorStore } from '../../store';\n\nconst EMPTY_BLOCKS_LIST = [];\n\n/**\n * React hook used to compute the block editor settings to use for the post editor.\n *\n * @param {Object} settings EditorProvider settings prop.\n * @param {boolean} hasTemplate Whether template mode is enabled.\n *\n * @return {Object} Block Editor Settings.\n */\nfunction useBlockEditorSettings( settings, hasTemplate ) {\n\tconst {\n\t\treusableBlocks,\n\t\thasUploadPermissions,\n\t\tcanUseUnfilteredHTML,\n\t\tuserCanCreatePages,\n\t\tpageOnFront,\n\t\tpostType,\n\t} = useSelect( ( select ) => {\n\t\tconst { canUserUseUnfilteredHTML, getCurrentPostType } =\n\t\t\tselect( editorStore );\n\t\tconst isWeb = Platform.OS === 'web';\n\t\tconst { canUser, getEntityRecord } = select( coreStore );\n\n\t\tconst siteSettings = canUser( 'read', 'settings' )\n\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\tcanUseUnfilteredHTML: canUserUseUnfilteredHTML(),\n\t\t\treusableBlocks: isWeb\n\t\t\t\t? select( coreStore ).getEntityRecords(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'wp_block',\n\t\t\t\t\t\t{ per_page: -1 }\n\t\t\t\t )\n\t\t\t\t: EMPTY_BLOCKS_LIST, // Reusable blocks are fetched in the native version of this hook.\n\t\t\thasUploadPermissions: canUser( 'create', 'media' ) ?? true,\n\t\t\tuserCanCreatePages: canUser( 'create', 'pages' ),\n\t\t\tpageOnFront: siteSettings?.page_on_front,\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t}, [] );\n\n\tconst settingsBlockPatterns =\n\t\tsettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tsettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst { restBlockPatterns, restBlockPatternCategories } = useSelect(\n\t\t( select ) => ( {\n\t\t\trestBlockPatterns: select( coreStore ).getBlockPatterns(),\n\t\t\trestBlockPatternCategories:\n\t\t\t\tselect( coreStore ).getBlockPatternCategories(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatterns || [] ),\n\t\t\t\t...( restBlockPatterns || [] ),\n\t\t\t]\n\t\t\t\t.filter(\n\t\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t\t)\n\t\t\t\t.filter( ( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( postType ) )\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t[ settingsBlockPatterns, restBlockPatterns, postType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\n\tconst { undo } = useDispatch( editorStore );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\t/**\n\t * Creates a Post entity.\n\t * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages.\n\t *\n\t * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord.\n\t * @return {Object} the post type object that was created.\n\t */\n\tconst createPageEntity = ( options ) => {\n\t\tif ( ! userCanCreatePages ) {\n\t\t\treturn Promise.reject( {\n\t\t\t\tmessage: __( 'You do not have permission to create Pages.' ),\n\t\t\t} );\n\t\t}\n\t\treturn saveEntityRecord( 'postType', 'page', options );\n\t};\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\t...Object.fromEntries(\n\t\t\t\tObject.entries( settings ).filter( ( [ key ] ) =>\n\t\t\t\t\t[\n\t\t\t\t\t\t'__experimentalBlockDirectory',\n\t\t\t\t\t\t'__experimentalDiscussionSettings',\n\t\t\t\t\t\t'__experimentalFeatures',\n\t\t\t\t\t\t'__experimentalPreferredStyleVariations',\n\t\t\t\t\t\t'__experimentalSetIsInserterOpened',\n\t\t\t\t\t\t'__unstableGalleryWithImageBlocks',\n\t\t\t\t\t\t'alignWide',\n\t\t\t\t\t\t'allowedBlockTypes',\n\t\t\t\t\t\t'blockInspectorTabs',\n\t\t\t\t\t\t'bodyPlaceholder',\n\t\t\t\t\t\t'canLockBlocks',\n\t\t\t\t\t\t'codeEditingEnabled',\n\t\t\t\t\t\t'colors',\n\t\t\t\t\t\t'disableCustomColors',\n\t\t\t\t\t\t'disableCustomFontSizes',\n\t\t\t\t\t\t'disableCustomSpacingSizes',\n\t\t\t\t\t\t'disableCustomGradients',\n\t\t\t\t\t\t'disableLayoutStyles',\n\t\t\t\t\t\t'enableCustomLineHeight',\n\t\t\t\t\t\t'enableCustomSpacing',\n\t\t\t\t\t\t'enableCustomUnits',\n\t\t\t\t\t\t'focusMode',\n\t\t\t\t\t\t'fontSizes',\n\t\t\t\t\t\t'gradients',\n\t\t\t\t\t\t'generateAnchors',\n\t\t\t\t\t\t'hasFixedToolbar',\n\t\t\t\t\t\t'isDistractionFree',\n\t\t\t\t\t\t'hasInlineToolbar',\n\t\t\t\t\t\t'imageDefaultSize',\n\t\t\t\t\t\t'imageDimensions',\n\t\t\t\t\t\t'imageEditing',\n\t\t\t\t\t\t'imageSizes',\n\t\t\t\t\t\t'isRTL',\n\t\t\t\t\t\t'keepCaretInsideBlock',\n\t\t\t\t\t\t'maxWidth',\n\t\t\t\t\t\t'onUpdateDefaultBlockStyles',\n\t\t\t\t\t\t'styles',\n\t\t\t\t\t\t'template',\n\t\t\t\t\t\t'templateLock',\n\t\t\t\t\t\t'titlePlaceholder',\n\t\t\t\t\t\t'supportsLayout',\n\t\t\t\t\t\t'widgetTypesToHideFromLegacyWidgetBlock',\n\t\t\t\t\t\t'__unstableResolvedAssets',\n\t\t\t\t\t].includes( key )\n\t\t\t\t)\n\t\t\t),\n\t\t\tmediaUpload: hasUploadPermissions ? mediaUpload : undefined,\n\t\t\t__experimentalReusableBlocks: reusableBlocks,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t\t__experimentalFetchLinkSuggestions: ( search, searchOptions ) =>\n\t\t\t\tfetchLinkSuggestions( search, searchOptions, settings ),\n\t\t\t// TODO: We should find a proper way to consolidate similar cases\n\t\t\t// like reusable blocks, fetch entities, etc.\n\t\t\t__unstableFetchMedia: fetchMedia,\n\t\t\t__experimentalFetchRichUrlData: fetchUrlData,\n\t\t\t__experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,\n\t\t\t__experimentalUndo: undo,\n\t\t\toutlineMode: hasTemplate,\n\t\t\t__experimentalCreatePageEntity: createPageEntity,\n\t\t\t__experimentalUserCanCreatePages: userCanCreatePages,\n\t\t\tpageOnFront,\n\t\t\t__experimentalPreferPatternsOnRoot: hasTemplate,\n\t\t} ),\n\t\t[\n\t\t\tsettings,\n\t\t\thasUploadPermissions,\n\t\t\treusableBlocks,\n\t\t\tblockPatterns,\n\t\t\tblockPatternCategories,\n\t\t\tcanUseUnfilteredHTML,\n\t\t\tundo,\n\t\t\thasTemplate,\n\t\t\tuserCanCreatePages,\n\t\t\tpageOnFront,\n\t\t]\n\t);\n}\n\nexport default useBlockEditorSettings;\n"]}
@@ -69,10 +69,13 @@ const createWithMetaAttributeSource = metaAttributes => (0, _compose.createHighe
69
69
  return (0, _element.createElement)(BlockEdit, (0, _extends2.default)({
70
70
  attributes: mergedAttributes,
71
71
  setAttributes: nextAttributes => {
72
- const nextMeta = Object.fromEntries(Object.entries( // Filter to intersection of keys between the updated
72
+ const nextMeta = Object.fromEntries(Object.entries(nextAttributes !== null && nextAttributes !== void 0 ? nextAttributes : {}).filter( // Filter to intersection of keys between the updated
73
73
  // attributes and those with an associated meta key.
74
- (0, _lodash.pickBy)(nextAttributes, (value, key) => metaAttributes[key])).map(_ref2 => {
75
- let [attributeKey, value] = _ref2;
74
+ _ref2 => {
75
+ let [key] = _ref2;
76
+ return key in metaAttributes;
77
+ }).map(_ref3 => {
78
+ let [attributeKey, value] = _ref3;
76
79
  return [// Rename the keys to the expected meta key name.
77
80
  metaAttributes[attributeKey], value];
78
81
  }));
@@ -96,10 +99,15 @@ const createWithMetaAttributeSource = metaAttributes => (0, _compose.createHighe
96
99
 
97
100
 
98
101
  function shimAttributeSource(settings) {
102
+ var _settings$attributes;
103
+
99
104
  /** @type {WPMetaAttributeMapping} */
100
- const metaAttributes = (0, _lodash.mapValues)((0, _lodash.pickBy)(settings.attributes, {
101
- source: 'meta'
102
- }), 'meta');
105
+ const metaAttributes = (0, _lodash.mapValues)(Object.fromEntries(Object.entries((_settings$attributes = settings.attributes) !== null && _settings$attributes !== void 0 ? _settings$attributes : {}).filter(_ref4 => {
106
+ let [, {
107
+ source
108
+ }] = _ref4;
109
+ return source === 'meta';
110
+ })), 'meta');
103
111
 
104
112
  if (!(0, _lodash.isEmpty)(metaAttributes)) {
105
113
  settings.edit = createWithMetaAttributeSource(metaAttributes)(settings.edit);
@@ -127,10 +135,10 @@ function shimAttributeSource(settings) {
127
135
  // In the future, we could support updating block settings, at which point this
128
136
  // implementation could use that mechanism instead.
129
137
 
130
- (0, _data.select)(_blocks.store).getBlockTypes().map(_ref3 => {
138
+ (0, _data.select)(_blocks.store).getBlockTypes().map(_ref5 => {
131
139
  let {
132
140
  name
133
- } = _ref3;
141
+ } = _ref5;
134
142
  return (0, _data.select)(_blocks.store).getBlockType(name);
135
143
  }).forEach(shimAttributeSource);
136
144
  //# sourceMappingURL=custom-sources-backwards-compatibility.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/hooks/custom-sources-backwards-compatibility.js"],"names":["createWithMetaAttributeSource","metaAttributes","BlockEdit","attributes","setAttributes","props","postType","select","editorStore","getCurrentPostType","meta","setMeta","mergedAttributes","metaKey","nextAttributes","nextMeta","Object","fromEntries","entries","value","key","map","attributeKey","shimAttributeSource","settings","source","edit","blocksStore","getBlockTypes","name","getBlockType","forEach"],"mappings":";;;;AAWA;;;;AARA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AAKA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;;AAGA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;A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AACA;AACA;AACA;AACA;;;AACA,SAASkB,mBAAT,CAA8BC,QAA9B,EAAyC;AACxC;AACA,QAAMvB,cAAc,GAAG,uBACtB,oBAAQuB,QAAQ,CAACrB,UAAjB,EAA6B;AAAEsB,IAAAA,MAAM,EAAE;AAAV,GAA7B,CADsB,EAEtB,MAFsB,CAAvB;;AAIA,MAAK,CAAE,qBAASxB,cAAT,CAAP,EAAmC;AAClCuB,IAAAA,QAAQ,CAACE,IAAT,GAAgB1B,6BAA6B,CAAEC,cAAF,CAA7B,CACfuB,QAAQ,CAACE,IADM,CAAhB;AAGA;;AAED,SAAOF,QAAP;AACA;;AAED,sBACC,0BADD,EAEC,0EAFD,EAGCD,mBAHD,E,CAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,kBAAcI,aAAd,EACEC,aADF,GAEEP,GAFF,CAEO;AAAA,MAAE;AAAEQ,IAAAA;AAAF,GAAF;AAAA,SAAgB,kBAAcF,aAAd,EAA4BG,YAA5B,CAA0CD,IAA1C,CAAhB;AAAA,CAFP,EAGEE,OAHF,CAGWR,mBAHX","sourcesContent":["/**\n * External dependencies\n */\nimport { pickBy, mapValues, isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { select as globalSelect, useSelect } from '@wordpress/data';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\n\n/** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */\n/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */\n\n/**\n * Object whose keys are the names of block attributes, where each value\n * represents the meta key to which the block attribute is intended to save.\n *\n * @see https://developer.wordpress.org/reference/functions/register_meta/\n *\n * @typedef {Object<string,string>} WPMetaAttributeMapping\n */\n\n/**\n * Given a mapping of attribute names (meta source attributes) to their\n * associated meta key, returns a higher order component that overrides its\n * `attributes` and `setAttributes` props to sync any changes with the edited\n * post's meta keys.\n *\n * @param {WPMetaAttributeMapping} metaAttributes Meta attribute mapping.\n *\n * @return {WPHigherOrderComponent} Higher-order component.\n */\nconst createWithMetaAttributeSource = ( metaAttributes ) =>\n\tcreateHigherOrderComponent(\n\t\t( BlockEdit ) =>\n\t\t\t( { attributes, setAttributes, ...props } ) => {\n\t\t\t\tconst postType = useSelect(\n\t\t\t\t\t( select ) => select( editorStore ).getCurrentPostType(),\n\t\t\t\t\t[]\n\t\t\t\t);\n\t\t\t\tconst [ meta, setMeta ] = useEntityProp(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\t'meta'\n\t\t\t\t);\n\n\t\t\t\tconst mergedAttributes = useMemo(\n\t\t\t\t\t() => ( {\n\t\t\t\t\t\t...attributes,\n\t\t\t\t\t\t...mapValues(\n\t\t\t\t\t\t\tmetaAttributes,\n\t\t\t\t\t\t\t( metaKey ) => meta[ metaKey ]\n\t\t\t\t\t\t),\n\t\t\t\t\t} ),\n\t\t\t\t\t[ attributes, meta ]\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<BlockEdit\n\t\t\t\t\t\tattributes={ mergedAttributes }\n\t\t\t\t\t\tsetAttributes={ ( nextAttributes ) => {\n\t\t\t\t\t\t\tconst nextMeta = Object.fromEntries(\n\t\t\t\t\t\t\t\tObject.entries(\n\t\t\t\t\t\t\t\t\t// Filter to intersection of keys between the updated\n\t\t\t\t\t\t\t\t\t// attributes and those with an associated meta key.\n\t\t\t\t\t\t\t\t\tpickBy(\n\t\t\t\t\t\t\t\t\t\tnextAttributes,\n\t\t\t\t\t\t\t\t\t\t( value, key ) => metaAttributes[ key ]\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t).map( ( [ attributeKey, value ] ) => [\n\t\t\t\t\t\t\t\t\t// Rename the keys to the expected meta key name.\n\t\t\t\t\t\t\t\t\tmetaAttributes[ attributeKey ],\n\t\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\t] )\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif ( ! isEmpty( nextMeta ) ) {\n\t\t\t\t\t\t\t\tsetMeta( nextMeta );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tsetAttributes( nextAttributes );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t},\n\t\t'withMetaAttributeSource'\n\t);\n\n/**\n * Filters a registered block's settings to enhance a block's `edit` component\n * to upgrade meta-sourced attributes to use the post's meta entity property.\n *\n * @param {WPBlockSettings} settings Registered block settings.\n *\n * @return {WPBlockSettings} Filtered block settings.\n */\nfunction shimAttributeSource( settings ) {\n\t/** @type {WPMetaAttributeMapping} */\n\tconst metaAttributes = mapValues(\n\t\tpickBy( settings.attributes, { source: 'meta' } ),\n\t\t'meta'\n\t);\n\tif ( ! isEmpty( metaAttributes ) ) {\n\t\tsettings.edit = createWithMetaAttributeSource( metaAttributes )(\n\t\t\tsettings.edit\n\t\t);\n\t}\n\n\treturn settings;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/custom-sources-backwards-compatibility/shim-attribute-source',\n\tshimAttributeSource\n);\n\n// The above filter will only capture blocks registered after the filter was\n// added. There may already be blocks registered by this point, and those must\n// be updated to apply the shim.\n//\n// The following implementation achieves this, albeit with a couple caveats:\n// - Only blocks registered on the global store will be modified.\n// - The block settings are directly mutated, since there is currently no\n// mechanism to update an existing block registration. This is the reason for\n// `getBlockType` separate from `getBlockTypes`, since the latter returns a\n// _copy_ of the block registration (i.e. the mutation would not affect the\n// actual registered block settings).\n//\n// `getBlockTypes` or `getBlockType` implementation could change in the future\n// in regards to creating settings clones, but the corresponding end-to-end\n// tests for meta blocks should cover against any potential regressions.\n//\n// In the future, we could support updating block settings, at which point this\n// implementation could use that mechanism instead.\nglobalSelect( blocksStore )\n\t.getBlockTypes()\n\t.map( ( { name } ) => globalSelect( blocksStore ).getBlockType( name ) )\n\t.forEach( shimAttributeSource );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/hooks/custom-sources-backwards-compatibility.js"],"names":["createWithMetaAttributeSource","metaAttributes","BlockEdit","attributes","setAttributes","props","postType","select","editorStore","getCurrentPostType","meta","setMeta","mergedAttributes","metaKey","nextAttributes","nextMeta","Object","fromEntries","entries","filter","key","map","attributeKey","value","shimAttributeSource","settings","source","edit","blocksStore","getBlockTypes","name","getBlockType","forEach"],"mappings":";;;;AAWA;;;;AARA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AAKA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;;AAGA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,6BAA6B,GAAKC,cAAF,IACrC,yCACGC,SAAF,IACC,QAA+C;AAAA,MAA7C;AAAEC,IAAAA,UAAF;AAAcC,IAAAA,aAAd;AAA6B,OAAGC;AAAhC,GAA6C;AAC9C,QAAMC,QAAQ,GAAG,qBACdC,MAAF,IAAcA,MAAM,CAAEC,YAAF,CAAN,CAAsBC,kBAAtB,EADE,EAEhB,EAFgB,CAAjB;AAIA,QAAM,CAAEC,IAAF,EAAQC,OAAR,IAAoB,6BACzB,UADyB,EAEzBL,QAFyB,EAGzB,MAHyB,CAA1B;AAMA,QAAMM,gBAAgB,GAAG,sBACxB,OAAQ,EACP,GAAGT,UADI;AAEP,OAAG,uBACFF,cADE,EAEAY,OAAF,IAAeH,IAAI,CAAEG,OAAF,CAFjB;AAFI,GAAR,CADwB,EAQxB,CAAEV,UAAF,EAAcO,IAAd,CARwB,CAAzB;AAWA,SACC,4BAAC,SAAD;AACC,IAAA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ACC,0BADD,EAEC,0EAFD,EAGCD,mBAHD,E,CAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,kBAAcI,aAAd,EACEC,aADF,GAEER,GAFF,CAEO;AAAA,MAAE;AAAES,IAAAA;AAAF,GAAF;AAAA,SAAgB,kBAAcF,aAAd,EAA4BG,YAA5B,CAA0CD,IAA1C,CAAhB;AAAA,CAFP,EAGEE,OAHF,CAGWR,mBAHX","sourcesContent":["/**\n * External dependencies\n */\nimport { mapValues, isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { select as globalSelect, useSelect } from '@wordpress/data';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\n\n/** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */\n/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */\n\n/**\n * Object whose keys are the names of block attributes, where each value\n * represents the meta key to which the block attribute is intended to save.\n *\n * @see https://developer.wordpress.org/reference/functions/register_meta/\n *\n * @typedef {Object<string,string>} WPMetaAttributeMapping\n */\n\n/**\n * Given a mapping of attribute names (meta source attributes) to their\n * associated meta key, returns a higher order component that overrides its\n * `attributes` and `setAttributes` props to sync any changes with the edited\n * post's meta keys.\n *\n * @param {WPMetaAttributeMapping} metaAttributes Meta attribute mapping.\n *\n * @return {WPHigherOrderComponent} Higher-order component.\n */\nconst createWithMetaAttributeSource = ( metaAttributes ) =>\n\tcreateHigherOrderComponent(\n\t\t( BlockEdit ) =>\n\t\t\t( { attributes, setAttributes, ...props } ) => {\n\t\t\t\tconst postType = useSelect(\n\t\t\t\t\t( select ) => select( editorStore ).getCurrentPostType(),\n\t\t\t\t\t[]\n\t\t\t\t);\n\t\t\t\tconst [ meta, setMeta ] = useEntityProp(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\t'meta'\n\t\t\t\t);\n\n\t\t\t\tconst mergedAttributes = useMemo(\n\t\t\t\t\t() => ( {\n\t\t\t\t\t\t...attributes,\n\t\t\t\t\t\t...mapValues(\n\t\t\t\t\t\t\tmetaAttributes,\n\t\t\t\t\t\t\t( metaKey ) => meta[ metaKey ]\n\t\t\t\t\t\t),\n\t\t\t\t\t} ),\n\t\t\t\t\t[ attributes, meta ]\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<BlockEdit\n\t\t\t\t\t\tattributes={ mergedAttributes }\n\t\t\t\t\t\tsetAttributes={ ( nextAttributes ) => {\n\t\t\t\t\t\t\tconst nextMeta = Object.fromEntries(\n\t\t\t\t\t\t\t\tObject.entries( nextAttributes ?? {} )\n\t\t\t\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t\t\t\t// Filter to intersection of keys between the updated\n\t\t\t\t\t\t\t\t\t\t// attributes and those with an associated meta key.\n\t\t\t\t\t\t\t\t\t\t( [ key ] ) => key in metaAttributes\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t.map( ( [ attributeKey, value ] ) => [\n\t\t\t\t\t\t\t\t\t\t// Rename the keys to the expected meta key name.\n\t\t\t\t\t\t\t\t\t\tmetaAttributes[ attributeKey ],\n\t\t\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\t\t] )\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif ( ! isEmpty( nextMeta ) ) {\n\t\t\t\t\t\t\t\tsetMeta( nextMeta );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tsetAttributes( nextAttributes );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t},\n\t\t'withMetaAttributeSource'\n\t);\n\n/**\n * Filters a registered block's settings to enhance a block's `edit` component\n * to upgrade meta-sourced attributes to use the post's meta entity property.\n *\n * @param {WPBlockSettings} settings Registered block settings.\n *\n * @return {WPBlockSettings} Filtered block settings.\n */\nfunction shimAttributeSource( settings ) {\n\t/** @type {WPMetaAttributeMapping} */\n\tconst metaAttributes = mapValues(\n\t\tObject.fromEntries(\n\t\t\tObject.entries( settings.attributes ?? {} ).filter(\n\t\t\t\t( [ , { source } ] ) => source === 'meta'\n\t\t\t)\n\t\t),\n\t\t'meta'\n\t);\n\tif ( ! isEmpty( metaAttributes ) ) {\n\t\tsettings.edit = createWithMetaAttributeSource( metaAttributes )(\n\t\t\tsettings.edit\n\t\t);\n\t}\n\n\treturn settings;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/custom-sources-backwards-compatibility/shim-attribute-source',\n\tshimAttributeSource\n);\n\n// The above filter will only capture blocks registered after the filter was\n// added. There may already be blocks registered by this point, and those must\n// be updated to apply the shim.\n//\n// The following implementation achieves this, albeit with a couple caveats:\n// - Only blocks registered on the global store will be modified.\n// - The block settings are directly mutated, since there is currently no\n// mechanism to update an existing block registration. This is the reason for\n// `getBlockType` separate from `getBlockTypes`, since the latter returns a\n// _copy_ of the block registration (i.e. the mutation would not affect the\n// actual registered block settings).\n//\n// `getBlockTypes` or `getBlockType` implementation could change in the future\n// in regards to creating settings clones, but the corresponding end-to-end\n// tests for meta blocks should cover against any potential regressions.\n//\n// In the future, we could support updating block settings, at which point this\n// implementation could use that mechanism instead.\nglobalSelect( blocksStore )\n\t.getBlockTypes()\n\t.map( ( { name } ) => globalSelect( blocksStore ).getBlockType( name ) )\n\t.forEach( shimAttributeSource );\n"]}
@@ -46,6 +46,7 @@ function PostAuthorSelect() {
46
46
  };
47
47
 
48
48
  return createElement(SelectControl, {
49
+ __nextHasNoMarginBottom: true,
49
50
  className: "post-author-selector",
50
51
  label: __('Author'),
51
52
  options: authorOptions,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-author/select.js"],"names":["__","useMemo","useSelect","useDispatch","decodeEntities","SelectControl","store","coreStore","editorStore","AUTHORS_QUERY","PostAuthorSelect","editPost","postAuthor","authors","select","getEditedPostAttribute","getUsers","authorOptions","map","author","value","id","label","name","setAuthorId","Number"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,aAAT,QAA8B,uBAA9B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,aAArC;AACA,SAASC,aAAT,QAA8B,aAA9B;;AAEA,SAASC,gBAAT,GAA4B;AAC3B,QAAM;AAAEC,IAAAA;AAAF,MAAeR,WAAW,CAAEK,WAAF,CAAhC;AACA,QAAM;AAAEI,IAAAA,UAAF;AAAcC,IAAAA;AAAd,MAA0BX,SAAS,CAAIY,MAAF,IAAc;AACxD,WAAO;AACNF,MAAAA,UAAU,EACTE,MAAM,CAAEN,WAAF,CAAN,CAAsBO,sBAAtB,CAA8C,QAA9C,CAFK;AAGNF,MAAAA,OAAO,EAAEC,MAAM,CAAEP,SAAF,CAAN,CAAoBS,QAApB,CAA8BP,aAA9B;AAHH,KAAP;AAKA,GANwC,EAMtC,EANsC,CAAzC;AAQA,QAAMQ,aAAa,GAAGhB,OAAO,CAAE,MAAM;AACpC,WAAO,CAAEY,OAAF,aAAEA,OAAF,cAAEA,OAAF,GAAa,EAAb,EAAkBK,GAAlB,CAAyBC,MAAF,IAAc;AAC3C,aAAO;AACNC,QAAAA,KAAK,EAAED,MAAM,CAACE,EADR;AAENC,QAAAA,KAAK,EAAElB,cAAc,CAAEe,MAAM,CAACI,IAAT;AAFf,OAAP;AAIA,KALM,CAAP;AAMA,GAP4B,EAO1B,CAAEV,OAAF,CAP0B,CAA7B;;AASA,QAAMW,WAAW,GAAKJ,KAAF,IAAa;AAChC,UAAMD,MAAM,GAAGM,MAAM,CAAEL,KAAF,CAArB;AACAT,IAAAA,QAAQ,CAAE;AAAEQ,MAAAA;AAAF,KAAF,CAAR;AACA,GAHD;;AAKA,SACC,cAAC,aAAD;AACC,IAAA,SAAS,EAAC,sBADX;AAEC,IAAA,KAAK,EAAGnB,EAAE,CAAE,QAAF,CAFX;AAGC,IAAA,OAAO,EAAGiB,aAHX;AAIC,IAAA,QAAQ,EAAGO,WAJZ;AAKC,IAAA,KAAK,EAAGZ;AALT,IADD;AASA;;AAED,eAAeF,gBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { SelectControl } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { AUTHORS_QUERY } from './constants';\n\nfunction PostAuthorSelect() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { postAuthor, authors } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostAuthor:\n\t\t\t\tselect( editorStore ).getEditedPostAttribute( 'author' ),\n\t\t\tauthors: select( coreStore ).getUsers( AUTHORS_QUERY ),\n\t\t};\n\t}, [] );\n\n\tconst authorOptions = useMemo( () => {\n\t\treturn ( authors ?? [] ).map( ( author ) => {\n\t\t\treturn {\n\t\t\t\tvalue: author.id,\n\t\t\t\tlabel: decodeEntities( author.name ),\n\t\t\t};\n\t\t} );\n\t}, [ authors ] );\n\n\tconst setAuthorId = ( value ) => {\n\t\tconst author = Number( value );\n\t\teditPost( { author } );\n\t};\n\n\treturn (\n\t\t<SelectControl\n\t\t\tclassName=\"post-author-selector\"\n\t\t\tlabel={ __( 'Author' ) }\n\t\t\toptions={ authorOptions }\n\t\t\tonChange={ setAuthorId }\n\t\t\tvalue={ postAuthor }\n\t\t/>\n\t);\n}\n\nexport default PostAuthorSelect;\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-author/select.js"],"names":["__","useMemo","useSelect","useDispatch","decodeEntities","SelectControl","store","coreStore","editorStore","AUTHORS_QUERY","PostAuthorSelect","editPost","postAuthor","authors","select","getEditedPostAttribute","getUsers","authorOptions","map","author","value","id","label","name","setAuthorId","Number"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,aAAT,QAA8B,uBAA9B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,aAArC;AACA,SAASC,aAAT,QAA8B,aAA9B;;AAEA,SAASC,gBAAT,GAA4B;AAC3B,QAAM;AAAEC,IAAAA;AAAF,MAAeR,WAAW,CAAEK,WAAF,CAAhC;AACA,QAAM;AAAEI,IAAAA,UAAF;AAAcC,IAAAA;AAAd,MAA0BX,SAAS,CAAIY,MAAF,IAAc;AACxD,WAAO;AACNF,MAAAA,UAAU,EACTE,MAAM,CAAEN,WAAF,CAAN,CAAsBO,sBAAtB,CAA8C,QAA9C,CAFK;AAGNF,MAAAA,OAAO,EAAEC,MAAM,CAAEP,SAAF,CAAN,CAAoBS,QAApB,CAA8BP,aAA9B;AAHH,KAAP;AAKA,GANwC,EAMtC,EANsC,CAAzC;AAQA,QAAMQ,aAAa,GAAGhB,OAAO,CAAE,MAAM;AACpC,WAAO,CAAEY,OAAF,aAAEA,OAAF,cAAEA,OAAF,GAAa,EAAb,EAAkBK,GAAlB,CAAyBC,MAAF,IAAc;AAC3C,aAAO;AACNC,QAAAA,KAAK,EAAED,MAAM,CAACE,EADR;AAENC,QAAAA,KAAK,EAAElB,cAAc,CAAEe,MAAM,CAACI,IAAT;AAFf,OAAP;AAIA,KALM,CAAP;AAMA,GAP4B,EAO1B,CAAEV,OAAF,CAP0B,CAA7B;;AASA,QAAMW,WAAW,GAAKJ,KAAF,IAAa;AAChC,UAAMD,MAAM,GAAGM,MAAM,CAAEL,KAAF,CAArB;AACAT,IAAAA,QAAQ,CAAE;AAAEQ,MAAAA;AAAF,KAAF,CAAR;AACA,GAHD;;AAKA,SACC,cAAC,aAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,SAAS,EAAC,sBAFX;AAGC,IAAA,KAAK,EAAGnB,EAAE,CAAE,QAAF,CAHX;AAIC,IAAA,OAAO,EAAGiB,aAJX;AAKC,IAAA,QAAQ,EAAGO,WALZ;AAMC,IAAA,KAAK,EAAGZ;AANT,IADD;AAUA;;AAED,eAAeF,gBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { SelectControl } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { AUTHORS_QUERY } from './constants';\n\nfunction PostAuthorSelect() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { postAuthor, authors } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostAuthor:\n\t\t\t\tselect( editorStore ).getEditedPostAttribute( 'author' ),\n\t\t\tauthors: select( coreStore ).getUsers( AUTHORS_QUERY ),\n\t\t};\n\t}, [] );\n\n\tconst authorOptions = useMemo( () => {\n\t\treturn ( authors ?? [] ).map( ( author ) => {\n\t\t\treturn {\n\t\t\t\tvalue: author.id,\n\t\t\t\tlabel: decodeEntities( author.name ),\n\t\t\t};\n\t\t} );\n\t}, [ authors ] );\n\n\tconst setAuthorId = ( value ) => {\n\t\tconst author = Number( value );\n\t\teditPost( { author } );\n\t};\n\n\treturn (\n\t\t<SelectControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tclassName=\"post-author-selector\"\n\t\t\tlabel={ __( 'Author' ) }\n\t\t\toptions={ authorOptions }\n\t\t\tonChange={ setAuthorId }\n\t\t\tvalue={ postAuthor }\n\t\t/>\n\t);\n}\n\nexport default PostAuthorSelect;\n"]}
@@ -98,6 +98,7 @@ export default function PostFormat() {
98
98
  return createElement(PostFormatCheck, null, createElement("div", {
99
99
  className: "editor-post-format"
100
100
  }, createElement(SelectControl, {
101
+ __nextHasNoMarginBottom: true,
101
102
  label: __('Post Format'),
102
103
  value: postFormat,
103
104
  onChange: format => onUpdatePostFormat(format),
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-format/index.js"],"names":["__","sprintf","Button","SelectControl","useDispatch","useSelect","useInstanceId","store","coreStore","PostFormatCheck","editorStore","POST_FORMATS","id","caption","sort","a","b","normalizedA","toUpperCase","normalizedB","PostFormat","instanceId","postFormatSelectorId","postFormat","suggestedFormat","supportedFormats","select","getEditedPostAttribute","getSuggestedPostFormat","_postFormat","themeSupports","getThemeSupports","formats","filter","format","includes","suggestion","find","editPost","onUpdatePostFormat","map","label","value"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,MAAT,EAAiBC,aAAjB,QAAsC,uBAAtC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,eAAP,MAA4B,SAA5B;AACA,SAASF,KAAK,IAAIG,WAAlB,QAAqC,aAArC,C,CAEA;;AACA,OAAO,MAAMC,YAAY,GAAG,CAC3B;AAAEC,EAAAA,EAAE,EAAE,OAAN;A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cI,QAAQ,CAAE;AAAEJ,IAAAA;AAAF,GAAF,CAAjD;;AAEA,SACC,cAAC,eAAD,QACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,aAAD;AACC,IAAA,KAAK,EAAGlC,EAAE,CAAE,aAAF,CADX;AAEC,IAAA,KAAK,EAAGuB,UAFT;AAGC,IAAA,QAAQ,EAAKW,MAAF,IAAcK,kBAAkB,CAAEL,MAAF,CAH5C;AAIC,IAAA,EAAE,EAAGZ,oBAJN;AAKC,IAAA,OAAO,EAAGU,OAAO,CAACQ,GAAR,CAAeN,MAAF,KAAgB;AACtCO,MAAAA,KAAK,EAAEP,MAAM,CAACrB,OADwB;AAEtC6B,MAAAA,KAAK,EAAER,MAAM,CAACtB;AAFwB,KAAhB,CAAb;AALX,IADD,EAWGwB,UAAU,IAAIA,UAAU,CAACxB,EAAX,KAAkBW,UAAhC,IACD;AAAG,IAAA,SAAS,EAAC;AAAb,KACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,MADT;AAEC,IAAA,OAAO,EAAG,MACTgB,kBAAkB,CAAEH,UAAU,CAACxB,EAAb;AAHpB,KAMGX,OAAO;AACR;AACAD,EAAAA,EAAE,CAAE,4BAAF,CAFM,EAGRoC,UAAU,CAACvB,OAHH,CANV,CADD,CAZF,CADD,CADD;AAgCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button, SelectControl } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostFormatCheck from './check';\nimport { store as editorStore } from '../../store';\n\n// All WP post formats, sorted alphabetically by translated name.\nexport const POST_FORMATS = [\n\t{ id: 'aside', caption: __( 'Aside' ) },\n\t{ id: 'audio', caption: __( 'Audio' ) },\n\t{ id: 'chat', caption: __( 'Chat' ) },\n\t{ id: 'gallery', caption: __( 'Gallery' ) },\n\t{ id: 'image', caption: __( 'Image' ) },\n\t{ id: 'link', caption: __( 'Link' ) },\n\t{ id: 'quote', caption: __( 'Quote' ) },\n\t{ id: 'standard', caption: __( 'Standard' ) },\n\t{ id: 'status', caption: __( 'Status' ) },\n\t{ id: 'video', caption: __( 'Video' ) },\n].sort( ( a, b ) => {\n\tconst normalizedA = a.caption.toUpperCase();\n\tconst normalizedB = b.caption.toUpperCase();\n\n\tif ( normalizedA < normalizedB ) {\n\t\treturn -1;\n\t}\n\tif ( normalizedA > normalizedB ) {\n\t\treturn 1;\n\t}\n\treturn 0;\n} );\n\nexport default function PostFormat() {\n\tconst instanceId = useInstanceId( PostFormat );\n\tconst postFormatSelectorId = `post-format-selector-${ instanceId }`;\n\n\tconst { postFormat, suggestedFormat, supportedFormats } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostAttribute, getSuggestedPostFormat } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst _postFormat = getEditedPostAttribute( 'format' );\n\t\t\tconst themeSupports = select( coreStore ).getThemeSupports();\n\t\t\treturn {\n\t\t\t\tpostFormat: _postFormat ?? 'standard',\n\t\t\t\tsuggestedFormat: getSuggestedPostFormat(),\n\t\t\t\tsupportedFormats: themeSupports.formats,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst formats = POST_FORMATS.filter( ( format ) => {\n\t\t// Ensure current format is always in the set.\n\t\t// The current format may not be a format supported by the theme.\n\t\treturn (\n\t\t\tsupportedFormats?.includes( format.id ) || postFormat === format.id\n\t\t);\n\t} );\n\tconst suggestion = formats.find(\n\t\t( format ) => format.id === suggestedFormat\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tconst onUpdatePostFormat = ( format ) => editPost( { format } );\n\n\treturn (\n\t\t<PostFormatCheck>\n\t\t\t<div className=\"editor-post-format\">\n\t\t\t\t<SelectControl\n\t\t\t\t\tlabel={ __( 'Post Format' ) }\n\t\t\t\t\tvalue={ postFormat }\n\t\t\t\t\tonChange={ ( format ) => onUpdatePostFormat( format ) }\n\t\t\t\t\tid={ postFormatSelectorId }\n\t\t\t\t\toptions={ formats.map( ( format ) => ( {\n\t\t\t\t\t\tlabel: format.caption,\n\t\t\t\t\t\tvalue: format.id,\n\t\t\t\t\t} ) ) }\n\t\t\t\t/>\n\t\t\t\t{ suggestion && suggestion.id !== postFormat && (\n\t\t\t\t\t<p className=\"editor-post-format__suggestion\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\tonUpdatePostFormat( suggestion.id )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: post format */\n\t\t\t\t\t\t\t\t__( 'Apply suggested format: %s' ),\n\t\t\t\t\t\t\t\tsuggestion.caption\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</PostFormatCheck>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-format/index.js"],"names":["__","sprintf","Button","SelectControl","useDispatch","useSelect","useInstanceId","store","coreStore","PostFormatCheck","editorStore","POST_FORMATS","id","caption","sort","a","b","normalizedA","toUpperCase","normalizedB","PostFormat","instanceId","postFormatSelectorId","postFormat","suggestedFormat","supportedFormats","select","getEditedPostAttribute","getSuggestedPostFormat","_postFormat","themeSupports","getThemeSupports","formats","filter","format","includes","suggestion","find","editPost","onUpdatePostFormat","map","label","value"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,MAAT,EAAiBC,aAAjB,QAAsC,uBAAtC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,KAAK,IAAIC,SA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U,GAAGJ,OAAO,CAACK,IAAR,CAChBH,MAAF,IAAcA,MAAM,CAACtB,EAAP,KAAcY,eADV,CAAnB;AAIA,QAAM;AAAEc,IAAAA;AAAF,MAAelC,WAAW,CAAEM,WAAF,CAAhC;;AAEA,QAAM6B,kBAAkB,GAAKL,MAAF,IAAcI,QAAQ,CAAE;AAAEJ,IAAAA;AAAF,GAAF,CAAjD;;AAEA,SACC,cAAC,eAAD,QACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,aAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAGlC,EAAE,CAAE,aAAF,CAFX;AAGC,IAAA,KAAK,EAAGuB,UAHT;AAIC,IAAA,QAAQ,EAAKW,MAAF,IAAcK,kBAAkB,CAAEL,MAAF,CAJ5C;AAKC,IAAA,EAAE,EAAGZ,oBALN;AAMC,IAAA,OAAO,EAAGU,OAAO,CAACQ,GAAR,CAAeN,MAAF,KAAgB;AACtCO,MAAAA,KAAK,EAAEP,MAAM,CAACrB,OADwB;AAEtC6B,MAAAA,KAAK,EAAER,MAAM,CAACtB;AAFwB,KAAhB,CAAb;AANX,IADD,EAYGwB,UAAU,IAAIA,UAAU,CAACxB,EAAX,KAAkBW,UAAhC,IACD;AAAG,IAAA,SAAS,EAAC;AAAb,KACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,MADT;AAEC,IAAA,OAAO,EAAG,MACTgB,kBAAkB,CAAEH,UAAU,CAACxB,EAAb;AAHpB,KAMGX,OAAO;AACR;AACAD,EAAAA,EAAE,CAAE,4BAAF,CAFM,EAGRoC,UAAU,CAACvB,OAHH,CANV,CADD,CAbF,CADD,CADD;AAiCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button, SelectControl } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostFormatCheck from './check';\nimport { store as editorStore } from '../../store';\n\n// All WP post formats, sorted alphabetically by translated name.\nexport const POST_FORMATS = [\n\t{ id: 'aside', caption: __( 'Aside' ) },\n\t{ id: 'audio', caption: __( 'Audio' ) },\n\t{ id: 'chat', caption: __( 'Chat' ) },\n\t{ id: 'gallery', caption: __( 'Gallery' ) },\n\t{ id: 'image', caption: __( 'Image' ) },\n\t{ id: 'link', caption: __( 'Link' ) },\n\t{ id: 'quote', caption: __( 'Quote' ) },\n\t{ id: 'standard', caption: __( 'Standard' ) },\n\t{ id: 'status', caption: __( 'Status' ) },\n\t{ id: 'video', caption: __( 'Video' ) },\n].sort( ( a, b ) => {\n\tconst normalizedA = a.caption.toUpperCase();\n\tconst normalizedB = b.caption.toUpperCase();\n\n\tif ( normalizedA < normalizedB ) {\n\t\treturn -1;\n\t}\n\tif ( normalizedA > normalizedB ) {\n\t\treturn 1;\n\t}\n\treturn 0;\n} );\n\nexport default function PostFormat() {\n\tconst instanceId = useInstanceId( PostFormat );\n\tconst postFormatSelectorId = `post-format-selector-${ instanceId }`;\n\n\tconst { postFormat, suggestedFormat, supportedFormats } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostAttribute, getSuggestedPostFormat } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst _postFormat = getEditedPostAttribute( 'format' );\n\t\t\tconst themeSupports = select( coreStore ).getThemeSupports();\n\t\t\treturn {\n\t\t\t\tpostFormat: _postFormat ?? 'standard',\n\t\t\t\tsuggestedFormat: getSuggestedPostFormat(),\n\t\t\t\tsupportedFormats: themeSupports.formats,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst formats = POST_FORMATS.filter( ( format ) => {\n\t\t// Ensure current format is always in the set.\n\t\t// The current format may not be a format supported by the theme.\n\t\treturn (\n\t\t\tsupportedFormats?.includes( format.id ) || postFormat === format.id\n\t\t);\n\t} );\n\tconst suggestion = formats.find(\n\t\t( format ) => format.id === suggestedFormat\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tconst onUpdatePostFormat = ( format ) => editPost( { format } );\n\n\treturn (\n\t\t<PostFormatCheck>\n\t\t\t<div className=\"editor-post-format\">\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Post Format' ) }\n\t\t\t\t\tvalue={ postFormat }\n\t\t\t\t\tonChange={ ( format ) => onUpdatePostFormat( format ) }\n\t\t\t\t\tid={ postFormatSelectorId }\n\t\t\t\t\toptions={ formats.map( ( format ) => ( {\n\t\t\t\t\t\tlabel: format.caption,\n\t\t\t\t\t\tvalue: format.id,\n\t\t\t\t\t} ) ) }\n\t\t\t\t/>\n\t\t\t\t{ suggestion && suggestion.id !== postFormat && (\n\t\t\t\t\t<p className=\"editor-post-format__suggestion\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\tonUpdatePostFormat( suggestion.id )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: post format */\n\t\t\t\t\t\t\t\t__( 'Apply suggested format: %s' ),\n\t\t\t\t\t\t\t\tsuggestion.caption\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</PostFormatCheck>\n\t);\n}\n"]}
@@ -48,6 +48,7 @@ export function PostTemplate() {
48
48
  }
49
49
 
50
50
  return createElement(SelectControl, {
51
+ __nextHasNoMarginBottom: true,
51
52
  label: __('Template:'),
52
53
  value: selectedTemplate,
53
54
  onChange: templateSlug => {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-template/index.js"],"names":["isEmpty","map","__","SelectControl","useSelect","useDispatch","store","coreStore","editorStore","PostTemplate","availableTemplates","selectedTemplate","isViewable","select","getEditedPostAttribute","getEditorSettings","getCurrentPostType","getPostType","viewable","editPost","templateSlug","template","templateName","value","label"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,GAAlB,QAA6B,QAA7B;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,aAAT,QAA8B,uBAA9B;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,YAAT,GAAwB;AAC9B,QAAM;AAAEC,IAAAA,kBAAF;AAAsBC,IAAAA,gBAAtB;AAAwCC,IAAAA;AAAxC,MAAuDR,SAAS,CACnES,MAAF,IAAc;AAAA;;AACb,UAAM;AACLC,MAAAA,sBADK;AAELC,MAAAA,iBAFK;AAGLC,MAAAA;AAHK,QAIFH,MAAM,CAAEL,WAAF,CAJV;AAKA,UAAM;AAAES,MAAAA;AAAF,QAAkBJ,MAAM,CAAEN,SAAF,CAA9B;AAEA,WAAO;AACNI,MAAAA,gBAAgB,EAAEG,sBAAsB,CAAE,UAAF,CADlC;AAENJ,MAAAA,kBAAkB,EAAEK,iBAAiB,GAAGL,kBAFlC;AAGNE,MAAAA,UAAU,2CACTK,WAAW,CAAED,kBAAkB,EAApB,CADF,iDACT,aAAqCE,QAD5B,yEACwC;AAJ5C,KAAP;AAMA,GAfoE,EAgBrE,EAhBqE,CAAtE;AAmBA,QAAM;AAAEC,IAAAA;AAAF,MAAed,WAAW,CAAEG,WAAF,CAAhC;;AAEA,MAAK,CAAEI,UAAF,IAAgBZ,OAAO,CAAEU,kBAAF,CAA5B,EAAqD;AACpD,WAAO,IAAP;AACA;;AAED,SACC,cAAC,aAAD;AACC,IAAA,KAAK,EAAGR,EAAE,CAAE,WAAF,CADX;AAEC,IAAA,KAAK,EAAGS,gBAFT;AAGC,IAAA,QAAQ,EAAKS,YAAF,IAAoB;AAC9BD,MAAAA,QAAQ,CAAE;AACTE,QAAAA,QAAQ,EAAED,YAAY,IAAI;AADjB,OAAF,CAAR;AAGA,KAPF;AAQC,IAAA,OAAO,EAAGnB,GAAG,CACZS,kBADY,EAEZ,CAAEY,YAAF,EAAgBF,YAAhB,MAAoC;AACnCG,MAAAA,KAAK,EAAEH,YAD4B;AAEnCI,MAAAA,KAAK,EAAEF;AAF4B,KAApC,CAFY;AARd,IADD;AAkBA;AAED,eAAeb,YAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty, map } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { SelectControl } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function PostTemplate() {\n\tconst { availableTemplates, selectedTemplate, isViewable } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t\tgetEditorSettings,\n\t\t\t\tgetCurrentPostType,\n\t\t\t} = select( editorStore );\n\t\t\tconst { getPostType } = select( coreStore );\n\n\t\t\treturn {\n\t\t\t\tselectedTemplate: getEditedPostAttribute( 'template' ),\n\t\t\t\tavailableTemplates: getEditorSettings().availableTemplates,\n\t\t\t\tisViewable:\n\t\t\t\t\tgetPostType( getCurrentPostType() )?.viewable ?? false,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tif ( ! isViewable || isEmpty( availableTemplates ) ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<SelectControl\n\t\t\tlabel={ __( 'Template:' ) }\n\t\t\tvalue={ selectedTemplate }\n\t\t\tonChange={ ( templateSlug ) => {\n\t\t\t\teditPost( {\n\t\t\t\t\ttemplate: templateSlug || '',\n\t\t\t\t} );\n\t\t\t} }\n\t\t\toptions={ map(\n\t\t\t\tavailableTemplates,\n\t\t\t\t( templateName, templateSlug ) => ( {\n\t\t\t\t\tvalue: templateSlug,\n\t\t\t\t\tlabel: templateName,\n\t\t\t\t} )\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nexport default PostTemplate;\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-template/index.js"],"names":["isEmpty","map","__","SelectControl","useSelect","useDispatch","store","coreStore","editorStore","PostTemplate","availableTemplates","selectedTemplate","isViewable","select","getEditedPostAttribute","getEditorSettings","getCurrentPostType","getPostType","viewable","editPost","templateSlug","template","templateName","value","label"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,GAAlB,QAA6B,QAA7B;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,aAAT,QAA8B,uBAA9B;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,YAAT,GAAwB;AAC9B,QAAM;AAAEC,IAAAA,kBAAF;AAAsBC,IAAAA,gBAAtB;AAAwCC,IAAAA;AAAxC,MAAuDR,SAAS,CACnES,MAAF,IAAc;AAAA;;AACb,UAAM;AACLC,MAAAA,sBADK;AAELC,MAAAA,iBAFK;AAGLC,MAAAA;AAHK,QAIFH,MAAM,CAAEL,WAAF,CAJV;AAKA,UAAM;AAAES,MAAAA;AAAF,QAAkBJ,MAAM,CAAEN,SAAF,CAA9B;AAEA,WAAO;AACNI,MAAAA,gBAAgB,EAAEG,sBAAsB,CAAE,UAAF,CADlC;AAENJ,MAAAA,kBAAkB,EAAEK,iBAAiB,GAAGL,kBAFlC;AAGNE,MAAAA,UAAU,2CACTK,WAAW,CAAED,kBAAkB,EAApB,CADF,iDACT,aAAqCE,QAD5B,yEACwC;AAJ5C,KAAP;AAMA,GAfoE,EAgBrE,EAhBqE,CAAtE;AAmBA,QAAM;AAAEC,IAAAA;AAAF,MAAed,WAAW,CAAEG,WAAF,CAAhC;;AAEA,MAAK,CAAEI,UAAF,IAAgBZ,OAAO,CAAEU,kBAAF,CAA5B,EAAqD;AACpD,WAAO,IAAP;AACA;;AAED,SACC,cAAC,aAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAGR,EAAE,CAAE,WAAF,CAFX;AAGC,IAAA,KAAK,EAAGS,gBAHT;AAIC,IAAA,QAAQ,EAAKS,YAAF,IAAoB;AAC9BD,MAAAA,QAAQ,CAAE;AACTE,QAAAA,QAAQ,EAAED,YAAY,IAAI;AADjB,OAAF,CAAR;AAGA,KARF;AASC,IAAA,OAAO,EAAGnB,GAAG,CACZS,kBADY,EAEZ,CAAEY,YAAF,EAAgBF,YAAhB,MAAoC;AACnCG,MAAAA,KAAK,EAAEH,YAD4B;AAEnCI,MAAAA,KAAK,EAAEF;AAF4B,KAApC,CAFY;AATd,IADD;AAmBA;AAED,eAAeb,YAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty, map } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { SelectControl } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function PostTemplate() {\n\tconst { availableTemplates, selectedTemplate, isViewable } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t\tgetEditorSettings,\n\t\t\t\tgetCurrentPostType,\n\t\t\t} = select( editorStore );\n\t\t\tconst { getPostType } = select( coreStore );\n\n\t\t\treturn {\n\t\t\t\tselectedTemplate: getEditedPostAttribute( 'template' ),\n\t\t\t\tavailableTemplates: getEditorSettings().availableTemplates,\n\t\t\t\tisViewable:\n\t\t\t\t\tgetPostType( getCurrentPostType() )?.viewable ?? false,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tif ( ! isViewable || isEmpty( availableTemplates ) ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<SelectControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ __( 'Template:' ) }\n\t\t\tvalue={ selectedTemplate }\n\t\t\tonChange={ ( templateSlug ) => {\n\t\t\t\teditPost( {\n\t\t\t\t\ttemplate: templateSlug || '',\n\t\t\t\t} );\n\t\t\t} }\n\t\t\toptions={ map(\n\t\t\t\tavailableTemplates,\n\t\t\t\t( templateName, templateSlug ) => ( {\n\t\t\t\t\tvalue: templateSlug,\n\t\t\t\t\tlabel: templateName,\n\t\t\t\t} )\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nexport default PostTemplate;\n"]}
@@ -102,7 +102,7 @@ function useBlockEditorSettings(settings, hasTemplate) {
102
102
 
103
103
  return useMemo(() => ({ ...Object.fromEntries(Object.entries(settings).filter(_ref2 => {
104
104
  let [key] = _ref2;
105
- return ['__experimentalBlockDirectory', '__experimentalBlockInspectorTabs', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalPreferredStyleVariations', '__experimentalSetIsInserterOpened', '__unstableGalleryWithImageBlocks', 'alignWide', 'allowedBlockTypes', 'bodyPlaceholder', 'canLockBlocks', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomSpacingSizes', 'disableCustomGradients', 'disableLayoutStyles', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'focusMode', 'fontSizes', 'gradients', 'generateAnchors', 'hasFixedToolbar', 'isDistractionFree', 'hasInlineToolbar', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'keepCaretInsideBlock', 'maxWidth', 'onUpdateDefaultBlockStyles', 'styles', 'template', 'templateLock', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock', '__unstableResolvedAssets'].includes(key);
105
+ return ['__experimentalBlockDirectory', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalPreferredStyleVariations', '__experimentalSetIsInserterOpened', '__unstableGalleryWithImageBlocks', 'alignWide', 'allowedBlockTypes', 'blockInspectorTabs', 'bodyPlaceholder', 'canLockBlocks', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomSpacingSizes', 'disableCustomGradients', 'disableLayoutStyles', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'focusMode', 'fontSizes', 'gradients', 'generateAnchors', 'hasFixedToolbar', 'isDistractionFree', 'hasInlineToolbar', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'keepCaretInsideBlock', 'maxWidth', 'onUpdateDefaultBlockStyles', 'styles', 'template', 'templateLock', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock', '__unstableResolvedAssets'].includes(key);
106
106
  })),
107
107
  mediaUpload: hasUploadPermissions ? mediaUpload : undefined,
108
108
  __experimentalReusableBlocks: reusableBlocks,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.js"],"names":["Platform","useMemo","useDispatch","useSelect","store","coreStore","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","__experimentalFetchMedia","fetchMedia","__","mediaUpload","editorStore","EMPTY_BLOCKS_LIST","useBlockEditorSettings","settings","hasTemplate","reusableBlocks","hasUploadPermissions","canUseUnfilteredHTML","userCanCreatePages","pageOnFront","postType","select","canUserUseUnfilteredHTML","getCurrentPostType","isWeb","OS","canUser","getEntityRecord","siteSettings","undefined","getEntityRecords","per_page","page_on_front","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","restBlockPatterns","restBlockPatternCategories","getBlockPatterns","getBlockPatternCategories","blockPatterns","filter","x","index","arr","findIndex","y","name","postTypes","Array","isArray","includes","blockPatternCategories","undo","saveEntityRecord","createPageEntity","options","Promise","reject","message","Object","fromEntries","entries","key","__experimentalReusableBlocks","search","searchOptions","__unstableFetchMedia","__experimentalFetchRichUrlData","__experimentalCanUserUseUnfilteredHTML","__experimentalUndo","outlineMode","__experimentalCreatePageEntity","__experimentalUserCanCreatePages","__experimentalPreferPatternsOnRoot"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,OAAnB,QAAkC,oBAAlC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SACCC,KAAK,IAAIC,SADV,EAECC,kCAAkC,IAAIC,oBAFvC,EAGCC,0BAA0B,IAAIC,YAH/B,EAICC,wBAAwB,IAAIC,UAJ7B,QAKO,sBALP;AAMA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASC,WAAT,QAA4B,aAA5B;AACA,SAAST,KAAK,IAAIU,WAAlB,QAAqC,aAArC;AAEA,MAAMC,iBAAiB,GAAG,EAA1B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,sBAAT,CAAiCC,QAAjC,EAA2CC,WAA3C,EAAyD;AAAA;;AACxD,QAAM;AACLC,IAAAA,cADK;AAELC,IAAAA,oBAFK;AAGLC,IAAAA,oBAHK;AAILC,IAAAA,kBAJK;AAKLC,IAAAA,WALK;AAMLC,IAAAA;AANK,MAOFrB,SAAS,CAAIsB,MAAF,IAAc;AAAA;;AAC5B,UAAM;AAAEC,MAAAA,wBAAF;AAA4BC,MAAAA;AAA5B,QACLF,MAAM,CAAEX,WAAF,CADP;AAEA,UAAMc,KAAK,GAAG5B,QAAQ,CAAC6B,EAAT,KAAgB,KAA9B;AACA,UAAM;AAAEC,MAAAA,OAAF;AAAWC,M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KACnClE,oBAAoB,CAAEiE,MAAF,EAAUC,aAAV,EAAyBxD,QAAzB,CAvDd;AAwDP;AACA;AACAyD,IAAAA,oBAAoB,EAAE/D,UA1Df;AA2DPgE,IAAAA,8BAA8B,EAAElE,YA3DzB;AA4DPmE,IAAAA,sCAAsC,EAAEvD,oBA5DjC;AA6DPwD,IAAAA,kBAAkB,EAAEjB,IA7Db;AA8DPkB,IAAAA,WAAW,EAAE5D,WA9DN;AA+DP6D,IAAAA,8BAA8B,EAAEjB,gBA/DzB;AAgEPkB,IAAAA,gCAAgC,EAAE1D,kBAhE3B;AAiEPC,IAAAA,WAjEO;AAkEP0D,IAAAA,kCAAkC,EAAE/D;AAlE7B,GAAR,CADa,EAqEb,CACCD,QADD,EAECG,oBAFD,EAGCD,cAHD,EAIC4B,aAJD,EAKCY,sBALD,EAMCtC,oBAND,EAOCuC,IAPD,EAQC1C,WARD,EASCI,kBATD,EAUCC,WAVD,CArEa,CAAd;AAkFA;;AAED,eAAeP,sBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Platform, useMemo } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as coreStore,\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n\t__experimentalFetchMedia as fetchMedia,\n} from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { mediaUpload } from '../../utils';\nimport { store as editorStore } from '../../store';\n\nconst EMPTY_BLOCKS_LIST = [];\n\n/**\n * React hook used to compute the block editor settings to use for the post editor.\n *\n * @param {Object} settings EditorProvider settings prop.\n * @param {boolean} hasTemplate Whether template mode is enabled.\n *\n * @return {Object} Block Editor Settings.\n */\nfunction useBlockEditorSettings( settings, hasTemplate ) {\n\tconst {\n\t\treusableBlocks,\n\t\thasUploadPermissions,\n\t\tcanUseUnfilteredHTML,\n\t\tuserCanCreatePages,\n\t\tpageOnFront,\n\t\tpostType,\n\t} = useSelect( ( select ) => {\n\t\tconst { canUserUseUnfilteredHTML, getCurrentPostType } =\n\t\t\tselect( editorStore );\n\t\tconst isWeb = Platform.OS === 'web';\n\t\tconst { canUser, getEntityRecord } = select( coreStore );\n\n\t\tconst siteSettings = canUser( 'read', 'settings' )\n\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\tcanUseUnfilteredHTML: canUserUseUnfilteredHTML(),\n\t\t\treusableBlocks: isWeb\n\t\t\t\t? select( coreStore ).getEntityRecords(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'wp_block',\n\t\t\t\t\t\t{ per_page: -1 }\n\t\t\t\t )\n\t\t\t\t: EMPTY_BLOCKS_LIST, // Reusable blocks are fetched in the native version of this hook.\n\t\t\thasUploadPermissions: canUser( 'create', 'media' ) ?? true,\n\t\t\tuserCanCreatePages: canUser( 'create', 'pages' ),\n\t\t\tpageOnFront: siteSettings?.page_on_front,\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t}, [] );\n\n\tconst settingsBlockPatterns =\n\t\tsettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tsettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst { restBlockPatterns, restBlockPatternCategories } = useSelect(\n\t\t( select ) => ( {\n\t\t\trestBlockPatterns: select( coreStore ).getBlockPatterns(),\n\t\t\trestBlockPatternCategories:\n\t\t\t\tselect( coreStore ).getBlockPatternCategories(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatterns || [] ),\n\t\t\t\t...( restBlockPatterns || [] ),\n\t\t\t]\n\t\t\t\t.filter(\n\t\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t\t)\n\t\t\t\t.filter( ( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( postType ) )\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t[ settingsBlockPatterns, restBlockPatterns, postType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\n\tconst { undo } = useDispatch( editorStore );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\t/**\n\t * Creates a Post entity.\n\t * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages.\n\t *\n\t * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord.\n\t * @return {Object} the post type object that was created.\n\t */\n\tconst createPageEntity = ( options ) => {\n\t\tif ( ! userCanCreatePages ) {\n\t\t\treturn Promise.reject( {\n\t\t\t\tmessage: __( 'You do not have permission to create Pages.' ),\n\t\t\t} );\n\t\t}\n\t\treturn saveEntityRecord( 'postType', 'page', options );\n\t};\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\t...Object.fromEntries(\n\t\t\t\tObject.entries( settings ).filter( ( [ key ] ) =>\n\t\t\t\t\t[\n\t\t\t\t\t\t'__experimentalBlockDirectory',\n\t\t\t\t\t\t'__experimentalBlockInspectorTabs',\n\t\t\t\t\t\t'__experimentalDiscussionSettings',\n\t\t\t\t\t\t'__experimentalFeatures',\n\t\t\t\t\t\t'__experimentalPreferredStyleVariations',\n\t\t\t\t\t\t'__experimentalSetIsInserterOpened',\n\t\t\t\t\t\t'__unstableGalleryWithImageBlocks',\n\t\t\t\t\t\t'alignWide',\n\t\t\t\t\t\t'allowedBlockTypes',\n\t\t\t\t\t\t'bodyPlaceholder',\n\t\t\t\t\t\t'canLockBlocks',\n\t\t\t\t\t\t'codeEditingEnabled',\n\t\t\t\t\t\t'colors',\n\t\t\t\t\t\t'disableCustomColors',\n\t\t\t\t\t\t'disableCustomFontSizes',\n\t\t\t\t\t\t'disableCustomSpacingSizes',\n\t\t\t\t\t\t'disableCustomGradients',\n\t\t\t\t\t\t'disableLayoutStyles',\n\t\t\t\t\t\t'enableCustomLineHeight',\n\t\t\t\t\t\t'enableCustomSpacing',\n\t\t\t\t\t\t'enableCustomUnits',\n\t\t\t\t\t\t'focusMode',\n\t\t\t\t\t\t'fontSizes',\n\t\t\t\t\t\t'gradients',\n\t\t\t\t\t\t'generateAnchors',\n\t\t\t\t\t\t'hasFixedToolbar',\n\t\t\t\t\t\t'isDistractionFree',\n\t\t\t\t\t\t'hasInlineToolbar',\n\t\t\t\t\t\t'imageDefaultSize',\n\t\t\t\t\t\t'imageDimensions',\n\t\t\t\t\t\t'imageEditing',\n\t\t\t\t\t\t'imageSizes',\n\t\t\t\t\t\t'isRTL',\n\t\t\t\t\t\t'keepCaretInsideBlock',\n\t\t\t\t\t\t'maxWidth',\n\t\t\t\t\t\t'onUpdateDefaultBlockStyles',\n\t\t\t\t\t\t'styles',\n\t\t\t\t\t\t'template',\n\t\t\t\t\t\t'templateLock',\n\t\t\t\t\t\t'titlePlaceholder',\n\t\t\t\t\t\t'supportsLayout',\n\t\t\t\t\t\t'widgetTypesToHideFromLegacyWidgetBlock',\n\t\t\t\t\t\t'__unstableResolvedAssets',\n\t\t\t\t\t].includes( key )\n\t\t\t\t)\n\t\t\t),\n\t\t\tmediaUpload: hasUploadPermissions ? mediaUpload : undefined,\n\t\t\t__experimentalReusableBlocks: reusableBlocks,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t\t__experimentalFetchLinkSuggestions: ( search, searchOptions ) =>\n\t\t\t\tfetchLinkSuggestions( search, searchOptions, settings ),\n\t\t\t// TODO: We should find a proper way to consolidate similar cases\n\t\t\t// like reusable blocks, fetch entities, etc.\n\t\t\t__unstableFetchMedia: fetchMedia,\n\t\t\t__experimentalFetchRichUrlData: fetchUrlData,\n\t\t\t__experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,\n\t\t\t__experimentalUndo: undo,\n\t\t\toutlineMode: hasTemplate,\n\t\t\t__experimentalCreatePageEntity: createPageEntity,\n\t\t\t__experimentalUserCanCreatePages: userCanCreatePages,\n\t\t\tpageOnFront,\n\t\t\t__experimentalPreferPatternsOnRoot: hasTemplate,\n\t\t} ),\n\t\t[\n\t\t\tsettings,\n\t\t\thasUploadPermissions,\n\t\t\treusableBlocks,\n\t\t\tblockPatterns,\n\t\t\tblockPatternCategories,\n\t\t\tcanUseUnfilteredHTML,\n\t\t\tundo,\n\t\t\thasTemplate,\n\t\t\tuserCanCreatePages,\n\t\t\tpageOnFront,\n\t\t]\n\t);\n}\n\nexport default useBlockEditorSettings;\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.js"],"names":["Platform","useMemo","useDispatch","useSelect","store","coreStore","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","__experimentalFetchMedia","fetchMedia","__","mediaUpload","editorStore","EMPTY_BLOCKS_LIST","useBlockEditorSettings","settings","hasTemplate","reusableBlocks","hasUploadPermissions","canUseUnfilteredHTML","userCanCreatePages","pageOnFront","postType","select","canUserUseUnfilteredHTML","getCurrentPostType","isWeb","OS","canUser","getEntityRecord","siteSettings","undefined","getEntityRecords","per_page","page_on_front","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","restBlockPatterns","restBlockPatternCategories","getBlockPatterns","getBlockPatternCategories","blockPatterns","filter","x","index","arr","findIndex","y","name","postTypes","Array","isArray","includes","blockPatternCategories","undo","saveEntityRecord","createPageEntity","options","Promise","reject","message","Object","fromEntries","entries","key","__experimentalReusableBlocks","search","searchOptions","__unstableFetchMedia","__experimentalFetchRichUrlData","__experimentalCanUserUseUnfilteredHTML","__experimentalUndo","outlineMode","__experimentalCreatePageEntity","__experimentalUserCanCreatePages","__experimentalPreferPatternsOnRoot"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,OAAnB,QAAkC,oBAAlC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SACCC,KAAK,IAAIC,SADV,EAECC,kCAAkC,IAAIC,oBAFvC,EAGCC,0BAA0B,IAAIC,YAH/B,EAICC,wBAAwB,IAAIC,UAJ7B,QAKO,sBALP;AAMA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASC,WAAT,QAA4B,aAA5B;AACA,SAAST,KAAK,IAAIU,WAAlB,QAAqC,aAArC;AAEA,MAAMC,iBAAiB,GAAG,EAA1B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,sBAAT,CAAiCC,QAAjC,EAA2CC,WAA3C,EAAyD;AAAA;;AACxD,QAAM;AACLC,IAAAA,cADK;AAELC,IAAAA,oBAFK;AAGLC,IAAAA,oBAHK;AAILC,IAAAA,kBAJK;AAKLC,IAAAA,WALK;AAMLC,IAAAA;AANK,MAOFrB,SAAS,CAAIsB,MAAF,IAAc;AAAA;;AAC5B,UAAM;AAAEC,MAAAA,wBAAF;AAA4BC,MAAAA;AAA5B,QACLF,MAAM,CAAEX,WAAF,CADP;AAEA,UAAMc,KAAK,GAAG5B,QAAQ,CAAC6B,EAAT,KAAgB,KAA9B;AACA,UAAM;AAAEC,MAAAA,OAAF;AAAWC,MAAAA;AAAX,QAA+BN,MAAM,CAA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EAAUC,aAAV,EAAyBxD,QAAzB,CAvDd;AAwDP;AACA;AACAyD,IAAAA,oBAAoB,EAAE/D,UA1Df;AA2DPgE,IAAAA,8BAA8B,EAAElE,YA3DzB;AA4DPmE,IAAAA,sCAAsC,EAAEvD,oBA5DjC;AA6DPwD,IAAAA,kBAAkB,EAAEjB,IA7Db;AA8DPkB,IAAAA,WAAW,EAAE5D,WA9DN;AA+DP6D,IAAAA,8BAA8B,EAAEjB,gBA/DzB;AAgEPkB,IAAAA,gCAAgC,EAAE1D,kBAhE3B;AAiEPC,IAAAA,WAjEO;AAkEP0D,IAAAA,kCAAkC,EAAE/D;AAlE7B,GAAR,CADa,EAqEb,CACCD,QADD,EAECG,oBAFD,EAGCD,cAHD,EAIC4B,aAJD,EAKCY,sBALD,EAMCtC,oBAND,EAOCuC,IAPD,EAQC1C,WARD,EASCI,kBATD,EAUCC,WAVD,CArEa,CAAd;AAkFA;;AAED,eAAeP,sBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Platform, useMemo } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as coreStore,\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n\t__experimentalFetchMedia as fetchMedia,\n} from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { mediaUpload } from '../../utils';\nimport { store as editorStore } from '../../store';\n\nconst EMPTY_BLOCKS_LIST = [];\n\n/**\n * React hook used to compute the block editor settings to use for the post editor.\n *\n * @param {Object} settings EditorProvider settings prop.\n * @param {boolean} hasTemplate Whether template mode is enabled.\n *\n * @return {Object} Block Editor Settings.\n */\nfunction useBlockEditorSettings( settings, hasTemplate ) {\n\tconst {\n\t\treusableBlocks,\n\t\thasUploadPermissions,\n\t\tcanUseUnfilteredHTML,\n\t\tuserCanCreatePages,\n\t\tpageOnFront,\n\t\tpostType,\n\t} = useSelect( ( select ) => {\n\t\tconst { canUserUseUnfilteredHTML, getCurrentPostType } =\n\t\t\tselect( editorStore );\n\t\tconst isWeb = Platform.OS === 'web';\n\t\tconst { canUser, getEntityRecord } = select( coreStore );\n\n\t\tconst siteSettings = canUser( 'read', 'settings' )\n\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\tcanUseUnfilteredHTML: canUserUseUnfilteredHTML(),\n\t\t\treusableBlocks: isWeb\n\t\t\t\t? select( coreStore ).getEntityRecords(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'wp_block',\n\t\t\t\t\t\t{ per_page: -1 }\n\t\t\t\t )\n\t\t\t\t: EMPTY_BLOCKS_LIST, // Reusable blocks are fetched in the native version of this hook.\n\t\t\thasUploadPermissions: canUser( 'create', 'media' ) ?? true,\n\t\t\tuserCanCreatePages: canUser( 'create', 'pages' ),\n\t\t\tpageOnFront: siteSettings?.page_on_front,\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t}, [] );\n\n\tconst settingsBlockPatterns =\n\t\tsettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tsettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst { restBlockPatterns, restBlockPatternCategories } = useSelect(\n\t\t( select ) => ( {\n\t\t\trestBlockPatterns: select( coreStore ).getBlockPatterns(),\n\t\t\trestBlockPatternCategories:\n\t\t\t\tselect( coreStore ).getBlockPatternCategories(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatterns || [] ),\n\t\t\t\t...( restBlockPatterns || [] ),\n\t\t\t]\n\t\t\t\t.filter(\n\t\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t\t)\n\t\t\t\t.filter( ( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( postType ) )\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t[ settingsBlockPatterns, restBlockPatterns, postType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\n\tconst { undo } = useDispatch( editorStore );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\t/**\n\t * Creates a Post entity.\n\t * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages.\n\t *\n\t * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord.\n\t * @return {Object} the post type object that was created.\n\t */\n\tconst createPageEntity = ( options ) => {\n\t\tif ( ! userCanCreatePages ) {\n\t\t\treturn Promise.reject( {\n\t\t\t\tmessage: __( 'You do not have permission to create Pages.' ),\n\t\t\t} );\n\t\t}\n\t\treturn saveEntityRecord( 'postType', 'page', options );\n\t};\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\t...Object.fromEntries(\n\t\t\t\tObject.entries( settings ).filter( ( [ key ] ) =>\n\t\t\t\t\t[\n\t\t\t\t\t\t'__experimentalBlockDirectory',\n\t\t\t\t\t\t'__experimentalDiscussionSettings',\n\t\t\t\t\t\t'__experimentalFeatures',\n\t\t\t\t\t\t'__experimentalPreferredStyleVariations',\n\t\t\t\t\t\t'__experimentalSetIsInserterOpened',\n\t\t\t\t\t\t'__unstableGalleryWithImageBlocks',\n\t\t\t\t\t\t'alignWide',\n\t\t\t\t\t\t'allowedBlockTypes',\n\t\t\t\t\t\t'blockInspectorTabs',\n\t\t\t\t\t\t'bodyPlaceholder',\n\t\t\t\t\t\t'canLockBlocks',\n\t\t\t\t\t\t'codeEditingEnabled',\n\t\t\t\t\t\t'colors',\n\t\t\t\t\t\t'disableCustomColors',\n\t\t\t\t\t\t'disableCustomFontSizes',\n\t\t\t\t\t\t'disableCustomSpacingSizes',\n\t\t\t\t\t\t'disableCustomGradients',\n\t\t\t\t\t\t'disableLayoutStyles',\n\t\t\t\t\t\t'enableCustomLineHeight',\n\t\t\t\t\t\t'enableCustomSpacing',\n\t\t\t\t\t\t'enableCustomUnits',\n\t\t\t\t\t\t'focusMode',\n\t\t\t\t\t\t'fontSizes',\n\t\t\t\t\t\t'gradients',\n\t\t\t\t\t\t'generateAnchors',\n\t\t\t\t\t\t'hasFixedToolbar',\n\t\t\t\t\t\t'isDistractionFree',\n\t\t\t\t\t\t'hasInlineToolbar',\n\t\t\t\t\t\t'imageDefaultSize',\n\t\t\t\t\t\t'imageDimensions',\n\t\t\t\t\t\t'imageEditing',\n\t\t\t\t\t\t'imageSizes',\n\t\t\t\t\t\t'isRTL',\n\t\t\t\t\t\t'keepCaretInsideBlock',\n\t\t\t\t\t\t'maxWidth',\n\t\t\t\t\t\t'onUpdateDefaultBlockStyles',\n\t\t\t\t\t\t'styles',\n\t\t\t\t\t\t'template',\n\t\t\t\t\t\t'templateLock',\n\t\t\t\t\t\t'titlePlaceholder',\n\t\t\t\t\t\t'supportsLayout',\n\t\t\t\t\t\t'widgetTypesToHideFromLegacyWidgetBlock',\n\t\t\t\t\t\t'__unstableResolvedAssets',\n\t\t\t\t\t].includes( key )\n\t\t\t\t)\n\t\t\t),\n\t\t\tmediaUpload: hasUploadPermissions ? mediaUpload : undefined,\n\t\t\t__experimentalReusableBlocks: reusableBlocks,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t\t__experimentalFetchLinkSuggestions: ( search, searchOptions ) =>\n\t\t\t\tfetchLinkSuggestions( search, searchOptions, settings ),\n\t\t\t// TODO: We should find a proper way to consolidate similar cases\n\t\t\t// like reusable blocks, fetch entities, etc.\n\t\t\t__unstableFetchMedia: fetchMedia,\n\t\t\t__experimentalFetchRichUrlData: fetchUrlData,\n\t\t\t__experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,\n\t\t\t__experimentalUndo: undo,\n\t\t\toutlineMode: hasTemplate,\n\t\t\t__experimentalCreatePageEntity: createPageEntity,\n\t\t\t__experimentalUserCanCreatePages: userCanCreatePages,\n\t\t\tpageOnFront,\n\t\t\t__experimentalPreferPatternsOnRoot: hasTemplate,\n\t\t} ),\n\t\t[\n\t\t\tsettings,\n\t\t\thasUploadPermissions,\n\t\t\treusableBlocks,\n\t\t\tblockPatterns,\n\t\t\tblockPatternCategories,\n\t\t\tcanUseUnfilteredHTML,\n\t\t\tundo,\n\t\t\thasTemplate,\n\t\t\tuserCanCreatePages,\n\t\t\tpageOnFront,\n\t\t]\n\t);\n}\n\nexport default useBlockEditorSettings;\n"]}
@@ -4,7 +4,7 @@ import { createElement } from "@wordpress/element";
4
4
  /**
5
5
  * External dependencies
6
6
  */
7
- import { pickBy, mapValues, isEmpty } from 'lodash';
7
+ import { mapValues, isEmpty } from 'lodash';
8
8
  /**
9
9
  * WordPress dependencies
10
10
  */
@@ -58,10 +58,13 @@ const createWithMetaAttributeSource = metaAttributes => createHigherOrderCompone
58
58
  return createElement(BlockEdit, _extends({
59
59
  attributes: mergedAttributes,
60
60
  setAttributes: nextAttributes => {
61
- const nextMeta = Object.fromEntries(Object.entries( // Filter to intersection of keys between the updated
61
+ const nextMeta = Object.fromEntries(Object.entries(nextAttributes !== null && nextAttributes !== void 0 ? nextAttributes : {}).filter( // Filter to intersection of keys between the updated
62
62
  // attributes and those with an associated meta key.
63
- pickBy(nextAttributes, (value, key) => metaAttributes[key])).map(_ref2 => {
64
- let [attributeKey, value] = _ref2;
63
+ _ref2 => {
64
+ let [key] = _ref2;
65
+ return key in metaAttributes;
66
+ }).map(_ref3 => {
67
+ let [attributeKey, value] = _ref3;
65
68
  return [// Rename the keys to the expected meta key name.
66
69
  metaAttributes[attributeKey], value];
67
70
  }));
@@ -85,10 +88,15 @@ const createWithMetaAttributeSource = metaAttributes => createHigherOrderCompone
85
88
 
86
89
 
87
90
  function shimAttributeSource(settings) {
91
+ var _settings$attributes;
92
+
88
93
  /** @type {WPMetaAttributeMapping} */
89
- const metaAttributes = mapValues(pickBy(settings.attributes, {
90
- source: 'meta'
91
- }), 'meta');
94
+ const metaAttributes = mapValues(Object.fromEntries(Object.entries((_settings$attributes = settings.attributes) !== null && _settings$attributes !== void 0 ? _settings$attributes : {}).filter(_ref4 => {
95
+ let [, {
96
+ source
97
+ }] = _ref4;
98
+ return source === 'meta';
99
+ })), 'meta');
92
100
 
93
101
  if (!isEmpty(metaAttributes)) {
94
102
  settings.edit = createWithMetaAttributeSource(metaAttributes)(settings.edit);
@@ -116,10 +124,10 @@ addFilter('blocks.registerBlockType', 'core/editor/custom-sources-backwards-comp
116
124
  // In the future, we could support updating block settings, at which point this
117
125
  // implementation could use that mechanism instead.
118
126
 
119
- globalSelect(blocksStore).getBlockTypes().map(_ref3 => {
127
+ globalSelect(blocksStore).getBlockTypes().map(_ref5 => {
120
128
  let {
121
129
  name
122
- } = _ref3;
130
+ } = _ref5;
123
131
  return globalSelect(blocksStore).getBlockType(name);
124
132
  }).forEach(shimAttributeSource);
125
133
  //# sourceMappingURL=custom-sources-backwards-compatibility.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/hooks/custom-sources-backwards-compatibility.js"],"names":["pickBy","mapValues","isEmpty","store","blocksStore","select","globalSelect","useSelect","useEntityProp","useMemo","createHigherOrderComponent","addFilter","editorStore","createWithMetaAttributeSource","metaAttributes","BlockEdit","attributes","setAttributes","props","postType","getCurrentPostType","meta","setMeta","mergedAttributes","metaKey","nextAttributes","nextMeta","Object","fromEntries","entries","value","key","map","attributeKey","shimAttributeSource","settings","source","edit","getBlockTypes","name","getBlockType","forEach"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,MAAT,EAAiBC,SAAjB,EAA4BC,OAA5B,QAA2C,QAA3C;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,MAAM,IAAIC,YAAnB,EAAiCC,SAAjC,QAAkD,iBAAlD;AACA,SAASC,aAAT,QAA8B,sBAA9B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SAASC,SAAT,QAA0B,kBAA1B;AAEA;AACA;AACA;;AACA,SAASR,KAAK,IAAIS,WAAlB,QAAqC,UAArC;AAEA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,6BAA6B,GAAKC,cAAF,IACrCJ,0BAA0B,CACvBK,SAAF,IACC,QAA+C;AAAA,MAA7C;AAAEC,IAAAA,UAAF;AAAcC,IAAAA,aAAd;AAA6B,OAAGC;AAAhC,GAA6C;AAC9C,QAAMC,QAAQ,GAAGZ,SAAS,CACvBF,MAAF,IAAcA,MAAM,CAAEO,WAAF,CAAN,CAAsBQ,kBAAtB,EADW,EAEzB,EAFyB,CAA1B;AAIA,QAAM,CAAEC,IAAF,EAAQC,OAAR,IAAoBd,aAAa,CACtC,UADsC,EAEtCW,QAFsC,EAGtC,MAHsC,CAAvC;AAMA,QAAMI,gBAAgB,GAAGd,OAAO,CAC/B,OAAQ,EACP,GAAGO,UADI;AAEP,OAAGf,SAAS,CACXa,cADW,EAETU,OAAF,IAAeH,IAAI,CAAEG,OAAF,CAFR;AAFL,GAAR,CAD+B,EAQ/B,CAAER,UAAF,EAAcK,IAAd,CAR+B,CAAhC;AAWA,SACC,cAAC,SAAD;AACC,IAAA,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AAY,CAAEF,WAAF,CAAZ,CACEkC,aADF,GAEEN,GAFF,CAEO;AAAA,MAAE;AAAEO,IAAAA;AAAF,GAAF;AAAA,SAAgBjC,YAAY,CAAEF,WAAF,CAAZ,CAA4BoC,YAA5B,CAA0CD,IAA1C,CAAhB;AAAA,CAFP,EAGEE,OAHF,CAGWP,mBAHX","sourcesContent":["/**\n * External dependencies\n */\nimport { pickBy, mapValues, isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { select as globalSelect, useSelect } from '@wordpress/data';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\n\n/** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */\n/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */\n\n/**\n * Object whose keys are the names of block attributes, where each value\n * represents the meta key to which the block attribute is intended to save.\n *\n * @see https://developer.wordpress.org/reference/functions/register_meta/\n *\n * @typedef {Object<string,string>} WPMetaAttributeMapping\n */\n\n/**\n * Given a mapping of attribute names (meta source attributes) to their\n * associated meta key, returns a higher order component that overrides its\n * `attributes` and `setAttributes` props to sync any changes with the edited\n * post's meta keys.\n *\n * @param {WPMetaAttributeMapping} metaAttributes Meta attribute mapping.\n *\n * @return {WPHigherOrderComponent} Higher-order component.\n */\nconst createWithMetaAttributeSource = ( metaAttributes ) =>\n\tcreateHigherOrderComponent(\n\t\t( BlockEdit ) =>\n\t\t\t( { attributes, setAttributes, ...props } ) => {\n\t\t\t\tconst postType = useSelect(\n\t\t\t\t\t( select ) => select( editorStore ).getCurrentPostType(),\n\t\t\t\t\t[]\n\t\t\t\t);\n\t\t\t\tconst [ meta, setMeta ] = useEntityProp(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\t'meta'\n\t\t\t\t);\n\n\t\t\t\tconst mergedAttributes = useMemo(\n\t\t\t\t\t() => ( {\n\t\t\t\t\t\t...attributes,\n\t\t\t\t\t\t...mapValues(\n\t\t\t\t\t\t\tmetaAttributes,\n\t\t\t\t\t\t\t( metaKey ) => meta[ metaKey ]\n\t\t\t\t\t\t),\n\t\t\t\t\t} ),\n\t\t\t\t\t[ attributes, meta ]\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<BlockEdit\n\t\t\t\t\t\tattributes={ mergedAttributes }\n\t\t\t\t\t\tsetAttributes={ ( nextAttributes ) => {\n\t\t\t\t\t\t\tconst nextMeta = Object.fromEntries(\n\t\t\t\t\t\t\t\tObject.entries(\n\t\t\t\t\t\t\t\t\t// Filter to intersection of keys between the updated\n\t\t\t\t\t\t\t\t\t// attributes and those with an associated meta key.\n\t\t\t\t\t\t\t\t\tpickBy(\n\t\t\t\t\t\t\t\t\t\tnextAttributes,\n\t\t\t\t\t\t\t\t\t\t( value, key ) => metaAttributes[ key ]\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t).map( ( [ attributeKey, value ] ) => [\n\t\t\t\t\t\t\t\t\t// Rename the keys to the expected meta key name.\n\t\t\t\t\t\t\t\t\tmetaAttributes[ attributeKey ],\n\t\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\t] )\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif ( ! isEmpty( nextMeta ) ) {\n\t\t\t\t\t\t\t\tsetMeta( nextMeta );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tsetAttributes( nextAttributes );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t},\n\t\t'withMetaAttributeSource'\n\t);\n\n/**\n * Filters a registered block's settings to enhance a block's `edit` component\n * to upgrade meta-sourced attributes to use the post's meta entity property.\n *\n * @param {WPBlockSettings} settings Registered block settings.\n *\n * @return {WPBlockSettings} Filtered block settings.\n */\nfunction shimAttributeSource( settings ) {\n\t/** @type {WPMetaAttributeMapping} */\n\tconst metaAttributes = mapValues(\n\t\tpickBy( settings.attributes, { source: 'meta' } ),\n\t\t'meta'\n\t);\n\tif ( ! isEmpty( metaAttributes ) ) {\n\t\tsettings.edit = createWithMetaAttributeSource( metaAttributes )(\n\t\t\tsettings.edit\n\t\t);\n\t}\n\n\treturn settings;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/custom-sources-backwards-compatibility/shim-attribute-source',\n\tshimAttributeSource\n);\n\n// The above filter will only capture blocks registered after the filter was\n// added. There may already be blocks registered by this point, and those must\n// be updated to apply the shim.\n//\n// The following implementation achieves this, albeit with a couple caveats:\n// - Only blocks registered on the global store will be modified.\n// - The block settings are directly mutated, since there is currently no\n// mechanism to update an existing block registration. This is the reason for\n// `getBlockType` separate from `getBlockTypes`, since the latter returns a\n// _copy_ of the block registration (i.e. the mutation would not affect the\n// actual registered block settings).\n//\n// `getBlockTypes` or `getBlockType` implementation could change in the future\n// in regards to creating settings clones, but the corresponding end-to-end\n// tests for meta blocks should cover against any potential regressions.\n//\n// In the future, we could support updating block settings, at which point this\n// implementation could use that mechanism instead.\nglobalSelect( blocksStore )\n\t.getBlockTypes()\n\t.map( ( { name } ) => globalSelect( blocksStore ).getBlockType( name ) )\n\t.forEach( shimAttributeSource );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/hooks/custom-sources-backwards-compatibility.js"],"names":["mapValues","isEmpty","store","blocksStore","select","globalSelect","useSelect","useEntityProp","useMemo","createHigherOrderComponent","addFilter","editorStore","createWithMetaAttributeSource","metaAttributes","BlockEdit","attributes","setAttributes","props","postType","getCurrentPostType","meta","setMeta","mergedAttributes","metaKey","nextAttributes","nextMeta","Object","fromEntries","entries","filter","key","map","attributeKey","value","shimAttributeSource","settings","source","edit","getBlockTypes","name","getBlockType","forEach"],"mappings":";;;AAAA;AACA;AACA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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA7B,YAAY,CAAEF,WAAF,CAAZ,CACEmC,aADF,GAEEP,GAFF,CAEO;AAAA,MAAE;AAAEQ,IAAAA;AAAF,GAAF;AAAA,SAAgBlC,YAAY,CAAEF,WAAF,CAAZ,CAA4BqC,YAA5B,CAA0CD,IAA1C,CAAhB;AAAA,CAFP,EAGEE,OAHF,CAGWP,mBAHX","sourcesContent":["/**\n * External dependencies\n */\nimport { mapValues, isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { select as globalSelect, useSelect } from '@wordpress/data';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\n\n/** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */\n/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */\n\n/**\n * Object whose keys are the names of block attributes, where each value\n * represents the meta key to which the block attribute is intended to save.\n *\n * @see https://developer.wordpress.org/reference/functions/register_meta/\n *\n * @typedef {Object<string,string>} WPMetaAttributeMapping\n */\n\n/**\n * Given a mapping of attribute names (meta source attributes) to their\n * associated meta key, returns a higher order component that overrides its\n * `attributes` and `setAttributes` props to sync any changes with the edited\n * post's meta keys.\n *\n * @param {WPMetaAttributeMapping} metaAttributes Meta attribute mapping.\n *\n * @return {WPHigherOrderComponent} Higher-order component.\n */\nconst createWithMetaAttributeSource = ( metaAttributes ) =>\n\tcreateHigherOrderComponent(\n\t\t( BlockEdit ) =>\n\t\t\t( { attributes, setAttributes, ...props } ) => {\n\t\t\t\tconst postType = useSelect(\n\t\t\t\t\t( select ) => select( editorStore ).getCurrentPostType(),\n\t\t\t\t\t[]\n\t\t\t\t);\n\t\t\t\tconst [ meta, setMeta ] = useEntityProp(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\t'meta'\n\t\t\t\t);\n\n\t\t\t\tconst mergedAttributes = useMemo(\n\t\t\t\t\t() => ( {\n\t\t\t\t\t\t...attributes,\n\t\t\t\t\t\t...mapValues(\n\t\t\t\t\t\t\tmetaAttributes,\n\t\t\t\t\t\t\t( metaKey ) => meta[ metaKey ]\n\t\t\t\t\t\t),\n\t\t\t\t\t} ),\n\t\t\t\t\t[ attributes, meta ]\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<BlockEdit\n\t\t\t\t\t\tattributes={ mergedAttributes }\n\t\t\t\t\t\tsetAttributes={ ( nextAttributes ) => {\n\t\t\t\t\t\t\tconst nextMeta = Object.fromEntries(\n\t\t\t\t\t\t\t\tObject.entries( nextAttributes ?? {} )\n\t\t\t\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t\t\t\t// Filter to intersection of keys between the updated\n\t\t\t\t\t\t\t\t\t\t// attributes and those with an associated meta key.\n\t\t\t\t\t\t\t\t\t\t( [ key ] ) => key in metaAttributes\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t.map( ( [ attributeKey, value ] ) => [\n\t\t\t\t\t\t\t\t\t\t// Rename the keys to the expected meta key name.\n\t\t\t\t\t\t\t\t\t\tmetaAttributes[ attributeKey ],\n\t\t\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\t\t] )\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif ( ! isEmpty( nextMeta ) ) {\n\t\t\t\t\t\t\t\tsetMeta( nextMeta );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tsetAttributes( nextAttributes );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t},\n\t\t'withMetaAttributeSource'\n\t);\n\n/**\n * Filters a registered block's settings to enhance a block's `edit` component\n * to upgrade meta-sourced attributes to use the post's meta entity property.\n *\n * @param {WPBlockSettings} settings Registered block settings.\n *\n * @return {WPBlockSettings} Filtered block settings.\n */\nfunction shimAttributeSource( settings ) {\n\t/** @type {WPMetaAttributeMapping} */\n\tconst metaAttributes = mapValues(\n\t\tObject.fromEntries(\n\t\t\tObject.entries( settings.attributes ?? {} ).filter(\n\t\t\t\t( [ , { source } ] ) => source === 'meta'\n\t\t\t)\n\t\t),\n\t\t'meta'\n\t);\n\tif ( ! isEmpty( metaAttributes ) ) {\n\t\tsettings.edit = createWithMetaAttributeSource( metaAttributes )(\n\t\t\tsettings.edit\n\t\t);\n\t}\n\n\treturn settings;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/custom-sources-backwards-compatibility/shim-attribute-source',\n\tshimAttributeSource\n);\n\n// The above filter will only capture blocks registered after the filter was\n// added. There may already be blocks registered by this point, and those must\n// be updated to apply the shim.\n//\n// The following implementation achieves this, albeit with a couple caveats:\n// - Only blocks registered on the global store will be modified.\n// - The block settings are directly mutated, since there is currently no\n// mechanism to update an existing block registration. This is the reason for\n// `getBlockType` separate from `getBlockTypes`, since the latter returns a\n// _copy_ of the block registration (i.e. the mutation would not affect the\n// actual registered block settings).\n//\n// `getBlockTypes` or `getBlockType` implementation could change in the future\n// in regards to creating settings clones, but the corresponding end-to-end\n// tests for meta blocks should cover against any potential regressions.\n//\n// In the future, we could support updating block settings, at which point this\n// implementation could use that mechanism instead.\nglobalSelect( blocksStore )\n\t.getBlockTypes()\n\t.map( ( { name } ) => globalSelect( blocksStore ).getBlockType( name ) )\n\t.forEach( shimAttributeSource );\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/editor",
3
- "version": "13.1.0",
3
+ "version": "13.2.0",
4
4
  "description": "Enhanced block editor for WordPress posts.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -31,33 +31,33 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.16.0",
34
- "@wordpress/a11y": "^3.24.0",
35
- "@wordpress/api-fetch": "^6.21.0",
36
- "@wordpress/blob": "^3.24.0",
37
- "@wordpress/block-editor": "^11.1.0",
38
- "@wordpress/blocks": "^12.1.0",
39
- "@wordpress/components": "^23.1.0",
40
- "@wordpress/compose": "^6.1.0",
41
- "@wordpress/core-data": "^6.1.0",
42
- "@wordpress/data": "^8.1.0",
43
- "@wordpress/date": "^4.24.0",
44
- "@wordpress/deprecated": "^3.24.0",
45
- "@wordpress/dom": "^3.24.0",
46
- "@wordpress/element": "^5.1.0",
47
- "@wordpress/hooks": "^3.24.0",
48
- "@wordpress/html-entities": "^3.24.0",
49
- "@wordpress/i18n": "^4.24.0",
50
- "@wordpress/icons": "^9.15.0",
51
- "@wordpress/keyboard-shortcuts": "^4.1.0",
52
- "@wordpress/keycodes": "^3.24.0",
53
- "@wordpress/media-utils": "^4.15.0",
54
- "@wordpress/notices": "^3.24.0",
55
- "@wordpress/preferences": "^3.1.0",
56
- "@wordpress/reusable-blocks": "^4.1.0",
57
- "@wordpress/rich-text": "^6.1.0",
58
- "@wordpress/server-side-render": "^4.1.0",
59
- "@wordpress/url": "^3.25.0",
60
- "@wordpress/wordcount": "^3.24.0",
34
+ "@wordpress/a11y": "^3.25.0",
35
+ "@wordpress/api-fetch": "^6.22.0",
36
+ "@wordpress/blob": "^3.25.0",
37
+ "@wordpress/block-editor": "^11.2.0",
38
+ "@wordpress/blocks": "^12.2.0",
39
+ "@wordpress/components": "^23.2.0",
40
+ "@wordpress/compose": "^6.2.0",
41
+ "@wordpress/core-data": "^6.2.0",
42
+ "@wordpress/data": "^8.2.0",
43
+ "@wordpress/date": "^4.25.0",
44
+ "@wordpress/deprecated": "^3.25.0",
45
+ "@wordpress/dom": "^3.25.0",
46
+ "@wordpress/element": "^5.2.0",
47
+ "@wordpress/hooks": "^3.25.0",
48
+ "@wordpress/html-entities": "^3.25.0",
49
+ "@wordpress/i18n": "^4.25.0",
50
+ "@wordpress/icons": "^9.16.0",
51
+ "@wordpress/keyboard-shortcuts": "^4.2.0",
52
+ "@wordpress/keycodes": "^3.25.0",
53
+ "@wordpress/media-utils": "^4.16.0",
54
+ "@wordpress/notices": "^3.25.0",
55
+ "@wordpress/preferences": "^3.2.0",
56
+ "@wordpress/reusable-blocks": "^4.2.0",
57
+ "@wordpress/rich-text": "^6.2.0",
58
+ "@wordpress/server-side-render": "^4.2.0",
59
+ "@wordpress/url": "^3.26.0",
60
+ "@wordpress/wordcount": "^3.25.0",
61
61
  "classnames": "^2.3.1",
62
62
  "date-fns": "^2.28.0",
63
63
  "escape-html": "^1.0.3",
@@ -74,5 +74,5 @@
74
74
  "publishConfig": {
75
75
  "access": "public"
76
76
  },
77
- "gitHead": "200bee7b06b15f6fa655e25b6ab69cbd6b49a357"
77
+ "gitHead": "204c880ff65295768e9695dfee6c7a9fee1fdd05"
78
78
  }
@@ -40,6 +40,7 @@ function PostAuthorSelect() {
40
40
 
41
41
  return (
42
42
  <SelectControl
43
+ __nextHasNoMarginBottom
43
44
  className="post-author-selector"
44
45
  label={ __( 'Author' ) }
45
46
  options={ authorOptions }
@@ -76,6 +76,7 @@ export default function PostFormat() {
76
76
  <PostFormatCheck>
77
77
  <div className="editor-post-format">
78
78
  <SelectControl
79
+ __nextHasNoMarginBottom
79
80
  label={ __( 'Post Format' ) }
80
81
  value={ postFormat }
81
82
  onChange={ ( format ) => onUpdatePostFormat( format ) }
@@ -44,6 +44,7 @@ export function PostTemplate() {
44
44
 
45
45
  return (
46
46
  <SelectControl
47
+ __nextHasNoMarginBottom
47
48
  label={ __( 'Template:' ) }
48
49
  value={ selectedTemplate }
49
50
  onChange={ ( templateSlug ) => {
@@ -135,7 +135,6 @@ function useBlockEditorSettings( settings, hasTemplate ) {
135
135
  Object.entries( settings ).filter( ( [ key ] ) =>
136
136
  [
137
137
  '__experimentalBlockDirectory',
138
- '__experimentalBlockInspectorTabs',
139
138
  '__experimentalDiscussionSettings',
140
139
  '__experimentalFeatures',
141
140
  '__experimentalPreferredStyleVariations',
@@ -143,6 +142,7 @@ function useBlockEditorSettings( settings, hasTemplate ) {
143
142
  '__unstableGalleryWithImageBlocks',
144
143
  'alignWide',
145
144
  'allowedBlockTypes',
145
+ 'blockInspectorTabs',
146
146
  'bodyPlaceholder',
147
147
  'canLockBlocks',
148
148
  'codeEditingEnabled',
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { pickBy, mapValues, isEmpty } from 'lodash';
4
+ import { mapValues, isEmpty } from 'lodash';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -70,18 +70,17 @@ const createWithMetaAttributeSource = ( metaAttributes ) =>
70
70
  attributes={ mergedAttributes }
71
71
  setAttributes={ ( nextAttributes ) => {
72
72
  const nextMeta = Object.fromEntries(
73
- Object.entries(
74
- // Filter to intersection of keys between the updated
75
- // attributes and those with an associated meta key.
76
- pickBy(
77
- nextAttributes,
78
- ( value, key ) => metaAttributes[ key ]
73
+ Object.entries( nextAttributes ?? {} )
74
+ .filter(
75
+ // Filter to intersection of keys between the updated
76
+ // attributes and those with an associated meta key.
77
+ ( [ key ] ) => key in metaAttributes
79
78
  )
80
- ).map( ( [ attributeKey, value ] ) => [
81
- // Rename the keys to the expected meta key name.
82
- metaAttributes[ attributeKey ],
83
- value,
84
- ] )
79
+ .map( ( [ attributeKey, value ] ) => [
80
+ // Rename the keys to the expected meta key name.
81
+ metaAttributes[ attributeKey ],
82
+ value,
83
+ ] )
85
84
  );
86
85
 
87
86
  if ( ! isEmpty( nextMeta ) ) {
@@ -108,7 +107,11 @@ const createWithMetaAttributeSource = ( metaAttributes ) =>
108
107
  function shimAttributeSource( settings ) {
109
108
  /** @type {WPMetaAttributeMapping} */
110
109
  const metaAttributes = mapValues(
111
- pickBy( settings.attributes, { source: 'meta' } ),
110
+ Object.fromEntries(
111
+ Object.entries( settings.attributes ?? {} ).filter(
112
+ ( [ , { source } ] ) => source === 'meta'
113
+ )
114
+ ),
112
115
  'meta'
113
116
  );
114
117
  if ( ! isEmpty( metaAttributes ) ) {