@wordpress/block-library 8.12.10 → 8.12.11
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-library",
|
|
3
|
-
"version": "8.12.
|
|
3
|
+
"version": "8.12.11",
|
|
4
4
|
"description": "Block library for the WordPress editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
"@wordpress/api-fetch": "^6.32.1",
|
|
38
38
|
"@wordpress/autop": "^3.35.1",
|
|
39
39
|
"@wordpress/blob": "^3.35.1",
|
|
40
|
-
"@wordpress/block-editor": "^12.3.
|
|
41
|
-
"@wordpress/blocks": "^12.12.
|
|
40
|
+
"@wordpress/block-editor": "^12.3.9",
|
|
41
|
+
"@wordpress/blocks": "^12.12.5",
|
|
42
42
|
"@wordpress/components": "^25.1.8",
|
|
43
43
|
"@wordpress/compose": "^6.12.1",
|
|
44
|
-
"@wordpress/core-data": "^6.12.
|
|
44
|
+
"@wordpress/core-data": "^6.12.9",
|
|
45
45
|
"@wordpress/data": "^9.5.4",
|
|
46
46
|
"@wordpress/date": "^4.35.1",
|
|
47
47
|
"@wordpress/deprecated": "^3.35.1",
|
|
@@ -56,9 +56,9 @@
|
|
|
56
56
|
"@wordpress/notices": "^4.3.4",
|
|
57
57
|
"@wordpress/primitives": "^3.33.1",
|
|
58
58
|
"@wordpress/private-apis": "^0.17.2",
|
|
59
|
-
"@wordpress/reusable-blocks": "^4.12.
|
|
59
|
+
"@wordpress/reusable-blocks": "^4.12.9",
|
|
60
60
|
"@wordpress/rich-text": "^6.12.5",
|
|
61
|
-
"@wordpress/server-side-render": "^4.12.
|
|
61
|
+
"@wordpress/server-side-render": "^4.12.9",
|
|
62
62
|
"@wordpress/url": "^3.36.1",
|
|
63
63
|
"@wordpress/viewport": "^5.12.4",
|
|
64
64
|
"@wordpress/wordcount": "^3.35.1",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"publishConfig": {
|
|
84
84
|
"access": "public"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "ec0ed708e46a598ab2cf8e18bf2591b0102b5bb3"
|
|
87
87
|
}
|
package/src/footnotes/index.php
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* Renders the `core/footnotes` block on the server.
|
|
10
10
|
*
|
|
11
|
+
* @since 6.3.0
|
|
12
|
+
*
|
|
11
13
|
* @param array $attributes Block attributes.
|
|
12
14
|
* @param string $content Block default content.
|
|
13
15
|
* @param WP_Block $block Block instance.
|
|
@@ -57,6 +59,8 @@ function render_block_core_footnotes( $attributes, $content, $block ) {
|
|
|
57
59
|
|
|
58
60
|
/**
|
|
59
61
|
* Registers the `core/footnotes` block on the server.
|
|
62
|
+
*
|
|
63
|
+
* @since 6.3.0
|
|
60
64
|
*/
|
|
61
65
|
function register_block_core_footnotes() {
|
|
62
66
|
foreach ( array( 'post', 'page' ) as $post_type ) {
|
|
@@ -78,3 +82,137 @@ function register_block_core_footnotes() {
|
|
|
78
82
|
);
|
|
79
83
|
}
|
|
80
84
|
add_action( 'init', 'register_block_core_footnotes' );
|
|
85
|
+
|
|
86
|
+
add_action(
|
|
87
|
+
'wp_after_insert_post',
|
|
88
|
+
/**
|
|
89
|
+
* Saves the footnotes meta value to the revision.
|
|
90
|
+
*
|
|
91
|
+
* @since 6.3.0
|
|
92
|
+
*
|
|
93
|
+
* @param int $revision_id The revision ID.
|
|
94
|
+
*/
|
|
95
|
+
static function( $revision_id ) {
|
|
96
|
+
$post_id = wp_is_post_revision( $revision_id );
|
|
97
|
+
|
|
98
|
+
if ( $post_id ) {
|
|
99
|
+
$footnotes = get_post_meta( $post_id, 'footnotes', true );
|
|
100
|
+
|
|
101
|
+
if ( $footnotes ) {
|
|
102
|
+
// Can't use update_post_meta() because it doesn't allow revisions.
|
|
103
|
+
update_metadata( 'post', $revision_id, 'footnotes', $footnotes );
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
add_action(
|
|
110
|
+
'_wp_put_post_revision',
|
|
111
|
+
/**
|
|
112
|
+
* Keeps track of the revision ID for "rest_after_insert_{$post_type}".
|
|
113
|
+
*
|
|
114
|
+
* @param int $revision_id The revision ID.
|
|
115
|
+
*/
|
|
116
|
+
static function( $revision_id ) {
|
|
117
|
+
global $_gutenberg_revision_id;
|
|
118
|
+
$_gutenberg_revision_id = $revision_id;
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
foreach ( array( 'post', 'page' ) as $post_type ) {
|
|
123
|
+
add_action(
|
|
124
|
+
"rest_after_insert_{$post_type}",
|
|
125
|
+
/**
|
|
126
|
+
* This is a specific fix for the REST API. The REST API doesn't update
|
|
127
|
+
* the post and post meta in one go (through `meta_input`). While it
|
|
128
|
+
* does fix the `wp_after_insert_post` hook to be called correctly after
|
|
129
|
+
* updating meta, it does NOT fix hooks such as post_updated and
|
|
130
|
+
* save_post, which are normally also fired after post meta is updated
|
|
131
|
+
* in `wp_insert_post()`. Unfortunately, `wp_save_post_revision` is
|
|
132
|
+
* added to the `post_updated` action, which means the meta is not
|
|
133
|
+
* available at the time, so we have to add it afterwards through the
|
|
134
|
+
* `"rest_after_insert_{$post_type}"` action.
|
|
135
|
+
*
|
|
136
|
+
* @since 6.3.0
|
|
137
|
+
*
|
|
138
|
+
* @param WP_Post $post The post object.
|
|
139
|
+
*/
|
|
140
|
+
static function( $post ) {
|
|
141
|
+
global $_gutenberg_revision_id;
|
|
142
|
+
|
|
143
|
+
if ( $_gutenberg_revision_id ) {
|
|
144
|
+
$revision = get_post( $_gutenberg_revision_id );
|
|
145
|
+
$post_id = $revision->post_parent;
|
|
146
|
+
|
|
147
|
+
// Just making sure we're updating the right revision.
|
|
148
|
+
if ( $post->ID === $post_id ) {
|
|
149
|
+
$footnotes = get_post_meta( $post_id, 'footnotes', true );
|
|
150
|
+
|
|
151
|
+
if ( $footnotes ) {
|
|
152
|
+
// Can't use update_post_meta() because it doesn't allow revisions.
|
|
153
|
+
update_metadata( 'post', $_gutenberg_revision_id, 'footnotes', $footnotes );
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
add_action(
|
|
162
|
+
'wp_restore_post_revision',
|
|
163
|
+
/**
|
|
164
|
+
* Restores the footnotes meta value from the revision.
|
|
165
|
+
*
|
|
166
|
+
* @since 6.3.0
|
|
167
|
+
*
|
|
168
|
+
* @param int $post_id The post ID.
|
|
169
|
+
* @param int $revision_id The revision ID.
|
|
170
|
+
*/
|
|
171
|
+
static function( $post_id, $revision_id ) {
|
|
172
|
+
$footnotes = get_post_meta( $revision_id, 'footnotes', true );
|
|
173
|
+
|
|
174
|
+
if ( $footnotes ) {
|
|
175
|
+
update_post_meta( $post_id, 'footnotes', $footnotes );
|
|
176
|
+
} else {
|
|
177
|
+
delete_post_meta( $post_id, 'footnotes' );
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
10,
|
|
181
|
+
2
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
add_filter(
|
|
185
|
+
'_wp_post_revision_fields',
|
|
186
|
+
/**
|
|
187
|
+
* Adds the footnotes field to the revision.
|
|
188
|
+
*
|
|
189
|
+
* @since 6.3.0
|
|
190
|
+
*
|
|
191
|
+
* @param array $fields The revision fields.
|
|
192
|
+
* @return array The revision fields.
|
|
193
|
+
*/
|
|
194
|
+
static function( $fields ) {
|
|
195
|
+
$fields['footnotes'] = __( 'Footnotes' );
|
|
196
|
+
return $fields;
|
|
197
|
+
}
|
|
198
|
+
);
|
|
199
|
+
|
|
200
|
+
add_filter(
|
|
201
|
+
'wp_post_revision_field_footnotes',
|
|
202
|
+
/**
|
|
203
|
+
* Gets the footnotes field from the revision.
|
|
204
|
+
*
|
|
205
|
+
* @since 6.3.0
|
|
206
|
+
*
|
|
207
|
+
* @param string $revision_field The field value, but $revision->$field
|
|
208
|
+
* (footnotes) does not exist.
|
|
209
|
+
* @param string $field The field name, in this case "footnotes".
|
|
210
|
+
* @param object $revision The revision object to compare against.
|
|
211
|
+
* @return string The field value.
|
|
212
|
+
*/
|
|
213
|
+
static function( $revision_field, $field, $revision ) {
|
|
214
|
+
return get_metadata( 'post', $revision->ID, $field, true );
|
|
215
|
+
},
|
|
216
|
+
10,
|
|
217
|
+
3
|
|
218
|
+
);
|
package/src/pattern/index.php
CHANGED
|
@@ -22,6 +22,8 @@ function register_block_core_pattern() {
|
|
|
22
22
|
/**
|
|
23
23
|
* Renders the `core/pattern` block on the server.
|
|
24
24
|
*
|
|
25
|
+
* @since 6.3.0 Backwards compatibility: blocks with no `syncStatus` attribute do not receive block wrapper.
|
|
26
|
+
*
|
|
25
27
|
* @param array $attributes Block attributes.
|
|
26
28
|
*
|
|
27
29
|
* @return string Returns the output of the pattern.
|
|
@@ -34,6 +34,8 @@ function block_core_post_template_uses_featured_image( $inner_blocks ) {
|
|
|
34
34
|
/**
|
|
35
35
|
* Renders the `core/post-template` block on the server.
|
|
36
36
|
*
|
|
37
|
+
* @since 6.3.0 Changed render_block_context priority to `1`.
|
|
38
|
+
*
|
|
37
39
|
* @param array $attributes Block attributes.
|
|
38
40
|
* @param string $content Block default content.
|
|
39
41
|
* @param WP_Block $block Block instance.
|
package/src/post-title/index.php
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* Renders the `core/post-title` block on the server.
|
|
10
10
|
*
|
|
11
|
+
* @since 6.3.0 Omitting the $post argument from the `get_the_title`.
|
|
12
|
+
*
|
|
11
13
|
* @param array $attributes Block attributes.
|
|
12
14
|
* @param string $content Block default content.
|
|
13
15
|
* @param WP_Block $block Block instance.
|
package/src/search/index.php
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* Dynamically renders the `core/search` block.
|
|
10
10
|
*
|
|
11
|
+
* @since 6.3.0 Using block.json `viewScript` to register script, and update `view_script_handles()` only when needed.
|
|
12
|
+
*
|
|
11
13
|
* @param array $attributes The block attributes.
|
|
12
14
|
* @param string $content The saved content.
|
|
13
15
|
* @param WP_Block $block The parsed block.
|