@wordpress/block-library 9.16.0 → 9.17.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/archives/edit.js +2 -2
- package/build/archives/edit.js.map +1 -1
- package/build/categories/edit.js +115 -37
- package/build/categories/edit.js.map +1 -1
- package/build/comments/edit/comments-inspector-controls.js +6 -5
- package/build/comments/edit/comments-inspector-controls.js.map +1 -1
- package/build/comments-pagination/index.js +5 -0
- package/build/comments-pagination/index.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +2 -9
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/details/edit.js +16 -2
- package/build/details/edit.js.map +1 -1
- package/build/details/index.js +9 -0
- package/build/details/index.js.map +1 -1
- package/build/details/save.js +2 -0
- package/build/details/save.js.map +1 -1
- package/build/embed/transforms.js +5 -2
- package/build/embed/transforms.js.map +1 -1
- package/build/form/variations.js +1 -1
- package/build/form/variations.js.map +1 -1
- package/build/group/edit.js +2 -9
- package/build/group/edit.js.map +1 -1
- package/build/home-link/edit.js +1 -2
- package/build/home-link/edit.js.map +1 -1
- package/build/latest-comments/edit.js +73 -26
- package/build/latest-comments/edit.js.map +1 -1
- package/build/latest-posts/constants.js +2 -1
- package/build/latest-posts/constants.js.map +1 -1
- package/build/latest-posts/edit.js +91 -38
- package/build/latest-posts/edit.js.map +1 -1
- package/build/list-item/index.js +1 -1
- package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js +4 -4
- package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
- package/build/navigation/edit/use-generate-default-navigation-title.js +4 -4
- package/build/navigation/edit/use-generate-default-navigation-title.js.map +1 -1
- package/build/navigation-link/edit.js +14 -19
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-submenu/index.js +7 -0
- package/build/navigation-submenu/index.js.map +1 -1
- package/build/page-list/edit.js +1 -1
- package/build/page-list/edit.js.map +1 -1
- package/build/paragraph/edit.js +4 -14
- package/build/paragraph/edit.js.map +1 -1
- package/build/pattern/index.js +1 -1
- package/build/post-content/index.js +1 -0
- package/build/post-content/index.js.map +1 -1
- package/build/post-date/edit.js +1 -1
- package/build/post-date/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +0 -6
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-navigation-link/variations.js +2 -2
- package/build/post-navigation-link/variations.js.map +1 -1
- package/build/post-terms/edit.js +1 -0
- package/build/post-terms/edit.js.map +1 -1
- package/build/post-time-to-read/index.js +1 -1
- package/build/query/edit/query-content.js +2 -6
- package/build/query/edit/query-content.js.map +1 -1
- package/build/query-no-results/index.js +1 -1
- package/build/query-pagination-numbers/edit.js +1 -1
- package/build/query-pagination-numbers/edit.js.map +1 -1
- package/build/query-title/edit.js +1 -0
- package/build/query-title/edit.js.map +1 -1
- package/build/read-more/edit.js +25 -7
- package/build/read-more/edit.js.map +1 -1
- package/build/search/edit.js +67 -49
- package/build/search/edit.js.map +1 -1
- package/build/separator/edit.js +2 -4
- package/build/separator/edit.js.map +1 -1
- package/build/spacer/controls.js +13 -9
- package/build/spacer/controls.js.map +1 -1
- package/build/spacer/edit.js +23 -21
- package/build/spacer/edit.js.map +1 -1
- package/build/template-part/edit/advanced-controls.js +2 -9
- package/build/template-part/edit/advanced-controls.js.map +1 -1
- package/build/utils/messages.js +22 -0
- package/build/utils/messages.js.map +1 -0
- package/build/video/edit-common-settings.js +1 -1
- package/build/video/edit-common-settings.js.map +1 -1
- package/build-module/archives/edit.js +2 -2
- package/build-module/archives/edit.js.map +1 -1
- package/build-module/categories/edit.js +116 -38
- package/build-module/categories/edit.js.map +1 -1
- package/build-module/comments/edit/comments-inspector-controls.js +5 -4
- package/build-module/comments/edit/comments-inspector-controls.js.map +1 -1
- package/build-module/comments-pagination/index.js +5 -0
- package/build-module/comments-pagination/index.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +1 -8
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/details/edit.js +17 -3
- package/build-module/details/edit.js.map +1 -1
- package/build-module/details/index.js +9 -0
- package/build-module/details/index.js.map +1 -1
- package/build-module/details/save.js +2 -0
- package/build-module/details/save.js.map +1 -1
- package/build-module/embed/transforms.js +5 -2
- package/build-module/embed/transforms.js.map +1 -1
- package/build-module/form/variations.js +1 -1
- package/build-module/form/variations.js.map +1 -1
- package/build-module/group/edit.js +1 -8
- package/build-module/group/edit.js.map +1 -1
- package/build-module/home-link/edit.js +1 -2
- package/build-module/home-link/edit.js.map +1 -1
- package/build-module/latest-comments/edit.js +74 -27
- package/build-module/latest-comments/edit.js.map +1 -1
- package/build-module/latest-posts/constants.js +1 -0
- package/build-module/latest-posts/constants.js.map +1 -1
- package/build-module/latest-posts/edit.js +93 -40
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/list-item/index.js +1 -1
- package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js +4 -4
- package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
- package/build-module/navigation/edit/use-generate-default-navigation-title.js +4 -4
- package/build-module/navigation/edit/use-generate-default-navigation-title.js.map +1 -1
- package/build-module/navigation-link/edit.js +15 -20
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-submenu/index.js +7 -0
- package/build-module/navigation-submenu/index.js.map +1 -1
- package/build-module/page-list/edit.js +1 -1
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/paragraph/edit.js +5 -15
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/pattern/index.js +1 -1
- package/build-module/post-content/index.js +1 -0
- package/build-module/post-content/index.js.map +1 -1
- package/build-module/post-date/edit.js +1 -1
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +0 -6
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-navigation-link/variations.js +2 -2
- package/build-module/post-navigation-link/variations.js.map +1 -1
- package/build-module/post-terms/edit.js +1 -0
- package/build-module/post-terms/edit.js.map +1 -1
- package/build-module/post-time-to-read/index.js +1 -1
- package/build-module/query/edit/query-content.js +1 -5
- package/build-module/query/edit/query-content.js.map +1 -1
- package/build-module/query-no-results/index.js +1 -1
- package/build-module/query-pagination-numbers/edit.js +1 -1
- package/build-module/query-pagination-numbers/edit.js.map +1 -1
- package/build-module/query-title/edit.js +1 -0
- package/build-module/query-title/edit.js.map +1 -1
- package/build-module/read-more/edit.js +26 -8
- package/build-module/read-more/edit.js.map +1 -1
- package/build-module/search/edit.js +68 -50
- package/build-module/search/edit.js.map +1 -1
- package/build-module/separator/edit.js +1 -3
- package/build-module/separator/edit.js.map +1 -1
- package/build-module/spacer/controls.js +13 -9
- package/build-module/spacer/controls.js.map +1 -1
- package/build-module/spacer/edit.js +24 -22
- package/build-module/spacer/edit.js.map +1 -1
- package/build-module/template-part/edit/advanced-controls.js +1 -8
- package/build-module/template-part/edit/advanced-controls.js.map +1 -1
- package/build-module/utils/messages.js +15 -0
- package/build-module/utils/messages.js.map +1 -0
- package/build-module/video/edit-common-settings.js +1 -1
- package/build-module/video/edit-common-settings.js.map +1 -1
- package/build-style/editor-rtl.css +8 -45
- package/build-style/editor.css +8 -45
- package/build-style/gallery/editor-rtl.css +0 -44
- package/build-style/gallery/editor.css +0 -44
- package/build-style/navigation-link/editor-rtl.css +3 -0
- package/build-style/navigation-link/editor.css +3 -0
- package/build-style/paragraph/editor-rtl.css +4 -0
- package/build-style/paragraph/editor.css +4 -0
- package/build-style/post-featured-image/editor-rtl.css +1 -1
- package/build-style/post-featured-image/editor.css +1 -1
- package/package.json +35 -35
- package/src/archives/edit.js +2 -2
- package/src/categories/edit.js +133 -45
- package/src/comments/edit/comments-inspector-controls.js +5 -8
- package/src/comments-pagination/block.json +5 -0
- package/src/cover/edit/inspector-controls.js +1 -21
- package/src/details/block.json +9 -0
- package/src/details/edit.js +18 -2
- package/src/details/save.js +6 -2
- package/src/embed/transforms.js +3 -1
- package/src/form/variations.js +1 -1
- package/src/gallery/editor.scss +0 -56
- package/src/group/edit.js +1 -20
- package/src/home-link/edit.js +0 -6
- package/src/latest-comments/edit.js +93 -33
- package/src/latest-posts/constants.js +1 -0
- package/src/latest-posts/edit.js +119 -44
- package/src/list/test/edit.native.js +9 -9
- package/src/list-item/block.json +1 -1
- package/src/navigation/edit/use-convert-classic-menu-to-block-menu.js +4 -4
- package/src/navigation/edit/use-generate-default-navigation-title.js +4 -4
- package/src/navigation-link/edit.js +25 -29
- package/src/navigation-link/editor.scss +27 -18
- package/src/navigation-submenu/index.js +7 -0
- package/src/navigation-submenu/index.php +21 -4
- package/src/page-list/edit.js +52 -50
- package/src/paragraph/edit.js +3 -18
- package/src/paragraph/editor.scss +7 -0
- package/src/pattern/block.json +1 -1
- package/src/post-content/block.json +1 -0
- package/src/post-date/edit.js +1 -3
- package/src/post-featured-image/edit.js +2 -15
- package/src/post-featured-image/editor.scss +2 -2
- package/src/post-navigation-link/variations.js +2 -2
- package/src/post-terms/edit.js +1 -0
- package/src/post-time-to-read/block.json +1 -1
- package/src/query/edit/query-content.js +1 -11
- package/src/query-no-results/block.json +1 -1
- package/src/query-pagination-numbers/edit.js +1 -1
- package/src/query-title/edit.js +1 -0
- package/src/read-more/edit.js +35 -11
- package/src/search/edit.js +99 -74
- package/src/separator/edit.js +1 -6
- package/src/spacer/controls.js +10 -9
- package/src/spacer/edit.js +25 -23
- package/src/template-part/edit/advanced-controls.js +1 -21
- package/src/utils/messages.js +31 -0
- package/src/video/edit-common-settings.js +1 -1
package/src/search/edit.js
CHANGED
|
@@ -25,12 +25,13 @@ import {
|
|
|
25
25
|
ToolbarGroup,
|
|
26
26
|
ToolbarButton,
|
|
27
27
|
ResizableBox,
|
|
28
|
-
PanelBody,
|
|
29
|
-
__experimentalVStack as VStack,
|
|
30
28
|
__experimentalUseCustomUnits as useCustomUnits,
|
|
31
29
|
__experimentalUnitControl as UnitControl,
|
|
32
30
|
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
33
31
|
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
|
|
32
|
+
__experimentalToolsPanel as ToolsPanel,
|
|
33
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
34
|
+
__experimentalVStack as VStack,
|
|
34
35
|
} from '@wordpress/components';
|
|
35
36
|
import { useInstanceId } from '@wordpress/compose';
|
|
36
37
|
import { Icon, search } from '@wordpress/icons';
|
|
@@ -54,6 +55,7 @@ import {
|
|
|
54
55
|
MIN_WIDTH,
|
|
55
56
|
isPercentageUnit,
|
|
56
57
|
} from './utils.js';
|
|
58
|
+
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
57
59
|
|
|
58
60
|
// Used to calculate border radius adjustment to avoid "fat" corners when
|
|
59
61
|
// button is placed inside wrapper.
|
|
@@ -370,6 +372,7 @@ export default function SearchEdit( {
|
|
|
370
372
|
</>
|
|
371
373
|
);
|
|
372
374
|
};
|
|
375
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
373
376
|
|
|
374
377
|
const controls = (
|
|
375
378
|
<>
|
|
@@ -408,79 +411,101 @@ export default function SearchEdit( {
|
|
|
408
411
|
</BlockControls>
|
|
409
412
|
|
|
410
413
|
<InspectorControls>
|
|
411
|
-
<
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
414
|
+
<ToolsPanel
|
|
415
|
+
label={ __( 'Settings' ) }
|
|
416
|
+
resetAll={ () => {
|
|
417
|
+
setAttributes( {
|
|
418
|
+
width: undefined,
|
|
419
|
+
widthUnit: undefined,
|
|
420
|
+
} );
|
|
421
|
+
} }
|
|
422
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
423
|
+
>
|
|
424
|
+
<ToolsPanelItem
|
|
425
|
+
hasValue={ () => !! width }
|
|
426
|
+
label={ __( 'Width' ) }
|
|
427
|
+
onDeselect={ () => {
|
|
428
|
+
setAttributes( {
|
|
429
|
+
width: undefined,
|
|
430
|
+
widthUnit: undefined,
|
|
431
|
+
} );
|
|
432
|
+
} }
|
|
433
|
+
isShownByDefault
|
|
415
434
|
>
|
|
416
|
-
<
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
widthValue
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
435
|
+
<VStack>
|
|
436
|
+
<UnitControl
|
|
437
|
+
__next40pxDefaultSize
|
|
438
|
+
label={ __( 'Width' ) }
|
|
439
|
+
id={ unitControlInputId } // Unused, kept for backwards compatibility
|
|
440
|
+
min={
|
|
441
|
+
isPercentageUnit( widthUnit )
|
|
442
|
+
? 0
|
|
443
|
+
: MIN_WIDTH
|
|
444
|
+
}
|
|
445
|
+
max={
|
|
446
|
+
isPercentageUnit( widthUnit )
|
|
447
|
+
? 100
|
|
448
|
+
: undefined
|
|
449
|
+
}
|
|
450
|
+
step={ 1 }
|
|
451
|
+
onChange={ ( newWidth ) => {
|
|
452
|
+
const parsedNewWidth =
|
|
453
|
+
newWidth === ''
|
|
454
|
+
? undefined
|
|
455
|
+
: parseInt( newWidth, 10 );
|
|
456
|
+
setAttributes( {
|
|
457
|
+
width: parsedNewWidth,
|
|
458
|
+
} );
|
|
459
|
+
} }
|
|
460
|
+
onUnitChange={ ( newUnit ) => {
|
|
461
|
+
setAttributes( {
|
|
462
|
+
width:
|
|
463
|
+
'%' === newUnit
|
|
464
|
+
? PC_WIDTH_DEFAULT
|
|
465
|
+
: PX_WIDTH_DEFAULT,
|
|
466
|
+
widthUnit: newUnit,
|
|
467
|
+
} );
|
|
468
|
+
} }
|
|
469
|
+
__unstableInputWidth="80px"
|
|
470
|
+
value={ `${ width }${ widthUnit }` }
|
|
471
|
+
units={ units }
|
|
472
|
+
/>
|
|
473
|
+
<ToggleGroupControl
|
|
474
|
+
label={ __( 'Percentage Width' ) }
|
|
475
|
+
value={
|
|
476
|
+
PERCENTAGE_WIDTHS.includes( width ) &&
|
|
477
|
+
widthUnit === '%'
|
|
478
|
+
? width
|
|
479
|
+
: undefined
|
|
480
|
+
}
|
|
481
|
+
hideLabelFromVision
|
|
482
|
+
onChange={ ( newWidth ) => {
|
|
483
|
+
setAttributes( {
|
|
484
|
+
width: newWidth,
|
|
485
|
+
widthUnit: '%',
|
|
486
|
+
} );
|
|
487
|
+
} }
|
|
488
|
+
isBlock
|
|
489
|
+
__next40pxDefaultSize
|
|
490
|
+
__nextHasNoMarginBottom
|
|
491
|
+
>
|
|
492
|
+
{ PERCENTAGE_WIDTHS.map( ( widthValue ) => {
|
|
493
|
+
return (
|
|
494
|
+
<ToggleGroupControlOption
|
|
495
|
+
key={ widthValue }
|
|
496
|
+
value={ widthValue }
|
|
497
|
+
label={ sprintf(
|
|
498
|
+
/* translators: Percentage value. */
|
|
499
|
+
__( '%d%%' ),
|
|
500
|
+
widthValue
|
|
501
|
+
) }
|
|
502
|
+
/>
|
|
503
|
+
);
|
|
504
|
+
} ) }
|
|
505
|
+
</ToggleGroupControl>
|
|
506
|
+
</VStack>
|
|
507
|
+
</ToolsPanelItem>
|
|
508
|
+
</ToolsPanel>
|
|
484
509
|
</InspectorControls>
|
|
485
510
|
</>
|
|
486
511
|
);
|
package/src/separator/edit.js
CHANGED
|
@@ -19,12 +19,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
19
19
|
* Internal dependencies
|
|
20
20
|
*/
|
|
21
21
|
import useDeprecatedOpacity from './use-deprecated-opacity';
|
|
22
|
-
|
|
23
|
-
const htmlElementMessages = {
|
|
24
|
-
div: __(
|
|
25
|
-
'The <div> element should only be used if the separator is a design element that should not be announced.'
|
|
26
|
-
),
|
|
27
|
-
};
|
|
22
|
+
import { htmlElementMessages } from '../utils/messages';
|
|
28
23
|
|
|
29
24
|
export default function SeparatorEdit( { attributes, setAttributes } ) {
|
|
30
25
|
const { backgroundColor, opacity, style, tagName } = attributes;
|
package/src/spacer/controls.js
CHANGED
|
@@ -24,6 +24,7 @@ import { View } from '@wordpress/primitives';
|
|
|
24
24
|
*/
|
|
25
25
|
import { unlock } from '../lock-unlock';
|
|
26
26
|
import { MIN_SPACER_SIZE } from './constants';
|
|
27
|
+
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
27
28
|
|
|
28
29
|
const { useSpacingSizes } = unlock( blockEditorPrivateApis );
|
|
29
30
|
|
|
@@ -43,10 +44,6 @@ function DimensionInput( { label, onChange, isResizing, value = '' } ) {
|
|
|
43
44
|
defaultValues: { px: 100, em: 10, rem: 10, vw: 10, vh: 25 },
|
|
44
45
|
} );
|
|
45
46
|
|
|
46
|
-
const handleOnChange = ( unprocessedValue ) => {
|
|
47
|
-
onChange( unprocessedValue.all );
|
|
48
|
-
};
|
|
49
|
-
|
|
50
47
|
// Force the unit to update to `px` when the Spacer is being resized.
|
|
51
48
|
const [ parsedQuantity, parsedUnit ] =
|
|
52
49
|
parseQuantityAndUnitFromRawValue( value );
|
|
@@ -56,23 +53,24 @@ function DimensionInput( { label, onChange, isResizing, value = '' } ) {
|
|
|
56
53
|
|
|
57
54
|
return (
|
|
58
55
|
<>
|
|
59
|
-
{
|
|
56
|
+
{ spacingSizes?.length < 2 ? (
|
|
60
57
|
<UnitControl
|
|
61
58
|
id={ inputId }
|
|
62
59
|
isResetValueOnUnitChange
|
|
63
60
|
min={ MIN_SPACER_SIZE }
|
|
64
|
-
onChange={
|
|
61
|
+
onChange={ onChange }
|
|
65
62
|
value={ computedValue }
|
|
66
63
|
units={ units }
|
|
67
64
|
label={ label }
|
|
68
65
|
__next40pxDefaultSize
|
|
69
66
|
/>
|
|
70
|
-
)
|
|
71
|
-
{ spacingSizes?.length > 0 && (
|
|
67
|
+
) : (
|
|
72
68
|
<View className="tools-panel-item-spacing">
|
|
73
69
|
<SpacingSizesControl
|
|
74
70
|
values={ { all: computedValue } }
|
|
75
|
-
onChange={
|
|
71
|
+
onChange={ ( { all } ) => {
|
|
72
|
+
onChange( all );
|
|
73
|
+
} }
|
|
76
74
|
label={ label }
|
|
77
75
|
sides={ [ 'all' ] }
|
|
78
76
|
units={ units }
|
|
@@ -93,6 +91,8 @@ export default function SpacerControls( {
|
|
|
93
91
|
width,
|
|
94
92
|
isResizing,
|
|
95
93
|
} ) {
|
|
94
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
95
|
+
|
|
96
96
|
return (
|
|
97
97
|
<InspectorControls>
|
|
98
98
|
<ToolsPanel
|
|
@@ -103,6 +103,7 @@ export default function SpacerControls( {
|
|
|
103
103
|
height: '100px',
|
|
104
104
|
} );
|
|
105
105
|
} }
|
|
106
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
106
107
|
>
|
|
107
108
|
{ orientation === 'horizontal' && (
|
|
108
109
|
<ToolsPanelItem
|
package/src/spacer/edit.js
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
import { ResizableBox } from '@wordpress/components';
|
|
17
17
|
import { useState, useEffect } from '@wordpress/element';
|
|
18
18
|
import { View } from '@wordpress/primitives';
|
|
19
|
-
import { useSelect } from '@wordpress/data';
|
|
19
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Internal dependencies
|
|
@@ -124,6 +124,9 @@ const SpacerEdit = ( {
|
|
|
124
124
|
const onResizeStart = () => toggleSelection( false );
|
|
125
125
|
const onResizeStop = () => toggleSelection( true );
|
|
126
126
|
|
|
127
|
+
const { __unstableMarkNextChangeAsNotPersistent } =
|
|
128
|
+
useDispatch( blockEditorStore );
|
|
129
|
+
|
|
127
130
|
const handleOnVerticalResizeStop = ( newHeight ) => {
|
|
128
131
|
onResizeStop();
|
|
129
132
|
|
|
@@ -256,11 +259,19 @@ const SpacerEdit = ( {
|
|
|
256
259
|
};
|
|
257
260
|
|
|
258
261
|
useEffect( () => {
|
|
262
|
+
// To avoid interfering with undo/redo operations any changes in this
|
|
263
|
+
// effect must not make history and should be preceded by
|
|
264
|
+
// `__unstableMarkNextChangeAsNotPersistent()`.
|
|
265
|
+
const setAttributesCovertly = ( nextAttributes ) => {
|
|
266
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
267
|
+
setAttributes( nextAttributes );
|
|
268
|
+
};
|
|
269
|
+
|
|
259
270
|
if (
|
|
260
271
|
isFlexLayout &&
|
|
261
272
|
selfStretch !== 'fill' &&
|
|
262
273
|
selfStretch !== 'fit' &&
|
|
263
|
-
|
|
274
|
+
flexSize === undefined
|
|
264
275
|
) {
|
|
265
276
|
if ( inheritedOrientation === 'horizontal' ) {
|
|
266
277
|
// If spacer is moving from a vertical container to a horizontal container,
|
|
@@ -269,7 +280,7 @@ const SpacerEdit = ( {
|
|
|
269
280
|
getCustomValueFromPreset( width, spacingSizes ) ||
|
|
270
281
|
getCustomValueFromPreset( height, spacingSizes ) ||
|
|
271
282
|
'100px';
|
|
272
|
-
|
|
283
|
+
setAttributesCovertly( {
|
|
273
284
|
width: '0px',
|
|
274
285
|
style: {
|
|
275
286
|
...blockStyle,
|
|
@@ -285,7 +296,7 @@ const SpacerEdit = ( {
|
|
|
285
296
|
getCustomValueFromPreset( height, spacingSizes ) ||
|
|
286
297
|
getCustomValueFromPreset( width, spacingSizes ) ||
|
|
287
298
|
'100px';
|
|
288
|
-
|
|
299
|
+
setAttributesCovertly( {
|
|
289
300
|
height: '0px',
|
|
290
301
|
style: {
|
|
291
302
|
...blockStyle,
|
|
@@ -301,26 +312,16 @@ const SpacerEdit = ( {
|
|
|
301
312
|
isFlexLayout &&
|
|
302
313
|
( selfStretch === 'fill' || selfStretch === 'fit' )
|
|
303
314
|
) {
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
width: undefined
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
setAttributes( {
|
|
310
|
-
height: undefined,
|
|
311
|
-
} );
|
|
312
|
-
}
|
|
315
|
+
setAttributesCovertly(
|
|
316
|
+
inheritedOrientation === 'horizontal'
|
|
317
|
+
? { width: undefined }
|
|
318
|
+
: { height: undefined }
|
|
319
|
+
);
|
|
313
320
|
} else if ( ! isFlexLayout && ( selfStretch || flexSize ) ) {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
width: flexSize
|
|
317
|
-
|
|
318
|
-
} else {
|
|
319
|
-
setAttributes( {
|
|
320
|
-
height: flexSize,
|
|
321
|
-
} );
|
|
322
|
-
}
|
|
323
|
-
setAttributes( {
|
|
321
|
+
setAttributesCovertly( {
|
|
322
|
+
...( inheritedOrientation === 'horizontal'
|
|
323
|
+
? { width: flexSize }
|
|
324
|
+
: { height: flexSize } ),
|
|
324
325
|
style: {
|
|
325
326
|
...blockStyle,
|
|
326
327
|
layout: {
|
|
@@ -342,6 +343,7 @@ const SpacerEdit = ( {
|
|
|
342
343
|
setAttributes,
|
|
343
344
|
spacingSizes,
|
|
344
345
|
width,
|
|
346
|
+
__unstableMarkNextChangeAsNotPersistent,
|
|
345
347
|
] );
|
|
346
348
|
|
|
347
349
|
return (
|
|
@@ -10,27 +10,7 @@ import { useSelect } from '@wordpress/data';
|
|
|
10
10
|
* Internal dependencies
|
|
11
11
|
*/
|
|
12
12
|
import { TemplatePartImportControls } from './import-controls';
|
|
13
|
-
|
|
14
|
-
const htmlElementMessages = {
|
|
15
|
-
header: __(
|
|
16
|
-
'The <header> element should represent introductory content, typically a group of introductory or navigational aids.'
|
|
17
|
-
),
|
|
18
|
-
main: __(
|
|
19
|
-
'The <main> element should be used for the primary content of your document only.'
|
|
20
|
-
),
|
|
21
|
-
section: __(
|
|
22
|
-
"The <section> element should represent a standalone portion of the document that can't be better represented by another element."
|
|
23
|
-
),
|
|
24
|
-
article: __(
|
|
25
|
-
'The <article> element should represent a self-contained, syndicatable portion of the document.'
|
|
26
|
-
),
|
|
27
|
-
aside: __(
|
|
28
|
-
"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content."
|
|
29
|
-
),
|
|
30
|
-
footer: __(
|
|
31
|
-
'The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'
|
|
32
|
-
),
|
|
33
|
-
};
|
|
13
|
+
import { htmlElementMessages } from '../../utils/messages';
|
|
34
14
|
|
|
35
15
|
export function TemplatePartAdvancedControls( {
|
|
36
16
|
tagName,
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
export const htmlElementMessages = {
|
|
7
|
+
article: __(
|
|
8
|
+
'The <article> element should represent a self-contained, syndicatable portion of the document.'
|
|
9
|
+
),
|
|
10
|
+
aside: __(
|
|
11
|
+
"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content."
|
|
12
|
+
),
|
|
13
|
+
div: __(
|
|
14
|
+
'The <div> element should only be used if the block is a design element with no semantic meaning.'
|
|
15
|
+
),
|
|
16
|
+
footer: __(
|
|
17
|
+
'The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'
|
|
18
|
+
),
|
|
19
|
+
header: __(
|
|
20
|
+
'The <header> element should represent introductory content, typically a group of introductory or navigational aids.'
|
|
21
|
+
),
|
|
22
|
+
main: __(
|
|
23
|
+
'The <main> element should be used for the primary content of your document only.'
|
|
24
|
+
),
|
|
25
|
+
nav: __(
|
|
26
|
+
'The <nav> element should be used to identify groups of links that are intended to be used for website or page content navigation.'
|
|
27
|
+
),
|
|
28
|
+
section: __(
|
|
29
|
+
"The <section> element should represent a standalone portion of the document that can't be better represented by another element."
|
|
30
|
+
),
|
|
31
|
+
};
|
|
@@ -125,7 +125,7 @@ const VideoSettings = ( { setAttributes, attributes } ) => {
|
|
|
125
125
|
/* translators: Setting to play videos within the webpage on mobile browsers rather than opening in a fullscreen player. */
|
|
126
126
|
label={ __( 'Play inline' ) }
|
|
127
127
|
onChange={ toggleFactory.playsInline }
|
|
128
|
-
checked={ playsInline }
|
|
128
|
+
checked={ !! playsInline }
|
|
129
129
|
help={ __(
|
|
130
130
|
'When enabled, videos will play directly within the webpage on mobile browsers, instead of opening in a fullscreen player.'
|
|
131
131
|
) }
|