@wordpress/block-library 9.25.0 → 9.26.1-next.719a03cbe.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/avatar/edit.js +84 -39
- package/build/avatar/edit.js.map +1 -1
- package/build/avatar/user-control.js +32 -17
- package/build/avatar/user-control.js.map +1 -1
- package/build/button/edit.js +1 -1
- package/build/button/edit.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +2 -2
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/details/index.js +1 -1
- package/build/details/index.js.map +1 -1
- package/build/embed/variations.js +0 -10
- package/build/embed/variations.js.map +1 -1
- package/build/form/edit.js +0 -1
- package/build/form/edit.js.map +1 -1
- package/build/form/index.js +3 -3
- package/build/form/index.js.map +1 -1
- package/build/form-input/index.js +2 -1
- package/build/form-input/index.js.map +1 -1
- package/build/form-submission-notification/index.js +2 -1
- package/build/form-submission-notification/index.js.map +1 -1
- package/build/form-submit-button/index.js +2 -1
- package/build/form-submit-button/index.js.map +1 -1
- package/build/gallery/constants.js +2 -1
- package/build/gallery/constants.js.map +1 -1
- package/build/gallery/edit.js +93 -15
- package/build/gallery/edit.js.map +1 -1
- package/build/image/edit.js +6 -0
- package/build/image/edit.js.map +1 -1
- package/build/image/image.js +1 -0
- package/build/image/image.js.map +1 -1
- package/build/image/view.js +0 -3
- package/build/image/view.js.map +1 -1
- package/build/list/index.js +0 -1
- package/build/list/index.js.map +1 -1
- package/build/more/edit.native.js +17 -32
- package/build/more/edit.native.js.map +1 -1
- package/build/navigation-link/edit.js +28 -1
- package/build/navigation-link/edit.js.map +1 -1
- package/build/post-author/edit.js +152 -52
- package/build/post-author/edit.js.map +1 -1
- package/build/post-comments-form/form.js +1 -1
- package/build/post-comments-form/form.js.map +1 -1
- package/build/post-featured-image/edit.js +2 -1
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-navigation-link/edit.js +72 -33
- package/build/post-navigation-link/edit.js.map +1 -1
- package/build/search/edit.js +1 -1
- package/build/search/edit.js.map +1 -1
- package/build/site-logo/edit.js +69 -24
- package/build/site-logo/edit.js.map +1 -1
- package/build/social-link/edit.js +21 -5
- package/build/social-link/edit.js.map +1 -1
- package/build/social-link/edit.native.js +13 -5
- package/build/social-link/edit.native.js.map +1 -1
- package/build/social-link/social-list.js +17 -25
- package/build/social-link/social-list.js.map +1 -1
- package/build/social-links/edit.js +8 -5
- package/build/social-links/edit.js.map +1 -1
- package/build/video/tracks-editor.js +23 -9
- package/build/video/tracks-editor.js.map +1 -1
- package/build-module/avatar/edit.js +83 -38
- package/build-module/avatar/edit.js.map +1 -1
- package/build-module/avatar/user-control.js +33 -18
- package/build-module/avatar/user-control.js.map +1 -1
- package/build-module/button/edit.js +1 -1
- package/build-module/button/edit.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +2 -2
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/details/index.js +1 -1
- package/build-module/details/index.js.map +1 -1
- package/build-module/embed/variations.js +0 -10
- package/build-module/embed/variations.js.map +1 -1
- package/build-module/form/edit.js +0 -1
- package/build-module/form/edit.js.map +1 -1
- package/build-module/form/index.js +3 -3
- package/build-module/form/index.js.map +1 -1
- package/build-module/form-input/index.js +2 -1
- package/build-module/form-input/index.js.map +1 -1
- package/build-module/form-submission-notification/index.js +2 -1
- package/build-module/form-submission-notification/index.js.map +1 -1
- package/build-module/form-submit-button/index.js +2 -1
- package/build-module/form-submit-button/index.js.map +1 -1
- package/build-module/gallery/constants.js +1 -0
- package/build-module/gallery/constants.js.map +1 -1
- package/build-module/gallery/edit.js +95 -17
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/image/edit.js +6 -0
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/image.js +1 -0
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/view.js +0 -3
- package/build-module/image/view.js.map +1 -1
- package/build-module/list/index.js +0 -1
- package/build-module/list/index.js.map +1 -1
- package/build-module/more/edit.native.js +16 -30
- package/build-module/more/edit.native.js.map +1 -1
- package/build-module/navigation-link/edit.js +29 -2
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/post-author/edit.js +153 -53
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-comments-form/form.js +1 -1
- package/build-module/post-comments-form/form.js.map +1 -1
- package/build-module/post-featured-image/edit.js +2 -1
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-navigation-link/edit.js +73 -34
- package/build-module/post-navigation-link/edit.js.map +1 -1
- package/build-module/search/edit.js +1 -1
- package/build-module/search/edit.js.map +1 -1
- package/build-module/site-logo/edit.js +70 -25
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/social-link/edit.js +24 -8
- package/build-module/social-link/edit.js.map +1 -1
- package/build-module/social-link/edit.native.js +15 -6
- package/build-module/social-link/edit.native.js.map +1 -1
- package/build-module/social-link/social-list.js +16 -21
- package/build-module/social-link/social-list.js.map +1 -1
- package/build-module/social-links/edit.js +8 -5
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/video/tracks-editor.js +24 -10
- package/build-module/video/tracks-editor.js.map +1 -1
- package/build-style/calendar/style-rtl.css +7 -7
- package/build-style/calendar/style.css +7 -7
- package/build-style/comments-pagination/editor-rtl.css +0 -12
- package/build-style/comments-pagination/editor.css +0 -14
- package/build-style/comments-pagination/style-rtl.css +0 -7
- package/build-style/comments-pagination/style.css +0 -9
- package/build-style/editor-rtl.css +0 -30
- package/build-style/editor.css +0 -32
- package/build-style/gallery/editor-rtl.css +0 -13
- package/build-style/gallery/editor.css +0 -13
- package/build-style/navigation/style-rtl.css +5 -0
- package/build-style/navigation/style.css +5 -0
- package/build-style/style-rtl.css +12 -14
- package/build-style/style.css +12 -16
- package/package.json +35 -35
- package/src/avatar/edit.js +99 -51
- package/src/avatar/user-control.js +34 -29
- package/src/button/edit.js +1 -1
- package/src/calendar/style.scss +10 -10
- package/src/comments-pagination/editor.scss +0 -15
- package/src/comments-pagination/style.scss +0 -8
- package/src/cover/edit/inspector-controls.js +1 -1
- package/src/details/index.js +1 -1
- package/src/editor.scss +0 -1
- package/src/embed/variations.js +0 -8
- package/src/form/block.json +1 -2
- package/src/form/edit.js +0 -1
- package/src/form/index.js +1 -0
- package/src/form-input/index.js +1 -0
- package/src/form-submission-notification/index.js +1 -0
- package/src/form-submit-button/index.js +1 -0
- package/src/gallery/constants.js +1 -0
- package/src/gallery/edit.js +182 -68
- package/src/gallery/editor.scss +0 -17
- package/src/image/edit.js +12 -0
- package/src/image/image.js +1 -0
- package/src/image/index.php +4 -1
- package/src/image/view.js +0 -3
- package/src/list/block.json +0 -1
- package/src/more/edit.native.js +19 -33
- package/src/navigation/style.scss +9 -0
- package/src/navigation-link/edit.js +32 -2
- package/src/post-author/edit.js +178 -63
- package/src/post-comments-form/form.js +1 -1
- package/src/post-featured-image/edit.js +1 -0
- package/src/post-navigation-link/edit.js +96 -51
- package/src/rss/index.php +2 -1
- package/src/search/edit.js +1 -1
- package/src/site-logo/edit.js +90 -35
- package/src/social-link/edit.js +18 -7
- package/src/social-link/edit.native.js +10 -4
- package/src/social-link/index.php +13 -0
- package/src/social-link/social-list.js +15 -20
- package/src/social-links/edit.js +6 -7
- package/src/video/tracks-editor.js +18 -6
- package/build-style/post-author/editor-rtl.css +0 -140
- package/build-style/post-author/editor.css +0 -140
- package/src/post-author/editor.scss +0 -7
package/src/gallery/edit.js
CHANGED
|
@@ -7,15 +7,15 @@ import clsx from 'clsx';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import {
|
|
10
|
-
BaseControl,
|
|
11
|
-
PanelBody,
|
|
12
10
|
SelectControl,
|
|
13
11
|
ToggleControl,
|
|
14
12
|
RangeControl,
|
|
15
|
-
Spinner,
|
|
16
13
|
MenuGroup,
|
|
17
14
|
MenuItem,
|
|
15
|
+
__experimentalToolsPanel as ToolsPanel,
|
|
16
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
18
17
|
ToolbarDropdownMenu,
|
|
18
|
+
PanelBody,
|
|
19
19
|
} from '@wordpress/components';
|
|
20
20
|
import {
|
|
21
21
|
store as blockEditorStore,
|
|
@@ -48,6 +48,7 @@ import {
|
|
|
48
48
|
import { sharedIcon } from './shared-icon';
|
|
49
49
|
import { defaultColumnsNumber, pickRelevantMediaFiles } from './shared';
|
|
50
50
|
import { getHrefAndDestination } from './utils';
|
|
51
|
+
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
51
52
|
import {
|
|
52
53
|
getUpdatedLinkTargetSettings,
|
|
53
54
|
getImageSizeAttributes,
|
|
@@ -58,6 +59,7 @@ import {
|
|
|
58
59
|
LINK_DESTINATION_MEDIA,
|
|
59
60
|
LINK_DESTINATION_NONE,
|
|
60
61
|
LINK_DESTINATION_LIGHTBOX,
|
|
62
|
+
DEFAULT_MEDIA_SIZE_SLUG,
|
|
61
63
|
} from './constants';
|
|
62
64
|
import useImageSizes from './use-image-sizes';
|
|
63
65
|
import useGetNewImages from './use-get-new-images';
|
|
@@ -465,7 +467,7 @@ export default function GalleryEdit( props ) {
|
|
|
465
467
|
sprintf(
|
|
466
468
|
/* translators: %s: image size settings */
|
|
467
469
|
__( 'All gallery image sizes updated to: %s' ),
|
|
468
|
-
imageSize
|
|
470
|
+
imageSize?.label ?? newSizeSlug
|
|
469
471
|
),
|
|
470
472
|
{
|
|
471
473
|
id: 'gallery-attributes-sizeSlug',
|
|
@@ -546,6 +548,8 @@ export default function GalleryEdit( props ) {
|
|
|
546
548
|
...nativeInnerBlockProps,
|
|
547
549
|
} );
|
|
548
550
|
|
|
551
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
552
|
+
|
|
549
553
|
if ( ! hasImages ) {
|
|
550
554
|
return (
|
|
551
555
|
<View { ...innerBlocksProps }>
|
|
@@ -560,39 +564,163 @@ export default function GalleryEdit( props ) {
|
|
|
560
564
|
return (
|
|
561
565
|
<>
|
|
562
566
|
<InspectorControls>
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
567
|
+
{ Platform.isWeb && (
|
|
568
|
+
<ToolsPanel
|
|
569
|
+
label={ __( 'Settings' ) }
|
|
570
|
+
resetAll={ () => {
|
|
571
|
+
setAttributes( {
|
|
572
|
+
columns: undefined,
|
|
573
|
+
imageCrop: true,
|
|
574
|
+
randomOrder: false,
|
|
575
|
+
} );
|
|
576
|
+
|
|
577
|
+
if ( sizeSlug !== DEFAULT_MEDIA_SIZE_SLUG ) {
|
|
578
|
+
updateImagesSize( DEFAULT_MEDIA_SIZE_SLUG );
|
|
572
579
|
}
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
580
|
+
|
|
581
|
+
if ( linkTarget ) {
|
|
582
|
+
toggleOpenInNewTab( false );
|
|
583
|
+
}
|
|
584
|
+
} }
|
|
585
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
586
|
+
>
|
|
587
|
+
{ images.length > 1 && (
|
|
588
|
+
<ToolsPanelItem
|
|
589
|
+
isShownByDefault
|
|
590
|
+
label={ __( 'Columns' ) }
|
|
591
|
+
hasValue={ () =>
|
|
592
|
+
!! columns && columns !== images.length
|
|
593
|
+
}
|
|
594
|
+
onDeselect={ () =>
|
|
595
|
+
setColumnsNumber( undefined )
|
|
596
|
+
}
|
|
597
|
+
>
|
|
598
|
+
<RangeControl
|
|
599
|
+
__nextHasNoMarginBottom
|
|
600
|
+
label={ __( 'Columns' ) }
|
|
601
|
+
value={
|
|
602
|
+
columns
|
|
603
|
+
? columns
|
|
604
|
+
: defaultColumnsNumber(
|
|
605
|
+
images.length
|
|
606
|
+
)
|
|
607
|
+
}
|
|
608
|
+
onChange={ setColumnsNumber }
|
|
609
|
+
min={ 1 }
|
|
610
|
+
max={ Math.min(
|
|
611
|
+
MAX_COLUMNS,
|
|
612
|
+
images.length
|
|
613
|
+
) }
|
|
614
|
+
required
|
|
615
|
+
__next40pxDefaultSize
|
|
616
|
+
/>
|
|
617
|
+
</ToolsPanelItem>
|
|
618
|
+
) }
|
|
619
|
+
{ imageSizeOptions?.length > 0 && (
|
|
620
|
+
<ToolsPanelItem
|
|
621
|
+
isShownByDefault
|
|
622
|
+
label={ __( 'Resolution' ) }
|
|
623
|
+
hasValue={ () =>
|
|
624
|
+
sizeSlug !== DEFAULT_MEDIA_SIZE_SLUG
|
|
625
|
+
}
|
|
626
|
+
onDeselect={ () =>
|
|
627
|
+
updateImagesSize( DEFAULT_MEDIA_SIZE_SLUG )
|
|
628
|
+
}
|
|
629
|
+
>
|
|
630
|
+
<SelectControl
|
|
631
|
+
__nextHasNoMarginBottom
|
|
632
|
+
label={ __( 'Resolution' ) }
|
|
633
|
+
help={ __(
|
|
634
|
+
'Select the size of the source images.'
|
|
635
|
+
) }
|
|
636
|
+
value={ sizeSlug }
|
|
637
|
+
options={ imageSizeOptions }
|
|
638
|
+
onChange={ updateImagesSize }
|
|
639
|
+
hideCancelButton
|
|
640
|
+
size="__unstable-large"
|
|
641
|
+
/>
|
|
642
|
+
</ToolsPanelItem>
|
|
643
|
+
) }
|
|
644
|
+
<ToolsPanelItem
|
|
645
|
+
isShownByDefault
|
|
646
|
+
label={ __( 'Crop images to fit' ) }
|
|
647
|
+
hasValue={ () => ! imageCrop }
|
|
648
|
+
onDeselect={ () =>
|
|
649
|
+
setAttributes( { imageCrop: true } )
|
|
650
|
+
}
|
|
651
|
+
>
|
|
652
|
+
<ToggleControl
|
|
653
|
+
__nextHasNoMarginBottom
|
|
654
|
+
label={ __( 'Crop images to fit' ) }
|
|
655
|
+
checked={ !! imageCrop }
|
|
656
|
+
onChange={ toggleImageCrop }
|
|
657
|
+
/>
|
|
658
|
+
</ToolsPanelItem>
|
|
659
|
+
<ToolsPanelItem
|
|
660
|
+
isShownByDefault
|
|
661
|
+
label={ __( 'Randomize order' ) }
|
|
662
|
+
hasValue={ () => !! randomOrder }
|
|
663
|
+
onDeselect={ () =>
|
|
664
|
+
setAttributes( { randomOrder: false } )
|
|
665
|
+
}
|
|
666
|
+
>
|
|
667
|
+
<ToggleControl
|
|
668
|
+
__nextHasNoMarginBottom
|
|
669
|
+
label={ __( 'Randomize order' ) }
|
|
670
|
+
checked={ !! randomOrder }
|
|
671
|
+
onChange={ toggleRandomOrder }
|
|
672
|
+
/>
|
|
673
|
+
</ToolsPanelItem>
|
|
674
|
+
{ hasLinkTo && (
|
|
675
|
+
<ToolsPanelItem
|
|
676
|
+
isShownByDefault
|
|
677
|
+
label={ __( 'Open images in new tab' ) }
|
|
678
|
+
hasValue={ () => !! linkTarget }
|
|
679
|
+
onDeselect={ () => toggleOpenInNewTab( false ) }
|
|
680
|
+
>
|
|
681
|
+
<ToggleControl
|
|
682
|
+
__nextHasNoMarginBottom
|
|
683
|
+
label={ __( 'Open images in new tab' ) }
|
|
684
|
+
checked={ linkTarget === '_blank' }
|
|
685
|
+
onChange={ toggleOpenInNewTab }
|
|
686
|
+
/>
|
|
687
|
+
</ToolsPanelItem>
|
|
688
|
+
) }
|
|
689
|
+
</ToolsPanel>
|
|
690
|
+
) }
|
|
691
|
+
{ Platform.isNative && (
|
|
692
|
+
<PanelBody title={ __( 'Settings' ) }>
|
|
693
|
+
{ images.length > 1 && (
|
|
694
|
+
<RangeControl
|
|
695
|
+
__nextHasNoMarginBottom
|
|
696
|
+
label={ __( 'Columns' ) }
|
|
697
|
+
value={
|
|
698
|
+
columns
|
|
699
|
+
? columns
|
|
700
|
+
: defaultColumnsNumber( images.length )
|
|
701
|
+
}
|
|
702
|
+
onChange={ setColumnsNumber }
|
|
703
|
+
min={ 1 }
|
|
704
|
+
max={ Math.min( MAX_COLUMNS, images.length ) }
|
|
705
|
+
{ ...MOBILE_CONTROL_PROPS_RANGE_CONTROL }
|
|
706
|
+
required
|
|
707
|
+
__next40pxDefaultSize
|
|
708
|
+
/>
|
|
709
|
+
) }
|
|
710
|
+
{ imageSizeOptions?.length > 0 && (
|
|
711
|
+
<SelectControl
|
|
712
|
+
__nextHasNoMarginBottom
|
|
713
|
+
label={ __( 'Resolution' ) }
|
|
714
|
+
help={ __(
|
|
715
|
+
'Select the size of the source images.'
|
|
716
|
+
) }
|
|
717
|
+
value={ sizeSlug }
|
|
718
|
+
options={ imageSizeOptions }
|
|
719
|
+
onChange={ updateImagesSize }
|
|
720
|
+
hideCancelButton
|
|
721
|
+
size="__unstable-large"
|
|
722
|
+
/>
|
|
723
|
+
) }
|
|
596
724
|
<SelectControl
|
|
597
725
|
__nextHasNoMarginBottom
|
|
598
726
|
label={ __( 'Link' ) }
|
|
@@ -602,42 +730,28 @@ export default function GalleryEdit( props ) {
|
|
|
602
730
|
hideCancelButton
|
|
603
731
|
size="__unstable-large"
|
|
604
732
|
/>
|
|
605
|
-
) : null }
|
|
606
|
-
<ToggleControl
|
|
607
|
-
__nextHasNoMarginBottom
|
|
608
|
-
label={ __( 'Crop images to fit' ) }
|
|
609
|
-
checked={ !! imageCrop }
|
|
610
|
-
onChange={ toggleImageCrop }
|
|
611
|
-
/>
|
|
612
|
-
<ToggleControl
|
|
613
|
-
__nextHasNoMarginBottom
|
|
614
|
-
label={ __( 'Randomize order' ) }
|
|
615
|
-
checked={ !! randomOrder }
|
|
616
|
-
onChange={ toggleRandomOrder }
|
|
617
|
-
/>
|
|
618
|
-
{ hasLinkTo && (
|
|
619
733
|
<ToggleControl
|
|
620
734
|
__nextHasNoMarginBottom
|
|
621
|
-
label={ __( '
|
|
622
|
-
checked={
|
|
623
|
-
onChange={
|
|
735
|
+
label={ __( 'Crop images to fit' ) }
|
|
736
|
+
checked={ !! imageCrop }
|
|
737
|
+
onChange={ toggleImageCrop }
|
|
624
738
|
/>
|
|
625
|
-
|
|
626
|
-
{ Platform.isWeb && ! imageSizeOptions && hasImageIds && (
|
|
627
|
-
<BaseControl
|
|
628
|
-
className="gallery-image-sizes"
|
|
739
|
+
<ToggleControl
|
|
629
740
|
__nextHasNoMarginBottom
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
741
|
+
label={ __( 'Randomize order' ) }
|
|
742
|
+
checked={ !! randomOrder }
|
|
743
|
+
onChange={ toggleRandomOrder }
|
|
744
|
+
/>
|
|
745
|
+
{ hasLinkTo && (
|
|
746
|
+
<ToggleControl
|
|
747
|
+
__nextHasNoMarginBottom
|
|
748
|
+
label={ __( 'Open images in new tab' ) }
|
|
749
|
+
checked={ linkTarget === '_blank' }
|
|
750
|
+
onChange={ toggleOpenInNewTab }
|
|
751
|
+
/>
|
|
752
|
+
) }
|
|
753
|
+
</PanelBody>
|
|
754
|
+
) }
|
|
641
755
|
</InspectorControls>
|
|
642
756
|
{ Platform.isWeb ? (
|
|
643
757
|
<BlockControls group="block">
|
package/src/gallery/editor.scss
CHANGED
|
@@ -68,23 +68,6 @@
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
.gallery-image-sizes {
|
|
72
|
-
.components-base-control__label {
|
|
73
|
-
margin-bottom: 4px;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.gallery-image-sizes__loading {
|
|
77
|
-
display: flex;
|
|
78
|
-
align-items: center;
|
|
79
|
-
color: $gray-700;
|
|
80
|
-
font-size: $helptext-font-size;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.components-spinner {
|
|
84
|
-
margin: 0 8px 0 4px;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
71
|
/**
|
|
89
72
|
* Deprecated css past this point. This can be removed once all galleries are migrated
|
|
90
73
|
* to V2.
|
package/src/image/edit.js
CHANGED
|
@@ -249,6 +249,18 @@ export function ImageEdit( {
|
|
|
249
249
|
|
|
250
250
|
let mediaAttributes = pickRelevantMediaFiles( media, newSize );
|
|
251
251
|
|
|
252
|
+
// Normalize newline characters in caption to <br />
|
|
253
|
+
// to preserve line breaks in both editor and frontend.
|
|
254
|
+
if (
|
|
255
|
+
typeof mediaAttributes.caption === 'string' &&
|
|
256
|
+
mediaAttributes.caption.includes( '\n' )
|
|
257
|
+
) {
|
|
258
|
+
mediaAttributes.caption = mediaAttributes.caption.replace(
|
|
259
|
+
/\n/g,
|
|
260
|
+
'<br>'
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
|
|
252
264
|
// If a caption text was meanwhile written by the user,
|
|
253
265
|
// make sure the text is not overwritten by empty captions.
|
|
254
266
|
if ( captionRef.current && ! mediaAttributes.caption ) {
|
package/src/image/image.js
CHANGED
package/src/image/index.php
CHANGED
|
@@ -204,6 +204,7 @@ function block_core_image_render_lightbox( $block_content, $block ) {
|
|
|
204
204
|
JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP
|
|
205
205
|
)
|
|
206
206
|
);
|
|
207
|
+
$p->set_attribute( 'data-wp-key', $unique_image_id );
|
|
207
208
|
|
|
208
209
|
// Image.
|
|
209
210
|
$p->next_tag( 'img' );
|
|
@@ -272,12 +273,14 @@ function block_core_image_print_lightbox_overlay() {
|
|
|
272
273
|
<div
|
|
273
274
|
class="wp-lightbox-overlay zoom"
|
|
274
275
|
data-wp-interactive="core/image"
|
|
276
|
+
data-wp-router-region='{ "id": "core/image-overlay", "attachTo": "body" }'
|
|
277
|
+
data-wp-key="wp-lightbox-overlay"
|
|
275
278
|
data-wp-context='{}'
|
|
276
279
|
data-wp-bind--role="state.roleAttribute"
|
|
277
280
|
data-wp-bind--aria-label="state.currentImage.ariaLabel"
|
|
278
281
|
data-wp-bind--aria-modal="state.ariaModal"
|
|
279
282
|
data-wp-class--active="state.overlayEnabled"
|
|
280
|
-
data-wp-class--show-closing-animation="state.
|
|
283
|
+
data-wp-class--show-closing-animation="state.overlayOpened"
|
|
281
284
|
data-wp-watch="callbacks.setOverlayFocus"
|
|
282
285
|
data-wp-on--keydown="actions.handleKeydown"
|
|
283
286
|
data-wp-on-async--touchstart="actions.handleTouchStart"
|
package/src/image/view.js
CHANGED
|
@@ -110,9 +110,6 @@ const { state, actions, callbacks } = store(
|
|
|
110
110
|
},
|
|
111
111
|
hideLightbox() {
|
|
112
112
|
if ( state.overlayEnabled ) {
|
|
113
|
-
// Starts the overlay closing animation. The showClosingAnimation
|
|
114
|
-
// class is used to avoid showing it on page load.
|
|
115
|
-
state.showClosingAnimation = true;
|
|
116
113
|
state.overlayEnabled = false;
|
|
117
114
|
|
|
118
115
|
// Waits until the close animation has completed before allowing a
|
package/src/list/block.json
CHANGED
package/src/more/edit.native.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { Component } from '@wordpress/element';
|
|
6
5
|
import { withPreferredColorScheme } from '@wordpress/compose';
|
|
7
6
|
import { HorizontalRule } from '@wordpress/components';
|
|
8
7
|
|
|
@@ -11,40 +10,27 @@ import { HorizontalRule } from '@wordpress/components';
|
|
|
11
10
|
*/
|
|
12
11
|
import styles from './editor.scss';
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
super( ...arguments );
|
|
13
|
+
function MoreEdit( { attributes, getStylesFromColorScheme } ) {
|
|
14
|
+
const { customText } = attributes;
|
|
17
15
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
const textStyle = getStylesFromColorScheme(
|
|
17
|
+
styles.moreText,
|
|
18
|
+
styles.moreTextDark
|
|
19
|
+
);
|
|
20
|
+
const lineStyle = getStylesFromColorScheme(
|
|
21
|
+
styles.moreLine,
|
|
22
|
+
styles.moreLineDark
|
|
23
|
+
);
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
);
|
|
33
|
-
const lineStyle = getStylesFromColorScheme(
|
|
34
|
-
styles.moreLine,
|
|
35
|
-
styles.moreLineDark
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<HorizontalRule
|
|
40
|
-
text={ content }
|
|
41
|
-
marginLeft={ 0 }
|
|
42
|
-
marginRight={ 0 }
|
|
43
|
-
textStyle={ textStyle }
|
|
44
|
-
lineStyle={ lineStyle }
|
|
45
|
-
/>
|
|
46
|
-
);
|
|
47
|
-
}
|
|
25
|
+
return (
|
|
26
|
+
<HorizontalRule
|
|
27
|
+
text={ customText || __( 'Read more' ) }
|
|
28
|
+
marginLeft={ 0 }
|
|
29
|
+
marginRight={ 0 }
|
|
30
|
+
textStyle={ textStyle }
|
|
31
|
+
lineStyle={ lineStyle }
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
48
34
|
}
|
|
49
35
|
|
|
50
36
|
export default withPreferredColorScheme( MoreEdit );
|
|
@@ -46,6 +46,7 @@ $navigation-icon-size: 24px;
|
|
|
46
46
|
// but still allow them to be overridden by user-set colors.
|
|
47
47
|
.wp-block-navigation-item__content {
|
|
48
48
|
display: block;
|
|
49
|
+
z-index: 1;
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
// This rule needs extra specificity so that it inherits the correct color from its parent.
|
|
@@ -310,6 +311,14 @@ button.wp-block-navigation-item__content {
|
|
|
310
311
|
|
|
311
312
|
.wp-block-navigation-submenu__toggle {
|
|
312
313
|
cursor: pointer;
|
|
314
|
+
|
|
315
|
+
// Rotate submenu icon when open.
|
|
316
|
+
&[aria-expanded="true"] {
|
|
317
|
+
+ .wp-block-navigation__submenu-icon > svg,
|
|
318
|
+
> svg {
|
|
319
|
+
transform: rotate(180deg);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
313
322
|
}
|
|
314
323
|
|
|
315
324
|
// When set to open on click, a button element is used.
|
|
@@ -11,6 +11,7 @@ import { useSelect, useDispatch } from '@wordpress/data';
|
|
|
11
11
|
import {
|
|
12
12
|
__experimentalToolsPanel as ToolsPanel,
|
|
13
13
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
14
|
+
CheckboxControl,
|
|
14
15
|
TextControl,
|
|
15
16
|
TextareaControl,
|
|
16
17
|
ToolbarButton,
|
|
@@ -42,6 +43,7 @@ import { useMergeRefs, usePrevious } from '@wordpress/compose';
|
|
|
42
43
|
import { LinkUI } from './link-ui';
|
|
43
44
|
import { updateAttributes } from './update-attributes';
|
|
44
45
|
import { getColors } from '../navigation/edit/utils';
|
|
46
|
+
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
45
47
|
|
|
46
48
|
const DEFAULT_BLOCK = { name: 'core/navigation-link' };
|
|
47
49
|
const NESTING_BLOCK_NAMES = [
|
|
@@ -174,9 +176,21 @@ function getMissingText( type ) {
|
|
|
174
176
|
* Consider reusing this components for both blocks.
|
|
175
177
|
*/
|
|
176
178
|
function Controls( { attributes, setAttributes, setIsLabelFieldFocused } ) {
|
|
177
|
-
const { label, url, description, rel } = attributes;
|
|
179
|
+
const { label, url, description, rel, opensInNewTab } = attributes;
|
|
180
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
178
181
|
return (
|
|
179
|
-
<ToolsPanel
|
|
182
|
+
<ToolsPanel
|
|
183
|
+
label={ __( 'Settings' ) }
|
|
184
|
+
resetAll={ () => {
|
|
185
|
+
setAttributes( {
|
|
186
|
+
label: '',
|
|
187
|
+
url: '',
|
|
188
|
+
description: '',
|
|
189
|
+
rel: '',
|
|
190
|
+
} );
|
|
191
|
+
} }
|
|
192
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
193
|
+
>
|
|
180
194
|
<ToolsPanelItem
|
|
181
195
|
hasValue={ () => !! label }
|
|
182
196
|
label={ __( 'Text' ) }
|
|
@@ -220,6 +234,22 @@ function Controls( { attributes, setAttributes, setIsLabelFieldFocused } ) {
|
|
|
220
234
|
/>
|
|
221
235
|
</ToolsPanelItem>
|
|
222
236
|
|
|
237
|
+
<ToolsPanelItem
|
|
238
|
+
hasValue={ () => !! opensInNewTab }
|
|
239
|
+
label={ __( 'Open in new tab' ) }
|
|
240
|
+
onDeselect={ () => setAttributes( { opensInNewTab: false } ) }
|
|
241
|
+
isShownByDefault
|
|
242
|
+
>
|
|
243
|
+
<CheckboxControl
|
|
244
|
+
__nextHasNoMarginBottom
|
|
245
|
+
label={ __( 'Open in new tab' ) }
|
|
246
|
+
checked={ opensInNewTab }
|
|
247
|
+
onChange={ ( value ) =>
|
|
248
|
+
setAttributes( { opensInNewTab: value } )
|
|
249
|
+
}
|
|
250
|
+
/>
|
|
251
|
+
</ToolsPanelItem>
|
|
252
|
+
|
|
223
253
|
<ToolsPanelItem
|
|
224
254
|
hasValue={ () => !! description }
|
|
225
255
|
label={ __( 'Description' ) }
|