@wordpress/block-library 9.11.0 → 9.12.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/button/index.js +1 -1
- package/build/button/index.js.map +1 -1
- package/build/cover/deprecated.js +140 -4
- package/build/cover/deprecated.js.map +1 -1
- package/build/cover/edit/block-controls.js +1 -1
- package/build/cover/edit/block-controls.js.map +1 -1
- package/build/cover/edit/cover-placeholder.js +1 -2
- package/build/cover/edit/cover-placeholder.js.map +1 -1
- package/build/cover/edit/index.js +22 -22
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/save.js +13 -13
- package/build/cover/save.js.map +1 -1
- package/build/details/index.js +1 -0
- package/build/details/index.js.map +1 -1
- package/build/file/edit.js +1 -1
- package/build/file/edit.js.map +1 -1
- package/build/gallery/edit.js +1 -1
- package/build/gallery/edit.js.map +1 -1
- package/build/image/edit.js +1 -1
- package/build/image/edit.js.map +1 -1
- package/build/image/image.js +144 -78
- package/build/image/image.js.map +1 -1
- package/build/image/index.js +1 -1
- package/build/latest-posts/edit.js +0 -1
- package/build/latest-posts/edit.js.map +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/navigation/edit/index.js +2 -23
- package/build/navigation/edit/index.js.map +1 -1
- package/build/paragraph/edit.js +1 -1
- package/build/paragraph/edit.js.map +1 -1
- package/build/post-content/index.js +13 -0
- package/build/post-content/index.js.map +1 -1
- package/build/post-template/edit.js +11 -0
- package/build/post-template/edit.js.map +1 -1
- package/build/post-template/index.js +1 -1
- package/build/query/edit/inspector-controls/index.js +2 -2
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/pattern-selection-modal.js +0 -3
- package/build/query/edit/pattern-selection-modal.js.map +1 -1
- package/build/query/edit/query-content.js +10 -12
- package/build/query/edit/query-content.js.map +1 -1
- package/build/query/index.js +1 -1
- package/build/query/utils.js +32 -1
- package/build/query/utils.js.map +1 -1
- package/build/template-part/edit/index.js +1 -4
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/edit/selection-modal.js +0 -3
- package/build/template-part/edit/selection-modal.js.map +1 -1
- package/build/video/edit.js +1 -1
- package/build/video/edit.js.map +1 -1
- package/build/video/tracks-editor.js +0 -2
- package/build/video/tracks-editor.js.map +1 -1
- package/build-module/button/index.js +1 -1
- package/build-module/button/index.js.map +1 -1
- package/build-module/cover/deprecated.js +140 -4
- package/build-module/cover/deprecated.js.map +1 -1
- package/build-module/cover/edit/block-controls.js +1 -1
- package/build-module/cover/edit/block-controls.js.map +1 -1
- package/build-module/cover/edit/cover-placeholder.js +1 -2
- package/build-module/cover/edit/cover-placeholder.js.map +1 -1
- package/build-module/cover/edit/index.js +22 -22
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/save.js +13 -13
- package/build-module/cover/save.js.map +1 -1
- package/build-module/details/index.js +1 -0
- package/build-module/details/index.js.map +1 -1
- package/build-module/file/edit.js +1 -1
- package/build-module/file/edit.js.map +1 -1
- package/build-module/gallery/edit.js +1 -1
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/image/edit.js +1 -1
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/image.js +149 -83
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/index.js +1 -1
- package/build-module/latest-posts/edit.js +0 -1
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/navigation/edit/index.js +2 -23
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/paragraph/edit.js +1 -1
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/post-content/index.js +13 -0
- package/build-module/post-content/index.js.map +1 -1
- package/build-module/post-template/edit.js +11 -0
- package/build-module/post-template/edit.js.map +1 -1
- package/build-module/post-template/index.js +1 -1
- package/build-module/query/edit/inspector-controls/index.js +2 -2
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/pattern-selection-modal.js +0 -3
- package/build-module/query/edit/pattern-selection-modal.js.map +1 -1
- package/build-module/query/edit/query-content.js +10 -12
- package/build-module/query/edit/query-content.js.map +1 -1
- package/build-module/query/index.js +1 -1
- package/build-module/query/utils.js +29 -0
- package/build-module/query/utils.js.map +1 -1
- package/build-module/template-part/edit/index.js +1 -4
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/edit/selection-modal.js +0 -3
- package/build-module/template-part/edit/selection-modal.js.map +1 -1
- package/build-module/video/edit.js +1 -1
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/tracks-editor.js +0 -2
- package/build-module/video/tracks-editor.js.map +1 -1
- package/build-style/cover/editor-rtl.css +3 -5
- package/build-style/cover/editor.css +3 -5
- package/build-style/cover/style-rtl.css +19 -15
- package/build-style/cover/style.css +19 -15
- package/build-style/editor-rtl.css +7 -22
- package/build-style/editor.css +7 -22
- package/build-style/group/editor-rtl.css +0 -10
- package/build-style/group/editor.css +0 -10
- package/build-style/image/editor-rtl.css +4 -0
- package/build-style/image/editor.css +4 -0
- package/build-style/image/style-rtl.css +0 -2
- package/build-style/image/style.css +0 -2
- package/build-style/latest-posts/editor-rtl.css +0 -7
- package/build-style/latest-posts/editor.css +0 -7
- package/build-style/media-text/style-rtl.css +1 -1
- package/build-style/media-text/style.css +1 -1
- package/build-style/style-rtl.css +20 -18
- package/build-style/style.css +20 -18
- package/build-types/lock-unlock.d.ts +2 -0
- package/build-types/lock-unlock.d.ts.map +1 -0
- package/package.json +8 -8
- package/src/button/index.js +1 -1
- package/src/comments/block.json +3 -9
- package/src/cover/deprecated.js +182 -4
- package/src/cover/edit/block-controls.js +1 -1
- package/src/cover/edit/cover-placeholder.js +0 -3
- package/src/cover/edit/index.js +41 -26
- package/src/cover/editor.scss +4 -5
- package/src/cover/save.js +27 -20
- package/src/cover/style.scss +40 -16
- package/src/cover/test/__snapshots__/edit.native.js.snap +9 -9
- package/src/cover/test/__snapshots__/transforms.native.js.snap +4 -4
- package/src/cover/test/edit.native.js +4 -4
- package/src/cover/test/transforms.native.js +4 -4
- package/src/details/block.json +1 -0
- package/src/file/edit.js +1 -1
- package/src/gallery/edit.js +1 -1
- package/src/group/editor.scss +0 -12
- package/src/image/block.json +1 -1
- package/src/image/edit.js +1 -1
- package/src/image/editor.scss +4 -0
- package/src/image/image.js +200 -109
- package/src/image/style.scss +0 -1
- package/src/image/test/__snapshots__/transforms.native.js.snap +1 -1
- package/src/latest-posts/edit.js +0 -1
- package/src/latest-posts/editor.scss +0 -11
- package/src/media-text/style.scss +1 -1
- package/src/media-text/test/__snapshots__/transforms.native.js.snap +2 -2
- package/src/navigation/edit/index.js +3 -30
- package/src/navigation/index.php +1 -1
- package/src/paragraph/edit.js +1 -1
- package/src/post-content/block.json +14 -1
- package/src/post-template/block.json +2 -1
- package/src/post-template/edit.js +19 -0
- package/src/query/block.json +1 -1
- package/src/query/edit/inspector-controls/index.js +2 -2
- package/src/query/edit/pattern-selection-modal.js +0 -3
- package/src/query/edit/query-content.js +9 -17
- package/src/query/test/utils.js +59 -1
- package/src/query/utils.js +29 -0
- package/src/search/index.php +2 -2
- package/src/template-part/edit/index.js +1 -4
- package/src/template-part/edit/selection-modal.js +0 -3
- package/src/video/edit.js +1 -1
- package/src/video/test/__snapshots__/transforms.native.js.snap +1 -1
- package/src/video/tracks-editor.js +0 -2
- package/tsconfig.tsbuildinfo +1 -1
- /package/src/{lock-unlock.js → lock-unlock.ts} +0 -0
|
@@ -53,13 +53,13 @@ const COVER_BLOCK_SOLID_COLOR_HTML = `<!-- wp:cover {"overlayColor":"cyan-bluish
|
|
|
53
53
|
<p class="has-text-align-center"></p>
|
|
54
54
|
<!-- /wp:paragraph --></div></div>
|
|
55
55
|
<!-- /wp:cover -->`;
|
|
56
|
-
const COVER_BLOCK_IMAGE_HTML = `<!-- wp:cover {"url":"https://cldup.com/cXyG__fTLN.jpg","id":10710,"dimRatio":50,"overlayColor":"foreground","isDark":false} -->
|
|
57
|
-
<div class="wp-block-cover is-light"><
|
|
56
|
+
const COVER_BLOCK_IMAGE_HTML = `<!-- wp:cover {"url":"https://cldup.com/cXyG__fTLN.jpg","id":10710,"dimRatio":50,"overlayColor":"foreground","isUserOverlayColor":true,"isDark":false} -->
|
|
57
|
+
<div class="wp-block-cover is-light"><img class="wp-block-cover__image-background wp-image-10710" alt="" src="https://cldup.com/cXyG__fTLN.jpg" data-object-fit="cover"/><span aria-hidden="true" class="wp-block-cover__background has-foreground-background-color has-background-dim"></span><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…","fontSize":"large"} -->
|
|
58
58
|
<p class="has-text-align-center has-large-font-size"></p>
|
|
59
59
|
<!-- /wp:paragraph --></div></div>
|
|
60
60
|
<!-- /wp:cover -->`;
|
|
61
|
-
const COVER_BLOCK_CUSTOM_HEIGHT_HTML = `<!-- wp:cover {"url":"https://cldup.com/cXyG__fTLN.jpg","id":10710,"dimRatio":50,"overlayColor":"foreground","minHeight":20,"minHeightUnit":"vw","isDark":false} -->
|
|
62
|
-
<div class="wp-block-cover is-light" style="min-height:20vw"><
|
|
61
|
+
const COVER_BLOCK_CUSTOM_HEIGHT_HTML = `<!-- wp:cover {"url":"https://cldup.com/cXyG__fTLN.jpg","id":10710,"dimRatio":50,"overlayColor":"foreground","isUserOverlayColor":true,"minHeight":20,"minHeightUnit":"vw","isDark":false} -->
|
|
62
|
+
<div class="wp-block-cover is-light" style="min-height:20vw"><img class="wp-block-cover__image-background wp-image-10710" alt="" src="https://cldup.com/cXyG__fTLN.jpg" data-object-fit="cover"/><span aria-hidden="true" class="wp-block-cover__background has-foreground-background-color has-background-dim"></span><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…","fontSize":"large"} -->
|
|
63
63
|
<p class="has-text-align-center has-large-font-size"></p>
|
|
64
64
|
<!-- /wp:paragraph --></div></div>
|
|
65
65
|
<!-- /wp:cover -->`;
|
|
@@ -11,14 +11,14 @@ import {
|
|
|
11
11
|
|
|
12
12
|
const block = 'Cover';
|
|
13
13
|
const initialHtmlWithImage = `
|
|
14
|
-
<!-- wp:cover {"url":"https://cldup.com/cXyG__fTLN.jpg","id":890,"dimRatio":20,"overlayColor":"luminous-vivid-orange","focalPoint":{"x":"0.63","y":"0.83"},"minHeight":219} -->
|
|
15
|
-
<div class="wp-block-cover" style="min-height:219px"><
|
|
14
|
+
<!-- wp:cover {"url":"https://cldup.com/cXyG__fTLN.jpg","id":890,"dimRatio":20,"overlayColor":"luminous-vivid-orange","isUserOverlayColor":true,"focalPoint":{"x":"0.63","y":"0.83"},"minHeight":219} -->
|
|
15
|
+
<div class="wp-block-cover" style="min-height:219px"><img class="wp-block-cover__image-background wp-image-890" alt="" src="https://cldup.com/cXyG__fTLN.jpg" style="object-position:63% 83%" data-object-fit="cover" data-object-position="63% 83%"/><span aria-hidden="true" class="wp-block-cover__background has-luminous-vivid-orange-background-color has-background-dim-20 has-background-dim"></span><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…","className":"has-text-color has-very-light-gray-color","fontSize":"large"} -->
|
|
16
16
|
<p class="has-text-align-center has-text-color has-very-light-gray-color has-large-font-size">Cool cover</p>
|
|
17
17
|
<!-- /wp:paragraph --></div></div>
|
|
18
18
|
<!-- /wp:cover -->`;
|
|
19
19
|
const initialHtmlWithVideo = `
|
|
20
|
-
<!-- wp:cover {"url":"https://i.cloudup.com/YtZFJbuQCE.mov","id":891,"dimRatio":20,"overlayColor":"luminous-vivid-orange","backgroundType":"video","focalPoint":{"x":"0.63","y":"0.83"},"minHeight":219,"isDark":false} -->
|
|
21
|
-
<div class="wp-block-cover is-light" style="min-height:219px"><
|
|
20
|
+
<!-- wp:cover {"url":"https://i.cloudup.com/YtZFJbuQCE.mov","id":891,"dimRatio":20,"overlayColor":"luminous-vivid-orange","isUserOverlayColor":true,"backgroundType":"video","focalPoint":{"x":"0.63","y":"0.83"},"minHeight":219,"isDark":false} -->
|
|
21
|
+
<div class="wp-block-cover is-light" style="min-height:219px"><video class="wp-block-cover__video-background intrinsic-ignore" autoplay muted loop playsinline src="https://i.cloudup.com/YtZFJbuQCE.mov" style="object-position:63% 83%" data-object-fit="cover" data-object-position="63% 83%"></video><span aria-hidden="true" class="wp-block-cover__background has-luminous-vivid-orange-background-color has-background-dim-20 has-background-dim"></span><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…","className":"has-text-color has-very-light-gray-color","fontSize":"large"} -->
|
|
22
22
|
<p class="has-text-align-center has-text-color has-very-light-gray-color has-large-font-size">Cool cover</p>
|
|
23
23
|
<!-- /wp:paragraph --></div></div>
|
|
24
24
|
<!-- /wp:cover -->`;
|
package/src/details/block.json
CHANGED
package/src/file/edit.js
CHANGED
|
@@ -201,7 +201,7 @@ function FileEdit( { attributes, isSelected, setAttributes, clientId } ) {
|
|
|
201
201
|
labels={ {
|
|
202
202
|
title: __( 'File' ),
|
|
203
203
|
instructions: __(
|
|
204
|
-
'
|
|
204
|
+
'Drag and drop a file, upload, or choose from your library.'
|
|
205
205
|
),
|
|
206
206
|
} }
|
|
207
207
|
onSelect={ onSelectFile }
|
package/src/gallery/edit.js
CHANGED
|
@@ -96,7 +96,7 @@ const ALLOWED_MEDIA_TYPES = [ 'image' ];
|
|
|
96
96
|
|
|
97
97
|
const PLACEHOLDER_TEXT = Platform.isNative
|
|
98
98
|
? __( 'Add media' )
|
|
99
|
-
: __( 'Drag images, upload
|
|
99
|
+
: __( 'Drag and drop images, upload, or choose from your library.' );
|
|
100
100
|
|
|
101
101
|
const MOBILE_CONTROL_PROPS_RANGE_CONTROL = Platform.isNative
|
|
102
102
|
? { type: 'stepper' }
|
package/src/group/editor.scss
CHANGED
|
@@ -10,18 +10,6 @@
|
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
// Reset user select, but the next rule should take precedence for nested
|
|
14
|
-
// groups.
|
|
15
|
-
:where([data-has-multi-selection]:not([contenteditable="true"]) .wp-block-group > *) {
|
|
16
|
-
user-select: initial;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// When we are not multi-selecting, prevent children from capturing the
|
|
20
|
-
// selection, which happens when the group is flex and children inlined.
|
|
21
|
-
:where([data-has-multi-selection]:not([contenteditable="true"]) .wp-block-group) {
|
|
22
|
-
user-select: none;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
13
|
// Place block list appender in the same place content will appear.
|
|
26
14
|
[data-type="core/group"].is-selected {
|
|
27
15
|
.block-list-appender {
|
package/src/image/block.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"name": "core/image",
|
|
5
5
|
"title": "Image",
|
|
6
6
|
"category": "media",
|
|
7
|
-
"usesContext": [ "allowResize", "imageCrop", "fixedHeight" ],
|
|
7
|
+
"usesContext": [ "allowResize", "imageCrop", "fixedHeight", "postId", "postType", "queryId" ],
|
|
8
8
|
"description": "Insert an image to make a visual statement.",
|
|
9
9
|
"keywords": [ "img", "photo", "picture" ],
|
|
10
10
|
"textdomain": "default",
|
package/src/image/edit.js
CHANGED
|
@@ -411,7 +411,7 @@ export function ImageEdit( {
|
|
|
411
411
|
! lockUrlControls &&
|
|
412
412
|
! isSmallContainer &&
|
|
413
413
|
__(
|
|
414
|
-
'
|
|
414
|
+
'Drag and drop an image, upload, or choose from your library.'
|
|
415
415
|
)
|
|
416
416
|
}
|
|
417
417
|
style={ {
|
package/src/image/editor.scss
CHANGED
|
@@ -159,6 +159,10 @@ figure.wp-block-image:not(.wp-block) {
|
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
+
.wp-block-image__toolbar_content_textarea__container {
|
|
163
|
+
padding: $grid-unit;
|
|
164
|
+
}
|
|
165
|
+
|
|
162
166
|
.wp-block-image__toolbar_content_textarea {
|
|
163
167
|
// Corresponds to the size of the textarea in the block inspector.
|
|
164
168
|
width: 250px;
|
package/src/image/image.js
CHANGED
|
@@ -10,11 +10,14 @@ import {
|
|
|
10
10
|
TextControl,
|
|
11
11
|
ToolbarButton,
|
|
12
12
|
ToolbarGroup,
|
|
13
|
-
Dropdown,
|
|
14
13
|
__experimentalToolsPanel as ToolsPanel,
|
|
15
14
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
16
15
|
__experimentalUseCustomUnits as useCustomUnits,
|
|
17
16
|
Placeholder,
|
|
17
|
+
MenuItem,
|
|
18
|
+
ToolbarItem,
|
|
19
|
+
DropdownMenu,
|
|
20
|
+
Popover,
|
|
18
21
|
} from '@wordpress/components';
|
|
19
22
|
import { useViewportMatch } from '@wordpress/compose';
|
|
20
23
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
@@ -29,15 +32,15 @@ import {
|
|
|
29
32
|
__experimentalUseBorderProps as useBorderProps,
|
|
30
33
|
__experimentalGetShadowClassesAndStyles as getShadowClassesAndStyles,
|
|
31
34
|
privateApis as blockEditorPrivateApis,
|
|
35
|
+
BlockSettingsMenuControls,
|
|
32
36
|
} from '@wordpress/block-editor';
|
|
33
37
|
import { useEffect, useMemo, useState, useRef } from '@wordpress/element';
|
|
34
38
|
import { __, _x, sprintf, isRTL } from '@wordpress/i18n';
|
|
35
|
-
import { DOWN } from '@wordpress/keycodes';
|
|
36
39
|
import { getFilename } from '@wordpress/url';
|
|
37
40
|
import { getBlockBindingsSource, switchToBlockType } from '@wordpress/blocks';
|
|
38
|
-
import { crop, overlayText, upload } from '@wordpress/icons';
|
|
41
|
+
import { crop, overlayText, upload, chevronDown } from '@wordpress/icons';
|
|
39
42
|
import { store as noticesStore } from '@wordpress/notices';
|
|
40
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
43
|
+
import { store as coreStore, useEntityProp } from '@wordpress/core-data';
|
|
41
44
|
|
|
42
45
|
/**
|
|
43
46
|
* Internal dependencies
|
|
@@ -69,6 +72,10 @@ const scaleOptions = [
|
|
|
69
72
|
},
|
|
70
73
|
];
|
|
71
74
|
|
|
75
|
+
const WRITEMODE_POPOVER_PROPS = {
|
|
76
|
+
placement: 'bottom-start',
|
|
77
|
+
};
|
|
78
|
+
|
|
72
79
|
// If the image has a href, wrap in an <a /> tag to trigger any inherited link element styles.
|
|
73
80
|
const ImageWrapper = ( { href, children } ) => {
|
|
74
81
|
if ( ! href ) {
|
|
@@ -94,6 +101,150 @@ const ImageWrapper = ( { href, children } ) => {
|
|
|
94
101
|
);
|
|
95
102
|
};
|
|
96
103
|
|
|
104
|
+
function ContentOnlyControls( {
|
|
105
|
+
attributes,
|
|
106
|
+
setAttributes,
|
|
107
|
+
lockAltControls,
|
|
108
|
+
lockAltControlsMessage,
|
|
109
|
+
lockTitleControls,
|
|
110
|
+
lockTitleControlsMessage,
|
|
111
|
+
} ) {
|
|
112
|
+
// Use internal state instead of a ref to make sure that the component
|
|
113
|
+
// re-renders when the popover's anchor updates.
|
|
114
|
+
const [ popoverAnchor, setPopoverAnchor ] = useState( null );
|
|
115
|
+
const [ isAltDialogOpen, setIsAltDialogOpen ] = useState( false );
|
|
116
|
+
const [ isTitleDialogOpen, setIsTitleDialogOpen ] = useState( false );
|
|
117
|
+
return (
|
|
118
|
+
<>
|
|
119
|
+
<ToolbarItem ref={ setPopoverAnchor }>
|
|
120
|
+
{ ( toggleProps ) => (
|
|
121
|
+
<DropdownMenu
|
|
122
|
+
icon={ chevronDown }
|
|
123
|
+
/* translators: button label text should, if possible, be under 16 characters. */
|
|
124
|
+
label={ __( 'More' ) }
|
|
125
|
+
toggleProps={ {
|
|
126
|
+
...toggleProps,
|
|
127
|
+
description: __( 'Displays more controls.' ),
|
|
128
|
+
} }
|
|
129
|
+
popoverProps={ WRITEMODE_POPOVER_PROPS }
|
|
130
|
+
>
|
|
131
|
+
{ ( { onClose } ) => (
|
|
132
|
+
<>
|
|
133
|
+
<MenuItem
|
|
134
|
+
onClick={ () => {
|
|
135
|
+
setIsAltDialogOpen( true );
|
|
136
|
+
onClose();
|
|
137
|
+
} }
|
|
138
|
+
aria-haspopup="dialog"
|
|
139
|
+
>
|
|
140
|
+
{ _x(
|
|
141
|
+
'Alternative text',
|
|
142
|
+
'Alternative text for an image. Block toolbar label, a low character count is preferred.'
|
|
143
|
+
) }
|
|
144
|
+
</MenuItem>
|
|
145
|
+
<MenuItem
|
|
146
|
+
onClick={ () => {
|
|
147
|
+
setIsTitleDialogOpen( true );
|
|
148
|
+
onClose();
|
|
149
|
+
} }
|
|
150
|
+
aria-haspopup="dialog"
|
|
151
|
+
>
|
|
152
|
+
{ __( 'Title text' ) }
|
|
153
|
+
</MenuItem>
|
|
154
|
+
</>
|
|
155
|
+
) }
|
|
156
|
+
</DropdownMenu>
|
|
157
|
+
) }
|
|
158
|
+
</ToolbarItem>
|
|
159
|
+
{ isAltDialogOpen && (
|
|
160
|
+
<Popover
|
|
161
|
+
placement="bottom-start"
|
|
162
|
+
anchor={ popoverAnchor }
|
|
163
|
+
onClose={ () => setIsAltDialogOpen( false ) }
|
|
164
|
+
offset={ 13 }
|
|
165
|
+
variant="toolbar"
|
|
166
|
+
>
|
|
167
|
+
<div className="wp-block-image__toolbar_content_textarea__container">
|
|
168
|
+
<TextareaControl
|
|
169
|
+
className="wp-block-image__toolbar_content_textarea"
|
|
170
|
+
label={ __( 'Alternative text' ) }
|
|
171
|
+
value={ attributes.alt || '' }
|
|
172
|
+
onChange={ ( value ) =>
|
|
173
|
+
setAttributes( { alt: value } )
|
|
174
|
+
}
|
|
175
|
+
disabled={ lockAltControls }
|
|
176
|
+
help={
|
|
177
|
+
lockAltControls ? (
|
|
178
|
+
<>{ lockAltControlsMessage }</>
|
|
179
|
+
) : (
|
|
180
|
+
<>
|
|
181
|
+
<ExternalLink
|
|
182
|
+
href={
|
|
183
|
+
// translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations.
|
|
184
|
+
__(
|
|
185
|
+
'https://www.w3.org/WAI/tutorials/images/decision-tree/'
|
|
186
|
+
)
|
|
187
|
+
}
|
|
188
|
+
>
|
|
189
|
+
{ __(
|
|
190
|
+
'Describe the purpose of the image.'
|
|
191
|
+
) }
|
|
192
|
+
</ExternalLink>
|
|
193
|
+
<br />
|
|
194
|
+
{ __( 'Leave empty if decorative.' ) }
|
|
195
|
+
</>
|
|
196
|
+
)
|
|
197
|
+
}
|
|
198
|
+
__nextHasNoMarginBottom
|
|
199
|
+
/>
|
|
200
|
+
</div>
|
|
201
|
+
</Popover>
|
|
202
|
+
) }
|
|
203
|
+
{ isTitleDialogOpen && (
|
|
204
|
+
<Popover
|
|
205
|
+
placement="bottom-start"
|
|
206
|
+
anchor={ popoverAnchor }
|
|
207
|
+
onClose={ () => setIsTitleDialogOpen( false ) }
|
|
208
|
+
offset={ 13 }
|
|
209
|
+
variant="toolbar"
|
|
210
|
+
>
|
|
211
|
+
<div className="wp-block-image__toolbar_content_textarea__container">
|
|
212
|
+
<TextControl
|
|
213
|
+
__next40pxDefaultSize
|
|
214
|
+
className="wp-block-image__toolbar_content_textarea"
|
|
215
|
+
__nextHasNoMarginBottom
|
|
216
|
+
label={ __( 'Title attribute' ) }
|
|
217
|
+
value={ attributes.title || '' }
|
|
218
|
+
onChange={ ( value ) =>
|
|
219
|
+
setAttributes( {
|
|
220
|
+
title: value,
|
|
221
|
+
} )
|
|
222
|
+
}
|
|
223
|
+
disabled={ lockTitleControls }
|
|
224
|
+
help={
|
|
225
|
+
lockTitleControls ? (
|
|
226
|
+
<>{ lockTitleControlsMessage }</>
|
|
227
|
+
) : (
|
|
228
|
+
<>
|
|
229
|
+
{ __(
|
|
230
|
+
'Describe the role of this image on the page.'
|
|
231
|
+
) }
|
|
232
|
+
<ExternalLink href="https://www.w3.org/TR/html52/dom.html#the-title-attribute">
|
|
233
|
+
{ __(
|
|
234
|
+
'(Note: many devices and browsers do not display this text.)'
|
|
235
|
+
) }
|
|
236
|
+
</ExternalLink>
|
|
237
|
+
</>
|
|
238
|
+
)
|
|
239
|
+
}
|
|
240
|
+
/>
|
|
241
|
+
</div>
|
|
242
|
+
</Popover>
|
|
243
|
+
) }
|
|
244
|
+
</>
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
|
|
97
248
|
export default function Image( {
|
|
98
249
|
temporaryURL,
|
|
99
250
|
attributes,
|
|
@@ -625,112 +776,15 @@ export default function Image( {
|
|
|
625
776
|
// Add some extra controls for content attributes when content only mode is active.
|
|
626
777
|
// With content only mode active, the inspector is hidden, so users need another way
|
|
627
778
|
// to edit these attributes.
|
|
628
|
-
<BlockControls group="
|
|
629
|
-
<
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
onKeyDown={ ( event ) => {
|
|
637
|
-
if ( ! isOpen && event.keyCode === DOWN ) {
|
|
638
|
-
event.preventDefault();
|
|
639
|
-
onToggle();
|
|
640
|
-
}
|
|
641
|
-
} }
|
|
642
|
-
>
|
|
643
|
-
{ _x(
|
|
644
|
-
'Alternative text',
|
|
645
|
-
'Alternative text for an image. Block toolbar label, a low character count is preferred.'
|
|
646
|
-
) }
|
|
647
|
-
</ToolbarButton>
|
|
648
|
-
) }
|
|
649
|
-
renderContent={ () => (
|
|
650
|
-
<TextareaControl
|
|
651
|
-
className="wp-block-image__toolbar_content_textarea"
|
|
652
|
-
label={ __( 'Alternative text' ) }
|
|
653
|
-
value={ alt || '' }
|
|
654
|
-
onChange={ updateAlt }
|
|
655
|
-
disabled={ lockAltControls }
|
|
656
|
-
help={
|
|
657
|
-
lockAltControls ? (
|
|
658
|
-
<>{ lockAltControlsMessage }</>
|
|
659
|
-
) : (
|
|
660
|
-
<>
|
|
661
|
-
<ExternalLink
|
|
662
|
-
href={
|
|
663
|
-
// translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations.
|
|
664
|
-
__(
|
|
665
|
-
'https://www.w3.org/WAI/tutorials/images/decision-tree/'
|
|
666
|
-
)
|
|
667
|
-
}
|
|
668
|
-
>
|
|
669
|
-
{ __(
|
|
670
|
-
'Describe the purpose of the image.'
|
|
671
|
-
) }
|
|
672
|
-
</ExternalLink>
|
|
673
|
-
<br />
|
|
674
|
-
{ __(
|
|
675
|
-
'Leave empty if decorative.'
|
|
676
|
-
) }
|
|
677
|
-
</>
|
|
678
|
-
)
|
|
679
|
-
}
|
|
680
|
-
__nextHasNoMarginBottom
|
|
681
|
-
/>
|
|
682
|
-
) }
|
|
779
|
+
<BlockControls group="block">
|
|
780
|
+
<ContentOnlyControls
|
|
781
|
+
attributes={ attributes }
|
|
782
|
+
setAttributes={ setAttributes }
|
|
783
|
+
lockAltControls={ lockAltControls }
|
|
784
|
+
lockAltControlsMessage={ lockAltControlsMessage }
|
|
785
|
+
lockTitleControls={ lockTitleControls }
|
|
786
|
+
lockTitleControlsMessage={ lockTitleControlsMessage }
|
|
683
787
|
/>
|
|
684
|
-
{ title && (
|
|
685
|
-
<Dropdown
|
|
686
|
-
popoverProps={ { position: 'bottom right' } }
|
|
687
|
-
renderToggle={ ( { isOpen, onToggle } ) => (
|
|
688
|
-
<ToolbarButton
|
|
689
|
-
onClick={ onToggle }
|
|
690
|
-
aria-haspopup="true"
|
|
691
|
-
aria-expanded={ isOpen }
|
|
692
|
-
onKeyDown={ ( event ) => {
|
|
693
|
-
if (
|
|
694
|
-
! isOpen &&
|
|
695
|
-
event.keyCode === DOWN
|
|
696
|
-
) {
|
|
697
|
-
event.preventDefault();
|
|
698
|
-
onToggle();
|
|
699
|
-
}
|
|
700
|
-
} }
|
|
701
|
-
>
|
|
702
|
-
{ __( 'Title' ) }
|
|
703
|
-
</ToolbarButton>
|
|
704
|
-
) }
|
|
705
|
-
renderContent={ () => (
|
|
706
|
-
<TextControl
|
|
707
|
-
__next40pxDefaultSize
|
|
708
|
-
className="wp-block-image__toolbar_content_textarea"
|
|
709
|
-
__nextHasNoMarginBottom
|
|
710
|
-
label={ __( 'Title attribute' ) }
|
|
711
|
-
value={ title || '' }
|
|
712
|
-
onChange={ onSetTitle }
|
|
713
|
-
disabled={ lockTitleControls }
|
|
714
|
-
help={
|
|
715
|
-
lockTitleControls ? (
|
|
716
|
-
<>{ lockTitleControlsMessage }</>
|
|
717
|
-
) : (
|
|
718
|
-
<>
|
|
719
|
-
{ __(
|
|
720
|
-
'Describe the role of this image on the page.'
|
|
721
|
-
) }
|
|
722
|
-
<ExternalLink href="https://www.w3.org/TR/html52/dom.html#the-title-attribute">
|
|
723
|
-
{ __(
|
|
724
|
-
'(Note: many devices and browsers do not display this text.)'
|
|
725
|
-
) }
|
|
726
|
-
</ExternalLink>
|
|
727
|
-
</>
|
|
728
|
-
)
|
|
729
|
-
}
|
|
730
|
-
/>
|
|
731
|
-
) }
|
|
732
|
-
/>
|
|
733
|
-
) }
|
|
734
788
|
</BlockControls>
|
|
735
789
|
) }
|
|
736
790
|
<InspectorControls>
|
|
@@ -842,6 +896,16 @@ export default function Image( {
|
|
|
842
896
|
const shadowProps = getShadowClassesAndStyles( attributes );
|
|
843
897
|
const isRounded = attributes.className?.includes( 'is-style-rounded' );
|
|
844
898
|
|
|
899
|
+
const { postType, postId, queryId } = context;
|
|
900
|
+
const isDescendentOfQueryLoop = Number.isFinite( queryId );
|
|
901
|
+
|
|
902
|
+
const [ , setFeaturedImage ] = useEntityProp(
|
|
903
|
+
'postType',
|
|
904
|
+
postType,
|
|
905
|
+
'featured_media',
|
|
906
|
+
postId
|
|
907
|
+
);
|
|
908
|
+
|
|
845
909
|
let img =
|
|
846
910
|
temporaryURL && hasImageErrored ? (
|
|
847
911
|
// Show a placeholder during upload when the blob URL can't be loaded. This can
|
|
@@ -1043,10 +1107,37 @@ export default function Image( {
|
|
|
1043
1107
|
);
|
|
1044
1108
|
}
|
|
1045
1109
|
|
|
1110
|
+
/**
|
|
1111
|
+
* Set the post's featured image with the current image.
|
|
1112
|
+
*/
|
|
1113
|
+
const setPostFeatureImage = () => {
|
|
1114
|
+
setFeaturedImage( id );
|
|
1115
|
+
createSuccessNotice( __( 'Post featured image updated.' ), {
|
|
1116
|
+
type: 'snackbar',
|
|
1117
|
+
} );
|
|
1118
|
+
};
|
|
1119
|
+
|
|
1120
|
+
const featuredImageControl = (
|
|
1121
|
+
<BlockSettingsMenuControls>
|
|
1122
|
+
{ ( { selectedClientIds } ) =>
|
|
1123
|
+
selectedClientIds.length === 1 &&
|
|
1124
|
+
! isDescendentOfQueryLoop &&
|
|
1125
|
+
postId &&
|
|
1126
|
+
id &&
|
|
1127
|
+
clientId === selectedClientIds[ 0 ] && (
|
|
1128
|
+
<MenuItem onClick={ setPostFeatureImage }>
|
|
1129
|
+
{ __( 'Set featured image' ) }
|
|
1130
|
+
</MenuItem>
|
|
1131
|
+
)
|
|
1132
|
+
}
|
|
1133
|
+
</BlockSettingsMenuControls>
|
|
1134
|
+
);
|
|
1135
|
+
|
|
1046
1136
|
return (
|
|
1047
1137
|
<>
|
|
1048
1138
|
{ mediaReplaceFlow }
|
|
1049
1139
|
{ controls }
|
|
1140
|
+
{ featuredImageControl }
|
|
1050
1141
|
{ img }
|
|
1051
1142
|
|
|
1052
1143
|
<Caption
|
package/src/image/style.scss
CHANGED
|
@@ -12,7 +12,7 @@ exports[`Image block transformations to Columns block 1`] = `
|
|
|
12
12
|
|
|
13
13
|
exports[`Image block transformations to Cover block 1`] = `
|
|
14
14
|
"<!-- wp:cover {"url":"https://cldup.com/cXyG__fTLN.jpg","id":1,"dimRatio":50,"style":{"color":{}}} -->
|
|
15
|
-
<div class="wp-block-cover"><
|
|
15
|
+
<div class="wp-block-cover"><img class="wp-block-cover__image-background wp-image-1" alt="" src="https://cldup.com/cXyG__fTLN.jpg" data-object-fit="cover"/><span aria-hidden="true" class="wp-block-cover__background has-background-dim"></span><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","fontSize":"large"} -->
|
|
16
16
|
<p class="has-text-align-center has-large-font-size">Mountain</p>
|
|
17
17
|
<!-- /wp:paragraph --></div></div>
|
|
18
18
|
<!-- /wp:cover -->"
|
package/src/latest-posts/edit.js
CHANGED
|
@@ -238,7 +238,6 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
|
|
|
238
238
|
/>
|
|
239
239
|
{ displayPostContent && (
|
|
240
240
|
<RadioControl
|
|
241
|
-
className="wp-block-latest-posts__post-content-radio"
|
|
242
241
|
label={ __( 'Show' ) }
|
|
243
242
|
selected={ displayPostContentRadio }
|
|
244
243
|
options={ [
|
|
@@ -18,14 +18,3 @@
|
|
|
18
18
|
padding-left: 0;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
// Apply the same styles that would be applied to
|
|
23
|
-
// ".block-editor-block-inspector .components-base-control"
|
|
24
|
-
// (see packages/block-editor/src/components/block-inspector/style.scss)
|
|
25
|
-
.wp-block-latest-posts__post-content-radio {
|
|
26
|
-
margin-bottom: #{ $grid-unit-30 };
|
|
27
|
-
|
|
28
|
-
&:last-child {
|
|
29
|
-
margin-bottom: $grid-unit-10;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -14,7 +14,7 @@ exports[`Media & Text block transformations with Image to Columns block 1`] = `
|
|
|
14
14
|
|
|
15
15
|
exports[`Media & Text block transformations with Image to Cover block 1`] = `
|
|
16
16
|
"<!-- wp:cover {"url":"https://cldup.com/cXyG__fTLN.jpg","id":4674,"dimRatio":50,"align":"wide"} -->
|
|
17
|
-
<div class="wp-block-cover alignwide"><
|
|
17
|
+
<div class="wp-block-cover alignwide"><img class="wp-block-cover__image-background wp-image-4674" alt="" src="https://cldup.com/cXyG__fTLN.jpg" data-object-fit="cover"/><span aria-hidden="true" class="wp-block-cover__background has-background-dim"></span><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"className":"has-large-font-size"} -->
|
|
18
18
|
<p class="has-large-font-size">Mountain</p>
|
|
19
19
|
<!-- /wp:paragraph --></div></div>
|
|
20
20
|
<!-- /wp:cover -->"
|
|
@@ -50,7 +50,7 @@ exports[`Media & Text block transformations with Video to Columns block 1`] = `
|
|
|
50
50
|
|
|
51
51
|
exports[`Media & Text block transformations with Video to Cover block 1`] = `
|
|
52
52
|
"<!-- wp:cover {"url":"https://i.cloudup.com/YtZFJbuQCE.mov","id":4675,"dimRatio":50,"backgroundType":"video","align":"wide"} -->
|
|
53
|
-
<div class="wp-block-cover alignwide"><
|
|
53
|
+
<div class="wp-block-cover alignwide"><video class="wp-block-cover__video-background intrinsic-ignore" autoplay muted loop playsinline src="https://i.cloudup.com/YtZFJbuQCE.mov" data-object-fit="cover"></video><span aria-hidden="true" class="wp-block-cover__background has-background-dim"></span><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"className":"has-large-font-size"} -->
|
|
54
54
|
<p class="has-large-font-size">Cloudup</p>
|
|
55
55
|
<!-- /wp:paragraph --></div></div>
|
|
56
56
|
<!-- /wp:cover -->"
|
|
@@ -73,33 +73,6 @@ import AccessibleDescription from './accessible-description';
|
|
|
73
73
|
import AccessibleMenuDescription from './accessible-menu-description';
|
|
74
74
|
import { unlock } from '../../lock-unlock';
|
|
75
75
|
|
|
76
|
-
function useResponsiveMenu( navRef ) {
|
|
77
|
-
const [ isResponsiveMenuOpen, setResponsiveMenuVisibility ] =
|
|
78
|
-
useState( false );
|
|
79
|
-
|
|
80
|
-
useEffect( () => {
|
|
81
|
-
if ( ! navRef.current ) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const htmlElement = navRef.current.ownerDocument.documentElement;
|
|
86
|
-
|
|
87
|
-
// Add a `has-modal-open` class to the <html> when the responsive
|
|
88
|
-
// menu is open. This reproduces the same behavior of the frontend.
|
|
89
|
-
if ( isResponsiveMenuOpen ) {
|
|
90
|
-
htmlElement.classList.add( 'has-modal-open' );
|
|
91
|
-
} else {
|
|
92
|
-
htmlElement.classList.remove( 'has-modal-open' );
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return () => {
|
|
96
|
-
htmlElement?.classList.remove( 'has-modal-open' );
|
|
97
|
-
};
|
|
98
|
-
}, [ navRef, isResponsiveMenuOpen ] );
|
|
99
|
-
|
|
100
|
-
return [ isResponsiveMenuOpen, setResponsiveMenuVisibility ];
|
|
101
|
-
}
|
|
102
|
-
|
|
103
76
|
function ColorTools( {
|
|
104
77
|
textColor,
|
|
105
78
|
setTextColor,
|
|
@@ -311,10 +284,8 @@ function Navigation( {
|
|
|
311
284
|
__unstableMarkNextChangeAsNotPersistent,
|
|
312
285
|
} = useDispatch( blockEditorStore );
|
|
313
286
|
|
|
314
|
-
const navRef = useRef();
|
|
315
|
-
|
|
316
287
|
const [ isResponsiveMenuOpen, setResponsiveMenuVisibility ] =
|
|
317
|
-
|
|
288
|
+
useState( false );
|
|
318
289
|
|
|
319
290
|
const [ overlayMenuPreview, setOverlayMenuPreview ] = useState( false );
|
|
320
291
|
|
|
@@ -396,6 +367,8 @@ function Navigation( {
|
|
|
396
367
|
__unstableMarkNextChangeAsNotPersistent,
|
|
397
368
|
] );
|
|
398
369
|
|
|
370
|
+
const navRef = useRef();
|
|
371
|
+
|
|
399
372
|
// The standard HTML5 tag for the block wrapper.
|
|
400
373
|
const TagName = 'nav';
|
|
401
374
|
|
package/src/navigation/index.php
CHANGED
|
@@ -813,7 +813,7 @@ function block_core_navigation_add_directives_to_submenu( $tags, $block_attribut
|
|
|
813
813
|
) ) {
|
|
814
814
|
// Add directives to the parent `<li>`.
|
|
815
815
|
$tags->set_attribute( 'data-wp-interactive', 'core/navigation' );
|
|
816
|
-
$tags->set_attribute( 'data-wp-context', '{ "submenuOpenedBy": { "click": false, "hover": false, "focus": false }, "type": "submenu" }' );
|
|
816
|
+
$tags->set_attribute( 'data-wp-context', '{ "submenuOpenedBy": { "click": false, "hover": false, "focus": false }, "type": "submenu", "modal": null }' );
|
|
817
817
|
$tags->set_attribute( 'data-wp-watch', 'callbacks.initMenu' );
|
|
818
818
|
$tags->set_attribute( 'data-wp-on--focusout', 'actions.handleMenuFocusout' );
|
|
819
819
|
$tags->set_attribute( 'data-wp-on--keydown', 'actions.handleMenuKeydown' );
|
package/src/paragraph/edit.js
CHANGED
|
@@ -83,7 +83,7 @@ function DropCapControl( { clientId, attributes, setAttributes } ) {
|
|
|
83
83
|
checked={ !! dropCap }
|
|
84
84
|
onChange={ () => setAttributes( { dropCap: ! dropCap } ) }
|
|
85
85
|
help={ helpText }
|
|
86
|
-
disabled={ hasDropCapDisabled( align )
|
|
86
|
+
disabled={ hasDropCapDisabled( align ) }
|
|
87
87
|
/>
|
|
88
88
|
</ToolsPanelItem>
|
|
89
89
|
);
|