@wordpress/block-library 8.19.2 → 8.19.4
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/CHANGELOG.md +7 -0
- package/build/cover/edit/inspector-controls.js +1 -1
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/embed/edit.js +17 -0
- package/build/embed/edit.js.map +1 -1
- package/build/embed/edit.native.js +17 -0
- package/build/embed/edit.native.js.map +1 -1
- package/build/image/image.js +2 -2
- package/build/image/image.js.map +1 -1
- package/build/image/view.js +142 -31
- package/build/image/view.js.map +1 -1
- package/build/latest-posts/edit.js +6 -2
- package/build/latest-posts/edit.js.map +1 -1
- package/build/media-text/edit.js +1 -1
- package/build/media-text/edit.js.map +1 -1
- package/build/navigation/edit/deleted-navigation-warning.js +6 -4
- package/build/navigation/edit/deleted-navigation-warning.js.map +1 -1
- package/build/navigation/edit/index.js +3 -2
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/inner-blocks.js +2 -1
- package/build/navigation/edit/inner-blocks.js.map +1 -1
- package/build/paragraph/edit.js +1 -1
- package/build/paragraph/edit.js.map +1 -1
- package/build/search/edit.js +12 -10
- package/build/search/edit.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +1 -1
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/embed/edit.js +17 -0
- package/build-module/embed/edit.js.map +1 -1
- package/build-module/embed/edit.native.js +17 -0
- package/build-module/embed/edit.native.js.map +1 -1
- package/build-module/image/image.js +2 -2
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/view.js +142 -31
- package/build-module/image/view.js.map +1 -1
- package/build-module/latest-posts/edit.js +6 -2
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/media-text/edit.js +1 -1
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/navigation/edit/deleted-navigation-warning.js +7 -4
- package/build-module/navigation/edit/deleted-navigation-warning.js.map +1 -1
- package/build-module/navigation/edit/index.js +3 -2
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/inner-blocks.js +2 -1
- package/build-module/navigation/edit/inner-blocks.js.map +1 -1
- package/build-module/paragraph/edit.js +1 -1
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/search/edit.js +12 -10
- package/build-module/search/edit.js.map +1 -1
- package/build-style/image/style-rtl.css +17 -6
- package/build-style/image/style.css +17 -6
- package/build-style/navigation-link/style-rtl.css +0 -1
- package/build-style/navigation-link/style.css +0 -1
- package/build-style/post-featured-image/style-rtl.css +3 -0
- package/build-style/post-featured-image/style.css +3 -0
- package/build-style/post-template/style-rtl.css +25 -0
- package/build-style/post-template/style.css +25 -0
- package/build-style/style-rtl.css +46 -7
- package/build-style/style.css +46 -7
- package/package.json +32 -32
- package/src/cover/edit/inspector-controls.js +1 -1
- package/src/embed/edit.js +15 -0
- package/src/embed/edit.native.js +15 -0
- package/src/footnotes/index.php +13 -179
- package/src/image/image.js +2 -2
- package/src/image/index.php +73 -48
- package/src/image/style.scss +23 -6
- package/src/image/view.js +151 -48
- package/src/latest-posts/edit.js +10 -2
- package/src/latest-posts/index.php +18 -8
- package/src/media-text/edit.js +1 -1
- package/src/navigation/edit/deleted-navigation-warning.js +9 -4
- package/src/navigation/edit/index.js +26 -17
- package/src/navigation/edit/inner-blocks.js +1 -0
- package/src/navigation-link/style.scss +0 -1
- package/src/paragraph/edit.js +1 -1
- package/src/post-featured-image/style.scss +4 -0
- package/src/post-template/style.scss +20 -0
- package/src/search/edit.js +16 -10
|
@@ -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\tlightboxSetting === true || lightboxSetting?.allowEditing === true;\n\n\tconst lightboxChecked =\n\t\tlightbox?.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,EACtCC,4BAA4B,IAAIC,cAAc,EAC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,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","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,EACtCC,4BAA4B,IAAIC,cAAc,EAC9CC,4BAA4B,IAAIC,cAAc,QACxC,uBAAuB;AAC9B,SAASC,gBAAgB,EAAEC,WAAW,QAAQ,oBAAoB;AAClE,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SACCC,aAAa,EACbC,iBAAiB,EACjBC,QAAQ,EACRC,6BAA6B,IAAIC,eAAe,EAChDC,gBAAgB,EAChBC,KAAK,IAAIC,gBAAgB,EACzBC,UAAU,EACVC,qBAAqB,EACrBC,yBAAyB,IAAIC,WAAW,EACxCC,iCAAiC,EACjCC,4BAA4B,IAAIC,cAAc,EAC9CC,WAAW,IAAIC,sBAAsB,QAC/B,yBAAyB;AAChC,SACCC,SAAS,EACTC,OAAO,EACPC,QAAQ,EACRC,MAAM,EACNC,WAAW,QACL,oBAAoB;AAC3B,SAASC,EAAE,E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 +3,66 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { store } from '@wordpress/interactivity';
|
|
5
5
|
const focusableSelectors = ['a[href]', 'area[href]', 'input:not([disabled]):not([type="hidden"]):not([aria-hidden])', 'select:not([disabled]):not([aria-hidden])', 'textarea:not([disabled]):not([aria-hidden])', 'button:not([disabled]):not([aria-hidden])', 'iframe', 'object', 'embed', '[contenteditable]', '[tabindex]:not([tabindex^="-"])'];
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
* Stores a context-bound scroll handler.
|
|
9
|
+
*
|
|
10
|
+
* This callback could be defined inline inside of the store
|
|
11
|
+
* object but it's created externally to avoid confusion about
|
|
12
|
+
* how its logic is called. This logic is not referenced directly
|
|
13
|
+
* by the directives in the markup because the scroll event we
|
|
14
|
+
* need to listen to is triggered on the window; so by defining it
|
|
15
|
+
* outside of the store, we signal that the behavior here is different.
|
|
16
|
+
* If we find a compelling reason to move it to the store, feel free.
|
|
17
|
+
*
|
|
18
|
+
* @type {Function}
|
|
19
|
+
*/
|
|
20
|
+
let scrollCallback;
|
|
21
|
+
|
|
22
|
+
/*
|
|
23
|
+
* Tracks whether user is touching screen; used to
|
|
24
|
+
* differentiate behavior for touch and mouse input.
|
|
25
|
+
*
|
|
26
|
+
* @type {boolean}
|
|
27
|
+
*/
|
|
28
|
+
let isTouching = false;
|
|
29
|
+
|
|
30
|
+
/*
|
|
31
|
+
* Tracks the last time the screen was touched; used to
|
|
32
|
+
* differentiate behavior for touch and mouse input.
|
|
33
|
+
*
|
|
34
|
+
* @type {number}
|
|
35
|
+
*/
|
|
36
|
+
let lastTouchTime = 0;
|
|
37
|
+
|
|
38
|
+
/*
|
|
39
|
+
* Lightbox page-scroll handler: prevents scrolling.
|
|
40
|
+
*
|
|
41
|
+
* This handler is added to prevent scrolling behaviors that
|
|
42
|
+
* trigger content shift while the lightbox is open.
|
|
43
|
+
*
|
|
44
|
+
* It would be better to accomplish this through CSS alone, but
|
|
45
|
+
* using overflow: hidden is currently the only way to do so, and
|
|
46
|
+
* that causes the layout to shift and prevents the zoom animation
|
|
47
|
+
* from working in some cases because we're unable to account for
|
|
48
|
+
* the layout shift when doing the animation calculations. Instead,
|
|
49
|
+
* here we use JavaScript to prevent and reset the scrolling
|
|
50
|
+
* behavior. In the future, we may be able to use CSS or overflow: hidden
|
|
51
|
+
* instead to not rely on JavaScript, but this seems to be the best approach
|
|
52
|
+
* for now that provides the best visual experience.
|
|
53
|
+
*
|
|
54
|
+
* @param {Object} context Interactivity page context?
|
|
55
|
+
*/
|
|
56
|
+
function handleScroll(context) {
|
|
57
|
+
// We can't override the scroll behavior on mobile devices
|
|
58
|
+
// because doing so breaks the pinch to zoom functionality, and we
|
|
59
|
+
// want to allow users to zoom in further on the high-res image.
|
|
60
|
+
if (!isTouching && Date.now() - lastTouchTime > 450) {
|
|
61
|
+
// We are unable to use event.preventDefault() to prevent scrolling
|
|
62
|
+
// because the scroll event can't be canceled, so we reset the position instead.
|
|
63
|
+
window.scrollTo(context.core.image.scrollLeftReset, context.core.image.scrollTopReset);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
6
66
|
store({
|
|
7
67
|
state: {
|
|
8
68
|
core: {
|
|
@@ -29,38 +89,39 @@ store({
|
|
|
29
89
|
context.core.image.scrollDelta = 0;
|
|
30
90
|
context.core.image.lightboxEnabled = true;
|
|
31
91
|
setStyles(context, event);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
//
|
|
35
|
-
|
|
92
|
+
context.core.image.scrollTopReset = window.pageYOffset || document.documentElement.scrollTop;
|
|
93
|
+
|
|
94
|
+
// In most cases, this value will be 0, but this is included
|
|
95
|
+
// in case a user has created a page with horizontal scrolling.
|
|
96
|
+
context.core.image.scrollLeftReset = window.pageXOffset || document.documentElement.scrollLeft;
|
|
97
|
+
|
|
98
|
+
// We define and bind the scroll callback here so
|
|
99
|
+
// that we can pass the context and as an argument.
|
|
100
|
+
// We may be able to change this in the future if we
|
|
101
|
+
// define the scroll callback in the store instead, but
|
|
102
|
+
// this approach seems to tbe clearest for now.
|
|
103
|
+
scrollCallback = handleScroll.bind(null, context);
|
|
104
|
+
|
|
105
|
+
// We need to add a scroll event listener to the window
|
|
106
|
+
// here because we are unable to otherwise access it via
|
|
107
|
+
// the Interactivity API directives. If we add a native way
|
|
108
|
+
// to access the window, we can remove this.
|
|
109
|
+
window.addEventListener('scroll', scrollCallback, false);
|
|
36
110
|
},
|
|
37
111
|
hideLightbox: async ({
|
|
38
|
-
context
|
|
39
|
-
event
|
|
112
|
+
context
|
|
40
113
|
}) => {
|
|
41
114
|
context.core.image.hideAnimationEnabled = true;
|
|
42
115
|
if (context.core.image.lightboxEnabled) {
|
|
43
|
-
//
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
|
53
|
-
const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
|
|
54
|
-
// if any scroll is attempted, set this to the previous value.
|
|
55
|
-
window.onscroll = function () {
|
|
56
|
-
window.scrollTo(scrollLeft, scrollTop);
|
|
57
|
-
};
|
|
58
|
-
// Enable scrolling after the animation finishes
|
|
59
|
-
setTimeout(function () {
|
|
60
|
-
window.onscroll = function () {};
|
|
61
|
-
}, 400);
|
|
62
|
-
}
|
|
63
|
-
document.documentElement.classList.remove('wp-has-lightbox-open');
|
|
116
|
+
// We want to wait until the close animation is completed
|
|
117
|
+
// before allowing a user to scroll again. The duration of this
|
|
118
|
+
// animation is defined in the styles.scss and depends on if the
|
|
119
|
+
// animation is 'zoom' or 'fade', but in any case we should wait
|
|
120
|
+
// a few milliseconds longer than the duration, otherwise a user
|
|
121
|
+
// may scroll too soon and cause the animation to look sloppy.
|
|
122
|
+
setTimeout(function () {
|
|
123
|
+
window.removeEventListener('scroll', scrollCallback);
|
|
124
|
+
}, 450);
|
|
64
125
|
context.core.image.lightboxEnabled = false;
|
|
65
126
|
context.core.image.lastFocusedElement.focus({
|
|
66
127
|
preventScroll: true
|
|
@@ -104,6 +165,30 @@ store({
|
|
|
104
165
|
context,
|
|
105
166
|
ref
|
|
106
167
|
});
|
|
168
|
+
},
|
|
169
|
+
handleTouchStart: () => {
|
|
170
|
+
isTouching = true;
|
|
171
|
+
},
|
|
172
|
+
handleTouchMove: ({
|
|
173
|
+
context,
|
|
174
|
+
event
|
|
175
|
+
}) => {
|
|
176
|
+
// On mobile devices, we want to prevent triggering the
|
|
177
|
+
// scroll event because otherwise the page jumps around as
|
|
178
|
+
// we reset the scroll position. This also means that closing
|
|
179
|
+
// the lightbox requires that a user perform a simple tap. This
|
|
180
|
+
// may be changed in the future if we find a better alternative
|
|
181
|
+
// to override or reset the scroll position during swipe actions.
|
|
182
|
+
if (context.core.image.lightboxEnabled) {
|
|
183
|
+
event.preventDefault();
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
handleTouchEnd: () => {
|
|
187
|
+
// We need to wait a few milliseconds before resetting
|
|
188
|
+
// to ensure that pinch to zoom works consistently
|
|
189
|
+
// on mobile devices when the lightbox is open.
|
|
190
|
+
lastTouchTime = Date.now();
|
|
191
|
+
isTouching = false;
|
|
107
192
|
}
|
|
108
193
|
}
|
|
109
194
|
}
|
|
@@ -114,7 +199,17 @@ store({
|
|
|
114
199
|
roleAttribute: ({
|
|
115
200
|
context
|
|
116
201
|
}) => {
|
|
117
|
-
return context.core.image.lightboxEnabled ? 'dialog' :
|
|
202
|
+
return context.core.image.lightboxEnabled ? 'dialog' : null;
|
|
203
|
+
},
|
|
204
|
+
ariaModal: ({
|
|
205
|
+
context
|
|
206
|
+
}) => {
|
|
207
|
+
return context.core.image.lightboxEnabled ? 'true' : null;
|
|
208
|
+
},
|
|
209
|
+
dialogLabel: ({
|
|
210
|
+
context
|
|
211
|
+
}) => {
|
|
212
|
+
return context.core.image.lightboxEnabled ? context.core.image.dialogLabel : null;
|
|
118
213
|
},
|
|
119
214
|
lightboxObjectFit: ({
|
|
120
215
|
context
|
|
@@ -126,7 +221,7 @@ store({
|
|
|
126
221
|
enlargedImgSrc: ({
|
|
127
222
|
context
|
|
128
223
|
}) => {
|
|
129
|
-
return context.core.image.initialized ? context.core.image.imageUploadedSrc : '';
|
|
224
|
+
return context.core.image.initialized ? context.core.image.imageUploadedSrc : 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=';
|
|
130
225
|
}
|
|
131
226
|
}
|
|
132
227
|
}
|
|
@@ -221,6 +316,14 @@ store({
|
|
|
221
316
|
}));
|
|
222
317
|
}
|
|
223
318
|
});
|
|
319
|
+
|
|
320
|
+
/*
|
|
321
|
+
* Computes styles for the lightbox and adds them to the document.
|
|
322
|
+
*
|
|
323
|
+
* @function
|
|
324
|
+
* @param {Object} context - An Interactivity API context
|
|
325
|
+
* @param {Object} event - A triggering event
|
|
326
|
+
*/
|
|
224
327
|
function setStyles(context, event) {
|
|
225
328
|
// The reference img element lies adjacent
|
|
226
329
|
// to the event target button in the DOM.
|
|
@@ -229,11 +332,11 @@ function setStyles(context, event) {
|
|
|
229
332
|
naturalHeight,
|
|
230
333
|
offsetWidth: originalWidth,
|
|
231
334
|
offsetHeight: originalHeight
|
|
232
|
-
} = event.target.
|
|
335
|
+
} = event.target.previousElementSibling;
|
|
233
336
|
let {
|
|
234
337
|
x: screenPosX,
|
|
235
338
|
y: screenPosY
|
|
236
|
-
} = event.target.
|
|
339
|
+
} = event.target.previousElementSibling.getBoundingClientRect();
|
|
237
340
|
|
|
238
341
|
// Natural ratio of the image clicked to open the lightbox.
|
|
239
342
|
const naturalRatio = naturalWidth / naturalHeight;
|
|
@@ -371,6 +474,14 @@ function setStyles(context, event) {
|
|
|
371
474
|
}
|
|
372
475
|
`;
|
|
373
476
|
}
|
|
477
|
+
|
|
478
|
+
/*
|
|
479
|
+
* Debounces a function call.
|
|
480
|
+
*
|
|
481
|
+
* @function
|
|
482
|
+
* @param {Function} func - A function to be called
|
|
483
|
+
* @param {number} wait - The time to wait before calling the function
|
|
484
|
+
*/
|
|
374
485
|
function debounce(func, wait = 50) {
|
|
375
486
|
let timeout;
|
|
376
487
|
return () => {
|