@wordpress/block-library 9.19.0 → 9.20.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 (119) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/archives/edit.js +2 -2
  3. package/build/archives/edit.js.map +1 -1
  4. package/build/audio/edit.js +66 -33
  5. package/build/audio/edit.js.map +1 -1
  6. package/build/avatar/index.js +8 -3
  7. package/build/avatar/index.js.map +1 -1
  8. package/build/button/edit.js +43 -16
  9. package/build/button/edit.js.map +1 -1
  10. package/build/comment-template/hooks.js +6 -0
  11. package/build/comment-template/hooks.js.map +1 -1
  12. package/build/cover/index.js +8 -1
  13. package/build/cover/index.js.map +1 -1
  14. package/build/image/constants.js +2 -1
  15. package/build/image/constants.js.map +1 -1
  16. package/build/image/image.js +85 -72
  17. package/build/image/image.js.map +1 -1
  18. package/build/latest-posts/edit.js +2 -1
  19. package/build/latest-posts/edit.js.map +1 -1
  20. package/build/navigation/use-template-part-area-label.js +7 -6
  21. package/build/navigation/use-template-part-area-label.js.map +1 -1
  22. package/build/post-author/edit.js +1 -1
  23. package/build/post-author/edit.js.map +1 -1
  24. package/build/post-author/index.js +8 -1
  25. package/build/post-author/index.js.map +1 -1
  26. package/build/post-author-name/edit.js +2 -2
  27. package/build/post-author-name/edit.js.map +1 -1
  28. package/build/query/edit/inspector-controls/index.js +2 -0
  29. package/build/query/edit/inspector-controls/index.js.map +1 -1
  30. package/build/query/edit/inspector-controls/order-control.js +3 -2
  31. package/build/query/edit/inspector-controls/order-control.js.map +1 -1
  32. package/build/query/utils.js +45 -0
  33. package/build/query/utils.js.map +1 -1
  34. package/build/query-total/index.js +2 -2
  35. package/build/query-total/index.js.map +1 -1
  36. package/build/site-logo/index.js +8 -1
  37. package/build/site-logo/index.js.map +1 -1
  38. package/build/social-links/index.js +1 -0
  39. package/build/social-links/index.js.map +1 -1
  40. package/build/table-of-contents/hooks.js +6 -3
  41. package/build/table-of-contents/hooks.js.map +1 -1
  42. package/build/template-part/edit/advanced-controls.js +1 -1
  43. package/build/template-part/edit/advanced-controls.js.map +1 -1
  44. package/build/template-part/edit/utils/hooks.js +1 -1
  45. package/build/template-part/edit/utils/hooks.js.map +1 -1
  46. package/build-module/archives/edit.js +2 -2
  47. package/build-module/archives/edit.js.map +1 -1
  48. package/build-module/audio/edit.js +68 -35
  49. package/build-module/audio/edit.js.map +1 -1
  50. package/build-module/avatar/index.js +8 -3
  51. package/build-module/avatar/index.js.map +1 -1
  52. package/build-module/button/edit.js +44 -17
  53. package/build-module/button/edit.js.map +1 -1
  54. package/build-module/comment-template/hooks.js +6 -0
  55. package/build-module/comment-template/hooks.js.map +1 -1
  56. package/build-module/cover/index.js +8 -1
  57. package/build-module/cover/index.js.map +1 -1
  58. package/build-module/image/constants.js +1 -0
  59. package/build-module/image/constants.js.map +1 -1
  60. package/build-module/image/image.js +88 -75
  61. package/build-module/image/image.js.map +1 -1
  62. package/build-module/latest-posts/edit.js +2 -1
  63. package/build-module/latest-posts/edit.js.map +1 -1
  64. package/build-module/navigation/use-template-part-area-label.js +7 -6
  65. package/build-module/navigation/use-template-part-area-label.js.map +1 -1
  66. package/build-module/post-author/edit.js +1 -1
  67. package/build-module/post-author/edit.js.map +1 -1
  68. package/build-module/post-author/index.js +8 -1
  69. package/build-module/post-author/index.js.map +1 -1
  70. package/build-module/post-author-name/edit.js +2 -2
  71. package/build-module/post-author-name/edit.js.map +1 -1
  72. package/build-module/query/edit/inspector-controls/index.js +3 -1
  73. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  74. package/build-module/query/edit/inspector-controls/order-control.js +3 -2
  75. package/build-module/query/edit/inspector-controls/order-control.js.map +1 -1
  76. package/build-module/query/utils.js +44 -0
  77. package/build-module/query/utils.js.map +1 -1
  78. package/build-module/query-total/index.js +2 -2
  79. package/build-module/query-total/index.js.map +1 -1
  80. package/build-module/site-logo/index.js +8 -1
  81. package/build-module/site-logo/index.js.map +1 -1
  82. package/build-module/social-links/index.js +1 -0
  83. package/build-module/social-links/index.js.map +1 -1
  84. package/build-module/table-of-contents/hooks.js +6 -3
  85. package/build-module/table-of-contents/hooks.js.map +1 -1
  86. package/build-module/template-part/edit/advanced-controls.js +1 -1
  87. package/build-module/template-part/edit/advanced-controls.js.map +1 -1
  88. package/build-module/template-part/edit/utils/hooks.js +1 -1
  89. package/build-module/template-part/edit/utils/hooks.js.map +1 -1
  90. package/build-style/editor-rtl.css +0 -9
  91. package/build-style/editor.css +0 -9
  92. package/build-style/image/editor-rtl.css +0 -9
  93. package/build-style/image/editor.css +0 -9
  94. package/package.json +35 -35
  95. package/src/archives/edit.js +2 -2
  96. package/src/audio/edit.js +84 -33
  97. package/src/avatar/block.json +8 -3
  98. package/src/button/edit.js +69 -24
  99. package/src/comment-template/hooks.js +14 -6
  100. package/src/cover/block.json +8 -1
  101. package/src/image/constants.js +1 -0
  102. package/src/image/editor.scss +0 -13
  103. package/src/image/image.js +115 -122
  104. package/src/latest-posts/edit.js +1 -0
  105. package/src/navigation/use-template-part-area-label.js +6 -6
  106. package/src/post-author/block.json +8 -1
  107. package/src/post-author/edit.js +1 -1
  108. package/src/post-author-name/edit.js +4 -4
  109. package/src/query/edit/inspector-controls/index.js +3 -1
  110. package/src/query/edit/inspector-controls/order-control.js +9 -3
  111. package/src/query/utils.js +58 -0
  112. package/src/query-total/block.json +2 -2
  113. package/src/query-total/index.php +2 -2
  114. package/src/site-logo/block.json +8 -1
  115. package/src/site-title/index.php +1 -1
  116. package/src/social-links/block.json +1 -0
  117. package/src/table-of-contents/hooks.js +5 -2
  118. package/src/template-part/edit/advanced-controls.js +1 -1
  119. package/src/template-part/edit/utils/hooks.js +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 9.20.0 (2025-03-13)
6
+
7
+ ### Enhancements
8
+
9
+ - Query Loop Block: Enable custom order or `menu_order` ordering option for post types that support it. ([#68781](https://github.com/WordPress/gutenberg/pull/68781))
10
+
5
11
  ## 9.19.0 (2025-02-28)
6
12
 
7
13
  ## 9.18.0 (2025-02-12)
@@ -37,7 +37,7 @@ function ArchivesEdit({
37
37
  resetAll: () => {
38
38
  setAttributes({
39
39
  displayAsDropdown: false,
40
- showLabel: false,
40
+ showLabel: true,
41
41
  showPostCounts: false,
42
42
  type: 'monthly'
43
43
  });
@@ -63,7 +63,7 @@ function ArchivesEdit({
63
63
  isShownByDefault: true,
64
64
  hasValue: () => !showLabel,
65
65
  onDeselect: () => setAttributes({
66
- showLabel: false
66
+ showLabel: true
67
67
  }),
68
68
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
69
69
  __nextHasNoMarginBottom: true,
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_i18n","_blockEditor","_serverSideRender","_interopRequireDefault","_hooks","_jsxRuntime","ArchivesEdit","attributes","setAttributes","showLabel","showPostCounts","displayAsDropdown","type","dropdownMenuProps","useToolsPanelDropdownMenuProps","jsxs","Fragment","children","jsx","InspectorControls","__experimentalToolsPanel","label","__","resetAll","__experimentalToolsPanelItem","isShownByDefault","hasValue","onDeselect","ToggleControl","__nextHasNoMarginBottom","checked","onChange","SelectControl","__next40pxDefaultSize","options","value","useBlockProps","Disabled","default","block","skipBlockSupportAttributes"],"sources":["@wordpress/block-library/src/archives/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tToggleControl,\n\tSelectControl,\n\tDisabled,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport ServerSideRender from '@wordpress/server-side-render';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nexport default function ArchivesEdit( { attributes, setAttributes } ) {\n\tconst { showLabel, showPostCounts, displayAsDropdown, type } = attributes;\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tdisplayAsDropdown: false,\n\t\t\t\t\t\t\tshowLabel: false,\n\t\t\t\t\t\t\tshowPostCounts: false,\n\t\t\t\t\t\t\ttype: 'monthly',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Display as dropdown' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => displayAsDropdown }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { displayAsDropdown: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Display as dropdown' ) }\n\t\t\t\t\t\t\tchecked={ displayAsDropdown }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tdisplayAsDropdown: ! displayAsDropdown,\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</ToolsPanelItem>\n\n\t\t\t\t\t{ displayAsDropdown && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Show label' ) }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\thasValue={ () => ! showLabel }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { showLabel: false } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Show label' ) }\n\t\t\t\t\t\t\t\tchecked={ showLabel }\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tshowLabel: ! showLabel,\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</ToolsPanelItem>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Show post counts' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => showPostCounts }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showPostCounts: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Show post counts' ) }\n\t\t\t\t\t\t\tchecked={ showPostCounts }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tshowPostCounts: ! showPostCounts,\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</ToolsPanelItem>\n\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Group by' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => type !== 'monthly' }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { type: 'monthly' } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Group by' ) }\n\t\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t\t{ label: __( 'Year' ), value: 'yearly' },\n\t\t\t\t\t\t\t\t{ label: __( 'Month' ), value: 'monthly' },\n\t\t\t\t\t\t\t\t{ label: __( 'Week' ), value: 'weekly' },\n\t\t\t\t\t\t\t\t{ label: __( 'Day' ), value: 'daily' },\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\tvalue={ type }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { type: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...useBlockProps() }>\n\t\t\t\t<Disabled>\n\t\t\t\t\t<ServerSideRender\n\t\t\t\t\t\tblock=\"core/archives\"\n\t\t\t\t\t\tskipBlockSupportAttributes\n\t\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\t/>\n\t\t\t\t</Disabled>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AAAgE,IAAAM,WAAA,GAAAN,OAAA;AAjBhE;AACA;AACA;;AAYA;AACA;AACA;;AAGe,SAASO,YAAYA,CAAE;EAAEC,UAAU;EAAEC;AAAc,CAAC,EAAG;EACrE,MAAM;IAAEC,SAAS;IAAEC,cAAc;IAAEC,iBAAiB;IAAEC;EAAK,CAAC,GAAGL,UAAU;EAEzE,MAAMM,iBAAiB,GAAG,IAAAC,qCAA8B,EAAC,CAAC;EAE1D,oB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AAa;YACbC,qBAAqB;YACrBJ,uBAAuB;YACvBR,KAAK,EAAG,IAAAC,QAAE,EAAE,UAAW,CAAG;YAC1BY,OAAO,EAAG,CACT;cAAEb,KAAK,EAAE,IAAAC,QAAE,EAAE,MAAO,CAAC;cAAEa,KAAK,EAAE;YAAS,CAAC,EACxC;cAAEd,KAAK,EAAE,IAAAC,QAAE,EAAE,OAAQ,CAAC;cAAEa,KAAK,EAAE;YAAU,CAAC,EAC1C;cAAEd,KAAK,EAAE,IAAAC,QAAE,EAAE,MAAO,CAAC;cAAEa,KAAK,EAAE;YAAS,CAAC,EACxC;cAAEd,KAAK,EAAE,IAAAC,QAAE,EAAE,KAAM,CAAC;cAAEa,KAAK,EAAE;YAAQ,CAAC,CACpC;YACHA,KAAK,EAAGvB,IAAM;YACdmB,QAAQ,EAAKI,KAAK,IACjB3B,aAAa,CAAE;cAAEI,IAAI,EAAEuB;YAAM,CAAE;UAC/B,CACD;QAAC,CACa,CAAC;MAAA,CACN;IAAC,CACK,CAAC,eACpB,IAAA9B,WAAA,CAAAa,GAAA;MAAA,GAAU,IAAAkB,0BAAa,EAAC,CAAC;MAAAnB,QAAA,eACxB,IAAAZ,WAAA,CAAAa,GAAA,EAACpB,WAAA,CAAAuC,QAAQ;QAAApB,QAAA,eACR,IAAAZ,WAAA,CAAAa,GAAA,EAAChB,iBAAA,CAAAoC,OAAgB;UAChBC,KAAK,EAAC,eAAe;UACrBC,0BAA0B;UAC1BjC,UAAU,EAAGA;QAAY,CACzB;MAAC,CACO;IAAC,CACP,CAAC;EAAA,CACL,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["_components","require","_i18n","_blockEditor","_serverSideRender","_interopRequireDefault","_hooks","_jsxRuntime","ArchivesEdit","attributes","setAttributes","showLabel","showPostCounts","displayAsDropdown","type","dropdownMenuProps","useToolsPanelDropdownMenuProps","jsxs","Fragment","children","jsx","InspectorControls","__experimentalToolsPanel","label","__","resetAll","__experimentalToolsPanelItem","isShownByDefault","hasValue","onDeselect","ToggleControl","__nextHasNoMarginBottom","checked","onChange","SelectControl","__next40pxDefaultSize","options","value","useBlockProps","Disabled","default","block","skipBlockSupportAttributes"],"sources":["@wordpress/block-library/src/archives/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tToggleControl,\n\tSelectControl,\n\tDisabled,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport ServerSideRender from '@wordpress/server-side-render';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nexport default function ArchivesEdit( { attributes, setAttributes } ) {\n\tconst { showLabel, showPostCounts, displayAsDropdown, type } = attributes;\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tdisplayAsDropdown: false,\n\t\t\t\t\t\t\tshowLabel: true,\n\t\t\t\t\t\t\tshowPostCounts: false,\n\t\t\t\t\t\t\ttype: 'monthly',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Display as dropdown' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => displayAsDropdown }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { displayAsDropdown: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Display as dropdown' ) }\n\t\t\t\t\t\t\tchecked={ displayAsDropdown }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tdisplayAsDropdown: ! displayAsDropdown,\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</ToolsPanelItem>\n\n\t\t\t\t\t{ displayAsDropdown && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Show label' ) }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\thasValue={ () => ! showLabel }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { showLabel: true } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Show label' ) }\n\t\t\t\t\t\t\t\tchecked={ showLabel }\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tshowLabel: ! showLabel,\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</ToolsPanelItem>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Show post counts' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => showPostCounts }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showPostCounts: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Show post counts' ) }\n\t\t\t\t\t\t\tchecked={ showPostCounts }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tshowPostCounts: ! showPostCounts,\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</ToolsPanelItem>\n\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Group by' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => type !== 'monthly' }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { type: 'monthly' } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Group by' ) }\n\t\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t\t{ label: __( 'Year' ), value: 'yearly' },\n\t\t\t\t\t\t\t\t{ label: __( 'Month' ), value: 'monthly' },\n\t\t\t\t\t\t\t\t{ label: __( 'Week' ), value: 'weekly' },\n\t\t\t\t\t\t\t\t{ label: __( 'Day' ), value: 'daily' },\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\tvalue={ type }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { type: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...useBlockProps() }>\n\t\t\t\t<Disabled>\n\t\t\t\t\t<ServerSideRender\n\t\t\t\t\t\tblock=\"core/archives\"\n\t\t\t\t\t\tskipBlockSupportAttributes\n\t\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\t/>\n\t\t\t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AnB,QAAA,eACxB,IAAAZ,WAAA,CAAAa,GAAA,EAACpB,WAAA,CAAAuC,QAAQ;QAAApB,QAAA,eACR,IAAAZ,WAAA,CAAAa,GAAA,EAAChB,iBAAA,CAAAoC,OAAgB;UAChBC,KAAK,EAAC,eAAe;UACrBC,0BAA0B;UAC1BjC,UAAU,EAAGA;QAAY,CACzB;MAAC,CACO;IAAC,CACP,CAAC;EAAA,CACL,CAAC;AAEL","ignoreList":[]}
@@ -127,6 +127,7 @@ function AudioEdit({
127
127
  const blockProps = (0, _blockEditor.useBlockProps)({
128
128
  className: classes
129
129
  });
130
+ const dropdownMenuProps = (0, _hooks.useToolsPanelDropdownMenuProps)();
130
131
  if (!src && !temporaryURL) {
131
132
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
132
133
  ...blockProps,
@@ -157,42 +158,74 @@ function AudioEdit({
157
158
  onReset: () => onSelectAudio(undefined)
158
159
  })
159
160
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.InspectorControls, {
160
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.PanelBody, {
161
- title: (0, _i18n.__)('Settings'),
162
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
163
- __nextHasNoMarginBottom: true,
161
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalToolsPanel, {
162
+ label: (0, _i18n.__)('Settings'),
163
+ resetAll: () => {
164
+ setAttributes({
165
+ autoplay: false,
166
+ loop: false,
167
+ preload: undefined
168
+ });
169
+ },
170
+ dropdownMenuProps: dropdownMenuProps,
171
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
164
172
  label: (0, _i18n.__)('Autoplay'),
165
- onChange: toggleAttribute('autoplay'),
166
- checked: autoplay,
167
- help: getAutoplayHelp
168
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
169
- __nextHasNoMarginBottom: true,
173
+ isShownByDefault: true,
174
+ hasValue: () => !!autoplay,
175
+ onDeselect: () => setAttributes({
176
+ autoplay: false
177
+ }),
178
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
179
+ __nextHasNoMarginBottom: true,
180
+ label: (0, _i18n.__)('Autoplay'),
181
+ onChange: toggleAttribute('autoplay'),
182
+ checked: !!autoplay,
183
+ help: getAutoplayHelp
184
+ })
185
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
170
186
  label: (0, _i18n.__)('Loop'),
171
- onChange: toggleAttribute('loop'),
172
- checked: loop
173
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SelectControl, {
174
- __next40pxDefaultSize: true,
175
- __nextHasNoMarginBottom: true,
176
- label: (0, _i18n._x)('Preload', 'noun; Audio block parameter'),
177
- value: preload || ''
178
- // `undefined` is required for the preload attribute to be unset.
179
- ,
180
- onChange: value => setAttributes({
181
- preload: value || undefined
187
+ isShownByDefault: true,
188
+ hasValue: () => !!loop,
189
+ onDeselect: () => setAttributes({
190
+ loop: false
191
+ }),
192
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
193
+ __nextHasNoMarginBottom: true,
194
+ label: (0, _i18n.__)('Loop'),
195
+ onChange: toggleAttribute('loop'),
196
+ checked: !!loop
197
+ })
198
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
199
+ label: (0, _i18n.__)('Preload'),
200
+ isShownByDefault: true,
201
+ hasValue: () => !!preload,
202
+ onDeselect: () => setAttributes({
203
+ preload: undefined
182
204
  }),
183
- options: [{
184
- value: '',
185
- label: (0, _i18n.__)('Browser default')
186
- }, {
187
- value: 'auto',
188
- label: (0, _i18n.__)('Auto')
189
- }, {
190
- value: 'metadata',
191
- label: (0, _i18n.__)('Metadata')
192
- }, {
193
- value: 'none',
194
- label: (0, _i18n._x)('None', 'Preload value')
195
- }]
205
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SelectControl, {
206
+ __next40pxDefaultSize: true,
207
+ __nextHasNoMarginBottom: true,
208
+ label: (0, _i18n._x)('Preload', 'noun; Audio block parameter'),
209
+ value: preload || ''
210
+ // `undefined` is required for the preload attribute to be unset.
211
+ ,
212
+ onChange: value => setAttributes({
213
+ preload: value || undefined
214
+ }),
215
+ options: [{
216
+ value: '',
217
+ label: (0, _i18n.__)('Browser default')
218
+ }, {
219
+ value: 'auto',
220
+ label: (0, _i18n.__)('Auto')
221
+ }, {
222
+ value: 'metadata',
223
+ label: (0, _i18n.__)('Metadata')
224
+ }, {
225
+ value: 'none',
226
+ label: (0, _i18n._x)('None', 'Preload value')
227
+ }]
228
+ })
196
229
  })]
197
230
  })
198
231
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("figure", {
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_blob","_components","_blockEditor","_i18n","_data","_icons","_notices","_element","_util","_hooks","_caption","_jsxRuntime","ALLOWED_MEDIA_TYPES","AudioEdit","attributes","className","setAttributes","onReplace","isSelected","isSingleSelected","insertBlocksAfter","id","autoplay","loop","preload","src","temporaryURL","setTemporaryURL","useState","blob","useUploadMediaFromBlobURL","url","allowedTypes","onChange","onSelectAudio","onError","onUploadError","toggleAttribute","attribute","newValue","onSelectURL","newSrc","embedBlock","createUpgradedEmbedBlock","undefined","createErrorNotice","useDispatch","noticesStore","message","type","getAutoplayHelp","checked","__","media","caption","isBlobURL","classes","clsx","blockProps","useBlockProps","jsx","children","MediaPlaceholder","icon","BlockIcon","onSelect","accept","value","jsxs","Fragment","BlockControls","group","MediaReplaceFlow","mediaId","mediaURL","onReset","InspectorControls","PanelBody","title","ToggleControl","__nextHasNoMarginBottom","label","help","SelectControl","__next40pxDefaultSize","_x","options","Disabled","isDisabled","controls","Spinner","Caption","showToolbarButton","_default","exports","default"],"sources":["@wordpress/block-library/src/audio/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { isBlobURL } from '@wordpress/blob';\nimport {\n\tDisabled,\n\tPanelBody,\n\tSelectControl,\n\tSpinner,\n\tToggleControl,\n} from '@wordpress/components';\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tInspectorControls,\n\tMediaPlaceholder,\n\tMediaReplaceFlow,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { __, _x } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { audio as icon } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { createUpgradedEmbedBlock } from '../embed/util';\nimport { useUploadMediaFromBlobURL } from '../utils/hooks';\nimport { Caption } from '../utils/caption';\n\nconst ALLOWED_MEDIA_TYPES = [ 'audio' ];\n\nfunction AudioEdit( {\n\tattributes,\n\tclassName,\n\tsetAttributes,\n\tonReplace,\n\tisSelected: isSingleSelected,\n\tinsertBlocksAfter,\n} ) {\n\tconst { id, autoplay, loop, preload, src } = attributes;\n\tconst [ temporaryURL, setTemporaryURL ] = useState( attributes.blob );\n\n\tuseUploadMediaFromBlobURL( {\n\t\turl: temporaryURL,\n\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\tonChange: onSelectAudio,\n\t\tonError: onUploadError,\n\t} );\n\n\tfunction toggleAttribute( attribute ) {\n\t\treturn ( newValue ) => {\n\t\t\tsetAttributes( { [ attribute ]: newValue } );\n\t\t};\n\t}\n\n\tfunction onSelectURL( newSrc ) {\n\t\t// Set the block's src from the edit component's state, and switch off\n\t\t// the editing UI.\n\t\tif ( newSrc !== src ) {\n\t\t\t// Check if there's an embed block that handles this URL.\n\t\t\tconst embedBlock = createUpgradedEmbedBlock( {\n\t\t\t\tattributes: { url: newSrc },\n\t\t\t} );\n\t\t\tif ( undefined !== embedBlock && onReplace ) {\n\t\t\t\tonReplace( embedBlock );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetAttributes( { src: newSrc, id: undefined, blob: undefined } );\n\t\t\tsetTemporaryURL();\n\t\t}\n\t}\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tfunction onUploadError( message ) {\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t}\n\n\tfunction getAutoplayHelp( checked ) {\n\t\treturn checked\n\t\t\t? __( 'Autoplay may cause usability issues for some users.' )\n\t\t\t: null;\n\t}\n\n\tfunction onSelectAudio( media ) {\n\t\tif ( ! media || ! media.url ) {\n\t\t\t// In this case there was an error and we should continue in the editing state\n\t\t\t// previous attributes should be removed because they may be temporary blob urls.\n\t\t\tsetAttributes( {\n\t\t\t\tsrc: undefined,\n\t\t\t\tid: undefined,\n\t\t\t\tcaption: undefined,\n\t\t\t\tblob: undefined,\n\t\t\t} );\n\t\t\tsetTemporaryURL();\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isBlobURL( media.url ) ) {\n\t\t\tsetTemporaryURL( media.url );\n\t\t\treturn;\n\t\t}\n\n\t\t// Sets the block's attribute and updates the edit component from the\n\t\t// selected media, then switches off the editing UI.\n\t\tsetAttributes( {\n\t\t\tblob: undefined,\n\t\t\tsrc: media.url,\n\t\t\tid: media.id,\n\t\t\tcaption: media.caption,\n\t\t} );\n\t\tsetTemporaryURL();\n\t}\n\n\tconst classes = clsx( className, {\n\t\t'is-transient': !! temporaryURL,\n\t} );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classes,\n\t} );\n\n\tif ( ! src && ! temporaryURL ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<MediaPlaceholder\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\tonSelect={ onSelectAudio }\n\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\taccept=\"audio/*\"\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\tvalue={ attributes }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ isSingleSelected && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\t\tmediaId={ id }\n\t\t\t\t\t\tmediaURL={ src }\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\taccept=\"audio/*\"\n\t\t\t\t\t\tonSelect={ onSelectAudio }\n\t\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t\tonReset={ () => onSelectAudio( undefined ) }\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t) }\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={ __( 'Autoplay' ) }\n\t\t\t\t\t\tonChange={ toggleAttribute( 'autoplay' ) }\n\t\t\t\t\t\tchecked={ autoplay }\n\t\t\t\t\t\thelp={ getAutoplayHelp }\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={ __( 'Loop' ) }\n\t\t\t\t\t\tonChange={ toggleAttribute( 'loop' ) }\n\t\t\t\t\t\tchecked={ loop }\n\t\t\t\t\t/>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ _x( 'Preload', 'noun; Audio block parameter' ) }\n\t\t\t\t\t\tvalue={ preload || '' }\n\t\t\t\t\t\t// `undefined` is required for the preload attribute to be unset.\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tpreload: value || undefined,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t{ value: '', label: __( 'Browser default' ) },\n\t\t\t\t\t\t\t{ value: 'auto', label: __( 'Auto' ) },\n\t\t\t\t\t\t\t{ value: 'metadata', label: __( 'Metadata' ) },\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvalue: 'none',\n\t\t\t\t\t\t\t\tlabel: _x( 'None', 'Preload value' ),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t] }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<figure { ...blockProps }>\n\t\t\t\t{ /*\n\t\t\t\tDisable the audio tag if the block is not selected\n\t\t\t\tso the user clicking on it won't play the\n\t\t\t\tfile or change the position slider when the controls are enabled.\n\t\t\t\t*/ }\n\t\t\t\t<Disabled isDisabled={ ! isSingleSelected }>\n\t\t\t\t\t<audio controls=\"controls\" src={ src ?? temporaryURL } />\n\t\t\t\t</Disabled>\n\t\t\t\t{ !! temporaryURL && <Spinner /> }\n\t\t\t\t<Caption\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisSelected={ isSingleSelected }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\tlabel={ __( 'Audio caption text' ) }\n\t\t\t\t\tshowToolbarButton={ isSingleSelected }\n\t\t\t\t/>\n\t\t\t</figure>\n\t\t</>\n\t);\n}\n\nexport default AudioEdit;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAOA,IAAAG,YAAA,GAAAH,OAAA;AAQA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAA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CAAC;MAAA,CACQ;IAAC,CACM,CAAC,eACpB,IAAA1E,WAAA,CAAAyD,IAAA;MAAA,GAAaV,UAAU;MAAAG,QAAA,gBAMtB,IAAAlD,WAAA,CAAAiD,GAAA,EAAC3D,WAAA,CAAAsF,QAAQ;QAACC,UAAU,EAAG,CAAErE,gBAAkB;QAAA0C,QAAA,eAC1C,IAAAlD,WAAA,CAAAiD,GAAA;UAAO6B,QAAQ,EAAC,UAAU;UAAChE,GAAG,EAAGA,GAAG,aAAHA,GAAG,cAAHA,GAAG,GAAIC;QAAc,CAAE;MAAC,CAChD,CAAC,EACT,CAAC,CAAEA,YAAY,iBAAI,IAAAf,WAAA,CAAAiD,GAAA,EAAC3D,WAAA,CAAAyF,OAAO,IAAE,CAAC,eAChC,IAAA/E,WAAA,CAAAiD,GAAA,EAAClD,QAAA,CAAAiF,OAAO;QACP7E,UAAU,EAAGA,UAAY;QACzBE,aAAa,EAAGA,aAAe;QAC/BE,UAAU,EAAGC,gBAAkB;QAC/BC,iBAAiB,EAAGA,iBAAmB;QACvC6D,KAAK,EAAG,IAAA7B,QAAE,EAAE,oBAAqB,CAAG;QACpCwC,iBAAiB,EAAGzE;MAAkB,CACtC,CAAC;IAAA,CACK,CAAC;EAAA,CACR,CAAC;AAEL;AAAC,IAAA0E,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEclF,SAAS","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_blob","_components","_blockEditor","_i18n","_data","_icons","_notices","_element","_util","_hooks","_caption","_jsxRuntime","ALLOWED_MEDIA_TYPES","AudioEdit","attributes","className","setAttributes","onReplace","isSelected","isSingleSelected","insertBlocksAfter","id","autoplay","loop","preload","src","temporaryURL","setTemporaryURL","useState","blob","useUploadMediaFromBlobURL","url","allowedTypes","onChange","onSelectAudio","onError","onUploadError","toggleAttribute","attribute","newValue","onSelectURL","newSrc","embedBlock","createUpgradedEmbedBlock","undefined","createErrorNotice","useDispatch","noticesStore","message","type","getAutoplayHelp","checked","__","media","caption","isBlobURL","classes","clsx","blockProps","useBlockProps","dropdownMenuProps","useToolsPanelDropdownMenuProps","jsx","children","MediaPlaceholder","icon","BlockIcon","onSelect","accept","value","jsxs","Fragment","BlockControls","group","MediaReplaceFlow","mediaId","mediaURL","onReset","InspectorControls","__experimentalToolsPanel","label","resetAll","__experimentalToolsPanelItem","isShownByDefault","hasValue","onDeselect","ToggleControl","__nextHasNoMarginBottom","help","SelectControl","__next40pxDefaultSize","_x","options","Disabled","isDisabled","controls","Spinner","Caption","showToolbarButton","_default","exports","default"],"sources":["@wordpress/block-library/src/audio/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { isBlobURL } from '@wordpress/blob';\nimport {\n\tDisabled,\n\tSelectControl,\n\tSpinner,\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tInspectorControls,\n\tMediaPlaceholder,\n\tMediaReplaceFlow,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { __, _x } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { audio as icon } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { createUpgradedEmbedBlock } from '../embed/util';\nimport {\n\tuseUploadMediaFromBlobURL,\n\tuseToolsPanelDropdownMenuProps,\n} from '../utils/hooks';\nimport { Caption } from '../utils/caption';\n\nconst ALLOWED_MEDIA_TYPES = [ 'audio' ];\n\nfunction AudioEdit( {\n\tattributes,\n\tclassName,\n\tsetAttributes,\n\tonReplace,\n\tisSelected: isSingleSelected,\n\tinsertBlocksAfter,\n} ) {\n\tconst { id, autoplay, loop, preload, src } = attributes;\n\tconst [ temporaryURL, setTemporaryURL ] = useState( attributes.blob );\n\n\tuseUploadMediaFromBlobURL( {\n\t\turl: temporaryURL,\n\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\tonChange: onSelectAudio,\n\t\tonError: onUploadError,\n\t} );\n\n\tfunction toggleAttribute( attribute ) {\n\t\treturn ( newValue ) => {\n\t\t\tsetAttributes( { [ attribute ]: newValue } );\n\t\t};\n\t}\n\n\tfunction onSelectURL( newSrc ) {\n\t\t// Set the block's src from the edit component's state, and switch off\n\t\t// the editing UI.\n\t\tif ( newSrc !== src ) {\n\t\t\t// Check if there's an embed block that handles this URL.\n\t\t\tconst embedBlock = createUpgradedEmbedBlock( {\n\t\t\t\tattributes: { url: newSrc },\n\t\t\t} );\n\t\t\tif ( undefined !== embedBlock && onReplace ) {\n\t\t\t\tonReplace( embedBlock );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetAttributes( { src: newSrc, id: undefined, blob: undefined } );\n\t\t\tsetTemporaryURL();\n\t\t}\n\t}\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tfunction onUploadError( message ) {\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t}\n\n\tfunction getAutoplayHelp( checked ) {\n\t\treturn checked\n\t\t\t? __( 'Autoplay may cause usability issues for some users.' )\n\t\t\t: null;\n\t}\n\n\tfunction onSelectAudio( media ) {\n\t\tif ( ! media || ! media.url ) {\n\t\t\t// In this case there was an error and we should continue in the editing state\n\t\t\t// previous attributes should be removed because they may be temporary blob urls.\n\t\t\tsetAttributes( {\n\t\t\t\tsrc: undefined,\n\t\t\t\tid: undefined,\n\t\t\t\tcaption: undefined,\n\t\t\t\tblob: undefined,\n\t\t\t} );\n\t\t\tsetTemporaryURL();\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isBlobURL( media.url ) ) {\n\t\t\tsetTemporaryURL( media.url );\n\t\t\treturn;\n\t\t}\n\n\t\t// Sets the block's attribute and updates the edit component from the\n\t\t// selected media, then switches off the editing UI.\n\t\tsetAttributes( {\n\t\t\tblob: undefined,\n\t\t\tsrc: media.url,\n\t\t\tid: media.id,\n\t\t\tcaption: media.caption,\n\t\t} );\n\t\tsetTemporaryURL();\n\t}\n\n\tconst classes = clsx( className, {\n\t\t'is-transient': !! temporaryURL,\n\t} );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classes,\n\t} );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tif ( ! src && ! temporaryURL ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<MediaPlaceholder\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\tonSelect={ onSelectAudio }\n\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\taccept=\"audio/*\"\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\tvalue={ attributes }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ isSingleSelected && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\t\tmediaId={ id }\n\t\t\t\t\t\tmediaURL={ src }\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\taccept=\"audio/*\"\n\t\t\t\t\t\tonSelect={ onSelectAudio }\n\t\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t\tonReset={ () => onSelectAudio( undefined ) }\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tautoplay: false,\n\t\t\t\t\t\t\tloop: false,\n\t\t\t\t\t\t\tpreload: undefined,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Autoplay' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! autoplay }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tautoplay: false,\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\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Autoplay' ) }\n\t\t\t\t\t\t\tonChange={ toggleAttribute( 'autoplay' ) }\n\t\t\t\t\t\t\tchecked={ !! autoplay }\n\t\t\t\t\t\t\thelp={ getAutoplayHelp }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Loop' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! loop }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tloop: false,\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\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Loop' ) }\n\t\t\t\t\t\t\tonChange={ toggleAttribute( 'loop' ) }\n\t\t\t\t\t\t\tchecked={ !! loop }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Preload' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! preload }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tpreload: undefined,\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\t<SelectControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t'Preload',\n\t\t\t\t\t\t\t\t'noun; Audio block parameter'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tvalue={ preload || '' }\n\t\t\t\t\t\t\t// `undefined` is required for the preload attribute to be unset.\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tpreload: value || undefined,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t\t{ value: '', label: __( 'Browser default' ) },\n\t\t\t\t\t\t\t\t{ value: 'auto', label: __( 'Auto' ) },\n\t\t\t\t\t\t\t\t{ value: 'metadata', label: __( 'Metadata' ) },\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tvalue: 'none',\n\t\t\t\t\t\t\t\t\tlabel: _x( 'None', 'Preload value' ),\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</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<figure { ...blockProps }>\n\t\t\t\t{ /*\n\t\t\t\tDisable the audio tag if the block is not selected\n\t\t\t\tso the user clicking on it won't play the\n\t\t\t\tfile or change the position slider when the controls are enabled.\n\t\t\t\t*/ }\n\t\t\t\t<Disabled isDisabled={ ! isSingleSelected }>\n\t\t\t\t\t<audio controls=\"controls\" src={ src ?? temporaryURL } />\n\t\t\t\t</Disabled>\n\t\t\t\t{ !! temporaryURL && <Spinner /> }\n\t\t\t\t<Caption\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisSelected={ isSingleSelected }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\tlabel={ __( 'Audio caption text' ) }\n\t\t\t\t\tshowToolbarButton={ isSingleSelected }\n\t\t\t\t/>\n\t\t\t</figure>\n\t\t</>\n\t);\n}\n\nexport default AudioEdit;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAQA,IAAAG,YAAA,GAAAH,OAAA;AAQA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AAKA,IAAAS,KAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AAIA,IAAAW,QAAA,GAAAX,OAAA;AAA2C,IAAAY,WAAA,GAAAZ,OAAA;AAvC3C;AACA;AACA;;AAGA;AACA;AACA;;AAwBA;AACA;AACA;;AAQA,MAAMa,mBAAmB,GAAG,CAAE,OAAO,CAAE;AAEvC,SAASC,SAASA,CAAE;EACnBC,UAAU;EACVC,SAAS;EACTC,aAAa;EACbC,SAAS;EACTC,UAAU,EAAEC,gBAAgB;EAC5BC;AACD,CAAC,EAAG;EACH,MAAM;IAAEC,EAAE;IAAEC,QAAQ;IAAEC,IAAI;IAAEC,OAAO;IAAEC;EAAI,CAAC,GAAGX,UAAU;EACvD,MAAM,CAAEY,YAAY,EAAEC,eAAe,CAAE,GAAG,IAAAC,iBAAQ,EAAEd,UAAU,CAACe,IAAK,CAAC;EAErE,IAAAC,gCAAyB,EAAE;IAC1BC,GAAG,EAAEL,YAAY;I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ACK,CAAC;EAAA,CACR,CAAC;AAEL;AAAC,IAAAgF,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcxF,SAAS","ignoreList":[]}
@@ -64,15 +64,20 @@ const metadata = exports.metadata = {
64
64
  },
65
65
  color: {
66
66
  text: false,
67
- background: false,
68
- __experimentalDuotone: "img"
67
+ background: false
68
+ },
69
+ filter: {
70
+ duotone: true
69
71
  },
70
72
  interactivity: {
71
73
  clientNavigation: true
72
74
  }
73
75
  },
74
76
  selectors: {
75
- border: ".wp-block-avatar img"
77
+ border: ".wp-block-avatar img",
78
+ filter: {
79
+ duotone: ".wp-block-avatar img"
80
+ }
76
81
  },
77
82
  editorStyle: "wp-block-avatar-editor",
78
83
  style: "wp-block-avatar"
@@ -1 +1 @@
1
- {"version":3,"names":["_icons","require","_initBlock","_interopRequireDefault","_edit","metadata","exports","$schema","apiVersion","name","title","category","description","textdomain","attributes","userId","type","size","isLink","linkTarget","usesContext","supports","html","align","alignWide","spacing","margin","padding","__experimentalDefaultControls","__experimentalBorder","__experimentalSkipSerialization","radius","width","color","style","text","background","__experimentalDuotone","interactivity","clientNavigation","selectors","border","editorStyle","settings","icon","edit","example","init","initBlock"],"sources":["@wordpress/block-library/src/avatar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { commentAuthorAvatar 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';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\texample: {},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAKA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,KAAA,GAAAD,sBAAA,CAAAF,OAAA;AAVA;AACA;AACA;AAGA;AACA;AACA;AAFA,MAAAI,QAAA,GAAAC,OAAA,CAAAD,QAAA;EAAAE,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,MAAA;MAAAC,IAAA;IAAA;IAAAC,IAAA;MAAAD,IAAA;MAAA;IAAA;IAAAE,MAAA;MAAAF,IAAA;MAAA;IAAA;IAAAG,UAAA;MAAAH,IAAA;MAAA;IAAA;EAAA;EAAAI,WAAA;EAAAC,QAAA;IAAAC,IAAA;IAAAC,KAAA;IAAAC,SAAA;IAAAC,OAAA;MAAAC,MAAA;MAAAC,OAAA;MAAAC,6BAAA;QAAAF,MAAA;QAAAC,OAAA;MAAA;IAAA;IAAAE,oBAAA;MAAAC,+BAAA;MAAAC,MAAA;MAAAC,KAAA;MAAAC,KAAA;MAAAC,KAAA;MAAAN,6BAAA;QAAAG,MAAA;MAAA;IAAA;IAAAE,KAAA;MAAAE,IAAA;MAAAC,UAAA;MAAAC,qBAAA;IAAA;IAAAC,aAAA;MAAAC,gBAAA;IAAA;EAAA;EAAAC,SAAA;IAAAC,MAAA;EAAA;EAAAC,WAAA;EAAAR,KAAA;AAAA;AAOA,MAAM;EAAEzB;AAAK,CAAC,GAAGJ,QAAQ;AAACC,OAAA,CAAAG,IAAA,GAAAA,IAAA;AAGnB,MAAMkC,QAAQ,GAAArC,OAAA,CAAAqC,QAAA,GAAG;EACvBC,IAAI,EAAJA,0BAAI;EACJC,IAAI,EAAJA,aAAI;EACJC,OAAO,EAAE,CAAC;AACX,CAAC;AAEM,MAAMC,IAAI,GAAGA,CAAA,KAAM,IAAAC,kBAAS,EAAE;EAAEvC,IAAI;EAAEJ,QAAQ;EAAEsC;AAAS,CAAE,CAAC;AAACrC,OAAA,CAAAyC,IAAA,GAAAA,IAAA","ignoreList":[]}
1
+ {"version":3,"names":["_icons","require","_initBlock","_interopRequireDefault","_edit","metadata","exports","$schema","apiVersion","name","title","category","description","textdomain","attributes","userId","type","size","isLink","linkTarget","usesContext","supports","html","align","alignWide","spacing","margin","padding","__experimentalDefaultControls","__experimentalBorder","__experimentalSkipSerialization","radius","width","color","style","text","background","filter","duotone","interactivity","clientNavigation","selectors","border","editorStyle","settings","icon","edit","example","init","initBlock"],"sources":["@wordpress/block-library/src/avatar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { commentAuthorAvatar 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';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\texample: {},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAKA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,KAAA,GAAAD,sBAAA,CAAAF,OAAA;AAVA;AACA;AACA;AAGA;AACA;AACA;AAFA,MAAAI,QAAA,GAAAC,OAAA,CAAAD,QAAA;EAAAE,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,MAAA;MAAAC,IAAA;IAAA;IAAAC,IAAA;MAAAD,IAAA;MAAA;IAAA;IAAAE,MAAA;MAAAF,IAAA;MAAA;IAAA;IAAAG,UAAA;MAAAH,IAAA;MAAA;IAAA;EAAA;EAAAI,WAAA;EAAAC,QAAA;IAAAC,IAAA;IAAAC,KAAA;IAAAC,SAAA;IAAAC,OAAA;MAAAC,MAAA;MAAAC,OAAA;MAAAC,6BAAA;QAAAF,MAAA;QAAAC,OAAA;MAAA;IAAA;IAAAE,oBAAA;MAAAC,+BAAA;MAAAC,MAAA;MAAAC,KAAA;MAAAC,KAAA;MAAAC,KAAA;MAAAN,6BAAA;QAAAG,MAAA;MAAA;IAAA;IAAAE,KAAA;MAAAE,IAAA;MAAAC,UAAA;IAAA;IAAAC,MAAA;MAAAC,OAAA;IAAA;IAAAC,aAAA;MAAAC,gBAAA;IAAA;EAAA;EAAAC,SAAA;IAAAC,MAAA;IAAAL,MAAA;MAAAC,OAAA;IAAA;EAAA;EAAAK,WAAA;EAAAT,KAAA;AAAA;AAOA,MAAM;EAAEzB;AAAK,CAAC,GAAGJ,QAAQ;AAACC,OAAA,CAAAG,IAAA,GAAAA,IAAA;AAGnB,MAAMmC,QAAQ,GAAAtC,OAAA,CAAAsC,QAAA,GAAG;EACvBC,IAAI,EAAJA,0BAAI;EACJC,IAAI,EAAJA,aAAI;EACJC,OAAO,EAAE,CAAC;AACX,CAAC;AAEM,MAAMC,IAAI,GAAGA,CAAA,KAAM,IAAAC,kBAAS,EAAE;EAAExC,IAAI;EAAEJ,QAAQ;EAAEuC;AAAS,CAAE,CAAC;AAACtC,OAAA,CAAA0C,IAAA,GAAAA,IAAA","ignoreList":[]}
@@ -175,6 +175,45 @@ function ButtonEdit(props) {
175
175
  const opensInNewTab = linkTarget === _constants.NEW_TAB_TARGET;
176
176
  const nofollow = !!rel?.includes(_constants.NOFOLLOW_REL);
177
177
  const isLinkTag = 'a' === TagName;
178
+ const {
179
+ createPageEntity,
180
+ userCanCreatePages,
181
+ lockUrlControls = false
182
+ } = (0, _data.useSelect)(select => {
183
+ if (!isSelected) {
184
+ return {};
185
+ }
186
+ const _settings = select(_blockEditor.store).getSettings();
187
+ const blockBindingsSource = (0, _blocks.getBlockBindingsSource)(metadata?.bindings?.url?.source);
188
+ return {
189
+ createPageEntity: _settings.__experimentalCreatePageEntity,
190
+ userCanCreatePages: _settings.__experimentalUserCanCreatePages,
191
+ lockUrlControls: !!metadata?.bindings?.url && !blockBindingsSource?.canUserEditValue?.({
192
+ select,
193
+ context,
194
+ args: metadata?.bindings?.url?.args
195
+ })
196
+ };
197
+ }, [context, isSelected, metadata?.bindings?.url]);
198
+ async function handleCreate(pageTitle) {
199
+ const page = await createPageEntity({
200
+ title: pageTitle,
201
+ status: 'draft'
202
+ });
203
+ return {
204
+ id: page.id,
205
+ type: page.type,
206
+ title: page.title.rendered,
207
+ url: page.link,
208
+ kind: 'post-type'
209
+ };
210
+ }
211
+ function createButtonText(searchTerm) {
212
+ return (0, _element.createInterpolateElement)((0, _i18n.sprintf)(/* translators: %s: search term. */
213
+ (0, _i18n.__)('Create page: <mark>%s</mark>'), searchTerm), {
214
+ mark: /*#__PURE__*/(0, _jsxRuntime.jsx)("mark", {})
215
+ });
216
+ }
178
217
  function startEditing(event) {
179
218
  event.preventDefault();
180
219
  setIsEditingURL(true);
@@ -205,21 +244,6 @@ function ButtonEdit(props) {
205
244
  clientId
206
245
  });
207
246
  const mergedRef = (0, _compose.useMergeRefs)([useEnterRef, richTextRef]);
208
- const {
209
- lockUrlControls = false
210
- } = (0, _data.useSelect)(select => {
211
- if (!isSelected) {
212
- return {};
213
- }
214
- const blockBindingsSource = (0, _blocks.getBlockBindingsSource)(metadata?.bindings?.url?.source);
215
- return {
216
- lockUrlControls: !!metadata?.bindings?.url && !blockBindingsSource?.canUserEditValue?.({
217
- select,
218
- context,
219
- args: metadata?.bindings?.url?.args
220
- })
221
- };
222
- }, [context, isSelected, metadata?.bindings?.url]);
223
247
  const [fluidTypographySettings, layout] = (0, _blockEditor.useSettings)('typography.fluid', 'layout');
224
248
  const typographyProps = (0, _blockEditor.getTypographyClassesAndStyles)(attributes, {
225
249
  typography: {
@@ -313,7 +337,10 @@ function ButtonEdit(props) {
313
337
  richTextRef.current?.focus();
314
338
  },
315
339
  forceIsEditingLink: isEditingURL,
316
- settings: LINK_SETTINGS
340
+ settings: LINK_SETTINGS,
341
+ createSuggestion: createPageEntity && handleCreate,
342
+ withCreateSuggestion: userCanCreatePages,
343
+ createSuggestionButtonText: createButtonText
317
344
  })
318
345
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.InspectorControls, {
319
346
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(WidthPanel, {
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_constants","_getUpdatedLinkAttributes","_removeAnchorTag","_hooks","_i18n","_element","_components","_blockEditor","_keycodes","_icons","_blocks","_compose","_data","_jsxRuntime","LINK_SETTINGS","LinkControl","DEFAULT_LINK_SETTINGS","id","title","__","useEnter","props","replaceBlocks","selectionChange","useDispatch","blockEditorStore","getBlock","getBlockRootClientId","getBlockIndex","useSelect","propsRef","useRef","current","useRefEffect","element","onKeyDown","event","defaultPrevented","keyCode","ENTER","content","clientId","length","preventDefault","topParentListBlock","blockIndex","head","cloneBlock","innerBlocks","slice","middle","createBlock","getDefaultBlockName","after","tail","addEventListener","removeEventListener","WidthPanel","selectedWidth","setAttributes","dropdownMenuProps","useToolsPanelDropdownMenuProps","jsx","__experimentalToolsPanel","label","resetAll","width","undefined","children","__experimentalToolsPanelItem","isShownByDefault","hasValue","onDeselect","__nextHasNoMarginBottom","__experimentalToggleGroupControl","value","onChange","newWidth","isBlock","__next40pxDefaultSize","map","widthValue","__experimentalToggleGroupControlOption","sprintf","ButtonEdit","attributes","className","isSelected","onReplace","mergeBlocks","context","tagName","textAlign","linkTarget","placeholder","rel","style","text","url","metadata","TagName","isKeyboardEvent","primary","startEditing","primaryShift","unlink","richTextRef","focus","popoverAnchor","setPopoverAnchor","useState","borderProps","useBorderProps","colorProps","useColorProps","spacingProps","useSpacingProps","shadowProps","useShadowProps","ref","blockProps","useBlockProps","useMergeRefs","blockEditingMode","useBlockEditingMode","isEditingURL","setIsEditingURL","isURLSet","opensInNewTab","NEW_TAB_TARGET","nofollow","includes","NOFOLLOW_REL","isLinkTag","useEffect","linkValue","useMemo","useEnterRef","mergedRef","lockUrlControls","select","blockBindingsSource","getBlockBindingsSource","bindings","source","canUserEditValue","args","fluidTypographySettings","layout","useSettings","typographyProps","useTypographyProps","typography","fluid","wideSize","jsxs","Fragment","clsx","RichText","removeAnchorTag","withoutInteractiveFormatting","border","radius","fontSize","__experimentalGetElementClassName","writingMode","onMerge","identifier","BlockControls","group","AlignmentControl","nextAlign","ToolbarButton","name","icon","link","shortcut","displayShortcut","onClick","linkOff","isActive","Popover","placement","onClose","anchor","focusOnMount","__unstableSlotName","shift","newURL","newOpensInNewTab","newNofollow","getUpdatedLinkAttributes","onRemove","forceIsEditingLink","settings","InspectorControls","TextControl","newRel","_default","exports","default"],"sources":["@wordpress/block-library/src/button/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * Internal dependencies\n */\nimport { NEW_TAB_TARGET, NOFOLLOW_REL } from './constants';\nimport { getUpdatedLinkAttributes } from './get-updated-link-attributes';\nimport removeAnchorTag from '../utils/remove-anchor-tag';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useEffect, useState, useRef, useMemo } from '@wordpress/element';\nimport {\n\tTextControl,\n\tToolbarButton,\n\tPopover,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n} from '@wordpress/components';\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n\tLinkControl,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalUseColorProps as useColorProps,\n\t__experimentalGetSpacingClassesAndStyles as useSpacingProps,\n\t__experimentalGetShadowClassesAndStyles as useShadowProps,\n\t__experimentalGetElementClassName,\n\tstore as blockEditorStore,\n\tuseBlockEditingMode,\n\tgetTypographyClassesAndStyles as useTypographyProps,\n\tuseSettings,\n} from '@wordpress/block-editor';\nimport { displayShortcut, isKeyboardEvent, ENTER } from '@wordpress/keycodes';\nimport { link, linkOff } from '@wordpress/icons';\nimport {\n\tcreateBlock,\n\tcloneBlock,\n\tgetDefaultBlockName,\n\tgetBlockBindingsSource,\n} from '@wordpress/blocks';\nimport { useMergeRefs, useRefEffect } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\nconst LINK_SETTINGS = [\n\t...LinkControl.DEFAULT_LINK_SETTINGS,\n\t{\n\t\tid: 'nofollow',\n\t\ttitle: __( 'Mark as nofollow' ),\n\t},\n];\n\nfunction useEnter( props ) {\n\tconst { replaceBlocks, selectionChange } = useDispatch( blockEditorStore );\n\tconst { getBlock, getBlockRootClientId, getBlockIndex } =\n\t\tuseSelect( blockEditorStore );\n\tconst propsRef = useRef( props );\n\tpropsRef.current = props;\n\treturn useRefEffect( ( element ) => {\n\t\tfunction onKeyDown( event ) {\n\t\t\tif ( event.defaultPrevented || event.keyCode !== ENTER ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst { content, clientId } = propsRef.current;\n\t\t\tif ( content.length ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\t\t\tconst topParentListBlock = getBlock(\n\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t);\n\t\t\tconst blockIndex = getBlockIndex( clientId );\n\t\t\tconst head = cloneBlock( {\n\t\t\t\t...topParentListBlock,\n\t\t\t\tinnerBlocks: topParentListBlock.innerBlocks.slice(\n\t\t\t\t\t0,\n\t\t\t\t\tblockIndex\n\t\t\t\t),\n\t\t\t} );\n\t\t\tconst middle = createBlock( getDefaultBlockName() );\n\t\t\tconst after = topParentListBlock.innerBlocks.slice(\n\t\t\t\tblockIndex + 1\n\t\t\t);\n\t\t\tconst tail = after.length\n\t\t\t\t? [\n\t\t\t\t\t\tcloneBlock( {\n\t\t\t\t\t\t\t...topParentListBlock,\n\t\t\t\t\t\t\tinnerBlocks: after,\n\t\t\t\t\t\t} ),\n\t\t\t\t ]\n\t\t\t\t: [];\n\t\t\treplaceBlocks(\n\t\t\t\ttopParentListBlock.clientId,\n\t\t\t\t[ head, middle, ...tail ],\n\t\t\t\t1\n\t\t\t);\n\t\t\t// We manually change the selection here because we are replacing\n\t\t\t// a different block than the selected one.\n\t\t\tselectionChange( middle.clientId );\n\t\t}\n\n\t\telement.addEventListener( 'keydown', onKeyDown );\n\t\treturn () => {\n\t\t\telement.removeEventListener( 'keydown', onKeyDown );\n\t\t};\n\t}, [] );\n}\n\nfunction WidthPanel( { selectedWidth, setAttributes } ) {\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\treturn (\n\t\t<ToolsPanel\n\t\t\tlabel={ __( 'Settings' ) }\n\t\t\tresetAll={ () => setAttributes( { width: undefined } ) }\n\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t>\n\t\t\t<ToolsPanelItem\n\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\tisShownByDefault\n\t\t\t\thasValue={ () => !! selectedWidth }\n\t\t\t\tonDeselect={ () => setAttributes( { width: undefined } ) }\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t>\n\t\t\t\t<ToggleGroupControl\n\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\tvalue={ selectedWidth }\n\t\t\t\t\tonChange={ ( newWidth ) =>\n\t\t\t\t\t\tsetAttributes( { width: newWidth } )\n\t\t\t\t\t}\n\t\t\t\t\tisBlock\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t>\n\t\t\t\t\t{ [ 25, 50, 75, 100 ].map( ( widthValue ) => {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tkey={ widthValue }\n\t\t\t\t\t\t\t\tvalue={ widthValue }\n\t\t\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: Percentage value. */\n\t\t\t\t\t\t\t\t\t__( '%d%%' ),\n\t\t\t\t\t\t\t\t\twidthValue\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t\t</ToggleGroupControl>\n\t\t\t</ToolsPanelItem>\n\t\t</ToolsPanel>\n\t);\n}\n\nfunction ButtonEdit( props ) {\n\tconst {\n\t\tattributes,\n\t\tsetAttributes,\n\t\tclassName,\n\t\tisSelected,\n\t\tonReplace,\n\t\tmergeBlocks,\n\t\tclientId,\n\t\tcontext,\n\t} = props;\n\tconst {\n\t\ttagName,\n\t\ttextAlign,\n\t\tlinkTarget,\n\t\tplaceholder,\n\t\trel,\n\t\tstyle,\n\t\ttext,\n\t\turl,\n\t\twidth,\n\t\tmetadata,\n\t} = attributes;\n\n\tconst TagName = tagName || 'a';\n\n\tfunction onKeyDown( event ) {\n\t\tif ( isKeyboardEvent.primary( event, 'k' ) ) {\n\t\t\tstartEditing( event );\n\t\t} else if ( isKeyboardEvent.primaryShift( event, 'k' ) ) {\n\t\t\tunlink();\n\t\t\trichTextRef.current?.focus();\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\n\tconst borderProps = useBorderProps( attributes );\n\tconst colorProps = useColorProps( attributes );\n\tconst spacingProps = useSpacingProps( attributes );\n\tconst shadowProps = useShadowProps( attributes );\n\tconst ref = useRef();\n\tconst richTextRef = useRef();\n\tconst blockProps = useBlockProps( {\n\t\tref: useMergeRefs( [ setPopoverAnchor, ref ] ),\n\t\tonKeyDown,\n\t} );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst [ isEditingURL, setIsEditingURL ] = useState( false );\n\tconst isURLSet = !! url;\n\tconst opensInNewTab = linkTarget === NEW_TAB_TARGET;\n\tconst nofollow = !! rel?.includes( NOFOLLOW_REL );\n\tconst isLinkTag = 'a' === TagName;\n\n\tfunction startEditing( event ) {\n\t\tevent.preventDefault();\n\t\tsetIsEditingURL( true );\n\t}\n\n\tfunction unlink() {\n\t\tsetAttributes( {\n\t\t\turl: undefined,\n\t\t\tlinkTarget: undefined,\n\t\t\trel: undefined,\n\t\t} );\n\t\tsetIsEditingURL( false );\n\t}\n\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsEditingURL( false );\n\t\t}\n\t}, [ isSelected ] );\n\n\t// Memoize link value to avoid overriding the LinkControl's internal state.\n\t// This is a temporary fix. See https://github.com/WordPress/gutenberg/issues/51256.\n\tconst linkValue = useMemo(\n\t\t() => ( { url, opensInNewTab, nofollow } ),\n\t\t[ url, opensInNewTab, nofollow ]\n\t);\n\n\tconst useEnterRef = useEnter( { content: text, clientId } );\n\tconst mergedRef = useMergeRefs( [ useEnterRef, richTextRef ] );\n\n\tconst { lockUrlControls = false } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! isSelected ) {\n\t\t\t\treturn {};\n\t\t\t}\n\n\t\t\tconst blockBindingsSource = getBlockBindingsSource(\n\t\t\t\tmetadata?.bindings?.url?.source\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tlockUrlControls:\n\t\t\t\t\t!! metadata?.bindings?.url &&\n\t\t\t\t\t! blockBindingsSource?.canUserEditValue?.( {\n\t\t\t\t\t\tselect,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\targs: metadata?.bindings?.url?.args,\n\t\t\t\t\t} ),\n\t\t\t};\n\t\t},\n\t\t[ context, isSelected, metadata?.bindings?.url ]\n\t);\n\n\tconst [ fluidTypographySettings, layout ] = useSettings(\n\t\t'typography.fluid',\n\t\t'layout'\n\t);\n\tconst typographyProps = useTypographyProps( attributes, {\n\t\ttypography: {\n\t\t\tfluid: fluidTypographySettings,\n\t\t},\n\t\tlayout: {\n\t\t\twideSize: layout?.wideSize,\n\t\t},\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<div\n\t\t\t\t{ ...blockProps }\n\t\t\t\tclassName={ clsx( blockProps.className, {\n\t\t\t\t\t[ `has-custom-width wp-block-button__width-${ width }` ]:\n\t\t\t\t\t\twidth,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t<RichText\n\t\t\t\t\tref={ mergedRef }\n\t\t\t\t\taria-label={ __( 'Button text' ) }\n\t\t\t\t\tplaceholder={ placeholder || __( 'Add text…' ) }\n\t\t\t\t\tvalue={ text }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\ttext: removeAnchorTag( value ),\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t'wp-block-button__link',\n\t\t\t\t\t\tcolorProps.className,\n\t\t\t\t\t\tborderProps.className,\n\t\t\t\t\t\ttypographyProps.className,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t\t\t\t\t\t// For backwards compatibility add style that isn't\n\t\t\t\t\t\t\t// provided via block support.\n\t\t\t\t\t\t\t'no-border-radius': style?.border?.radius === 0,\n\t\t\t\t\t\t\t[ `has-custom-font-size` ]:\n\t\t\t\t\t\t\t\tblockProps.style.fontSize,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t__experimentalGetElementClassName( 'button' )\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t\t...colorProps.style,\n\t\t\t\t\t\t...spacingProps.style,\n\t\t\t\t\t\t...shadowProps.style,\n\t\t\t\t\t\t...typographyProps.style,\n\t\t\t\t\t\twritingMode: undefined,\n\t\t\t\t\t} }\n\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\tonMerge={ mergeBlocks }\n\t\t\t\t\tidentifier=\"text\"\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t{ blockEditingMode === 'default' && (\n\t\t\t\t\t<AlignmentControl\n\t\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\t\tsetAttributes( { textAlign: nextAlign } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! isURLSet && isLinkTag && ! lockUrlControls && (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tname=\"link\"\n\t\t\t\t\t\ticon={ link }\n\t\t\t\t\t\ttitle={ __( 'Link' ) }\n\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t\tonClick={ startEditing }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ isURLSet && isLinkTag && ! lockUrlControls && (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tname=\"link\"\n\t\t\t\t\t\ticon={ linkOff }\n\t\t\t\t\t\ttitle={ __( 'Unlink' ) }\n\t\t\t\t\t\tshortcut={ displayShortcut.primaryShift( 'k' ) }\n\t\t\t\t\t\tonClick={ unlink }\n\t\t\t\t\t\tisActive\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BlockControls>\n\t\t\t{ isLinkTag &&\n\t\t\t\tisSelected &&\n\t\t\t\t( isEditingURL || isURLSet ) &&\n\t\t\t\t! lockUrlControls && (\n\t\t\t\t\t<Popover\n\t\t\t\t\t\tplacement=\"bottom\"\n\t\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\t\tsetIsEditingURL( false );\n\t\t\t\t\t\t\trichTextRef.current?.focus();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\t\tfocusOnMount={ isEditingURL ? 'firstElement' : false }\n\t\t\t\t\t\t__unstableSlotName=\"__unstable-block-tools-after\"\n\t\t\t\t\t\tshift\n\t\t\t\t\t>\n\t\t\t\t\t\t<LinkControl\n\t\t\t\t\t\t\tvalue={ linkValue }\n\t\t\t\t\t\t\tonChange={ ( {\n\t\t\t\t\t\t\t\turl: newURL,\n\t\t\t\t\t\t\t\topensInNewTab: newOpensInNewTab,\n\t\t\t\t\t\t\t\tnofollow: newNofollow,\n\t\t\t\t\t\t\t} ) =>\n\t\t\t\t\t\t\t\tsetAttributes(\n\t\t\t\t\t\t\t\t\tgetUpdatedLinkAttributes( {\n\t\t\t\t\t\t\t\t\t\trel,\n\t\t\t\t\t\t\t\t\t\turl: newURL,\n\t\t\t\t\t\t\t\t\t\topensInNewTab: newOpensInNewTab,\n\t\t\t\t\t\t\t\t\t\tnofollow: newNofollow,\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\tonRemove={ () => {\n\t\t\t\t\t\t\t\tunlink();\n\t\t\t\t\t\t\t\trichTextRef.current?.focus();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tforceIsEditingLink={ isEditingURL }\n\t\t\t\t\t\t\tsettings={ LINK_SETTINGS }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Popover>\n\t\t\t\t) }\n\t\t\t<InspectorControls>\n\t\t\t\t<WidthPanel\n\t\t\t\t\tselectedWidth={ width }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t{ isLinkTag && (\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\t\tonChange={ ( newRel ) =>\n\t\t\t\t\t\t\tsetAttributes( { rel: newRel } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n}\n\nexport default ButtonEdit;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,yBAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAJ,sBAAA,C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AE0F,MAAM;UACX5D,aAAa,EAAE6D,gBAAgB;UAC/B3D,QAAQ,EAAE4D;QACX,CAAC,KACAnI,aAAa,CACZ,IAAAoI,kDAAwB,EAAE;UACzBhG,GAAG;UACHG,GAAG,EAAE0F,MAAM;UACX5D,aAAa,EAAE6D,gBAAgB;UAC/B3D,QAAQ,EAAE4D;QACX,CAAE,CACH,CACA;QACDE,QAAQ,EAAGA,CAAA,KAAM;UAChBvF,MAAM,CAAC,CAAC;UACRC,WAAW,CAAC1E,OAAO,EAAE2E,KAAK,CAAC,CAAC;QAC7B,CAAG;QACHsF,kBAAkB,EAAGpE,YAAc;QACnCqE,QAAQ,EAAGpL;MAAe,CAC1B;IAAC,CACM,CACT,eACF,IAAAD,WAAA,CAAAiD,GAAA,EAACvD,YAAA,CAAA4L,iBAAiB;MAAA/H,QAAA,eACjB,IAAAvD,WAAA,CAAAiD,GAAA,EAACL,UAAU;QACVC,aAAa,EAAGQ,KAAO;QACvBP,aAAa,EAAGA;MAAe,CAC/B;IAAC,CACgB,CAAC,eACpB,IAAA9C,WAAA,CAAAiD,GAAA,EAACvD,YAAA,CAAA4L,iBAAiB;MAAC1B,KAAK,EAAC,UAAU;MAAArG,QAAA,EAChCiE,SAAS,iBACV,IAAAxH,WAAA,CAAAiD,GAAA,EAACxD,WAAA,CAAA8L,WAAW;QACXrH,qBAAqB;QACrBN,uBAAuB;QACvBT,KAAK,EAAG,IAAA7C,QAAE,EAAE,UAAW,CAAG;QAC1BwD,KAAK,EAAGoB,GAAG,IAAI,EAAI;QACnBnB,QAAQ,EAAKyH,MAAM,IAClB1I,aAAa,CAAE;UAAEoC,GAAG,EAAEsG;QAAO,CAAE;MAC/B,CACD;IACD,CACiB,CAAC;EAAA,CACnB,CAAC;AAEL;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcpH,UAAU","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_constants","_getUpdatedLinkAttributes","_removeAnchorTag","_hooks","_i18n","_element","_components","_blockEditor","_keycodes","_icons","_blocks","_compose","_data","_jsxRuntime","LINK_SETTINGS","LinkControl","DEFAULT_LINK_SETTINGS","id","title","__","useEnter","props","replaceBlocks","selectionChange","useDispatch","blockEditorStore","getBlock","getBlockRootClientId","getBlockIndex","useSelect","propsRef","useRef","current","useRefEffect","element","onKeyDown","event","defaultPrevented","keyCode","ENTER","content","clientId","length","preventDefault","topParentListBlock","blockIndex","head","cloneBlock","innerBlocks","slice","middle","createBlock","getDefaultBlockName","after","tail","addEventListener","removeEventListener","WidthPanel","selectedWidth","setAttributes","dropdownMenuProps","useToolsPanelDropdownMenuProps","jsx","__experimentalToolsPanel","label","resetAll","width","undefined","children","__experimentalToolsPanelItem","isShownByDefault","hasValue","onDeselect","__nextHasNoMarginBottom","__experimentalToggleGroupControl","value","onChange","newWidth","isBlock","__next40pxDefaultSize","map","widthValue","__experimentalToggleGroupControlOption","sprintf","ButtonEdit","attributes","className","isSelected","onReplace","mergeBlocks","context","tagName","textAlign","linkTarget","placeholder","rel","style","text","url","metadata","TagName","isKeyboardEvent","primary","startEditing","primaryShift","unlink","richTextRef","focus","popoverAnchor","setPopoverAnchor","useState","borderProps","useBorderProps","colorProps","useColorProps","spacingProps","useSpacingProps","shadowProps","useShadowProps","ref","blockProps","useBlockProps","useMergeRefs","blockEditingMode","useBlockEditingMode","isEditingURL","setIsEditingURL","isURLSet","opensInNewTab","NEW_TAB_TARGET","nofollow","includes","NOFOLLOW_REL","isLinkTag","createPageEntity","userCanCreatePages","lockUrlControls","select","_settings","getSettings","blockBindingsSource","getBlockBindingsSource","bindings","source","__experimentalCreatePageEntity","__experimentalUserCanCreatePages","canUserEditValue","args","handleCreate","pageTitle","page","status","type","rendered","link","kind","createButtonText","searchTerm","createInterpolateElement","mark","useEffect","linkValue","useMemo","useEnterRef","mergedRef","fluidTypographySettings","layout","useSettings","typographyProps","useTypographyProps","typography","fluid","wideSize","jsxs","Fragment","clsx","RichText","removeAnchorTag","withoutInteractiveFormatting","border","radius","fontSize","__experimentalGetElementClassName","writingMode","onMerge","identifier","BlockControls","group","AlignmentControl","nextAlign","ToolbarButton","name","icon","shortcut","displayShortcut","onClick","linkOff","isActive","Popover","placement","onClose","anchor","focusOnMount","__unstableSlotName","shift","newURL","newOpensInNewTab","newNofollow","getUpdatedLinkAttributes","onRemove","forceIsEditingLink","settings","createSuggestion","withCreateSuggestion","createSuggestionButtonText","InspectorControls","TextControl","newRel","_default","exports","default"],"sources":["@wordpress/block-library/src/button/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * Internal dependencies\n */\nimport { NEW_TAB_TARGET, NOFOLLOW_REL } from './constants';\nimport { getUpdatedLinkAttributes } from './get-updated-link-attributes';\nimport removeAnchorTag from '../utils/remove-anchor-tag';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tuseEffect,\n\tuseState,\n\tuseRef,\n\tuseMemo,\n\tcreateInterpolateElement,\n} from '@wordpress/element';\nimport {\n\tTextControl,\n\tToolbarButton,\n\tPopover,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n} from '@wordpress/components';\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n\tLinkControl,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalUseColorProps as useColorProps,\n\t__experimentalGetSpacingClassesAndStyles as useSpacingProps,\n\t__experimentalGetShadowClassesAndStyles as useShadowProps,\n\t__experimentalGetElementClassName,\n\tstore as blockEditorStore,\n\tuseBlockEditingMode,\n\tgetTypographyClassesAndStyles as useTypographyProps,\n\tuseSettings,\n} from '@wordpress/block-editor';\nimport { displayShortcut, isKeyboardEvent, ENTER } from '@wordpress/keycodes';\nimport { link, linkOff } from '@wordpress/icons';\nimport {\n\tcreateBlock,\n\tcloneBlock,\n\tgetDefaultBlockName,\n\tgetBlockBindingsSource,\n} from '@wordpress/blocks';\nimport { useMergeRefs, useRefEffect } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\nconst LINK_SETTINGS = [\n\t...LinkControl.DEFAULT_LINK_SETTINGS,\n\t{\n\t\tid: 'nofollow',\n\t\ttitle: __( 'Mark as nofollow' ),\n\t},\n];\n\nfunction useEnter( props ) {\n\tconst { replaceBlocks, selectionChange } = useDispatch( blockEditorStore );\n\tconst { getBlock, getBlockRootClientId, getBlockIndex } =\n\t\tuseSelect( blockEditorStore );\n\tconst propsRef = useRef( props );\n\tpropsRef.current = props;\n\treturn useRefEffect( ( element ) => {\n\t\tfunction onKeyDown( event ) {\n\t\t\tif ( event.defaultPrevented || event.keyCode !== ENTER ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst { content, clientId } = propsRef.current;\n\t\t\tif ( content.length ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\t\t\tconst topParentListBlock = getBlock(\n\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t);\n\t\t\tconst blockIndex = getBlockIndex( clientId );\n\t\t\tconst head = cloneBlock( {\n\t\t\t\t...topParentListBlock,\n\t\t\t\tinnerBlocks: topParentListBlock.innerBlocks.slice(\n\t\t\t\t\t0,\n\t\t\t\t\tblockIndex\n\t\t\t\t),\n\t\t\t} );\n\t\t\tconst middle = createBlock( getDefaultBlockName() );\n\t\t\tconst after = topParentListBlock.innerBlocks.slice(\n\t\t\t\tblockIndex + 1\n\t\t\t);\n\t\t\tconst tail = after.length\n\t\t\t\t? [\n\t\t\t\t\t\tcloneBlock( {\n\t\t\t\t\t\t\t...topParentListBlock,\n\t\t\t\t\t\t\tinnerBlocks: after,\n\t\t\t\t\t\t} ),\n\t\t\t\t ]\n\t\t\t\t: [];\n\t\t\treplaceBlocks(\n\t\t\t\ttopParentListBlock.clientId,\n\t\t\t\t[ head, middle, ...tail ],\n\t\t\t\t1\n\t\t\t);\n\t\t\t// We manually change the selection here because we are replacing\n\t\t\t// a different block than the selected one.\n\t\t\tselectionChange( middle.clientId );\n\t\t}\n\n\t\telement.addEventListener( 'keydown', onKeyDown );\n\t\treturn () => {\n\t\t\telement.removeEventListener( 'keydown', onKeyDown );\n\t\t};\n\t}, [] );\n}\n\nfunction WidthPanel( { selectedWidth, setAttributes } ) {\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\treturn (\n\t\t<ToolsPanel\n\t\t\tlabel={ __( 'Settings' ) }\n\t\t\tresetAll={ () => setAttributes( { width: undefined } ) }\n\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t>\n\t\t\t<ToolsPanelItem\n\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\tisShownByDefault\n\t\t\t\thasValue={ () => !! selectedWidth }\n\t\t\t\tonDeselect={ () => setAttributes( { width: undefined } ) }\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t>\n\t\t\t\t<ToggleGroupControl\n\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\tvalue={ selectedWidth }\n\t\t\t\t\tonChange={ ( newWidth ) =>\n\t\t\t\t\t\tsetAttributes( { width: newWidth } )\n\t\t\t\t\t}\n\t\t\t\t\tisBlock\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t>\n\t\t\t\t\t{ [ 25, 50, 75, 100 ].map( ( widthValue ) => {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tkey={ widthValue }\n\t\t\t\t\t\t\t\tvalue={ widthValue }\n\t\t\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: Percentage value. */\n\t\t\t\t\t\t\t\t\t__( '%d%%' ),\n\t\t\t\t\t\t\t\t\twidthValue\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t\t</ToggleGroupControl>\n\t\t\t</ToolsPanelItem>\n\t\t</ToolsPanel>\n\t);\n}\n\nfunction ButtonEdit( props ) {\n\tconst {\n\t\tattributes,\n\t\tsetAttributes,\n\t\tclassName,\n\t\tisSelected,\n\t\tonReplace,\n\t\tmergeBlocks,\n\t\tclientId,\n\t\tcontext,\n\t} = props;\n\tconst {\n\t\ttagName,\n\t\ttextAlign,\n\t\tlinkTarget,\n\t\tplaceholder,\n\t\trel,\n\t\tstyle,\n\t\ttext,\n\t\turl,\n\t\twidth,\n\t\tmetadata,\n\t} = attributes;\n\n\tconst TagName = tagName || 'a';\n\n\tfunction onKeyDown( event ) {\n\t\tif ( isKeyboardEvent.primary( event, 'k' ) ) {\n\t\t\tstartEditing( event );\n\t\t} else if ( isKeyboardEvent.primaryShift( event, 'k' ) ) {\n\t\t\tunlink();\n\t\t\trichTextRef.current?.focus();\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\n\tconst borderProps = useBorderProps( attributes );\n\tconst colorProps = useColorProps( attributes );\n\tconst spacingProps = useSpacingProps( attributes );\n\tconst shadowProps = useShadowProps( attributes );\n\tconst ref = useRef();\n\tconst richTextRef = useRef();\n\tconst blockProps = useBlockProps( {\n\t\tref: useMergeRefs( [ setPopoverAnchor, ref ] ),\n\t\tonKeyDown,\n\t} );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst [ isEditingURL, setIsEditingURL ] = useState( false );\n\tconst isURLSet = !! url;\n\tconst opensInNewTab = linkTarget === NEW_TAB_TARGET;\n\tconst nofollow = !! rel?.includes( NOFOLLOW_REL );\n\tconst isLinkTag = 'a' === TagName;\n\n\tconst {\n\t\tcreatePageEntity,\n\t\tuserCanCreatePages,\n\t\tlockUrlControls = false,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! isSelected ) {\n\t\t\t\treturn {};\n\t\t\t}\n\n\t\t\tconst _settings = select( blockEditorStore ).getSettings();\n\n\t\t\tconst blockBindingsSource = getBlockBindingsSource(\n\t\t\t\tmetadata?.bindings?.url?.source\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tcreatePageEntity: _settings.__experimentalCreatePageEntity,\n\t\t\t\tuserCanCreatePages: _settings.__experimentalUserCanCreatePages,\n\t\t\t\tlockUrlControls:\n\t\t\t\t\t!! metadata?.bindings?.url &&\n\t\t\t\t\t! blockBindingsSource?.canUserEditValue?.( {\n\t\t\t\t\t\tselect,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\targs: metadata?.bindings?.url?.args,\n\t\t\t\t\t} ),\n\t\t\t};\n\t\t},\n\t\t[ context, isSelected, metadata?.bindings?.url ]\n\t);\n\n\tasync function handleCreate( pageTitle ) {\n\t\tconst page = await createPageEntity( {\n\t\t\ttitle: pageTitle,\n\t\t\tstatus: 'draft',\n\t\t} );\n\n\t\treturn {\n\t\t\tid: page.id,\n\t\t\ttype: page.type,\n\t\t\ttitle: page.title.rendered,\n\t\t\turl: page.link,\n\t\t\tkind: 'post-type',\n\t\t};\n\t}\n\n\tfunction createButtonText( searchTerm ) {\n\t\treturn createInterpolateElement(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t__( 'Create page: <mark>%s</mark>' ),\n\t\t\t\tsearchTerm\n\t\t\t),\n\t\t\t{ mark: <mark /> }\n\t\t);\n\t}\n\n\tfunction startEditing( event ) {\n\t\tevent.preventDefault();\n\t\tsetIsEditingURL( true );\n\t}\n\n\tfunction unlink() {\n\t\tsetAttributes( {\n\t\t\turl: undefined,\n\t\t\tlinkTarget: undefined,\n\t\t\trel: undefined,\n\t\t} );\n\t\tsetIsEditingURL( false );\n\t}\n\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsEditingURL( false );\n\t\t}\n\t}, [ isSelected ] );\n\n\t// Memoize link value to avoid overriding the LinkControl's internal state.\n\t// This is a temporary fix. See https://github.com/WordPress/gutenberg/issues/51256.\n\tconst linkValue = useMemo(\n\t\t() => ( { url, opensInNewTab, nofollow } ),\n\t\t[ url, opensInNewTab, nofollow ]\n\t);\n\n\tconst useEnterRef = useEnter( { content: text, clientId } );\n\tconst mergedRef = useMergeRefs( [ useEnterRef, richTextRef ] );\n\n\tconst [ fluidTypographySettings, layout ] = useSettings(\n\t\t'typography.fluid',\n\t\t'layout'\n\t);\n\tconst typographyProps = useTypographyProps( attributes, {\n\t\ttypography: {\n\t\t\tfluid: fluidTypographySettings,\n\t\t},\n\t\tlayout: {\n\t\t\twideSize: layout?.wideSize,\n\t\t},\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<div\n\t\t\t\t{ ...blockProps }\n\t\t\t\tclassName={ clsx( blockProps.className, {\n\t\t\t\t\t[ `has-custom-width wp-block-button__width-${ width }` ]:\n\t\t\t\t\t\twidth,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t<RichText\n\t\t\t\t\tref={ mergedRef }\n\t\t\t\t\taria-label={ __( 'Button text' ) }\n\t\t\t\t\tplaceholder={ placeholder || __( 'Add text…' ) }\n\t\t\t\t\tvalue={ text }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\ttext: removeAnchorTag( value ),\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t'wp-block-button__link',\n\t\t\t\t\t\tcolorProps.className,\n\t\t\t\t\t\tborderProps.className,\n\t\t\t\t\t\ttypographyProps.className,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t\t\t\t\t\t// For backwards compatibility add style that isn't\n\t\t\t\t\t\t\t// provided via block support.\n\t\t\t\t\t\t\t'no-border-radius': style?.border?.radius === 0,\n\t\t\t\t\t\t\t[ `has-custom-font-size` ]:\n\t\t\t\t\t\t\t\tblockProps.style.fontSize,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t__experimentalGetElementClassName( 'button' )\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t\t...colorProps.style,\n\t\t\t\t\t\t...spacingProps.style,\n\t\t\t\t\t\t...shadowProps.style,\n\t\t\t\t\t\t...typographyProps.style,\n\t\t\t\t\t\twritingMode: undefined,\n\t\t\t\t\t} }\n\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\tonMerge={ mergeBlocks }\n\t\t\t\t\tidentifier=\"text\"\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t{ blockEditingMode === 'default' && (\n\t\t\t\t\t<AlignmentControl\n\t\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\t\tsetAttributes( { textAlign: nextAlign } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! isURLSet && isLinkTag && ! lockUrlControls && (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tname=\"link\"\n\t\t\t\t\t\ticon={ link }\n\t\t\t\t\t\ttitle={ __( 'Link' ) }\n\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t\tonClick={ startEditing }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ isURLSet && isLinkTag && ! lockUrlControls && (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tname=\"link\"\n\t\t\t\t\t\ticon={ linkOff }\n\t\t\t\t\t\ttitle={ __( 'Unlink' ) }\n\t\t\t\t\t\tshortcut={ displayShortcut.primaryShift( 'k' ) }\n\t\t\t\t\t\tonClick={ unlink }\n\t\t\t\t\t\tisActive\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BlockControls>\n\t\t\t{ isLinkTag &&\n\t\t\t\tisSelected &&\n\t\t\t\t( isEditingURL || isURLSet ) &&\n\t\t\t\t! lockUrlControls && (\n\t\t\t\t\t<Popover\n\t\t\t\t\t\tplacement=\"bottom\"\n\t\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\t\tsetIsEditingURL( false );\n\t\t\t\t\t\t\trichTextRef.current?.focus();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\t\tfocusOnMount={ isEditingURL ? 'firstElement' : false }\n\t\t\t\t\t\t__unstableSlotName=\"__unstable-block-tools-after\"\n\t\t\t\t\t\tshift\n\t\t\t\t\t>\n\t\t\t\t\t\t<LinkControl\n\t\t\t\t\t\t\tvalue={ linkValue }\n\t\t\t\t\t\t\tonChange={ ( {\n\t\t\t\t\t\t\t\turl: newURL,\n\t\t\t\t\t\t\t\topensInNewTab: newOpensInNewTab,\n\t\t\t\t\t\t\t\tnofollow: newNofollow,\n\t\t\t\t\t\t\t} ) =>\n\t\t\t\t\t\t\t\tsetAttributes(\n\t\t\t\t\t\t\t\t\tgetUpdatedLinkAttributes( {\n\t\t\t\t\t\t\t\t\t\trel,\n\t\t\t\t\t\t\t\t\t\turl: newURL,\n\t\t\t\t\t\t\t\t\t\topensInNewTab: newOpensInNewTab,\n\t\t\t\t\t\t\t\t\t\tnofollow: newNofollow,\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\tonRemove={ () => {\n\t\t\t\t\t\t\t\tunlink();\n\t\t\t\t\t\t\t\trichTextRef.current?.focus();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tforceIsEditingLink={ isEditingURL }\n\t\t\t\t\t\t\tsettings={ LINK_SETTINGS }\n\t\t\t\t\t\t\tcreateSuggestion={\n\t\t\t\t\t\t\t\tcreatePageEntity && handleCreate\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\twithCreateSuggestion={ userCanCreatePages }\n\t\t\t\t\t\t\tcreateSuggestionButtonText={ createButtonText }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Popover>\n\t\t\t\t) }\n\t\t\t<InspectorControls>\n\t\t\t\t<WidthPanel\n\t\t\t\t\tselectedWidth={ width }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t{ isLinkTag && (\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\t\tonChange={ ( newRel ) =>\n\t\t\t\t\t\t\tsetAttributes( { rel: newRel } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n}\n\nexport default ButtonEdit;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,yBAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAKA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAOA,IAAAO,WAAA,GAAAP,OAAA;AASA,IAAAQ,YAAA,GAAAR,OAAA;AAiBA,IAAAS,SAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,OAAA,GAAAX,OAAA;AAMA,IAAAY,QAAA,GAAAZ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,KAAO;QACvBP,aAAa,EAAGA;MAAe,CAC/B;IAAC,CACgB,CAAC,eACpB,IAAA9C,WAAA,CAAAiD,GAAA,EAACvD,YAAA,CAAAgN,iBAAiB;MAAC5B,KAAK,EAAC,UAAU;MAAAvH,QAAA,EAChCiE,SAAS,iBACV,IAAAxH,WAAA,CAAAiD,GAAA,EAACxD,WAAA,CAAAkN,WAAW;QACXzI,qBAAqB;QACrBN,uBAAuB;QACvBT,KAAK,EAAG,IAAA7C,QAAE,EAAE,UAAW,CAAG;QAC1BwD,KAAK,EAAGoB,GAAG,IAAI,EAAI;QACnBnB,QAAQ,EAAK6I,MAAM,IAClB9J,aAAa,CAAE;UAAEoC,GAAG,EAAE0H;QAAO,CAAE;MAC/B,CACD;IACD,CACiB,CAAC;EAAA,CACnB,CAAC;AAEL;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcxI,UAAU","ignoreList":[]}
@@ -127,6 +127,12 @@ const useDefaultPageIndex = ({
127
127
  ...defaultPages,
128
128
  [key]: pages <= 1 ? 1 : pages // If there are 0 pages, it means that there are no comments, but there is no 0th page.
129
129
  });
130
+ }).catch(() => {
131
+ // There's no 0th page, but we can't know the number of pages, fallback to 1.
132
+ setDefaultPages({
133
+ ...defaultPages,
134
+ [key]: 1
135
+ });
130
136
  });
131
137
  }, [defaultPage, postId, perPage, setDefaultPages]);
132
138
 
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_data","_blockEditor","_url","_apiFetch","_interopRequireDefault","MAX_COMMENTS_PER_PAGE","useCommentQueryArgs","postId","queryArgs","status","order","context","parent","_embed","pageComments","commentsPerPage","defaultCommentsPage","defaultPage","useSelect","select","getSettings","blockEditorStore","__experimentalDiscussionSettings","perPage","Math","min","page","useDefaultPageIndex","useMemo","post","per_page","exports","defaultPages","setDefaultPages","useState","key","useEffect","apiFetch","path","addQueryArgs","_fields","method","parse","then","res","pages","parseInt","headers","get","useCommentTree","topLevelComments","commentTree","map","id","_embedded","children","commentId","child"],"sources":["@wordpress/block-library/src/comment-template/hooks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useEffect, useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { addQueryArgs } from '@wordpress/url';\nimport apiFetch from '@wordpress/api-fetch';\n\n// This is limited by WP REST API\nconst MAX_COMMENTS_PER_PAGE = 100;\n\n/**\n * Return an object with the query args needed to fetch the default page of\n * comments.\n *\n * @param {Object} props Hook props.\n * @param {number} props.postId ID of the post that contains the comments.\n * discussion settings.\n *\n * @return {Object} Query args to retrieve the comments.\n */\nexport const useCommentQueryArgs = ( { postId } ) => {\n\t// Initialize the query args that are not going to change.\n\tconst queryArgs = {\n\t\tstatus: 'approve',\n\t\torder: 'asc',\n\t\tcontext: 'embed',\n\t\tparent: 0,\n\t\t_embed: 'children',\n\t};\n\n\t// Get the Discussion settings that may be needed to query the comments.\n\tconst {\n\t\tpageComments,\n\t\tcommentsPerPage,\n\t\tdefaultCommentsPage: defaultPage,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { __experimentalDiscussionSettings } = getSettings();\n\t\treturn __experimentalDiscussionSettings;\n\t} );\n\n\t// WP REST API doesn't allow fetching more than max items limit set per single page of data.\n\t// As for the editor performance is more important than completeness of data and fetching only the\n\t// max allowed for single page should be enough for the purpose of design and laying out the page.\n\t// Fetching over the limit would return an error here but would work with backend query.\n\tconst perPage = pageComments\n\t\t? Math.min( commentsPerPage, MAX_COMMENTS_PER_PAGE )\n\t\t: MAX_COMMENTS_PER_PAGE;\n\n\t// Get the number of the default page.\n\tconst page = useDefaultPageIndex( {\n\t\tdefaultPage,\n\t\tpostId,\n\t\tperPage,\n\t\tqueryArgs,\n\t} );\n\n\t// Merge, memoize and return all query arguments, unless the default page's\n\t// number is not known yet.\n\treturn useMemo( () => {\n\t\treturn page\n\t\t\t? {\n\t\t\t\t\t...queryArgs,\n\t\t\t\t\tpost: postId,\n\t\t\t\t\tper_page: perPage,\n\t\t\t\t\tpage,\n\t\t\t }\n\t\t\t: null;\n\t}, [ postId, perPage, page ] );\n};\n\n/**\n * Return the index of the default page, depending on whether `defaultPage` is\n * `newest` or `oldest`. In the first case, the only way to know the page's\n * index is by using the `X-WP-TotalPages` header, which forces to make an\n * additional request.\n *\n * @param {Object} props Hook props.\n * @param {string} props.defaultPage Page shown by default (newest/oldest).\n * @param {number} props.postId ID of the post that contains the comments.\n * @param {number} props.perPage The number of comments included per page.\n * @param {Object} props.queryArgs Other query args.\n *\n * @return {number} Index of the default comments page.\n */\nconst useDefaultPageIndex = ( { defaultPage, postId, perPage, queryArgs } ) => {\n\t// Store the default page indices.\n\tconst [ defaultPages, setDefaultPages ] = useState( {} );\n\tconst key = `${ postId }_${ perPage }`;\n\tconst page = defaultPages[ key ] || 0;\n\n\tuseEffect( () => {\n\t\t// Do nothing if the page is already known or not the newest page.\n\t\tif ( page || defaultPage !== 'newest' ) {\n\t\t\treturn;\n\t\t}\n\t\t// We need to fetch comments to know the index. Use HEAD and limit\n\t\t// fields just to ID, to make this call as light as possible.\n\t\tapiFetch( {\n\t\t\tpath: addQueryArgs( '/wp/v2/comments', {\n\t\t\t\t...queryArgs,\n\t\t\t\tpost: postId,\n\t\t\t\tper_page: perPage,\n\t\t\t\t_fields: 'id',\n\t\t\t} ),\n\t\t\tmethod: 'HEAD',\n\t\t\tparse: false,\n\t\t} ).then( ( res ) => {\n\t\t\tconst pages = parseInt( res.headers.get( 'X-WP-TotalPages' ) );\n\t\t\tsetDefaultPages( {\n\t\t\t\t...defaultPages,\n\t\t\t\t[ key ]: pages <= 1 ? 1 : pages, // If there are 0 pages, it means that there are no comments, but there is no 0th page.\n\t\t\t} );\n\t\t} );\n\t}, [ defaultPage, postId, perPage, setDefaultPages ] );\n\n\t// The oldest one is always the first one.\n\treturn defaultPage === 'newest' ? page : 1;\n};\n\n/**\n * Generate a tree structure of comment IDs from a list of comment entities. The\n * children of each comment are obtained from `_embedded`.\n *\n * @typedef {{ commentId: number, children: CommentNode }} CommentNode\n *\n * @param {Object[]} topLevelComments List of comment entities.\n * @return {{ commentTree: CommentNode[]}} Tree of comment IDs.\n */\nexport const useCommentTree = ( topLevelComments ) => {\n\tconst commentTree = useMemo(\n\t\t() =>\n\t\t\ttopLevelComments?.map( ( { id, _embedded } ) => {\n\t\t\t\tconst [ children ] = _embedded?.children || [ [] ];\n\t\t\t\treturn {\n\t\t\t\t\tcommentId: id,\n\t\t\t\t\tchildren: children.map( ( child ) => ( {\n\t\t\t\t\t\tcommentId: child.id,\n\t\t\t\t\t} ) ),\n\t\t\t\t};\n\t\t\t} ),\n\t\t[ topLevelComments ]\n\t);\n\n\treturn commentTree;\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAC,sBAAA,CAAAL,OAAA;AAPA;AACA;AACA;;AAOA;AACA,MAAMM,qBAAqB,GAAG,GAAG;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,mBAAmB,GAAGA,CAAE;EAAEC;AAAO,CAAC,KAAM;EACpD;EACA,MAAMC,SAAS,GAAG;IACjBC,MAAM,EAAE,SAAS;IACjBC,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE,OAAO;IAChBC,MAAM,EAAE,CAAC;IACTC,MAAM,EAAE;EACT,CAAC;;EAED;EACA,MAAM;IACLC,YAAY;IACZC,eAAe;IACfC,mBAAmB,EAAEC;EACtB,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC5B,MAAM;MAAEC;IAAY,CAAC,GAAGD,MAAM,CAAEE,kBAAiB,CAAC;IAClD,MAAM;MAAEC;IAAiC,CAAC,GAAGF,WAAW,CAAC,CAAC;IA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P,OAAO;QACjBiB,OAAO,EAAE;MACV,CAAE,CAAC;MACHC,MAAM,EAAE,MAAM;MACdC,KAAK,EAAE;IACR,CAAE,CAAC,CAACC,IAAI,CAAIC,GAAG,IAAM;MACpB,MAAMC,KAAK,GAAGC,QAAQ,CAAEF,GAAG,CAACG,OAAO,CAACC,GAAG,CAAE,iBAAkB,CAAE,CAAC;MAC9Df,eAAe,CAAE;QAChB,GAAGD,YAAY;QACf,CAAEG,GAAG,GAAIU,KAAK,IAAI,CAAC,GAAG,CAAC,GAAGA,KAAK,CAAE;MAClC,CAAE,CAAC;IACJ,CAAE,CAAC;EACJ,CAAC,EAAE,CAAE5B,WAAW,EAAEV,MAAM,EAAEgB,OAAO,EAAEU,eAAe,CAAG,CAAC;;EAEtD;EACA,OAAOhB,WAAW,KAAK,QAAQ,GAAGS,IAAI,GAAG,CAAC;AAC3C,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMuB,cAAc,GAAKC,gBAAgB,IAAM;EACrD,MAAMC,WAAW,GAAG,IAAAvB,gBAAO,EAC1B,MACCsB,gBAAgB,EAAEE,GAAG,CAAE,CAAE;IAAEC,EAAE;IAAEC;EAAU,CAAC,KAAM;IAC/C,MAAM,CAAEC,QAAQ,CAAE,GAAGD,SAAS,EAAEC,QAAQ,IAAI,CAAE,EAAE,CAAE;IAClD,OAAO;MACNC,SAAS,EAAEH,EAAE;MACbE,QAAQ,EAAEA,QAAQ,CAACH,GAAG,CAAIK,KAAK,KAAQ;QACtCD,SAAS,EAAEC,KAAK,CAACJ;MAClB,CAAC,CAAG;IACL,CAAC;EACF,CAAE,CAAC,EACJ,CAAEH,gBAAgB,CACnB,CAAC;EAED,OAAOC,WAAW;AACnB,CAAC;AAACpB,OAAA,CAAAkB,cAAA,GAAAA,cAAA","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_data","_blockEditor","_url","_apiFetch","_interopRequireDefault","MAX_COMMENTS_PER_PAGE","useCommentQueryArgs","postId","queryArgs","status","order","context","parent","_embed","pageComments","commentsPerPage","defaultCommentsPage","defaultPage","useSelect","select","getSettings","blockEditorStore","__experimentalDiscussionSettings","perPage","Math","min","page","useDefaultPageIndex","useMemo","post","per_page","exports","defaultPages","setDefaultPages","useState","key","useEffect","apiFetch","path","addQueryArgs","_fields","method","parse","then","res","pages","parseInt","headers","get","catch","useCommentTree","topLevelComments","commentTree","map","id","_embedded","children","commentId","child"],"sources":["@wordpress/block-library/src/comment-template/hooks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useEffect, useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { addQueryArgs } from '@wordpress/url';\nimport apiFetch from '@wordpress/api-fetch';\n\n// This is limited by WP REST API\nconst MAX_COMMENTS_PER_PAGE = 100;\n\n/**\n * Return an object with the query args needed to fetch the default page of\n * comments.\n *\n * @param {Object} props Hook props.\n * @param {number} props.postId ID of the post that contains the comments.\n * discussion settings.\n *\n * @return {Object} Query args to retrieve the comments.\n */\nexport const useCommentQueryArgs = ( { postId } ) => {\n\t// Initialize the query args that are not going to change.\n\tconst queryArgs = {\n\t\tstatus: 'approve',\n\t\torder: 'asc',\n\t\tcontext: 'embed',\n\t\tparent: 0,\n\t\t_embed: 'children',\n\t};\n\n\t// Get the Discussion settings that may be needed to query the comments.\n\tconst {\n\t\tpageComments,\n\t\tcommentsPerPage,\n\t\tdefaultCommentsPage: defaultPage,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { __experimentalDiscussionSettings } = getSettings();\n\t\treturn __experimentalDiscussionSettings;\n\t} );\n\n\t// WP REST API doesn't allow fetching more than max items limit set per single page of data.\n\t// As for the editor performance is more important than completeness of data and fetching only the\n\t// max allowed for single page should be enough for the purpose of design and laying out the page.\n\t// Fetching over the limit would return an error here but would work with backend query.\n\tconst perPage = pageComments\n\t\t? Math.min( commentsPerPage, MAX_COMMENTS_PER_PAGE )\n\t\t: MAX_COMMENTS_PER_PAGE;\n\n\t// Get the number of the default page.\n\tconst page = useDefaultPageIndex( {\n\t\tdefaultPage,\n\t\tpostId,\n\t\tperPage,\n\t\tqueryArgs,\n\t} );\n\n\t// Merge, memoize and return all query arguments, unless the default page's\n\t// number is not known yet.\n\treturn useMemo( () => {\n\t\treturn page\n\t\t\t? {\n\t\t\t\t\t...queryArgs,\n\t\t\t\t\tpost: postId,\n\t\t\t\t\tper_page: perPage,\n\t\t\t\t\tpage,\n\t\t\t }\n\t\t\t: null;\n\t}, [ postId, perPage, page ] );\n};\n\n/**\n * Return the index of the default page, depending on whether `defaultPage` is\n * `newest` or `oldest`. In the first case, the only way to know the page's\n * index is by using the `X-WP-TotalPages` header, which forces to make an\n * additional request.\n *\n * @param {Object} props Hook props.\n * @param {string} props.defaultPage Page shown by default (newest/oldest).\n * @param {number} props.postId ID of the post that contains the comments.\n * @param {number} props.perPage The number of comments included per page.\n * @param {Object} props.queryArgs Other query args.\n *\n * @return {number} Index of the default comments page.\n */\nconst useDefaultPageIndex = ( { defaultPage, postId, perPage, queryArgs } ) => {\n\t// Store the default page indices.\n\tconst [ defaultPages, setDefaultPages ] = useState( {} );\n\tconst key = `${ postId }_${ perPage }`;\n\tconst page = defaultPages[ key ] || 0;\n\n\tuseEffect( () => {\n\t\t// Do nothing if the page is already known or not the newest page.\n\t\tif ( page || defaultPage !== 'newest' ) {\n\t\t\treturn;\n\t\t}\n\t\t// We need to fetch comments to know the index. Use HEAD and limit\n\t\t// fields just to ID, to make this call as light as possible.\n\t\tapiFetch( {\n\t\t\tpath: addQueryArgs( '/wp/v2/comments', {\n\t\t\t\t...queryArgs,\n\t\t\t\tpost: postId,\n\t\t\t\tper_page: perPage,\n\t\t\t\t_fields: 'id',\n\t\t\t} ),\n\t\t\tmethod: 'HEAD',\n\t\t\tparse: false,\n\t\t} )\n\t\t\t.then( ( res ) => {\n\t\t\t\tconst pages = parseInt( res.headers.get( 'X-WP-TotalPages' ) );\n\t\t\t\tsetDefaultPages( {\n\t\t\t\t\t...defaultPages,\n\t\t\t\t\t[ key ]: pages <= 1 ? 1 : pages, // If there are 0 pages, it means that there are no comments, but there is no 0th page.\n\t\t\t\t} );\n\t\t\t} )\n\t\t\t.catch( () => {\n\t\t\t\t// There's no 0th page, but we can't know the number of pages, fallback to 1.\n\t\t\t\tsetDefaultPages( {\n\t\t\t\t\t...defaultPages,\n\t\t\t\t\t[ key ]: 1,\n\t\t\t\t} );\n\t\t\t} );\n\t}, [ defaultPage, postId, perPage, setDefaultPages ] );\n\n\t// The oldest one is always the first one.\n\treturn defaultPage === 'newest' ? page : 1;\n};\n\n/**\n * Generate a tree structure of comment IDs from a list of comment entities. The\n * children of each comment are obtained from `_embedded`.\n *\n * @typedef {{ commentId: number, children: CommentNode }} CommentNode\n *\n * @param {Object[]} topLevelComments List of comment entities.\n * @return {{ commentTree: CommentNode[]}} Tree of comment IDs.\n */\nexport const useCommentTree = ( topLevelComments ) => {\n\tconst commentTree = useMemo(\n\t\t() =>\n\t\t\ttopLevelComments?.map( ( { id, _embedded } ) => {\n\t\t\t\tconst [ children ] = _embedded?.children || [ [] ];\n\t\t\t\treturn {\n\t\t\t\t\tcommentId: id,\n\t\t\t\t\tchildren: children.map( ( child ) => ( {\n\t\t\t\t\t\tcommentId: child.id,\n\t\t\t\t\t} ) ),\n\t\t\t\t};\n\t\t\t} ),\n\t\t[ topLevelComments ]\n\t);\n\n\treturn commentTree;\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAC,sBAAA,CAAAL,OAAA;AAPA;AACA;AACA;;AAOA;AACA,MAAMM,qBAAqB,GAAG,GAAG;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,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AAG,IAAAxB,gBAAO,EAC1B,MACCuB,gBAAgB,EAAEE,GAAG,CAAE,CAAE;IAAEC,EAAE;IAAEC;EAAU,CAAC,KAAM;IAC/C,MAAM,CAAEC,QAAQ,CAAE,GAAGD,SAAS,EAAEC,QAAQ,IAAI,CAAE,EAAE,CAAE;IAClD,OAAO;MACNC,SAAS,EAAEH,EAAE;MACbE,QAAQ,EAAEA,QAAQ,CAACH,GAAG,CAAIK,KAAK,KAAQ;QACtCD,SAAS,EAAEC,KAAK,CAACJ;MAClB,CAAC,CAAG;IACL,CAAC;EACF,CAAE,CAAC,EACJ,CAAEH,gBAAgB,CACnB,CAAC;EAED,OAAOC,WAAW;AACnB,CAAC;AAACrB,OAAA,CAAAmB,cAAA,GAAAA,cAAA","ignoreList":[]}
@@ -132,7 +132,6 @@ const metadata = exports.metadata = {
132
132
  }
133
133
  },
134
134
  color: {
135
- __experimentalDuotone: "> .wp-block-cover__image-background, > .wp-block-cover__video-background",
136
135
  heading: true,
137
136
  text: true,
138
137
  background: false,
@@ -160,6 +159,14 @@ const metadata = exports.metadata = {
160
159
  },
161
160
  interactivity: {
162
161
  clientNavigation: true
162
+ },
163
+ filter: {
164
+ duotone: true
165
+ }
166
+ },
167
+ selectors: {
168
+ filter: {
169
+ duotone: ".wp-block-cover > .wp-block-cover__image-background, .wp-block-cover > .wp-block-cover__video-background"
163
170
  }
164
171
  },
165
172
  editorStyle: "wp-block-cover-editor",