@wordpress/block-library 8.31.0 → 8.32.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/block/edit.js +5 -8
- package/build/block/edit.js.map +1 -1
- package/build/button/edit.native.js +1 -1
- package/build/button/edit.native.js.map +1 -1
- package/build/image/edit.js +10 -39
- package/build/image/edit.js.map +1 -1
- package/build/image/image.js +27 -6
- package/build/image/image.js.map +1 -1
- package/build/navigation/view.js +12 -2
- package/build/navigation/view.js.map +1 -1
- package/build/navigation-link/edit.js +41 -18
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-submenu/edit.js +27 -9
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/pattern/edit.js +3 -1
- package/build/pattern/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +12 -3
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-featured-image/index.js +8 -3
- package/build/post-featured-image/index.js.map +1 -1
- package/build/post-featured-image/overlay-controls.js +82 -0
- package/build/post-featured-image/overlay-controls.js.map +1 -0
- package/build/post-featured-image/overlay.js +5 -54
- package/build/post-featured-image/overlay.js.map +1 -1
- package/build/quote/edit.js +18 -23
- package/build/quote/edit.js.map +1 -1
- package/build/site-tagline/edit.js +13 -4
- package/build/site-tagline/edit.js.map +1 -1
- package/build/site-tagline/index.js +4 -0
- package/build/site-tagline/index.js.map +1 -1
- package/build/template-part/edit/index.js +55 -47
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/edit/inner-blocks.js +106 -10
- package/build/template-part/edit/inner-blocks.js.map +1 -1
- package/build/template-part/edit/selection-modal.js +1 -9
- package/build/template-part/edit/selection-modal.js.map +1 -1
- package/build/utils/caption.js +19 -13
- package/build/utils/caption.js.map +1 -1
- package/build/utils/hooks.js +1 -0
- package/build/utils/hooks.js.map +1 -1
- package/build-module/block/edit.js +5 -8
- package/build-module/block/edit.js.map +1 -1
- package/build-module/button/edit.native.js +1 -1
- package/build-module/button/edit.native.js.map +1 -1
- package/build-module/image/edit.js +11 -40
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/image.js +27 -6
- package/build-module/image/image.js.map +1 -1
- package/build-module/navigation/view.js +12 -2
- package/build-module/navigation/view.js.map +1 -1
- package/build-module/navigation-link/edit.js +43 -20
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +27 -9
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/pattern/edit.js +3 -1
- package/build-module/pattern/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +12 -3
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-featured-image/index.js +8 -3
- package/build-module/post-featured-image/index.js.map +1 -1
- package/build-module/post-featured-image/overlay-controls.js +75 -0
- package/build-module/post-featured-image/overlay-controls.js.map +1 -0
- package/build-module/post-featured-image/overlay.js +7 -56
- package/build-module/post-featured-image/overlay.js.map +1 -1
- package/build-module/quote/edit.js +20 -25
- package/build-module/quote/edit.js.map +1 -1
- package/build-module/site-tagline/edit.js +14 -5
- package/build-module/site-tagline/edit.js.map +1 -1
- package/build-module/site-tagline/index.js +4 -0
- package/build-module/site-tagline/index.js.map +1 -1
- package/build-module/template-part/edit/index.js +58 -50
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/edit/inner-blocks.js +108 -12
- package/build-module/template-part/edit/inner-blocks.js.map +1 -1
- package/build-module/template-part/edit/selection-modal.js +2 -10
- package/build-module/template-part/edit/selection-modal.js.map +1 -1
- package/build-module/utils/caption.js +19 -13
- package/build-module/utils/caption.js.map +1 -1
- package/build-module/utils/hooks.js +1 -0
- package/build-module/utils/hooks.js.map +1 -1
- package/build-style/audio/theme-rtl.css +1 -1
- package/build-style/audio/theme.css +1 -1
- package/build-style/cover/style-rtl.css +5 -2
- package/build-style/cover/style.css +5 -2
- package/build-style/editor-rtl.css +12 -8
- package/build-style/editor.css +12 -8
- package/build-style/embed/theme-rtl.css +1 -1
- package/build-style/embed/theme.css +1 -1
- package/build-style/image/theme-rtl.css +1 -1
- package/build-style/image/theme.css +1 -1
- package/build-style/pullquote/theme-rtl.css +2 -1
- package/build-style/pullquote/theme.css +2 -1
- package/build-style/quote/theme-rtl.css +6 -6
- package/build-style/quote/theme.css +6 -6
- package/build-style/search/style-rtl.css +10 -0
- package/build-style/search/style.css +10 -0
- package/build-style/social-links/editor-rtl.css +0 -4
- package/build-style/social-links/editor.css +0 -4
- package/build-style/style-rtl.css +15 -2
- package/build-style/style.css +15 -2
- package/build-style/table/theme-rtl.css +4 -3
- package/build-style/table/theme.css +4 -3
- package/build-style/template-part/editor-rtl.css +12 -4
- package/build-style/template-part/editor.css +12 -4
- package/build-style/template-part/theme-rtl.css +1 -1
- package/build-style/template-part/theme.css +1 -1
- package/build-style/theme-rtl.css +17 -15
- package/build-style/theme.css +17 -15
- package/build-style/video/theme-rtl.css +1 -1
- package/build-style/video/theme.css +1 -1
- package/package.json +34 -34
- package/src/audio/theme.scss +1 -1
- package/src/block/edit.js +5 -17
- package/src/button/edit.native.js +1 -1
- package/src/cover/style.scss +6 -2
- package/src/embed/theme.scss +1 -1
- package/src/gallery/editor.scss +1 -1
- package/src/gallery/index.php +1 -1
- package/src/image/edit.js +11 -40
- package/src/image/editor.scss +2 -2
- package/src/image/image.js +25 -7
- package/src/image/theme.scss +1 -1
- package/src/navigation/index.php +8 -0
- package/src/navigation/view.js +11 -2
- package/src/navigation-link/edit.js +53 -27
- package/src/navigation-submenu/edit.js +30 -10
- package/src/pattern/edit.js +4 -0
- package/src/post-featured-image/block.json +8 -3
- package/src/post-featured-image/edit.js +12 -1
- package/src/post-featured-image/editor.scss +1 -1
- package/src/post-featured-image/overlay-controls.js +88 -0
- package/src/post-featured-image/overlay.js +17 -84
- package/src/pullquote/theme.scss +3 -1
- package/src/query-no-results/index.php +2 -0
- package/src/query-pagination-next/index.php +2 -0
- package/src/query-pagination-numbers/index.php +2 -0
- package/src/quote/edit.js +27 -43
- package/src/quote/test/edit.native.js +4 -6
- package/src/quote/theme.scss +1 -2
- package/src/search/style.scss +11 -0
- package/src/site-logo/editor.scss +2 -2
- package/src/site-tagline/block.json +4 -0
- package/src/site-tagline/edit.js +16 -3
- package/src/site-tagline/index.php +9 -1
- package/src/social-links/editor.scss +1 -9
- package/src/table/theme.scss +4 -2
- package/src/template-part/edit/index.js +87 -79
- package/src/template-part/edit/inner-blocks.js +126 -13
- package/src/template-part/edit/selection-modal.js +1 -22
- package/src/template-part/editor.scss +11 -3
- package/src/template-part/index.php +2 -0
- package/src/template-part/theme.scss +1 -1
- package/src/utils/caption.js +19 -16
- package/src/utils/hooks.js +1 -0
- package/src/video/editor.scss +2 -2
- package/src/video/theme.scss +1 -1
|
@@ -61,7 +61,6 @@
|
|
|
61
61
|
"supports": {
|
|
62
62
|
"align": [ "left", "right", "center", "wide", "full" ],
|
|
63
63
|
"color": {
|
|
64
|
-
"__experimentalDuotone": "img, .wp-block-post-featured-image__placeholder, .components-placeholder__illustration, .components-placeholder::before",
|
|
65
64
|
"text": false,
|
|
66
65
|
"background": false
|
|
67
66
|
},
|
|
@@ -69,7 +68,6 @@
|
|
|
69
68
|
"color": true,
|
|
70
69
|
"radius": true,
|
|
71
70
|
"width": true,
|
|
72
|
-
"__experimentalSelector": "img, .block-editor-media-placeholder, .wp-block-post-featured-image__overlay",
|
|
73
71
|
"__experimentalSkipSerialization": true,
|
|
74
72
|
"__experimentalDefaultControls": {
|
|
75
73
|
"color": true,
|
|
@@ -77,6 +75,9 @@
|
|
|
77
75
|
"width": true
|
|
78
76
|
}
|
|
79
77
|
},
|
|
78
|
+
"filter": {
|
|
79
|
+
"duotone": true
|
|
80
|
+
},
|
|
80
81
|
"shadow": {
|
|
81
82
|
"__experimentalSkipSerialization": true
|
|
82
83
|
},
|
|
@@ -90,7 +91,11 @@
|
|
|
90
91
|
}
|
|
91
92
|
},
|
|
92
93
|
"selectors": {
|
|
93
|
-
"
|
|
94
|
+
"border": ".wp-block-post-featured-image img, .wp-block-post-featured-image .block-editor-media-placeholder, .wp-block-post-featured-image .wp-block-post-featured-image__overlay",
|
|
95
|
+
"shadow": ".wp-block-post-featured-image img, .wp-block-post-featured-image .components-placeholder",
|
|
96
|
+
"filter": {
|
|
97
|
+
"duotone": ".wp-block-post-featured-image img, .wp-block-post-featured-image .wp-block-post-featured-image__placeholder, .wp-block-post-featured-image .components-placeholder__illustration, .wp-block-post-featured-image .components-placeholder::before"
|
|
98
|
+
}
|
|
94
99
|
},
|
|
95
100
|
"editorStyle": "wp-block-post-featured-image-editor",
|
|
96
101
|
"style": "wp-block-post-featured-image"
|
|
@@ -36,6 +36,7 @@ import { store as noticesStore } from '@wordpress/notices';
|
|
|
36
36
|
* Internal dependencies
|
|
37
37
|
*/
|
|
38
38
|
import DimensionControls from './dimension-controls';
|
|
39
|
+
import OverlayControls from './overlay-controls';
|
|
39
40
|
import Overlay from './overlay';
|
|
40
41
|
|
|
41
42
|
const ALLOWED_MEDIA_TYPES = [ 'image' ];
|
|
@@ -181,7 +182,7 @@ export default function PostFeaturedImageEdit( {
|
|
|
181
182
|
|
|
182
183
|
const controls = blockEditingMode === 'default' && (
|
|
183
184
|
<>
|
|
184
|
-
<
|
|
185
|
+
<OverlayControls
|
|
185
186
|
attributes={ attributes }
|
|
186
187
|
setAttributes={ setAttributes }
|
|
187
188
|
clientId={ clientId }
|
|
@@ -262,6 +263,11 @@ export default function PostFeaturedImageEdit( {
|
|
|
262
263
|
) : (
|
|
263
264
|
placeholder()
|
|
264
265
|
) }
|
|
266
|
+
<Overlay
|
|
267
|
+
attributes={ attributes }
|
|
268
|
+
setAttributes={ setAttributes }
|
|
269
|
+
clientId={ clientId }
|
|
270
|
+
/>
|
|
265
271
|
</div>
|
|
266
272
|
</>
|
|
267
273
|
);
|
|
@@ -367,6 +373,11 @@ export default function PostFeaturedImageEdit( {
|
|
|
367
373
|
) : (
|
|
368
374
|
image
|
|
369
375
|
) }
|
|
376
|
+
<Overlay
|
|
377
|
+
attributes={ attributes }
|
|
378
|
+
setAttributes={ setAttributes }
|
|
379
|
+
clientId={ clientId }
|
|
380
|
+
/>
|
|
370
381
|
</figure>
|
|
371
382
|
</>
|
|
372
383
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Provide special styling for the placeholder.
|
|
2
|
-
// @todo
|
|
2
|
+
// @todo this particular minimal style of placeholder could be componentized further.
|
|
3
3
|
.wp-block-post-featured-image {
|
|
4
4
|
.block-editor-media-placeholder {
|
|
5
5
|
z-index: 1; // Need to put it above the overlay so the upload button works.
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
RangeControl,
|
|
6
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
7
|
+
} from '@wordpress/components';
|
|
8
|
+
import {
|
|
9
|
+
InspectorControls,
|
|
10
|
+
withColors,
|
|
11
|
+
__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,
|
|
12
|
+
__experimentalUseGradient,
|
|
13
|
+
__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,
|
|
14
|
+
} from '@wordpress/block-editor';
|
|
15
|
+
import { compose } from '@wordpress/compose';
|
|
16
|
+
import { __ } from '@wordpress/i18n';
|
|
17
|
+
|
|
18
|
+
const Overlay = ( {
|
|
19
|
+
clientId,
|
|
20
|
+
attributes,
|
|
21
|
+
setAttributes,
|
|
22
|
+
overlayColor,
|
|
23
|
+
setOverlayColor,
|
|
24
|
+
} ) => {
|
|
25
|
+
const { dimRatio } = attributes;
|
|
26
|
+
const { gradientValue, setGradient } = __experimentalUseGradient();
|
|
27
|
+
const colorGradientSettings = useMultipleOriginColorsAndGradients();
|
|
28
|
+
|
|
29
|
+
if ( ! colorGradientSettings.hasColorsOrGradients ) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<InspectorControls group="color">
|
|
35
|
+
<ColorGradientSettingsDropdown
|
|
36
|
+
__experimentalIsRenderedInSidebar
|
|
37
|
+
settings={ [
|
|
38
|
+
{
|
|
39
|
+
colorValue: overlayColor.color,
|
|
40
|
+
gradientValue,
|
|
41
|
+
label: __( 'Overlay' ),
|
|
42
|
+
onColorChange: setOverlayColor,
|
|
43
|
+
onGradientChange: setGradient,
|
|
44
|
+
isShownByDefault: true,
|
|
45
|
+
resetAllFilter: () => ( {
|
|
46
|
+
overlayColor: undefined,
|
|
47
|
+
customOverlayColor: undefined,
|
|
48
|
+
gradient: undefined,
|
|
49
|
+
customGradient: undefined,
|
|
50
|
+
} ),
|
|
51
|
+
},
|
|
52
|
+
] }
|
|
53
|
+
panelId={ clientId }
|
|
54
|
+
{ ...colorGradientSettings }
|
|
55
|
+
/>
|
|
56
|
+
<ToolsPanelItem
|
|
57
|
+
hasValue={ () => dimRatio !== undefined }
|
|
58
|
+
label={ __( 'Overlay opacity' ) }
|
|
59
|
+
onDeselect={ () => setAttributes( { dimRatio: 0 } ) }
|
|
60
|
+
resetAllFilter={ () => ( {
|
|
61
|
+
dimRatio: 0,
|
|
62
|
+
} ) }
|
|
63
|
+
isShownByDefault
|
|
64
|
+
panelId={ clientId }
|
|
65
|
+
>
|
|
66
|
+
<RangeControl
|
|
67
|
+
__nextHasNoMarginBottom
|
|
68
|
+
label={ __( 'Overlay opacity' ) }
|
|
69
|
+
value={ dimRatio }
|
|
70
|
+
onChange={ ( newDimRatio ) =>
|
|
71
|
+
setAttributes( {
|
|
72
|
+
dimRatio: newDimRatio,
|
|
73
|
+
} )
|
|
74
|
+
}
|
|
75
|
+
min={ 0 }
|
|
76
|
+
max={ 100 }
|
|
77
|
+
step={ 10 }
|
|
78
|
+
required
|
|
79
|
+
__next40pxDefaultSize
|
|
80
|
+
/>
|
|
81
|
+
</ToolsPanelItem>
|
|
82
|
+
</InspectorControls>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export default compose( [
|
|
87
|
+
withColors( { overlayColor: 'background-color' } ),
|
|
88
|
+
] )( Overlay );
|
|
@@ -7,35 +7,21 @@ import classnames from 'classnames';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import {
|
|
10
|
-
RangeControl,
|
|
11
|
-
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
12
|
-
} from '@wordpress/components';
|
|
13
|
-
import {
|
|
14
|
-
InspectorControls,
|
|
15
10
|
withColors,
|
|
16
|
-
__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,
|
|
17
11
|
__experimentalUseGradient,
|
|
18
12
|
__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,
|
|
19
13
|
__experimentalUseBorderProps as useBorderProps,
|
|
20
14
|
} from '@wordpress/block-editor';
|
|
21
15
|
import { compose } from '@wordpress/compose';
|
|
22
|
-
import { __ } from '@wordpress/i18n';
|
|
23
16
|
|
|
24
17
|
/**
|
|
25
18
|
* Internal dependencies
|
|
26
19
|
*/
|
|
27
20
|
import { dimRatioToClass } from './utils';
|
|
28
21
|
|
|
29
|
-
const Overlay = ( {
|
|
30
|
-
clientId,
|
|
31
|
-
attributes,
|
|
32
|
-
setAttributes,
|
|
33
|
-
overlayColor,
|
|
34
|
-
setOverlayColor,
|
|
35
|
-
} ) => {
|
|
22
|
+
const Overlay = ( { attributes, overlayColor } ) => {
|
|
36
23
|
const { dimRatio } = attributes;
|
|
37
|
-
const { gradientClass, gradientValue
|
|
38
|
-
__experimentalUseGradient();
|
|
24
|
+
const { gradientClass, gradientValue } = __experimentalUseGradient();
|
|
39
25
|
const colorGradientSettings = useMultipleOriginColorsAndGradients();
|
|
40
26
|
|
|
41
27
|
const borderProps = useBorderProps( attributes );
|
|
@@ -45,79 +31,26 @@ const Overlay = ( {
|
|
|
45
31
|
...borderProps.style,
|
|
46
32
|
};
|
|
47
33
|
|
|
48
|
-
if ( ! colorGradientSettings.hasColorsOrGradients ) {
|
|
34
|
+
if ( ! colorGradientSettings.hasColorsOrGradients || ! dimRatio ) {
|
|
49
35
|
return null;
|
|
50
36
|
}
|
|
51
37
|
|
|
52
38
|
return (
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
},
|
|
66
|
-
borderProps.className
|
|
67
|
-
) }
|
|
68
|
-
style={ overlayStyles }
|
|
69
|
-
/>
|
|
39
|
+
<span
|
|
40
|
+
aria-hidden="true"
|
|
41
|
+
className={ classnames(
|
|
42
|
+
'wp-block-post-featured-image__overlay',
|
|
43
|
+
dimRatioToClass( dimRatio ),
|
|
44
|
+
{
|
|
45
|
+
[ overlayColor.class ]: overlayColor.class,
|
|
46
|
+
'has-background-dim': dimRatio !== undefined,
|
|
47
|
+
'has-background-gradient': gradientValue,
|
|
48
|
+
[ gradientClass ]: gradientClass,
|
|
49
|
+
},
|
|
50
|
+
borderProps.className
|
|
70
51
|
) }
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
__experimentalIsRenderedInSidebar
|
|
74
|
-
settings={ [
|
|
75
|
-
{
|
|
76
|
-
colorValue: overlayColor.color,
|
|
77
|
-
gradientValue,
|
|
78
|
-
label: __( 'Overlay' ),
|
|
79
|
-
onColorChange: setOverlayColor,
|
|
80
|
-
onGradientChange: setGradient,
|
|
81
|
-
isShownByDefault: true,
|
|
82
|
-
resetAllFilter: () => ( {
|
|
83
|
-
overlayColor: undefined,
|
|
84
|
-
customOverlayColor: undefined,
|
|
85
|
-
gradient: undefined,
|
|
86
|
-
customGradient: undefined,
|
|
87
|
-
} ),
|
|
88
|
-
},
|
|
89
|
-
] }
|
|
90
|
-
panelId={ clientId }
|
|
91
|
-
{ ...colorGradientSettings }
|
|
92
|
-
/>
|
|
93
|
-
<ToolsPanelItem
|
|
94
|
-
hasValue={ () => dimRatio !== undefined }
|
|
95
|
-
label={ __( 'Overlay opacity' ) }
|
|
96
|
-
onDeselect={ () => setAttributes( { dimRatio: 0 } ) }
|
|
97
|
-
resetAllFilter={ () => ( {
|
|
98
|
-
dimRatio: 0,
|
|
99
|
-
} ) }
|
|
100
|
-
isShownByDefault
|
|
101
|
-
panelId={ clientId }
|
|
102
|
-
>
|
|
103
|
-
<RangeControl
|
|
104
|
-
__nextHasNoMarginBottom
|
|
105
|
-
label={ __( 'Overlay opacity' ) }
|
|
106
|
-
value={ dimRatio }
|
|
107
|
-
onChange={ ( newDimRatio ) =>
|
|
108
|
-
setAttributes( {
|
|
109
|
-
dimRatio: newDimRatio,
|
|
110
|
-
} )
|
|
111
|
-
}
|
|
112
|
-
min={ 0 }
|
|
113
|
-
max={ 100 }
|
|
114
|
-
step={ 10 }
|
|
115
|
-
required
|
|
116
|
-
__next40pxDefaultSize
|
|
117
|
-
/>
|
|
118
|
-
</ToolsPanelItem>
|
|
119
|
-
</InspectorControls>
|
|
120
|
-
</>
|
|
52
|
+
style={ overlayStyles }
|
|
53
|
+
/>
|
|
121
54
|
);
|
|
122
55
|
};
|
|
123
56
|
|
package/src/pullquote/theme.scss
CHANGED
package/src/quote/edit.js
CHANGED
|
@@ -10,21 +10,21 @@ import { __ } from '@wordpress/i18n';
|
|
|
10
10
|
import {
|
|
11
11
|
AlignmentControl,
|
|
12
12
|
BlockControls,
|
|
13
|
-
RichText,
|
|
14
13
|
useBlockProps,
|
|
15
14
|
useInnerBlocksProps,
|
|
16
15
|
store as blockEditorStore,
|
|
17
16
|
} from '@wordpress/block-editor';
|
|
18
17
|
import { BlockQuotation } from '@wordpress/components';
|
|
19
|
-
import { useDispatch,
|
|
20
|
-
import { createBlock, getDefaultBlockName } from '@wordpress/blocks';
|
|
18
|
+
import { useDispatch, useRegistry } from '@wordpress/data';
|
|
21
19
|
import { Platform, useEffect } from '@wordpress/element';
|
|
22
20
|
import deprecated from '@wordpress/deprecated';
|
|
21
|
+
import { verse } from '@wordpress/icons';
|
|
23
22
|
|
|
24
23
|
/**
|
|
25
24
|
* Internal dependencies
|
|
26
25
|
*/
|
|
27
26
|
import { migrateToQuoteV2 } from './deprecated';
|
|
27
|
+
import { Caption } from '../utils/caption';
|
|
28
28
|
|
|
29
29
|
const isWebPlatform = Platform.OS === 'web';
|
|
30
30
|
|
|
@@ -73,23 +73,12 @@ export default function QuoteEdit( {
|
|
|
73
73
|
clientId,
|
|
74
74
|
className,
|
|
75
75
|
style,
|
|
76
|
+
isSelected,
|
|
76
77
|
} ) {
|
|
77
|
-
const { textAlign
|
|
78
|
+
const { textAlign } = attributes;
|
|
78
79
|
|
|
79
80
|
useMigrateOnLoad( attributes, clientId );
|
|
80
81
|
|
|
81
|
-
const hasSelection = useSelect(
|
|
82
|
-
( select ) => {
|
|
83
|
-
const { isBlockSelected, hasSelectedInnerBlock } =
|
|
84
|
-
select( blockEditorStore );
|
|
85
|
-
return (
|
|
86
|
-
hasSelectedInnerBlock( clientId, true ) ||
|
|
87
|
-
isBlockSelected( clientId )
|
|
88
|
-
);
|
|
89
|
-
},
|
|
90
|
-
[ clientId ]
|
|
91
|
-
);
|
|
92
|
-
|
|
93
82
|
const blockProps = useBlockProps( {
|
|
94
83
|
className: classNames( className, {
|
|
95
84
|
[ `has-text-align-${ textAlign }` ]: textAlign,
|
|
@@ -100,6 +89,7 @@ export default function QuoteEdit( {
|
|
|
100
89
|
template: TEMPLATE,
|
|
101
90
|
templateInsertUpdatesSelection: true,
|
|
102
91
|
__experimentalCaptureToolbars: true,
|
|
92
|
+
renderAppender: false,
|
|
103
93
|
} );
|
|
104
94
|
|
|
105
95
|
return (
|
|
@@ -114,33 +104,27 @@ export default function QuoteEdit( {
|
|
|
114
104
|
</BlockControls>
|
|
115
105
|
<BlockQuotation { ...innerBlocksProps }>
|
|
116
106
|
{ innerBlocksProps.children }
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
createBlock( getDefaultBlockName() )
|
|
139
|
-
)
|
|
140
|
-
}
|
|
141
|
-
{ ...( ! isWebPlatform ? { textAlign } : {} ) }
|
|
142
|
-
/>
|
|
143
|
-
) }
|
|
107
|
+
<Caption
|
|
108
|
+
attributeKey="citation"
|
|
109
|
+
tagName={ isWebPlatform ? 'cite' : undefined }
|
|
110
|
+
style={ isWebPlatform && { display: 'block' } }
|
|
111
|
+
isSelected={ isSelected }
|
|
112
|
+
attributes={ attributes }
|
|
113
|
+
setAttributes={ setAttributes }
|
|
114
|
+
__unstableMobileNoFocusOnMount
|
|
115
|
+
icon={ verse }
|
|
116
|
+
label={ __( 'Quote citation' ) }
|
|
117
|
+
placeholder={
|
|
118
|
+
// translators: placeholder text used for the
|
|
119
|
+
// citation
|
|
120
|
+
__( 'Add citation' )
|
|
121
|
+
}
|
|
122
|
+
addLabel={ __( 'Add citation' ) }
|
|
123
|
+
removeLabel={ __( 'Remove citation' ) }
|
|
124
|
+
className="wp-block-quote__citation"
|
|
125
|
+
insertBlocksAfter={ insertBlocksAfter }
|
|
126
|
+
{ ...( ! isWebPlatform ? { textAlign } : {} ) }
|
|
127
|
+
/>
|
|
144
128
|
</BlockQuotation>
|
|
145
129
|
</>
|
|
146
130
|
);
|
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
getEditorHtml,
|
|
11
11
|
fireEvent,
|
|
12
12
|
within,
|
|
13
|
-
waitFor,
|
|
14
13
|
typeInRichText,
|
|
15
14
|
} from 'test/helpers';
|
|
16
15
|
|
|
@@ -40,14 +39,9 @@ describe( 'Quote', () => {
|
|
|
40
39
|
},
|
|
41
40
|
}
|
|
42
41
|
);
|
|
43
|
-
// Await inner blocks to be rendered
|
|
44
|
-
const citationBlock = await waitFor( () =>
|
|
45
|
-
screen.getByPlaceholderText( 'Add citation' )
|
|
46
|
-
);
|
|
47
42
|
|
|
48
43
|
// Act
|
|
49
44
|
fireEvent.press( quoteBlock );
|
|
50
|
-
// screen.debug();
|
|
51
45
|
let quoteTextInput =
|
|
52
46
|
within( quoteBlock ).getByPlaceholderText( 'Start writing…' );
|
|
53
47
|
typeInRichText( quoteTextInput, 'A great statement.' );
|
|
@@ -61,6 +55,10 @@ describe( 'Quote', () => {
|
|
|
61
55
|
'Start writing…'
|
|
62
56
|
)[ 1 ];
|
|
63
57
|
typeInRichText( quoteTextInput, 'Again.' );
|
|
58
|
+
fireEvent.press( screen.getByLabelText( 'Navigate Up' ) );
|
|
59
|
+
fireEvent.press( screen.getByLabelText( 'Add citation' ) );
|
|
60
|
+
const citationBlock =
|
|
61
|
+
await screen.findByPlaceholderText( 'Add citation' );
|
|
64
62
|
const citationTextInput =
|
|
65
63
|
within( citationBlock ).getByPlaceholderText( 'Add citation' );
|
|
66
64
|
typeInRichText( citationTextInput, 'A person' );
|
package/src/quote/theme.scss
CHANGED
package/src/search/style.scss
CHANGED
|
@@ -97,6 +97,17 @@ $button-spacing-y: math.div($grid-unit-15, 2); // 6px
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
// We are lowering the specificity so that the input element can override the rule for the input element inside the search block.
|
|
101
|
+
:where(.wp-block-search__input) {
|
|
102
|
+
font-family: inherit;
|
|
103
|
+
font-weight: inherit;
|
|
104
|
+
font-size: inherit;
|
|
105
|
+
line-height: inherit;
|
|
106
|
+
letter-spacing: inherit;
|
|
107
|
+
text-transform: inherit;
|
|
108
|
+
font-style: inherit;
|
|
109
|
+
}
|
|
110
|
+
|
|
100
111
|
// We are lowering the specificity so that the button element can override the rule for the button inside the search block.
|
|
101
112
|
:where(.wp-block-search__button-inside .wp-block-search__inside-wrapper) {
|
|
102
113
|
padding: $grid-unit-05;
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
// Provide special styling for the placeholder.
|
|
34
|
-
// @todo
|
|
34
|
+
// @todo this particular minimal style of placeholder could be componentized further.
|
|
35
35
|
.wp-block-site-logo.wp-block-site-logo {
|
|
36
36
|
|
|
37
37
|
&.is-default-size .components-placeholder {
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
border-radius: inherit;
|
|
55
55
|
|
|
56
56
|
// Provide a minimum size for the placeholder, for when the logo is resized.
|
|
57
|
-
// @todo
|
|
57
|
+
// @todo resizing is currently only possible by adding an image, resizing,
|
|
58
58
|
// and then removing the image again. We might want to enable resizing on the
|
|
59
59
|
// placeholder itself.
|
|
60
60
|
min-height: $grid-unit-60;
|
package/src/site-tagline/edit.js
CHANGED
|
@@ -12,17 +12,20 @@ import {
|
|
|
12
12
|
AlignmentControl,
|
|
13
13
|
useBlockProps,
|
|
14
14
|
BlockControls,
|
|
15
|
+
HeadingLevelDropdown,
|
|
15
16
|
RichText,
|
|
16
17
|
} from '@wordpress/block-editor';
|
|
17
18
|
import { __ } from '@wordpress/i18n';
|
|
18
19
|
import { createBlock, getDefaultBlockName } from '@wordpress/blocks';
|
|
19
20
|
|
|
21
|
+
const HEADING_LEVELS = [ 0, 1, 2, 3, 4, 5, 6 ];
|
|
22
|
+
|
|
20
23
|
export default function SiteTaglineEdit( {
|
|
21
24
|
attributes,
|
|
22
25
|
setAttributes,
|
|
23
26
|
insertBlocksAfter,
|
|
24
27
|
} ) {
|
|
25
|
-
const { textAlign } = attributes;
|
|
28
|
+
const { textAlign, level } = attributes;
|
|
26
29
|
const { canUserEdit, tagline } = useSelect( ( select ) => {
|
|
27
30
|
const { canUser, getEntityRecord, getEditedEntityRecord } =
|
|
28
31
|
select( coreStore );
|
|
@@ -38,6 +41,7 @@ export default function SiteTaglineEdit( {
|
|
|
38
41
|
};
|
|
39
42
|
}, [] );
|
|
40
43
|
|
|
44
|
+
const TagName = level === 0 ? 'p' : `h${ level }`;
|
|
41
45
|
const { editEntityRecord } = useDispatch( coreStore );
|
|
42
46
|
|
|
43
47
|
function setTagline( newTagline ) {
|
|
@@ -58,7 +62,7 @@ export default function SiteTaglineEdit( {
|
|
|
58
62
|
onChange={ setTagline }
|
|
59
63
|
aria-label={ __( 'Site tagline text' ) }
|
|
60
64
|
placeholder={ __( 'Write site tagline…' ) }
|
|
61
|
-
tagName=
|
|
65
|
+
tagName={ TagName }
|
|
62
66
|
value={ tagline }
|
|
63
67
|
disableLineBreaks
|
|
64
68
|
__unstableOnSplitAtEnd={ () =>
|
|
@@ -67,11 +71,20 @@ export default function SiteTaglineEdit( {
|
|
|
67
71
|
{ ...blockProps }
|
|
68
72
|
/>
|
|
69
73
|
) : (
|
|
70
|
-
<
|
|
74
|
+
<TagName { ...blockProps }>
|
|
75
|
+
{ tagline || __( 'Site Tagline placeholder' ) }
|
|
76
|
+
</TagName>
|
|
71
77
|
);
|
|
72
78
|
return (
|
|
73
79
|
<>
|
|
74
80
|
<BlockControls group="block">
|
|
81
|
+
<HeadingLevelDropdown
|
|
82
|
+
options={ HEADING_LEVELS }
|
|
83
|
+
value={ level }
|
|
84
|
+
onChange={ ( newLevel ) =>
|
|
85
|
+
setAttributes( { level: newLevel } )
|
|
86
|
+
}
|
|
87
|
+
/>
|
|
75
88
|
<AlignmentControl
|
|
76
89
|
onChange={ ( newAlign ) =>
|
|
77
90
|
setAttributes( { textAlign: newAlign } )
|
|
@@ -19,11 +19,18 @@ function render_block_core_site_tagline( $attributes ) {
|
|
|
19
19
|
if ( ! $site_tagline ) {
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
+
|
|
23
|
+
$tag_name = 'p';
|
|
22
24
|
$align_class_name = empty( $attributes['textAlign'] ) ? '' : "has-text-align-{$attributes['textAlign']}";
|
|
23
25
|
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $align_class_name ) );
|
|
24
26
|
|
|
27
|
+
if ( isset( $attributes['level'] ) && 0 !== $attributes['level'] ) {
|
|
28
|
+
$tag_name = 'h' . (int) $attributes['level'];
|
|
29
|
+
}
|
|
30
|
+
|
|
25
31
|
return sprintf(
|
|
26
|
-
'
|
|
32
|
+
'<%1$s %2$s>%3$s</%1$s>',
|
|
33
|
+
$tag_name,
|
|
27
34
|
$wrapper_attributes,
|
|
28
35
|
$site_tagline
|
|
29
36
|
);
|
|
@@ -42,4 +49,5 @@ function register_block_core_site_tagline() {
|
|
|
42
49
|
)
|
|
43
50
|
);
|
|
44
51
|
}
|
|
52
|
+
|
|
45
53
|
add_action( 'init', 'register_block_core_site_tagline' );
|
|
@@ -4,13 +4,6 @@
|
|
|
4
4
|
display: inline-block;
|
|
5
5
|
margin-left: $grid-unit-10;
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
// Unset background colors that can be inherited from Global Styles.
|
|
9
|
-
// This is a duplicate of a rule in style.scss, as it needs higher specificity in the editor.
|
|
10
|
-
// The rule can be removed if editor styles get lowered in specificity.
|
|
11
|
-
&.wp-block-social-links {
|
|
12
|
-
background: none;
|
|
13
|
-
}
|
|
14
7
|
}
|
|
15
8
|
|
|
16
9
|
// Prevent toolbar from jumping when selecting / hovering a link.
|
|
@@ -74,7 +67,6 @@
|
|
|
74
67
|
.wp-block-social-links .wp-block-social-links__social-prompt {
|
|
75
68
|
min-height: $button-size-small;
|
|
76
69
|
list-style: none;
|
|
77
|
-
order: 2; // Move after the appender button. Because this element is non-interactive, it does not affect tab order.
|
|
78
70
|
|
|
79
71
|
// Show as block UI.
|
|
80
72
|
font-family: $default-font;
|
|
@@ -93,7 +85,7 @@
|
|
|
93
85
|
}
|
|
94
86
|
|
|
95
87
|
// Improve the preview, ensure buttons are fully opaque despite being disabled.
|
|
96
|
-
// @todo
|
|
88
|
+
// @todo Look at improving the preview component to make this unnecessary.
|
|
97
89
|
.block-editor-block-preview__content .components-button:disabled {
|
|
98
90
|
opacity: 1;
|
|
99
91
|
}
|