@wordpress/block-library 9.40.1 → 9.40.2-next.v.202602241322.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/build/icon/block.json +9 -1
- package/build/icon/components/custom-inserter/icon-grid.cjs +1 -1
- package/build/icon/components/custom-inserter/icon-grid.cjs.map +2 -2
- package/build/icon/components/custom-inserter/index.cjs +1 -1
- package/build/icon/components/custom-inserter/index.cjs.map +2 -2
- package/build/icon/edit.cjs +15 -7
- package/build/icon/edit.cjs.map +2 -2
- package/build/image/edit.cjs +1 -1
- package/build/image/edit.cjs.map +2 -2
- package/build/navigation-overlay-close/edit.cjs +2 -3
- package/build/navigation-overlay-close/edit.cjs.map +2 -2
- package/build/post-navigation-link/block.json +1 -3
- package/build/post-navigation-link/deprecated.cjs +100 -0
- package/build/post-navigation-link/deprecated.cjs.map +7 -0
- package/build/post-navigation-link/edit.cjs +2 -36
- package/build/post-navigation-link/edit.cjs.map +3 -3
- package/build/post-navigation-link/index.cjs +2 -0
- package/build/post-navigation-link/index.cjs.map +3 -3
- package/build/post-title/block.json +1 -3
- package/build/post-title/deprecated.cjs +82 -1
- package/build/post-title/deprecated.cjs.map +3 -3
- package/build/post-title/edit.cjs +10 -36
- package/build/post-title/edit.cjs.map +3 -3
- package/build/pullquote/deprecated.cjs +6 -6
- package/build/pullquote/deprecated.cjs.map +2 -2
- package/build/query/block.json +1 -2
- package/build/query-title/block.json +1 -3
- package/build/query-title/deprecated.cjs +70 -1
- package/build/query-title/deprecated.cjs.map +3 -3
- package/build/query-title/edit.cjs +17 -35
- package/build/query-title/edit.cjs.map +3 -3
- package/build/site-tagline/block.json +6 -4
- package/build/site-tagline/deprecated.cjs +66 -1
- package/build/site-tagline/deprecated.cjs.map +3 -3
- package/build/site-tagline/edit.cjs +14 -28
- package/build/site-tagline/edit.cjs.map +3 -3
- package/build/site-title/block.json +1 -3
- package/build/site-title/deprecated.cjs +79 -1
- package/build/site-title/deprecated.cjs.map +3 -3
- package/build/site-title/edit.cjs +14 -30
- package/build/site-title/edit.cjs.map +3 -3
- package/build/tabs-menu-item/block.json +1 -26
- package/build/tabs-menu-item/controls.cjs +2 -100
- package/build/tabs-menu-item/controls.cjs.map +3 -3
- package/build/tabs-menu-item/edit.cjs +6 -65
- package/build/tabs-menu-item/edit.cjs.map +2 -2
- package/build/tabs-menu-item/save.cjs +1 -15
- package/build/tabs-menu-item/save.cjs.map +2 -2
- package/build-module/icon/block.json +9 -1
- package/build-module/icon/components/custom-inserter/icon-grid.mjs +1 -1
- package/build-module/icon/components/custom-inserter/icon-grid.mjs.map +2 -2
- package/build-module/icon/components/custom-inserter/index.mjs +1 -1
- package/build-module/icon/components/custom-inserter/index.mjs.map +2 -2
- package/build-module/icon/edit.mjs +15 -7
- package/build-module/icon/edit.mjs.map +2 -2
- package/build-module/image/edit.mjs +1 -1
- package/build-module/image/edit.mjs.map +2 -2
- package/build-module/navigation-overlay-close/edit.mjs +2 -3
- package/build-module/navigation-overlay-close/edit.mjs.map +2 -2
- package/build-module/post-navigation-link/block.json +1 -3
- package/build-module/post-navigation-link/deprecated.mjs +69 -0
- package/build-module/post-navigation-link/deprecated.mjs.map +7 -0
- package/build-module/post-navigation-link/edit.mjs +3 -30
- package/build-module/post-navigation-link/edit.mjs.map +2 -2
- package/build-module/post-navigation-link/index.mjs +2 -0
- package/build-module/post-navigation-link/index.mjs.map +2 -2
- package/build-module/post-title/block.json +1 -3
- package/build-module/post-title/deprecated.mjs +82 -1
- package/build-module/post-title/deprecated.mjs.map +2 -2
- package/build-module/post-title/edit.mjs +10 -27
- package/build-module/post-title/edit.mjs.map +2 -2
- package/build-module/pullquote/deprecated.mjs +6 -6
- package/build-module/pullquote/deprecated.mjs.map +2 -2
- package/build-module/query/block.json +1 -2
- package/build-module/query-title/block.json +1 -3
- package/build-module/query-title/deprecated.mjs +70 -1
- package/build-module/query-title/deprecated.mjs.map +2 -2
- package/build-module/query-title/edit.mjs +17 -36
- package/build-module/query-title/edit.mjs.map +2 -2
- package/build-module/site-tagline/block.json +6 -4
- package/build-module/site-tagline/deprecated.mjs +66 -1
- package/build-module/site-tagline/deprecated.mjs.map +2 -2
- package/build-module/site-tagline/edit.mjs +14 -29
- package/build-module/site-tagline/edit.mjs.map +2 -2
- package/build-module/site-title/block.json +1 -3
- package/build-module/site-title/deprecated.mjs +79 -1
- package/build-module/site-title/deprecated.mjs.map +2 -2
- package/build-module/site-title/edit.mjs +14 -31
- package/build-module/site-title/edit.mjs.map +2 -2
- package/build-module/tabs-menu-item/block.json +1 -26
- package/build-module/tabs-menu-item/controls.mjs +3 -104
- package/build-module/tabs-menu-item/controls.mjs.map +2 -2
- package/build-module/tabs-menu-item/edit.mjs +6 -66
- package/build-module/tabs-menu-item/edit.mjs.map +2 -2
- package/build-module/tabs-menu-item/save.mjs +1 -15
- package/build-module/tabs-menu-item/save.mjs.map +2 -2
- package/build-style/editor-rtl.css +0 -5
- package/build-style/editor.css +0 -5
- package/build-style/style-rtl.css +3 -12
- package/build-style/style.css +3 -12
- package/build-style/tabs-menu-item/editor-rtl.css +0 -5
- package/build-style/tabs-menu-item/editor.css +0 -5
- package/build-style/tabs-menu-item/style-rtl.css +3 -12
- package/build-style/tabs-menu-item/style.css +3 -12
- package/package.json +38 -38
- package/src/icon/block.json +9 -1
- package/src/icon/components/custom-inserter/icon-grid.js +1 -1
- package/src/icon/components/custom-inserter/index.js +1 -1
- package/src/icon/edit.js +20 -10
- package/src/icon/index.php +1 -3
- package/src/image/edit.js +1 -1
- package/src/image/index.php +1 -4
- package/src/navigation-overlay-close/edit.js +4 -3
- package/src/post-featured-image/index.php +2 -4
- package/src/post-navigation-link/block.json +1 -3
- package/src/post-navigation-link/deprecated.js +72 -0
- package/src/post-navigation-link/edit.js +2 -35
- package/src/post-navigation-link/index.js +2 -0
- package/src/post-title/block.json +1 -3
- package/src/post-title/deprecated.js +86 -1
- package/src/post-title/edit.js +2 -18
- package/src/pullquote/deprecated.js +3 -3
- package/src/query/block.json +1 -2
- package/src/query-title/block.json +1 -3
- package/src/query-title/deprecated.js +74 -1
- package/src/query-title/edit.js +11 -27
- package/src/site-tagline/block.json +6 -4
- package/src/site-tagline/deprecated.js +70 -1
- package/src/site-tagline/edit.js +9 -22
- package/src/site-title/block.json +1 -3
- package/src/site-title/deprecated.js +83 -1
- package/src/site-title/edit.js +9 -22
- package/src/tabs-menu-item/block.json +1 -26
- package/src/tabs-menu-item/controls.js +0 -108
- package/src/tabs-menu-item/edit.js +6 -79
- package/src/tabs-menu-item/editor.scss +0 -6
- package/src/tabs-menu-item/save.js +1 -26
- package/src/tabs-menu-item/style.scss +3 -14
|
@@ -2,6 +2,79 @@
|
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
4
|
import migrateFontFamily from '../utils/migrate-font-family';
|
|
5
|
+
import migrateTextAlign from '../utils/migrate-text-align';
|
|
6
|
+
|
|
7
|
+
const v2 = {
|
|
8
|
+
attributes: {
|
|
9
|
+
type: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
},
|
|
12
|
+
textAlign: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
},
|
|
15
|
+
level: {
|
|
16
|
+
type: 'number',
|
|
17
|
+
default: 1,
|
|
18
|
+
},
|
|
19
|
+
levelOptions: {
|
|
20
|
+
type: 'array',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
supports: {
|
|
24
|
+
anchor: true,
|
|
25
|
+
align: [ 'wide', 'full' ],
|
|
26
|
+
html: false,
|
|
27
|
+
color: {
|
|
28
|
+
gradients: true,
|
|
29
|
+
__experimentalDefaultControls: {
|
|
30
|
+
background: true,
|
|
31
|
+
text: true,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
spacing: {
|
|
35
|
+
padding: true,
|
|
36
|
+
margin: true,
|
|
37
|
+
},
|
|
38
|
+
typography: {
|
|
39
|
+
fontSize: true,
|
|
40
|
+
lineHeight: true,
|
|
41
|
+
__experimentalFontFamily: true,
|
|
42
|
+
__experimentalTextTransform: true,
|
|
43
|
+
__experimentalTextDecoration: true,
|
|
44
|
+
__experimentalFontStyle: true,
|
|
45
|
+
__experimentalFontWeight: true,
|
|
46
|
+
__experimentalLetterSpacing: true,
|
|
47
|
+
__experimentalDefaultControls: {
|
|
48
|
+
fontSize: true,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
interactivity: {
|
|
52
|
+
clientNavigation: true,
|
|
53
|
+
},
|
|
54
|
+
__experimentalBorder: {
|
|
55
|
+
radius: true,
|
|
56
|
+
color: true,
|
|
57
|
+
width: true,
|
|
58
|
+
style: true,
|
|
59
|
+
__experimentalDefaultControls: {
|
|
60
|
+
radius: true,
|
|
61
|
+
color: true,
|
|
62
|
+
width: true,
|
|
63
|
+
style: true,
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
migrate: migrateTextAlign,
|
|
68
|
+
isEligible( attributes ) {
|
|
69
|
+
return (
|
|
70
|
+
!! attributes.textAlign ||
|
|
71
|
+
!! attributes.className?.match(
|
|
72
|
+
/\bhas-text-align-(left|center|right)\b/
|
|
73
|
+
)
|
|
74
|
+
);
|
|
75
|
+
},
|
|
76
|
+
save: () => null,
|
|
77
|
+
};
|
|
5
78
|
|
|
6
79
|
const v1 = {
|
|
7
80
|
attributes: {
|
|
@@ -48,4 +121,4 @@ const v1 = {
|
|
|
48
121
|
*
|
|
49
122
|
* See block-deprecation.md
|
|
50
123
|
*/
|
|
51
|
-
export default [ v1 ];
|
|
124
|
+
export default [ v2, v1 ];
|
package/src/query-title/edit.js
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import clsx from 'clsx';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
9
4
|
import {
|
|
10
|
-
AlignmentControl,
|
|
11
5
|
BlockControls,
|
|
12
6
|
InspectorControls,
|
|
13
7
|
useBlockProps,
|
|
@@ -27,21 +21,19 @@ import { __, _x, sprintf } from '@wordpress/i18n';
|
|
|
27
21
|
import { useArchiveLabel } from './use-archive-label';
|
|
28
22
|
import { usePostTypeLabel } from './use-post-type-label';
|
|
29
23
|
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
24
|
+
import useDeprecatedTextAlign from '../utils/deprecated-text-align-attributes';
|
|
30
25
|
|
|
31
26
|
const SUPPORTED_TYPES = [ 'archive', 'search', 'post-type' ];
|
|
32
27
|
|
|
33
|
-
export default function QueryTitleEdit( {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
levelOptions,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
setAttributes,
|
|
43
|
-
context: { query },
|
|
44
|
-
} ) {
|
|
28
|
+
export default function QueryTitleEdit( props ) {
|
|
29
|
+
useDeprecatedTextAlign( props );
|
|
30
|
+
|
|
31
|
+
const {
|
|
32
|
+
attributes: { type, level, levelOptions, showPrefix, showSearchTerm },
|
|
33
|
+
setAttributes,
|
|
34
|
+
context: { query },
|
|
35
|
+
} = props;
|
|
36
|
+
|
|
45
37
|
const { archiveTypeLabel, archiveNameLabel } = useArchiveLabel();
|
|
46
38
|
const { postTypeLabel } = usePostTypeLabel( query?.postType );
|
|
47
39
|
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
@@ -49,9 +41,7 @@ export default function QueryTitleEdit( {
|
|
|
49
41
|
const TagName = level === 0 ? 'p' : `h${ level }`;
|
|
50
42
|
|
|
51
43
|
const blockProps = useBlockProps( {
|
|
52
|
-
className:
|
|
53
|
-
[ `has-text-align-${ textAlign }` ]: textAlign,
|
|
54
|
-
} ),
|
|
44
|
+
className: 'wp-block-query-title__placeholder',
|
|
55
45
|
} );
|
|
56
46
|
|
|
57
47
|
if ( ! SUPPORTED_TYPES.includes( type ) ) {
|
|
@@ -239,12 +229,6 @@ export default function QueryTitleEdit( {
|
|
|
239
229
|
setAttributes( { level: newLevel } )
|
|
240
230
|
}
|
|
241
231
|
/>
|
|
242
|
-
<AlignmentControl
|
|
243
|
-
value={ textAlign }
|
|
244
|
-
onChange={ ( nextAlign ) => {
|
|
245
|
-
setAttributes( { textAlign: nextAlign } );
|
|
246
|
-
} }
|
|
247
|
-
/>
|
|
248
232
|
</BlockControls>
|
|
249
233
|
{ titleElement }
|
|
250
234
|
</>
|
|
@@ -8,9 +8,6 @@
|
|
|
8
8
|
"keywords": [ "description" ],
|
|
9
9
|
"textdomain": "default",
|
|
10
10
|
"attributes": {
|
|
11
|
-
"textAlign": {
|
|
12
|
-
"type": "string"
|
|
13
|
-
},
|
|
14
11
|
"level": {
|
|
15
12
|
"type": "number",
|
|
16
13
|
"default": 0
|
|
@@ -23,7 +20,11 @@
|
|
|
23
20
|
"example": {
|
|
24
21
|
"viewportWidth": 350,
|
|
25
22
|
"attributes": {
|
|
26
|
-
"
|
|
23
|
+
"style": {
|
|
24
|
+
"typography": {
|
|
25
|
+
"textAlign": "center"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
27
28
|
}
|
|
28
29
|
},
|
|
29
30
|
"supports": {
|
|
@@ -49,6 +50,7 @@
|
|
|
49
50
|
"typography": {
|
|
50
51
|
"fontSize": true,
|
|
51
52
|
"lineHeight": true,
|
|
53
|
+
"textAlign": true,
|
|
52
54
|
"__experimentalFontFamily": true,
|
|
53
55
|
"__experimentalTextTransform": true,
|
|
54
56
|
"__experimentalTextDecoration": true,
|
|
@@ -2,6 +2,75 @@
|
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
4
|
import migrateFontFamily from '../utils/migrate-font-family';
|
|
5
|
+
import migrateTextAlign from '../utils/migrate-text-align';
|
|
6
|
+
|
|
7
|
+
const v2 = {
|
|
8
|
+
attributes: {
|
|
9
|
+
textAlign: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
},
|
|
12
|
+
level: {
|
|
13
|
+
type: 'number',
|
|
14
|
+
},
|
|
15
|
+
levelOptions: {
|
|
16
|
+
type: 'array',
|
|
17
|
+
default: [ 0, 1, 2, 3, 4, 5, 6 ],
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
supports: {
|
|
21
|
+
anchor: true,
|
|
22
|
+
reusable: false,
|
|
23
|
+
html: false,
|
|
24
|
+
color: {
|
|
25
|
+
gradients: true,
|
|
26
|
+
__experimentalDefaultControls: {
|
|
27
|
+
background: true,
|
|
28
|
+
text: true,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
spacing: {
|
|
32
|
+
margin: true,
|
|
33
|
+
padding: true,
|
|
34
|
+
__experimentalDefaultControls: {
|
|
35
|
+
margin: false,
|
|
36
|
+
padding: false,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
typography: {
|
|
40
|
+
fontSize: true,
|
|
41
|
+
lineHeight: true,
|
|
42
|
+
__experimentalFontFamily: true,
|
|
43
|
+
__experimentalTextTransform: true,
|
|
44
|
+
__experimentalTextDecoration: true,
|
|
45
|
+
__experimentalFontStyle: true,
|
|
46
|
+
__experimentalFontWeight: true,
|
|
47
|
+
__experimentalLetterSpacing: true,
|
|
48
|
+
__experimentalWritingMode: true,
|
|
49
|
+
__experimentalDefaultControls: {
|
|
50
|
+
fontSize: true,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
interactivity: {
|
|
54
|
+
clientNavigation: true,
|
|
55
|
+
},
|
|
56
|
+
__experimentalBorder: {
|
|
57
|
+
radius: true,
|
|
58
|
+
color: true,
|
|
59
|
+
width: true,
|
|
60
|
+
style: true,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
migrate: migrateTextAlign,
|
|
64
|
+
isEligible( attributes ) {
|
|
65
|
+
return (
|
|
66
|
+
!! attributes.textAlign ||
|
|
67
|
+
!! attributes.className?.match(
|
|
68
|
+
/\bhas-text-align-(left|center|right)\b/
|
|
69
|
+
)
|
|
70
|
+
);
|
|
71
|
+
},
|
|
72
|
+
save: () => null,
|
|
73
|
+
};
|
|
5
74
|
|
|
6
75
|
const v1 = {
|
|
7
76
|
attributes: {
|
|
@@ -46,4 +115,4 @@ const v1 = {
|
|
|
46
115
|
*
|
|
47
116
|
* See block-deprecation.md
|
|
48
117
|
*/
|
|
49
|
-
export default [ v1 ];
|
|
118
|
+
export default [ v2, v1 ];
|
package/src/site-tagline/edit.js
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import clsx from 'clsx';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
9
4
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
10
5
|
import { store as coreStore } from '@wordpress/core-data';
|
|
11
6
|
import {
|
|
12
|
-
AlignmentControl,
|
|
13
7
|
useBlockProps,
|
|
14
8
|
BlockControls,
|
|
15
9
|
HeadingLevelDropdown,
|
|
@@ -17,13 +11,13 @@ import {
|
|
|
17
11
|
} from '@wordpress/block-editor';
|
|
18
12
|
import { __ } from '@wordpress/i18n';
|
|
19
13
|
import { createBlock, getDefaultBlockName } from '@wordpress/blocks';
|
|
14
|
+
import useDeprecatedTextAlign from '../utils/deprecated-text-align-attributes';
|
|
15
|
+
|
|
16
|
+
export default function SiteTaglineEdit( props ) {
|
|
17
|
+
useDeprecatedTextAlign( props );
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
attributes
|
|
23
|
-
setAttributes,
|
|
24
|
-
insertBlocksAfter,
|
|
25
|
-
} ) {
|
|
26
|
-
const { textAlign, level, levelOptions } = attributes;
|
|
19
|
+
const { attributes, setAttributes, insertBlocksAfter } = props;
|
|
20
|
+
const { level, levelOptions } = attributes;
|
|
27
21
|
const { canUserEdit, tagline } = useSelect( ( select ) => {
|
|
28
22
|
const { canUser, getEntityRecord, getEditedEntityRecord } =
|
|
29
23
|
select( coreStore );
|
|
@@ -52,11 +46,10 @@ export default function SiteTaglineEdit( {
|
|
|
52
46
|
}
|
|
53
47
|
|
|
54
48
|
const blockProps = useBlockProps( {
|
|
55
|
-
className:
|
|
56
|
-
|
|
57
|
-
'wp-block-site-tagline__placeholder': ! canUserEdit && ! tagline,
|
|
58
|
-
} ),
|
|
49
|
+
className:
|
|
50
|
+
! canUserEdit && ! tagline && 'wp-block-site-tagline__placeholder',
|
|
59
51
|
} );
|
|
52
|
+
|
|
60
53
|
const siteTaglineContent = canUserEdit ? (
|
|
61
54
|
<RichText
|
|
62
55
|
allowedFormats={ [] }
|
|
@@ -86,12 +79,6 @@ export default function SiteTaglineEdit( {
|
|
|
86
79
|
setAttributes( { level: newLevel } )
|
|
87
80
|
}
|
|
88
81
|
/>
|
|
89
|
-
<AlignmentControl
|
|
90
|
-
onChange={ ( newAlign ) =>
|
|
91
|
-
setAttributes( { textAlign: newAlign } )
|
|
92
|
-
}
|
|
93
|
-
value={ textAlign }
|
|
94
|
-
/>
|
|
95
82
|
</BlockControls>
|
|
96
83
|
{ siteTaglineContent }
|
|
97
84
|
</>
|
|
@@ -15,9 +15,6 @@
|
|
|
15
15
|
"type": "array",
|
|
16
16
|
"default": [ 0, 1, 2, 3, 4, 5, 6 ]
|
|
17
17
|
},
|
|
18
|
-
"textAlign": {
|
|
19
|
-
"type": "string"
|
|
20
|
-
},
|
|
21
18
|
"isLink": {
|
|
22
19
|
"type": "boolean",
|
|
23
20
|
"default": true,
|
|
@@ -56,6 +53,7 @@
|
|
|
56
53
|
"typography": {
|
|
57
54
|
"fontSize": true,
|
|
58
55
|
"lineHeight": true,
|
|
56
|
+
"textAlign": true,
|
|
59
57
|
"__experimentalFontFamily": true,
|
|
60
58
|
"__experimentalTextTransform": true,
|
|
61
59
|
"__experimentalTextDecoration": true,
|
|
@@ -2,6 +2,88 @@
|
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
4
|
import migrateFontFamily from '../utils/migrate-font-family';
|
|
5
|
+
import migrateTextAlign from '../utils/migrate-text-align';
|
|
6
|
+
|
|
7
|
+
const v2 = {
|
|
8
|
+
attributes: {
|
|
9
|
+
textAlign: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
},
|
|
12
|
+
level: {
|
|
13
|
+
type: 'number',
|
|
14
|
+
default: 1,
|
|
15
|
+
},
|
|
16
|
+
levelOptions: {
|
|
17
|
+
type: 'array',
|
|
18
|
+
default: [ 0, 1, 2, 3, 4, 5, 6 ],
|
|
19
|
+
},
|
|
20
|
+
isLink: {
|
|
21
|
+
type: 'boolean',
|
|
22
|
+
default: true,
|
|
23
|
+
role: 'content',
|
|
24
|
+
},
|
|
25
|
+
linkTarget: {
|
|
26
|
+
type: 'string',
|
|
27
|
+
default: '_self',
|
|
28
|
+
role: 'content',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
supports: {
|
|
32
|
+
anchor: true,
|
|
33
|
+
align: [ 'wide', 'full' ],
|
|
34
|
+
html: false,
|
|
35
|
+
color: {
|
|
36
|
+
gradients: true,
|
|
37
|
+
link: true,
|
|
38
|
+
__experimentalDefaultControls: {
|
|
39
|
+
background: true,
|
|
40
|
+
text: true,
|
|
41
|
+
link: true,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
spacing: {
|
|
45
|
+
padding: true,
|
|
46
|
+
margin: true,
|
|
47
|
+
__experimentalDefaultControls: {
|
|
48
|
+
margin: false,
|
|
49
|
+
padding: false,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
typography: {
|
|
53
|
+
fontSize: true,
|
|
54
|
+
lineHeight: true,
|
|
55
|
+
__experimentalFontFamily: true,
|
|
56
|
+
__experimentalTextTransform: true,
|
|
57
|
+
__experimentalTextDecoration: true,
|
|
58
|
+
__experimentalFontStyle: true,
|
|
59
|
+
__experimentalFontWeight: true,
|
|
60
|
+
__experimentalLetterSpacing: true,
|
|
61
|
+
__experimentalWritingMode: true,
|
|
62
|
+
__experimentalDefaultControls: {
|
|
63
|
+
fontSize: true,
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
interactivity: {
|
|
67
|
+
clientNavigation: true,
|
|
68
|
+
},
|
|
69
|
+
__experimentalBorder: {
|
|
70
|
+
radius: true,
|
|
71
|
+
color: true,
|
|
72
|
+
width: true,
|
|
73
|
+
style: true,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
migrate: migrateTextAlign,
|
|
77
|
+
isEligible( attributes ) {
|
|
78
|
+
return (
|
|
79
|
+
!! attributes.textAlign ||
|
|
80
|
+
!! attributes.className?.match(
|
|
81
|
+
/\bhas-text-align-(left|center|right)\b/
|
|
82
|
+
)
|
|
83
|
+
);
|
|
84
|
+
},
|
|
85
|
+
save: () => null,
|
|
86
|
+
};
|
|
5
87
|
|
|
6
88
|
const v1 = {
|
|
7
89
|
attributes: {
|
|
@@ -59,4 +141,4 @@ const v1 = {
|
|
|
59
141
|
*
|
|
60
142
|
* See block-deprecation.md
|
|
61
143
|
*/
|
|
62
|
-
export default [ v1 ];
|
|
144
|
+
export default [ v2, v1 ];
|
package/src/site-title/edit.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import clsx from 'clsx';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -11,7 +6,6 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
11
6
|
import { __ } from '@wordpress/i18n';
|
|
12
7
|
import {
|
|
13
8
|
RichText,
|
|
14
|
-
AlignmentControl,
|
|
15
9
|
InspectorControls,
|
|
16
10
|
BlockControls,
|
|
17
11
|
useBlockProps,
|
|
@@ -30,13 +24,14 @@ import { decodeEntities } from '@wordpress/html-entities';
|
|
|
30
24
|
* Internal dependencies
|
|
31
25
|
*/
|
|
32
26
|
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
27
|
+
import useDeprecatedTextAlign from '../utils/deprecated-text-align-attributes';
|
|
33
28
|
|
|
34
|
-
export default function SiteTitleEdit( {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
insertBlocksAfter
|
|
38
|
-
|
|
39
|
-
const { level, levelOptions,
|
|
29
|
+
export default function SiteTitleEdit( props ) {
|
|
30
|
+
useDeprecatedTextAlign( props );
|
|
31
|
+
|
|
32
|
+
const { attributes, setAttributes, insertBlocksAfter } = props;
|
|
33
|
+
|
|
34
|
+
const { level, levelOptions, isLink, linkTarget } = attributes;
|
|
40
35
|
const { canUserEdit, title } = useSelect( ( select ) => {
|
|
41
36
|
const { canUser, getEntityRecord, getEditedEntityRecord } =
|
|
42
37
|
select( coreStore );
|
|
@@ -64,10 +59,8 @@ export default function SiteTitleEdit( {
|
|
|
64
59
|
|
|
65
60
|
const TagName = level === 0 ? 'p' : `h${ level }`;
|
|
66
61
|
const blockProps = useBlockProps( {
|
|
67
|
-
className:
|
|
68
|
-
|
|
69
|
-
'wp-block-site-title__placeholder': ! canUserEdit && ! title,
|
|
70
|
-
} ),
|
|
62
|
+
className:
|
|
63
|
+
! canUserEdit && ! title && 'wp-block-site-title__placeholder',
|
|
71
64
|
} );
|
|
72
65
|
const siteTitleContent = canUserEdit ? (
|
|
73
66
|
<TagName { ...blockProps }>
|
|
@@ -114,12 +107,6 @@ export default function SiteTitleEdit( {
|
|
|
114
107
|
setAttributes( { level: newLevel } )
|
|
115
108
|
}
|
|
116
109
|
/>
|
|
117
|
-
<AlignmentControl
|
|
118
|
-
value={ textAlign }
|
|
119
|
-
onChange={ ( nextAlign ) => {
|
|
120
|
-
setAttributes( { textAlign: nextAlign } );
|
|
121
|
-
} }
|
|
122
|
-
/>
|
|
123
110
|
</BlockControls>
|
|
124
111
|
) }
|
|
125
112
|
<InspectorControls>
|
|
@@ -18,32 +18,7 @@
|
|
|
18
18
|
"core/tabs-activeTabIndex",
|
|
19
19
|
"core/tabs-editorActiveTabIndex"
|
|
20
20
|
],
|
|
21
|
-
"attributes": {
|
|
22
|
-
"activeBackgroundColor": {
|
|
23
|
-
"type": "string"
|
|
24
|
-
},
|
|
25
|
-
"customActiveBackgroundColor": {
|
|
26
|
-
"type": "string"
|
|
27
|
-
},
|
|
28
|
-
"activeTextColor": {
|
|
29
|
-
"type": "string"
|
|
30
|
-
},
|
|
31
|
-
"customActiveTextColor": {
|
|
32
|
-
"type": "string"
|
|
33
|
-
},
|
|
34
|
-
"hoverBackgroundColor": {
|
|
35
|
-
"type": "string"
|
|
36
|
-
},
|
|
37
|
-
"customHoverBackgroundColor": {
|
|
38
|
-
"type": "string"
|
|
39
|
-
},
|
|
40
|
-
"hoverTextColor": {
|
|
41
|
-
"type": "string"
|
|
42
|
-
},
|
|
43
|
-
"customHoverTextColor": {
|
|
44
|
-
"type": "string"
|
|
45
|
-
}
|
|
46
|
-
},
|
|
21
|
+
"attributes": {},
|
|
47
22
|
"supports": {
|
|
48
23
|
"html": false,
|
|
49
24
|
"reusable": false,
|
|
@@ -9,10 +9,7 @@ import clsx from 'clsx';
|
|
|
9
9
|
import { __, isRTL } from '@wordpress/i18n';
|
|
10
10
|
import {
|
|
11
11
|
BlockControls,
|
|
12
|
-
InspectorControls,
|
|
13
12
|
store as blockEditorStore,
|
|
14
|
-
__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,
|
|
15
|
-
__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,
|
|
16
13
|
} from '@wordpress/block-editor';
|
|
17
14
|
import { ToolbarGroup, ToolbarItem, Button } from '@wordpress/components';
|
|
18
15
|
import {
|
|
@@ -163,32 +160,12 @@ function TabBlockMover( {
|
|
|
163
160
|
}
|
|
164
161
|
|
|
165
162
|
export default function Controls( {
|
|
166
|
-
attributes,
|
|
167
|
-
setAttributes,
|
|
168
|
-
clientId,
|
|
169
163
|
tabsClientId,
|
|
170
164
|
tabClientId,
|
|
171
165
|
tabIndex,
|
|
172
166
|
tabsCount,
|
|
173
167
|
tabsMenuClientId,
|
|
174
|
-
activeBackgroundColor,
|
|
175
|
-
setActiveBackgroundColor,
|
|
176
|
-
activeTextColor,
|
|
177
|
-
setActiveTextColor,
|
|
178
|
-
hoverBackgroundColor,
|
|
179
|
-
setHoverBackgroundColor,
|
|
180
|
-
hoverTextColor,
|
|
181
|
-
setHoverTextColor,
|
|
182
168
|
} ) {
|
|
183
|
-
const {
|
|
184
|
-
customActiveBackgroundColor,
|
|
185
|
-
customActiveTextColor,
|
|
186
|
-
customHoverBackgroundColor,
|
|
187
|
-
customHoverTextColor,
|
|
188
|
-
} = attributes;
|
|
189
|
-
|
|
190
|
-
const colorSettings = useMultipleOriginColorsAndGradients();
|
|
191
|
-
|
|
192
169
|
return (
|
|
193
170
|
<>
|
|
194
171
|
<TabBlockMover
|
|
@@ -200,91 +177,6 @@ export default function Controls( {
|
|
|
200
177
|
/>
|
|
201
178
|
<AddTabToolbarControl tabsClientId={ tabsClientId } />
|
|
202
179
|
<RemoveTabToolbarControl tabsClientId={ tabsClientId } />
|
|
203
|
-
<InspectorControls group="color">
|
|
204
|
-
<ColorGradientSettingsDropdown
|
|
205
|
-
settings={ [
|
|
206
|
-
{
|
|
207
|
-
label: __( 'Active background' ),
|
|
208
|
-
colorValue:
|
|
209
|
-
activeBackgroundColor?.color ??
|
|
210
|
-
customActiveBackgroundColor,
|
|
211
|
-
onColorChange: ( value ) => {
|
|
212
|
-
setActiveBackgroundColor( value );
|
|
213
|
-
setAttributes( {
|
|
214
|
-
customActiveBackgroundColor: value,
|
|
215
|
-
} );
|
|
216
|
-
},
|
|
217
|
-
resetAllFilter: () => {
|
|
218
|
-
setActiveBackgroundColor( undefined );
|
|
219
|
-
setAttributes( {
|
|
220
|
-
customActiveBackgroundColor: undefined,
|
|
221
|
-
} );
|
|
222
|
-
},
|
|
223
|
-
clearable: true,
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
label: __( 'Active text' ),
|
|
227
|
-
colorValue:
|
|
228
|
-
activeTextColor?.color ?? customActiveTextColor,
|
|
229
|
-
onColorChange: ( value ) => {
|
|
230
|
-
setActiveTextColor( value );
|
|
231
|
-
setAttributes( {
|
|
232
|
-
customActiveTextColor: value,
|
|
233
|
-
} );
|
|
234
|
-
},
|
|
235
|
-
resetAllFilter: () => {
|
|
236
|
-
setActiveTextColor( undefined );
|
|
237
|
-
setAttributes( {
|
|
238
|
-
customActiveTextColor: undefined,
|
|
239
|
-
} );
|
|
240
|
-
},
|
|
241
|
-
clearable: true,
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
label: __( 'Hover background' ),
|
|
245
|
-
colorValue:
|
|
246
|
-
hoverBackgroundColor?.color ??
|
|
247
|
-
customHoverBackgroundColor,
|
|
248
|
-
onColorChange: ( value ) => {
|
|
249
|
-
setHoverBackgroundColor( value );
|
|
250
|
-
setAttributes( {
|
|
251
|
-
customHoverBackgroundColor: value,
|
|
252
|
-
} );
|
|
253
|
-
},
|
|
254
|
-
resetAllFilter: () => {
|
|
255
|
-
setHoverBackgroundColor( undefined );
|
|
256
|
-
setAttributes( {
|
|
257
|
-
customHoverBackgroundColor: undefined,
|
|
258
|
-
} );
|
|
259
|
-
},
|
|
260
|
-
clearable: true,
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
label: __( 'Hover text' ),
|
|
264
|
-
colorValue:
|
|
265
|
-
hoverTextColor?.color ?? customHoverTextColor,
|
|
266
|
-
onColorChange: ( value ) => {
|
|
267
|
-
setHoverTextColor( value );
|
|
268
|
-
setAttributes( {
|
|
269
|
-
customHoverTextColor: value,
|
|
270
|
-
} );
|
|
271
|
-
},
|
|
272
|
-
resetAllFilter: () => {
|
|
273
|
-
setHoverTextColor( undefined );
|
|
274
|
-
setAttributes( {
|
|
275
|
-
customHoverTextColor: undefined,
|
|
276
|
-
} );
|
|
277
|
-
},
|
|
278
|
-
clearable: true,
|
|
279
|
-
},
|
|
280
|
-
] }
|
|
281
|
-
panelId={ clientId }
|
|
282
|
-
disableCustomColors={ false }
|
|
283
|
-
__experimentalIsRenderedInSidebar
|
|
284
|
-
__next40pxDefaultSize
|
|
285
|
-
{ ...colorSettings }
|
|
286
|
-
/>
|
|
287
|
-
</InspectorControls>
|
|
288
180
|
</>
|
|
289
181
|
);
|
|
290
182
|
}
|