@wordpress/block-library 6.0.20 → 6.0.26
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/gallery/constants.js +5 -1
- package/build/gallery/constants.js.map +1 -1
- package/build/gallery/transforms.js +8 -2
- package/build/gallery/transforms.js.map +1 -1
- package/build/gallery/utils.js +4 -3
- package/build/gallery/utils.js.map +1 -1
- package/build/heading/edit.js +14 -2
- package/build/heading/edit.js.map +1 -1
- package/build/navigation/edit/index.js +8 -2
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/navigation-menu-selector.js +42 -4
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build/navigation/edit/placeholder/index.js +6 -41
- package/build/navigation/edit/placeholder/index.js.map +1 -1
- package/build/navigation/use-convert-classic-menu.js +59 -0
- package/build/navigation/use-convert-classic-menu.js.map +1 -0
- package/build/page-list/edit.js +37 -10
- package/build/page-list/edit.js.map +1 -1
- package/build/post-featured-image/dimension-controls.js +50 -30
- package/build/post-featured-image/dimension-controls.js.map +1 -1
- package/build/post-featured-image/edit.js +4 -2
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/site-logo/edit.js +0 -25
- package/build/site-logo/edit.js.map +1 -1
- package/build/social-links/deprecated.js +1 -62
- package/build/social-links/deprecated.js.map +1 -1
- package/build/social-links/edit.js +1 -1
- package/build/social-links/edit.js.map +1 -1
- package/build/spacer/controls.js +111 -0
- package/build/spacer/controls.js.map +1 -0
- package/build/spacer/controls.native.js +95 -0
- package/build/spacer/controls.native.js.map +1 -0
- package/build/spacer/deprecated.js +53 -0
- package/build/spacer/deprecated.js.map +1 -0
- package/build/spacer/edit.js +111 -82
- package/build/spacer/edit.js.map +1 -1
- package/build/spacer/edit.native.js +76 -0
- package/build/spacer/edit.native.js.map +1 -0
- package/build/spacer/index.js +7 -4
- package/build/spacer/index.js.map +1 -1
- package/build/spacer/save.js +6 -3
- package/build/spacer/save.js.map +1 -1
- package/build-module/gallery/constants.js +2 -0
- package/build-module/gallery/constants.js.map +1 -1
- package/build-module/gallery/transforms.js +8 -2
- package/build-module/gallery/transforms.js.map +1 -1
- package/build-module/gallery/utils.js +5 -4
- package/build-module/gallery/utils.js.map +1 -1
- package/build-module/heading/edit.js +15 -3
- package/build-module/heading/edit.js.map +1 -1
- package/build-module/navigation/edit/index.js +7 -2
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.js +39 -4
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/navigation/edit/placeholder/index.js +5 -41
- package/build-module/navigation/edit/placeholder/index.js.map +1 -1
- package/build-module/navigation/use-convert-classic-menu.js +47 -0
- package/build-module/navigation/use-convert-classic-menu.js.map +1 -0
- package/build-module/page-list/edit.js +38 -11
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/post-featured-image/dimension-controls.js +52 -29
- package/build-module/post-featured-image/dimension-controls.js.map +1 -1
- package/build-module/post-featured-image/edit.js +4 -2
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/site-logo/edit.js +0 -25
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/social-links/deprecated.js +1 -62
- package/build-module/social-links/deprecated.js.map +1 -1
- package/build-module/social-links/edit.js +1 -1
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/spacer/controls.js +101 -0
- package/build-module/spacer/controls.js.map +1 -0
- package/build-module/spacer/controls.native.js +82 -0
- package/build-module/spacer/controls.native.js.map +1 -0
- package/build-module/spacer/deprecated.js +44 -0
- package/build-module/spacer/deprecated.js.map +1 -0
- package/build-module/spacer/edit.js +108 -82
- package/build-module/spacer/edit.js.map +1 -1
- package/build-module/spacer/edit.native.js +61 -0
- package/build-module/spacer/edit.native.js.map +1 -0
- package/build-module/spacer/index.js +6 -4
- package/build-module/spacer/index.js.map +1 -1
- package/build-module/spacer/save.js +6 -3
- package/build-module/spacer/save.js.map +1 -1
- package/build-style/common-rtl.css +8 -0
- package/build-style/common.css +8 -0
- package/build-style/cover/style-rtl.css +60 -0
- package/build-style/cover/style.css +60 -0
- package/build-style/editor-rtl.css +8 -7
- package/build-style/editor.css +8 -7
- package/build-style/gallery/style-rtl.css +2 -1
- package/build-style/gallery/style.css +2 -1
- package/build-style/image/style-rtl.css +0 -2
- package/build-style/image/style.css +0 -2
- package/build-style/page-list/editor-rtl.css +4 -0
- package/build-style/page-list/editor.css +4 -0
- package/build-style/post-featured-image/editor-rtl.css +0 -7
- package/build-style/post-featured-image/editor.css +0 -7
- package/build-style/post-template/style-rtl.css +4 -0
- package/build-style/post-template/style.css +4 -0
- package/build-style/spacer/editor-rtl.css +4 -0
- package/build-style/spacer/editor.css +4 -0
- package/build-style/style-rtl.css +74 -3
- package/build-style/style.css +74 -3
- package/package.json +8 -8
- package/src/common.scss +8 -0
- package/src/cover/style.scss +13 -0
- package/src/gallery/constants.js +2 -0
- package/src/gallery/style.scss +4 -1
- package/src/gallery/transforms.js +7 -1
- package/src/gallery/utils.js +7 -3
- package/src/heading/edit.js +18 -5
- package/src/image/style.scss +0 -2
- package/src/navigation/edit/index.js +9 -1
- package/src/navigation/edit/navigation-menu-selector.js +65 -15
- package/src/navigation/edit/placeholder/index.js +9 -44
- package/src/navigation/use-convert-classic-menu.js +58 -0
- package/src/page-list/edit.js +47 -9
- package/src/page-list/editor.scss +4 -0
- package/src/page-list/index.php +5 -0
- package/src/post-featured-image/dimension-controls.js +75 -50
- package/src/post-featured-image/edit.js +6 -4
- package/src/post-featured-image/editor.scss +0 -8
- package/src/post-template/style.scss +5 -0
- package/src/search/index.php +6 -4
- package/src/site-logo/edit.js +1 -32
- package/src/site-logo/index.php +1 -1
- package/src/site-title/index.php +0 -1
- package/src/social-links/deprecated.js +0 -59
- package/src/social-links/edit.js +1 -1
- package/src/spacer/block.json +3 -3
- package/src/spacer/controls.js +108 -0
- package/src/spacer/controls.native.js +82 -0
- package/src/spacer/deprecated.js +41 -0
- package/src/spacer/edit.js +127 -113
- package/src/spacer/edit.native.js +68 -0
- package/src/spacer/editor.scss +6 -0
- package/src/spacer/index.js +2 -0
- package/src/spacer/save.js +5 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/post-featured-image/edit.js"],"names":["useEntityProp","store","coreStore","useSelect","useDispatch","ToggleControl","PanelBody","Placeholder","Button","InspectorControls","BlockControls","MediaPlaceholder","MediaReplaceFlow","useBlockProps","__","sprintf","upload","SVG","Path","noticesStore","DimensionControls","placeholderIllustration","ALLOWED_MEDIA_TYPES","placeholderChip","PostFeaturedImageDisplay","attributes","setAttributes","context","postId","postType","queryId","isDescendentOfQueryLoop","Number","isFinite","isLink","height","width","scale","featuredImage","setFeaturedImage","media","select","getMedia","blockProps","style","placeholder","content","onSelectImage","value","id","createErrorNotice","onUploadError","message","type","image","label","open","source_url","alt_text","objectFit","PostFeaturedImageEdit","props"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,aAAT,EAAwBC,KAAK,IAAIC,SAAjC,QAAkD,sBAAlD;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SACCC,aADD,EAECC,SAFD,EAGCC,WAHD,EAICC,MAJD,QAKO,uBALP;AAMA,SACCC,iBADD,EAECC,aAFD,EAGCC,gBAHD,EAICC,gBAJD,EAKCC,aALD,QAMO,yBANP;AAOA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,MAAT,QAAuB,kBAAvB;AACA,SAASC,GAAT,EAAcC,IAAd,QAA0B,uBAA1B;AACA,SAASjB,KAAK,IAAIkB,YAAlB,QAAsC,oBAAtC;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,sBAA9B;AAEA,MAAMC,uBAAuB,GAC5B,cAAC,GAAD;AACC,EAAA,SAAS,EAAC,sCADX;AAEC,EAAA,IAAI,EAAC,MAFN;AAGC,EAAA,KAAK,EAAC,4BAHP;AAIC,EAAA,OAAO,EAAC,WAJT;AAKC,EAAA,mBAAmB,EAAC;AALrB,GAOC,cAAC,IAAD;AAAM,EAAA,YAAY,EAAC,oBAAnB;AAAwC,EAAA,CAAC,EAAC;AAA1C,EAPD,CADD;AAYA,MAAMC,mBAAmB,GAAG,CAAE,OAAF,CAA5B;AACA,MAAMC,eAAe,GACpB;AAAK,EAAA,SAAS,EAAC;AAAf,GACGF,uBADH,CADD;;AAMA,SAASG,wBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/post-featured-image/edit.js"],"names":["useEntityProp","store","coreStore","useSelect","useDispatch","ToggleControl","PanelBody","Placeholder","Button","InspectorControls","BlockControls","MediaPlaceholder","MediaReplaceFlow","useBlockProps","__","sprintf","upload","SVG","Path","noticesStore","DimensionControls","placeholderIllustration","ALLOWED_MEDIA_TYPES","placeholderChip","PostFeaturedImageDisplay","clientId","attributes","setAttributes","context","postId","postType","queryId","isDescendentOfQueryLoop","Number","isFinite","isLink","height","width","scale","featuredImage","setFeaturedImage","media","select","getMedia","blockProps","style","placeholder","content","onSelectImage","value","id","createErrorNotice","onUploadError","message","type","image","label","open","source_url","alt_text","objectFit","PostFeaturedImageEdit","props"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,aAAT,EAAwBC,KAAK,IAAIC,SAAjC,QAAkD,sBAAlD;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SACCC,aADD,EAECC,SAFD,EAGCC,WAHD,EAICC,MAJD,QAKO,uBALP;AAMA,SACCC,iBADD,EAECC,aAFD,EAGCC,gBAHD,EAICC,gBAJD,EAKCC,aALD,QAMO,yBANP;AAOA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,MAAT,QAAuB,kBAAvB;AACA,SAASC,GAAT,EAAcC,IAAd,QAA0B,uBAA1B;AACA,SAASjB,KAAK,IAAIkB,YAAlB,QAAsC,oBAAtC;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,sBAA9B;AAEA,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,CADD;AAmCA;;AAED,eAAe,SAASM,qBAAT,CAAgCC,KAAhC,EAAwC;AAAA;;AACtD,QAAMlB,UAAU,GAAG/B,aAAa,EAAhC;;AACA,MAAK,oBAAEiD,KAAK,CAAClC,OAAR,2CAAE,eAAeC,MAAjB,CAAL,EAA+B;AAC9B,WAAO,qBAAUe,UAAV,EAAyBrB,eAAzB,CAAP;AACA;;AACD,SAAO,cAAC,wBAAD,EAA+BuC,KAA/B,CAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tToggleControl,\n\tPanelBody,\n\tPlaceholder,\n\tButton,\n} from '@wordpress/components';\nimport {\n\tInspectorControls,\n\tBlockControls,\n\tMediaPlaceholder,\n\tMediaReplaceFlow,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { upload } from '@wordpress/icons';\nimport { SVG, Path } from '@wordpress/primitives';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport DimensionControls from './dimension-controls';\n\nconst placeholderIllustration = (\n\t<SVG\n\t\tclassName=\"components-placeholder__illustration\"\n\t\tfill=\"none\"\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\tviewBox=\"0 0 60 60\"\n\t\tpreserveAspectRatio=\"none\"\n\t>\n\t\t<Path vectorEffect=\"non-scaling-stroke\" d=\"M60 60 0 0\" />\n\t</SVG>\n);\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\nconst placeholderChip = (\n\t<div className=\"wp-block-post-featured-image__placeholder\">\n\t\t{ placeholderIllustration }\n\t</div>\n);\n\nfunction PostFeaturedImageDisplay( {\n\tclientId,\n\tattributes,\n\tsetAttributes,\n\tcontext: { postId, postType, queryId },\n} ) {\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst { isLink, height, width, scale } = attributes;\n\tconst [ featuredImage, setFeaturedImage ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'featured_media',\n\t\tpostId\n\t);\n\n\tconst media = useSelect(\n\t\t( select ) =>\n\t\t\tfeaturedImage &&\n\t\t\tselect( coreStore ).getMedia( featuredImage, { context: 'view' } ),\n\t\t[ featuredImage ]\n\t);\n\n\tconst blockProps = useBlockProps( {\n\t\tstyle: { width, height },\n\t} );\n\n\tconst placeholder = ( content ) => {\n\t\treturn (\n\t\t\t<Placeholder className=\"block-editor-media-placeholder\">\n\t\t\t\t{ placeholderIllustration }\n\t\t\t\t{ content }\n\t\t\t</Placeholder>\n\t\t);\n\t};\n\n\tconst onSelectImage = ( value ) => {\n\t\tif ( value?.id ) {\n\t\t\tsetFeaturedImage( value.id );\n\t\t}\n\t};\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message[ 2 ], { type: 'snackbar' } );\n\t};\n\n\tlet image;\n\tif ( ! featuredImage && isDescendentOfQueryLoop ) {\n\t\treturn <div { ...blockProps }>{ placeholderChip }</div>;\n\t}\n\n\tconst label = __( 'Add a featured image' );\n\n\tif ( ! featuredImage ) {\n\t\timage = (\n\t\t\t<MediaPlaceholder\n\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\taccept=\"image/*\"\n\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\tonError={ onUploadError }\n\t\t\t\tplaceholder={ placeholder }\n\t\t\t\tmediaLibraryButton={ ( { open } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\ttooltipPosition=\"top center\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\topen();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t/>\n\t\t);\n\t} else {\n\t\t// We have a Featured image so show a Placeholder if is loading.\n\t\timage = ! media ? (\n\t\t\tplaceholderChip\n\t\t) : (\n\t\t\t<img\n\t\t\t\tsrc={ media.source_url }\n\t\t\t\talt={ media.alt_text || __( 'Featured image' ) }\n\t\t\t\tstyle={ { height, objectFit: height && scale } }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<DimensionControls\n\t\t\t\tclientId={ clientId }\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t/>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Link settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"post\".\n\t\t\t\t\t\t\t__( 'Link to %s' ),\n\t\t\t\t\t\t\tpostType\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonChange={ () => setAttributes( { isLink: ! isLink } ) }\n\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ !! media && ! isDescendentOfQueryLoop && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\t\tmediaId={ featuredImage }\n\t\t\t\t\t\tmediaURL={ media.source_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\tonError={ onUploadError }\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t<figure { ...blockProps }>{ image }</figure>\n\t\t</>\n\t);\n}\n\nexport default function PostFeaturedImageEdit( props ) {\n\tconst blockProps = useBlockProps();\n\tif ( ! props.context?.postId ) {\n\t\treturn <div { ...blockProps }>{ placeholderChip }</div>;\n\t}\n\treturn <PostFeaturedImageDisplay { ...props } />;\n}\n"]}
|
|
@@ -301,7 +301,6 @@ export default function LogoEdit(_ref2) {
|
|
|
301
301
|
isSelected
|
|
302
302
|
} = _ref2;
|
|
303
303
|
const {
|
|
304
|
-
className: styleClass,
|
|
305
304
|
width,
|
|
306
305
|
shouldSyncIcon
|
|
307
306
|
} = attributes;
|
|
@@ -354,33 +353,9 @@ export default function LogoEdit(_ref2) {
|
|
|
354
353
|
siteIconId: _siteIconId
|
|
355
354
|
};
|
|
356
355
|
}, []);
|
|
357
|
-
const {
|
|
358
|
-
getGlobalBlockCount
|
|
359
|
-
} = useSelect(blockEditorStore);
|
|
360
356
|
const {
|
|
361
357
|
editEntityRecord
|
|
362
358
|
} = useDispatch(coreStore);
|
|
363
|
-
useEffect(() => {
|
|
364
|
-
// Cleanup function to discard unsaved changes to the icon and logo when
|
|
365
|
-
// the block is removed.
|
|
366
|
-
return () => {
|
|
367
|
-
// Do nothing if the block is being rendered in the styles preview or the
|
|
368
|
-
// block inserter.
|
|
369
|
-
if (styleClass !== null && styleClass !== void 0 && styleClass.includes('block-editor-block-types-list__site-logo-example') || styleClass !== null && styleClass !== void 0 && styleClass.includes('block-editor-block-styles__block-preview-container')) {
|
|
370
|
-
return;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
const logoBlockCount = getGlobalBlockCount('core/site-logo'); // Only discard unsaved changes if we are removing the last Site Logo block
|
|
374
|
-
// on the page.
|
|
375
|
-
|
|
376
|
-
if (logoBlockCount === 0) {
|
|
377
|
-
editEntityRecord('root', 'site', undefined, {
|
|
378
|
-
site_logo: undefined,
|
|
379
|
-
site_icon: undefined
|
|
380
|
-
});
|
|
381
|
-
}
|
|
382
|
-
};
|
|
383
|
-
}, []);
|
|
384
359
|
|
|
385
360
|
const setLogo = function (newValue) {
|
|
386
361
|
let shouldForceSync = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/site-logo/edit.js"],"names":["classnames","includes","pick","isBlobURL","createInterpolateElement","useEffect","useState","useRef","__","isRTL","MenuItem","PanelBody","RangeControl","ResizableBox","Spinner","ToggleControl","ToolbarButton","Placeholder","Button","useViewportMatch","BlockControls","InspectorControls","MediaPlaceholder","MediaReplaceFlow","useBlockProps","store","blockEditorStore","__experimentalImageEditor","ImageEditor","__experimentalImageEditingProvider","ImageEditingProvider","useSelect","useDispatch","coreStore","crop","upload","SVG","Path","noticesStore","useClientWidth","MIN_SIZE","ALLOWED_MEDIA_TYPES","ACCEPT_MEDIA_STRING","SiteLogo","alt","attributes","align","width","height","isLink","linkTarget","shouldSyncIcon","containerRef","isSelected","setAttributes","setLogo","logoUrl","siteUrl","logoId","iconId","setIcon","canUserEdit","clientWidth","isLargeViewport","isWideAligned","isResizable","naturalWidth","naturalHeight","setNaturalSize","isEditingImage","setIsEditingImage","toggleSelection","classes","imageEditing","maxWidth","title","select","getSettings","siteEntities","getEditedEntityRecord","onResizeStart","onResizeStop","img","event","target","imgWrapper","preventDefault","imageWidthWithinContainer","exceedMaxWidth","defaultWidth","currentWidth","ratio","currentHeight","minWidth","Math","ceil","minHeight","maxWidthBuffer","showRightHandle","showLeftHandle","canEditImage","imgEdit","imageAttributes","id","top","right","bottom","left","direction","elt","delta","parseInt","syncSiteIconHelpText","a","newWidth","min","value","undefined","LogoEdit","className","styleClass","setLogoUrl","ref","siteLogoId","url","siteIconId","mediaItemData","isRequestingMediaItem","canUser","getEntityRecord","siteSettings","siteData","_siteLogo","site_logo","_readOnlyLogo","_canUserEdit","_siteLogoId","_siteIconId","site_icon","mediaItem","getMedia","context","_isRequestingMediaItem","hasFinishedResolution","source_url","alt_text","getGlobalBlockCount","editEntityRecord","logoBlockCount","newValue","shouldForceSync","onInitialSelectLogo","media","onSelectLogo","onRemoveLogo","createErrorNotice","onUploadError","message","type","controls","logoImage","isLoading","placeholder","content","placeholderClassName","blockProps","label","open"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,QAAT,EAAmBC,IAAnB,QAA+B,QAA/B;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SACCC,wBADD,EAECC,SAFD,EAGCC,QAHD,EAICC,MAJD,QAKO,oBALP;AAMA,SAASC,EAAT,EAAaC,KAAb,QAA0B,iBAA1B;AACA,SACCC,QADD,EAECC,SAFD,EAGCC,YAHD,EAICC,YAJD,EAKCC,OALD,EAMCC,aAND,EAOCC,aAPD,EAQCC,WARD,EASCC,MATD,QAUO,uBAVP;AAWA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SACCC,aADD,EAECC,iBAFD,EAGCC,gBAHD,EAICC,gBAJD,EAKCC,aALD,EAMCC,KAAK,IAAIC,gBANV,EAOCC,yBAAyB,IAAIC,WAP9B,EAQCC,kCAAkC,IAAIC,oBARvC,QASO,yBATP;AAUA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASP,KAAK,IAAIQ,SAAlB,QAAmC,sBAAnC;AACA,SAASC,IAAT,EAAeC,MAAf,QAA6B,kBAA7B;AACA,SAASC,GAAT,EAAcC,IAAd,QAA0B,uBAA1B;AACA,SAASZ,KAAK,IAAIa,YAAlB,QAAsC,oBAAtC;AAEA;AACA;AACA;;AACA,OAAOC,cAAP,MAA2B,2BAA3B;AAEA;AACA;AACA;;AACA,SAASC,QAAT,QAAyB,oBAAzB;AAEA,MAAMC,mBAAmB,GAAG,CAAE,OAAF,CAA5B;AACA,MAAMC,mBAAmB,GAAG,SAA5B;;AAEA,MAAMC,QAAQ,GAAG,QAaV;AAAA,MAbY;AAClBC,IAAAA,GADkB;AAElBC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,KAAF;AAASC,MAAAA,KAAT;AAAgBC,MAAAA,MAAhB;AAAwBC,MAAAA,MAAxB;A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O,GAAGxE,UAAU,CAAEuH,SAAF,EAAa;AACtC,uBAAmB,CAAExE;AADiB,GAAb,CAA1B;AAIA,QAAMsH,UAAU,GAAG7I,aAAa,CAAE;AACjCkG,IAAAA,GADiC;AAEjCH,IAAAA,SAAS,EAAE/C;AAFsB,GAAF,CAAhC;;AAKA,QAAM8F,KAAK,GAAG9J,EAAE,CAAE,iBAAF,CAAhB;;AAEA,SACC,qBAAU6J,UAAV,EACGN,QADH,EAEG,CAAC,CAAEvG,OAAH,IAAcwG,SAFjB,EAGG,CAAExG,OAAF,IAAa,CAAEK,WAAf,IACD,cAAC,WAAD;AAAa,IAAA,SAAS,EAAC;AAAvB,KACGoG,SAAS,IACV;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC,cAAC,OAAD,OADD,CAFF,CAJF,EAYG,CAAEzG,OAAF,IAAaK,WAAb,IACD,cAAC,gBAAD;AACC,IAAA,QAAQ,EAAG0F,mBADZ;AAEC,IAAA,MAAM,EAAG7G,mBAFV;AAGC,IAAA,YAAY,EAAGD,mBAHhB;AAIC,IAAA,OAAO,EAAGmH,aAJX;AAKC,IAAA,WAAW,EAAGM,WALf;AAMC,IAAA,kBAAkB,EAAG,SAAgB;AAAA,UAAd;AAAEK,QAAAA;AAAF,OAAc;AACpC,aACC,cAAC,MAAD;AACC,QAAA,IAAI,EAAGpI,MADR;AAEC,QAAA,OAAO,EAAC,SAFT;AAGC,QAAA,KAAK,EAAGmI,KAHT;AAIC,QAAA,WAAW,MAJZ;AAKC,QAAA,eAAe,EAAC,YALjB;AAMC,QAAA,OAAO,EAAG,MAAM;AACfC,UAAAA,IAAI;AACJ;AARF,QADD;AAYA;AAnBF,IAbF,CADD;AAsCA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { includes, pick } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { isBlobURL } from '@wordpress/blob';\nimport {\n\tcreateInterpolateElement,\n\tuseEffect,\n\tuseState,\n\tuseRef,\n} from '@wordpress/element';\nimport { __, isRTL } from '@wordpress/i18n';\nimport {\n\tMenuItem,\n\tPanelBody,\n\tRangeControl,\n\tResizableBox,\n\tSpinner,\n\tToggleControl,\n\tToolbarButton,\n\tPlaceholder,\n\tButton,\n} from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tMediaPlaceholder,\n\tMediaReplaceFlow,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\t__experimentalImageEditor as ImageEditor,\n\t__experimentalImageEditingProvider as ImageEditingProvider,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { crop, upload } from '@wordpress/icons';\nimport { SVG, Path } from '@wordpress/primitives';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport useClientWidth from '../image/use-client-width';\n\n/**\n * Module constants\n */\nimport { MIN_SIZE } from '../image/constants';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\nconst ACCEPT_MEDIA_STRING = 'image/*';\n\nconst SiteLogo = ( {\n\talt,\n\tattributes: { align, width, height, isLink, linkTarget, shouldSyncIcon },\n\tcontainerRef,\n\tisSelected,\n\tsetAttributes,\n\tsetLogo,\n\tlogoUrl,\n\tsiteUrl,\n\tlogoId,\n\ticonId,\n\tsetIcon,\n\tcanUserEdit,\n} ) => {\n\tconst clientWidth = useClientWidth( containerRef, [ align ] );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideAligned = includes( [ 'wide', 'full' ], align );\n\tconst isResizable = ! isWideAligned && isLargeViewport;\n\tconst [ { naturalWidth, naturalHeight }, setNaturalSize ] = useState( {} );\n\tconst [ isEditingImage, setIsEditingImage ] = useState( false );\n\tconst { toggleSelection } = useDispatch( blockEditorStore );\n\tconst classes = classnames( 'custom-logo-link', {\n\t\t'is-transient': isBlobURL( logoUrl ),\n\t} );\n\tconst { imageEditing, maxWidth, title } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst siteEntities = select( coreStore ).getEditedEntityRecord(\n\t\t\t'root',\n\t\t\t'site'\n\t\t);\n\t\treturn {\n\t\t\ttitle: siteEntities.title,\n\t\t\t...pick( getSettings(), [ 'imageEditing', 'maxWidth' ] ),\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\t// Turn the `Use as site icon` toggle off if it is on but the logo and icon have\n\t\t// fallen out of sync. This can happen if the toggle is saved in the `on` position,\n\t\t// but changes are later made to the site icon in the Customizer.\n\t\tif ( shouldSyncIcon && logoId !== iconId ) {\n\t\t\tsetAttributes( { shouldSyncIcon: false } );\n\t\t}\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsEditingImage( false );\n\t\t}\n\t}, [ isSelected ] );\n\n\tfunction onResizeStart() {\n\t\ttoggleSelection( false );\n\t}\n\n\tfunction onResizeStop() {\n\t\ttoggleSelection( true );\n\t}\n\n\tconst img = (\n\t\t<img\n\t\t\tclassName=\"custom-logo\"\n\t\t\tsrc={ logoUrl }\n\t\t\talt={ alt }\n\t\t\tonLoad={ ( event ) => {\n\t\t\t\tsetNaturalSize(\n\t\t\t\t\tpick( event.target, [ 'naturalWidth', 'naturalHeight' ] )\n\t\t\t\t);\n\t\t\t} }\n\t\t/>\n\t);\n\n\tlet imgWrapper = img;\n\n\t// Disable reason: Image itself is not meant to be interactive, but\n\t// should direct focus to block.\n\tif ( isLink ) {\n\t\timgWrapper = (\n\t\t\t/* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */\n\t\t\t<a\n\t\t\t\thref={ siteUrl }\n\t\t\t\tclassName={ classes }\n\t\t\t\trel=\"home\"\n\t\t\t\ttitle={ title }\n\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t>\n\t\t\t\t{ img }\n\t\t\t</a>\n\t\t\t/* eslint-enable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */\n\t\t);\n\t}\n\n\tlet imageWidthWithinContainer;\n\n\tif ( clientWidth && naturalWidth && naturalHeight ) {\n\t\tconst exceedMaxWidth = naturalWidth > clientWidth;\n\t\timageWidthWithinContainer = exceedMaxWidth ? clientWidth : naturalWidth;\n\t}\n\n\tif ( ! isResizable || ! imageWidthWithinContainer ) {\n\t\treturn <div style={ { width, height } }>{ imgWrapper }</div>;\n\t}\n\n\t// Set the default width to a responsible size.\n\t// Note that this width is also set in the attached frontend CSS file.\n\tconst defaultWidth = 120;\n\n\tconst currentWidth = width || defaultWidth;\n\tconst ratio = naturalWidth / naturalHeight;\n\tconst currentHeight = currentWidth / ratio;\n\tconst minWidth =\n\t\tnaturalWidth < naturalHeight ? MIN_SIZE : Math.ceil( MIN_SIZE * ratio );\n\tconst minHeight =\n\t\tnaturalHeight < naturalWidth ? MIN_SIZE : Math.ceil( MIN_SIZE / ratio );\n\n\t// With the current implementation of ResizableBox, an image needs an\n\t// explicit pixel value for the max-width. In absence of being able to\n\t// set the content-width, this max-width is currently dictated by the\n\t// vanilla editor style. The following variable adds a buffer to this\n\t// vanilla style, so 3rd party themes have some wiggleroom. This does,\n\t// in most cases, allow you to scale the image beyond the width of the\n\t// main column, though not infinitely.\n\t// @todo It would be good to revisit this once a content-width variable\n\t// becomes available.\n\tconst maxWidthBuffer = maxWidth * 2.5;\n\n\tlet showRightHandle = false;\n\tlet showLeftHandle = false;\n\n\t/* eslint-disable no-lonely-if */\n\t// See https://github.com/WordPress/gutenberg/issues/7584.\n\tif ( align === 'center' ) {\n\t\t// When the image is centered, show both handles.\n\t\tshowRightHandle = true;\n\t\tshowLeftHandle = true;\n\t} else if ( isRTL() ) {\n\t\t// In RTL mode the image is on the right by default.\n\t\t// Show the right handle and hide the left handle only when it is\n\t\t// aligned left. Otherwise always show the left handle.\n\t\tif ( align === 'left' ) {\n\t\t\tshowRightHandle = true;\n\t\t} else {\n\t\t\tshowLeftHandle = true;\n\t\t}\n\t} else {\n\t\t// Show the left handle and hide the right handle only when the\n\t\t// image is aligned right. Otherwise always show the right handle.\n\t\tif ( align === 'right' ) {\n\t\t\tshowLeftHandle = true;\n\t\t} else {\n\t\t\tshowRightHandle = true;\n\t\t}\n\t}\n\t/* eslint-enable no-lonely-if */\n\n\tconst canEditImage =\n\t\tlogoId && naturalWidth && naturalHeight && imageEditing;\n\n\tconst imgEdit =\n\t\tcanEditImage && isEditingImage ? (\n\t\t\t<ImageEditingProvider\n\t\t\t\tid={ logoId }\n\t\t\t\turl={ logoUrl }\n\t\t\t\tnaturalWidth={ naturalWidth }\n\t\t\t\tnaturalHeight={ naturalHeight }\n\t\t\t\tclientWidth={ clientWidth }\n\t\t\t\tonSaveImage={ ( imageAttributes ) => {\n\t\t\t\t\tsetLogo( imageAttributes.id );\n\t\t\t\t} }\n\t\t\t\tisEditing={ isEditingImage }\n\t\t\t\tonFinishEditing={ () => setIsEditingImage( false ) }\n\t\t\t>\n\t\t\t\t<ImageEditor\n\t\t\t\t\turl={ logoUrl }\n\t\t\t\t\twidth={ currentWidth }\n\t\t\t\t\theight={ currentHeight }\n\t\t\t\t\tclientWidth={ clientWidth }\n\t\t\t\t\tnaturalHeight={ naturalHeight }\n\t\t\t\t\tnaturalWidth={ naturalWidth }\n\t\t\t\t/>\n\t\t\t</ImageEditingProvider>\n\t\t) : (\n\t\t\t<ResizableBox\n\t\t\t\tsize={ {\n\t\t\t\t\twidth: currentWidth,\n\t\t\t\t\theight: currentHeight,\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\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, delta ) => {\n\t\t\t\t\tonResizeStop();\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: parseInt( currentWidth + delta.width, 10 ),\n\t\t\t\t\t\theight: parseInt( currentHeight + delta.height, 10 ),\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ imgWrapper }\n\t\t\t</ResizableBox>\n\t\t);\n\n\tconst syncSiteIconHelpText = createInterpolateElement(\n\t\t__(\n\t\t\t'Site Icons are what you see in browser tabs, bookmark bars, and within the WordPress mobile apps. To use a custom icon that is different from your site logo, use the <a>Site Icon settings</a>.'\n\t\t),\n\t\t{\n\t\t\ta: (\n\t\t\t\t// eslint-disable-next-line jsx-a11y/anchor-has-content\n\t\t\t\t<a\n\t\t\t\t\thref={\n\t\t\t\t\t\tsiteUrl +\n\t\t\t\t\t\t'/wp-admin/customize.php?autofocus[section]=title_tagline'\n\t\t\t\t\t}\n\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t/>\n\t\t\t),\n\t\t}\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\tlabel={ __( 'Image width' ) }\n\t\t\t\t\t\tonChange={ ( newWidth ) =>\n\t\t\t\t\t\t\tsetAttributes( { width: newWidth } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmin={ minWidth }\n\t\t\t\t\t\tmax={ maxWidthBuffer }\n\t\t\t\t\t\tinitialPosition={ Math.min(\n\t\t\t\t\t\t\tdefaultWidth,\n\t\t\t\t\t\t\tmaxWidthBuffer\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tvalue={ width || '' }\n\t\t\t\t\t\tdisabled={ ! isResizable }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Link image to home' ) }\n\t\t\t\t\t\tonChange={ () => setAttributes( { isLink: ! isLink } ) }\n\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t/>\n\t\t\t\t\t{ isLink && (\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={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlinkTarget: value ? '_blank' : '_self',\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\tchecked={ linkTarget === '_blank' }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t{ canUserEdit && (\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={ __( 'Use as site icon' ) }\n\t\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t\tsetAttributes( { shouldSyncIcon: value } );\n\t\t\t\t\t\t\t\t\tsetIcon( value ? logoId : undefined );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tchecked={ !! shouldSyncIcon }\n\t\t\t\t\t\t\t\thelp={ syncSiteIconHelpText }\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</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t{ canEditImage && ! isEditingImage && (\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</BlockControls>\n\t\t\t{ imgEdit }\n\t\t</>\n\t);\n};\n\nexport default function LogoEdit( {\n\tattributes,\n\tclassName,\n\tsetAttributes,\n\tisSelected,\n} ) {\n\tconst { className: styleClass, width, shouldSyncIcon } = attributes;\n\tconst [ logoUrl, setLogoUrl ] = useState();\n\tconst ref = useRef();\n\n\tconst {\n\t\tsiteLogoId,\n\t\tcanUserEdit,\n\t\turl,\n\t\tsiteIconId,\n\t\tmediaItemData,\n\t\tisRequestingMediaItem,\n\t} = useSelect( ( select ) => {\n\t\tconst { canUser, getEntityRecord, getEditedEntityRecord } = select(\n\t\t\tcoreStore\n\t\t);\n\t\tconst siteSettings = getEditedEntityRecord( 'root', 'site' );\n\t\tconst siteData = getEntityRecord( 'root', '__unstableBase' );\n\t\tconst _siteLogo = siteSettings?.site_logo;\n\t\tconst _readOnlyLogo = siteData?.site_logo;\n\t\tconst _canUserEdit = canUser( 'update', 'settings' );\n\t\tconst _siteLogoId = _canUserEdit ? _siteLogo : _readOnlyLogo;\n\t\tconst _siteIconId = siteSettings?.site_icon;\n\t\tconst mediaItem =\n\t\t\t_siteLogoId &&\n\t\t\tselect( coreStore ).getMedia( _siteLogoId, {\n\t\t\t\tcontext: 'view',\n\t\t\t} );\n\t\tconst _isRequestingMediaItem =\n\t\t\t_siteLogoId &&\n\t\t\t! select( coreStore ).hasFinishedResolution( 'getMedia', [\n\t\t\t\t_siteLogoId,\n\t\t\t\t{ context: 'view' },\n\t\t\t] );\n\n\t\treturn {\n\t\t\tsiteLogoId: _siteLogoId,\n\t\t\tcanUserEdit: _canUserEdit,\n\t\t\turl: siteData?.url,\n\t\t\tmediaItemData: mediaItem && {\n\t\t\t\tid: mediaItem.id,\n\t\t\t\turl: mediaItem.source_url,\n\t\t\t\talt: mediaItem.alt_text,\n\t\t\t},\n\t\t\tisRequestingMediaItem: _isRequestingMediaItem,\n\t\t\tsiteIconId: _siteIconId,\n\t\t};\n\t}, [] );\n\n\tconst { getGlobalBlockCount } = useSelect( blockEditorStore );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\n\tuseEffect( () => {\n\t\t// Cleanup function to discard unsaved changes to the icon and logo when\n\t\t// the block is removed.\n\t\treturn () => {\n\t\t\t// Do nothing if the block is being rendered in the styles preview or the\n\t\t\t// block inserter.\n\t\t\tif (\n\t\t\t\tstyleClass?.includes(\n\t\t\t\t\t'block-editor-block-types-list__site-logo-example'\n\t\t\t\t) ||\n\t\t\t\tstyleClass?.includes(\n\t\t\t\t\t'block-editor-block-styles__block-preview-container'\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst logoBlockCount = getGlobalBlockCount( 'core/site-logo' );\n\n\t\t\t// Only discard unsaved changes if we are removing the last Site Logo block\n\t\t\t// on the page.\n\t\t\tif ( logoBlockCount === 0 ) {\n\t\t\t\teditEntityRecord( 'root', 'site', undefined, {\n\t\t\t\t\tsite_logo: undefined,\n\t\t\t\t\tsite_icon: undefined,\n\t\t\t\t} );\n\t\t\t}\n\t\t};\n\t}, [] );\n\n\tconst setLogo = ( newValue, shouldForceSync = false ) => {\n\t\t// `shouldForceSync` is used to force syncing when the attribute\n\t\t// may not have updated yet.\n\t\tif ( shouldSyncIcon || shouldForceSync ) {\n\t\t\tsetIcon( newValue );\n\t\t}\n\n\t\teditEntityRecord( 'root', 'site', undefined, {\n\t\t\tsite_logo: newValue,\n\t\t} );\n\t};\n\n\tconst setIcon = ( newValue ) =>\n\t\teditEntityRecord( 'root', 'site', undefined, {\n\t\t\tsite_icon: newValue,\n\t\t} );\n\n\tlet alt = null;\n\tif ( mediaItemData ) {\n\t\talt = mediaItemData.alt;\n\t\tif ( logoUrl !== mediaItemData.url ) {\n\t\t\tsetLogoUrl( mediaItemData.url );\n\t\t}\n\t}\n\n\tconst onInitialSelectLogo = ( media ) => {\n\t\t// Initialize the syncSiteIcon toggle. If we currently have no Site logo and no\n\t\t// site icon, automatically sync the logo to the icon.\n\t\tif ( shouldSyncIcon === undefined ) {\n\t\t\tconst shouldForceSync = ! siteIconId;\n\t\t\tsetAttributes( { shouldSyncIcon: shouldForceSync } );\n\n\t\t\t// Because we cannot rely on the `shouldSyncIcon` attribute to have updated by\n\t\t\t// the time `setLogo` is called, pass an argument to force the syncing.\n\t\t\tonSelectLogo( media, shouldForceSync );\n\t\t\treturn;\n\t\t}\n\n\t\tonSelectLogo( media );\n\t};\n\n\tconst onSelectLogo = ( media, shouldForceSync = false ) => {\n\t\tif ( ! media ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! media.id && media.url ) {\n\t\t\t// This is a temporary blob image\n\t\t\tsetLogo( undefined );\n\t\t\tsetLogoUrl( media.url );\n\t\t\treturn;\n\t\t}\n\n\t\tsetLogo( media.id, shouldForceSync );\n\t};\n\n\tconst onRemoveLogo = () => {\n\t\tsetLogo( null );\n\t\tsetLogoUrl( undefined );\n\t\tsetAttributes( { width: undefined } );\n\t};\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message[ 2 ], { type: 'snackbar' } );\n\t};\n\n\tconst controls = canUserEdit && logoUrl && (\n\t\t<BlockControls group=\"other\">\n\t\t\t<MediaReplaceFlow\n\t\t\t\tmediaURL={ logoUrl }\n\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\taccept={ ACCEPT_MEDIA_STRING }\n\t\t\t\tonSelect={ onSelectLogo }\n\t\t\t\tonError={ onUploadError }\n\t\t\t>\n\t\t\t\t<MenuItem onClick={ onRemoveLogo }>{ __( 'Reset' ) }</MenuItem>\n\t\t\t</MediaReplaceFlow>\n\t\t</BlockControls>\n\t);\n\n\tlet logoImage;\n\tconst isLoading = siteLogoId === undefined || isRequestingMediaItem;\n\tif ( isLoading ) {\n\t\tlogoImage = <Spinner />;\n\t}\n\tif ( !! logoUrl ) {\n\t\tlogoImage = (\n\t\t\t<SiteLogo\n\t\t\t\talt={ alt }\n\t\t\t\tattributes={ attributes }\n\t\t\t\tclassName={ className }\n\t\t\t\tcontainerRef={ ref }\n\t\t\t\tisSelected={ isSelected }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\tlogoUrl={ logoUrl }\n\t\t\t\tsetLogo={ setLogo }\n\t\t\t\tlogoId={ mediaItemData?.id || siteLogoId }\n\t\t\t\tsiteUrl={ url }\n\t\t\t\tsetIcon={ setIcon }\n\t\t\t\ticonId={ siteIconId }\n\t\t\t\tcanUserEdit={ canUserEdit }\n\t\t\t/>\n\t\t);\n\t}\n\tconst placeholder = ( content ) => {\n\t\tconst placeholderClassName = classnames(\n\t\t\t'block-editor-media-placeholder',\n\t\t\tclassName\n\t\t);\n\n\t\treturn (\n\t\t\t<Placeholder\n\t\t\t\tclassName={ placeholderClassName }\n\t\t\t\tpreview={ logoImage }\n\t\t\t>\n\t\t\t\t{\n\t\t\t\t\t<SVG\n\t\t\t\t\t\tclassName=\"components-placeholder__illustration\"\n\t\t\t\t\t\tfill=\"none\"\n\t\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\t\tviewBox=\"0 0 60 60\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Path\n\t\t\t\t\t\t\tvectorEffect=\"non-scaling-stroke\"\n\t\t\t\t\t\t\td=\"m61 32.622-13.555-9.137-15.888 9.859a5 5 0 0 1-5.386-.073l-9.095-5.989L1 37.5\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</SVG>\n\t\t\t\t}\n\t\t\t\t{ content }\n\t\t\t</Placeholder>\n\t\t);\n\t};\n\n\tconst classes = classnames( className, {\n\t\t'is-default-size': ! width,\n\t} );\n\n\tconst blockProps = useBlockProps( {\n\t\tref,\n\t\tclassName: classes,\n\t} );\n\n\tconst label = __( 'Add a site logo' );\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t{ controls }\n\t\t\t{ !! logoUrl && logoImage }\n\t\t\t{ ! logoUrl && ! canUserEdit && (\n\t\t\t\t<Placeholder className=\"site-logo_placeholder\">\n\t\t\t\t\t{ isLoading && (\n\t\t\t\t\t\t<span className=\"components-placeholder__preview\">\n\t\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</Placeholder>\n\t\t\t) }\n\t\t\t{ ! logoUrl && canUserEdit && (\n\t\t\t\t<MediaPlaceholder\n\t\t\t\t\tonSelect={ onInitialSelectLogo }\n\t\t\t\t\taccept={ ACCEPT_MEDIA_STRING }\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\tplaceholder={ placeholder }\n\t\t\t\t\tmediaLibraryButton={ ( { open } ) => {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\t\ttooltipPosition=\"top center\"\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\topen();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/site-logo/edit.js"],"names":["classnames","includes","pick","isBlobURL","createInterpolateElement","useEffect","useState","useRef","__","isRTL","MenuItem","PanelBody","RangeControl","ResizableBox","Spinner","ToggleControl","ToolbarButton","Placeholder","Button","useViewportMatch","BlockControls","InspectorControls","MediaPlaceholder","MediaReplaceFlow","useBlockProps","store","blockEditorStore","__experimentalImageEditor","ImageEditor","__experimentalImageEditingProvider","ImageEditingProvider","useSelect","useDispatch","coreStore","crop","upload","SVG","Path","noticesStore","useClientWidth","MIN_SIZE","ALLOWED_MEDIA_TYPES","ACCEPT_MEDIA_STRING","SiteLogo","alt","attributes","align","width","height","isLink","linkTarget","shouldSyncIcon","containerRef","isSelected","setAttributes","setLogo","logoUrl","siteUrl","logoId","iconId","setIcon","canUserEdit","clientWidth","isLargeViewport","isWideAligned","isResizable","naturalWidth","naturalHeight","setNaturalSize","isEditingImage","setIsEditingImage","toggleSelection","classes","imageEditing","maxWidth","title","select","getSettings","siteEntities","getEditedEntityRecord","onResizeStart","onResizeStop","img","event","target","imgWrapper","preventDefault","imageWidthWithinContainer","exceedMaxWidth","defaultWidth","currentWidth","ratio","currentHeight","minWidth","Math","ceil","minHeight","maxWidthBuffer","showRightHandle","showLeftHandle","canEditImage","imgEdit","imageAttributes","id","top","right","bottom","left","direction","elt","delta","parseInt","syncSiteIconHelpText","a","newWidth","min","value","undefined","LogoEdit","className","setLogoUrl","ref","siteLogoId","url","siteIconId","mediaItemData","isRequestingMediaItem","canUser","getEntityRecord","siteSettings","siteData","_siteLogo","site_logo","_readOnlyLogo","_canUserEdit","_siteLogoId","_siteIconId","site_icon","mediaItem","getMedia","context","_isRequestingMediaItem","hasFinishedResolution","source_url","alt_text","editEntityRecord","newValue","shouldForceSync","onInitialSelectLogo","media","onSelectLogo","onRemoveLogo","createErrorNotice","onUploadError","message","type","controls","logoImage","isLoading","placeholder","content","placeholderClassName","blockProps","label","open"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,QAAT,EAAmBC,IAAnB,QAA+B,QAA/B;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SACCC,wBADD,EAECC,SAFD,EAGCC,QAHD,EAICC,MAJD,QAKO,oBALP;AAMA,SAASC,EAAT,EAAaC,KAAb,QAA0B,iBAA1B;AACA,SACCC,QADD,EAECC,SAFD,EAGCC,YAHD,EAICC,YAJD,EAKCC,OALD,EAMCC,aAND,EAOCC,aAPD,EAQCC,WARD,EASCC,MATD,QAUO,uBAVP;AAWA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAC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MAND,CALF,EAiBGG,OAjBH,CADD;AAqBA,GA3BD;;AA6BA,QAAMxF,OAAO,GAAGxE,UAAU,CAAEuH,SAAF,EAAa;AACtC,uBAAmB,CAAExE;AADiB,GAAb,CAA1B;AAIA,QAAMmH,UAAU,GAAG1I,aAAa,CAAE;AACjCiG,IAAAA,GADiC;AAEjCF,IAAAA,SAAS,EAAE/C;AAFsB,GAAF,CAAhC;;AAKA,QAAM2F,KAAK,GAAG3J,EAAE,CAAE,iBAAF,CAAhB;;AAEA,SACC,qBAAU0J,UAAV,EACGN,QADH,EAEG,CAAC,CAAEpG,OAAH,IAAcqG,SAFjB,EAGG,CAAErG,OAAF,IAAa,CAAEK,WAAf,IACD,cAAC,WAAD;AAAa,IAAA,SAAS,EAAC;AAAvB,KACGiG,SAAS,IACV;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC,cAAC,OAAD,OADD,CAFF,CAJF,EAYG,CAAEtG,OAAF,IAAaK,WAAb,IACD,cAAC,gBAAD;AACC,IAAA,QAAQ,EAAGuF,mBADZ;AAEC,IAAA,MAAM,EAAG1G,mBAFV;AAGC,IAAA,YAAY,EAAGD,mBAHhB;AAIC,IAAA,OAAO,EAAGgH,aAJX;AAKC,IAAA,WAAW,EAAGM,WALf;AAMC,IAAA,kBAAkB,EAAG,SAAgB;AAAA,UAAd;AAAEK,QAAAA;AAAF,OAAc;AACpC,aACC,cAAC,MAAD;AACC,QAAA,IAAI,EAAGjI,MADR;AAEC,QAAA,OAAO,EAAC,SAFT;AAGC,QAAA,KAAK,EAAGgI,KAHT;AAIC,QAAA,WAAW,MAJZ;AAKC,QAAA,eAAe,EAAC,YALjB;AAMC,QAAA,OAAO,EAAG,MAAM;AACfC,UAAAA,IAAI;AACJ;AARF,QADD;AAYA;AAnBF,IAbF,CADD;AAsCA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { includes, pick } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { isBlobURL } from '@wordpress/blob';\nimport {\n\tcreateInterpolateElement,\n\tuseEffect,\n\tuseState,\n\tuseRef,\n} from '@wordpress/element';\nimport { __, isRTL } from '@wordpress/i18n';\nimport {\n\tMenuItem,\n\tPanelBody,\n\tRangeControl,\n\tResizableBox,\n\tSpinner,\n\tToggleControl,\n\tToolbarButton,\n\tPlaceholder,\n\tButton,\n} from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tMediaPlaceholder,\n\tMediaReplaceFlow,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\t__experimentalImageEditor as ImageEditor,\n\t__experimentalImageEditingProvider as ImageEditingProvider,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { crop, upload } from '@wordpress/icons';\nimport { SVG, Path } from '@wordpress/primitives';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport useClientWidth from '../image/use-client-width';\n\n/**\n * Module constants\n */\nimport { MIN_SIZE } from '../image/constants';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\nconst ACCEPT_MEDIA_STRING = 'image/*';\n\nconst SiteLogo = ( {\n\talt,\n\tattributes: { align, width, height, isLink, linkTarget, shouldSyncIcon },\n\tcontainerRef,\n\tisSelected,\n\tsetAttributes,\n\tsetLogo,\n\tlogoUrl,\n\tsiteUrl,\n\tlogoId,\n\ticonId,\n\tsetIcon,\n\tcanUserEdit,\n} ) => {\n\tconst clientWidth = useClientWidth( containerRef, [ align ] );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideAligned = includes( [ 'wide', 'full' ], align );\n\tconst isResizable = ! isWideAligned && isLargeViewport;\n\tconst [ { naturalWidth, naturalHeight }, setNaturalSize ] = useState( {} );\n\tconst [ isEditingImage, setIsEditingImage ] = useState( false );\n\tconst { toggleSelection } = useDispatch( blockEditorStore );\n\tconst classes = classnames( 'custom-logo-link', {\n\t\t'is-transient': isBlobURL( logoUrl ),\n\t} );\n\tconst { imageEditing, maxWidth, title } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst siteEntities = select( coreStore ).getEditedEntityRecord(\n\t\t\t'root',\n\t\t\t'site'\n\t\t);\n\t\treturn {\n\t\t\ttitle: siteEntities.title,\n\t\t\t...pick( getSettings(), [ 'imageEditing', 'maxWidth' ] ),\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\t// Turn the `Use as site icon` toggle off if it is on but the logo and icon have\n\t\t// fallen out of sync. This can happen if the toggle is saved in the `on` position,\n\t\t// but changes are later made to the site icon in the Customizer.\n\t\tif ( shouldSyncIcon && logoId !== iconId ) {\n\t\t\tsetAttributes( { shouldSyncIcon: false } );\n\t\t}\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsEditingImage( false );\n\t\t}\n\t}, [ isSelected ] );\n\n\tfunction onResizeStart() {\n\t\ttoggleSelection( false );\n\t}\n\n\tfunction onResizeStop() {\n\t\ttoggleSelection( true );\n\t}\n\n\tconst img = (\n\t\t<img\n\t\t\tclassName=\"custom-logo\"\n\t\t\tsrc={ logoUrl }\n\t\t\talt={ alt }\n\t\t\tonLoad={ ( event ) => {\n\t\t\t\tsetNaturalSize(\n\t\t\t\t\tpick( event.target, [ 'naturalWidth', 'naturalHeight' ] )\n\t\t\t\t);\n\t\t\t} }\n\t\t/>\n\t);\n\n\tlet imgWrapper = img;\n\n\t// Disable reason: Image itself is not meant to be interactive, but\n\t// should direct focus to block.\n\tif ( isLink ) {\n\t\timgWrapper = (\n\t\t\t/* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */\n\t\t\t<a\n\t\t\t\thref={ siteUrl }\n\t\t\t\tclassName={ classes }\n\t\t\t\trel=\"home\"\n\t\t\t\ttitle={ title }\n\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t>\n\t\t\t\t{ img }\n\t\t\t</a>\n\t\t\t/* eslint-enable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */\n\t\t);\n\t}\n\n\tlet imageWidthWithinContainer;\n\n\tif ( clientWidth && naturalWidth && naturalHeight ) {\n\t\tconst exceedMaxWidth = naturalWidth > clientWidth;\n\t\timageWidthWithinContainer = exceedMaxWidth ? clientWidth : naturalWidth;\n\t}\n\n\tif ( ! isResizable || ! imageWidthWithinContainer ) {\n\t\treturn <div style={ { width, height } }>{ imgWrapper }</div>;\n\t}\n\n\t// Set the default width to a responsible size.\n\t// Note that this width is also set in the attached frontend CSS file.\n\tconst defaultWidth = 120;\n\n\tconst currentWidth = width || defaultWidth;\n\tconst ratio = naturalWidth / naturalHeight;\n\tconst currentHeight = currentWidth / ratio;\n\tconst minWidth =\n\t\tnaturalWidth < naturalHeight ? MIN_SIZE : Math.ceil( MIN_SIZE * ratio );\n\tconst minHeight =\n\t\tnaturalHeight < naturalWidth ? MIN_SIZE : Math.ceil( MIN_SIZE / ratio );\n\n\t// With the current implementation of ResizableBox, an image needs an\n\t// explicit pixel value for the max-width. In absence of being able to\n\t// set the content-width, this max-width is currently dictated by the\n\t// vanilla editor style. The following variable adds a buffer to this\n\t// vanilla style, so 3rd party themes have some wiggleroom. This does,\n\t// in most cases, allow you to scale the image beyond the width of the\n\t// main column, though not infinitely.\n\t// @todo It would be good to revisit this once a content-width variable\n\t// becomes available.\n\tconst maxWidthBuffer = maxWidth * 2.5;\n\n\tlet showRightHandle = false;\n\tlet showLeftHandle = false;\n\n\t/* eslint-disable no-lonely-if */\n\t// See https://github.com/WordPress/gutenberg/issues/7584.\n\tif ( align === 'center' ) {\n\t\t// When the image is centered, show both handles.\n\t\tshowRightHandle = true;\n\t\tshowLeftHandle = true;\n\t} else if ( isRTL() ) {\n\t\t// In RTL mode the image is on the right by default.\n\t\t// Show the right handle and hide the left handle only when it is\n\t\t// aligned left. Otherwise always show the left handle.\n\t\tif ( align === 'left' ) {\n\t\t\tshowRightHandle = true;\n\t\t} else {\n\t\t\tshowLeftHandle = true;\n\t\t}\n\t} else {\n\t\t// Show the left handle and hide the right handle only when the\n\t\t// image is aligned right. Otherwise always show the right handle.\n\t\tif ( align === 'right' ) {\n\t\t\tshowLeftHandle = true;\n\t\t} else {\n\t\t\tshowRightHandle = true;\n\t\t}\n\t}\n\t/* eslint-enable no-lonely-if */\n\n\tconst canEditImage =\n\t\tlogoId && naturalWidth && naturalHeight && imageEditing;\n\n\tconst imgEdit =\n\t\tcanEditImage && isEditingImage ? (\n\t\t\t<ImageEditingProvider\n\t\t\t\tid={ logoId }\n\t\t\t\turl={ logoUrl }\n\t\t\t\tnaturalWidth={ naturalWidth }\n\t\t\t\tnaturalHeight={ naturalHeight }\n\t\t\t\tclientWidth={ clientWidth }\n\t\t\t\tonSaveImage={ ( imageAttributes ) => {\n\t\t\t\t\tsetLogo( imageAttributes.id );\n\t\t\t\t} }\n\t\t\t\tisEditing={ isEditingImage }\n\t\t\t\tonFinishEditing={ () => setIsEditingImage( false ) }\n\t\t\t>\n\t\t\t\t<ImageEditor\n\t\t\t\t\turl={ logoUrl }\n\t\t\t\t\twidth={ currentWidth }\n\t\t\t\t\theight={ currentHeight }\n\t\t\t\t\tclientWidth={ clientWidth }\n\t\t\t\t\tnaturalHeight={ naturalHeight }\n\t\t\t\t\tnaturalWidth={ naturalWidth }\n\t\t\t\t/>\n\t\t\t</ImageEditingProvider>\n\t\t) : (\n\t\t\t<ResizableBox\n\t\t\t\tsize={ {\n\t\t\t\t\twidth: currentWidth,\n\t\t\t\t\theight: currentHeight,\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\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, delta ) => {\n\t\t\t\t\tonResizeStop();\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: parseInt( currentWidth + delta.width, 10 ),\n\t\t\t\t\t\theight: parseInt( currentHeight + delta.height, 10 ),\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ imgWrapper }\n\t\t\t</ResizableBox>\n\t\t);\n\n\tconst syncSiteIconHelpText = createInterpolateElement(\n\t\t__(\n\t\t\t'Site Icons are what you see in browser tabs, bookmark bars, and within the WordPress mobile apps. To use a custom icon that is different from your site logo, use the <a>Site Icon settings</a>.'\n\t\t),\n\t\t{\n\t\t\ta: (\n\t\t\t\t// eslint-disable-next-line jsx-a11y/anchor-has-content\n\t\t\t\t<a\n\t\t\t\t\thref={\n\t\t\t\t\t\tsiteUrl +\n\t\t\t\t\t\t'/wp-admin/customize.php?autofocus[section]=title_tagline'\n\t\t\t\t\t}\n\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t/>\n\t\t\t),\n\t\t}\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\tlabel={ __( 'Image width' ) }\n\t\t\t\t\t\tonChange={ ( newWidth ) =>\n\t\t\t\t\t\t\tsetAttributes( { width: newWidth } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmin={ minWidth }\n\t\t\t\t\t\tmax={ maxWidthBuffer }\n\t\t\t\t\t\tinitialPosition={ Math.min(\n\t\t\t\t\t\t\tdefaultWidth,\n\t\t\t\t\t\t\tmaxWidthBuffer\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tvalue={ width || '' }\n\t\t\t\t\t\tdisabled={ ! isResizable }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Link image to home' ) }\n\t\t\t\t\t\tonChange={ () => setAttributes( { isLink: ! isLink } ) }\n\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t/>\n\t\t\t\t\t{ isLink && (\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={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlinkTarget: value ? '_blank' : '_self',\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\tchecked={ linkTarget === '_blank' }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t{ canUserEdit && (\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={ __( 'Use as site icon' ) }\n\t\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t\tsetAttributes( { shouldSyncIcon: value } );\n\t\t\t\t\t\t\t\t\tsetIcon( value ? logoId : undefined );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tchecked={ !! shouldSyncIcon }\n\t\t\t\t\t\t\t\thelp={ syncSiteIconHelpText }\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</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t{ canEditImage && ! isEditingImage && (\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</BlockControls>\n\t\t\t{ imgEdit }\n\t\t</>\n\t);\n};\n\nexport default function LogoEdit( {\n\tattributes,\n\tclassName,\n\tsetAttributes,\n\tisSelected,\n} ) {\n\tconst { width, shouldSyncIcon } = attributes;\n\tconst [ logoUrl, setLogoUrl ] = useState();\n\tconst ref = useRef();\n\n\tconst {\n\t\tsiteLogoId,\n\t\tcanUserEdit,\n\t\turl,\n\t\tsiteIconId,\n\t\tmediaItemData,\n\t\tisRequestingMediaItem,\n\t} = useSelect( ( select ) => {\n\t\tconst { canUser, getEntityRecord, getEditedEntityRecord } = select(\n\t\t\tcoreStore\n\t\t);\n\t\tconst siteSettings = getEditedEntityRecord( 'root', 'site' );\n\t\tconst siteData = getEntityRecord( 'root', '__unstableBase' );\n\t\tconst _siteLogo = siteSettings?.site_logo;\n\t\tconst _readOnlyLogo = siteData?.site_logo;\n\t\tconst _canUserEdit = canUser( 'update', 'settings' );\n\t\tconst _siteLogoId = _canUserEdit ? _siteLogo : _readOnlyLogo;\n\t\tconst _siteIconId = siteSettings?.site_icon;\n\t\tconst mediaItem =\n\t\t\t_siteLogoId &&\n\t\t\tselect( coreStore ).getMedia( _siteLogoId, {\n\t\t\t\tcontext: 'view',\n\t\t\t} );\n\t\tconst _isRequestingMediaItem =\n\t\t\t_siteLogoId &&\n\t\t\t! select( coreStore ).hasFinishedResolution( 'getMedia', [\n\t\t\t\t_siteLogoId,\n\t\t\t\t{ context: 'view' },\n\t\t\t] );\n\n\t\treturn {\n\t\t\tsiteLogoId: _siteLogoId,\n\t\t\tcanUserEdit: _canUserEdit,\n\t\t\turl: siteData?.url,\n\t\t\tmediaItemData: mediaItem && {\n\t\t\t\tid: mediaItem.id,\n\t\t\t\turl: mediaItem.source_url,\n\t\t\t\talt: mediaItem.alt_text,\n\t\t\t},\n\t\t\tisRequestingMediaItem: _isRequestingMediaItem,\n\t\t\tsiteIconId: _siteIconId,\n\t\t};\n\t}, [] );\n\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\n\tconst setLogo = ( newValue, shouldForceSync = false ) => {\n\t\t// `shouldForceSync` is used to force syncing when the attribute\n\t\t// may not have updated yet.\n\t\tif ( shouldSyncIcon || shouldForceSync ) {\n\t\t\tsetIcon( newValue );\n\t\t}\n\n\t\teditEntityRecord( 'root', 'site', undefined, {\n\t\t\tsite_logo: newValue,\n\t\t} );\n\t};\n\n\tconst setIcon = ( newValue ) =>\n\t\teditEntityRecord( 'root', 'site', undefined, {\n\t\t\tsite_icon: newValue,\n\t\t} );\n\n\tlet alt = null;\n\tif ( mediaItemData ) {\n\t\talt = mediaItemData.alt;\n\t\tif ( logoUrl !== mediaItemData.url ) {\n\t\t\tsetLogoUrl( mediaItemData.url );\n\t\t}\n\t}\n\n\tconst onInitialSelectLogo = ( media ) => {\n\t\t// Initialize the syncSiteIcon toggle. If we currently have no Site logo and no\n\t\t// site icon, automatically sync the logo to the icon.\n\t\tif ( shouldSyncIcon === undefined ) {\n\t\t\tconst shouldForceSync = ! siteIconId;\n\t\t\tsetAttributes( { shouldSyncIcon: shouldForceSync } );\n\n\t\t\t// Because we cannot rely on the `shouldSyncIcon` attribute to have updated by\n\t\t\t// the time `setLogo` is called, pass an argument to force the syncing.\n\t\t\tonSelectLogo( media, shouldForceSync );\n\t\t\treturn;\n\t\t}\n\n\t\tonSelectLogo( media );\n\t};\n\n\tconst onSelectLogo = ( media, shouldForceSync = false ) => {\n\t\tif ( ! media ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! media.id && media.url ) {\n\t\t\t// This is a temporary blob image\n\t\t\tsetLogo( undefined );\n\t\t\tsetLogoUrl( media.url );\n\t\t\treturn;\n\t\t}\n\n\t\tsetLogo( media.id, shouldForceSync );\n\t};\n\n\tconst onRemoveLogo = () => {\n\t\tsetLogo( null );\n\t\tsetLogoUrl( undefined );\n\t\tsetAttributes( { width: undefined } );\n\t};\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message[ 2 ], { type: 'snackbar' } );\n\t};\n\n\tconst controls = canUserEdit && logoUrl && (\n\t\t<BlockControls group=\"other\">\n\t\t\t<MediaReplaceFlow\n\t\t\t\tmediaURL={ logoUrl }\n\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\taccept={ ACCEPT_MEDIA_STRING }\n\t\t\t\tonSelect={ onSelectLogo }\n\t\t\t\tonError={ onUploadError }\n\t\t\t>\n\t\t\t\t<MenuItem onClick={ onRemoveLogo }>{ __( 'Reset' ) }</MenuItem>\n\t\t\t</MediaReplaceFlow>\n\t\t</BlockControls>\n\t);\n\n\tlet logoImage;\n\tconst isLoading = siteLogoId === undefined || isRequestingMediaItem;\n\tif ( isLoading ) {\n\t\tlogoImage = <Spinner />;\n\t}\n\tif ( !! logoUrl ) {\n\t\tlogoImage = (\n\t\t\t<SiteLogo\n\t\t\t\talt={ alt }\n\t\t\t\tattributes={ attributes }\n\t\t\t\tclassName={ className }\n\t\t\t\tcontainerRef={ ref }\n\t\t\t\tisSelected={ isSelected }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\tlogoUrl={ logoUrl }\n\t\t\t\tsetLogo={ setLogo }\n\t\t\t\tlogoId={ mediaItemData?.id || siteLogoId }\n\t\t\t\tsiteUrl={ url }\n\t\t\t\tsetIcon={ setIcon }\n\t\t\t\ticonId={ siteIconId }\n\t\t\t\tcanUserEdit={ canUserEdit }\n\t\t\t/>\n\t\t);\n\t}\n\tconst placeholder = ( content ) => {\n\t\tconst placeholderClassName = classnames(\n\t\t\t'block-editor-media-placeholder',\n\t\t\tclassName\n\t\t);\n\n\t\treturn (\n\t\t\t<Placeholder\n\t\t\t\tclassName={ placeholderClassName }\n\t\t\t\tpreview={ logoImage }\n\t\t\t>\n\t\t\t\t{\n\t\t\t\t\t<SVG\n\t\t\t\t\t\tclassName=\"components-placeholder__illustration\"\n\t\t\t\t\t\tfill=\"none\"\n\t\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\t\tviewBox=\"0 0 60 60\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Path\n\t\t\t\t\t\t\tvectorEffect=\"non-scaling-stroke\"\n\t\t\t\t\t\t\td=\"m61 32.622-13.555-9.137-15.888 9.859a5 5 0 0 1-5.386-.073l-9.095-5.989L1 37.5\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</SVG>\n\t\t\t\t}\n\t\t\t\t{ content }\n\t\t\t</Placeholder>\n\t\t);\n\t};\n\n\tconst classes = classnames( className, {\n\t\t'is-default-size': ! width,\n\t} );\n\n\tconst blockProps = useBlockProps( {\n\t\tref,\n\t\tclassName: classes,\n\t} );\n\n\tconst label = __( 'Add a site logo' );\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t{ controls }\n\t\t\t{ !! logoUrl && logoImage }\n\t\t\t{ ! logoUrl && ! canUserEdit && (\n\t\t\t\t<Placeholder className=\"site-logo_placeholder\">\n\t\t\t\t\t{ isLoading && (\n\t\t\t\t\t\t<span className=\"components-placeholder__preview\">\n\t\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</Placeholder>\n\t\t\t) }\n\t\t\t{ ! logoUrl && canUserEdit && (\n\t\t\t\t<MediaPlaceholder\n\t\t\t\t\tonSelect={ onInitialSelectLogo }\n\t\t\t\t\taccept={ ACCEPT_MEDIA_STRING }\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\tplaceholder={ placeholder }\n\t\t\t\t\tmediaLibraryButton={ ( { open } ) => {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\t\ttooltipPosition=\"top center\"\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\topen();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -55,68 +55,7 @@ const migrateWithLayout = attributes => {
|
|
|
55
55
|
}; // Social Links block deprecations.
|
|
56
56
|
|
|
57
57
|
|
|
58
|
-
const deprecated = [//
|
|
59
|
-
{
|
|
60
|
-
attributes: {
|
|
61
|
-
iconColor: {
|
|
62
|
-
type: 'string'
|
|
63
|
-
},
|
|
64
|
-
customIconColor: {
|
|
65
|
-
type: 'string'
|
|
66
|
-
},
|
|
67
|
-
iconColorValue: {
|
|
68
|
-
type: 'string'
|
|
69
|
-
},
|
|
70
|
-
iconBackgroundColor: {
|
|
71
|
-
type: 'string'
|
|
72
|
-
},
|
|
73
|
-
customIconBackgroundColor: {
|
|
74
|
-
type: 'string'
|
|
75
|
-
},
|
|
76
|
-
iconBackgroundColorValue: {
|
|
77
|
-
type: 'string'
|
|
78
|
-
},
|
|
79
|
-
openInNewTab: {
|
|
80
|
-
type: 'boolean',
|
|
81
|
-
default: false
|
|
82
|
-
},
|
|
83
|
-
size: {
|
|
84
|
-
type: 'string'
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
supports: {
|
|
88
|
-
align: ['left', 'center', 'right'],
|
|
89
|
-
anchor: true,
|
|
90
|
-
__experimentalExposeControlsToChildren: true
|
|
91
|
-
},
|
|
92
|
-
isEligible: _ref => {
|
|
93
|
-
let {
|
|
94
|
-
layout
|
|
95
|
-
} = _ref;
|
|
96
|
-
return !layout;
|
|
97
|
-
},
|
|
98
|
-
migrate: migrateWithLayout,
|
|
99
|
-
|
|
100
|
-
save(props) {
|
|
101
|
-
const {
|
|
102
|
-
attributes: {
|
|
103
|
-
iconBackgroundColorValue,
|
|
104
|
-
iconColorValue,
|
|
105
|
-
itemsJustification,
|
|
106
|
-
size
|
|
107
|
-
}
|
|
108
|
-
} = props;
|
|
109
|
-
const className = classNames(size, {
|
|
110
|
-
'has-icon-color': iconColorValue,
|
|
111
|
-
'has-icon-background-color': iconBackgroundColorValue,
|
|
112
|
-
[`items-justified-${itemsJustification}`]: itemsJustification
|
|
113
|
-
});
|
|
114
|
-
return createElement("ul", useBlockProps.save({
|
|
115
|
-
className
|
|
116
|
-
}), createElement(InnerBlocks.Content, null));
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
}, // V1. Remove CSS variable use for colors.
|
|
58
|
+
const deprecated = [// V1. Remove CSS variable use for colors.
|
|
120
59
|
{
|
|
121
60
|
attributes: {
|
|
122
61
|
iconColor: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/social-links/deprecated.js"],"names":["classNames","InnerBlocks","useBlockProps","migrateWithLayout","attributes","layout","className","prefix","justifiedItemsRegex","RegExp","newAttributes","replace","trim","justifyContent","match","Object","assign","type","slice","length","deprecated","iconColor","customIconColor","iconColorValue","iconBackgroundColor","customIconBackgroundColor","iconBackgroundColorValue","openInNewTab","default","size","supports","align","anchor","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/social-links/deprecated.js"],"names":["classNames","InnerBlocks","useBlockProps","migrateWithLayout","attributes","layout","className","prefix","justifiedItemsRegex","RegExp","newAttributes","replace","trim","justifyContent","match","Object","assign","type","slice","length","deprecated","iconColor","customIconColor","iconColorValue","iconBackgroundColor","customIconBackgroundColor","iconBackgroundColorValue","openInNewTab","default","size","providesContext","supports","align","anchor","migrate","save","props","itemsJustification","style"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,WAAT,EAAsBC,aAAtB,QAA2C,yBAA3C;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,iBA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n * WordPress dependencies\n */\nimport { InnerBlocks, useBlockProps } from '@wordpress/block-editor';\n\n/**\n * The specific handling by `className` below is needed because `itemsJustification`\n * was introduced in https://github.com/WordPress/gutenberg/pull/28980/files and wasn't\n * declared in block.json.\n *\n * @param {Object} attributes Block's attributes.\n */\nconst migrateWithLayout = ( attributes ) => {\n\tif ( !! attributes.layout ) {\n\t\treturn attributes;\n\t}\n\tconst { className } = attributes;\n\t// Matches classes with `items-justified-` prefix.\n\tconst prefix = `items-justified-`;\n\tconst justifiedItemsRegex = new RegExp( `\\\\b${ prefix }[^ ]*[ ]?\\\\b`, 'g' );\n\tconst newAttributes = {\n\t\t...attributes,\n\t\tclassName: className?.replace( justifiedItemsRegex, '' ).trim(),\n\t};\n\t/**\n\t * Add `layout` prop only if `justifyContent` is defined, for backwards\n\t * compatibility. In other cases the block's default layout will be used.\n\t * Also noting that due to the missing attribute, it's possible for a block\n\t * to have more than one of `justified` classes.\n\t */\n\tconst justifyContent = className\n\t\t?.match( justifiedItemsRegex )?.[ 0 ]\n\t\t?.trim();\n\tif ( justifyContent ) {\n\t\tObject.assign( newAttributes, {\n\t\t\tlayout: {\n\t\t\t\ttype: 'flex',\n\t\t\t\tjustifyContent: justifyContent.slice( prefix.length ),\n\t\t\t},\n\t\t} );\n\t}\n\treturn newAttributes;\n};\n\n// Social Links block deprecations.\nconst deprecated = [\n\t// V1. Remove CSS variable use for colors.\n\t{\n\t\tattributes: {\n\t\t\ticonColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tcustomIconColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\ticonColorValue: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\ticonBackgroundColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tcustomIconBackgroundColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\ticonBackgroundColorValue: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\topenInNewTab: {\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: false,\n\t\t\t},\n\t\t\tsize: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t},\n\t\tprovidesContext: {\n\t\t\topenInNewTab: 'openInNewTab',\n\t\t},\n\t\tsupports: {\n\t\t\talign: [ 'left', 'center', 'right' ],\n\t\t\tanchor: true,\n\t\t},\n\t\tmigrate: migrateWithLayout,\n\t\tsave: ( props ) => {\n\t\t\tconst {\n\t\t\t\tattributes: {\n\t\t\t\t\ticonBackgroundColorValue,\n\t\t\t\t\ticonColorValue,\n\t\t\t\t\titemsJustification,\n\t\t\t\t\tsize,\n\t\t\t\t},\n\t\t\t} = props;\n\n\t\t\tconst className = classNames( size, {\n\t\t\t\t'has-icon-color': iconColorValue,\n\t\t\t\t'has-icon-background-color': iconBackgroundColorValue,\n\t\t\t\t[ `items-justified-${ itemsJustification }` ]: itemsJustification,\n\t\t\t} );\n\n\t\t\tconst style = {\n\t\t\t\t'--wp--social-links--icon-color': iconColorValue,\n\t\t\t\t'--wp--social-links--icon-background-color': iconBackgroundColorValue,\n\t\t\t};\n\n\t\t\treturn (\n\t\t\t\t<ul { ...useBlockProps.save( { className, style } ) }>\n\t\t\t\t\t<InnerBlocks.Content />\n\t\t\t\t</ul>\n\t\t\t);\n\t\t},\n\t},\n];\n\nexport default deprecated;\n"]}
|
|
@@ -159,7 +159,7 @@ export function SocialLinksEdit(props) {
|
|
|
159
159
|
iconBackgroundColorValue: colorValue
|
|
160
160
|
});
|
|
161
161
|
},
|
|
162
|
-
label: __('Icon background
|
|
162
|
+
label: __('Icon background')
|
|
163
163
|
}]
|
|
164
164
|
}), !logosOnly && createElement(ContrastChecker, {
|
|
165
165
|
textColor: iconColorValue,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/social-links/edit.js"],"names":["classNames","getBlockSupport","Fragment","useEffect","BlockControls","useInnerBlocksProps","useBlockProps","InspectorControls","ContrastChecker","PanelColorSettings","withColors","MenuGroup","MenuItem","PanelBody","ToggleControl","ToolbarDropdownMenu","__","check","ALLOWED_BLOCKS","sizeOptions","name","value","getDefaultBlockLayout","blockTypeOrName","layoutBlockSupportConfig","default","SocialLinksEdit","props","attributes","iconBackgroundColor","iconColor","isSelected","setAttributes","setIconBackgroundColor","setIconColor","iconBackgroundColorValue","iconColorValue","openInNewTab","size","layout","usedLayout","logosOnly","className","indexOf","undefined","customIconBackgroundColor","SocialPlaceholder","SelectedSocialPlaceholder","color","blockProps","innerBlocksProps","allowedBlocks","placeholder","templateLock","__experimentalAppenderTagName","__experimentalLayout","POPOVER_PROPS","position","onClose","map","entry","onChange","colorValue","label","textColor","backgroundColor","iconColorAttributes"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,QAAT,EAAmBC,SAAnB,QAAoC,oBAApC;AACA,SACCC,aADD,EAECC,mBAFD,EAGCC,aAHD,EAICC,iBAJD,EAKCC,eALD,EAMCC,kBAND,EAOCC,UAPD,QAQO,yBARP;AASA,SACCC,SADD,EAECC,QAFD,EAGCC,SAHD,EAICC,aAJD,EAKCC,mBALD,QAMO,uBANP;AAOA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAT,QAAsB,kBAAtB;AAEA,MAAMC,cAAc,GAAG,CAAE,kBAAF,CAAvB;AAEA,MAAMC,WAAW,GAAG,CACnB;AAAEC,EAAAA,IAAI,EAAEJ,EAAE,CAAE,OAAF,CAAV;AAAuBK,EAAAA,KAAK,EAAE;AAA9B,CADmB,EAEnB;AAAED,EAAAA,IAAI,EAAEJ,EAAE,CAAE,QAAF,CAAV;AAAwBK,EAAAA,KAAK,EAAE;AAA/B,CAFmB,EAGnB;AAAED,EAAAA,IAAI,EAAEJ,EAAE,CAAE,OAAF,CAAV;AAAuBK,EAAAA,KAAK,EAAE;AAA9B,CAHmB,EAInB;AAA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,EAAE,CAAE,YAAF;AARV,KADe,EAWf,CAAEyB,SAAF,IAAe;AACd;AACA;AACApB,MAAAA,KAAK,EACJQ,mBAAmB,CAACmB,KAApB,IACAb,wBALa;AAMd0B,MAAAA,QAAQ,EAAIC,UAAF,IAAkB;AAC3B7B,QAAAA,sBAAsB,CAAE6B,UAAF,CAAtB;AACA9B,QAAAA,aAAa,CAAE;AACdG,UAAAA,wBAAwB,EAAE2B;AADZ,SAAF,CAAb;AAGA,OAXa;AAYdC,MAAAA,KAAK,EAAE/C,EAAE,CAAE,uBAAF;AAZK,KAXA;AAJjB,IAVD,EAyCG,CAAEyB,SAAF,IACD,cAAC,eAAD;AAEEuB,IAAAA,SAAS,EAAE5B,cAFb;AAGE6B,IAAAA,eAAe,EAAE9B,wBAHnB;AAKC,IAAA,WAAW,EAAG;AALf,IA1CF,CAtCD,EAyFC,oBAASe,gBAAT,CAzFD,CADD;AA6FA;AAED,MAAMgB,mBAAmB,GAAG;AAC3BpC,EAAAA,SAAS,EAAE,YADgB;AAE3BD,EAAAA,mBAAmB,EAAE;AAFM,CAA5B;AAKA,eAAenB,UAAU,CAAEwD,mBAAF,CAAV,CAAmCxC,eAAnC,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { Fragment, useEffect } from '@wordpress/element';\nimport {\n\tBlockControls,\n\tuseInnerBlocksProps,\n\tuseBlockProps,\n\tInspectorControls,\n\tContrastChecker,\n\tPanelColorSettings,\n\twithColors,\n} from '@wordpress/block-editor';\nimport {\n\tMenuGroup,\n\tMenuItem,\n\tPanelBody,\n\tToggleControl,\n\tToolbarDropdownMenu,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { check } from '@wordpress/icons';\n\nconst ALLOWED_BLOCKS = [ 'core/social-link' ];\n\nconst sizeOptions = [\n\t{ name: __( 'Small' ), value: 'has-small-icon-size' },\n\t{ name: __( 'Normal' ), value: 'has-normal-icon-size' },\n\t{ name: __( 'Large' ), value: 'has-large-icon-size' },\n\t{ name: __( 'Huge' ), value: 'has-huge-icon-size' },\n];\n\nconst getDefaultBlockLayout = ( blockTypeOrName ) => {\n\tconst layoutBlockSupportConfig = getBlockSupport(\n\t\tblockTypeOrName,\n\t\t'__experimentalLayout'\n\t);\n\treturn layoutBlockSupportConfig?.default;\n};\n\nexport function SocialLinksEdit( props ) {\n\tconst {\n\t\tname,\n\t\tattributes,\n\t\ticonBackgroundColor,\n\t\ticonColor,\n\t\tisSelected,\n\t\tsetAttributes,\n\t\tsetIconBackgroundColor,\n\t\tsetIconColor,\n\t} = props;\n\n\tconst {\n\t\ticonBackgroundColorValue,\n\t\ticonColorValue,\n\t\topenInNewTab,\n\t\tsize,\n\t\tlayout,\n\t} = attributes;\n\tconst usedLayout = layout || getDefaultBlockLayout( name );\n\n\t// Remove icon background color if logos only style selected.\n\tconst logosOnly =\n\t\tattributes.className?.indexOf( 'is-style-logos-only' ) >= 0;\n\tuseEffect( () => {\n\t\tif ( logosOnly ) {\n\t\t\tsetAttributes( {\n\t\t\t\ticonBackgroundColor: undefined,\n\t\t\t\tcustomIconBackgroundColor: undefined,\n\t\t\t\ticonBackgroundColorValue: undefined,\n\t\t\t} );\n\t\t}\n\t}, [ logosOnly, setAttributes ] );\n\n\tconst SocialPlaceholder = (\n\t\t<li className=\"wp-block-social-links__social-placeholder\">\n\t\t\t<div className=\"wp-social-link\"></div>\n\t\t\t<div className=\"wp-block-social-links__social-placeholder-icons\">\n\t\t\t\t<div className=\"wp-social-link wp-social-link-twitter\"></div>\n\t\t\t\t<div className=\"wp-social-link wp-social-link-facebook\"></div>\n\t\t\t\t<div className=\"wp-social-link wp-social-link-instagram\"></div>\n\t\t\t</div>\n\t\t</li>\n\t);\n\n\tconst SelectedSocialPlaceholder = (\n\t\t<li className=\"wp-block-social-links__social-prompt\">\n\t\t\t{ __( 'Click plus to add' ) }\n\t\t</li>\n\t);\n\n\t// Fallback color values are used maintain selections in case switching\n\t// themes and named colors in palette do not match.\n\tconst className = classNames( size, {\n\t\t'has-icon-color': iconColor.color || iconColorValue,\n\t\t'has-icon-background-color':\n\t\t\ticonBackgroundColor.color || iconBackgroundColorValue,\n\t} );\n\n\tconst blockProps = useBlockProps( { className } );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tallowedBlocks: ALLOWED_BLOCKS,\n\t\tplaceholder: isSelected ? SelectedSocialPlaceholder : SocialPlaceholder,\n\t\ttemplateLock: false,\n\t\t__experimentalAppenderTagName: 'li',\n\t\t__experimentalLayout: usedLayout,\n\t} );\n\n\tconst POPOVER_PROPS = {\n\t\tposition: 'bottom right',\n\t};\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<BlockControls group=\"other\">\n\t\t\t\t<ToolbarDropdownMenu\n\t\t\t\t\tlabel={ __( 'Size' ) }\n\t\t\t\t\ttext={ __( 'Size' ) }\n\t\t\t\t\ticon={ null }\n\t\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t{ sizeOptions.map( ( entry ) => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t( size === entry.value ||\n\t\t\t\t\t\t\t\t\t\t\t\t( ! size &&\n\t\t\t\t\t\t\t\t\t\t\t\t\tentry.value ===\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'has-normal-icon-size' ) ) &&\n\t\t\t\t\t\t\t\t\t\t\tcheck\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tisSelected={ size === entry.value }\n\t\t\t\t\t\t\t\t\t\tkey={ entry.value }\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\tsize: entry.value,\n\t\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\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\t\t\trole=\"menuitemradio\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ entry.name }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarDropdownMenu>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Link settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Open links in new tab' ) }\n\t\t\t\t\t\tchecked={ openInNewTab }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( { openInNewTab: ! openInNewTab } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t\t<PanelColorSettings\n\t\t\t\t\t__experimentalHasMultipleOrigins\n\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\ttitle={ __( 'Color' ) }\n\t\t\t\t\tcolorSettings={ [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t\t\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\t\t\t\t\tvalue: iconColor.color || iconColorValue,\n\t\t\t\t\t\t\tonChange: ( colorValue ) => {\n\t\t\t\t\t\t\t\tsetIconColor( colorValue );\n\t\t\t\t\t\t\t\tsetAttributes( { iconColorValue: colorValue } );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tlabel: __( 'Icon color' ),\n\t\t\t\t\t\t},\n\t\t\t\t\t\t! logosOnly && {\n\t\t\t\t\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t\t\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\t\t\t\t\tvalue:\n\t\t\t\t\t\t\t\ticonBackgroundColor.color ||\n\t\t\t\t\t\t\t\ticonBackgroundColorValue,\n\t\t\t\t\t\t\tonChange: ( colorValue ) => {\n\t\t\t\t\t\t\t\tsetIconBackgroundColor( colorValue );\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\ticonBackgroundColorValue: colorValue,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tlabel: __( 'Icon background color' ),\n\t\t\t\t\t\t},\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t\t{ ! logosOnly && (\n\t\t\t\t\t<ContrastChecker\n\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\ttextColor: iconColorValue,\n\t\t\t\t\t\t\tbackgroundColor: iconBackgroundColorValue,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisLargeText={ false }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t\t<ul { ...innerBlocksProps } />\n\t\t</Fragment>\n\t);\n}\n\nconst iconColorAttributes = {\n\ticonColor: 'icon-color',\n\ticonBackgroundColor: 'icon-background-color',\n};\n\nexport default withColors( iconColorAttributes )( SocialLinksEdit );\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/social-links/edit.js"],"names":["classNames","getBlockSupport","Fragment","useEffect","BlockControls","useInnerBlocksProps","useBlockProps","InspectorControls","ContrastChecker","PanelColorSettings","withColors","MenuGroup","MenuItem","PanelBody","ToggleControl","ToolbarDropdownMenu","__","check","ALLOWED_BLOCKS","sizeOptions","name","value","getDefaultBlockLayout","blockTypeOrName","layoutBlockSupportConfig","default","SocialLinksEdit","props","attributes","iconBackgroundColor","iconColor","isSelected","setAttributes","setIconBackgroundColor","setIconColor","iconBackgroundColorValue","iconColorValue","openInNewTab","size","layout","usedLayout","logosOnly","className","indexOf","undefined","customIconBackgroundColor","SocialPlaceholder","SelectedSocialPlaceholder","color","blockProps","innerBlocksProps","allowedBlocks","placeholder","templateLock","__experimentalAppenderTagName","__experimentalLayout","POPOVER_PROPS","position","onClose","map","entry","onChange","colorValue","label","textColor","backgroundColor","iconColorAttributes"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,QAAT,EAAmBC,SAAnB,QAAoC,oBAApC;AACA,SACCC,aADD,EAECC,mBAFD,EAGCC,aAHD,EAICC,iBAJD,EAKCC,eALD,EAMCC,kBAND,EAOCC,UAPD,QAQO,yBARP;AASA,SACCC,SADD,EAECC,QAFD,EAGCC,SAHD,EAICC,aAJD,EAKCC,mBALD,QAMO,uBANP;AAOA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAT,QAAsB,kBAAtB;AAEA,MAAMC,cAAc,GAAG,CAAE,kBAAF,CAAvB;AAEA,MAAMC,WAAW,GAAG,CACnB;AAAEC,EAAAA,IAAI,EAAEJ,EAAE,CAAE,OAAF,CAAV;AAAuBK,EAAAA,KAAK,EAAE;AAA9B,CADmB,EAEnB;AAAED,EAAAA,IAAI,EAAEJ,EAAE,CAAE,QAAF,CAAV;AAAwBK,EAAAA,KAAK,EAAE;AAA/B,CAFmB,EAGnB;AAAED,EAAAA,IAAI,EAAEJ,EAAE,CAAE,OAAF,CAAV;AAAuBK,EAAAA,KAAK,EAAE;AAA9B,CAHmB,EAInB;AAAED,EAAAA,IAAI,EAAEJ,EAAE,CAAE,MAAF,CAAV;AAAsBK,EAAAA,KAAK,EAAE;AAA7B,CAJmB,CAApB;;AAOA,MAAMC,qBAAqB,GAAKC,eAAF,IAAuB;AACpD,QAAMC,wBAAwB,GAAGvB,eAAe,CAC/CsB,eAD+C,EAE/C,sBAF+C,CAAhD;AAIA,SAAOC,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,aAAa,CAAE;AACdG,UAAAA,wBAAwB,EAAE2B;AADZ,SAAF,CAAb;AAGA,OAXa;AAYdC,MAAAA,KAAK,EAAE/C,EAAE,CAAE,iBAAF;AAZK,KAXA;AAJjB,IAVD,EAyCG,CAAEyB,SAAF,IACD,cAAC,eAAD;AAEEuB,IAAAA,SAAS,EAAE5B,cAFb;AAGE6B,IAAAA,eAAe,EAAE9B,wBAHnB;AAKC,IAAA,WAAW,EAAG;AALf,IA1CF,CAtCD,EAyFC,oBAASe,gBAAT,CAzFD,CADD;AA6FA;AAED,MAAMgB,mBAAmB,GAAG;AAC3BpC,EAAAA,SAAS,EAAE,YADgB;AAE3BD,EAAAA,mBAAmB,EAAE;AAFM,CAA5B;AAKA,eAAenB,UAAU,CAAEwD,mBAAF,CAAV,CAAmCxC,eAAnC,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { Fragment, useEffect } from '@wordpress/element';\nimport {\n\tBlockControls,\n\tuseInnerBlocksProps,\n\tuseBlockProps,\n\tInspectorControls,\n\tContrastChecker,\n\tPanelColorSettings,\n\twithColors,\n} from '@wordpress/block-editor';\nimport {\n\tMenuGroup,\n\tMenuItem,\n\tPanelBody,\n\tToggleControl,\n\tToolbarDropdownMenu,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { check } from '@wordpress/icons';\n\nconst ALLOWED_BLOCKS = [ 'core/social-link' ];\n\nconst sizeOptions = [\n\t{ name: __( 'Small' ), value: 'has-small-icon-size' },\n\t{ name: __( 'Normal' ), value: 'has-normal-icon-size' },\n\t{ name: __( 'Large' ), value: 'has-large-icon-size' },\n\t{ name: __( 'Huge' ), value: 'has-huge-icon-size' },\n];\n\nconst getDefaultBlockLayout = ( blockTypeOrName ) => {\n\tconst layoutBlockSupportConfig = getBlockSupport(\n\t\tblockTypeOrName,\n\t\t'__experimentalLayout'\n\t);\n\treturn layoutBlockSupportConfig?.default;\n};\n\nexport function SocialLinksEdit( props ) {\n\tconst {\n\t\tname,\n\t\tattributes,\n\t\ticonBackgroundColor,\n\t\ticonColor,\n\t\tisSelected,\n\t\tsetAttributes,\n\t\tsetIconBackgroundColor,\n\t\tsetIconColor,\n\t} = props;\n\n\tconst {\n\t\ticonBackgroundColorValue,\n\t\ticonColorValue,\n\t\topenInNewTab,\n\t\tsize,\n\t\tlayout,\n\t} = attributes;\n\tconst usedLayout = layout || getDefaultBlockLayout( name );\n\n\t// Remove icon background color if logos only style selected.\n\tconst logosOnly =\n\t\tattributes.className?.indexOf( 'is-style-logos-only' ) >= 0;\n\tuseEffect( () => {\n\t\tif ( logosOnly ) {\n\t\t\tsetAttributes( {\n\t\t\t\ticonBackgroundColor: undefined,\n\t\t\t\tcustomIconBackgroundColor: undefined,\n\t\t\t\ticonBackgroundColorValue: undefined,\n\t\t\t} );\n\t\t}\n\t}, [ logosOnly, setAttributes ] );\n\n\tconst SocialPlaceholder = (\n\t\t<li className=\"wp-block-social-links__social-placeholder\">\n\t\t\t<div className=\"wp-social-link\"></div>\n\t\t\t<div className=\"wp-block-social-links__social-placeholder-icons\">\n\t\t\t\t<div className=\"wp-social-link wp-social-link-twitter\"></div>\n\t\t\t\t<div className=\"wp-social-link wp-social-link-facebook\"></div>\n\t\t\t\t<div className=\"wp-social-link wp-social-link-instagram\"></div>\n\t\t\t</div>\n\t\t</li>\n\t);\n\n\tconst SelectedSocialPlaceholder = (\n\t\t<li className=\"wp-block-social-links__social-prompt\">\n\t\t\t{ __( 'Click plus to add' ) }\n\t\t</li>\n\t);\n\n\t// Fallback color values are used maintain selections in case switching\n\t// themes and named colors in palette do not match.\n\tconst className = classNames( size, {\n\t\t'has-icon-color': iconColor.color || iconColorValue,\n\t\t'has-icon-background-color':\n\t\t\ticonBackgroundColor.color || iconBackgroundColorValue,\n\t} );\n\n\tconst blockProps = useBlockProps( { className } );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tallowedBlocks: ALLOWED_BLOCKS,\n\t\tplaceholder: isSelected ? SelectedSocialPlaceholder : SocialPlaceholder,\n\t\ttemplateLock: false,\n\t\t__experimentalAppenderTagName: 'li',\n\t\t__experimentalLayout: usedLayout,\n\t} );\n\n\tconst POPOVER_PROPS = {\n\t\tposition: 'bottom right',\n\t};\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<BlockControls group=\"other\">\n\t\t\t\t<ToolbarDropdownMenu\n\t\t\t\t\tlabel={ __( 'Size' ) }\n\t\t\t\t\ttext={ __( 'Size' ) }\n\t\t\t\t\ticon={ null }\n\t\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t{ sizeOptions.map( ( entry ) => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t( size === entry.value ||\n\t\t\t\t\t\t\t\t\t\t\t\t( ! size &&\n\t\t\t\t\t\t\t\t\t\t\t\t\tentry.value ===\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'has-normal-icon-size' ) ) &&\n\t\t\t\t\t\t\t\t\t\t\tcheck\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tisSelected={ size === entry.value }\n\t\t\t\t\t\t\t\t\t\tkey={ entry.value }\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\tsize: entry.value,\n\t\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\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\t\t\trole=\"menuitemradio\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ entry.name }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarDropdownMenu>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Link settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Open links in new tab' ) }\n\t\t\t\t\t\tchecked={ openInNewTab }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( { openInNewTab: ! openInNewTab } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t\t<PanelColorSettings\n\t\t\t\t\t__experimentalHasMultipleOrigins\n\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\ttitle={ __( 'Color' ) }\n\t\t\t\t\tcolorSettings={ [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t\t\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\t\t\t\t\tvalue: iconColor.color || iconColorValue,\n\t\t\t\t\t\t\tonChange: ( colorValue ) => {\n\t\t\t\t\t\t\t\tsetIconColor( colorValue );\n\t\t\t\t\t\t\t\tsetAttributes( { iconColorValue: colorValue } );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tlabel: __( 'Icon color' ),\n\t\t\t\t\t\t},\n\t\t\t\t\t\t! logosOnly && {\n\t\t\t\t\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t\t\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\t\t\t\t\tvalue:\n\t\t\t\t\t\t\t\ticonBackgroundColor.color ||\n\t\t\t\t\t\t\t\ticonBackgroundColorValue,\n\t\t\t\t\t\t\tonChange: ( colorValue ) => {\n\t\t\t\t\t\t\t\tsetIconBackgroundColor( colorValue );\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\ticonBackgroundColorValue: colorValue,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tlabel: __( 'Icon background' ),\n\t\t\t\t\t\t},\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t\t{ ! logosOnly && (\n\t\t\t\t\t<ContrastChecker\n\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\ttextColor: iconColorValue,\n\t\t\t\t\t\t\tbackgroundColor: iconBackgroundColorValue,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisLargeText={ false }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t\t<ul { ...innerBlocksProps } />\n\t\t</Fragment>\n\t);\n}\n\nconst iconColorAttributes = {\n\ticonColor: 'icon-color',\n\ticonBackgroundColor: 'icon-background-color',\n};\n\nexport default withColors( iconColorAttributes )( SocialLinksEdit );\n"]}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { InspectorControls, useSetting } from '@wordpress/block-editor';
|
|
8
|
+
import { BaseControl, PanelBody, __experimentalUseCustomUnits as useCustomUnits, __experimentalUnitControl as UnitControl } from '@wordpress/components';
|
|
9
|
+
import { useInstanceId } from '@wordpress/compose';
|
|
10
|
+
import { useState } from '@wordpress/element';
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { MAX_SPACER_SIZE } from './edit';
|
|
16
|
+
|
|
17
|
+
function DimensionInput(_ref) {
|
|
18
|
+
var _ref2;
|
|
19
|
+
|
|
20
|
+
let {
|
|
21
|
+
label,
|
|
22
|
+
onChange,
|
|
23
|
+
isResizing,
|
|
24
|
+
value = ''
|
|
25
|
+
} = _ref;
|
|
26
|
+
const [temporaryInput, setTemporaryInput] = useState(null);
|
|
27
|
+
const inputId = useInstanceId(UnitControl, 'block-spacer-height-input'); // In most contexts the spacer size cannot meaningfully be set to a
|
|
28
|
+
// percentage, since this is relative to the parent container. This
|
|
29
|
+
// unit is disabled from the UI.
|
|
30
|
+
|
|
31
|
+
const availableUnitSettings = (_ref2 = useSetting('spacing.units') || undefined) === null || _ref2 === void 0 ? void 0 : _ref2.filter(availableUnit => availableUnit !== '%');
|
|
32
|
+
const units = useCustomUnits({
|
|
33
|
+
availableUnits: availableUnitSettings || ['px', 'em', 'rem', 'vw', 'vh'],
|
|
34
|
+
defaultValues: {
|
|
35
|
+
px: '100',
|
|
36
|
+
em: '10',
|
|
37
|
+
rem: '10',
|
|
38
|
+
vw: '10',
|
|
39
|
+
vh: '25'
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const handleOnChange = unprocessedValue => {
|
|
44
|
+
setTemporaryInput(null);
|
|
45
|
+
onChange(unprocessedValue);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const handleOnBlur = () => {
|
|
49
|
+
if (temporaryInput !== null) {
|
|
50
|
+
setTemporaryInput(null);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const inputValue = temporaryInput !== null ? temporaryInput : value;
|
|
55
|
+
return createElement(BaseControl, {
|
|
56
|
+
label: label,
|
|
57
|
+
id: inputId
|
|
58
|
+
}, createElement(UnitControl, {
|
|
59
|
+
id: inputId,
|
|
60
|
+
isResetValueOnUnitChange: true,
|
|
61
|
+
min: 0,
|
|
62
|
+
max: MAX_SPACER_SIZE,
|
|
63
|
+
onBlur: handleOnBlur,
|
|
64
|
+
onChange: handleOnChange,
|
|
65
|
+
style: {
|
|
66
|
+
maxWidth: 80
|
|
67
|
+
},
|
|
68
|
+
value: inputValue,
|
|
69
|
+
units: units // Force the unit to update to `px` when the Spacer is being resized.
|
|
70
|
+
,
|
|
71
|
+
unit: isResizing ? 'px' : undefined
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export default function SpacerControls(_ref3) {
|
|
76
|
+
let {
|
|
77
|
+
setAttributes,
|
|
78
|
+
orientation,
|
|
79
|
+
height,
|
|
80
|
+
width,
|
|
81
|
+
isResizing
|
|
82
|
+
} = _ref3;
|
|
83
|
+
return createElement(InspectorControls, null, createElement(PanelBody, {
|
|
84
|
+
title: __('Spacer settings')
|
|
85
|
+
}, orientation === 'horizontal' && createElement(DimensionInput, {
|
|
86
|
+
label: __('Width'),
|
|
87
|
+
value: width,
|
|
88
|
+
onChange: nextWidth => setAttributes({
|
|
89
|
+
width: nextWidth
|
|
90
|
+
}),
|
|
91
|
+
isResizing: isResizing
|
|
92
|
+
}), orientation !== 'horizontal' && createElement(DimensionInput, {
|
|
93
|
+
label: __('Height'),
|
|
94
|
+
value: height,
|
|
95
|
+
onChange: nextHeight => setAttributes({
|
|
96
|
+
height: nextHeight
|
|
97
|
+
}),
|
|
98
|
+
isResizing: isResizing
|
|
99
|
+
})));
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=controls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/spacer/controls.js"],"names":["__","InspectorControls","useSetting","BaseControl","PanelBody","__experimentalUseCustomUnits","useCustomUnits","__experimentalUnitControl","UnitControl","useInstanceId","useState","MAX_SPACER_SIZE","DimensionInput","label","onChange","isResizing","value","temporaryInput","setTemporaryInput","inputId","availableUnitSettings","undefined","filter","availableUnit","units","availableUnits","defaultValues","px","em","rem","vw","vh","handleOnChange","unprocessedValue","handleOnBlur","inputValue","maxWidth","SpacerControls","setAttributes","orientation","height","width","nextWidth","nextHeight"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,iBAAT,EAA4BC,UAA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AAC,cAAD;AACC,IAAA,KAAK,EAAGvC,EAAE,CAAE,QAAF,CADX;AAEC,IAAA,KAAK,EAAGwC,MAFT;AAGC,IAAA,QAAQ,EAAKG,UAAF,IACVL,aAAa,CAAE;AAAEE,MAAAA,MAAM,EAAEG;AAAV,KAAF,CAJf;AAMC,IAAA,UAAU,EAAG5B;AANd,IAZF,CADD,CADD;AA0BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { InspectorControls, useSetting } from '@wordpress/block-editor';\nimport {\n\tBaseControl,\n\tPanelBody,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalUnitControl as UnitControl,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { MAX_SPACER_SIZE } from './edit';\n\nfunction DimensionInput( { label, onChange, isResizing, value = '' } ) {\n\tconst [ temporaryInput, setTemporaryInput ] = useState( null );\n\n\tconst inputId = useInstanceId( UnitControl, 'block-spacer-height-input' );\n\n\t// In most contexts the spacer size cannot meaningfully be set to a\n\t// percentage, since this is relative to the parent container. This\n\t// unit is disabled from the UI.\n\tconst availableUnitSettings = (\n\t\tuseSetting( 'spacing.units' ) || undefined\n\t)?.filter( ( availableUnit ) => availableUnit !== '%' );\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: availableUnitSettings || [\n\t\t\t'px',\n\t\t\t'em',\n\t\t\t'rem',\n\t\t\t'vw',\n\t\t\t'vh',\n\t\t],\n\t\tdefaultValues: { px: '100', em: '10', rem: '10', vw: '10', vh: '25' },\n\t} );\n\n\tconst handleOnChange = ( unprocessedValue ) => {\n\t\tsetTemporaryInput( null );\n\t\tonChange( unprocessedValue );\n\t};\n\n\tconst handleOnBlur = () => {\n\t\tif ( temporaryInput !== null ) {\n\t\t\tsetTemporaryInput( null );\n\t\t}\n\t};\n\n\tconst inputValue = temporaryInput !== null ? temporaryInput : value;\n\n\treturn (\n\t\t<BaseControl label={ label } id={ inputId }>\n\t\t\t<UnitControl\n\t\t\t\tid={ inputId }\n\t\t\t\tisResetValueOnUnitChange\n\t\t\t\tmin={ 0 }\n\t\t\t\tmax={ MAX_SPACER_SIZE }\n\t\t\t\tonBlur={ handleOnBlur }\n\t\t\t\tonChange={ handleOnChange }\n\t\t\t\tstyle={ { maxWidth: 80 } }\n\t\t\t\tvalue={ inputValue }\n\t\t\t\tunits={ units }\n\t\t\t\t// Force the unit to update to `px` when the Spacer is being resized.\n\t\t\t\tunit={ isResizing ? 'px' : undefined }\n\t\t\t/>\n\t\t</BaseControl>\n\t);\n}\n\nexport default function SpacerControls( {\n\tsetAttributes,\n\torientation,\n\theight,\n\twidth,\n\tisResizing,\n} ) {\n\treturn (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Spacer settings' ) }>\n\t\t\t\t{ orientation === 'horizontal' && (\n\t\t\t\t\t<DimensionInput\n\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\tvalue={ width }\n\t\t\t\t\t\tonChange={ ( nextWidth ) =>\n\t\t\t\t\t\t\tsetAttributes( { width: nextWidth } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisResizing={ isResizing }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ orientation !== 'horizontal' && (\n\t\t\t\t\t<DimensionInput\n\t\t\t\t\t\tlabel={ __( 'Height' ) }\n\t\t\t\t\t\tvalue={ height }\n\t\t\t\t\t\tonChange={ ( nextHeight ) =>\n\t\t\t\t\t\t\tsetAttributes( { height: nextHeight } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisResizing={ isResizing }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n}\n"]}
|