@wordpress/block-library 9.27.0 → 9.28.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/categories/edit.js +15 -3
- package/build/categories/edit.js.map +1 -1
- package/build/cover/edit/index.js +1 -1
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +5 -3
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/file/edit.js +5 -2
- package/build/file/edit.js.map +1 -1
- package/build/file/edit.native.js +1 -1
- package/build/file/edit.native.js.map +1 -1
- package/build/file/transforms.js +6 -6
- package/build/file/transforms.js.map +1 -1
- package/build/file/utils/index.js +5 -0
- package/build/file/utils/index.js.map +1 -1
- package/build/gallery/use-get-media.js +3 -3
- package/build/gallery/use-get-media.js.map +1 -1
- package/build/gallery/use-get-media.native.js +3 -3
- package/build/gallery/use-get-media.native.js.map +1 -1
- package/build/image/edit.native.js +2 -2
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +1 -1
- package/build/image/image.js.map +1 -1
- package/build/latest-posts/edit.js +0 -2
- package/build/latest-posts/edit.js.map +1 -1
- package/build/list-item/edit.js +3 -0
- package/build/list-item/edit.js.map +1 -1
- package/build/media-text/edit.js +2 -2
- package/build/media-text/edit.js.map +1 -1
- package/build/more/edit.js +13 -28
- package/build/more/edit.js.map +1 -1
- package/build/paragraph/edit.js +2 -2
- package/build/paragraph/edit.js.map +1 -1
- package/build/post-comments-count/index.js +3 -0
- package/build/post-comments-count/index.js.map +1 -1
- package/build/post-comments-link/index.js +3 -0
- package/build/post-comments-link/index.js.map +1 -1
- package/build/post-date/deprecated.js +104 -1
- package/build/post-date/deprecated.js.map +1 -1
- package/build/post-date/edit.js +32 -32
- package/build/post-date/edit.js.map +1 -1
- package/build/post-date/index.js +4 -4
- package/build/post-date/index.js.map +1 -1
- package/build/post-date/variations.js +32 -3
- package/build/post-date/variations.js.map +1 -1
- package/build/post-featured-image/edit.js +2 -2
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/site-logo/edit.js +2 -2
- package/build/site-logo/edit.js.map +1 -1
- package/build/social-link/icons/tiktok.js +2 -2
- package/build/social-link/icons/tiktok.js.map +1 -1
- package/build/social-link/variations.js +51 -49
- package/build/social-link/variations.js.map +1 -1
- package/build/utils/poster-image.js +141 -0
- package/build/utils/poster-image.js.map +1 -0
- package/build/video/edit.js +6 -2
- package/build/video/edit.js.map +1 -1
- package/build-module/categories/edit.js +15 -3
- package/build-module/categories/edit.js.map +1 -1
- package/build-module/cover/edit/index.js +1 -1
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +5 -3
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/file/edit.js +5 -2
- package/build-module/file/edit.js.map +1 -1
- package/build-module/file/edit.native.js +1 -1
- package/build-module/file/edit.native.js.map +1 -1
- package/build-module/file/transforms.js +6 -6
- package/build-module/file/transforms.js.map +1 -1
- package/build-module/file/utils/index.js +5 -0
- package/build-module/file/utils/index.js.map +1 -1
- package/build-module/gallery/use-get-media.js +3 -3
- package/build-module/gallery/use-get-media.js.map +1 -1
- package/build-module/gallery/use-get-media.native.js +3 -3
- package/build-module/gallery/use-get-media.native.js.map +1 -1
- package/build-module/image/edit.native.js +2 -2
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +1 -1
- package/build-module/image/image.js.map +1 -1
- package/build-module/latest-posts/edit.js +0 -2
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/list-item/edit.js +3 -0
- package/build-module/list-item/edit.js.map +1 -1
- package/build-module/media-text/edit.js +2 -2
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/more/edit.js +15 -29
- package/build-module/more/edit.js.map +1 -1
- package/build-module/paragraph/edit.js +2 -2
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/post-comments-count/index.js +3 -0
- package/build-module/post-comments-count/index.js.map +1 -1
- package/build-module/post-comments-link/index.js +3 -0
- package/build-module/post-comments-link/index.js.map +1 -1
- package/build-module/post-date/deprecated.js +104 -1
- package/build-module/post-date/deprecated.js.map +1 -1
- package/build-module/post-date/edit.js +35 -35
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-date/index.js +4 -4
- package/build-module/post-date/index.js.map +1 -1
- package/build-module/post-date/variations.js +32 -3
- package/build-module/post-date/variations.js.map +1 -1
- package/build-module/post-featured-image/edit.js +2 -2
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/site-logo/edit.js +2 -2
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/social-link/icons/tiktok.js +2 -2
- package/build-module/social-link/icons/tiktok.js.map +1 -1
- package/build-module/social-link/variations.js +52 -50
- package/build-module/social-link/variations.js.map +1 -1
- package/build-module/utils/poster-image.js +133 -0
- package/build-module/utils/poster-image.js.map +1 -0
- package/build-module/video/edit.js +6 -2
- package/build-module/video/edit.js.map +1 -1
- package/build-style/editor-rtl.css +77 -23
- package/build-style/editor.css +77 -23
- package/build-style/gallery/style-rtl.css +1 -2
- package/build-style/gallery/style.css +1 -2
- package/build-style/image/style-rtl.css +1 -2
- package/build-style/image/style.css +1 -2
- package/build-style/more/editor-rtl.css +3 -11
- package/build-style/more/editor.css +3 -11
- package/build-style/navigation/editor-rtl.css +6 -6
- package/build-style/navigation/editor.css +6 -6
- package/build-style/page-list/editor-rtl.css +0 -4
- package/build-style/page-list/editor.css +0 -4
- package/build-style/post-featured-image/editor-rtl.css +1 -2
- package/build-style/post-featured-image/editor.css +1 -2
- package/build-style/style-rtl.css +3 -4
- package/build-style/style.css +3 -4
- package/build-style/video/style-rtl.css +1 -0
- package/build-style/video/style.css +1 -0
- package/package.json +35 -35
- package/src/block/index.php +33 -20
- package/src/categories/edit.js +13 -1
- package/src/cover/edit/index.js +8 -3
- package/src/cover/edit/inspector-controls.js +12 -3
- package/src/editor.scss +1 -0
- package/src/file/edit.js +10 -2
- package/src/file/edit.native.js +5 -1
- package/src/file/transforms.js +6 -6
- package/src/file/utils/index.js +5 -0
- package/src/form-input/index.php +4 -2
- package/src/gallery/use-get-media.js +9 -5
- package/src/gallery/use-get-media.native.js +10 -6
- package/src/image/edit.native.js +4 -2
- package/src/image/image.js +6 -1
- package/src/image/index.php +1 -1
- package/src/image/test/edit.native.js +16 -10
- package/src/latest-posts/edit.js +0 -2
- package/src/list-item/edit.js +3 -0
- package/src/loginout/index.php +4 -2
- package/src/media-text/edit.js +16 -6
- package/src/more/edit.js +27 -33
- package/src/more/editor.scss +3 -12
- package/src/page-list/editor.scss +0 -6
- package/src/paragraph/edit.js +2 -2
- package/src/post-comments-count/block.json +3 -0
- package/src/post-comments-link/block.json +3 -0
- package/src/post-date/block.json +4 -4
- package/src/post-date/deprecated.js +104 -1
- package/src/post-date/edit.js +74 -86
- package/src/post-date/index.php +51 -28
- package/src/post-date/variations.js +37 -3
- package/src/post-featured-image/edit.js +2 -2
- package/src/site-logo/edit.js +11 -4
- package/src/social-link/README.md +21 -0
- package/src/social-link/icons/tiktok.js +2 -2
- package/src/social-link/index.php +49 -49
- package/src/social-link/variations.js +51 -49
- package/src/utils/poster-image.js +176 -0
- package/src/utils/poster-image.scss +82 -0
- package/src/video/edit.js +7 -2
- package/src/video/index.php +91 -0
- package/src/video/style.native.scss +1 -0
- package/src/video/style.scss +1 -0
- package/build/cover/edit/poster-image.js +0 -81
- package/build/cover/edit/poster-image.js.map +0 -1
- package/build/video/poster-image.js +0 -81
- package/build/video/poster-image.js.map +0 -1
- package/build-module/cover/edit/poster-image.js +0 -74
- package/build-module/cover/edit/poster-image.js.map +0 -1
- package/build-module/video/poster-image.js +0 -74
- package/build-module/video/poster-image.js.map +0 -1
- package/src/cover/edit/poster-image.js +0 -91
- package/src/video/poster-image.js +0 -91
|
@@ -1465,8 +1465,7 @@ figure.wp-block-gallery.has-nested-images {
|
|
|
1465
1465
|
height: 100%;
|
|
1466
1466
|
max-height: 40%;
|
|
1467
1467
|
pointer-events: none;
|
|
1468
|
-
|
|
1469
|
-
backdrop-filter: blur(3px);
|
|
1468
|
+
backdrop-filter: blur(3px);
|
|
1470
1469
|
-webkit-mask-image: linear-gradient(0deg, #000 20%, transparent 100%);
|
|
1471
1470
|
mask-image: linear-gradient(0deg, #000 20%, transparent 100%);
|
|
1472
1471
|
}
|
|
@@ -1741,8 +1740,7 @@ h6.has-text-align-left[style*=writing-mode]:where([style*=vertical-lr]) {
|
|
|
1741
1740
|
opacity: 0;
|
|
1742
1741
|
border: none;
|
|
1743
1742
|
background-color: rgba(90, 90, 90, 0.25);
|
|
1744
|
-
|
|
1745
|
-
backdrop-filter: blur(16px) saturate(180%);
|
|
1743
|
+
backdrop-filter: blur(16px) saturate(180%);
|
|
1746
1744
|
cursor: zoom-in;
|
|
1747
1745
|
display: flex;
|
|
1748
1746
|
justify-content: center;
|
|
@@ -4197,6 +4195,7 @@ pre.wp-block-verse {
|
|
|
4197
4195
|
}
|
|
4198
4196
|
.wp-block-video video {
|
|
4199
4197
|
width: 100%;
|
|
4198
|
+
height: auto;
|
|
4200
4199
|
vertical-align: middle;
|
|
4201
4200
|
}
|
|
4202
4201
|
@supports (position: sticky) {
|
package/build-style/style.css
CHANGED
|
@@ -1473,8 +1473,7 @@ figure.wp-block-gallery.has-nested-images {
|
|
|
1473
1473
|
height: 100%;
|
|
1474
1474
|
max-height: 40%;
|
|
1475
1475
|
pointer-events: none;
|
|
1476
|
-
|
|
1477
|
-
backdrop-filter: blur(3px);
|
|
1476
|
+
backdrop-filter: blur(3px);
|
|
1478
1477
|
-webkit-mask-image: linear-gradient(0deg, #000 20%, transparent 100%);
|
|
1479
1478
|
mask-image: linear-gradient(0deg, #000 20%, transparent 100%);
|
|
1480
1479
|
}
|
|
@@ -1755,8 +1754,7 @@ h6.has-text-align-left[style*=writing-mode]:where([style*=vertical-lr]) {
|
|
|
1755
1754
|
opacity: 0;
|
|
1756
1755
|
border: none;
|
|
1757
1756
|
background-color: rgba(90, 90, 90, 0.25);
|
|
1758
|
-
|
|
1759
|
-
backdrop-filter: blur(16px) saturate(180%);
|
|
1757
|
+
backdrop-filter: blur(16px) saturate(180%);
|
|
1760
1758
|
cursor: zoom-in;
|
|
1761
1759
|
display: flex;
|
|
1762
1760
|
justify-content: center;
|
|
@@ -4230,6 +4228,7 @@ pre.wp-block-verse {
|
|
|
4230
4228
|
}
|
|
4231
4229
|
.wp-block-video video {
|
|
4232
4230
|
width: 100%;
|
|
4231
|
+
height: auto;
|
|
4233
4232
|
vertical-align: middle;
|
|
4234
4233
|
}
|
|
4235
4234
|
@supports (position: sticky) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-library",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.28.0",
|
|
4
4
|
"description": "Block library for the WordPress editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -41,39 +41,39 @@
|
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@babel/runtime": "7.25.7",
|
|
44
|
-
"@wordpress/a11y": "^4.
|
|
45
|
-
"@wordpress/api-fetch": "^7.
|
|
46
|
-
"@wordpress/autop": "^4.
|
|
47
|
-
"@wordpress/blob": "^4.
|
|
48
|
-
"@wordpress/block-editor": "^15.
|
|
49
|
-
"@wordpress/blocks": "^15.
|
|
50
|
-
"@wordpress/components": "^30.
|
|
51
|
-
"@wordpress/compose": "^7.
|
|
52
|
-
"@wordpress/core-data": "^7.
|
|
53
|
-
"@wordpress/data": "^10.
|
|
54
|
-
"@wordpress/date": "^5.
|
|
55
|
-
"@wordpress/deprecated": "^4.
|
|
56
|
-
"@wordpress/dom": "^4.
|
|
57
|
-
"@wordpress/element": "^6.
|
|
58
|
-
"@wordpress/escape-html": "^3.
|
|
59
|
-
"@wordpress/hooks": "^4.
|
|
60
|
-
"@wordpress/html-entities": "^4.
|
|
61
|
-
"@wordpress/i18n": "^6.
|
|
62
|
-
"@wordpress/icons": "^10.
|
|
63
|
-
"@wordpress/interactivity": "^6.
|
|
64
|
-
"@wordpress/interactivity-router": "^2.
|
|
65
|
-
"@wordpress/keyboard-shortcuts": "^5.
|
|
66
|
-
"@wordpress/keycodes": "^4.
|
|
67
|
-
"@wordpress/notices": "^5.
|
|
68
|
-
"@wordpress/patterns": "^2.
|
|
69
|
-
"@wordpress/primitives": "^4.
|
|
70
|
-
"@wordpress/private-apis": "^1.
|
|
71
|
-
"@wordpress/reusable-blocks": "^5.
|
|
72
|
-
"@wordpress/rich-text": "^7.
|
|
73
|
-
"@wordpress/server-side-render": "^6.
|
|
74
|
-
"@wordpress/url": "^4.
|
|
75
|
-
"@wordpress/viewport": "^6.
|
|
76
|
-
"@wordpress/wordcount": "^4.
|
|
44
|
+
"@wordpress/a11y": "^4.28.0",
|
|
45
|
+
"@wordpress/api-fetch": "^7.28.0",
|
|
46
|
+
"@wordpress/autop": "^4.28.0",
|
|
47
|
+
"@wordpress/blob": "^4.28.0",
|
|
48
|
+
"@wordpress/block-editor": "^15.1.0",
|
|
49
|
+
"@wordpress/blocks": "^15.1.0",
|
|
50
|
+
"@wordpress/components": "^30.1.0",
|
|
51
|
+
"@wordpress/compose": "^7.28.0",
|
|
52
|
+
"@wordpress/core-data": "^7.28.0",
|
|
53
|
+
"@wordpress/data": "^10.28.0",
|
|
54
|
+
"@wordpress/date": "^5.28.0",
|
|
55
|
+
"@wordpress/deprecated": "^4.28.0",
|
|
56
|
+
"@wordpress/dom": "^4.28.0",
|
|
57
|
+
"@wordpress/element": "^6.28.0",
|
|
58
|
+
"@wordpress/escape-html": "^3.28.0",
|
|
59
|
+
"@wordpress/hooks": "^4.28.0",
|
|
60
|
+
"@wordpress/html-entities": "^4.28.0",
|
|
61
|
+
"@wordpress/i18n": "^6.1.0",
|
|
62
|
+
"@wordpress/icons": "^10.28.0",
|
|
63
|
+
"@wordpress/interactivity": "^6.28.0",
|
|
64
|
+
"@wordpress/interactivity-router": "^2.28.0",
|
|
65
|
+
"@wordpress/keyboard-shortcuts": "^5.28.0",
|
|
66
|
+
"@wordpress/keycodes": "^4.28.0",
|
|
67
|
+
"@wordpress/notices": "^5.28.0",
|
|
68
|
+
"@wordpress/patterns": "^2.28.0",
|
|
69
|
+
"@wordpress/primitives": "^4.28.0",
|
|
70
|
+
"@wordpress/private-apis": "^1.28.0",
|
|
71
|
+
"@wordpress/reusable-blocks": "^5.28.0",
|
|
72
|
+
"@wordpress/rich-text": "^7.28.0",
|
|
73
|
+
"@wordpress/server-side-render": "^6.4.0",
|
|
74
|
+
"@wordpress/url": "^4.28.0",
|
|
75
|
+
"@wordpress/viewport": "^6.28.0",
|
|
76
|
+
"@wordpress/wordcount": "^4.28.0",
|
|
77
77
|
"change-case": "^4.1.2",
|
|
78
78
|
"clsx": "^2.1.1",
|
|
79
79
|
"colord": "^2.7.0",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"publishConfig": {
|
|
92
92
|
"access": "public"
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "28cc2098f5ee28f89096b638533796538f495f72"
|
|
95
95
|
}
|
package/src/block/index.php
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<?php
|
|
1
|
+
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName // Needed for WP_Block_Cloner helper class.
|
|
2
2
|
/**
|
|
3
3
|
* Server-side rendering of the `core/block` block.
|
|
4
4
|
*
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*
|
|
17
17
|
* @return string Rendered HTML of the referenced block.
|
|
18
18
|
*/
|
|
19
|
-
function render_block_core_block( $attributes ) {
|
|
19
|
+
function render_block_core_block( $attributes, $content, $block_instance ) {
|
|
20
20
|
static $seen_refs = array();
|
|
21
21
|
|
|
22
22
|
if ( empty( $attributes['ref'] ) ) {
|
|
@@ -73,30 +73,43 @@ function render_block_core_block( $attributes ) {
|
|
|
73
73
|
$attributes['content'] = $attributes['overrides'];
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
// Apply Block Hooks.
|
|
77
|
+
$content = apply_block_hooks_to_content_from_post_object( $content, $reusable_block );
|
|
78
|
+
|
|
76
79
|
/**
|
|
77
|
-
* We
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
+
* We attach the blocks from $content as inner blocks to the Synced Pattern block instance.
|
|
81
|
+
* This ensures that block context available to the Synced Pattern block instance is provided to
|
|
82
|
+
* those blocks.
|
|
80
83
|
*/
|
|
81
|
-
$
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
$block_instance->parsed_block['innerBlocks'] = parse_blocks( $content );
|
|
85
|
+
$block_instance->parsed_block['innerContent'] = array_fill( 0, count( $block_instance->parsed_block['innerBlocks'] ), null );
|
|
86
|
+
if ( method_exists( $block_instance, 'refresh_context_dependents' ) ) {
|
|
87
|
+
// WP_Block::refresh_context_dependents() was introduced in WordPress 6.8.
|
|
88
|
+
$block_instance->refresh_context_dependents();
|
|
89
|
+
} else {
|
|
90
|
+
// This branch can be removed once Gutenberg requires WordPress 6.8 or later.
|
|
91
|
+
// phpcs:ignore Gutenberg.Commenting.SinceTag.MissingClassSinceTag
|
|
92
|
+
class WP_Block_Cloner extends WP_Block {
|
|
93
|
+
/**
|
|
94
|
+
* Static methods of subclasses have access to protected properties
|
|
95
|
+
* of instances of the parent class.
|
|
96
|
+
* In this case, this gives us access to `available_context` and `registry`.
|
|
97
|
+
*/
|
|
98
|
+
// phpcs:ignore Gutenberg.Commenting.SinceTag.MissingMethodSinceTag
|
|
99
|
+
public static function clone_instance( $instance ) {
|
|
100
|
+
return new WP_Block(
|
|
101
|
+
$instance->parsed_block,
|
|
102
|
+
$instance->available_context,
|
|
103
|
+
$instance->registry
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
$block_instance = WP_Block_Cloner::clone_instance( $block_instance );
|
|
88
108
|
}
|
|
89
109
|
|
|
90
|
-
|
|
91
|
-
$content = apply_block_hooks_to_content_from_post_object( $content, $reusable_block );
|
|
92
|
-
|
|
93
|
-
$content = do_blocks( $content );
|
|
110
|
+
$content = $block_instance->render( array( 'dynamic' => false ) );
|
|
94
111
|
unset( $seen_refs[ $attributes['ref'] ] );
|
|
95
112
|
|
|
96
|
-
if ( $has_pattern_overrides ) {
|
|
97
|
-
remove_filter( 'render_block_context', $filter_block_context, 1 );
|
|
98
|
-
}
|
|
99
|
-
|
|
100
113
|
return $content;
|
|
101
114
|
}
|
|
102
115
|
|
package/src/categories/edit.js
CHANGED
|
@@ -25,6 +25,8 @@ import { decodeEntities } from '@wordpress/html-entities';
|
|
|
25
25
|
import { __, sprintf } from '@wordpress/i18n';
|
|
26
26
|
import { pin } from '@wordpress/icons';
|
|
27
27
|
import { useEntityRecords } from '@wordpress/core-data';
|
|
28
|
+
import { useDispatch } from '@wordpress/data';
|
|
29
|
+
import { store as noticeStore } from '@wordpress/notices';
|
|
28
30
|
|
|
29
31
|
/**
|
|
30
32
|
* Internal dependencies
|
|
@@ -44,6 +46,7 @@ export default function CategoriesEdit( {
|
|
|
44
46
|
},
|
|
45
47
|
setAttributes,
|
|
46
48
|
className,
|
|
49
|
+
clientId,
|
|
47
50
|
} ) {
|
|
48
51
|
const selectId = useInstanceId( CategoriesEdit, 'blocks-category-select' );
|
|
49
52
|
|
|
@@ -70,6 +73,15 @@ export default function CategoriesEdit( {
|
|
|
70
73
|
query
|
|
71
74
|
);
|
|
72
75
|
|
|
76
|
+
const { createWarningNotice } = useDispatch( noticeStore );
|
|
77
|
+
const showRedirectionPreventedNotice = ( event ) => {
|
|
78
|
+
event.preventDefault();
|
|
79
|
+
createWarningNotice( __( 'Links are disabled in the editor.' ), {
|
|
80
|
+
id: `block-library/core/categories/redirection-prevented/${ clientId }`,
|
|
81
|
+
type: 'snackbar',
|
|
82
|
+
} );
|
|
83
|
+
};
|
|
84
|
+
|
|
73
85
|
const getCategoriesList = ( parentId ) => {
|
|
74
86
|
if ( ! categories?.length ) {
|
|
75
87
|
return [];
|
|
@@ -99,7 +111,7 @@ export default function CategoriesEdit( {
|
|
|
99
111
|
const { id, link, count, name } = category;
|
|
100
112
|
return (
|
|
101
113
|
<li key={ id } className={ `cat-item cat-item-${ id }` }>
|
|
102
|
-
<a href={ link }
|
|
114
|
+
<a href={ link } onClick={ showRedirectionPreventedNotice }>
|
|
103
115
|
{ renderCategoryName( name ) }
|
|
104
116
|
</a>
|
|
105
117
|
{ showPostCounts && ` (${ count })` }
|
package/src/cover/edit/index.js
CHANGED
|
@@ -120,9 +120,14 @@ function CoverEdit( {
|
|
|
120
120
|
return {
|
|
121
121
|
media:
|
|
122
122
|
featuredImage && useFeaturedImage
|
|
123
|
-
? select( coreStore ).
|
|
124
|
-
|
|
125
|
-
|
|
123
|
+
? select( coreStore ).getEntityRecord(
|
|
124
|
+
'postType',
|
|
125
|
+
'attachment',
|
|
126
|
+
featuredImage,
|
|
127
|
+
{
|
|
128
|
+
context: 'view',
|
|
129
|
+
}
|
|
130
|
+
)
|
|
126
131
|
: undefined,
|
|
127
132
|
};
|
|
128
133
|
},
|
|
@@ -35,7 +35,7 @@ import { COVER_MIN_HEIGHT, mediaPosition } from '../shared';
|
|
|
35
35
|
import { unlock } from '../../lock-unlock';
|
|
36
36
|
import { useToolsPanelDropdownMenuProps } from '../../utils/hooks';
|
|
37
37
|
import { DEFAULT_MEDIA_SIZE_SLUG } from '../constants';
|
|
38
|
-
import PosterImage from '
|
|
38
|
+
import PosterImage from '../../utils/poster-image';
|
|
39
39
|
|
|
40
40
|
const { cleanEmptyObject, ResolutionTool, HTMLElementControl } = unlock(
|
|
41
41
|
blockEditorPrivateApis
|
|
@@ -131,7 +131,12 @@ export default function CoverInspectorControls( {
|
|
|
131
131
|
const image = useSelect(
|
|
132
132
|
( select ) =>
|
|
133
133
|
id && isImageBackground
|
|
134
|
-
? select( coreStore ).
|
|
134
|
+
? select( coreStore ).getEntityRecord(
|
|
135
|
+
'postType',
|
|
136
|
+
'attachment',
|
|
137
|
+
id,
|
|
138
|
+
{ context: 'view' }
|
|
139
|
+
)
|
|
135
140
|
: null,
|
|
136
141
|
[ id, isImageBackground ]
|
|
137
142
|
);
|
|
@@ -275,7 +280,11 @@ export default function CoverInspectorControls( {
|
|
|
275
280
|
{ isVideoBackground && (
|
|
276
281
|
<PosterImage
|
|
277
282
|
poster={ poster }
|
|
278
|
-
|
|
283
|
+
onChange={ ( posterImage ) =>
|
|
284
|
+
setAttributes( {
|
|
285
|
+
poster: posterImage?.url,
|
|
286
|
+
} )
|
|
287
|
+
}
|
|
279
288
|
/>
|
|
280
289
|
) }
|
|
281
290
|
{ ! useFeaturedImage && url && ! isVideoBackground && (
|
package/src/editor.scss
CHANGED
package/src/file/edit.js
CHANGED
|
@@ -29,6 +29,7 @@ import { __, _x } from '@wordpress/i18n';
|
|
|
29
29
|
import { file as icon } from '@wordpress/icons';
|
|
30
30
|
import { store as coreStore } from '@wordpress/core-data';
|
|
31
31
|
import { store as noticesStore } from '@wordpress/notices';
|
|
32
|
+
import { getFilename } from '@wordpress/url';
|
|
32
33
|
|
|
33
34
|
/**
|
|
34
35
|
* Internal dependencies
|
|
@@ -79,7 +80,11 @@ function FileEdit( { attributes, isSelected, setAttributes, clientId } ) {
|
|
|
79
80
|
media:
|
|
80
81
|
id === undefined
|
|
81
82
|
? undefined
|
|
82
|
-
: select( coreStore ).
|
|
83
|
+
: select( coreStore ).getEntityRecord(
|
|
84
|
+
'postType',
|
|
85
|
+
'attachment',
|
|
86
|
+
id
|
|
87
|
+
),
|
|
83
88
|
} ),
|
|
84
89
|
[ id ]
|
|
85
90
|
);
|
|
@@ -127,7 +132,10 @@ function FileEdit( { attributes, isSelected, setAttributes, clientId } ) {
|
|
|
127
132
|
return;
|
|
128
133
|
}
|
|
129
134
|
|
|
130
|
-
const isPdf =
|
|
135
|
+
const isPdf =
|
|
136
|
+
// Media Library and REST API use different properties for mime type.
|
|
137
|
+
( newMedia.mime || newMedia.mime_type ) === 'application/pdf' ||
|
|
138
|
+
getFilename( newMedia.url ).toLowerCase().endsWith( '.pdf' );
|
|
131
139
|
const pdfAttributes = {
|
|
132
140
|
displayPreview: isPdf
|
|
133
141
|
? attributes.displayPreview ?? true
|
package/src/file/edit.native.js
CHANGED
|
@@ -583,7 +583,11 @@ export default compose( [
|
|
|
583
583
|
const isNotFileHref = id && getProtocol( href ) !== 'file:';
|
|
584
584
|
return {
|
|
585
585
|
media: isNotFileHref
|
|
586
|
-
? select( coreStore ).
|
|
586
|
+
? select( coreStore ).getEntityRecord(
|
|
587
|
+
'postType',
|
|
588
|
+
'attachment',
|
|
589
|
+
id
|
|
590
|
+
)
|
|
587
591
|
: undefined,
|
|
588
592
|
isSidebarOpened: isSelected && isEditorSidebarOpened(),
|
|
589
593
|
wasBlockJustInserted: select(
|
package/src/file/transforms.js
CHANGED
|
@@ -104,8 +104,8 @@ const transforms = {
|
|
|
104
104
|
if ( ! id ) {
|
|
105
105
|
return false;
|
|
106
106
|
}
|
|
107
|
-
const {
|
|
108
|
-
const media =
|
|
107
|
+
const { getEntityRecord } = select( coreStore );
|
|
108
|
+
const media = getEntityRecord( 'postType', 'attachment', id );
|
|
109
109
|
return !! media && media.mime_type.includes( 'audio' );
|
|
110
110
|
},
|
|
111
111
|
transform: ( attributes ) => {
|
|
@@ -124,8 +124,8 @@ const transforms = {
|
|
|
124
124
|
if ( ! id ) {
|
|
125
125
|
return false;
|
|
126
126
|
}
|
|
127
|
-
const {
|
|
128
|
-
const media =
|
|
127
|
+
const { getEntityRecord } = select( coreStore );
|
|
128
|
+
const media = getEntityRecord( 'postType', 'attachment', id );
|
|
129
129
|
return !! media && media.mime_type.includes( 'video' );
|
|
130
130
|
},
|
|
131
131
|
transform: ( attributes ) => {
|
|
@@ -144,8 +144,8 @@ const transforms = {
|
|
|
144
144
|
if ( ! id ) {
|
|
145
145
|
return false;
|
|
146
146
|
}
|
|
147
|
-
const {
|
|
148
|
-
const media =
|
|
147
|
+
const { getEntityRecord } = select( coreStore );
|
|
148
|
+
const media = getEntityRecord( 'postType', 'attachment', id );
|
|
149
149
|
return !! media && media.mime_type.includes( 'image' );
|
|
150
150
|
},
|
|
151
151
|
transform: ( attributes ) => {
|
package/src/file/utils/index.js
CHANGED
|
@@ -5,6 +5,11 @@
|
|
|
5
5
|
* @return {boolean} Whether or not the browser supports inline PDFs.
|
|
6
6
|
*/
|
|
7
7
|
export const browserSupportsPdfs = () => {
|
|
8
|
+
// Use native feature detection if available.
|
|
9
|
+
if ( window.navigator.pdfViewerEnabled ) {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
|
|
8
13
|
// Most mobile devices include "Mobi" in their UA.
|
|
9
14
|
if ( window.navigator.userAgent.indexOf( 'Mobi' ) > -1 ) {
|
|
10
15
|
return false;
|
package/src/form-input/index.php
CHANGED
|
@@ -19,10 +19,12 @@ function render_block_core_form_input( $attributes, $content ) {
|
|
|
19
19
|
$visibility_permissions = $attributes['visibilityPermissions'];
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
$user_logged_in = is_user_logged_in();
|
|
23
|
+
|
|
24
|
+
if ( 'logged-in' === $visibility_permissions && ! $user_logged_in ) {
|
|
23
25
|
return '';
|
|
24
26
|
}
|
|
25
|
-
if ( 'logged-out' === $visibility_permissions &&
|
|
27
|
+
if ( 'logged-out' === $visibility_permissions && $user_logged_in ) {
|
|
26
28
|
return '';
|
|
27
29
|
}
|
|
28
30
|
return $content;
|
|
@@ -26,11 +26,15 @@ export default function useGetMedia( innerBlockImages ) {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
return (
|
|
29
|
-
select( coreStore ).
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
select( coreStore ).getEntityRecords(
|
|
30
|
+
'postType',
|
|
31
|
+
'attachment',
|
|
32
|
+
{
|
|
33
|
+
include: imageIds.join( ',' ),
|
|
34
|
+
per_page: -1,
|
|
35
|
+
orderby: 'include',
|
|
36
|
+
}
|
|
37
|
+
) ?? EMPTY_IMAGE_MEDIA
|
|
34
38
|
);
|
|
35
39
|
},
|
|
36
40
|
[ innerBlockImages ]
|
|
@@ -32,12 +32,16 @@ export default function useGetMedia( innerBlockImages = [] ) {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
return (
|
|
35
|
-
select( coreStore ).
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
select( coreStore ).getEntityRecords(
|
|
36
|
+
'postType',
|
|
37
|
+
'attachment',
|
|
38
|
+
{
|
|
39
|
+
include: imageIds.join( ',' ),
|
|
40
|
+
per_page:
|
|
41
|
+
imageIds.length /* 'hard' limit necessary as unbounded queries aren't supported on native */,
|
|
42
|
+
orderby: 'include',
|
|
43
|
+
}
|
|
44
|
+
) ?? EMPTY_IMAGE_MEDIA
|
|
41
45
|
);
|
|
42
46
|
},
|
|
43
47
|
[ innerBlockImages ]
|
package/src/image/edit.native.js
CHANGED
|
@@ -905,7 +905,7 @@ export class ImageEdit extends Component {
|
|
|
905
905
|
|
|
906
906
|
export default compose( [
|
|
907
907
|
withSelect( ( select, props ) => {
|
|
908
|
-
const {
|
|
908
|
+
const { getEntityRecord } = select( coreStore );
|
|
909
909
|
const { getSettings, wasBlockJustInserted } =
|
|
910
910
|
select( blockEditorStore );
|
|
911
911
|
const { getEditedPostAttribute } = select( 'core/editor' );
|
|
@@ -926,7 +926,9 @@ export default compose( [
|
|
|
926
926
|
isNotFileUrl &&
|
|
927
927
|
url &&
|
|
928
928
|
! hasQueryArg( url, 'w' ) );
|
|
929
|
-
const image = shouldGetMedia
|
|
929
|
+
const image = shouldGetMedia
|
|
930
|
+
? getEntityRecord( 'postType', 'attachment', id )
|
|
931
|
+
: null;
|
|
930
932
|
|
|
931
933
|
return {
|
|
932
934
|
image,
|
package/src/image/image.js
CHANGED
|
@@ -306,7 +306,12 @@ export default function Image( {
|
|
|
306
306
|
const image = useSelect(
|
|
307
307
|
( select ) =>
|
|
308
308
|
id && isSingleSelected
|
|
309
|
-
? select( coreStore ).
|
|
309
|
+
? select( coreStore ).getEntityRecord(
|
|
310
|
+
'postType',
|
|
311
|
+
'attachment',
|
|
312
|
+
id,
|
|
313
|
+
{ context: 'view' }
|
|
314
|
+
)
|
|
310
315
|
: null,
|
|
311
316
|
[ id, isSingleSelected ]
|
|
312
317
|
);
|
package/src/image/index.php
CHANGED
|
@@ -100,7 +100,7 @@ function render_block_core_image( $attributes, $content, $block ) {
|
|
|
100
100
|
*
|
|
101
101
|
* @param array $block Block data.
|
|
102
102
|
*
|
|
103
|
-
* @return array Filtered block data.
|
|
103
|
+
* @return array|null Filtered block data.
|
|
104
104
|
*/
|
|
105
105
|
function block_core_image_get_lightbox_settings( $block ) {
|
|
106
106
|
// Gets the lightbox setting from the block attributes.
|
|
@@ -42,7 +42,9 @@ sendMediaUpload.mockImplementation( ( payload ) => {
|
|
|
42
42
|
} );
|
|
43
43
|
|
|
44
44
|
function mockGetMedia( media ) {
|
|
45
|
-
jest.spyOn( select( coreStore ), '
|
|
45
|
+
jest.spyOn( select( coreStore ), 'getEntityRecord' ).mockReturnValue(
|
|
46
|
+
media
|
|
47
|
+
);
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
const FETCH_MEDIA = {
|
|
@@ -71,8 +73,12 @@ beforeEach( () => {
|
|
|
71
73
|
// Mock media fetch requests
|
|
72
74
|
setupApiFetch( [ FETCH_MEDIA ] );
|
|
73
75
|
|
|
74
|
-
// Invalidate `
|
|
75
|
-
dispatch( coreStore ).
|
|
76
|
+
// Invalidate `getEntityRecord` resolutions to allow requesting to the API the same media id
|
|
77
|
+
dispatch( coreStore ).invalidateResolution( 'getEntityRecord', [
|
|
78
|
+
'postType',
|
|
79
|
+
'attachment',
|
|
80
|
+
1,
|
|
81
|
+
] );
|
|
76
82
|
} );
|
|
77
83
|
|
|
78
84
|
afterEach( () => {
|
|
@@ -99,7 +105,7 @@ describe( 'Image Block', () => {
|
|
|
99
105
|
<figcaption class="wp-element-caption">Mountain</figcaption></figure>
|
|
100
106
|
<!-- /wp:image -->`;
|
|
101
107
|
const screen = await initializeEditor( { initialHtml } );
|
|
102
|
-
// Check that image is fetched via `
|
|
108
|
+
// Check that image is fetched via `getEntityRecord`
|
|
103
109
|
expect( apiFetch ).toHaveBeenCalledWith( FETCH_MEDIA.request );
|
|
104
110
|
|
|
105
111
|
const [ imageBlock ] = screen.getAllByLabelText( /Image Block/ );
|
|
@@ -126,7 +132,7 @@ describe( 'Image Block', () => {
|
|
|
126
132
|
<figcaption class="wp-element-caption">Mountain</figcaption></figure>
|
|
127
133
|
<!-- /wp:image -->`;
|
|
128
134
|
const screen = await initializeEditor( { initialHtml } );
|
|
129
|
-
// Check that image is fetched via `
|
|
135
|
+
// Check that image is fetched via `getEntityRecord`
|
|
130
136
|
expect( apiFetch ).toHaveBeenCalledWith( FETCH_MEDIA.request );
|
|
131
137
|
|
|
132
138
|
const [ imageBlock ] = screen.getAllByLabelText( /Image Block/ );
|
|
@@ -153,7 +159,7 @@ describe( 'Image Block', () => {
|
|
|
153
159
|
<figcaption class="wp-element-caption">Mountain</figcaption></figure>
|
|
154
160
|
<!-- /wp:image -->`;
|
|
155
161
|
const screen = await initializeEditor( { initialHtml } );
|
|
156
|
-
// Check that image is fetched via `
|
|
162
|
+
// Check that image is fetched via `getEntityRecord`
|
|
157
163
|
expect( apiFetch ).toHaveBeenCalledWith( FETCH_MEDIA.request );
|
|
158
164
|
|
|
159
165
|
const [ imageBlock ] = screen.getAllByLabelText( /Image Block/ );
|
|
@@ -190,7 +196,7 @@ describe( 'Image Block', () => {
|
|
|
190
196
|
<figcaption class="wp-element-caption">Mountain</figcaption></figure>
|
|
191
197
|
<!-- /wp:image -->`;
|
|
192
198
|
const screen = await initializeEditor( { initialHtml } );
|
|
193
|
-
// Check that image is fetched via `
|
|
199
|
+
// Check that image is fetched via `getEntityRecord`
|
|
194
200
|
expect( apiFetch ).toHaveBeenCalledWith( FETCH_MEDIA.request );
|
|
195
201
|
|
|
196
202
|
const [ imageBlock ] = screen.getAllByLabelText( /Image Block/ );
|
|
@@ -223,7 +229,7 @@ describe( 'Image Block', () => {
|
|
|
223
229
|
<figcaption class="wp-element-caption">Mountain</figcaption></figure>
|
|
224
230
|
<!-- /wp:image -->`;
|
|
225
231
|
const screen = await initializeEditor( { initialHtml } );
|
|
226
|
-
// Check that image is not fetched via `
|
|
232
|
+
// Check that image is not fetched via `getEntityRecord` due to the presence of query parameters in the URL.
|
|
227
233
|
expect( apiFetch ).not.toHaveBeenCalledWith( FETCH_MEDIA.request );
|
|
228
234
|
|
|
229
235
|
const [ imageBlock ] = screen.getAllByLabelText( /Image Block/ );
|
|
@@ -248,7 +254,7 @@ describe( 'Image Block', () => {
|
|
|
248
254
|
<figcaption class="wp-element-caption">Mountain</figcaption></figure>
|
|
249
255
|
<!-- /wp:image -->`;
|
|
250
256
|
const screen = await initializeEditor( { initialHtml } );
|
|
251
|
-
// Check that image is fetched via `
|
|
257
|
+
// Check that image is fetched via `getEntityRecord`
|
|
252
258
|
expect( apiFetch ).toHaveBeenCalledWith( FETCH_MEDIA.request );
|
|
253
259
|
|
|
254
260
|
const [ imageBlock ] = screen.getAllByLabelText( /Image Block/ );
|
|
@@ -279,7 +285,7 @@ describe( 'Image Block', () => {
|
|
|
279
285
|
</figure>
|
|
280
286
|
<!-- /wp:image -->`;
|
|
281
287
|
const screen = await initializeEditor( { initialHtml } );
|
|
282
|
-
// Check that image is fetched via `
|
|
288
|
+
// Check that image is fetched via `getEntityRecord`
|
|
283
289
|
expect( apiFetch ).toHaveBeenCalledWith( FETCH_MEDIA.request );
|
|
284
290
|
|
|
285
291
|
const [ imageBlock ] = screen.getAllByLabelText( /Image Block/ );
|
package/src/latest-posts/edit.js
CHANGED
|
@@ -774,7 +774,6 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
|
|
|
774
774
|
{ addLinkToFeaturedImage ? (
|
|
775
775
|
<a
|
|
776
776
|
href={ post.link }
|
|
777
|
-
rel="noreferrer noopener"
|
|
778
777
|
onClick={
|
|
779
778
|
showRedirectionPreventedNotice
|
|
780
779
|
}
|
|
@@ -789,7 +788,6 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
|
|
|
789
788
|
<a
|
|
790
789
|
className="wp-block-latest-posts__post-title"
|
|
791
790
|
href={ post.link }
|
|
792
|
-
rel="noreferrer noopener"
|
|
793
791
|
dangerouslySetInnerHTML={
|
|
794
792
|
!! titleTrimmed
|
|
795
793
|
? {
|