@wordpress/block-library 9.7.0 → 9.7.1-next.5368f64a9.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.
- package/build/archives/edit.js +1 -1
- package/build/archives/edit.js.map +1 -1
- package/build/block/edit.js +2 -3
- package/build/block/edit.js.map +1 -1
- package/build/buttons/index.js +1 -1
- package/build/comments/edit/comments-legacy.js +2 -4
- package/build/comments/edit/comments-legacy.js.map +1 -1
- package/build/cover/deprecated.js +1 -1
- package/build/cover/deprecated.js.map +1 -1
- package/build/cover/edit/index.js +4 -2
- package/build/cover/edit/index.js.map +1 -1
- package/build/embed/edit.js +5 -11
- package/build/embed/edit.js.map +1 -1
- package/build/embed/embed-placeholder.js +4 -8
- package/build/embed/embed-placeholder.js.map +1 -1
- package/build/embed/embed-preview.js +16 -4
- package/build/embed/embed-preview.js.map +1 -1
- package/build/file/transforms.js +18 -4
- package/build/file/transforms.js.map +1 -1
- package/build/freeform/modal.js +6 -12
- package/build/freeform/modal.js.map +1 -1
- package/build/image/edit.js +55 -15
- package/build/image/edit.js.map +1 -1
- package/build/image/image.js +23 -20
- package/build/image/image.js.map +1 -1
- package/build/image/transforms.js +0 -13
- package/build/image/transforms.js.map +1 -1
- package/build/image/use-max-width-observer.js +35 -0
- package/build/image/use-max-width-observer.js.map +1 -0
- package/build/image/utils.js +11 -0
- package/build/image/utils.js.map +1 -1
- package/build/latest-posts/edit.js +1 -1
- package/build/latest-posts/edit.js.map +1 -1
- package/build/missing/edit.js +2 -4
- package/build/missing/edit.js.map +1 -1
- package/build/navigation/edit/deleted-navigation-warning.js +14 -10
- package/build/navigation/edit/deleted-navigation-warning.js.map +1 -1
- package/build/navigation/edit/index.js +2 -4
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/menu-inspector-controls.js +2 -1
- package/build/navigation/edit/menu-inspector-controls.js.map +1 -1
- package/build/navigation/edit/navigation-menu-delete-control.js +2 -4
- package/build/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build/navigation/edit/placeholder/index.js +2 -4
- package/build/navigation/edit/placeholder/index.js.map +1 -1
- package/build/navigation/edit/responsive-wrapper.js +4 -8
- package/build/navigation/edit/responsive-wrapper.js.map +1 -1
- package/build/navigation-link/link-ui.js +2 -4
- package/build/navigation-link/link-ui.js.map +1 -1
- package/build/page-list/convert-to-links-modal.js +4 -8
- package/build/page-list/convert-to-links-modal.js.map +1 -1
- package/build/page-list/edit.js +2 -4
- package/build/page-list/edit.js.map +1 -1
- package/build/post-comments-form/form.js +2 -4
- package/build/post-comments-form/form.js.map +1 -1
- package/build/post-featured-image/edit.js +2 -4
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-title/index.js +4 -1
- package/build/post-title/index.js.map +1 -1
- package/build/query/edit/enhanced-pagination-modal.js +4 -6
- package/build/query/edit/enhanced-pagination-modal.js.map +1 -1
- package/build/query/edit/inspector-controls/enhanced-pagination-control.js +3 -3
- package/build/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +2 -10
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/query-content.js +9 -3
- package/build/query/edit/query-content.js.map +1 -1
- package/build/query/edit/query-placeholder.js +4 -8
- package/build/query/edit/query-placeholder.js.map +1 -1
- package/build/site-logo/edit.js +4 -8
- package/build/site-logo/edit.js.map +1 -1
- package/build/site-title/index.js +4 -1
- package/build/site-title/index.js.map +1 -1
- package/build/social-link/edit.js +1 -1
- package/build/social-link/edit.js.map +1 -1
- package/build/template-part/edit/inner-blocks.js +10 -1
- package/build/template-part/edit/inner-blocks.js.map +1 -1
- package/build/template-part/edit/placeholder.js +4 -8
- package/build/template-part/edit/placeholder.js.map +1 -1
- package/build/video/edit.js +4 -8
- package/build/video/edit.js.map +1 -1
- package/build/video/tracks-editor.js +6 -12
- package/build/video/tracks-editor.js.map +1 -1
- package/build-module/archives/edit.js +1 -1
- package/build-module/archives/edit.js.map +1 -1
- package/build-module/block/edit.js +2 -3
- package/build-module/block/edit.js.map +1 -1
- package/build-module/buttons/index.js +1 -1
- package/build-module/comments/edit/comments-legacy.js +2 -4
- package/build-module/comments/edit/comments-legacy.js.map +1 -1
- package/build-module/cover/deprecated.js +1 -1
- package/build-module/cover/deprecated.js.map +1 -1
- package/build-module/cover/edit/index.js +4 -2
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/embed/edit.js +6 -12
- package/build-module/embed/edit.js.map +1 -1
- package/build-module/embed/embed-placeholder.js +4 -8
- package/build-module/embed/embed-placeholder.js.map +1 -1
- package/build-module/embed/embed-preview.js +16 -4
- package/build-module/embed/embed-preview.js.map +1 -1
- package/build-module/file/transforms.js +18 -4
- package/build-module/file/transforms.js.map +1 -1
- package/build-module/freeform/modal.js +6 -12
- package/build-module/freeform/modal.js.map +1 -1
- package/build-module/image/edit.js +58 -18
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/image.js +23 -20
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/transforms.js +0 -13
- package/build-module/image/transforms.js.map +1 -1
- package/build-module/image/use-max-width-observer.js +29 -0
- package/build-module/image/use-max-width-observer.js.map +1 -0
- package/build-module/image/utils.js +11 -1
- package/build-module/image/utils.js.map +1 -1
- package/build-module/latest-posts/edit.js +1 -1
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/missing/edit.js +2 -4
- package/build-module/missing/edit.js.map +1 -1
- package/build-module/navigation/edit/deleted-navigation-warning.js +15 -11
- package/build-module/navigation/edit/deleted-navigation-warning.js.map +1 -1
- package/build-module/navigation/edit/index.js +2 -4
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/menu-inspector-controls.js +2 -1
- package/build-module/navigation/edit/menu-inspector-controls.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-delete-control.js +2 -4
- package/build-module/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build-module/navigation/edit/placeholder/index.js +2 -4
- package/build-module/navigation/edit/placeholder/index.js.map +1 -1
- package/build-module/navigation/edit/responsive-wrapper.js +4 -8
- package/build-module/navigation/edit/responsive-wrapper.js.map +1 -1
- package/build-module/navigation-link/link-ui.js +2 -4
- package/build-module/navigation-link/link-ui.js.map +1 -1
- package/build-module/page-list/convert-to-links-modal.js +4 -8
- package/build-module/page-list/convert-to-links-modal.js.map +1 -1
- package/build-module/page-list/edit.js +2 -4
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/post-comments-form/form.js +2 -4
- package/build-module/post-comments-form/form.js.map +1 -1
- package/build-module/post-featured-image/edit.js +2 -4
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-title/index.js +4 -1
- package/build-module/post-title/index.js.map +1 -1
- package/build-module/query/edit/enhanced-pagination-modal.js +4 -6
- package/build-module/query/edit/enhanced-pagination-modal.js.map +1 -1
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js +3 -3
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +2 -10
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/query-content.js +10 -4
- package/build-module/query/edit/query-content.js.map +1 -1
- package/build-module/query/edit/query-placeholder.js +4 -8
- package/build-module/query/edit/query-placeholder.js.map +1 -1
- package/build-module/site-logo/edit.js +4 -8
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/site-title/index.js +4 -1
- package/build-module/site-title/index.js.map +1 -1
- package/build-module/social-link/edit.js +1 -1
- package/build-module/social-link/edit.js.map +1 -1
- package/build-module/template-part/edit/inner-blocks.js +10 -1
- package/build-module/template-part/edit/inner-blocks.js.map +1 -1
- package/build-module/template-part/edit/placeholder.js +4 -8
- package/build-module/template-part/edit/placeholder.js.map +1 -1
- package/build-module/video/edit.js +4 -8
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/tracks-editor.js +6 -12
- package/build-module/video/tracks-editor.js.map +1 -1
- package/build-style/buttons/editor-rtl.css +2 -2
- package/build-style/buttons/editor.css +2 -2
- package/build-style/buttons/style-rtl.css +2 -2
- package/build-style/buttons/style.css +2 -2
- package/build-style/common-rtl.css +2 -2
- package/build-style/common.css +2 -2
- package/build-style/editor-rtl.css +11 -31
- package/build-style/editor.css +11 -31
- package/build-style/image/editor-rtl.css +6 -26
- package/build-style/image/editor.css +6 -26
- package/build-style/navigation/editor-rtl.css +1 -1
- package/build-style/navigation/editor.css +1 -1
- package/build-style/post-title/style-rtl.css +21 -0
- package/build-style/post-title/style.css +21 -0
- package/build-style/site-title/style-rtl.css +21 -0
- package/build-style/site-title/style.css +21 -0
- package/build-style/style-rtl.css +46 -4
- package/build-style/style.css +46 -4
- package/package.json +42 -35
- package/src/archives/edit.js +1 -1
- package/src/block/edit.js +3 -7
- package/src/buttons/block.json +1 -1
- package/src/buttons/editor.scss +2 -2
- package/src/buttons/style.scss +2 -2
- package/src/comments/edit/comments-legacy.js +1 -2
- package/src/cover/deprecated.js +3 -2
- package/src/cover/edit/index.js +5 -1
- package/src/embed/edit.js +0 -7
- package/src/embed/embed-placeholder.js +2 -4
- package/src/embed/embed-preview.js +22 -2
- package/src/file/index.php +1 -1
- package/src/file/transforms.js +26 -6
- package/src/freeform/modal.js +3 -6
- package/src/image/edit.js +91 -20
- package/src/image/editor.scss +7 -38
- package/src/image/image.js +31 -20
- package/src/image/index.php +1 -1
- package/src/image/transforms.js +0 -23
- package/src/image/use-max-width-observer.js +32 -0
- package/src/image/utils.js +13 -1
- package/src/latest-posts/edit.js +1 -1
- package/src/missing/edit.js +1 -2
- package/src/navigation/edit/deleted-navigation-warning.js +23 -20
- package/src/navigation/edit/index.js +1 -2
- package/src/navigation/edit/menu-inspector-controls.js +3 -1
- package/src/navigation/edit/navigation-menu-delete-control.js +1 -2
- package/src/navigation/edit/placeholder/index.js +1 -2
- package/src/navigation/edit/responsive-wrapper.js +2 -4
- package/src/navigation/editor.scss +5 -1
- package/src/navigation/index.php +1 -1
- package/src/navigation-link/link-ui.js +1 -2
- package/src/page-list/convert-to-links-modal.js +2 -4
- package/src/page-list/edit.js +1 -2
- package/src/post-comments-form/form.js +1 -2
- package/src/post-featured-image/edit.js +1 -2
- package/src/post-title/block.json +4 -1
- package/src/post-title/style.scss +24 -0
- package/src/query/edit/enhanced-pagination-modal.js +3 -4
- package/src/query/edit/inspector-controls/enhanced-pagination-control.js +3 -3
- package/src/query/edit/inspector-controls/index.js +2 -9
- package/src/query/edit/query-content.js +7 -0
- package/src/query/edit/query-placeholder.js +2 -4
- package/src/query/index.php +1 -1
- package/src/search/index.php +1 -1
- package/src/site-logo/edit.js +2 -4
- package/src/site-title/block.json +4 -1
- package/src/site-title/style.scss +24 -0
- package/src/social-link/edit.js +1 -1
- package/src/template-part/edit/inner-blocks.js +20 -1
- package/src/template-part/edit/placeholder.js +2 -4
- package/src/video/edit.js +2 -4
- package/src/video/tracks-editor.js +3 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","useEntityProp","store","coreStore","useEffect","useMemo","useRef","Placeholder","Spinner","compose","useResizeObserver","withColors","ColorPalette","useBlockProps","useSettings","useInnerBlocksProps","__experimentalUseGradient","blockEditorStore","__","useSelect","useDispatch","isBlobURL","noticesStore","attributesFromMedia","IMAGE_BACKGROUND_TYPE","VIDEO_BACKGROUND_TYPE","dimRatioToClass","isContentPositionCenter","getPositionClassName","mediaPosition","CoverInspectorControls","CoverBlockControls","CoverPlaceholder","ResizableCoverPopover","getMediaColor","compositeIsDark","DEFAULT_BACKGROUND_COLOR","DEFAULT_OVERLAY_COLOR","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","getInnerBlocksTemplate","attributes","align","placeholder","isTemporaryMedia","id","url","CoverEdit","clientId","isSelected","overlayColor","setAttributes","setOverlayColor","toggleSelection","context","postId","postType","contentPosition","originalUrl","backgroundType","originalBackgroundType","useFeaturedImage","dimRatio","focalPoint","hasParallax","isDark","isRepeated","minHeight","minHeightUnit","alt","allowedBlocks","templateLock","tagName","TagName","isUserOverlayColor","featuredImage","__unstableMarkNextChangeAsNotPersistent","media","select","getMedia","mediaUrl","source_url","averageBackgroundColor","newOverlayColor","color","newIsDark","replaceAll","createErrorNotice","gradientClass","gradientValue","onSelectMedia","newMedia","mediaAttributes","isImage","type","media_type","includes","undefined","newDimRatio","onClearMedia","onSetOverlayColor","onUpdateDimRatio","onUploadError","message","isUploadingMedia","isImageBackground","isVideoBackground","resizeListener","height","width","resizableBoxDimensions","minHeightWithUnit","isImgElement","style","backgroundImage","backgroundPosition","bgStyle","backgroundColor","mediaStyle","objectPosition","hasBackground","hasInnerBlocks","getBlock","innerBlocks","length","ref","blockProps","fontSizes","hasFontSizes","innerBlocksTemplate","fontSize","innerBlocksProps","className","template","templateInsertUpdatesSelection","dropZoneElement","current","mediaElement","currentSettings","toggleUseFeaturedImage","newUseFeaturedImage","blockControls","inspectorControls","coverRef","updateDimRatio","resizableCoverProps","onResizeStart","onResize","value","onResizeStop","newMinHeight","showHandle","dimensions","aspectRatio","size","children","onError","disableCustomColors","onChange","clearable","classes","showOverlay","class","withIllustration","src","role","autoPlay","muted","loop","disableMediaButtons"],"sources":["@wordpress/block-library/src/cover/edit/index.js"],"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} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { isBlobURL } from '@wordpress/blob';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport {\n\tattributesFromMedia,\n\tIMAGE_BACKGROUND_TYPE,\n\tVIDEO_BACKGROUND_TYPE,\n\tdimRatioToClass,\n\tisContentPositionCenter,\n\tgetPositionClassName,\n\tmediaPosition,\n} 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';\n\nfunction getInnerBlocksTemplate( attributes ) {\n\treturn [\n\t\t[\n\t\t\t'core/paragraph',\n\t\t\t{\n\t\t\t\talign: 'center',\n\t\t\t\tplaceholder: __( 'Write title…' ),\n\t\t\t\t...attributes,\n\t\t\t},\n\t\t],\n\t];\n}\n\n/**\n * Is the URL a temporary blob URL? A blob URL is one that is used temporarily while\n * the media (image or video) is being uploaded and will not have an id allocated yet.\n *\n * @param {number} id The id of the media.\n * @param {string} url The url of the media.\n *\n * @return {boolean} Is the URL a Blob URL.\n */\nconst isTemporaryMedia = ( id, url ) => ! id && isBlobURL( url );\n\nfunction CoverEdit( {\n\tattributes,\n\tclientId,\n\tisSelected,\n\toverlayColor,\n\tsetAttributes,\n\tsetOverlayColor,\n\ttoggleSelection,\n\tcontext: { postId, postType },\n} ) {\n\tconst {\n\t\tcontentPosition,\n\t\tid,\n\t\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} = attributes;\n\n\tconst [ featuredImage ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'featured_media',\n\t\tpostId\n\t);\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst media = useSelect(\n\t\t( select ) =>\n\t\t\tfeaturedImage &&\n\t\t\tselect( coreStore ).getMedia( featuredImage, { context: 'view' } ),\n\t\t[ featuredImage ]\n\t);\n\tconst mediaUrl = media?.source_url;\n\n\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( { isDark: newIsDark } );\n\t\t} )();\n\t\t// Disable reason: Update the block only when the featured image changes.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ mediaUrl ] );\n\n\t// instead of destructuring the attributes\n\t// we define the url and background type\n\t// depending on the value of the useFeaturedImage flag\n\t// to preview in edit the dynamic featured image\n\tconst url = useFeaturedImage\n\t\t? mediaUrl\n\t\t: // Ensure the url is not malformed due to sanitization through `wp_kses`.\n\t\t originalUrl?.replaceAll( '&', '&' );\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\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} );\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 isUploadingMedia = isTemporaryMedia( id, url );\n\n\tconst isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType;\n\tconst isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType;\n\n\tconst [ resizeListener, { height, width } ] = useResizeObserver();\n\tconst resizableBoxDimensions = useMemo( () => {\n\t\treturn {\n\t\t\theight: minHeightUnit === 'px' ? minHeight : 'auto',\n\t\t\twidth: 'auto',\n\t\t};\n\t}, [ minHeight, minHeightUnit ] );\n\n\tconst minHeightWithUnit =\n\t\tminHeight && minHeightUnit\n\t\t\t? `${ minHeight }${ minHeightUnit }`\n\t\t\t: minHeight;\n\n\tconst isImgElement = ! ( hasParallax || isRepeated );\n\n\tconst style = {\n\t\tminHeight: minHeightWithUnit || undefined,\n\t};\n\n\tconst backgroundImage = url ? `url(${ url })` : undefined;\n\n\tconst backgroundPosition = mediaPosition( focalPoint );\n\n\tconst bgStyle = { backgroundColor: overlayColor.color };\n\tconst mediaStyle = {\n\t\tobjectPosition:\n\t\t\tfocalPoint && isImgElement\n\t\t\t\t? mediaPosition( focalPoint )\n\t\t\t\t: undefined,\n\t};\n\n\tconst hasBackground = !! ( url || overlayColor.color || gradientValue );\n\n\tconst hasInnerBlocks = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlock( clientId ).innerBlocks.length >\n\t\t\t0,\n\t\t[ clientId ]\n\t);\n\n\tconst ref = useRef();\n\tconst blockProps = useBlockProps( { ref } );\n\n\t// Check for fontSize support before we pass a fontSize attribute to the innerBlocks.\n\tconst [ 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\tcurrentSettings={ currentSettings }\n\t\t\ttoggleUseFeaturedImage={ toggleUseFeaturedImage }\n\t\t\tonClearMedia={ onClearMedia }\n\t\t/>\n\t);\n\n\tconst inspectorControls = (\n\t\t<CoverInspectorControls\n\t\t\tattributes={ attributes }\n\t\t\tsetAttributes={ setAttributes }\n\t\t\tclientId={ clientId }\n\t\t\tsetOverlayColor={ onSetOverlayColor }\n\t\t\tcoverRef={ ref }\n\t\t\tcurrentSettings={ currentSettings }\n\t\t\ttoggleUseFeaturedImage={ toggleUseFeaturedImage }\n\t\t\tupdateDimRatio={ onUpdateDimRatio }\n\t\t\tonClearMedia={ onClearMedia }\n\t\t/>\n\t);\n\n\tconst resizableCoverProps = {\n\t\tclassName: 'block-library-cover__resize-container',\n\t\tclientId,\n\t\theight,\n\t\tminHeight: minHeightWithUnit,\n\t\tonResizeStart: () => {\n\t\t\tsetAttributes( { minHeightUnit: 'px' } );\n\t\t\ttoggleSelection( false );\n\t\t},\n\t\tonResize: ( value ) => {\n\t\t\tsetAttributes( { minHeight: value } );\n\t\t},\n\t\tonResizeStop: ( newMinHeight ) => {\n\t\t\ttoggleSelection( true );\n\t\t\tsetAttributes( { minHeight: newMinHeight } );\n\t\t},\n\t\t// Hide the resize handle if an aspect ratio is set, as the aspect ratio takes precedence.\n\t\tshowHandle: ! attributes.style?.dimensions?.aspectRatio ? true : false,\n\t\tsize: resizableBoxDimensions,\n\t\twidth,\n\t};\n\n\tif ( ! useFeaturedImage && ! hasInnerBlocks && ! hasBackground ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ blockControls }\n\t\t\t\t{ inspectorControls }\n\t\t\t\t{ isSelected && (\n\t\t\t\t\t<ResizableCoverPopover { ...resizableCoverProps } />\n\t\t\t\t) }\n\t\t\t\t<TagName\n\t\t\t\t\t{ ...blockProps }\n\t\t\t\t\tclassName={ 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/>\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\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{ ! 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\tstyle={ mediaStyle }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ isUploadingMedia && <Spinner /> }\n\t\t\t\t<CoverPlaceholder\n\t\t\t\t\tdisableMediaButtons\n\t\t\t\t\tonSelectMedia={ onSelectMedia }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\ttoggleUseFeaturedImage={ toggleUseFeaturedImage }\n\t\t\t\t/>\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t</TagName>\n\t\t\t{ isSelected && (\n\t\t\t\t<ResizableCoverPopover { ...resizableCoverProps } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default compose( [\n\twithColors( { overlayColor: 'background-color' } ),\n] )( CoverEdit );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,aAAa,EAAEC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACxE,SAASC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,oBAAoB;AAC/D,SAASC,WAAW,EAAEC,OAAO,QAAQ,uBAAuB;AAC5D,SAASC,OAAO,EAAEC,iBAAiB,QAAQ,oBAAoB;AAC/D,SACCC,UAAU,EACVC,YAAY,EACZC,aAAa,EACbC,WAAW,EACXC,mBAAmB,EACnBC,yBAAyB,EACzBd,KAAK,IAAIe,gBAAgB,QACnB,yBAAyB;AAChC,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASnB,KAAK,IAAIoB,YAAY,QAAQ,oBAAoB;;AAE1D;AACA;AACA;AACA,SACCC,mBAAmB,EACnBC,qBAAqB,EACrBC,qBAAqB,EACrBC,eAAe,EACfC,uBAAuB,EACvBC,oBAAoB,EACpBC,aAAa,QACP,WAAW;AAClB,OAAOC,sBAAsB,MAAM,sBAAsB;AACzD,OAAOC,kBAAkB,MAAM,kBAAkB;AACjD,OAAOC,gBAAgB,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","useEffect","useMemo","useRef","Placeholder","Spinner","compose","useResizeObserver","withColors","ColorPalette","useBlockProps","useSettings","useInnerBlocksProps","__experimentalUseGradient","blockEditorStore","__","useSelect","useDispatch","isBlobURL","noticesStore","attributesFromMedia","IMAGE_BACKGROUND_TYPE","VIDEO_BACKGROUND_TYPE","dimRatioToClass","isContentPositionCenter","getPositionClassName","mediaPosition","CoverInspectorControls","CoverBlockControls","CoverPlaceholder","ResizableCoverPopover","getMediaColor","compositeIsDark","DEFAULT_BACKGROUND_COLOR","DEFAULT_OVERLAY_COLOR","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","getInnerBlocksTemplate","attributes","align","placeholder","isTemporaryMedia","id","url","CoverEdit","clientId","isSelected","overlayColor","setAttributes","setOverlayColor","toggleSelection","context","postId","postType","contentPosition","originalUrl","backgroundType","originalBackgroundType","useFeaturedImage","dimRatio","focalPoint","hasParallax","isDark","isRepeated","minHeight","minHeightUnit","alt","allowedBlocks","templateLock","tagName","TagName","isUserOverlayColor","featuredImage","__unstableMarkNextChangeAsNotPersistent","media","select","getMedia","mediaUrl","source_url","averageBackgroundColor","newOverlayColor","color","newIsDark","replaceAll","createErrorNotice","gradientClass","gradientValue","onSelectMedia","newMedia","mediaAttributes","isImage","type","media_type","includes","undefined","newDimRatio","onClearMedia","onSetOverlayColor","onUpdateDimRatio","onUploadError","message","isUploadingMedia","isImageBackground","isVideoBackground","resizeListener","height","width","resizableBoxDimensions","minHeightWithUnit","isImgElement","style","backgroundImage","backgroundPosition","bgStyle","backgroundColor","mediaStyle","objectPosition","hasBackground","hasInnerBlocks","getBlock","innerBlocks","length","ref","blockProps","fontSizes","hasFontSizes","innerBlocksTemplate","fontSize","innerBlocksProps","className","template","templateInsertUpdatesSelection","dropZoneElement","current","mediaElement","currentSettings","toggleUseFeaturedImage","newUseFeaturedImage","blockControls","inspectorControls","coverRef","updateDimRatio","resizableCoverProps","onResizeStart","onResize","value","onResizeStop","newMinHeight","showHandle","dimensions","aspectRatio","size","children","onError","disableCustomColors","onChange","clearable","classes","showOverlay","class","withIllustration","src","role","autoPlay","muted","loop","disableMediaButtons"],"sources":["@wordpress/block-library/src/cover/edit/index.js"],"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} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { isBlobURL } from '@wordpress/blob';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport {\n\tattributesFromMedia,\n\tIMAGE_BACKGROUND_TYPE,\n\tVIDEO_BACKGROUND_TYPE,\n\tdimRatioToClass,\n\tisContentPositionCenter,\n\tgetPositionClassName,\n\tmediaPosition,\n} 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';\n\nfunction getInnerBlocksTemplate( attributes ) {\n\treturn [\n\t\t[\n\t\t\t'core/paragraph',\n\t\t\t{\n\t\t\t\talign: 'center',\n\t\t\t\tplaceholder: __( 'Write title…' ),\n\t\t\t\t...attributes,\n\t\t\t},\n\t\t],\n\t];\n}\n\n/**\n * Is the URL a temporary blob URL? A blob URL is one that is used temporarily while\n * the media (image or video) is being uploaded and will not have an id allocated yet.\n *\n * @param {number} id The id of the media.\n * @param {string} url The url of the media.\n *\n * @return {boolean} Is the URL a Blob URL.\n */\nconst isTemporaryMedia = ( id, url ) => ! id && isBlobURL( url );\n\nfunction CoverEdit( {\n\tattributes,\n\tclientId,\n\tisSelected,\n\toverlayColor,\n\tsetAttributes,\n\tsetOverlayColor,\n\ttoggleSelection,\n\tcontext: { postId, postType },\n} ) {\n\tconst {\n\t\tcontentPosition,\n\t\tid,\n\t\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} = attributes;\n\n\tconst [ featuredImage ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'featured_media',\n\t\tpostId\n\t);\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst media = useSelect(\n\t\t( select ) =>\n\t\t\tfeaturedImage &&\n\t\t\tselect( coreStore ).getMedia( featuredImage, { context: 'view' } ),\n\t\t[ featuredImage ]\n\t);\n\tconst mediaUrl = media?.source_url;\n\n\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// Disable reason: Update the block only when the featured image changes.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ mediaUrl ] );\n\n\t// instead of destructuring the attributes\n\t// we define the url and background type\n\t// depending on the value of the useFeaturedImage flag\n\t// to preview in edit the dynamic featured image\n\tconst url = useFeaturedImage\n\t\t? mediaUrl\n\t\t: // Ensure the url is not malformed due to sanitization through `wp_kses`.\n\t\t originalUrl?.replaceAll( '&', '&' );\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\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 isUploadingMedia = isTemporaryMedia( id, url );\n\n\tconst isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType;\n\tconst isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType;\n\n\tconst [ resizeListener, { height, width } ] = useResizeObserver();\n\tconst resizableBoxDimensions = useMemo( () => {\n\t\treturn {\n\t\t\theight: minHeightUnit === 'px' ? minHeight : 'auto',\n\t\t\twidth: 'auto',\n\t\t};\n\t}, [ minHeight, minHeightUnit ] );\n\n\tconst minHeightWithUnit =\n\t\tminHeight && minHeightUnit\n\t\t\t? `${ minHeight }${ minHeightUnit }`\n\t\t\t: minHeight;\n\n\tconst isImgElement = ! ( hasParallax || isRepeated );\n\n\tconst style = {\n\t\tminHeight: minHeightWithUnit || undefined,\n\t};\n\n\tconst backgroundImage = url ? `url(${ url })` : undefined;\n\n\tconst backgroundPosition = mediaPosition( focalPoint );\n\n\tconst bgStyle = { backgroundColor: overlayColor.color };\n\tconst mediaStyle = {\n\t\tobjectPosition:\n\t\t\tfocalPoint && isImgElement\n\t\t\t\t? mediaPosition( focalPoint )\n\t\t\t\t: undefined,\n\t};\n\n\tconst hasBackground = !! ( url || overlayColor.color || gradientValue );\n\n\tconst hasInnerBlocks = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlock( clientId ).innerBlocks.length >\n\t\t\t0,\n\t\t[ clientId ]\n\t);\n\n\tconst ref = useRef();\n\tconst blockProps = useBlockProps( { ref } );\n\n\t// Check for fontSize support before we pass a fontSize attribute to the innerBlocks.\n\tconst [ 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\tcurrentSettings={ currentSettings }\n\t\t\ttoggleUseFeaturedImage={ toggleUseFeaturedImage }\n\t\t\tonClearMedia={ onClearMedia }\n\t\t/>\n\t);\n\n\tconst inspectorControls = (\n\t\t<CoverInspectorControls\n\t\t\tattributes={ attributes }\n\t\t\tsetAttributes={ setAttributes }\n\t\t\tclientId={ clientId }\n\t\t\tsetOverlayColor={ onSetOverlayColor }\n\t\t\tcoverRef={ ref }\n\t\t\tcurrentSettings={ currentSettings }\n\t\t\ttoggleUseFeaturedImage={ toggleUseFeaturedImage }\n\t\t\tupdateDimRatio={ onUpdateDimRatio }\n\t\t\tonClearMedia={ onClearMedia }\n\t\t/>\n\t);\n\n\tconst resizableCoverProps = {\n\t\tclassName: 'block-library-cover__resize-container',\n\t\tclientId,\n\t\theight,\n\t\tminHeight: minHeightWithUnit,\n\t\tonResizeStart: () => {\n\t\t\tsetAttributes( { minHeightUnit: 'px' } );\n\t\t\ttoggleSelection( false );\n\t\t},\n\t\tonResize: ( value ) => {\n\t\t\tsetAttributes( { minHeight: value } );\n\t\t},\n\t\tonResizeStop: ( newMinHeight ) => {\n\t\t\ttoggleSelection( true );\n\t\t\tsetAttributes( { minHeight: newMinHeight } );\n\t\t},\n\t\t// Hide the resize handle if an aspect ratio is set, as the aspect ratio takes precedence.\n\t\tshowHandle: ! attributes.style?.dimensions?.aspectRatio ? true : false,\n\t\tsize: resizableBoxDimensions,\n\t\twidth,\n\t};\n\n\tif ( ! useFeaturedImage && ! hasInnerBlocks && ! hasBackground ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ blockControls }\n\t\t\t\t{ inspectorControls }\n\t\t\t\t{ isSelected && (\n\t\t\t\t\t<ResizableCoverPopover { ...resizableCoverProps } />\n\t\t\t\t) }\n\t\t\t\t<TagName\n\t\t\t\t\t{ ...blockProps }\n\t\t\t\t\tclassName={ 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/>\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\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{ ! 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\tstyle={ mediaStyle }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ isUploadingMedia && <Spinner /> }\n\t\t\t\t<CoverPlaceholder\n\t\t\t\t\tdisableMediaButtons\n\t\t\t\t\tonSelectMedia={ onSelectMedia }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\ttoggleUseFeaturedImage={ toggleUseFeaturedImage }\n\t\t\t\t/>\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t</TagName>\n\t\t\t{ isSelected && (\n\t\t\t\t<ResizableCoverPopover { ...resizableCoverProps } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default compose( [\n\twithColors( { overlayColor: 'background-color' } ),\n] )( CoverEdit );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,aAAa,EAAEC,KAAK,IAAIC,S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AEC,eAAe;UAAEC;QAAmB;MAAG,CACjD,CACD,CAAE,EACFrE,GAAG,IAAI4D,iBAAiB,iBACzBvE,IAAA;QACC0F,GAAG,EAAGY,YAAc;QACpBL,SAAS,EAAC,kCAAkC;QAC5CkC,QAAQ;QACRC,KAAK;QACLC,IAAI;QACJJ,GAAG,EAAGtH,GAAK;QACXmE,KAAK,EAAGK;MAAY,CACpB,CACD,EACCd,gBAAgB,iBAAIrE,IAAA,CAAC/B,OAAO,IAAE,CAAC,eACjC+B,IAAA,CAACP,gBAAgB;QAChB6I,mBAAmB;QACnB/E,aAAa,EAAGA,aAAe;QAC/BkE,OAAO,EAAGtD,aAAe;QACzBqC,sBAAsB,EAAGA;MAAwB,CACjD,CAAC,eACFxG,IAAA;QAAA,GAAUgG;MAAgB,CAAI,CAAC;IAAA,CACvB,CAAC,EACRlF,UAAU,iBACXd,IAAA,CAACN,qBAAqB;MAAA,GAAMoH;IAAmB,CAAI,CACnD;EAAA,CACA,CAAC;AAEL;AAEA,eAAe5I,OAAO,CAAE,CACvBE,UAAU,CAAE;EAAE2C,YAAY,EAAE;AAAmB,CAAE,CAAC,CACjD,CAAC,CAAEH,SAAU,CAAC","ignoreList":[]}
|
|
@@ -7,7 +7,6 @@ import { embedContentIcon } from './icons';
|
|
|
7
7
|
import EmbedLoading from './embed-loading';
|
|
8
8
|
import EmbedPlaceholder from './embed-placeholder';
|
|
9
9
|
import EmbedPreview from './embed-preview';
|
|
10
|
-
import { Caption } from '../utils/caption';
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* External dependencies
|
|
@@ -25,8 +24,8 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
25
24
|
import { View } from '@wordpress/primitives';
|
|
26
25
|
import { getAuthority } from '@wordpress/url';
|
|
27
26
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
28
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
29
27
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
28
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
30
29
|
const EmbedEdit = props => {
|
|
31
30
|
const {
|
|
32
31
|
attributes: {
|
|
@@ -228,9 +227,9 @@ const EmbedEdit = props => {
|
|
|
228
227
|
allowResponsive: allowResponsive,
|
|
229
228
|
toggleResponsive: toggleResponsive,
|
|
230
229
|
switchBackToURLInput: () => setIsEditingURL(true)
|
|
231
|
-
}), /*#__PURE__*/
|
|
230
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
232
231
|
...blockProps,
|
|
233
|
-
children:
|
|
232
|
+
children: /*#__PURE__*/_jsx(EmbedPreview, {
|
|
234
233
|
preview: preview,
|
|
235
234
|
previewable: previewable,
|
|
236
235
|
className: className,
|
|
@@ -243,15 +242,10 @@ const EmbedEdit = props => {
|
|
|
243
242
|
isSelected: isSelected,
|
|
244
243
|
icon: icon,
|
|
245
244
|
label: label,
|
|
246
|
-
insertBlocksAfter: insertBlocksAfter
|
|
247
|
-
}), /*#__PURE__*/_jsx(Caption, {
|
|
248
|
-
attributes: attributes,
|
|
249
|
-
setAttributes: setAttributes,
|
|
250
|
-
isSelected: isSelected,
|
|
251
245
|
insertBlocksAfter: insertBlocksAfter,
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
})
|
|
246
|
+
attributes: attributes,
|
|
247
|
+
setAttributes: setAttributes
|
|
248
|
+
})
|
|
255
249
|
})]
|
|
256
250
|
});
|
|
257
251
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createUpgradedEmbedBlock","getClassNames","removeAspectRatioClasses","fallback","getEmbedInfoByProvider","getMergedAttributesWithPreview","EmbedControls","embedContentIcon","EmbedLoading","EmbedPlaceholder","EmbedPreview","Caption","clsx","__","_x","sprintf","useState","useEffect","useDispatch","useSelect","useBlockProps","store","coreStore","View","getAuthority","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","EmbedEdit","props","attributes","providerNameSlug","previewable","responsive","url","attributesUrl","isSelected","onReplace","setAttributes","insertBlocksAfter","onFocus","defaultEmbedInfo","title","icon","setURL","isEditingURL","setIsEditingURL","invalidateResolution","preview","fetching","themeSupportsResponsive","cannotEmbed","hasResolved","select","getEmbedPreview","isPreviewEmbedFallback","isRequestingEmbedPreview","getThemeSupports","hasFinishedResolution","embedPreview","previewIsFallback","badEmbedProvider","html","type","undefined","wordpressCantEmbed","data","status","validPreview","getMergedAttributes","toggleResponsive","allowResponsive","className","newAllowResponsive","newURL","replace","URL","host","toString","mergedAttributes","upgradedBlock","blockProps","children","label","showEmbedPlaceholder","onSubmit","event","preventDefault","blockClass","value","onChange","tryAgain","caption","classFromPreview","showEditButton","blockSupportsResponsive","switchBackToURLInput","onCaptionChange","showToolbarButton"],"sources":["@wordpress/block-library/src/embed/edit.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tcreateUpgradedEmbedBlock,\n\tgetClassNames,\n\tremoveAspectRatioClasses,\n\tfallback,\n\tgetEmbedInfoByProvider,\n\tgetMergedAttributesWithPreview,\n} from './util';\nimport EmbedControls from './embed-controls';\nimport { embedContentIcon } from './icons';\nimport EmbedLoading from './embed-loading';\nimport EmbedPlaceholder from './embed-placeholder';\nimport EmbedPreview from './embed-preview';\nimport { Caption } from '../utils/caption';\n\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { View } from '@wordpress/primitives';\nimport { getAuthority } from '@wordpress/url';\n\nconst EmbedEdit = ( props ) => {\n\tconst {\n\t\tattributes: {\n\t\t\tproviderNameSlug,\n\t\t\tpreviewable,\n\t\t\tresponsive,\n\t\t\turl: attributesUrl,\n\t\t},\n\t\tattributes,\n\t\tisSelected,\n\t\tonReplace,\n\t\tsetAttributes,\n\t\tinsertBlocksAfter,\n\t\tonFocus,\n\t} = props;\n\n\tconst defaultEmbedInfo = {\n\t\ttitle: _x( 'Embed', 'block title' ),\n\t\ticon: embedContentIcon,\n\t};\n\tconst { icon, title } =\n\t\tgetEmbedInfoByProvider( providerNameSlug ) || defaultEmbedInfo;\n\n\tconst [ url, setURL ] = useState( attributesUrl );\n\tconst [ isEditingURL, setIsEditingURL ] = useState( false );\n\tconst { invalidateResolution } = useDispatch( coreStore );\n\n\tconst {\n\t\tpreview,\n\t\tfetching,\n\t\tthemeSupportsResponsive,\n\t\tcannotEmbed,\n\t\thasResolved,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEmbedPreview,\n\t\t\t\tisPreviewEmbedFallback,\n\t\t\t\tisRequestingEmbedPreview,\n\t\t\t\tgetThemeSupports,\n\t\t\t\thasFinishedResolution,\n\t\t\t} = select( coreStore );\n\t\t\tif ( ! attributesUrl ) {\n\t\t\t\treturn { fetching: false, cannotEmbed: false };\n\t\t\t}\n\n\t\t\tconst embedPreview = getEmbedPreview( attributesUrl );\n\t\t\tconst previewIsFallback = isPreviewEmbedFallback( attributesUrl );\n\n\t\t\t// The external oEmbed provider does not exist. We got no type info and no html.\n\t\t\tconst badEmbedProvider =\n\t\t\t\tembedPreview?.html === false &&\n\t\t\t\tembedPreview?.type === undefined;\n\t\t\t// Some WordPress URLs that can't be embedded will cause the API to return\n\t\t\t// a valid JSON response with no HTML and `data.status` set to 404, rather\n\t\t\t// than generating a fallback response as other embeds do.\n\t\t\tconst wordpressCantEmbed = embedPreview?.data?.status === 404;\n\t\t\tconst validPreview =\n\t\t\t\t!! embedPreview && ! badEmbedProvider && ! wordpressCantEmbed;\n\t\t\treturn {\n\t\t\t\tpreview: validPreview ? embedPreview : undefined,\n\t\t\t\tfetching: isRequestingEmbedPreview( attributesUrl ),\n\t\t\t\tthemeSupportsResponsive:\n\t\t\t\t\tgetThemeSupports()[ 'responsive-embeds' ],\n\t\t\t\tcannotEmbed: ! validPreview || previewIsFallback,\n\t\t\t\thasResolved: hasFinishedResolution( 'getEmbedPreview', [\n\t\t\t\t\tattributesUrl,\n\t\t\t\t] ),\n\t\t\t};\n\t\t},\n\t\t[ attributesUrl ]\n\t);\n\n\t/**\n\t * Returns the attributes derived from the preview, merged with the current attributes.\n\t *\n\t * @return {Object} Merged attributes.\n\t */\n\tconst getMergedAttributes = () =>\n\t\tgetMergedAttributesWithPreview(\n\t\t\tattributes,\n\t\t\tpreview,\n\t\t\ttitle,\n\t\t\tresponsive\n\t\t);\n\n\tconst toggleResponsive = () => {\n\t\tconst { allowResponsive, className } = attributes;\n\t\tconst { html } = preview;\n\t\tconst newAllowResponsive = ! allowResponsive;\n\n\t\tsetAttributes( {\n\t\t\tallowResponsive: newAllowResponsive,\n\t\t\tclassName: getClassNames(\n\t\t\t\thtml,\n\t\t\t\tclassName,\n\t\t\t\tresponsive && newAllowResponsive\n\t\t\t),\n\t\t} );\n\t};\n\n\tuseEffect( () => {\n\t\tif ( preview?.html || ! cannotEmbed || ! hasResolved ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// At this stage, we're not fetching the preview and know it can't be embedded,\n\t\t// so try removing any trailing slash, and resubmit.\n\t\tconst newURL = attributesUrl.replace( /\\/$/, '' );\n\t\tsetURL( newURL );\n\t\tsetIsEditingURL( false );\n\t\tsetAttributes( { url: newURL } );\n\t}, [\n\t\tpreview?.html,\n\t\tattributesUrl,\n\t\tcannotEmbed,\n\t\thasResolved,\n\t\tsetAttributes,\n\t] );\n\n\t// Try a different provider in case the embed url is not supported.\n\tuseEffect( () => {\n\t\tif ( ! cannotEmbed || fetching || ! url ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Until X provider is supported in WordPress, as a workaround we use Twitter provider.\n\t\tif ( getAuthority( url ) === 'x.com' ) {\n\t\t\tconst newURL = new URL( url );\n\t\t\tnewURL.host = 'twitter.com';\n\t\t\tsetAttributes( { url: newURL.toString() } );\n\t\t}\n\t}, [ url, cannotEmbed, fetching, setAttributes ] );\n\n\t// Handle incoming preview.\n\tuseEffect( () => {\n\t\tif ( preview && ! isEditingURL ) {\n\t\t\t// When obtaining an incoming preview,\n\t\t\t// we set the attributes derived from the preview data.\n\t\t\tconst mergedAttributes = getMergedAttributes();\n\t\t\tsetAttributes( mergedAttributes );\n\n\t\t\tif ( onReplace ) {\n\t\t\t\tconst upgradedBlock = createUpgradedEmbedBlock(\n\t\t\t\t\tprops,\n\t\t\t\t\tmergedAttributes\n\t\t\t\t);\n\n\t\t\t\tif ( upgradedBlock ) {\n\t\t\t\t\tonReplace( upgradedBlock );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}, [ preview, isEditingURL ] );\n\n\tconst blockProps = useBlockProps();\n\n\tif ( fetching ) {\n\t\treturn (\n\t\t\t<View { ...blockProps }>\n\t\t\t\t<EmbedLoading />\n\t\t\t</View>\n\t\t);\n\t}\n\n\t// translators: %s: type of embed e.g: \"YouTube\", \"Twitter\", etc. \"Embed\" is used when no specific type exists\n\tconst label = sprintf( __( '%s URL' ), title );\n\n\t// No preview, or we can't embed the current URL, or we've clicked the edit button.\n\tconst showEmbedPlaceholder = ! preview || cannotEmbed || isEditingURL;\n\n\tif ( showEmbedPlaceholder ) {\n\t\treturn (\n\t\t\t<View { ...blockProps }>\n\t\t\t\t<EmbedPlaceholder\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\t\tif ( event ) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// If the embed URL was changed, we need to reset the aspect ratio class.\n\t\t\t\t\t\t// To do this we have to remove the existing ratio class so it can be recalculated.\n\t\t\t\t\t\tconst blockClass = removeAspectRatioClasses(\n\t\t\t\t\t\t\tattributes.className\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tsetIsEditingURL( false );\n\t\t\t\t\t\tsetAttributes( { url, className: blockClass } );\n\t\t\t\t\t} }\n\t\t\t\t\tvalue={ url }\n\t\t\t\t\tcannotEmbed={ cannotEmbed }\n\t\t\t\t\tonChange={ ( value ) => setURL( value ) }\n\t\t\t\t\tfallback={ () => fallback( url, onReplace ) }\n\t\t\t\t\ttryAgain={ () => {\n\t\t\t\t\t\tinvalidateResolution( 'getEmbedPreview', [ url ] );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t);\n\t}\n\n\t// Even though we set attributes that get derived from the preview,\n\t// we don't access them directly because for the initial render,\n\t// the `setAttributes` call will not have taken effect. If we're\n\t// rendering responsive content, setting the responsive classes\n\t// after the preview has been rendered can result in unwanted\n\t// clipping or scrollbars. The `getAttributesFromPreview` function\n\t// that `getMergedAttributes` uses is memoized so that we're not\n\t// calculating them on every render.\n\tconst {\n\t\tcaption,\n\t\ttype,\n\t\tallowResponsive,\n\t\tclassName: classFromPreview,\n\t} = getMergedAttributes();\n\tconst className = clsx( classFromPreview, props.className );\n\n\treturn (\n\t\t<>\n\t\t\t<EmbedControls\n\t\t\t\tshowEditButton={ preview && ! cannotEmbed }\n\t\t\t\tthemeSupportsResponsive={ themeSupportsResponsive }\n\t\t\t\tblockSupportsResponsive={ responsive }\n\t\t\t\tallowResponsive={ allowResponsive }\n\t\t\t\ttoggleResponsive={ toggleResponsive }\n\t\t\t\tswitchBackToURLInput={ () => setIsEditingURL( true ) }\n\t\t\t/>\n\t\t\t<View { ...blockProps }>\n\t\t\t\t<EmbedPreview\n\t\t\t\t\tpreview={ preview }\n\t\t\t\t\tpreviewable={ previewable }\n\t\t\t\t\tclassName={ className }\n\t\t\t\t\turl={ url }\n\t\t\t\t\ttype={ type }\n\t\t\t\t\tcaption={ caption }\n\t\t\t\t\tonCaptionChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { caption: value } )\n\t\t\t\t\t}\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t/>\n\t\t\t\t<Caption\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\tlabel={ __( 'Embed caption text' ) }\n\t\t\t\t\tshowToolbarButton={ isSelected }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t</>\n\t);\n};\n\nexport default EmbedEdit;\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,wBAAwB,EACxBC,aAAa,EACbC,wBAAwB,EACxBC,QAAQ,EACRC,sBAAsB,EACtBC,8BAA8B,QACxB,QAAQ;AACf,OAAOC,aAAa,MAAM,kBAAkB;AAC5C,SAASC,gBAAgB,QAAQ,SAAS;AAC1C,OAAOC,YAAY,MAAM,iBAAiB;AAC1C,OAAOC,gBAAgB,MAAM,qBAAqB;AAClD,OAAOC,YAAY,MAAM,iBAAiB;AAC1C,SAASC,OAAO,QAAQ,kBAAkB;;AAE1C;AACA;AACA;AACA,OAAOC,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,SAASC,QAAQ,EAAEC,SAAS,QAAQ,oBAAoB;AACxD,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,aAAa,QAAQ,yBAAyB;AACvD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,IAAI,QAAQ,uBAAuB;AAC5C,SAASC,YAAY,QAAQ,gBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAE9C,MAAMC,SAAS,GAAKC,KAAK,IAAM;EAC9B,MAAM;IACLC,UAAU,EAAE;MACXC,gBAA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EAE3D,oBACC/C,KAAA,CAAAE,SAAA;IAAAuD,QAAA,gBACC3D,IAAA,CAACpB,aAAa;MACb2F,cAAc,EAAG9C,OAAO,IAAI,CAAEG,WAAa;MAC3CD,uBAAuB,EAAGA,uBAAyB;MACnD6C,uBAAuB,EAAG9D,UAAY;MACtCsC,eAAe,EAAGA,eAAiB;MACnCD,gBAAgB,EAAGA,gBAAkB;MACrC0B,oBAAoB,EAAGA,CAAA,KAAMlD,eAAe,CAAE,IAAK;IAAG,CACtD,CAAC,eACFrB,KAAA,CAACL,IAAI;MAAA,GAAM6D,UAAU;MAAAC,QAAA,gBACpB3D,IAAA,CAAChB,YAAY;QACZyC,OAAO,EAAGA,OAAS;QACnBhB,WAAW,EAAGA,WAAa;QAC3BwC,SAAS,EAAGA,SAAW;QACvBtC,GAAG,EAAGA,GAAK;QACX6B,IAAI,EAAGA,IAAM;QACb6B,OAAO,EAAGA,OAAS;QACnBK,eAAe,EAAKR,KAAK,IACxBnD,aAAa,CAAE;UAAEsD,OAAO,EAAEH;QAAM,CAAE,CAClC;QACDrD,UAAU,EAAGA,UAAY;QACzBO,IAAI,EAAGA,IAAM;QACbwC,KAAK,EAAGA,KAAO;QACf5C,iBAAiB,EAAGA;MAAmB,CACvC,CAAC,eACFhB,IAAA,CAACf,OAAO;QACPsB,UAAU,EAAGA,UAAY;QACzBQ,aAAa,EAAGA,aAAe;QAC/BF,UAAU,EAAGA,UAAY;QACzBG,iBAAiB,EAAGA,iBAAmB;QACvC4C,KAAK,EAAGzE,EAAE,CAAE,oBAAqB,CAAG;QACpCwF,iBAAiB,EAAG9D;MAAY,CAChC,CAAC;IAAA,CACG,CAAC;EAAA,CACN,CAAC;AAEL,CAAC;AAED,eAAeR,SAAS","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["createUpgradedEmbedBlock","getClassNames","removeAspectRatioClasses","fallback","getEmbedInfoByProvider","getMergedAttributesWithPreview","EmbedControls","embedContentIcon","EmbedLoading","EmbedPlaceholder","EmbedPreview","clsx","__","_x","sprintf","useState","useEffect","useDispatch","useSelect","useBlockProps","store","coreStore","View","getAuthority","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","EmbedEdit","props","attributes","providerNameSlug","previewable","responsive","url","attributesUrl","isSelected","onReplace","setAttributes","insertBlocksAfter","onFocus","defaultEmbedInfo","title","icon","setURL","isEditingURL","setIsEditingURL","invalidateResolution","preview","fetching","themeSupportsResponsive","cannotEmbed","hasResolved","select","getEmbedPreview","isPreviewEmbedFallback","isRequestingEmbedPreview","getThemeSupports","hasFinishedResolution","embedPreview","previewIsFallback","badEmbedProvider","html","type","undefined","wordpressCantEmbed","data","status","validPreview","getMergedAttributes","toggleResponsive","allowResponsive","className","newAllowResponsive","newURL","replace","URL","host","toString","mergedAttributes","upgradedBlock","blockProps","children","label","showEmbedPlaceholder","onSubmit","event","preventDefault","blockClass","value","onChange","tryAgain","caption","classFromPreview","showEditButton","blockSupportsResponsive","switchBackToURLInput","onCaptionChange"],"sources":["@wordpress/block-library/src/embed/edit.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tcreateUpgradedEmbedBlock,\n\tgetClassNames,\n\tremoveAspectRatioClasses,\n\tfallback,\n\tgetEmbedInfoByProvider,\n\tgetMergedAttributesWithPreview,\n} from './util';\nimport EmbedControls from './embed-controls';\nimport { embedContentIcon } from './icons';\nimport EmbedLoading from './embed-loading';\nimport EmbedPlaceholder from './embed-placeholder';\nimport EmbedPreview from './embed-preview';\n\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { View } from '@wordpress/primitives';\nimport { getAuthority } from '@wordpress/url';\n\nconst EmbedEdit = ( props ) => {\n\tconst {\n\t\tattributes: {\n\t\t\tproviderNameSlug,\n\t\t\tpreviewable,\n\t\t\tresponsive,\n\t\t\turl: attributesUrl,\n\t\t},\n\t\tattributes,\n\t\tisSelected,\n\t\tonReplace,\n\t\tsetAttributes,\n\t\tinsertBlocksAfter,\n\t\tonFocus,\n\t} = props;\n\n\tconst defaultEmbedInfo = {\n\t\ttitle: _x( 'Embed', 'block title' ),\n\t\ticon: embedContentIcon,\n\t};\n\tconst { icon, title } =\n\t\tgetEmbedInfoByProvider( providerNameSlug ) || defaultEmbedInfo;\n\n\tconst [ url, setURL ] = useState( attributesUrl );\n\tconst [ isEditingURL, setIsEditingURL ] = useState( false );\n\tconst { invalidateResolution } = useDispatch( coreStore );\n\n\tconst {\n\t\tpreview,\n\t\tfetching,\n\t\tthemeSupportsResponsive,\n\t\tcannotEmbed,\n\t\thasResolved,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEmbedPreview,\n\t\t\t\tisPreviewEmbedFallback,\n\t\t\t\tisRequestingEmbedPreview,\n\t\t\t\tgetThemeSupports,\n\t\t\t\thasFinishedResolution,\n\t\t\t} = select( coreStore );\n\t\t\tif ( ! attributesUrl ) {\n\t\t\t\treturn { fetching: false, cannotEmbed: false };\n\t\t\t}\n\n\t\t\tconst embedPreview = getEmbedPreview( attributesUrl );\n\t\t\tconst previewIsFallback = isPreviewEmbedFallback( attributesUrl );\n\n\t\t\t// The external oEmbed provider does not exist. We got no type info and no html.\n\t\t\tconst badEmbedProvider =\n\t\t\t\tembedPreview?.html === false &&\n\t\t\t\tembedPreview?.type === undefined;\n\t\t\t// Some WordPress URLs that can't be embedded will cause the API to return\n\t\t\t// a valid JSON response with no HTML and `data.status` set to 404, rather\n\t\t\t// than generating a fallback response as other embeds do.\n\t\t\tconst wordpressCantEmbed = embedPreview?.data?.status === 404;\n\t\t\tconst validPreview =\n\t\t\t\t!! embedPreview && ! badEmbedProvider && ! wordpressCantEmbed;\n\t\t\treturn {\n\t\t\t\tpreview: validPreview ? embedPreview : undefined,\n\t\t\t\tfetching: isRequestingEmbedPreview( attributesUrl ),\n\t\t\t\tthemeSupportsResponsive:\n\t\t\t\t\tgetThemeSupports()[ 'responsive-embeds' ],\n\t\t\t\tcannotEmbed: ! validPreview || previewIsFallback,\n\t\t\t\thasResolved: hasFinishedResolution( 'getEmbedPreview', [\n\t\t\t\t\tattributesUrl,\n\t\t\t\t] ),\n\t\t\t};\n\t\t},\n\t\t[ attributesUrl ]\n\t);\n\n\t/**\n\t * Returns the attributes derived from the preview, merged with the current attributes.\n\t *\n\t * @return {Object} Merged attributes.\n\t */\n\tconst getMergedAttributes = () =>\n\t\tgetMergedAttributesWithPreview(\n\t\t\tattributes,\n\t\t\tpreview,\n\t\t\ttitle,\n\t\t\tresponsive\n\t\t);\n\n\tconst toggleResponsive = () => {\n\t\tconst { allowResponsive, className } = attributes;\n\t\tconst { html } = preview;\n\t\tconst newAllowResponsive = ! allowResponsive;\n\n\t\tsetAttributes( {\n\t\t\tallowResponsive: newAllowResponsive,\n\t\t\tclassName: getClassNames(\n\t\t\t\thtml,\n\t\t\t\tclassName,\n\t\t\t\tresponsive && newAllowResponsive\n\t\t\t),\n\t\t} );\n\t};\n\n\tuseEffect( () => {\n\t\tif ( preview?.html || ! cannotEmbed || ! hasResolved ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// At this stage, we're not fetching the preview and know it can't be embedded,\n\t\t// so try removing any trailing slash, and resubmit.\n\t\tconst newURL = attributesUrl.replace( /\\/$/, '' );\n\t\tsetURL( newURL );\n\t\tsetIsEditingURL( false );\n\t\tsetAttributes( { url: newURL } );\n\t}, [\n\t\tpreview?.html,\n\t\tattributesUrl,\n\t\tcannotEmbed,\n\t\thasResolved,\n\t\tsetAttributes,\n\t] );\n\n\t// Try a different provider in case the embed url is not supported.\n\tuseEffect( () => {\n\t\tif ( ! cannotEmbed || fetching || ! url ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Until X provider is supported in WordPress, as a workaround we use Twitter provider.\n\t\tif ( getAuthority( url ) === 'x.com' ) {\n\t\t\tconst newURL = new URL( url );\n\t\t\tnewURL.host = 'twitter.com';\n\t\t\tsetAttributes( { url: newURL.toString() } );\n\t\t}\n\t}, [ url, cannotEmbed, fetching, setAttributes ] );\n\n\t// Handle incoming preview.\n\tuseEffect( () => {\n\t\tif ( preview && ! isEditingURL ) {\n\t\t\t// When obtaining an incoming preview,\n\t\t\t// we set the attributes derived from the preview data.\n\t\t\tconst mergedAttributes = getMergedAttributes();\n\t\t\tsetAttributes( mergedAttributes );\n\n\t\t\tif ( onReplace ) {\n\t\t\t\tconst upgradedBlock = createUpgradedEmbedBlock(\n\t\t\t\t\tprops,\n\t\t\t\t\tmergedAttributes\n\t\t\t\t);\n\n\t\t\t\tif ( upgradedBlock ) {\n\t\t\t\t\tonReplace( upgradedBlock );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}, [ preview, isEditingURL ] );\n\n\tconst blockProps = useBlockProps();\n\n\tif ( fetching ) {\n\t\treturn (\n\t\t\t<View { ...blockProps }>\n\t\t\t\t<EmbedLoading />\n\t\t\t</View>\n\t\t);\n\t}\n\n\t// translators: %s: type of embed e.g: \"YouTube\", \"Twitter\", etc. \"Embed\" is used when no specific type exists\n\tconst label = sprintf( __( '%s URL' ), title );\n\n\t// No preview, or we can't embed the current URL, or we've clicked the edit button.\n\tconst showEmbedPlaceholder = ! preview || cannotEmbed || isEditingURL;\n\n\tif ( showEmbedPlaceholder ) {\n\t\treturn (\n\t\t\t<View { ...blockProps }>\n\t\t\t\t<EmbedPlaceholder\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\t\tif ( event ) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// If the embed URL was changed, we need to reset the aspect ratio class.\n\t\t\t\t\t\t// To do this we have to remove the existing ratio class so it can be recalculated.\n\t\t\t\t\t\tconst blockClass = removeAspectRatioClasses(\n\t\t\t\t\t\t\tattributes.className\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tsetIsEditingURL( false );\n\t\t\t\t\t\tsetAttributes( { url, className: blockClass } );\n\t\t\t\t\t} }\n\t\t\t\t\tvalue={ url }\n\t\t\t\t\tcannotEmbed={ cannotEmbed }\n\t\t\t\t\tonChange={ ( value ) => setURL( value ) }\n\t\t\t\t\tfallback={ () => fallback( url, onReplace ) }\n\t\t\t\t\ttryAgain={ () => {\n\t\t\t\t\t\tinvalidateResolution( 'getEmbedPreview', [ url ] );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t);\n\t}\n\n\t// Even though we set attributes that get derived from the preview,\n\t// we don't access them directly because for the initial render,\n\t// the `setAttributes` call will not have taken effect. If we're\n\t// rendering responsive content, setting the responsive classes\n\t// after the preview has been rendered can result in unwanted\n\t// clipping or scrollbars. The `getAttributesFromPreview` function\n\t// that `getMergedAttributes` uses is memoized so that we're not\n\t// calculating them on every render.\n\tconst {\n\t\tcaption,\n\t\ttype,\n\t\tallowResponsive,\n\t\tclassName: classFromPreview,\n\t} = getMergedAttributes();\n\tconst className = clsx( classFromPreview, props.className );\n\n\treturn (\n\t\t<>\n\t\t\t<EmbedControls\n\t\t\t\tshowEditButton={ preview && ! cannotEmbed }\n\t\t\t\tthemeSupportsResponsive={ themeSupportsResponsive }\n\t\t\t\tblockSupportsResponsive={ responsive }\n\t\t\t\tallowResponsive={ allowResponsive }\n\t\t\t\ttoggleResponsive={ toggleResponsive }\n\t\t\t\tswitchBackToURLInput={ () => setIsEditingURL( true ) }\n\t\t\t/>\n\t\t\t<View { ...blockProps }>\n\t\t\t\t<EmbedPreview\n\t\t\t\t\tpreview={ preview }\n\t\t\t\t\tpreviewable={ previewable }\n\t\t\t\t\tclassName={ className }\n\t\t\t\t\turl={ url }\n\t\t\t\t\ttype={ type }\n\t\t\t\t\tcaption={ caption }\n\t\t\t\t\tonCaptionChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { caption: value } )\n\t\t\t\t\t}\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t</>\n\t);\n};\n\nexport default EmbedEdit;\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,wBAAwB,EACxBC,aAAa,EACbC,wBAAwB,EACxBC,QAAQ,EACRC,sBAAsB,EACtBC,8BAA8B,QACxB,QAAQ;AACf,OAAOC,aAAa,MAAM,kBAAkB;AAC5C,SAASC,gBAAgB,QAAQ,SAAS;AAC1C,OAAOC,YAAY,MAAM,iBAAiB;AAC1C,OAAOC,gBAAgB,MAAM,qBAAqB;AAClD,OAAOC,YAAY,MAAM,iBAAiB;;AAE1C;AACA;AACA;AACA,OAAOC,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,SAASC,QAAQ,EAAEC,SAAS,QAAQ,oBAAoB;AACxD,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,aAAa,QAAQ,yBAAyB;AACvD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,IAAI,QAAQ,uBAAuB;AAC5C,SAASC,YAAY,QAAQ,gBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAE9C,MAAMC,SAAS,GAAKC,KAAK,IAAM;EAC9B,MAAM;IACLC,UAAU,EAAE;MACXC,gBAAgB;MAChBC,WAAW;MACXC,UAAU;MACVC,GAAG,EAAEC;IACN,CAAC;IACDL,U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ACnB,aAAa;MACb0F,cAAc,EAAG9C,OAAO,IAAI,CAAEG,WAAa;MAC3CD,uBAAuB,EAAGA,uBAAyB;MACnD6C,uBAAuB,EAAG9D,UAAY;MACtCsC,eAAe,EAAGA,eAAiB;MACnCD,gBAAgB,EAAGA,gBAAkB;MACrC0B,oBAAoB,EAAGA,CAAA,KAAMlD,eAAe,CAAE,IAAK;IAAG,CACtD,CAAC,eACFvB,IAAA,CAACH,IAAI;MAAA,GAAM6D,UAAU;MAAAC,QAAA,eACpB3D,IAAA,CAACf,YAAY;QACZwC,OAAO,EAAGA,OAAS;QACnBhB,WAAW,EAAGA,WAAa;QAC3BwC,SAAS,EAAGA,SAAW;QACvBtC,GAAG,EAAGA,GAAK;QACX6B,IAAI,EAAGA,IAAM;QACb6B,OAAO,EAAGA,OAAS;QACnBK,eAAe,EAAKR,KAAK,IACxBnD,aAAa,CAAE;UAAEsD,OAAO,EAAEH;QAAM,CAAE,CAClC;QACDrD,UAAU,EAAGA,UAAY;QACzBO,IAAI,EAAGA,IAAM;QACbwC,KAAK,EAAGA,KAAO;QACf5C,iBAAiB,EAAGA,iBAAmB;QACvCT,UAAU,EAAGA,UAAY;QACzBQ,aAAa,EAAGA;MAAe,CAC/B;IAAC,CACG,CAAC;EAAA,CACN,CAAC;AAEL,CAAC;AAED,eAAeV,SAAS","ignoreList":[]}
|
|
@@ -57,17 +57,13 @@ const EmbedPlaceholder = ({
|
|
|
57
57
|
expanded: false,
|
|
58
58
|
spacing: 3,
|
|
59
59
|
justify: "flex-start",
|
|
60
|
-
children: [/*#__PURE__*/_jsx(Button
|
|
61
|
-
|
|
62
|
-
, {
|
|
63
|
-
__next40pxDefaultSize: false,
|
|
60
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
61
|
+
__next40pxDefaultSize: true,
|
|
64
62
|
variant: "secondary",
|
|
65
63
|
onClick: tryAgain,
|
|
66
64
|
children: _x('Try again', 'button label')
|
|
67
|
-
}), ' ', /*#__PURE__*/_jsx(Button
|
|
68
|
-
|
|
69
|
-
, {
|
|
70
|
-
__next40pxDefaultSize: false,
|
|
65
|
+
}), ' ', /*#__PURE__*/_jsx(Button, {
|
|
66
|
+
__next40pxDefaultSize: true,
|
|
71
67
|
variant: "secondary",
|
|
72
68
|
onClick: fallback,
|
|
73
69
|
children: _x('Convert to link', 'button label')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","_x","Button","Placeholder","ExternalLink","__experimentalHStack","HStack","__experimentalVStack","VStack","__experimentalInputControl","InputControl","BlockIcon","jsx","_jsx","jsxs","_jsxs","EmbedPlaceholder","icon","label","value","onSubmit","onChange","cannotEmbed","fallback","tryAgain","showColors","className","instructions","children","__next40pxDefaultSize","type","hideLabelFromVision","placeholder","variant","href","spacing","expanded","justify","onClick"],"sources":["@wordpress/block-library/src/embed/embed-placeholder.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tButton,\n\tPlaceholder,\n\tExternalLink,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalInputControl as InputControl,\n} from '@wordpress/components';\nimport { BlockIcon } from '@wordpress/block-editor';\n\nconst EmbedPlaceholder = ( {\n\ticon,\n\tlabel,\n\tvalue,\n\tonSubmit,\n\tonChange,\n\tcannotEmbed,\n\tfallback,\n\ttryAgain,\n} ) => {\n\treturn (\n\t\t<Placeholder\n\t\t\ticon={ <BlockIcon icon={ icon } showColors /> }\n\t\t\tlabel={ label }\n\t\t\tclassName=\"wp-block-embed\"\n\t\t\tinstructions={ __(\n\t\t\t\t'Paste a link to the content you want to display on your site.'\n\t\t\t) }\n\t\t>\n\t\t\t<form onSubmit={ onSubmit }>\n\t\t\t\t<InputControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\ttype=\"url\"\n\t\t\t\t\tvalue={ value || '' }\n\t\t\t\t\tclassName=\"wp-block-embed__placeholder-input\"\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\tplaceholder={ __( 'Enter URL to embed here…' ) }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t\t<Button __next40pxDefaultSize variant=\"primary\" type=\"submit\">\n\t\t\t\t\t{ _x( 'Embed', 'button label' ) }\n\t\t\t\t</Button>\n\t\t\t</form>\n\t\t\t<div className=\"wp-block-embed__learn-more\">\n\t\t\t\t<ExternalLink\n\t\t\t\t\thref={ __(\n\t\t\t\t\t\t'https://wordpress.org/documentation/article/embeds/'\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Learn more about embeds' ) }\n\t\t\t\t</ExternalLink>\n\t\t\t</div>\n\t\t\t{ cannotEmbed && (\n\t\t\t\t<VStack spacing={ 3 } className=\"components-placeholder__error\">\n\t\t\t\t\t<div className=\"components-placeholder__instructions\">\n\t\t\t\t\t\t{ __( 'Sorry, this content could not be embedded.' ) }\n\t\t\t\t\t</div>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\tspacing={ 3 }\n\t\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\
|
|
1
|
+
{"version":3,"names":["__","_x","Button","Placeholder","ExternalLink","__experimentalHStack","HStack","__experimentalVStack","VStack","__experimentalInputControl","InputControl","BlockIcon","jsx","_jsx","jsxs","_jsxs","EmbedPlaceholder","icon","label","value","onSubmit","onChange","cannotEmbed","fallback","tryAgain","showColors","className","instructions","children","__next40pxDefaultSize","type","hideLabelFromVision","placeholder","variant","href","spacing","expanded","justify","onClick"],"sources":["@wordpress/block-library/src/embed/embed-placeholder.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tButton,\n\tPlaceholder,\n\tExternalLink,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalInputControl as InputControl,\n} from '@wordpress/components';\nimport { BlockIcon } from '@wordpress/block-editor';\n\nconst EmbedPlaceholder = ( {\n\ticon,\n\tlabel,\n\tvalue,\n\tonSubmit,\n\tonChange,\n\tcannotEmbed,\n\tfallback,\n\ttryAgain,\n} ) => {\n\treturn (\n\t\t<Placeholder\n\t\t\ticon={ <BlockIcon icon={ icon } showColors /> }\n\t\t\tlabel={ label }\n\t\t\tclassName=\"wp-block-embed\"\n\t\t\tinstructions={ __(\n\t\t\t\t'Paste a link to the content you want to display on your site.'\n\t\t\t) }\n\t\t>\n\t\t\t<form onSubmit={ onSubmit }>\n\t\t\t\t<InputControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\ttype=\"url\"\n\t\t\t\t\tvalue={ value || '' }\n\t\t\t\t\tclassName=\"wp-block-embed__placeholder-input\"\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\tplaceholder={ __( 'Enter URL to embed here…' ) }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t\t<Button __next40pxDefaultSize variant=\"primary\" type=\"submit\">\n\t\t\t\t\t{ _x( 'Embed', 'button label' ) }\n\t\t\t\t</Button>\n\t\t\t</form>\n\t\t\t<div className=\"wp-block-embed__learn-more\">\n\t\t\t\t<ExternalLink\n\t\t\t\t\thref={ __(\n\t\t\t\t\t\t'https://wordpress.org/documentation/article/embeds/'\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Learn more about embeds' ) }\n\t\t\t\t</ExternalLink>\n\t\t\t</div>\n\t\t\t{ cannotEmbed && (\n\t\t\t\t<VStack spacing={ 3 } className=\"components-placeholder__error\">\n\t\t\t\t\t<div className=\"components-placeholder__instructions\">\n\t\t\t\t\t\t{ __( 'Sorry, this content could not be embedded.' ) }\n\t\t\t\t\t</div>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\tspacing={ 3 }\n\t\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\tonClick={ tryAgain }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ _x( 'Try again', 'button label' ) }\n\t\t\t\t\t\t</Button>{ ' ' }\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\tonClick={ fallback }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ _x( 'Convert to link', 'button label' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t) }\n\t\t</Placeholder>\n\t);\n};\n\nexport default EmbedPlaceholder;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SACCC,MAAM,EACNC,WAAW,EACXC,YAAY,EACZC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,0BAA0B,IAAIC,YAAY,QACpC,uBAAuB;AAC9B,SAASC,SAAS,QAAQ,yBAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEpD,MAAMC,gBAAgB,GAAGA,CAAE;EAC1BC,IAAI;EACJC,KAAK;EACLC,KAAK;EACLC,QAAQ;EACRC,QAAQ;EACRC,WAAW;EACXC,QAAQ;EACRC;AACD,CAAC,KAAM;EACN,oBACCT,KAAA,CAACZ,WAAW;IACXc,IAAI,eAAGJ,IAAA,CAACF,SAAS;MAACM,IAAI,EAAGA,IAAM;MAACQ,UAAU;IAAA,CAAE,CAAG;IAC/CP,KAAK,EAAGA,KAAO;IACfQ,SAAS,EAAC,gBAAgB;IAC1BC,YAAY,EAAG3B,EAAE,CAChB,+DACD,CAAG;IAAA4B,QAAA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BAAqB;UACrBI,OAAO,EAAC,WAAW;UACnBK,OAAO,EAAGf,QAAU;UAAAK,QAAA,EAElB3B,EAAE,CAAE,iBAAiB,EAAE,cAAe;QAAC,CAClC,CAAC;MAAA,CACF,CAAC;IAAA,CACF,CACR;EAAA,CACW,CAAC;AAEhB,CAAC;AAED,eAAee,gBAAgB","ignoreList":[]}
|
|
@@ -21,6 +21,7 @@ import { getAuthority } from '@wordpress/url';
|
|
|
21
21
|
* Internal dependencies
|
|
22
22
|
*/
|
|
23
23
|
import WpEmbedPreview from './wp-embed-preview';
|
|
24
|
+
import { Caption } from '../utils/caption';
|
|
24
25
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
25
26
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
26
27
|
class EmbedPreview extends Component {
|
|
@@ -60,7 +61,11 @@ class EmbedPreview extends Component {
|
|
|
60
61
|
type,
|
|
61
62
|
className,
|
|
62
63
|
icon,
|
|
63
|
-
label
|
|
64
|
+
label,
|
|
65
|
+
insertBlocksAfter,
|
|
66
|
+
attributes,
|
|
67
|
+
setAttributes,
|
|
68
|
+
isSelected
|
|
64
69
|
} = this.props;
|
|
65
70
|
const {
|
|
66
71
|
scripts
|
|
@@ -96,11 +101,11 @@ class EmbedPreview extends Component {
|
|
|
96
101
|
});
|
|
97
102
|
/* eslint-enable jsx-a11y/no-static-element-interactions */
|
|
98
103
|
|
|
99
|
-
return /*#__PURE__*/
|
|
104
|
+
return /*#__PURE__*/_jsxs("figure", {
|
|
100
105
|
className: clsx(className, 'wp-block-embed', {
|
|
101
106
|
'is-type-video': 'video' === type
|
|
102
107
|
}),
|
|
103
|
-
children: previewable ? embedWrapper : /*#__PURE__*/_jsxs(Placeholder, {
|
|
108
|
+
children: [previewable ? embedWrapper : /*#__PURE__*/_jsxs(Placeholder, {
|
|
104
109
|
icon: /*#__PURE__*/_jsx(BlockIcon, {
|
|
105
110
|
icon: icon,
|
|
106
111
|
showColors: true
|
|
@@ -117,7 +122,14 @@ class EmbedPreview extends Component {
|
|
|
117
122
|
children: sprintf( /* translators: %s: host providing embed content e.g: www.youtube.com */
|
|
118
123
|
__("Embedded content from %s can't be previewed in the editor."), embedSourceUrl)
|
|
119
124
|
})]
|
|
120
|
-
})
|
|
125
|
+
}), /*#__PURE__*/_jsx(Caption, {
|
|
126
|
+
attributes: attributes,
|
|
127
|
+
setAttributes: setAttributes,
|
|
128
|
+
isSelected: isSelected,
|
|
129
|
+
insertBlocksAfter: insertBlocksAfter,
|
|
130
|
+
label: __('Embed caption text'),
|
|
131
|
+
showToolbarButton: isSelected
|
|
132
|
+
})]
|
|
121
133
|
});
|
|
122
134
|
}
|
|
123
135
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getPhotoHtml","clsx","__","sprintf","Placeholder","SandBox","BlockIcon","Component","getAuthority","WpEmbedPreview","jsx","_jsx","jsxs","_jsxs","EmbedPreview","constructor","arguments","hideOverlay","bind","state","interactive","getDerivedStateFromProps","nextProps","isSelected","setState","render","preview","previewable","url","type","className","icon","label","props","scripts","html","embedSourceUrl","iframeTitle","sandboxClassnames","embedWrapper","children","title","onFocus","onMouseUp","showColors","href"],"sources":["@wordpress/block-library/src/embed/embed-preview.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { getPhotoHtml } from './util';\n\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Placeholder, SandBox } from '@wordpress/components';\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { Component } from '@wordpress/element';\nimport { getAuthority } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport WpEmbedPreview from './wp-embed-preview';\n\nclass EmbedPreview extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.hideOverlay = this.hideOverlay.bind( this );\n\t\tthis.state = {\n\t\t\tinteractive: false,\n\t\t};\n\t}\n\n\tstatic getDerivedStateFromProps( nextProps, state ) {\n\t\tif ( ! nextProps.isSelected && state.interactive ) {\n\t\t\t// We only want to change this when the block is not selected, because changing it when\n\t\t\t// the block becomes selected makes the overlap disappear too early. Hiding the overlay\n\t\t\t// happens on mouseup when the overlay is clicked.\n\t\t\treturn { interactive: false };\n\t\t}\n\n\t\treturn null;\n\t}\n\n\thideOverlay() {\n\t\t// This is called onMouseUp on the overlay. We can't respond to the `isSelected` prop\n\t\t// changing, because that happens on mouse down, and the overlay immediately disappears,\n\t\t// and the mouse event can end up in the preview content. We can't use onClick on\n\t\t// the overlay to hide it either, because then the editor misses the mouseup event, and\n\t\t// thinks we're multi-selecting blocks.\n\t\tthis.setState( { interactive: true } );\n\t}\n\n\trender() {\n\t\tconst {
|
|
1
|
+
{"version":3,"names":["getPhotoHtml","clsx","__","sprintf","Placeholder","SandBox","BlockIcon","Component","getAuthority","WpEmbedPreview","Caption","jsx","_jsx","jsxs","_jsxs","EmbedPreview","constructor","arguments","hideOverlay","bind","state","interactive","getDerivedStateFromProps","nextProps","isSelected","setState","render","preview","previewable","url","type","className","icon","label","insertBlocksAfter","attributes","setAttributes","props","scripts","html","embedSourceUrl","iframeTitle","sandboxClassnames","embedWrapper","children","title","onFocus","onMouseUp","showColors","href","showToolbarButton"],"sources":["@wordpress/block-library/src/embed/embed-preview.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { getPhotoHtml } from './util';\n\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Placeholder, SandBox } from '@wordpress/components';\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { Component } from '@wordpress/element';\nimport { getAuthority } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport WpEmbedPreview from './wp-embed-preview';\nimport { Caption } from '../utils/caption';\n\nclass EmbedPreview extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.hideOverlay = this.hideOverlay.bind( this );\n\t\tthis.state = {\n\t\t\tinteractive: false,\n\t\t};\n\t}\n\n\tstatic getDerivedStateFromProps( nextProps, state ) {\n\t\tif ( ! nextProps.isSelected && state.interactive ) {\n\t\t\t// We only want to change this when the block is not selected, because changing it when\n\t\t\t// the block becomes selected makes the overlap disappear too early. Hiding the overlay\n\t\t\t// happens on mouseup when the overlay is clicked.\n\t\t\treturn { interactive: false };\n\t\t}\n\n\t\treturn null;\n\t}\n\n\thideOverlay() {\n\t\t// This is called onMouseUp on the overlay. We can't respond to the `isSelected` prop\n\t\t// changing, because that happens on mouse down, and the overlay immediately disappears,\n\t\t// and the mouse event can end up in the preview content. We can't use onClick on\n\t\t// the overlay to hide it either, because then the editor misses the mouseup event, and\n\t\t// thinks we're multi-selecting blocks.\n\t\tthis.setState( { interactive: true } );\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tpreview,\n\t\t\tpreviewable,\n\t\t\turl,\n\t\t\ttype,\n\t\t\tclassName,\n\t\t\ticon,\n\t\t\tlabel,\n\t\t\tinsertBlocksAfter,\n\t\t\tattributes,\n\t\t\tsetAttributes,\n\t\t\tisSelected,\n\t\t} = this.props;\n\t\tconst { scripts } = preview;\n\t\tconst { interactive } = this.state;\n\n\t\tconst html = 'photo' === type ? getPhotoHtml( preview ) : preview.html;\n\t\tconst embedSourceUrl = getAuthority( url );\n\t\tconst iframeTitle = sprintf(\n\t\t\t// translators: %s: host providing embed content e.g: www.youtube.com\n\t\t\t__( 'Embedded content from %s' ),\n\t\t\tembedSourceUrl\n\t\t);\n\t\tconst sandboxClassnames = clsx(\n\t\t\ttype,\n\t\t\tclassName,\n\t\t\t'wp-block-embed__wrapper'\n\t\t);\n\n\t\t// Disabled because the overlay div doesn't actually have a role or functionality\n\t\t// as far as the user is concerned. We're just catching the first click so that\n\t\t// the block can be selected without interacting with the embed preview that the overlay covers.\n\t\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\t\tconst embedWrapper =\n\t\t\t'wp-embed' === type ? (\n\t\t\t\t<WpEmbedPreview html={ html } />\n\t\t\t) : (\n\t\t\t\t<div className=\"wp-block-embed__wrapper\">\n\t\t\t\t\t<SandBox\n\t\t\t\t\t\thtml={ html }\n\t\t\t\t\t\tscripts={ scripts }\n\t\t\t\t\t\ttitle={ iframeTitle }\n\t\t\t\t\t\ttype={ sandboxClassnames }\n\t\t\t\t\t\tonFocus={ this.hideOverlay }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! interactive && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"block-library-embed__interactive-overlay\"\n\t\t\t\t\t\t\tonMouseUp={ this.hideOverlay }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t);\n\t\t/* eslint-enable jsx-a11y/no-static-element-interactions */\n\n\t\treturn (\n\t\t\t<figure\n\t\t\t\tclassName={ clsx( className, 'wp-block-embed', {\n\t\t\t\t\t'is-type-video': 'video' === type,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t{ previewable ? (\n\t\t\t\t\tembedWrapper\n\t\t\t\t) : (\n\t\t\t\t\t<Placeholder\n\t\t\t\t\t\ticon={ <BlockIcon icon={ icon } showColors /> }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t>\n\t\t\t\t\t\t<p className=\"components-placeholder__error\">\n\t\t\t\t\t\t\t<a href={ url }>{ url }</a>\n\t\t\t\t\t\t</p>\n\t\t\t\t\t\t<p className=\"components-placeholder__error\">\n\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: host providing embed content e.g: www.youtube.com */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\"Embedded content from %s can't be previewed in the editor.\"\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tembedSourceUrl\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</Placeholder>\n\t\t\t\t) }\n\t\t\t\t<Caption\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\tlabel={ __( 'Embed caption text' ) }\n\t\t\t\t\tshowToolbarButton={ isSelected }\n\t\t\t\t/>\n\t\t\t</figure>\n\t\t);\n\t}\n}\n\nexport default EmbedPreview;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,QAAQ;;AAErC;AACA;AACA;AACA,OAAOC,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,WAAW,EAAEC,OAAO,QAAQ,uBAAuB;AAC5D,SAASC,SAAS,QAAQ,yBAAyB;AACnD,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,YAAY,QAAQ,gBAAgB;;AAE7C;AACA;AACA;AACA,OAAOC,cAAc,MAAM,oBAAoB;AAC/C,SAASC,OAAO,QAAQ,kBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAE3C,MAAMC,YAAY,SAASR,SAAS,CAAC;EACpCS,WAAWA,CAAA,EAAG;IACb,KAAK,CAAE,GAAGC,SAAU,CAAC;IACrB,IAAI,CAACC,WAAW,GAAG,IAAI,CAACA,WAAW,CAACC,IAAI,CAAE,IAAK,CAAC;IAChD,IAAI,CAACC,KAAK,GAAG;MACZC,WAAW,EAAE;IACd,CAAC;EACF;EAEA,OAAOC,wBAAwBA,CAAEC,SAAS,EAAEH,KAAK,EAAG;IACnD,IAAK,CAAEG,SAAS,CAACC,UAAU,IAAIJ,KAAK,CAACC,WAAW,EAAG;MAClD;MACA;MACA;MACA,OAAO;QAAEA,WAAW,EAAE;MAAM,CAAC;IAC9B;IAEA,OAAO,IAAI;EACZ;EAEAH,WAAWA,CAAA,EAAG;IACb;IACA;IACA;IACA;IACA;IACA,IAAI,CA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MACCiB,SAAS,EAAG9B,IAAI,CAAE8B,SAAS,EAAE,gBAAgB,EAAE;QAC9C,eAAe,EAAE,OAAO,KAAKD;MAC9B,CAAE,CAAG;MAAAc,QAAA,GAEHhB,WAAW,GACZe,YAAY,gBAEZ7B,KAAA,CAACV,WAAW;QACX4B,IAAI,eAAGpB,IAAA,CAACN,SAAS;UAAC0B,IAAI,EAAGA,IAAM;UAACgB,UAAU;QAAA,CAAE,CAAG;QAC/Cf,KAAK,EAAGA,KAAO;QAAAW,QAAA,gBAEfhC,IAAA;UAAGmB,SAAS,EAAC,+BAA+B;UAAAa,QAAA,eAC3ChC,IAAA;YAAGqC,IAAI,EAAGpB,GAAK;YAAAe,QAAA,EAAGf;UAAG,CAAK;QAAC,CACzB,CAAC,eACJjB,IAAA;UAAGmB,SAAS,EAAC,+BAA+B;UAAAa,QAAA,EACzCzC,OAAO,EACR;UACAD,EAAE,CACD,4DACD,CAAC,EACDsC,cACD;QAAC,CACC,CAAC;MAAA,CACQ,CACb,eACD5B,IAAA,CAACF,OAAO;QACPyB,UAAU,EAAGA,UAAY;QACzBC,aAAa,EAAGA,aAAe;QAC/BZ,UAAU,EAAGA,UAAY;QACzBU,iBAAiB,EAAGA,iBAAmB;QACvCD,KAAK,EAAG/B,EAAE,CAAE,oBAAqB,CAAG;QACpCgD,iBAAiB,EAAG1B;MAAY,CAChC,CAAC;IAAA,CACK,CAAC;EAEX;AACD;AAEA,eAAeT,YAAY","ignoreList":[]}
|
|
@@ -21,10 +21,24 @@ const transforms = {
|
|
|
21
21
|
const blobURL = createBlobURL(file);
|
|
22
22
|
|
|
23
23
|
// File will be uploaded in componentDidMount()
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
if (file.type.startsWith('video/')) {
|
|
25
|
+
blocks.push(createBlock('core/video', {
|
|
26
|
+
blob: createBlobURL(file)
|
|
27
|
+
}));
|
|
28
|
+
} else if (file.type.startsWith('image/')) {
|
|
29
|
+
blocks.push(createBlock('core/image', {
|
|
30
|
+
blob: createBlobURL(file)
|
|
31
|
+
}));
|
|
32
|
+
} else if (file.type.startsWith('audio/')) {
|
|
33
|
+
blocks.push(createBlock('core/audio', {
|
|
34
|
+
blob: createBlobURL(file)
|
|
35
|
+
}));
|
|
36
|
+
} else {
|
|
37
|
+
blocks.push(createBlock('core/file', {
|
|
38
|
+
blob: blobURL,
|
|
39
|
+
fileName: file.name
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
28
42
|
});
|
|
29
43
|
return blocks;
|
|
30
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createBlobURL","createBlock","select","store","coreStore","getFilename","transforms","from","type","isMatch","files","length","priority","transform","blocks","forEach","file","blobURL","push","blob","fileName","name","attributes","href","src","caption","textLinkHref","id","anchor","url","to","getMedia","media","mime_type","includes"],"sources":["@wordpress/block-library/src/file/transforms.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlobURL } from '@wordpress/blob';\nimport { createBlock } from '@wordpress/blocks';\nimport { select } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { getFilename } from '@wordpress/url';\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'files',\n\t\t\tisMatch( files ) {\n\t\t\t\treturn files.length > 0;\n\t\t\t},\n\t\t\t// We define a lower priorty (higher number) than the default of 10. This\n\t\t\t// ensures that the File block is only created as a fallback.\n\t\t\tpriority: 15,\n\t\t\ttransform: ( files ) => {\n\t\t\t\tconst blocks = [];\n\n\t\t\t\tfiles.forEach( ( file ) => {\n\t\t\t\t\tconst blobURL = createBlobURL( file );\n\n\t\t\t\t\t// File will be uploaded in componentDidMount()\n\t\t\t\t\tblocks.push(\n\t\t\t\t\t\tcreateBlock( 'core/file', {\n\t\t\t\t\t\t\tblob: blobURL,\n\t\t\t\t\t\t\tfileName: file.name,\n\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\t\t\t\t} );\n\n\t\t\t\treturn blocks;\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/audio' ],\n\t\t\ttransform: ( attributes ) => {\n\t\t\t\treturn createBlock( 'core/file', {\n\t\t\t\t\thref: attributes.src,\n\t\t\t\t\tfileName: attributes.caption,\n\t\t\t\t\ttextLinkHref: attributes.src,\n\t\t\t\t\tid: attributes.id,\n\t\t\t\t\tanchor: attributes.anchor,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/video' ],\n\t\t\ttransform: ( attributes ) => {\n\t\t\t\treturn createBlock( 'core/file', {\n\t\t\t\t\thref: attributes.src,\n\t\t\t\t\tfileName: attributes.caption,\n\t\t\t\t\ttextLinkHref: attributes.src,\n\t\t\t\t\tid: attributes.id,\n\t\t\t\t\tanchor: attributes.anchor,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/image' ],\n\t\t\ttransform: ( attributes ) => {\n\t\t\t\treturn createBlock( 'core/file', {\n\t\t\t\t\thref: attributes.url,\n\t\t\t\t\tfileName:\n\t\t\t\t\t\tattributes.caption || getFilename( attributes.url ),\n\t\t\t\t\ttextLinkHref: attributes.url,\n\t\t\t\t\tid: attributes.id,\n\t\t\t\t\tanchor: attributes.anchor,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t],\n\tto: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/audio' ],\n\t\t\tisMatch: ( { id } ) => {\n\t\t\t\tif ( ! id ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tconst { getMedia } = select( coreStore );\n\t\t\t\tconst media = getMedia( id );\n\t\t\t\treturn !! media && media.mime_type.includes( 'audio' );\n\t\t\t},\n\t\t\ttransform: ( attributes ) => {\n\t\t\t\treturn createBlock( 'core/audio', {\n\t\t\t\t\tsrc: attributes.href,\n\t\t\t\t\tcaption: attributes.fileName,\n\t\t\t\t\tid: attributes.id,\n\t\t\t\t\tanchor: attributes.anchor,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/video' ],\n\t\t\tisMatch: ( { id } ) => {\n\t\t\t\tif ( ! id ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tconst { getMedia } = select( coreStore );\n\t\t\t\tconst media = getMedia( id );\n\t\t\t\treturn !! media && media.mime_type.includes( 'video' );\n\t\t\t},\n\t\t\ttransform: ( attributes ) => {\n\t\t\t\treturn createBlock( 'core/video', {\n\t\t\t\t\tsrc: attributes.href,\n\t\t\t\t\tcaption: attributes.fileName,\n\t\t\t\t\tid: attributes.id,\n\t\t\t\t\tanchor: attributes.anchor,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/image' ],\n\t\t\tisMatch: ( { id } ) => {\n\t\t\t\tif ( ! id ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tconst { getMedia } = select( coreStore );\n\t\t\t\tconst media = getMedia( id );\n\t\t\t\treturn !! media && media.mime_type.includes( 'image' );\n\t\t\t},\n\t\t\ttransform: ( attributes ) => {\n\t\t\t\treturn createBlock( 'core/image', {\n\t\t\t\t\turl: attributes.href,\n\t\t\t\t\tcaption: attributes.fileName,\n\t\t\t\t\tid: attributes.id,\n\t\t\t\t\tanchor: attributes.anchor,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,WAAW,QAAQ,mBAAmB;AAC/C,SAASC,MAAM,QAAQ,iBAAiB;AACxC,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,WAAW,QAAQ,gBAAgB;AAE5C,MAAMC,UAAU,GAAG;EAClBC,IAAI,EAAE,CACL;IACCC,IAAI,EAAE,OAAO;IACbC,OAAOA,CAAEC,KAAK,EAAG;MAChB,OAAOA,KAAK,CAACC,MAAM,GAAG,CAAC;IACxB,CAAC;IACD;IACA;IACAC,QAAQ,EAAE,EAAE;IACZC,SAAS,EAAIH,KAAK,IAAM;MACvB,MAAMI,MAAM,GAAG,EAAE;MAEjBJ,KAAK,CAACK,OAAO,CAAIC,IAAI,IAAM;QAC1B,MAAMC,OAAO,GAAGjB,aAAa,CAAEgB,IAAK,CAAC;;QAErC;
|
|
1
|
+
{"version":3,"names":["createBlobURL","createBlock","select","store","coreStore","getFilename","transforms","from","type","isMatch","files","length","priority","transform","blocks","forEach","file","blobURL","startsWith","push","blob","fileName","name","attributes","href","src","caption","textLinkHref","id","anchor","url","to","getMedia","media","mime_type","includes"],"sources":["@wordpress/block-library/src/file/transforms.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlobURL } from '@wordpress/blob';\nimport { createBlock } from '@wordpress/blocks';\nimport { select } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { getFilename } from '@wordpress/url';\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'files',\n\t\t\tisMatch( files ) {\n\t\t\t\treturn files.length > 0;\n\t\t\t},\n\t\t\t// We define a lower priorty (higher number) than the default of 10. This\n\t\t\t// ensures that the File block is only created as a fallback.\n\t\t\tpriority: 15,\n\t\t\ttransform: ( files ) => {\n\t\t\t\tconst blocks = [];\n\n\t\t\t\tfiles.forEach( ( file ) => {\n\t\t\t\t\tconst blobURL = createBlobURL( file );\n\n\t\t\t\t\t// File will be uploaded in componentDidMount()\n\t\t\t\t\tif ( file.type.startsWith( 'video/' ) ) {\n\t\t\t\t\t\tblocks.push(\n\t\t\t\t\t\t\tcreateBlock( 'core/video', {\n\t\t\t\t\t\t\t\tblob: createBlobURL( file ),\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t);\n\t\t\t\t\t} else if ( file.type.startsWith( 'image/' ) ) {\n\t\t\t\t\t\tblocks.push(\n\t\t\t\t\t\t\tcreateBlock( 'core/image', {\n\t\t\t\t\t\t\t\tblob: createBlobURL( file ),\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t);\n\t\t\t\t\t} else if ( file.type.startsWith( 'audio/' ) ) {\n\t\t\t\t\t\tblocks.push(\n\t\t\t\t\t\t\tcreateBlock( 'core/audio', {\n\t\t\t\t\t\t\t\tblob: createBlobURL( file ),\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tblocks.push(\n\t\t\t\t\t\t\tcreateBlock( 'core/file', {\n\t\t\t\t\t\t\t\tblob: blobURL,\n\t\t\t\t\t\t\t\tfileName: file.name,\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\n\t\t\t\treturn blocks;\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/audio' ],\n\t\t\ttransform: ( attributes ) => {\n\t\t\t\treturn createBlock( 'core/file', {\n\t\t\t\t\thref: attributes.src,\n\t\t\t\t\tfileName: attributes.caption,\n\t\t\t\t\ttextLinkHref: attributes.src,\n\t\t\t\t\tid: attributes.id,\n\t\t\t\t\tanchor: attributes.anchor,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/video' ],\n\t\t\ttransform: ( attributes ) => {\n\t\t\t\treturn createBlock( 'core/file', {\n\t\t\t\t\thref: attributes.src,\n\t\t\t\t\tfileName: attributes.caption,\n\t\t\t\t\ttextLinkHref: attributes.src,\n\t\t\t\t\tid: attributes.id,\n\t\t\t\t\tanchor: attributes.anchor,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/image' ],\n\t\t\ttransform: ( attributes ) => {\n\t\t\t\treturn createBlock( 'core/file', {\n\t\t\t\t\thref: attributes.url,\n\t\t\t\t\tfileName:\n\t\t\t\t\t\tattributes.caption || getFilename( attributes.url ),\n\t\t\t\t\ttextLinkHref: attributes.url,\n\t\t\t\t\tid: attributes.id,\n\t\t\t\t\tanchor: attributes.anchor,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t],\n\tto: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/audio' ],\n\t\t\tisMatch: ( { id } ) => {\n\t\t\t\tif ( ! id ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tconst { getMedia } = select( coreStore );\n\t\t\t\tconst media = getMedia( id );\n\t\t\t\treturn !! media && media.mime_type.includes( 'audio' );\n\t\t\t},\n\t\t\ttransform: ( attributes ) => {\n\t\t\t\treturn createBlock( 'core/audio', {\n\t\t\t\t\tsrc: attributes.href,\n\t\t\t\t\tcaption: attributes.fileName,\n\t\t\t\t\tid: attributes.id,\n\t\t\t\t\tanchor: attributes.anchor,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/video' ],\n\t\t\tisMatch: ( { id } ) => {\n\t\t\t\tif ( ! id ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tconst { getMedia } = select( coreStore );\n\t\t\t\tconst media = getMedia( id );\n\t\t\t\treturn !! media && media.mime_type.includes( 'video' );\n\t\t\t},\n\t\t\ttransform: ( attributes ) => {\n\t\t\t\treturn createBlock( 'core/video', {\n\t\t\t\t\tsrc: attributes.href,\n\t\t\t\t\tcaption: attributes.fileName,\n\t\t\t\t\tid: attributes.id,\n\t\t\t\t\tanchor: attributes.anchor,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/image' ],\n\t\t\tisMatch: ( { id } ) => {\n\t\t\t\tif ( ! id ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tconst { getMedia } = select( coreStore );\n\t\t\t\tconst media = getMedia( id );\n\t\t\t\treturn !! media && media.mime_type.includes( 'image' );\n\t\t\t},\n\t\t\ttransform: ( attributes ) => {\n\t\t\t\treturn createBlock( 'core/image', {\n\t\t\t\t\turl: attributes.href,\n\t\t\t\t\tcaption: attributes.fileName,\n\t\t\t\t\tid: attributes.id,\n\t\t\t\t\tanchor: attributes.anchor,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,WAAW,QAAQ,mBAAmB;AAC/C,SAASC,MAAM,QAAQ,iBAAiB;AACxC,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,WAAW,QAAQ,gBAAgB;AAE5C,MAAMC,UAAU,GAAG;EAClBC,IAAI,EAAE,CACL;IACCC,IAAI,EAAE,OAAO;IACbC,OAAOA,CAAEC,KAAK,EAAG;MAChB,OAAOA,KAAK,CAACC,MAAM,GAAG,CAAC;IACxB,CAAC;IACD;IACA;IACAC,QAAQ,EAAE,EAAE;IACZC,SAAS,EAAIH,KAAK,IAAM;MACvB,MAAMI,MAAM,GAAG,EAAE;MAEjBJ,KAAK,CAACK,OAAO,CAAIC,IAAI,IAAM;QAC1B,MAAMC,OAAO,GAAGjB,aAAa,CAAEgB,IAAK,CAAC;;QAErC;QACA,IAAKA,IAAI,CAACR,IAAI,CAACU,UAAU,CAAE,QAAS,CAAC,EAAG;UACvCJ,MAAM,CAACK,IAAI,CACVlB,WAAW,CAAE,YAAY,EAAE;YAC1BmB,IAAI,EAAEpB,aAAa,CAAEgB,IAAK;UAC3B,CAAE,CACH,CAAC;QACF,CAAC,MAAM,IAAKA,IAAI,CAACR,IAAI,CAACU,UAAU,CAAE,QAAS,CAAC,EAAG;UAC9CJ,MAAM,CAACK,IA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+20,8 @@ function ModalAuxiliaryActions({
|
|
|
20
20
|
if (isMobileViewport) {
|
|
21
21
|
return null;
|
|
22
22
|
}
|
|
23
|
-
return /*#__PURE__*/_jsx(Button
|
|
24
|
-
|
|
25
|
-
, {
|
|
26
|
-
__next40pxDefaultSize: false,
|
|
23
|
+
return /*#__PURE__*/_jsx(Button, {
|
|
24
|
+
size: "small",
|
|
27
25
|
onClick: onClick,
|
|
28
26
|
icon: fullscreen,
|
|
29
27
|
isPressed: isModalFullScreen,
|
|
@@ -109,19 +107,15 @@ export default function ModalEdit(props) {
|
|
|
109
107
|
justify: "flex-end",
|
|
110
108
|
expanded: false,
|
|
111
109
|
children: [/*#__PURE__*/_jsx(FlexItem, {
|
|
112
|
-
children: /*#__PURE__*/_jsx(Button
|
|
113
|
-
|
|
114
|
-
, {
|
|
115
|
-
__next40pxDefaultSize: false,
|
|
110
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
111
|
+
__next40pxDefaultSize: true,
|
|
116
112
|
variant: "tertiary",
|
|
117
113
|
onClick: onClose,
|
|
118
114
|
children: __('Cancel')
|
|
119
115
|
})
|
|
120
116
|
}), /*#__PURE__*/_jsx(FlexItem, {
|
|
121
|
-
children: /*#__PURE__*/_jsx(Button
|
|
122
|
-
|
|
123
|
-
, {
|
|
124
|
-
__next40pxDefaultSize: false,
|
|
117
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
118
|
+
__next40pxDefaultSize: true,
|
|
125
119
|
variant: "primary",
|
|
126
120
|
onClick: () => {
|
|
127
121
|
setAttributes({
|