@wordpress/block-library 8.28.1 → 8.28.3
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/button/edit.js +2 -4
- package/build/button/edit.js.map +1 -1
- package/build/button/index.js +0 -1
- package/build/button/index.js.map +1 -1
- package/build/heading/index.js +0 -1
- package/build/heading/index.js.map +1 -1
- package/build/image/edit.js +2 -4
- package/build/image/edit.js.map +1 -1
- package/build/image/image.js +75 -6
- package/build/image/image.js.map +1 -1
- package/build/image/index.js +1 -1
- package/build/navigation/constants.js +1 -2
- package/build/navigation/constants.js.map +1 -1
- package/build/navigation/edit/index.js +0 -4
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/view.js +0 -23
- package/build/navigation/view.js.map +1 -1
- package/build/paragraph/index.js +1 -1
- package/build/paragraph/transforms.js +1 -1
- package/build-module/button/edit.js +2 -4
- package/build-module/button/edit.js.map +1 -1
- package/build-module/button/index.js +0 -1
- package/build-module/button/index.js.map +1 -1
- package/build-module/heading/index.js +0 -1
- package/build-module/heading/index.js.map +1 -1
- package/build-module/image/edit.js +2 -4
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/image.js +76 -7
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/index.js +1 -1
- package/build-module/navigation/constants.js +0 -1
- package/build-module/navigation/constants.js.map +1 -1
- package/build-module/navigation/edit/index.js +1 -5
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/view.js +0 -23
- package/build-module/navigation/view.js.map +1 -1
- package/build-module/paragraph/index.js +1 -1
- package/build-module/paragraph/transforms.js +1 -1
- package/build-style/editor-rtl.css +8 -2
- package/build-style/editor.css +8 -2
- package/build-style/image/editor-rtl.css +4 -0
- package/build-style/image/editor.css +4 -0
- package/build-style/navigation/editor-rtl.css +4 -2
- package/build-style/navigation/editor.css +4 -2
- package/build-style/navigation/style-rtl.css +18 -14
- package/build-style/navigation/style.css +18 -14
- package/build-style/style-rtl.css +18 -14
- package/build-style/style.css +18 -14
- package/package.json +34 -34
- package/src/button/block.json +0 -1
- package/src/button/edit.js +4 -4
- package/src/footnotes/index.php +24 -11
- package/src/heading/block.json +0 -1
- package/src/image/block.json +1 -6
- package/src/image/edit.js +4 -4
- package/src/image/editor.scss +5 -0
- package/src/image/image.js +127 -8
- package/src/navigation/constants.js +0 -2
- package/src/navigation/edit/index.js +1 -11
- package/src/navigation/editor.scss +1 -1
- package/src/navigation/index.php +95 -54
- package/src/navigation/style.scss +16 -18
- package/src/navigation/view.js +0 -26
- package/src/navigation-link/index.php +0 -1
- package/src/paragraph/block.json +1 -1
- package/src/search/index.php +1 -1
|
@@ -504,18 +504,20 @@ button.wp-block-navigation-item__content {
|
|
|
504
504
|
right: auto;
|
|
505
505
|
left: auto;
|
|
506
506
|
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
507
|
+
@media (min-width: 600px) {
|
|
508
|
+
.wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
|
|
509
|
+
display: block;
|
|
510
|
+
width: 100%;
|
|
511
|
+
position: relative;
|
|
512
|
+
z-index: auto;
|
|
513
|
+
background-color: inherit;
|
|
514
|
+
}
|
|
515
|
+
.wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) .wp-block-navigation__responsive-container-close {
|
|
516
|
+
display: none;
|
|
517
|
+
}
|
|
518
|
+
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container {
|
|
519
|
+
left: 0;
|
|
520
|
+
}
|
|
519
521
|
}
|
|
520
522
|
|
|
521
523
|
.wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open {
|
|
@@ -559,8 +561,10 @@ button.wp-block-navigation-item__content {
|
|
|
559
561
|
font-weight: inherit;
|
|
560
562
|
font-size: inherit;
|
|
561
563
|
}
|
|
562
|
-
|
|
563
|
-
|
|
564
|
+
@media (min-width: 600px) {
|
|
565
|
+
.wp-block-navigation__responsive-container-open:not(.always-shown) {
|
|
566
|
+
display: none;
|
|
567
|
+
}
|
|
564
568
|
}
|
|
565
569
|
|
|
566
570
|
.wp-block-navigation__responsive-container-close {
|
|
@@ -2568,18 +2568,20 @@ button.wp-block-navigation-item__content {
|
|
|
2568
2568
|
left: auto;
|
|
2569
2569
|
right: auto;
|
|
2570
2570
|
}
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2571
|
+
@media (min-width: 600px) {
|
|
2572
|
+
.wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
|
|
2573
|
+
display: block;
|
|
2574
|
+
width: 100%;
|
|
2575
|
+
position: relative;
|
|
2576
|
+
z-index: auto;
|
|
2577
|
+
background-color: inherit;
|
|
2578
|
+
}
|
|
2579
|
+
.wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) .wp-block-navigation__responsive-container-close {
|
|
2580
|
+
display: none;
|
|
2581
|
+
}
|
|
2582
|
+
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container {
|
|
2583
|
+
right: 0;
|
|
2584
|
+
}
|
|
2583
2585
|
}
|
|
2584
2586
|
|
|
2585
2587
|
.wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open {
|
|
@@ -2623,8 +2625,10 @@ button.wp-block-navigation-item__content {
|
|
|
2623
2625
|
font-weight: inherit;
|
|
2624
2626
|
font-size: inherit;
|
|
2625
2627
|
}
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
+
@media (min-width: 600px) {
|
|
2629
|
+
.wp-block-navigation__responsive-container-open:not(.always-shown) {
|
|
2630
|
+
display: none;
|
|
2631
|
+
}
|
|
2628
2632
|
}
|
|
2629
2633
|
|
|
2630
2634
|
.wp-block-navigation__responsive-container-close {
|
package/build-style/style.css
CHANGED
|
@@ -2598,18 +2598,20 @@ button.wp-block-navigation-item__content {
|
|
|
2598
2598
|
right: auto;
|
|
2599
2599
|
left: auto;
|
|
2600
2600
|
}
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2601
|
+
@media (min-width: 600px) {
|
|
2602
|
+
.wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
|
|
2603
|
+
display: block;
|
|
2604
|
+
width: 100%;
|
|
2605
|
+
position: relative;
|
|
2606
|
+
z-index: auto;
|
|
2607
|
+
background-color: inherit;
|
|
2608
|
+
}
|
|
2609
|
+
.wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) .wp-block-navigation__responsive-container-close {
|
|
2610
|
+
display: none;
|
|
2611
|
+
}
|
|
2612
|
+
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container {
|
|
2613
|
+
left: 0;
|
|
2614
|
+
}
|
|
2613
2615
|
}
|
|
2614
2616
|
|
|
2615
2617
|
.wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open {
|
|
@@ -2653,8 +2655,10 @@ button.wp-block-navigation-item__content {
|
|
|
2653
2655
|
font-weight: inherit;
|
|
2654
2656
|
font-size: inherit;
|
|
2655
2657
|
}
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
+
@media (min-width: 600px) {
|
|
2659
|
+
.wp-block-navigation__responsive-container-open:not(.always-shown) {
|
|
2660
|
+
display: none;
|
|
2661
|
+
}
|
|
2658
2662
|
}
|
|
2659
2663
|
|
|
2660
2664
|
.wp-block-navigation__responsive-container-close {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-library",
|
|
3
|
-
"version": "8.28.
|
|
3
|
+
"version": "8.28.3",
|
|
4
4
|
"description": "Block library for the WordPress editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -31,38 +31,38 @@
|
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.16.0",
|
|
34
|
-
"@wordpress/a11y": "^3.51.
|
|
35
|
-
"@wordpress/api-fetch": "^6.48.
|
|
36
|
-
"@wordpress/autop": "^3.51.
|
|
37
|
-
"@wordpress/blob": "^3.51.
|
|
38
|
-
"@wordpress/block-editor": "^12.19.
|
|
39
|
-
"@wordpress/blocks": "^12.28.
|
|
40
|
-
"@wordpress/components": "^26.0.
|
|
41
|
-
"@wordpress/compose": "^6.28.
|
|
42
|
-
"@wordpress/core-data": "^6.28.
|
|
43
|
-
"@wordpress/data": "^9.21.
|
|
44
|
-
"@wordpress/date": "^4.51.
|
|
45
|
-
"@wordpress/deprecated": "^3.51.
|
|
46
|
-
"@wordpress/dom": "^3.51.
|
|
47
|
-
"@wordpress/element": "^5.28.
|
|
48
|
-
"@wordpress/escape-html": "^2.51.
|
|
49
|
-
"@wordpress/hooks": "^3.51.
|
|
50
|
-
"@wordpress/html-entities": "^3.51.
|
|
51
|
-
"@wordpress/i18n": "^4.51.
|
|
52
|
-
"@wordpress/icons": "^9.42.
|
|
53
|
-
"@wordpress/interactivity": "^5.0.
|
|
54
|
-
"@wordpress/interactivity-router": "^1.1.
|
|
55
|
-
"@wordpress/keycodes": "^3.51.
|
|
56
|
-
"@wordpress/notices": "^4.19.
|
|
57
|
-
"@wordpress/patterns": "^1.12.
|
|
58
|
-
"@wordpress/primitives": "^3.49.
|
|
59
|
-
"@wordpress/private-apis": "^0.33.
|
|
60
|
-
"@wordpress/reusable-blocks": "^4.28.
|
|
61
|
-
"@wordpress/rich-text": "^6.28.
|
|
62
|
-
"@wordpress/server-side-render": "^4.28.
|
|
63
|
-
"@wordpress/url": "^3.52.
|
|
64
|
-
"@wordpress/viewport": "^5.28.
|
|
65
|
-
"@wordpress/wordcount": "^3.51.
|
|
34
|
+
"@wordpress/a11y": "^3.51.1",
|
|
35
|
+
"@wordpress/api-fetch": "^6.48.1",
|
|
36
|
+
"@wordpress/autop": "^3.51.1",
|
|
37
|
+
"@wordpress/blob": "^3.51.1",
|
|
38
|
+
"@wordpress/block-editor": "^12.19.3",
|
|
39
|
+
"@wordpress/blocks": "^12.28.3",
|
|
40
|
+
"@wordpress/components": "^26.0.2",
|
|
41
|
+
"@wordpress/compose": "^6.28.1",
|
|
42
|
+
"@wordpress/core-data": "^6.28.3",
|
|
43
|
+
"@wordpress/data": "^9.21.1",
|
|
44
|
+
"@wordpress/date": "^4.51.1",
|
|
45
|
+
"@wordpress/deprecated": "^3.51.1",
|
|
46
|
+
"@wordpress/dom": "^3.51.1",
|
|
47
|
+
"@wordpress/element": "^5.28.1",
|
|
48
|
+
"@wordpress/escape-html": "^2.51.1",
|
|
49
|
+
"@wordpress/hooks": "^3.51.1",
|
|
50
|
+
"@wordpress/html-entities": "^3.51.1",
|
|
51
|
+
"@wordpress/i18n": "^4.51.1",
|
|
52
|
+
"@wordpress/icons": "^9.42.1",
|
|
53
|
+
"@wordpress/interactivity": "^5.0.1",
|
|
54
|
+
"@wordpress/interactivity-router": "^1.1.1",
|
|
55
|
+
"@wordpress/keycodes": "^3.51.1",
|
|
56
|
+
"@wordpress/notices": "^4.19.1",
|
|
57
|
+
"@wordpress/patterns": "^1.12.3",
|
|
58
|
+
"@wordpress/primitives": "^3.49.1",
|
|
59
|
+
"@wordpress/private-apis": "^0.33.1",
|
|
60
|
+
"@wordpress/reusable-blocks": "^4.28.3",
|
|
61
|
+
"@wordpress/rich-text": "^6.28.2",
|
|
62
|
+
"@wordpress/server-side-render": "^4.28.3",
|
|
63
|
+
"@wordpress/url": "^3.52.1",
|
|
64
|
+
"@wordpress/viewport": "^5.28.1",
|
|
65
|
+
"@wordpress/wordcount": "^3.51.1",
|
|
66
66
|
"change-case": "^4.1.2",
|
|
67
67
|
"classnames": "^2.3.1",
|
|
68
68
|
"colord": "^2.7.0",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"publishConfig": {
|
|
81
81
|
"access": "public"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "b12d75c5c5256fda2a0509bb432e20ddd3354d5e"
|
|
84
84
|
}
|
package/src/button/block.json
CHANGED
package/src/button/edit.js
CHANGED
|
@@ -238,15 +238,15 @@ function ButtonEdit( props ) {
|
|
|
238
238
|
return {};
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
-
const
|
|
241
|
+
const blockBindingsSource = unlock(
|
|
242
242
|
select( blockEditorStore )
|
|
243
|
-
);
|
|
243
|
+
).getBlockBindingsSource( metadata?.bindings?.url?.source );
|
|
244
244
|
|
|
245
245
|
return {
|
|
246
246
|
lockUrlControls:
|
|
247
247
|
!! metadata?.bindings?.url &&
|
|
248
|
-
|
|
249
|
-
?.lockAttributesEditing,
|
|
248
|
+
( ! blockBindingsSource ||
|
|
249
|
+
blockBindingsSource?.lockAttributesEditing ),
|
|
250
250
|
};
|
|
251
251
|
},
|
|
252
252
|
[ isSelected ]
|
package/src/footnotes/index.php
CHANGED
|
@@ -68,15 +68,30 @@ function render_block_core_footnotes( $attributes, $content, $block ) {
|
|
|
68
68
|
* @since 6.3.0
|
|
69
69
|
*/
|
|
70
70
|
function register_block_core_footnotes() {
|
|
71
|
-
|
|
71
|
+
register_block_type_from_metadata(
|
|
72
|
+
__DIR__ . '/footnotes',
|
|
72
73
|
array(
|
|
73
|
-
'
|
|
74
|
-
'public' => true,
|
|
74
|
+
'render_callback' => 'render_block_core_footnotes',
|
|
75
75
|
)
|
|
76
76
|
);
|
|
77
|
+
}
|
|
78
|
+
add_action( 'init', 'register_block_core_footnotes' );
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Registers the footnotes meta field required for footnotes to work.
|
|
83
|
+
*
|
|
84
|
+
* @since 6.5.0
|
|
85
|
+
*/
|
|
86
|
+
function register_block_core_footnotes_post_meta() {
|
|
87
|
+
$post_types = get_post_types( array( 'show_in_rest' => true ) );
|
|
77
88
|
foreach ( $post_types as $post_type ) {
|
|
78
89
|
// Only register the meta field if the post type supports the editor, custom fields, and revisions.
|
|
79
|
-
if (
|
|
90
|
+
if (
|
|
91
|
+
post_type_supports( $post_type, 'editor' ) &&
|
|
92
|
+
post_type_supports( $post_type, 'custom-fields' ) &&
|
|
93
|
+
post_type_supports( $post_type, 'revisions' )
|
|
94
|
+
) {
|
|
80
95
|
register_post_meta(
|
|
81
96
|
$post_type,
|
|
82
97
|
'footnotes',
|
|
@@ -89,14 +104,12 @@ function register_block_core_footnotes() {
|
|
|
89
104
|
);
|
|
90
105
|
}
|
|
91
106
|
}
|
|
92
|
-
register_block_type_from_metadata(
|
|
93
|
-
__DIR__ . '/footnotes',
|
|
94
|
-
array(
|
|
95
|
-
'render_callback' => 'render_block_core_footnotes',
|
|
96
|
-
)
|
|
97
|
-
);
|
|
98
107
|
}
|
|
99
|
-
|
|
108
|
+
/**
|
|
109
|
+
* Most post types are registered at priority 10, so use priority 20 here in
|
|
110
|
+
* order to catch them.
|
|
111
|
+
*/
|
|
112
|
+
add_action( 'init', 'register_block_core_footnotes_post_meta', 20 );
|
|
100
113
|
|
|
101
114
|
/**
|
|
102
115
|
* Adds the footnotes field to the revisions display.
|
package/src/heading/block.json
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
"description": "Introduce new sections and organize content to help visitors (and search engines) understand the structure of your content.",
|
|
8
8
|
"keywords": [ "title", "subtitle" ],
|
|
9
9
|
"textdomain": "default",
|
|
10
|
-
"usesContext": [ "pattern/overrides" ],
|
|
11
10
|
"attributes": {
|
|
12
11
|
"textAlign": {
|
|
13
12
|
"type": "string"
|
package/src/image/block.json
CHANGED
|
@@ -4,12 +4,7 @@
|
|
|
4
4
|
"name": "core/image",
|
|
5
5
|
"title": "Image",
|
|
6
6
|
"category": "media",
|
|
7
|
-
"usesContext": [
|
|
8
|
-
"allowResize",
|
|
9
|
-
"imageCrop",
|
|
10
|
-
"fixedHeight",
|
|
11
|
-
"pattern/overrides"
|
|
12
|
-
],
|
|
7
|
+
"usesContext": [ "allowResize", "imageCrop", "fixedHeight" ],
|
|
13
8
|
"description": "Insert an image to make a visual statement.",
|
|
14
9
|
"keywords": [ "img", "photo", "picture" ],
|
|
15
10
|
"textdomain": "default",
|
package/src/image/edit.js
CHANGED
|
@@ -341,15 +341,15 @@ export function ImageEdit( {
|
|
|
341
341
|
return {};
|
|
342
342
|
}
|
|
343
343
|
|
|
344
|
-
const
|
|
344
|
+
const blockBindingsSource = unlock(
|
|
345
345
|
select( blockEditorStore )
|
|
346
|
-
);
|
|
346
|
+
).getBlockBindingsSource( metadata?.bindings?.url?.source );
|
|
347
347
|
|
|
348
348
|
return {
|
|
349
349
|
lockUrlControls:
|
|
350
350
|
!! metadata?.bindings?.url &&
|
|
351
|
-
|
|
352
|
-
?.lockAttributesEditing,
|
|
351
|
+
( ! blockBindingsSource ||
|
|
352
|
+
blockBindingsSource?.lockAttributesEditing ),
|
|
353
353
|
};
|
|
354
354
|
},
|
|
355
355
|
[ isSingleSelected ]
|
package/src/image/editor.scss
CHANGED
package/src/image/image.js
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
TextControl,
|
|
11
11
|
ToolbarButton,
|
|
12
12
|
ToolbarGroup,
|
|
13
|
+
Dropdown,
|
|
13
14
|
__experimentalToolsPanel as ToolsPanel,
|
|
14
15
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
15
16
|
__experimentalUseCustomUnits as useCustomUnits,
|
|
@@ -30,6 +31,7 @@ import {
|
|
|
30
31
|
} from '@wordpress/block-editor';
|
|
31
32
|
import { useEffect, useMemo, useState, useRef } from '@wordpress/element';
|
|
32
33
|
import { __, _x, sprintf, isRTL } from '@wordpress/i18n';
|
|
34
|
+
import { DOWN } from '@wordpress/keycodes';
|
|
33
35
|
import { getFilename } from '@wordpress/url';
|
|
34
36
|
import { switchToBlockType } from '@wordpress/blocks';
|
|
35
37
|
import { crop, overlayText, upload } from '@wordpress/icons';
|
|
@@ -177,6 +179,7 @@ export default function Image( {
|
|
|
177
179
|
const [ externalBlob, setExternalBlob ] = useState();
|
|
178
180
|
const clientWidth = useClientWidth( containerRef, [ align ] );
|
|
179
181
|
const hasNonContentControls = blockEditingMode === 'default';
|
|
182
|
+
const isContentOnlyMode = blockEditingMode === 'contentOnly';
|
|
180
183
|
const isResizable =
|
|
181
184
|
allowResize &&
|
|
182
185
|
hasNonContentControls &&
|
|
@@ -423,23 +426,32 @@ export default function Image( {
|
|
|
423
426
|
} = metadata?.bindings || {};
|
|
424
427
|
const hasParentPattern =
|
|
425
428
|
getBlockParentsByBlockName( clientId, 'core/block' ).length > 0;
|
|
429
|
+
const urlBindingSource = getBlockBindingsSource(
|
|
430
|
+
urlBinding?.source
|
|
431
|
+
);
|
|
432
|
+
const altBindingSource = getBlockBindingsSource(
|
|
433
|
+
altBinding?.source
|
|
434
|
+
);
|
|
435
|
+
const titleBindingSource = getBlockBindingsSource(
|
|
436
|
+
titleBinding?.source
|
|
437
|
+
);
|
|
426
438
|
return {
|
|
427
439
|
lockUrlControls:
|
|
428
440
|
!! urlBinding &&
|
|
429
|
-
|
|
430
|
-
?.lockAttributesEditing,
|
|
441
|
+
( ! urlBindingSource ||
|
|
442
|
+
urlBindingSource?.lockAttributesEditing ),
|
|
431
443
|
lockHrefControls:
|
|
432
444
|
// Disable editing the link of the URL if the image is inside a pattern instance.
|
|
433
445
|
// This is a temporary solution until we support overriding the link on the frontend.
|
|
434
446
|
hasParentPattern,
|
|
435
447
|
lockAltControls:
|
|
436
448
|
!! altBinding &&
|
|
437
|
-
|
|
438
|
-
?.lockAttributesEditing,
|
|
449
|
+
( ! altBindingSource ||
|
|
450
|
+
altBindingSource?.lockAttributesEditing ),
|
|
439
451
|
lockTitleControls:
|
|
440
452
|
!! titleBinding &&
|
|
441
|
-
|
|
442
|
-
?.lockAttributesEditing,
|
|
453
|
+
( ! titleBindingSource ||
|
|
454
|
+
titleBindingSource?.lockAttributesEditing ),
|
|
443
455
|
};
|
|
444
456
|
},
|
|
445
457
|
[ clientId, isSingleSelected, metadata?.bindings ]
|
|
@@ -505,6 +517,113 @@ export default function Image( {
|
|
|
505
517
|
</ToolbarGroup>
|
|
506
518
|
</BlockControls>
|
|
507
519
|
) }
|
|
520
|
+
{ isContentOnlyMode && (
|
|
521
|
+
// Add some extra controls for content attributes when content only mode is active.
|
|
522
|
+
// With content only mode active, the inspector is hidden, so users need another way
|
|
523
|
+
// to edit these attributes.
|
|
524
|
+
<BlockControls group="other">
|
|
525
|
+
<Dropdown
|
|
526
|
+
popoverProps={ { position: 'bottom right' } }
|
|
527
|
+
renderToggle={ ( { isOpen, onToggle } ) => (
|
|
528
|
+
<ToolbarButton
|
|
529
|
+
onClick={ onToggle }
|
|
530
|
+
aria-haspopup="true"
|
|
531
|
+
aria-expanded={ isOpen }
|
|
532
|
+
onKeyDown={ ( event ) => {
|
|
533
|
+
if ( ! isOpen && event.keyCode === DOWN ) {
|
|
534
|
+
event.preventDefault();
|
|
535
|
+
onToggle();
|
|
536
|
+
}
|
|
537
|
+
} }
|
|
538
|
+
>
|
|
539
|
+
{ _x(
|
|
540
|
+
'Alt',
|
|
541
|
+
'Alternative text for an image. Block toolbar label, a low character count is preferred.'
|
|
542
|
+
) }
|
|
543
|
+
</ToolbarButton>
|
|
544
|
+
) }
|
|
545
|
+
renderContent={ () => (
|
|
546
|
+
<TextareaControl
|
|
547
|
+
className="wp-block-image__toolbar_content_textarea"
|
|
548
|
+
label={ __( 'Alternative text' ) }
|
|
549
|
+
value={ alt || '' }
|
|
550
|
+
onChange={ updateAlt }
|
|
551
|
+
disabled={ lockAltControls }
|
|
552
|
+
help={
|
|
553
|
+
lockAltControls ? (
|
|
554
|
+
<>
|
|
555
|
+
{ __(
|
|
556
|
+
'Connected to a custom field'
|
|
557
|
+
) }
|
|
558
|
+
</>
|
|
559
|
+
) : (
|
|
560
|
+
<>
|
|
561
|
+
<ExternalLink href="https://www.w3.org/WAI/tutorials/images/decision-tree">
|
|
562
|
+
{ __(
|
|
563
|
+
'Describe the purpose of the image.'
|
|
564
|
+
) }
|
|
565
|
+
</ExternalLink>
|
|
566
|
+
<br />
|
|
567
|
+
{ __(
|
|
568
|
+
'Leave empty if decorative.'
|
|
569
|
+
) }
|
|
570
|
+
</>
|
|
571
|
+
)
|
|
572
|
+
}
|
|
573
|
+
__nextHasNoMarginBottom
|
|
574
|
+
/>
|
|
575
|
+
) }
|
|
576
|
+
/>
|
|
577
|
+
<Dropdown
|
|
578
|
+
popoverProps={ { position: 'bottom right' } }
|
|
579
|
+
renderToggle={ ( { isOpen, onToggle } ) => (
|
|
580
|
+
<ToolbarButton
|
|
581
|
+
onClick={ onToggle }
|
|
582
|
+
aria-haspopup="true"
|
|
583
|
+
aria-expanded={ isOpen }
|
|
584
|
+
onKeyDown={ ( event ) => {
|
|
585
|
+
if ( ! isOpen && event.keyCode === DOWN ) {
|
|
586
|
+
event.preventDefault();
|
|
587
|
+
onToggle();
|
|
588
|
+
}
|
|
589
|
+
} }
|
|
590
|
+
>
|
|
591
|
+
{ __( 'Title' ) }
|
|
592
|
+
</ToolbarButton>
|
|
593
|
+
) }
|
|
594
|
+
renderContent={ () => (
|
|
595
|
+
<TextControl
|
|
596
|
+
className="wp-block-image__toolbar_content_textarea"
|
|
597
|
+
__nextHasNoMarginBottom
|
|
598
|
+
label={ __( 'Title attribute' ) }
|
|
599
|
+
value={ title || '' }
|
|
600
|
+
onChange={ onSetTitle }
|
|
601
|
+
disabled={ lockTitleControls }
|
|
602
|
+
help={
|
|
603
|
+
lockTitleControls ? (
|
|
604
|
+
<>
|
|
605
|
+
{ __(
|
|
606
|
+
'Connected to a custom field'
|
|
607
|
+
) }
|
|
608
|
+
</>
|
|
609
|
+
) : (
|
|
610
|
+
<>
|
|
611
|
+
{ __(
|
|
612
|
+
'Describe the role of this image on the page.'
|
|
613
|
+
) }
|
|
614
|
+
<ExternalLink href="https://www.w3.org/TR/html52/dom.html#the-title-attribute">
|
|
615
|
+
{ __(
|
|
616
|
+
'(Note: many devices and browsers do not display this text.)'
|
|
617
|
+
) }
|
|
618
|
+
</ExternalLink>
|
|
619
|
+
</>
|
|
620
|
+
)
|
|
621
|
+
}
|
|
622
|
+
/>
|
|
623
|
+
) }
|
|
624
|
+
/>
|
|
625
|
+
</BlockControls>
|
|
626
|
+
) }
|
|
508
627
|
<InspectorControls>
|
|
509
628
|
<ToolsPanel
|
|
510
629
|
label={ __( 'Settings' ) }
|
|
@@ -524,7 +643,7 @@ export default function Image( {
|
|
|
524
643
|
label={ __( 'Alternative text' ) }
|
|
525
644
|
value={ alt || '' }
|
|
526
645
|
onChange={ updateAlt }
|
|
527
|
-
|
|
646
|
+
readOnly={ lockAltControls }
|
|
528
647
|
help={
|
|
529
648
|
lockAltControls ? (
|
|
530
649
|
<>
|
|
@@ -566,7 +685,7 @@ export default function Image( {
|
|
|
566
685
|
label={ __( 'Title attribute' ) }
|
|
567
686
|
value={ title || '' }
|
|
568
687
|
onChange={ onSetTitle }
|
|
569
|
-
|
|
688
|
+
readOnly={ lockTitleControls }
|
|
570
689
|
help={
|
|
571
690
|
lockTitleControls ? (
|
|
572
691
|
<>{ __( 'Connected to a custom field' ) }</>
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
import { __, sprintf } from '@wordpress/i18n';
|
|
43
43
|
import { speak } from '@wordpress/a11y';
|
|
44
44
|
import { close, Icon } from '@wordpress/icons';
|
|
45
|
-
import { useInstanceId
|
|
45
|
+
import { useInstanceId } from '@wordpress/compose';
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
48
|
* Internal dependencies
|
|
@@ -71,7 +71,6 @@ import MenuInspectorControls from './menu-inspector-controls';
|
|
|
71
71
|
import DeletedNavigationWarning from './deleted-navigation-warning';
|
|
72
72
|
import AccessibleDescription from './accessible-description';
|
|
73
73
|
import AccessibleMenuDescription from './accessible-menu-description';
|
|
74
|
-
import { NAVIGATION_MOBILE_COLLAPSE } from '../constants';
|
|
75
74
|
import { unlock } from '../../lock-unlock';
|
|
76
75
|
|
|
77
76
|
function Navigation( {
|
|
@@ -298,14 +297,6 @@ function Navigation( {
|
|
|
298
297
|
[ clientId ]
|
|
299
298
|
);
|
|
300
299
|
const isResponsive = 'never' !== overlayMenu;
|
|
301
|
-
const isMobileBreakPoint = useMediaQuery(
|
|
302
|
-
`(max-width: ${ NAVIGATION_MOBILE_COLLAPSE })`
|
|
303
|
-
);
|
|
304
|
-
|
|
305
|
-
const isCollapsed =
|
|
306
|
-
( 'mobile' === overlayMenu && isMobileBreakPoint ) ||
|
|
307
|
-
'always' === overlayMenu;
|
|
308
|
-
|
|
309
300
|
const blockProps = useBlockProps( {
|
|
310
301
|
ref: navRef,
|
|
311
302
|
className: classnames(
|
|
@@ -319,7 +310,6 @@ function Navigation( {
|
|
|
319
310
|
'is-vertical': orientation === 'vertical',
|
|
320
311
|
'no-wrap': flexWrap === 'nowrap',
|
|
321
312
|
'is-responsive': isResponsive,
|
|
322
|
-
'is-collapsed': isCollapsed,
|
|
323
313
|
'has-text-color': !! textColor.color || !! textColor?.class,
|
|
324
314
|
[ getColorClassName( 'color', textColor?.slug ) ]:
|
|
325
315
|
!! textColor?.slug,
|
|
@@ -429,7 +429,7 @@ $color-control-label-height: 20px;
|
|
|
429
429
|
// These needs extra specificity in the editor.
|
|
430
430
|
.wp-block-navigation__responsive-container:not(.is-menu-open) {
|
|
431
431
|
.components-button.wp-block-navigation__responsive-container-close {
|
|
432
|
-
|
|
432
|
+
@include break-small {
|
|
433
433
|
display: none;
|
|
434
434
|
}
|
|
435
435
|
}
|