@wordpress/block-library 7.17.0 → 7.18.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/audio/edit.js +44 -4
- package/build/audio/edit.js.map +1 -1
- package/build/button/edit.js +1 -1
- package/build/button/edit.js.map +1 -1
- package/build/buttons/edit.native.js +1 -1
- package/build/buttons/edit.native.js.map +1 -1
- package/build/comment-template/index.js +6 -2
- package/build/comment-template/index.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +3 -7
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/embed/deprecated.js +43 -4
- package/build/embed/deprecated.js.map +1 -1
- package/build/file/deprecated.js +108 -4
- package/build/file/deprecated.js.map +1 -1
- package/build/file/transforms.js +3 -9
- package/build/file/transforms.js.map +1 -1
- package/build/gallery/deprecated.js +148 -23
- package/build/gallery/deprecated.js.map +1 -1
- package/build/gallery/gallery.js +3 -2
- package/build/gallery/gallery.js.map +1 -1
- package/build/gallery/use-image-sizes.js +2 -1
- package/build/gallery/use-image-sizes.js.map +1 -1
- package/build/gallery/v1/edit.js +2 -1
- package/build/gallery/v1/edit.js.map +1 -1
- package/build/group/edit.js +7 -3
- package/build/group/edit.js.map +1 -1
- package/build/image/edit.native.js +1 -1
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +6 -9
- package/build/image/image.js.map +1 -1
- package/build/latest-posts/edit.js +1 -1
- package/build/latest-posts/edit.js.map +1 -1
- package/build/list/utils.js +4 -8
- package/build/list/utils.js.map +1 -1
- package/build/list-item/hooks/use-outdent-list-item.js +5 -7
- package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build/navigation/edit/index.js +12 -11
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/unsaved-inner-blocks.js +3 -1
- package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build/navigation-link/edit.js +4 -2
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-submenu/edit.js +4 -4
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/page-list/edit.js +29 -10
- package/build/page-list/edit.js.map +1 -1
- package/build/post-comments-count/index.js +4 -0
- package/build/post-comments-count/index.js.map +1 -1
- package/build/post-comments-form/index.js +4 -0
- package/build/post-comments-form/index.js.map +1 -1
- package/build/post-comments-link/index.js +4 -0
- package/build/post-comments-link/index.js.map +1 -1
- package/build/post-content/edit.js +14 -6
- package/build/post-content/edit.js.map +1 -1
- package/build/pullquote/deprecated.js +6 -6
- package/build/pullquote/deprecated.js.map +1 -1
- package/build/search/edit.js +1 -3
- package/build/search/edit.js.map +1 -1
- package/build/site-logo/edit.js +1 -1
- package/build/site-logo/edit.js.map +1 -1
- package/build/site-tagline/edit.js +21 -9
- package/build/site-tagline/edit.js.map +1 -1
- package/build/site-title/edit/index.js +20 -8
- package/build/site-title/edit/index.js.map +1 -1
- package/build/social-link/edit.js +11 -2
- package/build/social-link/edit.js.map +1 -1
- package/build/social-link/index.js +3 -0
- package/build/social-link/index.js.map +1 -1
- package/build/spacer/controls.js +3 -7
- package/build/spacer/controls.js.map +1 -1
- package/build/table/deprecated.js +282 -27
- package/build/table/deprecated.js.map +1 -1
- package/build/table/state.js +1 -1
- package/build/table/state.js.map +1 -1
- package/build/utils/clean-empty-object.js +5 -4
- package/build/utils/clean-empty-object.js.map +1 -1
- package/build/video/deprecated.js +159 -0
- package/build/video/deprecated.js.map +1 -0
- package/build/video/edit.js +41 -5
- package/build/video/edit.js.map +1 -1
- package/build/video/index.js +3 -0
- package/build/video/index.js.map +1 -1
- package/build/video/tracks-editor.js +3 -28
- package/build/video/tracks-editor.js.map +1 -1
- package/build-module/audio/edit.js +46 -7
- package/build-module/audio/edit.js.map +1 -1
- package/build-module/button/edit.js +1 -1
- package/build-module/button/edit.js.map +1 -1
- package/build-module/buttons/edit.native.js +1 -1
- package/build-module/buttons/edit.native.js.map +1 -1
- package/build-module/comment-template/index.js +6 -2
- package/build-module/comment-template/index.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +4 -8
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/embed/deprecated.js +44 -5
- package/build-module/embed/deprecated.js.map +1 -1
- package/build-module/file/deprecated.js +108 -4
- package/build-module/file/deprecated.js.map +1 -1
- package/build-module/file/transforms.js +3 -8
- package/build-module/file/transforms.js.map +1 -1
- package/build-module/gallery/deprecated.js +147 -25
- package/build-module/gallery/deprecated.js.map +1 -1
- package/build-module/gallery/gallery.js +3 -2
- package/build-module/gallery/gallery.js.map +1 -1
- package/build-module/gallery/use-image-sizes.js +3 -2
- package/build-module/gallery/use-image-sizes.js.map +1 -1
- package/build-module/gallery/v1/edit.js +3 -2
- package/build-module/gallery/v1/edit.js.map +1 -1
- package/build-module/group/edit.js +7 -3
- package/build-module/group/edit.js.map +1 -1
- package/build-module/image/edit.native.js +1 -1
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +8 -11
- package/build-module/image/image.js.map +1 -1
- package/build-module/latest-posts/edit.js +2 -2
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/list/utils.js +5 -9
- package/build-module/list/utils.js.map +1 -1
- package/build-module/list-item/hooks/use-outdent-list-item.js +5 -6
- package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build-module/navigation/edit/index.js +12 -11
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/unsaved-inner-blocks.js +3 -1
- package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build-module/navigation-link/edit.js +4 -3
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +4 -4
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/page-list/edit.js +29 -10
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/post-comments-count/index.js +4 -0
- package/build-module/post-comments-count/index.js.map +1 -1
- package/build-module/post-comments-form/index.js +4 -0
- package/build-module/post-comments-form/index.js.map +1 -1
- package/build-module/post-comments-link/index.js +4 -0
- package/build-module/post-comments-link/index.js.map +1 -1
- package/build-module/post-content/edit.js +14 -6
- package/build-module/post-content/edit.js.map +1 -1
- package/build-module/pullquote/deprecated.js +7 -7
- package/build-module/pullquote/deprecated.js.map +1 -1
- package/build-module/search/edit.js +1 -3
- package/build-module/search/edit.js.map +1 -1
- package/build-module/site-logo/edit.js +2 -2
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/site-tagline/edit.js +23 -11
- package/build-module/site-tagline/edit.js.map +1 -1
- package/build-module/site-title/edit/index.js +22 -10
- package/build-module/site-title/edit/index.js.map +1 -1
- package/build-module/social-link/edit.js +11 -2
- package/build-module/social-link/edit.js.map +1 -1
- package/build-module/social-link/index.js +3 -0
- package/build-module/social-link/index.js.map +1 -1
- package/build-module/spacer/controls.js +4 -8
- package/build-module/spacer/controls.js.map +1 -1
- package/build-module/table/deprecated.js +282 -27
- package/build-module/table/deprecated.js.map +1 -1
- package/build-module/table/state.js +1 -1
- package/build-module/table/state.js.map +1 -1
- package/build-module/utils/clean-empty-object.js +5 -5
- package/build-module/utils/clean-empty-object.js.map +1 -1
- package/build-module/video/deprecated.js +147 -0
- package/build-module/video/deprecated.js.map +1 -0
- package/build-module/video/edit.js +45 -9
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/index.js +2 -0
- package/build-module/video/index.js.map +1 -1
- package/build-module/video/tracks-editor.js +4 -29
- package/build-module/video/tracks-editor.js.map +1 -1
- package/build-style/button/style-rtl.css +1 -0
- package/build-style/button/style.css +1 -0
- package/build-style/comment-template/style-rtl.css +1 -0
- package/build-style/comment-template/style.css +1 -0
- package/build-style/editor-rtl.css +4 -4
- package/build-style/editor.css +4 -4
- package/build-style/navigation/editor-rtl.css +4 -4
- package/build-style/navigation/editor.css +4 -4
- package/build-style/navigation/style-rtl.css +3 -1
- package/build-style/navigation/style.css +3 -1
- package/build-style/post-comments-form/style-rtl.css +3 -0
- package/build-style/post-comments-form/style.css +3 -0
- package/build-style/style-rtl.css +8 -1
- package/build-style/style.css +8 -1
- package/package.json +29 -28
- package/src/audio/edit.js +79 -24
- package/src/button/edit.js +1 -1
- package/src/button/style.scss +2 -0
- package/src/buttons/edit.native.js +1 -1
- package/src/comment-template/block.json +6 -2
- package/src/comment-template/style.scss +2 -0
- package/src/cover/edit/inspector-controls.js +11 -13
- package/src/embed/deprecated.js +53 -26
- package/src/file/deprecated.js +130 -2
- package/src/file/transforms.js +3 -8
- package/src/gallery/deprecated.js +129 -4
- package/src/gallery/gallery.js +2 -0
- package/src/gallery/index.php +19 -10
- package/src/gallery/use-image-sizes.js +3 -2
- package/src/gallery/v1/edit.js +3 -2
- package/src/group/edit.js +10 -2
- package/src/image/edit.native.js +1 -1
- package/src/image/image.js +22 -10
- package/src/latest-posts/edit.js +2 -2
- package/src/list/utils.js +3 -11
- package/src/list-item/hooks/use-outdent-list-item.js +3 -6
- package/src/navigation/edit/index.js +13 -15
- package/src/navigation/edit/unsaved-inner-blocks.js +9 -2
- package/src/navigation/editor.scss +4 -4
- package/src/navigation/style.scss +3 -1
- package/src/navigation-link/edit.js +5 -4
- package/src/navigation-submenu/edit.js +7 -5
- package/src/page-list/edit.js +36 -22
- package/src/post-comments-count/block.json +4 -0
- package/src/post-comments-form/block.json +4 -0
- package/src/post-comments-form/style.scss +3 -0
- package/src/post-comments-link/block.json +4 -0
- package/src/post-content/edit.js +8 -4
- package/src/pullquote/deprecated.js +7 -7
- package/src/search/edit.js +1 -1
- package/src/site-logo/edit.js +2 -2
- package/src/site-tagline/edit.js +25 -18
- package/src/site-title/edit/index.js +26 -12
- package/src/social-link/block.json +3 -0
- package/src/social-link/edit.js +8 -1
- package/src/social-link/index.php +11 -7
- package/src/spacer/controls.js +10 -12
- package/src/table/deprecated.js +587 -348
- package/src/table/state.js +1 -1
- package/src/utils/clean-empty-object.js +5 -6
- package/src/video/deprecated.js +57 -0
- package/src/video/edit.js +71 -23
- package/src/video/index.js +2 -0
- package/src/video/tracks-editor.js +12 -28
|
@@ -261,10 +261,6 @@ $color-control-label-height: 20px;
|
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
263
|
|
|
264
|
-
.wp-block-navigation-placeholder .components-spinner {
|
|
265
|
-
margin-top: 0;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
264
|
// Unselected state.
|
|
269
265
|
.wp-block-navigation-placeholder__preview {
|
|
270
266
|
display: flex;
|
|
@@ -567,6 +563,10 @@ body.editor-styles-wrapper
|
|
|
567
563
|
padding: $grid-unit-10 $grid-unit-15;
|
|
568
564
|
}
|
|
569
565
|
|
|
566
|
+
.wp-block-navigation .wp-block-navigation__uncontrolled-inner-blocks-loading-indicator {
|
|
567
|
+
margin-top: 0;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
570
|
@keyframes fadeouthalf {
|
|
571
571
|
0% {
|
|
572
572
|
opacity: 1;
|
|
@@ -359,7 +359,9 @@ button.wp-block-navigation-item__content {
|
|
|
359
359
|
|
|
360
360
|
// Provide a default padding for submenus who should always have some, regardless of the top level menu items.
|
|
361
361
|
:where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-item a:not(.wp-element-button)),
|
|
362
|
-
:where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-submenu a:not(.wp-element-button))
|
|
362
|
+
:where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-submenu a:not(.wp-element-button)),
|
|
363
|
+
:where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-submenu button.wp-block-navigation-item__content),
|
|
364
|
+
:where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-pages-list__item button.wp-block-navigation-item__content) {
|
|
363
365
|
padding: 0.5em 1em;
|
|
364
366
|
}
|
|
365
367
|
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import classnames from 'classnames';
|
|
5
|
-
import
|
|
5
|
+
import escapeHtml from 'escape-html';
|
|
6
|
+
import { unescape } from 'lodash';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* WordPress dependencies
|
|
@@ -262,8 +263,8 @@ export const updateNavigationLinkBlockAttributes = (
|
|
|
262
263
|
// - https://github.com/WordPress/gutenberg/pull/41063
|
|
263
264
|
// - https://github.com/WordPress/gutenberg/pull/18617.
|
|
264
265
|
const label = useNewLabel
|
|
265
|
-
?
|
|
266
|
-
: originalLabel ||
|
|
266
|
+
? escapeHtml( newLabel )
|
|
267
|
+
: originalLabel || escapeHtml( newUrlWithoutHttp );
|
|
267
268
|
|
|
268
269
|
// In https://github.com/WordPress/gutenberg/pull/24670 we decided to use "tag" in favor of "post_tag"
|
|
269
270
|
const type = newType === 'post_tag' ? 'tag' : newType.replace( '-', '_' );
|
|
@@ -846,7 +847,7 @@ export default function NavigationLinkEdit( {
|
|
|
846
847
|
) }
|
|
847
848
|
{ isLinkOpen && (
|
|
848
849
|
<Popover
|
|
849
|
-
|
|
850
|
+
placement="bottom"
|
|
850
851
|
onClose={ () => setIsLinkOpen( false ) }
|
|
851
852
|
anchor={ popoverAnchor }
|
|
852
853
|
shift
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import classnames from 'classnames';
|
|
5
|
-
import
|
|
5
|
+
import escapeHtml from 'escape-html';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
@@ -248,8 +248,8 @@ export const updateNavigationLinkBlockAttributes = (
|
|
|
248
248
|
normalizedTitle !== normalizedURL &&
|
|
249
249
|
originalLabel !== title;
|
|
250
250
|
const label = escapeTitle
|
|
251
|
-
?
|
|
252
|
-
: originalLabel ||
|
|
251
|
+
? escapeHtml( title )
|
|
252
|
+
: originalLabel || escapeHtml( normalizedURL );
|
|
253
253
|
|
|
254
254
|
// In https://github.com/WordPress/gutenberg/pull/24670 we decided to use "tag" in favor of "post_tag"
|
|
255
255
|
const type = newType === 'post_tag' ? 'tag' : newType.replace( '-', '_' );
|
|
@@ -486,7 +486,9 @@ export default function NavigationSubmenuEdit( {
|
|
|
486
486
|
const innerBlocksColors = getColors( context, true );
|
|
487
487
|
|
|
488
488
|
const allowedBlocks = isAtMaxNesting
|
|
489
|
-
?
|
|
489
|
+
? ALLOWED_BLOCKS.filter(
|
|
490
|
+
( blockName ) => blockName !== 'core/navigation-submenu'
|
|
491
|
+
)
|
|
490
492
|
: ALLOWED_BLOCKS;
|
|
491
493
|
|
|
492
494
|
const innerBlocksProps = useInnerBlocksProps(
|
|
@@ -631,7 +633,7 @@ export default function NavigationSubmenuEdit( {
|
|
|
631
633
|
}
|
|
632
634
|
{ ! openSubmenusOnClick && isLinkOpen && (
|
|
633
635
|
<Popover
|
|
634
|
-
|
|
636
|
+
placement="bottom"
|
|
635
637
|
onClose={ () => setIsLinkOpen( false ) }
|
|
636
638
|
anchor={ popoverAnchor }
|
|
637
639
|
shift
|
package/src/page-list/edit.js
CHANGED
|
@@ -52,50 +52,64 @@ export default function PageListEdit( { context, clientId } ) {
|
|
|
52
52
|
style: { ...context.style?.color },
|
|
53
53
|
} );
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
<BlockControls group="other">
|
|
59
|
-
<ToolbarButton title={ __( 'Edit' ) } onClick={ openModal }>
|
|
60
|
-
{ __( 'Edit' ) }
|
|
61
|
-
</ToolbarButton>
|
|
62
|
-
</BlockControls>
|
|
63
|
-
) }
|
|
64
|
-
{ allowConvertToLinks && isOpen && (
|
|
65
|
-
<ConvertToLinksModal
|
|
66
|
-
onClose={ closeModal }
|
|
67
|
-
clientId={ clientId }
|
|
68
|
-
/>
|
|
69
|
-
) }
|
|
70
|
-
{ ! hasResolvedPages && (
|
|
55
|
+
const getBlockContent = () => {
|
|
56
|
+
if ( ! hasResolvedPages ) {
|
|
57
|
+
return (
|
|
71
58
|
<div { ...blockProps }>
|
|
72
59
|
<Spinner />
|
|
73
60
|
</div>
|
|
74
|
-
)
|
|
61
|
+
);
|
|
62
|
+
}
|
|
75
63
|
|
|
76
|
-
|
|
64
|
+
if ( totalPages === null ) {
|
|
65
|
+
return (
|
|
77
66
|
<div { ...blockProps }>
|
|
78
67
|
<Notice status={ 'warning' } isDismissible={ false }>
|
|
79
68
|
{ __( 'Page List: Cannot retrieve Pages.' ) }
|
|
80
69
|
</Notice>
|
|
81
70
|
</div>
|
|
82
|
-
)
|
|
71
|
+
);
|
|
72
|
+
}
|
|
83
73
|
|
|
84
|
-
|
|
74
|
+
if ( totalPages === 0 ) {
|
|
75
|
+
return (
|
|
85
76
|
<div { ...blockProps }>
|
|
86
77
|
<Notice status={ 'info' } isDismissible={ false }>
|
|
87
78
|
{ __( 'Page List: Cannot retrieve Pages.' ) }
|
|
88
79
|
</Notice>
|
|
89
80
|
</div>
|
|
90
|
-
)
|
|
91
|
-
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if ( totalPages > 0 ) {
|
|
85
|
+
return (
|
|
92
86
|
<ul { ...blockProps }>
|
|
93
87
|
<PageItems
|
|
94
88
|
context={ context }
|
|
95
89
|
pagesByParentId={ pagesByParentId }
|
|
96
90
|
/>
|
|
97
91
|
</ul>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<>
|
|
98
|
+
{ allowConvertToLinks && (
|
|
99
|
+
<BlockControls group="other">
|
|
100
|
+
<ToolbarButton title={ __( 'Edit' ) } onClick={ openModal }>
|
|
101
|
+
{ __( 'Edit' ) }
|
|
102
|
+
</ToolbarButton>
|
|
103
|
+
</BlockControls>
|
|
98
104
|
) }
|
|
105
|
+
{ allowConvertToLinks && isOpen && (
|
|
106
|
+
<ConvertToLinksModal
|
|
107
|
+
onClose={ closeModal }
|
|
108
|
+
clientId={ clientId }
|
|
109
|
+
/>
|
|
110
|
+
) }
|
|
111
|
+
|
|
112
|
+
{ getBlockContent() }
|
|
99
113
|
</>
|
|
100
114
|
);
|
|
101
115
|
}
|
package/src/post-content/edit.js
CHANGED
|
@@ -84,8 +84,8 @@ function Content( props ) {
|
|
|
84
84
|
);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
function Placeholder() {
|
|
88
|
-
const blockProps = useBlockProps();
|
|
87
|
+
function Placeholder( { layoutClassNames } ) {
|
|
88
|
+
const blockProps = useBlockProps( { className: layoutClassNames } );
|
|
89
89
|
return (
|
|
90
90
|
<div { ...blockProps }>
|
|
91
91
|
<p>
|
|
@@ -118,7 +118,11 @@ function RecursionError() {
|
|
|
118
118
|
);
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
export default function PostContentEdit( {
|
|
121
|
+
export default function PostContentEdit( {
|
|
122
|
+
context,
|
|
123
|
+
attributes,
|
|
124
|
+
__unstableLayoutClassNames: layoutClassNames,
|
|
125
|
+
} ) {
|
|
122
126
|
const { postId: contextPostId, postType: contextPostType } = context;
|
|
123
127
|
const { layout = {} } = attributes;
|
|
124
128
|
const hasAlreadyRendered = useHasRecursion( contextPostId );
|
|
@@ -132,7 +136,7 @@ export default function PostContentEdit( { context, attributes } ) {
|
|
|
132
136
|
{ contextPostId && contextPostType ? (
|
|
133
137
|
<Content context={ context } layout={ layout } />
|
|
134
138
|
) : (
|
|
135
|
-
<Placeholder />
|
|
139
|
+
<Placeholder layoutClassNames={ layoutClassNames } />
|
|
136
140
|
) }
|
|
137
141
|
</RecursionProvider>
|
|
138
142
|
);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import classnames from 'classnames';
|
|
5
|
-
import { get
|
|
5
|
+
import { get } from 'lodash';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
@@ -140,7 +140,7 @@ const v4 = {
|
|
|
140
140
|
className,
|
|
141
141
|
} = attributes;
|
|
142
142
|
|
|
143
|
-
const isSolidColorStyle = includes(
|
|
143
|
+
const isSolidColorStyle = className?.includes( SOLID_COLOR_CLASS );
|
|
144
144
|
|
|
145
145
|
let figureClasses, figureStyles;
|
|
146
146
|
|
|
@@ -206,7 +206,7 @@ const v4 = {
|
|
|
206
206
|
customTextColor,
|
|
207
207
|
...attributes
|
|
208
208
|
} ) {
|
|
209
|
-
const isSolidColorStyle = includes(
|
|
209
|
+
const isSolidColorStyle = className?.includes( SOLID_COLOR_CLASS );
|
|
210
210
|
let style;
|
|
211
211
|
|
|
212
212
|
if ( customMainColor ) {
|
|
@@ -270,7 +270,7 @@ const v3 = {
|
|
|
270
270
|
figureStyle,
|
|
271
271
|
} = attributes;
|
|
272
272
|
|
|
273
|
-
const isSolidColorStyle = includes(
|
|
273
|
+
const isSolidColorStyle = className?.includes( SOLID_COLOR_CLASS );
|
|
274
274
|
|
|
275
275
|
let figureClasses, figureStyles;
|
|
276
276
|
|
|
@@ -345,7 +345,7 @@ const v3 = {
|
|
|
345
345
|
customTextColor,
|
|
346
346
|
...attributes
|
|
347
347
|
} ) {
|
|
348
|
-
const isSolidColorStyle = includes(
|
|
348
|
+
const isSolidColorStyle = className?.includes( SOLID_COLOR_CLASS );
|
|
349
349
|
let style;
|
|
350
350
|
|
|
351
351
|
if ( customMainColor ) {
|
|
@@ -416,7 +416,7 @@ const v2 = {
|
|
|
416
416
|
citation,
|
|
417
417
|
className,
|
|
418
418
|
} = attributes;
|
|
419
|
-
const isSolidColorStyle = includes(
|
|
419
|
+
const isSolidColorStyle = className?.includes( SOLID_COLOR_CLASS );
|
|
420
420
|
|
|
421
421
|
let figureClass, figureStyles;
|
|
422
422
|
// Is solid color style
|
|
@@ -484,7 +484,7 @@ const v2 = {
|
|
|
484
484
|
customTextColor,
|
|
485
485
|
...attributes
|
|
486
486
|
} ) {
|
|
487
|
-
const isSolidColorStyle = includes(
|
|
487
|
+
const isSolidColorStyle = className?.includes( SOLID_COLOR_CLASS );
|
|
488
488
|
let style = {};
|
|
489
489
|
|
|
490
490
|
if ( customMainColor ) {
|
package/src/search/edit.js
CHANGED
package/src/site-logo/edit.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import classnames from 'classnames';
|
|
5
|
-
import {
|
|
5
|
+
import { pick } from 'lodash';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
@@ -71,7 +71,7 @@ const SiteLogo = ( {
|
|
|
71
71
|
} ) => {
|
|
72
72
|
const clientWidth = useClientWidth( containerRef, [ align ] );
|
|
73
73
|
const isLargeViewport = useViewportMatch( 'medium' );
|
|
74
|
-
const isWideAligned =
|
|
74
|
+
const isWideAligned = [ 'wide', 'full' ].includes( align );
|
|
75
75
|
const isResizable = ! isWideAligned && isLargeViewport;
|
|
76
76
|
const [ { naturalWidth, naturalHeight }, setNaturalSize ] = useState( {} );
|
|
77
77
|
const [ isEditingImage, setIsEditingImage ] = useState( false );
|
package/src/site-tagline/edit.js
CHANGED
|
@@ -6,8 +6,8 @@ import classnames from 'classnames';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { useSelect } from '@wordpress/data';
|
|
10
|
-
import {
|
|
9
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
10
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
11
11
|
import {
|
|
12
12
|
AlignmentControl,
|
|
13
13
|
useBlockProps,
|
|
@@ -23,34 +23,43 @@ export default function SiteTaglineEdit( {
|
|
|
23
23
|
insertBlocksAfter,
|
|
24
24
|
} ) {
|
|
25
25
|
const { textAlign } = attributes;
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
'
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const siteData = getEntityRecord( 'root', '__unstableBase' );
|
|
26
|
+
const { canUserEdit, tagline } = useSelect( ( select ) => {
|
|
27
|
+
const { canUser, getEntityRecord, getEditedEntityRecord } =
|
|
28
|
+
select( coreStore );
|
|
29
|
+
const canEdit = canUser( 'update', 'settings' );
|
|
30
|
+
const settings = canEdit ? getEditedEntityRecord( 'root', 'site' ) : {};
|
|
31
|
+
const readOnlySettings = getEntityRecord( 'root', '__unstableBase' );
|
|
32
|
+
|
|
34
33
|
return {
|
|
35
34
|
canUserEdit: canUser( 'update', 'settings' ),
|
|
36
|
-
|
|
35
|
+
tagline: canEdit
|
|
36
|
+
? settings?.description
|
|
37
|
+
: readOnlySettings?.description,
|
|
37
38
|
};
|
|
38
39
|
}, [] );
|
|
40
|
+
|
|
41
|
+
const { editEntityRecord } = useDispatch( coreStore );
|
|
42
|
+
|
|
43
|
+
function setTagline( newTagline ) {
|
|
44
|
+
editEntityRecord( 'root', 'site', undefined, {
|
|
45
|
+
description: newTagline,
|
|
46
|
+
} );
|
|
47
|
+
}
|
|
48
|
+
|
|
39
49
|
const blockProps = useBlockProps( {
|
|
40
50
|
className: classnames( {
|
|
41
51
|
[ `has-text-align-${ textAlign }` ]: textAlign,
|
|
42
|
-
'wp-block-site-tagline__placeholder':
|
|
43
|
-
! canUserEdit && ! readOnlySiteTagLine,
|
|
52
|
+
'wp-block-site-tagline__placeholder': ! canUserEdit && ! tagline,
|
|
44
53
|
} ),
|
|
45
54
|
} );
|
|
46
55
|
const siteTaglineContent = canUserEdit ? (
|
|
47
56
|
<RichText
|
|
48
57
|
allowedFormats={ [] }
|
|
49
|
-
onChange={
|
|
58
|
+
onChange={ setTagline }
|
|
50
59
|
aria-label={ __( 'Site tagline text' ) }
|
|
51
60
|
placeholder={ __( 'Write site tagline…' ) }
|
|
52
61
|
tagName="p"
|
|
53
|
-
value={
|
|
62
|
+
value={ tagline }
|
|
54
63
|
disableLineBreaks
|
|
55
64
|
__unstableOnSplitAtEnd={ () =>
|
|
56
65
|
insertBlocksAfter( createBlock( getDefaultBlockName() ) )
|
|
@@ -58,9 +67,7 @@ export default function SiteTaglineEdit( {
|
|
|
58
67
|
{ ...blockProps }
|
|
59
68
|
/>
|
|
60
69
|
) : (
|
|
61
|
-
<p { ...blockProps }>
|
|
62
|
-
{ readOnlySiteTagLine || __( 'Site Tagline placeholder' ) }
|
|
63
|
-
</p>
|
|
70
|
+
<p { ...blockProps }>{ tagline || __( 'Site Tagline placeholder' ) }</p>
|
|
64
71
|
);
|
|
65
72
|
return (
|
|
66
73
|
<>
|
|
@@ -6,8 +6,8 @@ import classnames from 'classnames';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { useSelect } from '@wordpress/data';
|
|
10
|
-
import {
|
|
9
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
10
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
11
11
|
import { __ } from '@wordpress/i18n';
|
|
12
12
|
import {
|
|
13
13
|
RichText,
|
|
@@ -31,21 +31,31 @@ export default function SiteTitleEdit( {
|
|
|
31
31
|
insertBlocksAfter,
|
|
32
32
|
} ) {
|
|
33
33
|
const { level, textAlign, isLink, linkTarget } = attributes;
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const
|
|
34
|
+
const { canUserEdit, title } = useSelect( ( select ) => {
|
|
35
|
+
const { canUser, getEntityRecord, getEditedEntityRecord } =
|
|
36
|
+
select( coreStore );
|
|
37
|
+
const canEdit = canUser( 'update', 'settings' );
|
|
38
|
+
const settings = canEdit ? getEditedEntityRecord( 'root', 'site' ) : {};
|
|
39
|
+
const readOnlySettings = getEntityRecord( 'root', '__unstableBase' );
|
|
40
|
+
|
|
38
41
|
return {
|
|
39
|
-
canUserEdit:
|
|
40
|
-
|
|
42
|
+
canUserEdit: canEdit,
|
|
43
|
+
title: canEdit ? settings?.title : readOnlySettings?.name,
|
|
41
44
|
};
|
|
42
45
|
}, [] );
|
|
46
|
+
const { editEntityRecord } = useDispatch( coreStore );
|
|
47
|
+
|
|
48
|
+
function setTitle( newTitle ) {
|
|
49
|
+
editEntityRecord( 'root', 'site', undefined, {
|
|
50
|
+
title: newTitle,
|
|
51
|
+
} );
|
|
52
|
+
}
|
|
53
|
+
|
|
43
54
|
const TagName = level === 0 ? 'p' : `h${ level }`;
|
|
44
55
|
const blockProps = useBlockProps( {
|
|
45
56
|
className: classnames( {
|
|
46
57
|
[ `has-text-align-${ textAlign }` ]: textAlign,
|
|
47
|
-
'wp-block-site-title__placeholder':
|
|
48
|
-
! canUserEdit && ! readOnlyTitle,
|
|
58
|
+
'wp-block-site-title__placeholder': ! canUserEdit && ! title,
|
|
49
59
|
} ),
|
|
50
60
|
} );
|
|
51
61
|
const siteTitleContent = canUserEdit ? (
|
|
@@ -71,10 +81,14 @@ export default function SiteTitleEdit( {
|
|
|
71
81
|
href="#site-title-pseudo-link"
|
|
72
82
|
onClick={ ( event ) => event.preventDefault() }
|
|
73
83
|
>
|
|
74
|
-
{
|
|
84
|
+
{ decodeEntities( title ) ||
|
|
85
|
+
__( 'Site Title placeholder' ) }
|
|
75
86
|
</a>
|
|
76
87
|
) : (
|
|
77
|
-
<span>
|
|
88
|
+
<span>
|
|
89
|
+
{ decodeEntities( title ) ||
|
|
90
|
+
__( 'Site Title placeholder' ) }
|
|
91
|
+
</span>
|
|
78
92
|
) }
|
|
79
93
|
</TagName>
|
|
80
94
|
);
|
package/src/social-link/edit.js
CHANGED
|
@@ -66,7 +66,7 @@ const SocialLinkEdit = ( {
|
|
|
66
66
|
isSelected,
|
|
67
67
|
setAttributes,
|
|
68
68
|
} ) => {
|
|
69
|
-
const { url, service, label } = attributes;
|
|
69
|
+
const { url, service, label, rel } = attributes;
|
|
70
70
|
const { showLabels, iconColorValue, iconBackgroundColorValue } = context;
|
|
71
71
|
const [ showURLPopover, setPopover ] = useState( false );
|
|
72
72
|
const classes = classNames( 'wp-social-link', 'wp-social-link-' + service, {
|
|
@@ -113,6 +113,13 @@ const SocialLinkEdit = ( {
|
|
|
113
113
|
</PanelRow>
|
|
114
114
|
</PanelBody>
|
|
115
115
|
</InspectorControls>
|
|
116
|
+
<InspectorControls __experimentalGroup="advanced">
|
|
117
|
+
<TextControl
|
|
118
|
+
label={ __( 'Link rel' ) }
|
|
119
|
+
value={ rel || '' }
|
|
120
|
+
onChange={ ( value ) => setAttributes( { rel: value } ) }
|
|
121
|
+
/>
|
|
122
|
+
</InspectorControls>
|
|
116
123
|
<li { ...blockProps }>
|
|
117
124
|
<Button
|
|
118
125
|
className="wp-block-social-link-anchor"
|
|
@@ -20,6 +20,7 @@ function render_block_core_social_link( $attributes, $content, $block ) {
|
|
|
20
20
|
$service = ( isset( $attributes['service'] ) ) ? $attributes['service'] : 'Icon';
|
|
21
21
|
$url = ( isset( $attributes['url'] ) ) ? $attributes['url'] : false;
|
|
22
22
|
$label = ( isset( $attributes['label'] ) ) ? $attributes['label'] : block_core_social_link_get_name( $service );
|
|
23
|
+
$rel = ( isset( $attributes['rel'] ) ) ? $attributes['rel'] : '';
|
|
23
24
|
$show_labels = array_key_exists( 'showLabels', $block->context ) ? $block->context['showLabels'] : false;
|
|
24
25
|
|
|
25
26
|
// Don't render a link if there is no URL set.
|
|
@@ -43,11 +44,6 @@ function render_block_core_social_link( $attributes, $content, $block ) {
|
|
|
43
44
|
$url = 'https://' . $url;
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
$rel_target_attributes = '';
|
|
47
|
-
if ( $open_in_new_tab ) {
|
|
48
|
-
$rel_target_attributes = 'rel="noopener nofollow" target="_blank"';
|
|
49
|
-
}
|
|
50
|
-
|
|
51
47
|
$icon = block_core_social_link_get_icon( $service );
|
|
52
48
|
$wrapper_attributes = get_block_wrapper_attributes(
|
|
53
49
|
array(
|
|
@@ -57,13 +53,21 @@ function render_block_core_social_link( $attributes, $content, $block ) {
|
|
|
57
53
|
);
|
|
58
54
|
|
|
59
55
|
$link = '<li ' . $wrapper_attributes . '>';
|
|
60
|
-
$link .= '<a href="' . esc_url( $url ) . '"
|
|
56
|
+
$link .= '<a href="' . esc_url( $url ) . '" class="wp-block-social-link-anchor">';
|
|
61
57
|
$link .= $icon;
|
|
62
58
|
$link .= '<span class="wp-block-social-link-label' . ( $show_labels ? '' : ' screen-reader-text' ) . '">';
|
|
63
59
|
$link .= esc_html( $label );
|
|
64
60
|
$link .= '</span></a></li>';
|
|
65
61
|
|
|
66
|
-
|
|
62
|
+
$w = new WP_HTML_Tag_Processor( $link );
|
|
63
|
+
$w->next_tag( 'a' );
|
|
64
|
+
if ( $open_in_new_tab ) {
|
|
65
|
+
$w->set_attribute( 'rel', esc_attr( $rel ) . ' noopener nofollow' );
|
|
66
|
+
$w->set_attribute( 'target', '_blank' );
|
|
67
|
+
} elseif ( '' !== $rel ) {
|
|
68
|
+
$w->set_attribute( 'rel', esc_attr( $rel ) );
|
|
69
|
+
}
|
|
70
|
+
return $w;
|
|
67
71
|
}
|
|
68
72
|
|
|
69
73
|
/**
|
package/src/spacer/controls.js
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import { InspectorControls, useSetting } from '@wordpress/block-editor';
|
|
6
6
|
import {
|
|
7
|
-
BaseControl,
|
|
8
7
|
PanelBody,
|
|
9
8
|
__experimentalUseCustomUnits as useCustomUnits,
|
|
10
9
|
__experimentalUnitControl as UnitControl,
|
|
@@ -51,17 +50,16 @@ function DimensionInput( { label, onChange, isResizing, value = '' } ) {
|
|
|
51
50
|
].join( '' );
|
|
52
51
|
|
|
53
52
|
return (
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
</BaseControl>
|
|
53
|
+
<UnitControl
|
|
54
|
+
label={ label }
|
|
55
|
+
id={ inputId }
|
|
56
|
+
isResetValueOnUnitChange
|
|
57
|
+
min={ MIN_SPACER_SIZE }
|
|
58
|
+
onChange={ handleOnChange }
|
|
59
|
+
__unstableInputWidth={ '80px' }
|
|
60
|
+
value={ computedValue }
|
|
61
|
+
units={ units }
|
|
62
|
+
/>
|
|
65
63
|
);
|
|
66
64
|
}
|
|
67
65
|
|