@wordpress/block-library 9.35.1-next.16d95556a.0 → 9.35.1-next.dc3f6d3c1.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/build/audio/index.js +26 -0
- package/build/audio/index.js.map +2 -2
- package/build/breadcrumbs/edit.js +1 -1
- package/build/breadcrumbs/edit.js.map +2 -2
- package/build/button/index.js +22 -0
- package/build/button/index.js.map +2 -2
- package/build/code/index.js +12 -0
- package/build/code/index.js.map +2 -2
- package/build/cover/index.js +22 -0
- package/build/cover/index.js.map +2 -2
- package/build/details/index.js +12 -0
- package/build/details/index.js.map +2 -2
- package/build/file/index.js +33 -0
- package/build/file/index.js.map +2 -2
- package/build/heading/index.js +12 -0
- package/build/heading/index.js.map +2 -2
- package/build/html/modal.js +126 -144
- package/build/html/modal.js.map +2 -2
- package/build/image/index.js +46 -0
- package/build/image/index.js.map +2 -2
- package/build/list-item/index.js +13 -0
- package/build/list-item/index.js.map +2 -2
- package/build/media-text/index.js +28 -0
- package/build/media-text/index.js.map +2 -2
- package/build/more/index.js +13 -0
- package/build/more/index.js.map +2 -2
- package/build/navigation/block.json +2 -2
- package/build/navigation-link/block.json +2 -1
- package/build/navigation-link/edit.js +6 -0
- package/build/navigation-link/edit.js.map +2 -2
- package/build/navigation-link/index.js +22 -0
- package/build/navigation-link/index.js.map +2 -2
- package/build/navigation-link/shared/controls.js +15 -19
- package/build/navigation-link/shared/controls.js.map +2 -2
- package/build/navigation-link/shared/index.js +4 -0
- package/build/navigation-link/shared/index.js.map +2 -2
- package/build/navigation-link/shared/use-entity-binding.js +3 -2
- package/build/navigation-link/shared/use-entity-binding.js.map +2 -2
- package/build/navigation-submenu/block.json +2 -1
- package/build/navigation-submenu/index.js +22 -0
- package/build/navigation-submenu/index.js.map +2 -2
- package/build/paragraph/index.js +12 -0
- package/build/paragraph/index.js.map +2 -2
- package/build/post-comments-count/edit.js +1 -2
- package/build/post-comments-count/edit.js.map +2 -2
- package/build/post-comments-link/edit.js +10 -7
- package/build/post-comments-link/edit.js.map +2 -2
- package/build/preformatted/index.js +12 -0
- package/build/preformatted/index.js.map +2 -2
- package/build/pullquote/index.js +20 -0
- package/build/pullquote/index.js.map +2 -2
- package/build/search/index.js +28 -0
- package/build/search/index.js.map +2 -2
- package/build/social-link/index.js +22 -0
- package/build/social-link/index.js.map +2 -2
- package/build/social-links/edit.js +1 -1
- package/build/social-links/edit.js.map +1 -1
- package/build/tabs/view.js +17 -4
- package/build/tabs/view.js.map +2 -2
- package/build/verse/index.js +12 -0
- package/build/verse/index.js.map +2 -2
- package/build/video/index.js +27 -0
- package/build/video/index.js.map +2 -2
- package/build-module/audio/index.js +26 -0
- package/build-module/audio/index.js.map +2 -2
- package/build-module/breadcrumbs/edit.js +1 -1
- package/build-module/breadcrumbs/edit.js.map +2 -2
- package/build-module/button/index.js +22 -0
- package/build-module/button/index.js.map +2 -2
- package/build-module/code/index.js +12 -0
- package/build-module/code/index.js.map +2 -2
- package/build-module/cover/index.js +22 -0
- package/build-module/cover/index.js.map +2 -2
- package/build-module/details/index.js +12 -0
- package/build-module/details/index.js.map +2 -2
- package/build-module/file/index.js +34 -1
- package/build-module/file/index.js.map +2 -2
- package/build-module/heading/index.js +12 -0
- package/build-module/heading/index.js.map +2 -2
- package/build-module/html/modal.js +127 -145
- package/build-module/html/modal.js.map +2 -2
- package/build-module/image/index.js +46 -0
- package/build-module/image/index.js.map +2 -2
- package/build-module/list-item/index.js +13 -0
- package/build-module/list-item/index.js.map +2 -2
- package/build-module/media-text/index.js +28 -0
- package/build-module/media-text/index.js.map +2 -2
- package/build-module/more/index.js +13 -0
- package/build-module/more/index.js.map +2 -2
- package/build-module/navigation/block.json +2 -2
- package/build-module/navigation-link/block.json +2 -1
- package/build-module/navigation-link/edit.js +20 -4
- package/build-module/navigation-link/edit.js.map +2 -2
- package/build-module/navigation-link/index.js +23 -1
- package/build-module/navigation-link/index.js.map +2 -2
- package/build-module/navigation-link/shared/controls.js +12 -18
- package/build-module/navigation-link/shared/controls.js.map +2 -2
- package/build-module/navigation-link/shared/index.js +3 -1
- package/build-module/navigation-link/shared/index.js.map +2 -2
- package/build-module/navigation-link/shared/use-entity-binding.js +3 -2
- package/build-module/navigation-link/shared/use-entity-binding.js.map +2 -2
- package/build-module/navigation-submenu/block.json +2 -1
- package/build-module/navigation-submenu/index.js +23 -1
- package/build-module/navigation-submenu/index.js.map +2 -2
- package/build-module/paragraph/index.js +12 -0
- package/build-module/paragraph/index.js.map +2 -2
- package/build-module/post-comments-count/edit.js +1 -3
- package/build-module/post-comments-count/edit.js.map +2 -2
- package/build-module/post-comments-link/edit.js +10 -8
- package/build-module/post-comments-link/edit.js.map +2 -2
- package/build-module/preformatted/index.js +12 -0
- package/build-module/preformatted/index.js.map +2 -2
- package/build-module/pullquote/index.js +20 -0
- package/build-module/pullquote/index.js.map +2 -2
- package/build-module/search/index.js +28 -0
- package/build-module/search/index.js.map +2 -2
- package/build-module/social-link/index.js +22 -0
- package/build-module/social-link/index.js.map +2 -2
- package/build-module/social-links/edit.js +1 -1
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/tabs/view.js +17 -4
- package/build-module/tabs/view.js.map +2 -2
- package/build-module/verse/index.js +12 -0
- package/build-module/verse/index.js.map +2 -2
- package/build-module/video/index.js +27 -0
- package/build-module/video/index.js.map +2 -2
- package/package.json +37 -37
- package/src/audio/index.js +27 -0
- package/src/breadcrumbs/edit.js +4 -2
- package/src/breadcrumbs/index.php +112 -30
- package/src/button/index.js +23 -0
- package/src/code/index.js +13 -0
- package/src/cover/index.js +23 -0
- package/src/details/index.js +13 -0
- package/src/file/index.js +35 -1
- package/src/heading/index.js +13 -0
- package/src/html/modal.js +8 -28
- package/src/image/index.js +47 -0
- package/src/list-item/index.js +14 -0
- package/src/media-text/index.js +29 -0
- package/src/more/index.js +14 -0
- package/src/navigation/block.json +2 -2
- package/src/navigation-link/block.json +2 -1
- package/src/navigation-link/edit.js +27 -4
- package/src/navigation-link/index.js +24 -1
- package/src/navigation-link/shared/controls.js +13 -17
- package/src/navigation-link/shared/index.js +1 -1
- package/src/navigation-link/shared/use-entity-binding.js +5 -2
- package/src/navigation-submenu/block.json +2 -1
- package/src/navigation-submenu/index.js +24 -1
- package/src/paragraph/index.js +13 -0
- package/src/post-comments-count/edit.js +1 -9
- package/src/post-comments-link/edit.js +8 -18
- package/src/preformatted/index.js +13 -0
- package/src/pullquote/index.js +21 -0
- package/src/search/index.js +29 -0
- package/src/social-link/index.js +23 -0
- package/src/social-links/edit.js +1 -1
- package/src/tabs/view.js +19 -4
- package/src/verse/index.js +13 -0
- package/src/video/index.js +28 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-library",
|
|
3
|
-
"version": "9.35.1-next.
|
|
3
|
+
"version": "9.35.1-next.dc3f6d3c1.0",
|
|
4
4
|
"description": "Block library for the WordPress editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -82,41 +82,41 @@
|
|
|
82
82
|
"{src,build,build-module}/*/init.js"
|
|
83
83
|
],
|
|
84
84
|
"dependencies": {
|
|
85
|
-
"@wordpress/a11y": "^4.35.1-next.
|
|
86
|
-
"@wordpress/api-fetch": "^7.35.1-next.
|
|
87
|
-
"@wordpress/autop": "^4.35.1-next.
|
|
88
|
-
"@wordpress/base-styles": "^6.11.1-next.
|
|
89
|
-
"@wordpress/blob": "^4.35.1-next.
|
|
90
|
-
"@wordpress/block-editor": "^15.8.1-next.
|
|
91
|
-
"@wordpress/blocks": "^15.8.1-next.
|
|
92
|
-
"@wordpress/components": "^30.8.
|
|
93
|
-
"@wordpress/compose": "^7.35.1-next.
|
|
94
|
-
"@wordpress/core-data": "^7.35.1-next.
|
|
95
|
-
"@wordpress/data": "^10.35.1-next.
|
|
96
|
-
"@wordpress/date": "^5.35.1-next.
|
|
97
|
-
"@wordpress/deprecated": "^4.35.1-next.
|
|
98
|
-
"@wordpress/dom": "^4.35.1-next.
|
|
99
|
-
"@wordpress/element": "^6.35.1-next.
|
|
100
|
-
"@wordpress/escape-html": "^3.35.1-next.
|
|
101
|
-
"@wordpress/hooks": "^4.35.1-next.
|
|
102
|
-
"@wordpress/html-entities": "^4.35.1-next.
|
|
103
|
-
"@wordpress/i18n": "^6.8.1-next.
|
|
104
|
-
"@wordpress/icons": "^11.2.1-next.
|
|
105
|
-
"@wordpress/interactivity": "^6.35.1-next.
|
|
106
|
-
"@wordpress/interactivity-router": "^2.35.1-next.
|
|
107
|
-
"@wordpress/keyboard-shortcuts": "^5.35.1-next.
|
|
108
|
-
"@wordpress/keycodes": "^4.35.1-next.
|
|
109
|
-
"@wordpress/latex-to-mathml": "^1.3.1-next.
|
|
110
|
-
"@wordpress/notices": "^5.35.1-next.
|
|
111
|
-
"@wordpress/patterns": "^2.35.1-next.
|
|
112
|
-
"@wordpress/primitives": "^4.35.1-next.
|
|
113
|
-
"@wordpress/private-apis": "^1.35.1-next.
|
|
114
|
-
"@wordpress/reusable-blocks": "^5.35.1-next.
|
|
115
|
-
"@wordpress/rich-text": "^7.35.1-next.
|
|
116
|
-
"@wordpress/server-side-render": "^6.11.1-next.
|
|
117
|
-
"@wordpress/url": "^4.35.1-next.
|
|
118
|
-
"@wordpress/viewport": "^6.35.1-next.
|
|
119
|
-
"@wordpress/wordcount": "^4.35.1-next.
|
|
85
|
+
"@wordpress/a11y": "^4.35.1-next.dc3f6d3c1.0",
|
|
86
|
+
"@wordpress/api-fetch": "^7.35.1-next.dc3f6d3c1.0",
|
|
87
|
+
"@wordpress/autop": "^4.35.1-next.dc3f6d3c1.0",
|
|
88
|
+
"@wordpress/base-styles": "^6.11.1-next.dc3f6d3c1.0",
|
|
89
|
+
"@wordpress/blob": "^4.35.1-next.dc3f6d3c1.0",
|
|
90
|
+
"@wordpress/block-editor": "^15.8.1-next.dc3f6d3c1.0",
|
|
91
|
+
"@wordpress/blocks": "^15.8.1-next.dc3f6d3c1.0",
|
|
92
|
+
"@wordpress/components": "^30.8.2-next.dc3f6d3c1.0",
|
|
93
|
+
"@wordpress/compose": "^7.35.1-next.dc3f6d3c1.0",
|
|
94
|
+
"@wordpress/core-data": "^7.35.1-next.dc3f6d3c1.0",
|
|
95
|
+
"@wordpress/data": "^10.35.1-next.dc3f6d3c1.0",
|
|
96
|
+
"@wordpress/date": "^5.35.1-next.dc3f6d3c1.0",
|
|
97
|
+
"@wordpress/deprecated": "^4.35.1-next.dc3f6d3c1.0",
|
|
98
|
+
"@wordpress/dom": "^4.35.1-next.dc3f6d3c1.0",
|
|
99
|
+
"@wordpress/element": "^6.35.1-next.dc3f6d3c1.0",
|
|
100
|
+
"@wordpress/escape-html": "^3.35.1-next.dc3f6d3c1.0",
|
|
101
|
+
"@wordpress/hooks": "^4.35.1-next.dc3f6d3c1.0",
|
|
102
|
+
"@wordpress/html-entities": "^4.35.1-next.dc3f6d3c1.0",
|
|
103
|
+
"@wordpress/i18n": "^6.8.1-next.dc3f6d3c1.0",
|
|
104
|
+
"@wordpress/icons": "^11.2.1-next.dc3f6d3c1.0",
|
|
105
|
+
"@wordpress/interactivity": "^6.35.1-next.dc3f6d3c1.0",
|
|
106
|
+
"@wordpress/interactivity-router": "^2.35.1-next.dc3f6d3c1.0",
|
|
107
|
+
"@wordpress/keyboard-shortcuts": "^5.35.1-next.dc3f6d3c1.0",
|
|
108
|
+
"@wordpress/keycodes": "^4.35.1-next.dc3f6d3c1.0",
|
|
109
|
+
"@wordpress/latex-to-mathml": "^1.3.1-next.dc3f6d3c1.0",
|
|
110
|
+
"@wordpress/notices": "^5.35.1-next.dc3f6d3c1.0",
|
|
111
|
+
"@wordpress/patterns": "^2.35.1-next.dc3f6d3c1.0",
|
|
112
|
+
"@wordpress/primitives": "^4.35.1-next.dc3f6d3c1.0",
|
|
113
|
+
"@wordpress/private-apis": "^1.35.1-next.dc3f6d3c1.0",
|
|
114
|
+
"@wordpress/reusable-blocks": "^5.35.1-next.dc3f6d3c1.0",
|
|
115
|
+
"@wordpress/rich-text": "^7.35.1-next.dc3f6d3c1.0",
|
|
116
|
+
"@wordpress/server-side-render": "^6.11.1-next.dc3f6d3c1.0",
|
|
117
|
+
"@wordpress/url": "^4.35.1-next.dc3f6d3c1.0",
|
|
118
|
+
"@wordpress/viewport": "^6.35.1-next.dc3f6d3c1.0",
|
|
119
|
+
"@wordpress/wordcount": "^4.35.1-next.dc3f6d3c1.0",
|
|
120
120
|
"change-case": "^4.1.2",
|
|
121
121
|
"clsx": "^2.1.1",
|
|
122
122
|
"colord": "^2.7.0",
|
|
@@ -134,5 +134,5 @@
|
|
|
134
134
|
"publishConfig": {
|
|
135
135
|
"access": "public"
|
|
136
136
|
},
|
|
137
|
-
"gitHead": "
|
|
137
|
+
"gitHead": "f73b5e69b34fbaccfb8c47783f4f993059ff1a41"
|
|
138
138
|
}
|
package/src/audio/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
4
5
|
import { audio as icon } from '@wordpress/icons';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -31,4 +32,30 @@ export const settings = {
|
|
|
31
32
|
save,
|
|
32
33
|
};
|
|
33
34
|
|
|
35
|
+
if ( window.__experimentalContentOnlyPatternInsertion ) {
|
|
36
|
+
settings.fields = [
|
|
37
|
+
{
|
|
38
|
+
label: __( 'Audio' ),
|
|
39
|
+
type: 'Media',
|
|
40
|
+
shownByDefault: true,
|
|
41
|
+
mapping: {
|
|
42
|
+
id: 'id',
|
|
43
|
+
src: 'src',
|
|
44
|
+
},
|
|
45
|
+
args: {
|
|
46
|
+
allowedTypes: [ 'audio' ],
|
|
47
|
+
multiple: false,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: __( 'Caption' ),
|
|
52
|
+
type: 'RichText',
|
|
53
|
+
shownByDefault: false,
|
|
54
|
+
mapping: {
|
|
55
|
+
value: 'caption',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
];
|
|
59
|
+
}
|
|
60
|
+
|
|
34
61
|
export const init = () => initBlock( { name, metadata, settings } );
|
package/src/breadcrumbs/edit.js
CHANGED
|
@@ -116,9 +116,11 @@ export default function BreadcrumbEdit( {
|
|
|
116
116
|
);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
//
|
|
119
|
+
// Try to determine breadcrumb type for more accurate previews.
|
|
120
120
|
let _showTerms;
|
|
121
|
-
|
|
121
|
+
// Some non-hierarchical post types (e.g., attachments) can have parents.
|
|
122
|
+
// Use hierarchical breadcrumbs if a parent exists, otherwise use taxonomy breadcrumbs.
|
|
123
|
+
if ( ! isPostTypeHierarchical && ! post?.parent ) {
|
|
122
124
|
_showTerms = true;
|
|
123
125
|
} else if ( ! postTypeHasTaxonomies ) {
|
|
124
126
|
// Hierarchical post type without taxonomies can only use ancestors.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* Renders the `core/breadcrumbs` block on the server.
|
|
10
10
|
*
|
|
11
|
-
* @since
|
|
11
|
+
* @since 7.0.0
|
|
12
12
|
*
|
|
13
13
|
* @param array $attributes Block attributes.
|
|
14
14
|
* @param string $content Block default content.
|
|
@@ -76,25 +76,55 @@ function render_block_core_breadcrumbs( $attributes, $content, $block ) {
|
|
|
76
76
|
return '';
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
//
|
|
79
|
+
// For non-hierarchical post types with parents (e.g., attachments), build trail for the parent.
|
|
80
|
+
$post_parent = $post->post_parent;
|
|
81
|
+
$parent_post = null;
|
|
82
|
+
if ( ! is_post_type_hierarchical( $post_type ) && $post_parent ) {
|
|
83
|
+
$parent_post = get_post( $post_parent );
|
|
84
|
+
if ( $parent_post ) {
|
|
85
|
+
$post_id = $parent_post->ID;
|
|
86
|
+
$post_type = $parent_post->post_type;
|
|
87
|
+
$post_parent = $parent_post->post_parent;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Determine breadcrumb type.
|
|
92
|
+
// Some non-hierarchical post types (e.g., attachments) can have parents.
|
|
93
|
+
// Use hierarchical breadcrumbs if a parent exists, otherwise use taxonomy breadcrumbs.
|
|
80
94
|
$show_terms = false;
|
|
81
|
-
if ( ! is_post_type_hierarchical( $post_type ) ) {
|
|
95
|
+
if ( ! is_post_type_hierarchical( $post_type ) && ! $post_parent ) {
|
|
82
96
|
$show_terms = true;
|
|
83
97
|
} elseif ( empty( get_object_taxonomies( $post_type, 'objects' ) ) ) {
|
|
84
|
-
// Hierarchical post type without taxonomies can only use ancestors.
|
|
85
98
|
$show_terms = false;
|
|
86
99
|
} else {
|
|
87
|
-
// For hierarchical post types with taxonomies, use the attribute.
|
|
88
100
|
$show_terms = $attributes['prefersTaxonomy'];
|
|
89
101
|
}
|
|
90
102
|
|
|
103
|
+
// Build breadcrumb trail.
|
|
91
104
|
if ( ! $show_terms ) {
|
|
92
105
|
$breadcrumb_items = array_merge( $breadcrumb_items, block_core_breadcrumbs_get_hierarchical_post_type_breadcrumbs( $post_id ) );
|
|
93
106
|
} else {
|
|
94
107
|
$breadcrumb_items = array_merge( $breadcrumb_items, block_core_breadcrumbs_get_terms_breadcrumbs( $post_id, $post_type ) );
|
|
95
108
|
}
|
|
96
|
-
|
|
97
|
-
|
|
109
|
+
|
|
110
|
+
// Add post title: linked when viewing a paginated page, plain text otherwise.
|
|
111
|
+
$is_paged = (int) get_query_var( 'page' ) > 1;
|
|
112
|
+
$title = block_core_breadcrumbs_get_post_title( $post );
|
|
113
|
+
|
|
114
|
+
if ( $is_paged ) {
|
|
115
|
+
$breadcrumb_items[] = block_core_breadcrumbs_create_link(
|
|
116
|
+
get_permalink( $post ),
|
|
117
|
+
$title,
|
|
118
|
+
true
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
$breadcrumb_items[] = block_core_breadcrumbs_create_page_number_item( 'page' );
|
|
122
|
+
} else {
|
|
123
|
+
$breadcrumb_items[] = block_core_breadcrumbs_create_current_item(
|
|
124
|
+
$title,
|
|
125
|
+
true
|
|
126
|
+
);
|
|
127
|
+
}
|
|
98
128
|
}
|
|
99
129
|
|
|
100
130
|
// Remove last item if disabled.
|
|
@@ -133,7 +163,7 @@ function render_block_core_breadcrumbs( $attributes, $content, $block ) {
|
|
|
133
163
|
/**
|
|
134
164
|
* Checks if we're on a paginated view (page 2 or higher).
|
|
135
165
|
*
|
|
136
|
-
* @since
|
|
166
|
+
* @since 7.0.0
|
|
137
167
|
*
|
|
138
168
|
* @return bool True if paged > 1, false otherwise.
|
|
139
169
|
*/
|
|
@@ -145,12 +175,13 @@ function block_core_breadcrumbs_is_paged() {
|
|
|
145
175
|
/**
|
|
146
176
|
* Creates a "Page X" breadcrumb item for paginated views.
|
|
147
177
|
*
|
|
148
|
-
* @since
|
|
149
|
-
*
|
|
178
|
+
* @since 7.0.0
|
|
179
|
+
* @param string $query_var Optional. Query variable to get current page number. Default 'paged'.
|
|
150
180
|
* @return string The "Page X" breadcrumb HTML.
|
|
151
181
|
*/
|
|
152
|
-
function block_core_breadcrumbs_create_page_number_item() {
|
|
153
|
-
$paged = (int) get_query_var(
|
|
182
|
+
function block_core_breadcrumbs_create_page_number_item( $query_var = 'paged' ) {
|
|
183
|
+
$paged = (int) get_query_var( $query_var );
|
|
184
|
+
|
|
154
185
|
return block_core_breadcrumbs_create_current_item(
|
|
155
186
|
/* translators: %s: page number */
|
|
156
187
|
sprintf( __( 'Page %s' ), number_format_i18n( $paged ) )
|
|
@@ -160,7 +191,7 @@ function block_core_breadcrumbs_create_page_number_item() {
|
|
|
160
191
|
/**
|
|
161
192
|
* Creates a breadcrumb link item.
|
|
162
193
|
*
|
|
163
|
-
* @since
|
|
194
|
+
* @since 7.0.0
|
|
164
195
|
*
|
|
165
196
|
* @param string $url The URL for the link (will be escaped).
|
|
166
197
|
* @param string $text The link text (will be escaped).
|
|
@@ -179,7 +210,7 @@ function block_core_breadcrumbs_create_link( $url, $text, $allow_html = false )
|
|
|
179
210
|
/**
|
|
180
211
|
* Creates a breadcrumb current page item.
|
|
181
212
|
*
|
|
182
|
-
* @since
|
|
213
|
+
* @since 7.0.0
|
|
183
214
|
*
|
|
184
215
|
* @param string $text The text content (will be escaped).
|
|
185
216
|
* @param bool $allow_html Whether to allow HTML in the text. If true, uses wp_kses_post(), otherwise uses esc_html(). Default false.
|
|
@@ -199,7 +230,7 @@ function block_core_breadcrumbs_create_current_item( $text, $allow_html = false
|
|
|
199
230
|
* When paginated (is_paged is true), creates a link to page 1.
|
|
200
231
|
* Otherwise, creates a span marked as the current page.
|
|
201
232
|
*
|
|
202
|
-
* @since
|
|
233
|
+
* @since 7.0.0
|
|
203
234
|
*
|
|
204
235
|
* @param string $text The text content (will be escaped).
|
|
205
236
|
* @param bool $is_paged Whether we're on a paginated view.
|
|
@@ -217,7 +248,7 @@ function block_core_breadcrumbs_create_item( $text, $is_paged = false, $allow_ht
|
|
|
217
248
|
/**
|
|
218
249
|
* Gets a post title with fallback for empty titles.
|
|
219
250
|
*
|
|
220
|
-
* @since
|
|
251
|
+
* @since 7.0.0
|
|
221
252
|
*
|
|
222
253
|
* @param int|WP_Post $post_id_or_object The post ID or post object.
|
|
223
254
|
*
|
|
@@ -234,9 +265,9 @@ function block_core_breadcrumbs_get_post_title( $post_id_or_object ) {
|
|
|
234
265
|
/**
|
|
235
266
|
* Generates breadcrumb items from hierarchical post type ancestors.
|
|
236
267
|
*
|
|
237
|
-
* @since
|
|
268
|
+
* @since 7.0.0
|
|
238
269
|
*
|
|
239
|
-
* @param int
|
|
270
|
+
* @param int $post_id The post ID.
|
|
240
271
|
*
|
|
241
272
|
* @return array Array of breadcrumb HTML items.
|
|
242
273
|
*/
|
|
@@ -260,7 +291,7 @@ function block_core_breadcrumbs_get_hierarchical_post_type_breadcrumbs( $post_id
|
|
|
260
291
|
*
|
|
261
292
|
* For hierarchical taxonomies, retrieves and formats ancestor terms as breadcrumb links.
|
|
262
293
|
*
|
|
263
|
-
* @since
|
|
294
|
+
* @since 7.0.0
|
|
264
295
|
*
|
|
265
296
|
* @param int $term_id The term ID.
|
|
266
297
|
* @param string $taxonomy The taxonomy name.
|
|
@@ -294,7 +325,7 @@ function block_core_breadcrumbs_get_term_ancestors_items( $term_id, $taxonomy )
|
|
|
294
325
|
* Handles taxonomy archives, post type archives, date archives, and author archives.
|
|
295
326
|
* For hierarchical taxonomies, includes ancestor terms in the breadcrumb trail.
|
|
296
327
|
*
|
|
297
|
-
* @since
|
|
328
|
+
* @since 7.0.0
|
|
298
329
|
*
|
|
299
330
|
* @return array Array of breadcrumb HTML items.
|
|
300
331
|
*/
|
|
@@ -426,7 +457,7 @@ function block_core_breadcrumbs_get_archive_breadcrumbs() {
|
|
|
426
457
|
* Finds the first publicly queryable taxonomy with terms assigned to the post
|
|
427
458
|
* and generates breadcrumb links, including hierarchical term ancestors if applicable.
|
|
428
459
|
*
|
|
429
|
-
* @since
|
|
460
|
+
* @since 7.0.0
|
|
430
461
|
*
|
|
431
462
|
* @param int $post_id The post ID.
|
|
432
463
|
* @param string $post_type The post type name.
|
|
@@ -448,21 +479,72 @@ function block_core_breadcrumbs_get_terms_breadcrumbs( $post_id, $post_type ) {
|
|
|
448
479
|
return array();
|
|
449
480
|
}
|
|
450
481
|
|
|
451
|
-
|
|
482
|
+
/**
|
|
483
|
+
* Filters breadcrumb settings on a per-post-type basis.
|
|
484
|
+
*
|
|
485
|
+
* Allow developers to customize breadcrumb behavior for specific post types.
|
|
486
|
+
*
|
|
487
|
+
* @since 7.0.0
|
|
488
|
+
*
|
|
489
|
+
* @param array $settings {
|
|
490
|
+
* Array of breadcrumb settings. Default empty array.
|
|
491
|
+
*
|
|
492
|
+
* @type string $taxonomy Optional. Taxonomy slug to use for breadcrumbs.
|
|
493
|
+
* The taxonomy must be registered for the post type and have
|
|
494
|
+
* terms assigned to the post. If not found or has no terms,
|
|
495
|
+
* fall back to the first available taxonomy with terms.
|
|
496
|
+
* @type string $term Optional. Term slug to use when the post has multiple terms
|
|
497
|
+
* in the selected taxonomy. If the term is not found or not
|
|
498
|
+
* assigned to the post, fall back to the first term. If the
|
|
499
|
+
* post has only one term, that term is used regardless.
|
|
500
|
+
* }
|
|
501
|
+
* @param string $post_type The post type slug.
|
|
502
|
+
*/
|
|
503
|
+
$settings = apply_filters( 'block_core_breadcrumbs_post_type_settings', array(), $post_type );
|
|
504
|
+
|
|
452
505
|
$taxonomy_name = null;
|
|
453
506
|
$terms = array();
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
$
|
|
459
|
-
|
|
507
|
+
|
|
508
|
+
// Try preferred taxonomy first if specified.
|
|
509
|
+
if ( ! empty( $settings['taxonomy'] ) ) {
|
|
510
|
+
foreach ( $taxonomies as $taxonomy ) {
|
|
511
|
+
if ( $taxonomy->name === $settings['taxonomy'] ) {
|
|
512
|
+
$post_terms = get_the_terms( $post_id, $taxonomy->name );
|
|
513
|
+
if ( ! empty( $post_terms ) && ! is_wp_error( $post_terms ) ) {
|
|
514
|
+
$taxonomy_name = $taxonomy->name;
|
|
515
|
+
$terms = $post_terms;
|
|
516
|
+
}
|
|
517
|
+
break;
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
// If no preferred taxonomy or it didn't have terms, find the first taxonomy with terms.
|
|
523
|
+
if ( empty( $terms ) ) {
|
|
524
|
+
foreach ( $taxonomies as $taxonomy ) {
|
|
525
|
+
$post_terms = get_the_terms( $post_id, $taxonomy->name );
|
|
526
|
+
if ( ! empty( $post_terms ) && ! is_wp_error( $post_terms ) ) {
|
|
527
|
+
$taxonomy_name = $taxonomy->name;
|
|
528
|
+
$terms = $post_terms;
|
|
529
|
+
break;
|
|
530
|
+
}
|
|
460
531
|
}
|
|
461
532
|
}
|
|
462
533
|
|
|
463
534
|
if ( ! empty( $terms ) ) {
|
|
464
|
-
//
|
|
535
|
+
// Select which term to use.
|
|
465
536
|
$term = reset( $terms );
|
|
537
|
+
|
|
538
|
+
// Try preferred term if specified and post has multiple terms.
|
|
539
|
+
if ( ! empty( $settings['term'] ) && count( $terms ) > 1 ) {
|
|
540
|
+
foreach ( $terms as $candidate_term ) {
|
|
541
|
+
if ( $candidate_term->slug === $settings['term'] ) {
|
|
542
|
+
$term = $candidate_term;
|
|
543
|
+
break;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
|
|
466
548
|
// Add hierarchical term ancestors if applicable.
|
|
467
549
|
$breadcrumb_items = array_merge(
|
|
468
550
|
$breadcrumb_items,
|
|
@@ -479,7 +561,7 @@ function block_core_breadcrumbs_get_terms_breadcrumbs( $post_id, $post_type ) {
|
|
|
479
561
|
/**
|
|
480
562
|
* Registers the `core/breadcrumbs` block on the server.
|
|
481
563
|
*
|
|
482
|
-
* @since
|
|
564
|
+
* @since 7.0.0
|
|
483
565
|
*/
|
|
484
566
|
function register_block_core_breadcrumbs() {
|
|
485
567
|
register_block_type_from_metadata(
|
package/src/button/index.js
CHANGED
|
@@ -34,4 +34,27 @@ export const settings = {
|
|
|
34
34
|
} ),
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
+
if ( window.__experimentalContentOnlyPatternInsertion ) {
|
|
38
|
+
settings.fields = [
|
|
39
|
+
{
|
|
40
|
+
label: __( 'Content' ),
|
|
41
|
+
type: 'RichText',
|
|
42
|
+
shownByDefault: true,
|
|
43
|
+
mapping: {
|
|
44
|
+
value: 'text',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
label: __( 'Link' ),
|
|
49
|
+
type: 'Link',
|
|
50
|
+
shownByDefault: false,
|
|
51
|
+
mapping: {
|
|
52
|
+
href: 'url',
|
|
53
|
+
rel: 'rel',
|
|
54
|
+
target: 'linkTarget',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
];
|
|
58
|
+
}
|
|
59
|
+
|
|
37
60
|
export const init = () => initBlock( { name, metadata, settings } );
|
package/src/code/index.js
CHANGED
|
@@ -39,4 +39,17 @@ export const settings = {
|
|
|
39
39
|
save,
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
+
if ( window.__experimentalContentOnlyPatternInsertion ) {
|
|
43
|
+
settings.fields = [
|
|
44
|
+
{
|
|
45
|
+
label: __( 'Code' ),
|
|
46
|
+
type: 'RichText',
|
|
47
|
+
shownByDefault: true,
|
|
48
|
+
mapping: {
|
|
49
|
+
value: 'content',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
|
|
42
55
|
export const init = () => initBlock( { name, metadata, settings } );
|
package/src/cover/index.js
CHANGED
|
@@ -52,4 +52,27 @@ export const settings = {
|
|
|
52
52
|
variations,
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
+
if ( window.__experimentalContentOnlyPatternInsertion ) {
|
|
56
|
+
settings.fields = [
|
|
57
|
+
{
|
|
58
|
+
label: __( 'Background' ),
|
|
59
|
+
type: 'Media',
|
|
60
|
+
shownByDefault: true,
|
|
61
|
+
mapping: {
|
|
62
|
+
type: 'backgroundType',
|
|
63
|
+
id: 'id',
|
|
64
|
+
src: 'url',
|
|
65
|
+
alt: 'alt',
|
|
66
|
+
featuredImage: 'useFeaturedImage',
|
|
67
|
+
},
|
|
68
|
+
args: {
|
|
69
|
+
// TODO - How to support custom gradient?
|
|
70
|
+
// Build it into Media, or use a custom control?
|
|
71
|
+
allowedTypes: [ 'image', 'video' ],
|
|
72
|
+
multiple: false,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
];
|
|
76
|
+
}
|
|
77
|
+
|
|
55
78
|
export const init = () => initBlock( { name, metadata, settings } );
|
package/src/details/index.js
CHANGED
|
@@ -61,4 +61,17 @@ export const settings = {
|
|
|
61
61
|
transforms,
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
+
if ( window.__experimentalContentOnlyPatternInsertion ) {
|
|
65
|
+
settings.fields = [
|
|
66
|
+
{
|
|
67
|
+
label: __( 'Summary' ),
|
|
68
|
+
type: 'RichText',
|
|
69
|
+
shownByDefault: true,
|
|
70
|
+
mapping: {
|
|
71
|
+
value: 'summary',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
];
|
|
75
|
+
}
|
|
76
|
+
|
|
64
77
|
export const init = () => initBlock( { name, metadata, settings } );
|
package/src/file/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { _x } from '@wordpress/i18n';
|
|
4
|
+
import { _x, __ } from '@wordpress/i18n';
|
|
5
5
|
import { file as icon } from '@wordpress/icons';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -32,4 +32,38 @@ export const settings = {
|
|
|
32
32
|
save,
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
+
if ( window.__experimentalContentOnlyPatternInsertion ) {
|
|
36
|
+
settings.fields = [
|
|
37
|
+
{
|
|
38
|
+
label: __( 'File' ),
|
|
39
|
+
type: 'Media',
|
|
40
|
+
shownByDefault: true,
|
|
41
|
+
mapping: {
|
|
42
|
+
id: 'id',
|
|
43
|
+
src: 'href',
|
|
44
|
+
},
|
|
45
|
+
args: {
|
|
46
|
+
allowedTypes: [],
|
|
47
|
+
multiple: false,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: __( 'Filename' ),
|
|
52
|
+
type: 'RichText',
|
|
53
|
+
shownByDefault: false,
|
|
54
|
+
mapping: {
|
|
55
|
+
value: 'fileName',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
label: __( 'Button Text' ),
|
|
60
|
+
type: 'RichText',
|
|
61
|
+
shownByDefault: false,
|
|
62
|
+
mapping: {
|
|
63
|
+
value: 'downloadButtonText',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
];
|
|
67
|
+
}
|
|
68
|
+
|
|
35
69
|
export const init = () => initBlock( { name, metadata, settings } );
|
package/src/heading/index.js
CHANGED
|
@@ -69,4 +69,17 @@ export const settings = {
|
|
|
69
69
|
variations,
|
|
70
70
|
};
|
|
71
71
|
|
|
72
|
+
if ( window.__experimentalContentOnlyPatternInsertion ) {
|
|
73
|
+
settings.fields = [
|
|
74
|
+
{
|
|
75
|
+
label: __( 'Content' ),
|
|
76
|
+
type: 'RichText',
|
|
77
|
+
shownByDefault: true,
|
|
78
|
+
mapping: {
|
|
79
|
+
value: 'content',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
];
|
|
83
|
+
}
|
|
84
|
+
|
|
72
85
|
export const init = () => initBlock( { name, metadata, settings } );
|
package/src/html/modal.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { useState
|
|
5
|
+
import { useState } from '@wordpress/element';
|
|
6
6
|
import { useSelect } from '@wordpress/data';
|
|
7
7
|
import {
|
|
8
8
|
Modal,
|
|
@@ -40,32 +40,17 @@ export default function HTMLEditModal( {
|
|
|
40
40
|
const [ isFullscreen, setIsFullscreen ] = useState( false );
|
|
41
41
|
|
|
42
42
|
// Check if user has permission to save scripts and get editor styles
|
|
43
|
-
const { canUserUseUnfilteredHTML
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
};
|
|
51
|
-
},
|
|
52
|
-
[]
|
|
53
|
-
);
|
|
43
|
+
const { canUserUseUnfilteredHTML } = useSelect( ( select ) => {
|
|
44
|
+
const settings = select( blockEditorStore ).getSettings();
|
|
45
|
+
return {
|
|
46
|
+
canUserUseUnfilteredHTML:
|
|
47
|
+
settings.__experimentalCanUserUseUnfilteredHTML,
|
|
48
|
+
};
|
|
49
|
+
}, [] );
|
|
54
50
|
|
|
55
51
|
// Show JS tab if user has permission OR if block contains JavaScript
|
|
56
52
|
const shouldShowJsTab = canUserUseUnfilteredHTML || js.trim() !== '';
|
|
57
53
|
|
|
58
|
-
// Combine all editor styles to inject into modal
|
|
59
|
-
const styleContent = useMemo( () => {
|
|
60
|
-
if ( ! editorStyles ) {
|
|
61
|
-
return '';
|
|
62
|
-
}
|
|
63
|
-
return editorStyles
|
|
64
|
-
.filter( ( style ) => style.css )
|
|
65
|
-
.map( ( style ) => style.css )
|
|
66
|
-
.join( '\n' );
|
|
67
|
-
}, [ editorStyles ] );
|
|
68
|
-
|
|
69
54
|
if ( ! isOpen ) {
|
|
70
55
|
return null;
|
|
71
56
|
}
|
|
@@ -131,11 +116,6 @@ export default function HTMLEditModal( {
|
|
|
131
116
|
isFullScreen={ isFullscreen }
|
|
132
117
|
__experimentalHideHeader
|
|
133
118
|
>
|
|
134
|
-
{ styleContent && (
|
|
135
|
-
<style
|
|
136
|
-
dangerouslySetInnerHTML={ { __html: styleContent } }
|
|
137
|
-
/>
|
|
138
|
-
) }
|
|
139
119
|
<Tabs orientation="horizontal" defaultTabId="html">
|
|
140
120
|
<VStack spacing={ 4 } style={ { height: '100%' } }>
|
|
141
121
|
<HStack justify="space-between">
|
package/src/image/index.js
CHANGED
|
@@ -62,4 +62,51 @@ export const settings = {
|
|
|
62
62
|
deprecated,
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
+
if ( window.__experimentalContentOnlyPatternInsertion ) {
|
|
66
|
+
settings.fields = [
|
|
67
|
+
{
|
|
68
|
+
label: __( 'Image' ),
|
|
69
|
+
type: 'Media',
|
|
70
|
+
shownByDefault: true,
|
|
71
|
+
mapping: {
|
|
72
|
+
id: 'id',
|
|
73
|
+
src: 'url',
|
|
74
|
+
caption: 'caption',
|
|
75
|
+
alt: 'alt',
|
|
76
|
+
},
|
|
77
|
+
args: {
|
|
78
|
+
allowedTypes: [ 'image' ],
|
|
79
|
+
multiple: false,
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
label: __( 'Link' ),
|
|
84
|
+
type: 'Link',
|
|
85
|
+
shownByDefault: false,
|
|
86
|
+
mapping: {
|
|
87
|
+
href: 'href',
|
|
88
|
+
rel: 'rel',
|
|
89
|
+
target: 'linkTarget',
|
|
90
|
+
destination: 'linkDestination',
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
label: __( 'Caption' ),
|
|
95
|
+
type: 'RichText',
|
|
96
|
+
shownByDefault: false,
|
|
97
|
+
mapping: {
|
|
98
|
+
value: 'caption',
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
label: __( 'Alt text' ),
|
|
103
|
+
type: 'PlainText',
|
|
104
|
+
shownByDefault: false,
|
|
105
|
+
mapping: {
|
|
106
|
+
value: 'alt',
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
];
|
|
110
|
+
}
|
|
111
|
+
|
|
65
112
|
export const init = () => initBlock( { name, metadata, settings } );
|