@wordpress/block-library 9.1.0 → 9.2.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 (102) hide show
  1. package/CHANGELOG.md +19 -17
  2. package/build/button/index.js +1 -0
  3. package/build/button/index.js.map +1 -1
  4. package/build/image/image.js +3 -2
  5. package/build/image/image.js.map +1 -1
  6. package/build/lock-unlock.js +1 -1
  7. package/build/lock-unlock.js.map +1 -1
  8. package/build/quote/edit.js +1 -0
  9. package/build/quote/edit.js.map +1 -1
  10. package/build/site-tagline/index.js +1 -0
  11. package/build/site-tagline/index.js.map +1 -1
  12. package/build/site-title/index.js +1 -0
  13. package/build/site-title/index.js.map +1 -1
  14. package/build/social-link/edit.js +4 -18
  15. package/build/social-link/edit.js.map +1 -1
  16. package/build/table-of-contents/index.js +1 -1
  17. package/build/utils/caption.js +2 -1
  18. package/build/utils/caption.js.map +1 -1
  19. package/build/verse/index.js +1 -0
  20. package/build/verse/index.js.map +1 -1
  21. package/build-module/button/index.js +1 -0
  22. package/build-module/button/index.js.map +1 -1
  23. package/build-module/image/image.js +3 -2
  24. package/build-module/image/image.js.map +1 -1
  25. package/build-module/lock-unlock.js +1 -1
  26. package/build-module/lock-unlock.js.map +1 -1
  27. package/build-module/quote/edit.js +1 -0
  28. package/build-module/quote/edit.js.map +1 -1
  29. package/build-module/site-tagline/index.js +1 -0
  30. package/build-module/site-tagline/index.js.map +1 -1
  31. package/build-module/site-title/index.js +1 -0
  32. package/build-module/site-title/index.js.map +1 -1
  33. package/build-module/social-link/edit.js +5 -19
  34. package/build-module/social-link/edit.js.map +1 -1
  35. package/build-module/table-of-contents/index.js +1 -1
  36. package/build-module/utils/caption.js +2 -1
  37. package/build-module/utils/caption.js.map +1 -1
  38. package/build-module/verse/index.js +1 -0
  39. package/build-module/verse/index.js.map +1 -1
  40. package/build-style/audio/style-rtl.css +1 -1
  41. package/build-style/audio/style.css +1 -1
  42. package/build-style/audio/theme-rtl.css +2 -2
  43. package/build-style/audio/theme.css +2 -2
  44. package/build-style/common-rtl.css +1 -3
  45. package/build-style/common.css +1 -3
  46. package/build-style/editor-rtl.css +0 -12
  47. package/build-style/editor.css +0 -12
  48. package/build-style/embed/style-rtl.css +1 -1
  49. package/build-style/embed/style.css +1 -1
  50. package/build-style/embed/theme-rtl.css +2 -2
  51. package/build-style/embed/theme.css +2 -2
  52. package/build-style/image/editor-rtl.css +0 -12
  53. package/build-style/image/editor.css +0 -12
  54. package/build-style/image/style-rtl.css +7 -1
  55. package/build-style/image/style.css +7 -1
  56. package/build-style/media-text/style-rtl.css +4 -0
  57. package/build-style/media-text/style.css +4 -0
  58. package/build-style/navigation/style-rtl.css +1 -0
  59. package/build-style/navigation/style.css +1 -0
  60. package/build-style/reset-rtl.css +1 -5
  61. package/build-style/reset.css +1 -5
  62. package/build-style/search/style-rtl.css +1 -2
  63. package/build-style/search/style.css +1 -2
  64. package/build-style/style-rtl.css +17 -9
  65. package/build-style/style.css +17 -9
  66. package/build-style/table/theme-rtl.css +2 -2
  67. package/build-style/table/theme.css +2 -2
  68. package/build-style/theme-rtl.css +8 -8
  69. package/build-style/theme.css +8 -8
  70. package/build-style/video/style-rtl.css +1 -1
  71. package/build-style/video/style.css +1 -1
  72. package/build-style/video/theme-rtl.css +2 -2
  73. package/build-style/video/theme.css +2 -2
  74. package/package.json +35 -35
  75. package/src/audio/style.scss +1 -1
  76. package/src/audio/theme.scss +1 -1
  77. package/src/button/block.json +1 -0
  78. package/src/embed/style.scss +1 -1
  79. package/src/embed/theme.scss +1 -1
  80. package/src/image/editor.scss +0 -13
  81. package/src/image/image.js +9 -2
  82. package/src/image/style.scss +11 -1
  83. package/src/lock-unlock.js +1 -1
  84. package/src/media-text/index.php +68 -18
  85. package/src/media-text/style.scss +4 -0
  86. package/src/navigation/index.php +5 -3
  87. package/src/navigation/style.scss +1 -0
  88. package/src/paragraph/test/__snapshots__/edit.native.js.snap +30 -0
  89. package/src/paragraph/test/edit.native.js +99 -0
  90. package/src/post-date/index.php +1 -1
  91. package/src/quote/edit.js +1 -0
  92. package/src/reset.scss +11 -12
  93. package/src/site-tagline/block.json +1 -0
  94. package/src/site-title/block.json +1 -0
  95. package/src/social-link/edit.js +0 -20
  96. package/src/table/theme.scss +1 -1
  97. package/src/table-of-contents/block.json +1 -1
  98. package/src/template-part/index.php +1 -1
  99. package/src/utils/caption.js +5 -1
  100. package/src/verse/block.json +1 -0
  101. package/src/video/style.scss +1 -1
  102. package/src/video/theme.scss +1 -1
@@ -1,4 +1,9 @@
1
1
  .wp-block-image {
2
+
3
+ a {
4
+ display: inline-block;
5
+ }
6
+
2
7
  img {
3
8
  height: auto;
4
9
  max-width: 100%;
@@ -27,6 +32,11 @@
27
32
  text-align: center;
28
33
  }
29
34
 
35
+ &.alignfull a,
36
+ &.alignwide a {
37
+ width: 100%;
38
+ }
39
+
30
40
  &.alignfull img,
31
41
  &.alignwide img {
32
42
  height: auto;
@@ -78,7 +88,7 @@
78
88
  // Supply caption styles to images, even if the theme hasn't opted in.
79
89
  // Reason being: the new markup, <figcaptions>, are not likely to be styled in the majority of existing themes,
80
90
  // so we supply the styles so as to not appear broken or unstyled in those themes.
81
- figcaption {
91
+ :where(figcaption) {
82
92
  @include caption-style();
83
93
  }
84
94
 
@@ -5,6 +5,6 @@ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/pri
5
5
 
6
6
  export const { lock, unlock } =
7
7
  __dangerousOptInToUnstableAPIsOnlyForCoreModules(
8
- 'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
8
+ 'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',
9
9
  '@wordpress/block-library'
10
10
  );
@@ -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
  }
@@ -68,6 +68,10 @@
68
68
  /*!rtl:end:ignore*/
69
69
  }
70
70
 
71
+ .wp-block-media-text__media a {
72
+ display: inline-block;
73
+ }
74
+
71
75
  .wp-block-media-text__media img,
72
76
  .wp-block-media-text__media video {
73
77
  height: auto;
@@ -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;
@@ -1,5 +1,35 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
+ exports[`Paragraph block should be able to use a prefix to create a Heading block 1`] = `
4
+ "<!-- wp:heading {"level":1} -->
5
+ <h1 class="wp-block-heading"></h1>
6
+ <!-- /wp:heading -->"
7
+ `;
8
+
9
+ exports[`Paragraph block should be able to use a prefix to create a List block 1`] = `
10
+ "<!-- wp:list -->
11
+ <ul class="wp-block-list"><!-- wp:list-item -->
12
+ <li></li>
13
+ <!-- /wp:list-item --></ul>
14
+ <!-- /wp:list -->"
15
+ `;
16
+
17
+ exports[`Paragraph block should be able to use a prefix to create a Quote block 1`] = `
18
+ "<!-- wp:quote -->
19
+ <blockquote class="wp-block-quote"><!-- wp:paragraph -->
20
+ <p></p>
21
+ <!-- /wp:paragraph --></blockquote>
22
+ <!-- /wp:quote -->"
23
+ `;
24
+
25
+ exports[`Paragraph block should be able to use a prefix to create a numbered List block 1`] = `
26
+ "<!-- wp:list {"ordered":true} -->
27
+ <ol class="wp-block-list"><!-- wp:list-item -->
28
+ <li></li>
29
+ <!-- /wp:list-item --></ol>
30
+ <!-- /wp:list -->"
31
+ `;
32
+
3
33
  exports[`Paragraph block should prevent deleting the first Paragraph block when pressing backspace at the start 1`] = `
4
34
  "<!-- wp:paragraph -->
5
35
  <p>A quick brown fox jumps over the lazy dog.</p>
@@ -90,6 +90,105 @@ describe( 'Paragraph block', () => {
90
90
  expect( getEditorHtml() ).toMatchSnapshot();
91
91
  } );
92
92
 
93
+ it( 'should be able to use a prefix to create a Heading block', async () => {
94
+ const screen = await initializeEditor();
95
+ await addBlock( screen, 'Paragraph' );
96
+ const text = '# ';
97
+
98
+ const paragraphBlock = getBlock( screen, 'Paragraph' );
99
+ fireEvent.press( paragraphBlock );
100
+ const paragraphTextInput =
101
+ within( paragraphBlock ).getByPlaceholderText( 'Start writing…' );
102
+ typeInRichText( paragraphTextInput, text, {
103
+ finalSelectionStart: 1,
104
+ finalSelectionEnd: 1,
105
+ } );
106
+
107
+ fireEvent( paragraphTextInput, 'onChange', {
108
+ nativeEvent: { text },
109
+ preventDefault() {},
110
+ } );
111
+
112
+ const headingBlock = getBlock( screen, 'Heading' );
113
+ expect( headingBlock ).toBeVisible();
114
+ expect( getEditorHtml() ).toMatchSnapshot();
115
+ } );
116
+
117
+ it( 'should be able to use a prefix to create a Quote block', async () => {
118
+ const screen = await initializeEditor();
119
+ await addBlock( screen, 'Paragraph' );
120
+ const text = '> ';
121
+
122
+ const paragraphBlock = getBlock( screen, 'Paragraph' );
123
+ fireEvent.press( paragraphBlock );
124
+ const paragraphTextInput =
125
+ within( paragraphBlock ).getByPlaceholderText( 'Start writing…' );
126
+ typeInRichText( paragraphTextInput, text, {
127
+ finalSelectionStart: 1,
128
+ finalSelectionEnd: 1,
129
+ } );
130
+
131
+ fireEvent( paragraphTextInput, 'onChange', {
132
+ nativeEvent: { text },
133
+ preventDefault() {},
134
+ } );
135
+ const quoteBlock = getBlock( screen, 'Quote' );
136
+ await triggerBlockListLayout( quoteBlock );
137
+
138
+ expect( quoteBlock ).toBeVisible();
139
+ expect( getEditorHtml() ).toMatchSnapshot();
140
+ } );
141
+
142
+ it( 'should be able to use a prefix to create a List block', async () => {
143
+ const screen = await initializeEditor();
144
+ await addBlock( screen, 'Paragraph' );
145
+ const text = '- ';
146
+
147
+ const paragraphBlock = getBlock( screen, 'Paragraph' );
148
+ fireEvent.press( paragraphBlock );
149
+ const paragraphTextInput =
150
+ within( paragraphBlock ).getByPlaceholderText( 'Start writing…' );
151
+ typeInRichText( paragraphTextInput, text, {
152
+ finalSelectionStart: 1,
153
+ finalSelectionEnd: 1,
154
+ } );
155
+
156
+ fireEvent( paragraphTextInput, 'onChange', {
157
+ nativeEvent: { text },
158
+ preventDefault() {},
159
+ } );
160
+ const listBlock = getBlock( screen, 'List' );
161
+ await triggerBlockListLayout( listBlock );
162
+
163
+ expect( listBlock ).toBeVisible();
164
+ expect( getEditorHtml() ).toMatchSnapshot();
165
+ } );
166
+
167
+ it( 'should be able to use a prefix to create a numbered List block', async () => {
168
+ const screen = await initializeEditor();
169
+ await addBlock( screen, 'Paragraph' );
170
+ const text = '1. ';
171
+
172
+ const paragraphBlock = getBlock( screen, 'Paragraph' );
173
+ fireEvent.press( paragraphBlock );
174
+ const paragraphTextInput =
175
+ within( paragraphBlock ).getByPlaceholderText( 'Start writing…' );
176
+ typeInRichText( paragraphTextInput, text, {
177
+ finalSelectionStart: 2,
178
+ finalSelectionEnd: 2,
179
+ } );
180
+
181
+ fireEvent( paragraphTextInput, 'onChange', {
182
+ nativeEvent: { text },
183
+ preventDefault() {},
184
+ } );
185
+ const listBlock = getBlock( screen, 'List' );
186
+ await triggerBlockListLayout( listBlock );
187
+
188
+ expect( listBlock ).toBeVisible();
189
+ expect( getEditorHtml() ).toMatchSnapshot();
190
+ } );
191
+
93
192
  it( 'should bold text', async () => {
94
193
  // Arrange
95
194
  const screen = await initializeEditor();
@@ -44,7 +44,7 @@ function render_block_core_post_date( $attributes, $content, $block ) {
44
44
  */
45
45
  if ( isset( $attributes['displayType'] ) && 'modified' === $attributes['displayType'] ) {
46
46
  if ( get_the_modified_date( 'Ymdhi', $post_ID ) > get_the_date( 'Ymdhi', $post_ID ) ) {
47
- if ( 'human-diff' === $attributes['format'] ) {
47
+ if ( isset( $attributes['format'] ) && 'human-diff' === $attributes['format'] ) {
48
48
  // translators: %s: human-readable time difference.
49
49
  $formatted_date = sprintf( __( '%s ago', 'gutenberg' ), human_time_diff( get_post_timestamp( $post_ID, 'modified' ) ) );
50
50
  } else {
package/src/quote/edit.js CHANGED
@@ -121,6 +121,7 @@ export default function QuoteEdit( {
121
121
  }
122
122
  addLabel={ __( 'Add citation' ) }
123
123
  removeLabel={ __( 'Remove citation' ) }
124
+ excludeElementClassName
124
125
  className="wp-block-quote__citation"
125
126
  insertBlocksAfter={ insertBlocksAfter }
126
127
  { ...( ! isWebPlatform ? { textAlign } : {} ) }
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;
@@ -44,6 +44,7 @@
44
44
  "__experimentalFontStyle": true,
45
45
  "__experimentalFontWeight": true,
46
46
  "__experimentalLetterSpacing": true,
47
+ "__experimentalWritingMode": true,
47
48
  "__experimentalDefaultControls": {
48
49
  "fontSize": true
49
50
  }
@@ -55,6 +55,7 @@
55
55
  "__experimentalFontStyle": true,
56
56
  "__experimentalFontWeight": true,
57
57
  "__experimentalLetterSpacing": true,
58
+ "__experimentalWritingMode": true,
58
59
  "__experimentalDefaultControls": {
59
60
  "fontSize": true
60
61
  }
@@ -6,15 +6,11 @@ import clsx from 'clsx';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { DELETE, BACKSPACE } from '@wordpress/keycodes';
10
- import { useDispatch } from '@wordpress/data';
11
-
12
9
  import {
13
10
  InspectorControls,
14
11
  URLPopover,
15
12
  URLInput,
16
13
  useBlockProps,
17
- store as blockEditorStore,
18
14
  } from '@wordpress/block-editor';
19
15
  import { useState } from '@wordpress/element';
20
16
  import {
@@ -36,9 +32,7 @@ const SocialLinkURLPopover = ( {
36
32
  setAttributes,
37
33
  setPopover,
38
34
  popoverAnchor,
39
- clientId,
40
35
  } ) => {
41
- const { removeBlock } = useDispatch( blockEditorStore );
42
36
  return (
43
37
  <URLPopover
44
38
  anchor={ popoverAnchor }
@@ -62,18 +56,6 @@ const SocialLinkURLPopover = ( {
62
56
  label={ __( 'Enter social link' ) }
63
57
  hideLabelFromVision
64
58
  disableSuggestions
65
- onKeyDown={ ( event ) => {
66
- if (
67
- !! url ||
68
- event.defaultPrevented ||
69
- ! [ BACKSPACE, DELETE ].includes(
70
- event.keyCode
71
- )
72
- ) {
73
- return;
74
- }
75
- removeBlock( clientId );
76
- } }
77
59
  />
78
60
  </div>
79
61
  <Button
@@ -91,7 +73,6 @@ const SocialLinkEdit = ( {
91
73
  context,
92
74
  isSelected,
93
75
  setAttributes,
94
- clientId,
95
76
  } ) => {
96
77
  const { url, service, label = '', rel } = attributes;
97
78
  const {
@@ -178,7 +159,6 @@ const SocialLinkEdit = ( {
178
159
  setAttributes={ setAttributes }
179
160
  setPopover={ setPopover }
180
161
  popoverAnchor={ popoverAnchor }
181
- clientId={ clientId }
182
162
  />
183
163
  ) }
184
164
  </li>
@@ -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
  }
@@ -4,7 +4,7 @@
4
4
  "__experimental": true,
5
5
  "name": "core/table-of-contents",
6
6
  "title": "Table of Contents",
7
- "category": "layout",
7
+ "category": "design",
8
8
  "description": "Summarize your post with a list of headings. Add HTML anchors to Heading blocks to link them here.",
9
9
  "keywords": [ "document outline", "summary" ],
10
10
  "textdomain": "default",
@@ -161,7 +161,7 @@ function render_block_core_template_part( $attributes ) {
161
161
  global $wp_embed;
162
162
  $content = $wp_embed->autoembed( $content );
163
163
 
164
- if ( empty( $attributes['tagName'] ) ) {
164
+ if ( empty( $attributes['tagName'] ) || tag_escape( $attributes['tagName'] ) !== $attributes['tagName'] ) {
165
165
  $area_tag = 'div';
166
166
  if ( $area_definition && isset( $area_definition['area_tag'] ) ) {
167
167
  $area_tag = $area_definition['area_tag'];
@@ -32,6 +32,7 @@ export function Caption( {
32
32
  placeholder = __( 'Add caption' ),
33
33
  label = __( 'Caption text' ),
34
34
  showToolbarButton = true,
35
+ excludeElementClassName,
35
36
  className,
36
37
  readOnly,
37
38
  tagName = 'figcaption',
@@ -70,6 +71,7 @@ export function Caption( {
70
71
  },
71
72
  [ isCaptionEmpty ]
72
73
  );
74
+
73
75
  return (
74
76
  <>
75
77
  { showToolbarButton && (
@@ -96,7 +98,9 @@ export function Caption( {
96
98
  tagName={ tagName }
97
99
  className={ clsx(
98
100
  className,
99
- __experimentalGetElementClassName( 'caption' )
101
+ excludeElementClassName
102
+ ? ''
103
+ : __experimentalGetElementClassName( 'caption' )
100
104
  ) }
101
105
  ref={ ref }
102
106
  aria-label={ label }
@@ -51,6 +51,7 @@
51
51
  "__experimentalLetterSpacing": true,
52
52
  "__experimentalTextTransform": true,
53
53
  "__experimentalTextDecoration": true,
54
+ "__experimentalWritingMode": true,
54
55
  "__experimentalDefaultControls": {
55
56
  "fontSize": true
56
57
  }
@@ -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