@wordpress/block-library 9.12.0 → 9.12.1-next.082ed6819.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 (139) hide show
  1. package/build/block-keyboard-shortcuts/index.js +7 -7
  2. package/build/block-keyboard-shortcuts/index.js.map +1 -1
  3. package/build/cover/edit/index.js +1 -1
  4. package/build/cover/edit/index.js.map +1 -1
  5. package/build/cover/index.js +10 -10
  6. package/build/cover/index.js.map +1 -1
  7. package/build/cover/shared.js +6 -7
  8. package/build/cover/shared.js.map +1 -1
  9. package/build/details/index.js +19 -0
  10. package/build/details/index.js.map +1 -1
  11. package/build/file/edit.js +7 -3
  12. package/build/file/edit.js.map +1 -1
  13. package/build/freeform/modal.js +1 -1
  14. package/build/freeform/modal.js.map +1 -1
  15. package/build/heading/index.js +1 -7
  16. package/build/heading/index.js.map +1 -1
  17. package/build/home-link/edit.js +20 -36
  18. package/build/home-link/edit.js.map +1 -1
  19. package/build/navigation/use-template-part-area-label.js +6 -8
  20. package/build/navigation/use-template-part-area-label.js.map +1 -1
  21. package/build/page-list/index.js +14 -0
  22. package/build/page-list/index.js.map +1 -1
  23. package/build/paragraph/edit.js +26 -25
  24. package/build/paragraph/edit.js.map +1 -1
  25. package/build/query/edit/inspector-controls/enhanced-pagination-control.js +1 -3
  26. package/build/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
  27. package/build/query/edit/inspector-controls/index.js +1 -11
  28. package/build/query/edit/inspector-controls/index.js.map +1 -1
  29. package/build/query/utils.js +6 -8
  30. package/build/query/utils.js.map +1 -1
  31. package/build/social-link/edit.js +22 -9
  32. package/build/social-link/edit.js.map +1 -1
  33. package/build/template-part/edit/advanced-controls.js +2 -7
  34. package/build/template-part/edit/advanced-controls.js.map +1 -1
  35. package/build/template-part/edit/utils/get-template-part-icon.js +23 -0
  36. package/build/template-part/edit/utils/get-template-part-icon.js.map +1 -0
  37. package/build/template-part/edit/utils/hooks.js +1 -6
  38. package/build/template-part/edit/utils/hooks.js.map +1 -1
  39. package/build/template-part/variations.js +6 -12
  40. package/build/template-part/variations.js.map +1 -1
  41. package/build/video/tracks-editor.js +135 -121
  42. package/build/video/tracks-editor.js.map +1 -1
  43. package/build-module/block-keyboard-shortcuts/index.js +7 -7
  44. package/build-module/block-keyboard-shortcuts/index.js.map +1 -1
  45. package/build-module/cover/edit/index.js +1 -1
  46. package/build-module/cover/edit/index.js.map +1 -1
  47. package/build-module/cover/index.js +10 -10
  48. package/build-module/cover/index.js.map +1 -1
  49. package/build-module/cover/shared.js +6 -7
  50. package/build-module/cover/shared.js.map +1 -1
  51. package/build-module/details/index.js +20 -1
  52. package/build-module/details/index.js.map +1 -1
  53. package/build-module/file/edit.js +7 -3
  54. package/build-module/file/edit.js.map +1 -1
  55. package/build-module/freeform/modal.js +1 -1
  56. package/build-module/freeform/modal.js.map +1 -1
  57. package/build-module/heading/index.js +1 -7
  58. package/build-module/heading/index.js.map +1 -1
  59. package/build-module/home-link/edit.js +23 -39
  60. package/build-module/home-link/edit.js.map +1 -1
  61. package/build-module/navigation/use-template-part-area-label.js +6 -8
  62. package/build-module/navigation/use-template-part-area-label.js.map +1 -1
  63. package/build-module/page-list/index.js +14 -0
  64. package/build-module/page-list/index.js.map +1 -1
  65. package/build-module/paragraph/edit.js +26 -25
  66. package/build-module/paragraph/edit.js.map +1 -1
  67. package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js +1 -3
  68. package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
  69. package/build-module/query/edit/inspector-controls/index.js +1 -11
  70. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  71. package/build-module/query/utils.js +6 -8
  72. package/build-module/query/utils.js.map +1 -1
  73. package/build-module/social-link/edit.js +24 -11
  74. package/build-module/social-link/edit.js.map +1 -1
  75. package/build-module/template-part/edit/advanced-controls.js +3 -8
  76. package/build-module/template-part/edit/advanced-controls.js.map +1 -1
  77. package/build-module/template-part/edit/utils/get-template-part-icon.js +15 -0
  78. package/build-module/template-part/edit/utils/get-template-part-icon.js.map +1 -0
  79. package/build-module/template-part/edit/utils/hooks.js +1 -6
  80. package/build-module/template-part/edit/utils/hooks.js.map +1 -1
  81. package/build-module/template-part/variations.js +5 -11
  82. package/build-module/template-part/variations.js.map +1 -1
  83. package/build-module/video/tracks-editor.js +136 -122
  84. package/build-module/video/tracks-editor.js.map +1 -1
  85. package/build-style/editor-rtl.css +12 -8
  86. package/build-style/editor.css +12 -8
  87. package/build-style/navigation/style-rtl.css +1 -1
  88. package/build-style/navigation/style.css +1 -1
  89. package/build-style/page-list/style-rtl.css +4 -0
  90. package/build-style/page-list/style.css +4 -0
  91. package/build-style/query/editor-rtl.css +0 -4
  92. package/build-style/query/editor.css +0 -4
  93. package/build-style/search/style-rtl.css +3 -3
  94. package/build-style/search/style.css +3 -3
  95. package/build-style/social-link/editor-rtl.css +4 -4
  96. package/build-style/social-link/editor.css +4 -4
  97. package/build-style/style-rtl.css +8 -4
  98. package/build-style/style.css +8 -4
  99. package/build-style/video/editor-rtl.css +8 -0
  100. package/build-style/video/editor.css +8 -0
  101. package/package.json +33 -33
  102. package/src/block-keyboard-shortcuts/index.js +25 -11
  103. package/src/cover/edit/index.js +1 -1
  104. package/src/cover/index.js +8 -8
  105. package/src/cover/shared.js +10 -10
  106. package/src/cover/test/edit.js +2 -2
  107. package/src/details/index.js +23 -1
  108. package/src/file/edit.js +8 -2
  109. package/src/freeform/modal.js +1 -1
  110. package/src/heading/block.json +1 -7
  111. package/src/home-link/edit.js +27 -45
  112. package/src/home-link/index.php +0 -3
  113. package/src/navigation/index.php +4 -150
  114. package/src/navigation/style.scss +1 -1
  115. package/src/navigation/use-template-part-area-label.js +10 -10
  116. package/src/page-list/block.json +14 -0
  117. package/src/page-list/style.scss +4 -0
  118. package/src/paragraph/edit.js +20 -17
  119. package/src/pattern/index.php +0 -7
  120. package/src/query/edit/inspector-controls/enhanced-pagination-control.js +3 -5
  121. package/src/query/edit/inspector-controls/index.js +0 -10
  122. package/src/query/editor.scss +0 -4
  123. package/src/query/index.php +1 -1
  124. package/src/query/utils.js +14 -15
  125. package/src/rss/index.php +11 -8
  126. package/src/search/style.scss +3 -5
  127. package/src/social-link/edit.js +47 -19
  128. package/src/social-link/editor.scss +6 -7
  129. package/src/template-part/edit/advanced-controls.js +13 -13
  130. package/src/template-part/edit/utils/get-template-part-icon.js +20 -0
  131. package/src/template-part/edit/utils/hooks.js +2 -7
  132. package/src/template-part/variations.js +4 -16
  133. package/src/video/editor.scss +9 -0
  134. package/src/video/tracks-editor.js +157 -139
  135. package/build/query/edit/inspector-controls/create-new-post-link.js +0 -40
  136. package/build/query/edit/inspector-controls/create-new-post-link.js.map +0 -1
  137. package/build-module/query/edit/inspector-controls/create-new-post-link.js +0 -33
  138. package/build-module/query/edit/inspector-controls/create-new-post-link.js.map +0 -1
  139. package/src/query/edit/inspector-controls/create-new-post-link.js +0 -32
@@ -2558,7 +2558,7 @@ button.wp-block-navigation-item__content {
2558
2558
  padding-top: clamp(1rem, var(--wp--style--root--padding-top), 20rem);
2559
2559
  padding-left: clamp(1rem, var(--wp--style--root--padding-right), 20rem);
2560
2560
  padding-bottom: clamp(1rem, var(--wp--style--root--padding-bottom), 20rem);
2561
- padding-right: clamp(1rem, var(--wp--style--root--padding-left), 20em);
2561
+ padding-right: clamp(1rem, var(--wp--style--root--padding-left), 20rem);
2562
2562
  overflow: auto;
2563
2563
  z-index: 100000;
2564
2564
  }
@@ -2767,6 +2767,10 @@ html.has-modal-open {
2767
2767
  background-color: inherit;
2768
2768
  }
2769
2769
 
2770
+ .wp-block-page-list {
2771
+ box-sizing: border-box;
2772
+ }
2773
+
2770
2774
  .is-small-text {
2771
2775
  font-size: 0.875em;
2772
2776
  }
@@ -3342,9 +3346,9 @@ ul.wp-block-rss.is-grid li {
3342
3346
  margin-right: 0;
3343
3347
  flex-shrink: 0;
3344
3348
  max-width: 100%;
3345
- }
3346
- .wp-block-search.wp-block-search__button-only .wp-block-search__button[aria-expanded=true] {
3347
- max-width: calc(100% - 100px);
3349
+ box-sizing: border-box;
3350
+ display: flex;
3351
+ justify-content: center;
3348
3352
  }
3349
3353
  .wp-block-search.wp-block-search__button-only .wp-block-search__inside-wrapper {
3350
3354
  transition-property: width;
@@ -2590,7 +2590,7 @@ button.wp-block-navigation-item__content {
2590
2590
  padding-top: clamp(1rem, var(--wp--style--root--padding-top), 20rem);
2591
2591
  padding-right: clamp(1rem, var(--wp--style--root--padding-right), 20rem);
2592
2592
  padding-bottom: clamp(1rem, var(--wp--style--root--padding-bottom), 20rem);
2593
- padding-left: clamp(1rem, var(--wp--style--root--padding-left), 20em);
2593
+ padding-left: clamp(1rem, var(--wp--style--root--padding-left), 20rem);
2594
2594
  overflow: auto;
2595
2595
  z-index: 100000;
2596
2596
  }
@@ -2799,6 +2799,10 @@ html.has-modal-open {
2799
2799
  background-color: inherit;
2800
2800
  }
2801
2801
 
2802
+ .wp-block-page-list {
2803
+ box-sizing: border-box;
2804
+ }
2805
+
2802
2806
  .is-small-text {
2803
2807
  font-size: 0.875em;
2804
2808
  }
@@ -3376,9 +3380,9 @@ ul.wp-block-rss.is-grid li {
3376
3380
  margin-left: 0;
3377
3381
  flex-shrink: 0;
3378
3382
  max-width: 100%;
3379
- }
3380
- .wp-block-search.wp-block-search__button-only .wp-block-search__button[aria-expanded=true] {
3381
- max-width: calc(100% - 100px);
3383
+ box-sizing: border-box;
3384
+ display: flex;
3385
+ justify-content: center;
3382
3386
  }
3383
3387
  .wp-block-search.wp-block-search__button-only .wp-block-search__inside-wrapper {
3384
3388
  transition-property: width;
@@ -132,6 +132,7 @@
132
132
  max-width: 240px;
133
133
  }
134
134
 
135
+ .block-library-video-tracks-editor__tracks-informative-message-title,
135
136
  .block-library-video-tracks-editor__single-track-editor-edit-track-label {
136
137
  margin-top: 4px;
137
138
  color: #757575;
@@ -148,4 +149,11 @@
148
149
  .block-library-video-tracks-editor__track-list .components-menu-group__label,
149
150
  .block-library-video-tracks-editor__add-tracks-container .components-menu-group__label {
150
151
  padding: 0;
152
+ }
153
+
154
+ .block-library-video-tracks-editor__tracks-informative-message {
155
+ padding: 8px;
156
+ }
157
+ .block-library-video-tracks-editor__tracks-informative-message-description {
158
+ margin-bottom: 0;
151
159
  }
@@ -132,6 +132,7 @@
132
132
  max-width: 240px;
133
133
  }
134
134
 
135
+ .block-library-video-tracks-editor__tracks-informative-message-title,
135
136
  .block-library-video-tracks-editor__single-track-editor-edit-track-label {
136
137
  margin-top: 4px;
137
138
  color: #757575;
@@ -148,4 +149,11 @@
148
149
  .block-library-video-tracks-editor__track-list .components-menu-group__label,
149
150
  .block-library-video-tracks-editor__add-tracks-container .components-menu-group__label {
150
151
  padding: 0;
152
+ }
153
+
154
+ .block-library-video-tracks-editor__tracks-informative-message {
155
+ padding: 8px;
156
+ }
157
+ .block-library-video-tracks-editor__tracks-informative-message-description {
158
+ margin-bottom: 0;
151
159
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-library",
3
- "version": "9.12.0",
3
+ "version": "9.12.1-next.082ed6819.0",
4
4
  "description": "Block library for the WordPress editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -40,39 +40,39 @@
40
40
  ],
41
41
  "dependencies": {
42
42
  "@babel/runtime": "7.25.7",
43
- "@wordpress/a11y": "*",
44
- "@wordpress/api-fetch": "*",
45
- "@wordpress/autop": "*",
46
- "@wordpress/blob": "*",
47
- "@wordpress/block-editor": "*",
48
- "@wordpress/blocks": "*",
43
+ "@wordpress/a11y": "^4.12.1-next.082ed6819.0",
44
+ "@wordpress/api-fetch": "^7.12.1-next.082ed6819.0",
45
+ "@wordpress/autop": "^4.12.1-next.082ed6819.0",
46
+ "@wordpress/blob": "^4.12.1-next.082ed6819.0",
47
+ "@wordpress/block-editor": "^14.7.1-next.082ed6819.0",
48
+ "@wordpress/blocks": "^14.1.1-next.082ed6819.0",
49
49
  "@wordpress/components": "*",
50
- "@wordpress/compose": "*",
51
- "@wordpress/core-data": "*",
50
+ "@wordpress/compose": "^7.12.1-next.082ed6819.0",
51
+ "@wordpress/core-data": "^7.12.1-next.082ed6819.0",
52
52
  "@wordpress/data": "*",
53
- "@wordpress/date": "*",
54
- "@wordpress/deprecated": "*",
55
- "@wordpress/dom": "*",
56
- "@wordpress/element": "*",
57
- "@wordpress/escape-html": "*",
58
- "@wordpress/hooks": "*",
59
- "@wordpress/html-entities": "*",
60
- "@wordpress/i18n": "*",
61
- "@wordpress/icons": "*",
62
- "@wordpress/interactivity": "*",
63
- "@wordpress/interactivity-router": "*",
64
- "@wordpress/keyboard-shortcuts": "*",
65
- "@wordpress/keycodes": "*",
66
- "@wordpress/notices": "*",
67
- "@wordpress/patterns": "*",
68
- "@wordpress/primitives": "*",
69
- "@wordpress/private-apis": "*",
70
- "@wordpress/reusable-blocks": "*",
71
- "@wordpress/rich-text": "*",
72
- "@wordpress/server-side-render": "*",
73
- "@wordpress/url": "*",
74
- "@wordpress/viewport": "*",
75
- "@wordpress/wordcount": "*",
53
+ "@wordpress/date": "^5.12.1-next.082ed6819.0",
54
+ "@wordpress/deprecated": "^4.12.1-next.082ed6819.0",
55
+ "@wordpress/dom": "^4.12.1-next.082ed6819.0",
56
+ "@wordpress/element": "^6.12.1-next.082ed6819.0",
57
+ "@wordpress/escape-html": "^3.12.1-next.082ed6819.0",
58
+ "@wordpress/hooks": "^4.12.1-next.082ed6819.0",
59
+ "@wordpress/html-entities": "^4.12.1-next.082ed6819.0",
60
+ "@wordpress/i18n": "^5.12.1-next.082ed6819.0",
61
+ "@wordpress/icons": "^10.12.1-next.082ed6819.0",
62
+ "@wordpress/interactivity": "^6.12.1-next.082ed6819.0",
63
+ "@wordpress/interactivity-router": "^2.12.1-next.082ed6819.0",
64
+ "@wordpress/keyboard-shortcuts": "^5.12.1-next.082ed6819.0",
65
+ "@wordpress/keycodes": "^4.12.1-next.082ed6819.0",
66
+ "@wordpress/notices": "^5.12.1-next.082ed6819.0",
67
+ "@wordpress/patterns": "^2.12.1-next.082ed6819.0",
68
+ "@wordpress/primitives": "^4.12.1-next.082ed6819.0",
69
+ "@wordpress/private-apis": "^1.12.1-next.082ed6819.0",
70
+ "@wordpress/reusable-blocks": "^5.12.1-next.082ed6819.0",
71
+ "@wordpress/rich-text": "^7.12.1-next.082ed6819.0",
72
+ "@wordpress/server-side-render": "^5.12.1-next.082ed6819.0",
73
+ "@wordpress/url": "^4.12.1-next.082ed6819.0",
74
+ "@wordpress/viewport": "^6.12.1-next.082ed6819.0",
75
+ "@wordpress/wordcount": "^4.12.1-next.082ed6819.0",
76
76
  "change-case": "^4.1.2",
77
77
  "clsx": "^2.1.1",
78
78
  "colord": "^2.7.0",
@@ -90,5 +90,5 @@
90
90
  "publishConfig": {
91
91
  "access": "public"
92
92
  },
93
- "gitHead": "510540d99f3d222a96f08d3d7b66c9e7a726f705"
93
+ "gitHead": "2bb7bad15ddb8e88210fab7d4a1ef1565466e424"
94
94
  }
@@ -90,22 +90,36 @@ function BlockKeyboardShortcuts() {
90
90
  },
91
91
  } );
92
92
  } );
93
- }, [] );
93
+ }, [ registerShortcut ] );
94
94
 
95
95
  useShortcut(
96
96
  'core/block-editor/transform-heading-to-paragraph',
97
97
  ( event ) => handleTransformHeadingAndParagraph( event, 0 )
98
98
  );
99
-
100
- [ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {
101
- //the loop is based off on a constant therefore
102
- //the hook will execute the same way every time
103
- //eslint-disable-next-line react-hooks/rules-of-hooks
104
- useShortcut(
105
- `core/block-editor/transform-paragraph-to-heading-${ level }`,
106
- ( event ) => handleTransformHeadingAndParagraph( event, level )
107
- );
108
- } );
99
+ useShortcut(
100
+ 'core/block-editor/transform-paragraph-to-heading-1',
101
+ ( event ) => handleTransformHeadingAndParagraph( event, 1 )
102
+ );
103
+ useShortcut(
104
+ 'core/block-editor/transform-paragraph-to-heading-2',
105
+ ( event ) => handleTransformHeadingAndParagraph( event, 2 )
106
+ );
107
+ useShortcut(
108
+ 'core/block-editor/transform-paragraph-to-heading-3',
109
+ ( event ) => handleTransformHeadingAndParagraph( event, 3 )
110
+ );
111
+ useShortcut(
112
+ 'core/block-editor/transform-paragraph-to-heading-4',
113
+ ( event ) => handleTransformHeadingAndParagraph( event, 4 )
114
+ );
115
+ useShortcut(
116
+ 'core/block-editor/transform-paragraph-to-heading-5',
117
+ ( event ) => handleTransformHeadingAndParagraph( event, 5 )
118
+ );
119
+ useShortcut(
120
+ 'core/block-editor/transform-paragraph-to-heading-6',
121
+ ( event ) => handleTransformHeadingAndParagraph( event, 6 )
122
+ );
109
123
 
110
124
  return null;
111
125
  }
@@ -201,7 +201,7 @@ function CoverEdit( {
201
201
  averageBackgroundColor
202
202
  );
203
203
 
204
- if ( backgroundType === IMAGE_BACKGROUND_TYPE && mediaAttributes.id ) {
204
+ if ( backgroundType === IMAGE_BACKGROUND_TYPE && mediaAttributes?.id ) {
205
205
  const { imageDefaultSize } = getSettings();
206
206
 
207
207
  // Try to use the previous selected image size if it's available
@@ -26,6 +26,14 @@ export const settings = {
26
26
  customOverlayColor: '#065174',
27
27
  dimRatio: 40,
28
28
  url: 'https://s.w.org/images/core/5.3/Windbuchencom.jpg',
29
+ style: {
30
+ typography: {
31
+ fontSize: 48,
32
+ },
33
+ color: {
34
+ text: 'white',
35
+ },
36
+ },
29
37
  },
30
38
  innerBlocks: [
31
39
  {
@@ -33,14 +41,6 @@ export const settings = {
33
41
  attributes: {
34
42
  content: __( '<strong>Snow Patrol</strong>' ),
35
43
  align: 'center',
36
- style: {
37
- typography: {
38
- fontSize: 48,
39
- },
40
- color: {
41
- text: 'white',
42
- },
43
- },
44
44
  },
45
45
  },
46
46
  ],
@@ -35,7 +35,7 @@ export function dimRatioToClass( ratio ) {
35
35
  }
36
36
 
37
37
  export function attributesFromMedia( media ) {
38
- if ( ! media || ! media.url ) {
38
+ if ( ! media || ( ! media.url && ! media.src ) ) {
39
39
  return {
40
40
  url: undefined,
41
41
  id: undefined,
@@ -52,23 +52,23 @@ export function attributesFromMedia( media ) {
52
52
  if ( media.media_type === IMAGE_BACKGROUND_TYPE ) {
53
53
  mediaType = IMAGE_BACKGROUND_TYPE;
54
54
  } else {
55
- // only images and videos are accepted so if the media_type is not an image we can assume it is a video.
55
+ // Only images and videos are accepted so if the media_type is not an image we can assume it is a video.
56
56
  // Videos contain the media type of 'file' in the object returned from the rest api.
57
57
  mediaType = VIDEO_BACKGROUND_TYPE;
58
58
  }
59
- } else {
60
59
  // For media selections originated from existing files in the media library.
61
- if (
62
- media.type !== IMAGE_BACKGROUND_TYPE &&
63
- media.type !== VIDEO_BACKGROUND_TYPE
64
- ) {
65
- return;
66
- }
60
+ } else if (
61
+ media.type &&
62
+ ( media.type === IMAGE_BACKGROUND_TYPE ||
63
+ media.type === VIDEO_BACKGROUND_TYPE )
64
+ ) {
67
65
  mediaType = media.type;
66
+ } else {
67
+ return;
68
68
  }
69
69
 
70
70
  return {
71
- url: media.url,
71
+ url: media.url || media.src,
72
72
  id: media.id,
73
73
  alt: media?.alt,
74
74
  backgroundType: mediaType,
@@ -337,7 +337,7 @@ describe( 'Cover block', () => {
337
337
  describe( 'when colors are disabled', () => {
338
338
  test( 'does not render overlay control', async () => {
339
339
  await setup( undefined, true, disabledColorSettings );
340
- await createAndSelectBlock();
340
+ await selectBlock( 'Block: Cover' );
341
341
  await userEvent.click(
342
342
  screen.getByRole( 'tab', { name: 'Styles' } )
343
343
  );
@@ -350,7 +350,7 @@ describe( 'Cover block', () => {
350
350
  } );
351
351
  test( 'does not render opacity control', async () => {
352
352
  await setup( undefined, true, disabledColorSettings );
353
- await createAndSelectBlock();
353
+ await selectBlock( 'Block: Cover' );
354
354
  await userEvent.click(
355
355
  screen.getByRole( 'tab', { name: 'Styles' } )
356
356
  );
@@ -2,7 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { details as icon } from '@wordpress/icons';
5
- import { __ } from '@wordpress/i18n';
5
+ import { __, sprintf } from '@wordpress/i18n';
6
6
 
7
7
  /**
8
8
  * Internal dependencies
@@ -34,6 +34,28 @@ export const settings = {
34
34
  },
35
35
  ],
36
36
  },
37
+ __experimentalLabel( attributes, { context } ) {
38
+ const { summary } = attributes;
39
+
40
+ const customName = attributes?.metadata?.name;
41
+ const hasSummary = summary?.trim().length > 0;
42
+
43
+ // In the list view, use the block's summary as the label.
44
+ // If the summary is empty, fall back to the default label.
45
+ if ( context === 'list-view' && ( customName || hasSummary ) ) {
46
+ return customName || summary;
47
+ }
48
+
49
+ if ( context === 'accessibility' ) {
50
+ return ! hasSummary
51
+ ? __( 'Details. Empty.' )
52
+ : sprintf(
53
+ /* translators: accessibility text; summary title. */
54
+ __( 'Details. %s' ),
55
+ summary
56
+ );
57
+ }
58
+ },
37
59
  save,
38
60
  edit,
39
61
  transforms,
package/src/file/edit.js CHANGED
@@ -128,15 +128,21 @@ function FileEdit( { attributes, isSelected, setAttributes, clientId } ) {
128
128
  }
129
129
 
130
130
  const isPdf = newMedia.url.endsWith( '.pdf' );
131
+ const pdfAttributes = {
132
+ displayPreview: isPdf
133
+ ? attributes.displayPreview ?? true
134
+ : undefined,
135
+ previewHeight: isPdf ? attributes.previewHeight ?? 600 : undefined,
136
+ };
137
+
131
138
  setAttributes( {
132
139
  href: newMedia.url,
133
140
  fileName: newMedia.title,
134
141
  textLinkHref: newMedia.url,
135
142
  id: newMedia.id,
136
- displayPreview: isPdf ? true : undefined,
137
- previewHeight: isPdf ? 600 : undefined,
138
143
  fileId: `wp-block-file--media-${ clientId }`,
139
144
  blob: undefined,
145
+ ...pdfAttributes,
140
146
  } );
141
147
  setTemporaryURL();
142
148
  }
@@ -25,7 +25,7 @@ function ModalAuxiliaryActions( { onClick, isModalFullScreen } ) {
25
25
 
26
26
  return (
27
27
  <Button
28
- size="small"
28
+ size="compact"
29
29
  onClick={ onClick }
30
30
  icon={ fullscreen }
31
31
  isPressed={ isModalFullScreen }
@@ -37,13 +37,7 @@
37
37
  "color": true,
38
38
  "radius": true,
39
39
  "style": true,
40
- "width": true,
41
- "__experimentalDefaultControls": {
42
- "color": true,
43
- "radius": true,
44
- "style": true,
45
- "width": true
46
- }
40
+ "width": true
47
41
  },
48
42
  "color": {
49
43
  "gradients": true,
@@ -6,15 +6,10 @@ import clsx from 'clsx';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import {
10
- RichText,
11
- useBlockProps,
12
- store as blockEditorStore,
13
- } from '@wordpress/block-editor';
9
+ import { RichText, useBlockProps } from '@wordpress/block-editor';
14
10
  import { __ } from '@wordpress/i18n';
15
- import { useSelect, useDispatch } from '@wordpress/data';
11
+ import { useSelect } from '@wordpress/data';
16
12
  import { store as coreStore } from '@wordpress/core-data';
17
- import { useEffect } from '@wordpress/element';
18
13
 
19
14
  const preventDefault = ( event ) => event.preventDefault();
20
15
 
@@ -24,8 +19,6 @@ export default function HomeEdit( { attributes, setAttributes, context } ) {
24
19
  return select( coreStore ).getEntityRecord( 'root', '__unstableBase' )
25
20
  ?.home;
26
21
  }, [] );
27
- const { __unstableMarkNextChangeAsNotPersistent } =
28
- useDispatch( blockEditorStore );
29
22
 
30
23
  const { textColor, backgroundColor, style } = context;
31
24
  const blockProps = useBlockProps( {
@@ -41,42 +34,31 @@ export default function HomeEdit( { attributes, setAttributes, context } ) {
41
34
  },
42
35
  } );
43
36
 
44
- const { label } = attributes;
45
-
46
- useEffect( () => {
47
- if ( label === undefined ) {
48
- __unstableMarkNextChangeAsNotPersistent();
49
- setAttributes( { label: __( 'Home' ) } );
50
- }
51
- }, [ label ] );
52
-
53
37
  return (
54
- <>
55
- <div { ...blockProps }>
56
- <a
57
- className="wp-block-home-link__content wp-block-navigation-item__content"
58
- href={ homeUrl }
59
- onClick={ preventDefault }
60
- >
61
- <RichText
62
- identifier="label"
63
- className="wp-block-home-link__label"
64
- value={ label }
65
- onChange={ ( labelValue ) => {
66
- setAttributes( { label: labelValue } );
67
- } }
68
- aria-label={ __( 'Home link text' ) }
69
- placeholder={ __( 'Add home link' ) }
70
- withoutInteractiveFormatting
71
- allowedFormats={ [
72
- 'core/bold',
73
- 'core/italic',
74
- 'core/image',
75
- 'core/strikethrough',
76
- ] }
77
- />
78
- </a>
79
- </div>
80
- </>
38
+ <div { ...blockProps }>
39
+ <a
40
+ className="wp-block-home-link__content wp-block-navigation-item__content"
41
+ href={ homeUrl }
42
+ onClick={ preventDefault }
43
+ >
44
+ <RichText
45
+ identifier="label"
46
+ className="wp-block-home-link__label"
47
+ value={ attributes.label ?? __( 'Home' ) }
48
+ onChange={ ( labelValue ) => {
49
+ setAttributes( { label: labelValue } );
50
+ } }
51
+ aria-label={ __( 'Home link text' ) }
52
+ placeholder={ __( 'Add home link' ) }
53
+ withoutInteractiveFormatting
54
+ allowedFormats={ [
55
+ 'core/bold',
56
+ 'core/italic',
57
+ 'core/image',
58
+ 'core/strikethrough',
59
+ ] }
60
+ />
61
+ </a>
62
+ </div>
81
63
  );
82
64
  }
@@ -137,9 +137,6 @@ function block_core_home_link_build_li_wrapper_attributes( $context ) {
137
137
  */
138
138
  function render_block_core_home_link( $attributes, $content, $block ) {
139
139
  if ( empty( $attributes['label'] ) ) {
140
- // Using a fallback for the label attribute allows rendering the block even if no attributes have been set,
141
- // e.g. when using the block as a hooked block.
142
- // Note that the fallback value needs to be kept in sync with the one set in `edit.js` (upon first loading the block in the editor).
143
140
  $attributes['label'] = __( 'Home' );
144
141
  }
145
142
  $aria_current = '';