@wordpress/block-library 9.37.2-next.ba3aee3a2.0 → 9.38.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 +1 -1
- package/build/audio/index.cjs +16 -8
- package/build/audio/index.cjs.map +2 -2
- package/build/block-keyboard-shortcuts/index.cjs +2 -4
- package/build/block-keyboard-shortcuts/index.cjs.map +2 -2
- package/build/button/index.cjs +17 -8
- package/build/button/index.cjs.map +2 -2
- package/build/code/index.cjs +3 -1
- package/build/code/index.cjs.map +2 -2
- package/build/comments-title/edit.cjs +10 -6
- package/build/comments-title/edit.cjs.map +2 -2
- package/build/cover/index.cjs +20 -10
- package/build/cover/index.cjs.map +2 -2
- package/build/details/index.cjs +3 -1
- package/build/details/index.cjs.map +2 -2
- package/build/file/index.cjs +19 -9
- package/build/file/index.cjs.map +2 -2
- package/build/heading/block.json +1 -3
- package/build/heading/deprecated.cjs +101 -5
- package/build/heading/deprecated.cjs.map +3 -3
- package/build/heading/edit.cjs +20 -41
- package/build/heading/edit.cjs.map +3 -3
- package/build/heading/index.cjs +3 -1
- package/build/heading/index.cjs.map +2 -2
- package/build/heading/save.cjs +2 -16
- package/build/heading/save.cjs.map +3 -3
- package/build/heading/transforms.cjs +16 -3
- package/build/heading/transforms.cjs.map +2 -2
- package/build/image/image.cjs +3 -3
- package/build/image/image.cjs.map +2 -2
- package/build/image/index.cjs +33 -17
- package/build/image/index.cjs.map +2 -2
- package/build/list-item/index.cjs +3 -1
- package/build/list-item/index.cjs.map +2 -2
- package/build/media-text/index.cjs +30 -15
- package/build/media-text/index.cjs.map +2 -2
- package/build/more/block.json +1 -0
- package/build/more/index.cjs +3 -1
- package/build/more/index.cjs.map +2 -2
- package/build/navigation/edit/index.cjs +7 -6
- package/build/navigation/edit/index.cjs.map +2 -2
- package/build/navigation/edit/responsive-wrapper.cjs +7 -4
- package/build/navigation/edit/responsive-wrapper.cjs.map +2 -2
- package/build/navigation/edit/use-create-overlay.cjs +2 -0
- package/build/navigation/edit/use-create-overlay.cjs.map +2 -2
- package/build/navigation-link/edit.cjs +8 -58
- package/build/navigation-link/edit.cjs.map +3 -3
- package/build/navigation-link/index.cjs +13 -8
- package/build/navigation-link/index.cjs.map +2 -2
- package/build/navigation-link/shared/index.cjs +11 -2
- package/build/navigation-link/shared/index.cjs.map +2 -2
- package/build/navigation-link/shared/invalid-draft-display.cjs +82 -0
- package/build/navigation-link/shared/invalid-draft-display.cjs.map +7 -0
- package/build/navigation-link/shared/use-enable-link-status-validation.cjs +50 -0
- package/build/navigation-link/shared/use-enable-link-status-validation.cjs.map +7 -0
- package/build/navigation-link/shared/use-is-invalid-link.cjs +64 -0
- package/build/navigation-link/shared/use-is-invalid-link.cjs.map +7 -0
- package/build/navigation-overlay-close/block.json +1 -4
- package/build/navigation-overlay-close/index.cjs +3 -25
- package/build/navigation-overlay-close/index.cjs.map +3 -3
- package/build/navigation-submenu/edit.cjs +36 -18
- package/build/navigation-submenu/edit.cjs.map +2 -2
- package/build/navigation-submenu/index.cjs +15 -8
- package/build/navigation-submenu/index.cjs.map +2 -2
- package/build/nextpage/block.json +1 -0
- package/build/paragraph/index.cjs +3 -1
- package/build/paragraph/index.cjs.map +2 -2
- package/build/paragraph/transforms.cjs +14 -3
- package/build/paragraph/transforms.cjs.map +3 -3
- package/build/preformatted/index.cjs +3 -1
- package/build/preformatted/index.cjs.map +2 -2
- package/build/pullquote/index.cjs +7 -3
- package/build/pullquote/index.cjs.map +2 -2
- package/build/search/index.cjs +10 -5
- package/build/search/index.cjs.map +2 -2
- package/build/social-link/index.cjs +13 -7
- package/build/social-link/index.cjs.map +2 -2
- package/build/table-of-contents/hooks.cjs +1 -1
- package/build/table-of-contents/hooks.cjs.map +1 -1
- package/build/template-part/edit/utils/get-template-part-icon.cjs.map +1 -1
- package/build/utils/is-within-overlay.cjs +52 -0
- package/build/utils/is-within-overlay.cjs.map +7 -0
- package/build/verse/index.cjs +3 -1
- package/build/verse/index.cjs.map +2 -2
- package/build/video/index.cjs +20 -10
- package/build/video/index.cjs.map +2 -2
- package/build-module/audio/index.mjs +16 -8
- package/build-module/audio/index.mjs.map +2 -2
- package/build-module/block-keyboard-shortcuts/index.mjs +2 -4
- package/build-module/block-keyboard-shortcuts/index.mjs.map +2 -2
- package/build-module/button/index.mjs +17 -8
- package/build-module/button/index.mjs.map +2 -2
- package/build-module/code/index.mjs +3 -1
- package/build-module/code/index.mjs.map +2 -2
- package/build-module/comments-title/edit.mjs +10 -6
- package/build-module/comments-title/edit.mjs.map +2 -2
- package/build-module/cover/index.mjs +20 -10
- package/build-module/cover/index.mjs.map +2 -2
- package/build-module/details/index.mjs +3 -1
- package/build-module/details/index.mjs.map +2 -2
- package/build-module/file/index.mjs +19 -9
- package/build-module/file/index.mjs.map +2 -2
- package/build-module/heading/block.json +1 -3
- package/build-module/heading/deprecated.mjs +101 -5
- package/build-module/heading/deprecated.mjs.map +2 -2
- package/build-module/heading/edit.mjs +22 -46
- package/build-module/heading/edit.mjs.map +2 -2
- package/build-module/heading/index.mjs +3 -1
- package/build-module/heading/index.mjs.map +2 -2
- package/build-module/heading/save.mjs +2 -6
- package/build-module/heading/save.mjs.map +2 -2
- package/build-module/heading/transforms.mjs +16 -3
- package/build-module/heading/transforms.mjs.map +2 -2
- package/build-module/image/image.mjs +3 -3
- package/build-module/image/image.mjs.map +2 -2
- package/build-module/image/index.mjs +33 -17
- package/build-module/image/index.mjs.map +2 -2
- package/build-module/list-item/index.mjs +3 -1
- package/build-module/list-item/index.mjs.map +2 -2
- package/build-module/media-text/index.mjs +30 -15
- package/build-module/media-text/index.mjs.map +2 -2
- package/build-module/more/block.json +1 -0
- package/build-module/more/index.mjs +3 -1
- package/build-module/more/index.mjs.map +2 -2
- package/build-module/navigation/edit/index.mjs +7 -6
- package/build-module/navigation/edit/index.mjs.map +2 -2
- package/build-module/navigation/edit/responsive-wrapper.mjs +7 -4
- package/build-module/navigation/edit/responsive-wrapper.mjs.map +2 -2
- package/build-module/navigation/edit/use-create-overlay.mjs +2 -0
- package/build-module/navigation/edit/use-create-overlay.mjs.map +2 -2
- package/build-module/navigation-link/edit.mjs +12 -60
- package/build-module/navigation-link/edit.mjs.map +2 -2
- package/build-module/navigation-link/index.mjs +13 -8
- package/build-module/navigation-link/index.mjs.map +2 -2
- package/build-module/navigation-link/shared/index.mjs +7 -1
- package/build-module/navigation-link/shared/index.mjs.map +2 -2
- package/build-module/navigation-link/shared/invalid-draft-display.mjs +47 -0
- package/build-module/navigation-link/shared/invalid-draft-display.mjs.map +7 -0
- package/build-module/navigation-link/shared/use-enable-link-status-validation.mjs +25 -0
- package/build-module/navigation-link/shared/use-enable-link-status-validation.mjs.map +7 -0
- package/build-module/navigation-link/shared/use-is-invalid-link.mjs +39 -0
- package/build-module/navigation-link/shared/use-is-invalid-link.mjs.map +7 -0
- package/build-module/navigation-overlay-close/block.json +1 -4
- package/build-module/navigation-overlay-close/index.mjs +3 -25
- package/build-module/navigation-overlay-close/index.mjs.map +2 -2
- package/build-module/navigation-submenu/edit.mjs +40 -19
- package/build-module/navigation-submenu/edit.mjs.map +2 -2
- package/build-module/navigation-submenu/index.mjs +15 -8
- package/build-module/navigation-submenu/index.mjs.map +2 -2
- package/build-module/nextpage/block.json +1 -0
- package/build-module/paragraph/index.mjs +3 -1
- package/build-module/paragraph/index.mjs.map +2 -2
- package/build-module/paragraph/transforms.mjs +2 -1
- package/build-module/paragraph/transforms.mjs.map +2 -2
- package/build-module/preformatted/index.mjs +3 -1
- package/build-module/preformatted/index.mjs.map +2 -2
- package/build-module/pullquote/index.mjs +7 -3
- package/build-module/pullquote/index.mjs.map +2 -2
- package/build-module/search/index.mjs +10 -5
- package/build-module/search/index.mjs.map +2 -2
- package/build-module/social-link/index.mjs +13 -7
- package/build-module/social-link/index.mjs.map +2 -2
- package/build-module/table-of-contents/hooks.mjs +1 -1
- package/build-module/table-of-contents/hooks.mjs.map +1 -1
- package/build-module/template-part/edit/utils/get-template-part-icon.mjs.map +1 -1
- package/build-module/utils/is-within-overlay.mjs +27 -0
- package/build-module/utils/is-within-overlay.mjs.map +7 -0
- package/build-module/verse/index.mjs +3 -1
- package/build-module/verse/index.mjs.map +2 -2
- package/build-module/video/index.mjs +20 -10
- package/build-module/video/index.mjs.map +2 -2
- package/build-style/navigation/style-rtl.css +1 -16
- package/build-style/navigation/style.css +1 -16
- package/build-style/style-rtl.css +1 -16
- package/build-style/style.css +1 -16
- package/package.json +37 -38
- package/src/audio/index.js +13 -7
- package/src/block-keyboard-shortcuts/index.js +4 -7
- package/src/breadcrumbs/index.php +6 -3
- package/src/button/index.js +15 -8
- package/src/code/index.js +2 -1
- package/src/comments-title/edit.js +10 -7
- package/src/comments-title/index.php +7 -8
- package/src/cover/index.js +17 -8
- package/src/details/index.js +2 -1
- package/src/file/index.js +15 -8
- package/src/heading/block.json +1 -3
- package/src/heading/deprecated.js +118 -5
- package/src/heading/edit.js +6 -32
- package/src/heading/edit.native.js +17 -2
- package/src/heading/index.js +2 -1
- package/src/heading/save.js +2 -11
- package/src/heading/transforms.js +16 -3
- package/src/image/image.js +38 -40
- package/src/image/index.js +29 -16
- package/src/list-item/index.js +2 -1
- package/src/media-text/index.js +27 -14
- package/src/more/block.json +1 -0
- package/src/more/index.js +2 -1
- package/src/navigation/edit/index.js +9 -4
- package/src/navigation/edit/responsive-wrapper.js +15 -8
- package/src/navigation/edit/test/use-create-overlay.js +12 -0
- package/src/navigation/edit/use-create-overlay.js +2 -0
- package/src/navigation/index.php +74 -24
- package/src/navigation/style.scss +2 -18
- package/src/navigation-link/edit.js +11 -97
- package/src/navigation-link/index.js +13 -8
- package/src/navigation-link/index.php +17 -29
- package/src/navigation-link/shared/helpers.php +46 -0
- package/src/navigation-link/shared/index.js +3 -0
- package/src/navigation-link/shared/invalid-draft-display.js +63 -0
- package/src/navigation-link/shared/test/use-enable-link-status-validation.test.js +127 -0
- package/src/navigation-link/shared/use-enable-link-status-validation.js +40 -0
- package/src/navigation-link/shared/use-is-invalid-link.js +72 -0
- package/src/navigation-overlay-close/block.json +1 -4
- package/src/navigation-overlay-close/index.js +2 -37
- package/src/navigation-overlay-close/index.php +37 -1
- package/src/navigation-submenu/edit.js +49 -24
- package/src/navigation-submenu/index.js +13 -8
- package/src/navigation-submenu/index.php +25 -18
- package/src/nextpage/block.json +1 -0
- package/src/paragraph/index.js +2 -1
- package/src/paragraph/transforms.js +3 -1
- package/src/preformatted/index.js +2 -1
- package/src/pullquote/index.js +5 -3
- package/src/query-title/index.php +2 -2
- package/src/search/index.js +7 -5
- package/src/social-link/index.js +12 -7
- package/src/table-of-contents/hooks.js +1 -1
- package/src/template-part/edit/utils/get-template-part-icon.js +1 -1
- package/src/utils/is-within-overlay.js +54 -0
- package/src/verse/index.js +2 -1
- package/src/video/index.js +17 -9
- package/build/navigation-overlay-close/save.cjs +0 -67
- package/build/navigation-overlay-close/save.cjs.map +0 -7
- package/build-module/navigation-overlay-close/save.mjs +0 -46
- package/build-module/navigation-overlay-close/save.mjs.map +0 -7
- package/src/navigation-overlay-close/save.js +0 -44
|
@@ -12,6 +12,11 @@ import {
|
|
|
12
12
|
useBlockProps,
|
|
13
13
|
} from '@wordpress/block-editor';
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Internal dependencies
|
|
17
|
+
*/
|
|
18
|
+
import migrateTextAlignAttributeToBlockSupport from '../utils/migrate-text-align';
|
|
19
|
+
|
|
15
20
|
const blockSupports = {
|
|
16
21
|
className: false,
|
|
17
22
|
anchor: true,
|
|
@@ -75,7 +80,9 @@ const v1 = {
|
|
|
75
80
|
},
|
|
76
81
|
},
|
|
77
82
|
migrate: ( attributes ) =>
|
|
78
|
-
|
|
83
|
+
migrateTextAlignAttributeToBlockSupport(
|
|
84
|
+
migrateCustomColors( migrateTextAlign( attributes ) )
|
|
85
|
+
),
|
|
79
86
|
save( { attributes } ) {
|
|
80
87
|
const { align, level, content, textColor, customTextColor } =
|
|
81
88
|
attributes;
|
|
@@ -111,7 +118,9 @@ const v2 = {
|
|
|
111
118
|
},
|
|
112
119
|
},
|
|
113
120
|
migrate: ( attributes ) =>
|
|
114
|
-
|
|
121
|
+
migrateTextAlignAttributeToBlockSupport(
|
|
122
|
+
migrateCustomColors( migrateTextAlign( attributes ) )
|
|
123
|
+
),
|
|
115
124
|
save( { attributes } ) {
|
|
116
125
|
const { align, content, customTextColor, level, textColor } =
|
|
117
126
|
attributes;
|
|
@@ -149,7 +158,9 @@ const v3 = {
|
|
|
149
158
|
},
|
|
150
159
|
},
|
|
151
160
|
migrate: ( attributes ) =>
|
|
152
|
-
|
|
161
|
+
migrateTextAlignAttributeToBlockSupport(
|
|
162
|
+
migrateCustomColors( migrateTextAlign( attributes ) )
|
|
163
|
+
),
|
|
153
164
|
save( { attributes } ) {
|
|
154
165
|
const { align, content, customTextColor, level, textColor } =
|
|
155
166
|
attributes;
|
|
@@ -195,7 +206,10 @@ const v4 = {
|
|
|
195
206
|
},
|
|
196
207
|
attributes: blockAttributes,
|
|
197
208
|
isEligible: ( { align } ) => TEXT_ALIGN_OPTIONS.includes( align ),
|
|
198
|
-
migrate:
|
|
209
|
+
migrate: ( attributes ) =>
|
|
210
|
+
migrateTextAlignAttributeToBlockSupport(
|
|
211
|
+
migrateCustomColors( migrateTextAlign( attributes ) )
|
|
212
|
+
),
|
|
199
213
|
save( { attributes } ) {
|
|
200
214
|
const { align, content, level } = attributes;
|
|
201
215
|
const TagName = 'h' + level;
|
|
@@ -283,8 +297,107 @@ const v5 = {
|
|
|
283
297
|
</TagName>
|
|
284
298
|
);
|
|
285
299
|
},
|
|
300
|
+
migrate: ( attributes ) =>
|
|
301
|
+
migrateTextAlignAttributeToBlockSupport(
|
|
302
|
+
migrateCustomColors( migrateTextAlign( attributes ) )
|
|
303
|
+
),
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
const v6 = {
|
|
307
|
+
supports: {
|
|
308
|
+
align: [ 'wide', 'full' ],
|
|
309
|
+
anchor: true,
|
|
310
|
+
className: true,
|
|
311
|
+
splitting: true,
|
|
312
|
+
__experimentalBorder: {
|
|
313
|
+
color: true,
|
|
314
|
+
radius: true,
|
|
315
|
+
style: true,
|
|
316
|
+
width: true,
|
|
317
|
+
},
|
|
318
|
+
color: {
|
|
319
|
+
gradients: true,
|
|
320
|
+
link: true,
|
|
321
|
+
__experimentalDefaultControls: {
|
|
322
|
+
background: true,
|
|
323
|
+
text: true,
|
|
324
|
+
},
|
|
325
|
+
},
|
|
326
|
+
spacing: {
|
|
327
|
+
margin: true,
|
|
328
|
+
padding: true,
|
|
329
|
+
},
|
|
330
|
+
typography: {
|
|
331
|
+
fontSize: true,
|
|
332
|
+
lineHeight: true,
|
|
333
|
+
__experimentalFontFamily: true,
|
|
334
|
+
__experimentalFontStyle: true,
|
|
335
|
+
__experimentalFontWeight: true,
|
|
336
|
+
__experimentalLetterSpacing: true,
|
|
337
|
+
__experimentalTextTransform: true,
|
|
338
|
+
__experimentalTextDecoration: true,
|
|
339
|
+
__experimentalWritingMode: true,
|
|
340
|
+
fitText: true,
|
|
341
|
+
__experimentalDefaultControls: {
|
|
342
|
+
fontSize: true,
|
|
343
|
+
},
|
|
344
|
+
},
|
|
345
|
+
__unstablePasteTextInline: true,
|
|
346
|
+
__experimentalSlashInserter: true,
|
|
347
|
+
interactivity: {
|
|
348
|
+
clientNavigation: true,
|
|
349
|
+
},
|
|
350
|
+
},
|
|
351
|
+
attributes: {
|
|
352
|
+
textAlign: {
|
|
353
|
+
type: 'string',
|
|
354
|
+
},
|
|
355
|
+
content: {
|
|
356
|
+
type: 'string',
|
|
357
|
+
source: 'html',
|
|
358
|
+
selector: 'h1,h2,h3,h4,h5,h6',
|
|
359
|
+
default: '',
|
|
360
|
+
role: 'content',
|
|
361
|
+
},
|
|
362
|
+
level: {
|
|
363
|
+
type: 'number',
|
|
364
|
+
default: 2,
|
|
365
|
+
},
|
|
366
|
+
levelOptions: {
|
|
367
|
+
type: 'array',
|
|
368
|
+
},
|
|
369
|
+
placeholder: {
|
|
370
|
+
type: 'string',
|
|
371
|
+
},
|
|
372
|
+
},
|
|
373
|
+
save( { attributes } ) {
|
|
374
|
+
const { textAlign, content, level } = attributes;
|
|
375
|
+
const TagName = 'h' + level;
|
|
376
|
+
|
|
377
|
+
const className = clsx( {
|
|
378
|
+
[ `has-text-align-${ textAlign }` ]: textAlign,
|
|
379
|
+
} );
|
|
380
|
+
|
|
381
|
+
return (
|
|
382
|
+
<TagName { ...useBlockProps.save( { className } ) }>
|
|
383
|
+
<RichText.Content value={ content } />
|
|
384
|
+
</TagName>
|
|
385
|
+
);
|
|
386
|
+
},
|
|
387
|
+
migrate: ( attributes ) =>
|
|
388
|
+
migrateTextAlignAttributeToBlockSupport(
|
|
389
|
+
migrateCustomColors( migrateTextAlign( attributes ) )
|
|
390
|
+
),
|
|
391
|
+
isEligible( attributes ) {
|
|
392
|
+
return (
|
|
393
|
+
!! attributes.textAlign ||
|
|
394
|
+
!! attributes.className?.match(
|
|
395
|
+
/\bhas-text-align-(left|center|right)\b/
|
|
396
|
+
)
|
|
397
|
+
);
|
|
398
|
+
},
|
|
286
399
|
};
|
|
287
400
|
|
|
288
|
-
const deprecated = [ v5, v4, v3, v2, v1 ];
|
|
401
|
+
const deprecated = [ v6, v5, v4, v3, v2, v1 ];
|
|
289
402
|
|
|
290
403
|
export default deprecated;
|
package/src/heading/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
|
*/
|
|
@@ -10,36 +5,26 @@ import { __ } from '@wordpress/i18n';
|
|
|
10
5
|
import { useEffect, Platform } from '@wordpress/element';
|
|
11
6
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
12
7
|
import {
|
|
13
|
-
AlignmentControl,
|
|
14
|
-
BlockControls,
|
|
15
8
|
RichText,
|
|
16
9
|
useBlockProps,
|
|
17
10
|
store as blockEditorStore,
|
|
18
|
-
useBlockEditingMode,
|
|
19
11
|
} from '@wordpress/block-editor';
|
|
20
12
|
|
|
21
13
|
/**
|
|
22
14
|
* Internal dependencies
|
|
23
15
|
*/
|
|
24
16
|
import { generateAnchor, setAnchor } from './autogenerate-anchors';
|
|
17
|
+
import useDeprecatedTextAlign from '../utils/deprecated-text-align-attributes';
|
|
25
18
|
|
|
26
|
-
function HeadingEdit( {
|
|
27
|
-
attributes,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
style,
|
|
32
|
-
clientId,
|
|
33
|
-
} ) {
|
|
34
|
-
const { textAlign, content, level, placeholder, anchor } = attributes;
|
|
19
|
+
function HeadingEdit( props ) {
|
|
20
|
+
const { attributes, setAttributes, mergeBlocks, onReplace, clientId } =
|
|
21
|
+
props;
|
|
22
|
+
useDeprecatedTextAlign( props );
|
|
23
|
+
const { style, content, level, placeholder, anchor } = attributes;
|
|
35
24
|
const tagName = 'h' + level;
|
|
36
25
|
const blockProps = useBlockProps( {
|
|
37
|
-
className: clsx( {
|
|
38
|
-
[ `has-text-align-${ textAlign }` ]: textAlign,
|
|
39
|
-
} ),
|
|
40
26
|
style,
|
|
41
27
|
} );
|
|
42
|
-
const blockEditingMode = useBlockEditingMode();
|
|
43
28
|
|
|
44
29
|
const { canGenerateAnchors } = useSelect( ( select ) => {
|
|
45
30
|
const { getGlobalBlockCount, getSettings } = select( blockEditorStore );
|
|
@@ -90,16 +75,6 @@ function HeadingEdit( {
|
|
|
90
75
|
|
|
91
76
|
return (
|
|
92
77
|
<>
|
|
93
|
-
{ blockEditingMode === 'default' && (
|
|
94
|
-
<BlockControls group="block">
|
|
95
|
-
<AlignmentControl
|
|
96
|
-
value={ textAlign }
|
|
97
|
-
onChange={ ( nextAlign ) => {
|
|
98
|
-
setAttributes( { textAlign: nextAlign } );
|
|
99
|
-
} }
|
|
100
|
-
/>
|
|
101
|
-
</BlockControls>
|
|
102
|
-
) }
|
|
103
78
|
<RichText
|
|
104
79
|
identifier="content"
|
|
105
80
|
tagName={ tagName }
|
|
@@ -109,7 +84,6 @@ function HeadingEdit( {
|
|
|
109
84
|
onReplace={ onReplace }
|
|
110
85
|
onRemove={ () => onReplace( [] ) }
|
|
111
86
|
placeholder={ placeholder || __( 'Heading' ) }
|
|
112
|
-
textAlign={ textAlign }
|
|
113
87
|
{ ...( Platform.isNative && { deleteEnter: true } ) } // setup RichText on native mobile to delete the "Enter" key as it's handled by the JS/RN side
|
|
114
88
|
{ ...blockProps }
|
|
115
89
|
/>
|
|
@@ -32,7 +32,14 @@ function HeadingEdit( {
|
|
|
32
32
|
style,
|
|
33
33
|
clientId,
|
|
34
34
|
} ) {
|
|
35
|
-
const {
|
|
35
|
+
const {
|
|
36
|
+
content,
|
|
37
|
+
level,
|
|
38
|
+
placeholder,
|
|
39
|
+
anchor,
|
|
40
|
+
style: attributesStyle,
|
|
41
|
+
} = attributes;
|
|
42
|
+
const textAlign = attributesStyle?.typography?.textAlign;
|
|
36
43
|
const tagName = 'h' + level;
|
|
37
44
|
const blockProps = useBlockProps( {
|
|
38
45
|
className: clsx( {
|
|
@@ -100,7 +107,15 @@ function HeadingEdit( {
|
|
|
100
107
|
<AlignmentControl
|
|
101
108
|
value={ textAlign }
|
|
102
109
|
onChange={ ( nextAlign ) => {
|
|
103
|
-
setAttributes( {
|
|
110
|
+
setAttributes( {
|
|
111
|
+
style: {
|
|
112
|
+
...attributesStyle,
|
|
113
|
+
typography: {
|
|
114
|
+
...attributesStyle?.typography,
|
|
115
|
+
textAlign: nextAlign,
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
} );
|
|
104
119
|
} }
|
|
105
120
|
/>
|
|
106
121
|
</BlockControls>
|
package/src/heading/index.js
CHANGED
package/src/heading/save.js
CHANGED
|
@@ -1,23 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import clsx from 'clsx';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
9
4
|
import { RichText, useBlockProps } from '@wordpress/block-editor';
|
|
10
5
|
|
|
11
6
|
export default function save( { attributes } ) {
|
|
12
|
-
const {
|
|
7
|
+
const { content, level } = attributes;
|
|
13
8
|
const TagName = 'h' + level;
|
|
14
9
|
|
|
15
|
-
const className = clsx( {
|
|
16
|
-
[ `has-text-align-${ textAlign }` ]: textAlign,
|
|
17
|
-
} );
|
|
18
|
-
|
|
19
10
|
return (
|
|
20
|
-
<TagName { ...useBlockProps.save(
|
|
11
|
+
<TagName { ...useBlockProps.save() }>
|
|
21
12
|
<RichText.Content value={ content } />
|
|
22
13
|
</TagName>
|
|
23
14
|
);
|
|
@@ -29,7 +29,13 @@ const transforms = {
|
|
|
29
29
|
),
|
|
30
30
|
content,
|
|
31
31
|
anchor,
|
|
32
|
-
textAlign
|
|
32
|
+
...( textAlign && {
|
|
33
|
+
style: {
|
|
34
|
+
typography: {
|
|
35
|
+
textAlign,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
} ),
|
|
33
39
|
} );
|
|
34
40
|
} ),
|
|
35
41
|
},
|
|
@@ -64,7 +70,13 @@ const transforms = {
|
|
|
64
70
|
textAlign === 'center' ||
|
|
65
71
|
textAlign === 'right'
|
|
66
72
|
) {
|
|
67
|
-
attributes.
|
|
73
|
+
attributes.style = {
|
|
74
|
+
...attributes.style,
|
|
75
|
+
typography: {
|
|
76
|
+
...attributes.style?.typography,
|
|
77
|
+
textAlign,
|
|
78
|
+
},
|
|
79
|
+
};
|
|
68
80
|
}
|
|
69
81
|
|
|
70
82
|
return createBlock( 'core/heading', attributes );
|
|
@@ -93,7 +105,8 @@ const transforms = {
|
|
|
93
105
|
blocks: [ 'core/paragraph' ],
|
|
94
106
|
transform: ( attributes ) =>
|
|
95
107
|
attributes.map( ( _attributes ) => {
|
|
96
|
-
const { content,
|
|
108
|
+
const { content, style } = _attributes;
|
|
109
|
+
const textAlign = style?.typography?.textAlign;
|
|
97
110
|
return createBlock( 'core/paragraph', {
|
|
98
111
|
...getTransformedAttributes(
|
|
99
112
|
_attributes,
|
package/src/image/image.js
CHANGED
|
@@ -788,14 +788,14 @@ export default function Image( {
|
|
|
788
788
|
/>
|
|
789
789
|
</BlockControls>
|
|
790
790
|
) }
|
|
791
|
-
{ ! hasDataFormBlockFields && (
|
|
791
|
+
{ ! hasDataFormBlockFields && isSingleSelected && (
|
|
792
792
|
<InspectorControls group="content">
|
|
793
793
|
<ToolsPanel
|
|
794
794
|
label={ __( 'Media' ) }
|
|
795
795
|
resetAll={ () => onSelectImage( undefined ) }
|
|
796
796
|
dropdownMenuProps={ dropdownMenuProps }
|
|
797
797
|
>
|
|
798
|
-
{
|
|
798
|
+
{ ! lockUrlControls && (
|
|
799
799
|
<ToolsPanelItem
|
|
800
800
|
label={ __( 'Image' ) }
|
|
801
801
|
hasValue={ () => !! url }
|
|
@@ -822,47 +822,45 @@ export default function Image( {
|
|
|
822
822
|
/>
|
|
823
823
|
</ToolsPanelItem>
|
|
824
824
|
) }
|
|
825
|
-
|
|
826
|
-
|
|
825
|
+
<ToolsPanelItem
|
|
826
|
+
label={ __( 'Alternative text' ) }
|
|
827
|
+
isShownByDefault
|
|
828
|
+
hasValue={ () => !! alt }
|
|
829
|
+
onDeselect={ () =>
|
|
830
|
+
setAttributes( { alt: undefined } )
|
|
831
|
+
}
|
|
832
|
+
>
|
|
833
|
+
<TextareaControl
|
|
827
834
|
label={ __( 'Alternative text' ) }
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
<ExternalLink
|
|
845
|
-
href={
|
|
846
|
-
// translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations.
|
|
847
|
-
__(
|
|
848
|
-
'https://www.w3.org/WAI/tutorials/images/decision-tree/'
|
|
849
|
-
)
|
|
850
|
-
}
|
|
851
|
-
>
|
|
852
|
-
{ __(
|
|
853
|
-
'Describe the purpose of the image.'
|
|
854
|
-
) }
|
|
855
|
-
</ExternalLink>
|
|
856
|
-
<br />
|
|
835
|
+
value={ alt || '' }
|
|
836
|
+
onChange={ updateAlt }
|
|
837
|
+
readOnly={ lockAltControls }
|
|
838
|
+
help={
|
|
839
|
+
lockAltControls ? (
|
|
840
|
+
<>{ lockAltControlsMessage }</>
|
|
841
|
+
) : (
|
|
842
|
+
<>
|
|
843
|
+
<ExternalLink
|
|
844
|
+
href={
|
|
845
|
+
// translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations.
|
|
846
|
+
__(
|
|
847
|
+
'https://www.w3.org/WAI/tutorials/images/decision-tree/'
|
|
848
|
+
)
|
|
849
|
+
}
|
|
850
|
+
>
|
|
857
851
|
{ __(
|
|
858
|
-
'
|
|
852
|
+
'Describe the purpose of the image.'
|
|
859
853
|
) }
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
854
|
+
</ExternalLink>
|
|
855
|
+
<br />
|
|
856
|
+
{ __(
|
|
857
|
+
'Leave empty if decorative.'
|
|
858
|
+
) }
|
|
859
|
+
</>
|
|
860
|
+
)
|
|
861
|
+
}
|
|
862
|
+
/>
|
|
863
|
+
</ToolsPanelItem>
|
|
866
864
|
</ToolsPanel>
|
|
867
865
|
</InspectorControls>
|
|
868
866
|
) }
|
package/src/image/index.js
CHANGED
|
@@ -72,32 +72,45 @@ if ( window.__experimentalContentOnlyInspectorFields ) {
|
|
|
72
72
|
id: 'image',
|
|
73
73
|
label: __( 'Image' ),
|
|
74
74
|
type: 'media',
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
url: 'url',
|
|
78
|
-
caption: 'caption',
|
|
79
|
-
alt: 'alt',
|
|
80
|
-
},
|
|
81
|
-
args: {
|
|
75
|
+
Edit: {
|
|
76
|
+
control: 'media', // TODO: replace with custom component
|
|
82
77
|
allowedTypes: [ 'image' ],
|
|
83
78
|
multiple: false,
|
|
84
79
|
},
|
|
80
|
+
getValue: ( { item } ) => ( {
|
|
81
|
+
id: item.id,
|
|
82
|
+
url: item.url,
|
|
83
|
+
alt: item.alt,
|
|
84
|
+
caption: item.caption,
|
|
85
|
+
} ),
|
|
86
|
+
setValue: ( { value } ) => ( {
|
|
87
|
+
id: value.id,
|
|
88
|
+
url: value.url,
|
|
89
|
+
alt: value.alt,
|
|
90
|
+
caption: value.caption,
|
|
91
|
+
} ),
|
|
85
92
|
},
|
|
86
93
|
{
|
|
87
94
|
id: 'link',
|
|
88
95
|
label: __( 'Link' ),
|
|
89
|
-
type: '
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
},
|
|
96
|
+
type: 'url',
|
|
97
|
+
Edit: 'link', // TODO: replace with custom component
|
|
98
|
+
getValue: ( { item } ) => ( {
|
|
99
|
+
url: item.href,
|
|
100
|
+
rel: item.rel,
|
|
101
|
+
linkTarget: item.linkTarget,
|
|
102
|
+
} ),
|
|
103
|
+
setValue: ( { value } ) => ( {
|
|
104
|
+
href: value.url,
|
|
105
|
+
rel: value.rel,
|
|
106
|
+
linkTarget: value.linkTarget,
|
|
107
|
+
} ),
|
|
96
108
|
},
|
|
97
109
|
{
|
|
98
110
|
id: 'caption',
|
|
99
111
|
label: __( 'Caption' ),
|
|
100
|
-
type: '
|
|
112
|
+
type: 'text',
|
|
113
|
+
Edit: 'rich-text', // TODO: replace with custom component
|
|
101
114
|
},
|
|
102
115
|
{
|
|
103
116
|
id: 'alt',
|
|
@@ -106,7 +119,7 @@ if ( window.__experimentalContentOnlyInspectorFields ) {
|
|
|
106
119
|
},
|
|
107
120
|
];
|
|
108
121
|
settings[ formKey ] = {
|
|
109
|
-
fields: [ 'image' ],
|
|
122
|
+
fields: [ 'image', 'link', 'caption', 'alt' ],
|
|
110
123
|
};
|
|
111
124
|
}
|
|
112
125
|
|
package/src/list-item/index.js
CHANGED
package/src/media-text/index.js
CHANGED
|
@@ -60,30 +60,43 @@ if ( window.__experimentalContentOnlyInspectorFields ) {
|
|
|
60
60
|
id: 'media',
|
|
61
61
|
label: __( 'Media' ),
|
|
62
62
|
type: 'media',
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
type: 'mediaType',
|
|
66
|
-
url: 'mediaUrl',
|
|
67
|
-
link: 'mediaLink',
|
|
68
|
-
},
|
|
69
|
-
args: {
|
|
63
|
+
Edit: {
|
|
64
|
+
control: 'media', // TODO: replace with custom component
|
|
70
65
|
allowedTypes: [ 'image', 'video' ],
|
|
71
66
|
multiple: false,
|
|
72
67
|
},
|
|
68
|
+
getValue: ( { item } ) => ( {
|
|
69
|
+
id: item.mediaId,
|
|
70
|
+
url: item.mediaUrl,
|
|
71
|
+
mediaType: item.mediaType,
|
|
72
|
+
link: item.mediaLink,
|
|
73
|
+
} ),
|
|
74
|
+
setValue: ( { value } ) => ( {
|
|
75
|
+
mediaId: value.id,
|
|
76
|
+
mediaUrl: value.url,
|
|
77
|
+
mediaType: value.mediaType,
|
|
78
|
+
mediaLink: value.link,
|
|
79
|
+
} ),
|
|
73
80
|
},
|
|
74
81
|
{
|
|
75
82
|
id: 'link',
|
|
76
83
|
label: __( 'Link' ),
|
|
77
|
-
type: '
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
84
|
+
type: 'url',
|
|
85
|
+
Edit: 'link', // TODO: replace with custom component
|
|
86
|
+
getValue: ( { item } ) => ( {
|
|
87
|
+
url: item.href,
|
|
88
|
+
rel: item.rel,
|
|
89
|
+
linkTarget: item.linkTarget,
|
|
90
|
+
} ),
|
|
91
|
+
setValue: ( { value } ) => ( {
|
|
92
|
+
href: value.url,
|
|
93
|
+
rel: value.rel,
|
|
94
|
+
linkTarget: value.linkTarget,
|
|
95
|
+
} ),
|
|
83
96
|
},
|
|
84
97
|
];
|
|
85
98
|
settings[ formKey ] = {
|
|
86
|
-
fields: [ 'media' ],
|
|
99
|
+
fields: [ 'media', 'link' ],
|
|
87
100
|
};
|
|
88
101
|
}
|
|
89
102
|
|
package/src/more/block.json
CHANGED
package/src/more/index.js
CHANGED
|
@@ -130,6 +130,7 @@ function ColorTools( {
|
|
|
130
130
|
setOverlayBackgroundColor,
|
|
131
131
|
clientId,
|
|
132
132
|
navRef,
|
|
133
|
+
hasCustomOverlay,
|
|
133
134
|
} ) {
|
|
134
135
|
const [ detectedBackgroundColor, setDetectedBackgroundColor ] = useState();
|
|
135
136
|
const [ detectedColor, setDetectedColor ] = useState();
|
|
@@ -201,7 +202,9 @@ function ColorTools( {
|
|
|
201
202
|
},
|
|
202
203
|
{
|
|
203
204
|
colorValue: overlayTextColor.color,
|
|
204
|
-
label:
|
|
205
|
+
label: hasCustomOverlay
|
|
206
|
+
? __( 'Submenu text' )
|
|
207
|
+
: __( 'Submenu & overlay text' ),
|
|
205
208
|
onColorChange: setOverlayTextColor,
|
|
206
209
|
resetAllFilter: () => setOverlayTextColor(),
|
|
207
210
|
clearable: true,
|
|
@@ -209,7 +212,9 @@ function ColorTools( {
|
|
|
209
212
|
},
|
|
210
213
|
{
|
|
211
214
|
colorValue: overlayBackgroundColor.color,
|
|
212
|
-
label:
|
|
215
|
+
label: hasCustomOverlay
|
|
216
|
+
? __( 'Submenu background' )
|
|
217
|
+
: __( 'Submenu & overlay background' ),
|
|
213
218
|
onColorChange: setOverlayBackgroundColor,
|
|
214
219
|
resetAllFilter: () => setOverlayBackgroundColor(),
|
|
215
220
|
clearable: true,
|
|
@@ -254,7 +259,6 @@ function Navigation( {
|
|
|
254
259
|
|
|
255
260
|
// These props are used by the navigation editor to override specific
|
|
256
261
|
// navigation block settings.
|
|
257
|
-
hasSubmenuIndicatorSetting = true,
|
|
258
262
|
customPlaceholder: CustomPlaceholder = null,
|
|
259
263
|
__unstableLayoutClassNames: layoutClassNames,
|
|
260
264
|
} ) {
|
|
@@ -655,7 +659,7 @@ function Navigation( {
|
|
|
655
659
|
const stylingInspectorControls = (
|
|
656
660
|
<>
|
|
657
661
|
<InspectorControls>
|
|
658
|
-
{
|
|
662
|
+
{ ( ! isOverlayExperimentEnabled || hasSubmenus ) && (
|
|
659
663
|
<ToolsPanel
|
|
660
664
|
label={ __( 'Display' ) }
|
|
661
665
|
resetAll={ () => {
|
|
@@ -819,6 +823,7 @@ function Navigation( {
|
|
|
819
823
|
setOverlayBackgroundColor={ setOverlayBackgroundColor }
|
|
820
824
|
clientId={ clientId }
|
|
821
825
|
navRef={ navRef }
|
|
826
|
+
hasCustomOverlay={ !! overlay }
|
|
822
827
|
/>
|
|
823
828
|
</InspectorControls>
|
|
824
829
|
</>
|