@wordpress/block-library 8.19.5 → 8.19.7
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/image/image.js +4 -1
- package/build/image/image.js.map +1 -1
- package/build/list-item/hooks/use-merge.js +15 -15
- package/build/list-item/hooks/use-merge.js.map +1 -1
- package/build/lock-unlock.js +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build-module/image/image.js +4 -1
- package/build-module/image/image.js.map +1 -1
- package/build-module/list-item/hooks/use-merge.js +15 -15
- package/build-module/list-item/hooks/use-merge.js.map +1 -1
- package/build-module/lock-unlock.js +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/package.json +32 -32
- package/src/image/image.js +10 -0
- package/src/image/index.php +56 -39
- package/src/list-item/hooks/use-merge.js +20 -23
- package/src/lock-unlock.js +1 -1
- package/src/pattern/index.php +0 -3
- package/src/post-navigation-link/index.php +2 -1
- package/src/search/index.php +0 -4
- package/src/template-part/index.php +4 -7
package/build/image/image.js
CHANGED
|
@@ -309,6 +309,7 @@ function Image({
|
|
|
309
309
|
const lightboxSetting = (0, _blockEditor.useSetting)('lightbox');
|
|
310
310
|
const showLightboxToggle = !!lightbox || lightboxSetting?.allowEditing === true;
|
|
311
311
|
const lightboxChecked = !!lightbox?.enabled || !lightbox && !!lightboxSetting?.enabled;
|
|
312
|
+
const lightboxToggleDisabled = linkDestination !== 'none';
|
|
312
313
|
const dimensionsControl = (0, _element.createElement)(DimensionsTool, {
|
|
313
314
|
value: {
|
|
314
315
|
width,
|
|
@@ -442,7 +443,9 @@ function Image({
|
|
|
442
443
|
enabled: newValue
|
|
443
444
|
}
|
|
444
445
|
});
|
|
445
|
-
}
|
|
446
|
+
},
|
|
447
|
+
disabled: lightboxToggleDisabled,
|
|
448
|
+
help: lightboxToggleDisabled ? (0, _i18n.__)('“Expand on click” scales the image up, and can’t be combined with a link.') : ''
|
|
446
449
|
})))), (0, _element.createElement)(_blockEditor.InspectorControls, {
|
|
447
450
|
group: "advanced"
|
|
448
451
|
}, (0, _element.createElement)(_components.TextControl, {
|
package/build/image/image.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_blob","_components","_compose","_data","_blockEditor","_i18n","_url","_blocks","_icons","_notices","_coreData","_lockUnlock","_util","_useClientWidth","_interopRequireDefault","_edit","_constants","_utils","DimensionsTool","ResolutionTool","unlock","blockEditorPrivateApis","scaleOptions","value","label","_x","help","__","Image","temporaryURL","attributes","setAttributes","isSelected","insertBlocksAfter","onReplace","onSelectImage","onSelectURL","onUploadError","containerRef","context","clientId","blockEditingMode","url","alt","caption","align","id","href","rel","linkClass","linkDestination","title","width","height","aspectRatio","scale","linkTarget","sizeSlug","lightbox","numericWidth","parseInt","undefined","numericHeight","imageRef","useRef","prevCaption","usePrevious","showCaption","setShowCaption","useState","allowResize","getBlock","useSelect","blockEditorStore","image","multiImageSelection","select","getMedia","coreStore","getMultiSelectedBlockClientIds","getBlockName","multiSelectedClientIds","length","every","_clientId","canInsertCover","imageEditing","imageSizes","maxWidth","mediaUpload","getBlockRootClientId","getSettings","canInsertBlockType","rootClientId","settings","replaceBlocks","toggleSelection","useDispatch","createErrorNotice","createSuccessNotice","noticesStore","isLargeViewport","useViewportMatch","isWideAligned","includes","loadedNaturalWidth","loadedNaturalHeight","setLoadedNaturalSize","isEditingImage","setIsEditingImage","externalBlob","setExternalBlob","clientWidth","useClientWidth","hasNonContentControls","isResizable","imageSizeOptions","filter","slug","media_details","sizes","source_url","map","name","canUploadMedia","useEffect","isExternalImage","window","fetch","then","response","blob","catch","captionRef","useCallback","node","focus","naturalWidth","naturalHeight","useMemo","current","complete","onResizeStart","onResizeStop","onImageError","embedBlock","createUpgradedEmbedBlock","onSetHref","props","onSetTitle","updateAlt","newAlt","updateImage","newSizeSlug","newUrl","uploadExternal","filesList","onFileChange","img","isBlobURL","type","allowedTypes","ALLOWED_MEDIA_TYPES","onError","message","updateAlignment","nextAlign","extraUpdatedAttributes","canEditImage","allowCrop","switchToCover","switchToBlockType","dimensionsUnitsOptions","useCustomUnits","availableUnits","lightboxSetting","useSetting","showLightboxToggle","allowEditing","lightboxChecked","enabled","dimensionsControl","createElement","onChange","newWidth","newHeight","newScale","newAspectRatio","defaultScale","defaultAspectRatio","unitsOptions","resetAll","sizeControls","InspectorControls","__experimentalToolsPanel","controls","Fragment","BlockControls","group","BlockAlignmentControl","ToolbarButton","onClick","icon","captionIcon","isPressed","__experimentalImageURLInputUI","onChangeUrl","mediaUrl","mediaLink","link","crop","overlayText","MediaReplaceFlow","mediaId","mediaURL","accept","onSelect","ToolbarGroup","upload","__experimentalToolsPanelItem","isShownByDefault","hasValue","onDeselect","TextareaControl","ExternalLink","__nextHasNoMarginBottom","options","ToggleControl","checked","newValue","TextControl","filename","getFilename","defaultedAlt","sprintf","borderProps","useBorderProps","isRounded","className","src","onLoad","event","target","ref","style","objectFit","Spinner","fallbackClientWidth","__experimentalImageEditor","onSaveImage","imageAttributes","onFinishEditing","numericRatio","evalAspectRatio","customRatio","naturalRatio","ratio","currentWidth","currentHeight","minWidth","MIN_SIZE","minHeight","maxWidthBuffer","showRightHandle","showLeftHandle","isRTL","ResizableBox","display","size","showHandle","maxHeight","lockAspectRatio","enable","top","right","bottom","left","direction","elt","offsetWidth","String","resizeRatio","RichText","isEmpty","identifier","__experimentalGetElementClassName","tagName","placeholder","inlineToolbar","__unstableOnSplitAtEnd","createBlock","getDefaultBlockName"],"sources":["@wordpress/block-library/src/image/image.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { isBlobURL } from '@wordpress/blob';\nimport {\n\tExternalLink,\n\tResizableBox,\n\tSpinner,\n\tTextareaControl,\n\tToggleControl,\n\tTextControl,\n\tToolbarButton,\n\tToolbarGroup,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUseCustomUnits as useCustomUnits,\n} from '@wordpress/components';\nimport { useViewportMatch, usePrevious } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\t__experimentalImageURLInputUI as ImageURLInputUI,\n\tMediaReplaceFlow,\n\tstore as blockEditorStore,\n\tuseSetting,\n\tBlockAlignmentControl,\n\t__experimentalImageEditor as ImageEditor,\n\t__experimentalGetElementClassName,\n\t__experimentalUseBorderProps as useBorderProps,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\tuseEffect,\n\tuseMemo,\n\tuseState,\n\tuseRef,\n\tuseCallback,\n} from '@wordpress/element';\nimport { __, _x, sprintf, isRTL } from '@wordpress/i18n';\nimport { getFilename } from '@wordpress/url';\nimport {\n\tcreateBlock,\n\tgetDefaultBlockName,\n\tswitchToBlockType,\n} from '@wordpress/blocks';\nimport {\n\tcrop,\n\toverlayText,\n\tupload,\n\tcaption as captionIcon,\n} from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\nimport { createUpgradedEmbedBlock } from '../embed/util';\nimport useClientWidth from './use-client-width';\nimport { isExternalImage } from './edit';\n\n/**\n * Module constants\n */\nimport { MIN_SIZE, ALLOWED_MEDIA_TYPES } from './constants';\nimport { evalAspectRatio } from './utils';\n\nconst { DimensionsTool, ResolutionTool } = unlock( blockEditorPrivateApis );\n\nconst scaleOptions = [\n\t{\n\t\tvalue: 'cover',\n\t\tlabel: _x( 'Cover', 'Scale option for dimensions control' ),\n\t\thelp: __( 'Image covers the space evenly.' ),\n\t},\n\t{\n\t\tvalue: 'contain',\n\t\tlabel: _x( 'Contain', 'Scale option for dimensions control' ),\n\t\thelp: __( 'Image is contained without distortion.' ),\n\t},\n];\n\nexport default function Image( {\n\ttemporaryURL,\n\tattributes,\n\tsetAttributes,\n\tisSelected,\n\tinsertBlocksAfter,\n\tonReplace,\n\tonSelectImage,\n\tonSelectURL,\n\tonUploadError,\n\tcontainerRef,\n\tcontext,\n\tclientId,\n\tblockEditingMode,\n} ) {\n\tconst {\n\t\turl = '',\n\t\talt,\n\t\tcaption,\n\t\talign,\n\t\tid,\n\t\thref,\n\t\trel,\n\t\tlinkClass,\n\t\tlinkDestination,\n\t\ttitle,\n\t\twidth,\n\t\theight,\n\t\taspectRatio,\n\t\tscale,\n\t\tlinkTarget,\n\t\tsizeSlug,\n\t\tlightbox,\n\t} = attributes;\n\n\t// The only supported unit is px, so we can parseInt to strip the px here.\n\tconst numericWidth = width ? parseInt( width, 10 ) : undefined;\n\tconst numericHeight = height ? parseInt( height, 10 ) : undefined;\n\n\tconst imageRef = useRef();\n\tconst prevCaption = usePrevious( caption );\n\tconst [ showCaption, setShowCaption ] = useState( !! caption );\n\tconst { allowResize = true } = context;\n\tconst { getBlock } = useSelect( blockEditorStore );\n\n\tconst { image, multiImageSelection } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getMedia } = select( coreStore );\n\t\t\tconst { getMultiSelectedBlockClientIds, getBlockName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst multiSelectedClientIds = getMultiSelectedBlockClientIds();\n\t\t\treturn {\n\t\t\t\timage:\n\t\t\t\t\tid && isSelected\n\t\t\t\t\t\t? getMedia( id, { context: 'view' } )\n\t\t\t\t\t\t: null,\n\t\t\t\tmultiImageSelection:\n\t\t\t\t\tmultiSelectedClientIds.length &&\n\t\t\t\t\tmultiSelectedClientIds.every(\n\t\t\t\t\t\t( _clientId ) =>\n\t\t\t\t\t\t\tgetBlockName( _clientId ) === 'core/image'\n\t\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ id, isSelected ]\n\t);\n\tconst { canInsertCover, imageEditing, imageSizes, maxWidth, mediaUpload } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetBlockRootClientId,\n\t\t\t\t\tgetSettings,\n\t\t\t\t\tcanInsertBlockType,\n\t\t\t\t} = select( blockEditorStore );\n\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\t\tconst settings = getSettings();\n\n\t\t\t\treturn {\n\t\t\t\t\timageEditing: settings.imageEditing,\n\t\t\t\t\timageSizes: settings.imageSizes,\n\t\t\t\t\tmaxWidth: settings.maxWidth,\n\t\t\t\t\tmediaUpload: settings.mediaUpload,\n\t\t\t\t\tcanInsertCover: canInsertBlockType(\n\t\t\t\t\t\t'core/cover',\n\t\t\t\t\t\trootClientId\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ clientId ]\n\t\t);\n\n\tconst { replaceBlocks, toggleSelection } = useDispatch( blockEditorStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideAligned = [ 'wide', 'full' ].includes( align );\n\tconst [\n\t\t{ loadedNaturalWidth, loadedNaturalHeight },\n\t\tsetLoadedNaturalSize,\n\t] = useState( {} );\n\tconst [ isEditingImage, setIsEditingImage ] = useState( false );\n\tconst [ externalBlob, setExternalBlob ] = useState();\n\tconst clientWidth = useClientWidth( containerRef, [ align ] );\n\tconst hasNonContentControls = blockEditingMode === 'default';\n\tconst isResizable =\n\t\tallowResize &&\n\t\thasNonContentControls &&\n\t\t! ( isWideAligned && isLargeViewport );\n\tconst imageSizeOptions = imageSizes\n\t\t.filter(\n\t\t\t( { slug } ) => image?.media_details?.sizes?.[ slug ]?.source_url\n\t\t)\n\t\t.map( ( { name, slug } ) => ( { value: slug, label: name } ) );\n\tconst canUploadMedia = !! mediaUpload;\n\n\t// If an image is externally hosted, try to fetch the image data. This may\n\t// fail if the image host doesn't allow CORS with the domain. If it works,\n\t// we can enable a button in the toolbar to upload the image.\n\tuseEffect( () => {\n\t\tif (\n\t\t\t! isExternalImage( id, url ) ||\n\t\t\t! isSelected ||\n\t\t\t! canUploadMedia\n\t\t) {\n\t\t\tsetExternalBlob();\n\t\t\treturn;\n\t\t}\n\n\t\tif ( externalBlob ) return;\n\n\t\twindow\n\t\t\t// Avoid cache, which seems to help avoid CORS problems.\n\t\t\t.fetch( url.includes( '?' ) ? url : url + '?' )\n\t\t\t.then( ( response ) => response.blob() )\n\t\t\t.then( ( blob ) => setExternalBlob( blob ) )\n\t\t\t// Do nothing, cannot upload.\n\t\t\t.catch( () => {} );\n\t}, [ id, url, isSelected, externalBlob, canUploadMedia ] );\n\n\t// We need to show the caption when changes come from\n\t// history navigation(undo/redo).\n\tuseEffect( () => {\n\t\tif ( caption && ! prevCaption ) {\n\t\t\tsetShowCaption( true );\n\t\t}\n\t}, [ caption, prevCaption ] );\n\n\t// Focus the caption when we click to add one.\n\tconst captionRef = useCallback(\n\t\t( node ) => {\n\t\t\tif ( node && ! caption ) {\n\t\t\t\tnode.focus();\n\t\t\t}\n\t\t},\n\t\t[ caption ]\n\t);\n\n\t// Get naturalWidth and naturalHeight from image ref, and fall back to loaded natural\n\t// width and height. This resolves an issue in Safari where the loaded natural\n\t// width and height is otherwise lost when switching between alignments.\n\t// See: https://github.com/WordPress/gutenberg/pull/37210.\n\tconst { naturalWidth, naturalHeight } = useMemo( () => {\n\t\treturn {\n\t\t\tnaturalWidth:\n\t\t\t\timageRef.current?.naturalWidth ||\n\t\t\t\tloadedNaturalWidth ||\n\t\t\t\tundefined,\n\t\t\tnaturalHeight:\n\t\t\t\timageRef.current?.naturalHeight ||\n\t\t\t\tloadedNaturalHeight ||\n\t\t\t\tundefined,\n\t\t};\n\t}, [\n\t\tloadedNaturalWidth,\n\t\tloadedNaturalHeight,\n\t\timageRef.current?.complete,\n\t] );\n\n\tfunction onResizeStart() {\n\t\ttoggleSelection( false );\n\t}\n\n\tfunction onResizeStop() {\n\t\ttoggleSelection( true );\n\t}\n\n\tfunction onImageError() {\n\t\t// Check if there's an embed block that handles this URL, e.g., instagram URL.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/11472\n\t\tconst embedBlock = createUpgradedEmbedBlock( { attributes: { url } } );\n\n\t\tif ( undefined !== embedBlock ) {\n\t\t\tonReplace( embedBlock );\n\t\t}\n\t}\n\n\tfunction onSetHref( props ) {\n\t\tsetAttributes( props );\n\t}\n\n\tfunction onSetTitle( value ) {\n\t\t// This is the HTML title attribute, separate from the media object\n\t\t// title.\n\t\tsetAttributes( { title: value } );\n\t}\n\n\tfunction updateAlt( newAlt ) {\n\t\tsetAttributes( { alt: newAlt } );\n\t}\n\n\tfunction updateImage( newSizeSlug ) {\n\t\tconst newUrl = image?.media_details?.sizes?.[ newSizeSlug ]?.source_url;\n\t\tif ( ! newUrl ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\turl: newUrl,\n\t\t\tsizeSlug: newSizeSlug,\n\t\t} );\n\t}\n\n\tfunction uploadExternal() {\n\t\tmediaUpload( {\n\t\t\tfilesList: [ externalBlob ],\n\t\t\tonFileChange( [ img ] ) {\n\t\t\t\tonSelectImage( img );\n\n\t\t\t\tif ( isBlobURL( img.url ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tsetExternalBlob();\n\t\t\t\tcreateSuccessNotice( __( 'Image uploaded.' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t},\n\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\tonError( message ) {\n\t\t\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t\t\t},\n\t\t} );\n\t}\n\n\tfunction updateAlignment( nextAlign ) {\n\t\tconst extraUpdatedAttributes = [ 'wide', 'full' ].includes( nextAlign )\n\t\t\t? {\n\t\t\t\t\twidth: undefined,\n\t\t\t\t\theight: undefined,\n\t\t\t\t\taspectRatio: undefined,\n\t\t\t\t\tscale: undefined,\n\t\t\t }\n\t\t\t: {};\n\t\tsetAttributes( {\n\t\t\t...extraUpdatedAttributes,\n\t\t\talign: nextAlign,\n\t\t} );\n\t}\n\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsEditingImage( false );\n\t\t\tif ( ! caption ) {\n\t\t\t\tsetShowCaption( false );\n\t\t\t}\n\t\t}\n\t}, [ isSelected, caption ] );\n\n\tconst canEditImage = id && naturalWidth && naturalHeight && imageEditing;\n\tconst allowCrop = ! multiImageSelection && canEditImage && ! isEditingImage;\n\n\tfunction switchToCover() {\n\t\treplaceBlocks(\n\t\t\tclientId,\n\t\t\tswitchToBlockType( getBlock( clientId ), 'core/cover' )\n\t\t);\n\t}\n\n\t// TODO: Can allow more units after figuring out how they should interact\n\t// with the ResizableBox and ImageEditor components. Calculations later on\n\t// for those components are currently assuming px units.\n\tconst dimensionsUnitsOptions = useCustomUnits( {\n\t\tavailableUnits: [ 'px' ],\n\t} );\n\n\tconst lightboxSetting = useSetting( 'lightbox' );\n\n\tconst showLightboxToggle =\n\t\t!! lightbox || lightboxSetting?.allowEditing === true;\n\n\tconst lightboxChecked =\n\t\t!! lightbox?.enabled || ( ! lightbox && !! lightboxSetting?.enabled );\n\n\tconst dimensionsControl = (\n\t\t<DimensionsTool\n\t\t\tvalue={ { width, height, scale, aspectRatio } }\n\t\t\tonChange={ ( {\n\t\t\t\twidth: newWidth,\n\t\t\t\theight: newHeight,\n\t\t\t\tscale: newScale,\n\t\t\t\taspectRatio: newAspectRatio,\n\t\t\t} ) => {\n\t\t\t\t// Rebuilding the object forces setting `undefined`\n\t\t\t\t// for values that are removed since setAttributes\n\t\t\t\t// doesn't do anything with keys that aren't set.\n\t\t\t\tsetAttributes( {\n\t\t\t\t\t// CSS includes `height: auto`, but we need\n\t\t\t\t\t// `width: auto` to fix the aspect ratio when\n\t\t\t\t\t// only height is set due to the width and\n\t\t\t\t\t// height attributes set via the server.\n\t\t\t\t\twidth: ! newWidth && newHeight ? 'auto' : newWidth,\n\t\t\t\t\theight: newHeight,\n\t\t\t\t\tscale: newScale,\n\t\t\t\t\taspectRatio: newAspectRatio,\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tdefaultScale=\"cover\"\n\t\t\tdefaultAspectRatio=\"auto\"\n\t\t\tscaleOptions={ scaleOptions }\n\t\t\tunitsOptions={ dimensionsUnitsOptions }\n\t\t/>\n\t);\n\n\tconst resetAll = () => {\n\t\tsetAttributes( {\n\t\t\twidth: undefined,\n\t\t\theight: undefined,\n\t\t\tscale: undefined,\n\t\t\taspectRatio: undefined,\n\t\t\tlightbox: undefined,\n\t\t} );\n\t};\n\n\tconst sizeControls = (\n\t\t<InspectorControls>\n\t\t\t<ToolsPanel label={ __( 'Settings' ) } resetAll={ resetAll }>\n\t\t\t\t{ isResizable && dimensionsControl }\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n\n\tconst controls = (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t{ hasNonContentControls && (\n\t\t\t\t\t<BlockAlignmentControl\n\t\t\t\t\t\tvalue={ align }\n\t\t\t\t\t\tonChange={ updateAlignment }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ hasNonContentControls && (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetShowCaption( ! showCaption );\n\t\t\t\t\t\t\tif ( showCaption && caption ) {\n\t\t\t\t\t\t\t\tsetAttributes( { caption: undefined } );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ticon={ captionIcon }\n\t\t\t\t\t\tisPressed={ showCaption }\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\tshowCaption\n\t\t\t\t\t\t\t\t? __( 'Remove caption' )\n\t\t\t\t\t\t\t\t: __( 'Add caption' )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! multiImageSelection && ! isEditingImage && (\n\t\t\t\t\t<ImageURLInputUI\n\t\t\t\t\t\turl={ href || '' }\n\t\t\t\t\t\tonChangeUrl={ onSetHref }\n\t\t\t\t\t\tlinkDestination={ linkDestination }\n\t\t\t\t\t\tmediaUrl={ ( image && image.source_url ) || url }\n\t\t\t\t\t\tmediaLink={ image && image.link }\n\t\t\t\t\t\tlinkTarget={ linkTarget }\n\t\t\t\t\t\tlinkClass={ linkClass }\n\t\t\t\t\t\trel={ rel }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ allowCrop && (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tonClick={ () => setIsEditingImage( true ) }\n\t\t\t\t\t\ticon={ crop }\n\t\t\t\t\t\tlabel={ __( 'Crop' ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! multiImageSelection && canInsertCover && (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ticon={ overlayText }\n\t\t\t\t\t\tlabel={ __( 'Add text over image' ) }\n\t\t\t\t\t\tonClick={ switchToCover }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BlockControls>\n\t\t\t{ ! multiImageSelection && ! isEditingImage && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\t\tmediaId={ id }\n\t\t\t\t\t\tmediaURL={ url }\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\taccept=\"image/*\"\n\t\t\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t{ ! multiImageSelection && externalBlob && (\n\t\t\t\t<BlockControls>\n\t\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tonClick={ uploadExternal }\n\t\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\t\tlabel={ __( 'Upload external image' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel label={ __( 'Settings' ) } resetAll={ resetAll }>\n\t\t\t\t\t{ ! multiImageSelection && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t\t\t\thasValue={ () => alt !== '' }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { alt: undefined } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\t\tvalue={ alt }\n\t\t\t\t\t\t\t\tonChange={ updateAlt }\n\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<ExternalLink href=\"https://www.w3.org/WAI/tutorials/images/decision-tree\">\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Describe the purpose of the image.'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t\t{ __( 'Leave empty if decorative.' ) }\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isResizable && dimensionsControl }\n\t\t\t\t\t<ResolutionTool\n\t\t\t\t\t\tvalue={ sizeSlug }\n\t\t\t\t\t\tonChange={ updateImage }\n\t\t\t\t\t\toptions={ imageSizeOptions }\n\t\t\t\t\t/>\n\t\t\t\t\t{ showLightboxToggle && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! lightbox }\n\t\t\t\t\t\t\tlabel={ __( 'Expand on Click' ) }\n\t\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( { lightbox: undefined } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Expand on Click' ) }\n\t\t\t\t\t\t\t\tchecked={ lightboxChecked }\n\t\t\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlightbox: { enabled: newValue },\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Title attribute' ) }\n\t\t\t\t\tvalue={ title || '' }\n\t\t\t\t\tonChange={ onSetTitle }\n\t\t\t\t\thelp={\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Describe the role of this image on the page.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<ExternalLink href=\"https://www.w3.org/TR/html52/dom.html#the-title-attribute\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'(Note: many devices and browsers do not display this text.)'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t</>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\tconst filename = getFilename( url );\n\tlet defaultedAlt;\n\n\tif ( alt ) {\n\t\tdefaultedAlt = alt;\n\t} else if ( filename ) {\n\t\tdefaultedAlt = sprintf(\n\t\t\t/* translators: %s: file name */\n\t\t\t__( 'This image has an empty alt attribute; its file name is %s' ),\n\t\t\tfilename\n\t\t);\n\t} else {\n\t\tdefaultedAlt = __( 'This image has an empty alt attribute' );\n\t}\n\n\tconst borderProps = useBorderProps( attributes );\n\tconst isRounded = attributes.className?.includes( 'is-style-rounded' );\n\n\tlet img = (\n\t\t// Disable reason: Image itself is not meant to be interactive, but\n\t\t// should direct focus to block.\n\t\t/* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */\n\t\t<>\n\t\t\t<img\n\t\t\t\tsrc={ temporaryURL || url }\n\t\t\t\talt={ defaultedAlt }\n\t\t\t\tonError={ () => onImageError() }\n\t\t\t\tonLoad={ ( event ) => {\n\t\t\t\t\tsetLoadedNaturalSize( {\n\t\t\t\t\t\tloadedNaturalWidth: event.target?.naturalWidth,\n\t\t\t\t\t\tloadedNaturalHeight: event.target?.naturalHeight,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tref={ imageRef }\n\t\t\t\tclassName={ borderProps.className }\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth:\n\t\t\t\t\t\t( width && height ) || aspectRatio ? '100%' : undefined,\n\t\t\t\t\theight:\n\t\t\t\t\t\t( width && height ) || aspectRatio ? '100%' : undefined,\n\t\t\t\t\tobjectFit: scale,\n\t\t\t\t\t...borderProps.style,\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t{ temporaryURL && <Spinner /> }\n\t\t</>\n\t\t/* eslint-enable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */\n\t);\n\n\t// clientWidth needs to be a number for the image Cropper to work, but sometimes it's 0\n\t// So we try using the imageRef width first and fallback to clientWidth.\n\tconst fallbackClientWidth = imageRef.current?.width || clientWidth;\n\n\tif ( canEditImage && isEditingImage ) {\n\t\timg = (\n\t\t\t<ImageEditor\n\t\t\t\tid={ id }\n\t\t\t\turl={ url }\n\t\t\t\twidth={ numericWidth }\n\t\t\t\theight={ numericHeight }\n\t\t\t\tclientWidth={ fallbackClientWidth }\n\t\t\t\tnaturalHeight={ naturalHeight }\n\t\t\t\tnaturalWidth={ naturalWidth }\n\t\t\t\tonSaveImage={ ( imageAttributes ) =>\n\t\t\t\t\tsetAttributes( imageAttributes )\n\t\t\t\t}\n\t\t\t\tonFinishEditing={ () => {\n\t\t\t\t\tsetIsEditingImage( false );\n\t\t\t\t} }\n\t\t\t\tborderProps={ isRounded ? undefined : borderProps }\n\t\t\t/>\n\t\t);\n\t} else if ( ! isResizable ) {\n\t\timg = <div style={ { width, height, aspectRatio } }>{ img }</div>;\n\t} else {\n\t\tconst numericRatio = aspectRatio && evalAspectRatio( aspectRatio );\n\t\tconst customRatio = numericWidth / numericHeight;\n\t\tconst naturalRatio = naturalWidth / naturalHeight;\n\t\tconst ratio = numericRatio || customRatio || naturalRatio || 1;\n\t\tconst currentWidth =\n\t\t\t! numericWidth && numericHeight\n\t\t\t\t? numericHeight * ratio\n\t\t\t\t: numericWidth;\n\t\tconst currentHeight =\n\t\t\t! numericHeight && numericWidth\n\t\t\t\t? numericWidth / ratio\n\t\t\t\t: numericHeight;\n\n\t\tconst minWidth =\n\t\t\tnaturalWidth < naturalHeight ? MIN_SIZE : MIN_SIZE * ratio;\n\t\tconst minHeight =\n\t\t\tnaturalHeight < naturalWidth ? MIN_SIZE : MIN_SIZE / ratio;\n\n\t\t// With the current implementation of ResizableBox, an image needs an\n\t\t// explicit pixel value for the max-width. In absence of being able to\n\t\t// set the content-width, this max-width is currently dictated by the\n\t\t// vanilla editor style. The following variable adds a buffer to this\n\t\t// vanilla style, so 3rd party themes have some wiggleroom. This does,\n\t\t// in most cases, allow you to scale the image beyond the width of the\n\t\t// main column, though not infinitely.\n\t\t// @todo It would be good to revisit this once a content-width variable\n\t\t// becomes available.\n\t\tconst maxWidthBuffer = maxWidth * 2.5;\n\n\t\tlet showRightHandle = false;\n\t\tlet showLeftHandle = false;\n\n\t\t/* eslint-disable no-lonely-if */\n\t\t// See https://github.com/WordPress/gutenberg/issues/7584.\n\t\tif ( align === 'center' ) {\n\t\t\t// When the image is centered, show both handles.\n\t\t\tshowRightHandle = true;\n\t\t\tshowLeftHandle = true;\n\t\t} else if ( isRTL() ) {\n\t\t\t// In RTL mode the image is on the right by default.\n\t\t\t// Show the right handle and hide the left handle only when it is\n\t\t\t// aligned left. Otherwise always show the left handle.\n\t\t\tif ( align === 'left' ) {\n\t\t\t\tshowRightHandle = true;\n\t\t\t} else {\n\t\t\t\tshowLeftHandle = true;\n\t\t\t}\n\t\t} else {\n\t\t\t// Show the left handle and hide the right handle only when the\n\t\t\t// image is aligned right. Otherwise always show the right handle.\n\t\t\tif ( align === 'right' ) {\n\t\t\t\tshowLeftHandle = true;\n\t\t\t} else {\n\t\t\t\tshowRightHandle = true;\n\t\t\t}\n\t\t}\n\t\t/* eslint-enable no-lonely-if */\n\n\t\timg = (\n\t\t\t<ResizableBox\n\t\t\t\tstyle={ {\n\t\t\t\t\tdisplay: 'block',\n\t\t\t\t\tobjectFit: scale,\n\t\t\t\t\taspectRatio:\n\t\t\t\t\t\t! width && ! height && aspectRatio\n\t\t\t\t\t\t\t? aspectRatio\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t} }\n\t\t\t\tsize={ {\n\t\t\t\t\twidth: currentWidth ?? 'auto',\n\t\t\t\t\theight: currentHeight ?? 'auto',\n\t\t\t\t} }\n\t\t\t\tshowHandle={ isSelected }\n\t\t\t\tminWidth={ minWidth }\n\t\t\t\tmaxWidth={ maxWidthBuffer }\n\t\t\t\tminHeight={ minHeight }\n\t\t\t\tmaxHeight={ maxWidthBuffer / ratio }\n\t\t\t\tlockAspectRatio={ ratio }\n\t\t\t\tenable={ {\n\t\t\t\t\ttop: false,\n\t\t\t\t\tright: showRightHandle,\n\t\t\t\t\tbottom: true,\n\t\t\t\t\tleft: showLeftHandle,\n\t\t\t\t} }\n\t\t\t\tonResizeStart={ onResizeStart }\n\t\t\t\tonResizeStop={ ( event, direction, elt ) => {\n\t\t\t\t\tonResizeStop();\n\t\t\t\t\t// Since the aspect ratio is locked when resizing, we can\n\t\t\t\t\t// use the width of the resized element to calculate the\n\t\t\t\t\t// height in CSS to prevent stretching when the max-width\n\t\t\t\t\t// is reached.\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: `${ elt.offsetWidth }px`,\n\t\t\t\t\t\theight: 'auto',\n\t\t\t\t\t\taspectRatio:\n\t\t\t\t\t\t\tratio === naturalRatio\n\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t: String( ratio ),\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tresizeRatio={ align === 'center' ? 2 : 1 }\n\t\t\t>\n\t\t\t\t{ img }\n\t\t\t</ResizableBox>\n\t\t);\n\t}\n\n\tif ( ! url && ! temporaryURL ) {\n\t\treturn sizeControls;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ /* Hide controls during upload to avoid component remount,\n\t\t\t\twhich causes duplicated image upload. */ }\n\t\t\t{ ! temporaryURL && controls }\n\t\t\t{ img }\n\t\t\t{ showCaption &&\n\t\t\t\t( ! RichText.isEmpty( caption ) || isSelected ) && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"caption\"\n\t\t\t\t\t\tclassName={ __experimentalGetElementClassName(\n\t\t\t\t\t\t\t'caption'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tref={ captionRef }\n\t\t\t\t\t\ttagName=\"figcaption\"\n\t\t\t\t\t\taria-label={ __( 'Image caption text' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Add caption' ) }\n\t\t\t\t\t\tvalue={ caption }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { caption: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tinlineToolbar\n\t\t\t\t\t\t__unstableOnSplitAtE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AAClL,YAAA,CAAAsR,QAAQ;IACRE,UAAU,EAAC,SAAS;IACpB9C,SAAS,EAAG,IAAA+C,8CAAiC,EAC5C,SACD,CAAG;IACH1C,GAAG,EAAG9G,UAAY;IAClByJ,OAAO,EAAC,YAAY;IACpB,cAAa,IAAAnQ,QAAE,EAAE,oBAAqB,CAAG;IACzCoQ,WAAW,EAAG,IAAApQ,QAAE,EAAE,aAAc,CAAG;IACnCJ,KAAK,EAAGqB,OAAS;IACjB2I,QAAQ,EAAKhK,KAAK,IACjBQ,aAAa,CAAE;MAAEa,OAAO,EAAErB;IAAM,CAAE,CAClC;IACDyQ,aAAa;IACbC,sBAAsB,EAAGA,CAAA,KACxBhQ,iBAAiB,CAChB,IAAAiQ,mBAAW,EAAE,IAAAC,2BAAmB,EAAC,CAAE,CACpC;EACA,CACD,CAEF,CAAC;AAEL"}
|
|
1
|
+
{"version":3,"names":["_element","require","_blob","_components","_compose","_data","_blockEditor","_i18n","_url","_blocks","_icons","_notices","_coreData","_lockUnlock","_util","_useClientWidth","_interopRequireDefault","_edit","_constants","_utils","DimensionsTool","ResolutionTool","unlock","blockEditorPrivateApis","scaleOptions","value","label","_x","help","__","Image","temporaryURL","attributes","setAttributes","isSelected","insertBlocksAfter","onReplace","onSelectImage","onSelectURL","onUploadError","containerRef","context","clientId","blockEditingMode","url","alt","caption","align","id","href","rel","linkClass","linkDestination","title","width","height","aspectRatio","scale","linkTarget","sizeSlug","lightbox","numericWidth","parseInt","undefined","numericHeight","imageRef","useRef","prevCaption","usePrevious","showCaption","setShowCaption","useState","allowResize","getBlock","useSelect","blockEditorStore","image","multiImageSelection","select","getMedia","coreStore","getMultiSelectedBlockClientIds","getBlockName","multiSelectedClientIds","length","every","_clientId","canInsertCover","imageEditing","imageSizes","maxWidth","mediaUpload","getBlockRootClientId","getSettings","canInsertBlockType","rootClientId","settings","replaceBlocks","toggleSelection","useDispatch","createErrorNotice","createSuccessNotice","noticesStore","isLargeViewport","useViewportMatch","isWideAligned","includes","loadedNaturalWidth","loadedNaturalHeight","setLoadedNaturalSize","isEditingImage","setIsEditingImage","externalBlob","setExternalBlob","clientWidth","useClientWidth","hasNonContentControls","isResizable","imageSizeOptions","filter","slug","media_details","sizes","source_url","map","name","canUploadMedia","useEffect","isExternalImage","window","fetch","then","response","blob","catch","captionRef","useCallback","node","focus","naturalWidth","naturalHeight","useMemo","current","complete","onResizeStart","onResizeStop","onImageError","embedBlock","createUpgradedEmbedBlock","onSetHref","props","onSetTitle","updateAlt","newAlt","updateImage","newSizeSlug","newUrl","uploadExternal","filesList","onFileChange","img","isBlobURL","type","allowedTypes","ALLOWED_MEDIA_TYPES","onError","message","updateAlignment","nextAlign","extraUpdatedAttributes","canEditImage","allowCrop","switchToCover","switchToBlockType","dimensionsUnitsOptions","useCustomUnits","availableUnits","lightboxSetting","useSetting","showLightboxToggle","allowEditing","lightboxChecked","enabled","lightboxToggleDisabled","dimensionsControl","createElement","onChange","newWidth","newHeight","newScale","newAspectRatio","defaultScale","defaultAspectRatio","unitsOptions","resetAll","sizeControls","InspectorControls","__experimentalToolsPanel","controls","Fragment","BlockControls","group","BlockAlignmentControl","ToolbarButton","onClick","icon","captionIcon","isPressed","__experimentalImageURLInputUI","onChangeUrl","mediaUrl","mediaLink","link","crop","overlayText","MediaReplaceFlow","mediaId","mediaURL","accept","onSelect","ToolbarGroup","upload","__experimentalToolsPanelItem","isShownByDefault","hasValue","onDeselect","TextareaControl","ExternalLink","__nextHasNoMarginBottom","options","ToggleControl","checked","newValue","disabled","TextControl","filename","getFilename","defaultedAlt","sprintf","borderProps","useBorderProps","isRounded","className","src","onLoad","event","target","ref","style","objectFit","Spinner","fallbackClientWidth","__experimentalImageEditor","onSaveImage","imageAttributes","onFinishEditing","numericRatio","evalAspectRatio","customRatio","naturalRatio","ratio","currentWidth","currentHeight","minWidth","MIN_SIZE","minHeight","maxWidthBuffer","showRightHandle","showLeftHandle","isRTL","ResizableBox","display","size","showHandle","maxHeight","lockAspectRatio","enable","top","right","bottom","left","direction","elt","offsetWidth","String","resizeRatio","RichText","isEmpty","identifier","__experimentalGetElementClassName","tagName","placeholder","inlineToolbar","__unstableOnSplitAtEnd","createBlock","getDefaultBlockName"],"sources":["@wordpress/block-library/src/image/image.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { isBlobURL } from '@wordpress/blob';\nimport {\n\tExternalLink,\n\tResizableBox,\n\tSpinner,\n\tTextareaControl,\n\tToggleControl,\n\tTextControl,\n\tToolbarButton,\n\tToolbarGroup,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUseCustomUnits as useCustomUnits,\n} from '@wordpress/components';\nimport { useViewportMatch, usePrevious } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\t__experimentalImageURLInputUI as ImageURLInputUI,\n\tMediaReplaceFlow,\n\tstore as blockEditorStore,\n\tuseSetting,\n\tBlockAlignmentControl,\n\t__experimentalImageEditor as ImageEditor,\n\t__experimentalGetElementClassName,\n\t__experimentalUseBorderProps as useBorderProps,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\tuseEffect,\n\tuseMemo,\n\tuseState,\n\tuseRef,\n\tuseCallback,\n} from '@wordpress/element';\nimport { __, _x, sprintf, isRTL } from '@wordpress/i18n';\nimport { getFilename } from '@wordpress/url';\nimport {\n\tcreateBlock,\n\tgetDefaultBlockName,\n\tswitchToBlockType,\n} from '@wordpress/blocks';\nimport {\n\tcrop,\n\toverlayText,\n\tupload,\n\tcaption as captionIcon,\n} from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\nimport { createUpgradedEmbedBlock } from '../embed/util';\nimport useClientWidth from './use-client-width';\nimport { isExternalImage } from './edit';\n\n/**\n * Module constants\n */\nimport { MIN_SIZE, ALLOWED_MEDIA_TYPES } from './constants';\nimport { evalAspectRatio } from './utils';\n\nconst { DimensionsTool, ResolutionTool } = unlock( blockEditorPrivateApis );\n\nconst scaleOptions = [\n\t{\n\t\tvalue: 'cover',\n\t\tlabel: _x( 'Cover', 'Scale option for dimensions control' ),\n\t\thelp: __( 'Image covers the space evenly.' ),\n\t},\n\t{\n\t\tvalue: 'contain',\n\t\tlabel: _x( 'Contain', 'Scale option for dimensions control' ),\n\t\thelp: __( 'Image is contained without distortion.' ),\n\t},\n];\n\nexport default function Image( {\n\ttemporaryURL,\n\tattributes,\n\tsetAttributes,\n\tisSelected,\n\tinsertBlocksAfter,\n\tonReplace,\n\tonSelectImage,\n\tonSelectURL,\n\tonUploadError,\n\tcontainerRef,\n\tcontext,\n\tclientId,\n\tblockEditingMode,\n} ) {\n\tconst {\n\t\turl = '',\n\t\talt,\n\t\tcaption,\n\t\talign,\n\t\tid,\n\t\thref,\n\t\trel,\n\t\tlinkClass,\n\t\tlinkDestination,\n\t\ttitle,\n\t\twidth,\n\t\theight,\n\t\taspectRatio,\n\t\tscale,\n\t\tlinkTarget,\n\t\tsizeSlug,\n\t\tlightbox,\n\t} = attributes;\n\n\t// The only supported unit is px, so we can parseInt to strip the px here.\n\tconst numericWidth = width ? parseInt( width, 10 ) : undefined;\n\tconst numericHeight = height ? parseInt( height, 10 ) : undefined;\n\n\tconst imageRef = useRef();\n\tconst prevCaption = usePrevious( caption );\n\tconst [ showCaption, setShowCaption ] = useState( !! caption );\n\tconst { allowResize = true } = context;\n\tconst { getBlock } = useSelect( blockEditorStore );\n\n\tconst { image, multiImageSelection } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getMedia } = select( coreStore );\n\t\t\tconst { getMultiSelectedBlockClientIds, getBlockName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst multiSelectedClientIds = getMultiSelectedBlockClientIds();\n\t\t\treturn {\n\t\t\t\timage:\n\t\t\t\t\tid && isSelected\n\t\t\t\t\t\t? getMedia( id, { context: 'view' } )\n\t\t\t\t\t\t: null,\n\t\t\t\tmultiImageSelection:\n\t\t\t\t\tmultiSelectedClientIds.length &&\n\t\t\t\t\tmultiSelectedClientIds.every(\n\t\t\t\t\t\t( _clientId ) =>\n\t\t\t\t\t\t\tgetBlockName( _clientId ) === 'core/image'\n\t\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ id, isSelected ]\n\t);\n\tconst { canInsertCover, imageEditing, imageSizes, maxWidth, mediaUpload } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetBlockRootClientId,\n\t\t\t\t\tgetSettings,\n\t\t\t\t\tcanInsertBlockType,\n\t\t\t\t} = select( blockEditorStore );\n\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\t\tconst settings = getSettings();\n\n\t\t\t\treturn {\n\t\t\t\t\timageEditing: settings.imageEditing,\n\t\t\t\t\timageSizes: settings.imageSizes,\n\t\t\t\t\tmaxWidth: settings.maxWidth,\n\t\t\t\t\tmediaUpload: settings.mediaUpload,\n\t\t\t\t\tcanInsertCover: canInsertBlockType(\n\t\t\t\t\t\t'core/cover',\n\t\t\t\t\t\trootClientId\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ clientId ]\n\t\t);\n\n\tconst { replaceBlocks, toggleSelection } = useDispatch( blockEditorStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideAligned = [ 'wide', 'full' ].includes( align );\n\tconst [\n\t\t{ loadedNaturalWidth, loadedNaturalHeight },\n\t\tsetLoadedNaturalSize,\n\t] = useState( {} );\n\tconst [ isEditingImage, setIsEditingImage ] = useState( false );\n\tconst [ externalBlob, setExternalBlob ] = useState();\n\tconst clientWidth = useClientWidth( containerRef, [ align ] );\n\tconst hasNonContentControls = blockEditingMode === 'default';\n\tconst isResizable =\n\t\tallowResize &&\n\t\thasNonContentControls &&\n\t\t! ( isWideAligned && isLargeViewport );\n\tconst imageSizeOptions = imageSizes\n\t\t.filter(\n\t\t\t( { slug } ) => image?.media_details?.sizes?.[ slug ]?.source_url\n\t\t)\n\t\t.map( ( { name, slug } ) => ( { value: slug, label: name } ) );\n\tconst canUploadMedia = !! mediaUpload;\n\n\t// If an image is externally hosted, try to fetch the image data. This may\n\t// fail if the image host doesn't allow CORS with the domain. If it works,\n\t// we can enable a button in the toolbar to upload the image.\n\tuseEffect( () => {\n\t\tif (\n\t\t\t! isExternalImage( id, url ) ||\n\t\t\t! isSelected ||\n\t\t\t! canUploadMedia\n\t\t) {\n\t\t\tsetExternalBlob();\n\t\t\treturn;\n\t\t}\n\n\t\tif ( externalBlob ) return;\n\n\t\twindow\n\t\t\t// Avoid cache, which seems to help avoid CORS problems.\n\t\t\t.fetch( url.includes( '?' ) ? url : url + '?' )\n\t\t\t.then( ( response ) => response.blob() )\n\t\t\t.then( ( blob ) => setExternalBlob( blob ) )\n\t\t\t// Do nothing, cannot upload.\n\t\t\t.catch( () => {} );\n\t}, [ id, url, isSelected, externalBlob, canUploadMedia ] );\n\n\t// We need to show the caption when changes come from\n\t// history navigation(undo/redo).\n\tuseEffect( () => {\n\t\tif ( caption && ! prevCaption ) {\n\t\t\tsetShowCaption( true );\n\t\t}\n\t}, [ caption, prevCaption ] );\n\n\t// Focus the caption when we click to add one.\n\tconst captionRef = useCallback(\n\t\t( node ) => {\n\t\t\tif ( node && ! caption ) {\n\t\t\t\tnode.focus();\n\t\t\t}\n\t\t},\n\t\t[ caption ]\n\t);\n\n\t// Get naturalWidth and naturalHeight from image ref, and fall back to loaded natural\n\t// width and height. This resolves an issue in Safari where the loaded natural\n\t// width and height is otherwise lost when switching between alignments.\n\t// See: https://github.com/WordPress/gutenberg/pull/37210.\n\tconst { naturalWidth, naturalHeight } = useMemo( () => {\n\t\treturn {\n\t\t\tnaturalWidth:\n\t\t\t\timageRef.current?.naturalWidth ||\n\t\t\t\tloadedNaturalWidth ||\n\t\t\t\tundefined,\n\t\t\tnaturalHeight:\n\t\t\t\timageRef.current?.naturalHeight ||\n\t\t\t\tloadedNaturalHeight ||\n\t\t\t\tundefined,\n\t\t};\n\t}, [\n\t\tloadedNaturalWidth,\n\t\tloadedNaturalHeight,\n\t\timageRef.current?.complete,\n\t] );\n\n\tfunction onResizeStart() {\n\t\ttoggleSelection( false );\n\t}\n\n\tfunction onResizeStop() {\n\t\ttoggleSelection( true );\n\t}\n\n\tfunction onImageError() {\n\t\t// Check if there's an embed block that handles this URL, e.g., instagram URL.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/11472\n\t\tconst embedBlock = createUpgradedEmbedBlock( { attributes: { url } } );\n\n\t\tif ( undefined !== embedBlock ) {\n\t\t\tonReplace( embedBlock );\n\t\t}\n\t}\n\n\tfunction onSetHref( props ) {\n\t\tsetAttributes( props );\n\t}\n\n\tfunction onSetTitle( value ) {\n\t\t// This is the HTML title attribute, separate from the media object\n\t\t// title.\n\t\tsetAttributes( { title: value } );\n\t}\n\n\tfunction updateAlt( newAlt ) {\n\t\tsetAttributes( { alt: newAlt } );\n\t}\n\n\tfunction updateImage( newSizeSlug ) {\n\t\tconst newUrl = image?.media_details?.sizes?.[ newSizeSlug ]?.source_url;\n\t\tif ( ! newUrl ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\turl: newUrl,\n\t\t\tsizeSlug: newSizeSlug,\n\t\t} );\n\t}\n\n\tfunction uploadExternal() {\n\t\tmediaUpload( {\n\t\t\tfilesList: [ externalBlob ],\n\t\t\tonFileChange( [ img ] ) {\n\t\t\t\tonSelectImage( img );\n\n\t\t\t\tif ( isBlobURL( img.url ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tsetExternalBlob();\n\t\t\t\tcreateSuccessNotice( __( 'Image uploaded.' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t},\n\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\tonError( message ) {\n\t\t\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t\t\t},\n\t\t} );\n\t}\n\n\tfunction updateAlignment( nextAlign ) {\n\t\tconst extraUpdatedAttributes = [ 'wide', 'full' ].includes( nextAlign )\n\t\t\t? {\n\t\t\t\t\twidth: undefined,\n\t\t\t\t\theight: undefined,\n\t\t\t\t\taspectRatio: undefined,\n\t\t\t\t\tscale: undefined,\n\t\t\t }\n\t\t\t: {};\n\t\tsetAttributes( {\n\t\t\t...extraUpdatedAttributes,\n\t\t\talign: nextAlign,\n\t\t} );\n\t}\n\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsEditingImage( false );\n\t\t\tif ( ! caption ) {\n\t\t\t\tsetShowCaption( false );\n\t\t\t}\n\t\t}\n\t}, [ isSelected, caption ] );\n\n\tconst canEditImage = id && naturalWidth && naturalHeight && imageEditing;\n\tconst allowCrop = ! multiImageSelection && canEditImage && ! isEditingImage;\n\n\tfunction switchToCover() {\n\t\treplaceBlocks(\n\t\t\tclientId,\n\t\t\tswitchToBlockType( getBlock( clientId ), 'core/cover' )\n\t\t);\n\t}\n\n\t// TODO: Can allow more units after figuring out how they should interact\n\t// with the ResizableBox and ImageEditor components. Calculations later on\n\t// for those components are currently assuming px units.\n\tconst dimensionsUnitsOptions = useCustomUnits( {\n\t\tavailableUnits: [ 'px' ],\n\t} );\n\n\tconst lightboxSetting = useSetting( 'lightbox' );\n\n\tconst showLightboxToggle =\n\t\t!! lightbox || lightboxSetting?.allowEditing === true;\n\n\tconst lightboxChecked =\n\t\t!! lightbox?.enabled || ( ! lightbox && !! lightboxSetting?.enabled );\n\n\tconst lightboxToggleDisabled = linkDestination !== 'none';\n\n\tconst dimensionsControl = (\n\t\t<DimensionsTool\n\t\t\tvalue={ { width, height, scale, aspectRatio } }\n\t\t\tonChange={ ( {\n\t\t\t\twidth: newWidth,\n\t\t\t\theight: newHeight,\n\t\t\t\tscale: newScale,\n\t\t\t\taspectRatio: newAspectRatio,\n\t\t\t} ) => {\n\t\t\t\t// Rebuilding the object forces setting `undefined`\n\t\t\t\t// for values that are removed since setAttributes\n\t\t\t\t// doesn't do anything with keys that aren't set.\n\t\t\t\tsetAttributes( {\n\t\t\t\t\t// CSS includes `height: auto`, but we need\n\t\t\t\t\t// `width: auto` to fix the aspect ratio when\n\t\t\t\t\t// only height is set due to the width and\n\t\t\t\t\t// height attributes set via the server.\n\t\t\t\t\twidth: ! newWidth && newHeight ? 'auto' : newWidth,\n\t\t\t\t\theight: newHeight,\n\t\t\t\t\tscale: newScale,\n\t\t\t\t\taspectRatio: newAspectRatio,\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tdefaultScale=\"cover\"\n\t\t\tdefaultAspectRatio=\"auto\"\n\t\t\tscaleOptions={ scaleOptions }\n\t\t\tunitsOptions={ dimensionsUnitsOptions }\n\t\t/>\n\t);\n\n\tconst resetAll = () => {\n\t\tsetAttributes( {\n\t\t\twidth: undefined,\n\t\t\theight: undefined,\n\t\t\tscale: undefined,\n\t\t\taspectRatio: undefined,\n\t\t\tlightbox: undefined,\n\t\t} );\n\t};\n\n\tconst sizeControls = (\n\t\t<InspectorControls>\n\t\t\t<ToolsPanel label={ __( 'Settings' ) } resetAll={ resetAll }>\n\t\t\t\t{ isResizable && dimensionsControl }\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n\n\tconst controls = (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t{ hasNonContentControls && (\n\t\t\t\t\t<BlockAlignmentControl\n\t\t\t\t\t\tvalue={ align }\n\t\t\t\t\t\tonChange={ updateAlignment }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ hasNonContentControls && (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetShowCaption( ! showCaption );\n\t\t\t\t\t\t\tif ( showCaption && caption ) {\n\t\t\t\t\t\t\t\tsetAttributes( { caption: undefined } );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ticon={ captionIcon }\n\t\t\t\t\t\tisPressed={ showCaption }\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\tshowCaption\n\t\t\t\t\t\t\t\t? __( 'Remove caption' )\n\t\t\t\t\t\t\t\t: __( 'Add caption' )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! multiImageSelection && ! isEditingImage && (\n\t\t\t\t\t<ImageURLInputUI\n\t\t\t\t\t\turl={ href || '' }\n\t\t\t\t\t\tonChangeUrl={ onSetHref }\n\t\t\t\t\t\tlinkDestination={ linkDestination }\n\t\t\t\t\t\tmediaUrl={ ( image && image.source_url ) || url }\n\t\t\t\t\t\tmediaLink={ image && image.link }\n\t\t\t\t\t\tlinkTarget={ linkTarget }\n\t\t\t\t\t\tlinkClass={ linkClass }\n\t\t\t\t\t\trel={ rel }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ allowCrop && (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tonClick={ () => setIsEditingImage( true ) }\n\t\t\t\t\t\ticon={ crop }\n\t\t\t\t\t\tlabel={ __( 'Crop' ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! multiImageSelection && canInsertCover && (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ticon={ overlayText }\n\t\t\t\t\t\tlabel={ __( 'Add text over image' ) }\n\t\t\t\t\t\tonClick={ switchToCover }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BlockControls>\n\t\t\t{ ! multiImageSelection && ! isEditingImage && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\t\tmediaId={ id }\n\t\t\t\t\t\tmediaURL={ url }\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\taccept=\"image/*\"\n\t\t\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t{ ! multiImageSelection && externalBlob && (\n\t\t\t\t<BlockControls>\n\t\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tonClick={ uploadExternal }\n\t\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\t\tlabel={ __( 'Upload external image' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel label={ __( 'Settings' ) } resetAll={ resetAll }>\n\t\t\t\t\t{ ! multiImageSelection && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t\t\t\thasValue={ () => alt !== '' }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { alt: undefined } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\t\tvalue={ alt }\n\t\t\t\t\t\t\t\tonChange={ updateAlt }\n\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<ExternalLink href=\"https://www.w3.org/WAI/tutorials/images/decision-tree\">\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Describe the purpose of the image.'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t\t{ __( 'Leave empty if decorative.' ) }\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isResizable && dimensionsControl }\n\t\t\t\t\t<ResolutionTool\n\t\t\t\t\t\tvalue={ sizeSlug }\n\t\t\t\t\t\tonChange={ updateImage }\n\t\t\t\t\t\toptions={ imageSizeOptions }\n\t\t\t\t\t/>\n\t\t\t\t\t{ showLightboxToggle && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! lightbox }\n\t\t\t\t\t\t\tlabel={ __( 'Expand on Click' ) }\n\t\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( { lightbox: undefined } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Expand on Click' ) }\n\t\t\t\t\t\t\t\tchecked={ lightboxChecked }\n\t\t\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlightbox: { enabled: newValue },\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tdisabled={ lightboxToggleDisabled }\n\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\tlightboxToggleDisabled\n\t\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t\t'“Expand on click” scales the image up, and can’t be combined with a link.'\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t: ''\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Title attribute' ) }\n\t\t\t\t\tvalue={ title || '' }\n\t\t\t\t\tonChange={ onSetTitle }\n\t\t\t\t\thelp={\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Describe the role of this image on the page.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<ExternalLink href=\"https://www.w3.org/TR/html52/dom.html#the-title-attribute\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'(Note: many devices and browsers do not display this text.)'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t</>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\tconst filename = getFilename( url );\n\tlet defaultedAlt;\n\n\tif ( alt ) {\n\t\tdefaultedAlt = alt;\n\t} else if ( filename ) {\n\t\tdefaultedAlt = sprintf(\n\t\t\t/* translators: %s: file name */\n\t\t\t__( 'This image has an empty alt attribute; its file name is %s' ),\n\t\t\tfilename\n\t\t);\n\t} else {\n\t\tdefaultedAlt = __( 'This image has an empty alt attribute' );\n\t}\n\n\tconst borderProps = useBorderProps( attributes );\n\tconst isRounded = attributes.className?.includes( 'is-style-rounded' );\n\n\tlet img = (\n\t\t// Disable reason: Image itself is not meant to be interactive, but\n\t\t// should direct focus to block.\n\t\t/* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */\n\t\t<>\n\t\t\t<img\n\t\t\t\tsrc={ temporaryURL || url }\n\t\t\t\talt={ defaultedAlt }\n\t\t\t\tonError={ () => onImageError() }\n\t\t\t\tonLoad={ ( event ) => {\n\t\t\t\t\tsetLoadedNaturalSize( {\n\t\t\t\t\t\tloadedNaturalWidth: event.target?.naturalWidth,\n\t\t\t\t\t\tloadedNaturalHeight: event.target?.naturalHeight,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tref={ imageRef }\n\t\t\t\tclassName={ borderProps.className }\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth:\n\t\t\t\t\t\t( width && height ) || aspectRatio ? '100%' : undefined,\n\t\t\t\t\theight:\n\t\t\t\t\t\t( width && height ) || aspectRatio ? '100%' : undefined,\n\t\t\t\t\tobjectFit: scale,\n\t\t\t\t\t...borderProps.style,\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t{ temporaryURL && <Spinner /> }\n\t\t</>\n\t\t/* eslint-enable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */\n\t);\n\n\t// clientWidth needs to be a number for the image Cropper to work, but sometimes it's 0\n\t// So we try using the imageRef width first and fallback to clientWidth.\n\tconst fallbackClientWidth = imageRef.current?.width || clientWidth;\n\n\tif ( canEditImage && isEditingImage ) {\n\t\timg = (\n\t\t\t<ImageEditor\n\t\t\t\tid={ id }\n\t\t\t\turl={ url }\n\t\t\t\twidth={ numericWidth }\n\t\t\t\theight={ numericHeight }\n\t\t\t\tclientWidth={ fallbackClientWidth }\n\t\t\t\tnaturalHeight={ naturalHeight }\n\t\t\t\tnaturalWidth={ naturalWidth }\n\t\t\t\tonSaveImage={ ( imageAttributes ) =>\n\t\t\t\t\tsetAttributes( imageAttributes )\n\t\t\t\t}\n\t\t\t\tonFinishEditing={ () => {\n\t\t\t\t\tsetIsEditingImage( false );\n\t\t\t\t} }\n\t\t\t\tborderProps={ isRounded ? undefined : borderProps }\n\t\t\t/>\n\t\t);\n\t} else if ( ! isResizable ) {\n\t\timg = <div style={ { width, height, aspectRatio } }>{ img }</div>;\n\t} else {\n\t\tconst numericRatio = aspectRatio && evalAspectRatio( aspectRatio );\n\t\tconst customRatio = numericWidth / numericHeight;\n\t\tconst naturalRatio = naturalWidth / naturalHeight;\n\t\tconst ratio = numericRatio || customRatio || naturalRatio || 1;\n\t\tconst currentWidth =\n\t\t\t! numericWidth && numericHeight\n\t\t\t\t? numericHeight * ratio\n\t\t\t\t: numericWidth;\n\t\tconst currentHeight =\n\t\t\t! numericHeight && numericWidth\n\t\t\t\t? numericWidth / ratio\n\t\t\t\t: numericHeight;\n\n\t\tconst minWidth =\n\t\t\tnaturalWidth < naturalHeight ? MIN_SIZE : MIN_SIZE * ratio;\n\t\tconst minHeight =\n\t\t\tnaturalHeight < naturalWidth ? MIN_SIZE : MIN_SIZE / ratio;\n\n\t\t// With the current implementation of ResizableBox, an image needs an\n\t\t// explicit pixel value for the max-width. In absence of being able to\n\t\t// set the content-width, this max-width is currently dictated by the\n\t\t// vanilla editor style. The following variable adds a buffer to this\n\t\t// vanilla style, so 3rd party themes have some wiggleroom. This does,\n\t\t// in most cases, allow you to scale the image beyond the width of the\n\t\t// main column, though not infinitely.\n\t\t// @todo It would be good to revisit this once a content-width variable\n\t\t// becomes available.\n\t\tconst maxWidthBuffer = maxWidth * 2.5;\n\n\t\tlet showRightHandle = false;\n\t\tlet showLeftHandle = false;\n\n\t\t/* eslint-disable no-lonely-if */\n\t\t// See https://github.com/WordPress/gutenberg/issues/7584.\n\t\tif ( align === 'center' ) {\n\t\t\t// When the image is centered, show both handles.\n\t\t\tshowRightHandle = true;\n\t\t\tshowLeftHandle = true;\n\t\t} else if ( isRTL() ) {\n\t\t\t// In RTL mode the image is on the right by default.\n\t\t\t// Show the right handle and hide the left handle only when it is\n\t\t\t// aligned left. Otherwise always show the left handle.\n\t\t\tif ( align === 'left' ) {\n\t\t\t\tshowRightHandle = true;\n\t\t\t} else {\n\t\t\t\tshowLeftHandle = true;\n\t\t\t}\n\t\t} else {\n\t\t\t// Show the left handle and hide the right handle only when the\n\t\t\t// image is aligned right. Otherwise always show the right handle.\n\t\t\tif ( align === 'right' ) {\n\t\t\t\tshowLeftHandle = true;\n\t\t\t} else {\n\t\t\t\tshowRightHandle = true;\n\t\t\t}\n\t\t}\n\t\t/* eslint-enable no-lonely-if */\n\n\t\timg = (\n\t\t\t<ResizableBox\n\t\t\t\tstyle={ {\n\t\t\t\t\tdisplay: 'block',\n\t\t\t\t\tobjectFit: scale,\n\t\t\t\t\taspectRatio:\n\t\t\t\t\t\t! width && ! height && aspectRatio\n\t\t\t\t\t\t\t? aspectRatio\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t} }\n\t\t\t\tsize={ {\n\t\t\t\t\twidth: currentWidth ?? 'auto',\n\t\t\t\t\theight: currentHeight ?? 'auto',\n\t\t\t\t} }\n\t\t\t\tshowHandle={ isSelected }\n\t\t\t\tminWidth={ minWidth }\n\t\t\t\tmaxWidth={ maxWidthBuffer }\n\t\t\t\tminHeight={ minHeight }\n\t\t\t\tmaxHeight={ maxWidthBuffer / ratio }\n\t\t\t\tlockAspectRatio={ ratio }\n\t\t\t\tenable={ {\n\t\t\t\t\ttop: false,\n\t\t\t\t\tright: showRightHandle,\n\t\t\t\t\tbottom: true,\n\t\t\t\t\tleft: showLeftHandle,\n\t\t\t\t} }\n\t\t\t\tonResizeStart={ onResizeStart }\n\t\t\t\tonResizeStop={ ( event, direction, elt ) => {\n\t\t\t\t\tonResizeStop();\n\t\t\t\t\t// Since the aspect ratio is locked when resizing, we can\n\t\t\t\t\t// use the width of the resized element to calculate the\n\t\t\t\t\t// height in CSS to prevent stretching when the max-width\n\t\t\t\t\t// is reached.\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: `${ elt.offsetWidth }px`,\n\t\t\t\t\t\theight: 'auto',\n\t\t\t\t\t\taspectRatio:\n\t\t\t\t\t\t\tratio === naturalRatio\n\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t: String( ratio ),\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tresizeRatio={ align === 'center' ? 2 : 1 }\n\t\t\t>\n\t\t\t\t{ img }\n\t\t\t</ResizableBox>\n\t\t);\n\t}\n\n\tif ( ! url && ! temporaryURL ) {\n\t\treturn sizeControls;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ /* Hide controls during upload to avoid component remount,\n\t\t\t\twhich causes duplicated image upload. */ }\n\t\t\t{ ! temporaryURL && controls }\n\t\t\t{ img }\n\t\t\t{ showCaption &&\n\t\t\t\t( ! RichText.isEmpty( caption ) || isSelected ) && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"caption\"\n\t\t\t\t\t\tclassName={ __experimentalGetElementClassName(\n\t\t\t\t\t\t\t'caption'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tref={ captionRef }\n\t\t\t\t\t\ttagName=\"figcaption\"\n\t\t\t\t\t\taria-label={ __( 'Image caption text' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Add caption' ) }\n\t\t\t\t\t\tvalue={ caption }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { caption: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tinlineToolbar\n\t\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\tcreateBlock( getDefaultBlockName() )\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAiCA,IAAAA,QAAA,GAAAC,OAAA;AA9BA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAaA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AAqBA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,IAAA,GAAAP,OAAA;AACA,IAAAQ,OAA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K,IACjBQ,aAAa,CAAE;MAAEa,OAAO,EAAErB;IAAM,CAAE,CAClC;IACD2Q,aAAa;IACbC,sBAAsB,EAAGA,CAAA,KACxBlQ,iBAAiB,CAChB,IAAAmQ,mBAAW,EAAE,IAAAC,2BAAmB,EAAC,CAAE,CACpC;EACA,CACD,CAEF,CAAC;AAEL"}
|
|
@@ -80,6 +80,19 @@ function useMerge(clientId, onMerge) {
|
|
|
80
80
|
return getBlockOrder(order[0])[0];
|
|
81
81
|
}
|
|
82
82
|
return forward => {
|
|
83
|
+
function mergeWithNested(clientIdA, clientIdB) {
|
|
84
|
+
registry.batch(() => {
|
|
85
|
+
// When merging a sub list item with a higher next list item, we
|
|
86
|
+
// also need to move any nested list items. Check if there's a
|
|
87
|
+
// listed list, and append its nested list items to the current
|
|
88
|
+
// list.
|
|
89
|
+
const [nestedListClientId] = getBlockOrder(clientIdB);
|
|
90
|
+
if (nestedListClientId) {
|
|
91
|
+
moveBlocksToPosition(getBlockOrder(nestedListClientId), nestedListClientId, getBlockRootClientId(clientIdA));
|
|
92
|
+
}
|
|
93
|
+
mergeBlocks(clientIdA, clientIdB);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
83
96
|
if (forward) {
|
|
84
97
|
const nextBlockClientId = getNextId(clientId);
|
|
85
98
|
if (!nextBlockClientId) {
|
|
@@ -89,10 +102,7 @@ function useMerge(clientId, onMerge) {
|
|
|
89
102
|
if (getParentListItemId(nextBlockClientId)) {
|
|
90
103
|
outdentListItem(nextBlockClientId);
|
|
91
104
|
} else {
|
|
92
|
-
|
|
93
|
-
moveBlocksToPosition(getBlockOrder(nextBlockClientId), nextBlockClientId, getPreviousBlockClientId(nextBlockClientId));
|
|
94
|
-
mergeBlocks(clientId, nextBlockClientId);
|
|
95
|
-
});
|
|
105
|
+
mergeWithNested(clientId, nextBlockClientId);
|
|
96
106
|
}
|
|
97
107
|
} else {
|
|
98
108
|
// Merging is only done from the top level. For lowel levels, the
|
|
@@ -102,17 +112,7 @@ function useMerge(clientId, onMerge) {
|
|
|
102
112
|
outdentListItem(clientId);
|
|
103
113
|
} else if (previousBlockClientId) {
|
|
104
114
|
const trailingId = getTrailingId(previousBlockClientId);
|
|
105
|
-
|
|
106
|
-
// When merging a list item with a previous trailing list
|
|
107
|
-
// item, we also need to move any nested list items. First,
|
|
108
|
-
// check if there's a listed list. If there's a nested list,
|
|
109
|
-
// append its nested list items to the trailing list.
|
|
110
|
-
const [nestedListClientId] = getBlockOrder(clientId);
|
|
111
|
-
if (nestedListClientId) {
|
|
112
|
-
moveBlocksToPosition(getBlockOrder(nestedListClientId), nestedListClientId, getBlockRootClientId(trailingId));
|
|
113
|
-
}
|
|
114
|
-
mergeBlocks(trailingId, clientId);
|
|
115
|
-
});
|
|
115
|
+
mergeWithNested(trailingId, clientId);
|
|
116
116
|
} else {
|
|
117
117
|
onMerge(forward);
|
|
118
118
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_blockEditor","_useOutdentListItem","_interopRequireDefault","useMerge","clientId","onMerge","registry","useRegistry","getPreviousBlockClientId","getNextBlockClientId","getBlockOrder","getBlockRootClientId","getBlockName","useSelect","blockEditorStore","mergeBlocks","moveBlocksToPosition","useDispatch","outdentListItem","useOutdentListItem","getTrailingId","id","order","length","getParentListItemId","listId","parentListItemId","_getNextId","next","getNextId","forward","
|
|
1
|
+
{"version":3,"names":["_data","require","_blockEditor","_useOutdentListItem","_interopRequireDefault","useMerge","clientId","onMerge","registry","useRegistry","getPreviousBlockClientId","getNextBlockClientId","getBlockOrder","getBlockRootClientId","getBlockName","useSelect","blockEditorStore","mergeBlocks","moveBlocksToPosition","useDispatch","outdentListItem","useOutdentListItem","getTrailingId","id","order","length","getParentListItemId","listId","parentListItemId","_getNextId","next","getNextId","forward","mergeWithNested","clientIdA","clientIdB","batch","nestedListClientId","nextBlockClientId","previousBlockClientId","trailingId"],"sources":["@wordpress/block-library/src/list-item/hooks/use-merge.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRegistry, useDispatch, useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport useOutdentListItem from './use-outdent-list-item';\n\nexport default function useMerge( clientId, onMerge ) {\n\tconst registry = useRegistry();\n\tconst {\n\t\tgetPreviousBlockClientId,\n\t\tgetNextBlockClientId,\n\t\tgetBlockOrder,\n\t\tgetBlockRootClientId,\n\t\tgetBlockName,\n\t} = useSelect( blockEditorStore );\n\tconst { mergeBlocks, moveBlocksToPosition } =\n\t\tuseDispatch( blockEditorStore );\n\tconst [ , outdentListItem ] = useOutdentListItem( clientId );\n\n\tfunction getTrailingId( id ) {\n\t\tconst order = getBlockOrder( id );\n\n\t\tif ( ! order.length ) {\n\t\t\treturn id;\n\t\t}\n\n\t\treturn getTrailingId( order[ order.length - 1 ] );\n\t}\n\n\tfunction getParentListItemId( id ) {\n\t\tconst listId = getBlockRootClientId( id );\n\t\tconst parentListItemId = getBlockRootClientId( listId );\n\t\tif ( ! parentListItemId ) return;\n\t\tif ( getBlockName( parentListItemId ) !== 'core/list-item' ) return;\n\t\treturn parentListItemId;\n\t}\n\n\t/**\n\t * Return the next list item with respect to the given list item. If none,\n\t * return the next list item of the parent list item if it exists.\n\t *\n\t * @param {string} id A list item client ID.\n\t * @return {string?} The client ID of the next list item.\n\t */\n\tfunction _getNextId( id ) {\n\t\tconst next = getNextBlockClientId( id );\n\t\tif ( next ) return next;\n\t\tconst parentListItemId = getParentListItemId( id );\n\t\tif ( ! parentListItemId ) return;\n\t\treturn _getNextId( parentListItemId );\n\t}\n\n\t/**\n\t * Given a client ID, return the client ID of the list item on the next\n\t * line, regardless of indentation level.\n\t *\n\t * @param {string} id The client ID of the current list item.\n\t * @return {string?} The client ID of the next list item.\n\t */\n\tfunction getNextId( id ) {\n\t\tconst order = getBlockOrder( id );\n\n\t\t// If the list item does not have a nested list, return the next list\n\t\t// item.\n\t\tif ( ! order.length ) {\n\t\t\treturn _getNextId( id );\n\t\t}\n\n\t\t// Get the first list item in the nested list.\n\t\treturn getBlockOrder( order[ 0 ] )[ 0 ];\n\t}\n\n\treturn ( forward ) => {\n\t\tfunction mergeWithNested( clientIdA, clientIdB ) {\n\t\t\tregistry.batch( () => {\n\t\t\t\t// When merging a sub list item with a higher next list item, we\n\t\t\t\t// also need to move any nested list items. Check if there's a\n\t\t\t\t// listed list, and append its nested list items to the current\n\t\t\t\t// list.\n\t\t\t\tconst [ nestedListClientId ] = getBlockOrder( clientIdB );\n\t\t\t\tif ( nestedListClientId ) {\n\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\tgetBlockOrder( nestedListClientId ),\n\t\t\t\t\t\tnestedListClientId,\n\t\t\t\t\t\tgetBlockRootClientId( clientIdA )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tmergeBlocks( clientIdA, clientIdB );\n\t\t\t} );\n\t\t}\n\n\t\tif ( forward ) {\n\t\t\tconst nextBlockClientId = getNextId( clientId );\n\n\t\t\tif ( ! nextBlockClientId ) {\n\t\t\t\tonMerge( forward );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( getParentListItemId( nextBlockClientId ) ) {\n\t\t\t\toutdentListItem( nextBlockClientId );\n\t\t\t} else {\n\t\t\t\tmergeWithNested( clientId, nextBlockClientId );\n\t\t\t}\n\t\t} else {\n\t\t\t// Merging is only done from the top level. For lowel levels, the\n\t\t\t// list item is outdented instead.\n\t\t\tconst previousBlockClientId = getPreviousBlockClientId( clientId );\n\t\t\tif ( getParentListItemId( clientId ) ) {\n\t\t\t\toutdentListItem( clientId );\n\t\t\t} else if ( previousBlockClientId ) {\n\t\t\t\tconst trailingId = getTrailingId( previousBlockClientId );\n\t\t\t\tmergeWithNested( trailingId, clientId );\n\t\t\t} else {\n\t\t\t\tonMerge( forward );\n\t\t\t}\n\t\t}\n\t};\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YA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CAAC;MAClE,IAAKoB,mBAAmB,CAAEpB,QAAS,CAAC,EAAG;QACtCc,eAAe,CAAEd,QAAS,CAAC;MAC5B,CAAC,MAAM,IAAKiC,qBAAqB,EAAG;QACnC,MAAMC,UAAU,GAAGlB,aAAa,CAAEiB,qBAAsB,CAAC;QACzDN,eAAe,CAAEO,UAAU,EAAElC,QAAS,CAAC;MACxC,CAAC,MAAM;QACNC,OAAO,CAAEyB,OAAQ,CAAC;MACnB;IACD;EACD,CAAC;AACF"}
|
package/build/lock-unlock.js
CHANGED
|
@@ -12,7 +12,7 @@ var _privateApis = require("@wordpress/private-apis");
|
|
|
12
12
|
const {
|
|
13
13
|
lock,
|
|
14
14
|
unlock
|
|
15
|
-
} = (0, _privateApis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my
|
|
15
|
+
} = (0, _privateApis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/block-library');
|
|
16
16
|
exports.unlock = unlock;
|
|
17
17
|
exports.lock = lock;
|
|
18
18
|
//# sourceMappingURL=lock-unlock.js.map
|
package/build/lock-unlock.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_privateApis","require","lock","unlock","__dangerousOptInToUnstableAPIsOnlyForCoreModules","exports"],"sources":["@wordpress/block-library/src/lock-unlock.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my
|
|
1
|
+
{"version":3,"names":["_privateApis","require","lock","unlock","__dangerousOptInToUnstableAPIsOnlyForCoreModules","exports"],"sources":["@wordpress/block-library/src/lock-unlock.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',\n\t\t'@wordpress/block-library'\n\t);\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGO,MAAM;EAAEC,IAAI;EAAEC;AAAO,CAAC,GAC5B,IAAAC,6DAAgD,EAC/C,iHAAiH,EACjH,0BACD,CAAC;AAACC,OAAA,CAAAF,MAAA,GAAAA,MAAA;AAAAE,OAAA,CAAAH,IAAA,GAAAA,IAAA"}
|
|
@@ -302,6 +302,7 @@ export default function Image({
|
|
|
302
302
|
const lightboxSetting = useSetting('lightbox');
|
|
303
303
|
const showLightboxToggle = !!lightbox || lightboxSetting?.allowEditing === true;
|
|
304
304
|
const lightboxChecked = !!lightbox?.enabled || !lightbox && !!lightboxSetting?.enabled;
|
|
305
|
+
const lightboxToggleDisabled = linkDestination !== 'none';
|
|
305
306
|
const dimensionsControl = createElement(DimensionsTool, {
|
|
306
307
|
value: {
|
|
307
308
|
width,
|
|
@@ -435,7 +436,9 @@ export default function Image({
|
|
|
435
436
|
enabled: newValue
|
|
436
437
|
}
|
|
437
438
|
});
|
|
438
|
-
}
|
|
439
|
+
},
|
|
440
|
+
disabled: lightboxToggleDisabled,
|
|
441
|
+
help: lightboxToggleDisabled ? __('“Expand on click” scales the image up, and can’t be combined with a link.') : ''
|
|
439
442
|
})))), createElement(InspectorControls, {
|
|
440
443
|
group: "advanced"
|
|
441
444
|
}, createElement(TextControl, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["isBlobURL","ExternalLink","ResizableBox","Spinner","TextareaControl","ToggleControl","TextControl","ToolbarButton","ToolbarGroup","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","__experimentalUseCustomUnits","useCustomUnits","useViewportMatch","usePrevious","useSelect","useDispatch","BlockControls","InspectorControls","RichText","__experimentalImageURLInputUI","ImageURLInputUI","MediaReplaceFlow","store","blockEditorStore","useSetting","BlockAlignmentControl","__experimentalImageEditor","ImageEditor","__experimentalGetElementClassName","__experimentalUseBorderProps","useBorderProps","privateApis","blockEditorPrivateApis","useEffect","useMemo","useState","useRef","useCallback","__","_x","sprintf","isRTL","getFilename","createBlock","getDefaultBlockName","switchToBlockType","crop","overlayText","upload","caption","captionIcon","noticesStore","coreStore","unlock","createUpgradedEmbedBlock","useClientWidth","isExternalImage","MIN_SIZE","ALLOWED_MEDIA_TYPES","evalAspectRatio","DimensionsTool","ResolutionTool","scaleOptions","value","label","help","Image","temporaryURL","attributes","setAttributes","isSelected","insertBlocksAfter","onReplace","onSelectImage","onSelectURL","onUploadError","containerRef","context","clientId","blockEditingMode","url","alt","align","id","href","rel","linkClass","linkDestination","title","width","height","aspectRatio","scale","linkTarget","sizeSlug","lightbox","numericWidth","parseInt","undefined","numericHeight","imageRef","prevCaption","showCaption","setShowCaption","allowResize","getBlock","image","multiImageSelection","select","getMedia","getMultiSelectedBlockClientIds","getBlockName","multiSelectedClientIds","length","every","_clientId","canInsertCover","imageEditing","imageSizes","maxWidth","mediaUpload","getBlockRootClientId","getSettings","canInsertBlockType","rootClientId","settings","replaceBlocks","toggleSelection","createErrorNotice","createSuccessNotice","isLargeViewport","isWideAligned","includes","loadedNaturalWidth","loadedNaturalHeight","setLoadedNaturalSize","isEditingImage","setIsEditingImage","externalBlob","setExternalBlob","clientWidth","hasNonContentControls","isResizable","imageSizeOptions","filter","slug","media_details","sizes","source_url","map","name","canUploadMedia","window","fetch","then","response","blob","catch","captionRef","node","focus","naturalWidth","naturalHeight","current","complete","onResizeStart","onResizeStop","onImageError","embedBlock","onSetHref","props","onSetTitle","updateAlt","newAlt","updateImage","newSizeSlug","newUrl","uploadExternal","filesList","onFileChange","img","type","allowedTypes","onError","message","updateAlignment","nextAlign","extraUpdatedAttributes","canEditImage","allowCrop","switchToCover","dimensionsUnitsOptions","availableUnits","lightboxSetting","showLightboxToggle","allowEditing","lightboxChecked","enabled","dimensionsControl","createElement","onChange","newWidth","newHeight","newScale","newAspectRatio","defaultScale","defaultAspectRatio","unitsOptions","resetAll","sizeControls","controls","Fragment","group","onClick","icon","isPressed","onChangeUrl","mediaUrl","mediaLink","link","mediaId","mediaURL","accept","onSelect","isShownByDefault","hasValue","onDeselect","__nextHasNoMarginBottom","options","checked","newValue","filename","defaultedAlt","borderProps","isRounded","className","src","onLoad","event","target","ref","style","objectFit","fallbackClientWidth","onSaveImage","imageAttributes","onFinishEditing","numericRatio","customRatio","naturalRatio","ratio","currentWidth","currentHeight","minWidth","minHeight","maxWidthBuffer","showRightHandle","showLeftHandle","display","size","showHandle","maxHeight","lockAspectRatio","enable","top","right","bottom","left","direction","elt","offsetWidth","String","resizeRatio","isEmpty","identifier","tagName","placeholder","inlineToolbar","__unstableOnSplitAtEnd"],"sources":["@wordpress/block-library/src/image/image.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { isBlobURL } from '@wordpress/blob';\nimport {\n\tExternalLink,\n\tResizableBox,\n\tSpinner,\n\tTextareaControl,\n\tToggleControl,\n\tTextControl,\n\tToolbarButton,\n\tToolbarGroup,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUseCustomUnits as useCustomUnits,\n} from '@wordpress/components';\nimport { useViewportMatch, usePrevious } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\t__experimentalImageURLInputUI as ImageURLInputUI,\n\tMediaReplaceFlow,\n\tstore as blockEditorStore,\n\tuseSetting,\n\tBlockAlignmentControl,\n\t__experimentalImageEditor as ImageEditor,\n\t__experimentalGetElementClassName,\n\t__experimentalUseBorderProps as useBorderProps,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\tuseEffect,\n\tuseMemo,\n\tuseState,\n\tuseRef,\n\tuseCallback,\n} from '@wordpress/element';\nimport { __, _x, sprintf, isRTL } from '@wordpress/i18n';\nimport { getFilename } from '@wordpress/url';\nimport {\n\tcreateBlock,\n\tgetDefaultBlockName,\n\tswitchToBlockType,\n} from '@wordpress/blocks';\nimport {\n\tcrop,\n\toverlayText,\n\tupload,\n\tcaption as captionIcon,\n} from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\nimport { createUpgradedEmbedBlock } from '../embed/util';\nimport useClientWidth from './use-client-width';\nimport { isExternalImage } from './edit';\n\n/**\n * Module constants\n */\nimport { MIN_SIZE, ALLOWED_MEDIA_TYPES } from './constants';\nimport { evalAspectRatio } from './utils';\n\nconst { DimensionsTool, ResolutionTool } = unlock( blockEditorPrivateApis );\n\nconst scaleOptions = [\n\t{\n\t\tvalue: 'cover',\n\t\tlabel: _x( 'Cover', 'Scale option for dimensions control' ),\n\t\thelp: __( 'Image covers the space evenly.' ),\n\t},\n\t{\n\t\tvalue: 'contain',\n\t\tlabel: _x( 'Contain', 'Scale option for dimensions control' ),\n\t\thelp: __( 'Image is contained without distortion.' ),\n\t},\n];\n\nexport default function Image( {\n\ttemporaryURL,\n\tattributes,\n\tsetAttributes,\n\tisSelected,\n\tinsertBlocksAfter,\n\tonReplace,\n\tonSelectImage,\n\tonSelectURL,\n\tonUploadError,\n\tcontainerRef,\n\tcontext,\n\tclientId,\n\tblockEditingMode,\n} ) {\n\tconst {\n\t\turl = '',\n\t\talt,\n\t\tcaption,\n\t\talign,\n\t\tid,\n\t\thref,\n\t\trel,\n\t\tlinkClass,\n\t\tlinkDestination,\n\t\ttitle,\n\t\twidth,\n\t\theight,\n\t\taspectRatio,\n\t\tscale,\n\t\tlinkTarget,\n\t\tsizeSlug,\n\t\tlightbox,\n\t} = attributes;\n\n\t// The only supported unit is px, so we can parseInt to strip the px here.\n\tconst numericWidth = width ? parseInt( width, 10 ) : undefined;\n\tconst numericHeight = height ? parseInt( height, 10 ) : undefined;\n\n\tconst imageRef = useRef();\n\tconst prevCaption = usePrevious( caption );\n\tconst [ showCaption, setShowCaption ] = useState( !! caption );\n\tconst { allowResize = true } = context;\n\tconst { getBlock } = useSelect( blockEditorStore );\n\n\tconst { image, multiImageSelection } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getMedia } = select( coreStore );\n\t\t\tconst { getMultiSelectedBlockClientIds, getBlockName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst multiSelectedClientIds = getMultiSelectedBlockClientIds();\n\t\t\treturn {\n\t\t\t\timage:\n\t\t\t\t\tid && isSelected\n\t\t\t\t\t\t? getMedia( id, { context: 'view' } )\n\t\t\t\t\t\t: null,\n\t\t\t\tmultiImageSelection:\n\t\t\t\t\tmultiSelectedClientIds.length &&\n\t\t\t\t\tmultiSelectedClientIds.every(\n\t\t\t\t\t\t( _clientId ) =>\n\t\t\t\t\t\t\tgetBlockName( _clientId ) === 'core/image'\n\t\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ id, isSelected ]\n\t);\n\tconst { canInsertCover, imageEditing, imageSizes, maxWidth, mediaUpload } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetBlockRootClientId,\n\t\t\t\t\tgetSettings,\n\t\t\t\t\tcanInsertBlockType,\n\t\t\t\t} = select( blockEditorStore );\n\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\t\tconst settings = getSettings();\n\n\t\t\t\treturn {\n\t\t\t\t\timageEditing: settings.imageEditing,\n\t\t\t\t\timageSizes: settings.imageSizes,\n\t\t\t\t\tmaxWidth: settings.maxWidth,\n\t\t\t\t\tmediaUpload: settings.mediaUpload,\n\t\t\t\t\tcanInsertCover: canInsertBlockType(\n\t\t\t\t\t\t'core/cover',\n\t\t\t\t\t\trootClientId\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ clientId ]\n\t\t);\n\n\tconst { replaceBlocks, toggleSelection } = useDispatch( blockEditorStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideAligned = [ 'wide', 'full' ].includes( align );\n\tconst [\n\t\t{ loadedNaturalWidth, loadedNaturalHeight },\n\t\tsetLoadedNaturalSize,\n\t] = useState( {} );\n\tconst [ isEditingImage, setIsEditingImage ] = useState( false );\n\tconst [ externalBlob, setExternalBlob ] = useState();\n\tconst clientWidth = useClientWidth( containerRef, [ align ] );\n\tconst hasNonContentControls = blockEditingMode === 'default';\n\tconst isResizable =\n\t\tallowResize &&\n\t\thasNonContentControls &&\n\t\t! ( isWideAligned && isLargeViewport );\n\tconst imageSizeOptions = imageSizes\n\t\t.filter(\n\t\t\t( { slug } ) => image?.media_details?.sizes?.[ slug ]?.source_url\n\t\t)\n\t\t.map( ( { name, slug } ) => ( { value: slug, label: name } ) );\n\tconst canUploadMedia = !! mediaUpload;\n\n\t// If an image is externally hosted, try to fetch the image data. This may\n\t// fail if the image host doesn't allow CORS with the domain. If it works,\n\t// we can enable a button in the toolbar to upload the image.\n\tuseEffect( () => {\n\t\tif (\n\t\t\t! isExternalImage( id, url ) ||\n\t\t\t! isSelected ||\n\t\t\t! canUploadMedia\n\t\t) {\n\t\t\tsetExternalBlob();\n\t\t\treturn;\n\t\t}\n\n\t\tif ( externalBlob ) return;\n\n\t\twindow\n\t\t\t// Avoid cache, which seems to help avoid CORS problems.\n\t\t\t.fetch( url.includes( '?' ) ? url : url + '?' )\n\t\t\t.then( ( response ) => response.blob() )\n\t\t\t.then( ( blob ) => setExternalBlob( blob ) )\n\t\t\t// Do nothing, cannot upload.\n\t\t\t.catch( () => {} );\n\t}, [ id, url, isSelected, externalBlob, canUploadMedia ] );\n\n\t// We need to show the caption when changes come from\n\t// history navigation(undo/redo).\n\tuseEffect( () => {\n\t\tif ( caption && ! prevCaption ) {\n\t\t\tsetShowCaption( true );\n\t\t}\n\t}, [ caption, prevCaption ] );\n\n\t// Focus the caption when we click to add one.\n\tconst captionRef = useCallback(\n\t\t( node ) => {\n\t\t\tif ( node && ! caption ) {\n\t\t\t\tnode.focus();\n\t\t\t}\n\t\t},\n\t\t[ caption ]\n\t);\n\n\t// Get naturalWidth and naturalHeight from image ref, and fall back to loaded natural\n\t// width and height. This resolves an issue in Safari where the loaded natural\n\t// width and height is otherwise lost when switching between alignments.\n\t// See: https://github.com/WordPress/gutenberg/pull/37210.\n\tconst { naturalWidth, naturalHeight } = useMemo( () => {\n\t\treturn {\n\t\t\tnaturalWidth:\n\t\t\t\timageRef.current?.naturalWidth ||\n\t\t\t\tloadedNaturalWidth ||\n\t\t\t\tundefined,\n\t\t\tnaturalHeight:\n\t\t\t\timageRef.current?.naturalHeight ||\n\t\t\t\tloadedNaturalHeight ||\n\t\t\t\tundefined,\n\t\t};\n\t}, [\n\t\tloadedNaturalWidth,\n\t\tloadedNaturalHeight,\n\t\timageRef.current?.complete,\n\t] );\n\n\tfunction onResizeStart() {\n\t\ttoggleSelection( false );\n\t}\n\n\tfunction onResizeStop() {\n\t\ttoggleSelection( true );\n\t}\n\n\tfunction onImageError() {\n\t\t// Check if there's an embed block that handles this URL, e.g., instagram URL.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/11472\n\t\tconst embedBlock = createUpgradedEmbedBlock( { attributes: { url } } );\n\n\t\tif ( undefined !== embedBlock ) {\n\t\t\tonReplace( embedBlock );\n\t\t}\n\t}\n\n\tfunction onSetHref( props ) {\n\t\tsetAttributes( props );\n\t}\n\n\tfunction onSetTitle( value ) {\n\t\t// This is the HTML title attribute, separate from the media object\n\t\t// title.\n\t\tsetAttributes( { title: value } );\n\t}\n\n\tfunction updateAlt( newAlt ) {\n\t\tsetAttributes( { alt: newAlt } );\n\t}\n\n\tfunction updateImage( newSizeSlug ) {\n\t\tconst newUrl = image?.media_details?.sizes?.[ newSizeSlug ]?.source_url;\n\t\tif ( ! newUrl ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\turl: newUrl,\n\t\t\tsizeSlug: newSizeSlug,\n\t\t} );\n\t}\n\n\tfunction uploadExternal() {\n\t\tmediaUpload( {\n\t\t\tfilesList: [ externalBlob ],\n\t\t\tonFileChange( [ img ] ) {\n\t\t\t\tonSelectImage( img );\n\n\t\t\t\tif ( isBlobURL( img.url ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tsetExternalBlob();\n\t\t\t\tcreateSuccessNotice( __( 'Image uploaded.' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t},\n\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\tonError( message ) {\n\t\t\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t\t\t},\n\t\t} );\n\t}\n\n\tfunction updateAlignment( nextAlign ) {\n\t\tconst extraUpdatedAttributes = [ 'wide', 'full' ].includes( nextAlign )\n\t\t\t? {\n\t\t\t\t\twidth: undefined,\n\t\t\t\t\theight: undefined,\n\t\t\t\t\taspectRatio: undefined,\n\t\t\t\t\tscale: undefined,\n\t\t\t }\n\t\t\t: {};\n\t\tsetAttributes( {\n\t\t\t...extraUpdatedAttributes,\n\t\t\talign: nextAlign,\n\t\t} );\n\t}\n\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsEditingImage( false );\n\t\t\tif ( ! caption ) {\n\t\t\t\tsetShowCaption( false );\n\t\t\t}\n\t\t}\n\t}, [ isSelected, caption ] );\n\n\tconst canEditImage = id && naturalWidth && naturalHeight && imageEditing;\n\tconst allowCrop = ! multiImageSelection && canEditImage && ! isEditingImage;\n\n\tfunction switchToCover() {\n\t\treplaceBlocks(\n\t\t\tclientId,\n\t\t\tswitchToBlockType( getBlock( clientId ), 'core/cover' )\n\t\t);\n\t}\n\n\t// TODO: Can allow more units after figuring out how they should interact\n\t// with the ResizableBox and ImageEditor components. Calculations later on\n\t// for those components are currently assuming px units.\n\tconst dimensionsUnitsOptions = useCustomUnits( {\n\t\tavailableUnits: [ 'px' ],\n\t} );\n\n\tconst lightboxSetting = useSetting( 'lightbox' );\n\n\tconst showLightboxToggle =\n\t\t!! lightbox || lightboxSetting?.allowEditing === true;\n\n\tconst lightboxChecked =\n\t\t!! lightbox?.enabled || ( ! lightbox && !! lightboxSetting?.enabled );\n\n\tconst dimensionsControl = (\n\t\t<DimensionsTool\n\t\t\tvalue={ { width, height, scale, aspectRatio } }\n\t\t\tonChange={ ( {\n\t\t\t\twidth: newWidth,\n\t\t\t\theight: newHeight,\n\t\t\t\tscale: newScale,\n\t\t\t\taspectRatio: newAspectRatio,\n\t\t\t} ) => {\n\t\t\t\t// Rebuilding the object forces setting `undefined`\n\t\t\t\t// for values that are removed since setAttributes\n\t\t\t\t// doesn't do anything with keys that aren't set.\n\t\t\t\tsetAttributes( {\n\t\t\t\t\t// CSS includes `height: auto`, but we need\n\t\t\t\t\t// `width: auto` to fix the aspect ratio when\n\t\t\t\t\t// only height is set due to the width and\n\t\t\t\t\t// height attributes set via the server.\n\t\t\t\t\twidth: ! newWidth && newHeight ? 'auto' : newWidth,\n\t\t\t\t\theight: newHeight,\n\t\t\t\t\tscale: newScale,\n\t\t\t\t\taspectRatio: newAspectRatio,\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tdefaultScale=\"cover\"\n\t\t\tdefaultAspectRatio=\"auto\"\n\t\t\tscaleOptions={ scaleOptions }\n\t\t\tunitsOptions={ dimensionsUnitsOptions }\n\t\t/>\n\t);\n\n\tconst resetAll = () => {\n\t\tsetAttributes( {\n\t\t\twidth: undefined,\n\t\t\theight: undefined,\n\t\t\tscale: undefined,\n\t\t\taspectRatio: undefined,\n\t\t\tlightbox: undefined,\n\t\t} );\n\t};\n\n\tconst sizeControls = (\n\t\t<InspectorControls>\n\t\t\t<ToolsPanel label={ __( 'Settings' ) } resetAll={ resetAll }>\n\t\t\t\t{ isResizable && dimensionsControl }\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n\n\tconst controls = (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t{ hasNonContentControls && (\n\t\t\t\t\t<BlockAlignmentControl\n\t\t\t\t\t\tvalue={ align }\n\t\t\t\t\t\tonChange={ updateAlignment }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ hasNonContentControls && (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetShowCaption( ! showCaption );\n\t\t\t\t\t\t\tif ( showCaption && caption ) {\n\t\t\t\t\t\t\t\tsetAttributes( { caption: undefined } );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ticon={ captionIcon }\n\t\t\t\t\t\tisPressed={ showCaption }\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\tshowCaption\n\t\t\t\t\t\t\t\t? __( 'Remove caption' )\n\t\t\t\t\t\t\t\t: __( 'Add caption' )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! multiImageSelection && ! isEditingImage && (\n\t\t\t\t\t<ImageURLInputUI\n\t\t\t\t\t\turl={ href || '' }\n\t\t\t\t\t\tonChangeUrl={ onSetHref }\n\t\t\t\t\t\tlinkDestination={ linkDestination }\n\t\t\t\t\t\tmediaUrl={ ( image && image.source_url ) || url }\n\t\t\t\t\t\tmediaLink={ image && image.link }\n\t\t\t\t\t\tlinkTarget={ linkTarget }\n\t\t\t\t\t\tlinkClass={ linkClass }\n\t\t\t\t\t\trel={ rel }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ allowCrop && (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tonClick={ () => setIsEditingImage( true ) }\n\t\t\t\t\t\ticon={ crop }\n\t\t\t\t\t\tlabel={ __( 'Crop' ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! multiImageSelection && canInsertCover && (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ticon={ overlayText }\n\t\t\t\t\t\tlabel={ __( 'Add text over image' ) }\n\t\t\t\t\t\tonClick={ switchToCover }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BlockControls>\n\t\t\t{ ! multiImageSelection && ! isEditingImage && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\t\tmediaId={ id }\n\t\t\t\t\t\tmediaURL={ url }\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\taccept=\"image/*\"\n\t\t\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t{ ! multiImageSelection && externalBlob && (\n\t\t\t\t<BlockControls>\n\t\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tonClick={ uploadExternal }\n\t\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\t\tlabel={ __( 'Upload external image' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel label={ __( 'Settings' ) } resetAll={ resetAll }>\n\t\t\t\t\t{ ! multiImageSelection && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t\t\t\thasValue={ () => alt !== '' }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { alt: undefined } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\t\tvalue={ alt }\n\t\t\t\t\t\t\t\tonChange={ updateAlt }\n\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<ExternalLink href=\"https://www.w3.org/WAI/tutorials/images/decision-tree\">\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Describe the purpose of the image.'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t\t{ __( 'Leave empty if decorative.' ) }\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isResizable && dimensionsControl }\n\t\t\t\t\t<ResolutionTool\n\t\t\t\t\t\tvalue={ sizeSlug }\n\t\t\t\t\t\tonChange={ updateImage }\n\t\t\t\t\t\toptions={ imageSizeOptions }\n\t\t\t\t\t/>\n\t\t\t\t\t{ showLightboxToggle && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! lightbox }\n\t\t\t\t\t\t\tlabel={ __( 'Expand on Click' ) }\n\t\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( { lightbox: undefined } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Expand on Click' ) }\n\t\t\t\t\t\t\t\tchecked={ lightboxChecked }\n\t\t\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlightbox: { enabled: newValue },\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Title attribute' ) }\n\t\t\t\t\tvalue={ title || '' }\n\t\t\t\t\tonChange={ onSetTitle }\n\t\t\t\t\thelp={\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Describe the role of this image on the page.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<ExternalLink href=\"https://www.w3.org/TR/html52/dom.html#the-title-attribute\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'(Note: many devices and browsers do not display this text.)'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t</>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\tconst filename = getFilename( url );\n\tlet defaultedAlt;\n\n\tif ( alt ) {\n\t\tdefaultedAlt = alt;\n\t} else if ( filename ) {\n\t\tdefaultedAlt = sprintf(\n\t\t\t/* translators: %s: file name */\n\t\t\t__( 'This image has an empty alt attribute; its file name is %s' ),\n\t\t\tfilename\n\t\t);\n\t} else {\n\t\tdefaultedAlt = __( 'This image has an empty alt attribute' );\n\t}\n\n\tconst borderProps = useBorderProps( attributes );\n\tconst isRounded = attributes.className?.includes( 'is-style-rounded' );\n\n\tlet img = (\n\t\t// Disable reason: Image itself is not meant to be interactive, but\n\t\t// should direct focus to block.\n\t\t/* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */\n\t\t<>\n\t\t\t<img\n\t\t\t\tsrc={ temporaryURL || url }\n\t\t\t\talt={ defaultedAlt }\n\t\t\t\tonError={ () => onImageError() }\n\t\t\t\tonLoad={ ( event ) => {\n\t\t\t\t\tsetLoadedNaturalSize( {\n\t\t\t\t\t\tloadedNaturalWidth: event.target?.naturalWidth,\n\t\t\t\t\t\tloadedNaturalHeight: event.target?.naturalHeight,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tref={ imageRef }\n\t\t\t\tclassName={ borderProps.className }\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth:\n\t\t\t\t\t\t( width && height ) || aspectRatio ? '100%' : undefined,\n\t\t\t\t\theight:\n\t\t\t\t\t\t( width && height ) || aspectRatio ? '100%' : undefined,\n\t\t\t\t\tobjectFit: scale,\n\t\t\t\t\t...borderProps.style,\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t{ temporaryURL && <Spinner /> }\n\t\t</>\n\t\t/* eslint-enable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */\n\t);\n\n\t// clientWidth needs to be a number for the image Cropper to work, but sometimes it's 0\n\t// So we try using the imageRef width first and fallback to clientWidth.\n\tconst fallbackClientWidth = imageRef.current?.width || clientWidth;\n\n\tif ( canEditImage && isEditingImage ) {\n\t\timg = (\n\t\t\t<ImageEditor\n\t\t\t\tid={ id }\n\t\t\t\turl={ url }\n\t\t\t\twidth={ numericWidth }\n\t\t\t\theight={ numericHeight }\n\t\t\t\tclientWidth={ fallbackClientWidth }\n\t\t\t\tnaturalHeight={ naturalHeight }\n\t\t\t\tnaturalWidth={ naturalWidth }\n\t\t\t\tonSaveImage={ ( imageAttributes ) =>\n\t\t\t\t\tsetAttributes( imageAttributes )\n\t\t\t\t}\n\t\t\t\tonFinishEditing={ () => {\n\t\t\t\t\tsetIsEditingImage( false );\n\t\t\t\t} }\n\t\t\t\tborderProps={ isRounded ? undefined : borderProps }\n\t\t\t/>\n\t\t);\n\t} else if ( ! isResizable ) {\n\t\timg = <div style={ { width, height, aspectRatio } }>{ img }</div>;\n\t} else {\n\t\tconst numericRatio = aspectRatio && evalAspectRatio( aspectRatio );\n\t\tconst customRatio = numericWidth / numericHeight;\n\t\tconst naturalRatio = naturalWidth / naturalHeight;\n\t\tconst ratio = numericRatio || customRatio || naturalRatio || 1;\n\t\tconst currentWidth =\n\t\t\t! numericWidth && numericHeight\n\t\t\t\t? numericHeight * ratio\n\t\t\t\t: numericWidth;\n\t\tconst currentHeight =\n\t\t\t! numericHeight && numericWidth\n\t\t\t\t? numericWidth / ratio\n\t\t\t\t: numericHeight;\n\n\t\tconst minWidth =\n\t\t\tnaturalWidth < naturalHeight ? MIN_SIZE : MIN_SIZE * ratio;\n\t\tconst minHeight =\n\t\t\tnaturalHeight < naturalWidth ? MIN_SIZE : MIN_SIZE / ratio;\n\n\t\t// With the current implementation of ResizableBox, an image needs an\n\t\t// explicit pixel value for the max-width. In absence of being able to\n\t\t// set the content-width, this max-width is currently dictated by the\n\t\t// vanilla editor style. The following variable adds a buffer to this\n\t\t// vanilla style, so 3rd party themes have some wiggleroom. This does,\n\t\t// in most cases, allow you to scale the image beyond the width of the\n\t\t// main column, though not infinitely.\n\t\t// @todo It would be good to revisit this once a content-width variable\n\t\t// becomes available.\n\t\tconst maxWidthBuffer = maxWidth * 2.5;\n\n\t\tlet showRightHandle = false;\n\t\tlet showLeftHandle = false;\n\n\t\t/* eslint-disable no-lonely-if */\n\t\t// See https://github.com/WordPress/gutenberg/issues/7584.\n\t\tif ( align === 'center' ) {\n\t\t\t// When the image is centered, show both handles.\n\t\t\tshowRightHandle = true;\n\t\t\tshowLeftHandle = true;\n\t\t} else if ( isRTL() ) {\n\t\t\t// In RTL mode the image is on the right by default.\n\t\t\t// Show the right handle and hide the left handle only when it is\n\t\t\t// aligned left. Otherwise always show the left handle.\n\t\t\tif ( align === 'left' ) {\n\t\t\t\tshowRightHandle = true;\n\t\t\t} else {\n\t\t\t\tshowLeftHandle = true;\n\t\t\t}\n\t\t} else {\n\t\t\t// Show the left handle and hide the right handle only when the\n\t\t\t// image is aligned right. Otherwise always show the right handle.\n\t\t\tif ( align === 'right' ) {\n\t\t\t\tshowLeftHandle = true;\n\t\t\t} else {\n\t\t\t\tshowRightHandle = true;\n\t\t\t}\n\t\t}\n\t\t/* eslint-enable no-lonely-if */\n\n\t\timg = (\n\t\t\t<ResizableBox\n\t\t\t\tstyle={ {\n\t\t\t\t\tdisplay: 'block',\n\t\t\t\t\tobjectFit: scale,\n\t\t\t\t\taspectRatio:\n\t\t\t\t\t\t! width && ! height && aspectRatio\n\t\t\t\t\t\t\t? aspectRatio\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t} }\n\t\t\t\tsize={ {\n\t\t\t\t\twidth: currentWidth ?? 'auto',\n\t\t\t\t\theight: currentHeight ?? 'auto',\n\t\t\t\t} }\n\t\t\t\tshowHandle={ isSelected }\n\t\t\t\tminWidth={ minWidth }\n\t\t\t\tmaxWidth={ maxWidthBuffer }\n\t\t\t\tminHeight={ minHeight }\n\t\t\t\tmaxHeight={ maxWidthBuffer / ratio }\n\t\t\t\tlockAspectRatio={ ratio }\n\t\t\t\tenable={ {\n\t\t\t\t\ttop: false,\n\t\t\t\t\tright: showRightHandle,\n\t\t\t\t\tbottom: true,\n\t\t\t\t\tleft: showLeftHandle,\n\t\t\t\t} }\n\t\t\t\tonResizeStart={ onResizeStart }\n\t\t\t\tonResizeStop={ ( event, direction, elt ) => {\n\t\t\t\t\tonResizeStop();\n\t\t\t\t\t// Since the aspect ratio is locked when resizing, we can\n\t\t\t\t\t// use the width of the resized element to calculate the\n\t\t\t\t\t// height in CSS to prevent stretching when the max-width\n\t\t\t\t\t// is reached.\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: `${ elt.offsetWidth }px`,\n\t\t\t\t\t\theight: 'auto',\n\t\t\t\t\t\taspectRatio:\n\t\t\t\t\t\t\tratio === naturalRatio\n\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t: String( ratio ),\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tresizeRatio={ align === 'center' ? 2 : 1 }\n\t\t\t>\n\t\t\t\t{ img }\n\t\t\t</ResizableBox>\n\t\t);\n\t}\n\n\tif ( ! url && ! temporaryURL ) {\n\t\treturn sizeControls;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ /* Hide controls during upload to avoid component remount,\n\t\t\t\twhich causes duplicated image upload. */ }\n\t\t\t{ ! temporaryURL && controls }\n\t\t\t{ img }\n\t\t\t{ showCaption &&\n\t\t\t\t( ! RichText.isEmpty( caption ) || isSelected ) && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"caption\"\n\t\t\t\t\t\tclassName={ __experimentalGetElementClassName(\n\t\t\t\t\t\t\t'caption'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tref={ captionRef }\n\t\t\t\t\t\ttagName=\"figcaption\"\n\t\t\t\t\t\taria-label={ __( 'Image caption text' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Add caption' ) }\n\t\t\t\t\t\tvalue={ caption }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { caption: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tinlineToolbar\n\t\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\tcreateBlock( getDefaultBlockName() )\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SACCC,YAAY,EACZC,YAAY,EACZC,OAAO,EACPC,eAAe,EACfC,aAAa,EACbC,WAAW,EACXC,aAAa,EACbC,YAAY,EACZC,wBAAwB,IAAIC,UAAU,EAC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IAAIqB,UAAU,CAAE,IAC9CiI,aAAA,CAACrL,QAAQ;IACRgQ,UAAU,EAAC,SAAS;IACpBvC,SAAS,EAAG/M,iCAAiC,CAC5C,SACD,CAAG;IACHoN,GAAG,EAAGlF,UAAY;IAClBqH,OAAO,EAAC,YAAY;IACpB,cAAa7O,EAAE,CAAE,oBAAqB,CAAG;IACzC8O,WAAW,EAAG9O,EAAE,CAAE,aAAc,CAAG;IACnCyB,KAAK,EAAGd,OAAS;IACjBuJ,QAAQ,EAAKzI,KAAK,IACjBM,aAAa,CAAE;MAAEpB,OAAO,EAAEc;IAAM,CAAE,CAClC;IACDsN,aAAa;IACbC,sBAAsB,EAAGA,CAAA,KACxB/M,iBAAiB,CAChB5B,WAAW,CAAEC,mBAAmB,CAAC,CAAE,CACpC;EACA,CACD,CAEF,CAAC;AAEL"}
|
|
1
|
+
{"version":3,"names":["isBlobURL","ExternalLink","ResizableBox","Spinner","TextareaControl","ToggleControl","TextControl","ToolbarButton","ToolbarGroup","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","__experimentalUseCustomUnits","useCustomUnits","useViewportMatch","usePrevious","useSelect","useDispatch","BlockControls","InspectorControls","RichText","__experimentalImageURLInputUI","ImageURLInputUI","MediaReplaceFlow","store","blockEditorStore","useSetting","BlockAlignmentControl","__experimentalImageEditor","ImageEditor","__experimentalGetElementClassName","__experimentalUseBorderProps","useBorderProps","privateApis","blockEditorPrivateApis","useEffect","useMemo","useState","useRef","useCallback","__","_x","sprintf","isRTL","getFilename","createBlock","getDefaultBlockName","switchToBlockType","crop","overlayText","upload","caption","captionIcon","noticesStore","coreStore","unlock","createUpgradedEmbedBlock","useClientWidth","isExternalImage","MIN_SIZE","ALLOWED_MEDIA_TYPES","evalAspectRatio","DimensionsTool","ResolutionTool","scaleOptions","value","label","help","Image","temporaryURL","attributes","setAttributes","isSelected","insertBlocksAfter","onReplace","onSelectImage","onSelectURL","onUploadError","containerRef","context","clientId","blockEditingMode","url","alt","align","id","href","rel","linkClass","linkDestination","title","width","height","aspectRatio","scale","linkTarget","sizeSlug","lightbox","numericWidth","parseInt","undefined","numericHeight","imageRef","prevCaption","showCaption","setShowCaption","allowResize","getBlock","image","multiImageSelection","select","getMedia","getMultiSelectedBlockClientIds","getBlockName","multiSelectedClientIds","length","every","_clientId","canInsertCover","imageEditing","imageSizes","maxWidth","mediaUpload","getBlockRootClientId","getSettings","canInsertBlockType","rootClientId","settings","replaceBlocks","toggleSelection","createErrorNotice","createSuccessNotice","isLargeViewport","isWideAligned","includes","loadedNaturalWidth","loadedNaturalHeight","setLoadedNaturalSize","isEditingImage","setIsEditingImage","externalBlob","setExternalBlob","clientWidth","hasNonContentControls","isResizable","imageSizeOptions","filter","slug","media_details","sizes","source_url","map","name","canUploadMedia","window","fetch","then","response","blob","catch","captionRef","node","focus","naturalWidth","naturalHeight","current","complete","onResizeStart","onResizeStop","onImageError","embedBlock","onSetHref","props","onSetTitle","updateAlt","newAlt","updateImage","newSizeSlug","newUrl","uploadExternal","filesList","onFileChange","img","type","allowedTypes","onError","message","updateAlignment","nextAlign","extraUpdatedAttributes","canEditImage","allowCrop","switchToCover","dimensionsUnitsOptions","availableUnits","lightboxSetting","showLightboxToggle","allowEditing","lightboxChecked","enabled","lightboxToggleDisabled","dimensionsControl","createElement","onChange","newWidth","newHeight","newScale","newAspectRatio","defaultScale","defaultAspectRatio","unitsOptions","resetAll","sizeControls","controls","Fragment","group","onClick","icon","isPressed","onChangeUrl","mediaUrl","mediaLink","link","mediaId","mediaURL","accept","onSelect","isShownByDefault","hasValue","onDeselect","__nextHasNoMarginBottom","options","checked","newValue","disabled","filename","defaultedAlt","borderProps","isRounded","className","src","onLoad","event","target","ref","style","objectFit","fallbackClientWidth","onSaveImage","imageAttributes","onFinishEditing","numericRatio","customRatio","naturalRatio","ratio","currentWidth","currentHeight","minWidth","minHeight","maxWidthBuffer","showRightHandle","showLeftHandle","display","size","showHandle","maxHeight","lockAspectRatio","enable","top","right","bottom","left","direction","elt","offsetWidth","String","resizeRatio","isEmpty","identifier","tagName","placeholder","inlineToolbar","__unstableOnSplitAtEnd"],"sources":["@wordpress/block-library/src/image/image.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { isBlobURL } from '@wordpress/blob';\nimport {\n\tExternalLink,\n\tResizableBox,\n\tSpinner,\n\tTextareaControl,\n\tToggleControl,\n\tTextControl,\n\tToolbarButton,\n\tToolbarGroup,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUseCustomUnits as useCustomUnits,\n} from '@wordpress/components';\nimport { useViewportMatch, usePrevious } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\t__experimentalImageURLInputUI as ImageURLInputUI,\n\tMediaReplaceFlow,\n\tstore as blockEditorStore,\n\tuseSetting,\n\tBlockAlignmentControl,\n\t__experimentalImageEditor as ImageEditor,\n\t__experimentalGetElementClassName,\n\t__experimentalUseBorderProps as useBorderProps,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\tuseEffect,\n\tuseMemo,\n\tuseState,\n\tuseRef,\n\tuseCallback,\n} from '@wordpress/element';\nimport { __, _x, sprintf, isRTL } from '@wordpress/i18n';\nimport { getFilename } from '@wordpress/url';\nimport {\n\tcreateBlock,\n\tgetDefaultBlockName,\n\tswitchToBlockType,\n} from '@wordpress/blocks';\nimport {\n\tcrop,\n\toverlayText,\n\tupload,\n\tcaption as captionIcon,\n} from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\nimport { createUpgradedEmbedBlock } from '../embed/util';\nimport useClientWidth from './use-client-width';\nimport { isExternalImage } from './edit';\n\n/**\n * Module constants\n */\nimport { MIN_SIZE, ALLOWED_MEDIA_TYPES } from './constants';\nimport { evalAspectRatio } from './utils';\n\nconst { DimensionsTool, ResolutionTool } = unlock( blockEditorPrivateApis );\n\nconst scaleOptions = [\n\t{\n\t\tvalue: 'cover',\n\t\tlabel: _x( 'Cover', 'Scale option for dimensions control' ),\n\t\thelp: __( 'Image covers the space evenly.' ),\n\t},\n\t{\n\t\tvalue: 'contain',\n\t\tlabel: _x( 'Contain', 'Scale option for dimensions control' ),\n\t\thelp: __( 'Image is contained without distortion.' ),\n\t},\n];\n\nexport default function Image( {\n\ttemporaryURL,\n\tattributes,\n\tsetAttributes,\n\tisSelected,\n\tinsertBlocksAfter,\n\tonReplace,\n\tonSelectImage,\n\tonSelectURL,\n\tonUploadError,\n\tcontainerRef,\n\tcontext,\n\tclientId,\n\tblockEditingMode,\n} ) {\n\tconst {\n\t\turl = '',\n\t\talt,\n\t\tcaption,\n\t\talign,\n\t\tid,\n\t\thref,\n\t\trel,\n\t\tlinkClass,\n\t\tlinkDestination,\n\t\ttitle,\n\t\twidth,\n\t\theight,\n\t\taspectRatio,\n\t\tscale,\n\t\tlinkTarget,\n\t\tsizeSlug,\n\t\tlightbox,\n\t} = attributes;\n\n\t// The only supported unit is px, so we can parseInt to strip the px here.\n\tconst numericWidth = width ? parseInt( width, 10 ) : undefined;\n\tconst numericHeight = height ? parseInt( height, 10 ) : undefined;\n\n\tconst imageRef = useRef();\n\tconst prevCaption = usePrevious( caption );\n\tconst [ showCaption, setShowCaption ] = useState( !! caption );\n\tconst { allowResize = true } = context;\n\tconst { getBlock } = useSelect( blockEditorStore );\n\n\tconst { image, multiImageSelection } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getMedia } = select( coreStore );\n\t\t\tconst { getMultiSelectedBlockClientIds, getBlockName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst multiSelectedClientIds = getMultiSelectedBlockClientIds();\n\t\t\treturn {\n\t\t\t\timage:\n\t\t\t\t\tid && isSelected\n\t\t\t\t\t\t? getMedia( id, { context: 'view' } )\n\t\t\t\t\t\t: null,\n\t\t\t\tmultiImageSelection:\n\t\t\t\t\tmultiSelectedClientIds.length &&\n\t\t\t\t\tmultiSelectedClientIds.every(\n\t\t\t\t\t\t( _clientId ) =>\n\t\t\t\t\t\t\tgetBlockName( _clientId ) === 'core/image'\n\t\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ id, isSelected ]\n\t);\n\tconst { canInsertCover, imageEditing, imageSizes, maxWidth, mediaUpload } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetBlockRootClientId,\n\t\t\t\t\tgetSettings,\n\t\t\t\t\tcanInsertBlockType,\n\t\t\t\t} = select( blockEditorStore );\n\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\t\tconst settings = getSettings();\n\n\t\t\t\treturn {\n\t\t\t\t\timageEditing: settings.imageEditing,\n\t\t\t\t\timageSizes: settings.imageSizes,\n\t\t\t\t\tmaxWidth: settings.maxWidth,\n\t\t\t\t\tmediaUpload: settings.mediaUpload,\n\t\t\t\t\tcanInsertCover: canInsertBlockType(\n\t\t\t\t\t\t'core/cover',\n\t\t\t\t\t\trootClientId\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ clientId ]\n\t\t);\n\n\tconst { replaceBlocks, toggleSelection } = useDispatch( blockEditorStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideAligned = [ 'wide', 'full' ].includes( align );\n\tconst [\n\t\t{ loadedNaturalWidth, loadedNaturalHeight },\n\t\tsetLoadedNaturalSize,\n\t] = useState( {} );\n\tconst [ isEditingImage, setIsEditingImage ] = useState( false );\n\tconst [ externalBlob, setExternalBlob ] = useState();\n\tconst clientWidth = useClientWidth( containerRef, [ align ] );\n\tconst hasNonContentControls = blockEditingMode === 'default';\n\tconst isResizable =\n\t\tallowResize &&\n\t\thasNonContentControls &&\n\t\t! ( isWideAligned && isLargeViewport );\n\tconst imageSizeOptions = imageSizes\n\t\t.filter(\n\t\t\t( { slug } ) => image?.media_details?.sizes?.[ slug ]?.source_url\n\t\t)\n\t\t.map( ( { name, slug } ) => ( { value: slug, label: name } ) );\n\tconst canUploadMedia = !! mediaUpload;\n\n\t// If an image is externally hosted, try to fetch the image data. This may\n\t// fail if the image host doesn't allow CORS with the domain. If it works,\n\t// we can enable a button in the toolbar to upload the image.\n\tuseEffect( () => {\n\t\tif (\n\t\t\t! isExternalImage( id, url ) ||\n\t\t\t! isSelected ||\n\t\t\t! canUploadMedia\n\t\t) {\n\t\t\tsetExternalBlob();\n\t\t\treturn;\n\t\t}\n\n\t\tif ( externalBlob ) return;\n\n\t\twindow\n\t\t\t// Avoid cache, which seems to help avoid CORS problems.\n\t\t\t.fetch( url.includes( '?' ) ? url : url + '?' )\n\t\t\t.then( ( response ) => response.blob() )\n\t\t\t.then( ( blob ) => setExternalBlob( blob ) )\n\t\t\t// Do nothing, cannot upload.\n\t\t\t.catch( () => {} );\n\t}, [ id, url, isSelected, externalBlob, canUploadMedia ] );\n\n\t// We need to show the caption when changes come from\n\t// history navigation(undo/redo).\n\tuseEffect( () => {\n\t\tif ( caption && ! prevCaption ) {\n\t\t\tsetShowCaption( true );\n\t\t}\n\t}, [ caption, prevCaption ] );\n\n\t// Focus the caption when we click to add one.\n\tconst captionRef = useCallback(\n\t\t( node ) => {\n\t\t\tif ( node && ! caption ) {\n\t\t\t\tnode.focus();\n\t\t\t}\n\t\t},\n\t\t[ caption ]\n\t);\n\n\t// Get naturalWidth and naturalHeight from image ref, and fall back to loaded natural\n\t// width and height. This resolves an issue in Safari where the loaded natural\n\t// width and height is otherwise lost when switching between alignments.\n\t// See: https://github.com/WordPress/gutenberg/pull/37210.\n\tconst { naturalWidth, naturalHeight } = useMemo( () => {\n\t\treturn {\n\t\t\tnaturalWidth:\n\t\t\t\timageRef.current?.naturalWidth ||\n\t\t\t\tloadedNaturalWidth ||\n\t\t\t\tundefined,\n\t\t\tnaturalHeight:\n\t\t\t\timageRef.current?.naturalHeight ||\n\t\t\t\tloadedNaturalHeight ||\n\t\t\t\tundefined,\n\t\t};\n\t}, [\n\t\tloadedNaturalWidth,\n\t\tloadedNaturalHeight,\n\t\timageRef.current?.complete,\n\t] );\n\n\tfunction onResizeStart() {\n\t\ttoggleSelection( false );\n\t}\n\n\tfunction onResizeStop() {\n\t\ttoggleSelection( true );\n\t}\n\n\tfunction onImageError() {\n\t\t// Check if there's an embed block that handles this URL, e.g., instagram URL.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/11472\n\t\tconst embedBlock = createUpgradedEmbedBlock( { attributes: { url } } );\n\n\t\tif ( undefined !== embedBlock ) {\n\t\t\tonReplace( embedBlock );\n\t\t}\n\t}\n\n\tfunction onSetHref( props ) {\n\t\tsetAttributes( props );\n\t}\n\n\tfunction onSetTitle( value ) {\n\t\t// This is the HTML title attribute, separate from the media object\n\t\t// title.\n\t\tsetAttributes( { title: value } );\n\t}\n\n\tfunction updateAlt( newAlt ) {\n\t\tsetAttributes( { alt: newAlt } );\n\t}\n\n\tfunction updateImage( newSizeSlug ) {\n\t\tconst newUrl = image?.media_details?.sizes?.[ newSizeSlug ]?.source_url;\n\t\tif ( ! newUrl ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\turl: newUrl,\n\t\t\tsizeSlug: newSizeSlug,\n\t\t} );\n\t}\n\n\tfunction uploadExternal() {\n\t\tmediaUpload( {\n\t\t\tfilesList: [ externalBlob ],\n\t\t\tonFileChange( [ img ] ) {\n\t\t\t\tonSelectImage( img );\n\n\t\t\t\tif ( isBlobURL( img.url ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tsetExternalBlob();\n\t\t\t\tcreateSuccessNotice( __( 'Image uploaded.' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t},\n\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\tonError( message ) {\n\t\t\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t\t\t},\n\t\t} );\n\t}\n\n\tfunction updateAlignment( nextAlign ) {\n\t\tconst extraUpdatedAttributes = [ 'wide', 'full' ].includes( nextAlign )\n\t\t\t? {\n\t\t\t\t\twidth: undefined,\n\t\t\t\t\theight: undefined,\n\t\t\t\t\taspectRatio: undefined,\n\t\t\t\t\tscale: undefined,\n\t\t\t }\n\t\t\t: {};\n\t\tsetAttributes( {\n\t\t\t...extraUpdatedAttributes,\n\t\t\talign: nextAlign,\n\t\t} );\n\t}\n\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsEditingImage( false );\n\t\t\tif ( ! caption ) {\n\t\t\t\tsetShowCaption( false );\n\t\t\t}\n\t\t}\n\t}, [ isSelected, caption ] );\n\n\tconst canEditImage = id && naturalWidth && naturalHeight && imageEditing;\n\tconst allowCrop = ! multiImageSelection && canEditImage && ! isEditingImage;\n\n\tfunction switchToCover() {\n\t\treplaceBlocks(\n\t\t\tclientId,\n\t\t\tswitchToBlockType( getBlock( clientId ), 'core/cover' )\n\t\t);\n\t}\n\n\t// TODO: Can allow more units after figuring out how they should interact\n\t// with the ResizableBox and ImageEditor components. Calculations later on\n\t// for those components are currently assuming px units.\n\tconst dimensionsUnitsOptions = useCustomUnits( {\n\t\tavailableUnits: [ 'px' ],\n\t} );\n\n\tconst lightboxSetting = useSetting( 'lightbox' );\n\n\tconst showLightboxToggle =\n\t\t!! lightbox || lightboxSetting?.allowEditing === true;\n\n\tconst lightboxChecked =\n\t\t!! lightbox?.enabled || ( ! lightbox && !! lightboxSetting?.enabled );\n\n\tconst lightboxToggleDisabled = linkDestination !== 'none';\n\n\tconst dimensionsControl = (\n\t\t<DimensionsTool\n\t\t\tvalue={ { width, height, scale, aspectRatio } }\n\t\t\tonChange={ ( {\n\t\t\t\twidth: newWidth,\n\t\t\t\theight: newHeight,\n\t\t\t\tscale: newScale,\n\t\t\t\taspectRatio: newAspectRatio,\n\t\t\t} ) => {\n\t\t\t\t// Rebuilding the object forces setting `undefined`\n\t\t\t\t// for values that are removed since setAttributes\n\t\t\t\t// doesn't do anything with keys that aren't set.\n\t\t\t\tsetAttributes( {\n\t\t\t\t\t// CSS includes `height: auto`, but we need\n\t\t\t\t\t// `width: auto` to fix the aspect ratio when\n\t\t\t\t\t// only height is set due to the width and\n\t\t\t\t\t// height attributes set via the server.\n\t\t\t\t\twidth: ! newWidth && newHeight ? 'auto' : newWidth,\n\t\t\t\t\theight: newHeight,\n\t\t\t\t\tscale: newScale,\n\t\t\t\t\taspectRatio: newAspectRatio,\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tdefaultScale=\"cover\"\n\t\t\tdefaultAspectRatio=\"auto\"\n\t\t\tscaleOptions={ scaleOptions }\n\t\t\tunitsOptions={ dimensionsUnitsOptions }\n\t\t/>\n\t);\n\n\tconst resetAll = () => {\n\t\tsetAttributes( {\n\t\t\twidth: undefined,\n\t\t\theight: undefined,\n\t\t\tscale: undefined,\n\t\t\taspectRatio: undefined,\n\t\t\tlightbox: undefined,\n\t\t} );\n\t};\n\n\tconst sizeControls = (\n\t\t<InspectorControls>\n\t\t\t<ToolsPanel label={ __( 'Settings' ) } resetAll={ resetAll }>\n\t\t\t\t{ isResizable && dimensionsControl }\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n\n\tconst controls = (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t{ hasNonContentControls && (\n\t\t\t\t\t<BlockAlignmentControl\n\t\t\t\t\t\tvalue={ align }\n\t\t\t\t\t\tonChange={ updateAlignment }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ hasNonContentControls && (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetShowCaption( ! showCaption );\n\t\t\t\t\t\t\tif ( showCaption && caption ) {\n\t\t\t\t\t\t\t\tsetAttributes( { caption: undefined } );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ticon={ captionIcon }\n\t\t\t\t\t\tisPressed={ showCaption }\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\tshowCaption\n\t\t\t\t\t\t\t\t? __( 'Remove caption' )\n\t\t\t\t\t\t\t\t: __( 'Add caption' )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! multiImageSelection && ! isEditingImage && (\n\t\t\t\t\t<ImageURLInputUI\n\t\t\t\t\t\turl={ href || '' }\n\t\t\t\t\t\tonChangeUrl={ onSetHref }\n\t\t\t\t\t\tlinkDestination={ linkDestination }\n\t\t\t\t\t\tmediaUrl={ ( image && image.source_url ) || url }\n\t\t\t\t\t\tmediaLink={ image && image.link }\n\t\t\t\t\t\tlinkTarget={ linkTarget }\n\t\t\t\t\t\tlinkClass={ linkClass }\n\t\t\t\t\t\trel={ rel }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ allowCrop && (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tonClick={ () => setIsEditingImage( true ) }\n\t\t\t\t\t\ticon={ crop }\n\t\t\t\t\t\tlabel={ __( 'Crop' ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! multiImageSelection && canInsertCover && (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ticon={ overlayText }\n\t\t\t\t\t\tlabel={ __( 'Add text over image' ) }\n\t\t\t\t\t\tonClick={ switchToCover }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BlockControls>\n\t\t\t{ ! multiImageSelection && ! isEditingImage && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\t\tmediaId={ id }\n\t\t\t\t\t\tmediaURL={ url }\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\taccept=\"image/*\"\n\t\t\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t{ ! multiImageSelection && externalBlob && (\n\t\t\t\t<BlockControls>\n\t\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tonClick={ uploadExternal }\n\t\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\t\tlabel={ __( 'Upload external image' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel label={ __( 'Settings' ) } resetAll={ resetAll }>\n\t\t\t\t\t{ ! multiImageSelection && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t\t\t\thasValue={ () => alt !== '' }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { alt: undefined } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\t\tvalue={ alt }\n\t\t\t\t\t\t\t\tonChange={ updateAlt }\n\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<ExternalLink href=\"https://www.w3.org/WAI/tutorials/images/decision-tree\">\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Describe the purpose of the image.'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t\t{ __( 'Leave empty if decorative.' ) }\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isResizable && dimensionsControl }\n\t\t\t\t\t<ResolutionTool\n\t\t\t\t\t\tvalue={ sizeSlug }\n\t\t\t\t\t\tonChange={ updateImage }\n\t\t\t\t\t\toptions={ imageSizeOptions }\n\t\t\t\t\t/>\n\t\t\t\t\t{ showLightboxToggle && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! lightbox }\n\t\t\t\t\t\t\tlabel={ __( 'Expand on Click' ) }\n\t\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( { lightbox: undefined } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Expand on Click' ) }\n\t\t\t\t\t\t\t\tchecked={ lightboxChecked }\n\t\t\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlightbox: { enabled: newValue },\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tdisabled={ lightboxToggleDisabled }\n\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\tlightboxToggleDisabled\n\t\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t\t'“Expand on click” scales the image up, and can’t be combined with a link.'\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t: ''\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Title attribute' ) }\n\t\t\t\t\tvalue={ title || '' }\n\t\t\t\t\tonChange={ onSetTitle }\n\t\t\t\t\thelp={\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Describe the role of this image on the page.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<ExternalLink href=\"https://www.w3.org/TR/html52/dom.html#the-title-attribute\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'(Note: many devices and browsers do not display this text.)'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t</>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\tconst filename = getFilename( url );\n\tlet defaultedAlt;\n\n\tif ( alt ) {\n\t\tdefaultedAlt = alt;\n\t} else if ( filename ) {\n\t\tdefaultedAlt = sprintf(\n\t\t\t/* translators: %s: file name */\n\t\t\t__( 'This image has an empty alt attribute; its file name is %s' ),\n\t\t\tfilename\n\t\t);\n\t} else {\n\t\tdefaultedAlt = __( 'This image has an empty alt attribute' );\n\t}\n\n\tconst borderProps = useBorderProps( attributes );\n\tconst isRounded = attributes.className?.includes( 'is-style-rounded' );\n\n\tlet img = (\n\t\t// Disable reason: Image itself is not meant to be interactive, but\n\t\t// should direct focus to block.\n\t\t/* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */\n\t\t<>\n\t\t\t<img\n\t\t\t\tsrc={ temporaryURL || url }\n\t\t\t\talt={ defaultedAlt }\n\t\t\t\tonError={ () => onImageError() }\n\t\t\t\tonLoad={ ( event ) => {\n\t\t\t\t\tsetLoadedNaturalSize( {\n\t\t\t\t\t\tloadedNaturalWidth: event.target?.naturalWidth,\n\t\t\t\t\t\tloadedNaturalHeight: event.target?.naturalHeight,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tref={ imageRef }\n\t\t\t\tclassName={ borderProps.className }\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth:\n\t\t\t\t\t\t( width && height ) || aspectRatio ? '100%' : undefined,\n\t\t\t\t\theight:\n\t\t\t\t\t\t( width && height ) || aspectRatio ? '100%' : undefined,\n\t\t\t\t\tobjectFit: scale,\n\t\t\t\t\t...borderProps.style,\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t{ temporaryURL && <Spinner /> }\n\t\t</>\n\t\t/* eslint-enable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */\n\t);\n\n\t// clientWidth needs to be a number for the image Cropper to work, but sometimes it's 0\n\t// So we try using the imageRef width first and fallback to clientWidth.\n\tconst fallbackClientWidth = imageRef.current?.width || clientWidth;\n\n\tif ( canEditImage && isEditingImage ) {\n\t\timg = (\n\t\t\t<ImageEditor\n\t\t\t\tid={ id }\n\t\t\t\turl={ url }\n\t\t\t\twidth={ numericWidth }\n\t\t\t\theight={ numericHeight }\n\t\t\t\tclientWidth={ fallbackClientWidth }\n\t\t\t\tnaturalHeight={ naturalHeight }\n\t\t\t\tnaturalWidth={ naturalWidth }\n\t\t\t\tonSaveImage={ ( imageAttributes ) =>\n\t\t\t\t\tsetAttributes( imageAttributes )\n\t\t\t\t}\n\t\t\t\tonFinishEditing={ () => {\n\t\t\t\t\tsetIsEditingImage( false );\n\t\t\t\t} }\n\t\t\t\tborderProps={ isRounded ? undefined : borderProps }\n\t\t\t/>\n\t\t);\n\t} else if ( ! isResizable ) {\n\t\timg = <div style={ { width, height, aspectRatio } }>{ img }</div>;\n\t} else {\n\t\tconst numericRatio = aspectRatio && evalAspectRatio( aspectRatio );\n\t\tconst customRatio = numericWidth / numericHeight;\n\t\tconst naturalRatio = naturalWidth / naturalHeight;\n\t\tconst ratio = numericRatio || customRatio || naturalRatio || 1;\n\t\tconst currentWidth =\n\t\t\t! numericWidth && numericHeight\n\t\t\t\t? numericHeight * ratio\n\t\t\t\t: numericWidth;\n\t\tconst currentHeight =\n\t\t\t! numericHeight && numericWidth\n\t\t\t\t? numericWidth / ratio\n\t\t\t\t: numericHeight;\n\n\t\tconst minWidth =\n\t\t\tnaturalWidth < naturalHeight ? MIN_SIZE : MIN_SIZE * ratio;\n\t\tconst minHeight =\n\t\t\tnaturalHeight < naturalWidth ? MIN_SIZE : MIN_SIZE / ratio;\n\n\t\t// With the current implementation of ResizableBox, an image needs an\n\t\t// explicit pixel value for the max-width. In absence of being able to\n\t\t// set the content-width, this max-width is currently dictated by the\n\t\t// vanilla editor style. The following variable adds a buffer to this\n\t\t// vanilla style, so 3rd party themes have some wiggleroom. This does,\n\t\t// in most cases, allow you to scale the image beyond the width of the\n\t\t// main column, though not infinitely.\n\t\t// @todo It would be good to revisit this once a content-width variable\n\t\t// becomes available.\n\t\tconst maxWidthBuffer = maxWidth * 2.5;\n\n\t\tlet showRightHandle = false;\n\t\tlet showLeftHandle = false;\n\n\t\t/* eslint-disable no-lonely-if */\n\t\t// See https://github.com/WordPress/gutenberg/issues/7584.\n\t\tif ( align === 'center' ) {\n\t\t\t// When the image is centered, show both handles.\n\t\t\tshowRightHandle = true;\n\t\t\tshowLeftHandle = true;\n\t\t} else if ( isRTL() ) {\n\t\t\t// In RTL mode the image is on the right by default.\n\t\t\t// Show the right handle and hide the left handle only when it is\n\t\t\t// aligned left. Otherwise always show the left handle.\n\t\t\tif ( align === 'left' ) {\n\t\t\t\tshowRightHandle = true;\n\t\t\t} else {\n\t\t\t\tshowLeftHandle = true;\n\t\t\t}\n\t\t} else {\n\t\t\t// Show the left handle and hide the right handle only when the\n\t\t\t// image is aligned right. Otherwise always show the right handle.\n\t\t\tif ( align === 'right' ) {\n\t\t\t\tshowLeftHandle = true;\n\t\t\t} else {\n\t\t\t\tshowRightHandle = true;\n\t\t\t}\n\t\t}\n\t\t/* eslint-enable no-lonely-if */\n\n\t\timg = (\n\t\t\t<ResizableBox\n\t\t\t\tstyle={ {\n\t\t\t\t\tdisplay: 'block',\n\t\t\t\t\tobjectFit: scale,\n\t\t\t\t\taspectRatio:\n\t\t\t\t\t\t! width && ! height && aspectRatio\n\t\t\t\t\t\t\t? aspectRatio\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t} }\n\t\t\t\tsize={ {\n\t\t\t\t\twidth: currentWidth ?? 'auto',\n\t\t\t\t\theight: currentHeight ?? 'auto',\n\t\t\t\t} }\n\t\t\t\tshowHandle={ isSelected }\n\t\t\t\tminWidth={ minWidth }\n\t\t\t\tmaxWidth={ maxWidthBuffer }\n\t\t\t\tminHeight={ minHeight }\n\t\t\t\tmaxHeight={ maxWidthBuffer / ratio }\n\t\t\t\tlockAspectRatio={ ratio }\n\t\t\t\tenable={ {\n\t\t\t\t\ttop: false,\n\t\t\t\t\tright: showRightHandle,\n\t\t\t\t\tbottom: true,\n\t\t\t\t\tleft: showLeftHandle,\n\t\t\t\t} }\n\t\t\t\tonResizeStart={ onResizeStart }\n\t\t\t\tonResizeStop={ ( event, direction, elt ) => {\n\t\t\t\t\tonResizeStop();\n\t\t\t\t\t// Since the aspect ratio is locked when resizing, we can\n\t\t\t\t\t// use the width of the resized element to calculate the\n\t\t\t\t\t// height in CSS to prevent stretching when the max-width\n\t\t\t\t\t// is reached.\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: `${ elt.offsetWidth }px`,\n\t\t\t\t\t\theight: 'auto',\n\t\t\t\t\t\taspectRatio:\n\t\t\t\t\t\t\tratio === naturalRatio\n\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t: String( ratio ),\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tresizeRatio={ align === 'center' ? 2 : 1 }\n\t\t\t>\n\t\t\t\t{ img }\n\t\t\t</ResizableBox>\n\t\t);\n\t}\n\n\tif ( ! url && ! temporaryURL ) {\n\t\treturn sizeControls;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ /* Hide controls during upload to avoid component remount,\n\t\t\t\twhich causes duplicated image upload. */ }\n\t\t\t{ ! temporaryURL && controls }\n\t\t\t{ img }\n\t\t\t{ showCaption &&\n\t\t\t\t( ! RichText.isEmpty( caption ) || isSelected ) && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"caption\"\n\t\t\t\t\t\tclassName={ __experimentalGetElementClassName(\n\t\t\t\t\t\t\t'caption'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tref={ captionRef }\n\t\t\t\t\t\ttagName=\"figcaption\"\n\t\t\t\t\t\taria-label={ __( 'Image caption text' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Add caption' ) }\n\t\t\t\t\t\tvalue={ caption }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { caption: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tinlineToolbar\n\t\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\tcreateBlock( getDefaultBlockName() )\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SACCC,YAAY,EACZC,YAAY,EACZC,OAAO,EACPC,eAAe,EACfC,aAAa,EACbC,WAAW,EACXC,aAAa,EACbC,YAAY,EACZC,wBAAwB,IAAIC,UAAU,EACtCC,4BAA4B,IAAIC,cAAc,EAC9CC,4BAA4B,IAAIC,cAAc,QACxC,uBAAuB;AAC9B,SAASC,gBAAgB,EAAEC,WAAW,QAAQ,oBAAoB;AAClE,SAASC,SAAS,EAA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AC,IAAIqB,UAAU,CAAE,IAC9CkI,aAAA,CAACtL,QAAQ;IACRkQ,UAAU,EAAC,SAAS;IACpBvC,SAAS,EAAGjN,iCAAiC,CAC5C,SACD,CAAG;IACHsN,GAAG,EAAGpF,UAAY;IAClBuH,OAAO,EAAC,YAAY;IACpB,cAAa/O,EAAE,CAAE,oBAAqB,CAAG;IACzCgP,WAAW,EAAGhP,EAAE,CAAE,aAAc,CAAG;IACnCyB,KAAK,EAAGd,OAAS;IACjBwJ,QAAQ,EAAK1I,KAAK,IACjBM,aAAa,CAAE;MAAEpB,OAAO,EAAEc;IAAM,CAAE,CAClC;IACDwN,aAAa;IACbC,sBAAsB,EAAGA,CAAA,KACxBjN,iBAAiB,CAChB5B,WAAW,CAAEC,mBAAmB,CAAC,CAAE,CACpC;EACA,CACD,CAEF,CAAC;AAEL"}
|
|
@@ -72,6 +72,19 @@ export default function useMerge(clientId, onMerge) {
|
|
|
72
72
|
return getBlockOrder(order[0])[0];
|
|
73
73
|
}
|
|
74
74
|
return forward => {
|
|
75
|
+
function mergeWithNested(clientIdA, clientIdB) {
|
|
76
|
+
registry.batch(() => {
|
|
77
|
+
// When merging a sub list item with a higher next list item, we
|
|
78
|
+
// also need to move any nested list items. Check if there's a
|
|
79
|
+
// listed list, and append its nested list items to the current
|
|
80
|
+
// list.
|
|
81
|
+
const [nestedListClientId] = getBlockOrder(clientIdB);
|
|
82
|
+
if (nestedListClientId) {
|
|
83
|
+
moveBlocksToPosition(getBlockOrder(nestedListClientId), nestedListClientId, getBlockRootClientId(clientIdA));
|
|
84
|
+
}
|
|
85
|
+
mergeBlocks(clientIdA, clientIdB);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
75
88
|
if (forward) {
|
|
76
89
|
const nextBlockClientId = getNextId(clientId);
|
|
77
90
|
if (!nextBlockClientId) {
|
|
@@ -81,10 +94,7 @@ export default function useMerge(clientId, onMerge) {
|
|
|
81
94
|
if (getParentListItemId(nextBlockClientId)) {
|
|
82
95
|
outdentListItem(nextBlockClientId);
|
|
83
96
|
} else {
|
|
84
|
-
|
|
85
|
-
moveBlocksToPosition(getBlockOrder(nextBlockClientId), nextBlockClientId, getPreviousBlockClientId(nextBlockClientId));
|
|
86
|
-
mergeBlocks(clientId, nextBlockClientId);
|
|
87
|
-
});
|
|
97
|
+
mergeWithNested(clientId, nextBlockClientId);
|
|
88
98
|
}
|
|
89
99
|
} else {
|
|
90
100
|
// Merging is only done from the top level. For lowel levels, the
|
|
@@ -94,17 +104,7 @@ export default function useMerge(clientId, onMerge) {
|
|
|
94
104
|
outdentListItem(clientId);
|
|
95
105
|
} else if (previousBlockClientId) {
|
|
96
106
|
const trailingId = getTrailingId(previousBlockClientId);
|
|
97
|
-
|
|
98
|
-
// When merging a list item with a previous trailing list
|
|
99
|
-
// item, we also need to move any nested list items. First,
|
|
100
|
-
// check if there's a listed list. If there's a nested list,
|
|
101
|
-
// append its nested list items to the trailing list.
|
|
102
|
-
const [nestedListClientId] = getBlockOrder(clientId);
|
|
103
|
-
if (nestedListClientId) {
|
|
104
|
-
moveBlocksToPosition(getBlockOrder(nestedListClientId), nestedListClientId, getBlockRootClientId(trailingId));
|
|
105
|
-
}
|
|
106
|
-
mergeBlocks(trailingId, clientId);
|
|
107
|
-
});
|
|
107
|
+
mergeWithNested(trailingId, clientId);
|
|
108
108
|
} else {
|
|
109
109
|
onMerge(forward);
|
|
110
110
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useRegistry","useDispatch","useSelect","store","blockEditorStore","useOutdentListItem","useMerge","clientId","onMerge","registry","getPreviousBlockClientId","getNextBlockClientId","getBlockOrder","getBlockRootClientId","getBlockName","mergeBlocks","moveBlocksToPosition","outdentListItem","getTrailingId","id","order","length","getParentListItemId","listId","parentListItemId","_getNextId","next","getNextId","forward","
|
|
1
|
+
{"version":3,"names":["useRegistry","useDispatch","useSelect","store","blockEditorStore","useOutdentListItem","useMerge","clientId","onMerge","registry","getPreviousBlockClientId","getNextBlockClientId","getBlockOrder","getBlockRootClientId","getBlockName","mergeBlocks","moveBlocksToPosition","outdentListItem","getTrailingId","id","order","length","getParentListItemId","listId","parentListItemId","_getNextId","next","getNextId","forward","mergeWithNested","clientIdA","clientIdB","batch","nestedListClientId","nextBlockClientId","previousBlockClientId","trailingId"],"sources":["@wordpress/block-library/src/list-item/hooks/use-merge.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRegistry, useDispatch, useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport useOutdentListItem from './use-outdent-list-item';\n\nexport default function useMerge( clientId, onMerge ) {\n\tconst registry = useRegistry();\n\tconst {\n\t\tgetPreviousBlockClientId,\n\t\tgetNextBlockClientId,\n\t\tgetBlockOrder,\n\t\tgetBlockRootClientId,\n\t\tgetBlockName,\n\t} = useSelect( blockEditorStore );\n\tconst { mergeBlocks, moveBlocksToPosition } =\n\t\tuseDispatch( blockEditorStore );\n\tconst [ , outdentListItem ] = useOutdentListItem( clientId );\n\n\tfunction getTrailingId( id ) {\n\t\tconst order = getBlockOrder( id );\n\n\t\tif ( ! order.length ) {\n\t\t\treturn id;\n\t\t}\n\n\t\treturn getTrailingId( order[ order.length - 1 ] );\n\t}\n\n\tfunction getParentListItemId( id ) {\n\t\tconst listId = getBlockRootClientId( id );\n\t\tconst parentListItemId = getBlockRootClientId( listId );\n\t\tif ( ! parentListItemId ) return;\n\t\tif ( getBlockName( parentListItemId ) !== 'core/list-item' ) return;\n\t\treturn parentListItemId;\n\t}\n\n\t/**\n\t * Return the next list item with respect to the given list item. If none,\n\t * return the next list item of the parent list item if it exists.\n\t *\n\t * @param {string} id A list item client ID.\n\t * @return {string?} The client ID of the next list item.\n\t */\n\tfunction _getNextId( id ) {\n\t\tconst next = getNextBlockClientId( id );\n\t\tif ( next ) return next;\n\t\tconst parentListItemId = getParentListItemId( id );\n\t\tif ( ! parentListItemId ) return;\n\t\treturn _getNextId( parentListItemId );\n\t}\n\n\t/**\n\t * Given a client ID, return the client ID of the list item on the next\n\t * line, regardless of indentation level.\n\t *\n\t * @param {string} id The client ID of the current list item.\n\t * @return {string?} The client ID of the next list item.\n\t */\n\tfunction getNextId( id ) {\n\t\tconst order = getBlockOrder( id );\n\n\t\t// If the list item does not have a nested list, return the next list\n\t\t// item.\n\t\tif ( ! order.length ) {\n\t\t\treturn _getNextId( id );\n\t\t}\n\n\t\t// Get the first list item in the nested list.\n\t\treturn getBlockOrder( order[ 0 ] )[ 0 ];\n\t}\n\n\treturn ( forward ) => {\n\t\tfunction mergeWithNested( clientIdA, clientIdB ) {\n\t\t\tregistry.batch( () => {\n\t\t\t\t// When merging a sub list item with a higher next list item, we\n\t\t\t\t// also need to move any nested list items. Check if there's a\n\t\t\t\t// listed list, and append its nested list items to the current\n\t\t\t\t// list.\n\t\t\t\tconst [ nestedListClientId ] = getBlockOrder( clientIdB );\n\t\t\t\tif ( nestedListClientId ) {\n\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\tgetBlockOrder( nestedListClientId ),\n\t\t\t\t\t\tnestedListClientId,\n\t\t\t\t\t\tgetBlockRootClientId( clientIdA )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tmergeBlocks( clientIdA, clientIdB );\n\t\t\t} );\n\t\t}\n\n\t\tif ( forward ) {\n\t\t\tconst nextBlockClientId = getNextId( clientId );\n\n\t\t\tif ( ! nextBlockClientId ) {\n\t\t\t\tonMerge( forward );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( getParentListItemId( nextBlockClientId ) ) {\n\t\t\t\toutdentListItem( nextBlockClientId );\n\t\t\t} else {\n\t\t\t\tmergeWithNested( clientId, nextBlockClientId );\n\t\t\t}\n\t\t} else {\n\t\t\t// Merging is only done from the top level. For lowel levels, the\n\t\t\t// list item is outdented instead.\n\t\t\tconst previousBlockClientId = getPreviousBlockClientId( clientId );\n\t\t\tif ( getParentListItemId( clientId ) ) {\n\t\t\t\toutdentListItem( clientId );\n\t\t\t} else if ( previousBlockClientId ) {\n\t\t\t\tconst trailingId = getTrailingId( previousBlockClientId );\n\t\t\t\tmergeWithNested( trailingId, clientId );\n\t\t\t} else {\n\t\t\t\tonMerge( forward );\n\t\t\t}\n\t\t}\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACrE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;;AAEnE;AACA;AACA;AACA,OAAOC,kBAAkB,MAAM,yBAAyB;AAExD,eAAe,SAASC,QAAQA,CAAEC,QAAQ,EAAEC,OAAO,EAAG;EACrD,MAAMC,QAAQ,GAAGT,WAAW,CAAC,CAAC;EAC9B,MAAM;IACLU,wBAAwB;IACxBC,oBAAoB;IACpBC,aAAa;IACbC,oBAAoB;IACpBC;EACD,CAAC,GAAGZ,SAAS,CAAEE,gBAAiB,CAAC;EACjC,MAAM;IAAEW,WAAW;IAAEC;EAAqB,CAAC,GAC1Cf,WAAW,CAAEG,gBAAiB,CAAC;EAChC,MAAM,GAAIa,eAAe,CAAE,GAAGZ,kBAAkB,CAAEE,QAAS,CAAC;EAE5D,SAASW,aAAaA,CAAEC,EAAE,EAAG;IAC5B,MAAMC,KAAK,GAAGR,aAAa,CAAEO,EAAG,CAAC;IAEjC,IAAK,CAAEC,KAAK,CAACC,MAAM,EAAG;MACrB,OAAOF,EAAE;IACV;IAEA,OAAOD,aAAa,CAAEE,KAAK,CAAEA,KAAK,CAACC,MAAM,GAAG,CAAC,CAAG,CAAC;EAClD;EAEA,SAASC,mBAAmBA,CAAEH,EAAE,EAAG;IAClC,MAAMI,MAAM,GAAGV,oBAAoB,CAAEM,EAAG,CAAC;IACzC,MAAMK,gBAAgB,GAAGX,oBAAoB,CAAEU,MAAO,CAAC;IACvD,IAAK,CAAEC,gBAAgB,EAAG;IAC1B,IAAKV,YAAY,CAAEU,gBAAiB,CAAC,KAAK,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AClB;MACD;MAEA,IAAKN,mBAAmB,CAAEY,iBAAkB,CAAC,EAAG;QAC/CjB,eAAe,CAAEiB,iBAAkB,CAAC;MACrC,CAAC,MAAM;QACNL,eAAe,CAAEtB,QAAQ,EAAE2B,iBAAkB,CAAC;MAC/C;IACD,CAAC,MAAM;MACN;MACA;MACA,MAAMC,qBAAqB,GAAGzB,wBAAwB,CAAEH,QAAS,CAAC;MAClE,IAAKe,mBAAmB,CAAEf,QAAS,CAAC,EAAG;QACtCU,eAAe,CAAEV,QAAS,CAAC;MAC5B,CAAC,MAAM,IAAK4B,qBAAqB,EAAG;QACnC,MAAMC,UAAU,GAAGlB,aAAa,CAAEiB,qBAAsB,CAAC;QACzDN,eAAe,CAAEO,UAAU,EAAE7B,QAAS,CAAC;MACxC,CAAC,MAAM;QACNC,OAAO,CAAEoB,OAAQ,CAAC;MACnB;IACD;EACD,CAAC;AACF"}
|
|
@@ -5,5 +5,5 @@ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/pri
|
|
|
5
5
|
export const {
|
|
6
6
|
lock,
|
|
7
7
|
unlock
|
|
8
|
-
} = __dangerousOptInToUnstableAPIsOnlyForCoreModules('I know using unstable features means my
|
|
8
|
+
} = __dangerousOptInToUnstableAPIsOnlyForCoreModules('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/block-library');
|
|
9
9
|
//# sourceMappingURL=lock-unlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__dangerousOptInToUnstableAPIsOnlyForCoreModules","lock","unlock"],"sources":["@wordpress/block-library/src/lock-unlock.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my
|
|
1
|
+
{"version":3,"names":["__dangerousOptInToUnstableAPIsOnlyForCoreModules","lock","unlock"],"sources":["@wordpress/block-library/src/lock-unlock.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',\n\t\t'@wordpress/block-library'\n\t);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gDAAgD,QAAQ,yBAAyB;AAE1F,OAAO,MAAM;EAAEC,IAAI;EAAEC;AAAO,CAAC,GAC5BF,gDAAgD,CAC/C,iHAAiH,EACjH,0BACD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-library",
|
|
3
|
-
"version": "8.19.
|
|
3
|
+
"version": "8.19.7",
|
|
4
4
|
"description": "Block library for the WordPress editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -31,36 +31,36 @@
|
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.16.0",
|
|
34
|
-
"@wordpress/a11y": "^3.42.
|
|
35
|
-
"@wordpress/api-fetch": "^6.39.
|
|
36
|
-
"@wordpress/autop": "^3.42.
|
|
37
|
-
"@wordpress/blob": "^3.42.
|
|
38
|
-
"@wordpress/block-editor": "^12.10.
|
|
39
|
-
"@wordpress/blocks": "^12.19.
|
|
40
|
-
"@wordpress/components": "^25.8.
|
|
41
|
-
"@wordpress/compose": "^6.19.
|
|
42
|
-
"@wordpress/core-data": "^6.19.
|
|
43
|
-
"@wordpress/data": "^9.12.
|
|
44
|
-
"@wordpress/date": "^4.42.
|
|
45
|
-
"@wordpress/deprecated": "^3.42.
|
|
46
|
-
"@wordpress/dom": "^3.42.
|
|
47
|
-
"@wordpress/element": "^5.19.
|
|
48
|
-
"@wordpress/escape-html": "^2.42.
|
|
49
|
-
"@wordpress/hooks": "^3.42.
|
|
50
|
-
"@wordpress/html-entities": "^3.42.
|
|
51
|
-
"@wordpress/i18n": "^4.42.
|
|
52
|
-
"@wordpress/icons": "^9.33.
|
|
53
|
-
"@wordpress/interactivity": "^2.3.
|
|
54
|
-
"@wordpress/keycodes": "^3.42.
|
|
55
|
-
"@wordpress/notices": "^4.10.
|
|
56
|
-
"@wordpress/primitives": "^3.40.
|
|
57
|
-
"@wordpress/private-apis": "^0.24.
|
|
58
|
-
"@wordpress/reusable-blocks": "^4.19.
|
|
59
|
-
"@wordpress/rich-text": "^6.19.
|
|
60
|
-
"@wordpress/server-side-render": "^4.19.
|
|
61
|
-
"@wordpress/url": "^3.43.
|
|
62
|
-
"@wordpress/viewport": "^5.19.
|
|
63
|
-
"@wordpress/wordcount": "^3.42.
|
|
34
|
+
"@wordpress/a11y": "^3.42.7",
|
|
35
|
+
"@wordpress/api-fetch": "^6.39.7",
|
|
36
|
+
"@wordpress/autop": "^3.42.7",
|
|
37
|
+
"@wordpress/blob": "^3.42.7",
|
|
38
|
+
"@wordpress/block-editor": "^12.10.7",
|
|
39
|
+
"@wordpress/blocks": "^12.19.7",
|
|
40
|
+
"@wordpress/components": "^25.8.7",
|
|
41
|
+
"@wordpress/compose": "^6.19.7",
|
|
42
|
+
"@wordpress/core-data": "^6.19.7",
|
|
43
|
+
"@wordpress/data": "^9.12.7",
|
|
44
|
+
"@wordpress/date": "^4.42.7",
|
|
45
|
+
"@wordpress/deprecated": "^3.42.7",
|
|
46
|
+
"@wordpress/dom": "^3.42.7",
|
|
47
|
+
"@wordpress/element": "^5.19.7",
|
|
48
|
+
"@wordpress/escape-html": "^2.42.7",
|
|
49
|
+
"@wordpress/hooks": "^3.42.7",
|
|
50
|
+
"@wordpress/html-entities": "^3.42.7",
|
|
51
|
+
"@wordpress/i18n": "^4.42.7",
|
|
52
|
+
"@wordpress/icons": "^9.33.7",
|
|
53
|
+
"@wordpress/interactivity": "^2.3.7",
|
|
54
|
+
"@wordpress/keycodes": "^3.42.7",
|
|
55
|
+
"@wordpress/notices": "^4.10.7",
|
|
56
|
+
"@wordpress/primitives": "^3.40.7",
|
|
57
|
+
"@wordpress/private-apis": "^0.24.7",
|
|
58
|
+
"@wordpress/reusable-blocks": "^4.19.7",
|
|
59
|
+
"@wordpress/rich-text": "^6.19.7",
|
|
60
|
+
"@wordpress/server-side-render": "^4.19.7",
|
|
61
|
+
"@wordpress/url": "^3.43.7",
|
|
62
|
+
"@wordpress/viewport": "^5.19.7",
|
|
63
|
+
"@wordpress/wordcount": "^3.42.7",
|
|
64
64
|
"change-case": "^4.1.2",
|
|
65
65
|
"classnames": "^2.3.1",
|
|
66
66
|
"colord": "^2.7.0",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"publishConfig": {
|
|
79
79
|
"access": "public"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "5551609efcf6d5b15ac55842bbbb310faea607f9"
|
|
82
82
|
}
|
package/src/image/image.js
CHANGED
|
@@ -377,6 +377,8 @@ export default function Image( {
|
|
|
377
377
|
const lightboxChecked =
|
|
378
378
|
!! lightbox?.enabled || ( ! lightbox && !! lightboxSetting?.enabled );
|
|
379
379
|
|
|
380
|
+
const lightboxToggleDisabled = linkDestination !== 'none';
|
|
381
|
+
|
|
380
382
|
const dimensionsControl = (
|
|
381
383
|
<DimensionsTool
|
|
382
384
|
value={ { width, height, scale, aspectRatio } }
|
|
@@ -555,6 +557,14 @@ export default function Image( {
|
|
|
555
557
|
lightbox: { enabled: newValue },
|
|
556
558
|
} );
|
|
557
559
|
} }
|
|
560
|
+
disabled={ lightboxToggleDisabled }
|
|
561
|
+
help={
|
|
562
|
+
lightboxToggleDisabled
|
|
563
|
+
? __(
|
|
564
|
+
'“Expand on click” scales the image up, and can’t be combined with a link.'
|
|
565
|
+
)
|
|
566
|
+
: ''
|
|
567
|
+
}
|
|
558
568
|
/>
|
|
559
569
|
</ToolsPanelItem>
|
|
560
570
|
) }
|
package/src/image/index.php
CHANGED
|
@@ -16,11 +16,13 @@
|
|
|
16
16
|
* @return string The block content with the data-id attribute added.
|
|
17
17
|
*/
|
|
18
18
|
function render_block_core_image( $attributes, $content, $block ) {
|
|
19
|
+
if ( false === stripos( $content, '<img' ) ) {
|
|
20
|
+
return '';
|
|
21
|
+
}
|
|
19
22
|
|
|
20
23
|
$processor = new WP_HTML_Tag_Processor( $content );
|
|
21
|
-
$processor->next_tag( 'img' );
|
|
22
24
|
|
|
23
|
-
if ( $processor->
|
|
25
|
+
if ( ! $processor->next_tag( 'img' ) || null === $processor->get_attribute( 'src' ) ) {
|
|
24
26
|
return '';
|
|
25
27
|
}
|
|
26
28
|
|
|
@@ -32,45 +34,47 @@ function render_block_core_image( $attributes, $content, $block ) {
|
|
|
32
34
|
$processor->set_attribute( 'data-id', $attributes['data-id'] );
|
|
33
35
|
}
|
|
34
36
|
|
|
35
|
-
$lightbox_enabled = false;
|
|
36
37
|
$link_destination = isset( $attributes['linkDestination'] ) ? $attributes['linkDestination'] : 'none';
|
|
37
38
|
$lightbox_settings = block_core_image_get_lightbox_settings( $block->parsed_block );
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if ( isset( $lightbox_settings['enabled'] ) && true === $lightbox_settings['enabled'] ) {
|
|
43
|
-
$lightbox_enabled = true;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
40
|
+
$view_js_file_handle = 'wp-block-image-view';
|
|
41
|
+
$script_handles = $block->block_type->view_script_handles;
|
|
46
42
|
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
/*
|
|
44
|
+
* If the lightbox is enabled and the image is not linked, add the filter
|
|
45
|
+
* and the JavaScript view file.
|
|
46
|
+
*/
|
|
47
|
+
if (
|
|
48
|
+
isset( $lightbox_settings ) &&
|
|
49
|
+
'none' === $link_destination &&
|
|
50
|
+
isset( $lightbox_settings['enabled'] ) &&
|
|
51
|
+
true === $lightbox_settings['enabled']
|
|
52
|
+
) {
|
|
49
53
|
$block->block_type->supports['interactivity'] = true;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Determine whether the view script should be enqueued or not.
|
|
53
|
-
$view_js_file = 'wp-block-image-view';
|
|
54
|
-
if ( ! wp_script_is( $view_js_file ) ) {
|
|
55
|
-
$script_handles = $block->block_type->view_script_handles;
|
|
56
54
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
$block->block_type->view_script_handles = array_diff( $script_handles, array( $view_js_file ) );
|
|
60
|
-
}
|
|
61
|
-
// If the script is needed, but it was previously removed, add it again.
|
|
62
|
-
if ( $lightbox_enabled && ! in_array( $view_js_file, $script_handles, true ) ) {
|
|
63
|
-
$block->block_type->view_script_handles = array_merge( $script_handles, array( $view_js_file ) );
|
|
55
|
+
if ( ! in_array( $view_js_file_handle, $script_handles, true ) ) {
|
|
56
|
+
$block->block_type->view_script_handles = array_merge( $script_handles, array( $view_js_file_handle ) );
|
|
64
57
|
}
|
|
65
|
-
}
|
|
66
58
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
59
|
+
/*
|
|
60
|
+
* This render needs to happen in a filter with priority 15 to ensure
|
|
61
|
+
* that it runs after the duotone filter and that duotone styles are
|
|
62
|
+
* applied to the image in the lightbox. We also need to ensure that the
|
|
63
|
+
* lightbox works with any plugins that might use filters as well. We
|
|
64
|
+
* can consider removing this in the future if the way the blocks are
|
|
65
|
+
* rendered changes, or if a new kind of filter is introduced.
|
|
66
|
+
*/
|
|
73
67
|
add_filter( 'render_block_core/image', 'block_core_image_render_lightbox', 15, 2 );
|
|
68
|
+
} else {
|
|
69
|
+
/*
|
|
70
|
+
* Remove the filter and the JavaScript view file if previously added by
|
|
71
|
+
* other Image blocks.
|
|
72
|
+
*/
|
|
73
|
+
remove_filter( 'render_block_core/image', 'block_core_image_render_lightbox', 15 );
|
|
74
|
+
// If the script is not needed, and it is still in the `view_script_handles`, remove it.
|
|
75
|
+
if ( in_array( $view_js_file_handle, $script_handles, true ) ) {
|
|
76
|
+
$block->block_type->view_script_handles = array_diff( $script_handles, array( $view_js_file_handle ) );
|
|
77
|
+
}
|
|
74
78
|
}
|
|
75
79
|
|
|
76
80
|
return $processor->get_updated_html();
|
|
@@ -123,11 +127,28 @@ function block_core_image_get_lightbox_settings( $block ) {
|
|
|
123
127
|
* @return string Filtered block content.
|
|
124
128
|
*/
|
|
125
129
|
function block_core_image_render_lightbox( $block_content, $block ) {
|
|
130
|
+
/*
|
|
131
|
+
* If it's not possible that an IMG element exists then return the given
|
|
132
|
+
* block content as-is. It may be that there's no actual image in the block
|
|
133
|
+
* or it could be that another plugin already modified this HTML.
|
|
134
|
+
*/
|
|
135
|
+
if ( false === stripos( $block_content, '<img' ) ) {
|
|
136
|
+
return $block_content;
|
|
137
|
+
}
|
|
138
|
+
|
|
126
139
|
$processor = new WP_HTML_Tag_Processor( $block_content );
|
|
127
140
|
|
|
128
141
|
$aria_label = __( 'Enlarge image' );
|
|
129
142
|
|
|
130
|
-
|
|
143
|
+
/*
|
|
144
|
+
* If there's definitely no IMG element in the block then return the given
|
|
145
|
+
* block content as-is. There's nothing that this code can knowingly modify
|
|
146
|
+
* to add the lightbox behavior.
|
|
147
|
+
*/
|
|
148
|
+
if ( ! $processor->next_tag( 'img' ) ) {
|
|
149
|
+
return $block_content;
|
|
150
|
+
}
|
|
151
|
+
|
|
131
152
|
$alt_attribute = $processor->get_attribute( 'alt' );
|
|
132
153
|
|
|
133
154
|
// An empty alt attribute `alt=""` is valid for decorative images.
|
|
@@ -149,8 +170,8 @@ function block_core_image_render_lightbox( $block_content, $block ) {
|
|
|
149
170
|
if ( isset( $block['attrs']['id'] ) ) {
|
|
150
171
|
$img_uploaded_src = wp_get_attachment_url( $block['attrs']['id'] );
|
|
151
172
|
$img_metadata = wp_get_attachment_metadata( $block['attrs']['id'] );
|
|
152
|
-
$img_width = $img_metadata['width'];
|
|
153
|
-
$img_height = $img_metadata['height'];
|
|
173
|
+
$img_width = $img_metadata['width'] ?? 'none';
|
|
174
|
+
$img_height = $img_metadata['height'] ?? 'none';
|
|
154
175
|
} else {
|
|
155
176
|
$img_uploaded_src = $processor->get_attribute( 'src' );
|
|
156
177
|
$img_width = 'none';
|
|
@@ -310,8 +331,6 @@ HTML;
|
|
|
310
331
|
* @since 6.4.0
|
|
311
332
|
*
|
|
312
333
|
* @global WP_Scripts $wp_scripts
|
|
313
|
-
*
|
|
314
|
-
* @return void
|
|
315
334
|
*/
|
|
316
335
|
function block_core_image_ensure_interactivity_dependency() {
|
|
317
336
|
global $wp_scripts;
|
|
@@ -327,8 +346,6 @@ add_action( 'wp_print_scripts', 'block_core_image_ensure_interactivity_dependenc
|
|
|
327
346
|
|
|
328
347
|
/**
|
|
329
348
|
* Registers the `core/image` block on server.
|
|
330
|
-
*
|
|
331
|
-
* @return void
|
|
332
349
|
*/
|
|
333
350
|
function register_block_core_image() {
|
|
334
351
|
register_block_type_from_metadata(
|
|
@@ -76,6 +76,24 @@ export default function useMerge( clientId, onMerge ) {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
return ( forward ) => {
|
|
79
|
+
function mergeWithNested( clientIdA, clientIdB ) {
|
|
80
|
+
registry.batch( () => {
|
|
81
|
+
// When merging a sub list item with a higher next list item, we
|
|
82
|
+
// also need to move any nested list items. Check if there's a
|
|
83
|
+
// listed list, and append its nested list items to the current
|
|
84
|
+
// list.
|
|
85
|
+
const [ nestedListClientId ] = getBlockOrder( clientIdB );
|
|
86
|
+
if ( nestedListClientId ) {
|
|
87
|
+
moveBlocksToPosition(
|
|
88
|
+
getBlockOrder( nestedListClientId ),
|
|
89
|
+
nestedListClientId,
|
|
90
|
+
getBlockRootClientId( clientIdA )
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
mergeBlocks( clientIdA, clientIdB );
|
|
94
|
+
} );
|
|
95
|
+
}
|
|
96
|
+
|
|
79
97
|
if ( forward ) {
|
|
80
98
|
const nextBlockClientId = getNextId( clientId );
|
|
81
99
|
|
|
@@ -87,14 +105,7 @@ export default function useMerge( clientId, onMerge ) {
|
|
|
87
105
|
if ( getParentListItemId( nextBlockClientId ) ) {
|
|
88
106
|
outdentListItem( nextBlockClientId );
|
|
89
107
|
} else {
|
|
90
|
-
|
|
91
|
-
moveBlocksToPosition(
|
|
92
|
-
getBlockOrder( nextBlockClientId ),
|
|
93
|
-
nextBlockClientId,
|
|
94
|
-
getPreviousBlockClientId( nextBlockClientId )
|
|
95
|
-
);
|
|
96
|
-
mergeBlocks( clientId, nextBlockClientId );
|
|
97
|
-
} );
|
|
108
|
+
mergeWithNested( clientId, nextBlockClientId );
|
|
98
109
|
}
|
|
99
110
|
} else {
|
|
100
111
|
// Merging is only done from the top level. For lowel levels, the
|
|
@@ -104,21 +115,7 @@ export default function useMerge( clientId, onMerge ) {
|
|
|
104
115
|
outdentListItem( clientId );
|
|
105
116
|
} else if ( previousBlockClientId ) {
|
|
106
117
|
const trailingId = getTrailingId( previousBlockClientId );
|
|
107
|
-
|
|
108
|
-
// When merging a list item with a previous trailing list
|
|
109
|
-
// item, we also need to move any nested list items. First,
|
|
110
|
-
// check if there's a listed list. If there's a nested list,
|
|
111
|
-
// append its nested list items to the trailing list.
|
|
112
|
-
const [ nestedListClientId ] = getBlockOrder( clientId );
|
|
113
|
-
if ( nestedListClientId ) {
|
|
114
|
-
moveBlocksToPosition(
|
|
115
|
-
getBlockOrder( nestedListClientId ),
|
|
116
|
-
nestedListClientId,
|
|
117
|
-
getBlockRootClientId( trailingId )
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
mergeBlocks( trailingId, clientId );
|
|
121
|
-
} );
|
|
118
|
+
mergeWithNested( trailingId, clientId );
|
|
122
119
|
} else {
|
|
123
120
|
onMerge( forward );
|
|
124
121
|
}
|
package/src/lock-unlock.js
CHANGED
|
@@ -5,6 +5,6 @@ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/pri
|
|
|
5
5
|
|
|
6
6
|
export const { lock, unlock } =
|
|
7
7
|
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
|
|
8
|
-
'I know using unstable features means my
|
|
8
|
+
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
|
|
9
9
|
'@wordpress/block-library'
|
|
10
10
|
);
|
package/src/pattern/index.php
CHANGED
|
@@ -7,8 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Registers the `core/pattern` block on the server.
|
|
10
|
-
*
|
|
11
|
-
* @return void
|
|
12
10
|
*/
|
|
13
11
|
function register_block_core_pattern() {
|
|
14
12
|
register_block_type_from_metadata(
|
|
@@ -46,7 +44,6 @@ function render_block_core_pattern( $attributes ) {
|
|
|
46
44
|
// Backward compatibility for handling Block Hooks and injecting the theme attribute in the Gutenberg plugin.
|
|
47
45
|
// This can be removed when the minimum supported WordPress is >= 6.4.
|
|
48
46
|
if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN && ! function_exists( 'traverse_and_serialize_blocks' ) ) {
|
|
49
|
-
$content = _inject_theme_attribute_in_block_template_content( $content );
|
|
50
47
|
$blocks = parse_blocks( $content );
|
|
51
48
|
$content = gutenberg_serialize_blocks( $blocks );
|
|
52
49
|
}
|
|
@@ -38,6 +38,7 @@ function render_block_core_post_navigation_link( $attributes, $content ) {
|
|
|
38
38
|
$link = 'next' === $navigation_type ? _x( 'Next', 'label for next post link' ) : _x( 'Previous', 'label for previous post link' );
|
|
39
39
|
$label = '';
|
|
40
40
|
|
|
41
|
+
// Only use hardcoded values here, otherwise we need to add escaping where these values are used.
|
|
41
42
|
$arrow_map = array(
|
|
42
43
|
'none' => '',
|
|
43
44
|
'arrow' => array(
|
|
@@ -88,7 +89,7 @@ function render_block_core_post_navigation_link( $attributes, $content ) {
|
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
// Display arrows.
|
|
91
|
-
if ( isset( $attributes['arrow'] ) &&
|
|
92
|
+
if ( isset( $attributes['arrow'] ) && 'none' !== $attributes['arrow'] && isset( $arrow_map[ $attributes['arrow'] ] ) ) {
|
|
92
93
|
$arrow = $arrow_map[ $attributes['arrow'] ][ $navigation_type ];
|
|
93
94
|
|
|
94
95
|
if ( 'next' === $navigation_type ) {
|
package/src/search/index.php
CHANGED
|
@@ -281,8 +281,6 @@ function classnames_for_block_core_search( $attributes ) {
|
|
|
281
281
|
* @param array $wrapper_styles Current collection of wrapper styles.
|
|
282
282
|
* @param array $button_styles Current collection of button styles.
|
|
283
283
|
* @param array $input_styles Current collection of input styles.
|
|
284
|
-
*
|
|
285
|
-
* @return void
|
|
286
284
|
*/
|
|
287
285
|
function apply_block_core_search_border_style( $attributes, $property, $side, &$wrapper_styles, &$button_styles, &$input_styles ) {
|
|
288
286
|
$is_button_inside = isset( $attributes['buttonPosition'] ) && 'button-inside' === $attributes['buttonPosition'];
|
|
@@ -327,8 +325,6 @@ function apply_block_core_search_border_style( $attributes, $property, $side, &$
|
|
|
327
325
|
* @param array $wrapper_styles Current collection of wrapper styles.
|
|
328
326
|
* @param array $button_styles Current collection of button styles.
|
|
329
327
|
* @param array $input_styles Current collection of input styles.
|
|
330
|
-
*
|
|
331
|
-
* @return void
|
|
332
328
|
*/
|
|
333
329
|
function apply_block_core_search_border_styles( $attributes, $property, &$wrapper_styles, &$button_styles, &$input_styles ) {
|
|
334
330
|
apply_block_core_search_border_style( $attributes, $property, null, $wrapper_styles, $button_styles, $input_styles );
|
|
@@ -18,13 +18,10 @@ function render_block_core_template_part( $attributes ) {
|
|
|
18
18
|
$template_part_id = null;
|
|
19
19
|
$content = null;
|
|
20
20
|
$area = WP_TEMPLATE_PART_AREA_UNCATEGORIZED;
|
|
21
|
+
$theme = isset( $attributes['theme'] ) ? $attributes['theme'] : get_stylesheet();
|
|
21
22
|
|
|
22
|
-
if (
|
|
23
|
-
|
|
24
|
-
isset( $attributes['theme'] ) &&
|
|
25
|
-
get_stylesheet() === $attributes['theme']
|
|
26
|
-
) {
|
|
27
|
-
$template_part_id = $attributes['theme'] . '//' . $attributes['slug'];
|
|
23
|
+
if ( isset( $attributes['slug'] ) && get_stylesheet() === $theme ) {
|
|
24
|
+
$template_part_id = $theme . '//' . $attributes['slug'];
|
|
28
25
|
$template_part_query = new WP_Query(
|
|
29
26
|
array(
|
|
30
27
|
'post_type' => 'wp_template_part',
|
|
@@ -34,7 +31,7 @@ function render_block_core_template_part( $attributes ) {
|
|
|
34
31
|
array(
|
|
35
32
|
'taxonomy' => 'wp_theme',
|
|
36
33
|
'field' => 'name',
|
|
37
|
-
'terms' => $
|
|
34
|
+
'terms' => $theme,
|
|
38
35
|
),
|
|
39
36
|
),
|
|
40
37
|
'posts_per_page' => 1,
|