@wordpress/block-library 7.10.0 → 7.11.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/button/edit.js +2 -1
- package/build/button/edit.js.map +1 -1
- package/build/buttons/edit.js +1 -1
- package/build/buttons/edit.js.map +1 -1
- package/build/columns/edit.native.js +1 -1
- package/build/columns/edit.native.js.map +1 -1
- package/build/comments/edit/comments-legacy.js +73 -0
- package/build/comments/edit/comments-legacy.js.map +1 -0
- package/build/comments/{edit.js → edit/index.js} +17 -38
- package/build/comments/edit/index.js.map +1 -0
- package/build/comments/edit/placeholder.js +117 -0
- package/build/comments/edit/placeholder.js.map +1 -0
- package/build/comments/edit/template.js +39 -0
- package/build/comments/edit/template.js.map +1 -0
- package/build/comments/index.js +6 -1
- package/build/comments/index.js.map +1 -1
- package/build/comments/save.js +12 -4
- package/build/comments/save.js.map +1 -1
- package/build/cover/transforms.js +3 -2
- package/build/cover/transforms.js.map +1 -1
- package/build/embed/embed-placeholder.native.js +1 -3
- package/build/embed/embed-placeholder.native.js.map +1 -1
- package/build/gallery/edit.js +2 -2
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/use-get-media.native.js +59 -0
- package/build/gallery/use-get-media.native.js.map +1 -0
- package/build/group/index.js +1 -0
- package/build/group/index.js.map +1 -1
- package/build/group/variations.js +1 -1
- package/build/group/variations.js.map +1 -1
- package/build/image/deprecated.js +77 -9
- package/build/image/deprecated.js.map +1 -1
- package/build/image/edit.js +3 -1
- package/build/image/edit.js.map +1 -1
- package/build/image/edit.native.js +18 -8
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +27 -20
- package/build/image/image.js.map +1 -1
- package/build/image/index.js +7 -1
- package/build/image/index.js.map +1 -1
- package/build/image/save.js +8 -2
- package/build/image/save.js.map +1 -1
- package/build/index.js +1 -3
- package/build/index.js.map +1 -1
- package/build/index.native.js +3 -13
- package/build/index.native.js.map +1 -1
- package/build/list/transforms.js +4 -63
- package/build/list/transforms.js.map +1 -1
- package/build/list/v2/transforms.js +0 -27
- package/build/list/v2/transforms.js.map +1 -1
- package/build/list-item/edit.js +14 -9
- package/build/list-item/edit.js.map +1 -1
- package/build/list-item/hooks/index.js +8 -8
- package/build/list-item/hooks/index.js.map +1 -1
- package/build/list-item/hooks/use-merge.js +174 -0
- package/build/list-item/hooks/use-merge.js.map +1 -0
- package/build/list-item/hooks/use-outdent-list-item.js +86 -50
- package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build/list-item/utils.js +125 -1
- package/build/list-item/utils.js.map +1 -1
- package/build/media-text/deprecated.js +134 -7
- package/build/media-text/deprecated.js.map +1 -1
- package/build/media-text/edit.js +2 -2
- package/build/media-text/edit.js.map +1 -1
- package/build/media-text/save.js +13 -0
- package/build/media-text/save.js.map +1 -1
- package/build/more/save.js +1 -7
- package/build/more/save.js.map +1 -1
- package/build/navigation-link/edit.js +5 -4
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-submenu/edit.js +2 -1
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/page-list/edit.js +8 -1
- package/build/page-list/edit.js.map +1 -1
- package/build/paragraph/edit.js +7 -11
- package/build/paragraph/edit.js.map +1 -1
- package/build/post-comments-form/edit.js +4 -45
- package/build/post-comments-form/edit.js.map +1 -1
- package/build/post-comments-form/form.js +47 -3
- package/build/post-comments-form/form.js.map +1 -1
- package/build/post-terms/edit.js +3 -2
- package/build/post-terms/edit.js.map +1 -1
- package/build/query-no-results/edit.js +1 -1
- package/build/query-no-results/edit.js.map +1 -1
- package/build/query-pagination-next/edit.js +2 -1
- package/build/query-pagination-next/edit.js.map +1 -1
- package/build/query-pagination-previous/edit.js +2 -1
- package/build/query-pagination-previous/edit.js.map +1 -1
- package/build/quote/deprecated.js +168 -36
- package/build/quote/deprecated.js.map +1 -1
- package/build/quote/edit.js +76 -39
- package/build/quote/edit.js.map +1 -1
- package/build/quote/index.js +9 -45
- package/build/quote/index.js.map +1 -1
- package/build/quote/save.js +1 -5
- package/build/quote/save.js.map +1 -1
- package/build/quote/transforms.js +110 -158
- package/build/quote/transforms.js.map +1 -1
- package/build/social-link/icons/index.js +13 -0
- package/build/social-link/icons/index.js.map +1 -1
- package/build/social-link/icons/whatsapp.js +25 -0
- package/build/social-link/icons/whatsapp.js.map +1 -0
- package/build/social-link/variations.js +7 -0
- package/build/social-link/variations.js.map +1 -1
- package/build/template-part/edit/index.js +17 -8
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/edit/selection-modal.js +33 -13
- package/build/template-part/edit/selection-modal.js.map +1 -1
- package/build/template-part/edit/utils/search.js +94 -0
- package/build/template-part/edit/utils/search.js.map +1 -0
- package/build-module/button/edit.js +2 -1
- package/build-module/button/edit.js.map +1 -1
- package/build-module/buttons/edit.js +2 -2
- package/build-module/buttons/edit.js.map +1 -1
- package/build-module/columns/edit.native.js +2 -2
- package/build-module/columns/edit.native.js.map +1 -1
- package/build-module/comments/edit/comments-legacy.js +59 -0
- package/build-module/comments/edit/comments-legacy.js.map +1 -0
- package/build-module/comments/edit/index.js +37 -0
- package/build-module/comments/edit/index.js.map +1 -0
- package/build-module/comments/edit/placeholder.js +102 -0
- package/build-module/comments/edit/placeholder.js.map +1 -0
- package/build-module/comments/edit/template.js +32 -0
- package/build-module/comments/edit/template.js.map +1 -0
- package/build-module/comments/index.js +6 -1
- package/build-module/comments/index.js.map +1 -1
- package/build-module/comments/save.js +9 -4
- package/build-module/comments/save.js.map +1 -1
- package/build-module/cover/transforms.js +3 -2
- package/build-module/cover/transforms.js.map +1 -1
- package/build-module/embed/embed-placeholder.native.js +1 -2
- package/build-module/embed/embed-placeholder.native.js.map +1 -1
- package/build-module/gallery/edit.js +2 -2
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/use-get-media.native.js +50 -0
- package/build-module/gallery/use-get-media.native.js.map +1 -0
- package/build-module/group/index.js +1 -0
- package/build-module/group/index.js.map +1 -1
- package/build-module/group/variations.js +2 -2
- package/build-module/group/variations.js.map +1 -1
- package/build-module/image/deprecated.js +77 -9
- package/build-module/image/deprecated.js.map +1 -1
- package/build-module/image/edit.js +5 -3
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/edit.native.js +18 -8
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +29 -22
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/index.js +7 -1
- package/build-module/image/index.js.map +1 -1
- package/build-module/image/save.js +9 -3
- package/build-module/image/save.js.map +1 -1
- package/build-module/index.js +1 -2
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +3 -13
- package/build-module/index.native.js.map +1 -1
- package/build-module/list/transforms.js +4 -63
- package/build-module/list/transforms.js.map +1 -1
- package/build-module/list/v2/transforms.js +2 -29
- package/build-module/list/v2/transforms.js.map +1 -1
- package/build-module/list-item/edit.js +14 -10
- package/build-module/list-item/edit.js.map +1 -1
- package/build-module/list-item/hooks/index.js +1 -1
- package/build-module/list-item/hooks/index.js.map +1 -1
- package/build-module/list-item/hooks/use-merge.js +160 -0
- package/build-module/list-item/hooks/use-merge.js.map +1 -0
- package/build-module/list-item/hooks/use-outdent-list-item.js +82 -46
- package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build-module/list-item/utils.js +123 -2
- package/build-module/list-item/utils.js.map +1 -1
- package/build-module/media-text/deprecated.js +134 -8
- package/build-module/media-text/deprecated.js.map +1 -1
- package/build-module/media-text/edit.js +2 -2
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/media-text/save.js +13 -0
- package/build-module/media-text/save.js.map +1 -1
- package/build-module/more/save.js +1 -6
- package/build-module/more/save.js.map +1 -1
- package/build-module/navigation-link/edit.js +5 -4
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +2 -1
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/page-list/edit.js +8 -1
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/paragraph/edit.js +8 -12
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/post-comments-form/edit.js +5 -42
- package/build-module/post-comments-form/edit.js.map +1 -1
- package/build-module/post-comments-form/form.js +46 -5
- package/build-module/post-comments-form/form.js.map +1 -1
- package/build-module/post-terms/edit.js +3 -2
- package/build-module/post-terms/edit.js.map +1 -1
- package/build-module/query-no-results/edit.js +2 -2
- package/build-module/query-no-results/edit.js.map +1 -1
- package/build-module/query-pagination-next/edit.js +2 -1
- package/build-module/query-pagination-next/edit.js.map +1 -1
- package/build-module/query-pagination-previous/edit.js +2 -1
- package/build-module/query-pagination-previous/edit.js.map +1 -1
- package/build-module/quote/deprecated.js +162 -36
- package/build-module/quote/deprecated.js.map +1 -1
- package/build-module/quote/edit.js +77 -43
- package/build-module/quote/edit.js.map +1 -1
- package/build-module/quote/index.js +9 -39
- package/build-module/quote/index.js.map +1 -1
- package/build-module/quote/save.js +4 -8
- package/build-module/quote/save.js.map +1 -1
- package/build-module/quote/transforms.js +111 -158
- package/build-module/quote/transforms.js.map +1 -1
- package/build-module/social-link/icons/index.js +1 -0
- package/build-module/social-link/icons/index.js.map +1 -1
- package/build-module/social-link/icons/whatsapp.js +15 -0
- package/build-module/social-link/icons/whatsapp.js.map +1 -0
- package/build-module/social-link/variations.js +8 -1
- package/build-module/social-link/variations.js.map +1 -1
- package/build-module/template-part/edit/index.js +20 -11
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/edit/selection-modal.js +33 -15
- package/build-module/template-part/edit/selection-modal.js.map +1 -1
- package/build-module/template-part/edit/utils/search.js +84 -0
- package/build-module/template-part/edit/utils/search.js.map +1 -0
- package/build-style/button/style-rtl.css +1 -1
- package/build-style/button/style.css +1 -1
- package/build-style/comments/editor-rtl.css +122 -0
- package/build-style/comments/editor.css +122 -0
- package/build-style/{post-comments → comments}/style-rtl.css +1 -0
- package/build-style/{post-comments → comments}/style.css +1 -0
- package/build-style/common-rtl.css +7 -0
- package/build-style/common.css +7 -0
- package/build-style/cover/style-rtl.css +2 -2
- package/build-style/cover/style.css +2 -2
- package/build-style/{post-comments/editor.css → editor-elements-rtl.css} +8 -2
- package/build-style/{post-comments/editor-rtl.css → editor-elements.css} +8 -2
- package/build-style/editor-rtl.css +151 -10
- package/build-style/editor.css +151 -10
- package/build-style/gallery/style-rtl.css +7 -2
- package/build-style/gallery/style.css +7 -2
- package/build-style/image/editor-rtl.css +4 -3
- package/build-style/image/editor.css +4 -3
- package/build-style/image/style-rtl.css +33 -3
- package/build-style/image/style.css +33 -3
- package/build-style/post-comments-form/style-rtl.css +0 -1
- package/build-style/post-comments-form/style.css +0 -1
- package/build-style/social-link/editor-rtl.css +1 -0
- package/build-style/social-link/editor.css +1 -0
- package/build-style/social-links/style-rtl.css +8 -0
- package/build-style/social-links/style.css +8 -0
- package/build-style/style-rtl.css +170 -127
- package/build-style/style.css +170 -127
- package/build-style/template-part/editor-rtl.css +14 -3
- package/build-style/template-part/editor.css +14 -3
- package/package.json +28 -28
- package/src/button/edit.js +1 -0
- package/src/button/style.scss +3 -1
- package/src/buttons/edit.js +1 -5
- package/src/columns/edit.native.js +2 -2
- package/src/comments/block.json +6 -1
- package/src/comments/edit/comments-legacy.js +71 -0
- package/src/comments/edit/index.js +35 -0
- package/src/comments/edit/placeholder.js +124 -0
- package/src/comments/{edit.js → edit/template.js} +1 -28
- package/src/comments/editor.scss +9 -0
- package/src/comments/index.php +219 -0
- package/src/comments/save.js +8 -7
- package/src/{post-comments → comments}/style.scss +7 -0
- package/src/common.scss +2 -0
- package/src/cover/style.scss +2 -2
- package/src/cover/transforms.js +2 -2
- package/src/editor-elements.scss +10 -0
- package/src/editor.scss +2 -1
- package/src/embed/embed-placeholder.native.js +2 -3
- package/src/gallery/edit.js +4 -2
- package/src/gallery/style.scss +10 -1
- package/src/gallery/use-get-media.native.js +44 -0
- package/src/group/block.json +1 -0
- package/src/group/variations.js +2 -2
- package/src/image/block.json +7 -1
- package/src/image/deprecated.js +86 -0
- package/src/image/edit.js +6 -1
- package/src/image/edit.native.js +18 -7
- package/src/image/editor.scss +9 -4
- package/src/image/image.js +26 -16
- package/src/image/save.js +10 -1
- package/src/image/style.scss +39 -3
- package/src/index.js +0 -2
- package/src/index.native.js +2 -11
- package/src/list/transforms.js +0 -47
- package/src/list/v2/transforms.js +2 -40
- package/src/list-item/edit.js +10 -12
- package/src/list-item/hooks/index.js +1 -1
- package/src/list-item/hooks/use-merge.js +141 -0
- package/src/list-item/hooks/use-outdent-list-item.js +72 -74
- package/src/list-item/utils.js +27 -3
- package/src/media-text/deprecated.js +148 -1
- package/src/media-text/edit.js +2 -1
- package/src/media-text/save.js +18 -0
- package/src/more/save.js +3 -6
- package/src/navigation-link/edit.js +4 -3
- package/src/navigation-submenu/edit.js +1 -0
- package/src/page-list/edit.js +9 -0
- package/src/paragraph/edit.js +8 -14
- package/src/post-comments-form/edit.js +2 -71
- package/src/post-comments-form/form.js +80 -5
- package/src/post-comments-form/index.php +1 -1
- package/src/post-comments-form/style.scss +0 -1
- package/src/post-terms/edit.js +3 -2
- package/src/query-no-results/edit.js +2 -5
- package/src/query-pagination-next/edit.js +1 -0
- package/src/query-pagination-previous/edit.js +1 -0
- package/src/quote/deprecated.js +213 -99
- package/src/quote/edit.js +77 -52
- package/src/quote/index.js +10 -33
- package/src/quote/save.js +5 -5
- package/src/quote/{v2/test → test}/migrate.js +2 -7
- package/src/quote/transforms.js +117 -147
- package/src/social-link/editor.scss +3 -0
- package/src/social-link/icons/index.js +1 -0
- package/src/social-link/icons/whatsapp.js +10 -0
- package/src/social-link/index.php +4 -0
- package/src/social-link/socials-with-bg.scss +5 -0
- package/src/social-link/socials-without-bg.scss +5 -0
- package/src/social-link/variations.js +7 -0
- package/src/style.scss +1 -2
- package/src/template-part/edit/index.js +37 -24
- package/src/template-part/edit/selection-modal.js +68 -40
- package/src/template-part/edit/utils/search.js +76 -0
- package/src/template-part/editor.scss +21 -9
- package/src/template-part/index.php +56 -2
- package/build/comments/edit.js.map +0 -1
- package/build/list-item/hooks/use-backspace.js +0 -59
- package/build/list-item/hooks/use-backspace.js.map +0 -1
- package/build/post-comments/edit.js +0 -184
- package/build/post-comments/edit.js.map +0 -1
- package/build/post-comments/index.js +0 -72
- package/build/post-comments/index.js.map +0 -1
- package/build/quote/v2/deprecated.js +0 -133
- package/build/quote/v2/deprecated.js.map +0 -1
- package/build/quote/v2/edit.js +0 -139
- package/build/quote/v2/edit.js.map +0 -1
- package/build/quote/v2/index.js +0 -49
- package/build/quote/v2/index.js.map +0 -1
- package/build/quote/v2/save.js +0 -43
- package/build/quote/v2/save.js.map +0 -1
- package/build/quote/v2/transforms.js +0 -156
- package/build/quote/v2/transforms.js.map +0 -1
- package/build-module/comments/edit.js +0 -59
- package/build-module/comments/edit.js.map +0 -1
- package/build-module/list-item/hooks/use-backspace.js +0 -44
- package/build-module/list-item/hooks/use-backspace.js.map +0 -1
- package/build-module/post-comments/edit.js +0 -171
- package/build-module/post-comments/edit.js.map +0 -1
- package/build-module/post-comments/index.js +0 -59
- package/build-module/post-comments/index.js.map +0 -1
- package/build-module/quote/v2/deprecated.js +0 -116
- package/build-module/quote/v2/deprecated.js.map +0 -1
- package/build-module/quote/v2/edit.js +0 -122
- package/build-module/quote/v2/edit.js.map +0 -1
- package/build-module/quote/v2/index.js +0 -33
- package/build-module/quote/v2/index.js.map +0 -1
- package/build-module/quote/v2/save.js +0 -30
- package/build-module/quote/v2/save.js.map +0 -1
- package/build-module/quote/v2/transforms.js +0 -147
- package/build-module/quote/v2/transforms.js.map +0 -1
- package/src/list-item/hooks/use-backspace.js +0 -51
- package/src/post-comments/block.json +0 -45
- package/src/post-comments/edit.js +0 -247
- package/src/post-comments/editor.scss +0 -3
- package/src/post-comments/index.js +0 -18
- package/src/post-comments/index.php +0 -87
- package/src/quote/v2/deprecated.js +0 -107
- package/src/quote/v2/edit.js +0 -139
- package/src/quote/v2/index.js +0 -36
- package/src/quote/v2/save.js +0 -26
- package/src/quote/v2/transforms.js +0 -155
|
@@ -312,7 +312,7 @@ const useIsInvalidLink = ( kind, type, id ) => {
|
|
|
312
312
|
return [ isInvalid, isDraft ];
|
|
313
313
|
};
|
|
314
314
|
|
|
315
|
-
|
|
315
|
+
function getMissingText( type ) {
|
|
316
316
|
let missingText = '';
|
|
317
317
|
|
|
318
318
|
switch ( type ) {
|
|
@@ -338,7 +338,7 @@ const useMissingText = ( type ) => {
|
|
|
338
338
|
}
|
|
339
339
|
|
|
340
340
|
return missingText;
|
|
341
|
-
}
|
|
341
|
+
}
|
|
342
342
|
|
|
343
343
|
/**
|
|
344
344
|
* Removes HTML from a given string.
|
|
@@ -682,7 +682,7 @@ export default function NavigationLinkEdit( {
|
|
|
682
682
|
'wp-block-navigation-link__placeholder': ! url || isInvalid || isDraft,
|
|
683
683
|
} );
|
|
684
684
|
|
|
685
|
-
const missingText =
|
|
685
|
+
const missingText = getMissingText( type );
|
|
686
686
|
/* translators: Whether the navigation link is Invalid or a Draft. */
|
|
687
687
|
const placeholderText = `(${
|
|
688
688
|
isInvalid ? __( 'Invalid' ) : __( 'Draft' )
|
|
@@ -849,6 +849,7 @@ export default function NavigationLinkEdit( {
|
|
|
849
849
|
position="bottom center"
|
|
850
850
|
onClose={ () => setIsLinkOpen( false ) }
|
|
851
851
|
anchorRef={ listItemRef.current }
|
|
852
|
+
__unstableShift
|
|
852
853
|
>
|
|
853
854
|
<LinkControl
|
|
854
855
|
hasTextControl
|
|
@@ -634,6 +634,7 @@ export default function NavigationSubmenuEdit( {
|
|
|
634
634
|
position="bottom center"
|
|
635
635
|
onClose={ () => setIsLinkOpen( false ) }
|
|
636
636
|
anchorRef={ listItemRef.current }
|
|
637
|
+
__unstableShift
|
|
637
638
|
>
|
|
638
639
|
<LinkControl
|
|
639
640
|
className="wp-block-navigation-link__inline-link-input"
|
package/src/page-list/edit.js
CHANGED
|
@@ -103,6 +103,14 @@ export default function PageListEdit( { context, clientId } ) {
|
|
|
103
103
|
|
|
104
104
|
function useFrontPageId() {
|
|
105
105
|
return useSelect( ( select ) => {
|
|
106
|
+
const canReadSettings = select( coreStore ).canUser(
|
|
107
|
+
'read',
|
|
108
|
+
'settings'
|
|
109
|
+
);
|
|
110
|
+
if ( ! canReadSettings ) {
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
113
|
+
|
|
106
114
|
const site = select( coreStore ).getEntityRecord( 'root', 'site' );
|
|
107
115
|
return site?.show_on_front === 'page' && site?.page_on_front;
|
|
108
116
|
}, [] );
|
|
@@ -117,6 +125,7 @@ function usePageData() {
|
|
|
117
125
|
order: 'asc',
|
|
118
126
|
_fields: [ 'id', 'link', 'parent', 'title', 'menu_order' ],
|
|
119
127
|
per_page: -1,
|
|
128
|
+
context: 'view',
|
|
120
129
|
}
|
|
121
130
|
);
|
|
122
131
|
|
package/src/paragraph/edit.js
CHANGED
|
@@ -8,7 +8,7 @@ import classnames from 'classnames';
|
|
|
8
8
|
*/
|
|
9
9
|
import { __, _x, isRTL } from '@wordpress/i18n';
|
|
10
10
|
import {
|
|
11
|
-
|
|
11
|
+
ToolbarButton,
|
|
12
12
|
ToggleControl,
|
|
13
13
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
14
14
|
} from '@wordpress/components';
|
|
@@ -33,19 +33,13 @@ const name = 'core/paragraph';
|
|
|
33
33
|
function ParagraphRTLControl( { direction, setDirection } ) {
|
|
34
34
|
return (
|
|
35
35
|
isRTL() && (
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
setDirection(
|
|
44
|
-
direction === 'ltr' ? undefined : 'ltr'
|
|
45
|
-
);
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
] }
|
|
36
|
+
<ToolbarButton
|
|
37
|
+
icon={ formatLtr }
|
|
38
|
+
title={ _x( 'Left to right', 'editor button' ) }
|
|
39
|
+
isActive={ direction === 'ltr' }
|
|
40
|
+
onClick={ () => {
|
|
41
|
+
setDirection( direction === 'ltr' ? undefined : 'ltr' );
|
|
42
|
+
} }
|
|
49
43
|
/>
|
|
50
44
|
)
|
|
51
45
|
);
|
|
@@ -9,14 +9,8 @@ import classnames from 'classnames';
|
|
|
9
9
|
import {
|
|
10
10
|
AlignmentControl,
|
|
11
11
|
BlockControls,
|
|
12
|
-
Warning,
|
|
13
12
|
useBlockProps,
|
|
14
|
-
store as blockEditorStore,
|
|
15
13
|
} from '@wordpress/block-editor';
|
|
16
|
-
import { Button } from '@wordpress/components';
|
|
17
|
-
import { useEntityProp, store as coreStore } from '@wordpress/core-data';
|
|
18
|
-
import { __, _x, sprintf } from '@wordpress/i18n';
|
|
19
|
-
import { useSelect } from '@wordpress/data';
|
|
20
14
|
|
|
21
15
|
/**
|
|
22
16
|
* Internal dependencies
|
|
@@ -30,72 +24,13 @@ export default function PostCommentsFormEdit( {
|
|
|
30
24
|
} ) {
|
|
31
25
|
const { textAlign } = attributes;
|
|
32
26
|
const { postId, postType } = context;
|
|
33
|
-
|
|
34
|
-
'postType',
|
|
35
|
-
postType,
|
|
36
|
-
'comment_status',
|
|
37
|
-
postId
|
|
38
|
-
);
|
|
27
|
+
|
|
39
28
|
const blockProps = useBlockProps( {
|
|
40
29
|
className: classnames( {
|
|
41
30
|
[ `has-text-align-${ textAlign }` ]: textAlign,
|
|
42
31
|
} ),
|
|
43
32
|
} );
|
|
44
33
|
|
|
45
|
-
const isSiteEditor = postType === undefined || postId === undefined;
|
|
46
|
-
|
|
47
|
-
const { defaultCommentStatus } = useSelect(
|
|
48
|
-
( select ) =>
|
|
49
|
-
select( blockEditorStore ).getSettings()
|
|
50
|
-
.__experimentalDiscussionSettings
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
const postTypeSupportsComments = useSelect( ( select ) =>
|
|
54
|
-
postType
|
|
55
|
-
? !! select( coreStore ).getPostType( postType )?.supports.comments
|
|
56
|
-
: false
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
let warning = false;
|
|
60
|
-
let actions;
|
|
61
|
-
let showPlaceholder = true;
|
|
62
|
-
|
|
63
|
-
if ( ! isSiteEditor && 'open' !== commentStatus ) {
|
|
64
|
-
if ( 'closed' === commentStatus ) {
|
|
65
|
-
warning = __(
|
|
66
|
-
'Post Comments Form block: Comments are not enabled for this item.'
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
actions = [
|
|
70
|
-
<Button
|
|
71
|
-
key="enableComments"
|
|
72
|
-
onClick={ () => setCommentStatus( 'open' ) }
|
|
73
|
-
variant="primary"
|
|
74
|
-
>
|
|
75
|
-
{ _x(
|
|
76
|
-
'Enable comments',
|
|
77
|
-
'action that affects the current post'
|
|
78
|
-
) }
|
|
79
|
-
</Button>,
|
|
80
|
-
];
|
|
81
|
-
showPlaceholder = false;
|
|
82
|
-
} else if ( ! postTypeSupportsComments ) {
|
|
83
|
-
warning = sprintf(
|
|
84
|
-
/* translators: 1: Post type (i.e. "post", "page") */
|
|
85
|
-
__(
|
|
86
|
-
'Post Comments Form block: Comments are not enabled for this post type (%s).'
|
|
87
|
-
),
|
|
88
|
-
postType
|
|
89
|
-
);
|
|
90
|
-
showPlaceholder = false;
|
|
91
|
-
} else if ( 'open' !== defaultCommentStatus ) {
|
|
92
|
-
warning = __(
|
|
93
|
-
'Post Comments Form block: Comments are not enabled.'
|
|
94
|
-
);
|
|
95
|
-
showPlaceholder = false;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
34
|
return (
|
|
100
35
|
<>
|
|
101
36
|
<BlockControls group="block">
|
|
@@ -107,11 +42,7 @@ export default function PostCommentsFormEdit( {
|
|
|
107
42
|
/>
|
|
108
43
|
</BlockControls>
|
|
109
44
|
<div { ...blockProps }>
|
|
110
|
-
{
|
|
111
|
-
<Warning actions={ actions }>{ warning }</Warning>
|
|
112
|
-
) }
|
|
113
|
-
|
|
114
|
-
{ showPlaceholder ? <CommentsForm /> : null }
|
|
45
|
+
<CommentsForm postId={ postId } postType={ postType } />
|
|
115
46
|
</div>
|
|
116
47
|
</>
|
|
117
48
|
);
|
|
@@ -6,13 +6,20 @@ import classnames from 'classnames';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { __ } from '@wordpress/i18n';
|
|
10
|
-
import {
|
|
9
|
+
import { __, _x, sprintf } from '@wordpress/i18n';
|
|
10
|
+
import {
|
|
11
|
+
Warning,
|
|
12
|
+
store as blockEditorStore,
|
|
13
|
+
__experimentalGetElementClassName,
|
|
14
|
+
} from '@wordpress/block-editor';
|
|
15
|
+
import { Button } from '@wordpress/components';
|
|
11
16
|
import { useDisabled, useInstanceId } from '@wordpress/compose';
|
|
17
|
+
import { useEntityProp, store as coreStore } from '@wordpress/core-data';
|
|
18
|
+
import { useSelect } from '@wordpress/data';
|
|
12
19
|
|
|
13
|
-
const
|
|
20
|
+
const CommentsFormPlaceholder = () => {
|
|
14
21
|
const disabledFormRef = useDisabled();
|
|
15
|
-
const instanceId = useInstanceId(
|
|
22
|
+
const instanceId = useInstanceId( CommentsFormPlaceholder );
|
|
16
23
|
|
|
17
24
|
return (
|
|
18
25
|
<div className="comment-respond">
|
|
@@ -34,7 +41,6 @@ const CommentsForm = () => {
|
|
|
34
41
|
name="submit"
|
|
35
42
|
type="submit"
|
|
36
43
|
className={ classnames(
|
|
37
|
-
'submit',
|
|
38
44
|
'wp-block-button__link',
|
|
39
45
|
__experimentalGetElementClassName( 'button' )
|
|
40
46
|
) }
|
|
@@ -47,4 +53,73 @@ const CommentsForm = () => {
|
|
|
47
53
|
);
|
|
48
54
|
};
|
|
49
55
|
|
|
56
|
+
const CommentsForm = ( { postId, postType } ) => {
|
|
57
|
+
const [ commentStatus, setCommentStatus ] = useEntityProp(
|
|
58
|
+
'postType',
|
|
59
|
+
postType,
|
|
60
|
+
'comment_status',
|
|
61
|
+
postId
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
const isSiteEditor = postType === undefined || postId === undefined;
|
|
65
|
+
|
|
66
|
+
const { defaultCommentStatus } = useSelect(
|
|
67
|
+
( select ) =>
|
|
68
|
+
select( blockEditorStore ).getSettings()
|
|
69
|
+
.__experimentalDiscussionSettings
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
const postTypeSupportsComments = useSelect( ( select ) =>
|
|
73
|
+
postType
|
|
74
|
+
? !! select( coreStore ).getPostType( postType )?.supports.comments
|
|
75
|
+
: false
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
if ( ! isSiteEditor && 'open' !== commentStatus ) {
|
|
79
|
+
if ( 'closed' === commentStatus ) {
|
|
80
|
+
const actions = [
|
|
81
|
+
<Button
|
|
82
|
+
key="enableComments"
|
|
83
|
+
onClick={ () => setCommentStatus( 'open' ) }
|
|
84
|
+
variant="primary"
|
|
85
|
+
>
|
|
86
|
+
{ _x(
|
|
87
|
+
'Enable comments',
|
|
88
|
+
'action that affects the current post'
|
|
89
|
+
) }
|
|
90
|
+
</Button>,
|
|
91
|
+
];
|
|
92
|
+
return (
|
|
93
|
+
<Warning actions={ actions }>
|
|
94
|
+
{ __(
|
|
95
|
+
'Post Comments Form block: Comments are not enabled for this item.'
|
|
96
|
+
) }
|
|
97
|
+
</Warning>
|
|
98
|
+
);
|
|
99
|
+
} else if ( ! postTypeSupportsComments ) {
|
|
100
|
+
return (
|
|
101
|
+
<Warning>
|
|
102
|
+
{ sprintf(
|
|
103
|
+
/* translators: 1: Post type (i.e. "post", "page") */
|
|
104
|
+
__(
|
|
105
|
+
'Post Comments Form block: Comments are not enabled for this post type (%s).'
|
|
106
|
+
),
|
|
107
|
+
postType
|
|
108
|
+
) }
|
|
109
|
+
</Warning>
|
|
110
|
+
);
|
|
111
|
+
} else if ( 'open' !== defaultCommentStatus ) {
|
|
112
|
+
return (
|
|
113
|
+
<Warning>
|
|
114
|
+
{ __(
|
|
115
|
+
'Post Comments Form block: Comments are not enabled.'
|
|
116
|
+
) }
|
|
117
|
+
</Warning>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return <CommentsFormPlaceholder />;
|
|
123
|
+
};
|
|
124
|
+
|
|
50
125
|
export default CommentsForm;
|
|
@@ -72,7 +72,7 @@ add_action( 'init', 'register_block_core_post_comments_form' );
|
|
|
72
72
|
*/
|
|
73
73
|
function post_comments_form_block_form_defaults( $fields ) {
|
|
74
74
|
if ( wp_is_block_theme() ) {
|
|
75
|
-
$fields['submit_button'] = '<input name="%1$s" type="submit" id="%2$s" class="
|
|
75
|
+
$fields['submit_button'] = '<input name="%1$s" type="submit" id="%2$s" class="wp-block-button__link ' . WP_Theme_JSON_Gutenberg::get_element_class_name( 'button' ) . '" value="%4$s" />';
|
|
76
76
|
$fields['submit_field'] = '<p class="form-submit wp-block-button">%1$s %2$s</p>';
|
|
77
77
|
}
|
|
78
78
|
|
package/src/post-terms/edit.js
CHANGED
|
@@ -40,6 +40,7 @@ export default function PostTermsEdit( {
|
|
|
40
40
|
attributes,
|
|
41
41
|
clientId,
|
|
42
42
|
context,
|
|
43
|
+
isSelected,
|
|
43
44
|
setAttributes,
|
|
44
45
|
insertBlocksAfter,
|
|
45
46
|
} ) {
|
|
@@ -96,7 +97,7 @@ export default function PostTermsEdit( {
|
|
|
96
97
|
</InspectorControls>
|
|
97
98
|
<div { ...blockProps }>
|
|
98
99
|
{ isLoading && <Spinner /> }
|
|
99
|
-
{ ! isLoading && hasPostTerms && (
|
|
100
|
+
{ ! isLoading && hasPostTerms && ( isSelected || prefix ) && (
|
|
100
101
|
<RichText
|
|
101
102
|
allowedFormats={ ALLOWED_FORMATS }
|
|
102
103
|
className="wp-block-post-terms__prefix"
|
|
@@ -135,7 +136,7 @@ export default function PostTermsEdit( {
|
|
|
135
136
|
! hasPostTerms &&
|
|
136
137
|
( selectedTerm?.labels?.no_terms ||
|
|
137
138
|
__( 'Term items not found.' ) ) }
|
|
138
|
-
{ ! isLoading && hasPostTerms && (
|
|
139
|
+
{ ! isLoading && hasPostTerms && ( isSelected || suffix ) && (
|
|
139
140
|
<RichText
|
|
140
141
|
allowedFormats={ ALLOWED_FORMATS }
|
|
141
142
|
className="wp-block-post-terms__suffix"
|
|
@@ -20,9 +20,6 @@ export default function QueryNoResultsEdit() {
|
|
|
20
20
|
const innerBlocksProps = useInnerBlocksProps( blockProps, {
|
|
21
21
|
template: TEMPLATE,
|
|
22
22
|
} );
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
<div { ...innerBlocksProps } />
|
|
26
|
-
</>
|
|
27
|
-
);
|
|
23
|
+
|
|
24
|
+
return <div { ...innerBlocksProps } />;
|
|
28
25
|
}
|