@wordpress/block-library 8.6.0 → 8.7.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 (193) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/buttons/index.js +1 -0
  3. package/build/buttons/index.js.map +1 -1
  4. package/build/buttons/transforms.js +1 -0
  5. package/build/buttons/transforms.js.map +1 -1
  6. package/build/columns/edit.js +4 -2
  7. package/build/columns/edit.js.map +1 -1
  8. package/build/columns/index.js +4 -0
  9. package/build/columns/index.js.map +1 -1
  10. package/build/cover/edit/inspector-controls.js +2 -2
  11. package/build/cover/edit/inspector-controls.js.map +1 -1
  12. package/build/gallery/edit.js +8 -5
  13. package/build/gallery/edit.js.map +1 -1
  14. package/build/gallery/use-image-sizes.js +1 -1
  15. package/build/gallery/use-image-sizes.js.map +1 -1
  16. package/build/group/deprecated.js +4 -2
  17. package/build/group/deprecated.js.map +1 -1
  18. package/build/group/edit.js +22 -5
  19. package/build/group/edit.js.map +1 -1
  20. package/build/group/placeholder.js +11 -1
  21. package/build/group/placeholder.js.map +1 -1
  22. package/build/group/variations.js +23 -3
  23. package/build/group/variations.js.map +1 -1
  24. package/build/image/edit.js +1 -1
  25. package/build/image/edit.js.map +1 -1
  26. package/build/image/edit.native.js +1 -1
  27. package/build/image/edit.native.js.map +1 -1
  28. package/build/image/image.js +8 -6
  29. package/build/image/image.js.map +1 -1
  30. package/build/image/index.js +7 -2
  31. package/build/image/index.js.map +1 -1
  32. package/build/latest-posts/edit.js +1 -0
  33. package/build/latest-posts/edit.js.map +1 -1
  34. package/build/media-text/deprecated.js +228 -18
  35. package/build/media-text/deprecated.js.map +1 -1
  36. package/build/media-text/edit.js +3 -3
  37. package/build/media-text/edit.js.map +1 -1
  38. package/build/media-text/index.js +1 -1
  39. package/build/navigation/edit/index.js +1 -12
  40. package/build/navigation/edit/index.js.map +1 -1
  41. package/build/navigation/edit/inner-blocks.js +1 -4
  42. package/build/navigation/edit/inner-blocks.js.map +1 -1
  43. package/build/navigation/index.js +0 -1
  44. package/build/navigation/index.js.map +1 -1
  45. package/build/post-date/edit.js +2 -1
  46. package/build/post-date/edit.js.map +1 -1
  47. package/build/post-date/index.js +4 -1
  48. package/build/post-date/index.js.map +1 -1
  49. package/build/post-date/variations.js +28 -0
  50. package/build/post-date/variations.js.map +1 -0
  51. package/build/post-excerpt/edit.js +39 -10
  52. package/build/post-excerpt/edit.js.map +1 -1
  53. package/build/post-featured-image/dimension-controls.js +2 -2
  54. package/build/post-featured-image/dimension-controls.js.map +1 -1
  55. package/build/post-template/index.js +1 -1
  56. package/build/post-time-to-read/index.js +17 -1
  57. package/build/post-time-to-read/index.js.map +1 -1
  58. package/build/quote/index.js +1 -0
  59. package/build/quote/index.js.map +1 -1
  60. package/build/spacer/edit.js +16 -6
  61. package/build/spacer/edit.js.map +1 -1
  62. package/build-module/buttons/index.js +1 -0
  63. package/build-module/buttons/index.js.map +1 -1
  64. package/build-module/buttons/transforms.js +1 -0
  65. package/build-module/buttons/transforms.js.map +1 -1
  66. package/build-module/columns/edit.js +4 -2
  67. package/build-module/columns/edit.js.map +1 -1
  68. package/build-module/columns/index.js +4 -0
  69. package/build-module/columns/index.js.map +1 -1
  70. package/build-module/cover/edit/inspector-controls.js +2 -2
  71. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  72. package/build-module/gallery/edit.js +8 -5
  73. package/build-module/gallery/edit.js.map +1 -1
  74. package/build-module/gallery/use-image-sizes.js +1 -1
  75. package/build-module/gallery/use-image-sizes.js.map +1 -1
  76. package/build-module/group/deprecated.js +4 -2
  77. package/build-module/group/deprecated.js.map +1 -1
  78. package/build-module/group/edit.js +21 -5
  79. package/build-module/group/edit.js.map +1 -1
  80. package/build-module/group/placeholder.js +11 -1
  81. package/build-module/group/placeholder.js.map +1 -1
  82. package/build-module/group/variations.js +24 -1
  83. package/build-module/group/variations.js.map +1 -1
  84. package/build-module/image/edit.js +1 -1
  85. package/build-module/image/edit.js.map +1 -1
  86. package/build-module/image/edit.native.js +1 -1
  87. package/build-module/image/edit.native.js.map +1 -1
  88. package/build-module/image/image.js +8 -6
  89. package/build-module/image/image.js.map +1 -1
  90. package/build-module/image/index.js +7 -2
  91. package/build-module/image/index.js.map +1 -1
  92. package/build-module/latest-posts/edit.js +1 -0
  93. package/build-module/latest-posts/edit.js.map +1 -1
  94. package/build-module/media-text/deprecated.js +227 -18
  95. package/build-module/media-text/deprecated.js.map +1 -1
  96. package/build-module/media-text/edit.js +3 -3
  97. package/build-module/media-text/edit.js.map +1 -1
  98. package/build-module/media-text/index.js +1 -1
  99. package/build-module/navigation/edit/index.js +1 -12
  100. package/build-module/navigation/edit/index.js.map +1 -1
  101. package/build-module/navigation/edit/inner-blocks.js +1 -4
  102. package/build-module/navigation/edit/inner-blocks.js.map +1 -1
  103. package/build-module/navigation/index.js +0 -1
  104. package/build-module/navigation/index.js.map +1 -1
  105. package/build-module/post-date/edit.js +2 -1
  106. package/build-module/post-date/edit.js.map +1 -1
  107. package/build-module/post-date/index.js +3 -1
  108. package/build-module/post-date/index.js.map +1 -1
  109. package/build-module/post-date/variations.js +18 -0
  110. package/build-module/post-date/variations.js.map +1 -0
  111. package/build-module/post-excerpt/edit.js +38 -11
  112. package/build-module/post-excerpt/edit.js.map +1 -1
  113. package/build-module/post-featured-image/dimension-controls.js +2 -2
  114. package/build-module/post-featured-image/dimension-controls.js.map +1 -1
  115. package/build-module/post-template/index.js +1 -1
  116. package/build-module/post-time-to-read/index.js +17 -1
  117. package/build-module/post-time-to-read/index.js.map +1 -1
  118. package/build-module/quote/index.js +1 -0
  119. package/build-module/quote/index.js.map +1 -1
  120. package/build-module/spacer/edit.js +16 -6
  121. package/build-module/spacer/edit.js.map +1 -1
  122. package/build-style/categories/editor-rtl.css +5 -0
  123. package/build-style/categories/editor.css +5 -0
  124. package/build-style/categories/style-rtl.css +4 -0
  125. package/build-style/categories/style.css +4 -0
  126. package/build-style/editor-rtl.css +6 -0
  127. package/build-style/editor.css +6 -0
  128. package/build-style/navigation/style-rtl.css +2 -0
  129. package/build-style/navigation/style.css +2 -0
  130. package/build-style/post-featured-image/editor-rtl.css +1 -0
  131. package/build-style/post-featured-image/editor.css +1 -0
  132. package/build-style/post-template/style-rtl.css +1 -1
  133. package/build-style/post-template/style.css +1 -1
  134. package/build-style/post-time-to-read/style-rtl.css +91 -0
  135. package/build-style/post-time-to-read/style.css +91 -0
  136. package/build-style/search/style-rtl.css +8 -7
  137. package/build-style/search/style.css +8 -7
  138. package/build-style/style-rtl.css +19 -8
  139. package/build-style/style.css +19 -8
  140. package/package.json +31 -31
  141. package/src/buttons/block.json +1 -0
  142. package/src/categories/editor.scss +5 -0
  143. package/src/categories/style.scss +4 -0
  144. package/src/columns/block.json +4 -0
  145. package/src/columns/edit.js +2 -1
  146. package/src/comments/index.php +1 -0
  147. package/src/cover/edit/inspector-controls.js +4 -5
  148. package/src/cover/test/__snapshots__/transforms.native.js.snap +2 -2
  149. package/src/cover/test/edit.js +324 -0
  150. package/src/gallery/edit.js +5 -2
  151. package/src/gallery/use-image-sizes.js +1 -1
  152. package/src/group/deprecated.js +4 -2
  153. package/src/group/edit.js +27 -9
  154. package/src/group/placeholder.js +13 -1
  155. package/src/group/variations.js +14 -1
  156. package/src/home-link/index.php +2 -2
  157. package/src/image/block.json +7 -2
  158. package/src/image/edit.js +1 -1
  159. package/src/image/edit.native.js +1 -1
  160. package/src/image/image.js +15 -7
  161. package/src/image/index.php +7 -2
  162. package/src/image/test/__snapshots__/transforms.native.js.snap +1 -1
  163. package/src/latest-comments/style.scss +1 -1
  164. package/src/latest-posts/edit.js +3 -0
  165. package/src/media-text/block.json +1 -1
  166. package/src/media-text/deprecated.js +235 -3
  167. package/src/media-text/edit.js +7 -6
  168. package/src/media-text/test/__snapshots__/transforms.native.js.snap +4 -4
  169. package/src/navigation/block.json +0 -1
  170. package/src/navigation/edit/index.js +0 -13
  171. package/src/navigation/edit/inner-blocks.js +0 -3
  172. package/src/navigation/style.scss +6 -4
  173. package/src/navigation-link/index.php +2 -1
  174. package/src/navigation-submenu/index.php +30 -76
  175. package/src/post-author/index.php +1 -1
  176. package/src/post-date/edit.js +4 -1
  177. package/src/post-date/index.js +2 -0
  178. package/src/post-date/variations.js +20 -0
  179. package/src/post-excerpt/edit.js +48 -16
  180. package/src/post-featured-image/dimension-controls.js +2 -2
  181. package/src/post-featured-image/editor.scss +1 -0
  182. package/src/post-template/block.json +1 -1
  183. package/src/post-template/style.scss +1 -1
  184. package/src/post-time-to-read/block.json +17 -1
  185. package/src/post-time-to-read/style.scss +4 -0
  186. package/src/query-title/index.php +2 -5
  187. package/src/quote/block.json +1 -0
  188. package/src/search/style.scss +16 -12
  189. package/src/spacer/edit.js +18 -5
  190. package/src/style.scss +1 -0
  191. package/src/video/test/__snapshots__/transforms.native.js.snap +1 -1
  192. package/tsconfig.tsbuildinfo +1 -1
  193. package/src/cover/test/block-controls.js +0 -62
@@ -26,10 +26,7 @@ var _placeholderPreview = _interopRequireDefault(require("./placeholder/placehol
26
26
  */
27
27
  const ALLOWED_BLOCKS = ['core/navigation-link', 'core/search', 'core/social-links', 'core/page-list', 'core/spacer', 'core/home-link', 'core/site-title', 'core/site-logo', 'core/navigation-submenu'];
28
28
  const DEFAULT_BLOCK = {
29
- name: 'core/navigation-link',
30
- attributes: {
31
- type: 'page'
32
- }
29
+ name: 'core/navigation-link'
33
30
  };
34
31
 
35
32
  function NavigationInnerBlocks(_ref) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/navigation/edit/inner-blocks.js"],"names":["ALLOWED_BLOCKS","DEFAULT_BLOCK","name","attributes","type","NavigationInnerBlocks","clientId","hasCustomPlaceholder","orientation","templateLock","isImmediateParentOfSelectedBlock","selectedBlockHasChildren","isSelected","select","getBlockCount","hasSelectedInnerBlock","getSelectedBlockClientId","blockEditorStore","selectedBlockId","blocks","onInput","onChange","shouldDirectInsert","every","parentOrChildHasSelection","placeholder","hasMenuItems","length","showPlaceholder","innerBlocksProps","className","value","allowedBlocks","__experimentalDefaultBlock","__experimentalDirectInsert","renderAppender","InnerBlocks","ButtonBlockAppender","undefined"],"mappings":";;;;;;;;;AAUA;;AAPA;;AACA;;AAKA;;AAMA;;AAfA;AACA;AACA;;AAUA;AACA;AACA;AAGA,MAAMA,cAAc,GAAG,CACtB,sBADsB,EAEtB,aAFsB,EAGtB,mBAHsB,EAItB,gBAJsB,EAKtB,aALsB,EAMtB,gBANsB,EAOtB,iBAPsB,EAQtB,gBARsB,EAStB,yBATsB,CAAvB;AAYA,MAAMC,aAAa,GAAG;AACrBC,EAAAA,IAAI,EAAE,sBADe;AAErBC,EAAAA,UAAU,EAAE;AACXC,IAAAA,IAAI,EAAE;AADK;AAFS,CAAtB;;AAOe,SAASC,qBAAT,OAKX;AAAA,MAL2C;AAC9CC,IAAAA,QAD8C;AAE9CC,IAAAA,oBAF8C;AAG9CC,IAAAA,WAH8C;AAI9CC,IAAAA;AAJ8C,GAK3C;AACH,QAAM;AACLC,IAAAA,gCADK;AAELC,IAAAA,wBAFK;AAGLC,IAAAA;AAHK,MAIF,qBACDC,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,aADK;AAELC,MAAAA,qBAFK;AAGLC,MAAAA;AAHK,QAIFH,MAAM,CAAEI,kBAAF,CAJV;AAKA,UAAMC,eAAe,GAAGF,wBAAwB,EAAhD;AAEA,WAAO;AACNN,MAAAA,gCAAgC,EAAEK,qBAAqB,CACtDT,QADsD,EAEtD,KAFsD,CADjD;AAKNK,MAAAA,wBAAwB,EAAE,CAAC,CAAEG,aAAa,CAAEI,eAAF,CALpC;AAON;AACA;AACAN,MAAAA,UAAU,EAAEM,eAAe,KAAKZ;AAT1B,KAAP;AAWA,GApBE,EAqBH,CAAEA,QAAF,CArBG,CAJJ;AA4BA,QAAM,CAAEa,MAAF,EAAUC,OAAV,EAAmBC,QAAnB,IAAgC,oCACrC,UADqC,EAErC,eAFqC,CAAtC;AAKA,QAAMC,kBAAkB,GAA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@wordpress/core-data';\nimport {\n\tuseInnerBlocksProps,\n\tInnerBlocks,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport PlaceholderPreview from './placeholder/placeholder-preview';\n\nconst ALLOWED_BLOCKS = [\n\t'core/navigation-link',\n\t'core/search',\n\t'core/social-links',\n\t'core/page-list',\n\t'core/spacer',\n\t'core/home-link',\n\t'core/site-title',\n\t'core/site-logo',\n\t'core/navigation-submenu',\n];\n\nconst DEFAULT_BLOCK = {\n\tname: 'core/navigation-link',\n\tattributes: {\n\t\ttype: 'page',\n\t},\n};\n\nexport default function NavigationInnerBlocks( {\n\tclientId,\n\thasCustomPlaceholder,\n\torientation,\n\ttemplateLock,\n} ) {\n\tconst {\n\t\tisImmediateParentOfSelectedBlock,\n\t\tselectedBlockHasChildren,\n\t\tisSelected,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockCount,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst selectedBlockId = getSelectedBlockClientId();\n\n\t\t\treturn {\n\t\t\t\tisImmediateParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\tfalse\n\t\t\t\t),\n\t\t\t\tselectedBlockHasChildren: !! getBlockCount( selectedBlockId ),\n\n\t\t\t\t// This prop is already available but computing it here ensures it's\n\t\t\t\t// fresh compared to isImmediateParentOfSelectedBlock.\n\t\t\t\tisSelected: selectedBlockId === clientId,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\t'wp_navigation'\n\t);\n\n\tconst shouldDirectInsert = useMemo(\n\t\t() =>\n\t\t\tblocks.every(\n\t\t\t\t( { name } ) =>\n\t\t\t\t\tname === 'core/navigation-link' ||\n\t\t\t\t\tname === 'core/navigation-submenu' ||\n\t\t\t\t\tname === 'core/page-list'\n\t\t\t),\n\t\t[ blocks ]\n\t);\n\n\t// When the block is selected itself or has a top level item selected that\n\t// doesn't itself have children, show the standard appender. Else show no\n\t// appender.\n\tconst parentOrChildHasSelection =\n\t\tisSelected ||\n\t\t( isImmediateParentOfSelectedBlock && ! selectedBlockHasChildren );\n\n\tconst placeholder = useMemo( () => <PlaceholderPreview />, [] );\n\n\tconst hasMenuItems = !! blocks?.length;\n\n\t// If there is a `ref` attribute pointing to a `wp_navigation` but\n\t// that menu has no **items** (i.e. empty) then show a placeholder.\n\t// The block must also be selected else the placeholder will display\n\t// alongside the appender.\n\tconst showPlaceholder =\n\t\t! hasCustomPlaceholder && ! hasMenuItems && ! isSelected;\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{\n\t\t\tclassName: 'wp-block-navigation__container',\n\t\t},\n\t\t{\n\t\t\tvalue: blocks,\n\t\t\tonInput,\n\t\t\tonChange,\n\t\t\tallowedBlocks: ALLOWED_BLOCKS,\n\t\t\t__experimentalDefaultBlock: DEFAULT_BLOCK,\n\t\t\t__experimentalDirectInsert: shouldDirectInsert,\n\t\t\torientation,\n\t\t\ttemplateLock,\n\n\t\t\t// As an exception to other blocks which feature nesting, show\n\t\t\t// the block appender even when a child block is selected.\n\t\t\t// This should be a temporary fix, to be replaced by improvements to\n\t\t\t// the sibling inserter.\n\t\t\t// See https://github.com/WordPress/gutenberg/issues/37572.\n\t\t\trenderAppender:\n\t\t\t\tisSelected ||\n\t\t\t\t( isImmediateParentOfSelectedBlock &&\n\t\t\t\t\t! selectedBlockHasChildren ) ||\n\t\t\t\t// Show the appender while dragging to allow inserting element between item and the appender.\n\t\t\t\tparentOrChildHasSelection\n\t\t\t\t\t? InnerBlocks.ButtonBlockAppender\n\t\t\t\t\t: false,\n\t\t\tplaceholder: showPlaceholder ? placeholder : undefined,\n\t\t}\n\t);\n\n\treturn <div { ...innerBlocksProps } />;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/navigation/edit/inner-blocks.js"],"names":["ALLOWED_BLOCKS","DEFAULT_BLOCK","name","NavigationInnerBlocks","clientId","hasCustomPlaceholder","orientation","templateLock","isImmediateParentOfSelectedBlock","selectedBlockHasChildren","isSelected","select","getBlockCount","hasSelectedInnerBlock","getSelectedBlockClientId","blockEditorStore","selectedBlockId","blocks","onInput","onChange","shouldDirectInsert","every","parentOrChildHasSelection","placeholder","hasMenuItems","length","showPlaceholder","innerBlocksProps","className","value","allowedBlocks","__experimentalDefaultBlock","__experimentalDirectInsert","renderAppender","InnerBlocks","ButtonBlockAppender","undefined"],"mappings":";;;;;;;;;AAUA;;AAPA;;AACA;;AAKA;;AAMA;;AAfA;AACA;AACA;;AAUA;AACA;AACA;AAGA,MAAMA,cAAc,GAAG,CACtB,sBADsB,EAEtB,aAFsB,EAGtB,mBAHsB,EAItB,gBAJsB,EAKtB,aALsB,EAMtB,gBANsB,EAOtB,iBAPsB,EAQtB,gBARsB,EAStB,yBATsB,CAAvB;AAYA,MAAMC,aAAa,GAAG;AACrBC,EAAAA,IAAI,EAAE;AADe,CAAtB;;AAIe,SAASC,qBAAT,OAKX;AAAA,MAL2C;AAC9CC,IAAAA,QAD8C;AAE9CC,IAAAA,oBAF8C;AAG9CC,IAAAA,WAH8C;AAI9CC,IAAAA;AAJ8C,GAK3C;AACH,QAAM;AACLC,IAAAA,gCADK;AAELC,IAAAA,wBAFK;AAGLC,IAAAA;AAHK,MAIF,qBACDC,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,aADK;AAELC,MAAAA,qBAFK;AAGLC,MAAAA;AAHK,QAIFH,MAAM,CAAEI,kBAAF,CAJV;AAKA,UAAMC,eAAe,GAAGF,wBAAwB,EAAhD;AAEA,WAAO;AACNN,MAAAA,gCAAgC,EAAEK,qBAAqB,CACtDT,QADsD,EAEtD,KAFsD,CADjD;AAKNK,MAAAA,wBAAwB,E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,UAAU,IACRF,gCAAgC,IACjC,CAAEC,wBAFH,IAGA;AACAa,IAAAA,yBAJA,GAKGY,yBAAYC,mBALf,GAMG,KAtBL;AAuBCZ,IAAAA,WAAW,EAAEG,eAAe,GAAGH,WAAH,GAAiBa;AAvB9C,GAJwB,CAAzB;AA+BA,SAAO,mCAAUT,gBAAV,CAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityBlockEditor } from '@wordpress/core-data';\nimport {\n\tuseInnerBlocksProps,\n\tInnerBlocks,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport PlaceholderPreview from './placeholder/placeholder-preview';\n\nconst ALLOWED_BLOCKS = [\n\t'core/navigation-link',\n\t'core/search',\n\t'core/social-links',\n\t'core/page-list',\n\t'core/spacer',\n\t'core/home-link',\n\t'core/site-title',\n\t'core/site-logo',\n\t'core/navigation-submenu',\n];\n\nconst DEFAULT_BLOCK = {\n\tname: 'core/navigation-link',\n};\n\nexport default function NavigationInnerBlocks( {\n\tclientId,\n\thasCustomPlaceholder,\n\torientation,\n\ttemplateLock,\n} ) {\n\tconst {\n\t\tisImmediateParentOfSelectedBlock,\n\t\tselectedBlockHasChildren,\n\t\tisSelected,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockCount,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst selectedBlockId = getSelectedBlockClientId();\n\n\t\t\treturn {\n\t\t\t\tisImmediateParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\tfalse\n\t\t\t\t),\n\t\t\t\tselectedBlockHasChildren: !! getBlockCount( selectedBlockId ),\n\n\t\t\t\t// This prop is already available but computing it here ensures it's\n\t\t\t\t// fresh compared to isImmediateParentOfSelectedBlock.\n\t\t\t\tisSelected: selectedBlockId === clientId,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\t'wp_navigation'\n\t);\n\n\tconst shouldDirectInsert = useMemo(\n\t\t() =>\n\t\t\tblocks.every(\n\t\t\t\t( { name } ) =>\n\t\t\t\t\tname === 'core/navigation-link' ||\n\t\t\t\t\tname === 'core/navigation-submenu' ||\n\t\t\t\t\tname === 'core/page-list'\n\t\t\t),\n\t\t[ blocks ]\n\t);\n\n\t// When the block is selected itself or has a top level item selected that\n\t// doesn't itself have children, show the standard appender. Else show no\n\t// appender.\n\tconst parentOrChildHasSelection =\n\t\tisSelected ||\n\t\t( isImmediateParentOfSelectedBlock && ! selectedBlockHasChildren );\n\n\tconst placeholder = useMemo( () => <PlaceholderPreview />, [] );\n\n\tconst hasMenuItems = !! blocks?.length;\n\n\t// If there is a `ref` attribute pointing to a `wp_navigation` but\n\t// that menu has no **items** (i.e. empty) then show a placeholder.\n\t// The block must also be selected else the placeholder will display\n\t// alongside the appender.\n\tconst showPlaceholder =\n\t\t! hasCustomPlaceholder && ! hasMenuItems && ! isSelected;\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{\n\t\t\tclassName: 'wp-block-navigation__container',\n\t\t},\n\t\t{\n\t\t\tvalue: blocks,\n\t\t\tonInput,\n\t\t\tonChange,\n\t\t\tallowedBlocks: ALLOWED_BLOCKS,\n\t\t\t__experimentalDefaultBlock: DEFAULT_BLOCK,\n\t\t\t__experimentalDirectInsert: shouldDirectInsert,\n\t\t\torientation,\n\t\t\ttemplateLock,\n\n\t\t\t// As an exception to other blocks which feature nesting, show\n\t\t\t// the block appender even when a child block is selected.\n\t\t\t// This should be a temporary fix, to be replaced by improvements to\n\t\t\t// the sibling inserter.\n\t\t\t// See https://github.com/WordPress/gutenberg/issues/37572.\n\t\t\trenderAppender:\n\t\t\t\tisSelected ||\n\t\t\t\t( isImmediateParentOfSelectedBlock &&\n\t\t\t\t\t! selectedBlockHasChildren ) ||\n\t\t\t\t// Show the appender while dragging to allow inserting element between item and the appender.\n\t\t\t\tparentOrChildHasSelection\n\t\t\t\t\t? InnerBlocks.ButtonBlockAppender\n\t\t\t\t\t: false,\n\t\t\tplaceholder: showPlaceholder ? placeholder : undefined,\n\t\t}\n\t);\n\n\treturn <div { ...innerBlocksProps } />;\n}\n"]}
@@ -115,7 +115,6 @@ const metadata = {
115
115
  showSubmenuIcon: "showSubmenuIcon",
116
116
  openSubmenusOnClick: "openSubmenusOnClick",
117
117
  style: "style",
118
- orientation: "orientation",
119
118
  maxNestingLevel: "maxNestingLevel"
120
119
  },
121
120
  supports: {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/navigation/index.js"],"names":["name","metadata","settings","icon","example","attributes","overlayMenu","innerBlocks","label","url","edit","save","deprecated","init"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AAEA;;AACA;;AACA;;AAbA;AACA;AACA;;AAIA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAIO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,iBADuB;AAEvBC,EAAAA,OAAO,EAAE;AACRC,IAAAA,UAAU,EAAE;AACXC,MAAAA,WAAW,EAAE;AADF,KADJ;AAIRC,IAAAA,WAAW,EAAE,CACZ;AACCP,MAAAA,IAAI,EAAE,sBADP;AAECK,MAAAA,UAAU,EAAE;AACX;AACAG,QAAAA,KAAK,EAAE,cAAI,MAAJ,CAFI;AAGXC,QAAAA,GAAG,EAAE;AAHM;AAFb,KADY,EASZ;AACCT,MAAAA,IAAI,EAAE,sBADP;AAECK,MAAAA,UAAU,EAAE;AACX;AACAG,QAAAA,KAAK,EAAE,cAAI,OAAJ,CAFI;AAGXC,QAAAA,GAAG,EAAE;AAHM;AAFb,KATY,EAiBZ;AACCT,MAAAA,IAAI,EAAE,sBADP;AAECK,MAAAA,UAAU,EAAE;AACX;AACAG,QAAAA,KAAK,EAAE,cAAI,SAAJ,CAFI;AAGXC,QAAAA,GAAG,EAAE;AAHM;AAFb,KAjBY;AAJL,GAFc;AAiCvBC,EAAAA,IAAI,EAAJA,aAjCuB;AAkCvBC,EAAAA,IAAI,EAAJA,aAlCuB;AAmCvBC,EAAAA,UAAU,EAAVA;AAnCuB,CAAjB;;;AAsCA,MAAMC,IAAI,GAAG,MAAM,wBAAW;AAAEb,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA;AAAlB,CAAX,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { navigation as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\toverlayMenu: 'never',\n\t\t},\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/navigation-link',\n\t\t\t\tattributes: {\n\t\t\t\t\t// translators: 'Home' as in a website's home page.\n\t\t\t\t\tlabel: __( 'Home' ),\n\t\t\t\t\turl: 'https://make.wordpress.org/',\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/navigation-link',\n\t\t\t\tattributes: {\n\t\t\t\t\t// translators: 'About' as in a website's about page.\n\t\t\t\t\tlabel: __( 'About' ),\n\t\t\t\t\turl: 'https://make.wordpress.org/',\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/navigation-link',\n\t\t\t\tattributes: {\n\t\t\t\t\t// translators: 'Contact' as in a website's contact page.\n\t\t\t\t\tlabel: __( 'Contact' ),\n\t\t\t\t\turl: 'https://make.wordpress.org/',\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/navigation/index.js"],"names":["name","metadata","settings","icon","example","attributes","overlayMenu","innerBlocks","label","url","edit","save","deprecated","init"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AAEA;;AACA;;AACA;;AAbA;AACA;AACA;;AAIA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAIO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,iBADuB;AAEvBC,EAAAA,OAAO,EAAE;AACRC,IAAAA,UAAU,EAAE;AACXC,MAAAA,WAAW,EAAE;AADF,KADJ;AAIRC,IAAAA,WAAW,EAAE,CACZ;AACCP,MAAAA,IAAI,EAAE,sBADP;AAECK,MAAAA,UAAU,EAAE;AACX;AACAG,QAAAA,KAAK,EAAE,cAAI,MAAJ,CAFI;AAGXC,QAAAA,GAAG,EAAE;AAHM;AAFb,KADY,EASZ;AACCT,MAAAA,IAAI,EAAE,sBADP;AAECK,MAAAA,UAAU,EAAE;AACX;AACAG,QAAAA,KAAK,EAAE,cAAI,OAAJ,CAFI;AAGXC,QAAAA,GAAG,EAAE;AAHM;AAFb,KATY,EAiBZ;AACCT,MAAAA,IAAI,EAAE,sBADP;AAECK,MAAAA,UAAU,EAAE;AACX;AACAG,QAAAA,KAAK,EAAE,cAAI,SAAJ,CAFI;AAGXC,QAAAA,GAAG,EAAE;AAHM;AAFb,KAjBY;AAJL,GAFc;AAiCvBC,EAAAA,IAAI,EAAJA,aAjCuB;AAkCvBC,EAAAA,IAAI,EAAJA,aAlCuB;AAmCvBC,EAAAA,UAAU,EAAVA;AAnCuB,CAAjB;;;AAsCA,MAAMC,IAAI,GAAG,MAAM,wBAAW;AAAEb,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA;AAAlB,CAAX,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { navigation as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\toverlayMenu: 'never',\n\t\t},\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/navigation-link',\n\t\t\t\tattributes: {\n\t\t\t\t\t// translators: 'Home' as in a website's home page.\n\t\t\t\t\tlabel: __( 'Home' ),\n\t\t\t\t\turl: 'https://make.wordpress.org/',\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/navigation-link',\n\t\t\t\tattributes: {\n\t\t\t\t\t// translators: 'About' as in a website's about page.\n\t\t\t\t\tlabel: __( 'About' ),\n\t\t\t\t\turl: 'https://make.wordpress.org/',\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/navigation-link',\n\t\t\t\tattributes: {\n\t\t\t\t\t// translators: 'Contact' as in a website's contact page.\n\t\t\t\t\tlabel: __( 'Contact' ),\n\t\t\t\t\turl: 'https://make.wordpress.org/',\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"]}
@@ -68,10 +68,11 @@ function PostDateEdit(_ref) {
68
68
  const [siteTimeFormat = dateSettings.formats.time] = (0, _coreData.useEntityProp)('root', 'site', 'time_format');
69
69
  const [date, setDate] = (0, _coreData.useEntityProp)('postType', postTypeSlug, displayType, postId);
70
70
  const postType = (0, _data.useSelect)(select => postTypeSlug ? select(_coreData.store).getPostType(postTypeSlug) : null, [postTypeSlug]);
71
+ const dateLabel = displayType === 'date' ? (0, _i18n.__)('Post Date') : (0, _i18n.__)('Post Modified Date');
71
72
  let postDate = date ? (0, _element.createElement)("time", {
72
73
  dateTime: (0, _date.dateI18n)('c', date),
73
74
  ref: setPopoverAnchor
74
- }, (0, _date.dateI18n)(format || siteFormat, date)) : (0, _i18n.__)('Post Date');
75
+ }, (0, _date.dateI18n)(format || siteFormat, date)) : dateLabel;
75
76
 
76
77
  if (isLink && date) {
77
78
  postDate = (0, _element.createElement)("a", {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/post-date/edit.js"],"names":["PostDateEdit","attributes","textAlign","format","isLink","displayType","context","postId","postType","postTypeSlug","queryId","setAttributes","blockProps","className","popoverAnchor","setPopoverAnchor","popoverProps","anchor","isDescendentOfQueryLoop","Number","isFinite","dateSettings","siteFormat","formats","date","siteTimeFormat","time","setDate","select","coreStore","getPostType","postDate","event","preventDefault","nextAlign","onClose","is12HourFormat","isOpen","onToggle","openOnArrowDown","keyCode","DOWN","edit","nextFormat","labels","singular_name","toLowerCase","value","test"],"mappings":";;;;;;;;;;AASA;;AANA;;AAKA;;AAEA;;AACA;;AAQA;;AAOA;;AACA;;AACA;;AACA;;AA7BA;AACA;AACA;;AAGA;AACA;AACA;AAwBe,SAASA,YAAT,OAIX;AAAA,MAJkC;AACrCC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,SAAF;AAAaC,MAAAA,MAAb;AAAqBC,MAAAA,MAArB;AAA6BC,MAAAA;AAA7B,KADyB;AAErCC,IAAAA,OAA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,SAAO,oBAAoB6C,IAApB,CAA0B7C,MAA1B,CAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useMemo, useState } from '@wordpress/element';\nimport { dateI18n, getSettings as getDateSettings } from '@wordpress/date';\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\t__experimentalDateFormatPicker as DateFormatPicker,\n\t__experimentalPublishDateTimePicker as PublishDateTimePicker,\n} from '@wordpress/block-editor';\nimport {\n\tDropdown,\n\tToolbarGroup,\n\tToolbarButton,\n\tToggleControl,\n\tPanelBody,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { edit } from '@wordpress/icons';\nimport { DOWN } from '@wordpress/keycodes';\nimport { useSelect } from '@wordpress/data';\n\nexport default function PostDateEdit( {\n\tattributes: { textAlign, format, isLink, displayType },\n\tcontext: { postId, postType: postTypeSlug, queryId },\n\tsetAttributes,\n} ) {\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( { anchor: popoverAnchor } ),\n\t\t[ popoverAnchor ]\n\t);\n\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst dateSettings = getDateSettings();\n\tconst [ siteFormat = dateSettings.formats.date ] = useEntityProp(\n\t\t'root',\n\t\t'site',\n\t\t'date_format'\n\t);\n\tconst [ siteTimeFormat = dateSettings.formats.time ] = useEntityProp(\n\t\t'root',\n\t\t'site',\n\t\t'time_format'\n\t);\n\tconst [ date, setDate ] = useEntityProp(\n\t\t'postType',\n\t\tpostTypeSlug,\n\t\tdisplayType,\n\t\tpostId\n\t);\n\n\tconst postType = useSelect(\n\t\t( select ) =>\n\t\t\tpostTypeSlug\n\t\t\t\t? select( coreStore ).getPostType( postTypeSlug )\n\t\t\t\t: null,\n\t\t[ postTypeSlug ]\n\t);\n\n\tlet postDate = date ? (\n\t\t<time dateTime={ dateI18n( 'c', date ) } ref={ setPopoverAnchor }>\n\t\t\t{ dateI18n( format || siteFormat, date ) }\n\t\t</time>\n\t) : (\n\t\t__( 'Post Date' )\n\t);\n\n\tif ( isLink && date ) {\n\t\tpostDate = (\n\t\t\t<a\n\t\t\t\thref=\"#post-date-pseudo-link\"\n\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t>\n\t\t\t\t{ postDate }\n\t\t\t</a>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<AlignmentControl\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\tsetAttributes( { textAlign: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\t{ date && ! isDescendentOfQueryLoop && (\n\t\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t\t\t<PublishDateTimePicker\n\t\t\t\t\t\t\t\t\tcurrentDate={ date }\n\t\t\t\t\t\t\t\t\tonChange={ setDate }\n\t\t\t\t\t\t\t\t\tis12Hour={ is12HourFormat(\n\t\t\t\t\t\t\t\t\t\tsiteTimeFormat\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => {\n\t\t\t\t\t\t\t\tconst openOnArrowDown = ( event ) => {\n\t\t\t\t\t\t\t\t\tif ( ! isOpen && event.keyCode === DOWN ) {\n\t\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\t\tonToggle();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\t\t\t\t\ticon={ edit }\n\t\t\t\t\t\t\t\t\t\ttitle={ __( 'Change Date' ) }\n\t\t\t\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\t\t\t\tonKeyDown={ openOnArrowDown }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t) }\n\t\t\t</BlockControls>\n\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<DateFormatPicker\n\t\t\t\t\t\tformat={ format }\n\t\t\t\t\t\tdefaultFormat={ siteFormat }\n\t\t\t\t\t\tonChange={ ( nextFormat ) =>\n\t\t\t\t\t\t\tsetAttributes( { format: nextFormat } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\tpostType?.labels.singular_name\n\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"post\".\n\t\t\t\t\t\t\t\t\t\t__( 'Link to %s' ),\n\t\t\t\t\t\t\t\t\t\tpostType.labels.singular_name.toLowerCase()\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t: __( 'Link to post' )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonChange={ () => setAttributes( { isLink: ! isLink } ) }\n\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Display last modified date' ) }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tdisplayType: value ? 'modified' : 'date',\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tchecked={ displayType === 'modified' }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\n\t\t\t<div { ...blockProps }>{ postDate }</div>\n\t\t</>\n\t);\n}\n\nexport function is12HourFormat( format ) {\n\t// To know if the time format is a 12 hour time, look for any of the 12 hour\n\t// format characters: 'a', 'A', 'g', and 'h'. The character must be\n\t// unescaped, i.e. not preceded by a '\\'. Coincidentally, 'aAgh' is how I\n\t// feel when working with regular expressions.\n\t// https://www.php.net/manual/en/datetime.format.php\n\treturn /(?:^|[^\\\\])[aAgh]/.test( format );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/post-date/edit.js"],"names":["PostDateEdit","attributes","textAlign","format","isLink","displayType","context","postId","postType","postTypeSlug","queryId","setAttributes","blockProps","className","popoverAnchor","setPopoverAnchor","popoverProps","anchor","isDescendentOfQueryLoop","Number","isFinite","dateSettings","siteFormat","formats","date","siteTimeFormat","time","setDate","select","coreStore","getPostType","dateLabel","postDate","event","preventDefault","nextAlign","onClose","is12HourFormat","isOpen","onToggle","openOnArrowDown","keyCode","DOWN","edit","nextFormat","labels","singular_name","toLowerCase","value","test"],"mappings":";;;;;;;;;;AASA;;AANA;;AAKA;;AAEA;;AACA;;AAQA;;AAOA;;AACA;;AACA;;AACA;;AA7BA;AACA;AACA;;AAGA;AACA;AACA;AAwBe,SAASA,YAAT,OAIX;AAAA,MAJkC;AACrCC,IAAAA,U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gB;AADpB,KAAF,CAJf;AAQC,IAAA,OAAO,EAAG3C,WAAW,KAAK;AAR3B,IAtBD,CADD,CA5CD,EAgFC,mCAAUO,UAAV,EAAyBoB,QAAzB,CAhFD,CADD;AAoFA;;AAEM,SAASK,cAAT,CAAyBlC,MAAzB,EAAkC;AACxC;AACA;AACA;AACA;AACA;AACA,SAAO,oBAAoB8C,IAApB,CAA0B9C,MAA1B,CAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useMemo, useState } from '@wordpress/element';\nimport { dateI18n, getSettings as getDateSettings } from '@wordpress/date';\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\t__experimentalDateFormatPicker as DateFormatPicker,\n\t__experimentalPublishDateTimePicker as PublishDateTimePicker,\n} from '@wordpress/block-editor';\nimport {\n\tDropdown,\n\tToolbarGroup,\n\tToolbarButton,\n\tToggleControl,\n\tPanelBody,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { edit } from '@wordpress/icons';\nimport { DOWN } from '@wordpress/keycodes';\nimport { useSelect } from '@wordpress/data';\n\nexport default function PostDateEdit( {\n\tattributes: { textAlign, format, isLink, displayType },\n\tcontext: { postId, postType: postTypeSlug, queryId },\n\tsetAttributes,\n} ) {\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( { anchor: popoverAnchor } ),\n\t\t[ popoverAnchor ]\n\t);\n\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst dateSettings = getDateSettings();\n\tconst [ siteFormat = dateSettings.formats.date ] = useEntityProp(\n\t\t'root',\n\t\t'site',\n\t\t'date_format'\n\t);\n\tconst [ siteTimeFormat = dateSettings.formats.time ] = useEntityProp(\n\t\t'root',\n\t\t'site',\n\t\t'time_format'\n\t);\n\tconst [ date, setDate ] = useEntityProp(\n\t\t'postType',\n\t\tpostTypeSlug,\n\t\tdisplayType,\n\t\tpostId\n\t);\n\n\tconst postType = useSelect(\n\t\t( select ) =>\n\t\t\tpostTypeSlug\n\t\t\t\t? select( coreStore ).getPostType( postTypeSlug )\n\t\t\t\t: null,\n\t\t[ postTypeSlug ]\n\t);\n\n\tconst dateLabel =\n\t\tdisplayType === 'date' ? __( 'Post Date' ) : __( 'Post Modified Date' );\n\n\tlet postDate = date ? (\n\t\t<time dateTime={ dateI18n( 'c', date ) } ref={ setPopoverAnchor }>\n\t\t\t{ dateI18n( format || siteFormat, date ) }\n\t\t</time>\n\t) : (\n\t\tdateLabel\n\t);\n\n\tif ( isLink && date ) {\n\t\tpostDate = (\n\t\t\t<a\n\t\t\t\thref=\"#post-date-pseudo-link\"\n\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t>\n\t\t\t\t{ postDate }\n\t\t\t</a>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<AlignmentControl\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\tsetAttributes( { textAlign: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\t{ date && ! isDescendentOfQueryLoop && (\n\t\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t\t\t<PublishDateTimePicker\n\t\t\t\t\t\t\t\t\tcurrentDate={ date }\n\t\t\t\t\t\t\t\t\tonChange={ setDate }\n\t\t\t\t\t\t\t\t\tis12Hour={ is12HourFormat(\n\t\t\t\t\t\t\t\t\t\tsiteTimeFormat\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => {\n\t\t\t\t\t\t\t\tconst openOnArrowDown = ( event ) => {\n\t\t\t\t\t\t\t\t\tif ( ! isOpen && event.keyCode === DOWN ) {\n\t\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\t\tonToggle();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\t\t\t\t\ticon={ edit }\n\t\t\t\t\t\t\t\t\t\ttitle={ __( 'Change Date' ) }\n\t\t\t\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\t\t\t\tonKeyDown={ openOnArrowDown }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t) }\n\t\t\t</BlockControls>\n\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<DateFormatPicker\n\t\t\t\t\t\tformat={ format }\n\t\t\t\t\t\tdefaultFormat={ siteFormat }\n\t\t\t\t\t\tonChange={ ( nextFormat ) =>\n\t\t\t\t\t\t\tsetAttributes( { format: nextFormat } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\tpostType?.labels.singular_name\n\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"post\".\n\t\t\t\t\t\t\t\t\t\t__( 'Link to %s' ),\n\t\t\t\t\t\t\t\t\t\tpostType.labels.singular_name.toLowerCase()\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t: __( 'Link to post' )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonChange={ () => setAttributes( { isLink: ! isLink } ) }\n\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Display last modified date' ) }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tdisplayType: value ? 'modified' : 'date',\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tchecked={ displayType === 'modified' }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\n\t\t\t<div { ...blockProps }>{ postDate }</div>\n\t\t</>\n\t);\n}\n\nexport function is12HourFormat( format ) {\n\t// To know if the time format is a 12 hour time, look for any of the 12 hour\n\t// format characters: 'a', 'A', 'g', and 'h'. The character must be\n\t// unescaped, i.e. not preceded by a '\\'. Coincidentally, 'aAgh' is how I\n\t// feel when working with regular expressions.\n\t// https://www.php.net/manual/en/datetime.format.php\n\treturn /(?:^|[^\\\\])[aAgh]/.test( format );\n}\n"]}
@@ -15,6 +15,8 @@ var _edit = _interopRequireDefault(require("./edit"));
15
15
 
16
16
  var _deprecated = _interopRequireDefault(require("./deprecated"));
17
17
 
18
+ var _variations = _interopRequireDefault(require("./variations"));
19
+
18
20
  /**
19
21
  * WordPress dependencies
20
22
  */
@@ -86,7 +88,8 @@ exports.name = name;
86
88
  const settings = {
87
89
  icon: _icons.postDate,
88
90
  edit: _edit.default,
89
- deprecated: _deprecated.default
91
+ deprecated: _deprecated.default,
92
+ variations: _variations.default
90
93
  };
91
94
  exports.settings = settings;
92
95
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/post-date/index.js"],"names":["name","metadata","settings","icon","edit","deprecated","init"],"mappings":";;;;;;;;;AAGA;;AAKA;;AAEA;;AACA;;AAXA;AACA;AACA;;AAGA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAGO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,eADuB;AAEvBC,EAAAA,IAAI,EAAJA,aAFuB;AAGvBC,EAAAA,UAAU,EAAVA;AAHuB,CAAjB;;;AAMA,MAAMC,IAAI,GAAG,MAAM,wBAAW;AAAEN,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA;AAAlB,CAAX,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { postDate as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/post-date/index.js"],"names":["name","metadata","settings","icon","edit","deprecated","variations","init"],"mappings":";;;;;;;;;AAGA;;AAKA;;AAEA;;AACA;;AACA;;AAZA;AACA;AACA;;AAGA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAGO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,eADuB;AAEvBC,EAAAA,IAAI,EAAJA,aAFuB;AAGvBC,EAAAA,UAAU,EAAVA,mBAHuB;AAIvBC,EAAAA,UAAU,EAAVA;AAJuB,CAAjB;;;AAOA,MAAMC,IAAI,GAAG,MAAM,wBAAW;AAAEP,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA;AAAlB,CAAX,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { postDate as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport deprecated from './deprecated';\nimport variations from './variations';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tdeprecated,\n\tvariations,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"]}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _i18n = require("@wordpress/i18n");
9
+
10
+ var _icons = require("@wordpress/icons");
11
+
12
+ /**
13
+ * WordPress dependencies
14
+ */
15
+ const variations = [{
16
+ name: 'post-date-modified',
17
+ title: (0, _i18n.__)('Post Modified Date'),
18
+ description: (0, _i18n.__)("Display a post's last updated date."),
19
+ attributes: {
20
+ displayType: 'modified'
21
+ },
22
+ scope: ['block', 'inserter'],
23
+ isActive: blockAttributes => blockAttributes.displayType === 'modified',
24
+ icon: _icons.postDate
25
+ }];
26
+ var _default = variations;
27
+ exports.default = _default;
28
+ //# sourceMappingURL=variations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-library/src/post-date/variations.js"],"names":["variations","name","title","description","attributes","displayType","scope","isActive","blockAttributes","icon","postDate"],"mappings":";;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIA,MAAMA,UAAU,GAAG,CAClB;AACCC,EAAAA,IAAI,EAAE,oBADP;AAECC,EAAAA,KAAK,EAAE,cAAI,oBAAJ,CAFR;AAGCC,EAAAA,WAAW,EAAE,cAAI,qCAAJ,CAHd;AAICC,EAAAA,UAAU,EAAE;AAAEC,IAAAA,WAAW,EAAE;AAAf,GAJb;AAKCC,EAAAA,KAAK,EAAE,CAAE,OAAF,EAAW,UAAX,CALR;AAMCC,EAAAA,QAAQ,EAAIC,eAAF,IACTA,eAAe,CAACH,WAAhB,KAAgC,UAPlC;AAQCI,EAAAA,IAAI,EAAEC;AARP,CADkB,CAAnB;eAaeV,U","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { postDate } from '@wordpress/icons';\n\nconst variations = [\n\t{\n\t\tname: 'post-date-modified',\n\t\ttitle: __( 'Post Modified Date' ),\n\t\tdescription: __( \"Display a post's last updated date.\" ),\n\t\tattributes: { displayType: 'modified' },\n\t\tscope: [ 'block', 'inserter' ],\n\t\tisActive: ( blockAttributes ) =>\n\t\t\tblockAttributes.displayType === 'modified',\n\t\ticon: postDate,\n\t},\n];\n\nexport default variations;\n"]}
@@ -19,6 +19,8 @@ var _components = require("@wordpress/components");
19
19
 
20
20
  var _i18n = require("@wordpress/i18n");
21
21
 
22
+ var _data = require("@wordpress/data");
23
+
22
24
  var _hooks = require("../utils/hooks");
23
25
 
24
26
  /**
@@ -32,6 +34,8 @@ var _hooks = require("../utils/hooks");
32
34
  /**
33
35
  * Internal dependencies
34
36
  */
37
+ const ELLIPSIS = '…';
38
+
35
39
  function PostExcerptEditor(_ref) {
36
40
  let {
37
41
  attributes: {
@@ -50,11 +54,37 @@ function PostExcerptEditor(_ref) {
50
54
  } = _ref;
51
55
  const isDescendentOfQueryLoop = Number.isFinite(queryId);
52
56
  const userCanEdit = (0, _hooks.useCanEditEntity)('postType', postType, postId);
53
- const isEditable = userCanEdit && !isDescendentOfQueryLoop;
54
57
  const [rawExcerpt, setExcerpt, {
55
58
  rendered: renderedExcerpt,
56
59
  protected: isProtected
57
60
  } = {}] = (0, _coreData.useEntityProp)('postType', postType, 'excerpt', postId);
61
+ /**
62
+ * Check if the post type supports excerpts.
63
+ * Add an exception and return early for the "page" post type,
64
+ * which is registered without support for the excerpt UI,
65
+ * but supports saving the excerpt to the database.
66
+ * See: https://core.trac.wordpress.org/browser/branches/6.1/src/wp-includes/post.php#L65
67
+ * Without this exception, users that have excerpts saved to the database will
68
+ * not be able to edit the excerpts.
69
+ */
70
+
71
+ const postTypeSupportsExcerpts = (0, _data.useSelect)(select => {
72
+ var _select$getPostType;
73
+
74
+ if (postType === 'page') {
75
+ return true;
76
+ }
77
+
78
+ return !!((_select$getPostType = select(_coreData.store).getPostType(postType)) !== null && _select$getPostType !== void 0 && _select$getPostType.supports.excerpt);
79
+ }, [postType]);
80
+ /**
81
+ * The excerpt is editable if:
82
+ * - The user can edit the post
83
+ * - It is not a descendent of a Query Loop block
84
+ * - The post type supports excerpts
85
+ */
86
+
87
+ const isEditable = userCanEdit && !isDescendentOfQueryLoop && postTypeSupportsExcerpts;
58
88
  const blockProps = (0, _blockEditor.useBlockProps)({
59
89
  className: (0, _classnames.default)({
60
90
  [`has-text-align-${textAlign}`]: textAlign
@@ -111,11 +141,11 @@ function PostExcerptEditor(_ref) {
111
141
  * the raw and the rendered excerpt depending on which is being used.
112
142
  */
113
143
 
114
- const rawOrRenderedExcerpt = !!renderedExcerpt ? strippedRenderedExcerpt : rawExcerpt;
144
+ const rawOrRenderedExcerpt = (rawExcerpt || strippedRenderedExcerpt).trim();
115
145
  let trimmedExcerpt = '';
116
146
 
117
147
  if (wordCountType === 'words') {
118
- trimmedExcerpt = rawOrRenderedExcerpt.trim().split(' ', excerptLength).join(' ');
148
+ trimmedExcerpt = rawOrRenderedExcerpt.split(' ', excerptLength).join(' ');
119
149
  } else if (wordCountType === 'characters_excluding_spaces') {
120
150
  /*
121
151
  * 1. Split the excerpt at the character limit,
@@ -125,23 +155,23 @@ function PostExcerptEditor(_ref) {
125
155
  * 3. Add the number to the length of the visible excerpt,
126
156
  * so that the spaces are excluded from the word count.
127
157
  */
128
- const excerptWithSpaces = rawOrRenderedExcerpt.trim().split('', excerptLength).join('');
158
+ const excerptWithSpaces = rawOrRenderedExcerpt.split('', excerptLength).join('');
129
159
  const numberOfSpaces = excerptWithSpaces.length - excerptWithSpaces.replaceAll(' ', '').length;
130
- trimmedExcerpt = rawOrRenderedExcerpt.trim().split('', excerptLength + numberOfSpaces).join('');
160
+ trimmedExcerpt = rawOrRenderedExcerpt.split('', excerptLength + numberOfSpaces).join('');
131
161
  } else if (wordCountType === 'characters_including_spaces') {
132
- trimmedExcerpt = rawOrRenderedExcerpt.trim().split('', excerptLength);
162
+ trimmedExcerpt = rawOrRenderedExcerpt.split('', excerptLength).join('');
133
163
  }
134
164
 
135
- trimmedExcerpt = trimmedExcerpt + '...';
165
+ const isTrimmed = trimmedExcerpt !== rawOrRenderedExcerpt;
136
166
  const excerptContent = isEditable ? (0, _element.createElement)(_blockEditor.RichText, {
137
167
  className: excerptClassName,
138
168
  "aria-label": (0, _i18n.__)('Post excerpt text'),
139
- value: isSelected ? rawOrRenderedExcerpt : (trimmedExcerpt !== '...' ? trimmedExcerpt : '') || (0, _i18n.__)('No post excerpt found'),
169
+ value: isSelected ? rawOrRenderedExcerpt : (!isTrimmed ? rawOrRenderedExcerpt : trimmedExcerpt + ELLIPSIS) || (0, _i18n.__)('No post excerpt found'),
140
170
  onChange: setExcerpt,
141
171
  tagName: "p"
142
172
  }) : (0, _element.createElement)("p", {
143
173
  className: excerptClassName
144
- }, trimmedExcerpt !== '...' ? trimmedExcerpt : (0, _i18n.__)('No post excerpt found'));
174
+ }, !isTrimmed ? rawOrRenderedExcerpt || (0, _i18n.__)('No post excerpt found') : trimmedExcerpt + ELLIPSIS);
145
175
  return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_blockEditor.BlockControls, null, (0, _element.createElement)(_blockEditor.AlignmentToolbar, {
146
176
  value: textAlign,
147
177
  onChange: newAlign => setAttributes({
@@ -163,7 +193,6 @@ function PostExcerptEditor(_ref) {
163
193
  setAttributes({
164
194
  excerptLength: value
165
195
  });
166
- setExcerpt();
167
196
  },
168
197
  min: "10",
169
198
  max: "100"
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/post-excerpt/edit.js"],"names":["PostExcerptEditor","attributes","textAlign","moreText","showMoreOnNewLine","excerptLength","setAttributes","isSelected","context","postId","postType","queryId","isDescendentOfQueryLoop","Number","isFinite","userCanEdit","isEditable","rawExcerpt","setExcerpt","rendered","renderedExcerpt","protected","isProtected","blockProps","className","wordCountType","strippedRenderedExcerpt","document","window","DOMParser","parseFromString","body","textContent","innerText","newAlign","readMoreLink","newMoreText","excerptClassName","rawOrRenderedExcerpt","trimmedExcerpt","trim","split","join","excerptWithSpaces","numberOfSpaces","length","replaceAll","excerptContent","newShowMoreOnNewLine","value"],"mappings":";;;;;;;;;AASA;;AANA;;AAKA;;AAEA;;AAQA;;AACA;;AAKA;;AAxBA;AACA;AACA;;AAGA;AACA;AACA;;AAcA;AACA;AACA;AAGe,SAASA,iBAAT,OAKX;AAAA,MALuC;AAC1CC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,SAAF;AAAaC,MAAAA,QAAb;AAAuBC,MAAAA,iBAAvB;AAA0CC,MAAAA;AAA1C,KAD8B;AAE1CC,IAAAA,aAF0C;AAG1CC,IAAAA,UAH0C;AAI1CC,IAAAA,OAAO,EAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA,QAAV;AAAoBC,MAAAA;AAApB;AAJiC,GAKvC;AACH,QAAMC,uBAAuB,GAAGC,MAAM,CAACC,QAAP,CAAiBH,OAAjB,CAAhC;AACA,QAAMI,WAAW,GAAG,6BAAkB,UAAlB,EAA8BL,QAA9B,EAAwCD,MAAxC,CAApB;AACA,QAAMO,UAAU,GAAGD,WAAW,IAAI,CAAEH,uBAApC;AAEA,QAAM,CACLK,UADK,EAELC,UAFK,EAGL;AAAEC,IAAAA,QAAQ,EAAEC,eAA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AAAA,aAAa,CAAE;AAAED,QAAAA,aAAa,EAAE4C;AAAjB,OAAF,CAAb;AACA/B,MAAAA,UAAU;AACV,KANF;AAOC,IAAA,GAAG,EAAC,IAPL;AAQC,IAAA,GAAG,EAAC;AARL,IAXD,CADD,CATD,EAiCC,mCAAUK,UAAV,EACGwB,cADH,EAEG,CAAE3C,iBAAF,IAAuB,GAF1B,EAGGA,iBAAiB,GAClB;AAAG,IAAA,SAAS,EAAC;AAAb,KACG+B,YADH,CADkB,GAKlBA,YARF,CAjCD,CADD;AA+CA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport {\n\tAlignmentToolbar,\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\tWarning,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { PanelBody, ToggleControl, RangeControl } from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useCanEditEntity } from '../utils/hooks';\n\nexport default function PostExcerptEditor( {\n\tattributes: { textAlign, moreText, showMoreOnNewLine, excerptLength },\n\tsetAttributes,\n\tisSelected,\n\tcontext: { postId, postType, queryId },\n} ) {\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst userCanEdit = useCanEditEntity( 'postType', postType, postId );\n\tconst isEditable = userCanEdit && ! isDescendentOfQueryLoop;\n\n\tconst [\n\t\trawExcerpt,\n\t\tsetExcerpt,\n\t\t{ rendered: renderedExcerpt, protected: isProtected } = {},\n\t] = useEntityProp( 'postType', postType, 'excerpt', postId );\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\t/**\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\n\t/**\n\t * When excerpt is editable, strip the html tags from\n\t * rendered excerpt. This will be used if the entity's\n\t * excerpt has been produced from the content.\n\t */\n\tconst strippedRenderedExcerpt = useMemo( () => {\n\t\tif ( ! renderedExcerpt ) return '';\n\t\tconst document = new window.DOMParser().parseFromString(\n\t\t\trenderedExcerpt,\n\t\t\t'text/html'\n\t\t);\n\t\treturn document.body.textContent || document.body.innerText || '';\n\t}, [ renderedExcerpt ] );\n\tif ( ! postType || ! postId ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockControls>\n\t\t\t\t\t<AlignmentToolbar\n\t\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\t\tonChange={ ( newAlign ) =>\n\t\t\t\t\t\t\tsetAttributes( { textAlign: newAlign } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'This is the Post Excerpt block, it will display the excerpt from single posts.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'If there are any Custom Post Types with support for excerpts, the Post Excerpt block can display the excerpts of those entries as well.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t}\n\tif ( isProtected && ! userCanEdit ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'There is no excerpt because this is a protected post.'\n\t\t\t\t\t) }\n\t\t\t\t</Warning>\n\t\t\t</div>\n\t\t);\n\t}\n\tconst readMoreLink = (\n\t\t<RichText\n\t\t\tclassName=\"wp-block-post-excerpt__more-link\"\n\t\t\ttagName=\"a\"\n\t\t\taria-label={ __( '“Read more” link text' ) }\n\t\t\tplaceholder={ __( 'Add \"read more\" link text' ) }\n\t\t\tvalue={ moreText }\n\t\t\tonChange={ ( newMoreText ) =>\n\t\t\t\tsetAttributes( { moreText: newMoreText } )\n\t\t\t}\n\t\t\twithoutInteractiveFormatting={ true }\n\t\t/>\n\t);\n\tconst excerptClassName = classnames( 'wp-block-post-excerpt__excerpt', {\n\t\t'is-inline': ! showMoreOnNewLine,\n\t} );\n\n\t/**\n\t * The excerpt length setting needs to be applied to both\n\t * the raw and the rendered excerpt depending on which is being used.\n\t */\n\tconst rawOrRenderedExcerpt = !! renderedExcerpt\n\t\t? strippedRenderedExcerpt\n\t\t: rawExcerpt;\n\n\tlet trimmedExcerpt = '';\n\tif ( wordCountType === 'words' ) {\n\t\ttrimmedExcerpt = rawOrRenderedExcerpt\n\t\t\t.trim()\n\t\t\t.split( ' ', excerptLength )\n\t\t\t.join( ' ' );\n\t} else if ( wordCountType === 'characters_excluding_spaces' ) {\n\t\t/*\n\t\t * 1. Split the excerpt at the character limit,\n\t\t * then join the substrings back into one string.\n\t\t * 2. Count the number of spaces in the excerpt\n\t\t * by comparing the lengths of the string with and without spaces.\n\t\t * 3. Add the number to the length of the visible excerpt,\n\t\t * so that the spaces are excluded from the word count.\n\t\t */\n\t\tconst excerptWithSpaces = rawOrRenderedExcerpt\n\t\t\t.trim()\n\t\t\t.split( '', excerptLength )\n\t\t\t.join( '' );\n\n\t\tconst numberOfSpaces =\n\t\t\texcerptWithSpaces.length -\n\t\t\texcerptWithSpaces.replaceAll( ' ', '' ).length;\n\n\t\ttrimmedExcerpt = rawOrRenderedExcerpt\n\t\t\t.trim()\n\t\t\t.split( '', excerptLength + numberOfSpaces )\n\t\t\t.join( '' );\n\t} else if ( wordCountType === 'characters_including_spaces' ) {\n\t\ttrimmedExcerpt = rawOrRenderedExcerpt.trim().split( '', excerptLength );\n\t}\n\n\ttrimmedExcerpt = trimmedExcerpt + '...';\n\n\tconst excerptContent = isEditable ? (\n\t\t<RichText\n\t\t\tclassName={ excerptClassName }\n\t\t\taria-label={ __( 'Post excerpt text' ) }\n\t\t\tvalue={\n\t\t\t\tisSelected\n\t\t\t\t\t? rawOrRenderedExcerpt\n\t\t\t\t\t: ( trimmedExcerpt !== '...' ? trimmedExcerpt : '' ) ||\n\t\t\t\t\t __( 'No post excerpt found' )\n\t\t\t}\n\t\t\tonChange={ setExcerpt }\n\t\t\ttagName=\"p\"\n\t\t/>\n\t) : (\n\t\t<p className={ excerptClassName }>\n\t\t\t{ trimmedExcerpt !== '...'\n\t\t\t\t? trimmedExcerpt\n\t\t\t\t: __( 'No post excerpt found' ) }\n\t\t</p>\n\t);\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<AlignmentToolbar\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( newAlign ) =>\n\t\t\t\t\t\tsetAttributes( { textAlign: newAlign } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Show link on new line' ) }\n\t\t\t\t\t\tchecked={ showMoreOnNewLine }\n\t\t\t\t\t\tonChange={ ( newShowMoreOnNewLine ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowMoreOnNewLine: newShowMoreOnNewLine,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\tlabel={ __( 'Max number of words' ) }\n\t\t\t\t\t\tvalue={ excerptLength }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tsetAttributes( { excerptLength: value } );\n\t\t\t\t\t\t\tsetExcerpt();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tmin=\"10\"\n\t\t\t\t\t\tmax=\"100\"\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ excerptContent }\n\t\t\t\t{ ! showMoreOnNewLine && ' ' }\n\t\t\t\t{ showMoreOnNewLine ? (\n\t\t\t\t\t<p className=\"wp-block-post-excerpt__more-text\">\n\t\t\t\t\t\t{ readMoreLink }\n\t\t\t\t\t</p>\n\t\t\t\t) : (\n\t\t\t\t\treadMoreLink\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/post-excerpt/edit.js"],"names":["ELLIPSIS","PostExcerptEditor","attributes","textAlign","moreText","showMoreOnNewLine","excerptLength","setAttributes","isSelected","context","postId","postType","queryId","isDescendentOfQueryLoop","Number","isFinite","userCanEdit","rawExcerpt","setExcerpt","rendered","renderedExcerpt","protected","isProtected","postTypeSupportsExcerpts","select","coreStore","getPostType","supports","excerpt","isEditable","blockProps","className","wordCountType","strippedRenderedExcerpt","document","window","DOMParser","parseFromString","body","textContent","innerText","newAlign","readMoreLink","newMoreText","excerptClassName","rawOrRenderedExcerpt","trim","trimmedExcerpt","split","join","excerptWithSpaces","numberOfSpaces","length","replaceAll","isTrimmed","excerptContent","newShowMoreOnNewLine","value"],"mappings":";;;;;;;;;AASA;;AANA;;AAKA;;AAEA;;AAQA;;AACA;;AACA;;AAKA;;AAzBA;AACA;AACA;;AAGA;AACA;AACA;;AAeA;AACA;AACA;AAGA,MAAMA,QAAQ,GAAG,GAAjB;;AAEe,SAASC,iBAAT,OAKX;AAAA,MALuC;AAC1CC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,SAAF;AAAaC,MAAAA,QAAb;AAAuBC,MAAAA,iBAAvB;AAA0CC,MAAAA;AAA1C,KAD8B;AAE1CC,IAAAA,aAF0C;AAG1CC,IAAAA,UAH0C;AAI1CC,IAAAA,OAAO,EAAE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,IAAI,cAAI,uBAAJ,CADzB,GAECE,cAAc,GAAG/C,QAHrB,CAhBD;AAsBA,SACC,qDACC,4BAAC,0BAAD,QACC,4BAAC,6BAAD;AACC,IAAA,KAAK,EAAGG,SADT;AAEC,IAAA,QAAQ,EAAKsC,QAAF,IACVlC,aAAa,CAAE;AAAEJ,MAAAA,SAAS,EAAEsC;AAAb,KAAF;AAHf,IADD,CADD,EASC,4BAAC,8BAAD,QACC,4BAAC,qBAAD;AAAW,IAAA,KAAK,EAAG,cAAI,UAAJ;AAAnB,KACC,4BAAC,yBAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAG,cAAI,uBAAJ,CAFT;AAGC,IAAA,OAAO,EAAGpC,iBAHX;AAIC,IAAA,QAAQ,EAAKmD,oBAAF,IACVjD,aAAa,CAAE;AACdF,MAAAA,iBAAiB,EAAEmD;AADL,KAAF;AALf,IADD,EAWC,4BAAC,wBAAD;AACC,IAAA,KAAK,EAAG,cAAI,qBAAJ,CADT;AAEC,IAAA,KAAK,EAAGlD,aAFT;AAGC,IAAA,QAAQ,EAAKmD,KAAF,IAAa;AACvBlD,MAAAA,aAAa,CAAE;AAAED,QAAAA,aAAa,EAAEmD;AAAjB,OAAF,CAAb;AACA,KALF;AAMC,IAAA,GAAG,EAAC,IANL;AAOC,IAAA,GAAG,EAAC;AAPL,IAXD,CADD,CATD,EAgCC,mCAAU3B,UAAV,EACGyB,cADH,EAEG,CAAElD,iBAAF,IAAuB,GAF1B,EAGGA,iBAAiB,GAClB;AAAG,IAAA,SAAS,EAAC;AAAb,KACGqC,YADH,CADkB,GAKlBA,YARF,CAhCD,CADD;AA8CA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport {\n\tAlignmentToolbar,\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\tWarning,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { PanelBody, ToggleControl, RangeControl } from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useCanEditEntity } from '../utils/hooks';\n\nconst ELLIPSIS = '…';\n\nexport default function PostExcerptEditor( {\n\tattributes: { textAlign, moreText, showMoreOnNewLine, excerptLength },\n\tsetAttributes,\n\tisSelected,\n\tcontext: { postId, postType, queryId },\n} ) {\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst userCanEdit = useCanEditEntity( 'postType', postType, postId );\n\tconst [\n\t\trawExcerpt,\n\t\tsetExcerpt,\n\t\t{ rendered: renderedExcerpt, protected: isProtected } = {},\n\t] = useEntityProp( 'postType', postType, 'excerpt', postId );\n\n\t/**\n\t * Check if the post type supports excerpts.\n\t * Add an exception and return early for the \"page\" post type,\n\t * which is registered without support for the excerpt UI,\n\t * but supports saving the excerpt to the database.\n\t * See: https://core.trac.wordpress.org/browser/branches/6.1/src/wp-includes/post.php#L65\n\t * Without this exception, users that have excerpts saved to the database will\n\t * not be able to edit the excerpts.\n\t */\n\tconst postTypeSupportsExcerpts = useSelect(\n\t\t( select ) => {\n\t\t\tif ( postType === 'page' ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn !! select( coreStore ).getPostType( postType )?.supports\n\t\t\t\t.excerpt;\n\t\t},\n\t\t[ postType ]\n\t);\n\n\t/**\n\t * The excerpt is editable if:\n\t * - The user can edit the post\n\t * - It is not a descendent of a Query Loop block\n\t * - The post type supports excerpts\n\t */\n\tconst isEditable =\n\t\tuserCanEdit && ! isDescendentOfQueryLoop && postTypeSupportsExcerpts;\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\t/**\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\n\t/**\n\t * When excerpt is editable, strip the html tags from\n\t * rendered excerpt. This will be used if the entity's\n\t * excerpt has been produced from the content.\n\t */\n\tconst strippedRenderedExcerpt = useMemo( () => {\n\t\tif ( ! renderedExcerpt ) return '';\n\t\tconst document = new window.DOMParser().parseFromString(\n\t\t\trenderedExcerpt,\n\t\t\t'text/html'\n\t\t);\n\t\treturn document.body.textContent || document.body.innerText || '';\n\t}, [ renderedExcerpt ] );\n\n\tif ( ! postType || ! postId ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockControls>\n\t\t\t\t\t<AlignmentToolbar\n\t\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\t\tonChange={ ( newAlign ) =>\n\t\t\t\t\t\t\tsetAttributes( { textAlign: newAlign } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'This is the Post Excerpt block, it will display the excerpt from single posts.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'If there are any Custom Post Types with support for excerpts, the Post Excerpt block can display the excerpts of those entries as well.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t}\n\tif ( isProtected && ! userCanEdit ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'There is no excerpt because this is a protected post.'\n\t\t\t\t\t) }\n\t\t\t\t</Warning>\n\t\t\t</div>\n\t\t);\n\t}\n\tconst readMoreLink = (\n\t\t<RichText\n\t\t\tclassName=\"wp-block-post-excerpt__more-link\"\n\t\t\ttagName=\"a\"\n\t\t\taria-label={ __( '“Read more” link text' ) }\n\t\t\tplaceholder={ __( 'Add \"read more\" link text' ) }\n\t\t\tvalue={ moreText }\n\t\t\tonChange={ ( newMoreText ) =>\n\t\t\t\tsetAttributes( { moreText: newMoreText } )\n\t\t\t}\n\t\t\twithoutInteractiveFormatting={ true }\n\t\t/>\n\t);\n\tconst excerptClassName = classnames( 'wp-block-post-excerpt__excerpt', {\n\t\t'is-inline': ! showMoreOnNewLine,\n\t} );\n\n\t/**\n\t * The excerpt length setting needs to be applied to both\n\t * the raw and the rendered excerpt depending on which is being used.\n\t */\n\tconst rawOrRenderedExcerpt = (\n\t\trawExcerpt || strippedRenderedExcerpt\n\t).trim();\n\n\tlet trimmedExcerpt = '';\n\tif ( wordCountType === 'words' ) {\n\t\ttrimmedExcerpt = rawOrRenderedExcerpt\n\t\t\t.split( ' ', excerptLength )\n\t\t\t.join( ' ' );\n\t} else if ( wordCountType === 'characters_excluding_spaces' ) {\n\t\t/*\n\t\t * 1. Split the excerpt at the character limit,\n\t\t * then join the substrings back into one string.\n\t\t * 2. Count the number of spaces in the excerpt\n\t\t * by comparing the lengths of the string with and without spaces.\n\t\t * 3. Add the number to the length of the visible excerpt,\n\t\t * so that the spaces are excluded from the word count.\n\t\t */\n\t\tconst excerptWithSpaces = rawOrRenderedExcerpt\n\t\t\t.split( '', excerptLength )\n\t\t\t.join( '' );\n\n\t\tconst numberOfSpaces =\n\t\t\texcerptWithSpaces.length -\n\t\t\texcerptWithSpaces.replaceAll( ' ', '' ).length;\n\n\t\ttrimmedExcerpt = rawOrRenderedExcerpt\n\t\t\t.split( '', excerptLength + numberOfSpaces )\n\t\t\t.join( '' );\n\t} else if ( wordCountType === 'characters_including_spaces' ) {\n\t\ttrimmedExcerpt = rawOrRenderedExcerpt\n\t\t\t.split( '', excerptLength )\n\t\t\t.join( '' );\n\t}\n\n\tconst isTrimmed = trimmedExcerpt !== rawOrRenderedExcerpt;\n\n\tconst excerptContent = isEditable ? (\n\t\t<RichText\n\t\t\tclassName={ excerptClassName }\n\t\t\taria-label={ __( 'Post excerpt text' ) }\n\t\t\tvalue={\n\t\t\t\tisSelected\n\t\t\t\t\t? rawOrRenderedExcerpt\n\t\t\t\t\t: ( ! isTrimmed\n\t\t\t\t\t\t\t? rawOrRenderedExcerpt\n\t\t\t\t\t\t\t: trimmedExcerpt + ELLIPSIS ) ||\n\t\t\t\t\t __( 'No post excerpt found' )\n\t\t\t}\n\t\t\tonChange={ setExcerpt }\n\t\t\ttagName=\"p\"\n\t\t/>\n\t) : (\n\t\t<p className={ excerptClassName }>\n\t\t\t{ ! isTrimmed\n\t\t\t\t? rawOrRenderedExcerpt || __( 'No post excerpt found' )\n\t\t\t\t: trimmedExcerpt + ELLIPSIS }\n\t\t</p>\n\t);\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<AlignmentToolbar\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( newAlign ) =>\n\t\t\t\t\t\tsetAttributes( { textAlign: newAlign } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Show link on new line' ) }\n\t\t\t\t\t\tchecked={ showMoreOnNewLine }\n\t\t\t\t\t\tonChange={ ( newShowMoreOnNewLine ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowMoreOnNewLine: newShowMoreOnNewLine,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\tlabel={ __( 'Max number of words' ) }\n\t\t\t\t\t\tvalue={ excerptLength }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tsetAttributes( { excerptLength: value } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tmin=\"10\"\n\t\t\t\t\t\tmax=\"100\"\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ excerptContent }\n\t\t\t\t{ ! showMoreOnNewLine && ' ' }\n\t\t\t\t{ showMoreOnNewLine ? (\n\t\t\t\t\t<p className=\"wp-block-post-excerpt__more-text\">\n\t\t\t\t\t\t{ readMoreLink }\n\t\t\t\t\t</p>\n\t\t\t\t) : (\n\t\t\t\t\treadMoreLink\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"]}
@@ -173,7 +173,7 @@ const DimensionControls = _ref => {
173
173
  isBlock: true
174
174
  }, SCALE_OPTIONS)), !!imageSizeOptions.length && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
175
175
  hasValue: () => !!sizeSlug,
176
- label: (0, _i18n.__)('Image size'),
176
+ label: (0, _i18n.__)('Resolution'),
177
177
  onDeselect: () => setAttributes({
178
178
  sizeSlug: undefined
179
179
  }),
@@ -184,7 +184,7 @@ const DimensionControls = _ref => {
184
184
  panelId: clientId
185
185
  }, (0, _element.createElement)(_components.SelectControl, {
186
186
  __nextHasNoMarginBottom: true,
187
- label: (0, _i18n.__)('Image size'),
187
+ label: (0, _i18n.__)('Resolution'),
188
188
  value: sizeSlug || DEFAULT_SIZE,
189
189
  options: imageSizeOptions,
190
190
  onChange: nextSizeSlug => setAttributes({
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/post-featured-image/dimension-controls.js"],"names":["SCALE_OPTIONS","DEFAULT_SCALE","DEFAULT_SIZE","scaleHelp","cover","contain","fill","DimensionControls","clientId","attributes","aspectRatio","width","height","scale","sizeSlug","setAttributes","imageSizeOptions","defaultUnits","units","availableUnits","onDimensionChange","dimension","nextValue","parsedValue","parseFloat","isNaN","scaleLabel","undefined","label","value","nextAspectRatio","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,CApGF,EAkIG,CAAC,CAAEgB,gBAAgB,CAACiB,MAApB,IACD,4BAAC,wCAAD;AACC,IAAA,QAAQ,EAAG,MAAM,CAAC,CAAEnB,QADrB;AAEC,IAAA,KAAK,EAAG,cAAI,YAAJ,CAFT;AAGC,IAAA,UAAU,EAAG,MACZC,aAAa,CAAE;AAAED,MAAAA,QAAQ,EAAEa;AAAZ,KAAF,CAJf;AAMC,IAAA,cAAc,EAAG,OAAQ;AACxBb,MAAAA,QAAQ,EAAEa;AADc,KAAR,CANlB;AASC,IAAA,gBAAgB,EAAG,KATpB;AAUC,IAAA,OAAO,EAAGnB;AAVX,KAYC,4BAAC,yBAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAG,cAAI,YAAJ,CAFT;AAGC,IAAA,KAAK,EAAGM,QAAQ,IAAIZ,YAHrB;AAIC,IAAA,OAAO,EAAGc,gBAJX;AAKC,IAAA,QAAQ,EAAKkB,YAAF,IACVnB,aAAa,CAAE;AAAED,MAAAA,QAAQ,EAAEoB;AAAZ,KAAF,CANf;AAQC,IAAA,IAAI,EAAG,cAAI,sCAAJ;AARR,IAZD,CAnIF,CADD;AA8JA,CArLD;;eAuLe3B,iB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tSelectControl,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { InspectorControls, useSetting } from '@wordpress/block-editor';\n\nconst SCALE_OPTIONS = (\n\t<>\n\t\t<ToggleGroupControlOption\n\t\t\tvalue=\"cover\"\n\t\t\tlabel={ _x( 'Cover', 'Scale option for Image dimension control' ) }\n\t\t/>\n\t\t<ToggleGroupControlOption\n\t\t\tvalue=\"contain\"\n\t\t\tlabel={ _x(\n\t\t\t\t'Contain',\n\t\t\t\t'Scale option for Image dimension control'\n\t\t\t) }\n\t\t/>\n\t\t<ToggleGroupControlOption\n\t\t\tvalue=\"fill\"\n\t\t\tlabel={ _x( 'Fill', 'Scale option for Image dimension control' ) }\n\t\t/>\n\t</>\n);\n\nconst DEFAULT_SCALE = 'cover';\nconst DEFAULT_SIZE = 'full';\n\nconst scaleHelp = {\n\tcover: __(\n\t\t'Image is scaled and cropped to fill the entire space without being distorted.'\n\t),\n\tcontain: __(\n\t\t'Image is scaled to fill the space without clipping nor distorting.'\n\t),\n\tfill: __(\n\t\t'Image will be stretched and distorted to completely fill the space.'\n\t),\n};\n\nconst DimensionControls = ( {\n\tclientId,\n\tattributes: { aspectRatio, width, height, scale, sizeSlug },\n\tsetAttributes,\n\timageSizeOptions = [],\n} ) => {\n\tconst defaultUnits = [ 'px', '%', 'vw', 'em', 'rem' ];\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units' ) || defaultUnits,\n\t} );\n\tconst onDimensionChange = ( dimension, nextValue ) => {\n\t\tconst parsedValue = parseFloat( nextValue );\n\t\t/**\n\t\t * If we have no value set and we change the unit,\n\t\t * we don't want to set the attribute, as it would\n\t\t * end up having the unit as value without any number.\n\t\t */\n\t\tif ( isNaN( parsedValue ) && nextValue ) return;\n\t\tsetAttributes( {\n\t\t\t[ dimension ]: parsedValue < 0 ? '0' : nextValue,\n\t\t} );\n\t};\n\tconst scaleLabel = _x( 'Scale', 'Image scaling options' );\n\treturn (\n\t\t<InspectorControls group=\"dimensions\">\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => !! aspectRatio }\n\t\t\t\tlabel={ __( 'Aspect ratio' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { aspectRatio: undefined } ) }\n\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\taspectRatio: undefined,\n\t\t\t\t} ) }\n\t\t\t\tisShownByDefault={ true }\n\t\t\t\tpanelId={ clientId }\n\t\t\t>\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Aspect ratio' ) }\n\t\t\t\t\tvalue={ aspectRatio }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t// These should use the same values as AspectRatioDropdown in @wordpress/block-editor\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Original' ),\n\t\t\t\t\t\t\tvalue: 'auto',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Square' ),\n\t\t\t\t\t\t\tvalue: '1',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '16:9' ),\n\t\t\t\t\t\t\tvalue: '16/9',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '4:3' ),\n\t\t\t\t\t\t\tvalue: '4/3',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '3:2' ),\n\t\t\t\t\t\t\tvalue: '3/2',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '9:16' ),\n\t\t\t\t\t\t\tvalue: '9/16',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '3:4' ),\n\t\t\t\t\t\t\tvalue: '3/4',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '2:3' ),\n\t\t\t\t\t\t\tvalue: '2/3',\n\t\t\t\t\t\t},\n\t\t\t\t\t] }\n\t\t\t\t\tonChange={ ( nextAspectRatio ) =>\n\t\t\t\t\t\tsetAttributes( { aspectRatio: nextAspectRatio } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t\t<ToolsPanelItem\n\t\t\t\tclassName=\"single-column\"\n\t\t\t\thasValue={ () => !! height }\n\t\t\t\tlabel={ __( 'Height' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { height: undefined } ) }\n\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\theight: undefined,\n\t\t\t\t} ) }\n\t\t\t\tisShownByDefault={ true }\n\t\t\t\tpanelId={ clientId }\n\t\t\t>\n\t\t\t\t<UnitControl\n\t\t\t\t\tlabel={ __( 'Height' ) }\n\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\tvalue={ height || '' }\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tonChange={ ( nextHeight ) =>\n\t\t\t\t\t\tonDimensionChange( 'height', nextHeight )\n\t\t\t\t\t}\n\t\t\t\t\tunits={ units }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t\t<ToolsPanelItem\n\t\t\t\tclassName=\"single-column\"\n\t\t\t\thasValue={ () => !! width }\n\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { width: undefined } ) }\n\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\twidth: undefined,\n\t\t\t\t} ) }\n\t\t\t\tisShownByDefault={ true }\n\t\t\t\tpanelId={ clientId }\n\t\t\t>\n\t\t\t\t<UnitControl\n\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\tvalue={ width || '' }\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tonChange={ ( nextWidth ) =>\n\t\t\t\t\t\tonDimensionChange( 'width', nextWidth )\n\t\t\t\t\t}\n\t\t\t\t\tunits={ units }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t\t{ ( height || aspectRatio ) && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! scale && scale !== DEFAULT_SCALE }\n\t\t\t\t\tlabel={ scaleLabel }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tscale: DEFAULT_SCALE,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\tscale: DEFAULT_SCALE,\n\t\t\t\t\t} ) }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ scaleLabel }\n\t\t\t\t\t\tvalue={ scale }\n\t\t\t\t\t\thelp={ scaleHelp[ scale ] }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tscale: value,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisBlock\n\t\t\t\t\t>\n\t\t\t\t\t\t{ SCALE_OPTIONS }\n\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ !! imageSizeOptions.length && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! sizeSlug }\n\t\t\t\t\tlabel={ __( 'Image size' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { sizeSlug: undefined } )\n\t\t\t\t\t}\n\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\tsizeSlug: undefined,\n\t\t\t\t\t} ) }\n\t\t\t\t\tisShownByDefault={ false }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Image size' ) }\n\t\t\t\t\t\tvalue={ sizeSlug || DEFAULT_SIZE }\n\t\t\t\t\t\toptions={ imageSizeOptions }\n\t\t\t\t\t\tonChange={ ( nextSizeSlug ) =>\n\t\t\t\t\t\t\tsetAttributes( { sizeSlug: nextSizeSlug } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\thelp={ __( 'Select the size of the source image.' ) }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</InspectorControls>\n\t);\n};\n\nexport default DimensionControls;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/post-featured-image/dimension-controls.js"],"names":["SCALE_OPTIONS","DEFAULT_SCALE","DEFAULT_SIZE","scaleHelp","cover","contain","fill","DimensionControls","clientId","attributes","aspectRatio","width","height","scale","sizeSlug","setAttributes","imageSizeOptions","defaultUnits","units","availableUnits","onDimensionChange","dimension","nextValue","parsedValue","parseFloat","isNaN","scaleLabel","undefined","label","value","nextAspectRatio","nextHeight","nextWidth","length","nextSizeSlug"],"mappings":";;;;;;;;;AAGA;;AACA;;AAQA;;AAZA;AACA;AACA;AAYA,MAAMA,aAAa,GAClB,qDACC,4BAAC,kDAAD;AACC,EAAA,KAAK,EAAC,OADP;AAEC,EAAA,KAAK,EAAG,cAAI,OAAJ,EAAa,0CAAb;AAFT,EADD,EAKC,4BAAC,kDAAD;AACC,EAAA,KAAK,EAAC,SADP;AAEC,EAAA,KAAK,EAAG,cACP,SADO,EAEP,0CAFO;AAFT,EALD,EAYC,4BAAC,kDAAD;AACC,EAAA,KAAK,EAAC,MADP;AAEC,EAAA,KAAK,EAAG,cAAI,MAAJ,EAAY,0CAAZ;AAFT,EAZD,CADD;AAoBA,MAAMC,aAAa,GAAG,OAAtB;AACA,MAAMC,YAAY,GAAG,MAArB;AAEA,MAAMC,SAAS,GAAG;AACjBC,EAAAA,KAAK,EAAE,cACN,+EADM,CADU;AAIjBC,EAAAA,OAAO,EAAE,cACR,oEADQ,CAJQ;AAOjBC,EAAAA,IAAI,EAAE,cACL,qEADK;AAPW,CAAlB;;AAYA,MAAMC,iBAAiB,GAAG,QAKnB;AAAA,MALqB;AAC3BC,IAAAA,QAD2B;AAE3BC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,WAAF;AAAeC,MAAAA,KA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n';\nimport {\n\tSelectControl,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { InspectorControls, useSetting } from '@wordpress/block-editor';\n\nconst SCALE_OPTIONS = (\n\t<>\n\t\t<ToggleGroupControlOption\n\t\t\tvalue=\"cover\"\n\t\t\tlabel={ _x( 'Cover', 'Scale option for Image dimension control' ) }\n\t\t/>\n\t\t<ToggleGroupControlOption\n\t\t\tvalue=\"contain\"\n\t\t\tlabel={ _x(\n\t\t\t\t'Contain',\n\t\t\t\t'Scale option for Image dimension control'\n\t\t\t) }\n\t\t/>\n\t\t<ToggleGroupControlOption\n\t\t\tvalue=\"fill\"\n\t\t\tlabel={ _x( 'Fill', 'Scale option for Image dimension control' ) }\n\t\t/>\n\t</>\n);\n\nconst DEFAULT_SCALE = 'cover';\nconst DEFAULT_SIZE = 'full';\n\nconst scaleHelp = {\n\tcover: __(\n\t\t'Image is scaled and cropped to fill the entire space without being distorted.'\n\t),\n\tcontain: __(\n\t\t'Image is scaled to fill the space without clipping nor distorting.'\n\t),\n\tfill: __(\n\t\t'Image will be stretched and distorted to completely fill the space.'\n\t),\n};\n\nconst DimensionControls = ( {\n\tclientId,\n\tattributes: { aspectRatio, width, height, scale, sizeSlug },\n\tsetAttributes,\n\timageSizeOptions = [],\n} ) => {\n\tconst defaultUnits = [ 'px', '%', 'vw', 'em', 'rem' ];\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units' ) || defaultUnits,\n\t} );\n\tconst onDimensionChange = ( dimension, nextValue ) => {\n\t\tconst parsedValue = parseFloat( nextValue );\n\t\t/**\n\t\t * If we have no value set and we change the unit,\n\t\t * we don't want to set the attribute, as it would\n\t\t * end up having the unit as value without any number.\n\t\t */\n\t\tif ( isNaN( parsedValue ) && nextValue ) return;\n\t\tsetAttributes( {\n\t\t\t[ dimension ]: parsedValue < 0 ? '0' : nextValue,\n\t\t} );\n\t};\n\tconst scaleLabel = _x( 'Scale', 'Image scaling options' );\n\treturn (\n\t\t<InspectorControls group=\"dimensions\">\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => !! aspectRatio }\n\t\t\t\tlabel={ __( 'Aspect ratio' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { aspectRatio: undefined } ) }\n\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\taspectRatio: undefined,\n\t\t\t\t} ) }\n\t\t\t\tisShownByDefault={ true }\n\t\t\t\tpanelId={ clientId }\n\t\t\t>\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Aspect ratio' ) }\n\t\t\t\t\tvalue={ aspectRatio }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t// These should use the same values as AspectRatioDropdown in @wordpress/block-editor\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Original' ),\n\t\t\t\t\t\t\tvalue: 'auto',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Square' ),\n\t\t\t\t\t\t\tvalue: '1',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '16:9' ),\n\t\t\t\t\t\t\tvalue: '16/9',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '4:3' ),\n\t\t\t\t\t\t\tvalue: '4/3',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '3:2' ),\n\t\t\t\t\t\t\tvalue: '3/2',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '9:16' ),\n\t\t\t\t\t\t\tvalue: '9/16',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '3:4' ),\n\t\t\t\t\t\t\tvalue: '3/4',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '2:3' ),\n\t\t\t\t\t\t\tvalue: '2/3',\n\t\t\t\t\t\t},\n\t\t\t\t\t] }\n\t\t\t\t\tonChange={ ( nextAspectRatio ) =>\n\t\t\t\t\t\tsetAttributes( { aspectRatio: nextAspectRatio } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t\t<ToolsPanelItem\n\t\t\t\tclassName=\"single-column\"\n\t\t\t\thasValue={ () => !! height }\n\t\t\t\tlabel={ __( 'Height' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { height: undefined } ) }\n\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\theight: undefined,\n\t\t\t\t} ) }\n\t\t\t\tisShownByDefault={ true }\n\t\t\t\tpanelId={ clientId }\n\t\t\t>\n\t\t\t\t<UnitControl\n\t\t\t\t\tlabel={ __( 'Height' ) }\n\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\tvalue={ height || '' }\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tonChange={ ( nextHeight ) =>\n\t\t\t\t\t\tonDimensionChange( 'height', nextHeight )\n\t\t\t\t\t}\n\t\t\t\t\tunits={ units }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t\t<ToolsPanelItem\n\t\t\t\tclassName=\"single-column\"\n\t\t\t\thasValue={ () => !! width }\n\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { width: undefined } ) }\n\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\twidth: undefined,\n\t\t\t\t} ) }\n\t\t\t\tisShownByDefault={ true }\n\t\t\t\tpanelId={ clientId }\n\t\t\t>\n\t\t\t\t<UnitControl\n\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\tvalue={ width || '' }\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tonChange={ ( nextWidth ) =>\n\t\t\t\t\t\tonDimensionChange( 'width', nextWidth )\n\t\t\t\t\t}\n\t\t\t\t\tunits={ units }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t\t{ ( height || aspectRatio ) && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! scale && scale !== DEFAULT_SCALE }\n\t\t\t\t\tlabel={ scaleLabel }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tscale: DEFAULT_SCALE,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\tscale: DEFAULT_SCALE,\n\t\t\t\t\t} ) }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ scaleLabel }\n\t\t\t\t\t\tvalue={ scale }\n\t\t\t\t\t\thelp={ scaleHelp[ scale ] }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tscale: value,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisBlock\n\t\t\t\t\t>\n\t\t\t\t\t\t{ SCALE_OPTIONS }\n\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ !! imageSizeOptions.length && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! sizeSlug }\n\t\t\t\t\tlabel={ __( 'Resolution' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { sizeSlug: undefined } )\n\t\t\t\t\t}\n\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\tsizeSlug: undefined,\n\t\t\t\t\t} ) }\n\t\t\t\t\tisShownByDefault={ false }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Resolution' ) }\n\t\t\t\t\t\tvalue={ sizeSlug || DEFAULT_SIZE }\n\t\t\t\t\t\toptions={ imageSizeOptions }\n\t\t\t\t\t\tonChange={ ( nextSizeSlug ) =>\n\t\t\t\t\t\t\tsetAttributes( { sizeSlug: nextSizeSlug } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\thelp={ __( 'Select the size of the source image.' ) }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</InspectorControls>\n\t);\n};\n\nexport default DimensionControls;\n"]}
@@ -35,7 +35,7 @@ const metadata = {
35
35
  supports: {
36
36
  reusable: false,
37
37
  html: false,
38
- align: true,
38
+ align: ["wide", "full"],
39
39
  anchor: true,
40
40
  __experimentalLayout: {
41
41
  allowEditing: false
@@ -33,7 +33,23 @@ const metadata = {
33
33
  },
34
34
  supports: {
35
35
  html: false,
36
- multiple: false
36
+ spacing: {
37
+ margin: true,
38
+ padding: true
39
+ },
40
+ typography: {
41
+ fontSize: true,
42
+ lineHeight: true,
43
+ __experimentalFontFamily: true,
44
+ __experimentalFontWeight: true,
45
+ __experimentalFontStyle: true,
46
+ __experimentalTextTransform: true,
47
+ __experimentalTextDecoration: true,
48
+ __experimentalLetterSpacing: true,
49
+ __experimentalDefaultControls: {
50
+ fontSize: true
51
+ }
52
+ }
37
53
  }
38
54
  };
39
55
  exports.metadata = metadata;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/post-time-to-read/index.js"],"names":["name","metadata","settings","icon","edit","init"],"mappings":";;;;;;;;;AAGA;;AAEA;;AACA;;AANA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAGO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,aADuB;AAEvBC,EAAAA,IAAI,EAAJA;AAFuB,CAAjB;;;AAKA,MAAMC,IAAI,GAAG,MAAM,wBAAW;AAAEL,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA;AAAlB,CAAX,CAAnB","sourcesContent":["/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport icon from './icon';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/post-time-to-read/index.js"],"names":["name","metadata","settings","icon","edit","init"],"mappings":";;;;;;;;;AAGA;;AAEA;;AACA;;AANA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAGO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,aADuB;AAEvBC,EAAAA,IAAI,EAAJA;AAFuB,CAAjB;;;AAKA,MAAMC,IAAI,GAAG,MAAM,wBAAW;AAAEL,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA;AAAlB,CAAX,CAAnB","sourcesContent":["/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport icon from './icon';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"]}
@@ -59,6 +59,7 @@ const metadata = {
59
59
  },
60
60
  supports: {
61
61
  anchor: true,
62
+ html: false,
62
63
  __experimentalOnEnter: true,
63
64
  typography: {
64
65
  fontSize: true,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/quote/index.js"],"names":["name","metadata","settings","icon","example","attributes","citation","innerBlocks","content","transforms","edit","save","deprecated","init"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AAdA;AACA;AACA;;AAIA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAIO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,YADuB;AAEvBC,EAAAA,OAAO,EAAE;AACRC,IAAAA,UAAU,EAAE;AACXC,MAAAA,QAAQ,EAAE;AADC,KADJ;AAIRC,IAAAA,WAAW,EAAE,CACZ;AACCP,MAAAA,IAAI,EAAE,gBADP;AAECK,MAAAA,UAAU,EAAE;AACXG,QAAAA,OAAO,EAAE,cAAI,uCAAJ;AADE;AAFb,KADY;AAJL,GAFc;AAevBC,EAAAA,UAAU,EAAVA,mBAfuB;AAgBvBC,EAAAA,IAAI,EAAJA,aAhBuB;AAiBvBC,EAAAA,IAAI,EAAJA,aAjBuB;AAkBvBC,EAAAA,UAAU,EAAVA;AAlBuB,CAAjB;;;AAqBA,MAAMC,IAAI,GAAG,MAAM,wBAAW;AAAEb,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA;AAAlB,CAAX,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { quote as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tcitation: 'Julio Cortázar',\n\t\t},\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcontent: __( 'In quoting others, we cite ourselves.' ),\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/quote/index.js"],"names":["name","metadata","settings","icon","example","attributes","citation","innerBlocks","content","transforms","edit","save","deprecated","init"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AAdA;AACA;AACA;;AAIA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAIO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,YADuB;AAEvBC,EAAAA,OAAO,EAAE;AACRC,IAAAA,UAAU,EAAE;AACXC,MAAAA,QAAQ,EAAE;AADC,KADJ;AAIRC,IAAAA,WAAW,EAAE,CACZ;AACCP,MAAAA,IAAI,EAAE,gBADP;AAECK,MAAAA,UAAU,EAAE;AACXG,QAAAA,OAAO,EAAE,cAAI,uCAAJ;AADE;AAFb,KADY;AAJL,GAFc;AAevBC,EAAAA,UAAU,EAAVA,mBAfuB;AAgBvBC,EAAAA,IAAI,EAAJA,aAhBuB;AAiBvBC,EAAAA,IAAI,EAAJA,aAjBuB;AAkBvBC,EAAAA,UAAU,EAAVA;AAlBuB,CAAjB;;;AAqBA,MAAMC,IAAI,GAAG,MAAM,wBAAW;AAAEb,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA;AAAlB,CAAX,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { quote as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tcitation: 'Julio Cortázar',\n\t\t},\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcontent: __( 'In quoting others, we cite ourselves.' ),\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"]}
@@ -93,11 +93,19 @@ const SpacerEdit = _ref2 => {
93
93
  isSelected,
94
94
  setAttributes,
95
95
  toggleSelection,
96
- context
96
+ context,
97
+ __unstableParentLayout: parentLayout
97
98
  } = _ref2;
98
99
  const {
99
100
  orientation
100
101
  } = context;
102
+ const {
103
+ orientation: parentOrientation,
104
+ type
105
+ } = parentLayout || {}; // If the spacer is inside a flex container, it should either inherit the orientation
106
+ // of the parent or use the flex default orientation.
107
+
108
+ const inheritedOrientation = !parentOrientation && type === 'flex' ? 'horizontal' : parentOrientation || orientation;
101
109
  const {
102
110
  height,
103
111
  width
@@ -127,8 +135,10 @@ const SpacerEdit = _ref2 => {
127
135
  };
128
136
 
129
137
  const style = {
130
- height: orientation === 'horizontal' ? 24 : temporaryHeight || height || undefined,
131
- width: orientation === 'horizontal' ? temporaryWidth || width || undefined : undefined
138
+ height: inheritedOrientation === 'horizontal' ? 24 : temporaryHeight || height || undefined,
139
+ width: inheritedOrientation === 'horizontal' ? temporaryWidth || width || undefined : undefined,
140
+ // In vertical flex containers, the spacer shrinks to nothing without a minimum width.
141
+ minWidth: inheritedOrientation === 'vertical' && type === 'flex' ? 48 : undefined
132
142
  };
133
143
 
134
144
  const resizableBoxWithOrientation = blockOrientation => {
@@ -178,7 +188,7 @@ const SpacerEdit = _ref2 => {
178
188
  };
179
189
 
180
190
  (0, _element.useEffect)(() => {
181
- if (orientation === 'horizontal' && !width) {
191
+ if (inheritedOrientation === 'horizontal' && !width) {
182
192
  setAttributes({
183
193
  height: '0px',
184
194
  width: '72px'
@@ -187,11 +197,11 @@ const SpacerEdit = _ref2 => {
187
197
  }, []);
188
198
  return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_primitives.View, (0, _blockEditor.useBlockProps)({
189
199
  style
190
- }), resizableBoxWithOrientation(orientation)), (0, _element.createElement)(_controls.default, {
200
+ }), resizableBoxWithOrientation(inheritedOrientation)), (0, _element.createElement)(_controls.default, {
191
201
  setAttributes: setAttributes,
192
202
  height: temporaryHeight || height,
193
203
  width: temporaryWidth || width,
194
- orientation: orientation,
204
+ orientation: inheritedOrientation,
195
205
  isResizing: isResizing
196
206
  }));
197
207
  };