@wordpress/block-library 10.2.0 → 10.3.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 +16 -0
- package/build/accordion-panel/block.json +1 -0
- package/build/code/edit.cjs +3 -1
- package/build/code/edit.cjs.map +2 -2
- package/build/cover/block.json +1 -0
- package/build/cover/edit/block-controls.cjs +3 -1
- package/build/cover/edit/block-controls.cjs.map +2 -2
- package/build/cover/edit/index.cjs +75 -31
- package/build/cover/edit/index.cjs.map +2 -2
- package/build/embed/edit.cjs +1 -1
- package/build/embed/edit.cjs.map +2 -2
- package/build/embed/embed-placeholder.cjs +1 -1
- package/build/embed/embed-placeholder.cjs.map +2 -2
- package/build/gallery/dynamic-gallery.cjs +104 -61
- package/build/gallery/dynamic-gallery.cjs.map +3 -3
- package/build/gallery/use-dynamic-gallery.cjs +15 -8
- package/build/gallery/use-dynamic-gallery.cjs.map +2 -2
- package/build/heading/edit.cjs +1 -1
- package/build/heading/edit.cjs.map +2 -2
- package/build/html/modal.cjs +63 -54
- package/build/html/modal.cjs.map +3 -3
- package/build/icon/block.json +5 -3
- package/build/image/edit.cjs +1 -1
- package/build/image/edit.cjs.map +2 -2
- package/build/image/image.cjs +29 -5
- package/build/image/image.cjs.map +3 -3
- package/build/image/use-open-image-media-editor-modal.cjs +6 -2
- package/build/image/use-open-image-media-editor-modal.cjs.map +2 -2
- package/build/list-item/hooks/use-indent-list-item.cjs +10 -2
- package/build/list-item/hooks/use-indent-list-item.cjs.map +2 -2
- package/build/math/edit.cjs +39 -56
- package/build/math/edit.cjs.map +3 -3
- package/build/media-text/edit.cjs +2 -1
- package/build/media-text/edit.cjs.map +2 -2
- package/build/more/edit.cjs +2 -2
- package/build/more/edit.cjs.map +2 -2
- package/build/navigation/edit/index.cjs +30 -16
- package/build/navigation/edit/index.cjs.map +3 -3
- package/build/navigation/edit/use-layout-custom-properties.cjs +72 -0
- package/build/navigation/edit/use-layout-custom-properties.cjs.map +7 -0
- package/build/navigation/view.cjs +9 -6
- package/build/navigation/view.cjs.map +2 -2
- package/build/navigation-link/edit.cjs +3 -3
- package/build/navigation-link/edit.cjs.map +2 -2
- package/build/navigation-link/link-ui/index.cjs +2 -2
- package/build/navigation-link/link-ui/index.cjs.map +2 -2
- package/build/paragraph/block.json +0 -1
- package/build/paragraph/edit.cjs +5 -2
- package/build/paragraph/edit.cjs.map +3 -3
- package/build/paragraph/index.cjs +4 -1
- package/build/paragraph/index.cjs.map +2 -2
- package/build/playlist/context.cjs +2 -1
- package/build/playlist/context.cjs.map +2 -2
- package/build/playlist/edit.cjs +113 -26
- package/build/playlist/edit.cjs.map +2 -2
- package/build/playlist/utils.cjs +19 -4
- package/build/playlist/utils.cjs.map +2 -2
- package/build/playlist-track/edit.cjs +21 -6
- package/build/playlist-track/edit.cjs.map +2 -2
- package/build/post-content/edit.cjs +36 -15
- package/build/post-content/edit.cjs.map +2 -2
- package/build/post-featured-image/edit.cjs +3 -2
- package/build/post-featured-image/edit.cjs.map +2 -2
- package/build/post-terms/edit.cjs +2 -2
- package/build/post-terms/edit.cjs.map +2 -2
- package/build/post-title/edit.cjs +2 -2
- package/build/post-title/edit.cjs.map +2 -2
- package/build/preformatted/edit.cjs +3 -1
- package/build/preformatted/edit.cjs.map +2 -2
- package/build/pullquote/edit.cjs +5 -3
- package/build/pullquote/edit.cjs.map +2 -2
- package/build/query/edit/inspector-controls/index.cjs +4 -1
- package/build/query/edit/inspector-controls/index.cjs.map +2 -2
- package/build/query/edit/inspector-controls/offset-controls.cjs +1 -1
- package/build/query/edit/inspector-controls/offset-controls.cjs.map +2 -2
- package/build/read-more/edit.cjs +3 -1
- package/build/read-more/edit.cjs.map +2 -2
- package/build/site-tagline/edit.cjs +3 -1
- package/build/site-tagline/edit.cjs.map +2 -2
- package/build/site-title/edit.cjs +3 -1
- package/build/site-title/edit.cjs.map +2 -2
- package/build/social-links/edit.cjs +11 -4
- package/build/social-links/edit.cjs.map +2 -2
- package/build/tab-list/block.json +2 -1
- package/build/tab-list/edit.cjs +2 -0
- package/build/tab-list/edit.cjs.map +3 -3
- package/build/tab-list/tab-movers.cjs +87 -0
- package/build/tab-list/tab-movers.cjs.map +7 -0
- package/build/tab-panel/edit.cjs +1 -9
- package/build/tab-panel/edit.cjs.map +2 -2
- package/build/table/edit.cjs +1 -1
- package/build/table/edit.cjs.map +2 -2
- package/build/tabs/use-tab-actions.cjs +23 -1
- package/build/tabs/use-tab-actions.cjs.map +2 -2
- package/build/utils/caption.cjs +2 -2
- package/build/utils/caption.cjs.map +2 -2
- package/build/verse/edit.cjs +3 -1
- package/build/verse/edit.cjs.map +2 -2
- package/build/video/tracks-editor.cjs +0 -1
- package/build/video/tracks-editor.cjs.map +2 -2
- package/build-module/accordion-panel/block.json +1 -0
- package/build-module/code/edit.mjs +3 -1
- package/build-module/code/edit.mjs.map +2 -2
- package/build-module/cover/block.json +1 -0
- package/build-module/cover/edit/block-controls.mjs +3 -1
- package/build-module/cover/edit/block-controls.mjs.map +2 -2
- package/build-module/cover/edit/index.mjs +78 -34
- package/build-module/cover/edit/index.mjs.map +2 -2
- package/build-module/embed/edit.mjs +1 -1
- package/build-module/embed/edit.mjs.map +2 -2
- package/build-module/embed/embed-placeholder.mjs +1 -1
- package/build-module/embed/embed-placeholder.mjs.map +2 -2
- package/build-module/gallery/dynamic-gallery.mjs +104 -61
- package/build-module/gallery/dynamic-gallery.mjs.map +2 -2
- package/build-module/gallery/use-dynamic-gallery.mjs +16 -9
- package/build-module/gallery/use-dynamic-gallery.mjs.map +2 -2
- package/build-module/heading/edit.mjs +1 -1
- package/build-module/heading/edit.mjs.map +2 -2
- package/build-module/html/modal.mjs +68 -55
- package/build-module/html/modal.mjs.map +2 -2
- package/build-module/icon/block.json +5 -3
- package/build-module/image/edit.mjs +1 -1
- package/build-module/image/edit.mjs.map +2 -2
- package/build-module/image/image.mjs +19 -5
- package/build-module/image/image.mjs.map +2 -2
- package/build-module/image/use-open-image-media-editor-modal.mjs +6 -2
- package/build-module/image/use-open-image-media-editor-modal.mjs.map +2 -2
- package/build-module/list-item/hooks/use-indent-list-item.mjs +10 -2
- package/build-module/list-item/hooks/use-indent-list-item.mjs.map +2 -2
- package/build-module/math/edit.mjs +41 -60
- package/build-module/math/edit.mjs.map +2 -2
- package/build-module/media-text/edit.mjs +2 -1
- package/build-module/media-text/edit.mjs.map +2 -2
- package/build-module/more/edit.mjs +2 -2
- package/build-module/more/edit.mjs.map +2 -2
- package/build-module/navigation/edit/index.mjs +30 -16
- package/build-module/navigation/edit/index.mjs.map +2 -2
- package/build-module/navigation/edit/use-layout-custom-properties.mjs +51 -0
- package/build-module/navigation/edit/use-layout-custom-properties.mjs.map +7 -0
- package/build-module/navigation/view.mjs +9 -6
- package/build-module/navigation/view.mjs.map +2 -2
- package/build-module/navigation-link/edit.mjs +3 -3
- package/build-module/navigation-link/edit.mjs.map +2 -2
- package/build-module/navigation-link/link-ui/index.mjs +2 -2
- package/build-module/navigation-link/link-ui/index.mjs.map +2 -2
- package/build-module/paragraph/block.json +0 -1
- package/build-module/paragraph/edit.mjs +6 -2
- package/build-module/paragraph/edit.mjs.map +2 -2
- package/build-module/paragraph/index.mjs +4 -1
- package/build-module/paragraph/index.mjs.map +2 -2
- package/build-module/playlist/context.mjs +2 -1
- package/build-module/playlist/context.mjs.map +2 -2
- package/build-module/playlist/edit.mjs +113 -27
- package/build-module/playlist/edit.mjs.map +2 -2
- package/build-module/playlist/utils.mjs +19 -4
- package/build-module/playlist/utils.mjs.map +2 -2
- package/build-module/playlist-track/edit.mjs +21 -6
- package/build-module/playlist-track/edit.mjs.map +2 -2
- package/build-module/post-content/edit.mjs +37 -15
- package/build-module/post-content/edit.mjs.map +2 -2
- package/build-module/post-featured-image/edit.mjs +3 -2
- package/build-module/post-featured-image/edit.mjs.map +2 -2
- package/build-module/post-terms/edit.mjs +2 -2
- package/build-module/post-terms/edit.mjs.map +2 -2
- package/build-module/post-title/edit.mjs +2 -2
- package/build-module/post-title/edit.mjs.map +2 -2
- package/build-module/preformatted/edit.mjs +3 -1
- package/build-module/preformatted/edit.mjs.map +2 -2
- package/build-module/pullquote/edit.mjs +5 -3
- package/build-module/pullquote/edit.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/index.mjs +5 -2
- package/build-module/query/edit/inspector-controls/index.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/offset-controls.mjs +2 -2
- package/build-module/query/edit/inspector-controls/offset-controls.mjs.map +2 -2
- package/build-module/read-more/edit.mjs +3 -1
- package/build-module/read-more/edit.mjs.map +2 -2
- package/build-module/site-tagline/edit.mjs +3 -1
- package/build-module/site-tagline/edit.mjs.map +2 -2
- package/build-module/site-title/edit.mjs +3 -1
- package/build-module/site-title/edit.mjs.map +2 -2
- package/build-module/social-links/edit.mjs +11 -4
- package/build-module/social-links/edit.mjs.map +2 -2
- package/build-module/tab-list/block.json +2 -1
- package/build-module/tab-list/edit.mjs +2 -0
- package/build-module/tab-list/edit.mjs.map +2 -2
- package/build-module/tab-list/tab-movers.mjs +59 -0
- package/build-module/tab-list/tab-movers.mjs.map +7 -0
- package/build-module/tab-panel/edit.mjs +1 -9
- package/build-module/tab-panel/edit.mjs.map +2 -2
- package/build-module/table/edit.mjs +1 -1
- package/build-module/table/edit.mjs.map +2 -2
- package/build-module/tabs/use-tab-actions.mjs +23 -1
- package/build-module/tabs/use-tab-actions.mjs.map +2 -2
- package/build-module/utils/caption.mjs +2 -2
- package/build-module/utils/caption.mjs.map +2 -2
- package/build-module/verse/edit.mjs +3 -1
- package/build-module/verse/edit.mjs.map +2 -2
- package/build-module/video/tracks-editor.mjs +0 -1
- package/build-module/video/tracks-editor.mjs.map +2 -2
- package/build-style/cover/editor-rtl.css +3 -0
- package/build-style/cover/editor.css +3 -0
- package/build-style/editor-rtl.css +18 -41
- package/build-style/editor.css +18 -41
- package/build-style/icon/editor-rtl.css +1 -4
- package/build-style/icon/editor.css +1 -4
- package/build-style/image/editor-rtl.css +3 -32
- package/build-style/image/editor.css +3 -32
- package/build-style/playlist/editor-rtl.css +0 -5
- package/build-style/playlist/editor.css +0 -5
- package/build-style/playlist/style-rtl.css +44 -4
- package/build-style/playlist/style.css +44 -4
- package/build-style/pullquote/editor-rtl.css +4 -0
- package/build-style/pullquote/editor.css +4 -0
- package/build-style/style-rtl.css +44 -4
- package/build-style/style.css +44 -4
- package/build-style/tab-list/editor-rtl.css +101 -0
- package/build-style/tab-list/editor.css +101 -0
- package/package.json +43 -43
- package/src/accordion-panel/block.json +1 -0
- package/src/breadcrumbs/index.php +3 -1
- package/src/button/index.php +1 -1
- package/src/code/edit.js +7 -2
- package/src/cover/block.json +1 -0
- package/src/cover/edit/block-controls.js +5 -0
- package/src/cover/edit/index.js +100 -35
- package/src/cover/editor.scss +6 -0
- package/src/cover/index.php +9 -2
- package/src/editor.scss +1 -0
- package/src/embed/edit.js +3 -1
- package/src/embed/embed-placeholder.js +9 -7
- package/src/form/index.php +6 -4
- package/src/gallery/dynamic-gallery.js +133 -74
- package/src/gallery/use-dynamic-gallery.js +27 -12
- package/src/heading/edit.js +1 -1
- package/src/html/modal.js +13 -2
- package/src/icon/README.md +1 -3
- package/src/icon/block.json +5 -3
- package/src/icon/editor.scss +1 -4
- package/src/image/edit.js +1 -5
- package/src/image/editor.scss +6 -46
- package/src/image/image.js +37 -3
- package/src/image/test/use-open-image-media-editor-modal.js +37 -1
- package/src/image/use-open-image-media-editor-modal.js +8 -1
- package/src/latest-posts/index.php +3 -2
- package/src/list-item/hooks/use-indent-list-item.js +10 -1
- package/src/math/edit.js +42 -59
- package/src/media-text/edit.js +1 -0
- package/src/media-text/index.php +11 -2
- package/src/more/edit.js +7 -4
- package/src/navigation/edit/index.js +52 -36
- package/src/navigation/edit/test/layout-custom-properties.js +138 -0
- package/src/navigation/edit/use-layout-custom-properties.js +84 -0
- package/src/navigation/index.php +123 -12
- package/src/navigation/test/view.js +51 -0
- package/src/navigation/view.js +15 -14
- package/src/navigation-link/edit.js +11 -7
- package/src/navigation-link/index.php +64 -0
- package/src/navigation-link/link-ui/index.js +2 -1
- package/src/navigation-link/test/__snapshots__/hooks.js.snap +1 -1
- package/src/page-list/index.php +4 -3
- package/src/paragraph/README.md +0 -1
- package/src/paragraph/block.json +0 -1
- package/src/paragraph/edit.js +9 -2
- package/src/paragraph/index.js +4 -1
- package/src/pattern/index.php +5 -5
- package/src/playlist/context.js +1 -0
- package/src/playlist/edit.js +151 -47
- package/src/playlist/editor.scss +0 -7
- package/src/playlist/index.php +14 -9
- package/src/playlist/style.scss +3 -0
- package/src/playlist/test/edit-component.js +139 -0
- package/src/playlist/test/edit.js +30 -0
- package/src/playlist/utils.js +25 -4
- package/src/playlist-track/edit.js +22 -5
- package/src/playlist-track/index.php +8 -7
- package/src/playlist-track/test/edit.js +87 -3
- package/src/post-content/edit.js +45 -16
- package/src/post-excerpt/index.php +4 -1
- package/src/post-featured-image/edit.js +3 -2
- package/src/post-featured-image/index.php +4 -1
- package/src/post-terms/edit.js +7 -4
- package/src/post-title/edit.js +5 -3
- package/src/preformatted/edit.js +7 -2
- package/src/pullquote/edit.js +9 -4
- package/src/pullquote/editor.scss +6 -0
- package/src/query/edit/inspector-controls/index.js +5 -2
- package/src/query/edit/inspector-controls/offset-controls.js +2 -2
- package/src/read-more/edit.js +7 -2
- package/src/rss/index.php +9 -3
- package/src/site-tagline/edit.js +7 -2
- package/src/site-title/edit.js +7 -2
- package/src/social-link/index.php +19 -9
- package/src/social-links/edit.js +21 -12
- package/src/tab-list/block.json +2 -1
- package/src/tab-list/edit.js +2 -0
- package/src/tab-list/editor.scss +9 -0
- package/src/tab-list/tab-movers.js +72 -0
- package/src/tab-panel/edit.js +1 -9
- package/src/table/edit.js +1 -1
- package/src/table-of-contents/index.php +386 -1
- package/src/tabs/use-tab-actions.js +32 -3
- package/src/tag-cloud/index.php +3 -2
- package/src/template-part/index.php +2 -1
- package/src/utils/caption.js +7 -4
- package/src/utils/test/waveform-utils.js +63 -0
- package/src/verse/edit.js +7 -2
- package/src/video/index.php +2 -2
- package/src/video/tracks-editor.js +0 -1
|
@@ -15,3 +15,9 @@
|
|
|
15
15
|
.wp-block-pullquote__citation {
|
|
16
16
|
color: inherit;
|
|
17
17
|
}
|
|
18
|
+
|
|
19
|
+
// Ensure custom line-height values applied to the block are inherited by the
|
|
20
|
+
// paragraph instead of being overridden by the default editor styles.
|
|
21
|
+
.wp-block-pullquote[style*="line-height"] :where(p) {
|
|
22
|
+
line-height: inherit;
|
|
23
|
+
}
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from '@wordpress/components';
|
|
15
15
|
import { useSelect } from '@wordpress/data';
|
|
16
16
|
import { store as coreStore } from '@wordpress/core-data';
|
|
17
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
17
|
+
import { __, _x, sprintf } from '@wordpress/i18n';
|
|
18
18
|
import { debounce } from '@wordpress/compose';
|
|
19
19
|
import { useState, useMemo } from '@wordpress/element';
|
|
20
20
|
|
|
@@ -367,7 +367,10 @@ export default function QueryInspectorControls( props ) {
|
|
|
367
367
|
/>
|
|
368
368
|
</ToolsPanelItem>
|
|
369
369
|
<ToolsPanelItem
|
|
370
|
-
label={
|
|
370
|
+
label={ _x(
|
|
371
|
+
'Offset',
|
|
372
|
+
'Number of posts to skip in a query'
|
|
373
|
+
) }
|
|
371
374
|
hasValue={ () => offset > 0 }
|
|
372
375
|
onDeselect={ () => setQuery( { offset: 0 } ) }
|
|
373
376
|
>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __experimentalNumberControl as NumberControl } from '@wordpress/components';
|
|
5
|
-
import {
|
|
5
|
+
import { _x } from '@wordpress/i18n';
|
|
6
6
|
|
|
7
7
|
const MIN_OFFSET = 0;
|
|
8
8
|
const MAX_OFFSET = 100;
|
|
@@ -10,7 +10,7 @@ const MAX_OFFSET = 100;
|
|
|
10
10
|
export const OffsetControl = ( { offset = 0, onChange } ) => {
|
|
11
11
|
return (
|
|
12
12
|
<NumberControl
|
|
13
|
-
label={
|
|
13
|
+
label={ _x( 'Offset', 'Number of posts to skip in a query' ) }
|
|
14
14
|
value={ offset }
|
|
15
15
|
min={ MIN_OFFSET }
|
|
16
16
|
onChange={ ( newOffset ) => {
|
package/src/read-more/edit.js
CHANGED
|
@@ -64,8 +64,13 @@ export default function ReadMore( {
|
|
|
64
64
|
onChange={ ( newValue ) =>
|
|
65
65
|
setAttributes( { content: newValue } )
|
|
66
66
|
}
|
|
67
|
-
__unstableOnSplitAtEnd={
|
|
68
|
-
insertBlocksAfter
|
|
67
|
+
__unstableOnSplitAtEnd={
|
|
68
|
+
insertBlocksAfter
|
|
69
|
+
? () =>
|
|
70
|
+
insertBlocksAfter(
|
|
71
|
+
createBlock( getDefaultBlockName() )
|
|
72
|
+
)
|
|
73
|
+
: undefined
|
|
69
74
|
}
|
|
70
75
|
withoutInteractiveFormatting
|
|
71
76
|
{ ...blockProps }
|
package/src/rss/index.php
CHANGED
|
@@ -15,11 +15,16 @@
|
|
|
15
15
|
* @return string Returns the block content with received rss items.
|
|
16
16
|
*/
|
|
17
17
|
function render_block_core_rss( $attributes ) {
|
|
18
|
-
|
|
18
|
+
$feed_url = $attributes['feedURL'] ?? null;
|
|
19
|
+
if ( ! is_string( $feed_url ) ) {
|
|
20
|
+
return '';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if ( in_array( untrailingslashit( $feed_url ), array( site_url(), home_url() ), true ) ) {
|
|
19
24
|
return '<div class="components-placeholder"><div class="notice notice-error">' . __( 'Adding an RSS feed to this site’s homepage is not supported, as it could lead to a loop that slows down your site. Try using another block, like the <strong>Latest Posts</strong> block, to list posts from the site.' ) . '</div></div>';
|
|
20
25
|
}
|
|
21
26
|
|
|
22
|
-
$rss = fetch_feed( $
|
|
27
|
+
$rss = fetch_feed( $feed_url );
|
|
23
28
|
|
|
24
29
|
if ( is_wp_error( $rss ) ) {
|
|
25
30
|
return '<div class="components-placeholder"><div class="notice notice-error"><strong>' . __( 'RSS Error:' ) . '</strong> ' . esc_html( $rss->get_error_message() ) . '</div></div>';
|
|
@@ -33,7 +38,8 @@ function render_block_core_rss( $attributes ) {
|
|
|
33
38
|
$list_items = '';
|
|
34
39
|
|
|
35
40
|
$open_in_new_tab = ! empty( $attributes['openInNewTab'] );
|
|
36
|
-
$
|
|
41
|
+
$rel_attr = $attributes['rel'] ?? null;
|
|
42
|
+
$rel = is_string( $rel_attr ) && '' !== $rel_attr ? trim( $rel_attr ) : '';
|
|
37
43
|
|
|
38
44
|
$link_attributes = '';
|
|
39
45
|
|
package/src/site-tagline/edit.js
CHANGED
|
@@ -59,8 +59,13 @@ export default function SiteTaglineEdit( props ) {
|
|
|
59
59
|
tagName={ TagName }
|
|
60
60
|
value={ tagline }
|
|
61
61
|
disableLineBreaks
|
|
62
|
-
__unstableOnSplitAtEnd={
|
|
63
|
-
insertBlocksAfter
|
|
62
|
+
__unstableOnSplitAtEnd={
|
|
63
|
+
insertBlocksAfter
|
|
64
|
+
? () =>
|
|
65
|
+
insertBlocksAfter(
|
|
66
|
+
createBlock( getDefaultBlockName() )
|
|
67
|
+
)
|
|
68
|
+
: undefined
|
|
64
69
|
}
|
|
65
70
|
{ ...blockProps }
|
|
66
71
|
/>
|
package/src/site-title/edit.js
CHANGED
|
@@ -73,8 +73,13 @@ export default function SiteTitleEdit( props ) {
|
|
|
73
73
|
onChange={ setTitle }
|
|
74
74
|
allowedFormats={ [] }
|
|
75
75
|
disableLineBreaks
|
|
76
|
-
__unstableOnSplitAtEnd={
|
|
77
|
-
insertBlocksAfter
|
|
76
|
+
__unstableOnSplitAtEnd={
|
|
77
|
+
insertBlocksAfter
|
|
78
|
+
? () =>
|
|
79
|
+
insertBlocksAfter(
|
|
80
|
+
createBlock( getDefaultBlockName() )
|
|
81
|
+
)
|
|
82
|
+
: undefined
|
|
78
83
|
}
|
|
79
84
|
/>
|
|
80
85
|
</TagName>
|
|
@@ -19,19 +19,26 @@
|
|
|
19
19
|
function render_block_core_social_link( $attributes, $content, $block ) {
|
|
20
20
|
$open_in_new_tab = $block->context['openInNewTab'] ?? false;
|
|
21
21
|
|
|
22
|
-
$
|
|
22
|
+
$label_attr = $attributes['label'] ?? null;
|
|
23
|
+
$text = is_string( $label_attr ) && '' !== $label_attr ? trim( $label_attr ) : '';
|
|
23
24
|
|
|
24
|
-
$
|
|
25
|
-
$
|
|
26
|
-
$
|
|
27
|
-
$
|
|
28
|
-
$
|
|
25
|
+
$service_attr = $attributes['service'] ?? null;
|
|
26
|
+
$service = is_string( $service_attr ) ? $service_attr : 'Icon';
|
|
27
|
+
$url = $attributes['url'] ?? false;
|
|
28
|
+
$text = $text ? $text : block_core_social_link_get_name( $service );
|
|
29
|
+
$rel_attr = $attributes['rel'] ?? null;
|
|
30
|
+
$rel = is_string( $rel_attr ) ? $rel_attr : '';
|
|
31
|
+
$show_labels = array_key_exists( 'showLabels', $block->context ) ? $block->context['showLabels'] : false;
|
|
29
32
|
|
|
30
33
|
// Don't render a link if there is no URL set.
|
|
31
34
|
if ( ! $url ) {
|
|
32
35
|
return '';
|
|
33
36
|
}
|
|
34
37
|
|
|
38
|
+
if ( ! is_string( $url ) ) {
|
|
39
|
+
return '';
|
|
40
|
+
}
|
|
41
|
+
|
|
35
42
|
/**
|
|
36
43
|
* Prepend emails with `mailto:` if not set.
|
|
37
44
|
* The `is_email` returns false for emails with schema.
|
|
@@ -100,7 +107,7 @@ add_action( 'init', 'register_block_core_social_link' );
|
|
|
100
107
|
*/
|
|
101
108
|
function block_core_social_link_get_icon( $service ) {
|
|
102
109
|
$services = block_core_social_link_services();
|
|
103
|
-
if ( isset( $services[ $service ] ) && isset( $services[ $service ]['icon'] ) ) {
|
|
110
|
+
if ( is_string( $service ) && isset( $services[ $service ] ) && isset( $services[ $service ]['icon'] ) ) {
|
|
104
111
|
return $services[ $service ]['icon'];
|
|
105
112
|
}
|
|
106
113
|
|
|
@@ -118,7 +125,7 @@ function block_core_social_link_get_icon( $service ) {
|
|
|
118
125
|
*/
|
|
119
126
|
function block_core_social_link_get_name( $service ) {
|
|
120
127
|
$services = block_core_social_link_services();
|
|
121
|
-
if ( isset( $services[ $service ] ) && isset( $services[ $service ]['name'] ) ) {
|
|
128
|
+
if ( is_string( $service ) && isset( $services[ $service ] ) && isset( $services[ $service ]['name'] ) ) {
|
|
122
129
|
return $services[ $service ]['name'];
|
|
123
130
|
}
|
|
124
131
|
|
|
@@ -136,6 +143,9 @@ function block_core_social_link_get_name( $service ) {
|
|
|
136
143
|
* @return array|string
|
|
137
144
|
*/
|
|
138
145
|
function block_core_social_link_services( $service = '', $field = '' ) {
|
|
146
|
+
if ( ! is_string( $service ) || ! is_string( $field ) ) {
|
|
147
|
+
return array();
|
|
148
|
+
}
|
|
139
149
|
$services_data = array(
|
|
140
150
|
'fivehundredpx' => array(
|
|
141
151
|
'name' => _x( '500px', 'social link block variation name' ),
|
|
@@ -295,7 +305,7 @@ function block_core_social_link_services( $service = '', $field = '' ) {
|
|
|
295
305
|
),
|
|
296
306
|
'tumblr' => array(
|
|
297
307
|
'name' => _x( 'Tumblr', 'social link block variation name' ),
|
|
298
|
-
'icon' => '<svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M17.04 21.28h-3.28c-2.84 0-4.94-1.37-4.94-5.02v-5.67H6.08V7.5c2.93-.73 4.11-3.3 4.3-5.48h3.01v4.93h3.47v3.65H13.4v4.93c0 1.47.73 2.01 1.92 2.01h1.73v3.75z"
|
|
308
|
+
'icon' => '<svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M17.04 21.28h-3.28c-2.84 0-4.94-1.37-4.94-5.02v-5.67H6.08V7.5c2.93-.73 4.11-3.3 4.3-5.48h3.01v4.93h3.47v3.65H13.4v4.93c0 1.47.73 2.01 1.92 2.01h1.73v3.75z"></path></svg>',
|
|
299
309
|
),
|
|
300
310
|
'twitch' => array(
|
|
301
311
|
'name' => _x( 'Twitch', 'social link block variation name' ),
|
package/src/social-links/edit.js
CHANGED
|
@@ -30,6 +30,7 @@ import { useSelect } from '@wordpress/data';
|
|
|
30
30
|
/**
|
|
31
31
|
* Internal dependencies
|
|
32
32
|
*/
|
|
33
|
+
import { unlock } from '../lock-unlock';
|
|
33
34
|
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
34
35
|
|
|
35
36
|
const sizeOptions = [
|
|
@@ -60,17 +61,23 @@ export function SocialLinksEdit( props ) {
|
|
|
60
61
|
size,
|
|
61
62
|
} = attributes;
|
|
62
63
|
|
|
63
|
-
const { hasSocialIcons, hasSelectedChild } =
|
|
64
|
-
(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
64
|
+
const { hasSocialIcons, hasSelectedChild, hasSelectedStyleState } =
|
|
65
|
+
useSelect(
|
|
66
|
+
( select ) => {
|
|
67
|
+
const {
|
|
68
|
+
getBlockCount,
|
|
69
|
+
hasSelectedInnerBlock,
|
|
70
|
+
hasSelectedStyleState: hasSelectedBlockStyleState,
|
|
71
|
+
} = unlock( select( blockEditorStore ) );
|
|
72
|
+
return {
|
|
73
|
+
hasSocialIcons: getBlockCount( clientId ) > 0,
|
|
74
|
+
hasSelectedChild: hasSelectedInnerBlock( clientId ),
|
|
75
|
+
hasSelectedStyleState:
|
|
76
|
+
hasSelectedBlockStyleState( clientId ),
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
[ clientId ]
|
|
80
|
+
);
|
|
74
81
|
|
|
75
82
|
const hasAnySelected = isSelected || hasSelectedChild;
|
|
76
83
|
|
|
@@ -157,6 +164,8 @@ export function SocialLinksEdit( props ) {
|
|
|
157
164
|
}
|
|
158
165
|
|
|
159
166
|
const colorGradientSettings = useMultipleOriginColorsAndGradients();
|
|
167
|
+
const showColorControls =
|
|
168
|
+
colorGradientSettings.hasColorsOrGradients && ! hasSelectedStyleState;
|
|
160
169
|
|
|
161
170
|
return (
|
|
162
171
|
<>
|
|
@@ -227,7 +236,7 @@ export function SocialLinksEdit( props ) {
|
|
|
227
236
|
</ToolsPanelItem>
|
|
228
237
|
</ToolsPanel>
|
|
229
238
|
</InspectorControls>
|
|
230
|
-
{
|
|
239
|
+
{ showColorControls && (
|
|
231
240
|
<InspectorControls group="color">
|
|
232
241
|
{ colorSettings.map(
|
|
233
242
|
( { onChange, label, value, resetAllFilter } ) => (
|
package/src/tab-list/block.json
CHANGED
package/src/tab-list/edit.js
CHANGED
|
@@ -28,6 +28,7 @@ import { useEffect, useMemo, useRef } from '@wordpress/element';
|
|
|
28
28
|
* Internal dependencies
|
|
29
29
|
*/
|
|
30
30
|
import TabToolbarControls from '../tabs/tab-toolbar-controls';
|
|
31
|
+
import TabMovers from './tab-movers';
|
|
31
32
|
import useTabActions from '../tabs/use-tab-actions';
|
|
32
33
|
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
33
34
|
|
|
@@ -199,6 +200,7 @@ function Edit( {
|
|
|
199
200
|
</ToolsPanelItem>
|
|
200
201
|
</ToolsPanel>
|
|
201
202
|
</InspectorControls>
|
|
203
|
+
<TabMovers tabsClientId={ tabsClientId } />
|
|
202
204
|
<TabToolbarControls tabsClientId={ tabsClientId } />
|
|
203
205
|
<div { ...blockProps }>
|
|
204
206
|
{ tabsList.map( ( tab, index ) => {
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __, isRTL } from '@wordpress/i18n';
|
|
5
|
+
import {
|
|
6
|
+
BlockControls,
|
|
7
|
+
store as blockEditorStore,
|
|
8
|
+
} from '@wordpress/block-editor';
|
|
9
|
+
import { ToolbarButton } from '@wordpress/components';
|
|
10
|
+
import { chevronLeft, chevronRight } from '@wordpress/icons';
|
|
11
|
+
import { useSelect } from '@wordpress/data';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Internal dependencies
|
|
15
|
+
*/
|
|
16
|
+
import useTabActions from '../tabs/use-tab-actions';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Block toolbar buttons that reorder the active tab one position before or after.
|
|
20
|
+
* Reordering acts on the underlying core/tab-panel blocks; the tab-list labels
|
|
21
|
+
* follow their panel automatically via useTabListItemsSync. The buttons are
|
|
22
|
+
* disabled at the first/last position.
|
|
23
|
+
*
|
|
24
|
+
* @param {Object} props
|
|
25
|
+
* @param {string} props.tabsClientId The client ID of the parent tabs block.
|
|
26
|
+
* @return {React.JSX.Element} The toolbar control element.
|
|
27
|
+
*/
|
|
28
|
+
export default function TabMovers( { tabsClientId } ) {
|
|
29
|
+
const { moveTab } = useTabActions( tabsClientId );
|
|
30
|
+
const { tabCount, activeIndex } = useSelect(
|
|
31
|
+
( select ) => {
|
|
32
|
+
if ( ! tabsClientId ) {
|
|
33
|
+
return { tabCount: 0, activeIndex: 0 };
|
|
34
|
+
}
|
|
35
|
+
const { getBlocks, getBlockAttributes } =
|
|
36
|
+
select( blockEditorStore );
|
|
37
|
+
const tabsAttributes = getBlockAttributes( tabsClientId );
|
|
38
|
+
const tabPanels = getBlocks( tabsClientId ).find(
|
|
39
|
+
( block ) => block.name === 'core/tab-panels'
|
|
40
|
+
);
|
|
41
|
+
return {
|
|
42
|
+
tabCount: tabPanels?.innerBlocks.length ?? 0,
|
|
43
|
+
activeIndex:
|
|
44
|
+
tabsAttributes?.editorActiveTabIndex ??
|
|
45
|
+
tabsAttributes?.activeTabIndex ??
|
|
46
|
+
0,
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
[ tabsClientId ]
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<BlockControls group="parent">
|
|
54
|
+
<ToolbarButton
|
|
55
|
+
className="wp-block-tab-list__mover-button"
|
|
56
|
+
icon={ isRTL() ? chevronRight : chevronLeft }
|
|
57
|
+
label={ __( 'Move tab before' ) }
|
|
58
|
+
onClick={ () => moveTab( -1 ) }
|
|
59
|
+
disabled={ activeIndex <= 0 }
|
|
60
|
+
accessibleWhenDisabled
|
|
61
|
+
/>
|
|
62
|
+
<ToolbarButton
|
|
63
|
+
className="wp-block-tab-list__mover-button"
|
|
64
|
+
icon={ isRTL() ? chevronLeft : chevronRight }
|
|
65
|
+
label={ __( 'Move tab after' ) }
|
|
66
|
+
onClick={ () => moveTab( 1 ) }
|
|
67
|
+
disabled={ activeIndex >= tabCount - 1 }
|
|
68
|
+
accessibleWhenDisabled
|
|
69
|
+
/>
|
|
70
|
+
</BlockControls>
|
|
71
|
+
);
|
|
72
|
+
}
|
package/src/tab-panel/edit.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
5
4
|
import {
|
|
6
5
|
useBlockProps,
|
|
7
6
|
useInnerBlocksProps,
|
|
@@ -15,14 +14,7 @@ import { useEffect } from '@wordpress/element';
|
|
|
15
14
|
*/
|
|
16
15
|
import Controls from './controls';
|
|
17
16
|
|
|
18
|
-
const TEMPLATE = [
|
|
19
|
-
[
|
|
20
|
-
'core/paragraph',
|
|
21
|
-
{
|
|
22
|
-
placeholder: __( 'Type / to choose a block' ),
|
|
23
|
-
},
|
|
24
|
-
],
|
|
25
|
-
];
|
|
17
|
+
const TEMPLATE = [ [ 'core/paragraph' ] ];
|
|
26
18
|
|
|
27
19
|
export default function Edit( { clientId, isSelected } ) {
|
|
28
20
|
const {
|
package/src/table/edit.js
CHANGED
|
@@ -455,7 +455,7 @@ function TableEdit( {
|
|
|
455
455
|
<>
|
|
456
456
|
<BlockControls group="block">
|
|
457
457
|
<AlignmentControl
|
|
458
|
-
label={ __( '
|
|
458
|
+
label={ __( 'Align column content' ) }
|
|
459
459
|
alignmentControls={ ALIGNMENT_CONTROLS }
|
|
460
460
|
value={ getCellAlignment() }
|
|
461
461
|
onChange={ ( nextAlign ) =>
|