@wordpress/block-library 9.41.1-next.v.202603161435.0 → 9.42.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/html/modal.cjs +151 -229
- package/build/html/modal.cjs.map +2 -2
- package/build/post-date/block.json +1 -3
- package/build/post-date/deprecated.cjs +82 -6
- package/build/post-date/deprecated.cjs.map +3 -3
- package/build/post-date/edit.cjs +49 -62
- package/build/post-date/edit.cjs.map +3 -3
- package/build/site-title/index.cjs +5 -1
- package/build/site-title/index.cjs.map +2 -2
- package/build-module/html/modal.mjs +151 -229
- package/build-module/html/modal.mjs.map +2 -2
- package/build-module/post-date/block.json +1 -3
- package/build-module/post-date/deprecated.mjs +82 -6
- package/build-module/post-date/deprecated.mjs.map +2 -2
- package/build-module/post-date/edit.mjs +49 -63
- package/build-module/post-date/edit.mjs.map +2 -2
- package/build-module/site-title/index.mjs +5 -1
- package/build-module/site-title/index.mjs.map +2 -2
- package/package.json +38 -38
- package/src/html/modal.js +6 -77
- package/src/navigation/index.php +24 -6
- package/src/post-date/block.json +1 -3
- package/src/post-date/deprecated.js +86 -6
- package/src/post-date/edit.js +65 -82
- package/src/site-title/index.js +5 -1
|
@@ -7,6 +7,84 @@ import clsx from 'clsx';
|
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
9
|
import migrateFontFamily from '../utils/migrate-font-family';
|
|
10
|
+
import migrateTextAlign from '../utils/migrate-text-align';
|
|
11
|
+
|
|
12
|
+
const v4 = {
|
|
13
|
+
attributes: {
|
|
14
|
+
datetime: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
role: 'content',
|
|
17
|
+
},
|
|
18
|
+
textAlign: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
},
|
|
21
|
+
format: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
},
|
|
24
|
+
isLink: {
|
|
25
|
+
type: 'boolean',
|
|
26
|
+
default: false,
|
|
27
|
+
role: 'content',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
supports: {
|
|
31
|
+
anchor: true,
|
|
32
|
+
html: false,
|
|
33
|
+
color: {
|
|
34
|
+
gradients: true,
|
|
35
|
+
link: true,
|
|
36
|
+
__experimentalDefaultControls: {
|
|
37
|
+
background: true,
|
|
38
|
+
text: true,
|
|
39
|
+
link: true,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
spacing: {
|
|
43
|
+
margin: true,
|
|
44
|
+
padding: true,
|
|
45
|
+
},
|
|
46
|
+
typography: {
|
|
47
|
+
fontSize: true,
|
|
48
|
+
lineHeight: true,
|
|
49
|
+
__experimentalFontFamily: true,
|
|
50
|
+
__experimentalFontWeight: true,
|
|
51
|
+
__experimentalFontStyle: true,
|
|
52
|
+
__experimentalTextTransform: true,
|
|
53
|
+
__experimentalTextDecoration: true,
|
|
54
|
+
__experimentalLetterSpacing: true,
|
|
55
|
+
__experimentalDefaultControls: {
|
|
56
|
+
fontSize: true,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
interactivity: {
|
|
60
|
+
clientNavigation: true,
|
|
61
|
+
},
|
|
62
|
+
__experimentalBorder: {
|
|
63
|
+
radius: true,
|
|
64
|
+
color: true,
|
|
65
|
+
width: true,
|
|
66
|
+
style: true,
|
|
67
|
+
__experimentalDefaultControls: {
|
|
68
|
+
radius: true,
|
|
69
|
+
color: true,
|
|
70
|
+
width: true,
|
|
71
|
+
style: true,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
save() {
|
|
76
|
+
return null;
|
|
77
|
+
},
|
|
78
|
+
migrate: migrateTextAlign,
|
|
79
|
+
isEligible( attributes ) {
|
|
80
|
+
return (
|
|
81
|
+
!! attributes.textAlign ||
|
|
82
|
+
!! attributes.className?.match(
|
|
83
|
+
/\bhas-text-align-(left|center|right)\b/
|
|
84
|
+
)
|
|
85
|
+
);
|
|
86
|
+
},
|
|
87
|
+
};
|
|
10
88
|
|
|
11
89
|
const v3 = {
|
|
12
90
|
attributes: {
|
|
@@ -87,7 +165,7 @@ const v3 = {
|
|
|
87
165
|
...otherAttributes
|
|
88
166
|
} ) {
|
|
89
167
|
// Change the block bindings source argument name from "key" to "field".
|
|
90
|
-
return {
|
|
168
|
+
return migrateTextAlign( {
|
|
91
169
|
metadata: {
|
|
92
170
|
bindings: {
|
|
93
171
|
datetime: {
|
|
@@ -99,7 +177,7 @@ const v3 = {
|
|
|
99
177
|
...otherMetadata,
|
|
100
178
|
},
|
|
101
179
|
...otherAttributes,
|
|
102
|
-
};
|
|
180
|
+
} );
|
|
103
181
|
},
|
|
104
182
|
isEligible( attributes ) {
|
|
105
183
|
return (
|
|
@@ -184,7 +262,7 @@ const v2 = {
|
|
|
184
262
|
);
|
|
185
263
|
}
|
|
186
264
|
|
|
187
|
-
return {
|
|
265
|
+
return migrateTextAlign( {
|
|
188
266
|
...otherAttributes,
|
|
189
267
|
className,
|
|
190
268
|
metadata: {
|
|
@@ -196,7 +274,7 @@ const v2 = {
|
|
|
196
274
|
},
|
|
197
275
|
},
|
|
198
276
|
},
|
|
199
|
-
};
|
|
277
|
+
} );
|
|
200
278
|
}
|
|
201
279
|
},
|
|
202
280
|
isEligible( attributes ) {
|
|
@@ -240,7 +318,9 @@ const v1 = {
|
|
|
240
318
|
save() {
|
|
241
319
|
return null;
|
|
242
320
|
},
|
|
243
|
-
migrate
|
|
321
|
+
migrate( attributes ) {
|
|
322
|
+
return migrateTextAlign( migrateFontFamily( attributes ) );
|
|
323
|
+
},
|
|
244
324
|
isEligible( { style } ) {
|
|
245
325
|
return style?.typography?.fontFamily;
|
|
246
326
|
},
|
|
@@ -254,4 +334,4 @@ const v1 = {
|
|
|
254
334
|
*
|
|
255
335
|
* See block-deprecation.md
|
|
256
336
|
*/
|
|
257
|
-
export default [ v3, v2, v1 ];
|
|
337
|
+
export default [ v4, v3, v2, v1 ];
|
package/src/post-date/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
|
*/
|
|
@@ -14,7 +9,6 @@ import {
|
|
|
14
9
|
getSettings as getDateSettings,
|
|
15
10
|
} from '@wordpress/date';
|
|
16
11
|
import {
|
|
17
|
-
AlignmentControl,
|
|
18
12
|
BlockControls,
|
|
19
13
|
InspectorControls,
|
|
20
14
|
store as blockEditorStore,
|
|
@@ -41,19 +35,18 @@ import { store as blocksStore } from '@wordpress/blocks';
|
|
|
41
35
|
* Internal dependencies
|
|
42
36
|
*/
|
|
43
37
|
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
38
|
+
import useDeprecatedTextAlign from '../utils/deprecated-text-align-attributes';
|
|
44
39
|
|
|
45
|
-
export default function PostDateEdit( {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
} ),
|
|
56
|
-
} );
|
|
40
|
+
export default function PostDateEdit( props ) {
|
|
41
|
+
const {
|
|
42
|
+
attributes,
|
|
43
|
+
context: { postType: postTypeSlug, queryId },
|
|
44
|
+
setAttributes,
|
|
45
|
+
name,
|
|
46
|
+
} = props;
|
|
47
|
+
useDeprecatedTextAlign( props );
|
|
48
|
+
const { datetime, format, isLink } = attributes;
|
|
49
|
+
const blockProps = useBlockProps();
|
|
57
50
|
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
58
51
|
|
|
59
52
|
// Use internal state instead of a ref to make sure that the component
|
|
@@ -126,71 +119,61 @@ export default function PostDateEdit( {
|
|
|
126
119
|
}
|
|
127
120
|
return (
|
|
128
121
|
<>
|
|
129
|
-
{ ( blockEditingMode === 'default' ||
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
<
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
122
|
+
{ ( blockEditingMode === 'default' || ! isDescendentOfQueryLoop ) &&
|
|
123
|
+
activeBlockVariationName !== 'post-date-modified' &&
|
|
124
|
+
( ! isDescendentOfQueryLoop || ! activeBlockVariationName ) && (
|
|
125
|
+
<BlockControls group="block">
|
|
126
|
+
<ToolbarGroup>
|
|
127
|
+
<Dropdown
|
|
128
|
+
popoverProps={ popoverProps }
|
|
129
|
+
renderContent={ ( { onClose } ) => (
|
|
130
|
+
<PublishDateTimePicker
|
|
131
|
+
title={
|
|
132
|
+
activeBlockVariationName ===
|
|
133
|
+
'post-date'
|
|
134
|
+
? __( 'Publish Date' )
|
|
135
|
+
: __( 'Date' )
|
|
136
|
+
}
|
|
137
|
+
currentDate={ datetime }
|
|
138
|
+
onChange={ ( newDatetime ) =>
|
|
139
|
+
setAttributes( {
|
|
140
|
+
datetime: newDatetime,
|
|
141
|
+
} )
|
|
142
|
+
}
|
|
143
|
+
is12Hour={ is12HourFormat(
|
|
144
|
+
siteTimeFormat
|
|
145
|
+
) }
|
|
146
|
+
onClose={ onClose }
|
|
147
|
+
dateOrder={
|
|
148
|
+
/* translators: Order of day, month, and year. Available formats are 'dmy', 'mdy', and 'ymd'. */
|
|
149
|
+
_x( 'dmy', 'date order' )
|
|
150
|
+
}
|
|
151
|
+
/>
|
|
152
|
+
) }
|
|
153
|
+
renderToggle={ ( { isOpen, onToggle } ) => {
|
|
154
|
+
const openOnArrowDown = ( event ) => {
|
|
155
|
+
if (
|
|
156
|
+
! isOpen &&
|
|
157
|
+
event.keyCode === DOWN
|
|
158
|
+
) {
|
|
159
|
+
event.preventDefault();
|
|
160
|
+
onToggle();
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
return (
|
|
164
|
+
<ToolbarButton
|
|
165
|
+
aria-expanded={ isOpen }
|
|
166
|
+
icon={ pencil }
|
|
167
|
+
title={ __( 'Change Date' ) }
|
|
168
|
+
onClick={ onToggle }
|
|
169
|
+
onKeyDown={ openOnArrowDown }
|
|
167
170
|
/>
|
|
168
|
-
)
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
) {
|
|
175
|
-
event.preventDefault();
|
|
176
|
-
onToggle();
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
|
-
return (
|
|
180
|
-
<ToolbarButton
|
|
181
|
-
aria-expanded={ isOpen }
|
|
182
|
-
icon={ pencil }
|
|
183
|
-
title={ __( 'Change Date' ) }
|
|
184
|
-
onClick={ onToggle }
|
|
185
|
-
onKeyDown={ openOnArrowDown }
|
|
186
|
-
/>
|
|
187
|
-
);
|
|
188
|
-
} }
|
|
189
|
-
/>
|
|
190
|
-
</ToolbarGroup>
|
|
191
|
-
) }
|
|
192
|
-
</BlockControls>
|
|
193
|
-
) }
|
|
171
|
+
);
|
|
172
|
+
} }
|
|
173
|
+
/>
|
|
174
|
+
</ToolbarGroup>
|
|
175
|
+
</BlockControls>
|
|
176
|
+
) }
|
|
194
177
|
|
|
195
178
|
<InspectorControls>
|
|
196
179
|
<ToolsPanel
|