@wordpress/block-library 8.17.1 → 8.18.1-next.5a1d1283.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 (124) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/column/edit.native.js +5 -5
  3. package/build/column/edit.native.js.map +1 -1
  4. package/build/cover/edit/index.js +3 -1
  5. package/build/cover/edit/index.js.map +1 -1
  6. package/build/cover/shared.js +26 -21
  7. package/build/cover/shared.js.map +1 -1
  8. package/build/embed/embed-link-settings.native.js +0 -1
  9. package/build/embed/embed-link-settings.native.js.map +1 -1
  10. package/build/footnotes/edit.js +2 -3
  11. package/build/footnotes/edit.js.map +1 -1
  12. package/build/group/index.js +1 -0
  13. package/build/group/index.js.map +1 -1
  14. package/build/post-content/edit.js +1 -1
  15. package/build/post-content/edit.js.map +1 -1
  16. package/build/post-template/index.js +1 -1
  17. package/build/post-terms/use-post-terms.js +3 -2
  18. package/build/post-terms/use-post-terms.js.map +1 -1
  19. package/build/query/edit/inspector-controls/index.js +28 -3
  20. package/build/query/edit/inspector-controls/index.js.map +1 -1
  21. package/build/query/edit/query-content.js +2 -1
  22. package/build/query/edit/query-content.js.map +1 -1
  23. package/build/query/index.js +9 -2
  24. package/build/query/index.js.map +1 -1
  25. package/build/query/view.js +75 -0
  26. package/build/query/view.js.map +1 -0
  27. package/build/query-pagination-next/index.js +1 -1
  28. package/build/query-pagination-numbers/edit.js +50 -5
  29. package/build/query-pagination-numbers/edit.js.map +1 -1
  30. package/build/query-pagination-numbers/index.js +7 -1
  31. package/build/query-pagination-numbers/index.js.map +1 -1
  32. package/build/query-pagination-previous/index.js +1 -1
  33. package/build/search/edit.js +3 -1
  34. package/build/search/edit.js.map +1 -1
  35. package/build/search/utils.js +2 -4
  36. package/build/search/utils.js.map +1 -1
  37. package/build/social-link/edit.native.js +1 -3
  38. package/build/social-link/edit.native.js.map +1 -1
  39. package/build-module/column/edit.native.js +5 -5
  40. package/build-module/column/edit.native.js.map +1 -1
  41. package/build-module/cover/edit/index.js +3 -1
  42. package/build-module/cover/edit/index.js.map +1 -1
  43. package/build-module/cover/shared.js +26 -21
  44. package/build-module/cover/shared.js.map +1 -1
  45. package/build-module/embed/embed-link-settings.native.js +0 -1
  46. package/build-module/embed/embed-link-settings.native.js.map +1 -1
  47. package/build-module/footnotes/edit.js +2 -3
  48. package/build-module/footnotes/edit.js.map +1 -1
  49. package/build-module/group/index.js +1 -0
  50. package/build-module/group/index.js.map +1 -1
  51. package/build-module/post-content/edit.js +1 -1
  52. package/build-module/post-content/edit.js.map +1 -1
  53. package/build-module/post-template/index.js +1 -1
  54. package/build-module/post-terms/use-post-terms.js +3 -2
  55. package/build-module/post-terms/use-post-terms.js.map +1 -1
  56. package/build-module/query/edit/inspector-controls/index.js +29 -4
  57. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  58. package/build-module/query/edit/query-content.js +2 -1
  59. package/build-module/query/edit/query-content.js.map +1 -1
  60. package/build-module/query/index.js +9 -2
  61. package/build-module/query/index.js.map +1 -1
  62. package/build-module/query/view.js +72 -0
  63. package/build-module/query/view.js.map +1 -0
  64. package/build-module/query-pagination-next/index.js +1 -1
  65. package/build-module/query-pagination-numbers/edit.js +51 -6
  66. package/build-module/query-pagination-numbers/edit.js.map +1 -1
  67. package/build-module/query-pagination-numbers/index.js +7 -1
  68. package/build-module/query-pagination-numbers/index.js.map +1 -1
  69. package/build-module/query-pagination-previous/index.js +1 -1
  70. package/build-module/search/edit.js +4 -2
  71. package/build-module/search/edit.js.map +1 -1
  72. package/build-module/search/utils.js +0 -1
  73. package/build-module/search/utils.js.map +1 -1
  74. package/build-module/social-link/edit.native.js +1 -3
  75. package/build-module/social-link/edit.native.js.map +1 -1
  76. package/build-style/query/style-rtl.css +140 -0
  77. package/build-style/query/style.css +140 -0
  78. package/build-style/site-logo/style-rtl.css +1 -0
  79. package/build-style/site-logo/style.css +1 -0
  80. package/build-style/style-rtl.css +1 -0
  81. package/build-style/style.css +1 -0
  82. package/package.json +32 -32
  83. package/src/audio/test/__snapshots__/edit.native.js.snap +106 -78
  84. package/src/column/edit.native.js +4 -4
  85. package/src/columns/test/__snapshots__/edit.native.js.snap +14 -0
  86. package/src/columns/test/edit.native.js +47 -17
  87. package/src/cover/edit/index.js +3 -1
  88. package/src/cover/shared.js +25 -20
  89. package/src/cover/test/edit.native.js +1 -5
  90. package/src/embed/embed-link-settings.native.js +0 -1
  91. package/src/embed/test/index.native.js +9 -9
  92. package/src/file/test/__snapshots__/edit.native.js.snap +218 -162
  93. package/src/footnotes/edit.js +3 -1
  94. package/src/group/block.json +1 -0
  95. package/src/image/index.php +5 -0
  96. package/src/post-content/edit.js +2 -2
  97. package/src/post-content/index.php +0 -6
  98. package/src/post-featured-image/index.php +0 -6
  99. package/src/post-navigation-link/index.php +10 -1
  100. package/src/post-template/block.json +2 -1
  101. package/src/post-template/index.php +19 -4
  102. package/src/post-terms/use-post-terms.js +4 -2
  103. package/src/query/block.json +9 -2
  104. package/src/query/edit/inspector-controls/index.js +46 -3
  105. package/src/query/edit/query-content.js +1 -0
  106. package/src/query/index.php +94 -1
  107. package/src/query/style.scss +63 -0
  108. package/src/query/view.js +82 -0
  109. package/src/query-no-results/index.php +1 -5
  110. package/src/query-pagination-next/block.json +7 -1
  111. package/src/query-pagination-next/index.php +20 -3
  112. package/src/query-pagination-numbers/block.json +7 -1
  113. package/src/query-pagination-numbers/edit.js +64 -16
  114. package/src/query-pagination-numbers/index.php +27 -4
  115. package/src/query-pagination-previous/block.json +7 -1
  116. package/src/query-pagination-previous/index.php +19 -2
  117. package/src/search/edit.js +8 -2
  118. package/src/search/test/__snapshots__/edit.native.js.snap +363 -265
  119. package/src/search/utils.js +0 -1
  120. package/src/site-logo/style.scss +1 -0
  121. package/src/social-link/edit.native.js +1 -1
  122. package/src/social-link/editor.native.scss +0 -4
  123. package/src/social-links/test/edit.native.js +30 -0
  124. package/src/social-link/test/index.native.js +0 -132
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 8.18.0 (2023-08-31)
6
+
5
7
  ## 8.17.0 (2023-08-16)
6
8
 
7
9
  ## 8.16.0 (2023-08-10)
@@ -90,17 +90,17 @@ function ColumnEdit({
90
90
  onChangeWidth(nextWidth);
91
91
  };
92
92
  const renderAppender = (0, _element.useCallback)(() => {
93
- const {
94
- width: columnWidth
95
- } = contentStyle[clientId];
96
- const isFullWidth = columnWidth === screenWidth;
97
93
  if (isSelected) {
94
+ const {
95
+ width: columnWidth
96
+ } = contentStyle[clientId] || {};
97
+ const isFullWidth = columnWidth === screenWidth;
98
98
  return (0, _element.createElement)(_reactNative.View, {
99
99
  style: [_editor.default.columnAppender, isFullWidth && _editor.default.fullwidthColumnAppender, isFullWidth && hasChildren && _editor.default.fullwidthHasInnerColumnAppender, !isFullWidth && hasChildren && _editor.default.hasInnerColumnAppender]
100
100
  }, (0, _element.createElement)(_blockEditor.InnerBlocks.ButtonBlockAppender, null));
101
101
  }
102
102
  return null;
103
- }, [contentStyle[clientId], screenWidth, isSelected, hasChildren]);
103
+ }, [contentStyle, clientId, screenWidth, isSelected, hasChildren]);
104
104
  if (!isSelected && !hasChildren) {
105
105
  return (0, _element.createElement)(_reactNative.View, {
106
106
  style: [getStylesFromColorScheme(_editor.default.columnPlaceholder, _editor.default.columnPlaceholderDark), contentStyle[clientId]]
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_reactNative","_data","_compose","_blockEditor","_components","_i18n","_editor","_interopRequireDefault","_columnPreview","_utils","ColumnEdit","attributes","setAttributes","hasChildren","isSelected","getStylesFromColorScheme","contentStyle","columns","selectedColumnIndex","parentAlignment","clientId","blockWidth","verticalAlignment","width","valueUnit","getValueAndUnit","screenWidth","Math","floor","Dimensions","get","widthUnit","setWidthUnit","useState","units","useCustomUnits","availableUnits","useSetting","updateAlignment","alignment","useEffect","onChangeWidth","nextWidth","widthWithUnit","getWidthWithUnit","onChangeUnit","nextUnit","widthWithoutUnit","parseFloat","getWidths","onChange","isPercentageUnit","renderAppender","useCallback","columnWidth","isFullWidth","createElement","View","style","styles","columnAppender","fullwidthColumnAppender","fullwidthHasInnerColumnAppender","hasInnerColumnAppender","InnerBlocks","ButtonBlockAppender","columnPlaceholder","columnPlaceholderDark","parentWidth","Fragment","BlockControls","BlockVerticalAlignmentToolbar","value","InspectorControls","PanelBody","title","__","UnitControl","label","min","max","undefined","onComplete","onUnitChange","unit","preview","default","columnWidths","FooterMessageControl","innerBlocksBottomSpace","ColumnEditWrapper","props","getVerticalAlignmentRemap","flexBase","_default","compose","withSelect","select","getBlockCount","getBlockRootClientId","getSelectedBlockClientId","getBlocks","getBlockOrder","getBlockAttributes","blockEditorStore","selectedBlockClientId","parentId","blockOrder","indexOf","withPreferredColorScheme","exports"],"sources":["@wordpress/block-library/src/column/edit.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View, Dimensions } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { withSelect } from '@wordpress/data';\nimport { compose, withPreferredColorScheme } from '@wordpress/compose';\nimport { useEffect, useState, useCallback } from '@wordpress/element';\nimport {\n\tInnerBlocks,\n\tBlockControls,\n\tBlockVerticalAlignmentToolbar,\n\tInspectorControls,\n\tstore as blockEditorStore,\n\tuseSetting,\n} from '@wordpress/block-editor';\nimport {\n\tPanelBody,\n\tFooterMessageControl,\n\tUnitControl,\n\tgetValueAndUnit,\n\t__experimentalUseCustomUnits as useCustomUnits,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n/**\n * Internal dependencies\n */\nimport styles from './editor.scss';\nimport ColumnsPreview from './column-preview';\nimport {\n\tgetWidths,\n\tgetWidthWithUnit,\n\tisPercentageUnit,\n} from '../columns/utils';\n\nfunction ColumnEdit( {\n\tattributes,\n\tsetAttributes,\n\thasChildren,\n\tisSelected,\n\tgetStylesFromColorScheme,\n\tcontentStyle,\n\tcolumns,\n\tselectedColumnIndex,\n\tparentAlignment,\n\tclientId,\n\tblockWidth,\n} ) {\n\tif ( ! contentStyle ) {\n\t\tcontentStyle = { [ clientId ]: {} };\n\t}\n\n\tconst { verticalAlignment, width } = attributes;\n\tconst { valueUnit = '%' } = getValueAndUnit( width ) || {};\n\n\tconst screenWidth = Math.floor( Dimensions.get( 'window' ).width );\n\n\tconst [ widthUnit, setWidthUnit ] = useState( valueUnit || '%' );\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units' ) || [\n\t\t\t'%',\n\t\t\t'px',\n\t\t\t'em',\n\t\t\t'rem',\n\t\t\t'vw',\n\t\t],\n\t} );\n\n\tconst updateAlignment = ( alignment ) => {\n\t\tsetAttributes( { verticalAlignment: alignment } );\n\t};\n\n\tuseEffect( () => {\n\t\tsetWidthUnit( valueUnit );\n\t}, [ valueUnit ] );\n\n\tuseEffect( () => {\n\t\tif ( ! verticalAlignment && parentAlignment ) {\n\t\t\tupdateAlignment( parentAlignment );\n\t\t}\n\t}, [] );\n\n\tconst onChangeWidth = ( nextWidth ) => {\n\t\tconst widthWithUnit = getWidthWithUnit( nextWidth, widthUnit );\n\n\t\tsetAttributes( {\n\t\t\twidth: widthWithUnit,\n\t\t} );\n\t};\n\n\tconst onChangeUnit = ( nextUnit ) => {\n\t\tsetWidthUnit( nextUnit );\n\t\tconst widthWithoutUnit = parseFloat(\n\t\t\twidth || getWidths( columns )[ selectedColumnIndex ]\n\t\t);\n\n\t\tsetAttributes( {\n\t\t\twidth: getWidthWithUnit( widthWithoutUnit, nextUnit ),\n\t\t} );\n\t};\n\n\tconst onChange = ( nextWidth ) => {\n\t\tif ( isPercentageUnit( widthUnit ) || ! widthUnit ) {\n\t\t\treturn;\n\t\t}\n\t\tonChangeWidth( nextWidth );\n\t};\n\n\tconst renderAppender = useCallback( () => {\n\t\tconst { width: columnWidth } = contentStyle[ clientId ];\n\t\tconst isFullWidth = columnWidth === screenWidth;\n\n\t\tif ( isSelected ) {\n\t\t\treturn (\n\t\t\t\t<View\n\t\t\t\t\tstyle={ [\n\t\t\t\t\t\tstyles.columnAppender,\n\t\t\t\t\t\tisFullWidth && styles.fullwidthColumnAppender,\n\t\t\t\t\t\tisFullWidth &&\n\t\t\t\t\t\t\thasChildren &&\n\t\t\t\t\t\t\tstyles.fullwidthHasInnerColumnAppender,\n\t\t\t\t\t\t! isFullWidth &&\n\t\t\t\t\t\t\thasChildren &&\n\t\t\t\t\t\t\tstyles.hasInnerColumnAppender,\n\t\t\t\t\t] }\n\t\t\t\t>\n\t\t\t\t\t<InnerBlocks.ButtonBlockAppender />\n\t\t\t\t</View>\n\t\t\t);\n\t\t}\n\t\treturn null;\n\t}, [ contentStyle[ clientId ], screenWidth, isSelected, hasChildren ] );\n\n\tif ( ! isSelected && ! hasChildren ) {\n\t\treturn (\n\t\t\t<View\n\t\t\t\tstyle={ [\n\t\t\t\t\tgetStylesFromColorScheme(\n\t\t\t\t\t\tstyles.columnPlaceholder,\n\t\t\t\t\t\tstyles.columnPlaceholderDark\n\t\t\t\t\t),\n\t\t\t\t\tcontentStyle[ clientId ],\n\t\t\t\t] }\n\t\t\t/>\n\t\t);\n\t}\n\n\tconst parentWidth =\n\t\tcontentStyle &&\n\t\tcontentStyle[ clientId ] &&\n\t\tcontentStyle[ clientId ].width;\n\n\treturn (\n\t\t<>\n\t\t\t{ isSelected && (\n\t\t\t\t<>\n\t\t\t\t\t<BlockControls>\n\t\t\t\t\t\t<BlockVerticalAlignmentToolbar\n\t\t\t\t\t\t\tonChange={ updateAlignment }\n\t\t\t\t\t\t\tvalue={ verticalAlignment }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t\t<InspectorControls>\n\t\t\t\t\t\t<PanelBody title={ __( 'Column settings' ) }>\n\t\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\t\tmax={\n\t\t\t\t\t\t\t\t\tisPercentageUnit( widthUnit )\n\t\t\t\t\t\t\t\t\t\t? 100\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\t\tonComplete={ onChangeWidth }\n\t\t\t\t\t\t\t\tonUnitChange={ onChangeUnit }\n\t\t\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\t\t\tgetWidths( columns )[ selectedColumnIndex ]\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tunit={ widthUnit }\n\t\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\t\tpreview={\n\t\t\t\t\t\t\t\t\t<ColumnsPreview\n\t\t\t\t\t\t\t\t\t\tcolumnWidths={ getWidths(\n\t\t\t\t\t\t\t\t\t\t\tcolumns,\n\t\t\t\t\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tselectedColumnIndex={\n\t\t\t\t\t\t\t\t\t\t\tselectedColumnIndex\n\t\t\t\t\t\t\t\t\t\t}\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</PanelBody>\n\t\t\t\t\t\t<PanelBody>\n\t\t\t\t\t\t\t<FooterMessageControl\n\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t'Note: Column layout may vary between themes and screen sizes'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PanelBody>\n\t\t\t\t\t</InspectorControls>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<View\n\t\t\t\tstyle={ [\n\t\t\t\t\tisSelected && hasChildren && styles.innerBlocksBottomSpace,\n\t\t\t\t\tcontentStyle[ clientId ],\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t<InnerBlocks\n\t\t\t\t\trenderAppender={ renderAppender }\n\t\t\t\t\tparentWidth={ parentWidth }\n\t\t\t\t\tblockWidth={ blockWidth }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t</>\n\t);\n}\n\nfunction ColumnEditWrapper( props ) {\n\tconst { verticalAlignment } = props.attributes;\n\n\tconst getVerticalAlignmentRemap = ( alignment ) => {\n\t\tif ( ! alignment ) return styles.flexBase;\n\t\treturn {\n\t\t\t...styles.flexBase,\n\t\t\t...styles[ `is-vertically-aligned-${ alignment }` ],\n\t\t};\n\t};\n\n\treturn (\n\t\t<View style={ getVerticalAlignmentRemap( verticalAlignment ) }>\n\t\t\t<ColumnEdit { ...props } />\n\t\t</View>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select, { clientId } ) => {\n\t\tconst {\n\t\t\tgetBlockCount,\n\t\t\tgetBlockRootClientId,\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetBlocks,\n\t\t\tgetBlockOrder,\n\t\t\tgetBlockAttributes,\n\t\t} = select( blockEditorStore );\n\n\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\t\tconst isSelected = selectedBlockClientId === clientId;\n\n\t\tconst parentId = getBlockRootClientId( clientId );\n\t\tconst hasChildren = !! getBlockCount( clientId );\n\n\t\tconst blockOrder = getBlockOrder( parentId );\n\n\t\tconst selectedColumnIndex = blockOrder.indexOf( clientId );\n\t\tconst columns = getBlocks( parentId );\n\n\t\tconst parentAlignment =\n\t\t\tgetBlockAttributes( parentId )?.verticalAlignment;\n\n\t\treturn {\n\t\t\thasChildren,\n\t\t\tisSelected,\n\t\t\tselectedColumnIndex,\n\t\t\tcolumns,\n\t\t\tparentAlignment,\n\t\t};\n\t} ),\n\twithPreferredColorScheme,\n] )( ColumnEditWrapper );\n"],"mappings":";;;;;;;AAUA,IAAAA,QAAA,GAAAC,OAAA;AAPA,IAAAC,YAAA,GAAAD,OAAA;AAKA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAEA,IAAAI,YAAA,GAAAJ,OAAA;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AiB;EAElD,OAAO;IACNT,WAAW;IACXC,UAAU;IACVI,mBAAmB;IACnBD,OAAO;IACPE;EACD,CAAC;AACF,CAAE,CAAC,EACH0F,iCAAwB,CACvB,CAAC,CAAEnB,iBAAkB,CAAC;AAAAoB,OAAA,CAAAxB,OAAA,GAAAQ,QAAA"}
1
+ {"version":3,"names":["_element","require","_reactNative","_data","_compose","_blockEditor","_components","_i18n","_editor","_interopRequireDefault","_columnPreview","_utils","ColumnEdit","attributes","setAttributes","hasChildren","isSelected","getStylesFromColorScheme","contentStyle","columns","selectedColumnIndex","parentAlignment","clientId","blockWidth","verticalAlignment","width","valueUnit","getValueAndUnit","screenWidth","Math","floor","Dimensions","get","widthUnit","setWidthUnit","useState","units","useCustomUnits","availableUnits","useSetting","updateAlignment","alignment","useEffect","onChangeWidth","nextWidth","widthWithUnit","getWidthWithUnit","onChangeUnit","nextUnit","widthWithoutUnit","parseFloat","getWidths","onChange","isPercentageUnit","renderAppender","useCallback","columnWidth","isFullWidth","createElement","View","style","styles","columnAppender","fullwidthColumnAppender","fullwidthHasInnerColumnAppender","hasInnerColumnAppender","InnerBlocks","ButtonBlockAppender","columnPlaceholder","columnPlaceholderDark","parentWidth","Fragment","BlockControls","BlockVerticalAlignmentToolbar","value","InspectorControls","PanelBody","title","__","UnitControl","label","min","max","undefined","onComplete","onUnitChange","unit","preview","default","columnWidths","FooterMessageControl","innerBlocksBottomSpace","ColumnEditWrapper","props","getVerticalAlignmentRemap","flexBase","_default","compose","withSelect","select","getBlockCount","getBlockRootClientId","getSelectedBlockClientId","getBlocks","getBlockOrder","getBlockAttributes","blockEditorStore","selectedBlockClientId","parentId","blockOrder","indexOf","withPreferredColorScheme","exports"],"sources":["@wordpress/block-library/src/column/edit.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View, Dimensions } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { withSelect } from '@wordpress/data';\nimport { compose, withPreferredColorScheme } from '@wordpress/compose';\nimport { useEffect, useState, useCallback } from '@wordpress/element';\nimport {\n\tInnerBlocks,\n\tBlockControls,\n\tBlockVerticalAlignmentToolbar,\n\tInspectorControls,\n\tstore as blockEditorStore,\n\tuseSetting,\n} from '@wordpress/block-editor';\nimport {\n\tPanelBody,\n\tFooterMessageControl,\n\tUnitControl,\n\tgetValueAndUnit,\n\t__experimentalUseCustomUnits as useCustomUnits,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n/**\n * Internal dependencies\n */\nimport styles from './editor.scss';\nimport ColumnsPreview from './column-preview';\nimport {\n\tgetWidths,\n\tgetWidthWithUnit,\n\tisPercentageUnit,\n} from '../columns/utils';\n\nfunction ColumnEdit( {\n\tattributes,\n\tsetAttributes,\n\thasChildren,\n\tisSelected,\n\tgetStylesFromColorScheme,\n\tcontentStyle,\n\tcolumns,\n\tselectedColumnIndex,\n\tparentAlignment,\n\tclientId,\n\tblockWidth,\n} ) {\n\tif ( ! contentStyle ) {\n\t\tcontentStyle = { [ clientId ]: {} };\n\t}\n\n\tconst { verticalAlignment, width } = attributes;\n\tconst { valueUnit = '%' } = getValueAndUnit( width ) || {};\n\n\tconst screenWidth = Math.floor( Dimensions.get( 'window' ).width );\n\n\tconst [ widthUnit, setWidthUnit ] = useState( valueUnit || '%' );\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units' ) || [\n\t\t\t'%',\n\t\t\t'px',\n\t\t\t'em',\n\t\t\t'rem',\n\t\t\t'vw',\n\t\t],\n\t} );\n\n\tconst updateAlignment = ( alignment ) => {\n\t\tsetAttributes( { verticalAlignment: alignment } );\n\t};\n\n\tuseEffect( () => {\n\t\tsetWidthUnit( valueUnit );\n\t}, [ valueUnit ] );\n\n\tuseEffect( () => {\n\t\tif ( ! verticalAlignment && parentAlignment ) {\n\t\t\tupdateAlignment( parentAlignment );\n\t\t}\n\t}, [] );\n\n\tconst onChangeWidth = ( nextWidth ) => {\n\t\tconst widthWithUnit = getWidthWithUnit( nextWidth, widthUnit );\n\n\t\tsetAttributes( {\n\t\t\twidth: widthWithUnit,\n\t\t} );\n\t};\n\n\tconst onChangeUnit = ( nextUnit ) => {\n\t\tsetWidthUnit( nextUnit );\n\t\tconst widthWithoutUnit = parseFloat(\n\t\t\twidth || getWidths( columns )[ selectedColumnIndex ]\n\t\t);\n\n\t\tsetAttributes( {\n\t\t\twidth: getWidthWithUnit( widthWithoutUnit, nextUnit ),\n\t\t} );\n\t};\n\n\tconst onChange = ( nextWidth ) => {\n\t\tif ( isPercentageUnit( widthUnit ) || ! widthUnit ) {\n\t\t\treturn;\n\t\t}\n\t\tonChangeWidth( nextWidth );\n\t};\n\n\tconst renderAppender = useCallback( () => {\n\t\tif ( isSelected ) {\n\t\t\tconst { width: columnWidth } = contentStyle[ clientId ] || {};\n\t\t\tconst isFullWidth = columnWidth === screenWidth;\n\n\t\t\treturn (\n\t\t\t\t<View\n\t\t\t\t\tstyle={ [\n\t\t\t\t\t\tstyles.columnAppender,\n\t\t\t\t\t\tisFullWidth && styles.fullwidthColumnAppender,\n\t\t\t\t\t\tisFullWidth &&\n\t\t\t\t\t\t\thasChildren &&\n\t\t\t\t\t\t\tstyles.fullwidthHasInnerColumnAppender,\n\t\t\t\t\t\t! isFullWidth &&\n\t\t\t\t\t\t\thasChildren &&\n\t\t\t\t\t\t\tstyles.hasInnerColumnAppender,\n\t\t\t\t\t] }\n\t\t\t\t>\n\t\t\t\t\t<InnerBlocks.ButtonBlockAppender />\n\t\t\t\t</View>\n\t\t\t);\n\t\t}\n\t\treturn null;\n\t}, [ contentStyle, clientId, screenWidth, isSelected, hasChildren ] );\n\n\tif ( ! isSelected && ! hasChildren ) {\n\t\treturn (\n\t\t\t<View\n\t\t\t\tstyle={ [\n\t\t\t\t\tgetStylesFromColorScheme(\n\t\t\t\t\t\tstyles.columnPlaceholder,\n\t\t\t\t\t\tstyles.columnPlaceholderDark\n\t\t\t\t\t),\n\t\t\t\t\tcontentStyle[ clientId ],\n\t\t\t\t] }\n\t\t\t/>\n\t\t);\n\t}\n\n\tconst parentWidth =\n\t\tcontentStyle &&\n\t\tcontentStyle[ clientId ] &&\n\t\tcontentStyle[ clientId ].width;\n\n\treturn (\n\t\t<>\n\t\t\t{ isSelected && (\n\t\t\t\t<>\n\t\t\t\t\t<BlockControls>\n\t\t\t\t\t\t<BlockVerticalAlignmentToolbar\n\t\t\t\t\t\t\tonChange={ updateAlignment }\n\t\t\t\t\t\t\tvalue={ verticalAlignment }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t\t<InspectorControls>\n\t\t\t\t\t\t<PanelBody title={ __( 'Column settings' ) }>\n\t\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\t\tmax={\n\t\t\t\t\t\t\t\t\tisPercentageUnit( widthUnit )\n\t\t\t\t\t\t\t\t\t\t? 100\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\t\tonComplete={ onChangeWidth }\n\t\t\t\t\t\t\t\tonUnitChange={ onChangeUnit }\n\t\t\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\t\t\tgetWidths( columns )[ selectedColumnIndex ]\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tunit={ widthUnit }\n\t\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\t\tpreview={\n\t\t\t\t\t\t\t\t\t<ColumnsPreview\n\t\t\t\t\t\t\t\t\t\tcolumnWidths={ getWidths(\n\t\t\t\t\t\t\t\t\t\t\tcolumns,\n\t\t\t\t\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tselectedColumnIndex={\n\t\t\t\t\t\t\t\t\t\t\tselectedColumnIndex\n\t\t\t\t\t\t\t\t\t\t}\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</PanelBody>\n\t\t\t\t\t\t<PanelBody>\n\t\t\t\t\t\t\t<FooterMessageControl\n\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t'Note: Column layout may vary between themes and screen sizes'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PanelBody>\n\t\t\t\t\t</InspectorControls>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<View\n\t\t\t\tstyle={ [\n\t\t\t\t\tisSelected && hasChildren && styles.innerBlocksBottomSpace,\n\t\t\t\t\tcontentStyle[ clientId ],\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t<InnerBlocks\n\t\t\t\t\trenderAppender={ renderAppender }\n\t\t\t\t\tparentWidth={ parentWidth }\n\t\t\t\t\tblockWidth={ blockWidth }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t</>\n\t);\n}\n\nfunction ColumnEditWrapper( props ) {\n\tconst { verticalAlignment } = props.attributes;\n\n\tconst getVerticalAlignmentRemap = ( alignment ) => {\n\t\tif ( ! alignment ) return styles.flexBase;\n\t\treturn {\n\t\t\t...styles.flexBase,\n\t\t\t...styles[ `is-vertically-aligned-${ alignment }` ],\n\t\t};\n\t};\n\n\treturn (\n\t\t<View style={ getVerticalAlignmentRemap( verticalAlignment ) }>\n\t\t\t<ColumnEdit { ...props } />\n\t\t</View>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select, { clientId } ) => {\n\t\tconst {\n\t\t\tgetBlockCount,\n\t\t\tgetBlockRootClientId,\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetBlocks,\n\t\t\tgetBlockOrder,\n\t\t\tgetBlockAttributes,\n\t\t} = select( blockEditorStore );\n\n\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\t\tconst isSelected = selectedBlockClientId === clientId;\n\n\t\tconst parentId = getBlockRootClientId( clientId );\n\t\tconst hasChildren = !! getBlockCount( clientId );\n\n\t\tconst blockOrder = getBlockOrder( parentId );\n\n\t\tconst selectedColumnIndex = blockOrder.indexOf( clientId );\n\t\tconst columns = getBlocks( parentId );\n\n\t\tconst parentAlignment =\n\t\t\tgetBlockAttributes( parentId )?.verticalAlignment;\n\n\t\treturn {\n\t\t\thasChildren,\n\t\t\tisSelected,\n\t\t\tselectedColumnIndex,\n\t\t\tcolumns,\n\t\t\tparentAlignment,\n\t\t};\n\t} ),\n\twithPreferredColorScheme,\n] )( ColumnEditWrapper );\n"],"mappings":";;;;;;;AAUA,IAAAA,QAAA,GAAAC,OAAA;AAPA,IAAAC,YAAA,GAAAD,OAAA;AAKA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAEA,IAAAI,YAAA,GAAAJ,OAAA;AAQA,IAAAK,WAAA,GAAAL,OAAA;AAOA,IAAAM,KAAA,GAAAN,OAAA;AAIA,IAAAO,OAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,cAAA,GAAAD,sBAAA,CAAAR,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AAhCA;AACA;AACA;;AAGA;AACA;AACA;;AAoBA;AACA;AACA;;AASA,SAASW,UAAUA,CAAE;EACpBC,UAAU;EACVC,aAAa;EACbC,WAAW;EACXC,UAAU;EACVC,wBAAwB;EACxBC,YAAY;EACZC,OAAO;EACPC,mBAAmB;EACnBC,eAAe;EACfC,QAAQ;EACRC;AACD,CAAC,EAAG;EACH,IAAK,CAAEL,YAAY,EAAG;IACrBA,YAAY,GAAG;MAAE,CAAEI,QAAQ,GAAI,CAAC;IAAE,CAAC;EACpC;EAEA,MAAM;IAAEE,iBAAiB;IAAEC;EAAM,CAAC,GAAGZ,UAAU;EAC/C,MAAM;IAAEa,SAAS,GAAG;EAAI,CAAC,GAAG,IAAAC,2BAAe,EAAEF,KAAM,CAAC,IAAI,CAAC,CAAC;EAE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AwB;IACxBC,SAAS;IACTC,aAAa;IACbC;EACD,CAAC,GAAGN,MAAM,CAAEO,kBAAiB,CAAC;EAE9B,MAAMC,qBAAqB,GAAGL,wBAAwB,CAAC,CAAC;EACxD,MAAMtF,UAAU,GAAG2F,qBAAqB,KAAKrF,QAAQ;EAErD,MAAMsF,QAAQ,GAAGP,oBAAoB,CAAE/E,QAAS,CAAC;EACjD,MAAMP,WAAW,GAAG,CAAC,CAAEqF,aAAa,CAAE9E,QAAS,CAAC;EAEhD,MAAMuF,UAAU,GAAGL,aAAa,CAAEI,QAAS,CAAC;EAE5C,MAAMxF,mBAAmB,GAAGyF,UAAU,CAACC,OAAO,CAAExF,QAAS,CAAC;EAC1D,MAAMH,OAAO,GAAGoF,SAAS,CAAEK,QAAS,CAAC;EAErC,MAAMvF,eAAe,GACpBoF,kBAAkB,CAAEG,QAAS,CAAC,EAAEpF,iBAAiB;EAElD,OAAO;IACNT,WAAW;IACXC,UAAU;IACVI,mBAAmB;IACnBD,OAAO;IACPE;EACD,CAAC;AACF,CAAE,CAAC,EACH0F,iCAAwB,CACvB,CAAC,CAAEnB,iBAAkB,CAAC;AAAAoB,OAAA,CAAAxB,OAAA,GAAAQ,QAAA"}
@@ -123,7 +123,9 @@ function CoverEdit({
123
123
  } = (0, _blockEditor.__experimentalUseGradient)();
124
124
  const setMedia = (0, _shared.attributesFromMedia)(setAttributes, dimRatio);
125
125
  const onSelectMedia = async newMedia => {
126
- const isDarkSetting = await (0, _shared.getCoverIsDark)(newMedia.url, dimRatio, overlayColor.color);
126
+ // Only pass the url to getCoverIsDark if the media is an image as video is not handled.
127
+ const newUrl = newMedia?.type === 'image' ? newMedia.url : undefined;
128
+ const isDarkSetting = await (0, _shared.getCoverIsDark)(newUrl, dimRatio, overlayColor.color);
127
129
  setMedia(newMedia, isDarkSetting);
128
130
  };
129
131
  const onClearMedia = async () => {
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_colord","_names","_coreData","_components","_compose","_blockEditor","_i18n","_data","_blob","_notices","_shared","_inspectorControls","_blockControls","_coverPlaceholder","_resizableCoverPopover","extend","namesPlugin","getInnerBlocksTemplate","attributes","align","placeholder","__","isTemporaryMedia","id","url","isBlobURL","CoverEdit","clientId","isSelected","overlayColor","setAttributes","setOverlayColor","toggleSelection","context","postId","postType","contentPosition","useFeaturedImage","dimRatio","focalPoint","hasParallax","isDark","isRepeated","minHeight","minHeightUnit","alt","allowedBlocks","templateLock","tagName","TagName","featuredImage","useEntityProp","__unstableMarkNextChangeAsNotPersistent","useDispatch","blockEditorStore","media","useSelect","select","coreStore","getMedia","mediaUrl","source_url","useEffect","setIsDark","isDarkSetting","getCoverIsDark","color","replaceAll","backgroundType","IMAGE_BACKGROUND_TYPE","createErrorNotice","noticesStore","gradientClass","gradientValue","__experimentalUseGradient","setMedia","attributesFromMedia","onSelectMedia","newMedia","onClearMedia","undefined","onSetOverlayColor","colorValue","onUpdateDimRatio","newDimRatio","isUploadingMedia","onUploadError","message","type","isImageBackground","isVideoBackground","VIDEO_BACKGROUND_TYPE","resizeListener","height","width","useResizeObserver","resizableBoxDimensions","useMemo","minHeightWithUnit","isImgElement","style","backgroundImage","backgroundPosition","mediaPosition","bgStyle","backgroundColor","mediaStyle","objectPosition","hasBackground","hasInnerBlocks","getBlock","innerBlocks","length","ref","useRef","blockProps","useBlockProps","hasFontSizes","useSetting","innerBlocksTemplate","fontSize","innerBlocksProps","useInnerBlocksProps","className","template","templateInsertUpdatesSelection","mediaElement","currentSettings","toggleUseFeaturedImage","blockControls","createElement","default","inspectorControls","coverRef","updateDimRatio","resizableCoverProps","onResizeStart","onResize","value","onResizeStop","newMinHeight","showHandle","size","Fragment","classnames","onError","ColorPalette","disableCustomColors","onChange","clearable","classes","isContentPositionCenter","getPositionClassName","dimRatioToClass","class","Placeholder","withIllustration","src","role","autoPlay","muted","loop","Spinner","disableMediaButtons","_default","compose","withColors","exports"],"sources":["@wordpress/block-library/src/cover/edit/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * WordPress dependencies\n */\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useEffect, useMemo, useRef } from '@wordpress/element';\nimport { Placeholder, Spinner } from '@wordpress/components';\nimport { compose, useResizeObserver } from '@wordpress/compose';\nimport {\n\twithColors,\n\tColorPalette,\n\tuseBlockProps,\n\tuseSetting,\n\tuseInnerBlocksProps,\n\t__experimentalUseGradient,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { isBlobURL } from '@wordpress/blob';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport {\n\tattributesFromMedia,\n\tIMAGE_BACKGROUND_TYPE,\n\tVIDEO_BACKGROUND_TYPE,\n\tdimRatioToClass,\n\tisContentPositionCenter,\n\tgetPositionClassName,\n\tmediaPosition,\n\tgetCoverIsDark,\n} from '../shared';\nimport CoverInspectorControls from './inspector-controls';\nimport CoverBlockControls from './block-controls';\nimport CoverPlaceholder from './cover-placeholder';\nimport ResizableCoverPopover from './resizable-cover-popover';\n\nextend( [ namesPlugin ] );\n\nfunction getInnerBlocksTemplate( attributes ) {\n\treturn [\n\t\t[\n\t\t\t'core/paragraph',\n\t\t\t{\n\t\t\t\talign: 'center',\n\t\t\t\tplaceholder: __( 'Write title…' ),\n\t\t\t\t...attributes,\n\t\t\t},\n\t\t],\n\t];\n}\n\n/**\n * Is the URL a temporary blob URL? A blob URL is one that is used temporarily while\n * the media (image or video) is being uploaded and will not have an id allocated yet.\n *\n * @param {number} id The id of the media.\n * @param {string} url The url of the media.\n *\n * @return {boolean} Is the URL a Blob URL.\n */\nconst isTemporaryMedia = ( id, url ) => ! id && isBlobURL( url );\n\nfunction CoverEdit( {\n\tattributes,\n\tclientId,\n\tisSelected,\n\toverlayColor,\n\tsetAttributes,\n\tsetOverlayColor,\n\ttoggleSelection,\n\tcontext: { postId, postType },\n} ) {\n\tconst {\n\t\tcontentPosition,\n\t\tid,\n\t\tuseFeaturedImage,\n\t\tdimRatio,\n\t\tfocalPoint,\n\t\thasParallax,\n\t\tisDark,\n\t\tisRepeated,\n\t\tminHeight,\n\t\tminHeightUnit,\n\t\talt,\n\t\tallowedBlocks,\n\t\ttemplateLock,\n\t\ttagName: TagName = 'div',\n\t} = attributes;\n\n\tconst [ featuredImage ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'featured_media',\n\t\tpostId\n\t);\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst media = useSelect(\n\t\t( select ) =>\n\t\t\tfeaturedImage &&\n\t\t\tselect( coreStore ).getMedia( featuredImage, { context: 'view' } ),\n\t\t[ featuredImage ]\n\t);\n\tconst mediaUrl = media?.source_url;\n\n\tuseEffect( () => {\n\t\tasync function setIsDark() {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tconst isDarkSetting = await getCoverIsDark(\n\t\t\t\tmediaUrl,\n\t\t\t\tdimRatio,\n\t\t\t\toverlayColor.color\n\t\t\t);\n\t\t\tsetAttributes( {\n\t\t\t\tisDark: isDarkSetting,\n\t\t\t} );\n\t\t}\n\t\tif ( useFeaturedImage ) {\n\t\t\tsetIsDark();\n\t\t}\n\t\t// We only ever want to run this effect if the mediaUrl changes.\n\t\t// All other changes to the isDark state are handled in the appropriate event handlers.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ mediaUrl ] );\n\n\t// instead of destructuring the attributes\n\t// we define the url and background type\n\t// depending on the value of the useFeaturedImage flag\n\t// to preview in edit the dynamic featured image\n\tconst url = useFeaturedImage\n\t\t? mediaUrl\n\t\t: // Ensure the url is not malformed due to sanitization through `wp_kses`.\n\t\t attributes.url?.replaceAll( '&amp;', '&' );\n\tconst backgroundType = useFeaturedImage\n\t\t? IMAGE_BACKGROUND_TYPE\n\t\t: attributes.backgroundType;\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst { gradientClass, gradientValue } = __experimentalUseGradient();\n\tconst setMedia = attributesFromMedia( setAttributes, dimRatio );\n\n\tconst onSelectMedia = async ( newMedia ) => {\n\t\tconst isDarkSetting = await getCoverIsDark(\n\t\t\tnewMedia.url,\n\t\t\tdimRatio,\n\t\t\toverlayColor.color\n\t\t);\n\t\tsetMedia( newMedia, isDarkSetting );\n\t};\n\n\tconst onClearMedia = async () => {\n\t\tconst isDarkSetting = await getCoverIsDark(\n\t\t\tundefined,\n\t\t\tdimRatio,\n\t\t\toverlayColor.color\n\t\t);\n\t\tsetAttributes( {\n\t\t\turl: undefined,\n\t\t\tid: undefined,\n\t\t\tbackgroundType: undefined,\n\t\t\tfocalPoint: undefined,\n\t\t\thasParallax: undefined,\n\t\t\tisRepeated: undefined,\n\t\t\tuseFeaturedImage: false,\n\t\t\tisDark: isDarkSetting,\n\t\t} );\n\t};\n\n\tconst onSetOverlayColor = async ( colorValue ) => {\n\t\tconst isDarkSetting = await getCoverIsDark( url, dimRatio, colorValue );\n\t\tsetOverlayColor( colorValue );\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tsetAttributes( {\n\t\t\tisDark: isDarkSetting,\n\t\t} );\n\t};\n\n\tconst onUpdateDimRatio = async ( newDimRatio ) => {\n\t\tconst isDarkSetting = await getCoverIsDark(\n\t\t\turl,\n\t\t\tnewDimRatio,\n\t\t\toverlayColor.color\n\t\t);\n\n\t\tsetAttributes( {\n\t\t\tdimRatio: newDimRatio,\n\t\t\tisDark: isDarkSetting,\n\t\t} );\n\t};\n\n\tconst isUploadingMedia = isTemporaryMedia( id, url );\n\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t};\n\n\tconst isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType;\n\tconst isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType;\n\n\tconst [ resizeListener, { height, width } ] = useResizeObserver();\n\tconst resizableBoxDimensions = useMemo( () => {\n\t\treturn {\n\t\t\theight: minHeightUnit === 'px' ? minHeight : 'auto',\n\t\t\twidth: 'auto',\n\t\t};\n\t}, [ minHeight, minHeightUnit ] );\n\n\tconst minHeightWithUnit =\n\t\tminHeight && minHeightUnit\n\t\t\t? `${ minHeight }${ minHeightUnit }`\n\t\t\t: minHeight;\n\n\tconst isImgElement = ! ( hasParallax || isRepeated );\n\n\tconst style = {\n\t\tminHeight: minHeightWithUnit || undefined,\n\t};\n\n\tconst backgroundImage = url ? `url(${ url })` : undefined;\n\n\tconst backgroundPosition = mediaPosition( focalPoint );\n\n\tconst bgStyle = { backgroundColor: overlayColor.color };\n\tconst mediaStyle = {\n\t\tobjectPosition:\n\t\t\tfocalPoint && isImgElement\n\t\t\t\t? mediaPosition( focalPoint )\n\t\t\t\t: undefined,\n\t};\n\n\tconst hasBackground = !! ( url || overlayColor.color || gradientValue );\n\n\tconst hasInnerBlocks = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlock( clientId ).innerBlocks.length >\n\t\t\t0,\n\t\t[ clientId ]\n\t);\n\n\tconst ref = useRef();\n\tconst blockProps = useBlockProps( { ref } );\n\n\t// Check for fontSize support before we pass a fontSize attribute to the innerBlocks.\n\tconst hasFontSizes = !! useSetting( 'typography.fontSizes' )?.length;\n\tconst innerBlocksTemplate = getInnerBlocksTemplate( {\n\t\tfontSize: hasFontSizes ? 'large' : undefined,\n\t} );\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{\n\t\t\tclassName: 'wp-block-cover__inner-container',\n\t\t},\n\t\t{\n\t\t\t// Avoid template sync when the `templateLock` value is `all` or `contentOnly`.\n\t\t\t// See: https://github.com/WordPress/gutenberg/pull/45632\n\t\t\ttemplate: ! hasInnerBlocks ? innerBlocksTemplate : undefined,\n\t\t\ttemplateInsertUpdatesSelection: true,\n\t\t\tallowedBlocks,\n\t\t\ttemplateLock,\n\t\t}\n\t);\n\n\tconst mediaElement = useRef();\n\tconst currentSettings = {\n\t\tisVideoBackground,\n\t\tisImageBackground,\n\t\tmediaElement,\n\t\thasInnerBlocks,\n\t\turl,\n\t\tisImgElement,\n\t\toverlayColor,\n\t};\n\n\tconst toggleUseFeaturedImage = async () => {\n\t\tconst isDarkSetting = await ( useFeaturedImage\n\t\t\t? getCoverIsDark( undefined, dimRatio, overlayColor.color )\n\t\t\t: getCoverIsDark( mediaUrl, dimRatio, overlayColor.color ) );\n\t\tsetAttributes( {\n\t\t\tid: undefined,\n\t\t\turl: undefined,\n\t\t\tuseFeaturedImage: ! useFeaturedImage,\n\t\t\tdimRatio: dimRatio === 100 ? 50 : dimRatio,\n\t\t\tbackgroundType: useFeaturedImage\n\t\t\t\t? IMAGE_BACKGROUND_TYPE\n\t\t\t\t: undefined,\n\t\t\tisDark: isDarkSetting,\n\t\t} );\n\t};\n\n\tconst blockControls = (\n\t\t<CoverBlockControls\n\t\t\tattributes={ attributes }\n\t\t\tsetAttributes={ setAttributes }\n\t\t\tonSelectMedia={ onSelectMedia }\n\t\t\tcurrentSettings={ currentSettings }\n\t\t\ttoggleUseFeaturedImage={ toggleUseFeaturedImage }\n\t\t/>\n\t);\n\n\tconst inspectorControls = (\n\t\t<CoverInspectorControls\n\t\t\tattributes={ attributes }\n\t\t\tsetAttributes={ setAttributes }\n\t\t\tclientId={ clientId }\n\t\t\tsetOverlayColor={ onSetOverlayColor }\n\t\t\tcoverRef={ ref }\n\t\t\tcurrentSettings={ currentSettings }\n\t\t\ttoggleUseFeaturedImage={ toggleUseFeaturedImage }\n\t\t\tupdateDimRatio={ onUpdateDimRatio }\n\t\t\tonClearMedia={ onClearMedia }\n\t\t/>\n\t);\n\n\tconst resizableCoverProps = {\n\t\tclassName: 'block-library-cover__resize-container',\n\t\tclientId,\n\t\theight,\n\t\tminHeight: minHeightWithUnit,\n\t\tonResizeStart: () => {\n\t\t\tsetAttributes( { minHeightUnit: 'px' } );\n\t\t\ttoggleSelection( false );\n\t\t},\n\t\tonResize: ( value ) => {\n\t\t\tsetAttributes( { minHeight: value } );\n\t\t},\n\t\tonResizeStop: ( newMinHeight ) => {\n\t\t\ttoggleSelection( true );\n\t\t\tsetAttributes( { minHeight: newMinHeight } );\n\t\t},\n\t\tshowHandle: true,\n\t\tsize: resizableBoxDimensions,\n\t\twidth,\n\t};\n\n\tif ( ! useFeaturedImage && ! hasInnerBlocks && ! hasBackground ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ blockControls }\n\t\t\t\t{ inspectorControls }\n\t\t\t\t{ isSelected && (\n\t\t\t\t\t<ResizableCoverPopover { ...resizableCoverProps } />\n\t\t\t\t) }\n\t\t\t\t<TagName\n\t\t\t\t\t{ ...blockProps }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'is-placeholder',\n\t\t\t\t\t\tblockProps.className\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t...blockProps.style,\n\t\t\t\t\t\tminHeight: minHeightWithUnit || undefined,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ resizeListener }\n\t\t\t\t\t<CoverPlaceholder\n\t\t\t\t\t\tonSelectMedia={ onSelectMedia }\n\t\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t\ttoggleUseFeaturedImage={ toggleUseFeaturedImage }\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className=\"wp-block-cover__placeholder-background-options\">\n\t\t\t\t\t\t\t<ColorPalette\n\t\t\t\t\t\t\t\tdisableCustomColors={ true }\n\t\t\t\t\t\t\t\tvalue={ overlayColor.color }\n\t\t\t\t\t\t\t\tonChange={ onSetOverlayColor }\n\t\t\t\t\t\t\t\tclearable={ false }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</CoverPlaceholder>\n\t\t\t\t</TagName>\n\t\t\t</>\n\t\t);\n\t}\n\n\tconst classes = classnames(\n\t\t{\n\t\t\t'is-dark-theme': isDark,\n\t\t\t'is-light': ! isDark,\n\t\t\t'is-transient': isUploadingMedia,\n\t\t\t'has-parallax': hasParallax,\n\t\t\t'is-repeated': isRepeated,\n\t\t\t'has-custom-content-position':\n\t\t\t\t! isContentPositionCenter( contentPosition ),\n\t\t},\n\t\tgetPositionClassName( contentPosition )\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ blockControls }\n\t\t\t{ inspectorControls }\n\t\t\t<TagName\n\t\t\t\t{ ...blockProps }\n\t\t\t\tclassName={ classnames( classes, blockProps.className ) }\n\t\t\t\tstyle={ { ...style, ...blockProps.style } }\n\t\t\t\tdata-url={ url }\n\t\t\t>\n\t\t\t\t{ resizeListener }\n\t\t\t\t{ ( ! useFeaturedImage || url ) && (\n\t\t\t\t\t<span\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'wp-block-cover__background',\n\t\t\t\t\t\t\tdimRatioToClass( dimRatio ),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t[ overlayColor.class ]: overlayColor.class,\n\t\t\t\t\t\t\t\t'has-background-dim': dimRatio !== undefined,\n\t\t\t\t\t\t\t\t// For backwards compatibility. Former versions of the Cover Block applied\n\t\t\t\t\t\t\t\t// `.wp-block-cover__gradient-background` in the presence of\n\t\t\t\t\t\t\t\t// media, a gradient and a dim.\n\t\t\t\t\t\t\t\t'wp-block-cover__gradient-background':\n\t\t\t\t\t\t\t\t\turl && gradientValue && dimRatio !== 0,\n\t\t\t\t\t\t\t\t'has-background-gradient': gradientValue,\n\t\t\t\t\t\t\t\t[ gradientClass ]: gradientClass,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tstyle={ { backgroundImage: gradientValue, ...bgStyle } }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ ! url && useFeaturedImage && (\n\t\t\t\t\t<Placeholder\n\t\t\t\t\t\tclassName=\"wp-block-cover__image--placeholder-image\"\n\t\t\t\t\t\twithIllustration={ true }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ url &&\n\t\t\t\t\tisImageBackground &&\n\t\t\t\t\t( isImgElement ? (\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\tref={ mediaElement }\n\t\t\t\t\t\t\tclassName=\"wp-block-cover__image-background\"\n\t\t\t\t\t\t\talt={ alt }\n\t\t\t\t\t\t\tsrc={ url }\n\t\t\t\t\t\t\tstyle={ mediaStyle }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tref={ mediaElement }\n\t\t\t\t\t\t\trole=\"img\"\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\tclasses,\n\t\t\t\t\t\t\t\t'wp-block-cover__image-background'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tstyle={ { backgroundImage, backgroundPosition } }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t\t{ url && isVideoBackground && (\n\t\t\t\t\t<video\n\t\t\t\t\t\tref={ mediaElement }\n\t\t\t\t\t\tclassName=\"wp-block-cover__video-background\"\n\t\t\t\t\t\tautoPlay\n\t\t\t\t\t\tmuted\n\t\t\t\t\t\tloop\n\t\t\t\t\t\tsrc={ url }\n\t\t\t\t\t\tstyle={ mediaStyle }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ isUploadingMedia && <Spinner /> }\n\t\t\t\t<CoverPlaceholder\n\t\t\t\t\tdisableMediaButtons\n\t\t\t\t\tonSelectMedia={ onSelectMedia }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\ttoggleUseFeaturedImage={ toggleUseFeaturedImage }\n\t\t\t\t/>\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t</TagName>\n\t\t\t{ isSelected && (\n\t\t\t\t<ResizableCoverPopover { ...resizableCoverProps } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default compose( [\n\twithColors( { overlayColor: 'background-color' } ),\n] )( CoverEdit );\n"],"mappings":";;;;;;;AAWA,IAAAA,QAAA,GAAAC,OAAA;AARA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAF,sBAAA,CAAAF,OAAA;AAKA,IAAAK,SAAA,GAAAL,OAAA;AAEA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AASA,IAAAS,KAAA,GAAAT,OAAA;AACA,IAAAU,KAAA,GAAAV,OAAA;AACA,IAAAW,KAAA,GAAAX,OAAA;AACA,IAAAY,QAAA,GAAAZ,OAAA;AAKA,IAAAa,OAAA,GAAAb,OAAA;AAUA,IAAAc,kBAAA,GAAAZ,sBAAA,CAAAF,OAAA;AACA,IAAAe,cAAA,GAAAb,sBAAA,CAAAF,OAAA;AACA,IAAAgB,iBAAA,GAAAd,sBAAA,CAAAF,OAAA;AACA,IAAAiB,sBAAA,GAAAf,sBAAA,CAAAF,OAAA;AA5CA;AACA;AACA;;AAKA;AACA;AACA;;AAmBA;AACA;AACA;;AAgBA,IAAAkB,cAAM,EAAE,CAAEC,cAAW,CAAG,CAAC;AAEzB,SAASC,sBAAsBA,CAAEC,UAAU,EAAG;EAC7C,OAAO,CACN,CACC,gBAAgB,EAChB;IACCC,KAAK,EAAE,QAAQ;IACfC,WAAW,EAAE,IAAAC,QAAE,EAAE,cAAe,CAAC;IACjC,GAAGH;EACJ,CAAC,CACD,CACD;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMI,gBAAgB,GAAGA,CAAEC,EAAE,EAAEC,GAAG,KAAM,CAAED,EAAE,IAAI,IAAAE,eAAS,EAAED,GAAI,CAAC;AAEhE,SAASE,SAASA,C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AAC/H,WAAA,CAAA+J,OAAO,MAAE,CAAC,EACjC,IAAAtK,QAAA,CAAAsI,aAAA,EAACrH,iBAAA,CAAAsH,OAAgB;IAChBgC,mBAAmB;IACnBtF,aAAa,EAAGA,aAAe;IAC/BoE,OAAO,EAAG3D,aAAe;IACzB0C,sBAAsB,EAAGA;EAAwB,CACjD,CAAC,EACF,IAAApI,QAAA,CAAAsI,aAAA;IAAA,GAAUT;EAAgB,CAAI,CACtB,CAAC,EACR7F,UAAU,IACX,IAAAhC,QAAA,CAAAsI,aAAA,EAACpH,sBAAA,CAAAqH,OAAqB;IAAA,GAAMI;EAAmB,CAAI,CAEnD,CAAC;AAEL;AAAC,IAAA6B,QAAA,GAEc,IAAAC,gBAAO,EAAE,CACvB,IAAAC,uBAAU,EAAE;EAAEzI,YAAY,EAAE;AAAmB,CAAE,CAAC,CACjD,CAAC,CAAEH,SAAU,CAAC;AAAA6I,OAAA,CAAApC,OAAA,GAAAiC,QAAA"}
1
+ {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_colord","_names","_coreData","_components","_compose","_blockEditor","_i18n","_data","_blob","_notices","_shared","_inspectorControls","_blockControls","_coverPlaceholder","_resizableCoverPopover","extend","namesPlugin","getInnerBlocksTemplate","attributes","align","placeholder","__","isTemporaryMedia","id","url","isBlobURL","CoverEdit","clientId","isSelected","overlayColor","setAttributes","setOverlayColor","toggleSelection","context","postId","postType","contentPosition","useFeaturedImage","dimRatio","focalPoint","hasParallax","isDark","isRepeated","minHeight","minHeightUnit","alt","allowedBlocks","templateLock","tagName","TagName","featuredImage","useEntityProp","__unstableMarkNextChangeAsNotPersistent","useDispatch","blockEditorStore","media","useSelect","select","coreStore","getMedia","mediaUrl","source_url","useEffect","setIsDark","isDarkSetting","getCoverIsDark","color","replaceAll","backgroundType","IMAGE_BACKGROUND_TYPE","createErrorNotice","noticesStore","gradientClass","gradientValue","__experimentalUseGradient","setMedia","attributesFromMedia","onSelectMedia","newMedia","newUrl","type","undefined","onClearMedia","onSetOverlayColor","colorValue","onUpdateDimRatio","newDimRatio","isUploadingMedia","onUploadError","message","isImageBackground","isVideoBackground","VIDEO_BACKGROUND_TYPE","resizeListener","height","width","useResizeObserver","resizableBoxDimensions","useMemo","minHeightWithUnit","isImgElement","style","backgroundImage","backgroundPosition","mediaPosition","bgStyle","backgroundColor","mediaStyle","objectPosition","hasBackground","hasInnerBlocks","getBlock","innerBlocks","length","ref","useRef","blockProps","useBlockProps","hasFontSizes","useSetting","innerBlocksTemplate","fontSize","innerBlocksProps","useInnerBlocksProps","className","template","templateInsertUpdatesSelection","mediaElement","currentSettings","toggleUseFeaturedImage","blockControls","createElement","default","inspectorControls","coverRef","updateDimRatio","resizableCoverProps","onResizeStart","onResize","value","onResizeStop","newMinHeight","showHandle","size","Fragment","classnames","onError","ColorPalette","disableCustomColors","onChange","clearable","classes","isContentPositionCenter","getPositionClassName","dimRatioToClass","class","Placeholder","withIllustration","src","role","autoPlay","muted","loop","Spinner","disableMediaButtons","_default","compose","withColors","exports"],"sources":["@wordpress/block-library/src/cover/edit/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * WordPress dependencies\n */\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useEffect, useMemo, useRef } from '@wordpress/element';\nimport { Placeholder, Spinner } from '@wordpress/components';\nimport { compose, useResizeObserver } from '@wordpress/compose';\nimport {\n\twithColors,\n\tColorPalette,\n\tuseBlockProps,\n\tuseSetting,\n\tuseInnerBlocksProps,\n\t__experimentalUseGradient,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { isBlobURL } from '@wordpress/blob';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport {\n\tattributesFromMedia,\n\tIMAGE_BACKGROUND_TYPE,\n\tVIDEO_BACKGROUND_TYPE,\n\tdimRatioToClass,\n\tisContentPositionCenter,\n\tgetPositionClassName,\n\tmediaPosition,\n\tgetCoverIsDark,\n} from '../shared';\nimport CoverInspectorControls from './inspector-controls';\nimport CoverBlockControls from './block-controls';\nimport CoverPlaceholder from './cover-placeholder';\nimport ResizableCoverPopover from './resizable-cover-popover';\n\nextend( [ namesPlugin ] );\n\nfunction getInnerBlocksTemplate( attributes ) {\n\treturn [\n\t\t[\n\t\t\t'core/paragraph',\n\t\t\t{\n\t\t\t\talign: 'center',\n\t\t\t\tplaceholder: __( 'Write title…' ),\n\t\t\t\t...attributes,\n\t\t\t},\n\t\t],\n\t];\n}\n\n/**\n * Is the URL a temporary blob URL? A blob URL is one that is used temporarily while\n * the media (image or video) is being uploaded and will not have an id allocated yet.\n *\n * @param {number} id The id of the media.\n * @param {string} url The url of the media.\n *\n * @return {boolean} Is the URL a Blob URL.\n */\nconst isTemporaryMedia = ( id, url ) => ! id && isBlobURL( url );\n\nfunction CoverEdit( {\n\tattributes,\n\tclientId,\n\tisSelected,\n\toverlayColor,\n\tsetAttributes,\n\tsetOverlayColor,\n\ttoggleSelection,\n\tcontext: { postId, postType },\n} ) {\n\tconst {\n\t\tcontentPosition,\n\t\tid,\n\t\tuseFeaturedImage,\n\t\tdimRatio,\n\t\tfocalPoint,\n\t\thasParallax,\n\t\tisDark,\n\t\tisRepeated,\n\t\tminHeight,\n\t\tminHeightUnit,\n\t\talt,\n\t\tallowedBlocks,\n\t\ttemplateLock,\n\t\ttagName: TagName = 'div',\n\t} = attributes;\n\n\tconst [ featuredImage ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'featured_media',\n\t\tpostId\n\t);\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst media = useSelect(\n\t\t( select ) =>\n\t\t\tfeaturedImage &&\n\t\t\tselect( coreStore ).getMedia( featuredImage, { context: 'view' } ),\n\t\t[ featuredImage ]\n\t);\n\tconst mediaUrl = media?.source_url;\n\n\tuseEffect( () => {\n\t\tasync function setIsDark() {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tconst isDarkSetting = await getCoverIsDark(\n\t\t\t\tmediaUrl,\n\t\t\t\tdimRatio,\n\t\t\t\toverlayColor.color\n\t\t\t);\n\t\t\tsetAttributes( {\n\t\t\t\tisDark: isDarkSetting,\n\t\t\t} );\n\t\t}\n\t\tif ( useFeaturedImage ) {\n\t\t\tsetIsDark();\n\t\t}\n\t\t// We only ever want to run this effect if the mediaUrl changes.\n\t\t// All other changes to the isDark state are handled in the appropriate event handlers.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ mediaUrl ] );\n\n\t// instead of destructuring the attributes\n\t// we define the url and background type\n\t// depending on the value of the useFeaturedImage flag\n\t// to preview in edit the dynamic featured image\n\tconst url = useFeaturedImage\n\t\t? mediaUrl\n\t\t: // Ensure the url is not malformed due to sanitization through `wp_kses`.\n\t\t attributes.url?.replaceAll( '&amp;', '&' );\n\tconst backgroundType = useFeaturedImage\n\t\t? IMAGE_BACKGROUND_TYPE\n\t\t: attributes.backgroundType;\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst { gradientClass, gradientValue } = __experimentalUseGradient();\n\tconst setMedia = attributesFromMedia( setAttributes, dimRatio );\n\n\tconst onSelectMedia = async ( newMedia ) => {\n\t\t// Only pass the url to getCoverIsDark if the media is an image as video is not handled.\n\t\tconst newUrl = newMedia?.type === 'image' ? newMedia.url : undefined;\n\t\tconst isDarkSetting = await getCoverIsDark(\n\t\t\tnewUrl,\n\t\t\tdimRatio,\n\t\t\toverlayColor.color\n\t\t);\n\t\tsetMedia( newMedia, isDarkSetting );\n\t};\n\n\tconst onClearMedia = async () => {\n\t\tconst isDarkSetting = await getCoverIsDark(\n\t\t\tundefined,\n\t\t\tdimRatio,\n\t\t\toverlayColor.color\n\t\t);\n\t\tsetAttributes( {\n\t\t\turl: undefined,\n\t\t\tid: undefined,\n\t\t\tbackgroundType: undefined,\n\t\t\tfocalPoint: undefined,\n\t\t\thasParallax: undefined,\n\t\t\tisRepeated: undefined,\n\t\t\tuseFeaturedImage: false,\n\t\t\tisDark: isDarkSetting,\n\t\t} );\n\t};\n\n\tconst onSetOverlayColor = async ( colorValue ) => {\n\t\tconst isDarkSetting = await getCoverIsDark( url, dimRatio, colorValue );\n\t\tsetOverlayColor( colorValue );\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tsetAttributes( {\n\t\t\tisDark: isDarkSetting,\n\t\t} );\n\t};\n\n\tconst onUpdateDimRatio = async ( newDimRatio ) => {\n\t\tconst isDarkSetting = await getCoverIsDark(\n\t\t\turl,\n\t\t\tnewDimRatio,\n\t\t\toverlayColor.color\n\t\t);\n\n\t\tsetAttributes( {\n\t\t\tdimRatio: newDimRatio,\n\t\t\tisDark: isDarkSetting,\n\t\t} );\n\t};\n\n\tconst isUploadingMedia = isTemporaryMedia( id, url );\n\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t};\n\n\tconst isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType;\n\tconst isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType;\n\n\tconst [ resizeListener, { height, width } ] = useResizeObserver();\n\tconst resizableBoxDimensions = useMemo( () => {\n\t\treturn {\n\t\t\theight: minHeightUnit === 'px' ? minHeight : 'auto',\n\t\t\twidth: 'auto',\n\t\t};\n\t}, [ minHeight, minHeightUnit ] );\n\n\tconst minHeightWithUnit =\n\t\tminHeight && minHeightUnit\n\t\t\t? `${ minHeight }${ minHeightUnit }`\n\t\t\t: minHeight;\n\n\tconst isImgElement = ! ( hasParallax || isRepeated );\n\n\tconst style = {\n\t\tminHeight: minHeightWithUnit || undefined,\n\t};\n\n\tconst backgroundImage = url ? `url(${ url })` : undefined;\n\n\tconst backgroundPosition = mediaPosition( focalPoint );\n\n\tconst bgStyle = { backgroundColor: overlayColor.color };\n\tconst mediaStyle = {\n\t\tobjectPosition:\n\t\t\tfocalPoint && isImgElement\n\t\t\t\t? mediaPosition( focalPoint )\n\t\t\t\t: undefined,\n\t};\n\n\tconst hasBackground = !! ( url || overlayColor.color || gradientValue );\n\n\tconst hasInnerBlocks = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlock( clientId ).innerBlocks.length >\n\t\t\t0,\n\t\t[ clientId ]\n\t);\n\n\tconst ref = useRef();\n\tconst blockProps = useBlockProps( { ref } );\n\n\t// Check for fontSize support before we pass a fontSize attribute to the innerBlocks.\n\tconst hasFontSizes = !! useSetting( 'typography.fontSizes' )?.length;\n\tconst innerBlocksTemplate = getInnerBlocksTemplate( {\n\t\tfontSize: hasFontSizes ? 'large' : undefined,\n\t} );\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{\n\t\t\tclassName: 'wp-block-cover__inner-container',\n\t\t},\n\t\t{\n\t\t\t// Avoid template sync when the `templateLock` value is `all` or `contentOnly`.\n\t\t\t// See: https://github.com/WordPress/gutenberg/pull/45632\n\t\t\ttemplate: ! hasInnerBlocks ? innerBlocksTemplate : undefined,\n\t\t\ttemplateInsertUpdatesSelection: true,\n\t\t\tallowedBlocks,\n\t\t\ttemplateLock,\n\t\t}\n\t);\n\n\tconst mediaElement = useRef();\n\tconst currentSettings = {\n\t\tisVideoBackground,\n\t\tisImageBackground,\n\t\tmediaElement,\n\t\thasInnerBlocks,\n\t\turl,\n\t\tisImgElement,\n\t\toverlayColor,\n\t};\n\n\tconst toggleUseFeaturedImage = async () => {\n\t\tconst isDarkSetting = await ( useFeaturedImage\n\t\t\t? getCoverIsDark( undefined, dimRatio, overlayColor.color )\n\t\t\t: getCoverIsDark( mediaUrl, dimRatio, overlayColor.color ) );\n\t\tsetAttributes( {\n\t\t\tid: undefined,\n\t\t\turl: undefined,\n\t\t\tuseFeaturedImage: ! useFeaturedImage,\n\t\t\tdimRatio: dimRatio === 100 ? 50 : dimRatio,\n\t\t\tbackgroundType: useFeaturedImage\n\t\t\t\t? IMAGE_BACKGROUND_TYPE\n\t\t\t\t: undefined,\n\t\t\tisDark: isDarkSetting,\n\t\t} );\n\t};\n\n\tconst blockControls = (\n\t\t<CoverBlockControls\n\t\t\tattributes={ attributes }\n\t\t\tsetAttributes={ setAttributes }\n\t\t\tonSelectMedia={ onSelectMedia }\n\t\t\tcurrentSettings={ currentSettings }\n\t\t\ttoggleUseFeaturedImage={ toggleUseFeaturedImage }\n\t\t/>\n\t);\n\n\tconst inspectorControls = (\n\t\t<CoverInspectorControls\n\t\t\tattributes={ attributes }\n\t\t\tsetAttributes={ setAttributes }\n\t\t\tclientId={ clientId }\n\t\t\tsetOverlayColor={ onSetOverlayColor }\n\t\t\tcoverRef={ ref }\n\t\t\tcurrentSettings={ currentSettings }\n\t\t\ttoggleUseFeaturedImage={ toggleUseFeaturedImage }\n\t\t\tupdateDimRatio={ onUpdateDimRatio }\n\t\t\tonClearMedia={ onClearMedia }\n\t\t/>\n\t);\n\n\tconst resizableCoverProps = {\n\t\tclassName: 'block-library-cover__resize-container',\n\t\tclientId,\n\t\theight,\n\t\tminHeight: minHeightWithUnit,\n\t\tonResizeStart: () => {\n\t\t\tsetAttributes( { minHeightUnit: 'px' } );\n\t\t\ttoggleSelection( false );\n\t\t},\n\t\tonResize: ( value ) => {\n\t\t\tsetAttributes( { minHeight: value } );\n\t\t},\n\t\tonResizeStop: ( newMinHeight ) => {\n\t\t\ttoggleSelection( true );\n\t\t\tsetAttributes( { minHeight: newMinHeight } );\n\t\t},\n\t\tshowHandle: true,\n\t\tsize: resizableBoxDimensions,\n\t\twidth,\n\t};\n\n\tif ( ! useFeaturedImage && ! hasInnerBlocks && ! hasBackground ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ blockControls }\n\t\t\t\t{ inspectorControls }\n\t\t\t\t{ isSelected && (\n\t\t\t\t\t<ResizableCoverPopover { ...resizableCoverProps } />\n\t\t\t\t) }\n\t\t\t\t<TagName\n\t\t\t\t\t{ ...blockProps }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'is-placeholder',\n\t\t\t\t\t\tblockProps.className\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t...blockProps.style,\n\t\t\t\t\t\tminHeight: minHeightWithUnit || undefined,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ resizeListener }\n\t\t\t\t\t<CoverPlaceholder\n\t\t\t\t\t\tonSelectMedia={ onSelectMedia }\n\t\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t\ttoggleUseFeaturedImage={ toggleUseFeaturedImage }\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className=\"wp-block-cover__placeholder-background-options\">\n\t\t\t\t\t\t\t<ColorPalette\n\t\t\t\t\t\t\t\tdisableCustomColors={ true }\n\t\t\t\t\t\t\t\tvalue={ overlayColor.color }\n\t\t\t\t\t\t\t\tonChange={ onSetOverlayColor }\n\t\t\t\t\t\t\t\tclearable={ false }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</CoverPlaceholder>\n\t\t\t\t</TagName>\n\t\t\t</>\n\t\t);\n\t}\n\n\tconst classes = classnames(\n\t\t{\n\t\t\t'is-dark-theme': isDark,\n\t\t\t'is-light': ! isDark,\n\t\t\t'is-transient': isUploadingMedia,\n\t\t\t'has-parallax': hasParallax,\n\t\t\t'is-repeated': isRepeated,\n\t\t\t'has-custom-content-position':\n\t\t\t\t! isContentPositionCenter( contentPosition ),\n\t\t},\n\t\tgetPositionClassName( contentPosition )\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ blockControls }\n\t\t\t{ inspectorControls }\n\t\t\t<TagName\n\t\t\t\t{ ...blockProps }\n\t\t\t\tclassName={ classnames( classes, blockProps.className ) }\n\t\t\t\tstyle={ { ...style, ...blockProps.style } }\n\t\t\t\tdata-url={ url }\n\t\t\t>\n\t\t\t\t{ resizeListener }\n\t\t\t\t{ ( ! useFeaturedImage || url ) && (\n\t\t\t\t\t<span\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'wp-block-cover__background',\n\t\t\t\t\t\t\tdimRatioToClass( dimRatio ),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t[ overlayColor.class ]: overlayColor.class,\n\t\t\t\t\t\t\t\t'has-background-dim': dimRatio !== undefined,\n\t\t\t\t\t\t\t\t// For backwards compatibility. Former versions of the Cover Block applied\n\t\t\t\t\t\t\t\t// `.wp-block-cover__gradient-background` in the presence of\n\t\t\t\t\t\t\t\t// media, a gradient and a dim.\n\t\t\t\t\t\t\t\t'wp-block-cover__gradient-background':\n\t\t\t\t\t\t\t\t\turl && gradientValue && dimRatio !== 0,\n\t\t\t\t\t\t\t\t'has-background-gradient': gradientValue,\n\t\t\t\t\t\t\t\t[ gradientClass ]: gradientClass,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tstyle={ { backgroundImage: gradientValue, ...bgStyle } }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ ! url && useFeaturedImage && (\n\t\t\t\t\t<Placeholder\n\t\t\t\t\t\tclassName=\"wp-block-cover__image--placeholder-image\"\n\t\t\t\t\t\twithIllustration={ true }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ url &&\n\t\t\t\t\tisImageBackground &&\n\t\t\t\t\t( isImgElement ? (\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\tref={ mediaElement }\n\t\t\t\t\t\t\tclassName=\"wp-block-cover__image-background\"\n\t\t\t\t\t\t\talt={ alt }\n\t\t\t\t\t\t\tsrc={ url }\n\t\t\t\t\t\t\tstyle={ mediaStyle }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tref={ mediaElement }\n\t\t\t\t\t\t\trole=\"img\"\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\tclasses,\n\t\t\t\t\t\t\t\t'wp-block-cover__image-background'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tstyle={ { backgroundImage, backgroundPosition } }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t\t{ url && isVideoBackground && (\n\t\t\t\t\t<video\n\t\t\t\t\t\tref={ mediaElement }\n\t\t\t\t\t\tclassName=\"wp-block-cover__video-background\"\n\t\t\t\t\t\tautoPlay\n\t\t\t\t\t\tmuted\n\t\t\t\t\t\tloop\n\t\t\t\t\t\tsrc={ url }\n\t\t\t\t\t\tstyle={ mediaStyle }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ isUploadingMedia && <Spinner /> }\n\t\t\t\t<CoverPlaceholder\n\t\t\t\t\tdisableMediaButtons\n\t\t\t\t\tonSelectMedia={ onSelectMedia }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\ttoggleUseFeaturedImage={ toggleUseFeaturedImage }\n\t\t\t\t/>\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t</TagName>\n\t\t\t{ isSelected && (\n\t\t\t\t<ResizableCoverPopover { ...resizableCoverProps } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default compose( [\n\twithColors( { overlayColor: 'background-color' } ),\n] )( CoverEdit );\n"],"mappings":";;;;;;;AAWA,IAAAA,QAAA,GAAAC,OAAA;AARA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAF,sBAAA,CAAAF,OAAA;AAKA,IAAAK,SAAA,GAAAL,OAAA;AAEA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AASA,IAAAS,KAAA,GAAAT,OAAA;AACA,IAAAU,KAAA,GAAAV,OAAA;AACA,IAAAW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,CAEnD,CAAC;AAEL;AAAC,IAAA6B,QAAA,GAEc,IAAAC,gBAAO,EAAE,CACvB,IAAAC,uBAAU,EAAE;EAAE1I,YAAY,EAAE;AAAmB,CAAE,CAAC,CACjD,CAAC,CAAEH,SAAU,CAAC;AAAA8I,OAAA,CAAApC,OAAA,GAAAiC,QAAA"}
@@ -175,27 +175,32 @@ function retrieveFastAverageColor() {
175
175
  async function getCoverIsDark(url, dimRatio = 50, overlayColor) {
176
176
  const overlay = (0, _colord.colord)(overlayColor).alpha(dimRatio / 100).toRgb();
177
177
  if (url) {
178
- const imgCrossOrigin = (0, _hooks.applyFilters)('media.crossOrigin', undefined, url);
179
- const {
180
- value: [r, g, b, a]
181
- } = await retrieveFastAverageColor().getColorAsync(url, {
182
- // Previously the default color was white, but that changed
183
- // in v6.0.0 so it has to be manually set now.
184
- defaultColor: [255, 255, 255, 255],
185
- // Errors that come up don't reject the promise, so error
186
- // logging has to be silenced with this option.
187
- silent: process.env.NODE_ENV === 'production',
188
- crossOrigin: imgCrossOrigin
189
- });
190
- // FAC uses 0-255 for alpha, but colord expects 0-1.
191
- const media = {
192
- r,
193
- g,
194
- b,
195
- a: a / 255
196
- };
197
- const composite = compositeSourceOver(overlay, media);
198
- return (0, _colord.colord)(composite).isDark();
178
+ try {
179
+ const imgCrossOrigin = (0, _hooks.applyFilters)('media.crossOrigin', undefined, url);
180
+ const {
181
+ value: [r, g, b, a]
182
+ } = await retrieveFastAverageColor().getColorAsync(url, {
183
+ // Previously the default color was white, but that changed
184
+ // in v6.0.0 so it has to be manually set now.
185
+ defaultColor: [255, 255, 255, 255],
186
+ // Errors that come up don't reject the promise, so error
187
+ // logging has to be silenced with this option.
188
+ silent: process.env.NODE_ENV === 'production',
189
+ crossOrigin: imgCrossOrigin
190
+ });
191
+ // FAC uses 0-255 for alpha, but colord expects 0-1.
192
+ const media = {
193
+ r,
194
+ g,
195
+ b,
196
+ a: a / 255
197
+ };
198
+ const composite = compositeSourceOver(overlay, media);
199
+ return (0, _colord.colord)(composite).isDark();
200
+ } catch (error) {
201
+ // If there's an error, just assume the image is dark.
202
+ return true;
203
+ }
199
204
  }
200
205
 
201
206
  // Assume a white background because it isn't easy to get the actual
@@ -1 +1 @@
1
- {"version":3,"names":["_fastAverageColor","require","_colord","_blob","_hooks","POSITION_CLASSNAMES","center","IMAGE_BACKGROUND_TYPE","exports","VIDEO_BACKGROUND_TYPE","COVER_MIN_HEIGHT","COVER_MAX_HEIGHT","COVER_DEFAULT_HEIGHT","DEFAULT_FOCAL_POINT","x","y","ALLOWED_MEDIA_TYPES","mediaPosition","Math","round","dimRatioToClass","ratio","undefined","attributesFromMedia","setAttributes","dimRatio","media","isDark","url","id","isBlobURL","type","getBlobTypeByURL","mediaType","media_type","alt","backgroundType","focalPoint","hasParallax","isContentPositionCenter","contentPosition","getPositionClassName","compositeSourceOver","source","dest","r","a","g","b","retrieveFastAverageColor","fastAverageColor","FastAverageColor","getCoverIsDark","overlayColor","overlay","colord","alpha","toRgb","imgCrossOrigin","applyFilters","value","getColorAsync","defaultColor","silent","process","env","NODE_ENV","crossOrigin","composite","background"],"sources":["@wordpress/block-library/src/cover/shared.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { FastAverageColor } from 'fast-average-color';\nimport { colord } from 'colord';\n\n/**\n * WordPress dependencies\n */\nimport { getBlobTypeByURL, isBlobURL } from '@wordpress/blob';\nimport { applyFilters } from '@wordpress/hooks';\n\nconst POSITION_CLASSNAMES = {\n\t'top left': 'is-position-top-left',\n\t'top center': 'is-position-top-center',\n\t'top right': 'is-position-top-right',\n\t'center left': 'is-position-center-left',\n\t'center center': 'is-position-center-center',\n\tcenter: 'is-position-center-center',\n\t'center right': 'is-position-center-right',\n\t'bottom left': 'is-position-bottom-left',\n\t'bottom center': 'is-position-bottom-center',\n\t'bottom right': 'is-position-bottom-right',\n};\n\nexport const IMAGE_BACKGROUND_TYPE = 'image';\nexport const VIDEO_BACKGROUND_TYPE = 'video';\nexport const COVER_MIN_HEIGHT = 50;\nexport const COVER_MAX_HEIGHT = 1000;\nexport const COVER_DEFAULT_HEIGHT = 300;\nexport const DEFAULT_FOCAL_POINT = { x: 0.5, y: 0.5 };\nexport const ALLOWED_MEDIA_TYPES = [ 'image', 'video' ];\n\nexport function mediaPosition( { x, y } = DEFAULT_FOCAL_POINT ) {\n\treturn `${ Math.round( x * 100 ) }% ${ Math.round( y * 100 ) }%`;\n}\n\nexport function dimRatioToClass( ratio ) {\n\treturn ratio === 50 || ! ratio === undefined\n\t\t? null\n\t\t: 'has-background-dim-' + 10 * Math.round( ratio / 10 );\n}\n\nexport function attributesFromMedia( setAttributes, dimRatio ) {\n\treturn ( media, isDark ) => {\n\t\tif ( ! media || ! media.url ) {\n\t\t\tsetAttributes( { url: undefined, id: undefined, isDark } );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isBlobURL( media.url ) ) {\n\t\t\tmedia.type = getBlobTypeByURL( media.url );\n\t\t}\n\n\t\tlet mediaType;\n\t\t// For media selections originated from a file upload.\n\t\tif ( media.media_type ) {\n\t\t\tif ( media.media_type === IMAGE_BACKGROUND_TYPE ) {\n\t\t\t\tmediaType = IMAGE_BACKGROUND_TYPE;\n\t\t\t} else {\n\t\t\t\t// only images and videos are accepted so if the media_type is not an image we can assume it is a video.\n\t\t\t\t// Videos contain the media type of 'file' in the object returned from the rest api.\n\t\t\t\tmediaType = VIDEO_BACKGROUND_TYPE;\n\t\t\t}\n\t\t} else {\n\t\t\t// For media selections originated from existing files in the media library.\n\t\t\tif (\n\t\t\t\tmedia.type !== IMAGE_BACKGROUND_TYPE &&\n\t\t\t\tmedia.type !== VIDEO_BACKGROUND_TYPE\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tmediaType = media.type;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\tisDark,\n\t\t\tdimRatio: dimRatio === 100 ? 50 : dimRatio,\n\t\t\turl: media.url,\n\t\t\tid: media.id,\n\t\t\talt: media?.alt,\n\t\t\tbackgroundType: mediaType,\n\t\t\tfocalPoint: undefined,\n\t\t\t...( mediaType === VIDEO_BACKGROUND_TYPE\n\t\t\t\t? { hasParallax: undefined }\n\t\t\t\t: {} ),\n\t\t} );\n\t};\n}\n\n/**\n * Checks of the contentPosition is the center (default) position.\n *\n * @param {string} contentPosition The current content position.\n * @return {boolean} Whether the contentPosition is center.\n */\nexport function isContentPositionCenter( contentPosition ) {\n\treturn (\n\t\t! contentPosition ||\n\t\tcontentPosition === 'center center' ||\n\t\tcontentPosition === 'center'\n\t);\n}\n\n/**\n * Retrieves the className for the current contentPosition.\n * The default position (center) will not have a className.\n *\n * @param {string} contentPosition The current content position.\n * @return {string} The className assigned to the contentPosition.\n */\nexport function getPositionClassName( contentPosition ) {\n\t/*\n\t * Only render a className if the contentPosition is not center (the default).\n\t */\n\tif ( isContentPositionCenter( contentPosition ) ) return '';\n\n\treturn POSITION_CLASSNAMES[ contentPosition ];\n}\n\n/**\n * Performs a Porter Duff composite source over operation on two rgba colors.\n *\n * @see https://www.w3.org/TR/compositing-1/#porterduffcompositingoperators_srcover\n *\n * @param {import('colord').RgbaColor} source Source color.\n * @param {import('colord').RgbaColor} dest Destination color.\n * @return {import('colord').RgbaColor} Composite color.\n */\nfunction compositeSourceOver( source, dest ) {\n\treturn {\n\t\tr: source.r * source.a + dest.r * dest.a * ( 1 - source.a ),\n\t\tg: source.g * source.a + dest.g * dest.a * ( 1 - source.a ),\n\t\tb: source.b * source.a + dest.b * dest.a * ( 1 - source.a ),\n\t\ta: source.a + dest.a * ( 1 - source.a ),\n\t};\n}\n\nfunction retrieveFastAverageColor() {\n\tif ( ! retrieveFastAverageColor.fastAverageColor ) {\n\t\tretrieveFastAverageColor.fastAverageColor = new FastAverageColor();\n\t}\n\treturn retrieveFastAverageColor.fastAverageColor;\n}\n\n/**\n * This method evaluates if the cover block's background is dark or not and this boolean\n * can then be applied to the relevant attribute to help ensure that text is visible by default.\n * This needs to be recalculated in all of the following Cover block scenarios:\n * - When an overlay image is added, changed or removed\n * - When the featured image is selected as the overlay image, or removed from the overlay\n * - When the overlay color is changed\n * - When the overlay color is removed\n * - When the dimRatio is changed\n *\n * See the comments below for more details about which aspects take priority when\n * calculating the relative darkness of the Cover.\n *\n * @param {string} url\n * @param {number} dimRatio\n * @param {string} overlayColor\n * @return {Promise<boolean>} True if cover should be considered to be dark.\n */\nexport async function getCoverIsDark( url, dimRatio = 50, overlayColor ) {\n\tconst overlay = colord( overlayColor )\n\t\t.alpha( dimRatio / 100 )\n\t\t.toRgb();\n\n\tif ( url ) {\n\t\tconst imgCrossOrigin = applyFilters(\n\t\t\t'media.crossOrigin',\n\t\t\tundefined,\n\t\t\turl\n\t\t);\n\t\tconst {\n\t\t\tvalue: [ r, g, b, a ],\n\t\t} = await retrieveFastAverageColor().getColorAsync( url, {\n\t\t\t// Previously the default color was white, but that changed\n\t\t\t// in v6.0.0 so it has to be manually set now.\n\t\t\tdefaultColor: [ 255, 255, 255, 255 ],\n\t\t\t// Errors that come up don't reject the promise, so error\n\t\t\t// logging has to be silenced with this option.\n\t\t\tsilent: process.env.NODE_ENV === 'production',\n\t\t\tcrossOrigin: imgCrossOrigin,\n\t\t} );\n\t\t// FAC uses 0-255 for alpha, but colord expects 0-1.\n\t\tconst media = { r, g, b, a: a / 255 };\n\t\tconst composite = compositeSourceOver( overlay, media );\n\t\treturn colord( composite ).isDark();\n\t}\n\n\t// Assume a white background because it isn't easy to get the actual\n\t// parent background color.\n\tconst background = { r: 255, g: 255, b: 255, a: 1 };\n\tconst composite = compositeSourceOver( overlay, background );\n\treturn colord( composite ).isDark();\n}\n"],"mappings":";;;;;;;;;;;;AAGA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAVA;AACA;AACA;;AAIA;AACA;AACA;;AAIA,MAAMI,mBAAmB,GAAG;EAC3B,UAAU,EAAE,sBAA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AAS,GAAG1B,mBAAmB,CAAEY,OAAO,EAAEe,UAAW,CAAC;EAC5D,OAAO,IAAAd,cAAM,EAAEa,SAAU,CAAC,CAACzC,MAAM,CAAC,CAAC;AACpC"}
1
+ {"version":3,"names":["_fastAverageColor","require","_colord","_blob","_hooks","POSITION_CLASSNAMES","center","IMAGE_BACKGROUND_TYPE","exports","VIDEO_BACKGROUND_TYPE","COVER_MIN_HEIGHT","COVER_MAX_HEIGHT","COVER_DEFAULT_HEIGHT","DEFAULT_FOCAL_POINT","x","y","ALLOWED_MEDIA_TYPES","mediaPosition","Math","round","dimRatioToClass","ratio","undefined","attributesFromMedia","setAttributes","dimRatio","media","isDark","url","id","isBlobURL","type","getBlobTypeByURL","mediaType","media_type","alt","backgroundType","focalPoint","hasParallax","isContentPositionCenter","contentPosition","getPositionClassName","compositeSourceOver","source","dest","r","a","g","b","retrieveFastAverageColor","fastAverageColor","FastAverageColor","getCoverIsDark","overlayColor","overlay","colord","alpha","toRgb","imgCrossOrigin","applyFilters","value","getColorAsync","defaultColor","silent","process","env","NODE_ENV","crossOrigin","composite","error","background"],"sources":["@wordpress/block-library/src/cover/shared.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { FastAverageColor } from 'fast-average-color';\nimport { colord } from 'colord';\n\n/**\n * WordPress dependencies\n */\nimport { getBlobTypeByURL, isBlobURL } from '@wordpress/blob';\nimport { applyFilters } from '@wordpress/hooks';\n\nconst POSITION_CLASSNAMES = {\n\t'top left': 'is-position-top-left',\n\t'top center': 'is-position-top-center',\n\t'top right': 'is-position-top-right',\n\t'center left': 'is-position-center-left',\n\t'center center': 'is-position-center-center',\n\tcenter: 'is-position-center-center',\n\t'center right': 'is-position-center-right',\n\t'bottom left': 'is-position-bottom-left',\n\t'bottom center': 'is-position-bottom-center',\n\t'bottom right': 'is-position-bottom-right',\n};\n\nexport const IMAGE_BACKGROUND_TYPE = 'image';\nexport const VIDEO_BACKGROUND_TYPE = 'video';\nexport const COVER_MIN_HEIGHT = 50;\nexport const COVER_MAX_HEIGHT = 1000;\nexport const COVER_DEFAULT_HEIGHT = 300;\nexport const DEFAULT_FOCAL_POINT = { x: 0.5, y: 0.5 };\nexport const ALLOWED_MEDIA_TYPES = [ 'image', 'video' ];\n\nexport function mediaPosition( { x, y } = DEFAULT_FOCAL_POINT ) {\n\treturn `${ Math.round( x * 100 ) }% ${ Math.round( y * 100 ) }%`;\n}\n\nexport function dimRatioToClass( ratio ) {\n\treturn ratio === 50 || ! ratio === undefined\n\t\t? null\n\t\t: 'has-background-dim-' + 10 * Math.round( ratio / 10 );\n}\n\nexport function attributesFromMedia( setAttributes, dimRatio ) {\n\treturn ( media, isDark ) => {\n\t\tif ( ! media || ! media.url ) {\n\t\t\tsetAttributes( { url: undefined, id: undefined, isDark } );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isBlobURL( media.url ) ) {\n\t\t\tmedia.type = getBlobTypeByURL( media.url );\n\t\t}\n\n\t\tlet mediaType;\n\t\t// For media selections originated from a file upload.\n\t\tif ( media.media_type ) {\n\t\t\tif ( media.media_type === IMAGE_BACKGROUND_TYPE ) {\n\t\t\t\tmediaType = IMAGE_BACKGROUND_TYPE;\n\t\t\t} else {\n\t\t\t\t// only images and videos are accepted so if the media_type is not an image we can assume it is a video.\n\t\t\t\t// Videos contain the media type of 'file' in the object returned from the rest api.\n\t\t\t\tmediaType = VIDEO_BACKGROUND_TYPE;\n\t\t\t}\n\t\t} else {\n\t\t\t// For media selections originated from existing files in the media library.\n\t\t\tif (\n\t\t\t\tmedia.type !== IMAGE_BACKGROUND_TYPE &&\n\t\t\t\tmedia.type !== VIDEO_BACKGROUND_TYPE\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tmediaType = media.type;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\tisDark,\n\t\t\tdimRatio: dimRatio === 100 ? 50 : dimRatio,\n\t\t\turl: media.url,\n\t\t\tid: media.id,\n\t\t\talt: media?.alt,\n\t\t\tbackgroundType: mediaType,\n\t\t\tfocalPoint: undefined,\n\t\t\t...( mediaType === VIDEO_BACKGROUND_TYPE\n\t\t\t\t? { hasParallax: undefined }\n\t\t\t\t: {} ),\n\t\t} );\n\t};\n}\n\n/**\n * Checks of the contentPosition is the center (default) position.\n *\n * @param {string} contentPosition The current content position.\n * @return {boolean} Whether the contentPosition is center.\n */\nexport function isContentPositionCenter( contentPosition ) {\n\treturn (\n\t\t! contentPosition ||\n\t\tcontentPosition === 'center center' ||\n\t\tcontentPosition === 'center'\n\t);\n}\n\n/**\n * Retrieves the className for the current contentPosition.\n * The default position (center) will not have a className.\n *\n * @param {string} contentPosition The current content position.\n * @return {string} The className assigned to the contentPosition.\n */\nexport function getPositionClassName( contentPosition ) {\n\t/*\n\t * Only render a className if the contentPosition is not center (the default).\n\t */\n\tif ( isContentPositionCenter( contentPosition ) ) return '';\n\n\treturn POSITION_CLASSNAMES[ contentPosition ];\n}\n\n/**\n * Performs a Porter Duff composite source over operation on two rgba colors.\n *\n * @see https://www.w3.org/TR/compositing-1/#porterduffcompositingoperators_srcover\n *\n * @param {import('colord').RgbaColor} source Source color.\n * @param {import('colord').RgbaColor} dest Destination color.\n * @return {import('colord').RgbaColor} Composite color.\n */\nfunction compositeSourceOver( source, dest ) {\n\treturn {\n\t\tr: source.r * source.a + dest.r * dest.a * ( 1 - source.a ),\n\t\tg: source.g * source.a + dest.g * dest.a * ( 1 - source.a ),\n\t\tb: source.b * source.a + dest.b * dest.a * ( 1 - source.a ),\n\t\ta: source.a + dest.a * ( 1 - source.a ),\n\t};\n}\n\nfunction retrieveFastAverageColor() {\n\tif ( ! retrieveFastAverageColor.fastAverageColor ) {\n\t\tretrieveFastAverageColor.fastAverageColor = new FastAverageColor();\n\t}\n\treturn retrieveFastAverageColor.fastAverageColor;\n}\n\n/**\n * This method evaluates if the cover block's background is dark or not and this boolean\n * can then be applied to the relevant attribute to help ensure that text is visible by default.\n * This needs to be recalculated in all of the following Cover block scenarios:\n * - When an overlay image is added, changed or removed\n * - When the featured image is selected as the overlay image, or removed from the overlay\n * - When the overlay color is changed\n * - When the overlay color is removed\n * - When the dimRatio is changed\n *\n * See the comments below for more details about which aspects take priority when\n * calculating the relative darkness of the Cover.\n *\n * @param {string} url\n * @param {number} dimRatio\n * @param {string} overlayColor\n * @return {Promise<boolean>} True if cover should be considered to be dark.\n */\nexport async function getCoverIsDark( url, dimRatio = 50, overlayColor ) {\n\tconst overlay = colord( overlayColor )\n\t\t.alpha( dimRatio / 100 )\n\t\t.toRgb();\n\n\tif ( url ) {\n\t\ttry {\n\t\t\tconst imgCrossOrigin = applyFilters(\n\t\t\t\t'media.crossOrigin',\n\t\t\t\tundefined,\n\t\t\t\turl\n\t\t\t);\n\t\t\tconst {\n\t\t\t\tvalue: [ r, g, b, a ],\n\t\t\t} = await retrieveFastAverageColor().getColorAsync( url, {\n\t\t\t\t// Previously the default color was white, but that changed\n\t\t\t\t// in v6.0.0 so it has to be manually set now.\n\t\t\t\tdefaultColor: [ 255, 255, 255, 255 ],\n\t\t\t\t// Errors that come up don't reject the promise, so error\n\t\t\t\t// logging has to be silenced with this option.\n\t\t\t\tsilent: process.env.NODE_ENV === 'production',\n\t\t\t\tcrossOrigin: imgCrossOrigin,\n\t\t\t} );\n\t\t\t// FAC uses 0-255 for alpha, but colord expects 0-1.\n\t\t\tconst media = { r, g, b, a: a / 255 };\n\t\t\tconst composite = compositeSourceOver( overlay, media );\n\t\t\treturn colord( composite ).isDark();\n\t\t} catch ( error ) {\n\t\t\t// If there's an error, just assume the image is dark.\n\t\t\treturn true;\n\t\t}\n\t}\n\n\t// Assume a white background because it isn't easy to get the actual\n\t// parent background color.\n\tconst background = { r: 255, g: 255, b: 255, a: 1 };\n\tconst composite = compositeSourceOver( overlay, background );\n\treturn colord( composite ).isDark();\n}\n"],"mappings":";;;;;;;;;;;;AAGA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAAE,KAAA,GAAAF,O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EAAG;MACjB;MACA,OAAO,IAAI;IACZ;EACD;;EAEA;EACA;EACA,MAAMC,UAAU,GAAG;IAAEzB,CAAC,EAAE,GAAG;IAAEE,CAAC,EAAE,GAAG;IAAEC,CAAC,EAAE,GAAG;IAAEF,CAAC,EAAE;EAAE,CAAC;EACnD,MAAMsB,SAAS,GAAG1B,mBAAmB,CAAEY,OAAO,EAAEgB,UAAW,CAAC;EAC5D,OAAO,IAAAf,cAAM,EAAEa,SAAU,CAAC,CAACzC,MAAM,CAAC,CAAC;AACpC"}
@@ -82,7 +82,6 @@ const EmbedLinkSettings = ({
82
82
  onDismiss: onDismiss,
83
83
  setAttributes: onSetAttributes,
84
84
  options: linkSettingsOptions,
85
- testID: "embed-edit-url-modal",
86
85
  withBottomSheet: withBottomSheet,
87
86
  showIcon: true
88
87
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_i18n","_components","_url","_data","_notices","EmbedLinkSettings","autoFocus","value","label","isVisible","onClose","onSubmit","withBottomSheet","url","useRef","inputURL","setInputURL","useState","createErrorNotice","useDispatch","noticesStore","linkSettingsOptions","sprintf","__","placeholder","autoFill","footer","createElement","FooterMessageLink","href","separatorType","onDismiss","useCallback","isURL","current","useEffect","performOnCloseOperations","onSetAttributes","attributes","LinkSettingsNavigation","setAttributes","options","testID","showIcon","_default","exports","default"],"sources":["@wordpress/block-library/src/embed/embed-link-settings.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tLinkSettingsNavigation,\n\tFooterMessageLink,\n} from '@wordpress/components';\nimport { isURL } from '@wordpress/url';\nimport { useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useCallback, useEffect, useRef, useState } from '@wordpress/element';\n\nconst EmbedLinkSettings = ( {\n\tautoFocus,\n\tvalue,\n\tlabel,\n\tisVisible,\n\tonClose,\n\tonSubmit,\n\twithBottomSheet,\n} ) => {\n\tconst url = useRef( value );\n\tconst [ inputURL, setInputURL ] = useState( value );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tconst linkSettingsOptions = {\n\t\turl: {\n\t\t\tlabel: sprintf(\n\t\t\t\t// translators: %s: embed block variant's label e.g: \"Twitter\".\n\t\t\t\t__( '%s link' ),\n\t\t\t\tlabel\n\t\t\t),\n\t\t\tplaceholder: __( 'Add link' ),\n\t\t\tautoFocus,\n\t\t\tautoFill: true,\n\t\t},\n\t\tfooter: {\n\t\t\tlabel: (\n\t\t\t\t<FooterMessageLink\n\t\t\t\t\thref={ __(\n\t\t\t\t\t\t'https://wordpress.org/documentation/article/embeds/'\n\t\t\t\t\t) }\n\t\t\t\t\tvalue={ __( 'Learn more about embeds' ) }\n\t\t\t\t/>\n\t\t\t),\n\t\t\tseparatorType: 'topFullWidth',\n\t\t},\n\t};\n\n\tconst onDismiss = useCallback( () => {\n\t\tif ( ! isURL( url.current ) && url.current !== '' ) {\n\t\t\tcreateErrorNotice( __( 'Invalid URL. Please enter a valid URL.' ) );\n\t\t\t// If the URL was already defined, we submit it to stop showing the embed placeholder.\n\t\t\tonSubmit( value );\n\t\t\treturn;\n\t\t}\n\t\tonSubmit( url.current );\n\t}, [ onSubmit, value ] );\n\n\tuseEffect( () => {\n\t\turl.current = value;\n\t\tsetInputURL( value );\n\t}, [ value ] );\n\n\t/**\n\t * If the Embed Bottom Sheet component does not utilize a bottom sheet then the onDismiss action is not\n\t * called. Here we are wiring the onDismiss to the onClose callback that gets triggered when input is submitted.\n\t */\n\tconst performOnCloseOperations = useCallback( () => {\n\t\tif ( onClose ) {\n\t\t\tonClose();\n\t\t}\n\n\t\tif ( ! withBottomSheet ) {\n\t\t\tonDismiss();\n\t\t}\n\t}, [ onClose ] );\n\n\tconst onSetAttributes = useCallback( ( attributes ) => {\n\t\turl.current = attributes.url;\n\t\tsetInputURL( attributes.url );\n\t}, [] );\n\n\treturn (\n\t\t<LinkSettingsNavigation\n\t\t\tisVisible={ isVisible }\n\t\t\turl={ inputURL }\n\t\t\tonClose={ performOnCloseOperations }\n\t\t\tonDismiss={ onDismiss }\n\t\t\tsetAttributes={ onSetAttributes }\n\t\t\toptions={ linkSettingsOptions }\n\t\t\ttestID=\"embed-edit-url-modal\"\n\t\t\twithBottomSheet={ withBottomSheet }\n\t\t\tshowIcon\n\t\t/>\n\t);\n};\n\nexport default EmbedLinkSettings;\n"],"mappings":";;;;;;AAWA,IAAAA,QAAA,GAAAC,OAAA;AARA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAIA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAVA;AACA;AACA;;AAWA,MAAMM,iBAAiB,GAAGA,CAAE;EAC3BC,SAAS;EACTC,KAAK;EACLC,KAAK;EACLC,SAAS;EACTC,OAAO;EACPC,QAAQ;EACRC;AACD,CAAC,KAAM;EACN,MAAMC,GAAG,GAAG,IAAAC,eAAM,EAAEP,KAAM,CAAC;EAC3B,MAAM,CAAEQ,QAAQ,EAAEC,WAAW,CAAE,GAAG,IAAAC,iBAAQ,EAAEV,KAAM,CAAC;EACnD,MAAM;IAAEW;EAAkB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,cAAa,CAAC;EAEzD,MAAMC,mBAAmB,GAAG;IAC3BR,GAAG,EAAE;MACJL,KAAK,EAAE,IAAAc,aAAO;MACb;MACA,IAAAC,QAAE,EAAE,SAAU,CAAC,EACff,KACD,CAAC;MACDgB,WAAW,EAAE,IAAAD,QAAE,EAAE,UAAW,CAAC;MAC7BjB,SAAS;MACTmB,QAAQ,EAAE;IACX,CAAC;IACDC,MAAM,EAAE;MACPlB,KAAK,EACJ,IAAAV,QAAA,CAAA6B,aAAA,EAAC1B,WAAA,CAAA2B,iBAAiB;QACjBC,IAAI,EAAG,IAAAN,QAAE,EACR,qDACD,CAAG;QACHhB,KAAK,EAAG,IAAAgB,QAAE,EAAE,yBA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IACjCI,OAAO,EAAGpB,mBAAqB;IAC/BqB,MAAM,EAAC,sBAAsB;IAC7B9B,eAAe,EAAGA,eAAiB;IACnC+B,QAAQ;EAAA,CACR,CAAC;AAEJ,CAAC;AAAC,IAAAC,QAAA,GAEavC,iBAAiB;AAAAwC,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
1
+ {"version":3,"names":["_element","require","_i18n","_components","_url","_data","_notices","EmbedLinkSettings","autoFocus","value","label","isVisible","onClose","onSubmit","withBottomSheet","url","useRef","inputURL","setInputURL","useState","createErrorNotice","useDispatch","noticesStore","linkSettingsOptions","sprintf","__","placeholder","autoFill","footer","createElement","FooterMessageLink","href","separatorType","onDismiss","useCallback","isURL","current","useEffect","performOnCloseOperations","onSetAttributes","attributes","LinkSettingsNavigation","setAttributes","options","showIcon","_default","exports","default"],"sources":["@wordpress/block-library/src/embed/embed-link-settings.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tLinkSettingsNavigation,\n\tFooterMessageLink,\n} from '@wordpress/components';\nimport { isURL } from '@wordpress/url';\nimport { useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useCallback, useEffect, useRef, useState } from '@wordpress/element';\n\nconst EmbedLinkSettings = ( {\n\tautoFocus,\n\tvalue,\n\tlabel,\n\tisVisible,\n\tonClose,\n\tonSubmit,\n\twithBottomSheet,\n} ) => {\n\tconst url = useRef( value );\n\tconst [ inputURL, setInputURL ] = useState( value );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tconst linkSettingsOptions = {\n\t\turl: {\n\t\t\tlabel: sprintf(\n\t\t\t\t// translators: %s: embed block variant's label e.g: \"Twitter\".\n\t\t\t\t__( '%s link' ),\n\t\t\t\tlabel\n\t\t\t),\n\t\t\tplaceholder: __( 'Add link' ),\n\t\t\tautoFocus,\n\t\t\tautoFill: true,\n\t\t},\n\t\tfooter: {\n\t\t\tlabel: (\n\t\t\t\t<FooterMessageLink\n\t\t\t\t\thref={ __(\n\t\t\t\t\t\t'https://wordpress.org/documentation/article/embeds/'\n\t\t\t\t\t) }\n\t\t\t\t\tvalue={ __( 'Learn more about embeds' ) }\n\t\t\t\t/>\n\t\t\t),\n\t\t\tseparatorType: 'topFullWidth',\n\t\t},\n\t};\n\n\tconst onDismiss = useCallback( () => {\n\t\tif ( ! isURL( url.current ) && url.current !== '' ) {\n\t\t\tcreateErrorNotice( __( 'Invalid URL. Please enter a valid URL.' ) );\n\t\t\t// If the URL was already defined, we submit it to stop showing the embed placeholder.\n\t\t\tonSubmit( value );\n\t\t\treturn;\n\t\t}\n\t\tonSubmit( url.current );\n\t}, [ onSubmit, value ] );\n\n\tuseEffect( () => {\n\t\turl.current = value;\n\t\tsetInputURL( value );\n\t}, [ value ] );\n\n\t/**\n\t * If the Embed Bottom Sheet component does not utilize a bottom sheet then the onDismiss action is not\n\t * called. Here we are wiring the onDismiss to the onClose callback that gets triggered when input is submitted.\n\t */\n\tconst performOnCloseOperations = useCallback( () => {\n\t\tif ( onClose ) {\n\t\t\tonClose();\n\t\t}\n\n\t\tif ( ! withBottomSheet ) {\n\t\t\tonDismiss();\n\t\t}\n\t}, [ onClose ] );\n\n\tconst onSetAttributes = useCallback( ( attributes ) => {\n\t\turl.current = attributes.url;\n\t\tsetInputURL( attributes.url );\n\t}, [] );\n\n\treturn (\n\t\t<LinkSettingsNavigation\n\t\t\tisVisible={ isVisible }\n\t\t\turl={ inputURL }\n\t\t\tonClose={ performOnCloseOperations }\n\t\t\tonDismiss={ onDismiss }\n\t\t\tsetAttributes={ onSetAttributes }\n\t\t\toptions={ linkSettingsOptions }\n\t\t\twithBottomSheet={ withBottomSheet }\n\t\t\tshowIcon\n\t\t/>\n\t);\n};\n\nexport default EmbedLinkSettings;\n"],"mappings":";;;;;;AAWA,IAAAA,QAAA,GAAAC,OAAA;AARA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;A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,CAAEE,GAAG,CAACqB,OAAQ,CAAC;EACxB,CAAC,EAAE,CAAEvB,QAAQ,EAAEJ,KAAK,CAAG,CAAC;EAExB,IAAA4B,kBAAS,EAAE,MAAM;IAChBtB,GAAG,CAACqB,OAAO,GAAG3B,KAAK;IACnBS,WAAW,CAAET,KAAM,CAAC;EACrB,CAAC,EAAE,CAAEA,KAAK,CAAG,CAAC;;EAEd;AACD;AACA;AACA;EACC,MAAM6B,wBAAwB,GAAG,IAAAJ,oBAAW,EAAE,MAAM;IACnD,IAAKtB,OAAO,EAAG;MACdA,OAAO,CAAC,CAAC;IACV;IAEA,IAAK,CAAEE,eAAe,EAAG;MACxBmB,SAAS,CAAC,CAAC;IACZ;EACD,CAAC,EAAE,CAAErB,OAAO,CAAG,CAAC;EAEhB,MAAM2B,eAAe,GAAG,IAAAL,oBAAW,EAAIM,UAAU,IAAM;IACtDzB,GAAG,CAACqB,OAAO,GAAGI,UAAU,CAACzB,GAAG;IAC5BG,WAAW,CAAEsB,UAAU,CAACzB,GAAI,CAAC;EAC9B,CAAC,EAAE,EAAG,CAAC;EAEP,OACC,IAAAf,QAAA,CAAA6B,aAAA,EAAC1B,WAAA,CAAAsC,sBAAsB;IACtB9B,SAAS,EAAGA,SAAW;IACvBI,GAAG,EAAGE,QAAU;IAChBL,OAAO,EAAG0B,wBAA0B;IACpCL,SAAS,EAAGA,SAAW;IACvBS,aAAa,EAAGH,eAAiB;IACjCI,OAAO,EAAGpB,mBAAqB;IAC/BT,eAAe,EAAGA,eAAiB;IACnC8B,QAAQ;EAAA,CACR,CAAC;AAEJ,CAAC;AAAC,IAAAC,QAAA,GAEatC,iBAAiB;AAAAuC,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -30,11 +30,10 @@ function FootnotesEdit({
30
30
  icon: (0, _element.createElement)(_blockEditor.BlockIcon, {
31
31
  icon: _icons.formatListNumbered
32
32
  }),
33
- label: (0, _i18n.__)('Footnotes')
34
- // To do: add instructions. We can't add new string in RC.
33
+ label: (0, _i18n.__)('Footnotes'),
34
+ instructions: (0, _i18n.__)('Footnotes are not supported here. Add this block to post or page content.')
35
35
  }));
36
36
  }
37
-
38
37
  if (!footnotes.length) {
39
38
  return (0, _element.createElement)("div", {
40
39
  ...blockProps
@@ -1 +1 @@
1
- {"version":3,"names":["_blockEditor","require","_coreData","_i18n","_components","_icons","FootnotesEdit","context","postType","postId","meta","updateMeta","useEntityProp","footnotes","JSON","parse","blockProps","useBlockProps","_element","createElement","Placeholder","icon","BlockIcon","label","__","length","instructions","map","id","content","key","RichText","tagName","value","identifier","onFocus","event","target","textContent","trim","scrollIntoView","onChange","nextFootnote","stringify","footnote","href"],"sources":["@wordpress/block-library/src/footnotes/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockIcon, RichText, useBlockProps } from '@wordpress/block-editor';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport { Placeholder } from '@wordpress/components';\nimport { formatListNumbered as icon } from '@wordpress/icons';\n\nexport default function FootnotesEdit( { context: { postType, postId } } ) {\n\tconst [ meta, updateMeta ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'meta',\n\t\tpostId\n\t);\n\tconst footnotes = meta?.footnotes ? JSON.parse( meta.footnotes ) : [];\n\tconst blockProps = useBlockProps();\n\n\tif ( postType !== 'post' && postType !== 'page' ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Placeholder\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\tlabel={ __( 'Footnotes' ) }\n\t\t\t\t\t// To do: add instructions. We can't add new string in RC.\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n\n\tif ( ! footnotes.length ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Placeholder\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\tlabel={ __( 'Footnotes' ) }\n\t\t\t\t\tinstructions={ __(\n\t\t\t\t\t\t'Footnotes found in blocks within this document will be displayed here.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<ol { ...blockProps }>\n\t\t\t{ footnotes.map( ( { id, content } ) => (\n\t\t\t\t<li key={ id }>\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tid={ id }\n\t\t\t\t\t\ttagName=\"span\"\n\t\t\t\t\t\tvalue={ content }\n\t\t\t\t\t\tidentifier={ id }\n\t\t\t\t\t\t// To do: figure out why the browser is not scrolling\n\t\t\t\t\t\t// into view when it receives focus.\n\t\t\t\t\t\tonFocus={ ( event ) => {\n\t\t\t\t\t\t\tif ( ! event.target.textContent.trim() ) {\n\t\t\t\t\t\t\t\tevent.target.scrollIntoView();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonChange={ ( nextFootnote ) => {\n\t\t\t\t\t\t\tupdateMeta( {\n\t\t\t\t\t\t\t\t...meta,\n\t\t\t\t\t\t\t\tfootnotes: JSON.stringify(\n\t\t\t\t\t\t\t\t\tfootnotes.map( ( footnote ) => {\n\t\t\t\t\t\t\t\t\t\treturn footnote.id === id\n\t\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontent: nextFootnote,\n\t\t\t\t\t\t\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t\t: footnote;\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>{ ' ' }\n\t\t\t\t\t<a href={ `#${ id }-link` }>↩︎</a>\n\t\t\t\t</li>\n\t\t\t) ) }\n\t\t</ol>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,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AAC;EAER;EAEA,OACC,IAAAN,QAAA,CAAAC,aAAA;IAAA,GAASH;EAAU,GAChBH,SAAS,CAACc,GAAG,CAAE,CAAE;IAAEC,EAAE;IAAEC;EAAQ,CAAC,KACjC,IAAAX,QAAA,CAAAC,aAAA;IAAIW,GAAG,EAAGF;EAAI,GACb,IAAAV,QAAA,CAAAC,aAAA,EAACnB,YAAA,CAAA+B,QAAQ;IACRH,EAAE,EAAGA,EAAI;IACTI,OAAO,EAAC,MAAM;IACdC,KAAK,EAAGJ,OAAS;IACjBK,UAAU,EAAGN;IACb;IACA;IAAA;IACAO,OAAO,EAAKC,KAAK,IAAM;MACtB,IAAK,CAAEA,KAAK,CAACC,MAAM,CAACC,WAAW,CAACC,IAAI,CAAC,CAAC,EAAG;QACxCH,KAAK,CAACC,MAAM,CAACG,cAAc,CAAC,CAAC;MAC9B;IACD,CAAG;IACHC,QAAQ,EAAKC,YAAY,IAAM;MAC9B/B,UAAU,CAAE;QACX,GAAGD,IAAI;QACPG,SAAS,EAAEC,IAAI,CAAC6B,SAAS,CACxB9B,SAAS,CAACc,GAAG,CAAIiB,QAAQ,IAAM;UAC9B,OAAOA,QAAQ,CAAChB,EAAE,KAAKA,EAAE,GACtB;YACAC,OAAO,EAAEa,YAAY;YACrBd;UACA,CAAC,GACDgB,QAAQ;QACZ,CAAE,CACH;MACD,CAAE,CAAC;IACJ;EAAG,CACH,CAAC,EAAE,GAAG,EACP,IAAA1B,QAAA,CAAAC,aAAA;IAAG0B,IAAI,EAAI,IAAIjB,EAAI;EAAQ,GAAC,cAAK,CAC9B,CACH,CACC,CAAC;AAEP"}
1
+ {"version":3,"names":["_blockEditor","require","_coreData","_i18n","_components","_icons","FootnotesEdit","context","postType","postId","meta","updateMeta","useEntityProp","footnotes","JSON","parse","blockProps","useBlockProps","_element","createElement","Placeholder","icon","BlockIcon","label","__","instructions","length","map","id","content","key","RichText","tagName","value","identifier","onFocus","event","target","textContent","trim","scrollIntoView","onChange","nextFootnote","stringify","footnote","href"],"sources":["@wordpress/block-library/src/footnotes/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockIcon, RichText, useBlockProps } from '@wordpress/block-editor';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport { Placeholder } from '@wordpress/components';\nimport { formatListNumbered as icon } from '@wordpress/icons';\n\nexport default function FootnotesEdit( { context: { postType, postId } } ) {\n\tconst [ meta, updateMeta ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'meta',\n\t\tpostId\n\t);\n\tconst footnotes = meta?.footnotes ? JSON.parse( meta.footnotes ) : [];\n\tconst blockProps = useBlockProps();\n\n\tif ( postType !== 'post' && postType !== 'page' ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Placeholder\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\tlabel={ __( 'Footnotes' ) }\n\t\t\t\t\tinstructions={ __(\n\t\t\t\t\t\t'Footnotes are not supported here. Add this block to post or page content.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n\n\tif ( ! footnotes.length ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Placeholder\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\tlabel={ __( 'Footnotes' ) }\n\t\t\t\t\tinstructions={ __(\n\t\t\t\t\t\t'Footnotes found in blocks within this document will be displayed here.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<ol { ...blockProps }>\n\t\t\t{ footnotes.map( ( { id, content } ) => (\n\t\t\t\t<li key={ id }>\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tid={ id }\n\t\t\t\t\t\ttagName=\"span\"\n\t\t\t\t\t\tvalue={ content }\n\t\t\t\t\t\tidentifier={ id }\n\t\t\t\t\t\t// To do: figure out why the browser is not scrolling\n\t\t\t\t\t\t// into view when it receives focus.\n\t\t\t\t\t\tonFocus={ ( event ) => {\n\t\t\t\t\t\t\tif ( ! event.target.textContent.trim() ) {\n\t\t\t\t\t\t\t\tevent.target.scrollIntoView();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonChange={ ( nextFootnote ) => {\n\t\t\t\t\t\t\tupdateMeta( {\n\t\t\t\t\t\t\t\t...meta,\n\t\t\t\t\t\t\t\tfootnotes: JSON.stringify(\n\t\t\t\t\t\t\t\t\tfootnotes.map( ( footnote ) => {\n\t\t\t\t\t\t\t\t\t\treturn footnote.id === id\n\t\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontent: nextFootnote,\n\t\t\t\t\t\t\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t\t: footnote;\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>{ ' ' }\n\t\t\t\t\t<a href={ `#${ id }-link` }>↩︎</a>\n\t\t\t\t</li>\n\t\t\t) ) }\n\t\t</ol>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAPA;AACA;AACA;;AAOe,SAASK,aAAaA,CAAE;EAAEC,OAAO,EAAE;IAAEC,QAAQ;IAAEC;EAAO;AAAE,CAAC,EAAG;EAC1E,MAAM,CAAEC,IAAI,EAAEC,UAAU,CAAE,GAAG,IAAAC,uBAAa,EACzC,UAAU,EACVJ,QAAQ,EACR,MAAM,EACNC,MACD,CAAC;EACD,MAAMI,SAAS,GAAGH,IAAI,EAAEG,SA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K,EAAGJ,OAAS;IACjBK,UAAU,EAAGN;IACb;IACA;IAAA;IACAO,OAAO,EAAKC,KAAK,IAAM;MACtB,IAAK,CAAEA,KAAK,CAACC,MAAM,CAACC,WAAW,CAACC,IAAI,CAAC,CAAC,EAAG;QACxCH,KAAK,CAACC,MAAM,CAACG,cAAc,CAAC,CAAC;MAC9B;IACD,CAAG;IACHC,QAAQ,EAAKC,YAAY,IAAM;MAC9B/B,UAAU,CAAE;QACX,GAAGD,IAAI;QACPG,SAAS,EAAEC,IAAI,CAAC6B,SAAS,CACxB9B,SAAS,CAACc,GAAG,CAAIiB,QAAQ,IAAM;UAC9B,OAAOA,QAAQ,CAAChB,EAAE,KAAKA,EAAE,GACtB;YACAC,OAAO,EAAEa,YAAY;YACrBd;UACA,CAAC,GACDgB,QAAQ;QACZ,CAAE,CACH;MACD,CAAE,CAAC;IACJ;EAAG,CACH,CAAC,EAAE,GAAG,EACP,IAAA1B,QAAA,CAAAC,aAAA;IAAG0B,IAAI,EAAI,IAAIjB,EAAI;EAAQ,GAAC,cAAK,CAC9B,CACH,CACC,CAAC;AAEP"}
@@ -52,6 +52,7 @@ const metadata = {
52
52
  color: {
53
53
  gradients: true,
54
54
  heading: true,
55
+ button: true,
55
56
  link: true,
56
57
  __experimentalDefaultControls: {
57
58
  background: true,
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_icons","_initBlock","_interopRequireDefault","_deprecated","_edit","_save","_transforms","_variations","metadata","$schema","apiVersion","name","title","category","description","keywords","textdomain","attributes","tagName","type","templateLock","allowedBlocks","supports","__experimentalOnEnter","__experimentalOnMerge","__experimentalSettings","align","anchor","ariaLabel","html","color","gradients","heading","link","__experimentalDefaultControls","background","text","spacing","margin","padding","blockGap","dimensions","minHeight","__experimentalBorder","radius","style","width","position","sticky","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontWeight","__experimentalFontStyle","__experimentalTextTransform","__experimentalTextDecoration","__experimentalLetterSpacing","layout","allowSizingOnChildren","editorStyle","exports","settings","icon","example","innerBlocks","customTextColor","content","__","transforms","edit","save","deprecated","variations","init","initBlock"],"sources":["@wordpress/block-library/src/group/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { group as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tstyle: {\n\t\t\t\tcolor: {\n\t\t\t\t\ttext: '#000000',\n\t\t\t\t\tbackground: '#ffffff',\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcustomTextColor: '#cf2e2e',\n\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\tcontent: __( 'One.' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcustomTextColor: '#ff6900',\n\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\tcontent: __( 'Two.' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcustomTextColor: '#fcb900',\n\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\tcontent: __( 'Three.' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcustomTextColor: '#00d084',\n\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\tcontent: __( 'Four.' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcustomTextColor: '#0693e3',\n\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\tcontent: __( 'Five.' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcustomTextColor: '#9b51e0',\n\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\tcontent: __( 'Six.' ),\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n\tvariations,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAKA,IAAAE,UAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,WAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,KAAA,GAAAF,sBAAA,CAAAH,OAAA;AAEA,IAAAM,KAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IAAAO,WAAA,GAAAJ,sBAAA,CAAAH,OAAA;AACA,IAAAQ,WAAA,GAAAL,sBAAA,CAAAH,OAAA;AAfA;AACA;AACA;AAIA;AACA;AACA;AAFA,MAAAS,QAAA;EAAAC,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,QAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,OAAA;MAAAC,IAAA;MAAA;IAAA;IAAAC,YAAA;MAAAD,IAAA;MAAA;IAAA;IAAAE,aAAA;MAAAF,IAAA;IAAA;EAAA;EAAAG,QAAA;IAAAC,qBAAA;IAAAC,qBAAA;IAAAC,sBAAA;IAAAC,KAAA;IAAAC,MAAA;IAAAC,SAAA;IAAAC,IAAA;IAAAC,KAAA;MAAAC,SAAA;MAAAC,OAAA;MAAAC,IAAA;MAAAC,6BAAA;QAAAC,UAAA;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E,EAAE,MAAO;MACrB;IACD,CAAC,EACD;MACCzD,IAAI,EAAE,gBAAgB;MACtBM,UAAU,EAAE;QACXiD,eAAe,EAAE,SAAS;QAC1BhB,QAAQ,EAAE,OAAO;QACjBiB,OAAO,EAAE,IAAAC,QAAE,EAAE,QAAS;MACvB;IACD,CAAC,EACD;MACCzD,IAAI,EAAE,gBAAgB;MACtBM,UAAU,EAAE;QACXiD,eAAe,EAAE,SAAS;QAC1BhB,QAAQ,EAAE,OAAO;QACjBiB,OAAO,EAAE,IAAAC,QAAE,EAAE,OAAQ;MACtB;IACD,CAAC,EACD;MACCzD,IAAI,EAAE,gBAAgB;MACtBM,UAAU,EAAE;QACXiD,eAAe,EAAE,SAAS;QAC1BhB,QAAQ,EAAE,OAAO;QACjBiB,OAAO,EAAE,IAAAC,QAAE,EAAE,OAAQ;MACtB;IACD,CAAC,EACD;MACCzD,IAAI,EAAE,gBAAgB;MACtBM,UAAU,EAAE;QACXiD,eAAe,EAAE,SAAS;QAC1BhB,QAAQ,EAAE,OAAO;QACjBiB,OAAO,EAAE,IAAAC,QAAE,EAAE,MAAO;MACrB;IACD,CAAC;EAEH,CAAC;EACDC,UAAU,EAAVA,mBAAU;EACVC,IAAI,EAAJA,aAAI;EACJC,IAAI,EAAJA,aAAI;EACJC,UAAU,EAAVA,mBAAU;EACVC,UAAU,EAAVA;AACD,CAAC;AAACZ,OAAA,CAAAC,QAAA,GAAAA,QAAA;AAEK,MAAMY,IAAI,GAAGA,CAAA,KAAM,IAAAC,kBAAS,EAAE;EAAEhE,IAAI;EAAEH,QAAQ;EAAEsD;AAAS,CAAE,CAAC;AAACD,OAAA,CAAAa,IAAA,GAAAA,IAAA"}
1
+ {"version":3,"names":["_i18n","require","_icons","_initBlock","_interopRequireDefault","_deprecated","_edit","_save","_transforms","_variations","metadata","$schema","apiVersion","name","title","category","description","keywords","textdomain","attributes","tagName","type","templateLock","allowedBlocks","supports","__experimentalOnEnter","__experimentalOnMerge","__experimentalSettings","align","anchor","ariaLabel","html","color","gradients","heading","button","link","__experimentalDefaultControls","background","text","spacing","margin","padding","blockGap","dimensions","minHeight","__experimentalBorder","radius","style","width","position","sticky","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontWeight","__experimentalFontStyle","__experimentalTextTransform","__experimentalTextDecoration","__experimentalLetterSpacing","layout","allowSizingOnChildren","editorStyle","exports","settings","icon","example","innerBlocks","customTextColor","content","__","transforms","edit","save","deprecated","variations","init","initBlock"],"sources":["@wordpress/block-library/src/group/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { group as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tstyle: {\n\t\t\t\tcolor: {\n\t\t\t\t\ttext: '#000000',\n\t\t\t\t\tbackground: '#ffffff',\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcustomTextColor: '#cf2e2e',\n\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\tcontent: __( 'One.' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcustomTextColor: '#ff6900',\n\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\tcontent: __( 'Two.' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcustomTextColor: '#fcb900',\n\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\tcontent: __( 'Three.' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcustomTextColor: '#00d084',\n\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\tcontent: __( 'Four.' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcustomTextColor: '#0693e3',\n\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\tcontent: __( 'Five.' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcustomTextColor: '#9b51e0',\n\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\tcontent: __( 'Six.' ),\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n\tvariations,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAKA,IAAAE,UAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,WAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,KAAA,GAAAF,sBAAA,CAAAH,OAAA;AAEA,IAAAM,KAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IAAAO,WAAA,GAAAJ,sBAAA,CAAAH,OAAA;AACA,IAAAQ,WAAA,GAAAL,sBAAA,CAAAH,OAAA;AAfA;AACA;AACA;AAIA;AACA;AACA;AAFA,MAAAS,QAAA;EAAAC,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,QAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,OAAA;MAAAC,IAAA;MAAA;IAAA;IAAAC,YAAA;MAAAD,IAAA;MAAA;IAAA;IAAA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,CAAE,CAAC;AAACD,OAAA,CAAAa,IAAA,GAAAA,IAAA"}
@@ -91,7 +91,7 @@ function Placeholder({
91
91
  });
92
92
  return (0, _element.createElement)("div", {
93
93
  ...blockProps
94
- }, (0, _element.createElement)("p", null, (0, _i18n.__)('This is the Post Content block, it will display all the blocks in any single post or page.')), (0, _element.createElement)("p", null, (0, _i18n.__)('That might be a simple arrangement like consecutive paragraphs in a blog post, or a more elaborate composition that includes image galleries, videos, tables, columns, and any other block types.')), (0, _element.createElement)("p", null, (0, _i18n.__)('If there are any Custom Post Types registered at your site, the Post Content block can display the contents of those entries as well.')));
94
+ }, (0, _element.createElement)("p", null, (0, _i18n.__)('This is the Content block, it will display all the blocks in any single post or page.')), (0, _element.createElement)("p", null, (0, _i18n.__)('That might be a simple arrangement like consecutive paragraphs in a blog post, or a more elaborate composition that includes image galleries, videos, tables, columns, and any other block types.')), (0, _element.createElement)("p", null, (0, _i18n.__)('If there are any Custom Post Types registered at your site, the Content block can display the contents of those entries as well.')));
95
95
  }
96
96
  function RecursionError() {
97
97
  const blockProps = (0, _blockEditor.useBlockProps)();
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_blockEditor","_coreData","_data","_hooks","ReadOnlyContent","userCanEdit","postType","postId","content","useEntityProp","blockProps","useBlockProps","protected","_element","createElement","Warning","__","dangerouslySetInnerHTML","__html","rendered","EditableContent","context","blocks","onInput","onChange","useEntityBlockEditor","id","entityRecord","useSelect","select","coreStore","getEntityRecord","hasInnerBlocks","raw","length","initialInnerBlocks","props","useInnerBlocksProps","className","value","template","undefined","Content","queryId","useCanEditEntity","isDescendentOfQueryLoop","Number","isFinite","isEditable","Placeholder","layoutClassNames","RecursionError","PostContentEdit","attributes","__unstableLayoutClassNames","contextPostId","contextPostType","layout","hasAlreadyRendered","useHasRecursion","__experimentalRecursionProvider","uniqueId"],"sources":["@wordpress/block-library/src/post-content/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\t__experimentalRecursionProvider as RecursionProvider,\n\t__experimentalUseHasRecursion as useHasRecursion,\n\tWarning,\n} from '@wordpress/block-editor';\nimport {\n\tuseEntityProp,\n\tuseEntityBlockEditor,\n\tstore as coreStore,\n} from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\n/**\n * Internal dependencies\n */\nimport { useCanEditEntity } from '../utils/hooks';\n\nfunction ReadOnlyContent( { userCanEdit, postType, postId } ) {\n\tconst [ , , content ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'content',\n\t\tpostId\n\t);\n\tconst blockProps = useBlockProps();\n\treturn content?.protected && ! userCanEdit ? (\n\t\t<div { ...blockProps }>\n\t\t\t<Warning>{ __( 'This content is password protected.' ) }</Warning>\n\t\t</div>\n\t) : (\n\t\t<div\n\t\t\t{ ...blockProps }\n\t\t\tdangerouslySetInnerHTML={ { __html: content?.rendered } }\n\t\t></div>\n\t);\n}\n\nfunction EditableContent( { context = {} } ) {\n\tconst { postType, postId } = context;\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\tpostType,\n\t\t{ id: postId }\n\t);\n\n\tconst entityRecord = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( coreStore ).getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst hasInnerBlocks = !! entityRecord?.content?.raw || blocks?.length;\n\n\tconst initialInnerBlocks = [ [ 'core/paragraph' ] ];\n\n\tconst props = useInnerBlocksProps(\n\t\tuseBlockProps( { className: 'entry-content' } ),\n\t\t{\n\t\t\tvalue: blocks,\n\t\t\tonInput,\n\t\t\tonChange,\n\t\t\ttemplate: ! hasInnerBlocks ? initialInnerBlocks : undefined,\n\t\t}\n\t);\n\treturn <div { ...props } />;\n}\n\nfunction Content( props ) {\n\tconst { context: { queryId, postType, postId } = {} } = props;\n\tconst userCanEdit = useCanEditEntity( 'postType', postType, postId );\n\tif ( userCanEdit === undefined ) {\n\t\treturn null;\n\t}\n\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst isEditable = userCanEdit && ! isDescendentOfQueryLoop;\n\n\treturn isEditable ? (\n\t\t<EditableContent { ...props } />\n\t) : (\n\t\t<ReadOnlyContent\n\t\t\tuserCanEdit={ userCanEdit }\n\t\t\tpostType={ postType }\n\t\t\tpostId={ postId }\n\t\t/>\n\t);\n}\n\nfunction Placeholder( { layoutClassNames } ) {\n\tconst blockProps = useBlockProps( { className: layoutClassNames } );\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<p>\n\t\t\t\t{ __(\n\t\t\t\t\t'This is the Post Content block, it will display all the blocks in any single post or page.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<p>\n\t\t\t\t{ __(\n\t\t\t\t\t'That might be a simple arrangement like consecutive paragraphs in a blog post, or a more elaborate composition that includes image galleries, videos, tables, columns, and any other block types.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<p>\n\t\t\t\t{ __(\n\t\t\t\t\t'If there are any Custom Post Types registered at your site, the Post Content block can display the contents of those entries as well.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t</div>\n\t);\n}\n\nfunction RecursionError() {\n\tconst blockProps = useBlockProps();\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<Warning>\n\t\t\t\t{ __( 'Block cannot be rendered inside itself.' ) }\n\t\t\t</Warning>\n\t\t</div>\n\t);\n}\n\nexport default function PostContentEdit( {\n\tcontext,\n\tattributes,\n\t__unstableLayoutClassNames: layoutClassNames,\n} ) {\n\tconst { postId: contextPostId, postType: contextPostType } = context;\n\tconst { layout = {} } = attributes;\n\tconst hasAlreadyRendered = useHasRecursion( contextPostId );\n\n\tif ( contextPostId && contextPostType && hasAlreadyRendered ) {\n\t\treturn <RecursionError />;\n\t}\n\n\treturn (\n\t\t<RecursionProvider uniqueId={ contextPostId }>\n\t\t\t{ contextPostId && contextPostType ? (\n\t\t\t\t<Content context={ context } layout={ layout } />\n\t\t\t) : (\n\t\t\t\t<Placeholder layoutClassNames={ layoutClassNames } />\n\t\t\t) }\n\t\t</RecursionProvider>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAOA,IAAAE,SAAA,GAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AAIA,IAAAI,MAAA,GAAAJ,OAAA;AApBA;AACA;AACA;;AAeA;AACA;AACA;;AAGA,SAASK,eAAeA,CAAE;EAAEC,WAAW;EAAEC,QAAQ;EAAEC;AAAO,CAAC,EAAG;EAC7D,MAAM,IAAMC,OAAO,CAAE,GAAG,IAAAC,uBAAa,EACpC,UAAU,EACVH,QAAQ,EACR,SAAS,EACTC,MACD,CAAC;EACD,MAAMG,UAAU,GAAG,IAAAC,0BAAa,EAAC,CAAC;EAClC,OAAOH,OAAO,EAAEI,SAAS,IAAI,CAAEP,WAAW,GACzC,IAAAQ,QAAA,CAAAC,aAAA;IAAA,GAAUJ;EAAU,GACnB,IAAAG,QAAA,CAAAC,aAAA,EAACd,YAAA,CAAAe,OAAO,QAAG,IAAAC,QAAE,EAAE,qCAAsC,CAAY,CAC7D,CAAC,GAEN,IAAAH,QAAA,CAAAC,aAAA;IAAA,GACMJ,UAAU;IACfO,uBAAuB,EAAG;MAAEC,MAAM,EAAEV,OAAO,EAAEW;IAAS;EAAG,CACpD,CACN;AACF;AAEA,SAASC,eAAeA,CAAE;EAAEC,OAAO,GAAG,CAAC;AAAE,CAAC,EAAG;EAC5C,MAAM;IAAEf,QAAQ;IAAEC;EAAO,CAAC,GAAGc,OAAO;EAEpC,MAAM,CAAEC,MAAM,EAAEC,OAAO,EAAEC,QAAQ,CAAE,GAAG,IAAAC,8BAAoB,EACzD,UAAU,EACVnB,QAAQ,EACR;IAAEoB,EA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AAA7C,QAAA,CAAAC,aAAA,EAACqC,cAAc,MAAE,CAAC;EAC1B;EAEA,OACC,IAAAtC,QAAA,CAAAC,aAAA,EAACd,YAAA,CAAA4D,+BAAiB;IAACC,QAAQ,EAAGN;EAAe,GAC1CA,aAAa,IAAIC,eAAe,GACjC,IAAA3C,QAAA,CAAAC,aAAA,EAAC4B,OAAO;IAACrB,OAAO,EAAGA,OAAS;IAACoC,MAAM,EAAGA;EAAQ,CAAE,CAAC,GAEjD,IAAA5C,QAAA,CAAAC,aAAA,EAACmC,WAAW;IAACC,gBAAgB,EAAGA;EAAkB,CAAE,CAEnC,CAAC;AAEtB"}
1
+ {"version":3,"names":["_i18n","require","_blockEditor","_coreData","_data","_hooks","ReadOnlyContent","userCanEdit","postType","postId","content","useEntityProp","blockProps","useBlockProps","protected","_element","createElement","Warning","__","dangerouslySetInnerHTML","__html","rendered","EditableContent","context","blocks","onInput","onChange","useEntityBlockEditor","id","entityRecord","useSelect","select","coreStore","getEntityRecord","hasInnerBlocks","raw","length","initialInnerBlocks","props","useInnerBlocksProps","className","value","template","undefined","Content","queryId","useCanEditEntity","isDescendentOfQueryLoop","Number","isFinite","isEditable","Placeholder","layoutClassNames","RecursionError","PostContentEdit","attributes","__unstableLayoutClassNames","contextPostId","contextPostType","layout","hasAlreadyRendered","useHasRecursion","__experimentalRecursionProvider","uniqueId"],"sources":["@wordpress/block-library/src/post-content/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\t__experimentalRecursionProvider as RecursionProvider,\n\t__experimentalUseHasRecursion as useHasRecursion,\n\tWarning,\n} from '@wordpress/block-editor';\nimport {\n\tuseEntityProp,\n\tuseEntityBlockEditor,\n\tstore as coreStore,\n} from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\n/**\n * Internal dependencies\n */\nimport { useCanEditEntity } from '../utils/hooks';\n\nfunction ReadOnlyContent( { userCanEdit, postType, postId } ) {\n\tconst [ , , content ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'content',\n\t\tpostId\n\t);\n\tconst blockProps = useBlockProps();\n\treturn content?.protected && ! userCanEdit ? (\n\t\t<div { ...blockProps }>\n\t\t\t<Warning>{ __( 'This content is password protected.' ) }</Warning>\n\t\t</div>\n\t) : (\n\t\t<div\n\t\t\t{ ...blockProps }\n\t\t\tdangerouslySetInnerHTML={ { __html: content?.rendered } }\n\t\t></div>\n\t);\n}\n\nfunction EditableContent( { context = {} } ) {\n\tconst { postType, postId } = context;\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\tpostType,\n\t\t{ id: postId }\n\t);\n\n\tconst entityRecord = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( coreStore ).getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst hasInnerBlocks = !! entityRecord?.content?.raw || blocks?.length;\n\n\tconst initialInnerBlocks = [ [ 'core/paragraph' ] ];\n\n\tconst props = useInnerBlocksProps(\n\t\tuseBlockProps( { className: 'entry-content' } ),\n\t\t{\n\t\t\tvalue: blocks,\n\t\t\tonInput,\n\t\t\tonChange,\n\t\t\ttemplate: ! hasInnerBlocks ? initialInnerBlocks : undefined,\n\t\t}\n\t);\n\treturn <div { ...props } />;\n}\n\nfunction Content( props ) {\n\tconst { context: { queryId, postType, postId } = {} } = props;\n\tconst userCanEdit = useCanEditEntity( 'postType', postType, postId );\n\tif ( userCanEdit === undefined ) {\n\t\treturn null;\n\t}\n\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst isEditable = userCanEdit && ! isDescendentOfQueryLoop;\n\n\treturn isEditable ? (\n\t\t<EditableContent { ...props } />\n\t) : (\n\t\t<ReadOnlyContent\n\t\t\tuserCanEdit={ userCanEdit }\n\t\t\tpostType={ postType }\n\t\t\tpostId={ postId }\n\t\t/>\n\t);\n}\n\nfunction Placeholder( { layoutClassNames } ) {\n\tconst blockProps = useBlockProps( { className: layoutClassNames } );\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<p>\n\t\t\t\t{ __(\n\t\t\t\t\t'This is the Content block, it will display all the blocks in any single post or page.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<p>\n\t\t\t\t{ __(\n\t\t\t\t\t'That might be a simple arrangement like consecutive paragraphs in a blog post, or a more elaborate composition that includes image galleries, videos, tables, columns, and any other block types.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<p>\n\t\t\t\t{ __(\n\t\t\t\t\t'If there are any Custom Post Types registered at your site, the Content block can display the contents of those entries as well.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t</div>\n\t);\n}\n\nfunction RecursionError() {\n\tconst blockProps = useBlockProps();\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<Warning>\n\t\t\t\t{ __( 'Block cannot be rendered inside itself.' ) }\n\t\t\t</Warning>\n\t\t</div>\n\t);\n}\n\nexport default function PostContentEdit( {\n\tcontext,\n\tattributes,\n\t__unstableLayoutClassNames: layoutClassNames,\n} ) {\n\tconst { postId: contextPostId, postType: contextPostType } = context;\n\tconst { layout = {} } = attributes;\n\tconst hasAlreadyRendered = useHasRecursion( contextPostId );\n\n\tif ( contextPostId && contextPostType && hasAlreadyRendered ) {\n\t\treturn <RecursionError />;\n\t}\n\n\treturn (\n\t\t<RecursionProvider uniqueId={ contextPostId }>\n\t\t\t{ contextPostId && contextPostType ? (\n\t\t\t\t<Content context={ context } layout={ layout } />\n\t\t\t) : (\n\t\t\t\t<Placeholder layoutClassNames={ layoutClassNames } />\n\t\t\t) }\n\t\t</RecursionProvider>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAOA,IAAAE,SAAA,GAAAF,OAAA;AAKA,IAA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AA5C,QAAA,CAAAC,aAAA,EAACmC,WAAW;IAACC,gBAAgB,EAAGA;EAAkB,CAAE,CAEnC,CAAC;AAEtB"}
@@ -24,7 +24,7 @@ const metadata = {
24
24
  parent: ["core/query"],
25
25
  description: "Contains the block elements used to render a post, like the title, date, featured image, content or excerpt, and more.",
26
26
  textdomain: "default",
27
- usesContext: ["queryId", "query", "queryContext", "displayLayout", "templateSlug", "previewPostType"],
27
+ usesContext: ["queryId", "query", "queryContext", "displayLayout", "templateSlug", "previewPostType", "enhancedPagination"],
28
28
  supports: {
29
29
  reusable: false,
30
30
  html: false,