@wordpress/block-library 7.3.9 → 7.3.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/avatar/hooks.js +2 -2
- package/build/avatar/hooks.js.map +1 -1
- package/build/columns/index.js +3 -1
- package/build/columns/index.js.map +1 -1
- package/build/comment-author-name/edit.js +3 -3
- package/build/comment-author-name/edit.js.map +1 -1
- package/build/comment-author-name/index.js +0 -4
- package/build/comment-author-name/index.js.map +1 -1
- package/build/comment-date/edit.js +4 -4
- package/build/comment-date/edit.js.map +1 -1
- package/build/comment-date/index.js +0 -4
- package/build/comment-date/index.js.map +1 -1
- package/build/comment-edit-link/index.js +0 -4
- package/build/comment-edit-link/index.js.map +1 -1
- package/build/comment-reply-link/index.js +0 -4
- package/build/comment-reply-link/index.js.map +1 -1
- package/build/comments-query-loop/edit.js +10 -2
- package/build/comments-query-loop/edit.js.map +1 -1
- package/build/gallery/gap-styles.js +14 -4
- package/build/gallery/gap-styles.js.map +1 -1
- package/build/image/edit.js +5 -56
- package/build/image/edit.js.map +1 -1
- package/build/image/image.js +4 -15
- package/build/image/image.js.map +1 -1
- package/build/latest-posts/edit.js +30 -4
- package/build/latest-posts/edit.js.map +1 -1
- package/build/media-text/edit.js +0 -1
- package/build/media-text/edit.js.map +1 -1
- package/build/navigation/edit/index.js +81 -80
- package/build/navigation/edit/index.js.map +1 -1
- package/build/post-comments/edit.js +12 -33
- package/build/post-comments/edit.js.map +1 -1
- package/build/post-comments-form/edit.js +48 -25
- package/build/post-comments-form/edit.js.map +1 -1
- package/build/post-comments-form/form.js +48 -0
- package/build/post-comments-form/form.js.map +1 -0
- package/build-module/avatar/hooks.js +2 -2
- package/build-module/avatar/hooks.js.map +1 -1
- package/build-module/columns/index.js +3 -1
- package/build-module/columns/index.js.map +1 -1
- package/build-module/comment-author-name/edit.js +3 -3
- package/build-module/comment-author-name/edit.js.map +1 -1
- package/build-module/comment-author-name/index.js +0 -4
- package/build-module/comment-author-name/index.js.map +1 -1
- package/build-module/comment-date/edit.js +4 -4
- package/build-module/comment-date/edit.js.map +1 -1
- package/build-module/comment-date/index.js +0 -4
- package/build-module/comment-date/index.js.map +1 -1
- package/build-module/comment-edit-link/index.js +0 -4
- package/build-module/comment-edit-link/index.js.map +1 -1
- package/build-module/comment-reply-link/index.js +0 -4
- package/build-module/comment-reply-link/index.js.map +1 -1
- package/build-module/comments-query-loop/edit.js +10 -2
- package/build-module/comments-query-loop/edit.js.map +1 -1
- package/build-module/gallery/gap-styles.js +14 -4
- package/build-module/gallery/gap-styles.js.map +1 -1
- package/build-module/image/edit.js +4 -52
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/image.js +5 -16
- package/build-module/image/image.js.map +1 -1
- package/build-module/latest-posts/edit.js +29 -5
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/media-text/edit.js +0 -1
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/navigation/edit/index.js +81 -80
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/post-comments/edit.js +12 -34
- package/build-module/post-comments/edit.js.map +1 -1
- package/build-module/post-comments-form/edit.js +49 -28
- package/build-module/post-comments-form/edit.js.map +1 -1
- package/build-module/post-comments-form/form.js +39 -0
- package/build-module/post-comments-form/form.js.map +1 -0
- package/build-style/editor-rtl.css +3 -0
- package/build-style/editor.css +3 -0
- package/build-style/navigation/style-rtl.css +3 -0
- package/build-style/navigation/style.css +3 -0
- package/build-style/post-comments/style-rtl.css +15 -0
- package/build-style/post-comments/style.css +15 -0
- package/build-style/post-comments-form/editor-rtl.css +3 -0
- package/build-style/post-comments-form/editor.css +3 -0
- package/build-style/style-rtl.css +18 -0
- package/build-style/style.css +18 -0
- package/package.json +7 -7
- package/src/avatar/hooks.js +9 -6
- package/src/columns/block.json +3 -1
- package/src/comment-author-name/block.json +0 -4
- package/src/comment-author-name/edit.js +3 -12
- package/src/comment-date/block.json +0 -4
- package/src/comment-date/edit.js +10 -14
- package/src/comment-date/index.php +0 -3
- package/src/comment-edit-link/block.json +0 -4
- package/src/comment-reply-link/block.json +0 -4
- package/src/comments-query-loop/edit.js +24 -4
- package/src/cover/index.php +9 -6
- package/src/gallery/gap-styles.js +21 -6
- package/src/gallery/index.php +24 -4
- package/src/image/edit.js +0 -44
- package/src/image/image.js +3 -14
- package/src/latest-posts/edit.js +27 -2
- package/src/media-text/edit.js +0 -1
- package/src/navigation/edit/index.js +140 -143
- package/src/navigation/style.scss +3 -0
- package/src/post-comments/edit.js +13 -42
- package/src/post-comments/style.scss +18 -0
- package/src/post-comments-form/edit.js +68 -59
- package/src/post-comments-form/editor.scss +4 -0
- package/src/post-comments-form/form.js +43 -0
- package/src/post-template/index.php +15 -3
package/src/image/image.js
CHANGED
|
@@ -43,7 +43,7 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
43
43
|
*/
|
|
44
44
|
import { createUpgradedEmbedBlock } from '../embed/util';
|
|
45
45
|
import useClientWidth from './use-client-width';
|
|
46
|
-
import { isExternalImage
|
|
46
|
+
import { isExternalImage } from './edit';
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* Module constants
|
|
@@ -72,14 +72,12 @@ export default function Image( {
|
|
|
72
72
|
isSelected,
|
|
73
73
|
insertBlocksAfter,
|
|
74
74
|
onReplace,
|
|
75
|
-
onCloseModal,
|
|
76
75
|
onSelectImage,
|
|
77
76
|
onSelectURL,
|
|
78
77
|
onUploadError,
|
|
79
78
|
containerRef,
|
|
80
79
|
context,
|
|
81
80
|
clientId,
|
|
82
|
-
onImageLoadError,
|
|
83
81
|
} ) {
|
|
84
82
|
const imageRef = useRef();
|
|
85
83
|
const captionRef = useRef();
|
|
@@ -218,16 +216,11 @@ export default function Image( {
|
|
|
218
216
|
}
|
|
219
217
|
|
|
220
218
|
function onImageError() {
|
|
221
|
-
// Check if there's an embed block that handles this URL
|
|
222
|
-
// See: https://github.com/WordPress/gutenberg/pull/11472
|
|
219
|
+
// Check if there's an embed block that handles this URL.
|
|
223
220
|
const embedBlock = createUpgradedEmbedBlock( { attributes: { url } } );
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
if ( shouldReplace ) {
|
|
221
|
+
if ( undefined !== embedBlock ) {
|
|
227
222
|
onReplace( embedBlock );
|
|
228
223
|
}
|
|
229
|
-
|
|
230
|
-
onImageLoadError( shouldReplace );
|
|
231
224
|
}
|
|
232
225
|
|
|
233
226
|
function onSetHref( props ) {
|
|
@@ -299,9 +292,6 @@ export default function Image( {
|
|
|
299
292
|
if ( ! isSelected ) {
|
|
300
293
|
setIsEditingImage( false );
|
|
301
294
|
}
|
|
302
|
-
if ( isSelected && isMediaDestroyed( id ) ) {
|
|
303
|
-
onImageLoadError();
|
|
304
|
-
}
|
|
305
295
|
}, [ isSelected ] );
|
|
306
296
|
|
|
307
297
|
const canEditImage = id && naturalWidth && naturalHeight && imageEditing;
|
|
@@ -365,7 +355,6 @@ export default function Image( {
|
|
|
365
355
|
onSelect={ onSelectImage }
|
|
366
356
|
onSelectURL={ onSelectURL }
|
|
367
357
|
onError={ onUploadError }
|
|
368
|
-
onCloseModal={ onCloseModal }
|
|
369
358
|
/>
|
|
370
359
|
</BlockControls>
|
|
371
360
|
) }
|
package/src/latest-posts/edit.js
CHANGED
|
@@ -28,9 +28,11 @@ import {
|
|
|
28
28
|
useBlockProps,
|
|
29
29
|
store as blockEditorStore,
|
|
30
30
|
} from '@wordpress/block-editor';
|
|
31
|
-
import { useSelect } from '@wordpress/data';
|
|
31
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
32
32
|
import { pin, list, grid } from '@wordpress/icons';
|
|
33
33
|
import { store as coreStore } from '@wordpress/core-data';
|
|
34
|
+
import { store as noticeStore } from '@wordpress/notices';
|
|
35
|
+
import { useInstanceId } from '@wordpress/compose';
|
|
34
36
|
|
|
35
37
|
/**
|
|
36
38
|
* Internal dependencies
|
|
@@ -66,6 +68,7 @@ function getFeaturedImageDetails( post, size ) {
|
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
export default function LatestPostsEdit( { attributes, setAttributes } ) {
|
|
71
|
+
const instanceId = useInstanceId( LatestPostsEdit );
|
|
69
72
|
const {
|
|
70
73
|
postsToShow,
|
|
71
74
|
order,
|
|
@@ -148,6 +151,20 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
|
|
|
148
151
|
]
|
|
149
152
|
);
|
|
150
153
|
|
|
154
|
+
// If a user clicks to a link prevent redirection and show a warning.
|
|
155
|
+
const { createWarningNotice, removeNotice } = useDispatch( noticeStore );
|
|
156
|
+
let noticeId;
|
|
157
|
+
const showRedirectionPreventedNotice = ( event ) => {
|
|
158
|
+
event.preventDefault();
|
|
159
|
+
// Remove previous warning if any, to show one at a time per block.
|
|
160
|
+
removeNotice( noticeId );
|
|
161
|
+
noticeId = `block-library/core/latest-posts/redirection-prevented/${ instanceId }`;
|
|
162
|
+
createWarningNotice( __( 'Links are disabled in the editor.' ), {
|
|
163
|
+
id: noticeId,
|
|
164
|
+
type: 'snackbar',
|
|
165
|
+
} );
|
|
166
|
+
};
|
|
167
|
+
|
|
151
168
|
const imageSizeOptions = imageSizes
|
|
152
169
|
.filter( ( { slug } ) => slug !== 'full' )
|
|
153
170
|
.map( ( { name, slug } ) => ( {
|
|
@@ -466,7 +483,11 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
|
|
|
466
483
|
.join( ' ' ) }
|
|
467
484
|
{ /* translators: excerpt truncation character, default … */ }
|
|
468
485
|
{ __( ' … ' ) }
|
|
469
|
-
<a
|
|
486
|
+
<a
|
|
487
|
+
href={ post.link }
|
|
488
|
+
rel="noopener noreferrer"
|
|
489
|
+
onClick={ showRedirectionPreventedNotice }
|
|
490
|
+
>
|
|
470
491
|
{ __( 'Read more' ) }
|
|
471
492
|
</a>
|
|
472
493
|
</>
|
|
@@ -483,6 +504,9 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
|
|
|
483
504
|
className="wp-block-latest-posts__post-title"
|
|
484
505
|
href={ post.link }
|
|
485
506
|
rel="noreferrer noopener"
|
|
507
|
+
onClick={
|
|
508
|
+
showRedirectionPreventedNotice
|
|
509
|
+
}
|
|
486
510
|
>
|
|
487
511
|
{ featuredImage }
|
|
488
512
|
</a>
|
|
@@ -501,6 +525,7 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
|
|
|
501
525
|
}
|
|
502
526
|
: undefined
|
|
503
527
|
}
|
|
528
|
+
onClick={ showRedirectionPreventedNotice }
|
|
504
529
|
>
|
|
505
530
|
{ ! titleTrimmed ? __( '(no title)' ) : null }
|
|
506
531
|
</a>
|
package/src/media-text/edit.js
CHANGED
|
@@ -549,6 +549,144 @@ function Navigation( {
|
|
|
549
549
|
} );
|
|
550
550
|
}, [ clientId, ref ] );
|
|
551
551
|
|
|
552
|
+
const isResponsive = 'never' !== overlayMenu;
|
|
553
|
+
|
|
554
|
+
const overlayMenuPreviewClasses = classnames(
|
|
555
|
+
'wp-block-navigation__overlay-menu-preview',
|
|
556
|
+
{ open: overlayMenuPreview }
|
|
557
|
+
);
|
|
558
|
+
|
|
559
|
+
const stylingInspectorControls = (
|
|
560
|
+
<InspectorControls>
|
|
561
|
+
{ hasSubmenuIndicatorSetting && (
|
|
562
|
+
<PanelBody title={ __( 'Display' ) }>
|
|
563
|
+
{ isResponsive && (
|
|
564
|
+
<Button
|
|
565
|
+
className={ overlayMenuPreviewClasses }
|
|
566
|
+
onClick={ () => {
|
|
567
|
+
setOverlayMenuPreview( ! overlayMenuPreview );
|
|
568
|
+
} }
|
|
569
|
+
>
|
|
570
|
+
{ hasIcon && <OverlayMenuIcon /> }
|
|
571
|
+
{ ! hasIcon && <span>{ __( 'Menu' ) }</span> }
|
|
572
|
+
</Button>
|
|
573
|
+
) }
|
|
574
|
+
{ overlayMenuPreview && (
|
|
575
|
+
<ToggleControl
|
|
576
|
+
label={ __( 'Show icon button' ) }
|
|
577
|
+
help={ __(
|
|
578
|
+
'Configure the visual appearance of the button opening the overlay menu.'
|
|
579
|
+
) }
|
|
580
|
+
onChange={ ( value ) =>
|
|
581
|
+
setAttributes( { hasIcon: value } )
|
|
582
|
+
}
|
|
583
|
+
checked={ hasIcon }
|
|
584
|
+
/>
|
|
585
|
+
) }
|
|
586
|
+
<h3>{ __( 'Overlay Menu' ) }</h3>
|
|
587
|
+
<ToggleGroupControl
|
|
588
|
+
label={ __( 'Configure overlay menu' ) }
|
|
589
|
+
value={ overlayMenu }
|
|
590
|
+
help={ __(
|
|
591
|
+
'Collapses the navigation options in a menu icon opening an overlay.'
|
|
592
|
+
) }
|
|
593
|
+
onChange={ ( value ) =>
|
|
594
|
+
setAttributes( { overlayMenu: value } )
|
|
595
|
+
}
|
|
596
|
+
isBlock
|
|
597
|
+
hideLabelFromVision
|
|
598
|
+
>
|
|
599
|
+
<ToggleGroupControlOption
|
|
600
|
+
value="never"
|
|
601
|
+
label={ __( 'Off' ) }
|
|
602
|
+
/>
|
|
603
|
+
<ToggleGroupControlOption
|
|
604
|
+
value="mobile"
|
|
605
|
+
label={ __( 'Mobile' ) }
|
|
606
|
+
/>
|
|
607
|
+
<ToggleGroupControlOption
|
|
608
|
+
value="always"
|
|
609
|
+
label={ __( 'Always' ) }
|
|
610
|
+
/>
|
|
611
|
+
</ToggleGroupControl>
|
|
612
|
+
{ hasSubmenus && (
|
|
613
|
+
<>
|
|
614
|
+
<h3>{ __( 'Submenus' ) }</h3>
|
|
615
|
+
<ToggleControl
|
|
616
|
+
checked={ openSubmenusOnClick }
|
|
617
|
+
onChange={ ( value ) => {
|
|
618
|
+
setAttributes( {
|
|
619
|
+
openSubmenusOnClick: value,
|
|
620
|
+
...( value && {
|
|
621
|
+
showSubmenuIcon: true,
|
|
622
|
+
} ), // Make sure arrows are shown when we toggle this on.
|
|
623
|
+
} );
|
|
624
|
+
} }
|
|
625
|
+
label={ __( 'Open on click' ) }
|
|
626
|
+
/>
|
|
627
|
+
|
|
628
|
+
<ToggleControl
|
|
629
|
+
checked={ showSubmenuIcon }
|
|
630
|
+
onChange={ ( value ) => {
|
|
631
|
+
setAttributes( {
|
|
632
|
+
showSubmenuIcon: value,
|
|
633
|
+
} );
|
|
634
|
+
} }
|
|
635
|
+
disabled={ attributes.openSubmenusOnClick }
|
|
636
|
+
label={ __( 'Show arrow' ) }
|
|
637
|
+
/>
|
|
638
|
+
</>
|
|
639
|
+
) }
|
|
640
|
+
</PanelBody>
|
|
641
|
+
) }
|
|
642
|
+
{ hasColorSettings && (
|
|
643
|
+
<PanelColorSettings
|
|
644
|
+
__experimentalHasMultipleOrigins
|
|
645
|
+
__experimentalIsRenderedInSidebar
|
|
646
|
+
title={ __( 'Color' ) }
|
|
647
|
+
initialOpen={ false }
|
|
648
|
+
colorSettings={ [
|
|
649
|
+
{
|
|
650
|
+
value: textColor.color,
|
|
651
|
+
onChange: setTextColor,
|
|
652
|
+
label: __( 'Text' ),
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
value: backgroundColor.color,
|
|
656
|
+
onChange: setBackgroundColor,
|
|
657
|
+
label: __( 'Background' ),
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
value: overlayTextColor.color,
|
|
661
|
+
onChange: setOverlayTextColor,
|
|
662
|
+
label: __( 'Submenu & overlay text' ),
|
|
663
|
+
},
|
|
664
|
+
{
|
|
665
|
+
value: overlayBackgroundColor.color,
|
|
666
|
+
onChange: setOverlayBackgroundColor,
|
|
667
|
+
label: __( 'Submenu & overlay background' ),
|
|
668
|
+
},
|
|
669
|
+
] }
|
|
670
|
+
>
|
|
671
|
+
{ enableContrastChecking && (
|
|
672
|
+
<>
|
|
673
|
+
<ContrastChecker
|
|
674
|
+
backgroundColor={ detectedBackgroundColor }
|
|
675
|
+
textColor={ detectedColor }
|
|
676
|
+
/>
|
|
677
|
+
<ContrastChecker
|
|
678
|
+
backgroundColor={
|
|
679
|
+
detectedOverlayBackgroundColor
|
|
680
|
+
}
|
|
681
|
+
textColor={ detectedOverlayColor }
|
|
682
|
+
/>
|
|
683
|
+
</>
|
|
684
|
+
) }
|
|
685
|
+
</PanelColorSettings>
|
|
686
|
+
) }
|
|
687
|
+
</InspectorControls>
|
|
688
|
+
);
|
|
689
|
+
|
|
552
690
|
// If the block has inner blocks, but no menu id, then these blocks are either:
|
|
553
691
|
// - inserted via a pattern.
|
|
554
692
|
// - inserted directly via Code View (or otherwise).
|
|
@@ -559,6 +697,7 @@ function Navigation( {
|
|
|
559
697
|
if ( hasUnsavedBlocks ) {
|
|
560
698
|
return (
|
|
561
699
|
<TagName { ...blockProps }>
|
|
700
|
+
{ stylingInspectorControls }
|
|
562
701
|
<ResponsiveWrapper
|
|
563
702
|
id={ clientId }
|
|
564
703
|
onToggle={ setResponsiveMenuVisibility }
|
|
@@ -624,13 +763,6 @@ function Navigation( {
|
|
|
624
763
|
? CustomPlaceholder
|
|
625
764
|
: Placeholder;
|
|
626
765
|
|
|
627
|
-
const isResponsive = 'never' !== overlayMenu;
|
|
628
|
-
|
|
629
|
-
const overlayMenuPreviewClasses = classnames(
|
|
630
|
-
'wp-block-navigation__overlay-menu-preview',
|
|
631
|
-
{ open: overlayMenuPreview }
|
|
632
|
-
);
|
|
633
|
-
|
|
634
766
|
if ( isPlaceholder ) {
|
|
635
767
|
return (
|
|
636
768
|
<TagName { ...blockProps }>
|
|
@@ -668,142 +800,7 @@ function Navigation( {
|
|
|
668
800
|
</ToolbarGroup>
|
|
669
801
|
) }
|
|
670
802
|
</BlockControls>
|
|
671
|
-
|
|
672
|
-
{ hasSubmenuIndicatorSetting && (
|
|
673
|
-
<PanelBody title={ __( 'Display' ) }>
|
|
674
|
-
{ isResponsive && (
|
|
675
|
-
<Button
|
|
676
|
-
className={ overlayMenuPreviewClasses }
|
|
677
|
-
onClick={ () => {
|
|
678
|
-
setOverlayMenuPreview(
|
|
679
|
-
! overlayMenuPreview
|
|
680
|
-
);
|
|
681
|
-
} }
|
|
682
|
-
>
|
|
683
|
-
{ hasIcon && <OverlayMenuIcon /> }
|
|
684
|
-
{ ! hasIcon && (
|
|
685
|
-
<span>{ __( 'Menu' ) }</span>
|
|
686
|
-
) }
|
|
687
|
-
</Button>
|
|
688
|
-
) }
|
|
689
|
-
{ overlayMenuPreview && (
|
|
690
|
-
<ToggleControl
|
|
691
|
-
label={ __( 'Show icon button' ) }
|
|
692
|
-
help={ __(
|
|
693
|
-
'Configure the visual appearance of the button opening the overlay menu.'
|
|
694
|
-
) }
|
|
695
|
-
onChange={ ( value ) =>
|
|
696
|
-
setAttributes( { hasIcon: value } )
|
|
697
|
-
}
|
|
698
|
-
checked={ hasIcon }
|
|
699
|
-
/>
|
|
700
|
-
) }
|
|
701
|
-
<h3>{ __( 'Overlay Menu' ) }</h3>
|
|
702
|
-
<ToggleGroupControl
|
|
703
|
-
label={ __( 'Configure overlay menu' ) }
|
|
704
|
-
value={ overlayMenu }
|
|
705
|
-
help={ __(
|
|
706
|
-
'Collapses the navigation options in a menu icon opening an overlay.'
|
|
707
|
-
) }
|
|
708
|
-
onChange={ ( value ) =>
|
|
709
|
-
setAttributes( { overlayMenu: value } )
|
|
710
|
-
}
|
|
711
|
-
isBlock
|
|
712
|
-
hideLabelFromVision
|
|
713
|
-
>
|
|
714
|
-
<ToggleGroupControlOption
|
|
715
|
-
value="never"
|
|
716
|
-
label={ __( 'Off' ) }
|
|
717
|
-
/>
|
|
718
|
-
<ToggleGroupControlOption
|
|
719
|
-
value="mobile"
|
|
720
|
-
label={ __( 'Mobile' ) }
|
|
721
|
-
/>
|
|
722
|
-
<ToggleGroupControlOption
|
|
723
|
-
value="always"
|
|
724
|
-
label={ __( 'Always' ) }
|
|
725
|
-
/>
|
|
726
|
-
</ToggleGroupControl>
|
|
727
|
-
{ hasSubmenus && (
|
|
728
|
-
<>
|
|
729
|
-
<h3>{ __( 'Submenus' ) }</h3>
|
|
730
|
-
<ToggleControl
|
|
731
|
-
checked={ openSubmenusOnClick }
|
|
732
|
-
onChange={ ( value ) => {
|
|
733
|
-
setAttributes( {
|
|
734
|
-
openSubmenusOnClick: value,
|
|
735
|
-
...( value && {
|
|
736
|
-
showSubmenuIcon: true,
|
|
737
|
-
} ), // Make sure arrows are shown when we toggle this on.
|
|
738
|
-
} );
|
|
739
|
-
} }
|
|
740
|
-
label={ __( 'Open on click' ) }
|
|
741
|
-
/>
|
|
742
|
-
|
|
743
|
-
<ToggleControl
|
|
744
|
-
checked={ showSubmenuIcon }
|
|
745
|
-
onChange={ ( value ) => {
|
|
746
|
-
setAttributes( {
|
|
747
|
-
showSubmenuIcon: value,
|
|
748
|
-
} );
|
|
749
|
-
} }
|
|
750
|
-
disabled={
|
|
751
|
-
attributes.openSubmenusOnClick
|
|
752
|
-
}
|
|
753
|
-
label={ __( 'Show arrow' ) }
|
|
754
|
-
/>
|
|
755
|
-
</>
|
|
756
|
-
) }
|
|
757
|
-
</PanelBody>
|
|
758
|
-
) }
|
|
759
|
-
{ hasColorSettings && (
|
|
760
|
-
<PanelColorSettings
|
|
761
|
-
__experimentalHasMultipleOrigins
|
|
762
|
-
__experimentalIsRenderedInSidebar
|
|
763
|
-
title={ __( 'Color' ) }
|
|
764
|
-
initialOpen={ false }
|
|
765
|
-
colorSettings={ [
|
|
766
|
-
{
|
|
767
|
-
value: textColor.color,
|
|
768
|
-
onChange: setTextColor,
|
|
769
|
-
label: __( 'Text' ),
|
|
770
|
-
},
|
|
771
|
-
{
|
|
772
|
-
value: backgroundColor.color,
|
|
773
|
-
onChange: setBackgroundColor,
|
|
774
|
-
label: __( 'Background' ),
|
|
775
|
-
},
|
|
776
|
-
{
|
|
777
|
-
value: overlayTextColor.color,
|
|
778
|
-
onChange: setOverlayTextColor,
|
|
779
|
-
label: __( 'Submenu & overlay text' ),
|
|
780
|
-
},
|
|
781
|
-
{
|
|
782
|
-
value: overlayBackgroundColor.color,
|
|
783
|
-
onChange: setOverlayBackgroundColor,
|
|
784
|
-
label: __( 'Submenu & overlay background' ),
|
|
785
|
-
},
|
|
786
|
-
] }
|
|
787
|
-
>
|
|
788
|
-
{ enableContrastChecking && (
|
|
789
|
-
<>
|
|
790
|
-
<ContrastChecker
|
|
791
|
-
backgroundColor={
|
|
792
|
-
detectedBackgroundColor
|
|
793
|
-
}
|
|
794
|
-
textColor={ detectedColor }
|
|
795
|
-
/>
|
|
796
|
-
<ContrastChecker
|
|
797
|
-
backgroundColor={
|
|
798
|
-
detectedOverlayBackgroundColor
|
|
799
|
-
}
|
|
800
|
-
textColor={ detectedOverlayColor }
|
|
801
|
-
/>
|
|
802
|
-
</>
|
|
803
|
-
) }
|
|
804
|
-
</PanelColorSettings>
|
|
805
|
-
) }
|
|
806
|
-
</InspectorControls>
|
|
803
|
+
{ stylingInspectorControls }
|
|
807
804
|
{ isEntityAvailable && (
|
|
808
805
|
<InspectorControls __experimentalGroup="advanced">
|
|
809
806
|
{ hasResolvedCanUserUpdateNavigationMenu &&
|
|
@@ -299,6 +299,9 @@ button.wp-block-navigation-item__content {
|
|
|
299
299
|
font-size: inherit;
|
|
300
300
|
font-family: inherit;
|
|
301
301
|
line-height: inherit;
|
|
302
|
+
font-style: inherit;
|
|
303
|
+
font-weight: inherit;
|
|
304
|
+
text-transform: inherit;
|
|
302
305
|
|
|
303
306
|
// Buttons default to center alignment. This becomes visible
|
|
304
307
|
// when a menu item label is long enough to wrap.
|
|
@@ -16,11 +16,14 @@ import {
|
|
|
16
16
|
import { __, sprintf } from '@wordpress/i18n';
|
|
17
17
|
import { useSelect } from '@wordpress/data';
|
|
18
18
|
import { useEntityProp, store as coreStore } from '@wordpress/core-data';
|
|
19
|
-
|
|
20
|
-
__experimentalUseDisabled as useDisabled,
|
|
21
|
-
useInstanceId,
|
|
22
|
-
} from '@wordpress/compose';
|
|
19
|
+
|
|
23
20
|
import { createInterpolateElement } from '@wordpress/element';
|
|
21
|
+
import { __experimentalUseDisabled as useDisabled } from '@wordpress/compose';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Internal dependencies
|
|
25
|
+
*/
|
|
26
|
+
import CommentsForm from '../post-comments-form/form';
|
|
24
27
|
|
|
25
28
|
export default function PostCommentsEdit( {
|
|
26
29
|
attributes: { textAlign },
|
|
@@ -54,7 +57,7 @@ export default function PostCommentsEdit( {
|
|
|
54
57
|
let warning = __(
|
|
55
58
|
'Post Comments block: This is just a placeholder, not a real comment. The final styling may differ because it also depends on the current theme. For better compatibility with the Block Editor, please consider replacing this block with the "Comments Query Loop" block.'
|
|
56
59
|
);
|
|
57
|
-
let
|
|
60
|
+
let showPlaceholder = true;
|
|
58
61
|
|
|
59
62
|
if ( ! isSiteEditor && 'open' !== commentStatus ) {
|
|
60
63
|
if ( 'closed' === commentStatus ) {
|
|
@@ -65,7 +68,7 @@ export default function PostCommentsEdit( {
|
|
|
65
68
|
),
|
|
66
69
|
postType
|
|
67
70
|
);
|
|
68
|
-
|
|
71
|
+
showPlaceholder = false;
|
|
69
72
|
} else if ( ! postTypeSupportsComments ) {
|
|
70
73
|
warning = sprintf(
|
|
71
74
|
/* translators: 1: Post type (i.e. "post", "page") */
|
|
@@ -74,10 +77,10 @@ export default function PostCommentsEdit( {
|
|
|
74
77
|
),
|
|
75
78
|
postType
|
|
76
79
|
);
|
|
77
|
-
|
|
80
|
+
showPlaceholder = false;
|
|
78
81
|
} else if ( 'open' !== defaultCommentStatus ) {
|
|
79
82
|
warning = __( 'Post Comments block: Comments are not enabled.' );
|
|
80
|
-
|
|
83
|
+
showPlaceholder = false;
|
|
81
84
|
}
|
|
82
85
|
}
|
|
83
86
|
|
|
@@ -89,8 +92,6 @@ export default function PostCommentsEdit( {
|
|
|
89
92
|
|
|
90
93
|
const disabledRef = useDisabled();
|
|
91
94
|
|
|
92
|
-
const textareaId = useInstanceId( PostCommentsEdit );
|
|
93
|
-
|
|
94
95
|
return (
|
|
95
96
|
<>
|
|
96
97
|
<BlockControls group="block">
|
|
@@ -105,7 +106,7 @@ export default function PostCommentsEdit( {
|
|
|
105
106
|
<div { ...blockProps }>
|
|
106
107
|
<Warning>{ warning }</Warning>
|
|
107
108
|
|
|
108
|
-
{
|
|
109
|
+
{ showPlaceholder && (
|
|
109
110
|
<div
|
|
110
111
|
className="wp-block-post-comments__placeholder"
|
|
111
112
|
ref={ disabledRef }
|
|
@@ -238,37 +239,7 @@ export default function PostCommentsEdit( {
|
|
|
238
239
|
</div>
|
|
239
240
|
</div>
|
|
240
241
|
|
|
241
|
-
<
|
|
242
|
-
<h3 className="comment-reply-title">
|
|
243
|
-
{ __( 'Leave a Reply' ) }
|
|
244
|
-
</h3>
|
|
245
|
-
|
|
246
|
-
<form className="comment-form" noValidate>
|
|
247
|
-
<p className="comment-form-comment">
|
|
248
|
-
<label
|
|
249
|
-
htmlFor={ `comment-${ textareaId }` }
|
|
250
|
-
>
|
|
251
|
-
{ __( 'Comment' ) }{ ' ' }
|
|
252
|
-
<span className="required">*</span>
|
|
253
|
-
</label>
|
|
254
|
-
<textarea
|
|
255
|
-
id={ `comment-${ textareaId }` }
|
|
256
|
-
name="comment"
|
|
257
|
-
cols="45"
|
|
258
|
-
rows="8"
|
|
259
|
-
required
|
|
260
|
-
/>
|
|
261
|
-
</p>
|
|
262
|
-
<p className="form-submit wp-block-button">
|
|
263
|
-
<input
|
|
264
|
-
name="submit"
|
|
265
|
-
type="submit"
|
|
266
|
-
className="submit wp-block-button__link"
|
|
267
|
-
value={ __( 'Post Comment' ) }
|
|
268
|
-
/>
|
|
269
|
-
</p>
|
|
270
|
-
</form>
|
|
271
|
-
</div>
|
|
242
|
+
<CommentsForm />
|
|
272
243
|
</div>
|
|
273
244
|
) }
|
|
274
245
|
</div>
|
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
.wp-block-post-comments {
|
|
2
|
+
/* utility classes */
|
|
3
|
+
.alignleft {
|
|
4
|
+
float: left;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.alignright {
|
|
8
|
+
float: right;
|
|
9
|
+
}
|
|
10
|
+
/* end utility classes */
|
|
11
|
+
|
|
12
|
+
.navigation {
|
|
13
|
+
&::after {
|
|
14
|
+
content: "";
|
|
15
|
+
display: table;
|
|
16
|
+
clear: both;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
2
20
|
.commentlist {
|
|
3
21
|
clear: both;
|
|
4
22
|
list-style: none;
|