@wordpress/block-library 7.14.2 → 7.14.4
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/comments-pagination-next/index.js +1 -1
- package/build/comments-pagination-numbers/index.js +1 -1
- package/build/comments-pagination-previous/index.js +1 -1
- package/build/gallery/deprecated.js +4 -4
- package/build/gallery/deprecated.js.map +1 -1
- package/build/navigation/edit/index.js +12 -12
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/menu-items-to-blocks.js +16 -6
- package/build/navigation/menu-items-to-blocks.js.map +1 -1
- package/build/post-content/edit.js +6 -1
- package/build/post-content/edit.js.map +1 -1
- package/build/post-featured-image/index.js +1 -1
- package/build/post-featured-image/overlay.js +2 -2
- package/build/post-featured-image/overlay.js.map +1 -1
- package/build/post-template/edit.js +13 -28
- package/build/post-template/edit.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +1 -1
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/utils.js +1 -1
- package/build/query/utils.js.map +1 -1
- package/build/quote/index.js +0 -1
- package/build/quote/index.js.map +1 -1
- package/build/quote/transforms.js +2 -2
- package/build/quote/transforms.js.map +1 -1
- package/build/template-part/edit/index.js +2 -2
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/index.js +2 -2
- package/build/template-part/index.js.map +1 -1
- package/build-module/comments-pagination-next/index.js +1 -1
- package/build-module/comments-pagination-numbers/index.js +1 -1
- package/build-module/comments-pagination-previous/index.js +1 -1
- package/build-module/gallery/deprecated.js +4 -4
- package/build-module/gallery/deprecated.js.map +1 -1
- package/build-module/navigation/edit/index.js +12 -12
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/menu-items-to-blocks.js +16 -6
- package/build-module/navigation/menu-items-to-blocks.js.map +1 -1
- package/build-module/post-content/edit.js +6 -1
- package/build-module/post-content/edit.js.map +1 -1
- package/build-module/post-featured-image/index.js +1 -1
- package/build-module/post-featured-image/overlay.js +2 -2
- package/build-module/post-featured-image/overlay.js.map +1 -1
- package/build-module/post-template/edit.js +14 -29
- package/build-module/post-template/edit.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +1 -1
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/utils.js +1 -1
- package/build-module/query/utils.js.map +1 -1
- package/build-module/quote/index.js +0 -1
- package/build-module/quote/index.js.map +1 -1
- package/build-module/quote/transforms.js +2 -2
- package/build-module/quote/transforms.js.map +1 -1
- package/build-module/template-part/edit/index.js +3 -3
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/index.js +2 -2
- package/build-module/template-part/index.js.map +1 -1
- package/build-style/classic-rtl.css +85 -0
- package/build-style/classic.css +85 -0
- package/build-style/code/style-rtl.css +3 -0
- package/build-style/code/style.css +3 -0
- package/build-style/editor-rtl.css +39 -29
- package/build-style/editor.css +39 -29
- package/build-style/post-featured-image/editor-rtl.css +39 -29
- package/build-style/post-featured-image/editor.css +39 -29
- package/build-style/style-rtl.css +3 -0
- package/build-style/style.css +3 -0
- package/package.json +12 -12
- package/src/classic.scss +15 -0
- package/src/code/style.scss +12 -7
- package/src/comment-template/index.php +18 -8
- package/src/comments-pagination-next/block.json +1 -1
- package/src/comments-pagination-numbers/block.json +1 -1
- package/src/comments-pagination-previous/block.json +1 -1
- package/src/gallery/deprecated.js +4 -4
- package/src/navigation/edit/index.js +12 -10
- package/src/navigation/menu-items-to-blocks.js +39 -22
- package/src/navigation/test/menu-items-to-blocks.js +6 -0
- package/src/navigation-submenu/index.php +10 -1
- package/src/post-content/edit.js +3 -1
- package/src/post-featured-image/block.json +1 -1
- package/src/post-featured-image/editor.scss +79 -72
- package/src/post-featured-image/index.php +18 -24
- package/src/post-featured-image/overlay.js +17 -14
- package/src/post-template/edit.js +14 -23
- package/src/query/edit/inspector-controls/index.js +1 -4
- package/src/query/utils.js +1 -1
- package/src/quote/block.json +0 -1
- package/src/quote/transforms.js +1 -1
- package/src/template-part/edit/index.js +60 -58
- package/src/template-part/index.js +2 -2
package/build-style/style.css
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-library",
|
|
3
|
-
"version": "7.14.
|
|
3
|
+
"version": "7.14.4",
|
|
4
4
|
"description": "Block library for the WordPress editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"@wordpress/api-fetch": "^6.14.1",
|
|
36
36
|
"@wordpress/autop": "^3.17.1",
|
|
37
37
|
"@wordpress/blob": "^3.17.1",
|
|
38
|
-
"@wordpress/block-editor": "^10.0.
|
|
39
|
-
"@wordpress/blocks": "^11.16.
|
|
40
|
-
"@wordpress/components": "^21.0.
|
|
38
|
+
"@wordpress/block-editor": "^10.0.4",
|
|
39
|
+
"@wordpress/blocks": "^11.16.4",
|
|
40
|
+
"@wordpress/components": "^21.0.4",
|
|
41
41
|
"@wordpress/compose": "^5.15.2",
|
|
42
|
-
"@wordpress/core-data": "^5.0.
|
|
43
|
-
"@wordpress/data": "^7.1.
|
|
42
|
+
"@wordpress/core-data": "^5.0.4",
|
|
43
|
+
"@wordpress/data": "^7.1.3",
|
|
44
44
|
"@wordpress/date": "^4.17.1",
|
|
45
45
|
"@wordpress/deprecated": "^3.17.1",
|
|
46
46
|
"@wordpress/dom": "^3.17.2",
|
|
@@ -50,13 +50,13 @@
|
|
|
50
50
|
"@wordpress/i18n": "^4.17.1",
|
|
51
51
|
"@wordpress/icons": "^9.8.1",
|
|
52
52
|
"@wordpress/keycodes": "^3.17.1",
|
|
53
|
-
"@wordpress/notices": "^3.17.
|
|
53
|
+
"@wordpress/notices": "^3.17.3",
|
|
54
54
|
"@wordpress/primitives": "^3.15.1",
|
|
55
|
-
"@wordpress/reusable-blocks": "^3.15.
|
|
56
|
-
"@wordpress/rich-text": "^5.15.
|
|
57
|
-
"@wordpress/server-side-render": "^3.15.
|
|
55
|
+
"@wordpress/reusable-blocks": "^3.15.4",
|
|
56
|
+
"@wordpress/rich-text": "^5.15.3",
|
|
57
|
+
"@wordpress/server-side-render": "^3.15.4",
|
|
58
58
|
"@wordpress/url": "^3.18.1",
|
|
59
|
-
"@wordpress/viewport": "^4.15.
|
|
59
|
+
"@wordpress/viewport": "^4.15.3",
|
|
60
60
|
"change-case": "^4.1.2",
|
|
61
61
|
"classnames": "^2.3.1",
|
|
62
62
|
"colord": "^2.7.0",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"publishConfig": {
|
|
74
74
|
"access": "public"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "491b4b522dffb4d25aca066ec55500f456ac4aa3"
|
|
77
77
|
}
|
package/src/classic.scss
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// These rules are needed for backwards compatibility.
|
|
2
|
+
.wp-block-button__link {
|
|
3
|
+
color: $white;
|
|
4
|
+
background-color: #32373c;
|
|
5
|
+
border-radius: 9999px; // 100% causes an oval, but any explicit but really high value retains the pill shape.
|
|
6
|
+
|
|
7
|
+
// This needs a low specificity so it won't override the rules from the button element if defined in theme.json.
|
|
8
|
+
box-shadow: none;
|
|
9
|
+
text-decoration: none;
|
|
10
|
+
|
|
11
|
+
// The extra 2px are added to size solids the same as the outline versions.
|
|
12
|
+
padding: calc(0.667em + 2px) calc(1.333em + 2px);
|
|
13
|
+
|
|
14
|
+
font-size: 1.125em;
|
|
15
|
+
}
|
package/src/code/style.scss
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
//
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
.wp-block-code {
|
|
2
|
+
// This block has customizable padding, border-box makes that more predictable.
|
|
3
|
+
box-sizing: border-box;
|
|
4
|
+
|
|
5
|
+
// Provide a minimum of overflow handling and ensure the code markup inherits
|
|
6
|
+
// the font-family set on pre.
|
|
7
|
+
code {
|
|
8
|
+
display: block;
|
|
9
|
+
font-family: inherit;
|
|
10
|
+
overflow-wrap: break-word;
|
|
11
|
+
white-space: pre-wrap;
|
|
12
|
+
}
|
|
8
13
|
}
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
*/
|
|
17
17
|
function block_core_comment_template_render_comments( $comments, $block ) {
|
|
18
18
|
global $comment_depth;
|
|
19
|
+
$thread_comments = get_option( 'thread_comments' );
|
|
20
|
+
$thread_comments_depth = get_option( 'thread_comments_depth' );
|
|
19
21
|
|
|
20
22
|
if ( empty( $comment_depth ) ) {
|
|
21
23
|
$comment_depth = 1;
|
|
@@ -46,14 +48,22 @@ function block_core_comment_template_render_comments( $comments, $block ) {
|
|
|
46
48
|
|
|
47
49
|
// If the comment has children, recurse to create the HTML for the nested
|
|
48
50
|
// comments.
|
|
49
|
-
if ( ! empty( $children ) ) {
|
|
50
|
-
$comment_depth
|
|
51
|
-
|
|
52
|
-
$
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
if ( ! empty( $children ) && ! empty( $thread_comments ) ) {
|
|
52
|
+
if ( $comment_depth < $thread_comments_depth ) {
|
|
53
|
+
$comment_depth += 1;
|
|
54
|
+
$inner_content = block_core_comment_template_render_comments(
|
|
55
|
+
$children,
|
|
56
|
+
$block
|
|
57
|
+
);
|
|
58
|
+
$block_content .= sprintf( '<ol>%1$s</ol>', $inner_content );
|
|
59
|
+
$comment_depth -= 1;
|
|
60
|
+
} else {
|
|
61
|
+
$inner_content = block_core_comment_template_render_comments(
|
|
62
|
+
$children,
|
|
63
|
+
$block
|
|
64
|
+
);
|
|
65
|
+
$block_content .= sprintf( $inner_content );
|
|
66
|
+
}
|
|
57
67
|
}
|
|
58
68
|
|
|
59
69
|
$content .= sprintf( '<li id="comment-%1$s" %2$s>%3$s</li>', $comment->comment_ID, $comment_classes, $block_content );
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
|
3
3
|
"apiVersion": 2,
|
|
4
4
|
"name": "core/comments-pagination-next",
|
|
5
|
-
"title": "Next Page",
|
|
5
|
+
"title": "Comments Next Page",
|
|
6
6
|
"category": "theme",
|
|
7
7
|
"parent": [ "core/comments-pagination" ],
|
|
8
8
|
"description": "Displays the next comment's page link.",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
|
3
3
|
"apiVersion": 2,
|
|
4
4
|
"name": "core/comments-pagination-numbers",
|
|
5
|
-
"title": "Page Numbers",
|
|
5
|
+
"title": "Comments Page Numbers",
|
|
6
6
|
"category": "theme",
|
|
7
7
|
"parent": [ "core/comments-pagination" ],
|
|
8
8
|
"description": "Displays a list of page numbers for comments pagination.",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
|
3
3
|
"apiVersion": 2,
|
|
4
4
|
"name": "core/comments-pagination-previous",
|
|
5
|
-
"title": "Previous Page",
|
|
5
|
+
"title": "Comments Previous Page",
|
|
6
6
|
"category": "theme",
|
|
7
7
|
"parent": [ "core/comments-pagination" ],
|
|
8
8
|
"description": "Displays the previous comment's page link.",
|
|
@@ -659,8 +659,8 @@ const v3 = {
|
|
|
659
659
|
attribute: 'data-link',
|
|
660
660
|
},
|
|
661
661
|
caption: {
|
|
662
|
-
type: '
|
|
663
|
-
source: '
|
|
662
|
+
type: 'string',
|
|
663
|
+
source: 'html',
|
|
664
664
|
selector: 'figcaption',
|
|
665
665
|
},
|
|
666
666
|
},
|
|
@@ -779,8 +779,8 @@ const v2 = {
|
|
|
779
779
|
attribute: 'data-link',
|
|
780
780
|
},
|
|
781
781
|
caption: {
|
|
782
|
-
type: '
|
|
783
|
-
source: '
|
|
782
|
+
type: 'string',
|
|
783
|
+
source: 'html',
|
|
784
784
|
selector: 'figcaption',
|
|
785
785
|
},
|
|
786
786
|
},
|
|
@@ -282,16 +282,18 @@ function Navigation( {
|
|
|
282
282
|
hasResolvedNavigationMenus &&
|
|
283
283
|
! hasUncontrolledInnerBlocks;
|
|
284
284
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
285
|
+
useEffect( () => {
|
|
286
|
+
if ( isPlaceholder && ! ref ) {
|
|
287
|
+
/**
|
|
288
|
+
* this fallback only displays (both in editor and on front)
|
|
289
|
+
* the list of pages block if no menu is available as a fallback.
|
|
290
|
+
* We don't want the fallback to request a save,
|
|
291
|
+
* nor to be undoable, hence we mark it non persistent.
|
|
292
|
+
*/
|
|
293
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
294
|
+
replaceInnerBlocks( clientId, [ createBlock( 'core/page-list' ) ] );
|
|
295
|
+
}
|
|
296
|
+
}, [ clientId, isPlaceholder, ref ] );
|
|
295
297
|
|
|
296
298
|
const isEntityAvailable =
|
|
297
299
|
! isNavigationMenuMissing && isNavigationMenuResolved;
|
|
@@ -29,9 +29,10 @@ export default function menuItemsToBlocks( menuItems ) {
|
|
|
29
29
|
* A recursive function that maps menu item nodes to blocks.
|
|
30
30
|
*
|
|
31
31
|
* @param {WPNavMenuItem[]} menuItems An array of WPNavMenuItem items.
|
|
32
|
+
* @param {number} level An integer representing the nesting level.
|
|
32
33
|
* @return {Object} Object containing innerBlocks and mapping.
|
|
33
34
|
*/
|
|
34
|
-
function mapMenuItemsToBlocks( menuItems ) {
|
|
35
|
+
function mapMenuItemsToBlocks( menuItems, level = 0 ) {
|
|
35
36
|
let mapping = {};
|
|
36
37
|
|
|
37
38
|
// The menuItem should be in menu_order sort order.
|
|
@@ -52,14 +53,22 @@ function mapMenuItemsToBlocks( menuItems ) {
|
|
|
52
53
|
return block;
|
|
53
54
|
}
|
|
54
55
|
|
|
55
|
-
const
|
|
56
|
+
const blockType = menuItem.children?.length
|
|
57
|
+
? 'core/navigation-submenu'
|
|
58
|
+
: 'core/navigation-link';
|
|
59
|
+
|
|
60
|
+
const attributes = menuItemToBlockAttributes(
|
|
61
|
+
menuItem,
|
|
62
|
+
blockType,
|
|
63
|
+
level
|
|
64
|
+
);
|
|
56
65
|
|
|
57
66
|
// If there are children recurse to build those nested blocks.
|
|
58
67
|
const {
|
|
59
68
|
innerBlocks: nestedBlocks = [], // alias to avoid shadowing
|
|
60
69
|
mapping: nestedMapping = {}, // alias to avoid shadowing
|
|
61
70
|
} = menuItem.children?.length
|
|
62
|
-
? mapMenuItemsToBlocks( menuItem.children )
|
|
71
|
+
? mapMenuItemsToBlocks( menuItem.children, level + 1 )
|
|
63
72
|
: {};
|
|
64
73
|
|
|
65
74
|
// Update parent mapping with nested mapping.
|
|
@@ -68,10 +77,6 @@ function mapMenuItemsToBlocks( menuItems ) {
|
|
|
68
77
|
...nestedMapping,
|
|
69
78
|
};
|
|
70
79
|
|
|
71
|
-
const blockType = menuItem.children?.length
|
|
72
|
-
? 'core/navigation-submenu'
|
|
73
|
-
: 'core/navigation-link';
|
|
74
|
-
|
|
75
80
|
// Create block with nested "innerBlocks".
|
|
76
81
|
const block = createBlock( blockType, attributes, nestedBlocks );
|
|
77
82
|
|
|
@@ -111,23 +116,29 @@ function mapMenuItemsToBlocks( menuItems ) {
|
|
|
111
116
|
/**
|
|
112
117
|
* Convert block attributes to menu item.
|
|
113
118
|
*
|
|
114
|
-
* @param {WPNavMenuItem} menuItem
|
|
119
|
+
* @param {WPNavMenuItem} menuItem the menu item to be converted to block attributes.
|
|
120
|
+
* @param {string} blockType The block type.
|
|
121
|
+
* @param {number} level An integer representing the nesting level.
|
|
115
122
|
* @return {Object} the block attributes converted from the WPNavMenuItem item.
|
|
116
123
|
*/
|
|
117
|
-
function menuItemToBlockAttributes(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
124
|
+
function menuItemToBlockAttributes(
|
|
125
|
+
{
|
|
126
|
+
title: menuItemTitleField,
|
|
127
|
+
xfn,
|
|
128
|
+
classes,
|
|
129
|
+
// eslint-disable-next-line camelcase
|
|
130
|
+
attr_title,
|
|
131
|
+
object,
|
|
132
|
+
// eslint-disable-next-line camelcase
|
|
133
|
+
object_id,
|
|
134
|
+
description,
|
|
135
|
+
url,
|
|
136
|
+
type: menuItemTypeField,
|
|
137
|
+
target,
|
|
138
|
+
},
|
|
139
|
+
blockType,
|
|
140
|
+
level
|
|
141
|
+
) {
|
|
131
142
|
// For historical reasons, the `core/navigation-link` variation type is `tag`
|
|
132
143
|
// whereas WP Core expects `post_tag` as the `object` type.
|
|
133
144
|
// To avoid writing a block migration we perform a conversion here.
|
|
@@ -166,6 +177,12 @@ function menuItemToBlockAttributes( {
|
|
|
166
177
|
...( target === '_blank' && {
|
|
167
178
|
opensInNewTab: true,
|
|
168
179
|
} ),
|
|
180
|
+
...( blockType === 'core/navigation-submenu' && {
|
|
181
|
+
isTopLevelItem: level === 0,
|
|
182
|
+
} ),
|
|
183
|
+
...( blockType === 'core/navigation-link' && {
|
|
184
|
+
isTopLevelLink: level === 0,
|
|
185
|
+
} ),
|
|
169
186
|
};
|
|
170
187
|
}
|
|
171
188
|
|
|
@@ -189,12 +189,14 @@ describe( 'converting menu items to blocks', () => {
|
|
|
189
189
|
name: 'core/navigation-submenu',
|
|
190
190
|
attributes: expect.objectContaining( {
|
|
191
191
|
label: 'Top Level',
|
|
192
|
+
isTopLevelItem: true,
|
|
192
193
|
} ),
|
|
193
194
|
innerBlocks: [
|
|
194
195
|
expect.objectContaining( {
|
|
195
196
|
name: 'core/navigation-link',
|
|
196
197
|
attributes: expect.objectContaining( {
|
|
197
198
|
label: 'Child 1',
|
|
199
|
+
isTopLevelLink: false,
|
|
198
200
|
} ),
|
|
199
201
|
innerBlocks: [],
|
|
200
202
|
} ),
|
|
@@ -202,18 +204,21 @@ describe( 'converting menu items to blocks', () => {
|
|
|
202
204
|
name: 'core/navigation-submenu',
|
|
203
205
|
attributes: expect.objectContaining( {
|
|
204
206
|
label: 'Child 2',
|
|
207
|
+
isTopLevelItem: false,
|
|
205
208
|
} ),
|
|
206
209
|
innerBlocks: [
|
|
207
210
|
expect.objectContaining( {
|
|
208
211
|
name: 'core/navigation-submenu',
|
|
209
212
|
attributes: expect.objectContaining( {
|
|
210
213
|
label: 'Sub Child',
|
|
214
|
+
isTopLevelItem: false,
|
|
211
215
|
} ),
|
|
212
216
|
innerBlocks: [
|
|
213
217
|
expect.objectContaining( {
|
|
214
218
|
name: 'core/navigation-link',
|
|
215
219
|
attributes: expect.objectContaining( {
|
|
216
220
|
label: 'Sub Sub Child',
|
|
221
|
+
isTopLevelLink: false,
|
|
217
222
|
} ),
|
|
218
223
|
innerBlocks: [],
|
|
219
224
|
} ),
|
|
@@ -227,6 +232,7 @@ describe( 'converting menu items to blocks', () => {
|
|
|
227
232
|
name: 'core/navigation-link',
|
|
228
233
|
attributes: expect.objectContaining( {
|
|
229
234
|
label: 'Top Level 2',
|
|
235
|
+
isTopLevelLink: true,
|
|
230
236
|
} ),
|
|
231
237
|
innerBlocks: [],
|
|
232
238
|
} ),
|
|
@@ -183,7 +183,16 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) {
|
|
|
183
183
|
if ( ! $open_on_click ) {
|
|
184
184
|
$item_url = isset( $attributes['url'] ) ? $attributes['url'] : '';
|
|
185
185
|
// Start appending HTML attributes to anchor tag.
|
|
186
|
-
$html .= '<a class="wp-block-navigation-item__content"
|
|
186
|
+
$html .= '<a class="wp-block-navigation-item__content"';
|
|
187
|
+
|
|
188
|
+
// The href attribute on a and area elements is not required;
|
|
189
|
+
// when those elements do not have href attributes they do not create hyperlinks.
|
|
190
|
+
// But also The href attribute must have a value that is a valid URL potentially
|
|
191
|
+
// surrounded by spaces.
|
|
192
|
+
// see: https://html.spec.whatwg.org/multipage/links.html#links-created-by-a-and-area-elements.
|
|
193
|
+
if ( ! empty( $item_url ) ) {
|
|
194
|
+
$html .= ' href="' . esc_url( $item_url ) . '"';
|
|
195
|
+
}
|
|
187
196
|
|
|
188
197
|
if ( $is_active ) {
|
|
189
198
|
$html .= ' aria-current="page"';
|
package/src/post-content/edit.js
CHANGED
|
@@ -46,7 +46,9 @@ function EditableContent( { layout, context = {} } ) {
|
|
|
46
46
|
return getSettings()?.supportsLayout;
|
|
47
47
|
}, [] );
|
|
48
48
|
const defaultLayout = useSetting( 'layout' ) || {};
|
|
49
|
-
const usedLayout =
|
|
49
|
+
const usedLayout = ! layout?.type
|
|
50
|
+
? { ...defaultLayout, ...layout, type: 'default' }
|
|
51
|
+
: { ...defaultLayout, ...layout };
|
|
50
52
|
const [ blocks, onInput, onChange ] = useEntityBlockEditor(
|
|
51
53
|
'postType',
|
|
52
54
|
postType,
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"color": true,
|
|
63
63
|
"radius": true,
|
|
64
64
|
"width": true,
|
|
65
|
-
"__experimentalSelector": "img, .block-editor-media-placeholder",
|
|
65
|
+
"__experimentalSelector": "img, .block-editor-media-placeholder, .wp-block-post-featured-image__overlay",
|
|
66
66
|
"__experimentalSkipSerialization": true,
|
|
67
67
|
"__experimentalDefaultControls": {
|
|
68
68
|
"color": true,
|
|
@@ -6,87 +6,94 @@
|
|
|
6
6
|
backdrop-filter: none; // Removes background blur so the overlay's actual color is visible.
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
padding: 0;
|
|
9
|
+
// Style the placeholder.
|
|
10
|
+
.wp-block-post-featured-image__placeholder,
|
|
11
|
+
.components-placeholder {
|
|
12
|
+
justify-content: center;
|
|
13
|
+
align-items: center;
|
|
14
|
+
padding: 0;
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
// Hide the upload button, as it's also available in the media library.
|
|
17
|
+
.components-form-file-upload {
|
|
18
|
+
display: none;
|
|
19
|
+
}
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
21
|
+
// Style the upload button.
|
|
22
|
+
.components-button {
|
|
23
|
+
padding: 0;
|
|
24
|
+
display: flex;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
align-items: center;
|
|
27
|
+
width: $grid-unit-60;
|
|
28
|
+
height: $grid-unit-60;
|
|
29
|
+
border-radius: 50%;
|
|
30
|
+
position: relative;
|
|
31
|
+
background: var(--wp-admin-theme-color);
|
|
32
|
+
border-color: var(--wp-admin-theme-color);
|
|
33
|
+
border-style: solid;
|
|
34
|
+
color: $white;
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
36
|
+
> svg {
|
|
37
|
+
color: inherit;
|
|
40
38
|
}
|
|
39
|
+
}
|
|
41
40
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
// The following override the default placeholder styles that remove
|
|
46
|
-
// its border so that a user selection for border color or width displays
|
|
47
|
-
// a visual border.
|
|
48
|
-
&:where(.has-border-color) {
|
|
49
|
-
border-style: solid;
|
|
50
|
-
}
|
|
51
|
-
&:where([style*="border-top-color"]) {
|
|
52
|
-
border-top-style: solid;
|
|
53
|
-
}
|
|
54
|
-
&:where([style*="border-right-color"]) {
|
|
55
|
-
border-right-style: solid;
|
|
56
|
-
}
|
|
57
|
-
&:where([style*="border-bottom-color"]) {
|
|
58
|
-
border-bottom-style: solid;
|
|
59
|
-
}
|
|
60
|
-
&:where([style*="border-left-color"]) {
|
|
61
|
-
border-left-style: solid;
|
|
62
|
-
}
|
|
41
|
+
// Show default placeholder height when not resized.
|
|
42
|
+
min-height: 200px;
|
|
43
|
+
}
|
|
63
44
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
45
|
+
// The following override the default placeholder styles that remove
|
|
46
|
+
// its border so that a user selection for border color or width displays
|
|
47
|
+
// a visual border. They also override the `img { border: none; }` applied
|
|
48
|
+
// by core.
|
|
49
|
+
.wp-block-post-featured-image__placeholder,
|
|
50
|
+
.components-placeholder,
|
|
51
|
+
img {
|
|
52
|
+
// The following is required to overcome WP Core applying styles that clear
|
|
53
|
+
// img borders with a higher specificity than those added by the border
|
|
54
|
+
// block support to provide a default border-style of solid when a border
|
|
55
|
+
// color or width has been set.
|
|
56
|
+
&:where(.has-border-color) {
|
|
57
|
+
border-style: solid;
|
|
58
|
+
}
|
|
59
|
+
&:where([style*="border-top-color"]) {
|
|
60
|
+
border-top-style: solid;
|
|
61
|
+
}
|
|
62
|
+
&:where([style*="border-right-color"]) {
|
|
63
|
+
border-right-style: solid;
|
|
64
|
+
}
|
|
65
|
+
&:where([style*="border-bottom-color"]) {
|
|
66
|
+
border-bottom-style: solid;
|
|
67
|
+
}
|
|
68
|
+
&:where([style*="border-left-color"]) {
|
|
69
|
+
border-left-style: solid;
|
|
79
70
|
}
|
|
80
71
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
72
|
+
&:where([style*="border-width"]) {
|
|
73
|
+
border-style: solid;
|
|
74
|
+
}
|
|
75
|
+
&:where([style*="border-top-width"]) {
|
|
76
|
+
border-top-style: solid;
|
|
77
|
+
}
|
|
78
|
+
&:where([style*="border-right-width"]) {
|
|
79
|
+
border-right-style: solid;
|
|
89
80
|
}
|
|
81
|
+
&:where([style*="border-bottom-width"]) {
|
|
82
|
+
border-bottom-style: solid;
|
|
83
|
+
}
|
|
84
|
+
&:where([style*="border-left-width"]) {
|
|
85
|
+
border-left-style: solid;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Provide a minimum size for the placeholder when resized.
|
|
90
|
+
// Note, this should be as small as we can afford it, and exists only
|
|
91
|
+
// to ensure there's room for the upload button.
|
|
92
|
+
&[style*="height"] .components-placeholder {
|
|
93
|
+
min-height: $grid-unit-60;
|
|
94
|
+
min-width: $grid-unit-60;
|
|
95
|
+
height: 100%;
|
|
96
|
+
width: 100%;
|
|
90
97
|
}
|
|
91
98
|
}
|
|
92
99
|
|