@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.
- package/CHANGELOG.md +2 -0
- package/build/code/utils.js +3 -3
- package/build/code/utils.js.map +1 -1
- package/build/group/edit.js +1 -1
- package/build/group/edit.js.map +1 -1
- package/build/navigation/edit/index.js +12 -12
- package/build/navigation/edit/index.js.map +1 -1
- package/build/paragraph/deprecated.js +49 -10
- package/build/paragraph/deprecated.js.map +1 -1
- package/build/paragraph/edit.js +19 -3
- package/build/paragraph/edit.js.map +1 -1
- package/build/paragraph/save.js +3 -1
- package/build/paragraph/save.js.map +1 -1
- package/build/post-author/edit.js +20 -2
- package/build/post-author/edit.js.map +1 -1
- package/build/post-author/index.js +8 -0
- package/build/post-author/index.js.map +1 -1
- package/build/post-featured-image/index.js +1 -1
- package/build/post-featured-image/overlay.js +2 -2
- package/build/post-featured-image/overlay.js.map +1 -1
- package/build/post-terms/index.js +4 -0
- package/build/post-terms/index.js.map +1 -1
- package/build/query/edit/inspector-controls/author-control.js +2 -1
- package/build/query/edit/inspector-controls/author-control.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +1 -1
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/inspector-controls/parent-control.js +2 -1
- package/build/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build/query/edit/inspector-controls/taxonomy-controls.js +2 -1
- package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build/query/utils.js +1 -1
- package/build/query/utils.js.map +1 -1
- package/build/quote/index.js +0 -1
- package/build/quote/index.js.map +1 -1
- package/build/site-title/index.js +2 -1
- package/build/site-title/index.js.map +1 -1
- package/build/template-part/index.js +2 -2
- package/build/template-part/index.js.map +1 -1
- package/build/video/edit.js +13 -1
- package/build/video/edit.js.map +1 -1
- package/build-module/code/utils.js +3 -3
- package/build-module/code/utils.js.map +1 -1
- package/build-module/group/edit.js +1 -1
- package/build-module/group/edit.js.map +1 -1
- package/build-module/navigation/edit/index.js +12 -12
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/paragraph/deprecated.js +49 -11
- package/build-module/paragraph/deprecated.js.map +1 -1
- package/build-module/paragraph/edit.js +19 -3
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/paragraph/save.js +2 -1
- package/build-module/paragraph/save.js.map +1 -1
- package/build-module/post-author/edit.js +21 -2
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-author/index.js +8 -0
- package/build-module/post-author/index.js.map +1 -1
- package/build-module/post-featured-image/index.js +1 -1
- package/build-module/post-featured-image/overlay.js +2 -2
- package/build-module/post-featured-image/overlay.js.map +1 -1
- package/build-module/post-terms/index.js +4 -0
- package/build-module/post-terms/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/author-control.js +2 -1
- package/build-module/query/edit/inspector-controls/author-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +1 -1
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/parent-control.js +2 -1
- package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js +2 -1
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build-module/query/utils.js +1 -1
- package/build-module/query/utils.js.map +1 -1
- package/build-module/quote/index.js +0 -1
- package/build-module/quote/index.js.map +1 -1
- package/build-module/site-title/index.js +2 -1
- package/build-module/site-title/index.js.map +1 -1
- package/build-module/template-part/index.js +2 -2
- package/build-module/template-part/index.js.map +1 -1
- package/build-module/video/edit.js +15 -3
- package/build-module/video/edit.js.map +1 -1
- package/build-style/code/style-rtl.css +3 -0
- package/build-style/code/style.css +3 -0
- package/build-style/editor-rtl.css +69 -29
- package/build-style/editor.css +69 -29
- package/build-style/navigation/editor-rtl.css +4 -0
- package/build-style/navigation/editor.css +4 -0
- package/build-style/navigation/style-rtl.css +3 -0
- package/build-style/navigation/style.css +3 -0
- package/build-style/paragraph/style-rtl.css +5 -0
- package/build-style/paragraph/style.css +5 -0
- package/build-style/post-featured-image/editor-rtl.css +39 -29
- package/build-style/post-featured-image/editor.css +39 -29
- package/build-style/post-terms/style-rtl.css +4 -1
- package/build-style/post-terms/style.css +4 -1
- package/build-style/site-title/editor-rtl.css +4 -0
- package/build-style/site-title/editor.css +4 -0
- package/build-style/site-title/style-rtl.css +79 -0
- package/build-style/site-title/style.css +79 -0
- package/build-style/style-rtl.css +19 -1
- package/build-style/style.css +19 -1
- package/build-style/video/editor-rtl.css +22 -0
- package/build-style/video/editor.css +22 -0
- package/package.json +28 -28
- package/src/categories/index.php +1 -1
- package/src/code/style.scss +12 -7
- package/src/code/utils.js +3 -3
- package/src/comment-author-name/index.php +1 -1
- package/src/comment-reply-link/index.php +1 -1
- package/src/comment-template/index.php +2 -3
- package/src/cover/index.php +1 -1
- package/src/group/edit.js +1 -1
- package/src/latest-posts/index.php +1 -1
- package/src/navigation/edit/index.js +12 -10
- package/src/navigation/editor.scss +6 -0
- package/src/navigation/style.scss +8 -0
- package/src/page-list/index.php +2 -2
- package/src/paragraph/deprecated.js +36 -0
- package/src/paragraph/edit.js +23 -8
- package/src/paragraph/save.js +5 -1
- package/src/paragraph/style.scss +5 -0
- package/src/post-author/block.json +8 -0
- package/src/post-author/edit.js +29 -3
- package/src/post-author/index.php +7 -1
- package/src/post-featured-image/block.json +1 -1
- package/src/post-featured-image/editor.scss +79 -72
- package/src/post-featured-image/index.php +18 -24
- package/src/post-featured-image/overlay.js +17 -14
- package/src/post-terms/block.json +4 -0
- package/src/post-terms/style.scss +7 -2
- package/src/query/edit/inspector-controls/author-control.js +1 -0
- package/src/query/edit/inspector-controls/index.js +1 -4
- package/src/query/edit/inspector-controls/parent-control.js +1 -0
- package/src/query/edit/inspector-controls/taxonomy-controls.js +1 -0
- package/src/query/utils.js +1 -1
- package/src/quote/block.json +0 -1
- package/src/site-title/block.json +2 -1
- package/src/site-title/editor.scss +6 -0
- package/src/site-title/style.scss +5 -0
- package/src/style.scss +1 -0
- package/src/template-part/index.js +2 -2
- package/src/video/edit.js +19 -0
- package/src/video/editor.scss +37 -0
- package/build/navigation-submenu/view.js +0 -56
- package/build/navigation-submenu/view.js.map +0 -1
- package/build-module/navigation-submenu/view.js +0 -54
- package/build-module/navigation-submenu/view.js.map +0 -1
- 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.
|
|
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.
|
|
35
|
-
"@wordpress/api-fetch": "^6.
|
|
36
|
-
"@wordpress/autop": "^3.
|
|
37
|
-
"@wordpress/blob": "^3.
|
|
38
|
-
"@wordpress/block-editor": "^10.
|
|
39
|
-
"@wordpress/blocks": "^11.18.
|
|
40
|
-
"@wordpress/components": "^21.
|
|
41
|
-
"@wordpress/compose": "^5.
|
|
42
|
-
"@wordpress/core-data": "^5.
|
|
43
|
-
"@wordpress/data": "^7.
|
|
44
|
-
"@wordpress/date": "^4.
|
|
45
|
-
"@wordpress/deprecated": "^3.
|
|
46
|
-
"@wordpress/dom": "^3.
|
|
47
|
-
"@wordpress/element": "^4.
|
|
48
|
-
"@wordpress/hooks": "^3.
|
|
49
|
-
"@wordpress/html-entities": "^3.
|
|
50
|
-
"@wordpress/i18n": "^4.
|
|
51
|
-
"@wordpress/icons": "^9.
|
|
52
|
-
"@wordpress/keycodes": "^3.
|
|
53
|
-
"@wordpress/notices": "^3.
|
|
54
|
-
"@wordpress/primitives": "^3.
|
|
55
|
-
"@wordpress/reusable-blocks": "^3.
|
|
56
|
-
"@wordpress/rich-text": "^5.
|
|
57
|
-
"@wordpress/server-side-render": "^3.
|
|
58
|
-
"@wordpress/url": "^3.
|
|
59
|
-
"@wordpress/viewport": "^4.
|
|
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": "
|
|
76
|
+
"gitHead": "8d42d2febb7d0ba8372a33e560a62f5a5f6a9112"
|
|
77
77
|
}
|
package/src/categories/index.php
CHANGED
package/src/code/style.scss
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
//
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
*
|
|
2
|
+
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
/**
|
package/src/cover/index.php
CHANGED
|
@@ -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 ) . '%
|
|
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
|
|
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
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
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 {
|
package/src/page-list/index.php
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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: {
|
package/src/paragraph/edit.js
CHANGED
|
@@ -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( {
|
|
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
|
-
|
|
109
|
-
|
|
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>
|
package/src/paragraph/save.js
CHANGED
|
@@ -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':
|
|
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
|
|
package/src/paragraph/style.scss
CHANGED
|
@@ -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;
|
package/src/post-author/edit.js
CHANGED
|
@@ -46,9 +46,10 @@ function PostAuthorEdit( {
|
|
|
46
46
|
|
|
47
47
|
const { editEntityRecord } = useDispatch( coreStore );
|
|
48
48
|
|
|
49
|
-
const { textAlign, showAvatar, showBio, byline } =
|
|
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
|
-
{
|
|
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">' .
|
|
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,
|