@wordpress/block-library 9.43.0 → 9.43.1-next.v.202604091042.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 (76) hide show
  1. package/build/code/edit.cjs +2 -1
  2. package/build/code/edit.cjs.map +2 -2
  3. package/build/cover/edit/color-utils.cjs +1 -1
  4. package/build/cover/edit/color-utils.cjs.map +2 -2
  5. package/build/cover/edit/index.cjs +31 -25
  6. package/build/cover/edit/index.cjs.map +2 -2
  7. package/build/cover/embed-video-utils.cjs +9 -7
  8. package/build/cover/embed-video-utils.cjs.map +2 -2
  9. package/build/file/utils/index.cjs +1 -1
  10. package/build/file/utils/index.cjs.map +2 -2
  11. package/build/form/view.cjs +1 -1
  12. package/build/form/view.cjs.map +2 -2
  13. package/build/icon/edit.cjs +1 -3
  14. package/build/icon/edit.cjs.map +2 -2
  15. package/build/image/image.cjs +4 -3
  16. package/build/image/image.cjs.map +2 -2
  17. package/build/navigation-link/link-ui/page-creator.cjs +1 -1
  18. package/build/navigation-link/link-ui/page-creator.cjs.map +2 -2
  19. package/build/navigation-link/shared/update-attributes.cjs +1 -1
  20. package/build/navigation-link/shared/update-attributes.cjs.map +2 -2
  21. package/build/navigation-link/shared/use-link-preview.cjs +1 -1
  22. package/build/navigation-link/shared/use-link-preview.cjs.map +2 -2
  23. package/build/pattern/edit.cjs +1 -1
  24. package/build/pattern/edit.cjs.map +2 -2
  25. package/build/search/block.json +0 -4
  26. package/build/search/edit.cjs +6 -33
  27. package/build/search/edit.cjs.map +2 -2
  28. package/build-module/code/edit.mjs +2 -1
  29. package/build-module/code/edit.mjs.map +2 -2
  30. package/build-module/cover/edit/color-utils.mjs +1 -1
  31. package/build-module/cover/edit/color-utils.mjs.map +2 -2
  32. package/build-module/cover/edit/index.mjs +39 -28
  33. package/build-module/cover/edit/index.mjs.map +2 -2
  34. package/build-module/cover/embed-video-utils.mjs +8 -6
  35. package/build-module/cover/embed-video-utils.mjs.map +2 -2
  36. package/build-module/file/utils/index.mjs +1 -1
  37. package/build-module/file/utils/index.mjs.map +2 -2
  38. package/build-module/form/view.mjs +1 -1
  39. package/build-module/form/view.mjs.map +2 -2
  40. package/build-module/icon/edit.mjs +1 -3
  41. package/build-module/icon/edit.mjs.map +2 -2
  42. package/build-module/image/image.mjs +4 -3
  43. package/build-module/image/image.mjs.map +2 -2
  44. package/build-module/navigation-link/link-ui/page-creator.mjs +1 -1
  45. package/build-module/navigation-link/link-ui/page-creator.mjs.map +2 -2
  46. package/build-module/navigation-link/shared/update-attributes.mjs +1 -1
  47. package/build-module/navigation-link/shared/update-attributes.mjs.map +2 -2
  48. package/build-module/navigation-link/shared/use-link-preview.mjs +1 -1
  49. package/build-module/navigation-link/shared/use-link-preview.mjs.map +2 -2
  50. package/build-module/pattern/edit.mjs +1 -1
  51. package/build-module/pattern/edit.mjs.map +2 -2
  52. package/build-module/search/block.json +0 -4
  53. package/build-module/search/edit.mjs +6 -33
  54. package/build-module/search/edit.mjs.map +2 -2
  55. package/build-style/code/style-rtl.css +1 -1
  56. package/build-style/code/style.css +1 -1
  57. package/build-style/style-rtl.css +1 -1
  58. package/build-style/style.css +1 -1
  59. package/package.json +38 -38
  60. package/src/code/edit.js +1 -0
  61. package/src/code/style.scss +1 -1
  62. package/src/cover/edit/color-utils.js +1 -1
  63. package/src/cover/edit/index.js +63 -34
  64. package/src/cover/embed-video-utils.js +10 -8
  65. package/src/embed/test/index.native.js +3 -2
  66. package/src/file/utils/index.js +1 -1
  67. package/src/form/view.js +1 -1
  68. package/src/icon/edit.js +1 -3
  69. package/src/image/image.js +6 -4
  70. package/src/image/index.php +4 -4
  71. package/src/navigation-link/link-ui/page-creator.js +1 -1
  72. package/src/navigation-link/shared/update-attributes.js +1 -1
  73. package/src/navigation-link/shared/use-link-preview.js +1 -1
  74. package/src/pattern/edit.js +1 -1
  75. package/src/search/block.json +0 -4
  76. package/src/search/edit.js +2 -35
@@ -1,8 +1,13 @@
1
1
  // packages/block-library/src/cover/edit/index.js
2
2
  import clsx from "clsx";
3
3
  import { useEntityProp, store as coreStore } from "@wordpress/core-data";
4
- import { useEffect, useMemo, useRef } from "@wordpress/element";
5
- import { Placeholder, Spinner } from "@wordpress/components";
4
+ import {
5
+ useEffect,
6
+ useLayoutEffect,
7
+ useMemo,
8
+ useRef
9
+ } from "@wordpress/element";
10
+ import { Placeholder, SandBox, Spinner } from "@wordpress/components";
6
11
  import { compose, useResizeObserver } from "@wordpress/compose";
7
12
  import {
8
13
  withColors,
@@ -39,7 +44,7 @@ import {
39
44
  DEFAULT_OVERLAY_COLOR
40
45
  } from "./color-utils.mjs";
41
46
  import { DEFAULT_MEDIA_SIZE_SLUG } from "../constants.mjs";
42
- import { getIframeSrc, getBackgroundVideoSrc } from "../embed-video-utils.mjs";
47
+ import { getBackgroundEmbedHtml } from "../embed-video-utils.mjs";
43
48
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
44
49
  function getInnerBlocksTemplate(attributes) {
45
50
  return [
@@ -97,6 +102,10 @@ function CoverEdit({
97
102
  );
98
103
  const { getSettings } = useSelect(blockEditorStore);
99
104
  const { __unstableMarkNextChangeAsNotPersistent } = useDispatch(blockEditorStore);
105
+ const propsRef = useRef({ attributes, overlayColor });
106
+ useLayoutEffect(() => {
107
+ propsRef.current = { attributes, overlayColor };
108
+ });
100
109
  const { media } = useSelect(
101
110
  (select) => {
102
111
  return {
@@ -119,21 +128,22 @@ function CoverEdit({
119
128
  return;
120
129
  }
121
130
  const averageBackgroundColor = await getMediaColor(mediaUrl);
122
- let newOverlayColor = overlayColor.color;
123
- if (!isUserOverlayColor) {
131
+ const { attributes: currentAttrs, overlayColor: currentOverlay } = propsRef.current;
132
+ let newOverlayColor = currentOverlay.color;
133
+ if (!currentAttrs.isUserOverlayColor) {
124
134
  newOverlayColor = averageBackgroundColor;
125
135
  __unstableMarkNextChangeAsNotPersistent();
126
136
  setOverlayColor(newOverlayColor);
127
137
  }
128
138
  const newIsDark = compositeIsDark(
129
- dimRatio,
139
+ currentAttrs.dimRatio,
130
140
  newOverlayColor,
131
141
  averageBackgroundColor
132
142
  );
133
143
  __unstableMarkNextChangeAsNotPersistent();
134
144
  setAttributes({
135
145
  isDark: newIsDark,
136
- isUserOverlayColor: isUserOverlayColor || false
146
+ isUserOverlayColor: currentAttrs.isUserOverlayColor || false
137
147
  });
138
148
  })();
139
149
  }, [mediaUrl]);
@@ -152,13 +162,14 @@ function CoverEdit({
152
162
  const averageBackgroundColor = await getMediaColor(
153
163
  isImage ? newMedia?.url : void 0
154
164
  );
155
- let newOverlayColor = overlayColor.color;
156
- if (!isUserOverlayColor) {
165
+ const { attributes: currentAttrs, overlayColor: currentOverlay } = propsRef.current;
166
+ let newOverlayColor = currentOverlay.color;
167
+ if (!currentAttrs.isUserOverlayColor) {
157
168
  newOverlayColor = averageBackgroundColor;
158
169
  setOverlayColor(newOverlayColor);
159
170
  __unstableMarkNextChangeAsNotPersistent();
160
171
  }
161
- const newDimRatio = originalUrl === void 0 && dimRatio === 100 ? 50 : dimRatio;
172
+ const newDimRatio = currentAttrs.url === void 0 && currentAttrs.dimRatio === 100 ? 50 : currentAttrs.dimRatio;
162
173
  const newIsDark = compositeIsDark(
163
174
  newDimRatio,
164
175
  newOverlayColor,
@@ -182,7 +193,7 @@ function CoverEdit({
182
193
  useFeaturedImage: void 0,
183
194
  dimRatio: newDimRatio,
184
195
  isDark: newIsDark,
185
- isUserOverlayColor: isUserOverlayColor || false
196
+ isUserOverlayColor: currentAttrs.isUserOverlayColor || false
186
197
  });
187
198
  };
188
199
  const onClearMedia = () => {
@@ -210,8 +221,9 @@ function CoverEdit({
210
221
  };
211
222
  const onSetOverlayColor = async (newOverlayColor) => {
212
223
  const averageBackgroundColor = await getMediaColor(url);
224
+ const { attributes: currentAttrs } = propsRef.current;
213
225
  const newIsDark = compositeIsDark(
214
- dimRatio,
226
+ currentAttrs.dimRatio,
215
227
  newOverlayColor,
216
228
  averageBackgroundColor
217
229
  );
@@ -224,9 +236,10 @@ function CoverEdit({
224
236
  };
225
237
  const onUpdateDimRatio = async (newDimRatio) => {
226
238
  const averageBackgroundColor = await getMediaColor(url);
239
+ const { overlayColor: currentOverlay } = propsRef.current;
227
240
  const newIsDark = compositeIsDark(
228
241
  newDimRatio,
229
- overlayColor.color,
242
+ currentOverlay.color,
230
243
  averageBackgroundColor
231
244
  );
232
245
  setAttributes({
@@ -266,15 +279,11 @@ function CoverEdit({
266
279
  },
267
280
  [url, backgroundType]
268
281
  );
269
- const embedSrc = useMemo(() => {
282
+ const embedHtml = useMemo(() => {
270
283
  if (backgroundType !== EMBED_VIDEO_BACKGROUND_TYPE || !embedPreview?.html) {
271
284
  return null;
272
285
  }
273
- const iframeSrc = getIframeSrc(embedPreview.html);
274
- if (!iframeSrc) {
275
- return null;
276
- }
277
- return getBackgroundVideoSrc(iframeSrc);
286
+ return getBackgroundEmbedHtml(embedPreview.html);
278
287
  }, [embedPreview, backgroundType]);
279
288
  const isUploadingMedia = isTemporaryMedia(id, url);
280
289
  const isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType;
@@ -339,8 +348,9 @@ function CoverEdit({
339
348
  const toggleUseFeaturedImage = async () => {
340
349
  const newUseFeaturedImage = !useFeaturedImage;
341
350
  const averageBackgroundColor = newUseFeaturedImage ? await getMediaColor(mediaUrl) : DEFAULT_BACKGROUND_COLOR;
342
- const newOverlayColor = !isUserOverlayColor ? averageBackgroundColor : overlayColor.color;
343
- if (!isUserOverlayColor) {
351
+ const { attributes: currentAttrs, overlayColor: currentOverlay } = propsRef.current;
352
+ const newOverlayColor = !currentAttrs.isUserOverlayColor ? averageBackgroundColor : currentOverlay.color;
353
+ if (!currentAttrs.isUserOverlayColor) {
344
354
  if (newUseFeaturedImage) {
345
355
  setOverlayColor(newOverlayColor);
346
356
  } else {
@@ -348,7 +358,7 @@ function CoverEdit({
348
358
  }
349
359
  __unstableMarkNextChangeAsNotPersistent();
350
360
  }
351
- const newDimRatio = dimRatio === 100 ? 50 : dimRatio;
361
+ const newDimRatio = currentAttrs.dimRatio === 100 ? 50 : currentAttrs.dimRatio;
352
362
  const newIsDark = compositeIsDark(
353
363
  newDimRatio,
354
364
  newOverlayColor,
@@ -518,24 +528,25 @@ function CoverEdit({
518
528
  style: mediaStyle
519
529
  }
520
530
  ),
521
- isEmbedVideoBackground && embedSrc && /* @__PURE__ */ jsx(
531
+ isEmbedVideoBackground && embedHtml && /* @__PURE__ */ jsx(
522
532
  "div",
523
533
  {
524
534
  ref: mediaElement,
525
535
  className: "wp-block-cover__video-background wp-block-cover__embed-background",
526
536
  style: mediaStyle,
527
537
  children: /* @__PURE__ */ jsx(
528
- "iframe",
538
+ SandBox,
529
539
  {
530
- src: embedSrc,
540
+ html: embedHtml,
531
541
  title: "Background video",
532
- frameBorder: "0",
533
- allow: "autoplay; fullscreen"
542
+ styles: [
543
+ "iframe{position:fixed;top:0;left:0;width:100%;height:100%;}"
544
+ ]
534
545
  }
535
546
  )
536
547
  }
537
548
  ),
538
- isEmbedVideoBackground && !embedSrc && isFetchingEmbed && /* @__PURE__ */ jsx(Spinner, {}),
549
+ isEmbedVideoBackground && !embedHtml && isFetchingEmbed && /* @__PURE__ */ jsx(Spinner, {}),
539
550
  showOverlay && /* @__PURE__ */ jsx(
540
551
  "span",
541
552
  {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cover/edit/index.js"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\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\tuseSettings,\n\tuseInnerBlocksProps,\n\t__experimentalUseGradient,\n\tstore as blockEditorStore,\n\tuseBlockEditingMode,\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\tEMBED_VIDEO_BACKGROUND_TYPE,\n\tdimRatioToClass,\n\tisContentPositionCenter,\n\tgetPositionClassName,\n\tmediaPosition,\n} from '../shared';\nimport CoverInspectorControls from './inspector-controls';\nimport CoverBlockControls from './block-controls';\nimport CoverPlaceholder from './cover-placeholder';\nimport ResizableCoverPopover from './resizable-cover-popover';\nimport {\n\tgetMediaColor,\n\tcompositeIsDark,\n\tDEFAULT_BACKGROUND_COLOR,\n\tDEFAULT_OVERLAY_COLOR,\n} from './color-utils';\nimport { DEFAULT_MEDIA_SIZE_SLUG } from '../constants';\nimport { getIframeSrc, getBackgroundVideoSrc } from '../embed-video-utils';\n\nfunction getInnerBlocksTemplate( attributes ) {\n\treturn [\n\t\t[\n\t\t\t'core/paragraph',\n\t\t\t{\n\t\t\t\tstyle: {\n\t\t\t\t\ttypography: {\n\t\t\t\t\t\ttextAlign: 'center',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tplaceholder: __( 'Write title\u2026' ),\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\turl: originalUrl,\n\t\tbackgroundType: originalBackgroundType,\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\tisUserOverlayColor,\n\t\tsizeSlug,\n\t\tposter,\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\tconst { getSettings } = useSelect( blockEditorStore );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { media } = useSelect(\n\t\t( select ) => {\n\t\t\treturn {\n\t\t\t\tmedia:\n\t\t\t\t\tfeaturedImage && useFeaturedImage\n\t\t\t\t\t\t? select( coreStore ).getEntityRecord(\n\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\t'attachment',\n\t\t\t\t\t\t\t\tfeaturedImage,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tcontext: 'view',\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: undefined,\n\t\t\t};\n\t\t},\n\t\t[ featuredImage, useFeaturedImage ]\n\t);\n\tconst mediaUrl =\n\t\tmedia?.media_details?.sizes?.[ sizeSlug ]?.source_url ??\n\t\tmedia?.source_url;\n\n\t// User can change the featured image outside of the block, but we still\n\t// need to update the block when that happens. This effect should only\n\t// run when the featured image changes in that case. All other cases are\n\t// handled in their respective callbacks.\n\tuseEffect( () => {\n\t\t( async () => {\n\t\t\tif ( ! useFeaturedImage ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst averageBackgroundColor = await getMediaColor( mediaUrl );\n\n\t\t\tlet newOverlayColor = overlayColor.color;\n\t\t\tif ( ! isUserOverlayColor ) {\n\t\t\t\tnewOverlayColor = averageBackgroundColor;\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\tsetOverlayColor( newOverlayColor );\n\t\t\t}\n\n\t\t\tconst newIsDark = compositeIsDark(\n\t\t\t\tdimRatio,\n\t\t\t\tnewOverlayColor,\n\t\t\t\taverageBackgroundColor\n\t\t\t);\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( {\n\t\t\t\tisDark: newIsDark,\n\t\t\t\tisUserOverlayColor: isUserOverlayColor || false,\n\t\t\t} );\n\t\t} )();\n\t\t// Update the block only when the featured image changes.\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 originalUrl?.replaceAll( '&amp;', '&' );\n\tconst backgroundType = useFeaturedImage\n\t\t? IMAGE_BACKGROUND_TYPE\n\t\t: originalBackgroundType;\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst { gradientClass, gradientValue } = __experimentalUseGradient();\n\n\tconst onSelectMedia = async ( newMedia ) => {\n\t\tconst mediaAttributes = attributesFromMedia( newMedia );\n\t\tconst isImage = [ newMedia?.type, newMedia?.media_type ].includes(\n\t\t\tIMAGE_BACKGROUND_TYPE\n\t\t);\n\n\t\tconst averageBackgroundColor = await getMediaColor(\n\t\t\tisImage ? newMedia?.url : undefined\n\t\t);\n\n\t\tlet newOverlayColor = overlayColor.color;\n\t\tif ( ! isUserOverlayColor ) {\n\t\t\tnewOverlayColor = averageBackgroundColor;\n\t\t\tsetOverlayColor( newOverlayColor );\n\n\t\t\t// Make undo revert the next setAttributes and the previous setOverlayColor.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t}\n\n\t\t// Only set a new dimRatio if there was no previous media selected\n\t\t// to avoid resetting to 50 if it has been explicitly set to 100.\n\t\t// See issue #52835 for context.\n\t\tconst newDimRatio =\n\t\t\toriginalUrl === undefined && dimRatio === 100 ? 50 : dimRatio;\n\n\t\tconst newIsDark = compositeIsDark(\n\t\t\tnewDimRatio,\n\t\t\tnewOverlayColor,\n\t\t\taverageBackgroundColor\n\t\t);\n\n\t\tif ( backgroundType === IMAGE_BACKGROUND_TYPE && mediaAttributes?.id ) {\n\t\t\tconst { imageDefaultSize } = getSettings();\n\n\t\t\t// Try to use the previous selected image size if it's available\n\t\t\t// otherwise try the default image size or fallback to full size.\n\t\t\tif (\n\t\t\t\tsizeSlug &&\n\t\t\t\t( newMedia?.sizes?.[ sizeSlug ] ||\n\t\t\t\t\tnewMedia?.media_details?.sizes?.[ sizeSlug ] )\n\t\t\t) {\n\t\t\t\tmediaAttributes.sizeSlug = sizeSlug;\n\t\t\t\tmediaAttributes.url =\n\t\t\t\t\tnewMedia?.sizes?.[ sizeSlug ]?.url ||\n\t\t\t\t\tnewMedia?.media_details?.sizes?.[ sizeSlug ]?.source_url;\n\t\t\t} else if (\n\t\t\t\tnewMedia?.sizes?.[ imageDefaultSize ] ||\n\t\t\t\tnewMedia?.media_details?.sizes?.[ imageDefaultSize ]\n\t\t\t) {\n\t\t\t\tmediaAttributes.sizeSlug = imageDefaultSize;\n\t\t\t\tmediaAttributes.url =\n\t\t\t\t\tnewMedia?.sizes?.[ imageDefaultSize ]?.url ||\n\t\t\t\t\tnewMedia?.media_details?.sizes?.[ imageDefaultSize ]\n\t\t\t\t\t\t?.source_url;\n\t\t\t} else {\n\t\t\t\tmediaAttributes.sizeSlug = DEFAULT_MEDIA_SIZE_SLUG;\n\t\t\t}\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\t...mediaAttributes,\n\t\t\tfocalPoint: undefined,\n\t\t\tuseFeaturedImage: undefined,\n\t\t\tdimRatio: newDimRatio,\n\t\t\tisDark: newIsDark,\n\t\t\tisUserOverlayColor: isUserOverlayColor || false,\n\t\t} );\n\t};\n\n\tconst onClearMedia = () => {\n\t\tlet newOverlayColor = overlayColor.color;\n\t\tif ( ! isUserOverlayColor ) {\n\t\t\tnewOverlayColor = DEFAULT_OVERLAY_COLOR;\n\t\t\tsetOverlayColor( undefined );\n\n\t\t\t// Make undo revert the next setAttributes and the previous setOverlayColor.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t}\n\n\t\tconst newIsDark = compositeIsDark(\n\t\t\tdimRatio,\n\t\t\tnewOverlayColor,\n\t\t\tDEFAULT_BACKGROUND_COLOR\n\t\t);\n\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: undefined,\n\t\t\tisDark: newIsDark,\n\t\t} );\n\t};\n\n\tconst onSetOverlayColor = async ( newOverlayColor ) => {\n\t\tconst averageBackgroundColor = await getMediaColor( url );\n\t\tconst newIsDark = compositeIsDark(\n\t\t\tdimRatio,\n\t\t\tnewOverlayColor,\n\t\t\taverageBackgroundColor\n\t\t);\n\n\t\tsetOverlayColor( newOverlayColor );\n\n\t\t// Make undo revert the next setAttributes and the previous setOverlayColor.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\n\t\tsetAttributes( {\n\t\t\tisUserOverlayColor: true,\n\t\t\tisDark: newIsDark,\n\t\t} );\n\t};\n\n\tconst onUpdateDimRatio = async ( newDimRatio ) => {\n\t\tconst averageBackgroundColor = await getMediaColor( url );\n\t\tconst newIsDark = compositeIsDark(\n\t\t\tnewDimRatio,\n\t\t\toverlayColor.color,\n\t\t\taverageBackgroundColor\n\t\t);\n\n\t\tsetAttributes( {\n\t\t\tdimRatio: newDimRatio,\n\t\t\tisDark: newIsDark,\n\t\t} );\n\t};\n\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t};\n\n\tconst onSelectEmbedUrl = ( embedUrl ) => {\n\t\t// Only set a new dimRatio if there was no previous media selected\n\t\t// to avoid resetting to 50 if it has been explicitly set to 100.\n\t\tconst newDimRatio =\n\t\t\toriginalUrl === undefined && dimRatio === 100 ? 50 : dimRatio;\n\n\t\t// Set initial attributes with URL\n\t\tsetAttributes( {\n\t\t\turl: embedUrl,\n\t\t\tbackgroundType: EMBED_VIDEO_BACKGROUND_TYPE,\n\t\t\tdimRatio: newDimRatio,\n\t\t\tid: undefined,\n\t\t\tfocalPoint: undefined,\n\t\t\thasParallax: undefined,\n\t\t\tisRepeated: undefined,\n\t\t\tuseFeaturedImage: undefined,\n\t\t} );\n\t};\n\n\t// Fetch embed preview for embed videos\n\tconst { embedPreview, isFetchingEmbed } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( backgroundType !== EMBED_VIDEO_BACKGROUND_TYPE || ! url ) {\n\t\t\t\treturn {\n\t\t\t\t\tembedPreview: undefined,\n\t\t\t\t\tisFetchingEmbed: false,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst { getEmbedPreview, isRequestingEmbedPreview } =\n\t\t\t\tselect( coreStore );\n\n\t\t\treturn {\n\t\t\t\tembedPreview: getEmbedPreview( url ),\n\t\t\t\tisFetchingEmbed: isRequestingEmbedPreview( url ),\n\t\t\t};\n\t\t},\n\t\t[ url, backgroundType ]\n\t);\n\n\t// Compute embedSrc on-the-fly from embed preview for editor display\n\tconst embedSrc = useMemo( () => {\n\t\tif (\n\t\t\tbackgroundType !== EMBED_VIDEO_BACKGROUND_TYPE ||\n\t\t\t! embedPreview?.html\n\t\t) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// Extract iframe src from embed HTML\n\t\tconst iframeSrc = getIframeSrc( embedPreview.html );\n\t\tif ( ! iframeSrc ) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// Modify the src to add background video parameters (provider auto-detected)\n\t\treturn getBackgroundVideoSrc( iframeSrc );\n\t}, [ embedPreview, backgroundType ] );\n\n\tconst isUploadingMedia = isTemporaryMedia( id, url );\n\n\tconst isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType;\n\tconst isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType;\n\tconst isEmbedVideoBackground =\n\t\tEMBED_VIDEO_BACKGROUND_TYPE === backgroundType;\n\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst hasNonContentControls = blockEditingMode === 'default';\n\n\tconst [ resizeListener, { height, width } ] = useResizeObserver();\n\tconst resizableBoxDimensions = useMemo( () => {\n\t\treturn {\n\t\t\theight: minHeightUnit === 'px' && minHeight ? 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 [ fontSizes ] = useSettings( 'typography.fontSizes' );\n\tconst hasFontSizes = fontSizes?.length > 0;\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\tdropZoneElement: ref.current,\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 newUseFeaturedImage = ! useFeaturedImage;\n\n\t\tconst averageBackgroundColor = newUseFeaturedImage\n\t\t\t? await getMediaColor( mediaUrl )\n\t\t\t: DEFAULT_BACKGROUND_COLOR;\n\n\t\tconst newOverlayColor = ! isUserOverlayColor\n\t\t\t? averageBackgroundColor\n\t\t\t: overlayColor.color;\n\n\t\tif ( ! isUserOverlayColor ) {\n\t\t\tif ( newUseFeaturedImage ) {\n\t\t\t\tsetOverlayColor( newOverlayColor );\n\t\t\t} else {\n\t\t\t\tsetOverlayColor( undefined );\n\t\t\t}\n\n\t\t\t// Make undo revert the next setAttributes and the previous setOverlayColor.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t}\n\n\t\tconst newDimRatio = dimRatio === 100 ? 50 : dimRatio;\n\t\tconst newIsDark = compositeIsDark(\n\t\t\tnewDimRatio,\n\t\t\tnewOverlayColor,\n\t\t\taverageBackgroundColor\n\t\t);\n\n\t\tsetAttributes( {\n\t\t\tid: undefined,\n\t\t\turl: undefined,\n\t\t\tuseFeaturedImage: newUseFeaturedImage,\n\t\t\tdimRatio: newDimRatio,\n\t\t\tbackgroundType: useFeaturedImage\n\t\t\t\t? IMAGE_BACKGROUND_TYPE\n\t\t\t\t: undefined,\n\t\t\tisDark: newIsDark,\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\tonSelectEmbedUrl={ onSelectEmbedUrl }\n\t\t\tcurrentSettings={ currentSettings }\n\t\t\ttoggleUseFeaturedImage={ toggleUseFeaturedImage }\n\t\t\tonClearMedia={ onClearMedia }\n\t\t\tblockEditingMode={ blockEditingMode }\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\tfeaturedImage={ media }\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\t// Hide the resize handle if an aspect ratio is set, as the aspect ratio takes precedence.\n\t\tshowHandle: ! attributes.style?.dimensions?.aspectRatio,\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{ hasNonContentControls && 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={ clsx( 'is-placeholder', blockProps.className ) }\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\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\tasButtons\n\t\t\t\t\t\t\t\taria-label={ __( 'Overlay color' ) }\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 = clsx(\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\tconst showOverlay =\n\t\turl || ! useFeaturedImage || ( useFeaturedImage && ! url );\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={ clsx( 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\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\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={ alt ? 'img' : undefined }\n\t\t\t\t\t\t\taria-label={ alt ? alt : undefined }\n\t\t\t\t\t\t\tclassName={ clsx(\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\tposter={ poster }\n\t\t\t\t\t\tstyle={ mediaStyle }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ isEmbedVideoBackground && embedSrc && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tref={ mediaElement }\n\t\t\t\t\t\tclassName=\"wp-block-cover__video-background wp-block-cover__embed-background\"\n\t\t\t\t\t\tstyle={ mediaStyle }\n\t\t\t\t\t>\n\t\t\t\t\t\t<iframe\n\t\t\t\t\t\t\tsrc={ embedSrc }\n\t\t\t\t\t\t\ttitle=\"Background video\"\n\t\t\t\t\t\t\tframeBorder=\"0\"\n\t\t\t\t\t\t\tallow=\"autoplay; fullscreen\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t{ isEmbedVideoBackground && ! embedSrc && isFetchingEmbed && (\n\t\t\t\t\t<Spinner />\n\t\t\t\t) }\n\n\t\t\t\t{ showOverlay && (\n\t\t\t\t\t<span\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\tclassName={ clsx(\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{ isUploadingMedia && <Spinner /> }\n\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{ hasNonContentControls && 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"],
5
- "mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,eAAe,SAAS,iBAAiB;AAClD,SAAS,WAAW,SAAS,cAAc;AAC3C,SAAS,aAAa,eAAe;AACrC,SAAS,SAAS,yBAAyB;AAC3C;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT;AAAA,OACM;AACP,SAAS,UAAU;AACnB,SAAS,WAAW,mBAAmB;AACvC,SAAS,iBAAiB;AAC1B,SAAS,SAAS,oBAAoB;AAKtC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,OAAO,4BAA4B;AACnC,OAAO,wBAAwB;AAC/B,OAAO,sBAAsB;AAC7B,OAAO,2BAA2B;AAClC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,+BAA+B;AACxC,SAAS,cAAc,6BAA6B;AA+clD,SAmDC,UAnDD,KAyDE,YAzDF;AA7cF,SAAS,uBAAwB,YAAa;AAC7C,SAAO;AAAA,IACN;AAAA,MACC;AAAA,MACA;AAAA,QACC,OAAO;AAAA,UACN,YAAY;AAAA,YACX,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A;AAAA,kBAInC,uCACC,OAAO,iBAAiB,aAAa;AAAA,kBACtC,2BAA2B;AAAA,kBAC3B,CAAE,aAAc,GAAG;AAAA,gBACpB;AAAA,cACD;AAAA,cACA,OAAQ,EAAE,iBAAiB,eAAe,GAAG,QAAQ;AAAA;AAAA,UACtD;AAAA,UAGC,oBAAoB,oBAAC,WAAQ;AAAA,UAE/B;AAAA,YAAC;AAAA;AAAA,cACA,qBAAmB;AAAA,cACnB;AAAA,cACA,SAAU;AAAA,cACV;AAAA;AAAA,UACD;AAAA,UACA,oBAAC,SAAM,GAAG,kBAAmB;AAAA;AAAA;AAAA,IAC9B;AAAA,IACE,yBAAyB,cAC1B,oBAAC,yBAAwB,GAAG,qBAAsB;AAAA,KAEpD;AAEF;AAEA,IAAO,eAAQ,QAAS;AAAA,EACvB,WAAY,EAAE,cAAc,mBAAmB,CAAE;AAClD,CAAE,EAAG,SAAU;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport {\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseMemo,\n\tuseRef,\n} from '@wordpress/element';\nimport { Placeholder, SandBox, Spinner } from '@wordpress/components';\nimport { compose, useResizeObserver } from '@wordpress/compose';\nimport {\n\twithColors,\n\tColorPalette,\n\tuseBlockProps,\n\tuseSettings,\n\tuseInnerBlocksProps,\n\t__experimentalUseGradient,\n\tstore as blockEditorStore,\n\tuseBlockEditingMode,\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\tEMBED_VIDEO_BACKGROUND_TYPE,\n\tdimRatioToClass,\n\tisContentPositionCenter,\n\tgetPositionClassName,\n\tmediaPosition,\n} from '../shared';\nimport CoverInspectorControls from './inspector-controls';\nimport CoverBlockControls from './block-controls';\nimport CoverPlaceholder from './cover-placeholder';\nimport ResizableCoverPopover from './resizable-cover-popover';\nimport {\n\tgetMediaColor,\n\tcompositeIsDark,\n\tDEFAULT_BACKGROUND_COLOR,\n\tDEFAULT_OVERLAY_COLOR,\n} from './color-utils';\nimport { DEFAULT_MEDIA_SIZE_SLUG } from '../constants';\nimport { getBackgroundEmbedHtml } from '../embed-video-utils';\n\nfunction getInnerBlocksTemplate( attributes ) {\n\treturn [\n\t\t[\n\t\t\t'core/paragraph',\n\t\t\t{\n\t\t\t\tstyle: {\n\t\t\t\t\ttypography: {\n\t\t\t\t\t\ttextAlign: 'center',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tplaceholder: __( 'Write title\u2026' ),\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\turl: originalUrl,\n\t\tbackgroundType: originalBackgroundType,\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\tisUserOverlayColor,\n\t\tsizeSlug,\n\t\tposter,\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\tconst { getSettings } = useSelect( blockEditorStore );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\t// Ref to access latest values after async operations (e.g. getMediaColor),\n\t// avoiding stale values that could overwrite concurrent remote changes.\n\tconst propsRef = useRef( { attributes, overlayColor } );\n\tuseLayoutEffect( () => {\n\t\tpropsRef.current = { attributes, overlayColor };\n\t} );\n\n\tconst { media } = useSelect(\n\t\t( select ) => {\n\t\t\treturn {\n\t\t\t\tmedia:\n\t\t\t\t\tfeaturedImage && useFeaturedImage\n\t\t\t\t\t\t? select( coreStore ).getEntityRecord(\n\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\t'attachment',\n\t\t\t\t\t\t\t\tfeaturedImage,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tcontext: 'view',\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: undefined,\n\t\t\t};\n\t\t},\n\t\t[ featuredImage, useFeaturedImage ]\n\t);\n\tconst mediaUrl =\n\t\tmedia?.media_details?.sizes?.[ sizeSlug ]?.source_url ??\n\t\tmedia?.source_url;\n\n\t// User can change the featured image outside of the block, but we still\n\t// need to update the block when that happens. This effect should only\n\t// run when the featured image changes in that case. All other cases are\n\t// handled in their respective callbacks.\n\tuseEffect( () => {\n\t\t( async () => {\n\t\t\tif ( ! useFeaturedImage ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst averageBackgroundColor = await getMediaColor( mediaUrl );\n\n\t\t\t// Read latest values after await to avoid stale closures.\n\t\t\tconst { attributes: currentAttrs, overlayColor: currentOverlay } =\n\t\t\t\tpropsRef.current;\n\n\t\t\tlet newOverlayColor = currentOverlay.color;\n\t\t\tif ( ! currentAttrs.isUserOverlayColor ) {\n\t\t\t\tnewOverlayColor = averageBackgroundColor;\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\tsetOverlayColor( newOverlayColor );\n\t\t\t}\n\n\t\t\tconst newIsDark = compositeIsDark(\n\t\t\t\tcurrentAttrs.dimRatio,\n\t\t\t\tnewOverlayColor,\n\t\t\t\taverageBackgroundColor\n\t\t\t);\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( {\n\t\t\t\tisDark: newIsDark,\n\t\t\t\tisUserOverlayColor: currentAttrs.isUserOverlayColor || false,\n\t\t\t} );\n\t\t} )();\n\t\t// Update the block only when the featured image changes.\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 originalUrl?.replaceAll( '&amp;', '&' );\n\tconst backgroundType = useFeaturedImage\n\t\t? IMAGE_BACKGROUND_TYPE\n\t\t: originalBackgroundType;\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst { gradientClass, gradientValue } = __experimentalUseGradient();\n\n\tconst onSelectMedia = async ( newMedia ) => {\n\t\tconst mediaAttributes = attributesFromMedia( newMedia );\n\t\tconst isImage = [ newMedia?.type, newMedia?.media_type ].includes(\n\t\t\tIMAGE_BACKGROUND_TYPE\n\t\t);\n\n\t\tconst averageBackgroundColor = await getMediaColor(\n\t\t\tisImage ? newMedia?.url : undefined\n\t\t);\n\n\t\t// Read latest values to avoid stale closures.\n\t\tconst { attributes: currentAttrs, overlayColor: currentOverlay } =\n\t\t\tpropsRef.current;\n\n\t\tlet newOverlayColor = currentOverlay.color;\n\t\tif ( ! currentAttrs.isUserOverlayColor ) {\n\t\t\tnewOverlayColor = averageBackgroundColor;\n\t\t\tsetOverlayColor( newOverlayColor );\n\n\t\t\t// Make undo revert the next setAttributes and the previous setOverlayColor.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t}\n\n\t\t// Only set a new dimRatio if there was no previous media selected\n\t\t// to avoid resetting to 50 if it has been explicitly set to 100.\n\t\t// See issue #52835 for context.\n\t\tconst newDimRatio =\n\t\t\tcurrentAttrs.url === undefined && currentAttrs.dimRatio === 100\n\t\t\t\t? 50\n\t\t\t\t: currentAttrs.dimRatio;\n\n\t\tconst newIsDark = compositeIsDark(\n\t\t\tnewDimRatio,\n\t\t\tnewOverlayColor,\n\t\t\taverageBackgroundColor\n\t\t);\n\n\t\tif ( backgroundType === IMAGE_BACKGROUND_TYPE && mediaAttributes?.id ) {\n\t\t\tconst { imageDefaultSize } = getSettings();\n\n\t\t\t// Try to use the previous selected image size if it's available\n\t\t\t// otherwise try the default image size or fallback to full size.\n\t\t\tif (\n\t\t\t\tsizeSlug &&\n\t\t\t\t( newMedia?.sizes?.[ sizeSlug ] ||\n\t\t\t\t\tnewMedia?.media_details?.sizes?.[ sizeSlug ] )\n\t\t\t) {\n\t\t\t\tmediaAttributes.sizeSlug = sizeSlug;\n\t\t\t\tmediaAttributes.url =\n\t\t\t\t\tnewMedia?.sizes?.[ sizeSlug ]?.url ||\n\t\t\t\t\tnewMedia?.media_details?.sizes?.[ sizeSlug ]?.source_url;\n\t\t\t} else if (\n\t\t\t\tnewMedia?.sizes?.[ imageDefaultSize ] ||\n\t\t\t\tnewMedia?.media_details?.sizes?.[ imageDefaultSize ]\n\t\t\t) {\n\t\t\t\tmediaAttributes.sizeSlug = imageDefaultSize;\n\t\t\t\tmediaAttributes.url =\n\t\t\t\t\tnewMedia?.sizes?.[ imageDefaultSize ]?.url ||\n\t\t\t\t\tnewMedia?.media_details?.sizes?.[ imageDefaultSize ]\n\t\t\t\t\t\t?.source_url;\n\t\t\t} else {\n\t\t\t\tmediaAttributes.sizeSlug = DEFAULT_MEDIA_SIZE_SLUG;\n\t\t\t}\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\t...mediaAttributes,\n\t\t\tfocalPoint: undefined,\n\t\t\tuseFeaturedImage: undefined,\n\t\t\tdimRatio: newDimRatio,\n\t\t\tisDark: newIsDark,\n\t\t\tisUserOverlayColor: currentAttrs.isUserOverlayColor || false,\n\t\t} );\n\t};\n\n\tconst onClearMedia = () => {\n\t\tlet newOverlayColor = overlayColor.color;\n\t\tif ( ! isUserOverlayColor ) {\n\t\t\tnewOverlayColor = DEFAULT_OVERLAY_COLOR;\n\t\t\tsetOverlayColor( undefined );\n\n\t\t\t// Make undo revert the next setAttributes and the previous setOverlayColor.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t}\n\n\t\tconst newIsDark = compositeIsDark(\n\t\t\tdimRatio,\n\t\t\tnewOverlayColor,\n\t\t\tDEFAULT_BACKGROUND_COLOR\n\t\t);\n\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: undefined,\n\t\t\tisDark: newIsDark,\n\t\t} );\n\t};\n\n\tconst onSetOverlayColor = async ( newOverlayColor ) => {\n\t\tconst averageBackgroundColor = await getMediaColor( url );\n\n\t\t// Read latest dimRatio after await to avoid stale closure.\n\t\tconst { attributes: currentAttrs } = propsRef.current;\n\n\t\tconst newIsDark = compositeIsDark(\n\t\t\tcurrentAttrs.dimRatio,\n\t\t\tnewOverlayColor,\n\t\t\taverageBackgroundColor\n\t\t);\n\n\t\tsetOverlayColor( newOverlayColor );\n\n\t\t// Make undo revert the next setAttributes and the previous setOverlayColor.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\n\t\tsetAttributes( {\n\t\t\tisUserOverlayColor: true,\n\t\t\tisDark: newIsDark,\n\t\t} );\n\t};\n\n\tconst onUpdateDimRatio = async ( newDimRatio ) => {\n\t\tconst averageBackgroundColor = await getMediaColor( url );\n\n\t\t// Read latest overlayColor after await to avoid stale closure.\n\t\tconst { overlayColor: currentOverlay } = propsRef.current;\n\n\t\tconst newIsDark = compositeIsDark(\n\t\t\tnewDimRatio,\n\t\t\tcurrentOverlay.color,\n\t\t\taverageBackgroundColor\n\t\t);\n\n\t\tsetAttributes( {\n\t\t\tdimRatio: newDimRatio,\n\t\t\tisDark: newIsDark,\n\t\t} );\n\t};\n\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t};\n\n\tconst onSelectEmbedUrl = ( embedUrl ) => {\n\t\t// Only set a new dimRatio if there was no previous media selected\n\t\t// to avoid resetting to 50 if it has been explicitly set to 100.\n\t\tconst newDimRatio =\n\t\t\toriginalUrl === undefined && dimRatio === 100 ? 50 : dimRatio;\n\n\t\t// Set initial attributes with URL\n\t\tsetAttributes( {\n\t\t\turl: embedUrl,\n\t\t\tbackgroundType: EMBED_VIDEO_BACKGROUND_TYPE,\n\t\t\tdimRatio: newDimRatio,\n\t\t\tid: undefined,\n\t\t\tfocalPoint: undefined,\n\t\t\thasParallax: undefined,\n\t\t\tisRepeated: undefined,\n\t\t\tuseFeaturedImage: undefined,\n\t\t} );\n\t};\n\n\t// Fetch embed preview for embed videos\n\tconst { embedPreview, isFetchingEmbed } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( backgroundType !== EMBED_VIDEO_BACKGROUND_TYPE || ! url ) {\n\t\t\t\treturn {\n\t\t\t\t\tembedPreview: undefined,\n\t\t\t\t\tisFetchingEmbed: false,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst { getEmbedPreview, isRequestingEmbedPreview } =\n\t\t\t\tselect( coreStore );\n\n\t\t\treturn {\n\t\t\t\tembedPreview: getEmbedPreview( url ),\n\t\t\t\tisFetchingEmbed: isRequestingEmbedPreview( url ),\n\t\t\t};\n\t\t},\n\t\t[ url, backgroundType ]\n\t);\n\n\t// Compute embed HTML for editor display via SandBox\n\tconst embedHtml = useMemo( () => {\n\t\tif (\n\t\t\tbackgroundType !== EMBED_VIDEO_BACKGROUND_TYPE ||\n\t\t\t! embedPreview?.html\n\t\t) {\n\t\t\treturn null;\n\t\t}\n\t\treturn getBackgroundEmbedHtml( embedPreview.html );\n\t}, [ embedPreview, backgroundType ] );\n\n\tconst isUploadingMedia = isTemporaryMedia( id, url );\n\n\tconst isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType;\n\tconst isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType;\n\tconst isEmbedVideoBackground =\n\t\tEMBED_VIDEO_BACKGROUND_TYPE === backgroundType;\n\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst hasNonContentControls = blockEditingMode === 'default';\n\n\tconst [ resizeListener, { height, width } ] = useResizeObserver();\n\tconst resizableBoxDimensions = useMemo( () => {\n\t\treturn {\n\t\t\theight: minHeightUnit === 'px' && minHeight ? 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 [ fontSizes ] = useSettings( 'typography.fontSizes' );\n\tconst hasFontSizes = fontSizes?.length > 0;\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\tdropZoneElement: ref.current,\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 newUseFeaturedImage = ! useFeaturedImage;\n\n\t\tconst averageBackgroundColor = newUseFeaturedImage\n\t\t\t? await getMediaColor( mediaUrl )\n\t\t\t: DEFAULT_BACKGROUND_COLOR;\n\n\t\t// Read latest values after await to avoid stale closures.\n\t\tconst { attributes: currentAttrs, overlayColor: currentOverlay } =\n\t\t\tpropsRef.current;\n\n\t\tconst newOverlayColor = ! currentAttrs.isUserOverlayColor\n\t\t\t? averageBackgroundColor\n\t\t\t: currentOverlay.color;\n\n\t\tif ( ! currentAttrs.isUserOverlayColor ) {\n\t\t\tif ( newUseFeaturedImage ) {\n\t\t\t\tsetOverlayColor( newOverlayColor );\n\t\t\t} else {\n\t\t\t\tsetOverlayColor( undefined );\n\t\t\t}\n\n\t\t\t// Make undo revert the next setAttributes and the previous setOverlayColor.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t}\n\n\t\tconst newDimRatio =\n\t\t\tcurrentAttrs.dimRatio === 100 ? 50 : currentAttrs.dimRatio;\n\t\tconst newIsDark = compositeIsDark(\n\t\t\tnewDimRatio,\n\t\t\tnewOverlayColor,\n\t\t\taverageBackgroundColor\n\t\t);\n\n\t\tsetAttributes( {\n\t\t\tid: undefined,\n\t\t\turl: undefined,\n\t\t\tuseFeaturedImage: newUseFeaturedImage,\n\t\t\tdimRatio: newDimRatio,\n\t\t\tbackgroundType: useFeaturedImage\n\t\t\t\t? IMAGE_BACKGROUND_TYPE\n\t\t\t\t: undefined,\n\t\t\tisDark: newIsDark,\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\tonSelectEmbedUrl={ onSelectEmbedUrl }\n\t\t\tcurrentSettings={ currentSettings }\n\t\t\ttoggleUseFeaturedImage={ toggleUseFeaturedImage }\n\t\t\tonClearMedia={ onClearMedia }\n\t\t\tblockEditingMode={ blockEditingMode }\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\tfeaturedImage={ media }\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\t// Hide the resize handle if an aspect ratio is set, as the aspect ratio takes precedence.\n\t\tshowHandle: ! attributes.style?.dimensions?.aspectRatio,\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{ hasNonContentControls && 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={ clsx( 'is-placeholder', blockProps.className ) }\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\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\tasButtons\n\t\t\t\t\t\t\t\taria-label={ __( 'Overlay color' ) }\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 = clsx(\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\tconst showOverlay =\n\t\turl || ! useFeaturedImage || ( useFeaturedImage && ! url );\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={ clsx( 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\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\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={ alt ? 'img' : undefined }\n\t\t\t\t\t\t\taria-label={ alt ? alt : undefined }\n\t\t\t\t\t\t\tclassName={ clsx(\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\tposter={ poster }\n\t\t\t\t\t\tstyle={ mediaStyle }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ isEmbedVideoBackground && embedHtml && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tref={ mediaElement }\n\t\t\t\t\t\tclassName=\"wp-block-cover__video-background wp-block-cover__embed-background\"\n\t\t\t\t\t\tstyle={ mediaStyle }\n\t\t\t\t\t>\n\t\t\t\t\t\t<SandBox\n\t\t\t\t\t\t\thtml={ embedHtml }\n\t\t\t\t\t\t\ttitle=\"Background video\"\n\t\t\t\t\t\t\tstyles={ [\n\t\t\t\t\t\t\t\t'iframe{position:fixed;top:0;left:0;width:100%;height:100%;}',\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t{ isEmbedVideoBackground && ! embedHtml && isFetchingEmbed && (\n\t\t\t\t\t<Spinner />\n\t\t\t\t) }\n\n\t\t\t\t{ showOverlay && (\n\t\t\t\t\t<span\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\tclassName={ clsx(\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{ isUploadingMedia && <Spinner /> }\n\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{ hasNonContentControls && 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"],
5
+ "mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,eAAe,SAAS,iBAAiB;AAClD;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,aAAa,SAAS,eAAe;AAC9C,SAAS,SAAS,yBAAyB;AAC3C;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT;AAAA,OACM;AACP,SAAS,UAAU;AACnB,SAAS,WAAW,mBAAmB;AACvC,SAAS,iBAAiB;AAC1B,SAAS,SAAS,oBAAoB;AAKtC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAC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QAAS;AAAA,EACvB,WAAY,EAAE,cAAc,mBAAmB,CAAE;AAClD,CAAE,EAAG,SAAU;",
6
6
  "names": []
7
7
  }
@@ -34,12 +34,14 @@ function findVideoEmbedProvider(url) {
34
34
  }
35
35
  return matchingVariation;
36
36
  }
37
- function getIframeSrc(html) {
38
- if (!html) {
37
+ function getBackgroundEmbedHtml(html) {
38
+ const srcMatch = html?.match(/src=["']([^"']+)["']/);
39
+ if (!srcMatch) {
39
40
  return null;
40
41
  }
41
- const srcMatch = html.match(/src=["']([^"']+)["']/);
42
- return srcMatch ? srcMatch[1] : null;
42
+ const iframeSrc = srcMatch[1];
43
+ const backgroundSrc = getBackgroundVideoSrc(iframeSrc);
44
+ return html.replace(iframeSrc, backgroundSrc);
43
45
  }
44
46
  function detectProviderFromSrc(src) {
45
47
  if (!src) {
@@ -108,14 +110,14 @@ function getBackgroundVideoSrc(src) {
108
110
  break;
109
111
  }
110
112
  return url.toString();
111
- } catch (error) {
113
+ } catch {
112
114
  return src;
113
115
  }
114
116
  }
115
117
  export {
116
118
  detectProviderFromSrc,
119
+ getBackgroundEmbedHtml,
117
120
  getBackgroundVideoSrc,
118
- getIframeSrc,
119
121
  getVideoEmbedProvider,
120
122
  isValidVideoEmbedUrl
121
123
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/cover/embed-video-utils.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { getBlockVariations } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { matchesPatterns } from '../embed/util';\n\nconst DEFAULT_EMBED_BLOCK = 'core/embed';\n\n// List of supported video providers for cover block backgrounds\nconst VIDEO_PROVIDERS = [\n\t'youtube',\n\t'vimeo',\n\t'videopress',\n\t'animoto',\n\t'tiktok',\n\t'wordpress-tv',\n];\n\n/**\n * Checks if a URL is a valid video embed URL from supported providers.\n *\n * @param {string} url The URL to validate.\n * @return {boolean} True if the URL matches a supported video provider pattern.\n */\nexport function isValidVideoEmbedUrl( url ) {\n\tif ( ! url ) {\n\t\treturn false;\n\t}\n\n\tconst embedBlock = findVideoEmbedProvider( url );\n\treturn embedBlock !== null;\n}\n\n/**\n * Finds the embed provider for a given URL if it's a supported video provider.\n *\n * @param {string} url The URL to check.\n * @return {string|null} The provider name slug (e.g., 'youtube') or null if not found.\n */\nexport function getVideoEmbedProvider( url ) {\n\tconst embedBlock = findVideoEmbedProvider( url );\n\treturn embedBlock ? embedBlock.name : null;\n}\n\n/**\n * Finds a matching video embed block variation for the given URL.\n *\n * @param {string} url The URL to match against provider patterns.\n * @return {Object|null} The matching block variation or null if not found.\n */\nfunction findVideoEmbedProvider( url ) {\n\tconst embedVariations = getBlockVariations( DEFAULT_EMBED_BLOCK );\n\n\tif ( ! embedVariations ) {\n\t\treturn null;\n\t}\n\n\tconst matchingVariation = embedVariations.find( ( { patterns } ) =>\n\t\tmatchesPatterns( url, patterns )\n\t);\n\n\tif (\n\t\t! matchingVariation ||\n\t\t! VIDEO_PROVIDERS.includes( matchingVariation.name )\n\t) {\n\t\treturn null;\n\t}\n\n\treturn matchingVariation;\n}\n\n/**\n * Extracts iframe src from embed HTML.\n *\n * @param {string} html The embed HTML.\n * @return {string|null} The iframe src URL or null if not found.\n */\nexport function getIframeSrc( html ) {\n\tif ( ! html ) {\n\t\treturn null;\n\t}\n\n\tconst srcMatch = html.match( /src=[\"']([^\"']+)[\"']/ );\n\treturn srcMatch ? srcMatch[ 1 ] : null;\n}\n\n/**\n * Detects the video provider from an iframe src URL.\n *\n * @param {string} src The iframe src URL.\n * @return {string|null} The provider name slug or null if not recognized.\n */\nexport function detectProviderFromSrc( src ) {\n\tif ( ! src ) {\n\t\treturn null;\n\t}\n\n\tconst lowerSrc = src.toLowerCase();\n\n\tif (\n\t\tlowerSrc.includes( 'youtube.com' ) ||\n\t\tlowerSrc.includes( 'youtu.be' )\n\t) {\n\t\treturn 'youtube';\n\t}\n\tif ( lowerSrc.includes( 'vimeo.com' ) ) {\n\t\treturn 'vimeo';\n\t}\n\tif ( lowerSrc.includes( 'videopress.com' ) ) {\n\t\treturn 'videopress';\n\t}\n\tif ( lowerSrc.includes( 'animoto.com' ) ) {\n\t\treturn 'animoto';\n\t}\n\tif ( lowerSrc.includes( 'tiktok.com' ) ) {\n\t\treturn 'tiktok';\n\t}\n\tif ( lowerSrc.includes( 'wordpress.tv' ) ) {\n\t\treturn 'wordpress-tv';\n\t}\n\n\treturn null;\n}\n\n/**\n * Modifies an iframe src URL to add background video parameters.\n * Automatically detects the provider from the URL.\n *\n * @param {string} src The iframe src URL.\n * @return {string} The modified URL.\n */\nexport function getBackgroundVideoSrc( src ) {\n\tif ( ! src ) {\n\t\treturn src;\n\t}\n\n\ttry {\n\t\tconst url = new URL( src );\n\n\t\t// Detect provider from the iframe src URL\n\t\tconst provider = detectProviderFromSrc( src );\n\n\t\t// Add provider-specific parameters for background video behavior\n\t\tswitch ( provider ) {\n\t\t\tcase 'youtube':\n\t\t\t\t// YouTube parameters for background video\n\t\t\t\turl.searchParams.set( 'autoplay', '1' );\n\t\t\t\turl.searchParams.set( 'mute', '1' );\n\t\t\t\turl.searchParams.set( 'loop', '1' );\n\t\t\t\turl.searchParams.set( 'controls', '0' );\n\t\t\t\turl.searchParams.set( 'showinfo', '0' );\n\t\t\t\turl.searchParams.set( 'modestbranding', '1' );\n\t\t\t\turl.searchParams.set( 'playsinline', '1' );\n\t\t\t\turl.searchParams.set( 'rel', '0' );\n\t\t\t\t// For loop to work, we need the playlist parameter\n\t\t\t\tconst videoId = url.pathname.split( '/' ).pop();\n\t\t\t\tif ( videoId ) {\n\t\t\t\t\turl.searchParams.set( 'playlist', videoId );\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 'vimeo':\n\t\t\t\t// Vimeo parameters for background video\n\t\t\t\turl.searchParams.set( 'autoplay', '1' );\n\t\t\t\turl.searchParams.set( 'muted', '1' );\n\t\t\t\turl.searchParams.set( 'loop', '1' );\n\t\t\t\turl.searchParams.set( 'background', '1' );\n\t\t\t\turl.searchParams.set( 'controls', '0' );\n\t\t\t\tbreak;\n\n\t\t\tcase 'videopress':\n\t\t\tcase 'wordpress-tv':\n\t\t\t\t// VideoPress parameters\n\t\t\t\turl.searchParams.set( 'autoplay', '1' );\n\t\t\t\turl.searchParams.set( 'loop', '1' );\n\t\t\t\turl.searchParams.set( 'muted', '1' );\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\t// Generic parameters that might work for other providers\n\t\t\t\turl.searchParams.set( 'autoplay', '1' );\n\t\t\t\turl.searchParams.set( 'muted', '1' );\n\t\t\t\turl.searchParams.set( 'loop', '1' );\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn url.toString();\n\t} catch ( error ) {\n\t\t// If URL parsing fails, return original src\n\t\treturn src;\n\t}\n}\n"],
5
- "mappings": ";AAGA,SAAS,0BAA0B;AAKnC,SAAS,uBAAuB;AAEhC,IAAM,sBAAsB;AAG5B,IAAM,kBAAkB;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAQO,SAAS,qBAAsB,KAAM;AAC3C,MAAK,CAAE,KAAM;AACZ,WAAO;AAAA,EACR;AAEA,QAAM,aAAa,uBAAwB,GAAI;AAC/C,SAAO,eAAe;AACvB;AAQO,SAAS,sBAAuB,KAAM;AAC5C,QAAM,aAAa,uBAAwB,GAAI;AAC/C,SAAO,aAAa,WAAW,OAAO;AACvC;AAQA,SAAS,uBAAwB,KAAM;AACtC,QAAM,kBAAkB,mBAAoB,mBAAoB;AAEhE,MAAK,CAAE,iBAAkB;AACxB,WAAO;AAAA,EACR;AAEA,QAAM,oBAAoB,gBAAgB;AAAA,IAAM,CAAE,EAAE,SAAS,MAC5D,gBAAiB,KAAK,QAAS;AAAA,EAChC;AAEA,MACC,CAAE,qBACF,CAAE,gBAAgB,SAAU,kBAAkB,IAAK,GAClD;AACD,WAAO;AAAA,EACR;AAEA,SAAO;AACR;A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YAAY,OAAQ;AAAA,QAC3C;AACA;AAAA,MAED,KAAK;AAEJ,YAAI,aAAa,IAAK,YAAY,GAAI;AACtC,YAAI,aAAa,IAAK,SAAS,GAAI;AACnC,YAAI,aAAa,IAAK,QAAQ,GAAI;AAClC,YAAI,aAAa,IAAK,cAAc,GAAI;AACxC,YAAI,aAAa,IAAK,YAAY,GAAI;AACtC;AAAA,MAED,KAAK;AAAA,MACL,KAAK;AAEJ,YAAI,aAAa,IAAK,YAAY,GAAI;AACtC,YAAI,aAAa,IAAK,QAAQ,GAAI;AAClC,YAAI,aAAa,IAAK,SAAS,GAAI;AACnC;AAAA,MAED;AAEC,YAAI,aAAa,IAAK,YAAY,GAAI;AACtC,YAAI,aAAa,IAAK,SAAS,GAAI;AACnC,YAAI,aAAa,IAAK,QAAQ,GAAI;AAClC;AAAA,IACF;AAEA,WAAO,IAAI,SAAS;AAAA,EACrB,SAAU,OAAQ;AAEjB,WAAO;AAAA,EACR;AACD;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { getBlockVariations } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { matchesPatterns } from '../embed/util';\n\nconst DEFAULT_EMBED_BLOCK = 'core/embed';\n\n// List of supported video providers for cover block backgrounds\nconst VIDEO_PROVIDERS = [\n\t'youtube',\n\t'vimeo',\n\t'videopress',\n\t'animoto',\n\t'tiktok',\n\t'wordpress-tv',\n];\n\n/**\n * Checks if a URL is a valid video embed URL from supported providers.\n *\n * @param {string} url The URL to validate.\n * @return {boolean} True if the URL matches a supported video provider pattern.\n */\nexport function isValidVideoEmbedUrl( url ) {\n\tif ( ! url ) {\n\t\treturn false;\n\t}\n\n\tconst embedBlock = findVideoEmbedProvider( url );\n\treturn embedBlock !== null;\n}\n\n/**\n * Finds the embed provider for a given URL if it's a supported video provider.\n *\n * @param {string} url The URL to check.\n * @return {string|null} The provider name slug (e.g., 'youtube') or null if not found.\n */\nexport function getVideoEmbedProvider( url ) {\n\tconst embedBlock = findVideoEmbedProvider( url );\n\treturn embedBlock ? embedBlock.name : null;\n}\n\n/**\n * Finds a matching video embed block variation for the given URL.\n *\n * @param {string} url The URL to match against provider patterns.\n * @return {Object|null} The matching block variation or null if not found.\n */\nfunction findVideoEmbedProvider( url ) {\n\tconst embedVariations = getBlockVariations( DEFAULT_EMBED_BLOCK );\n\n\tif ( ! embedVariations ) {\n\t\treturn null;\n\t}\n\n\tconst matchingVariation = embedVariations.find( ( { patterns } ) =>\n\t\tmatchesPatterns( url, patterns )\n\t);\n\n\tif (\n\t\t! matchingVariation ||\n\t\t! VIDEO_PROVIDERS.includes( matchingVariation.name )\n\t) {\n\t\treturn null;\n\t}\n\n\treturn matchingVariation;\n}\n\n/**\n * Modifies embed HTML to use background video parameters.\n *\n * @param {string} html The original embed HTML.\n * @return {string|null} The modified embed HTML, or null if not possible.\n */\nexport function getBackgroundEmbedHtml( html ) {\n\tconst srcMatch = html?.match( /src=[\"']([^\"']+)[\"']/ );\n\tif ( ! srcMatch ) {\n\t\treturn null;\n\t}\n\n\tconst iframeSrc = srcMatch[ 1 ];\n\tconst backgroundSrc = getBackgroundVideoSrc( iframeSrc );\n\treturn html.replace( iframeSrc, backgroundSrc );\n}\n\n/**\n * Detects the video provider from an iframe src URL.\n *\n * @param {string} src The iframe src URL.\n * @return {string|null} The provider name slug or null if not recognized.\n */\nexport function detectProviderFromSrc( src ) {\n\tif ( ! src ) {\n\t\treturn null;\n\t}\n\n\tconst lowerSrc = src.toLowerCase();\n\n\tif (\n\t\tlowerSrc.includes( 'youtube.com' ) ||\n\t\tlowerSrc.includes( 'youtu.be' )\n\t) {\n\t\treturn 'youtube';\n\t}\n\tif ( lowerSrc.includes( 'vimeo.com' ) ) {\n\t\treturn 'vimeo';\n\t}\n\tif ( lowerSrc.includes( 'videopress.com' ) ) {\n\t\treturn 'videopress';\n\t}\n\tif ( lowerSrc.includes( 'animoto.com' ) ) {\n\t\treturn 'animoto';\n\t}\n\tif ( lowerSrc.includes( 'tiktok.com' ) ) {\n\t\treturn 'tiktok';\n\t}\n\tif ( lowerSrc.includes( 'wordpress.tv' ) ) {\n\t\treturn 'wordpress-tv';\n\t}\n\n\treturn null;\n}\n\n/**\n * Modifies an iframe src URL to add background video parameters.\n * Automatically detects the provider from the URL.\n *\n * @param {string} src The iframe src URL.\n * @return {string} The modified URL.\n */\nexport function getBackgroundVideoSrc( src ) {\n\tif ( ! src ) {\n\t\treturn src;\n\t}\n\n\ttry {\n\t\tconst url = new URL( src );\n\n\t\t// Detect provider from the iframe src URL\n\t\tconst provider = detectProviderFromSrc( src );\n\n\t\t// Add provider-specific parameters for background video behavior\n\t\tswitch ( provider ) {\n\t\t\tcase 'youtube':\n\t\t\t\t// YouTube parameters for background video\n\t\t\t\turl.searchParams.set( 'autoplay', '1' );\n\t\t\t\turl.searchParams.set( 'mute', '1' );\n\t\t\t\turl.searchParams.set( 'loop', '1' );\n\t\t\t\turl.searchParams.set( 'controls', '0' );\n\t\t\t\turl.searchParams.set( 'showinfo', '0' );\n\t\t\t\turl.searchParams.set( 'modestbranding', '1' );\n\t\t\t\turl.searchParams.set( 'playsinline', '1' );\n\t\t\t\turl.searchParams.set( 'rel', '0' );\n\t\t\t\t// For loop to work, we need the playlist parameter\n\t\t\t\tconst videoId = url.pathname.split( '/' ).pop();\n\t\t\t\tif ( videoId ) {\n\t\t\t\t\turl.searchParams.set( 'playlist', videoId );\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 'vimeo':\n\t\t\t\t// Vimeo parameters for background video\n\t\t\t\turl.searchParams.set( 'autoplay', '1' );\n\t\t\t\turl.searchParams.set( 'muted', '1' );\n\t\t\t\turl.searchParams.set( 'loop', '1' );\n\t\t\t\turl.searchParams.set( 'background', '1' );\n\t\t\t\turl.searchParams.set( 'controls', '0' );\n\t\t\t\tbreak;\n\n\t\t\tcase 'videopress':\n\t\t\tcase 'wordpress-tv':\n\t\t\t\t// VideoPress parameters\n\t\t\t\turl.searchParams.set( 'autoplay', '1' );\n\t\t\t\turl.searchParams.set( 'loop', '1' );\n\t\t\t\turl.searchParams.set( 'muted', '1' );\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\t// Generic parameters that might work for other providers\n\t\t\t\turl.searchParams.set( 'autoplay', '1' );\n\t\t\t\turl.searchParams.set( 'muted', '1' );\n\t\t\t\turl.searchParams.set( 'loop', '1' );\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn url.toString();\n\t} catch {\n\t\t// If URL parsing fails, return original src\n\t\treturn src;\n\t}\n}\n"],
5
+ "mappings": ";AAGA,SAAS,0BAA0B;AAKnC,SAAS,uBAAuB;AAEhC,IAAM,sBAAsB;AAG5B,IAAM,kBAAkB;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAQO,SAAS,qBAAsB,KAAM;AAC3C,MAAK,CAAE,KAAM;AACZ,WAAO;AAAA,EACR;AAEA,QAAM,aAAa,uBAAwB,GAAI;AAC/C,SAAO,eAAe;AACvB;AAQO,SAAS,sBAAuB,KAAM;AAC5C,QAAM,aAAa,uBAAwB,GAAI;AAC/C,SAAO,aAAa,WAAW,OAAO;AACvC;AAQA,SAAS,uBAAwB,KAAM;AACtC,QAAM,kBAAkB,mBAAoB,mBAAoB;AAEhE,MAAK,CAAE,iBAAkB;AACxB,WAAO;AAAA,EACR;AAEA,QAAM,oBAAoB,gBAAgB;AAAA,IAAM,CAAE,EAAE,SAAS,MAC5D,gBAAiB,KAAK,QAAS;AAAA,EAChC;AAEA,MACC,CAAE,qBACF,CAAE,gBAAgB,SAAU,kBAAkB,IAAK,GAClD;AACD,WAAO;AAAA,EACR;AAEA,SAAO;AACR;AAQO,SAAS,uBAAwB,MAAO;AAC9C,QAAM,WAAW,MAAM,MAAO,sBAAuB;AACrD,MAAK,CAAE,UAAW;AACjB,WAAO;AAAA,EACR;AAEA,QAAM,YAAY,SAAU,CAAE;AAC9B,QAAM,gBAAgB,sBAAuB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AAa,IAAK,SAAS,GAAI;AACnC,YAAI,aAAa,IAAK,QAAQ,GAAI;AAClC,YAAI,aAAa,IAAK,cAAc,GAAI;AACxC,YAAI,aAAa,IAAK,YAAY,GAAI;AACtC;AAAA,MAED,KAAK;AAAA,MACL,KAAK;AAEJ,YAAI,aAAa,IAAK,YAAY,GAAI;AACtC,YAAI,aAAa,IAAK,QAAQ,GAAI;AAClC,YAAI,aAAa,IAAK,SAAS,GAAI;AACnC;AAAA,MAED;AAEC,YAAI,aAAa,IAAK,YAAY,GAAI;AACtC,YAAI,aAAa,IAAK,SAAS,GAAI;AACnC,YAAI,aAAa,IAAK,QAAQ,GAAI;AAClC;AAAA,IACF;AAEA,WAAO,IAAI,SAAS;AAAA,EACrB,QAAQ;AAEP,WAAO;AAAA,EACR;AACD;",
6
6
  "names": []
7
7
  }
@@ -21,7 +21,7 @@ var createActiveXObject = (type) => {
21
21
  let ax;
22
22
  try {
23
23
  ax = new window.ActiveXObject(type);
24
- } catch (e) {
24
+ } catch {
25
25
  ax = void 0;
26
26
  }
27
27
  return ax;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/file/utils/index.js"],
4
- "sourcesContent": ["/**\n * Uses a combination of user agent matching and feature detection to determine whether\n * the current browser supports rendering PDFs inline.\n *\n * @return {boolean} Whether or not the browser supports inline PDFs.\n */\nexport const browserSupportsPdfs = () => {\n\t// Use native feature detection if available.\n\tif ( window.navigator.pdfViewerEnabled ) {\n\t\treturn true;\n\t}\n\n\t// Most mobile devices include \"Mobi\" in their UA.\n\tif ( window.navigator.userAgent.indexOf( 'Mobi' ) > -1 ) {\n\t\treturn false;\n\t}\n\n\t// Android tablets are the notable exception.\n\tif ( window.navigator.userAgent.indexOf( 'Android' ) > -1 ) {\n\t\treturn false;\n\t}\n\n\t// iPad pretends to be a Mac.\n\tif (\n\t\twindow.navigator.userAgent.indexOf( 'Macintosh' ) > -1 &&\n\t\twindow.navigator.maxTouchPoints &&\n\t\twindow.navigator.maxTouchPoints > 2\n\t) {\n\t\treturn false;\n\t}\n\n\t// IE only supports PDFs when there's an ActiveX object available for it.\n\tif (\n\t\t!! ( window.ActiveXObject || 'ActiveXObject' in window ) &&\n\t\t! (\n\t\t\tcreateActiveXObject( 'AcroPDF.PDF' ) ||\n\t\t\tcreateActiveXObject( 'PDF.PdfCtrl' )\n\t\t)\n\t) {\n\t\treturn false;\n\t}\n\n\treturn true;\n};\n\n/**\n * Helper function for creating ActiveX objects, catching any errors that are thrown\n * when it's generated.\n *\n * @param {string} type The name of the ActiveX object to create.\n * @return {window.ActiveXObject|undefined} The generated ActiveXObject, or null if it failed.\n */\nconst createActiveXObject = ( type ) => {\n\tlet ax;\n\ttry {\n\t\tax = new window.ActiveXObject( type );\n\t} catch ( e ) {\n\t\tax = undefined;\n\t}\n\treturn ax;\n};\n"],
5
- "mappings": ";AAMO,IAAM,sBAAsB,MAAM;AAExC,MAAK,OAAO,UAAU,kBAAmB;AACxC,WAAO;AAAA,EACR;AAGA,MAAK,OAAO,UAAU,UAAU,QAAS,MAAO,IAAI,IAAK;AACxD,WAAO;AAAA,EACR;AAGA,MAAK,OAAO,UAAU,UAAU,QAAS,SAAU,IAAI,IAAK;AAC3D,WAAO;AAAA,EACR;AAGA,MACC,OAAO,UAAU,UAAU,QAAS,WAAY,IAAI,MACpD,OAAO,UAAU,kBACjB,OAAO,UAAU,iBAAiB,GACjC;AACD,WAAO;AAAA,EACR;AAGA,MACC,CAAC,EAAI,OAAO,iBAAiB,mBAAmB,WAChD,EACC,oBAAqB,aAAc,KACnC,oBAAqB,aAAc,IAEnC;AACD,WAAO;AAAA,EACR;AAEA,SAAO;AACR;AASA,IAAM,sBAAsB,CAAE,SAAU;AACvC,MAAI;AACJ,MAAI;AACH,SAAK,IAAI,OAAO,cAAe,IAAK;AAAA,EACrC,SAAU,GAAI;AACb,SAAK;AAAA,EACN;AACA,SAAO;AACR;",
4
+ "sourcesContent": ["/**\n * Uses a combination of user agent matching and feature detection to determine whether\n * the current browser supports rendering PDFs inline.\n *\n * @return {boolean} Whether or not the browser supports inline PDFs.\n */\nexport const browserSupportsPdfs = () => {\n\t// Use native feature detection if available.\n\tif ( window.navigator.pdfViewerEnabled ) {\n\t\treturn true;\n\t}\n\n\t// Most mobile devices include \"Mobi\" in their UA.\n\tif ( window.navigator.userAgent.indexOf( 'Mobi' ) > -1 ) {\n\t\treturn false;\n\t}\n\n\t// Android tablets are the notable exception.\n\tif ( window.navigator.userAgent.indexOf( 'Android' ) > -1 ) {\n\t\treturn false;\n\t}\n\n\t// iPad pretends to be a Mac.\n\tif (\n\t\twindow.navigator.userAgent.indexOf( 'Macintosh' ) > -1 &&\n\t\twindow.navigator.maxTouchPoints &&\n\t\twindow.navigator.maxTouchPoints > 2\n\t) {\n\t\treturn false;\n\t}\n\n\t// IE only supports PDFs when there's an ActiveX object available for it.\n\tif (\n\t\t!! ( window.ActiveXObject || 'ActiveXObject' in window ) &&\n\t\t! (\n\t\t\tcreateActiveXObject( 'AcroPDF.PDF' ) ||\n\t\t\tcreateActiveXObject( 'PDF.PdfCtrl' )\n\t\t)\n\t) {\n\t\treturn false;\n\t}\n\n\treturn true;\n};\n\n/**\n * Helper function for creating ActiveX objects, catching any errors that are thrown\n * when it's generated.\n *\n * @param {string} type The name of the ActiveX object to create.\n * @return {window.ActiveXObject|undefined} The generated ActiveXObject, or null if it failed.\n */\nconst createActiveXObject = ( type ) => {\n\tlet ax;\n\ttry {\n\t\tax = new window.ActiveXObject( type );\n\t} catch {\n\t\tax = undefined;\n\t}\n\treturn ax;\n};\n"],
5
+ "mappings": ";AAMO,IAAM,sBAAsB,MAAM;AAExC,MAAK,OAAO,UAAU,kBAAmB;AACxC,WAAO;AAAA,EACR;AAGA,MAAK,OAAO,UAAU,UAAU,QAAS,MAAO,IAAI,IAAK;AACxD,WAAO;AAAA,EACR;AAGA,MAAK,OAAO,UAAU,UAAU,QAAS,SAAU,IAAI,IAAK;AAC3D,WAAO;AAAA,EACR;AAGA,MACC,OAAO,UAAU,UAAU,QAAS,WAAY,IAAI,MACpD,OAAO,UAAU,kBACjB,OAAO,UAAU,iBAAiB,GACjC;AACD,WAAO;AAAA,EACR;AAGA,MACC,CAAC,EAAI,OAAO,iBAAiB,mBAAmB,WAChD,EACC,oBAAqB,aAAc,KACnC,oBAAqB,aAAc,IAEnC;AACD,WAAO;AAAA,EACR;AAEA,SAAO;AACR;AASA,IAAM,sBAAsB,CAAE,SAAU;AACvC,MAAI;AACJ,MAAI;AACH,SAAK,IAAI,OAAO,cAAe,IAAK;AAAA,EACrC,QAAQ;AACP,SAAK;AAAA,EACN;AACA,SAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -38,7 +38,7 @@ document.querySelectorAll("form.wp-block-form").forEach(function(form) {
38
38
  } else {
39
39
  redirectNotification("error");
40
40
  }
41
- } catch (error) {
41
+ } catch {
42
42
  redirectNotification("error");
43
43
  }
44
44
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/form/view.js"],
4
- "sourcesContent": ["let formSettings;\ntry {\n\tformSettings = JSON.parse(\n\t\tdocument.getElementById(\n\t\t\t'wp-script-module-data-@wordpress/block-library/form/view'\n\t\t)?.textContent\n\t);\n} catch {}\n\ndocument.querySelectorAll( 'form.wp-block-form' ).forEach( function ( form ) {\n\t// Bail If the form settings not provided or the form is not using the mailto: action.\n\tif (\n\t\t! formSettings ||\n\t\t! form.action ||\n\t\t! form.action.startsWith( 'mailto:' )\n\t) {\n\t\treturn;\n\t}\n\n\tconst redirectNotification = ( status ) => {\n\t\tconst urlParams = new URLSearchParams( window.location.search );\n\t\turlParams.append( 'wp-form-result', status );\n\t\twindow.location.search = urlParams.toString();\n\t};\n\n\t// Add an event listener for the form submission.\n\tform.addEventListener( 'submit', async function ( event ) {\n\t\tevent.preventDefault();\n\t\t// Get the form data and merge it with the form action and nonce.\n\t\tconst formData = Object.fromEntries( new FormData( form ).entries() );\n\t\tformData.formAction = form.action;\n\t\tformData._ajax_nonce = formSettings.nonce;\n\t\tformData.action = formSettings.action;\n\t\tformData._wp_http_referer = window.location.href;\n\t\tformData.formAction = form.action;\n\n\t\ttry {\n\t\t\tconst response = await fetch( formSettings.ajaxUrl, {\n\t\t\t\tmethod: 'POST',\n\t\t\t\theaders: {\n\t\t\t\t\t'Content-Type': 'application/x-www-form-urlencoded',\n\t\t\t\t},\n\t\t\t\tbody: new URLSearchParams( formData ).toString(),\n\t\t\t} );\n\t\t\tif ( response.ok ) {\n\t\t\t\tredirectNotification( 'success' );\n\t\t\t} else {\n\t\t\t\tredirectNotification( 'error' );\n\t\t\t}\n\t\t} catch ( error ) {\n\t\t\tredirectNotification( 'error' );\n\t\t}\n\t} );\n} );\n"],
5
- "mappings": ";AAAA,IAAI;AACJ,IAAI;AACH,iBAAe,KAAK;AAAA,IACnB,SAAS;AAAA,MACR;AAAA,IACD,GAAG;AAAA,EACJ;AACD,QAAQ;AAAC;AAET,SAAS,iBAAkB,oBAAqB,EAAE,QAAS,SAAW,MAAO;AAE5E,MACC,CAAE,gBACF,CAAE,KAAK,UACP,CAAE,KAAK,OAAO,WAAY,SAAU,GACnC;AACD;AAAA,EACD;AAEA,QAAM,uBAAuB,CAAE,WAAY;AAC1C,UAAM,YAAY,IAAI,gBAAiB,OAAO,SAAS,MAAO;AAC9D,cAAU,OAAQ,kBAAkB,MAAO;AAC3C,WAAO,SAAS,SAAS,UAAU,SAAS;AAAA,EAC7C;AAGA,OAAK,iBAAkB,UAAU,eAAiB,OAAQ;AACzD,UAAM,eAAe;AAErB,UAAM,WAAW,OAAO,YAAa,IAAI,SAAU,IAAK,EAAE,QAAQ,CAAE;AACpE,aAAS,aAAa,KAAK;AAC3B,aAAS,cAAc,aAAa;AACpC,aAAS,SAAS,aAAa;AAC/B,aAAS,mBAAmB,OAAO,SAAS;AAC5C,aAAS,aAAa,KAAK;AAE3B,QAAI;AACH,YAAM,WAAW,MAAM,MAAO,aAAa,SAAS;AAAA,QACnD,QAAQ;AAAA,QACR,SAAS;AAAA,UACR,gBAAgB;AAAA,QACjB;AAAA,QACA,MAAM,IAAI,gBAAiB,QAAS,EAAE,SAAS;AAAA,MAChD,CAAE;AACF,UAAK,SAAS,IAAK;AAClB,6BAAsB,SAAU;AAAA,MACjC,OAAO;AACN,6BAAsB,OAAQ;AAAA,MAC/B;AAAA,IACD,SAAU,OAAQ;AACjB,2BAAsB,OAAQ;AAAA,IAC/B;AAAA,EACD,CAAE;AACH,CAAE;",
4
+ "sourcesContent": ["let formSettings;\ntry {\n\tformSettings = JSON.parse(\n\t\tdocument.getElementById(\n\t\t\t'wp-script-module-data-@wordpress/block-library/form/view'\n\t\t)?.textContent\n\t);\n} catch {}\n\ndocument.querySelectorAll( 'form.wp-block-form' ).forEach( function ( form ) {\n\t// Bail If the form settings not provided or the form is not using the mailto: action.\n\tif (\n\t\t! formSettings ||\n\t\t! form.action ||\n\t\t! form.action.startsWith( 'mailto:' )\n\t) {\n\t\treturn;\n\t}\n\n\tconst redirectNotification = ( status ) => {\n\t\tconst urlParams = new URLSearchParams( window.location.search );\n\t\turlParams.append( 'wp-form-result', status );\n\t\twindow.location.search = urlParams.toString();\n\t};\n\n\t// Add an event listener for the form submission.\n\tform.addEventListener( 'submit', async function ( event ) {\n\t\tevent.preventDefault();\n\t\t// Get the form data and merge it with the form action and nonce.\n\t\tconst formData = Object.fromEntries( new FormData( form ).entries() );\n\t\tformData.formAction = form.action;\n\t\tformData._ajax_nonce = formSettings.nonce;\n\t\tformData.action = formSettings.action;\n\t\tformData._wp_http_referer = window.location.href;\n\t\tformData.formAction = form.action;\n\n\t\ttry {\n\t\t\tconst response = await fetch( formSettings.ajaxUrl, {\n\t\t\t\tmethod: 'POST',\n\t\t\t\theaders: {\n\t\t\t\t\t'Content-Type': 'application/x-www-form-urlencoded',\n\t\t\t\t},\n\t\t\t\tbody: new URLSearchParams( formData ).toString(),\n\t\t\t} );\n\t\t\tif ( response.ok ) {\n\t\t\t\tredirectNotification( 'success' );\n\t\t\t} else {\n\t\t\t\tredirectNotification( 'error' );\n\t\t\t}\n\t\t} catch {\n\t\t\tredirectNotification( 'error' );\n\t\t}\n\t} );\n} );\n"],
5
+ "mappings": ";AAAA,IAAI;AACJ,IAAI;AACH,iBAAe,KAAK;AAAA,IACnB,SAAS;AAAA,MACR;AAAA,IACD,GAAG;AAAA,EACJ;AACD,QAAQ;AAAC;AAET,SAAS,iBAAkB,oBAAqB,EAAE,QAAS,SAAW,MAAO;AAE5E,MACC,CAAE,gBACF,CAAE,KAAK,UACP,CAAE,KAAK,OAAO,WAAY,SAAU,GACnC;AACD;AAAA,EACD;AAEA,QAAM,uBAAuB,CAAE,WAAY;AAC1C,UAAM,YAAY,IAAI,gBAAiB,OAAO,SAAS,MAAO;AAC9D,cAAU,OAAQ,kBAAkB,MAAO;AAC3C,WAAO,SAAS,SAAS,UAAU,SAAS;AAAA,EAC7C;AAGA,OAAK,iBAAkB,UAAU,eAAiB,OAAQ;AACzD,UAAM,eAAe;AAErB,UAAM,WAAW,OAAO,YAAa,IAAI,SAAU,IAAK,EAAE,QAAQ,CAAE;AACpE,aAAS,aAAa,KAAK;AAC3B,aAAS,cAAc,aAAa;AACpC,aAAS,SAAS,aAAa;AAC/B,aAAS,mBAAmB,OAAO,SAAS;AAC5C,aAAS,aAAa,KAAK;AAE3B,QAAI;AACH,YAAM,WAAW,MAAM,MAAO,aAAa,SAAS;AAAA,QACnD,QAAQ;AAAA,QACR,SAAS;AAAA,UACR,gBAAgB;AAAA,QACjB;AAAA,QACA,MAAM,IAAI,gBAAiB,QAAS,EAAE,SAAS;AAAA,MAChD,CAAE;AACF,UAAK,SAAS,IAAK;AAClB,6BAAsB,SAAU;AAAA,MACjC,OAAO;AACN,6BAAsB,OAAQ;AAAA,MAC/B;AAAA,IACD,QAAQ;AACP,2BAAsB,OAAQ;AAAA,IAC/B;AAAA,EACD,CAAE;AACH,CAAE;",
6
6
  "names": []
7
7
  }
@@ -64,9 +64,7 @@ function Edit({ attributes, setAttributes }) {
64
64
  const { getEntityRecord, getEntityRecords } = select(coreDataStore);
65
65
  return {
66
66
  selectedIcon: icon ? getEntityRecord("root", "icon", icon) : null,
67
- allIcons: isInserterOpen ? getEntityRecords("root", "icon", {
68
- per_page: -1
69
- }) : void 0
67
+ allIcons: isInserterOpen ? getEntityRecords("root", "icon") : void 0
70
68
  };
71
69
  },
72
70
  [isInserterOpen, icon]
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/icon/edit.js"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tDropdownMenu,\n\tTextControl,\n\tToolbarButton,\n\tToolbarGroup,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\tuseBlockEditingMode,\n\t__experimentalUseColorProps as useColorProps,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalGetSpacingClassesAndStyles as useSpacingProps,\n\tgetDimensionsClassesAndStyles as useDimensionsProps,\n} from '@wordpress/block-editor';\nimport { useState } from '@wordpress/element';\nimport { SVG, Rect, Path } from '@wordpress/primitives';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\nimport HtmlRenderer from '../utils/html-renderer';\nimport { CustomInserterModal } from './components';\n\nconst IconPlaceholder = ( { className, style } ) => (\n\t<SVG\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\tviewBox=\"0 0 60 60\"\n\t\tpreserveAspectRatio=\"none\"\n\t\tfill=\"none\"\n\t\taria-hidden=\"true\"\n\t\tclassName={ clsx( 'wp-block-icon__placeholder', className ) }\n\t\tstyle={ style }\n\t>\n\t\t<Rect width=\"60\" height=\"60\" fill=\"currentColor\" fillOpacity={ 0.1 } />\n\t\t<Path\n\t\t\tvectorEffect=\"non-scaling-stroke\"\n\t\t\tstroke=\"currentColor\"\n\t\t\tstrokeOpacity={ 0.25 }\n\t\t\td=\"M60 60 0 0\"\n\t\t/>\n\t</SVG>\n);\n\nexport function Edit( { attributes, setAttributes } ) {\n\tconst { icon, ariaLabel } = attributes;\n\n\tconst [ isInserterOpen, setInserterOpen ] = useState( false );\n\n\tconst isContentOnlyMode = useBlockEditingMode() === 'contentOnly';\n\n\tconst colorProps = useColorProps( attributes );\n\tconst spacingProps = useSpacingProps( attributes );\n\tconst borderProps = useBorderProps( attributes );\n\tconst dimensionsProps = useDimensionsProps( attributes );\n\n\tconst { selectedIcon, allIcons = [] } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, getEntityRecords } =\n\t\t\t\tselect( coreDataStore );\n\t\t\treturn {\n\t\t\t\tselectedIcon: icon\n\t\t\t\t\t? getEntityRecord( 'root', 'icon', icon )\n\t\t\t\t\t: null,\n\t\t\t\tallIcons: isInserterOpen\n\t\t\t\t\t? getEntityRecords( 'root', 'icon', {\n\t\t\t\t\t\t\tper_page: -1,\n\t\t\t\t\t } )\n\t\t\t\t\t: undefined,\n\t\t\t};\n\t\t},\n\t\t[ isInserterOpen, icon ]\n\t);\n\n\tconst iconToDisplay = selectedIcon?.content || '';\n\n\tconst blockControls = (\n\t\t<>\n\t\t\t<BlockControls group={ isContentOnlyMode ? 'inline' : 'other' }>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tsetInserterOpen( true );\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ icon ? __( 'Replace' ) : __( 'Choose icon' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t</BlockControls>\n\t\t\t{ isContentOnlyMode && icon && (\n\t\t\t\t// Add some extra controls for content attributes when content only mode is active.\n\t\t\t\t// With content only mode active, the inspector is hidden, so users need another way\n\t\t\t\t// to edit these attributes.\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<ToolbarGroup className=\"components-toolbar-group\">\n\t\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\t\ticon=\"\"\n\t\t\t\t\t\t\tpopoverProps={ {\n\t\t\t\t\t\t\t\tclassName: 'is-alternate',\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\ttext={ __( 'Label' ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ () => (\n\t\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t\tclassName=\"wp-block-icon__toolbar-content\"\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Label' ) }\n\t\t\t\t\t\t\t\t\tvalue={ ariaLabel || '' }\n\t\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( { ariaLabel: value } )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t\t'Briefly describe the icon to help screen reader users. Leave blank for decorative icons.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</DropdownMenu>\n\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t</>\n\t);\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst inspectorControls = icon && (\n\t\t<>\n\t\t\t<InspectorControls group=\"settings\">\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tariaLabel: undefined,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Label' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! ariaLabel }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { ariaLabel: undefined } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\tlabel={ __( 'Label' ) }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Briefly describe the icon to help screen reader users. Leave blank for decorative icons.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tvalue={ ariaLabel || '' }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { ariaLabel: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ blockControls }\n\t\t\t{ inspectorControls }\n\t\t\t<div { ...useBlockProps() }>\n\t\t\t\t{ icon ? (\n\t\t\t\t\t<HtmlRenderer\n\t\t\t\t\t\thtml={ iconToDisplay }\n\t\t\t\t\t\twrapperProps={ {\n\t\t\t\t\t\t\tclassName: clsx(\n\t\t\t\t\t\t\t\tcolorProps.className,\n\t\t\t\t\t\t\t\tborderProps.className,\n\t\t\t\t\t\t\t\tspacingProps.className,\n\t\t\t\t\t\t\t\tdimensionsProps.className\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t...colorProps.style,\n\t\t\t\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t\t\t\t...spacingProps.style,\n\t\t\t\t\t\t\t\t...dimensionsProps.style,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<IconPlaceholder\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\tborderProps.className,\n\t\t\t\t\t\t\tspacingProps.className,\n\t\t\t\t\t\t\tdimensionsProps.className\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t\t\t...spacingProps.style,\n\t\t\t\t\t\t\t...dimensionsProps.style,\n\t\t\t\t\t\t\theight: 'auto',\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t{ isInserterOpen && (\n\t\t\t\t<CustomInserterModal\n\t\t\t\t\ticons={ allIcons }\n\t\t\t\t\tsetInserterOpen={ setInserterOpen }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default Edit;\n"],
5
- "mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,UAAU;AACnB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,4BAA4B;AAAA,EAC5B,gCAAgC;AAAA,OAC1B;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,+BAA+B;AAAA,EAC/B,gCAAgC;AAAA,EAChC,4CAA4C;AAAA,EAC5C,iCAAiC;AAAA,OAC3B;AACP,SAAS,gBAAgB;AACzB,SAAS,KAAK,MAAM,YAAY;AAChC,SAAS,iBAAiB;AAC1B,SAAS,SAAS,qBAAqB;AAKvC,SAAS,sCAAsC;AAC/C,OAAO,kBAAkB;AACzB,SAAS,2BAA2B;AAGnC,SAoDC,UA3CA,KATD;AADD,IAAM,kBAAkB,CAAE,EAAE,WAAW,MAAM,MAC5C;AAAA,EAAC;AAAA;AAAA,IACA,OAAM;AAAA,IACN,SAAQ;AAAA,IACR,qBA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AAO;AAAA,QACP,cAAe;AAAA,UACd,WAAW;AAAA,YACV,WAAW;AAAA,YACX,YAAY;AAAA,YACZ,aAAa;AAAA,YACb,gBAAgB;AAAA,UACjB;AAAA,UACA,OAAO;AAAA,YACN,GAAG,WAAW;AAAA,YACd,GAAG,YAAY;AAAA,YACf,GAAG,aAAa;AAAA,YAChB,GAAG,gBAAgB;AAAA,UACpB;AAAA,QACD;AAAA;AAAA,IACD,IAEA;AAAA,MAAC;AAAA;AAAA,QACA,WAAY;AAAA,UACX,YAAY;AAAA,UACZ,aAAa;AAAA,UACb,gBAAgB;AAAA,QACjB;AAAA,QACA,OAAQ;AAAA,UACP,GAAG,YAAY;AAAA,UACf,GAAG,aAAa;AAAA,UAChB,GAAG,gBAAgB;AAAA,UACnB,QAAQ;AAAA,QACT;AAAA;AAAA,IACD,GAEF;AAAA,IACE,kBACD;AAAA,MAAC;AAAA;AAAA,QACA,OAAQ;AAAA,QACR;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACD;AAAA,KAEF;AAEF;AAEA,IAAO,eAAQ;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tDropdownMenu,\n\tTextControl,\n\tToolbarButton,\n\tToolbarGroup,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\tuseBlockEditingMode,\n\t__experimentalUseColorProps as useColorProps,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalGetSpacingClassesAndStyles as useSpacingProps,\n\tgetDimensionsClassesAndStyles as useDimensionsProps,\n} from '@wordpress/block-editor';\nimport { useState } from '@wordpress/element';\nimport { SVG, Rect, Path } from '@wordpress/primitives';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\nimport HtmlRenderer from '../utils/html-renderer';\nimport { CustomInserterModal } from './components';\n\nconst IconPlaceholder = ( { className, style } ) => (\n\t<SVG\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\tviewBox=\"0 0 60 60\"\n\t\tpreserveAspectRatio=\"none\"\n\t\tfill=\"none\"\n\t\taria-hidden=\"true\"\n\t\tclassName={ clsx( 'wp-block-icon__placeholder', className ) }\n\t\tstyle={ style }\n\t>\n\t\t<Rect width=\"60\" height=\"60\" fill=\"currentColor\" fillOpacity={ 0.1 } />\n\t\t<Path\n\t\t\tvectorEffect=\"non-scaling-stroke\"\n\t\t\tstroke=\"currentColor\"\n\t\t\tstrokeOpacity={ 0.25 }\n\t\t\td=\"M60 60 0 0\"\n\t\t/>\n\t</SVG>\n);\n\nexport function Edit( { attributes, setAttributes } ) {\n\tconst { icon, ariaLabel } = attributes;\n\n\tconst [ isInserterOpen, setInserterOpen ] = useState( false );\n\n\tconst isContentOnlyMode = useBlockEditingMode() === 'contentOnly';\n\n\tconst colorProps = useColorProps( attributes );\n\tconst spacingProps = useSpacingProps( attributes );\n\tconst borderProps = useBorderProps( attributes );\n\tconst dimensionsProps = useDimensionsProps( attributes );\n\n\tconst { selectedIcon, allIcons = [] } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, getEntityRecords } =\n\t\t\t\tselect( coreDataStore );\n\t\t\treturn {\n\t\t\t\tselectedIcon: icon\n\t\t\t\t\t? getEntityRecord( 'root', 'icon', icon )\n\t\t\t\t\t: null,\n\t\t\t\tallIcons: isInserterOpen\n\t\t\t\t\t? getEntityRecords( 'root', 'icon' )\n\t\t\t\t\t: undefined,\n\t\t\t};\n\t\t},\n\t\t[ isInserterOpen, icon ]\n\t);\n\n\tconst iconToDisplay = selectedIcon?.content || '';\n\n\tconst blockControls = (\n\t\t<>\n\t\t\t<BlockControls group={ isContentOnlyMode ? 'inline' : 'other' }>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tsetInserterOpen( true );\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ icon ? __( 'Replace' ) : __( 'Choose icon' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t</BlockControls>\n\t\t\t{ isContentOnlyMode && icon && (\n\t\t\t\t// Add some extra controls for content attributes when content only mode is active.\n\t\t\t\t// With content only mode active, the inspector is hidden, so users need another way\n\t\t\t\t// to edit these attributes.\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<ToolbarGroup className=\"components-toolbar-group\">\n\t\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\t\ticon=\"\"\n\t\t\t\t\t\t\tpopoverProps={ {\n\t\t\t\t\t\t\t\tclassName: 'is-alternate',\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\ttext={ __( 'Label' ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ () => (\n\t\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t\tclassName=\"wp-block-icon__toolbar-content\"\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Label' ) }\n\t\t\t\t\t\t\t\t\tvalue={ ariaLabel || '' }\n\t\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( { ariaLabel: value } )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t\t'Briefly describe the icon to help screen reader users. Leave blank for decorative icons.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</DropdownMenu>\n\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t</>\n\t);\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst inspectorControls = icon && (\n\t\t<>\n\t\t\t<InspectorControls group=\"settings\">\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tariaLabel: undefined,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Label' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! ariaLabel }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { ariaLabel: undefined } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\tlabel={ __( 'Label' ) }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Briefly describe the icon to help screen reader users. Leave blank for decorative icons.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tvalue={ ariaLabel || '' }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { ariaLabel: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ blockControls }\n\t\t\t{ inspectorControls }\n\t\t\t<div { ...useBlockProps() }>\n\t\t\t\t{ icon ? (\n\t\t\t\t\t<HtmlRenderer\n\t\t\t\t\t\thtml={ iconToDisplay }\n\t\t\t\t\t\twrapperProps={ {\n\t\t\t\t\t\t\tclassName: clsx(\n\t\t\t\t\t\t\t\tcolorProps.className,\n\t\t\t\t\t\t\t\tborderProps.className,\n\t\t\t\t\t\t\t\tspacingProps.className,\n\t\t\t\t\t\t\t\tdimensionsProps.className\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t...colorProps.style,\n\t\t\t\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t\t\t\t...spacingProps.style,\n\t\t\t\t\t\t\t\t...dimensionsProps.style,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<IconPlaceholder\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\tborderProps.className,\n\t\t\t\t\t\t\tspacingProps.className,\n\t\t\t\t\t\t\tdimensionsProps.className\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t\t\t...spacingProps.style,\n\t\t\t\t\t\t\t...dimensionsProps.style,\n\t\t\t\t\t\t\theight: 'auto',\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t{ isInserterOpen && (\n\t\t\t\t<CustomInserterModal\n\t\t\t\t\ticons={ allIcons }\n\t\t\t\t\tsetInserterOpen={ setInserterOpen }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default Edit;\n"],
5
+ "mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,UAAU;AACnB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,4BAA4B;AAAA,EAC5B,gCAAgC;AAAA,OAC1B;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,+BAA+B;AAAA,EAC/B,gCAAgC;AAAA,EAChC,4CAA4C;AAAA,EAC5C,iCAAiC;AAAA,OAC3B;AACP,SAAS,gBAAgB;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AA,cACrB,UAAW,CAAE,UACZ,cAAe,EAAE,WAAW,MAAM,CAAE;AAAA,cAErC,uBAAqB;AAAA;AAAA,UACtB;AAAA;AAAA,MACD;AAAA;AAAA,EACD,GACD,GACD;AAGD,SACC,iCACG;AAAA;AAAA,IACA;AAAA,IACF,oBAAC,SAAM,GAAG,cAAc,GACrB,iBACD;AAAA,MAAC;AAAA;AAAA,QACA,MAAO;AAAA,QACP,cAAe;AAAA,UACd,WAAW;AAAA,YACV,WAAW;AAAA,YACX,YAAY;AAAA,YACZ,aAAa;AAAA,YACb,gBAAgB;AAAA,UACjB;AAAA,UACA,OAAO;AAAA,YACN,GAAG,WAAW;AAAA,YACd,GAAG,YAAY;AAAA,YACf,GAAG,aAAa;AAAA,YAChB,GAAG,gBAAgB;AAAA,UACpB;AAAA,QACD;AAAA;AAAA,IACD,IAEA;AAAA,MAAC;AAAA;AAAA,QACA,WAAY;AAAA,UACX,YAAY;AAAA,UACZ,aAAa;AAAA,UACb,gBAAgB;AAAA,QACjB;AAAA,QACA,OAAQ;AAAA,UACP,GAAG,YAAY;AAAA,UACf,GAAG,aAAa;AAAA,UAChB,GAAG,gBAAgB;AAAA,UACnB,QAAQ;AAAA,QACT;AAAA;AAAA,IACD,GAEF;AAAA,IACE,kBACD;AAAA,MAAC;AAAA;AAAA,QACA,OAAQ;AAAA,QACR;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACD;AAAA,KAEF;AAEF;AAEA,IAAO,eAAQ;",
6
6
  "names": []
7
7
  }
@@ -345,6 +345,7 @@ function Image({
345
345
  const isContentOnlyMode = blockEditingMode === "contentOnly";
346
346
  const showDimensionsControls = allowResize && hasNonContentControls;
347
347
  const isResizable = allowResize && hasNonContentControls && !isWideAligned && isLargeViewport;
348
+ const isUploading = !!temporaryURL || isSideloading;
348
349
  const imageSizeOptions = imageSizes.filter(
349
350
  ({ slug }) => image?.media_details?.sizes?.[slug]?.source_url
350
351
  ).map(({ name, slug }) => ({ value: slug, label: name }));
@@ -714,7 +715,7 @@ function Image({
714
715
  onSelectURL,
715
716
  onError: onUploadError,
716
717
  onReset: () => onSelectImage(void 0),
717
- isUploading: !!temporaryURL || isSideloading,
718
+ isUploading,
718
719
  emptyLabel: __("Add image")
719
720
  }
720
721
  )
@@ -893,7 +894,7 @@ function Image({
893
894
  }
894
895
  }
895
896
  ),
896
- (temporaryURL || isSideloading) && /* @__PURE__ */ jsx(Spinner, {})
897
+ isUploading && /* @__PURE__ */ jsx(Spinner, {})
897
898
  ] });
898
899
  if (canEditImage && isEditingImage) {
899
900
  img = /* @__PURE__ */ jsx(ImageWrapper, { href, children: /* @__PURE__ */ jsx(
@@ -915,7 +916,7 @@ function Image({
915
916
  img = /* @__PURE__ */ jsx(ImageWrapper, { href, children: img });
916
917
  }
917
918
  let resizableBox;
918
- if (isResizable && isSingleSelected && !isEditingImage && !SIZED_LAYOUTS.includes(parentLayoutType)) {
919
+ if (isResizable && isSingleSelected && !isEditingImage && !isUploading && !SIZED_LAYOUTS.includes(parentLayoutType)) {
919
920
  const numericRatio = aspectRatio && evalAspectRatio(aspectRatio);
920
921
  const customRatio = pixelSize.width / pixelSize.height;
921
922
  const naturalRatio = naturalWidth / naturalHeight;