@wordpress/block-library 9.35.1-next.dc3f6d3c1.0 → 9.36.1-next.6deb34194.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/accordion/view.js +46 -4
- package/build/accordion/view.js.map +2 -2
- package/build/accordion-heading/block.json +1 -1
- package/build/accordion-heading/deprecated.js +1 -1
- package/build/accordion-heading/deprecated.js.map +2 -2
- package/build/accordion-panel/block.json +1 -1
- package/build/audio/index.js +13 -10
- package/build/audio/index.js.map +3 -3
- package/build/avatar/edit.js +13 -38
- package/build/avatar/edit.js.map +2 -2
- package/build/breadcrumbs/block.json +3 -2
- package/build/breadcrumbs/edit.js +18 -18
- package/build/breadcrumbs/edit.js.map +2 -2
- package/build/button/index.js +14 -11
- package/build/button/index.js.map +3 -3
- package/build/code/index.js +10 -7
- package/build/code/index.js.map +3 -3
- package/build/comments-pagination-numbers/block.json +7 -0
- package/build/cover/edit/block-controls.js +37 -3
- package/build/cover/edit/block-controls.js.map +3 -3
- package/build/cover/edit/cover-placeholder.js +0 -1
- package/build/cover/edit/cover-placeholder.js.map +2 -2
- package/build/cover/edit/embed-video-url-input.js +83 -0
- package/build/cover/edit/embed-video-url-input.js.map +7 -0
- package/build/cover/edit/index.js +60 -0
- package/build/cover/edit/index.js.map +2 -2
- package/build/cover/embed-video-utils.js +151 -0
- package/build/cover/embed-video-utils.js.map +7 -0
- package/build/cover/index.js +11 -5
- package/build/cover/index.js.map +3 -3
- package/build/cover/save.js +12 -0
- package/build/cover/save.js.map +2 -2
- package/build/cover/shared.js +3 -0
- package/build/cover/shared.js.map +2 -2
- package/build/details/index.js +10 -7
- package/build/details/index.js.map +3 -3
- package/build/file/index.js +15 -15
- package/build/file/index.js.map +3 -3
- package/build/freeform/block.json +1 -1
- package/build/gallery/edit.js +1 -3
- package/build/gallery/edit.js.map +2 -2
- package/build/gallery/transforms.js +7 -3
- package/build/gallery/transforms.js.map +2 -2
- package/build/heading/index.js +10 -7
- package/build/heading/index.js.map +3 -3
- package/build/html/modal.js +141 -121
- package/build/html/modal.js.map +3 -3
- package/build/image/edit.js +0 -1
- package/build/image/edit.js.map +2 -2
- package/build/image/image.js +0 -1
- package/build/image/image.js.map +2 -2
- package/build/image/index.js +19 -19
- package/build/image/index.js.map +3 -3
- package/build/index.js +9 -3
- package/build/index.js.map +2 -2
- package/build/list-item/index.js +9 -7
- package/build/list-item/index.js.map +3 -3
- package/build/math/block.json +28 -1
- package/build/math/edit.js +17 -2
- package/build/math/edit.js.map +2 -2
- package/build/media-text/index.js +16 -9
- package/build/media-text/index.js.map +3 -3
- package/build/media-text/media-container.js +0 -2
- package/build/media-text/media-container.js.map +2 -2
- package/build/missing/block.json +1 -1
- package/build/missing/edit.js +2 -2
- package/build/missing/edit.js.map +1 -1
- package/build/more/index.js +10 -7
- package/build/more/index.js.map +3 -3
- package/build/navigation-link/edit.js +36 -11
- package/build/navigation-link/edit.js.map +2 -2
- package/build/navigation-link/index.js +12 -9
- package/build/navigation-link/index.js.map +3 -3
- package/build/navigation-submenu/index.js +12 -9
- package/build/navigation-submenu/index.js.map +3 -3
- package/build/page-list-item/edit.js +4 -3
- package/build/page-list-item/edit.js.map +2 -2
- package/build/paragraph/deprecated-attributes.js +68 -0
- package/build/paragraph/deprecated-attributes.js.map +7 -0
- package/build/paragraph/edit.js +2 -0
- package/build/paragraph/edit.js.map +3 -3
- package/build/paragraph/index.js +10 -7
- package/build/paragraph/index.js.map +3 -3
- package/build/pattern/block.json +1 -1
- package/build/post-title/edit.js +6 -4
- package/build/post-title/edit.js.map +2 -2
- package/build/preformatted/index.js +10 -7
- package/build/preformatted/index.js.map +3 -3
- package/build/pullquote/index.js +12 -12
- package/build/pullquote/index.js.map +3 -3
- package/build/search/index.js +15 -17
- package/build/search/index.js.map +3 -3
- package/build/social-link/index.js +12 -9
- package/build/social-link/index.js.map +3 -3
- package/build/template-part/edit/index.js +37 -7
- package/build/template-part/edit/index.js.map +2 -2
- package/build/template-part/edit/utils/get-template-part-icon.js +9 -4
- package/build/template-part/edit/utils/get-template-part-icon.js.map +3 -3
- package/build/template-part/edit/utils/hooks.js +2 -3
- package/build/template-part/edit/utils/hooks.js.map +2 -2
- package/build/term-count/index.js +1 -0
- package/build/term-count/index.js.map +2 -2
- package/build/term-name/index.js +1 -0
- package/build/term-name/index.js.map +2 -2
- package/build/verse/index.js +10 -7
- package/build/verse/index.js.map +3 -3
- package/build/video/index.js +13 -10
- package/build/video/index.js.map +3 -3
- package/build-module/accordion/view.js +46 -4
- package/build-module/accordion/view.js.map +2 -2
- package/build-module/accordion-heading/block.json +1 -1
- package/build-module/accordion-heading/deprecated.js +1 -1
- package/build-module/accordion-heading/deprecated.js.map +2 -2
- package/build-module/accordion-panel/block.json +1 -1
- package/build-module/audio/index.js +13 -10
- package/build-module/audio/index.js.map +2 -2
- package/build-module/avatar/edit.js +13 -38
- package/build-module/avatar/edit.js.map +2 -2
- package/build-module/breadcrumbs/block.json +3 -2
- package/build-module/breadcrumbs/edit.js +18 -18
- package/build-module/breadcrumbs/edit.js.map +2 -2
- package/build-module/button/index.js +14 -11
- package/build-module/button/index.js.map +2 -2
- package/build-module/code/index.js +10 -7
- package/build-module/code/index.js.map +2 -2
- package/build-module/comments-pagination-numbers/block.json +7 -0
- package/build-module/cover/edit/block-controls.js +27 -3
- package/build-module/cover/edit/block-controls.js.map +2 -2
- package/build-module/cover/edit/cover-placeholder.js +0 -1
- package/build-module/cover/edit/cover-placeholder.js.map +2 -2
- package/build-module/cover/edit/embed-video-url-input.js +67 -0
- package/build-module/cover/edit/embed-video-url-input.js.map +7 -0
- package/build-module/cover/edit/index.js +61 -0
- package/build-module/cover/edit/index.js.map +2 -2
- package/build-module/cover/embed-video-utils.js +122 -0
- package/build-module/cover/embed-video-utils.js.map +7 -0
- package/build-module/cover/index.js +11 -5
- package/build-module/cover/index.js.map +2 -2
- package/build-module/cover/save.js +13 -0
- package/build-module/cover/save.js.map +2 -2
- package/build-module/cover/shared.js +2 -0
- package/build-module/cover/shared.js.map +2 -2
- package/build-module/details/index.js +10 -7
- package/build-module/details/index.js.map +2 -2
- package/build-module/file/index.js +15 -15
- package/build-module/file/index.js.map +2 -2
- package/build-module/freeform/block.json +1 -1
- package/build-module/gallery/edit.js +1 -3
- package/build-module/gallery/edit.js.map +2 -2
- package/build-module/gallery/transforms.js +7 -3
- package/build-module/gallery/transforms.js.map +2 -2
- package/build-module/heading/index.js +10 -7
- package/build-module/heading/index.js.map +2 -2
- package/build-module/html/modal.js +143 -122
- package/build-module/html/modal.js.map +2 -2
- package/build-module/image/edit.js +0 -1
- package/build-module/image/edit.js.map +2 -2
- package/build-module/image/image.js +0 -1
- package/build-module/image/image.js.map +2 -2
- package/build-module/image/index.js +19 -19
- package/build-module/image/index.js.map +2 -2
- package/build-module/index.js +9 -3
- package/build-module/index.js.map +2 -2
- package/build-module/list-item/index.js +9 -7
- package/build-module/list-item/index.js.map +2 -2
- package/build-module/math/block.json +28 -1
- package/build-module/math/edit.js +18 -3
- package/build-module/math/edit.js.map +2 -2
- package/build-module/media-text/index.js +16 -9
- package/build-module/media-text/index.js.map +2 -2
- package/build-module/media-text/media-container.js +0 -2
- package/build-module/media-text/media-container.js.map +2 -2
- package/build-module/missing/block.json +1 -1
- package/build-module/missing/edit.js +2 -2
- package/build-module/missing/edit.js.map +1 -1
- package/build-module/more/index.js +10 -7
- package/build-module/more/index.js.map +2 -2
- package/build-module/navigation-link/edit.js +37 -12
- package/build-module/navigation-link/edit.js.map +2 -2
- package/build-module/navigation-link/index.js +12 -9
- package/build-module/navigation-link/index.js.map +2 -2
- package/build-module/navigation-submenu/index.js +12 -9
- package/build-module/navigation-submenu/index.js.map +2 -2
- package/build-module/page-list-item/edit.js +4 -3
- package/build-module/page-list-item/edit.js.map +2 -2
- package/build-module/paragraph/deprecated-attributes.js +37 -0
- package/build-module/paragraph/deprecated-attributes.js.map +7 -0
- package/build-module/paragraph/edit.js +2 -0
- package/build-module/paragraph/edit.js.map +2 -2
- package/build-module/paragraph/index.js +10 -7
- package/build-module/paragraph/index.js.map +2 -2
- package/build-module/pattern/block.json +1 -1
- package/build-module/post-title/edit.js +6 -4
- package/build-module/post-title/edit.js.map +2 -2
- package/build-module/preformatted/index.js +10 -7
- package/build-module/preformatted/index.js.map +2 -2
- package/build-module/pullquote/index.js +12 -12
- package/build-module/pullquote/index.js.map +2 -2
- package/build-module/search/index.js +15 -17
- package/build-module/search/index.js.map +2 -2
- package/build-module/social-link/index.js +12 -9
- package/build-module/social-link/index.js.map +2 -2
- package/build-module/template-part/edit/index.js +37 -7
- package/build-module/template-part/edit/index.js.map +2 -2
- package/build-module/template-part/edit/utils/get-template-part-icon.js +10 -4
- package/build-module/template-part/edit/utils/get-template-part-icon.js.map +2 -2
- package/build-module/template-part/edit/utils/hooks.js +2 -3
- package/build-module/template-part/edit/utils/hooks.js.map +2 -2
- package/build-module/term-count/index.js +1 -0
- package/build-module/term-count/index.js.map +2 -2
- package/build-module/term-name/index.js +1 -0
- package/build-module/term-name/index.js.map +2 -2
- package/build-module/verse/index.js +10 -7
- package/build-module/verse/index.js.map +2 -2
- package/build-module/video/index.js +13 -10
- package/build-module/video/index.js.map +2 -2
- package/build-style/accordion/style-rtl.css +3 -0
- package/build-style/accordion/style.css +3 -0
- package/build-style/accordion-heading/style-rtl.css +2 -19
- package/build-style/accordion-heading/style.css +2 -19
- package/build-style/accordion-item/style-rtl.css +0 -7
- package/build-style/accordion-item/style.css +0 -7
- package/build-style/accordion-panel/style-rtl.css +1 -4
- package/build-style/accordion-panel/style.css +1 -4
- package/build-style/classic-rtl.css +24 -0
- package/build-style/classic.css +24 -0
- package/build-style/common-rtl.css +4 -4
- package/build-style/common.css +4 -0
- package/build-style/cover/style-rtl.css +47 -0
- package/build-style/cover/style.css +47 -0
- package/build-style/editor-rtl.css +11 -13
- package/build-style/editor.css +11 -13
- package/build-style/html/editor-rtl.css +11 -13
- package/build-style/html/editor.css +11 -13
- package/build-style/style-rtl.css +59 -33
- package/build-style/style.css +59 -29
- package/build-style/verse/style-rtl.css +2 -0
- package/build-style/verse/style.css +2 -0
- package/package.json +40 -38
- package/src/accordion/style.scss +4 -0
- package/src/accordion/view.js +60 -3
- package/src/accordion-heading/block.json +1 -1
- package/src/accordion-heading/deprecated.js +1 -1
- package/src/accordion-heading/style.scss +2 -38
- package/src/accordion-item/index.php +1 -0
- package/src/accordion-item/style.scss +2 -9
- package/src/accordion-panel/block.json +1 -1
- package/src/accordion-panel/style.scss +1 -5
- package/src/audio/index.js +14 -10
- package/src/avatar/edit.js +68 -83
- package/src/breadcrumbs/block.json +3 -2
- package/src/breadcrumbs/edit.js +18 -18
- package/src/breadcrumbs/index.php +103 -93
- package/src/button/index.js +15 -11
- package/src/classic.scss +38 -0
- package/src/code/index.js +11 -7
- package/src/comments-pagination-numbers/block.json +7 -0
- package/src/common.scss +4 -0
- package/src/cover/edit/block-controls.js +26 -2
- package/src/cover/edit/cover-placeholder.js +0 -1
- package/src/cover/edit/embed-video-url-input.js +74 -0
- package/src/cover/edit/index.js +81 -0
- package/src/cover/embed-video-utils.js +196 -0
- package/src/cover/index.js +12 -5
- package/src/cover/index.php +106 -0
- package/src/cover/save.js +14 -0
- package/src/cover/shared.js +1 -0
- package/src/cover/style.scss +47 -0
- package/src/details/index.js +11 -7
- package/src/file/index.js +16 -15
- package/src/freeform/block.json +1 -1
- package/src/gallery/edit.js +4 -3
- package/src/gallery/transforms.js +6 -2
- package/src/heading/index.js +11 -7
- package/src/html/editor.scss +10 -15
- package/src/html/modal.js +54 -30
- package/src/image/edit.js +0 -1
- package/src/image/image.js +0 -1
- package/src/image/index.js +20 -19
- package/src/image/index.php +1 -0
- package/src/index.js +9 -3
- package/src/list-item/index.js +10 -7
- package/src/math/block.json +28 -1
- package/src/math/edit.js +18 -3
- package/src/media-text/index.js +17 -9
- package/src/media-text/media-container.js +0 -2
- package/src/missing/block.json +1 -1
- package/src/missing/edit.js +2 -2
- package/src/more/index.js +11 -7
- package/src/navigation-link/edit.js +72 -26
- package/src/navigation-link/index.js +13 -9
- package/src/navigation-submenu/index.js +13 -9
- package/src/page-list/index.php +3 -4
- package/src/page-list-item/edit.js +4 -3
- package/src/paragraph/deprecated-attributes.js +45 -0
- package/src/paragraph/edit.js +2 -0
- package/src/paragraph/index.js +11 -7
- package/src/pattern/block.json +1 -1
- package/src/post-title/edit.js +8 -4
- package/src/post-title/index.php +1 -1
- package/src/preformatted/index.js +11 -7
- package/src/pullquote/index.js +13 -12
- package/src/search/index.js +15 -16
- package/src/social-link/index.js +13 -9
- package/src/style.scss +1 -0
- package/src/template-part/edit/index.js +44 -6
- package/src/template-part/edit/utils/get-template-part-icon.js +23 -4
- package/src/template-part/edit/utils/hooks.js +2 -4
- package/src/term-count/index.js +1 -0
- package/src/term-name/index.js +1 -0
- package/src/verse/index.js +11 -7
- package/src/verse/style.scss +4 -0
- package/src/video/index.js +14 -10
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -17,30 +17,45 @@
|
|
|
17
17
|
* @return string Returns the post breadcrumb for hierarchical post types.
|
|
18
18
|
*/
|
|
19
19
|
function render_block_core_breadcrumbs( $attributes, $content, $block ) {
|
|
20
|
-
$
|
|
21
|
-
|
|
20
|
+
$is_front_page = is_front_page();
|
|
21
|
+
|
|
22
|
+
if ( ! $attributes['showOnHomePage'] && $is_front_page ) {
|
|
22
23
|
return '';
|
|
23
24
|
}
|
|
24
25
|
|
|
26
|
+
$is_home = is_home();
|
|
27
|
+
$page_for_posts = get_option( 'page_for_posts' );
|
|
25
28
|
$breadcrumb_items = array();
|
|
26
29
|
|
|
27
|
-
if ( $attributes['
|
|
28
|
-
if
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
if ( $attributes['showHomeItem'] ) {
|
|
31
|
+
// We make `home` a link if not on front page, or if front page
|
|
32
|
+
// is set to a custom page and is paged.
|
|
33
|
+
if ( ! $is_front_page || ( 'page' === get_option( 'show_on_front' ) && (int) get_query_var( 'page' ) > 1 ) ) {
|
|
34
|
+
$breadcrumb_items[] = array(
|
|
35
|
+
'label' => __( 'Home' ),
|
|
36
|
+
'url' => home_url( '/' ),
|
|
32
37
|
);
|
|
33
38
|
} else {
|
|
34
39
|
$breadcrumb_items[] = block_core_breadcrumbs_create_item( __( 'Home' ), block_core_breadcrumbs_is_paged() );
|
|
35
40
|
}
|
|
36
41
|
}
|
|
37
42
|
|
|
38
|
-
// Handle home
|
|
39
|
-
if ( $
|
|
40
|
-
//
|
|
43
|
+
// Handle home.
|
|
44
|
+
if ( $is_home ) {
|
|
45
|
+
// These checks are explicitly nested in order not to execute the `else` branch.
|
|
46
|
+
if ( $page_for_posts ) {
|
|
47
|
+
$breadcrumb_items[] = block_core_breadcrumbs_create_item( block_core_breadcrumbs_get_post_title( $page_for_posts ), block_core_breadcrumbs_is_paged() );
|
|
48
|
+
}
|
|
41
49
|
if ( block_core_breadcrumbs_is_paged() ) {
|
|
42
50
|
$breadcrumb_items[] = block_core_breadcrumbs_create_page_number_item();
|
|
43
51
|
}
|
|
52
|
+
} elseif ( $is_front_page ) {
|
|
53
|
+
// Handle front page.
|
|
54
|
+
// This check is explicitly nested in order not to execute the `else` branch.
|
|
55
|
+
// If front page is set to custom page and is paged, add the page number.
|
|
56
|
+
if ( (int) get_query_var( 'page' ) > 1 ) {
|
|
57
|
+
$breadcrumb_items[] = block_core_breadcrumbs_create_page_number_item( 'page' );
|
|
58
|
+
}
|
|
44
59
|
} elseif ( is_search() ) {
|
|
45
60
|
// Handle search results.
|
|
46
61
|
$is_paged = block_core_breadcrumbs_is_paged();
|
|
@@ -53,8 +68,8 @@ function render_block_core_breadcrumbs( $attributes, $content, $block ) {
|
|
|
53
68
|
}
|
|
54
69
|
} elseif ( is_404() ) {
|
|
55
70
|
// Handle 404 pages.
|
|
56
|
-
$breadcrumb_items[] =
|
|
57
|
-
__( 'Page not found' )
|
|
71
|
+
$breadcrumb_items[] = array(
|
|
72
|
+
'label' => __( 'Page not found' ),
|
|
58
73
|
);
|
|
59
74
|
} elseif ( is_archive() ) {
|
|
60
75
|
// Handle archive pages (taxonomy, post type, date, author archives).
|
|
@@ -100,7 +115,20 @@ function render_block_core_breadcrumbs( $attributes, $content, $block ) {
|
|
|
100
115
|
$show_terms = $attributes['prefersTaxonomy'];
|
|
101
116
|
}
|
|
102
117
|
|
|
103
|
-
//
|
|
118
|
+
// Add post type archive link if applicable.
|
|
119
|
+
$post_type_object = get_post_type_object( $post_type );
|
|
120
|
+
$archive_link = get_post_type_archive_link( $post_type );
|
|
121
|
+
if ( $archive_link && untrailingslashit( home_url() ) !== untrailingslashit( $archive_link ) ) {
|
|
122
|
+
$label = $post_type_object->labels->archives;
|
|
123
|
+
if ( 'post' === $post_type && $page_for_posts ) {
|
|
124
|
+
$label = block_core_breadcrumbs_get_post_title( $page_for_posts );
|
|
125
|
+
}
|
|
126
|
+
$breadcrumb_items[] = array(
|
|
127
|
+
'label' => $label,
|
|
128
|
+
'url' => $archive_link,
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
// Build breadcrumb trail based on hierarchical structure or taxonomy terms.
|
|
104
132
|
if ( ! $show_terms ) {
|
|
105
133
|
$breadcrumb_items = array_merge( $breadcrumb_items, block_core_breadcrumbs_get_hierarchical_post_type_breadcrumbs( $post_id ) );
|
|
106
134
|
} else {
|
|
@@ -108,27 +136,26 @@ function render_block_core_breadcrumbs( $attributes, $content, $block ) {
|
|
|
108
136
|
}
|
|
109
137
|
|
|
110
138
|
// Add post title: linked when viewing a paginated page, plain text otherwise.
|
|
111
|
-
$is_paged = (int) get_query_var( 'page' ) > 1;
|
|
139
|
+
$is_paged = (int) get_query_var( 'page' ) > 1 || (int) get_query_var( 'cpage' ) > 1;
|
|
112
140
|
$title = block_core_breadcrumbs_get_post_title( $post );
|
|
113
141
|
|
|
114
142
|
if ( $is_paged ) {
|
|
115
|
-
$breadcrumb_items[] =
|
|
116
|
-
|
|
117
|
-
$
|
|
118
|
-
true
|
|
143
|
+
$breadcrumb_items[] = array(
|
|
144
|
+
'label' => $title,
|
|
145
|
+
'url' => get_permalink( $post ),
|
|
146
|
+
'allow_html' => true,
|
|
119
147
|
);
|
|
120
|
-
|
|
121
|
-
$breadcrumb_items[] = block_core_breadcrumbs_create_page_number_item( 'page' );
|
|
148
|
+
$breadcrumb_items[] = block_core_breadcrumbs_create_page_number_item( (int) get_query_var( 'cpage' ) > 1 ? 'cpage' : 'page' );
|
|
122
149
|
} else {
|
|
123
|
-
$breadcrumb_items[] =
|
|
124
|
-
$title,
|
|
125
|
-
true
|
|
150
|
+
$breadcrumb_items[] = array(
|
|
151
|
+
'label' => $title,
|
|
152
|
+
'allow_html' => true,
|
|
126
153
|
);
|
|
127
154
|
}
|
|
128
155
|
}
|
|
129
156
|
|
|
130
|
-
// Remove
|
|
131
|
-
if ( ! $attributes['
|
|
157
|
+
// Remove current item if disabled.
|
|
158
|
+
if ( ! $attributes['showCurrentItem'] && ! empty( $breadcrumb_items ) ) {
|
|
132
159
|
array_pop( $breadcrumb_items );
|
|
133
160
|
}
|
|
134
161
|
|
|
@@ -150,7 +177,11 @@ function render_block_core_breadcrumbs( $attributes, $content, $block ) {
|
|
|
150
177
|
'',
|
|
151
178
|
array_map(
|
|
152
179
|
static function ( $item ) {
|
|
153
|
-
|
|
180
|
+
$label = ! empty( $item['allow_html'] ) ? wp_kses_post( $item['label'] ) : esc_html( $item['label'] );
|
|
181
|
+
if ( ! empty( $item['url'] ) ) {
|
|
182
|
+
return '<li><a href="' . esc_url( $item['url'] ) . '">' . $label . '</a></li>';
|
|
183
|
+
}
|
|
184
|
+
return '<li><span aria-current="page">' . $label . '</span></li>';
|
|
154
185
|
},
|
|
155
186
|
$breadcrumb_items
|
|
156
187
|
)
|
|
@@ -177,52 +208,30 @@ function block_core_breadcrumbs_is_paged() {
|
|
|
177
208
|
*
|
|
178
209
|
* @since 7.0.0
|
|
179
210
|
* @param string $query_var Optional. Query variable to get current page number. Default 'paged'.
|
|
180
|
-
* @return
|
|
211
|
+
* @return array The "Page X" breadcrumb item data.
|
|
181
212
|
*/
|
|
182
213
|
function block_core_breadcrumbs_create_page_number_item( $query_var = 'paged' ) {
|
|
183
214
|
$paged = (int) get_query_var( $query_var );
|
|
184
215
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
216
|
+
if ( 'cpage' === $query_var ) {
|
|
217
|
+
return array(
|
|
218
|
+
'label' => sprintf(
|
|
219
|
+
/* translators: %s: comment page number */
|
|
220
|
+
__( 'Comments Page %s' ),
|
|
221
|
+
number_format_i18n( $paged )
|
|
222
|
+
),
|
|
223
|
+
);
|
|
224
|
+
}
|
|
190
225
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
* @param string $text The link text (will be escaped).
|
|
198
|
-
* @param bool $allow_html Whether to allow HTML in the text. If true, uses wp_kses_post(), otherwise uses esc_html(). Default false.
|
|
199
|
-
*
|
|
200
|
-
* @return string The breadcrumb link HTML.
|
|
201
|
-
*/
|
|
202
|
-
function block_core_breadcrumbs_create_link( $url, $text, $allow_html = false ) {
|
|
203
|
-
return sprintf(
|
|
204
|
-
'<a href="%s">%s</a>',
|
|
205
|
-
esc_url( $url ),
|
|
206
|
-
$allow_html ? wp_kses_post( $text ) : esc_html( $text )
|
|
226
|
+
return array(
|
|
227
|
+
'label' => sprintf(
|
|
228
|
+
/* translators: %s: page number */
|
|
229
|
+
__( 'Page %s' ),
|
|
230
|
+
number_format_i18n( $paged )
|
|
231
|
+
),
|
|
207
232
|
);
|
|
208
233
|
}
|
|
209
234
|
|
|
210
|
-
/**
|
|
211
|
-
* Creates a breadcrumb current page item.
|
|
212
|
-
*
|
|
213
|
-
* @since 7.0.0
|
|
214
|
-
*
|
|
215
|
-
* @param string $text The text content (will be escaped).
|
|
216
|
-
* @param bool $allow_html Whether to allow HTML in the text. If true, uses wp_kses_post(), otherwise uses esc_html(). Default false.
|
|
217
|
-
*
|
|
218
|
-
* @return string The breadcrumb current page HTML.
|
|
219
|
-
*/
|
|
220
|
-
function block_core_breadcrumbs_create_current_item( $text, $allow_html = false ) {
|
|
221
|
-
return sprintf(
|
|
222
|
-
'<span aria-current="page">%s</span>',
|
|
223
|
-
$allow_html ? wp_kses_post( $text ) : esc_html( $text )
|
|
224
|
-
);
|
|
225
|
-
}
|
|
226
235
|
|
|
227
236
|
/**
|
|
228
237
|
* Creates a breadcrumb item that's either a link or current page item.
|
|
@@ -232,17 +241,17 @@ function block_core_breadcrumbs_create_current_item( $text, $allow_html = false
|
|
|
232
241
|
*
|
|
233
242
|
* @since 7.0.0
|
|
234
243
|
*
|
|
235
|
-
* @param string $text The text content
|
|
244
|
+
* @param string $text The text content.
|
|
236
245
|
* @param bool $is_paged Whether we're on a paginated view.
|
|
237
|
-
* @param bool $allow_html Whether to allow HTML in the text. If true, uses wp_kses_post(), otherwise uses esc_html(). Default false.
|
|
238
246
|
*
|
|
239
|
-
* @return
|
|
247
|
+
* @return array The breadcrumb item data.
|
|
240
248
|
*/
|
|
241
|
-
function block_core_breadcrumbs_create_item( $text, $is_paged = false
|
|
249
|
+
function block_core_breadcrumbs_create_item( $text, $is_paged = false ) {
|
|
250
|
+
$item = array( 'label' => $text );
|
|
242
251
|
if ( $is_paged ) {
|
|
243
|
-
|
|
252
|
+
$item['url'] = get_pagenum_link( 1 );
|
|
244
253
|
}
|
|
245
|
-
return
|
|
254
|
+
return $item;
|
|
246
255
|
}
|
|
247
256
|
|
|
248
257
|
/**
|
|
@@ -267,9 +276,9 @@ function block_core_breadcrumbs_get_post_title( $post_id_or_object ) {
|
|
|
267
276
|
*
|
|
268
277
|
* @since 7.0.0
|
|
269
278
|
*
|
|
270
|
-
* @param int
|
|
279
|
+
* @param int $post_id The post ID.
|
|
271
280
|
*
|
|
272
|
-
* @return array Array of breadcrumb
|
|
281
|
+
* @return array Array of breadcrumb item data.
|
|
273
282
|
*/
|
|
274
283
|
function block_core_breadcrumbs_get_hierarchical_post_type_breadcrumbs( $post_id ) {
|
|
275
284
|
$breadcrumb_items = array();
|
|
@@ -277,10 +286,10 @@ function block_core_breadcrumbs_get_hierarchical_post_type_breadcrumbs( $post_id
|
|
|
277
286
|
$ancestors = array_reverse( $ancestors );
|
|
278
287
|
|
|
279
288
|
foreach ( $ancestors as $ancestor_id ) {
|
|
280
|
-
$breadcrumb_items[] =
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
true
|
|
289
|
+
$breadcrumb_items[] = array(
|
|
290
|
+
'label' => block_core_breadcrumbs_get_post_title( $ancestor_id ),
|
|
291
|
+
'url' => get_permalink( $ancestor_id ),
|
|
292
|
+
'allow_html' => true,
|
|
284
293
|
);
|
|
285
294
|
}
|
|
286
295
|
return $breadcrumb_items;
|
|
@@ -296,7 +305,7 @@ function block_core_breadcrumbs_get_hierarchical_post_type_breadcrumbs( $post_id
|
|
|
296
305
|
* @param int $term_id The term ID.
|
|
297
306
|
* @param string $taxonomy The taxonomy name.
|
|
298
307
|
*
|
|
299
|
-
* @return array Array of breadcrumb
|
|
308
|
+
* @return array Array of breadcrumb item data for ancestors.
|
|
300
309
|
*/
|
|
301
310
|
function block_core_breadcrumbs_get_term_ancestors_items( $term_id, $taxonomy ) {
|
|
302
311
|
$breadcrumb_items = array();
|
|
@@ -308,9 +317,9 @@ function block_core_breadcrumbs_get_term_ancestors_items( $term_id, $taxonomy )
|
|
|
308
317
|
foreach ( $term_ancestors as $ancestor_id ) {
|
|
309
318
|
$ancestor_term = get_term( $ancestor_id, $taxonomy );
|
|
310
319
|
if ( $ancestor_term && ! is_wp_error( $ancestor_term ) ) {
|
|
311
|
-
$breadcrumb_items[] =
|
|
312
|
-
|
|
313
|
-
$ancestor_term
|
|
320
|
+
$breadcrumb_items[] = array(
|
|
321
|
+
'label' => $ancestor_term->name,
|
|
322
|
+
'url' => get_term_link( $ancestor_term ),
|
|
314
323
|
);
|
|
315
324
|
}
|
|
316
325
|
}
|
|
@@ -327,7 +336,7 @@ function block_core_breadcrumbs_get_term_ancestors_items( $term_id, $taxonomy )
|
|
|
327
336
|
*
|
|
328
337
|
* @since 7.0.0
|
|
329
338
|
*
|
|
330
|
-
* @return array Array of breadcrumb
|
|
339
|
+
* @return array Array of breadcrumb item data.
|
|
331
340
|
*/
|
|
332
341
|
function block_core_breadcrumbs_get_archive_breadcrumbs() {
|
|
333
342
|
$breadcrumb_items = array();
|
|
@@ -354,16 +363,16 @@ function block_core_breadcrumbs_get_archive_breadcrumbs() {
|
|
|
354
363
|
if ( $year ) {
|
|
355
364
|
if ( $month ) {
|
|
356
365
|
// Year is linked if we have month.
|
|
357
|
-
$breadcrumb_items[] =
|
|
358
|
-
|
|
359
|
-
$year
|
|
366
|
+
$breadcrumb_items[] = array(
|
|
367
|
+
'label' => $year,
|
|
368
|
+
'url' => get_year_link( $year ),
|
|
360
369
|
);
|
|
361
370
|
|
|
362
371
|
if ( $day ) {
|
|
363
372
|
// Month is linked if we have day.
|
|
364
|
-
$breadcrumb_items[] =
|
|
365
|
-
|
|
366
|
-
|
|
373
|
+
$breadcrumb_items[] = array(
|
|
374
|
+
'label' => date_i18n( 'F', mktime( 0, 0, 0, $month, 1, $year ) ),
|
|
375
|
+
'url' => get_month_link( $year, $month ),
|
|
367
376
|
);
|
|
368
377
|
// Add day (current if not paginated, link if paginated).
|
|
369
378
|
$breadcrumb_items[] = block_core_breadcrumbs_create_item(
|
|
@@ -429,7 +438,7 @@ function block_core_breadcrumbs_get_archive_breadcrumbs() {
|
|
|
429
438
|
if ( $post_type_object ) {
|
|
430
439
|
// Add post type (current if not paginated, link if paginated).
|
|
431
440
|
$breadcrumb_items[] = block_core_breadcrumbs_create_item(
|
|
432
|
-
$post_type_object->labels->
|
|
441
|
+
$post_type_object->labels->archives,
|
|
433
442
|
$is_paged
|
|
434
443
|
);
|
|
435
444
|
}
|
|
@@ -462,10 +471,11 @@ function block_core_breadcrumbs_get_archive_breadcrumbs() {
|
|
|
462
471
|
* @param int $post_id The post ID.
|
|
463
472
|
* @param string $post_type The post type name.
|
|
464
473
|
*
|
|
465
|
-
* @return array Array of breadcrumb
|
|
474
|
+
* @return array Array of breadcrumb item data.
|
|
466
475
|
*/
|
|
467
476
|
function block_core_breadcrumbs_get_terms_breadcrumbs( $post_id, $post_type ) {
|
|
468
477
|
$breadcrumb_items = array();
|
|
478
|
+
|
|
469
479
|
// Get public taxonomies for this post type.
|
|
470
480
|
$taxonomies = wp_filter_object_list(
|
|
471
481
|
get_object_taxonomies( $post_type, 'objects' ),
|
|
@@ -476,7 +486,7 @@ function block_core_breadcrumbs_get_terms_breadcrumbs( $post_id, $post_type ) {
|
|
|
476
486
|
);
|
|
477
487
|
|
|
478
488
|
if ( empty( $taxonomies ) ) {
|
|
479
|
-
return
|
|
489
|
+
return $breadcrumb_items;
|
|
480
490
|
}
|
|
481
491
|
|
|
482
492
|
/**
|
|
@@ -550,9 +560,9 @@ function block_core_breadcrumbs_get_terms_breadcrumbs( $post_id, $post_type ) {
|
|
|
550
560
|
$breadcrumb_items,
|
|
551
561
|
block_core_breadcrumbs_get_term_ancestors_items( $term->term_id, $taxonomy_name )
|
|
552
562
|
);
|
|
553
|
-
$breadcrumb_items[] =
|
|
554
|
-
|
|
555
|
-
$term
|
|
563
|
+
$breadcrumb_items[] = array(
|
|
564
|
+
'label' => $term->name,
|
|
565
|
+
'url' => get_term_link( $term ),
|
|
556
566
|
);
|
|
557
567
|
}
|
|
558
568
|
return $breadcrumb_items;
|
package/src/button/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import { button as icon } from '@wordpress/icons';
|
|
6
|
+
import { privateApis as blocksPrivateApis } from '@wordpress/blocks';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Internal dependencies
|
|
@@ -12,6 +13,9 @@ import deprecated from './deprecated';
|
|
|
12
13
|
import edit from './edit';
|
|
13
14
|
import metadata from './block.json';
|
|
14
15
|
import save from './save';
|
|
16
|
+
import { unlock } from '../lock-unlock';
|
|
17
|
+
|
|
18
|
+
const { fieldsKey, formKey } = unlock( blocksPrivateApis );
|
|
15
19
|
|
|
16
20
|
const { name } = metadata;
|
|
17
21
|
|
|
@@ -34,27 +38,27 @@ export const settings = {
|
|
|
34
38
|
} ),
|
|
35
39
|
};
|
|
36
40
|
|
|
37
|
-
if ( window.
|
|
38
|
-
settings
|
|
41
|
+
if ( window.__experimentalContentOnlyInspectorFields ) {
|
|
42
|
+
settings[ fieldsKey ] = [
|
|
39
43
|
{
|
|
44
|
+
id: 'text',
|
|
40
45
|
label: __( 'Content' ),
|
|
41
|
-
type: '
|
|
42
|
-
shownByDefault: true,
|
|
43
|
-
mapping: {
|
|
44
|
-
value: 'text',
|
|
45
|
-
},
|
|
46
|
+
type: 'richtext',
|
|
46
47
|
},
|
|
47
48
|
{
|
|
49
|
+
id: 'link',
|
|
48
50
|
label: __( 'Link' ),
|
|
49
|
-
type: '
|
|
50
|
-
shownByDefault: false,
|
|
51
|
+
type: 'link',
|
|
51
52
|
mapping: {
|
|
52
|
-
|
|
53
|
+
url: 'url',
|
|
53
54
|
rel: 'rel',
|
|
54
|
-
|
|
55
|
+
linkTarget: 'linkTarget',
|
|
55
56
|
},
|
|
56
57
|
},
|
|
57
58
|
];
|
|
59
|
+
settings[ formKey ] = {
|
|
60
|
+
fields: [ 'text' ],
|
|
61
|
+
};
|
|
58
62
|
}
|
|
59
63
|
|
|
60
64
|
export const init = () => initBlock( { name, metadata, settings } );
|
package/src/classic.scss
CHANGED
|
@@ -20,3 +20,41 @@
|
|
|
20
20
|
background: #32373c;
|
|
21
21
|
color: $white;
|
|
22
22
|
}
|
|
23
|
+
|
|
24
|
+
// These rules are needed to enforce the default styling of
|
|
25
|
+
// the Accordion Heading block in the classic theme.
|
|
26
|
+
.wp-block-accordion-heading {
|
|
27
|
+
// Heading elements may have default margins applied, so those
|
|
28
|
+
// styles need to be reset.
|
|
29
|
+
margin: 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.wp-block-accordion-heading__toggle {
|
|
33
|
+
// Button elements can have colors applied with high CSS specificity,
|
|
34
|
+
// and since this specificity is impossible to predict, we use
|
|
35
|
+
// `!important` to reset the color.
|
|
36
|
+
background-color: inherit !important;
|
|
37
|
+
color: inherit !important;
|
|
38
|
+
|
|
39
|
+
&:not(:focus-visible) {
|
|
40
|
+
outline: none;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&:hover,
|
|
44
|
+
&:focus {
|
|
45
|
+
// Sometimes styles are applied when the button element is
|
|
46
|
+
// hovered over or focused. This isn't expected for accordion
|
|
47
|
+
// toggle buttons, so reset those styles here.
|
|
48
|
+
text-decoration: none;
|
|
49
|
+
background-color: inherit !important;
|
|
50
|
+
box-shadow: none;
|
|
51
|
+
color: inherit;
|
|
52
|
+
border: none;
|
|
53
|
+
padding: var(--wp--preset--spacing--20, 1em) 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&:focus-visible {
|
|
57
|
+
outline-offset: 0;
|
|
58
|
+
outline: auto;
|
|
59
|
+
}
|
|
60
|
+
}
|
package/src/code/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import { code as icon } from '@wordpress/icons';
|
|
6
|
+
import { privateApis as blocksPrivateApis } from '@wordpress/blocks';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Internal dependencies
|
|
@@ -12,6 +13,9 @@ import edit from './edit';
|
|
|
12
13
|
import metadata from './block.json';
|
|
13
14
|
import save from './save';
|
|
14
15
|
import transforms from './transforms';
|
|
16
|
+
import { unlock } from '../lock-unlock';
|
|
17
|
+
|
|
18
|
+
const { fieldsKey, formKey } = unlock( blocksPrivateApis );
|
|
15
19
|
|
|
16
20
|
const { name } = metadata;
|
|
17
21
|
|
|
@@ -39,17 +43,17 @@ export const settings = {
|
|
|
39
43
|
save,
|
|
40
44
|
};
|
|
41
45
|
|
|
42
|
-
if ( window.
|
|
43
|
-
settings
|
|
46
|
+
if ( window.__experimentalContentOnlyInspectorFields ) {
|
|
47
|
+
settings[ fieldsKey ] = [
|
|
44
48
|
{
|
|
49
|
+
id: 'content',
|
|
45
50
|
label: __( 'Code' ),
|
|
46
|
-
type: '
|
|
47
|
-
shownByDefault: true,
|
|
48
|
-
mapping: {
|
|
49
|
-
value: 'content',
|
|
50
|
-
},
|
|
51
|
+
type: 'richtext',
|
|
51
52
|
},
|
|
52
53
|
];
|
|
54
|
+
settings[ formKey ] = {
|
|
55
|
+
fields: [ 'content' ],
|
|
56
|
+
};
|
|
53
57
|
}
|
|
54
58
|
|
|
55
59
|
export const init = () => initBlock( { name, metadata, settings } );
|
package/src/common.scss
CHANGED
|
@@ -128,12 +128,14 @@ html :where([style*="border-top-color"]) {
|
|
|
128
128
|
border-top-style: solid;
|
|
129
129
|
}
|
|
130
130
|
html :where([style*="border-right-color"]) {
|
|
131
|
+
/*rtl:ignore*/
|
|
131
132
|
border-right-style: solid;
|
|
132
133
|
}
|
|
133
134
|
html :where([style*="border-bottom-color"]) {
|
|
134
135
|
border-bottom-style: solid;
|
|
135
136
|
}
|
|
136
137
|
html :where([style*="border-left-color"]) {
|
|
138
|
+
/*rtl:ignore*/
|
|
137
139
|
border-left-style: solid;
|
|
138
140
|
}
|
|
139
141
|
|
|
@@ -144,12 +146,14 @@ html :where([style*="border-top-width"]) {
|
|
|
144
146
|
border-top-style: solid;
|
|
145
147
|
}
|
|
146
148
|
html :where([style*="border-right-width"]) {
|
|
149
|
+
/*rtl:ignore*/
|
|
147
150
|
border-right-style: solid;
|
|
148
151
|
}
|
|
149
152
|
html :where([style*="border-bottom-width"]) {
|
|
150
153
|
border-bottom-style: solid;
|
|
151
154
|
}
|
|
152
155
|
html :where([style*="border-left-width"]) {
|
|
156
|
+
/*rtl:ignore*/
|
|
153
157
|
border-left-style: solid;
|
|
154
158
|
}
|
|
155
159
|
|
|
@@ -11,12 +11,15 @@ import {
|
|
|
11
11
|
privateApis as blockEditorPrivateApis,
|
|
12
12
|
} from '@wordpress/block-editor';
|
|
13
13
|
import { __ } from '@wordpress/i18n';
|
|
14
|
+
import { MenuItem } from '@wordpress/components';
|
|
15
|
+
import { link } from '@wordpress/icons';
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* Internal dependencies
|
|
17
19
|
*/
|
|
18
20
|
import { ALLOWED_MEDIA_TYPES } from '../shared';
|
|
19
21
|
import { unlock } from '../../lock-unlock';
|
|
22
|
+
import EmbedVideoUrlInput from './embed-video-url-input';
|
|
20
23
|
|
|
21
24
|
const { cleanEmptyObject } = unlock( blockEditorPrivateApis );
|
|
22
25
|
|
|
@@ -27,6 +30,7 @@ export default function CoverBlockControls( {
|
|
|
27
30
|
currentSettings,
|
|
28
31
|
toggleUseFeaturedImage,
|
|
29
32
|
onClearMedia,
|
|
33
|
+
onSelectEmbedUrl,
|
|
30
34
|
blockEditingMode,
|
|
31
35
|
} ) {
|
|
32
36
|
const { contentPosition, id, useFeaturedImage, minHeight, minHeightUnit } =
|
|
@@ -36,6 +40,7 @@ export default function CoverBlockControls( {
|
|
|
36
40
|
const [ prevMinHeightValue, setPrevMinHeightValue ] = useState( minHeight );
|
|
37
41
|
const [ prevMinHeightUnit, setPrevMinHeightUnit ] =
|
|
38
42
|
useState( minHeightUnit );
|
|
43
|
+
const [ isEmbedUrlInputOpen, setIsEmbedUrlInputOpen ] = useState( false );
|
|
39
44
|
const isMinFullHeight =
|
|
40
45
|
minHeightUnit === 'vh' &&
|
|
41
46
|
minHeight === 100 &&
|
|
@@ -102,14 +107,33 @@ export default function CoverBlockControls( {
|
|
|
102
107
|
mediaId={ id }
|
|
103
108
|
mediaURL={ url }
|
|
104
109
|
allowedTypes={ ALLOWED_MEDIA_TYPES }
|
|
105
|
-
accept="image/*,video/*"
|
|
106
110
|
onSelect={ onSelectMedia }
|
|
107
111
|
onToggleFeaturedImage={ toggleUseFeaturedImage }
|
|
108
112
|
useFeaturedImage={ useFeaturedImage }
|
|
109
113
|
name={ ! url ? __( 'Add media' ) : __( 'Replace' ) }
|
|
110
114
|
onReset={ onClearMedia }
|
|
111
|
-
|
|
115
|
+
>
|
|
116
|
+
{ ( { onClose } ) => (
|
|
117
|
+
<MenuItem
|
|
118
|
+
icon={ link }
|
|
119
|
+
onClick={ () => {
|
|
120
|
+
setIsEmbedUrlInputOpen( true );
|
|
121
|
+
onClose();
|
|
122
|
+
} }
|
|
123
|
+
>
|
|
124
|
+
{ __( 'Embed video from URL' ) }
|
|
125
|
+
</MenuItem>
|
|
126
|
+
) }
|
|
127
|
+
</MediaReplaceFlow>
|
|
112
128
|
</BlockControls>
|
|
129
|
+
{ isEmbedUrlInputOpen && (
|
|
130
|
+
<EmbedVideoUrlInput
|
|
131
|
+
onSubmit={ ( embedUrl ) => {
|
|
132
|
+
onSelectEmbedUrl( embedUrl );
|
|
133
|
+
} }
|
|
134
|
+
onClose={ () => setIsEmbedUrlInputOpen( false ) }
|
|
135
|
+
/>
|
|
136
|
+
) }
|
|
113
137
|
</>
|
|
114
138
|
);
|
|
115
139
|
}
|
|
@@ -25,7 +25,6 @@ export default function CoverPlaceholder( {
|
|
|
25
25
|
title: __( 'Cover' ),
|
|
26
26
|
} }
|
|
27
27
|
onSelect={ onSelectMedia }
|
|
28
|
-
accept="image/*,video/*"
|
|
29
28
|
allowedTypes={ ALLOWED_MEDIA_TYPES }
|
|
30
29
|
disableMediaButtons={ disableMediaButtons }
|
|
31
30
|
onToggleFeaturedImage={ toggleUseFeaturedImage }
|