@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.
Files changed (185) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/cover/transforms.js +10 -7
  3. package/build/cover/transforms.js.map +1 -1
  4. package/build/group/edit.js +3 -1
  5. package/build/group/edit.js.map +1 -1
  6. package/build/group/index.js +3 -0
  7. package/build/group/index.js.map +1 -1
  8. package/build/image/edit.js +16 -13
  9. package/build/image/edit.js.map +1 -1
  10. package/build/image/index.js +1 -1
  11. package/build/index.native.js +9 -5
  12. package/build/index.native.js.map +1 -1
  13. package/build/media-text/edit.js +4 -2
  14. package/build/media-text/edit.js.map +1 -1
  15. package/build/media-text/index.js +3 -0
  16. package/build/media-text/index.js.map +1 -1
  17. package/build/navigation/edit/index.js +32 -64
  18. package/build/navigation/edit/index.js.map +1 -1
  19. package/build/post-date/edit.js +4 -2
  20. package/build/post-date/edit.js.map +1 -1
  21. package/build/post-excerpt/edit.js +2 -2
  22. package/build/post-excerpt/edit.js.map +1 -1
  23. package/build/post-featured-image/edit.js +8 -5
  24. package/build/post-featured-image/edit.js.map +1 -1
  25. package/build/query/deprecated.js +8 -6
  26. package/build/query/deprecated.js.map +1 -1
  27. package/build/query/edit/inspector-controls/create-new-post-link.js +41 -0
  28. package/build/query/edit/inspector-controls/create-new-post-link.js.map +1 -0
  29. package/build/query/edit/inspector-controls/index.js +14 -6
  30. package/build/query/edit/inspector-controls/index.js.map +1 -1
  31. package/build/query/edit/pattern-selection-modal.js +2 -1
  32. package/build/query/edit/pattern-selection-modal.js.map +1 -1
  33. package/build/query/index.js +5 -12
  34. package/build/query/index.js.map +1 -1
  35. package/build/site-logo/edit.js +114 -16
  36. package/build/site-logo/edit.js.map +1 -1
  37. package/build/site-logo/index.js +1 -1
  38. package/build/social-link/icons/chain.js +1 -1
  39. package/build/social-link/icons/chain.js.map +1 -1
  40. package/build/social-link/icons/mail.js +1 -1
  41. package/build/social-link/icons/mail.js.map +1 -1
  42. package/build/spacer/edit.js +117 -11
  43. package/build/spacer/edit.js.map +1 -1
  44. package/build/template-part/edit/index.js +2 -1
  45. package/build/template-part/edit/index.js.map +1 -1
  46. package/build/template-part/edit/utils/hooks.js +2 -2
  47. package/build/template-part/edit/utils/hooks.js.map +1 -1
  48. package/build/utils/migrate-font-family.js +12 -5
  49. package/build/utils/migrate-font-family.js.map +1 -1
  50. package/build/video/edit.native.js +4 -3
  51. package/build/video/edit.native.js.map +1 -1
  52. package/build-module/cover/transforms.js +5 -1
  53. package/build-module/cover/transforms.js.map +1 -1
  54. package/build-module/group/edit.js +3 -1
  55. package/build-module/group/edit.js.map +1 -1
  56. package/build-module/group/index.js +3 -0
  57. package/build-module/group/index.js.map +1 -1
  58. package/build-module/image/edit.js +16 -13
  59. package/build-module/image/edit.js.map +1 -1
  60. package/build-module/image/index.js +1 -1
  61. package/build-module/index.native.js +9 -5
  62. package/build-module/index.native.js.map +1 -1
  63. package/build-module/media-text/edit.js +4 -2
  64. package/build-module/media-text/edit.js.map +1 -1
  65. package/build-module/media-text/index.js +3 -0
  66. package/build-module/media-text/index.js.map +1 -1
  67. package/build-module/navigation/edit/index.js +31 -63
  68. package/build-module/navigation/edit/index.js.map +1 -1
  69. package/build-module/post-date/edit.js +4 -2
  70. package/build-module/post-date/edit.js.map +1 -1
  71. package/build-module/post-excerpt/edit.js +2 -2
  72. package/build-module/post-excerpt/edit.js.map +1 -1
  73. package/build-module/post-featured-image/edit.js +8 -5
  74. package/build-module/post-featured-image/edit.js.map +1 -1
  75. package/build-module/query/deprecated.js +5 -2
  76. package/build-module/query/deprecated.js.map +1 -1
  77. package/build-module/query/edit/inspector-controls/create-new-post-link.js +33 -0
  78. package/build-module/query/edit/inspector-controls/create-new-post-link.js.map +1 -0
  79. package/build-module/query/edit/inspector-controls/index.js +12 -7
  80. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  81. package/build-module/query/edit/pattern-selection-modal.js +2 -1
  82. package/build-module/query/edit/pattern-selection-modal.js.map +1 -1
  83. package/build-module/query/index.js +5 -10
  84. package/build-module/query/index.js.map +1 -1
  85. package/build-module/site-logo/edit.js +115 -18
  86. package/build-module/site-logo/edit.js.map +1 -1
  87. package/build-module/site-logo/index.js +1 -1
  88. package/build-module/social-link/icons/chain.js +1 -1
  89. package/build-module/social-link/icons/chain.js.map +1 -1
  90. package/build-module/social-link/icons/mail.js +1 -1
  91. package/build-module/social-link/icons/mail.js.map +1 -1
  92. package/build-module/spacer/edit.js +118 -12
  93. package/build-module/spacer/edit.js.map +1 -1
  94. package/build-module/template-part/edit/index.js +2 -1
  95. package/build-module/template-part/edit/index.js.map +1 -1
  96. package/build-module/template-part/edit/utils/hooks.js +2 -2
  97. package/build-module/template-part/edit/utils/hooks.js.map +1 -1
  98. package/build-module/utils/migrate-font-family.js +9 -1
  99. package/build-module/utils/migrate-font-family.js.map +1 -1
  100. package/build-module/video/edit.native.js +4 -3
  101. package/build-module/video/edit.native.js.map +1 -1
  102. package/build-style/cover/editor-rtl.css +3 -3
  103. package/build-style/cover/editor.css +3 -3
  104. package/build-style/cover/style-rtl.css +1 -2
  105. package/build-style/cover/style.css +1 -2
  106. package/build-style/editor-rtl.css +71 -34
  107. package/build-style/editor.css +71 -34
  108. package/build-style/html/editor-rtl.css +2 -2
  109. package/build-style/html/editor.css +2 -2
  110. package/build-style/image/editor-rtl.css +1 -1
  111. package/build-style/image/editor.css +1 -1
  112. package/build-style/query/editor-rtl.css +8 -12
  113. package/build-style/query/editor.css +8 -12
  114. package/build-style/search/style-rtl.css +2 -0
  115. package/build-style/search/style.css +2 -0
  116. package/build-style/shortcode/editor-rtl.css +3 -4
  117. package/build-style/shortcode/editor.css +3 -4
  118. package/build-style/site-logo/editor-rtl.css +46 -0
  119. package/build-style/site-logo/editor.css +46 -0
  120. package/build-style/style-rtl.css +3 -2
  121. package/build-style/style.css +3 -2
  122. package/build-style/template-part/editor-rtl.css +8 -12
  123. package/build-style/template-part/editor.css +8 -12
  124. package/package.json +31 -31
  125. package/src/buttons/test/__snapshots__/edit.native.js.snap +18 -0
  126. package/src/buttons/test/edit.native.js +123 -2
  127. package/src/cover/editor.scss +1 -1
  128. package/src/cover/style.scss +0 -1
  129. package/src/cover/transforms.js +4 -1
  130. package/src/gallery/test/index.native.js +4 -4
  131. package/src/group/block.json +3 -0
  132. package/src/group/edit.js +8 -2
  133. package/src/heading/test/__snapshots__/index.native.js.snap +12 -0
  134. package/src/heading/test/index.native.js +71 -0
  135. package/src/html/editor.scss +2 -21
  136. package/src/image/block.json +1 -1
  137. package/src/image/edit.js +21 -17
  138. package/src/image/editor.scss +1 -1
  139. package/src/index.native.js +9 -5
  140. package/src/list/test/edit.native.js +7 -7
  141. package/src/media-text/block.json +3 -0
  142. package/src/media-text/edit.js +2 -1
  143. package/src/navigation/edit/index.js +32 -106
  144. package/src/navigation/index.php +15 -8
  145. package/src/paragraph/test/edit.native.js +288 -28
  146. package/src/post-date/edit.js +4 -0
  147. package/src/post-date/index.php +17 -8
  148. package/src/post-excerpt/edit.js +1 -1
  149. package/src/post-featured-image/edit.js +6 -5
  150. package/src/post-featured-image/index.php +1 -1
  151. package/src/preformatted/test/edit.native.js +6 -9
  152. package/src/pullquote/test/edit.native.js +7 -12
  153. package/src/query/deprecated.js +4 -1
  154. package/src/query/edit/inspector-controls/create-new-post-link.js +26 -0
  155. package/src/query/edit/inspector-controls/index.js +13 -6
  156. package/src/query/edit/pattern-selection-modal.js +1 -0
  157. package/src/query/editor.scss +8 -11
  158. package/src/query/index.js +1 -7
  159. package/src/quote/test/edit.native.js +6 -10
  160. package/src/search/style.scss +3 -0
  161. package/src/shortcode/editor.scss +1 -21
  162. package/src/site-logo/block.json +1 -1
  163. package/src/site-logo/edit.js +123 -9
  164. package/src/site-logo/editor.scss +57 -0
  165. package/src/social-link/icons/chain.js +1 -1
  166. package/src/social-link/icons/mail.js +1 -1
  167. package/src/social-link/index.php +2 -2
  168. package/src/spacer/edit.js +157 -18
  169. package/src/template-part/edit/index.js +1 -0
  170. package/src/template-part/edit/utils/hooks.js +2 -2
  171. package/src/template-part/editor.scss +9 -11
  172. package/src/utils/migrate-font-family.js +8 -1
  173. package/src/verse/test/edit.native.js +4 -9
  174. package/src/video/edit.native.js +2 -2
  175. package/tsconfig.json +1 -0
  176. package/build/query/hooks.js +0 -72
  177. package/build/query/hooks.js.map +0 -1
  178. package/build/utils/clean-empty-object.js +0 -37
  179. package/build/utils/clean-empty-object.js.map +0 -1
  180. package/build-module/query/hooks.js +0 -59
  181. package/build-module/query/hooks.js.map +0 -1
  182. package/build-module/utils/clean-empty-object.js +0 -28
  183. package/build-module/utils/clean-empty-object.js.map +0 -1
  184. package/src/query/hooks.js +0 -53
  185. package/src/utils/clean-empty-object.js +0 -28
@@ -12,7 +12,10 @@ import {
12
12
  __experimentalToolsPanelItem as ToolsPanelItem,
13
13
  } from '@wordpress/components';
14
14
  import { __ } from '@wordpress/i18n';
15
- import { InspectorControls } from '@wordpress/block-editor';
15
+ import {
16
+ InspectorControls,
17
+ privateApis as blockEditorPrivateApis,
18
+ } from '@wordpress/block-editor';
16
19
  import { debounce } from '@wordpress/compose';
17
20
  import { useEffect, useState, useCallback } from '@wordpress/element';
18
21
 
@@ -24,6 +27,8 @@ import AuthorControl from './author-control';
24
27
  import ParentControl from './parent-control';
25
28
  import { TaxonomyControls } from './taxonomy-controls';
26
29
  import StickyControl from './sticky-control';
30
+ import CreateNewPostLink from './create-new-post-link';
31
+ import { unlock } from '../../../private-apis';
27
32
  import {
28
33
  usePostTypes,
29
34
  useIsPostTypeHierarchical,
@@ -32,11 +37,10 @@ import {
32
37
  useTaxonomies,
33
38
  } from '../../utils';
34
39
 
35
- export default function QueryInspectorControls( {
36
- attributes,
37
- setQuery,
38
- setDisplayLayout,
39
- } ) {
40
+ const { BlockInfo } = unlock( blockEditorPrivateApis );
41
+
42
+ export default function QueryInspectorControls( props ) {
43
+ const { attributes, setQuery, setDisplayLayout } = props;
40
44
  const { query, displayLayout } = attributes;
41
45
  const {
42
46
  order,
@@ -127,6 +131,9 @@ export default function QueryInspectorControls( {
127
131
 
128
132
  return (
129
133
  <>
134
+ <BlockInfo>
135
+ <CreateNewPostLink { ...props } />
136
+ </BlockInfo>
130
137
  { showSettingsPanel && (
131
138
  <InspectorControls>
132
139
  <PanelBody title={ __( 'Settings' ) }>
@@ -62,6 +62,7 @@ export default function PatternSelectionModal( {
62
62
  overlayClassName="block-library-query-pattern__selection-modal"
63
63
  title={ __( 'Choose a pattern' ) }
64
64
  onRequestClose={ () => setIsPatternSelectionModalOpen( false ) }
65
+ isFullScreen={ true }
65
66
  >
66
67
  <div className="block-library-query-pattern__selection-content">
67
68
  <div className="block-library-query-pattern__selection-search">
@@ -20,20 +20,17 @@
20
20
  }
21
21
 
22
22
  .block-library-query-pattern__selection-modal {
23
- // To keep modal dimensions consistent as subsections are navigated, width
24
- // and height are used instead of max-(width/height).
25
- .components-modal__frame {
26
- @include break-small() {
27
- width: calc(100% - #{$grid-unit-20 * 2});
28
- height: calc(100% - #{$header-height * 2});
29
- }
30
23
 
31
- @include break-medium() {
32
- width: $break-medium - $grid-unit-20 * 2;
24
+ .block-editor-block-patterns-list {
25
+ column-count: 2;
26
+ column-gap: $grid-unit-30;
27
+
28
+ @include break-wide() {
29
+ column-count: 3;
33
30
  }
34
31
 
35
- @include break-large() {
36
- height: 70%;
32
+ .block-editor-block-patterns-list__list-item {
33
+ break-inside: avoid-column;
37
34
  }
38
35
  }
39
36
 
@@ -2,7 +2,6 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { loop as icon } from '@wordpress/icons';
5
- import { addFilter } from '@wordpress/hooks';
6
5
 
7
6
  /**
8
7
  * Internal dependencies
@@ -13,7 +12,6 @@ import edit from './edit';
13
12
  import save from './save';
14
13
  import variations from './variations';
15
14
  import deprecated from './deprecated';
16
- import queryInspectorControls from './hooks';
17
15
 
18
16
  const { name } = metadata;
19
17
  export { metadata, name };
@@ -26,8 +24,4 @@ export const settings = {
26
24
  deprecated,
27
25
  };
28
26
 
29
- export const init = () => {
30
- addFilter( 'editor.BlockEdit', 'core/query', queryInspectorControls );
31
-
32
- return initBlock( { name, metadata, settings } );
33
- };
27
+ export const init = () => initBlock( { name, metadata, settings } );
@@ -10,7 +10,7 @@ import {
10
10
  fireEvent,
11
11
  within,
12
12
  waitFor,
13
- changeAndSelectTextOfRichText,
13
+ typeInRichText,
14
14
  } from 'test/helpers';
15
15
 
16
16
  /**
@@ -49,11 +49,7 @@ describe( 'Quote', () => {
49
49
  // screen.debug();
50
50
  let quoteTextInput =
51
51
  within( quoteBlock ).getByPlaceholderText( 'Start writing…' );
52
- const string = 'A great statement.';
53
- changeAndSelectTextOfRichText( quoteTextInput, string, {
54
- selectionStart: string.length,
55
- selectionEnd: string.length,
56
- } );
52
+ typeInRichText( quoteTextInput, 'A great statement.' );
57
53
  fireEvent( quoteTextInput, 'onKeyDown', {
58
54
  nativeEvent: {},
59
55
  preventDefault() {},
@@ -63,12 +59,12 @@ describe( 'Quote', () => {
63
59
  within( quoteBlock ).getAllByPlaceholderText(
64
60
  'Start writing…'
65
61
  )[ 1 ];
66
- changeAndSelectTextOfRichText( quoteTextInput, 'Again.' );
62
+ typeInRichText( quoteTextInput, 'Again.' );
67
63
  const citationTextInput =
68
64
  within( citationBlock ).getByPlaceholderText( 'Add citation' );
69
- changeAndSelectTextOfRichText( citationTextInput, 'A person', {
70
- selectionStart: 2,
71
- selectionEnd: 2,
65
+ typeInRichText( citationTextInput, 'A person', {
66
+ finalSelectionStart: 2,
67
+ finalSelectionEnd: 2,
72
68
  } );
73
69
  fireEvent( citationTextInput, 'onKeyDown', {
74
70
  nativeEvent: {},
@@ -45,6 +45,9 @@ $button-spacing-y: math.div($grid-unit-15, 2); // 6px
45
45
  // !important used to forcibly prevent undesired application of
46
46
  // text-decoration styles on the input field.
47
47
  text-decoration: unset !important;
48
+
49
+ // Hides a redundant extra search icon on Mobile Safari.
50
+ appearance: initial;
48
51
  }
49
52
 
50
53
  .wp-block-search.wp-block-search__button-only {
@@ -7,28 +7,8 @@
7
7
  // The editing view for the Shortcode block is equivalent to block UI.
8
8
  // Therefore we increase specificity to avoid theme styles bleeding in.
9
9
  .blocks-shortcode__textarea {
10
- font-family: $editor-html-font !important;
11
- color: $gray-900 !important;
12
- background: $white !important;
13
- padding: $grid-unit-15 !important;
14
- border: $border-width solid $gray-900 !important;
15
- box-shadow: none !important;
16
- border-radius: $radius-block-ui !important;
17
10
  box-sizing: border-box;
18
11
  max-height: 250px;
19
12
  resize: none;
20
-
21
- /* Fonts smaller than 16px causes mobile safari to zoom. */
22
- font-size: $mobile-text-min-font-size !important;
23
- @include break-small {
24
- font-size: $default-font-size !important;
25
- }
26
-
27
- &:focus {
28
- border-color: var(--wp-admin-theme-color) !important;
29
- box-shadow: 0 0 0 ($border-width-focus - $border-width) var(--wp-admin-theme-color) !important;
30
-
31
- // Windows High Contrast mode will show this outline, but not the box-shadow.
32
- outline: 2px solid transparent !important;
33
- }
13
+ @include editor-input-reset();
34
14
  }
@@ -4,7 +4,7 @@
4
4
  "name": "core/site-logo",
5
5
  "title": "Site Logo",
6
6
  "category": "theme",
7
- "description": "Display a graphic to represent this site. Update the block, and the changes apply everywhere it’s used. This is different than the site icon, which is the smaller image visible in your dashboard, browser tabs, etc used to help others recognize this site.",
7
+ "description": "Display an image to represent this site. Update this block and the changes apply everywhere.",
8
8
  "textdomain": "default",
9
9
  "attributes": {
10
10
  "width": {
@@ -24,12 +24,19 @@ import {
24
24
  ToolbarButton,
25
25
  Placeholder,
26
26
  Button,
27
+ DropZone,
28
+ FlexItem,
29
+ __experimentalItemGroup as ItemGroup,
30
+ __experimentalHStack as HStack,
31
+ __experimentalTruncate as Truncate,
27
32
  } from '@wordpress/components';
28
33
  import { useViewportMatch } from '@wordpress/compose';
29
34
  import {
30
35
  BlockControls,
31
36
  InspectorControls,
32
37
  MediaPlaceholder,
38
+ MediaUpload,
39
+ MediaUploadCheck,
33
40
  MediaReplaceFlow,
34
41
  useBlockProps,
35
42
  store as blockEditorStore,
@@ -349,6 +356,45 @@ const SiteLogo = ( {
349
356
  );
350
357
  };
351
358
 
359
+ // This is a light wrapper around MediaReplaceFlow because the block has two
360
+ // different MediaReplaceFlows, one for the inspector and one for the toolbar.
361
+ function SiteLogoReplaceFlow( { onRemoveLogo, ...mediaReplaceProps } ) {
362
+ return (
363
+ <MediaReplaceFlow
364
+ { ...mediaReplaceProps }
365
+ allowedTypes={ ALLOWED_MEDIA_TYPES }
366
+ accept={ ACCEPT_MEDIA_STRING }
367
+ >
368
+ <MenuItem onClick={ onRemoveLogo }>{ __( 'Reset' ) }</MenuItem>
369
+ </MediaReplaceFlow>
370
+ );
371
+ }
372
+
373
+ const InspectorLogoPreview = ( { mediaItemData = {}, itemGroupProps } ) => {
374
+ const {
375
+ alt_text: alt,
376
+ source_url: logoUrl,
377
+ slug: logoSlug,
378
+ media_details: logoMediaDetails,
379
+ } = mediaItemData;
380
+ const logoLabel = logoMediaDetails?.sizes?.full?.file || logoSlug;
381
+ return (
382
+ <ItemGroup { ...itemGroupProps } as="span">
383
+ <HStack justify="flex-start" as="span">
384
+ <img src={ logoUrl } alt={ alt } />
385
+ <FlexItem as="span">
386
+ <Truncate
387
+ numberOfLines={ 1 }
388
+ className="block-library-site-logo__inspector-media-replace-title"
389
+ >
390
+ { logoLabel }
391
+ </Truncate>
392
+ </FlexItem>
393
+ </HStack>
394
+ </ItemGroup>
395
+ );
396
+ };
397
+
352
398
  export default function LogoEdit( {
353
399
  attributes,
354
400
  className,
@@ -365,6 +411,7 @@ export default function LogoEdit( {
365
411
  siteIconId,
366
412
  mediaItemData,
367
413
  isRequestingMediaItem,
414
+ mediaUpload,
368
415
  } = useSelect( ( select ) => {
369
416
  const { canUser, getEntityRecord, getEditedEntityRecord } =
370
417
  select( coreStore );
@@ -396,6 +443,7 @@ export default function LogoEdit( {
396
443
  mediaItemData: mediaItem,
397
444
  isRequestingMediaItem: _isRequestingMediaItem,
398
445
  siteIconId: _siteIconId,
446
+ mediaUpload: select( blockEditorStore ).getSettings().mediaUpload,
399
447
  };
400
448
  }, [] );
401
449
 
@@ -461,17 +509,29 @@ export default function LogoEdit( {
461
509
  createErrorNotice( message, { type: 'snackbar' } );
462
510
  };
463
511
 
512
+ const onFilesDrop = ( filesList ) => {
513
+ mediaUpload( {
514
+ allowedTypes: [ 'image' ],
515
+ filesList,
516
+ onFileChange( [ image ] ) {
517
+ if ( isBlobURL( image?.url ) ) {
518
+ return;
519
+ }
520
+ onInitialSelectLogo( image );
521
+ },
522
+ onError: onUploadError,
523
+ } );
524
+ };
525
+
526
+ const mediaReplaceFlowProps = {
527
+ mediaURL: logoUrl,
528
+ onSelect: onSelectLogo,
529
+ onError: onUploadError,
530
+ onRemoveLogo,
531
+ };
464
532
  const controls = canUserEdit && logoUrl && (
465
533
  <BlockControls group="other">
466
- <MediaReplaceFlow
467
- mediaURL={ logoUrl }
468
- allowedTypes={ ALLOWED_MEDIA_TYPES }
469
- accept={ ACCEPT_MEDIA_STRING }
470
- onSelect={ onSelectLogo }
471
- onError={ onUploadError }
472
- >
473
- <MenuItem onClick={ onRemoveLogo }>{ __( 'Reset' ) }</MenuItem>
474
- </MediaReplaceFlow>
534
+ <SiteLogoReplaceFlow { ...mediaReplaceFlowProps } />
475
535
  </BlockControls>
476
536
  );
477
537
 
@@ -530,9 +590,63 @@ export default function LogoEdit( {
530
590
 
531
591
  const label = __( 'Add a site logo' );
532
592
 
593
+ const mediaInspectorPanel = ( canUserEdit || logoUrl ) && (
594
+ <InspectorControls>
595
+ <PanelBody title={ __( 'Media' ) }>
596
+ <div className="block-library-site-logo__inspector-media-replace-container">
597
+ { ! canUserEdit && !! logoUrl && (
598
+ <InspectorLogoPreview
599
+ mediaItemData={ mediaItemData }
600
+ itemGroupProps={ {
601
+ isBordered: true,
602
+ className:
603
+ 'block-library-site-logo__inspector-readonly-logo-preview',
604
+ } }
605
+ />
606
+ ) }
607
+ { canUserEdit && !! logoUrl && (
608
+ <SiteLogoReplaceFlow
609
+ { ...mediaReplaceFlowProps }
610
+ name={
611
+ <InspectorLogoPreview
612
+ mediaItemData={ mediaItemData }
613
+ />
614
+ }
615
+ popoverProps={ {} }
616
+ />
617
+ ) }
618
+ { canUserEdit && ! logoUrl && (
619
+ <MediaUploadCheck>
620
+ <MediaUpload
621
+ onSelect={ onInitialSelectLogo }
622
+ allowedTypes={ ALLOWED_MEDIA_TYPES }
623
+ render={ ( { open } ) => (
624
+ <div className="block-library-site-logo__inspector-upload-container">
625
+ <Button
626
+ onClick={ open }
627
+ variant="secondary"
628
+ >
629
+ { isLoading ? (
630
+ <Spinner />
631
+ ) : (
632
+ __( 'Add media' )
633
+ ) }
634
+ </Button>
635
+ <DropZone onFilesDrop={ onFilesDrop } />
636
+ </div>
637
+ ) }
638
+ />
639
+ </MediaUploadCheck>
640
+ ) }
641
+ </div>
642
+ </PanelBody>
643
+ </InspectorControls>
644
+ );
645
+
533
646
  return (
534
647
  <div { ...blockProps }>
535
648
  { controls }
649
+ { mediaInspectorPanel }
536
650
  { !! logoUrl && logoImage }
537
651
  { ! logoUrl && ! canUserEdit && (
538
652
  <Placeholder className="site-logo_placeholder">
@@ -93,3 +93,60 @@
93
93
  }
94
94
  }
95
95
  }
96
+
97
+ .block-library-site-logo__inspector-upload-container {
98
+ position: relative;
99
+ // Since there is no option to skip rendering the drag'n'drop icon in drop
100
+ // zone, we hide it for now.
101
+ .components-drop-zone__content-icon {
102
+ display: none;
103
+ }
104
+ }
105
+
106
+ .block-library-site-logo__inspector-upload-container,
107
+ .block-library-site-logo__inspector-media-replace-container {
108
+ button.components-button {
109
+ color: $gray-900;
110
+ box-shadow: inset 0 0 0 1px $gray-400;
111
+ width: 100%;
112
+ display: block;
113
+ height: $grid-unit-50;
114
+
115
+ &:hover {
116
+ color: var(--wp-admin-theme-color);
117
+ }
118
+
119
+ &:focus {
120
+ box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
121
+ }
122
+ }
123
+
124
+ .block-library-site-logo__inspector-media-replace-title {
125
+ word-break: break-all;
126
+ // The Button component is white-space: nowrap, and that won't work with line-clamp.
127
+ white-space: normal;
128
+
129
+ // Without this, the ellipsis can sometimes be partially hidden by the Button padding.
130
+ text-align: start;
131
+ text-align-last: center;
132
+ }
133
+ }
134
+
135
+ .block-library-site-logo__inspector-media-replace-container {
136
+ .components-dropdown {
137
+ display: block;
138
+ }
139
+
140
+ img {
141
+ width: $grid-unit-50 * 0.5;
142
+ aspect-ratio: 1;
143
+ box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
144
+ border-radius: 50% !important;
145
+ }
146
+
147
+ .block-library-site-logo__inspector-readonly-logo-preview {
148
+ padding: 6px 12px;
149
+ display: flex;
150
+ height: $grid-unit-50;
151
+ }
152
+ }
@@ -5,6 +5,6 @@ import { Path, SVG } from '@wordpress/primitives';
5
5
 
6
6
  export const ChainIcon = () => (
7
7
  <SVG width="24" height="24" viewBox="0 0 24 24" version="1.1">
8
- <Path d="M19.647,16.706a1.134,1.134,0,0,0-.343-.833l-2.549-2.549a1.134,1.134,0,0,0-.833-.343,1.168,1.168,0,0,0-.883.392l.233.226q.2.189.264.264a2.922,2.922,0,0,1,.184.233.986.986,0,0,1,.159.312,1.242,1.242,0,0,1,.043.337,1.172,1.172,0,0,1-1.176,1.176,1.237,1.237,0,0,1-.337-.043,1,1,0,0,1-.312-.159,2.76,2.76,0,0,1-.233-.184q-.073-.068-.264-.264l-.226-.233a1.19,1.19,0,0,0-.4.895,1.134,1.134,0,0,0,.343.833L15.837,19.3a1.13,1.13,0,0,0,.833.331,1.18,1.18,0,0,0,.833-.318l1.8-1.789a1.12,1.12,0,0,0,.343-.821Zm-8.615-8.64a1.134,1.134,0,0,0-.343-.833L8.163,4.7a1.134,1.134,0,0,0-.833-.343,1.184,1.184,0,0,0-.833.331L4.7,6.473a1.12,1.12,0,0,0-.343.821,1.134,1.134,0,0,0,.343.833l2.549,2.549a1.13,1.13,0,0,0,.833.331,1.184,1.184,0,0,0,.883-.38L8.728,10.4q-.2-.189-.264-.264A2.922,2.922,0,0,1,8.28,9.9a.986.986,0,0,1-.159-.312,1.242,1.242,0,0,1-.043-.337A1.172,1.172,0,0,1,9.254,8.079a1.237,1.237,0,0,1,.337.043,1,1,0,0,1,.312.159,2.761,2.761,0,0,1,.233.184q.073.068.264.264l.226.233a1.19,1.19,0,0,0,.4-.895ZM22,16.706a3.343,3.343,0,0,1-1.042,2.488l-1.8,1.789a3.536,3.536,0,0,1-4.988-.025l-2.525-2.537a3.384,3.384,0,0,1-1.017-2.488,3.448,3.448,0,0,1,1.078-2.561l-1.078-1.078a3.434,3.434,0,0,1-2.549,1.078,3.4,3.4,0,0,1-2.5-1.029L3.029,9.794A3.4,3.4,0,0,1,2,7.294,3.343,3.343,0,0,1,3.042,4.806l1.8-1.789A3.384,3.384,0,0,1,7.331,2a3.357,3.357,0,0,1,2.5,1.042l2.525,2.537a3.384,3.384,0,0,1,1.017,2.488,3.448,3.448,0,0,1-1.078,2.561l1.078,1.078a3.551,3.551,0,0,1,5.049-.049l2.549,2.549A3.4,3.4,0,0,1,22,16.706Z" />
8
+ <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" />
9
9
  </SVG>
10
10
  );
@@ -5,6 +5,6 @@ import { Path, SVG } from '@wordpress/primitives';
5
5
 
6
6
  export const MailIcon = () => (
7
7
  <SVG width="24" height="24" viewBox="0 0 24 24" version="1.1">
8
- <Path d="M20,4H4C2.895,4,2,4.895,2,6v12c0,1.105,0.895,2,2,2h16c1.105,0,2-0.895,2-2V6C22,4.895,21.105,4,20,4z M20,8.236l-8,4.882 L4,8.236V6h16V8.236z" />
8
+ <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" />
9
9
  </SVG>
10
10
  );
@@ -144,7 +144,7 @@ function block_core_social_link_services( $service = '', $field = '' ) {
144
144
  ),
145
145
  'chain' => array(
146
146
  'name' => 'Link',
147
- 'icon' => '<svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M19.647,16.706a1.134,1.134,0,0,0-.343-.833l-2.549-2.549a1.134,1.134,0,0,0-.833-.343,1.168,1.168,0,0,0-.883.392l.233.226q.2.189.264.264a2.922,2.922,0,0,1,.184.233.986.986,0,0,1,.159.312,1.242,1.242,0,0,1,.043.337,1.172,1.172,0,0,1-1.176,1.176,1.237,1.237,0,0,1-.337-.043,1,1,0,0,1-.312-.159,2.76,2.76,0,0,1-.233-.184q-.073-.068-.264-.264l-.226-.233a1.19,1.19,0,0,0-.4.895,1.134,1.134,0,0,0,.343.833L15.837,19.3a1.13,1.13,0,0,0,.833.331,1.18,1.18,0,0,0,.833-.318l1.8-1.789a1.12,1.12,0,0,0,.343-.821Zm-8.615-8.64a1.134,1.134,0,0,0-.343-.833L8.163,4.7a1.134,1.134,0,0,0-.833-.343,1.184,1.184,0,0,0-.833.331L4.7,6.473a1.12,1.12,0,0,0-.343.821,1.134,1.134,0,0,0,.343.833l2.549,2.549a1.13,1.13,0,0,0,.833.331,1.184,1.184,0,0,0,.883-.38L8.728,10.4q-.2-.189-.264-.264A2.922,2.922,0,0,1,8.28,9.9a.986.986,0,0,1-.159-.312,1.242,1.242,0,0,1-.043-.337A1.172,1.172,0,0,1,9.254,8.079a1.237,1.237,0,0,1,.337.043,1,1,0,0,1,.312.159,2.761,2.761,0,0,1,.233.184q.073.068.264.264l.226.233a1.19,1.19,0,0,0,.4-.895ZM22,16.706a3.343,3.343,0,0,1-1.042,2.488l-1.8,1.789a3.536,3.536,0,0,1-4.988-.025l-2.525-2.537a3.384,3.384,0,0,1-1.017-2.488,3.448,3.448,0,0,1,1.078-2.561l-1.078-1.078a3.434,3.434,0,0,1-2.549,1.078,3.4,3.4,0,0,1-2.5-1.029L3.029,9.794A3.4,3.4,0,0,1,2,7.294,3.343,3.343,0,0,1,3.042,4.806l1.8-1.789A3.384,3.384,0,0,1,7.331,2a3.357,3.357,0,0,1,2.5,1.042l2.525,2.537a3.384,3.384,0,0,1,1.017,2.488,3.448,3.448,0,0,1-1.078,2.561l1.078,1.078a3.551,3.551,0,0,1,5.049-.049l2.549,2.549A3.4,3.4,0,0,1,22,16.706Z"></path></svg>',
147
+ 'icon' => '<svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><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"></path></svg>',
148
148
  ),
149
149
  'codepen' => array(
150
150
  'name' => 'CodePen',
@@ -208,7 +208,7 @@ function block_core_social_link_services( $service = '', $field = '' ) {
208
208
  ),
209
209
  'mail' => array(
210
210
  'name' => 'Mail',
211
- 'icon' => '<svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M20,4H4C2.895,4,2,4.895,2,6v12c0,1.105,0.895,2,2,2h16c1.105,0,2-0.895,2-2V6C22,4.895,21.105,4,20,4z M20,8.236l-8,4.882 L4,8.236V6h16V8.236z"></path></svg>',
211
+ 'icon' => '<svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><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"></path></svg>',
212
212
  ),
213
213
  'mastodon' => array(
214
214
  'name' => 'Mastodon',