@wordpress/block-library 9.0.3 → 9.0.5

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 (80) hide show
  1. package/build/block/index.js +5 -1
  2. package/build/block/index.js.map +1 -1
  3. package/build/image/image.js +14 -15
  4. package/build/image/image.js.map +1 -1
  5. package/build/list-item/hooks/use-merge.js +8 -1
  6. package/build/list-item/hooks/use-merge.js.map +1 -1
  7. package/build/media-text/edit.js +3 -2
  8. package/build/media-text/edit.js.map +1 -1
  9. package/build/query/edit/inspector-controls/index.js +3 -2
  10. package/build/query/edit/inspector-controls/index.js.map +1 -1
  11. package/build/utils/hooks.js +12 -0
  12. package/build/utils/hooks.js.map +1 -1
  13. package/build-module/block/index.js +5 -1
  14. package/build-module/block/index.js.map +1 -1
  15. package/build-module/image/image.js +9 -10
  16. package/build-module/image/image.js.map +1 -1
  17. package/build-module/list-item/hooks/use-merge.js +8 -1
  18. package/build-module/list-item/hooks/use-merge.js.map +1 -1
  19. package/build-module/media-text/edit.js +3 -2
  20. package/build-module/media-text/edit.js.map +1 -1
  21. package/build-module/query/edit/inspector-controls/index.js +3 -2
  22. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  23. package/build-module/utils/hooks.js +11 -0
  24. package/build-module/utils/hooks.js.map +1 -1
  25. package/build-style/audio/style-rtl.css +1 -1
  26. package/build-style/audio/style.css +1 -1
  27. package/build-style/audio/theme-rtl.css +2 -2
  28. package/build-style/audio/theme.css +2 -2
  29. package/build-style/editor-rtl.css +0 -12
  30. package/build-style/editor.css +0 -12
  31. package/build-style/embed/style-rtl.css +1 -1
  32. package/build-style/embed/style.css +1 -1
  33. package/build-style/embed/theme-rtl.css +2 -2
  34. package/build-style/embed/theme.css +2 -2
  35. package/build-style/image/editor-rtl.css +0 -12
  36. package/build-style/image/editor.css +0 -12
  37. package/build-style/image/style-rtl.css +1 -1
  38. package/build-style/image/style.css +1 -1
  39. package/build-style/navigation/style-rtl.css +1 -0
  40. package/build-style/navigation/style.css +1 -0
  41. package/build-style/reset-rtl.css +1 -5
  42. package/build-style/reset.css +1 -5
  43. package/build-style/social-links/style-rtl.css +91 -91
  44. package/build-style/social-links/style.css +91 -91
  45. package/build-style/style-rtl.css +96 -95
  46. package/build-style/style.css +96 -95
  47. package/build-style/table/theme-rtl.css +2 -2
  48. package/build-style/table/theme.css +2 -2
  49. package/build-style/theme-rtl.css +8 -8
  50. package/build-style/theme.css +8 -8
  51. package/build-style/video/style-rtl.css +1 -1
  52. package/build-style/video/style.css +1 -1
  53. package/build-style/video/theme-rtl.css +2 -2
  54. package/build-style/video/theme.css +2 -2
  55. package/package.json +12 -12
  56. package/src/audio/style.scss +1 -1
  57. package/src/audio/theme.scss +1 -1
  58. package/src/block/block.json +5 -1
  59. package/src/embed/style.scss +1 -1
  60. package/src/embed/theme.scss +1 -1
  61. package/src/image/editor.scss +0 -13
  62. package/src/image/image.js +21 -11
  63. package/src/image/style.scss +1 -1
  64. package/src/list-item/hooks/use-merge.js +19 -5
  65. package/src/media-text/edit.js +3 -2
  66. package/src/media-text/index.php +68 -18
  67. package/src/navigation/index.php +5 -3
  68. package/src/navigation/style.scss +1 -0
  69. package/src/query/edit/inspector-controls/index.js +3 -2
  70. package/src/reset.scss +11 -12
  71. package/src/social-links/style.scss +2 -2
  72. package/src/table/theme.scss +1 -1
  73. package/src/utils/hooks.js +14 -0
  74. package/src/video/style.scss +1 -1
  75. package/src/video/theme.scss +1 -1
  76. package/build/utils/constants.js +0 -15
  77. package/build/utils/constants.js.map +0 -1
  78. package/build-module/utils/constants.js +0 -9
  79. package/build-module/utils/constants.js.map +0 -1
  80. package/src/utils/constants.js +0 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-library",
3
- "version": "9.0.3",
3
+ "version": "9.0.5",
4
4
  "description": "Block library for the WordPress editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -36,11 +36,11 @@
36
36
  "@wordpress/api-fetch": "^7.0.1",
37
37
  "@wordpress/autop": "^4.0.1",
38
38
  "@wordpress/blob": "^4.0.1",
39
- "@wordpress/block-editor": "^13.0.2",
40
- "@wordpress/blocks": "^13.0.2",
41
- "@wordpress/components": "^28.0.2",
39
+ "@wordpress/block-editor": "^13.0.4",
40
+ "@wordpress/blocks": "^13.0.3",
41
+ "@wordpress/components": "^28.0.3",
42
42
  "@wordpress/compose": "^7.0.1",
43
- "@wordpress/core-data": "^7.0.2",
43
+ "@wordpress/core-data": "^7.0.4",
44
44
  "@wordpress/data": "^10.0.2",
45
45
  "@wordpress/date": "^5.0.1",
46
46
  "@wordpress/deprecated": "^4.0.1",
@@ -50,18 +50,18 @@
50
50
  "@wordpress/hooks": "^4.0.1",
51
51
  "@wordpress/html-entities": "^4.0.1",
52
52
  "@wordpress/i18n": "^5.0.1",
53
- "@wordpress/icons": "^10.0.1",
54
- "@wordpress/interactivity": "^6.0.1",
55
- "@wordpress/interactivity-router": "^2.0.1",
53
+ "@wordpress/icons": "^10.0.2",
54
+ "@wordpress/interactivity": "^6.0.2",
55
+ "@wordpress/interactivity-router": "^2.0.2",
56
56
  "@wordpress/keyboard-shortcuts": "^5.0.2",
57
57
  "@wordpress/keycodes": "^4.0.1",
58
58
  "@wordpress/notices": "^5.0.2",
59
- "@wordpress/patterns": "^2.0.2",
59
+ "@wordpress/patterns": "^2.0.4",
60
60
  "@wordpress/primitives": "^4.0.1",
61
61
  "@wordpress/private-apis": "^1.0.2",
62
- "@wordpress/reusable-blocks": "^5.0.2",
62
+ "@wordpress/reusable-blocks": "^5.0.4",
63
63
  "@wordpress/rich-text": "^7.0.2",
64
- "@wordpress/server-side-render": "^5.0.2",
64
+ "@wordpress/server-side-render": "^5.0.3",
65
65
  "@wordpress/url": "^4.0.1",
66
66
  "@wordpress/viewport": "^6.0.2",
67
67
  "@wordpress/wordcount": "^4.0.1",
@@ -82,5 +82,5 @@
82
82
  "publishConfig": {
83
83
  "access": "public"
84
84
  },
85
- "gitHead": "d0d80eabf45745725edbb19ce6667157fc68a6aa"
85
+ "gitHead": "85486692a3e48b7d863226cf895a21d787434921"
86
86
  }
@@ -4,7 +4,7 @@
4
4
  // Supply caption styles to audio blocks, even if the theme hasn't opted in.
5
5
  // Reason being: the new markup, <figcaptions>, are not likely to be styled in the majority of existing themes,
6
6
  // so we supply the styles so as to not appear broken or unstyled in those themes.
7
- figcaption {
7
+ :where(figcaption) {
8
8
  @include caption-style();
9
9
  }
10
10
 
@@ -1,4 +1,4 @@
1
- .wp-block-audio figcaption {
1
+ .wp-block-audio :where(figcaption) {
2
2
  @include caption-style-theme();
3
3
  }
4
4
 
@@ -12,9 +12,13 @@
12
12
  "type": "number"
13
13
  },
14
14
  "content": {
15
- "type": "object"
15
+ "type": "object",
16
+ "default": {}
16
17
  }
17
18
  },
19
+ "providesContext": {
20
+ "pattern/overrides": "content"
21
+ },
18
22
  "supports": {
19
23
  "customClassName": false,
20
24
  "html": false,
@@ -25,7 +25,7 @@
25
25
  // Supply caption styles to embeds, even if the theme hasn't opted in.
26
26
  // Reason being: the new markup, figcaptions, are not likely to be styled in the majority of existing themes,
27
27
  // so we supply the styles so as to not appear broken or unstyled in those.
28
- figcaption {
28
+ :where(figcaption) {
29
29
  @include caption-style();
30
30
  }
31
31
 
@@ -1,4 +1,4 @@
1
- .wp-block-embed figcaption {
1
+ .wp-block-embed :where(figcaption) {
2
2
  @include caption-style-theme();
3
3
  }
4
4
 
@@ -176,19 +176,6 @@ figure.wp-block-image:not(.wp-block) {
176
176
  }
177
177
  }
178
178
 
179
- .wp-block-image__aspect-ratio {
180
- height: $grid-unit-60 - $border-width - $border-width;
181
- margin-bottom: -$grid-unit-10;
182
- display: flex;
183
- align-items: center;
184
-
185
- .components-button {
186
- width: $button-size;
187
- padding-left: 0;
188
- padding-right: 0;
189
- }
190
- }
191
-
192
179
  .wp-block-image__toolbar_content_textarea {
193
180
  // Corresponds to the size of the textarea in the block inspector.
194
181
  width: 250px;
@@ -49,7 +49,7 @@ import { Caption } from '../utils/caption';
49
49
  /**
50
50
  * Module constants
51
51
  */
52
- import { TOOLSPANEL_DROPDOWNMENU_PROPS } from '../utils/constants';
52
+ import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
53
53
  import { MIN_SIZE, ALLOWED_MEDIA_TYPES } from './constants';
54
54
  import { evalAspectRatio } from './utils';
55
55
 
@@ -373,6 +373,8 @@ export default function Image( {
373
373
  const lightboxChecked =
374
374
  !! lightbox?.enabled || ( ! lightbox && !! lightboxSetting?.enabled );
375
375
 
376
+ const dropdownMenuProps = useToolsPanelDropdownMenuProps();
377
+
376
378
  const dimensionsControl = (
377
379
  <DimensionsTool
378
380
  value={ { width, height, scale, aspectRatio } }
@@ -419,13 +421,16 @@ export default function Image( {
419
421
  <ToolsPanel
420
422
  label={ __( 'Settings' ) }
421
423
  resetAll={ resetAll }
422
- dropdownMenuProps={ TOOLSPANEL_DROPDOWNMENU_PROPS }
424
+ dropdownMenuProps={ dropdownMenuProps }
423
425
  >
424
426
  { isResizable && dimensionsControl }
425
427
  </ToolsPanel>
426
428
  </InspectorControls>
427
429
  );
428
430
 
431
+ const arePatternOverridesEnabled =
432
+ metadata?.bindings?.__default?.source === 'core/pattern-overrides';
433
+
429
434
  const {
430
435
  lockUrlControls = false,
431
436
  lockHrefControls = false,
@@ -440,16 +445,12 @@ export default function Image( {
440
445
  return {};
441
446
  }
442
447
  const { getBlockBindingsSource } = unlock( select( blocksStore ) );
443
- const { getBlockParentsByBlockName } = unlock(
444
- select( blockEditorStore )
445
- );
446
448
  const {
447
449
  url: urlBinding,
448
450
  alt: altBinding,
449
451
  title: titleBinding,
450
452
  } = metadata?.bindings || {};
451
- const hasParentPattern =
452
- getBlockParentsByBlockName( clientId, 'core/block' ).length > 0;
453
+ const hasParentPattern = !! context[ 'pattern/overrides' ];
453
454
  const urlBindingSource = getBlockBindingsSource(
454
455
  urlBinding?.source
455
456
  );
@@ -470,7 +471,7 @@ export default function Image( {
470
471
  lockHrefControls:
471
472
  // Disable editing the link of the URL if the image is inside a pattern instance.
472
473
  // This is a temporary solution until we support overriding the link on the frontend.
473
- hasParentPattern,
474
+ hasParentPattern || arePatternOverridesEnabled,
474
475
  lockCaption:
475
476
  // Disable editing the caption if the image is inside a pattern instance.
476
477
  // This is a temporary solution until we support overriding the caption on the frontend.
@@ -505,7 +506,12 @@ export default function Image( {
505
506
  : __( 'Connected to dynamic data' ),
506
507
  };
507
508
  },
508
- [ clientId, isSingleSelected, metadata?.bindings ]
509
+ [
510
+ arePatternOverridesEnabled,
511
+ context,
512
+ isSingleSelected,
513
+ metadata?.bindings,
514
+ ]
509
515
  );
510
516
 
511
517
  const showUrlInput =
@@ -688,7 +694,7 @@ export default function Image( {
688
694
  <ToolsPanel
689
695
  label={ __( 'Settings' ) }
690
696
  resetAll={ resetAll }
691
- dropdownMenuProps={ TOOLSPANEL_DROPDOWNMENU_PROPS }
697
+ dropdownMenuProps={ dropdownMenuProps }
692
698
  >
693
699
  { isSingleSelected && (
694
700
  <ToolsPanelItem
@@ -971,7 +977,11 @@ export default function Image( {
971
977
  isSelected={ isSingleSelected }
972
978
  insertBlocksAfter={ insertBlocksAfter }
973
979
  label={ __( 'Image caption text' ) }
974
- showToolbarButton={ isSingleSelected && hasNonContentControls }
980
+ showToolbarButton={
981
+ isSingleSelected &&
982
+ hasNonContentControls &&
983
+ ! arePatternOverridesEnabled
984
+ }
975
985
  readOnly={ lockCaption }
976
986
  />
977
987
  </>
@@ -78,7 +78,7 @@
78
78
  // Supply caption styles to images, even if the theme hasn't opted in.
79
79
  // Reason being: the new markup, <figcaptions>, are not likely to be styled in the majority of existing themes,
80
80
  // so we supply the styles so as to not appear broken or unstyled in those themes.
81
- figcaption {
81
+ :where(figcaption) {
82
82
  @include caption-style();
83
83
  }
84
84
 
@@ -92,11 +92,25 @@ export default function useMerge( clientId, onMerge ) {
92
92
  // list.
93
93
  const [ nestedListClientId ] = getBlockOrder( clientIdB );
94
94
  if ( nestedListClientId ) {
95
- moveBlocksToPosition(
96
- getBlockOrder( nestedListClientId ),
97
- nestedListClientId,
98
- getBlockRootClientId( clientIdA )
99
- );
95
+ // If we are merging with the previous list item, and the
96
+ // previous list item does not have nested list, move the
97
+ // nested list to the previous list item.
98
+ if (
99
+ getPreviousBlockClientId( clientIdB ) === clientIdA &&
100
+ ! getBlockOrder( clientIdA ).length
101
+ ) {
102
+ moveBlocksToPosition(
103
+ [ nestedListClientId ],
104
+ clientIdB,
105
+ clientIdA
106
+ );
107
+ } else {
108
+ moveBlocksToPosition(
109
+ getBlockOrder( nestedListClientId ),
110
+ nestedListClientId,
111
+ getBlockRootClientId( clientIdA )
112
+ );
113
+ }
100
114
  }
101
115
  mergeBlocks( clientIdA, clientIdB );
102
116
  } );
@@ -46,7 +46,7 @@ import {
46
46
  TEMPLATE,
47
47
  } from './constants';
48
48
  import { unlock } from '../lock-unlock';
49
- import { TOOLSPANEL_DROPDOWNMENU_PROPS } from '../utils/constants';
49
+ import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
50
50
 
51
51
  const { ResolutionTool } = unlock( blockEditorPrivateApis );
52
52
 
@@ -276,6 +276,7 @@ function MediaTextEdit( {
276
276
  mediaSizeSlug: newMediaSizeSlug,
277
277
  } );
278
278
  };
279
+ const dropdownMenuProps = useToolsPanelDropdownMenuProps();
279
280
 
280
281
  const mediaTextGeneralSettings = (
281
282
  <ToolsPanel
@@ -290,7 +291,7 @@ function MediaTextEdit( {
290
291
  mediaSizeSlug: undefined,
291
292
  } );
292
293
  } }
293
- dropdownMenuProps={ TOOLSPANEL_DROPDOWNMENU_PROPS }
294
+ dropdownMenuProps={ dropdownMenuProps }
294
295
  >
295
296
  <ToolsPanelItem
296
297
  label={ __( 'Media width' ) }
@@ -29,28 +29,78 @@ function render_block_core_media_text( $attributes, $content ) {
29
29
  return $content;
30
30
  }
31
31
 
32
- $image_tag = '<figure class="wp-block-media-text__media"><img>';
33
- $content = preg_replace( '/<figure\s+class="wp-block-media-text__media">/', $image_tag, $content );
32
+ $media_tag_processor = new WP_HTML_Tag_Processor( $content );
33
+ $wrapping_figure_query = array(
34
+ 'tag_name' => 'figure',
35
+ 'class_name' => 'wp-block-media-text__media',
36
+ );
37
+ $has_media_on_right = isset( $attributes['mediaPosition'] ) && 'right' === $attributes['mediaPosition'];
38
+ $image_fill = isset( $attributes['imageFill'] ) && $attributes['imageFill'];
39
+ $focal_point = isset( $attributes['focalPoint'] ) ? round( $attributes['focalPoint']['x'] * 100 ) . '% ' . round( $attributes['focalPoint']['y'] * 100 ) . '%' : '50% 50%';
40
+ $unique_id = 'wp-block-media-text__media-' . wp_unique_id();
34
41
 
35
- $processor = new WP_HTML_Tag_Processor( $content );
36
- if ( isset( $attributes['imageFill'] ) && $attributes['imageFill'] ) {
37
- $position = '50% 50%';
38
- if ( isset( $attributes['focalPoint'] ) ) {
39
- $position = round( $attributes['focalPoint']['x'] * 100 ) . '% ' . round( $attributes['focalPoint']['y'] * 100 ) . '%';
42
+ if ( $has_media_on_right ) {
43
+ // Loop through all the figure tags and set a bookmark on the last figure tag.
44
+ while ( $media_tag_processor->next_tag( $wrapping_figure_query ) ) {
45
+ $media_tag_processor->set_bookmark( 'last_figure' );
46
+ }
47
+ if ( $media_tag_processor->has_bookmark( 'last_figure' ) ) {
48
+ $media_tag_processor->seek( 'last_figure' );
49
+ if ( $image_fill ) {
50
+ $media_tag_processor->set_attribute( 'style', 'background-image:url(' . esc_url( $current_featured_image ) . ');background-position:' . $focal_point . ';' );
51
+ } else {
52
+ // Insert a unique ID to identify the figure tag.
53
+ $media_tag_processor->set_attribute( 'id', $unique_id );
54
+ }
55
+ }
56
+ } else {
57
+ if ( $media_tag_processor->next_tag( $wrapping_figure_query ) ) {
58
+ if ( $image_fill ) {
59
+ $media_tag_processor->set_attribute( 'style', 'background-image:url(' . esc_url( $current_featured_image ) . ');background-position:' . $focal_point . ';' );
60
+ } else {
61
+ // Insert a unique ID to identify the figure tag.
62
+ $media_tag_processor->set_attribute( 'id', $unique_id );
63
+ }
40
64
  }
41
- $processor->next_tag( 'figure' );
42
- $processor->set_attribute( 'style', 'background-image:url(' . esc_url( $current_featured_image ) . ');background-position:' . $position . ';' );
43
- }
44
- $processor->next_tag( 'img' );
45
- $media_size_slug = 'full';
46
- if ( isset( $attributes['mediaSizeSlug'] ) ) {
47
- $media_size_slug = $attributes['mediaSizeSlug'];
48
65
  }
49
- $processor->set_attribute( 'src', esc_url( $current_featured_image ) );
50
- $processor->set_attribute( 'class', 'wp-image-' . get_post_thumbnail_id() . ' size-' . $media_size_slug );
51
- $processor->set_attribute( 'alt', trim( strip_tags( get_post_meta( get_post_thumbnail_id(), '_wp_attachment_image_alt', true ) ) ) );
52
66
 
53
- $content = $processor->get_updated_html();
67
+ $content = $media_tag_processor->get_updated_html();
68
+
69
+ // If the image is not set to fill, add the image tag inside the figure tag,
70
+ // and update the image attributes in order to display the featured image.
71
+ if ( ! $image_fill ) {
72
+ $media_size_slug = isset( $attributes['mediaSizeSlug'] ) ? $attributes['mediaSizeSlug'] : 'full';
73
+ $image_tag = '<img class="wp-block-media-text__featured_image">';
74
+ $content = preg_replace(
75
+ '/(<figure\s+id="' . preg_quote( $unique_id, '/' ) . '"\s+class="wp-block-media-text__media"\s*>)/',
76
+ '$1' . $image_tag,
77
+ $content
78
+ );
79
+
80
+ $image_tag_processor = new WP_HTML_Tag_Processor( $content );
81
+ if ( $image_tag_processor->next_tag(
82
+ array(
83
+ 'tag_name' => 'figure',
84
+ 'id' => $unique_id,
85
+ )
86
+ ) ) {
87
+ // The ID is only used to ensure that the correct figure tag is selected,
88
+ // and can now be removed.
89
+ $image_tag_processor->remove_attribute( 'id' );
90
+ if ( $image_tag_processor->next_tag(
91
+ array(
92
+ 'tag_name' => 'img',
93
+ 'class_name' => 'wp-block-media-text__featured_image',
94
+ )
95
+ ) ) {
96
+ $image_tag_processor->set_attribute( 'src', esc_url( $current_featured_image ) );
97
+ $image_tag_processor->set_attribute( 'class', 'wp-image-' . get_post_thumbnail_id() . ' size-' . $media_size_slug );
98
+ $image_tag_processor->set_attribute( 'alt', trim( strip_tags( get_post_meta( get_post_thumbnail_id(), '_wp_attachment_image_alt', true ) ) ) );
99
+
100
+ $content = $image_tag_processor->get_updated_html();
101
+ }
102
+ }
103
+ }
54
104
 
55
105
  return $content;
56
106
  }
@@ -519,9 +519,11 @@ class WP_Navigation_Block_Renderer {
519
519
  ';
520
520
  }
521
521
 
522
+ $overlay_inline_styles = esc_attr( safecss_filter_attr( $colors['overlay_inline_styles'] ) );
523
+
522
524
  return sprintf(
523
525
  '<button aria-haspopup="dialog" %3$s class="%6$s" %10$s>%8$s</button>
524
- <div class="%5$s" style="%7$s" id="%1$s" %11$s>
526
+ <div class="%5$s" %7$s id="%1$s" %11$s>
525
527
  <div class="wp-block-navigation__responsive-close" tabindex="-1">
526
528
  <div class="wp-block-navigation__responsive-dialog" %12$s>
527
529
  <button %4$s class="wp-block-navigation__responsive-container-close" %13$s>%9$s</button>
@@ -537,7 +539,7 @@ class WP_Navigation_Block_Renderer {
537
539
  $toggle_aria_label_close,
538
540
  esc_attr( implode( ' ', $responsive_container_classes ) ),
539
541
  esc_attr( implode( ' ', $open_button_classes ) ),
540
- esc_attr( safecss_filter_attr( $colors['overlay_inline_styles'] ) ),
542
+ ( ! empty( $overlay_inline_styles ) ) ? "style=\"$overlay_inline_styles\"" : '',
541
543
  $toggle_button_content,
542
544
  $toggle_close_button_content,
543
545
  $open_button_directives,
@@ -826,7 +828,7 @@ function block_core_navigation_add_directives_to_submenu( $tags, $block_attribut
826
828
  $tags->set_attribute( 'data-wp-interactive', 'core/navigation' );
827
829
  $tags->set_attribute( 'data-wp-context', '{ "submenuOpenedBy": { "click": false, "hover": false, "focus": false }, "type": "submenu" }' );
828
830
  $tags->set_attribute( 'data-wp-watch', 'callbacks.initMenu' );
829
- $tags->set_attribute( 'data-wp-on-async--focusout', 'actions.handleMenuFocusout' );
831
+ $tags->set_attribute( 'data-wp-on--focusout', 'actions.handleMenuFocusout' );
830
832
  $tags->set_attribute( 'data-wp-on--keydown', 'actions.handleMenuKeydown' );
831
833
 
832
834
  // This is a fix for Safari. Without it, Safari doesn't change the active
@@ -300,6 +300,7 @@ button.wp-block-navigation-item__content {
300
300
  color: currentColor;
301
301
  font-size: inherit;
302
302
  font-family: inherit;
303
+ letter-spacing: inherit;
303
304
  line-height: inherit;
304
305
  font-style: inherit;
305
306
  font-weight: inherit;
@@ -34,7 +34,7 @@ import {
34
34
  isControlAllowed,
35
35
  useTaxonomies,
36
36
  } from '../../utils';
37
- import { TOOLSPANEL_DROPDOWNMENU_PROPS } from '../../../utils/constants';
37
+ import { useToolsPanelDropdownMenuProps } from '../../../utils/hooks';
38
38
 
39
39
  const { BlockInfo } = unlock( blockEditorPrivateApis );
40
40
 
@@ -128,6 +128,7 @@ export default function QueryInspectorControls( props ) {
128
128
  showAuthorControl ||
129
129
  showSearchControl ||
130
130
  showParentControl;
131
+ const dropdownMenuProps = useToolsPanelDropdownMenuProps();
131
132
 
132
133
  return (
133
134
  <>
@@ -221,7 +222,7 @@ export default function QueryInspectorControls( props ) {
221
222
  } );
222
223
  setQuerySearch( '' );
223
224
  } }
224
- dropdownMenuProps={ TOOLSPANEL_DROPDOWNMENU_PROPS }
225
+ dropdownMenuProps={ dropdownMenuProps }
225
226
  >
226
227
  { showTaxControl && (
227
228
  <ToolsPanelItem
package/src/reset.scss CHANGED
@@ -8,19 +8,18 @@
8
8
  // We use :where to keep specificity minimal.
9
9
  // https://css-tricks.com/almanac/selectors/w/where/
10
10
  :where(.editor-styles-wrapper) {
11
- /**
12
- * The following styles revert to the browser defaults overriding the WPAdmin styles.
13
- * This is only needed while the block editor is not being loaded in an iframe.
14
- */
15
- font-family: serif; // unfortunately initial doesn't work for font-family.
16
- font-size: initial;
17
- line-height: initial;
18
- color: initial;
11
+ // The following styles revert to the browser defaults overriding the WPAdmin styles.
12
+ html & {
13
+ font-family: serif; // unfortunately initial doesn't work for font-family.
14
+ font-size: initial;
15
+ line-height: initial;
16
+ color: initial;
19
17
 
20
- // Many themes with white backgrounds load editor styles but fail to also provide
21
- // an explicit white background color, assuming a white editing canvas.
22
- // So to match browser defaults, we provide a white default here as well.
23
- background: #fff;
18
+ // Many themes with white backgrounds load editor styles but fail to also provide
19
+ // an explicit white background color, assuming a white editing canvas.
20
+ // So to match browser defaults, we provide a white default here as well.
21
+ background: #fff;
22
+ }
24
23
 
25
24
  .wp-align-wrapper {
26
25
  max-width: $content-width;
@@ -107,7 +107,7 @@
107
107
  }
108
108
 
109
109
  // Provide colors for a range of icons.
110
- .wp-block-social-links:not(.is-style-logos-only) {
110
+ :where(.wp-block-social-links:not(.is-style-logos-only)) {
111
111
  // Generic items such as mail, feed, etc.
112
112
  @import "../social-link/socials-with-bg.scss";
113
113
  }
@@ -116,7 +116,7 @@
116
116
  // The specificity for this selector has not been reduced to 0-1-0 as per
117
117
  // global styles variation selectors as the lack of background should be
118
118
  // enforced for this block style.
119
- .wp-block-social-links.is-style-logos-only {
119
+ :where(.wp-block-social-links.is-style-logos-only) {
120
120
  .wp-social-link {
121
121
  background: none;
122
122
 
@@ -6,7 +6,7 @@
6
6
  word-break: normal;
7
7
  }
8
8
 
9
- figcaption {
9
+ :where(figcaption) {
10
10
  @include caption-style-theme();
11
11
  }
12
12
  }
@@ -6,6 +6,7 @@ import { useLayoutEffect, useEffect, useRef } from '@wordpress/element';
6
6
  import { getBlobByURL, isBlobURL, revokeBlobURL } from '@wordpress/blob';
7
7
  import { store as blockEditorStore } from '@wordpress/block-editor';
8
8
  import { store as coreStore } from '@wordpress/core-data';
9
+ import { useViewportMatch } from '@wordpress/compose';
9
10
 
10
11
  /**
11
12
  * Returns whether the current user can edit the given entity.
@@ -84,3 +85,16 @@ export function useUploadMediaFromBlobURL( args = {} ) {
84
85
  } );
85
86
  }, [ getSettings ] );
86
87
  }
88
+
89
+ export function useToolsPanelDropdownMenuProps() {
90
+ const isMobile = useViewportMatch( 'medium', '<' );
91
+ return ! isMobile
92
+ ? {
93
+ popoverProps: {
94
+ placement: 'left-start',
95
+ // For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)
96
+ offset: 259,
97
+ },
98
+ }
99
+ : {};
100
+ }
@@ -19,7 +19,7 @@
19
19
  // Supply caption styles to videos, even if the theme hasn't opted in.
20
20
  // Reason being: the new markup, <figcaptions>, are not likely to be styled in the majority of existing themes,
21
21
  // so we supply the styles so as to not appear broken or unstyled in those themes.
22
- figcaption {
22
+ :where(figcaption) {
23
23
  @include caption-style();
24
24
  }
25
25
  }
@@ -1,4 +1,4 @@
1
- .wp-block-video figcaption {
1
+ .wp-block-video :where(figcaption) {
2
2
  @include caption-style-theme();
3
3
  }
4
4
 
@@ -1,15 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.TOOLSPANEL_DROPDOWNMENU_PROPS = void 0;
7
- // The following dropdown menu props aim to provide a consistent offset and
8
- // placement for ToolsPanel menus for block controls to match color popovers.
9
- const TOOLSPANEL_DROPDOWNMENU_PROPS = exports.TOOLSPANEL_DROPDOWNMENU_PROPS = {
10
- popoverProps: {
11
- placement: 'left-start',
12
- offset: 259 // Inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)
13
- }
14
- };
15
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["TOOLSPANEL_DROPDOWNMENU_PROPS","exports","popoverProps","placement","offset"],"sources":["@wordpress/block-library/src/utils/constants.js"],"sourcesContent":["// The following dropdown menu props aim to provide a consistent offset and\n// placement for ToolsPanel menus for block controls to match color popovers.\nexport const TOOLSPANEL_DROPDOWNMENU_PROPS = {\n\tpopoverProps: {\n\t\tplacement: 'left-start',\n\t\toffset: 259, // Inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)\n\t},\n};\n"],"mappings":";;;;;;AAAA;AACA;AACO,MAAMA,6BAA6B,GAAAC,OAAA,CAAAD,6BAAA,GAAG;EAC5CE,YAAY,EAAE;IACbC,SAAS,EAAE,YAAY;IACvBC,MAAM,EAAE,GAAG,CAAE;EACd;AACD,CAAC","ignoreList":[]}
@@ -1,9 +0,0 @@
1
- // The following dropdown menu props aim to provide a consistent offset and
2
- // placement for ToolsPanel menus for block controls to match color popovers.
3
- export const TOOLSPANEL_DROPDOWNMENU_PROPS = {
4
- popoverProps: {
5
- placement: 'left-start',
6
- offset: 259 // Inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)
7
- }
8
- };
9
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["TOOLSPANEL_DROPDOWNMENU_PROPS","popoverProps","placement","offset"],"sources":["@wordpress/block-library/src/utils/constants.js"],"sourcesContent":["// The following dropdown menu props aim to provide a consistent offset and\n// placement for ToolsPanel menus for block controls to match color popovers.\nexport const TOOLSPANEL_DROPDOWNMENU_PROPS = {\n\tpopoverProps: {\n\t\tplacement: 'left-start',\n\t\toffset: 259, // Inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)\n\t},\n};\n"],"mappings":"AAAA;AACA;AACA,OAAO,MAAMA,6BAA6B,GAAG;EAC5CC,YAAY,EAAE;IACbC,SAAS,EAAE,YAAY;IACvBC,MAAM,EAAE,GAAG,CAAE;EACd;AACD,CAAC","ignoreList":[]}
@@ -1,8 +0,0 @@
1
- // The following dropdown menu props aim to provide a consistent offset and
2
- // placement for ToolsPanel menus for block controls to match color popovers.
3
- export const TOOLSPANEL_DROPDOWNMENU_PROPS = {
4
- popoverProps: {
5
- placement: 'left-start',
6
- offset: 259, // Inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)
7
- },
8
- };