@wordpress/block-library 7.15.1-next.4d3b314fd5.0 → 7.16.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 (146) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/code/utils.js +3 -3
  3. package/build/code/utils.js.map +1 -1
  4. package/build/group/edit.js +1 -1
  5. package/build/group/edit.js.map +1 -1
  6. package/build/navigation/edit/index.js +12 -12
  7. package/build/navigation/edit/index.js.map +1 -1
  8. package/build/paragraph/deprecated.js +49 -10
  9. package/build/paragraph/deprecated.js.map +1 -1
  10. package/build/paragraph/edit.js +19 -3
  11. package/build/paragraph/edit.js.map +1 -1
  12. package/build/paragraph/save.js +3 -1
  13. package/build/paragraph/save.js.map +1 -1
  14. package/build/post-author/edit.js +20 -2
  15. package/build/post-author/edit.js.map +1 -1
  16. package/build/post-author/index.js +8 -0
  17. package/build/post-author/index.js.map +1 -1
  18. package/build/post-featured-image/index.js +1 -1
  19. package/build/post-featured-image/overlay.js +2 -2
  20. package/build/post-featured-image/overlay.js.map +1 -1
  21. package/build/post-terms/index.js +4 -0
  22. package/build/post-terms/index.js.map +1 -1
  23. package/build/query/edit/inspector-controls/author-control.js +2 -1
  24. package/build/query/edit/inspector-controls/author-control.js.map +1 -1
  25. package/build/query/edit/inspector-controls/index.js +1 -1
  26. package/build/query/edit/inspector-controls/index.js.map +1 -1
  27. package/build/query/edit/inspector-controls/parent-control.js +2 -1
  28. package/build/query/edit/inspector-controls/parent-control.js.map +1 -1
  29. package/build/query/edit/inspector-controls/taxonomy-controls.js +2 -1
  30. package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  31. package/build/query/utils.js +1 -1
  32. package/build/query/utils.js.map +1 -1
  33. package/build/quote/index.js +0 -1
  34. package/build/quote/index.js.map +1 -1
  35. package/build/site-title/index.js +2 -1
  36. package/build/site-title/index.js.map +1 -1
  37. package/build/template-part/index.js +2 -2
  38. package/build/template-part/index.js.map +1 -1
  39. package/build/video/edit.js +13 -1
  40. package/build/video/edit.js.map +1 -1
  41. package/build-module/code/utils.js +3 -3
  42. package/build-module/code/utils.js.map +1 -1
  43. package/build-module/group/edit.js +1 -1
  44. package/build-module/group/edit.js.map +1 -1
  45. package/build-module/navigation/edit/index.js +12 -12
  46. package/build-module/navigation/edit/index.js.map +1 -1
  47. package/build-module/paragraph/deprecated.js +49 -11
  48. package/build-module/paragraph/deprecated.js.map +1 -1
  49. package/build-module/paragraph/edit.js +19 -3
  50. package/build-module/paragraph/edit.js.map +1 -1
  51. package/build-module/paragraph/save.js +2 -1
  52. package/build-module/paragraph/save.js.map +1 -1
  53. package/build-module/post-author/edit.js +21 -2
  54. package/build-module/post-author/edit.js.map +1 -1
  55. package/build-module/post-author/index.js +8 -0
  56. package/build-module/post-author/index.js.map +1 -1
  57. package/build-module/post-featured-image/index.js +1 -1
  58. package/build-module/post-featured-image/overlay.js +2 -2
  59. package/build-module/post-featured-image/overlay.js.map +1 -1
  60. package/build-module/post-terms/index.js +4 -0
  61. package/build-module/post-terms/index.js.map +1 -1
  62. package/build-module/query/edit/inspector-controls/author-control.js +2 -1
  63. package/build-module/query/edit/inspector-controls/author-control.js.map +1 -1
  64. package/build-module/query/edit/inspector-controls/index.js +1 -1
  65. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  66. package/build-module/query/edit/inspector-controls/parent-control.js +2 -1
  67. package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -1
  68. package/build-module/query/edit/inspector-controls/taxonomy-controls.js +2 -1
  69. package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  70. package/build-module/query/utils.js +1 -1
  71. package/build-module/query/utils.js.map +1 -1
  72. package/build-module/quote/index.js +0 -1
  73. package/build-module/quote/index.js.map +1 -1
  74. package/build-module/site-title/index.js +2 -1
  75. package/build-module/site-title/index.js.map +1 -1
  76. package/build-module/template-part/index.js +2 -2
  77. package/build-module/template-part/index.js.map +1 -1
  78. package/build-module/video/edit.js +15 -3
  79. package/build-module/video/edit.js.map +1 -1
  80. package/build-style/code/style-rtl.css +3 -0
  81. package/build-style/code/style.css +3 -0
  82. package/build-style/editor-rtl.css +69 -29
  83. package/build-style/editor.css +69 -29
  84. package/build-style/navigation/editor-rtl.css +4 -0
  85. package/build-style/navigation/editor.css +4 -0
  86. package/build-style/navigation/style-rtl.css +3 -0
  87. package/build-style/navigation/style.css +3 -0
  88. package/build-style/paragraph/style-rtl.css +5 -0
  89. package/build-style/paragraph/style.css +5 -0
  90. package/build-style/post-featured-image/editor-rtl.css +39 -29
  91. package/build-style/post-featured-image/editor.css +39 -29
  92. package/build-style/post-terms/style-rtl.css +4 -1
  93. package/build-style/post-terms/style.css +4 -1
  94. package/build-style/site-title/editor-rtl.css +4 -0
  95. package/build-style/site-title/editor.css +4 -0
  96. package/build-style/site-title/style-rtl.css +79 -0
  97. package/build-style/site-title/style.css +79 -0
  98. package/build-style/style-rtl.css +19 -1
  99. package/build-style/style.css +19 -1
  100. package/build-style/video/editor-rtl.css +22 -0
  101. package/build-style/video/editor.css +22 -0
  102. package/package.json +28 -28
  103. package/src/categories/index.php +1 -1
  104. package/src/code/style.scss +12 -7
  105. package/src/code/utils.js +3 -3
  106. package/src/comment-author-name/index.php +1 -1
  107. package/src/comment-reply-link/index.php +1 -1
  108. package/src/comment-template/index.php +2 -3
  109. package/src/cover/index.php +1 -1
  110. package/src/group/edit.js +1 -1
  111. package/src/latest-posts/index.php +1 -1
  112. package/src/navigation/edit/index.js +12 -10
  113. package/src/navigation/editor.scss +6 -0
  114. package/src/navigation/style.scss +8 -0
  115. package/src/page-list/index.php +2 -2
  116. package/src/paragraph/deprecated.js +36 -0
  117. package/src/paragraph/edit.js +23 -8
  118. package/src/paragraph/save.js +5 -1
  119. package/src/paragraph/style.scss +5 -0
  120. package/src/post-author/block.json +8 -0
  121. package/src/post-author/edit.js +29 -3
  122. package/src/post-author/index.php +7 -1
  123. package/src/post-featured-image/block.json +1 -1
  124. package/src/post-featured-image/editor.scss +79 -72
  125. package/src/post-featured-image/index.php +18 -24
  126. package/src/post-featured-image/overlay.js +17 -14
  127. package/src/post-terms/block.json +4 -0
  128. package/src/post-terms/style.scss +7 -2
  129. package/src/query/edit/inspector-controls/author-control.js +1 -0
  130. package/src/query/edit/inspector-controls/index.js +1 -4
  131. package/src/query/edit/inspector-controls/parent-control.js +1 -0
  132. package/src/query/edit/inspector-controls/taxonomy-controls.js +1 -0
  133. package/src/query/utils.js +1 -1
  134. package/src/quote/block.json +0 -1
  135. package/src/site-title/block.json +2 -1
  136. package/src/site-title/editor.scss +6 -0
  137. package/src/site-title/style.scss +5 -0
  138. package/src/style.scss +1 -0
  139. package/src/template-part/index.js +2 -2
  140. package/src/video/edit.js +19 -0
  141. package/src/video/editor.scss +37 -0
  142. package/build/navigation-submenu/view.js +0 -56
  143. package/build/navigation-submenu/view.js.map +0 -1
  144. package/build-module/navigation-submenu/view.js +0 -54
  145. package/build-module/navigation-submenu/view.js.map +0 -1
  146. package/src/navigation-submenu/view.js +0 -67
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-library",
3
- "version": "7.15.1-next.4d3b314fd5.0",
3
+ "version": "7.16.0",
4
4
  "description": "Block library for the WordPress editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -31,32 +31,32 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.16.0",
34
- "@wordpress/a11y": "^3.18.1-next.4d3b314fd5.0",
35
- "@wordpress/api-fetch": "^6.15.1-next.4d3b314fd5.0",
36
- "@wordpress/autop": "^3.18.1-next.4d3b314fd5.0",
37
- "@wordpress/blob": "^3.18.1-next.4d3b314fd5.0",
38
- "@wordpress/block-editor": "^10.1.1-next.4d3b314fd5.0",
39
- "@wordpress/blocks": "^11.18.1-next.4d3b314fd5.0",
40
- "@wordpress/components": "^21.1.2-next.4d3b314fd5.0",
41
- "@wordpress/compose": "^5.16.1-next.4d3b314fd5.0",
42
- "@wordpress/core-data": "^5.1.1-next.4d3b314fd5.0",
43
- "@wordpress/data": "^7.2.1-next.4d3b314fd5.0",
44
- "@wordpress/date": "^4.18.1-next.4d3b314fd5.0",
45
- "@wordpress/deprecated": "^3.18.1-next.4d3b314fd5.0",
46
- "@wordpress/dom": "^3.18.1-next.4d3b314fd5.0",
47
- "@wordpress/element": "^4.16.1-next.4d3b314fd5.0",
48
- "@wordpress/hooks": "^3.18.1-next.4d3b314fd5.0",
49
- "@wordpress/html-entities": "^3.18.1-next.4d3b314fd5.0",
50
- "@wordpress/i18n": "^4.18.1-next.4d3b314fd5.0",
51
- "@wordpress/icons": "^9.9.1-next.4d3b314fd5.0",
52
- "@wordpress/keycodes": "^3.18.1-next.4d3b314fd5.0",
53
- "@wordpress/notices": "^3.18.1-next.4d3b314fd5.0",
54
- "@wordpress/primitives": "^3.16.1-next.4d3b314fd5.0",
55
- "@wordpress/reusable-blocks": "^3.16.1-next.4d3b314fd5.0",
56
- "@wordpress/rich-text": "^5.16.1-next.4d3b314fd5.0",
57
- "@wordpress/server-side-render": "^3.16.1-next.4d3b314fd5.0",
58
- "@wordpress/url": "^3.19.1-next.4d3b314fd5.0",
59
- "@wordpress/viewport": "^4.16.1-next.4d3b314fd5.0",
34
+ "@wordpress/a11y": "^3.19.0",
35
+ "@wordpress/api-fetch": "^6.16.0",
36
+ "@wordpress/autop": "^3.19.0",
37
+ "@wordpress/blob": "^3.19.0",
38
+ "@wordpress/block-editor": "^10.2.0",
39
+ "@wordpress/blocks": "^11.18.0",
40
+ "@wordpress/components": "^21.2.0",
41
+ "@wordpress/compose": "^5.17.0",
42
+ "@wordpress/core-data": "^5.2.0",
43
+ "@wordpress/data": "^7.3.0",
44
+ "@wordpress/date": "^4.19.0",
45
+ "@wordpress/deprecated": "^3.19.0",
46
+ "@wordpress/dom": "^3.19.0",
47
+ "@wordpress/element": "^4.17.0",
48
+ "@wordpress/hooks": "^3.19.0",
49
+ "@wordpress/html-entities": "^3.19.0",
50
+ "@wordpress/i18n": "^4.19.0",
51
+ "@wordpress/icons": "^9.10.0",
52
+ "@wordpress/keycodes": "^3.19.0",
53
+ "@wordpress/notices": "^3.19.0",
54
+ "@wordpress/primitives": "^3.17.0",
55
+ "@wordpress/reusable-blocks": "^3.17.0",
56
+ "@wordpress/rich-text": "^5.17.0",
57
+ "@wordpress/server-side-render": "^3.17.0",
58
+ "@wordpress/url": "^3.20.0",
59
+ "@wordpress/viewport": "^4.17.0",
60
60
  "change-case": "^4.1.2",
61
61
  "classnames": "^2.3.1",
62
62
  "colord": "^2.7.0",
@@ -73,5 +73,5 @@
73
73
  "publishConfig": {
74
74
  "access": "public"
75
75
  },
76
- "gitHead": "25054766423cb49d959eb656c2533530073ff5c2"
76
+ "gitHead": "8d42d2febb7d0ba8372a33e560a62f5a5f6a9112"
77
77
  }
@@ -14,7 +14,7 @@
14
14
  */
15
15
  function render_block_core_categories( $attributes ) {
16
16
  static $block_id = 0;
17
- $block_id++;
17
+ ++$block_id;
18
18
 
19
19
  $args = array(
20
20
  'echo' => false,
@@ -1,8 +1,13 @@
1
- // Provide a minimum of overflow handling and ensure the code markup inherits
2
- // the font-family set on pre.
3
- .wp-block-code code {
4
- display: block;
5
- font-family: inherit;
6
- overflow-wrap: break-word;
7
- white-space: pre-wrap;
1
+ .wp-block-code {
2
+ // This block has customizable padding, border-box makes that more predictable.
3
+ box-sizing: border-box;
4
+
5
+ // Provide a minimum of overflow handling and ensure the code markup inherits
6
+ // the font-family set on pre.
7
+ code {
8
+ display: block;
9
+ font-family: inherit;
10
+ overflow-wrap: break-word;
11
+ white-space: pre-wrap;
12
+ }
8
13
  }
package/src/code/utils.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
- * External dependencies
2
+ * WordPress dependencies
3
3
  */
4
- import { flow } from 'lodash';
4
+ import { pipe } from '@wordpress/compose';
5
5
 
6
6
  /**
7
7
  * Escapes ampersands, shortcodes, and links.
@@ -10,7 +10,7 @@ import { flow } from 'lodash';
10
10
  * @return {string} The given content with some characters escaped.
11
11
  */
12
12
  export function escape( content ) {
13
- return flow(
13
+ return pipe(
14
14
  escapeOpeningSquareBrackets,
15
15
  escapeProtocolInIsolatedUrls
16
16
  )( content || '' );
@@ -34,7 +34,7 @@ function render_block_core_comment_author_name( $attributes, $content, $block )
34
34
  $comment_author = get_comment_author( $comment );
35
35
  $link = get_comment_author_url( $comment );
36
36
 
37
- if ( ! empty( $attributes['isLink'] ) && ! empty( $attributes['linkTarget'] ) ) {
37
+ if ( ! empty( $link ) && ! empty( $attributes['isLink'] ) && ! empty( $attributes['linkTarget'] ) ) {
38
38
  $comment_author = sprintf( '<a rel="external nofollow ugc" href="%1s" target="%2s" >%3s</a>', esc_url( $link ), esc_attr( $attributes['linkTarget'] ), $comment_author );
39
39
  }
40
40
  if ( '0' === $comment->comment_approved && ! $show_pending_links ) {
@@ -34,7 +34,7 @@ function render_block_core_comment_reply_link( $attributes, $content, $block ) {
34
34
 
35
35
  // Compute comment's depth iterating over its ancestors.
36
36
  while ( ! empty( $parent_id ) ) {
37
- $depth++;
37
+ ++$depth;
38
38
  $parent_id = get_comment( $parent_id )->comment_parent;
39
39
  }
40
40
 
@@ -50,13 +50,13 @@ function block_core_comment_template_render_comments( $comments, $block ) {
50
50
  // comments.
51
51
  if ( ! empty( $children ) && ! empty( $thread_comments ) ) {
52
52
  if ( $comment_depth < $thread_comments_depth ) {
53
- $comment_depth += 1;
53
+ ++$comment_depth;
54
54
  $inner_content = block_core_comment_template_render_comments(
55
55
  $children,
56
56
  $block
57
57
  );
58
58
  $block_content .= sprintf( '<ol>%1$s</ol>', $inner_content );
59
- $comment_depth -= 1;
59
+ --$comment_depth;
60
60
  } else {
61
61
  $inner_content = block_core_comment_template_render_comments(
62
62
  $children,
@@ -70,7 +70,6 @@ function block_core_comment_template_render_comments( $comments, $block ) {
70
70
  }
71
71
 
72
72
  return $content;
73
-
74
73
  }
75
74
 
76
75
  /**
@@ -25,7 +25,7 @@ function render_block_core_cover( $attributes, $content ) {
25
25
  );
26
26
 
27
27
  if ( isset( $attributes['focalPoint'] ) ) {
28
- $object_position = round( $attributes['focalPoint']['x'] * 100 ) . '%' . ' ' . round( $attributes['focalPoint']['y'] * 100 ) . '%';
28
+ $object_position = round( $attributes['focalPoint']['x'] * 100 ) . '% ' . round( $attributes['focalPoint']['y'] * 100 ) . '%';
29
29
  $attr['data-object-position'] = $object_position;
30
30
  $attr['style'] = 'object-position: ' . $object_position;
31
31
  }
package/src/group/edit.js CHANGED
@@ -53,7 +53,7 @@ function GroupEdit( { attributes, setAttributes, clientId } ) {
53
53
  ? { ...defaultLayout, ...layout, type: 'default' }
54
54
  : { ...defaultLayout, ...layout };
55
55
  const { type = 'default' } = usedLayout;
56
- const layoutSupportEnabled = themeSupportsLayout || type !== 'default';
56
+ const layoutSupportEnabled = themeSupportsLayout || type === 'flex';
57
57
 
58
58
  const blockProps = useBlockProps();
59
59
 
@@ -55,7 +55,7 @@ function render_block_core_latest_posts( $attributes ) {
55
55
  $args['author'] = $attributes['selectedAuthor'];
56
56
  }
57
57
 
58
- $query = new WP_Query;
58
+ $query = new WP_Query();
59
59
  $recent_posts = $query->query( $args );
60
60
 
61
61
  if ( isset( $attributes['displayFeaturedImage'] ) && $attributes['displayFeaturedImage'] ) {
@@ -282,16 +282,18 @@ function Navigation( {
282
282
  hasResolvedNavigationMenus &&
283
283
  ! hasUncontrolledInnerBlocks;
284
284
 
285
- if ( isPlaceholder && ! ref ) {
286
- /**
287
- * this fallback only displays (both in editor and on front)
288
- * the list of pages block if no menu is available as a fallback.
289
- * We don't want the fallback to request a save,
290
- * nor to be undoable, hence we mark it non persistent.
291
- */
292
- __unstableMarkNextChangeAsNotPersistent();
293
- replaceInnerBlocks( clientId, [ createBlock( 'core/page-list' ) ] );
294
- }
285
+ useEffect( () => {
286
+ if ( isPlaceholder && ! ref ) {
287
+ /**
288
+ * this fallback only displays (both in editor and on front)
289
+ * the list of pages block if no menu is available as a fallback.
290
+ * We don't want the fallback to request a save,
291
+ * nor to be undoable, hence we mark it non persistent.
292
+ */
293
+ __unstableMarkNextChangeAsNotPersistent();
294
+ replaceInnerBlocks( clientId, [ createBlock( 'core/page-list' ) ] );
295
+ }
296
+ }, [ clientId, isPlaceholder, ref ] );
295
297
 
296
298
  const isEntityAvailable =
297
299
  ! isNavigationMenuMissing && isNavigationMenuResolved;
@@ -629,3 +629,9 @@ body.editor-styles-wrapper
629
629
  margin-bottom: $grid-unit-20;
630
630
  width: 100%;
631
631
  }
632
+
633
+ // Buttons inside a disabled component get semitransparent when there's a clickthrough overlay.
634
+ // Since this navigation button is content rather than UI, however, override that.
635
+ .wp-block-navigation__responsive-container-open.components-button {
636
+ opacity: 1;
637
+ }
@@ -47,6 +47,14 @@ $navigation-icon-size: 24px;
47
47
  display: block;
48
48
  }
49
49
 
50
+ // This rule needs extra specificity so that it inherits the correct color from its parent.
51
+ // Otherwise, a link color set by a parent group can override the value.
52
+ // This also fixes an issue where a navigation with an explicitly set color is overridden
53
+ // by link colors defined in Global Styles.
54
+ .wp-block-navigation-item__content.wp-block-navigation-item__content {
55
+ color: inherit;
56
+ }
57
+
50
58
  // The following rules provide class based application of user selected text
51
59
  // decoration via block supports.
52
60
  &.has-text-decoration-underline .wp-block-navigation-item__content {
@@ -189,7 +189,7 @@ function block_core_page_list_render_nested_page_list( $open_submenus_on_click,
189
189
 
190
190
  if ( isset( $page['children'] ) && $is_navigation_child && $open_submenus_on_click ) {
191
191
  $markup .= '<button aria-label="' . esc_attr( $aria_label ) . '" class="' . esc_attr( $navigation_child_content_class ) . ' wp-block-navigation-submenu__toggle" aria-expanded="false">' . esc_html( $title ) .
192
- '</button>' . '<span class="wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon"><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true" focusable="false"><path d="M1.50002 4L6.00002 8L10.5 4" stroke-width="1.5"></path></svg></span>';
192
+ '</button><span class="wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon"><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true" focusable="false"><path d="M1.50002 4L6.00002 8L10.5 4" stroke-width="1.5"></path></svg></span>';
193
193
  } else {
194
194
  $markup .= '<a class="wp-block-pages-list__item__link' . esc_attr( $navigation_child_content_class ) . '" href="' . esc_url( $page['link'] ) . '"' . $aria_current . '>' . $title . '</a>';
195
195
  }
@@ -243,7 +243,7 @@ function block_core_page_list_nest_pages( $current_level, $children ) {
243
243
  */
244
244
  function render_block_core_page_list( $attributes, $content, $block ) {
245
245
  static $block_id = 0;
246
- $block_id++;
246
+ ++$block_id;
247
247
 
248
248
  $all_pages = get_pages(
249
249
  array(
@@ -11,8 +11,11 @@ import {
11
11
  getColorClassName,
12
12
  getFontSizeClass,
13
13
  RichText,
14
+ useBlockProps,
14
15
  } from '@wordpress/block-editor';
15
16
 
17
+ import { isRTL } from '@wordpress/i18n';
18
+
16
19
  const supports = {
17
20
  className: false,
18
21
  };
@@ -90,6 +93,39 @@ const migrateCustomColorsAndFontSizes = ( attributes ) => {
90
93
  const { style, ...restBlockAttributes } = blockAttributes;
91
94
 
92
95
  const deprecated = [
96
+ // Version without drop cap on aligned text.
97
+ {
98
+ supports,
99
+ attributes: {
100
+ ...restBlockAttributes,
101
+ customTextColor: {
102
+ type: 'string',
103
+ },
104
+ customBackgroundColor: {
105
+ type: 'string',
106
+ },
107
+ customFontSize: {
108
+ type: 'number',
109
+ },
110
+ },
111
+ save( { attributes } ) {
112
+ const { align, content, dropCap, direction } = attributes;
113
+ const className = classnames( {
114
+ 'has-drop-cap':
115
+ align === ( isRTL() ? 'left' : 'right' ) ||
116
+ align === 'center'
117
+ ? false
118
+ : dropCap,
119
+ [ `has-text-align-${ align }` ]: align,
120
+ } );
121
+
122
+ return (
123
+ <p { ...useBlockProps.save( { className, dir: direction } ) }>
124
+ <RichText.Content value={ content } />
125
+ </p>
126
+ );
127
+ },
128
+ },
93
129
  {
94
130
  supports,
95
131
  attributes: {
@@ -48,6 +48,10 @@ function ParagraphRTLControl( { direction, setDirection } ) {
48
48
  );
49
49
  }
50
50
 
51
+ function hasDropCapDisabled( align ) {
52
+ return align === ( isRTL() ? 'left' : 'right' ) || align === 'center';
53
+ }
54
+
51
55
  function ParagraphBlock( {
52
56
  attributes,
53
57
  mergeBlocks,
@@ -65,19 +69,33 @@ function ParagraphBlock( {
65
69
  setParagraphElement,
66
70
  ] ),
67
71
  className: classnames( {
68
- 'has-drop-cap': dropCap,
72
+ 'has-drop-cap': hasDropCapDisabled( align ) ? false : dropCap,
69
73
  [ `has-text-align-${ align }` ]: align,
70
74
  } ),
71
75
  style: { direction },
72
76
  } );
73
77
 
78
+ let helpText;
79
+ if ( hasDropCapDisabled( align ) ) {
80
+ helpText = __( 'Not available for aligned text.' );
81
+ } else if ( dropCap ) {
82
+ helpText = __( 'Showing large initial letter.' );
83
+ } else {
84
+ helpText = __( 'Toggle to show a large initial letter.' );
85
+ }
86
+
74
87
  return (
75
88
  <>
76
89
  <BlockControls group="block">
77
90
  <AlignmentControl
78
91
  value={ align }
79
92
  onChange={ ( newAlign ) =>
80
- setAttributes( { align: newAlign } )
93
+ setAttributes( {
94
+ align: newAlign,
95
+ dropCap: hasDropCapDisabled( newAlign )
96
+ ? false
97
+ : dropCap,
98
+ } )
81
99
  }
82
100
  />
83
101
  <ParagraphRTLControl
@@ -104,12 +122,9 @@ function ParagraphBlock( {
104
122
  onChange={ () =>
105
123
  setAttributes( { dropCap: ! dropCap } )
106
124
  }
107
- help={
108
- dropCap
109
- ? __( 'Showing large initial letter.' )
110
- : __(
111
- 'Toggle to show a large initial letter.'
112
- )
125
+ help={ helpText }
126
+ disabled={
127
+ hasDropCapDisabled( align ) ? true : false
113
128
  }
114
129
  />
115
130
  </ToolsPanelItem>
@@ -7,11 +7,15 @@ import classnames from 'classnames';
7
7
  * WordPress dependencies
8
8
  */
9
9
  import { RichText, useBlockProps } from '@wordpress/block-editor';
10
+ import { isRTL } from '@wordpress/i18n';
10
11
 
11
12
  export default function save( { attributes } ) {
12
13
  const { align, content, dropCap, direction } = attributes;
13
14
  const className = classnames( {
14
- 'has-drop-cap': dropCap,
15
+ 'has-drop-cap':
16
+ align === ( isRTL() ? 'left' : 'right' ) || align === 'center'
17
+ ? false
18
+ : dropCap,
15
19
  [ `has-text-align-${ align }` ]: align,
16
20
  } );
17
21
 
@@ -28,6 +28,11 @@
28
28
  font-style: normal;
29
29
  }
30
30
 
31
+ body.rtl .has-drop-cap:not(:focus)::first-letter {
32
+ float: initial;
33
+ margin-left: 0.1em;
34
+ }
35
+
31
36
  // Prevent the dropcap from breaking out of the box when a background is applied.
32
37
  p.has-drop-cap.has-background {
33
38
  overflow: hidden;
@@ -23,6 +23,14 @@
23
23
  },
24
24
  "byline": {
25
25
  "type": "string"
26
+ },
27
+ "isLink": {
28
+ "type": "boolean",
29
+ "default": false
30
+ },
31
+ "linkTarget": {
32
+ "type": "string",
33
+ "default": "_self"
26
34
  }
27
35
  },
28
36
  "usesContext": [ "postType", "postId", "queryId" ],
@@ -46,9 +46,10 @@ function PostAuthorEdit( {
46
46
 
47
47
  const { editEntityRecord } = useDispatch( coreStore );
48
48
 
49
- const { textAlign, showAvatar, showBio, byline } = attributes;
50
-
49
+ const { textAlign, showAvatar, showBio, byline, isLink, linkTarget } =
50
+ attributes;
51
51
  const avatarSizes = [];
52
+ const authorName = authorDetails?.name || __( 'Post Author' );
52
53
  if ( authorDetails ) {
53
54
  Object.keys( authorDetails.avatar_urls ).forEach( ( size ) => {
54
55
  avatarSizes.push( {
@@ -118,6 +119,22 @@ function PostAuthorEdit( {
118
119
  setAttributes( { showBio: ! showBio } )
119
120
  }
120
121
  />
122
+ <ToggleControl
123
+ label={ __( 'Link author name to author page' ) }
124
+ checked={ isLink }
125
+ onChange={ () => setAttributes( { isLink: ! isLink } ) }
126
+ />
127
+ { isLink && (
128
+ <ToggleControl
129
+ label={ __( 'Open in new tab' ) }
130
+ onChange={ ( value ) =>
131
+ setAttributes( {
132
+ linkTarget: value ? '_blank' : '_self',
133
+ } )
134
+ }
135
+ checked={ linkTarget === '_blank' }
136
+ />
137
+ ) }
121
138
  </PanelBody>
122
139
  </InspectorControls>
123
140
 
@@ -158,7 +175,16 @@ function PostAuthorEdit( {
158
175
  />
159
176
  ) }
160
177
  <p className="wp-block-post-author__name">
161
- { authorDetails?.name || __( 'Post Author' ) }
178
+ { isLink ? (
179
+ <a
180
+ href="#post-author-pseudo-link"
181
+ onClick={ ( event ) => event.preventDefault() }
182
+ >
183
+ { authorName }
184
+ </a>
185
+ ) : (
186
+ authorName
187
+ ) }
162
188
  </p>
163
189
  { showBio && (
164
190
  <p
@@ -29,6 +29,12 @@ function render_block_core_post_author( $attributes, $content, $block ) {
29
29
  $attributes['avatarSize']
30
30
  ) : null;
31
31
 
32
+ $link = get_author_posts_url( $author_id );
33
+ $author_name = get_the_author_meta( 'display_name', $author_id );
34
+ if ( ! empty( $attributes['isLink'] && ! empty( $attributes['linkTarget'] ) ) ) {
35
+ $author_name = sprintf( '<a href="%1s" target="%2s">%2s</a>', esc_url( $link ), esc_attr( $attributes['linkTarget'] ), $author_name );
36
+ }
37
+
32
38
  $byline = ! empty( $attributes['byline'] ) ? $attributes['byline'] : false;
33
39
  $classes = array_merge(
34
40
  isset( $attributes['itemsJustification'] ) ? array( 'items-justified-' . $attributes['itemsJustification'] ) : array(),
@@ -41,7 +47,7 @@ function render_block_core_post_author( $attributes, $content, $block ) {
41
47
  ( ! empty( $attributes['showAvatar'] ) ? '<div class="wp-block-post-author__avatar">' . $avatar . '</div>' : '' ) .
42
48
  '<div class="wp-block-post-author__content">' .
43
49
  ( ! empty( $byline ) ? '<p class="wp-block-post-author__byline">' . wp_kses_post( $byline ) . '</p>' : '' ) .
44
- '<p class="wp-block-post-author__name">' . get_the_author_meta( 'display_name', $author_id ) . '</p>' .
50
+ '<p class="wp-block-post-author__name">' . $author_name . '</p>' .
45
51
  ( ! empty( $attributes['showBio'] ) ? '<p class="wp-block-post-author__bio">' . get_the_author_meta( 'user_description', $author_id ) . '</p>' : '' ) .
46
52
  '</div>' .
47
53
  '</div>';
@@ -62,7 +62,7 @@
62
62
  "color": true,
63
63
  "radius": true,
64
64
  "width": true,
65
- "__experimentalSelector": "img, .block-editor-media-placeholder",
65
+ "__experimentalSelector": "img, .block-editor-media-placeholder, .wp-block-post-featured-image__overlay",
66
66
  "__experimentalSkipSerialization": true,
67
67
  "__experimentalDefaultControls": {
68
68
  "color": true,