@wordpress/block-library 9.21.0 → 9.22.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 (143) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/cover/index.js +1 -1
  3. package/build/cover/index.js.map +1 -1
  4. package/build/details/edit.js +1 -5
  5. package/build/details/edit.js.map +1 -1
  6. package/build/details/index.js +1 -1
  7. package/build/details/index.js.map +1 -1
  8. package/build/navigation/view.js +2 -1
  9. package/build/navigation/view.js.map +1 -1
  10. package/build/navigation-link/edit.js +0 -21
  11. package/build/navigation-link/edit.js.map +1 -1
  12. package/build/navigation-link/index.js +0 -3
  13. package/build/navigation-link/index.js.map +1 -1
  14. package/build/navigation-link/transforms.js +0 -2
  15. package/build/navigation-link/transforms.js.map +1 -1
  16. package/build/navigation-link/update-attributes.js +0 -1
  17. package/build/navigation-link/update-attributes.js.map +1 -1
  18. package/build/navigation-submenu/edit.js +1 -24
  19. package/build/navigation-submenu/edit.js.map +1 -1
  20. package/build/navigation-submenu/index.js +0 -3
  21. package/build/navigation-submenu/index.js.map +1 -1
  22. package/build/post-comments-count/index.js +0 -1
  23. package/build/post-comments-count/index.js.map +1 -1
  24. package/build/post-comments-link/index.js +0 -1
  25. package/build/post-comments-link/index.js.map +1 -1
  26. package/build/post-featured-image/edit.js +15 -5
  27. package/build/post-featured-image/edit.js.map +1 -1
  28. package/build/query/edit/inspector-controls/index.js +47 -59
  29. package/build/query/edit/inspector-controls/index.js.map +1 -1
  30. package/build/query/edit/inspector-controls/parent-control.js +2 -2
  31. package/build/query/edit/inspector-controls/parent-control.js.map +1 -1
  32. package/build/query/edit/inspector-controls/taxonomy-controls.js +2 -2
  33. package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  34. package/build/query/edit/query-content.js +4 -17
  35. package/build/query/edit/query-content.js.map +1 -1
  36. package/build/quote/index.js +1 -1
  37. package/build/quote/index.js.map +1 -1
  38. package/build/social-links/edit.js +29 -31
  39. package/build/social-links/edit.js.map +1 -1
  40. package/build/table/index.js +3 -3
  41. package/build/table/index.js.map +1 -1
  42. package/build/table/transforms.js +11 -3
  43. package/build/table/transforms.js.map +1 -1
  44. package/build/table-of-contents/edit.js +1 -1
  45. package/build/table-of-contents/edit.js.map +1 -1
  46. package/build/table-of-contents/hooks.js +6 -3
  47. package/build/table-of-contents/hooks.js.map +1 -1
  48. package/build-module/cover/index.js +1 -1
  49. package/build-module/cover/index.js.map +1 -1
  50. package/build-module/details/edit.js +1 -5
  51. package/build-module/details/edit.js.map +1 -1
  52. package/build-module/details/index.js +1 -1
  53. package/build-module/details/index.js.map +1 -1
  54. package/build-module/navigation/view.js +2 -1
  55. package/build-module/navigation/view.js.map +1 -1
  56. package/build-module/navigation-link/edit.js +0 -21
  57. package/build-module/navigation-link/edit.js.map +1 -1
  58. package/build-module/navigation-link/index.js +0 -3
  59. package/build-module/navigation-link/index.js.map +1 -1
  60. package/build-module/navigation-link/transforms.js +0 -2
  61. package/build-module/navigation-link/transforms.js.map +1 -1
  62. package/build-module/navigation-link/update-attributes.js +0 -1
  63. package/build-module/navigation-link/update-attributes.js.map +1 -1
  64. package/build-module/navigation-submenu/edit.js +1 -24
  65. package/build-module/navigation-submenu/edit.js.map +1 -1
  66. package/build-module/navigation-submenu/index.js +0 -3
  67. package/build-module/navigation-submenu/index.js.map +1 -1
  68. package/build-module/post-comments-count/index.js +0 -1
  69. package/build-module/post-comments-count/index.js.map +1 -1
  70. package/build-module/post-comments-link/index.js +0 -1
  71. package/build-module/post-comments-link/index.js.map +1 -1
  72. package/build-module/post-featured-image/edit.js +15 -5
  73. package/build-module/post-featured-image/edit.js.map +1 -1
  74. package/build-module/query/edit/inspector-controls/index.js +49 -61
  75. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  76. package/build-module/query/edit/inspector-controls/parent-control.js +2 -2
  77. package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -1
  78. package/build-module/query/edit/inspector-controls/taxonomy-controls.js +2 -2
  79. package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  80. package/build-module/query/edit/query-content.js +4 -17
  81. package/build-module/query/edit/query-content.js.map +1 -1
  82. package/build-module/quote/index.js +1 -1
  83. package/build-module/quote/index.js.map +1 -1
  84. package/build-module/social-links/edit.js +30 -32
  85. package/build-module/social-links/edit.js.map +1 -1
  86. package/build-module/table/index.js +3 -3
  87. package/build-module/table/index.js.map +1 -1
  88. package/build-module/table/transforms.js +11 -3
  89. package/build-module/table/transforms.js.map +1 -1
  90. package/build-module/table-of-contents/edit.js +1 -1
  91. package/build-module/table-of-contents/edit.js.map +1 -1
  92. package/build-module/table-of-contents/hooks.js +6 -3
  93. package/build-module/table-of-contents/hooks.js.map +1 -1
  94. package/build-style/editor-rtl.css +1 -50
  95. package/build-style/editor.css +1 -50
  96. package/build-style/media-text/style-rtl.css +0 -2
  97. package/build-style/media-text/style.css +0 -2
  98. package/build-style/search/style-rtl.css +1 -0
  99. package/build-style/search/style.css +1 -0
  100. package/build-style/social-links/editor-rtl.css +1 -50
  101. package/build-style/social-links/editor.css +1 -50
  102. package/build-style/style-rtl.css +1 -6
  103. package/build-style/style.css +1 -6
  104. package/build-style/tag-cloud/style-rtl.css +0 -4
  105. package/build-style/tag-cloud/style.css +0 -4
  106. package/package.json +35 -35
  107. package/src/button/index.php +2 -3
  108. package/src/cover/index.js +1 -1
  109. package/src/details/edit.js +6 -8
  110. package/src/details/index.js +1 -1
  111. package/src/file/index.php +2 -3
  112. package/src/latest-comments/index.php +1 -1
  113. package/src/latest-posts/index.php +3 -0
  114. package/src/media-text/style.scss +0 -2
  115. package/src/navigation/index.php +1 -1
  116. package/src/navigation/view.js +2 -1
  117. package/src/navigation-link/block.json +0 -3
  118. package/src/navigation-link/edit.js +1 -22
  119. package/src/navigation-link/index.php +1 -5
  120. package/src/navigation-link/transforms.js +1 -2
  121. package/src/navigation-link/update-attributes.js +0 -1
  122. package/src/navigation-submenu/block.json +0 -3
  123. package/src/navigation-submenu/edit.js +1 -24
  124. package/src/navigation-submenu/index.php +0 -4
  125. package/src/post-comments-count/block.json +0 -1
  126. package/src/post-comments-count/index.php +4 -0
  127. package/src/post-comments-link/block.json +0 -1
  128. package/src/post-comments-link/index.php +4 -0
  129. package/src/post-featured-image/edit.js +94 -77
  130. package/src/query/edit/inspector-controls/index.js +66 -91
  131. package/src/query/edit/inspector-controls/parent-control.js +2 -2
  132. package/src/query/edit/inspector-controls/taxonomy-controls.js +2 -2
  133. package/src/query/edit/query-content.js +7 -16
  134. package/src/quote/index.js +1 -1
  135. package/src/search/index.php +12 -9
  136. package/src/search/style.scss +1 -0
  137. package/src/social-links/edit.js +29 -30
  138. package/src/social-links/editor.scss +1 -59
  139. package/src/table/index.js +3 -3
  140. package/src/table/transforms.js +14 -2
  141. package/src/table-of-contents/edit.js +1 -1
  142. package/src/table-of-contents/hooks.js +5 -2
  143. package/src/tag-cloud/style.scss +0 -5
@@ -10,9 +10,7 @@
10
10
  *
11
11
  * @since 6.3.0 Using block.json `viewScript` to register script, and update `view_script_handles()` only when needed.
12
12
  *
13
- * @param array $attributes The block attributes.
14
- * @param string $content The saved content.
15
- * @param WP_Block $block The parsed block.
13
+ * @param array $attributes The block attributes.
16
14
  *
17
15
  * @return string The search block markup.
18
16
  */
@@ -152,17 +150,22 @@ function render_block_core_search( $attributes ) {
152
150
  }
153
151
  }
154
152
 
155
- $field_markup_classes = $is_button_inside ? $border_color_classes : '';
156
- $field_markup = sprintf(
157
- '<div class="wp-block-search__inside-wrapper %s" %s>%s</div>',
158
- esc_attr( $field_markup_classes ),
153
+ $field_markup_classes = array(
154
+ 'wp-block-search__inside-wrapper',
155
+ );
156
+ if ( $is_button_inside && ! empty( $border_color_classes ) ) {
157
+ $field_markup_classes[] = $border_color_classes;
158
+ }
159
+ $field_markup = sprintf(
160
+ '<div class="%s" %s>%s</div>',
161
+ esc_attr( implode( ' ', $field_markup_classes ) ),
159
162
  $inline_styles['wrapper'],
160
163
  $input . $query_params_markup . $button
161
164
  );
162
- $wrapper_attributes = get_block_wrapper_attributes(
165
+ $wrapper_attributes = get_block_wrapper_attributes(
163
166
  array( 'class' => $classnames )
164
167
  );
165
- $form_directives = '';
168
+ $form_directives = '';
166
169
 
167
170
  // If it's interactive, add the directives.
168
171
  if ( $is_expandable_searchfield ) {
@@ -110,6 +110,7 @@ $button-spacing-y: math.div($grid-unit-15, 2); // 6px
110
110
  :where(.wp-block-search__button-inside .wp-block-search__inside-wrapper) {
111
111
  padding: $grid-unit-05;
112
112
  border: 1px solid $gray-600;
113
+ background-color: $white;
113
114
  box-sizing: border-box;
114
115
 
115
116
  .wp-block-search__input {
@@ -6,7 +6,7 @@ import clsx from 'clsx';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { useEffect, useRef } from '@wordpress/element';
9
+ import { useEffect } from '@wordpress/element';
10
10
  import {
11
11
  BlockControls,
12
12
  useInnerBlocksProps,
@@ -57,16 +57,21 @@ export function SocialLinksEdit( props ) {
57
57
 
58
58
  const {
59
59
  iconBackgroundColorValue,
60
- customIconBackgroundColor,
61
60
  iconColorValue,
62
61
  openInNewTab,
63
62
  showLabels,
64
63
  size,
65
64
  } = attributes;
66
65
 
67
- const hasSelectedChild = useSelect(
68
- ( select ) =>
69
- select( blockEditorStore ).hasSelectedInnerBlock( clientId ),
66
+ const { hasSocialIcons, hasSelectedChild } = useSelect(
67
+ ( select ) => {
68
+ const { getBlockCount, hasSelectedInnerBlock } =
69
+ select( blockEditorStore );
70
+ return {
71
+ hasSocialIcons: getBlockCount( clientId ) > 0,
72
+ hasSelectedChild: hasSelectedInnerBlock( clientId ),
73
+ };
74
+ },
70
75
  [ clientId ]
71
76
  );
72
77
 
@@ -78,33 +83,25 @@ export function SocialLinksEdit( props ) {
78
83
 
79
84
  // Remove icon background color when logos only style is selected or
80
85
  // restore it when any other style is selected.
81
- const backgroundBackupRef = useRef( {} );
82
86
  useEffect( () => {
83
87
  if ( logosOnly ) {
84
- backgroundBackupRef.current = {
85
- iconBackgroundColor,
86
- iconBackgroundColorValue,
87
- customIconBackgroundColor,
88
- };
89
- setAttributes( {
90
- iconBackgroundColor: undefined,
91
- customIconBackgroundColor: undefined,
92
- iconBackgroundColorValue: undefined,
88
+ let restore;
89
+ setAttributes( ( prev ) => {
90
+ restore = {
91
+ iconBackgroundColor: prev.iconBackgroundColor,
92
+ iconBackgroundColorValue: prev.iconBackgroundColorValue,
93
+ customIconBackgroundColor: prev.customIconBackgroundColor,
94
+ };
95
+ return {
96
+ iconBackgroundColor: undefined,
97
+ iconBackgroundColorValue: undefined,
98
+ customIconBackgroundColor: undefined,
99
+ };
93
100
  } );
94
- } else {
95
- setAttributes( { ...backgroundBackupRef.current } );
96
- }
97
- }, [ logosOnly ] );
98
101
 
99
- const SocialPlaceholder = (
100
- <li className="wp-block-social-links__social-placeholder">
101
- <div className="wp-block-social-links__social-placeholder-icons">
102
- <div className="wp-social-link wp-social-link-twitter"></div>
103
- <div className="wp-social-link wp-social-link-facebook"></div>
104
- <div className="wp-social-link wp-social-link-instagram"></div>
105
- </div>
106
- </li>
107
- );
102
+ return () => setAttributes( { ...restore } );
103
+ }
104
+ }, [ logosOnly, setAttributes ] );
108
105
 
109
106
  // Fallback color values are used maintain selections in case switching
110
107
  // themes and named colors in palette do not match.
@@ -117,11 +114,13 @@ export function SocialLinksEdit( props ) {
117
114
 
118
115
  const blockProps = useBlockProps( { className } );
119
116
  const innerBlocksProps = useInnerBlocksProps( blockProps, {
120
- placeholder: ! isSelected && SocialPlaceholder,
121
117
  templateLock: false,
122
118
  orientation: attributes.layout?.orientation ?? 'horizontal',
123
119
  __experimentalAppenderTagName: 'li',
124
- renderAppender: hasAnySelected && InnerBlocks.ButtonBlockAppender,
120
+ renderAppender:
121
+ ! hasSocialIcons || hasAnySelected
122
+ ? InnerBlocks.ButtonBlockAppender
123
+ : undefined,
125
124
  } );
126
125
 
127
126
  const POPOVER_PROPS = {
@@ -12,67 +12,9 @@
12
12
 
13
13
  // Specificity for the following styles are fixed at 0-1-0 to match and be
14
14
  // overridable by global styles.
15
- :root :where(.wp-block-social-links),
16
- :root :where(.wp-block-social-links.is-style-logos-only .wp-block-social-links__social-placeholder .wp-social-link) {
15
+ :root :where(.wp-block-social-links) {
17
16
  padding: 0;
18
17
  }
19
- :root :where(.wp-block-social-links__social-placeholder .wp-social-link) {
20
- padding: 0.25em;
21
- }
22
- :root :where(.wp-block-social-links.is-style-pill-shape .wp-block-social-links__social-placeholder .wp-social-link) {
23
- padding-left: calc((2/3) * 1em);
24
- padding-right: calc((2/3) * 1em);
25
- }
26
-
27
- // Placeholder/setup state.
28
- .wp-block-social-links__social-placeholder {
29
- display: flex;
30
- opacity: 0.8;
31
- list-style: none;
32
-
33
- // Use the first link to set the height.
34
- > .wp-social-link {
35
- // Use !important to keep the selector simple.
36
- padding-left: 0 !important;
37
- margin-left: 0 !important;
38
- padding-right: 0 !important;
39
- margin-right: 0 !important;
40
- width: 0 !important;
41
- visibility: hidden;
42
- }
43
-
44
- // Wrap the remaining placeholders in a container so the plus can overlap.
45
- > .wp-block-social-links__social-placeholder-icons {
46
- display: flex;
47
- }
48
-
49
- .wp-social-link::before {
50
- content: "";
51
- display: block;
52
- width: 1em;
53
- height: 1em;
54
- border-radius: $radius-round;
55
-
56
- .is-style-logos-only & {
57
- background: currentColor;
58
- }
59
- }
60
- }
61
-
62
- // Selected placeholder state.
63
- .wp-block-social-links .wp-block-social-links__social-prompt {
64
- min-height: $button-size-small;
65
- list-style: none;
66
-
67
- // Show as block UI.
68
- font-family: $default-font;
69
- font-size: $default-font-size;
70
- line-height: $button-size-small;
71
- margin-top: auto;
72
- margin-bottom: auto;
73
- cursor: default;
74
- padding-right: $grid-unit-10;
75
- }
76
18
 
77
19
  // Center flex items. This has an equivalent in style.scss.
78
20
  .wp-block[data-align="center"] > .wp-block-social-links,
@@ -48,7 +48,7 @@ export const settings = {
48
48
  tag: 'td',
49
49
  },
50
50
  {
51
- content: 'Jaco Pastorius',
51
+ content: __( 'Jaco Pastorius' ),
52
52
  tag: 'td',
53
53
  },
54
54
  {
@@ -64,7 +64,7 @@ export const settings = {
64
64
  tag: 'td',
65
65
  },
66
66
  {
67
- content: 'Betty Carter',
67
+ content: __( 'Betty Carter' ),
68
68
  tag: 'td',
69
69
  },
70
70
  {
@@ -80,7 +80,7 @@ export const settings = {
80
80
  tag: 'td',
81
81
  },
82
82
  {
83
- content: 'Bebo Valdés',
83
+ content: __( 'Bebo Valdés' ),
84
84
  tag: 'td',
85
85
  },
86
86
  {
@@ -15,12 +15,12 @@ const tableContentPasteSchema = ( { phrasingContentSchema } ) => ( {
15
15
  th: {
16
16
  allowEmpty: true,
17
17
  children: phrasingContentSchema,
18
- attributes: [ 'scope', 'colspan', 'rowspan' ],
18
+ attributes: [ 'scope', 'colspan', 'rowspan', 'style' ],
19
19
  },
20
20
  td: {
21
21
  allowEmpty: true,
22
22
  children: phrasingContentSchema,
23
- attributes: [ 'colspan', 'rowspan' ],
23
+ attributes: [ 'colspan', 'rowspan', 'style' ],
24
24
  },
25
25
  },
26
26
  },
@@ -79,11 +79,23 @@ const transforms = {
79
79
  col.getAttribute( 'colspan' )
80
80
  );
81
81
 
82
+ const { textAlign } = col.style || {};
83
+
84
+ let align;
85
+ if (
86
+ textAlign === 'left' ||
87
+ textAlign === 'center' ||
88
+ textAlign === 'right'
89
+ ) {
90
+ align = textAlign;
91
+ }
92
+
82
93
  colAcc.push( {
83
94
  tag: col.nodeName.toLowerCase(),
84
95
  content: col.innerHTML,
85
96
  rowspan,
86
97
  colspan,
98
+ align,
87
99
  } );
88
100
 
89
101
  return colAcc;
@@ -176,7 +176,7 @@ export default function TableOfContentsEdit( {
176
176
  } )
177
177
  }
178
178
  help={
179
- maxLevel
179
+ ! maxLevel
180
180
  ? __(
181
181
  'Including all heading levels in the table of contents.'
182
182
  )
@@ -148,8 +148,11 @@ function observeCallback( select, dispatch, clientId ) {
148
148
 
149
149
  const headings = getLatestHeadings( select, clientId );
150
150
  if ( ! fastDeepEqual( headings, attributes.headings ) ) {
151
- __unstableMarkNextChangeAsNotPersistent();
152
- updateBlockAttributes( clientId, { headings } );
151
+ // Executing the update in a microtask ensures that the non-persistent marker doesn't affect an attribute triggering the change.
152
+ window.queueMicrotask( () => {
153
+ __unstableMarkNextChangeAsNotPersistent();
154
+ updateBlockAttributes( clientId, { headings } );
155
+ } );
153
156
  }
154
157
  }
155
158
 
@@ -7,11 +7,6 @@
7
7
  justify-content: center;
8
8
  }
9
9
 
10
- &.alignfull {
11
- padding-left: 1em;
12
- padding-right: 1em;
13
- }
14
-
15
10
  a {
16
11
  display: inline-block;
17
12
  margin-right: 5px;