@wordpress/block-library 8.8.0 → 8.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/cover/transforms.js +10 -7
- package/build/cover/transforms.js.map +1 -1
- package/build/group/edit.js +3 -1
- package/build/group/edit.js.map +1 -1
- package/build/group/index.js +3 -0
- package/build/group/index.js.map +1 -1
- package/build/image/edit.js +16 -13
- package/build/image/edit.js.map +1 -1
- package/build/image/index.js +1 -1
- package/build/index.native.js +9 -5
- package/build/index.native.js.map +1 -1
- package/build/media-text/edit.js +4 -2
- package/build/media-text/edit.js.map +1 -1
- package/build/media-text/index.js +3 -0
- package/build/media-text/index.js.map +1 -1
- package/build/navigation/edit/index.js +32 -64
- package/build/navigation/edit/index.js.map +1 -1
- package/build/post-date/edit.js +4 -2
- package/build/post-date/edit.js.map +1 -1
- package/build/post-excerpt/edit.js +2 -2
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +8 -5
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/query/deprecated.js +8 -6
- package/build/query/deprecated.js.map +1 -1
- package/build/query/edit/inspector-controls/create-new-post-link.js +41 -0
- package/build/query/edit/inspector-controls/create-new-post-link.js.map +1 -0
- package/build/query/edit/inspector-controls/index.js +14 -6
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/pattern-selection-modal.js +2 -1
- package/build/query/edit/pattern-selection-modal.js.map +1 -1
- package/build/query/index.js +5 -12
- package/build/query/index.js.map +1 -1
- package/build/site-logo/edit.js +114 -16
- package/build/site-logo/edit.js.map +1 -1
- package/build/site-logo/index.js +1 -1
- package/build/social-link/icons/chain.js +1 -1
- package/build/social-link/icons/chain.js.map +1 -1
- package/build/social-link/icons/mail.js +1 -1
- package/build/social-link/icons/mail.js.map +1 -1
- package/build/spacer/edit.js +117 -11
- package/build/spacer/edit.js.map +1 -1
- package/build/template-part/edit/index.js +2 -1
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/edit/utils/hooks.js +2 -2
- package/build/template-part/edit/utils/hooks.js.map +1 -1
- package/build/utils/migrate-font-family.js +12 -5
- package/build/utils/migrate-font-family.js.map +1 -1
- package/build/video/edit.native.js +4 -3
- package/build/video/edit.native.js.map +1 -1
- package/build-module/cover/transforms.js +5 -1
- package/build-module/cover/transforms.js.map +1 -1
- package/build-module/group/edit.js +3 -1
- package/build-module/group/edit.js.map +1 -1
- package/build-module/group/index.js +3 -0
- package/build-module/group/index.js.map +1 -1
- package/build-module/image/edit.js +16 -13
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/index.js +1 -1
- package/build-module/index.native.js +9 -5
- package/build-module/index.native.js.map +1 -1
- package/build-module/media-text/edit.js +4 -2
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/media-text/index.js +3 -0
- package/build-module/media-text/index.js.map +1 -1
- package/build-module/navigation/edit/index.js +31 -63
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/post-date/edit.js +4 -2
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-excerpt/edit.js +2 -2
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +8 -5
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/query/deprecated.js +5 -2
- package/build-module/query/deprecated.js.map +1 -1
- package/build-module/query/edit/inspector-controls/create-new-post-link.js +33 -0
- package/build-module/query/edit/inspector-controls/create-new-post-link.js.map +1 -0
- package/build-module/query/edit/inspector-controls/index.js +12 -7
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/pattern-selection-modal.js +2 -1
- package/build-module/query/edit/pattern-selection-modal.js.map +1 -1
- package/build-module/query/index.js +5 -10
- package/build-module/query/index.js.map +1 -1
- package/build-module/site-logo/edit.js +115 -18
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/site-logo/index.js +1 -1
- package/build-module/social-link/icons/chain.js +1 -1
- package/build-module/social-link/icons/chain.js.map +1 -1
- package/build-module/social-link/icons/mail.js +1 -1
- package/build-module/social-link/icons/mail.js.map +1 -1
- package/build-module/spacer/edit.js +118 -12
- package/build-module/spacer/edit.js.map +1 -1
- package/build-module/template-part/edit/index.js +2 -1
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/edit/utils/hooks.js +2 -2
- package/build-module/template-part/edit/utils/hooks.js.map +1 -1
- package/build-module/utils/migrate-font-family.js +9 -1
- package/build-module/utils/migrate-font-family.js.map +1 -1
- package/build-module/video/edit.native.js +4 -3
- package/build-module/video/edit.native.js.map +1 -1
- package/build-style/cover/editor-rtl.css +3 -3
- package/build-style/cover/editor.css +3 -3
- package/build-style/cover/style-rtl.css +1 -2
- package/build-style/cover/style.css +1 -2
- package/build-style/editor-rtl.css +71 -34
- package/build-style/editor.css +71 -34
- package/build-style/html/editor-rtl.css +2 -2
- package/build-style/html/editor.css +2 -2
- package/build-style/image/editor-rtl.css +1 -1
- package/build-style/image/editor.css +1 -1
- package/build-style/query/editor-rtl.css +8 -12
- package/build-style/query/editor.css +8 -12
- package/build-style/search/style-rtl.css +2 -0
- package/build-style/search/style.css +2 -0
- package/build-style/shortcode/editor-rtl.css +3 -4
- package/build-style/shortcode/editor.css +3 -4
- package/build-style/site-logo/editor-rtl.css +46 -0
- package/build-style/site-logo/editor.css +46 -0
- package/build-style/style-rtl.css +3 -2
- package/build-style/style.css +3 -2
- package/build-style/template-part/editor-rtl.css +8 -12
- package/build-style/template-part/editor.css +8 -12
- package/package.json +31 -31
- package/src/buttons/test/__snapshots__/edit.native.js.snap +18 -0
- package/src/buttons/test/edit.native.js +123 -2
- package/src/cover/editor.scss +1 -1
- package/src/cover/style.scss +0 -1
- package/src/cover/transforms.js +4 -1
- package/src/gallery/test/index.native.js +4 -4
- package/src/group/block.json +3 -0
- package/src/group/edit.js +8 -2
- package/src/heading/test/__snapshots__/index.native.js.snap +12 -0
- package/src/heading/test/index.native.js +71 -0
- package/src/html/editor.scss +2 -21
- package/src/image/block.json +1 -1
- package/src/image/edit.js +21 -17
- package/src/image/editor.scss +1 -1
- package/src/index.native.js +9 -5
- package/src/list/test/edit.native.js +7 -7
- package/src/media-text/block.json +3 -0
- package/src/media-text/edit.js +2 -1
- package/src/navigation/edit/index.js +32 -106
- package/src/navigation/index.php +15 -8
- package/src/paragraph/test/edit.native.js +288 -28
- package/src/post-date/edit.js +4 -0
- package/src/post-date/index.php +17 -8
- package/src/post-excerpt/edit.js +1 -1
- package/src/post-featured-image/edit.js +6 -5
- package/src/post-featured-image/index.php +1 -1
- package/src/preformatted/test/edit.native.js +6 -9
- package/src/pullquote/test/edit.native.js +7 -12
- package/src/query/deprecated.js +4 -1
- package/src/query/edit/inspector-controls/create-new-post-link.js +26 -0
- package/src/query/edit/inspector-controls/index.js +13 -6
- package/src/query/edit/pattern-selection-modal.js +1 -0
- package/src/query/editor.scss +8 -11
- package/src/query/index.js +1 -7
- package/src/quote/test/edit.native.js +6 -10
- package/src/search/style.scss +3 -0
- package/src/shortcode/editor.scss +1 -21
- package/src/site-logo/block.json +1 -1
- package/src/site-logo/edit.js +123 -9
- package/src/site-logo/editor.scss +57 -0
- package/src/social-link/icons/chain.js +1 -1
- package/src/social-link/icons/mail.js +1 -1
- package/src/social-link/index.php +2 -2
- package/src/spacer/edit.js +157 -18
- package/src/template-part/edit/index.js +1 -0
- package/src/template-part/edit/utils/hooks.js +2 -2
- package/src/template-part/editor.scss +9 -11
- package/src/utils/migrate-font-family.js +8 -1
- package/src/verse/test/edit.native.js +4 -9
- package/src/video/edit.native.js +2 -2
- package/tsconfig.json +1 -0
- package/build/query/hooks.js +0 -72
- package/build/query/hooks.js.map +0 -1
- package/build/utils/clean-empty-object.js +0 -37
- package/build/utils/clean-empty-object.js.map +0 -1
- package/build-module/query/hooks.js +0 -59
- package/build-module/query/hooks.js.map +0 -1
- package/build-module/utils/clean-empty-object.js +0 -28
- package/build-module/utils/clean-empty-object.js.map +0 -1
- package/src/query/hooks.js +0 -53
- package/src/utils/clean-empty-object.js +0 -28
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
import { createElement, Fragment } from "@wordpress/element";
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -11,9 +12,9 @@ import classnames from 'classnames';
|
|
|
11
12
|
import { isBlobURL } from '@wordpress/blob';
|
|
12
13
|
import { createInterpolateElement, useEffect, useState, useRef } from '@wordpress/element';
|
|
13
14
|
import { __, isRTL } from '@wordpress/i18n';
|
|
14
|
-
import { MenuItem, PanelBody, RangeControl, ResizableBox, Spinner, ToggleControl, ToolbarButton, Placeholder, Button } from '@wordpress/components';
|
|
15
|
+
import { MenuItem, PanelBody, RangeControl, ResizableBox, Spinner, ToggleControl, ToolbarButton, Placeholder, Button, DropZone, FlexItem, __experimentalItemGroup as ItemGroup, __experimentalHStack as HStack, __experimentalTruncate as Truncate } from '@wordpress/components';
|
|
15
16
|
import { useViewportMatch } from '@wordpress/compose';
|
|
16
|
-
import { BlockControls, InspectorControls, MediaPlaceholder, MediaReplaceFlow, useBlockProps, store as blockEditorStore, __experimentalImageEditor as ImageEditor } from '@wordpress/block-editor';
|
|
17
|
+
import { BlockControls, InspectorControls, MediaPlaceholder, MediaUpload, MediaUploadCheck, MediaReplaceFlow, useBlockProps, store as blockEditorStore, __experimentalImageEditor as ImageEditor } from '@wordpress/block-editor';
|
|
17
18
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
18
19
|
import { store as coreStore } from '@wordpress/core-data';
|
|
19
20
|
import { crop, upload } from '@wordpress/icons';
|
|
@@ -291,15 +292,60 @@ const SiteLogo = _ref => {
|
|
|
291
292
|
icon: crop,
|
|
292
293
|
label: __('Crop')
|
|
293
294
|
})), imgEdit);
|
|
295
|
+
}; // This is a light wrapper around MediaReplaceFlow because the block has two
|
|
296
|
+
// different MediaReplaceFlows, one for the inspector and one for the toolbar.
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
function SiteLogoReplaceFlow(_ref2) {
|
|
300
|
+
let {
|
|
301
|
+
onRemoveLogo,
|
|
302
|
+
...mediaReplaceProps
|
|
303
|
+
} = _ref2;
|
|
304
|
+
return createElement(MediaReplaceFlow, _extends({}, mediaReplaceProps, {
|
|
305
|
+
allowedTypes: ALLOWED_MEDIA_TYPES,
|
|
306
|
+
accept: ACCEPT_MEDIA_STRING
|
|
307
|
+
}), createElement(MenuItem, {
|
|
308
|
+
onClick: onRemoveLogo
|
|
309
|
+
}, __('Reset')));
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
const InspectorLogoPreview = _ref3 => {
|
|
313
|
+
var _logoMediaDetails$siz, _logoMediaDetails$siz2;
|
|
314
|
+
|
|
315
|
+
let {
|
|
316
|
+
mediaItemData = {},
|
|
317
|
+
itemGroupProps
|
|
318
|
+
} = _ref3;
|
|
319
|
+
const {
|
|
320
|
+
alt_text: alt,
|
|
321
|
+
source_url: logoUrl,
|
|
322
|
+
slug: logoSlug,
|
|
323
|
+
media_details: logoMediaDetails
|
|
324
|
+
} = mediaItemData;
|
|
325
|
+
const logoLabel = (logoMediaDetails === null || logoMediaDetails === void 0 ? void 0 : (_logoMediaDetails$siz = logoMediaDetails.sizes) === null || _logoMediaDetails$siz === void 0 ? void 0 : (_logoMediaDetails$siz2 = _logoMediaDetails$siz.full) === null || _logoMediaDetails$siz2 === void 0 ? void 0 : _logoMediaDetails$siz2.file) || logoSlug;
|
|
326
|
+
return createElement(ItemGroup, _extends({}, itemGroupProps, {
|
|
327
|
+
as: "span"
|
|
328
|
+
}), createElement(HStack, {
|
|
329
|
+
justify: "flex-start",
|
|
330
|
+
as: "span"
|
|
331
|
+
}, createElement("img", {
|
|
332
|
+
src: logoUrl,
|
|
333
|
+
alt: alt
|
|
334
|
+
}), createElement(FlexItem, {
|
|
335
|
+
as: "span"
|
|
336
|
+
}, createElement(Truncate, {
|
|
337
|
+
numberOfLines: 1,
|
|
338
|
+
className: "block-library-site-logo__inspector-media-replace-title"
|
|
339
|
+
}, logoLabel))));
|
|
294
340
|
};
|
|
295
341
|
|
|
296
|
-
export default function LogoEdit(
|
|
342
|
+
export default function LogoEdit(_ref4) {
|
|
297
343
|
let {
|
|
298
344
|
attributes,
|
|
299
345
|
className,
|
|
300
346
|
setAttributes,
|
|
301
347
|
isSelected
|
|
302
|
-
} =
|
|
348
|
+
} = _ref4;
|
|
303
349
|
const {
|
|
304
350
|
width,
|
|
305
351
|
shouldSyncIcon
|
|
@@ -311,7 +357,8 @@ export default function LogoEdit(_ref2) {
|
|
|
311
357
|
url,
|
|
312
358
|
siteIconId,
|
|
313
359
|
mediaItemData,
|
|
314
|
-
isRequestingMediaItem
|
|
360
|
+
isRequestingMediaItem,
|
|
361
|
+
mediaUpload
|
|
315
362
|
} = useSelect(select => {
|
|
316
363
|
const {
|
|
317
364
|
canUser,
|
|
@@ -342,7 +389,8 @@ export default function LogoEdit(_ref2) {
|
|
|
342
389
|
url: siteData === null || siteData === void 0 ? void 0 : siteData.home,
|
|
343
390
|
mediaItemData: mediaItem,
|
|
344
391
|
isRequestingMediaItem: _isRequestingMediaItem,
|
|
345
|
-
siteIconId: _siteIconId
|
|
392
|
+
siteIconId: _siteIconId,
|
|
393
|
+
mediaUpload: select(blockEditorStore).getSettings().mediaUpload
|
|
346
394
|
};
|
|
347
395
|
}, []);
|
|
348
396
|
const {
|
|
@@ -423,17 +471,34 @@ export default function LogoEdit(_ref2) {
|
|
|
423
471
|
});
|
|
424
472
|
};
|
|
425
473
|
|
|
426
|
-
const
|
|
427
|
-
|
|
428
|
-
|
|
474
|
+
const onFilesDrop = filesList => {
|
|
475
|
+
mediaUpload({
|
|
476
|
+
allowedTypes: ['image'],
|
|
477
|
+
filesList,
|
|
478
|
+
|
|
479
|
+
onFileChange(_ref5) {
|
|
480
|
+
let [image] = _ref5;
|
|
481
|
+
|
|
482
|
+
if (isBlobURL(image === null || image === void 0 ? void 0 : image.url)) {
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
onInitialSelectLogo(image);
|
|
487
|
+
},
|
|
488
|
+
|
|
489
|
+
onError: onUploadError
|
|
490
|
+
});
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
const mediaReplaceFlowProps = {
|
|
429
494
|
mediaURL: logoUrl,
|
|
430
|
-
allowedTypes: ALLOWED_MEDIA_TYPES,
|
|
431
|
-
accept: ACCEPT_MEDIA_STRING,
|
|
432
495
|
onSelect: onSelectLogo,
|
|
433
|
-
onError: onUploadError
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
496
|
+
onError: onUploadError,
|
|
497
|
+
onRemoveLogo
|
|
498
|
+
};
|
|
499
|
+
const controls = canUserEdit && logoUrl && createElement(BlockControls, {
|
|
500
|
+
group: "other"
|
|
501
|
+
}, createElement(SiteLogoReplaceFlow, mediaReplaceFlowProps));
|
|
437
502
|
let logoImage;
|
|
438
503
|
const isLoading = siteLogoId === undefined || isRequestingMediaItem;
|
|
439
504
|
|
|
@@ -481,7 +546,39 @@ export default function LogoEdit(_ref2) {
|
|
|
481
546
|
|
|
482
547
|
const label = __('Add a site logo');
|
|
483
548
|
|
|
484
|
-
|
|
549
|
+
const mediaInspectorPanel = (canUserEdit || logoUrl) && createElement(InspectorControls, null, createElement(PanelBody, {
|
|
550
|
+
title: __('Media')
|
|
551
|
+
}, createElement("div", {
|
|
552
|
+
className: "block-library-site-logo__inspector-media-replace-container"
|
|
553
|
+
}, !canUserEdit && !!logoUrl && createElement(InspectorLogoPreview, {
|
|
554
|
+
mediaItemData: mediaItemData,
|
|
555
|
+
itemGroupProps: {
|
|
556
|
+
isBordered: true,
|
|
557
|
+
className: 'block-library-site-logo__inspector-readonly-logo-preview'
|
|
558
|
+
}
|
|
559
|
+
}), canUserEdit && !!logoUrl && createElement(SiteLogoReplaceFlow, _extends({}, mediaReplaceFlowProps, {
|
|
560
|
+
name: createElement(InspectorLogoPreview, {
|
|
561
|
+
mediaItemData: mediaItemData
|
|
562
|
+
}),
|
|
563
|
+
popoverProps: {}
|
|
564
|
+
})), canUserEdit && !logoUrl && createElement(MediaUploadCheck, null, createElement(MediaUpload, {
|
|
565
|
+
onSelect: onInitialSelectLogo,
|
|
566
|
+
allowedTypes: ALLOWED_MEDIA_TYPES,
|
|
567
|
+
render: _ref6 => {
|
|
568
|
+
let {
|
|
569
|
+
open
|
|
570
|
+
} = _ref6;
|
|
571
|
+
return createElement("div", {
|
|
572
|
+
className: "block-library-site-logo__inspector-upload-container"
|
|
573
|
+
}, createElement(Button, {
|
|
574
|
+
onClick: open,
|
|
575
|
+
variant: "secondary"
|
|
576
|
+
}, isLoading ? createElement(Spinner, null) : __('Add media')), createElement(DropZone, {
|
|
577
|
+
onFilesDrop: onFilesDrop
|
|
578
|
+
}));
|
|
579
|
+
}
|
|
580
|
+
})))));
|
|
581
|
+
return createElement("div", blockProps, controls, mediaInspectorPanel, !!logoUrl && logoImage, !logoUrl && !canUserEdit && createElement(Placeholder, {
|
|
485
582
|
className: "site-logo_placeholder"
|
|
486
583
|
}, !!isLoading && createElement("span", {
|
|
487
584
|
className: "components-placeholder__preview"
|
|
@@ -491,10 +588,10 @@ export default function LogoEdit(_ref2) {
|
|
|
491
588
|
allowedTypes: ALLOWED_MEDIA_TYPES,
|
|
492
589
|
onError: onUploadError,
|
|
493
590
|
placeholder: placeholder,
|
|
494
|
-
mediaLibraryButton:
|
|
591
|
+
mediaLibraryButton: _ref7 => {
|
|
495
592
|
let {
|
|
496
593
|
open
|
|
497
|
-
} =
|
|
594
|
+
} = _ref7;
|
|
498
595
|
return createElement(Button, {
|
|
499
596
|
icon: upload,
|
|
500
597
|
variant: "primary",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/site-logo/edit.js"],"names":["classnames","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","useSelect","useDispatch","coreStore","crop","upload","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","includes","isResizable","naturalWidth","naturalHeight","setNaturalSize","isEditingImage","setIsEditingImage","toggleSelection","classes","imageEditing","maxWidth","title","select","settings","getSettings","siteEntities","getEntityRecord","name","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","ref","siteLogoId","url","siteIconId","mediaItemData","isRequestingMediaItem","canUser","getEditedEntityRecord","_canUserEdit","siteSettings","siteData","_siteLogoId","site_logo","_siteIconId","site_icon","mediaItem","getMedia","context","_isRequestingMediaItem","hasFinishedResolution","home","editEntityRecord","newValue","shouldForceSync","alt_text","source_url","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;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,EA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WAAf,IACD,cAAC,WAAD;AAAa,IAAA,SAAS,EAAC;AAAvB,KACG,CAAC,CAAEkG,SAAH,IACD;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC,cAAC,OAAD,OADD,CAFF,CAJF,EAYG,CAAEvG,OAAF,IAAaK,WAAb,IACD,cAAC,gBAAD;AACC,IAAA,QAAQ,EAAGwF,mBADZ;AAEC,IAAA,MAAM,EAAG3G,mBAFV;AAGC,IAAA,YAAY,EAAGD,mBAHhB;AAIC,IAAA,OAAO,EAAGiH,aAJX;AAKC,IAAA,WAAW,EAAGM,WALf;AAMC,IAAA,kBAAkB,EAAG,SAAgB;AAAA,UAAd;AAAEK,QAAAA;AAAF,OAAc;AACpC,aACC,cAAC,MAAD;AACC,QAAA,IAAI,EAAGhI,MADR;AAEC,QAAA,OAAO,EAAC,SAFT;AAGC,QAAA,KAAK,EAAG+H,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';\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} 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 { 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 = [ 'wide', 'full' ].includes( 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 settings = select( blockEditorStore ).getSettings();\n\t\tconst siteEntities = select( coreStore ).getEntityRecord(\n\t\t\t'root',\n\t\t\t'__unstableBase'\n\t\t);\n\t\treturn {\n\t\t\ttitle: siteEntities?.name,\n\t\t\timageEditing: settings.imageEditing,\n\t\t\tmaxWidth: settings.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\tnaturalWidth: event.target.naturalWidth,\n\t\t\t\t\tnaturalHeight: event.target.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<ImageEditor\n\t\t\t\tid={ logoId }\n\t\t\t\turl={ logoUrl }\n\t\t\t\twidth={ currentWidth }\n\t\t\t\theight={ currentHeight }\n\t\t\t\tclientWidth={ clientWidth }\n\t\t\t\tnaturalHeight={ naturalHeight }\n\t\t\t\tnaturalWidth={ naturalWidth }\n\t\t\t\tonSaveImage={ ( imageAttributes ) => {\n\t\t\t\t\tsetLogo( imageAttributes.id );\n\t\t\t\t} }\n\t\t\t\tonFinishEditing={ () => {\n\t\t\t\t\tsetIsEditingImage( false );\n\t\t\t\t} }\n\t\t\t/>\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\t__nextHasNoMarginBottom\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\t__nextHasNoMarginBottom\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\t__nextHasNoMarginBottom\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\t__nextHasNoMarginBottom\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 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 } =\n\t\t\tselect( coreStore );\n\t\tconst _canUserEdit = canUser( 'update', 'settings' );\n\t\tconst siteSettings = _canUserEdit\n\t\t\t? getEditedEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\t\tconst siteData = getEntityRecord( 'root', '__unstableBase' );\n\t\tconst _siteLogoId = _canUserEdit\n\t\t\t? siteSettings?.site_logo\n\t\t\t: siteData?.site_logo;\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?.home,\n\t\t\tmediaItemData: mediaItem,\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\t// The new value needs to be `null` to reset the Site Icon.\n\t\teditEntityRecord( 'root', 'site', undefined, {\n\t\t\tsite_icon: newValue ?? null,\n\t\t} );\n\n\tconst { alt_text: alt, source_url: logoUrl } = mediaItemData ?? {};\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\treturn;\n\t\t}\n\n\t\tsetLogo( media.id, shouldForceSync );\n\t};\n\n\tconst onRemoveLogo = () => {\n\t\tsetLogo( null );\n\t\tsetAttributes( { width: undefined } );\n\t};\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message, { 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\twithIllustration={ true }\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth,\n\t\t\t\t} }\n\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","isBlobURL","createInterpolateElement","useEffect","useState","useRef","__","isRTL","MenuItem","PanelBody","RangeControl","ResizableBox","Spinner","ToggleControl","ToolbarButton","Placeholder","Button","DropZone","FlexItem","__experimentalItemGroup","ItemGroup","__experimentalHStack","HStack","__experimentalTruncate","Truncate","useViewportMatch","BlockControls","InspectorControls","MediaPlaceholder","MediaUpload","MediaUploadCheck","MediaReplaceFlow","useBlockProps","store","blockEditorStore","__experimentalImageEditor","ImageEditor","useSelect","useDispatch","coreStore","crop","upload","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","includes","isResizable","naturalWidth","naturalHeight","setNaturalSize","isEditingImage","setIsEditingImage","toggleSelection","classes","imageEditing","maxWidth","title","select","settings","getSettings","siteEntities","getEntityRecord","name","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","SiteLogoReplaceFlow","onRemoveLogo","mediaReplaceProps","InspectorLogoPreview","mediaItemData","itemGroupProps","alt_text","source_url","slug","logoSlug","media_details","logoMediaDetails","logoLabel","sizes","full","file","LogoEdit","className","ref","siteLogoId","url","siteIconId","isRequestingMediaItem","mediaUpload","canUser","getEditedEntityRecord","_canUserEdit","siteSettings","siteData","_siteLogoId","site_logo","_siteIconId","site_icon","mediaItem","getMedia","context","_isRequestingMediaItem","hasFinishedResolution","home","editEntityRecord","newValue","shouldForceSync","onInitialSelectLogo","media","onSelectLogo","createErrorNotice","onUploadError","message","type","onFilesDrop","filesList","allowedTypes","onFileChange","image","onError","mediaReplaceFlowProps","mediaURL","onSelect","controls","logoImage","isLoading","placeholder","content","placeholderClassName","blockProps","label","mediaInspectorPanel","isBordered","open"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;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,EAUCC,QAVD,EAWCC,QAXD,EAYCC,uBAAuB,IAAIC,SAZ5B,EAaCC,oBAAoB,IAAIC,MAbzB,EAcCC,sBAAsB,IAAIC,QAd3B,QAeO,uBAfP;AAgBA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SACCC,aADD,EAECC,iBAFD,EAGCC,gBAHD,EAICC,WAJD,EAKCC,gBALD,EAMCC,gBAND,EAOCC,aAPD,EAQCC,KAAK,IAAIC,gBARV,EASCC,yBAAyB,IAAIC,WAT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,SAAS,EAAC;AAAvB,KACG,CAAC,CAAEwH,SAAH,IACD;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC,cAAC,OAAD,OADD,CAFF,CALF,EAaG,CAAE7H,OAAF,IAAaK,WAAb,IACD,cAAC,gBAAD;AACC,IAAA,QAAQ,EAAGsG,mBADZ;AAEC,IAAA,MAAM,EAAGzH,mBAFV;AAGC,IAAA,YAAY,EAAGD,mBAHhB;AAIC,IAAA,OAAO,EAAG8H,aAJX;AAKC,IAAA,WAAW,EAAGe,WALf;AAMC,IAAA,kBAAkB,EAAG,SAAgB;AAAA,UAAd;AAAEO,QAAAA;AAAF,OAAc;AACpC,aACC,cAAC,MAAD;AACC,QAAA,IAAI,EAAGxJ,MADR;AAEC,QAAA,OAAO,EAAC,SAFT;AAGC,QAAA,KAAK,EAAGqJ,KAHT;AAIC,QAAA,WAAW,MAJZ;AAKC,QAAA,eAAe,EAAC,YALjB;AAMC,QAAA,OAAO,EAAG,MAAM;AACfG,UAAAA,IAAI;AACJ;AARF,QADD;AAYA;AAnBF,IAdF,CADD;AAuCA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\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\tDropZone,\n\tFlexItem,\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalHStack as HStack,\n\t__experimentalTruncate as Truncate,\n} from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tMediaPlaceholder,\n\tMediaUpload,\n\tMediaUploadCheck,\n\tMediaReplaceFlow,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\t__experimentalImageEditor as ImageEditor,\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 { 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 = [ 'wide', 'full' ].includes( 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 settings = select( blockEditorStore ).getSettings();\n\t\tconst siteEntities = select( coreStore ).getEntityRecord(\n\t\t\t'root',\n\t\t\t'__unstableBase'\n\t\t);\n\t\treturn {\n\t\t\ttitle: siteEntities?.name,\n\t\t\timageEditing: settings.imageEditing,\n\t\t\tmaxWidth: settings.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\tnaturalWidth: event.target.naturalWidth,\n\t\t\t\t\tnaturalHeight: event.target.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<ImageEditor\n\t\t\t\tid={ logoId }\n\t\t\t\turl={ logoUrl }\n\t\t\t\twidth={ currentWidth }\n\t\t\t\theight={ currentHeight }\n\t\t\t\tclientWidth={ clientWidth }\n\t\t\t\tnaturalHeight={ naturalHeight }\n\t\t\t\tnaturalWidth={ naturalWidth }\n\t\t\t\tonSaveImage={ ( imageAttributes ) => {\n\t\t\t\t\tsetLogo( imageAttributes.id );\n\t\t\t\t} }\n\t\t\t\tonFinishEditing={ () => {\n\t\t\t\t\tsetIsEditingImage( false );\n\t\t\t\t} }\n\t\t\t/>\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\t__nextHasNoMarginBottom\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\t__nextHasNoMarginBottom\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\t__nextHasNoMarginBottom\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\t__nextHasNoMarginBottom\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\n// This is a light wrapper around MediaReplaceFlow because the block has two\n// different MediaReplaceFlows, one for the inspector and one for the toolbar.\nfunction SiteLogoReplaceFlow( { onRemoveLogo, ...mediaReplaceProps } ) {\n\treturn (\n\t\t<MediaReplaceFlow\n\t\t\t{ ...mediaReplaceProps }\n\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\taccept={ ACCEPT_MEDIA_STRING }\n\t\t>\n\t\t\t<MenuItem onClick={ onRemoveLogo }>{ __( 'Reset' ) }</MenuItem>\n\t\t</MediaReplaceFlow>\n\t);\n}\n\nconst InspectorLogoPreview = ( { mediaItemData = {}, itemGroupProps } ) => {\n\tconst {\n\t\talt_text: alt,\n\t\tsource_url: logoUrl,\n\t\tslug: logoSlug,\n\t\tmedia_details: logoMediaDetails,\n\t} = mediaItemData;\n\tconst logoLabel = logoMediaDetails?.sizes?.full?.file || logoSlug;\n\treturn (\n\t\t<ItemGroup { ...itemGroupProps } as=\"span\">\n\t\t\t<HStack justify=\"flex-start\" as=\"span\">\n\t\t\t\t<img src={ logoUrl } alt={ alt } />\n\t\t\t\t<FlexItem as=\"span\">\n\t\t\t\t\t<Truncate\n\t\t\t\t\t\tnumberOfLines={ 1 }\n\t\t\t\t\t\tclassName=\"block-library-site-logo__inspector-media-replace-title\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ logoLabel }\n\t\t\t\t\t</Truncate>\n\t\t\t\t</FlexItem>\n\t\t\t</HStack>\n\t\t</ItemGroup>\n\t);\n};\n\nexport default function LogoEdit( {\n\tattributes,\n\tclassName,\n\tsetAttributes,\n\tisSelected,\n} ) {\n\tconst { width, shouldSyncIcon } = attributes;\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\tmediaUpload,\n\t} = useSelect( ( select ) => {\n\t\tconst { canUser, getEntityRecord, getEditedEntityRecord } =\n\t\t\tselect( coreStore );\n\t\tconst _canUserEdit = canUser( 'update', 'settings' );\n\t\tconst siteSettings = _canUserEdit\n\t\t\t? getEditedEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\t\tconst siteData = getEntityRecord( 'root', '__unstableBase' );\n\t\tconst _siteLogoId = _canUserEdit\n\t\t\t? siteSettings?.site_logo\n\t\t\t: siteData?.site_logo;\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?.home,\n\t\t\tmediaItemData: mediaItem,\n\t\t\tisRequestingMediaItem: _isRequestingMediaItem,\n\t\t\tsiteIconId: _siteIconId,\n\t\t\tmediaUpload: select( blockEditorStore ).getSettings().mediaUpload,\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\t// The new value needs to be `null` to reset the Site Icon.\n\t\teditEntityRecord( 'root', 'site', undefined, {\n\t\t\tsite_icon: newValue ?? null,\n\t\t} );\n\n\tconst { alt_text: alt, source_url: logoUrl } = mediaItemData ?? {};\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\treturn;\n\t\t}\n\n\t\tsetLogo( media.id, shouldForceSync );\n\t};\n\n\tconst onRemoveLogo = () => {\n\t\tsetLogo( null );\n\t\tsetAttributes( { width: undefined } );\n\t};\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t};\n\n\tconst onFilesDrop = ( filesList ) => {\n\t\tmediaUpload( {\n\t\t\tallowedTypes: [ 'image' ],\n\t\t\tfilesList,\n\t\t\tonFileChange( [ image ] ) {\n\t\t\t\tif ( isBlobURL( image?.url ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tonInitialSelectLogo( image );\n\t\t\t},\n\t\t\tonError: onUploadError,\n\t\t} );\n\t};\n\n\tconst mediaReplaceFlowProps = {\n\t\tmediaURL: logoUrl,\n\t\tonSelect: onSelectLogo,\n\t\tonError: onUploadError,\n\t\tonRemoveLogo,\n\t};\n\tconst controls = canUserEdit && logoUrl && (\n\t\t<BlockControls group=\"other\">\n\t\t\t<SiteLogoReplaceFlow { ...mediaReplaceFlowProps } />\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\twithIllustration={ true }\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth,\n\t\t\t\t} }\n\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\tconst mediaInspectorPanel = ( canUserEdit || logoUrl ) && (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Media' ) }>\n\t\t\t\t<div className=\"block-library-site-logo__inspector-media-replace-container\">\n\t\t\t\t\t{ ! canUserEdit && !! logoUrl && (\n\t\t\t\t\t\t<InspectorLogoPreview\n\t\t\t\t\t\t\tmediaItemData={ mediaItemData }\n\t\t\t\t\t\t\titemGroupProps={ {\n\t\t\t\t\t\t\t\tisBordered: true,\n\t\t\t\t\t\t\t\tclassName:\n\t\t\t\t\t\t\t\t\t'block-library-site-logo__inspector-readonly-logo-preview',\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 && !! logoUrl && (\n\t\t\t\t\t\t<SiteLogoReplaceFlow\n\t\t\t\t\t\t\t{ ...mediaReplaceFlowProps }\n\t\t\t\t\t\t\tname={\n\t\t\t\t\t\t\t\t<InspectorLogoPreview\n\t\t\t\t\t\t\t\t\tmediaItemData={ mediaItemData }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tpopoverProps={ {} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ canUserEdit && ! logoUrl && (\n\t\t\t\t\t\t<MediaUploadCheck>\n\t\t\t\t\t\t\t<MediaUpload\n\t\t\t\t\t\t\t\tonSelect={ onInitialSelectLogo }\n\t\t\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\t\t\trender={ ( { open } ) => (\n\t\t\t\t\t\t\t\t\t<div className=\"block-library-site-logo__inspector-upload-container\">\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ isLoading ? (\n\t\t\t\t\t\t\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t\t\t__( 'Add media' )\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t<DropZone onFilesDrop={ onFilesDrop } />\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MediaUploadCheck>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t{ controls }\n\t\t\t{ mediaInspectorPanel }\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"]}
|
|
@@ -13,7 +13,7 @@ const metadata = {
|
|
|
13
13
|
name: "core/site-logo",
|
|
14
14
|
title: "Site Logo",
|
|
15
15
|
category: "theme",
|
|
16
|
-
description: "Display
|
|
16
|
+
description: "Display an image to represent this site. Update this block and the changes apply everywhere.",
|
|
17
17
|
textdomain: "default",
|
|
18
18
|
attributes: {
|
|
19
19
|
width: {
|
|
@@ -10,6 +10,6 @@ export const ChainIcon = () => createElement(SVG, {
|
|
|
10
10
|
viewBox: "0 0 24 24",
|
|
11
11
|
version: "1.1"
|
|
12
12
|
}, createElement(Path, {
|
|
13
|
-
d: "
|
|
13
|
+
d: "M15.6 7.2H14v1.5h1.6c2 0 3.7 1.7 3.7 3.7s-1.7 3.7-3.7 3.7H14v1.5h1.6c2.8 0 5.2-2.3 5.2-5.2 0-2.9-2.3-5.2-5.2-5.2zM4.7 12.4c0-2 1.7-3.7 3.7-3.7H10V7.2H8.4c-2.9 0-5.2 2.3-5.2 5.2 0 2.9 2.3 5.2 5.2 5.2H10v-1.5H8.4c-2 0-3.7-1.7-3.7-3.7zm4.6.9h5.3v-1.5H9.3v1.5z"
|
|
14
14
|
}));
|
|
15
15
|
//# sourceMappingURL=chain.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/social-link/icons/chain.js"],"names":["Path","SVG","ChainIcon"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,GAAf,QAA0B,uBAA1B;AAEA,OAAO,MAAMC,SAAS,GAAG,MACxB,cAAC,GAAD;AAAK,EAAA,KAAK,EAAC,IAAX;AAAgB,EAAA,MAAM,EAAC,IAAvB;AAA4B,EAAA,OAAO,EAAC,WAApC;AAAgD,EAAA,OAAO,EAAC;AAAxD,GACC,cAAC,IAAD;AAAM,EAAA,CAAC,EAAC;AAAR,EADD,CADM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Path, SVG } from '@wordpress/primitives';\n\nexport const ChainIcon = () => (\n\t<SVG width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" version=\"1.1\">\n\t\t<Path d=\"
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/social-link/icons/chain.js"],"names":["Path","SVG","ChainIcon"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,GAAf,QAA0B,uBAA1B;AAEA,OAAO,MAAMC,SAAS,GAAG,MACxB,cAAC,GAAD;AAAK,EAAA,KAAK,EAAC,IAAX;AAAgB,EAAA,MAAM,EAAC,IAAvB;AAA4B,EAAA,OAAO,EAAC,WAApC;AAAgD,EAAA,OAAO,EAAC;AAAxD,GACC,cAAC,IAAD;AAAM,EAAA,CAAC,EAAC;AAAR,EADD,CADM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Path, SVG } from '@wordpress/primitives';\n\nexport const ChainIcon = () => (\n\t<SVG width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" version=\"1.1\">\n\t\t<Path d=\"M15.6 7.2H14v1.5h1.6c2 0 3.7 1.7 3.7 3.7s-1.7 3.7-3.7 3.7H14v1.5h1.6c2.8 0 5.2-2.3 5.2-5.2 0-2.9-2.3-5.2-5.2-5.2zM4.7 12.4c0-2 1.7-3.7 3.7-3.7H10V7.2H8.4c-2.9 0-5.2 2.3-5.2 5.2 0 2.9 2.3 5.2 5.2 5.2H10v-1.5H8.4c-2 0-3.7-1.7-3.7-3.7zm4.6.9h5.3v-1.5H9.3v1.5z\" />\n\t</SVG>\n);\n"]}
|
|
@@ -10,6 +10,6 @@ export const MailIcon = () => createElement(SVG, {
|
|
|
10
10
|
viewBox: "0 0 24 24",
|
|
11
11
|
version: "1.1"
|
|
12
12
|
}, createElement(Path, {
|
|
13
|
-
d: "
|
|
13
|
+
d: "M19 5H5c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm.5 12c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V9.8l7.5 5.6 7.5-5.6V17zm0-9.1L12 13.6 4.5 7.9V7c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v.9z"
|
|
14
14
|
}));
|
|
15
15
|
//# sourceMappingURL=mail.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/social-link/icons/mail.js"],"names":["Path","SVG","MailIcon"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,GAAf,QAA0B,uBAA1B;AAEA,OAAO,MAAMC,QAAQ,GAAG,MACvB,cAAC,GAAD;AAAK,EAAA,KAAK,EAAC,IAAX;AAAgB,EAAA,MAAM,EAAC,IAAvB;AAA4B,EAAA,OAAO,EAAC,WAApC;AAAgD,EAAA,OAAO,EAAC;AAAxD,GACC,cAAC,IAAD;AAAM,EAAA,CAAC,EAAC;AAAR,EADD,CADM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Path, SVG } from '@wordpress/primitives';\n\nexport const MailIcon = () => (\n\t<SVG width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" version=\"1.1\">\n\t\t<Path d=\"
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/social-link/icons/mail.js"],"names":["Path","SVG","MailIcon"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,GAAf,QAA0B,uBAA1B;AAEA,OAAO,MAAMC,QAAQ,GAAG,MACvB,cAAC,GAAD;AAAK,EAAA,KAAK,EAAC,IAAX;AAAgB,EAAA,MAAM,EAAC,IAAvB;AAA4B,EAAA,OAAO,EAAC,WAApC;AAAgD,EAAA,OAAO,EAAC;AAAxD,GACC,cAAC,IAAD;AAAM,EAAA,CAAC,EAAC;AAAR,EADD,CADM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Path, SVG } from '@wordpress/primitives';\n\nexport const MailIcon = () => (\n\t<SVG width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" version=\"1.1\">\n\t\t<Path d=\"M19 5H5c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm.5 12c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V9.8l7.5 5.6 7.5-5.6V17zm0-9.1L12 13.6 4.5 7.9V7c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v.9z\" />\n\t</SVG>\n);\n"]}
|
|
@@ -9,7 +9,7 @@ import classnames from 'classnames';
|
|
|
9
9
|
* WordPress dependencies
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import { useBlockProps, getSpacingPresetCssVar, store as blockEditorStore } from '@wordpress/block-editor';
|
|
12
|
+
import { useBlockProps, useSetting, getCustomValueFromPreset, getSpacingPresetCssVar, store as blockEditorStore } from '@wordpress/block-editor';
|
|
13
13
|
import { ResizableBox } from '@wordpress/components';
|
|
14
14
|
import { useState, useEffect } from '@wordpress/element';
|
|
15
15
|
import { View } from '@wordpress/primitives';
|
|
@@ -94,14 +94,25 @@ const SpacerEdit = _ref2 => {
|
|
|
94
94
|
const {
|
|
95
95
|
orientation: parentOrientation,
|
|
96
96
|
type
|
|
97
|
-
} = parentLayout || {}; //
|
|
97
|
+
} = parentLayout || {}; // Check if the spacer is inside a flex container.
|
|
98
|
+
|
|
99
|
+
const isFlexLayout = type === 'flex'; // If the spacer is inside a flex container, it should either inherit the orientation
|
|
98
100
|
// of the parent or use the flex default orientation.
|
|
99
101
|
|
|
100
|
-
const inheritedOrientation = !parentOrientation &&
|
|
102
|
+
const inheritedOrientation = !parentOrientation && isFlexLayout ? 'horizontal' : parentOrientation || orientation;
|
|
101
103
|
const {
|
|
102
104
|
height,
|
|
103
|
-
width
|
|
105
|
+
width,
|
|
106
|
+
style: blockStyle = {}
|
|
104
107
|
} = attributes;
|
|
108
|
+
const {
|
|
109
|
+
layout = {}
|
|
110
|
+
} = blockStyle;
|
|
111
|
+
const {
|
|
112
|
+
selfStretch,
|
|
113
|
+
flexSize
|
|
114
|
+
} = layout;
|
|
115
|
+
const spacingSizes = useSetting('spacing.spacingSizes');
|
|
105
116
|
const [isResizing, setIsResizing] = useState(false);
|
|
106
117
|
const [temporaryHeight, setTemporaryHeight] = useState(null);
|
|
107
118
|
const [temporaryWidth, setTemporaryWidth] = useState(null);
|
|
@@ -112,6 +123,18 @@ const SpacerEdit = _ref2 => {
|
|
|
112
123
|
|
|
113
124
|
const handleOnVerticalResizeStop = newHeight => {
|
|
114
125
|
onResizeStop();
|
|
126
|
+
|
|
127
|
+
if (isFlexLayout) {
|
|
128
|
+
setAttributes({
|
|
129
|
+
style: { ...blockStyle,
|
|
130
|
+
layout: { ...layout,
|
|
131
|
+
flexSize: newHeight,
|
|
132
|
+
selfStretch: 'fixed'
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
115
138
|
setAttributes({
|
|
116
139
|
height: newHeight
|
|
117
140
|
});
|
|
@@ -120,17 +143,50 @@ const SpacerEdit = _ref2 => {
|
|
|
120
143
|
|
|
121
144
|
const handleOnHorizontalResizeStop = newWidth => {
|
|
122
145
|
onResizeStop();
|
|
146
|
+
|
|
147
|
+
if (isFlexLayout) {
|
|
148
|
+
setAttributes({
|
|
149
|
+
style: { ...blockStyle,
|
|
150
|
+
layout: { ...layout,
|
|
151
|
+
flexSize: newWidth,
|
|
152
|
+
selfStretch: 'fixed'
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
123
158
|
setAttributes({
|
|
124
159
|
width: newWidth
|
|
125
160
|
});
|
|
126
161
|
setTemporaryWidth(null);
|
|
127
162
|
};
|
|
128
163
|
|
|
164
|
+
const getHeightForVerticalBlocks = () => {
|
|
165
|
+
if (isFlexLayout) {
|
|
166
|
+
return undefined;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return temporaryHeight || getSpacingPresetCssVar(height) || undefined;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const getWidthForHorizontalBlocks = () => {
|
|
173
|
+
if (isFlexLayout) {
|
|
174
|
+
return undefined;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return temporaryWidth || getSpacingPresetCssVar(width) || undefined;
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
const sizeConditionalOnOrientation = inheritedOrientation === 'horizontal' ? temporaryWidth || flexSize : temporaryHeight || flexSize;
|
|
129
181
|
const style = {
|
|
130
|
-
height: inheritedOrientation === 'horizontal' ? 24 :
|
|
131
|
-
width: inheritedOrientation === 'horizontal' ?
|
|
182
|
+
height: inheritedOrientation === 'horizontal' ? 24 : getHeightForVerticalBlocks(),
|
|
183
|
+
width: inheritedOrientation === 'horizontal' ? getWidthForHorizontalBlocks() : undefined,
|
|
132
184
|
// In vertical flex containers, the spacer shrinks to nothing without a minimum width.
|
|
133
|
-
minWidth: inheritedOrientation === 'vertical' &&
|
|
185
|
+
minWidth: inheritedOrientation === 'vertical' && isFlexLayout ? 48 : undefined,
|
|
186
|
+
// Add flex-basis so temporary sizes are respected.
|
|
187
|
+
flexBasis: isFlexLayout ? sizeConditionalOnOrientation : undefined,
|
|
188
|
+
// Remove flex-grow when resizing.
|
|
189
|
+
flexGrow: isFlexLayout && isResizing ? 0 : undefined
|
|
134
190
|
};
|
|
135
191
|
|
|
136
192
|
const resizableBoxWithOrientation = blockOrientation => {
|
|
@@ -180,19 +236,69 @@ const SpacerEdit = _ref2 => {
|
|
|
180
236
|
};
|
|
181
237
|
|
|
182
238
|
useEffect(() => {
|
|
183
|
-
if (
|
|
239
|
+
if (isFlexLayout && selfStretch !== 'fill' && selfStretch !== 'fit' && !flexSize) {
|
|
240
|
+
if (inheritedOrientation === 'horizontal') {
|
|
241
|
+
// If spacer is moving from a vertical container to a horizontal container,
|
|
242
|
+
// it might not have width but have height instead.
|
|
243
|
+
const newSize = getCustomValueFromPreset(width, spacingSizes) || getCustomValueFromPreset(height, spacingSizes) || '100px';
|
|
244
|
+
setAttributes({
|
|
245
|
+
width: '0px',
|
|
246
|
+
style: { ...blockStyle,
|
|
247
|
+
layout: { ...layout,
|
|
248
|
+
flexSize: newSize,
|
|
249
|
+
selfStretch: 'fixed'
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
} else {
|
|
254
|
+
const newSize = getCustomValueFromPreset(height, spacingSizes) || getCustomValueFromPreset(width, spacingSizes) || '100px';
|
|
255
|
+
setAttributes({
|
|
256
|
+
height: '0px',
|
|
257
|
+
style: { ...blockStyle,
|
|
258
|
+
layout: { ...layout,
|
|
259
|
+
flexSize: newSize,
|
|
260
|
+
selfStretch: 'fixed'
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
} else if (isFlexLayout && (selfStretch === 'fill' || selfStretch === 'fit')) {
|
|
266
|
+
if (inheritedOrientation === 'horizontal') {
|
|
267
|
+
setAttributes({
|
|
268
|
+
width: undefined
|
|
269
|
+
});
|
|
270
|
+
} else {
|
|
271
|
+
setAttributes({
|
|
272
|
+
height: undefined
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
} else if (!isFlexLayout && (selfStretch || flexSize)) {
|
|
276
|
+
if (inheritedOrientation === 'horizontal') {
|
|
277
|
+
setAttributes({
|
|
278
|
+
width: flexSize
|
|
279
|
+
});
|
|
280
|
+
} else {
|
|
281
|
+
setAttributes({
|
|
282
|
+
height: flexSize
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
|
|
184
286
|
setAttributes({
|
|
185
|
-
|
|
186
|
-
|
|
287
|
+
style: { ...blockStyle,
|
|
288
|
+
layout: { ...layout,
|
|
289
|
+
flexSize: undefined,
|
|
290
|
+
selfStretch: undefined
|
|
291
|
+
}
|
|
292
|
+
}
|
|
187
293
|
});
|
|
188
294
|
}
|
|
189
|
-
}, []);
|
|
295
|
+
}, [blockStyle, flexSize, height, inheritedOrientation, isFlexLayout, layout, selfStretch, setAttributes, spacingSizes, width]);
|
|
190
296
|
return createElement(Fragment, null, createElement(View, useBlockProps({
|
|
191
297
|
style,
|
|
192
298
|
className: classnames(className, {
|
|
193
299
|
'custom-sizes-disabled': disableCustomSpacingSizes
|
|
194
300
|
})
|
|
195
|
-
}), resizableBoxWithOrientation(inheritedOrientation)), createElement(SpacerControls, {
|
|
301
|
+
}), resizableBoxWithOrientation(inheritedOrientation)), !isFlexLayout && createElement(SpacerControls, {
|
|
196
302
|
setAttributes: setAttributes,
|
|
197
303
|
height: temporaryHeight || height,
|
|
198
304
|
width: temporaryWidth || width,
|