@wordpress/block-library 7.16.0 → 7.17.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 -1
- package/build/archives/edit.js +1 -0
- package/build/archives/edit.js.map +1 -1
- package/build/comment-template/edit.js +40 -32
- package/build/comment-template/edit.js.map +1 -1
- package/build/comments/edit/placeholder.js +1 -4
- package/build/comments/edit/placeholder.js.map +1 -1
- package/build/comments/index.js +5 -1
- package/build/comments/index.js.map +1 -1
- package/build/comments-title/edit.js +18 -1
- package/build/comments-title/edit.js.map +1 -1
- package/build/cover/edit/index.js +2 -2
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/edit/use-cover-is-dark.js +8 -7
- package/build/cover/edit/use-cover-is-dark.js.map +1 -1
- package/build/embed/variations.js +1 -1
- package/build/embed/variations.js.map +1 -1
- package/build/gallery/transforms.js +3 -3
- package/build/gallery/transforms.js.map +1 -1
- package/build/gallery/v1/edit.js +1 -1
- package/build/gallery/v1/edit.js.map +1 -1
- package/build/image/image.js +34 -10
- package/build/image/image.js.map +1 -1
- package/build/image/transforms.js +1 -7
- package/build/image/transforms.js.map +1 -1
- package/build/list/transforms.js +9 -1
- package/build/list/transforms.js.map +1 -1
- package/build/list-item/edit.js +3 -2
- package/build/list-item/edit.js.map +1 -1
- package/build/list-item/edit.native.js +3 -2
- package/build/list-item/edit.native.js.map +1 -1
- package/build/list-item/hooks/use-merge.js +19 -22
- package/build/list-item/hooks/use-merge.js.map +1 -1
- package/build/list-item/hooks/use-outdent-list-item.js +19 -3
- package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build/list-item/index.js +14 -1
- package/build/list-item/index.js.map +1 -1
- package/build/list-item/utils.js +14 -1
- package/build/list-item/utils.js.map +1 -1
- package/build/navigation/edit/index.js +35 -22
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/inner-blocks.js +3 -5
- package/build/navigation/edit/inner-blocks.js.map +1 -1
- package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js +25 -8
- package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
- package/build/navigation/edit/use-create-navigation-menu.js +1 -1
- package/build/navigation/edit/use-create-navigation-menu.js.map +1 -1
- package/build/navigation/index.js +4 -1
- package/build/navigation/index.js.map +1 -1
- package/build/navigation-link/edit.js +1 -1
- package/build/navigation-link/edit.js.map +1 -1
- package/build/page-list/index.js +1 -5
- package/build/page-list/index.js.map +1 -1
- package/build/paragraph/edit.js +3 -11
- package/build/paragraph/edit.js.map +1 -1
- package/build/pattern/edit.js +11 -4
- package/build/pattern/edit.js.map +1 -1
- package/build/post-comments-form/form.js +1 -2
- package/build/post-comments-form/form.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +2 -2
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/inspector-controls/taxonomy-controls.js +79 -104
- package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build/search/edit.js +2 -1
- package/build/search/edit.js.map +1 -1
- package/build/site-logo/edit.js +6 -9
- package/build/site-logo/edit.js.map +1 -1
- package/build/table/state.js +1 -1
- package/build/table/state.js.map +1 -1
- package/build/table-of-contents/edit.js +1 -4
- package/build/table-of-contents/edit.js.map +1 -1
- package/build/tag-cloud/edit.js +1 -1
- package/build/tag-cloud/edit.js.map +1 -1
- package/build/tag-cloud/index.js +8 -0
- package/build/tag-cloud/index.js.map +1 -1
- package/build-module/archives/edit.js +1 -0
- package/build-module/archives/edit.js.map +1 -1
- package/build-module/comment-template/edit.js +38 -30
- package/build-module/comment-template/edit.js.map +1 -1
- package/build-module/comments/edit/placeholder.js +1 -3
- package/build-module/comments/edit/placeholder.js.map +1 -1
- package/build-module/comments/index.js +5 -1
- package/build-module/comments/index.js.map +1 -1
- package/build-module/comments-title/edit.js +18 -2
- package/build-module/comments-title/edit.js.map +1 -1
- package/build-module/cover/edit/index.js +2 -2
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/edit/use-cover-is-dark.js +7 -7
- package/build-module/cover/edit/use-cover-is-dark.js.map +1 -1
- package/build-module/embed/variations.js +1 -1
- package/build-module/embed/variations.js.map +1 -1
- package/build-module/gallery/transforms.js +4 -4
- package/build-module/gallery/transforms.js.map +1 -1
- package/build-module/gallery/v1/edit.js +2 -2
- package/build-module/gallery/v1/edit.js.map +1 -1
- package/build-module/image/image.js +35 -11
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/transforms.js +1 -6
- package/build-module/image/transforms.js.map +1 -1
- package/build-module/list/transforms.js +9 -1
- package/build-module/list/transforms.js.map +1 -1
- package/build-module/list-item/edit.js +3 -2
- package/build-module/list-item/edit.js.map +1 -1
- package/build-module/list-item/edit.native.js +3 -2
- package/build-module/list-item/edit.native.js.map +1 -1
- package/build-module/list-item/hooks/use-merge.js +19 -21
- package/build-module/list-item/hooks/use-merge.js.map +1 -1
- package/build-module/list-item/hooks/use-outdent-list-item.js +19 -3
- package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build-module/list-item/index.js +14 -1
- package/build-module/list-item/index.js.map +1 -1
- package/build-module/list-item/utils.js +14 -1
- package/build-module/list-item/utils.js.map +1 -1
- package/build-module/navigation/edit/index.js +35 -22
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/inner-blocks.js +3 -5
- package/build-module/navigation/edit/inner-blocks.js.map +1 -1
- package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js +25 -8
- package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
- package/build-module/navigation/edit/use-create-navigation-menu.js +1 -1
- package/build-module/navigation/edit/use-create-navigation-menu.js.map +1 -1
- package/build-module/navigation/index.js +4 -1
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation-link/edit.js +1 -1
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/page-list/index.js +1 -5
- package/build-module/page-list/index.js.map +1 -1
- package/build-module/paragraph/edit.js +3 -10
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/pattern/edit.js +10 -3
- package/build-module/pattern/edit.js.map +1 -1
- package/build-module/post-comments-form/form.js +2 -3
- package/build-module/post-comments-form/form.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +4 -4
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js +81 -102
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build-module/search/edit.js +3 -2
- package/build-module/search/edit.js.map +1 -1
- package/build-module/site-logo/edit.js +6 -9
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/table/state.js +2 -2
- package/build-module/table/state.js.map +1 -1
- package/build-module/table-of-contents/edit.js +1 -3
- package/build-module/table-of-contents/edit.js.map +1 -1
- package/build-module/tag-cloud/edit.js +1 -1
- package/build-module/tag-cloud/edit.js.map +1 -1
- package/build-module/tag-cloud/index.js +8 -0
- package/build-module/tag-cloud/index.js.map +1 -1
- package/build-style/archives/style-rtl.css +4 -0
- package/build-style/archives/style.css +4 -0
- package/build-style/comments/editor-rtl.css +1 -0
- package/build-style/comments/editor.css +1 -0
- package/build-style/comments/style-rtl.css +1 -0
- package/build-style/comments/style.css +1 -0
- package/build-style/cover/editor-rtl.css +4 -0
- package/build-style/cover/editor.css +4 -0
- package/build-style/editor-rtl.css +9 -17
- package/build-style/editor.css +9 -17
- package/build-style/group/editor-rtl.css +1 -0
- package/build-style/group/editor.css +1 -0
- package/build-style/image/editor-rtl.css +1 -1
- package/build-style/image/editor.css +1 -1
- package/build-style/navigation/editor-rtl.css +1 -0
- package/build-style/navigation/editor.css +1 -0
- package/build-style/paragraph/editor-rtl.css +0 -16
- package/build-style/paragraph/editor.css +0 -16
- package/build-style/site-logo/editor-rtl.css +1 -0
- package/build-style/site-logo/editor.css +1 -0
- package/build-style/style-rtl.css +8 -0
- package/build-style/style.css +8 -0
- package/build-style/tag-cloud/style-rtl.css +3 -0
- package/build-style/tag-cloud/style.css +3 -0
- package/package.json +28 -28
- package/src/archives/edit.js +1 -0
- package/src/archives/style.scss +5 -0
- package/src/avatar/index.php +1 -1
- package/src/code/test/__snapshots__/edit.native.js.snap +13 -0
- package/src/code/test/edit.native.js +46 -32
- package/src/comment-template/edit.js +47 -34
- package/src/comments/block.json +5 -1
- package/src/comments/edit/placeholder.js +1 -7
- package/src/comments/style.scss +2 -0
- package/src/comments-title/edit.js +24 -1
- package/src/cover/edit/index.js +2 -7
- package/src/cover/edit/use-cover-is-dark.js +11 -11
- package/src/cover/editor.scss +7 -0
- package/src/embed/variations.js +1 -1
- package/src/gallery/transforms.js +8 -5
- package/src/gallery/v1/edit.js +2 -2
- package/src/group/editor.scss +1 -0
- package/src/image/editor.scss +4 -1
- package/src/image/image.js +59 -29
- package/src/image/transforms.js +1 -7
- package/src/list/test/edit.native.js +102 -3
- package/src/list/transforms.js +11 -0
- package/src/list-item/block.json +14 -1
- package/src/list-item/edit.js +2 -1
- package/src/list-item/edit.native.js +2 -1
- package/src/list-item/hooks/use-merge.js +4 -23
- package/src/list-item/hooks/use-outdent-list-item.js +6 -2
- package/src/navigation/block.json +4 -1
- package/src/navigation/edit/index.js +49 -23
- package/src/navigation/edit/inner-blocks.js +2 -5
- package/src/navigation/edit/use-convert-classic-menu-to-block-menu.js +32 -5
- package/src/navigation/edit/use-create-navigation-menu.js +2 -5
- package/src/navigation/editor.scss +1 -0
- package/src/navigation/index.php +103 -6
- package/src/navigation-link/edit.js +1 -1
- package/src/navigation-link/index.php +8 -1
- package/src/navigation-submenu/index.php +8 -1
- package/src/page-list/block.json +1 -5
- package/src/page-list/index.php +8 -6
- package/src/paragraph/edit.js +1 -14
- package/src/paragraph/editor.scss +0 -20
- package/src/pattern/edit.js +10 -3
- package/src/post-comments-form/form.js +2 -3
- package/src/query/edit/inspector-controls/index.js +4 -3
- package/src/query/edit/inspector-controls/taxonomy-controls.js +82 -87
- package/src/rss/index.php +3 -3
- package/src/search/edit.js +6 -1
- package/src/search/index.php +21 -13
- package/src/site-logo/edit.js +10 -8
- package/src/site-logo/editor.scss +1 -0
- package/src/table/state.js +2 -2
- package/src/table-of-contents/edit.js +1 -3
- package/src/tag-cloud/block.json +8 -0
- package/src/tag-cloud/edit.js +1 -1
- package/src/tag-cloud/style.scss +3 -0
- package/src/template-part/index.php +4 -0
- package/build/paragraph/drop-zone.js +0 -99
- package/build/paragraph/drop-zone.js.map +0 -1
- package/build-module/paragraph/drop-zone.js +0 -88
- package/build-module/paragraph/drop-zone.js.map +0 -1
- package/src/paragraph/drop-zone.js +0 -105
package/src/search/index.php
CHANGED
|
@@ -367,12 +367,12 @@ function styles_for_block_core_search( $attributes ) {
|
|
|
367
367
|
// Add color styles.
|
|
368
368
|
$has_text_color = ! empty( $attributes['style']['color']['text'] );
|
|
369
369
|
if ( $has_text_color ) {
|
|
370
|
-
$button_styles[] = sprintf( 'color: %s;',
|
|
370
|
+
$button_styles[] = sprintf( 'color: %s;', $attributes['style']['color']['text'] );
|
|
371
371
|
}
|
|
372
372
|
|
|
373
373
|
$has_background_color = ! empty( $attributes['style']['color']['background'] );
|
|
374
374
|
if ( $has_background_color ) {
|
|
375
|
-
$button_styles[] = sprintf( 'background-color: %s;',
|
|
375
|
+
$button_styles[] = sprintf( 'background-color: %s;', $attributes['style']['color']['background'] );
|
|
376
376
|
}
|
|
377
377
|
|
|
378
378
|
$has_custom_gradient = ! empty( $attributes['style']['color']['gradient'] );
|
|
@@ -381,7 +381,7 @@ function styles_for_block_core_search( $attributes ) {
|
|
|
381
381
|
}
|
|
382
382
|
|
|
383
383
|
// Get typography styles to be shared across inner elements.
|
|
384
|
-
$typography_styles = get_typography_styles_for_block_core_search( $attributes );
|
|
384
|
+
$typography_styles = esc_attr( get_typography_styles_for_block_core_search( $attributes ) );
|
|
385
385
|
if ( ! empty( $typography_styles ) ) {
|
|
386
386
|
$label_styles [] = $typography_styles;
|
|
387
387
|
$button_styles[] = $typography_styles;
|
|
@@ -399,9 +399,9 @@ function styles_for_block_core_search( $attributes ) {
|
|
|
399
399
|
}
|
|
400
400
|
|
|
401
401
|
return array(
|
|
402
|
-
'input' => ! empty( $input_styles ) ? sprintf( ' style="%s"', safecss_filter_attr( implode( ' ', $input_styles ) ) ) : '',
|
|
403
|
-
'button' => ! empty( $button_styles ) ? sprintf( ' style="%s"', safecss_filter_attr( implode( ' ', $button_styles ) ) ) : '',
|
|
404
|
-
'wrapper' => ! empty( $wrapper_styles ) ? sprintf( ' style="%s"', safecss_filter_attr( implode( ' ', $wrapper_styles ) ) ) : '',
|
|
402
|
+
'input' => ! empty( $input_styles ) ? sprintf( ' style="%s"', esc_attr( safecss_filter_attr( implode( ' ', $input_styles ) ) ) ) : '',
|
|
403
|
+
'button' => ! empty( $button_styles ) ? sprintf( ' style="%s"', esc_attr( safecss_filter_attr( implode( ' ', $button_styles ) ) ) ) : '',
|
|
404
|
+
'wrapper' => ! empty( $wrapper_styles ) ? sprintf( ' style="%s"', esc_attr( safecss_filter_attr( implode( ' ', $wrapper_styles ) ) ) ) : '',
|
|
405
405
|
'label' => ! empty( $label_styles ) ? sprintf( ' style="%s"', esc_attr( safecss_filter_attr( implode( ' ', $label_styles ) ) ) ) : '',
|
|
406
406
|
);
|
|
407
407
|
}
|
|
@@ -442,31 +442,39 @@ function get_typography_styles_for_block_core_search( $attributes ) {
|
|
|
442
442
|
|
|
443
443
|
// Add typography styles.
|
|
444
444
|
if ( ! empty( $attributes['style']['typography']['fontSize'] ) ) {
|
|
445
|
-
$typography_styles[] = sprintf(
|
|
445
|
+
$typography_styles[] = sprintf(
|
|
446
|
+
'font-size: %s;',
|
|
447
|
+
wp_get_typography_font_size_value(
|
|
448
|
+
array(
|
|
449
|
+
'size' => $attributes['style']['typography']['fontSize'],
|
|
450
|
+
)
|
|
451
|
+
)
|
|
452
|
+
);
|
|
453
|
+
|
|
446
454
|
}
|
|
447
455
|
|
|
448
456
|
if ( ! empty( $attributes['style']['typography']['fontFamily'] ) ) {
|
|
449
|
-
$typography_styles[] = sprintf( 'font-family: %s;',
|
|
457
|
+
$typography_styles[] = sprintf( 'font-family: %s;', $attributes['style']['typography']['fontFamily'] );
|
|
450
458
|
}
|
|
451
459
|
|
|
452
460
|
if ( ! empty( $attributes['style']['typography']['letterSpacing'] ) ) {
|
|
453
|
-
$typography_styles[] = sprintf( 'letter-spacing: %s;',
|
|
461
|
+
$typography_styles[] = sprintf( 'letter-spacing: %s;', $attributes['style']['typography']['letterSpacing'] );
|
|
454
462
|
}
|
|
455
463
|
|
|
456
464
|
if ( ! empty( $attributes['style']['typography']['fontWeight'] ) ) {
|
|
457
|
-
$typography_styles[] = sprintf( 'font-weight: %s;',
|
|
465
|
+
$typography_styles[] = sprintf( 'font-weight: %s;', $attributes['style']['typography']['fontWeight'] );
|
|
458
466
|
}
|
|
459
467
|
|
|
460
468
|
if ( ! empty( $attributes['style']['typography']['fontStyle'] ) ) {
|
|
461
|
-
$typography_styles[] = sprintf( 'font-style: %s;',
|
|
469
|
+
$typography_styles[] = sprintf( 'font-style: %s;', $attributes['style']['typography']['fontStyle'] );
|
|
462
470
|
}
|
|
463
471
|
|
|
464
472
|
if ( ! empty( $attributes['style']['typography']['lineHeight'] ) ) {
|
|
465
|
-
$typography_styles[] = sprintf( 'line-height: %s;',
|
|
473
|
+
$typography_styles[] = sprintf( 'line-height: %s;', $attributes['style']['typography']['lineHeight'] );
|
|
466
474
|
}
|
|
467
475
|
|
|
468
476
|
if ( ! empty( $attributes['style']['typography']['textTransform'] ) ) {
|
|
469
|
-
$typography_styles[] = sprintf( 'text-transform: %s;',
|
|
477
|
+
$typography_styles[] = sprintf( 'text-transform: %s;', $attributes['style']['typography']['textTransform'] );
|
|
470
478
|
}
|
|
471
479
|
|
|
472
480
|
return implode( '', $typography_styles );
|
package/src/site-logo/edit.js
CHANGED
|
@@ -81,12 +81,12 @@ const SiteLogo = ( {
|
|
|
81
81
|
} );
|
|
82
82
|
const { imageEditing, maxWidth, title } = useSelect( ( select ) => {
|
|
83
83
|
const { getSettings } = select( blockEditorStore );
|
|
84
|
-
const siteEntities = select( coreStore ).
|
|
84
|
+
const siteEntities = select( coreStore ).getEntityRecord(
|
|
85
85
|
'root',
|
|
86
|
-
'
|
|
86
|
+
'__unstableBase'
|
|
87
87
|
);
|
|
88
88
|
return {
|
|
89
|
-
title: siteEntities
|
|
89
|
+
title: siteEntities?.name,
|
|
90
90
|
...pick( getSettings(), [ 'imageEditing', 'maxWidth' ] ),
|
|
91
91
|
};
|
|
92
92
|
}, [] );
|
|
@@ -370,12 +370,14 @@ export default function LogoEdit( {
|
|
|
370
370
|
} = useSelect( ( select ) => {
|
|
371
371
|
const { canUser, getEntityRecord, getEditedEntityRecord } =
|
|
372
372
|
select( coreStore );
|
|
373
|
-
const siteSettings = getEditedEntityRecord( 'root', 'site' );
|
|
374
|
-
const siteData = getEntityRecord( 'root', '__unstableBase' );
|
|
375
|
-
const _siteLogo = siteSettings?.site_logo;
|
|
376
|
-
const _readOnlyLogo = siteData?.site_logo;
|
|
377
373
|
const _canUserEdit = canUser( 'update', 'settings' );
|
|
378
|
-
const
|
|
374
|
+
const siteSettings = _canUserEdit
|
|
375
|
+
? getEditedEntityRecord( 'root', 'site' )
|
|
376
|
+
: undefined;
|
|
377
|
+
const siteData = getEntityRecord( 'root', '__unstableBase' );
|
|
378
|
+
const _siteLogoId = _canUserEdit
|
|
379
|
+
? siteSettings?.site_logo
|
|
380
|
+
: siteData?.site_logo;
|
|
379
381
|
const _siteIconId = siteSettings?.site_icon;
|
|
380
382
|
const mediaItem =
|
|
381
383
|
_siteLogoId &&
|
package/src/table/state.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { get, mapValues,
|
|
4
|
+
import { get, mapValues, pick } from 'lodash';
|
|
5
5
|
|
|
6
6
|
const INHERITED_COLUMN_ATTRIBUTES = [ 'align' ];
|
|
7
7
|
|
|
@@ -309,7 +309,7 @@ export function toggleSection( state, sectionName ) {
|
|
|
309
309
|
* @return {boolean} True if the table section is empty, false otherwise.
|
|
310
310
|
*/
|
|
311
311
|
export function isEmptyTableSection( section ) {
|
|
312
|
-
return ! section || ! section.length || every(
|
|
312
|
+
return ! section || ! section.length || section.every( isEmptyRow );
|
|
313
313
|
}
|
|
314
314
|
|
|
315
315
|
/**
|
|
@@ -21,7 +21,6 @@ import {
|
|
|
21
21
|
ToolbarButton,
|
|
22
22
|
ToolbarGroup,
|
|
23
23
|
} from '@wordpress/components';
|
|
24
|
-
import { useDisabled } from '@wordpress/compose';
|
|
25
24
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
26
25
|
import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
|
|
27
26
|
import { renderToString, useEffect } from '@wordpress/element';
|
|
@@ -55,7 +54,6 @@ export default function TableOfContentsEdit( {
|
|
|
55
54
|
setAttributes,
|
|
56
55
|
} ) {
|
|
57
56
|
const blockProps = useBlockProps();
|
|
58
|
-
const disabledRef = useDisabled();
|
|
59
57
|
|
|
60
58
|
const canInsertList = useSelect(
|
|
61
59
|
( select ) => {
|
|
@@ -295,7 +293,7 @@ export default function TableOfContentsEdit( {
|
|
|
295
293
|
return (
|
|
296
294
|
<>
|
|
297
295
|
<nav { ...blockProps }>
|
|
298
|
-
<ol
|
|
296
|
+
<ol inert="true">
|
|
299
297
|
<TableOfContentsList nestedHeadingList={ headingTree } />
|
|
300
298
|
</ol>
|
|
301
299
|
</nav>
|
package/src/tag-cloud/block.json
CHANGED
|
@@ -40,6 +40,14 @@
|
|
|
40
40
|
"spacing": {
|
|
41
41
|
"margin": true,
|
|
42
42
|
"padding": true
|
|
43
|
+
},
|
|
44
|
+
"typography": {
|
|
45
|
+
"lineHeight": true,
|
|
46
|
+
"__experimentalFontFamily": true,
|
|
47
|
+
"__experimentalFontWeight": true,
|
|
48
|
+
"__experimentalFontStyle": true,
|
|
49
|
+
"__experimentalTextTransform": true,
|
|
50
|
+
"__experimentalLetterSpacing": true
|
|
43
51
|
}
|
|
44
52
|
},
|
|
45
53
|
"editorStyle": "wp-block-tag-cloud-editor"
|
package/src/tag-cloud/edit.js
CHANGED
|
@@ -168,7 +168,7 @@ function TagCloudEdit( { attributes, setAttributes, taxonomies } ) {
|
|
|
168
168
|
{ inspectorControls }
|
|
169
169
|
<div { ...useBlockProps() }>
|
|
170
170
|
<ServerSideRender
|
|
171
|
-
|
|
171
|
+
skipBlockSupportAttributes
|
|
172
172
|
block="core/tag-cloud"
|
|
173
173
|
attributes={ attributes }
|
|
174
174
|
/>
|
package/src/tag-cloud/style.scss
CHANGED
|
@@ -189,6 +189,10 @@ function build_template_part_block_area_variations() {
|
|
|
189
189
|
* @return array Array containing the block variation objects.
|
|
190
190
|
*/
|
|
191
191
|
function build_template_part_block_instance_variations() {
|
|
192
|
+
// Block themes are unavailable during installation.
|
|
193
|
+
if ( wp_installing() ) {
|
|
194
|
+
return array();
|
|
195
|
+
}
|
|
192
196
|
$variations = array();
|
|
193
197
|
$template_parts = get_block_templates(
|
|
194
198
|
array(
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = DropZone;
|
|
7
|
-
|
|
8
|
-
var _element = require("@wordpress/element");
|
|
9
|
-
|
|
10
|
-
var _data = require("@wordpress/data");
|
|
11
|
-
|
|
12
|
-
var _blockEditor = require("@wordpress/block-editor");
|
|
13
|
-
|
|
14
|
-
var _compose = require("@wordpress/compose");
|
|
15
|
-
|
|
16
|
-
var _components = require("@wordpress/components");
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* WordPress dependencies
|
|
20
|
-
*/
|
|
21
|
-
const animateVariants = {
|
|
22
|
-
hide: {
|
|
23
|
-
opacity: 0,
|
|
24
|
-
scaleY: 0.75
|
|
25
|
-
},
|
|
26
|
-
show: {
|
|
27
|
-
opacity: 1,
|
|
28
|
-
scaleY: 1
|
|
29
|
-
},
|
|
30
|
-
exit: {
|
|
31
|
-
opacity: 0,
|
|
32
|
-
scaleY: 0.9
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
function DropZone(_ref) {
|
|
37
|
-
let {
|
|
38
|
-
paragraphElement,
|
|
39
|
-
clientId
|
|
40
|
-
} = _ref;
|
|
41
|
-
const {
|
|
42
|
-
rootClientId,
|
|
43
|
-
blockIndex
|
|
44
|
-
} = (0, _data.useSelect)(select => {
|
|
45
|
-
const selectors = select(_blockEditor.store);
|
|
46
|
-
return {
|
|
47
|
-
rootClientId: selectors.getBlockRootClientId(clientId),
|
|
48
|
-
blockIndex: selectors.getBlockIndex(clientId)
|
|
49
|
-
};
|
|
50
|
-
}, [clientId]);
|
|
51
|
-
const onBlockDrop = (0, _blockEditor.__experimentalUseOnBlockDrop)(rootClientId, blockIndex, {
|
|
52
|
-
action: 'replace'
|
|
53
|
-
});
|
|
54
|
-
const [isDragging, setIsDragging] = (0, _element.useState)(false);
|
|
55
|
-
const [isVisible, setIsVisible] = (0, _element.useState)(false);
|
|
56
|
-
const popoverRef = (0, _compose.__experimentalUseDropZone)({
|
|
57
|
-
onDragStart: () => {
|
|
58
|
-
setIsDragging(true);
|
|
59
|
-
},
|
|
60
|
-
onDragEnd: () => {
|
|
61
|
-
setIsDragging(false);
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
const dropZoneRef = (0, _compose.__experimentalUseDropZone)({
|
|
65
|
-
onDrop: onBlockDrop,
|
|
66
|
-
onDragEnter: () => {
|
|
67
|
-
setIsVisible(true);
|
|
68
|
-
},
|
|
69
|
-
onDragLeave: () => {
|
|
70
|
-
setIsVisible(false);
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
const reducedMotion = (0, _compose.useReducedMotion)();
|
|
74
|
-
return (0, _element.createElement)(_components.Popover, {
|
|
75
|
-
anchor: paragraphElement,
|
|
76
|
-
animate: false,
|
|
77
|
-
placement: "top-start",
|
|
78
|
-
focusOnMount: false,
|
|
79
|
-
flip: false,
|
|
80
|
-
resize: false,
|
|
81
|
-
className: "wp-block-paragraph__drop-zone",
|
|
82
|
-
ref: popoverRef
|
|
83
|
-
}, isDragging ? (0, _element.createElement)("div", {
|
|
84
|
-
className: "wp-block-paragraph__drop-zone-backdrop",
|
|
85
|
-
ref: dropZoneRef,
|
|
86
|
-
style: {
|
|
87
|
-
width: paragraphElement === null || paragraphElement === void 0 ? void 0 : paragraphElement.offsetWidth,
|
|
88
|
-
height: paragraphElement === null || paragraphElement === void 0 ? void 0 : paragraphElement.offsetHeight
|
|
89
|
-
}
|
|
90
|
-
}, (0, _element.createElement)(_components.__unstableAnimatePresence, null, isVisible ? (0, _element.createElement)(_components.__unstableMotion.div, {
|
|
91
|
-
key: "drop-zone-foreground",
|
|
92
|
-
"data-testid": "empty-paragraph-drop-zone",
|
|
93
|
-
initial: reducedMotion ? animateVariants.show : animateVariants.hide,
|
|
94
|
-
animate: animateVariants.show,
|
|
95
|
-
exit: reducedMotion ? animateVariants.show : animateVariants.exit,
|
|
96
|
-
className: "wp-block-paragraph__drop-zone-foreground"
|
|
97
|
-
}) : null)) : null);
|
|
98
|
-
}
|
|
99
|
-
//# sourceMappingURL=drop-zone.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/paragraph/drop-zone.js"],"names":["animateVariants","hide","opacity","scaleY","show","exit","DropZone","paragraphElement","clientId","rootClientId","blockIndex","select","selectors","blockEditorStore","getBlockRootClientId","getBlockIndex","onBlockDrop","action","isDragging","setIsDragging","isVisible","setIsVisible","popoverRef","onDragStart","onDragEnd","dropZoneRef","onDrop","onDragEnter","onDragLeave","reducedMotion","width","offsetWidth","height","offsetHeight"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AAIA;;AAIA;;AAbA;AACA;AACA;AAiBA,MAAMA,eAAe,GAAG;AACvBC,EAA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useSelect } from '@wordpress/data';\nimport {\n\t__experimentalUseOnBlockDrop as useOnBlockDrop,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\t__experimentalUseDropZone as useDropZone,\n\tuseReducedMotion,\n} from '@wordpress/compose';\nimport {\n\tPopover,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\n\nconst animateVariants = {\n\thide: { opacity: 0, scaleY: 0.75 },\n\tshow: { opacity: 1, scaleY: 1 },\n\texit: { opacity: 0, scaleY: 0.9 },\n};\n\nexport default function DropZone( { paragraphElement, clientId } ) {\n\tconst { rootClientId, blockIndex } = useSelect(\n\t\t( select ) => {\n\t\t\tconst selectors = select( blockEditorStore );\n\t\t\treturn {\n\t\t\t\trootClientId: selectors.getBlockRootClientId( clientId ),\n\t\t\t\tblockIndex: selectors.getBlockIndex( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst onBlockDrop = useOnBlockDrop( rootClientId, blockIndex, {\n\t\taction: 'replace',\n\t} );\n\tconst [ isDragging, setIsDragging ] = useState( false );\n\tconst [ isVisible, setIsVisible ] = useState( false );\n\tconst popoverRef = useDropZone( {\n\t\tonDragStart: () => {\n\t\t\tsetIsDragging( true );\n\t\t},\n\t\tonDragEnd: () => {\n\t\t\tsetIsDragging( false );\n\t\t},\n\t} );\n\tconst dropZoneRef = useDropZone( {\n\t\tonDrop: onBlockDrop,\n\t\tonDragEnter: () => {\n\t\t\tsetIsVisible( true );\n\t\t},\n\t\tonDragLeave: () => {\n\t\t\tsetIsVisible( false );\n\t\t},\n\t} );\n\tconst reducedMotion = useReducedMotion();\n\n\treturn (\n\t\t<Popover\n\t\t\tanchor={ paragraphElement }\n\t\t\tanimate={ false }\n\t\t\tplacement=\"top-start\"\n\t\t\tfocusOnMount={ false }\n\t\t\tflip={ false }\n\t\t\tresize={ false }\n\t\t\tclassName=\"wp-block-paragraph__drop-zone\"\n\t\t\tref={ popoverRef }\n\t\t>\n\t\t\t{ isDragging ? (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"wp-block-paragraph__drop-zone-backdrop\"\n\t\t\t\t\tref={ dropZoneRef }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\twidth: paragraphElement?.offsetWidth,\n\t\t\t\t\t\theight: paragraphElement?.offsetHeight,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<AnimatePresence>\n\t\t\t\t\t\t{ isVisible ? (\n\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\tkey=\"drop-zone-foreground\"\n\t\t\t\t\t\t\t\tdata-testid=\"empty-paragraph-drop-zone\"\n\t\t\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\t\t\treducedMotion\n\t\t\t\t\t\t\t\t\t\t? animateVariants.show\n\t\t\t\t\t\t\t\t\t\t: animateVariants.hide\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tanimate={ animateVariants.show }\n\t\t\t\t\t\t\t\texit={\n\t\t\t\t\t\t\t\t\treducedMotion\n\t\t\t\t\t\t\t\t\t\t? animateVariants.show\n\t\t\t\t\t\t\t\t\t\t: animateVariants.exit\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tclassName=\"wp-block-paragraph__drop-zone-foreground\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : null }\n\t\t\t\t\t</AnimatePresence>\n\t\t\t\t</div>\n\t\t\t) : null }\n\t\t</Popover>\n\t);\n}\n"]}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* WordPress dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { useState } from '@wordpress/element';
|
|
7
|
-
import { useSelect } from '@wordpress/data';
|
|
8
|
-
import { __experimentalUseOnBlockDrop as useOnBlockDrop, store as blockEditorStore } from '@wordpress/block-editor';
|
|
9
|
-
import { __experimentalUseDropZone as useDropZone, useReducedMotion } from '@wordpress/compose';
|
|
10
|
-
import { Popover, __unstableMotion as motion, __unstableAnimatePresence as AnimatePresence } from '@wordpress/components';
|
|
11
|
-
const animateVariants = {
|
|
12
|
-
hide: {
|
|
13
|
-
opacity: 0,
|
|
14
|
-
scaleY: 0.75
|
|
15
|
-
},
|
|
16
|
-
show: {
|
|
17
|
-
opacity: 1,
|
|
18
|
-
scaleY: 1
|
|
19
|
-
},
|
|
20
|
-
exit: {
|
|
21
|
-
opacity: 0,
|
|
22
|
-
scaleY: 0.9
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
export default function DropZone(_ref) {
|
|
26
|
-
let {
|
|
27
|
-
paragraphElement,
|
|
28
|
-
clientId
|
|
29
|
-
} = _ref;
|
|
30
|
-
const {
|
|
31
|
-
rootClientId,
|
|
32
|
-
blockIndex
|
|
33
|
-
} = useSelect(select => {
|
|
34
|
-
const selectors = select(blockEditorStore);
|
|
35
|
-
return {
|
|
36
|
-
rootClientId: selectors.getBlockRootClientId(clientId),
|
|
37
|
-
blockIndex: selectors.getBlockIndex(clientId)
|
|
38
|
-
};
|
|
39
|
-
}, [clientId]);
|
|
40
|
-
const onBlockDrop = useOnBlockDrop(rootClientId, blockIndex, {
|
|
41
|
-
action: 'replace'
|
|
42
|
-
});
|
|
43
|
-
const [isDragging, setIsDragging] = useState(false);
|
|
44
|
-
const [isVisible, setIsVisible] = useState(false);
|
|
45
|
-
const popoverRef = useDropZone({
|
|
46
|
-
onDragStart: () => {
|
|
47
|
-
setIsDragging(true);
|
|
48
|
-
},
|
|
49
|
-
onDragEnd: () => {
|
|
50
|
-
setIsDragging(false);
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
const dropZoneRef = useDropZone({
|
|
54
|
-
onDrop: onBlockDrop,
|
|
55
|
-
onDragEnter: () => {
|
|
56
|
-
setIsVisible(true);
|
|
57
|
-
},
|
|
58
|
-
onDragLeave: () => {
|
|
59
|
-
setIsVisible(false);
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
const reducedMotion = useReducedMotion();
|
|
63
|
-
return createElement(Popover, {
|
|
64
|
-
anchor: paragraphElement,
|
|
65
|
-
animate: false,
|
|
66
|
-
placement: "top-start",
|
|
67
|
-
focusOnMount: false,
|
|
68
|
-
flip: false,
|
|
69
|
-
resize: false,
|
|
70
|
-
className: "wp-block-paragraph__drop-zone",
|
|
71
|
-
ref: popoverRef
|
|
72
|
-
}, isDragging ? createElement("div", {
|
|
73
|
-
className: "wp-block-paragraph__drop-zone-backdrop",
|
|
74
|
-
ref: dropZoneRef,
|
|
75
|
-
style: {
|
|
76
|
-
width: paragraphElement === null || paragraphElement === void 0 ? void 0 : paragraphElement.offsetWidth,
|
|
77
|
-
height: paragraphElement === null || paragraphElement === void 0 ? void 0 : paragraphElement.offsetHeight
|
|
78
|
-
}
|
|
79
|
-
}, createElement(AnimatePresence, null, isVisible ? createElement(motion.div, {
|
|
80
|
-
key: "drop-zone-foreground",
|
|
81
|
-
"data-testid": "empty-paragraph-drop-zone",
|
|
82
|
-
initial: reducedMotion ? animateVariants.show : animateVariants.hide,
|
|
83
|
-
animate: animateVariants.show,
|
|
84
|
-
exit: reducedMotion ? animateVariants.show : animateVariants.exit,
|
|
85
|
-
className: "wp-block-paragraph__drop-zone-foreground"
|
|
86
|
-
}) : null)) : null);
|
|
87
|
-
}
|
|
88
|
-
//# sourceMappingURL=drop-zone.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/paragraph/drop-zone.js"],"names":["useState","useSelect","__experimentalUseOnBlockDrop","useOnBlockDrop","store","blockEditorStore","__experimentalUseDropZone","useDropZone","useReducedMotion","Popover","__unstableMotion","motion","__unstableAnimatePresence","AnimatePresence","animateVariants","hide","opacity","scaleY","show","exit","DropZone","paragraphElement","clientId","rootClientId","blockIndex","select","selectors","getBlockRootClientId","getBlockIndex","onBlockDrop","action","isDragging","setIsDragging","isVisible","setIsVisible","popoverRef","onDragStart","onDragEnd","dropZoneRef","onDrop","onDragEnter","onDragLeave","reducedMotion","width","offsetWidth","height","offsetHeight"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,oBAAzB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SACCC,4BAA4B,IAAIC,cADjC,EAECC,KAAK,IAAIC,gBAFV,QAGO,yBAHP;AAIA,SACCC,yBAAyB,IAAIC,WAD9B,EAECC,gBAFD,QAGO,oBAHP;AAIA,SACCC,OADD,EAECC,gBAAgB,IAAIC,MAFrB,EAGCC,yBAAyB,IAAIC,eAH9B,QAIO,uBAJP;AAMA,MAAMC,eAAe,GAAG;AACvBC,EAAAA,IAAI,EAAE;AAAEC,IAAAA,OAAO,EAAE,CAAX;AAAcC,IAAAA,MAAM,EAAE;AAAtB,GADiB;AAEvBC,EAAAA,IAAI,EAAE;AAAEF,IAAAA,OAAO,EAAE,CAAX;AAAcC,IAAAA,MAAM,EAAE;AAAtB,GAFiB;AAGvBE,EAAAA,IAAI,EAAE;AAAEH,IAAAA,OAAO,EAAE,CAAX;AAAcC,IAAAA,MAAM,EAAE;AAAtB;AAHiB,CAAxB;AAMA,eAAe,SAASG,QAAT,OAAoD;AAAA,MAAjC;AAAEC,IAAAA,gBAAF;AAAoBC,IAAAA;AAApB,GAAiC;AAClE,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,MAA+BvB,SAAS,CAC3CwB,MAAF,IAAc;AACb,UAAMC,SAAS,GAAGD,MAAM,CAAEpB,gBAAF,CAAxB;AACA,WAAO;AACNkB,MAAAA,YAAY,EAAEG,SAAS,CAACC,oBAAV,CAAgCL,QAAhC,CADR;AAENE,MAAAA,UAAU,EAAEE,SAAS,CAACE,aAAV,CAAyBN,QAAzB;AAFN,KAAP;AAIA,GAP4C,EAQ7C,CAAEA,QAAF,CAR6C,CAA9C;AAUA,QAAMO,WAAW,GAAG1B,cAAc,CAAEoB,YAAF,EAAgBC,UAAh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AAEA,gBAAgB,CAAEyB;AAFnB;AAHT,KAQC,cAAC,eAAD,QACGb,SAAS,GACV,cAAC,MAAD,CAAQ,GAAR;AACC,IAAA,GAAG,EAAC,sBADL;AAEC,mBAAY,2BAFb;AAGC,IAAA,OAAO,EACNS,aAAa,GACV5B,eAAe,CAACI,IADN,GAEVJ,eAAe,CAACC,IANrB;AAQC,IAAA,OAAO,EAAGD,eAAe,CAACI,IAR3B;AASC,IAAA,IAAI,EACHwB,aAAa,GACV5B,eAAe,CAACI,IADN,GAEVJ,eAAe,CAACK,IAZrB;AAcC,IAAA,SAAS,EAAC;AAdX,IADU,GAiBP,IAlBL,CARD,CADW,GA8BR,IAxCL,CADD;AA4CA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport {\n\t__experimentalUseOnBlockDrop as useOnBlockDrop,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\t__experimentalUseDropZone as useDropZone,\n\tuseReducedMotion,\n} from '@wordpress/compose';\nimport {\n\tPopover,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\n\nconst animateVariants = {\n\thide: { opacity: 0, scaleY: 0.75 },\n\tshow: { opacity: 1, scaleY: 1 },\n\texit: { opacity: 0, scaleY: 0.9 },\n};\n\nexport default function DropZone( { paragraphElement, clientId } ) {\n\tconst { rootClientId, blockIndex } = useSelect(\n\t\t( select ) => {\n\t\t\tconst selectors = select( blockEditorStore );\n\t\t\treturn {\n\t\t\t\trootClientId: selectors.getBlockRootClientId( clientId ),\n\t\t\t\tblockIndex: selectors.getBlockIndex( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst onBlockDrop = useOnBlockDrop( rootClientId, blockIndex, {\n\t\taction: 'replace',\n\t} );\n\tconst [ isDragging, setIsDragging ] = useState( false );\n\tconst [ isVisible, setIsVisible ] = useState( false );\n\tconst popoverRef = useDropZone( {\n\t\tonDragStart: () => {\n\t\t\tsetIsDragging( true );\n\t\t},\n\t\tonDragEnd: () => {\n\t\t\tsetIsDragging( false );\n\t\t},\n\t} );\n\tconst dropZoneRef = useDropZone( {\n\t\tonDrop: onBlockDrop,\n\t\tonDragEnter: () => {\n\t\t\tsetIsVisible( true );\n\t\t},\n\t\tonDragLeave: () => {\n\t\t\tsetIsVisible( false );\n\t\t},\n\t} );\n\tconst reducedMotion = useReducedMotion();\n\n\treturn (\n\t\t<Popover\n\t\t\tanchor={ paragraphElement }\n\t\t\tanimate={ false }\n\t\t\tplacement=\"top-start\"\n\t\t\tfocusOnMount={ false }\n\t\t\tflip={ false }\n\t\t\tresize={ false }\n\t\t\tclassName=\"wp-block-paragraph__drop-zone\"\n\t\t\tref={ popoverRef }\n\t\t>\n\t\t\t{ isDragging ? (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"wp-block-paragraph__drop-zone-backdrop\"\n\t\t\t\t\tref={ dropZoneRef }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\twidth: paragraphElement?.offsetWidth,\n\t\t\t\t\t\theight: paragraphElement?.offsetHeight,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<AnimatePresence>\n\t\t\t\t\t\t{ isVisible ? (\n\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\tkey=\"drop-zone-foreground\"\n\t\t\t\t\t\t\t\tdata-testid=\"empty-paragraph-drop-zone\"\n\t\t\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\t\t\treducedMotion\n\t\t\t\t\t\t\t\t\t\t? animateVariants.show\n\t\t\t\t\t\t\t\t\t\t: animateVariants.hide\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tanimate={ animateVariants.show }\n\t\t\t\t\t\t\t\texit={\n\t\t\t\t\t\t\t\t\treducedMotion\n\t\t\t\t\t\t\t\t\t\t? animateVariants.show\n\t\t\t\t\t\t\t\t\t\t: animateVariants.exit\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tclassName=\"wp-block-paragraph__drop-zone-foreground\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : null }\n\t\t\t\t\t</AnimatePresence>\n\t\t\t\t</div>\n\t\t\t) : null }\n\t\t</Popover>\n\t);\n}\n"]}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useState } from '@wordpress/element';
|
|
5
|
-
import { useSelect } from '@wordpress/data';
|
|
6
|
-
import {
|
|
7
|
-
__experimentalUseOnBlockDrop as useOnBlockDrop,
|
|
8
|
-
store as blockEditorStore,
|
|
9
|
-
} from '@wordpress/block-editor';
|
|
10
|
-
import {
|
|
11
|
-
__experimentalUseDropZone as useDropZone,
|
|
12
|
-
useReducedMotion,
|
|
13
|
-
} from '@wordpress/compose';
|
|
14
|
-
import {
|
|
15
|
-
Popover,
|
|
16
|
-
__unstableMotion as motion,
|
|
17
|
-
__unstableAnimatePresence as AnimatePresence,
|
|
18
|
-
} from '@wordpress/components';
|
|
19
|
-
|
|
20
|
-
const animateVariants = {
|
|
21
|
-
hide: { opacity: 0, scaleY: 0.75 },
|
|
22
|
-
show: { opacity: 1, scaleY: 1 },
|
|
23
|
-
exit: { opacity: 0, scaleY: 0.9 },
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export default function DropZone( { paragraphElement, clientId } ) {
|
|
27
|
-
const { rootClientId, blockIndex } = useSelect(
|
|
28
|
-
( select ) => {
|
|
29
|
-
const selectors = select( blockEditorStore );
|
|
30
|
-
return {
|
|
31
|
-
rootClientId: selectors.getBlockRootClientId( clientId ),
|
|
32
|
-
blockIndex: selectors.getBlockIndex( clientId ),
|
|
33
|
-
};
|
|
34
|
-
},
|
|
35
|
-
[ clientId ]
|
|
36
|
-
);
|
|
37
|
-
const onBlockDrop = useOnBlockDrop( rootClientId, blockIndex, {
|
|
38
|
-
action: 'replace',
|
|
39
|
-
} );
|
|
40
|
-
const [ isDragging, setIsDragging ] = useState( false );
|
|
41
|
-
const [ isVisible, setIsVisible ] = useState( false );
|
|
42
|
-
const popoverRef = useDropZone( {
|
|
43
|
-
onDragStart: () => {
|
|
44
|
-
setIsDragging( true );
|
|
45
|
-
},
|
|
46
|
-
onDragEnd: () => {
|
|
47
|
-
setIsDragging( false );
|
|
48
|
-
},
|
|
49
|
-
} );
|
|
50
|
-
const dropZoneRef = useDropZone( {
|
|
51
|
-
onDrop: onBlockDrop,
|
|
52
|
-
onDragEnter: () => {
|
|
53
|
-
setIsVisible( true );
|
|
54
|
-
},
|
|
55
|
-
onDragLeave: () => {
|
|
56
|
-
setIsVisible( false );
|
|
57
|
-
},
|
|
58
|
-
} );
|
|
59
|
-
const reducedMotion = useReducedMotion();
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<Popover
|
|
63
|
-
anchor={ paragraphElement }
|
|
64
|
-
animate={ false }
|
|
65
|
-
placement="top-start"
|
|
66
|
-
focusOnMount={ false }
|
|
67
|
-
flip={ false }
|
|
68
|
-
resize={ false }
|
|
69
|
-
className="wp-block-paragraph__drop-zone"
|
|
70
|
-
ref={ popoverRef }
|
|
71
|
-
>
|
|
72
|
-
{ isDragging ? (
|
|
73
|
-
<div
|
|
74
|
-
className="wp-block-paragraph__drop-zone-backdrop"
|
|
75
|
-
ref={ dropZoneRef }
|
|
76
|
-
style={ {
|
|
77
|
-
width: paragraphElement?.offsetWidth,
|
|
78
|
-
height: paragraphElement?.offsetHeight,
|
|
79
|
-
} }
|
|
80
|
-
>
|
|
81
|
-
<AnimatePresence>
|
|
82
|
-
{ isVisible ? (
|
|
83
|
-
<motion.div
|
|
84
|
-
key="drop-zone-foreground"
|
|
85
|
-
data-testid="empty-paragraph-drop-zone"
|
|
86
|
-
initial={
|
|
87
|
-
reducedMotion
|
|
88
|
-
? animateVariants.show
|
|
89
|
-
: animateVariants.hide
|
|
90
|
-
}
|
|
91
|
-
animate={ animateVariants.show }
|
|
92
|
-
exit={
|
|
93
|
-
reducedMotion
|
|
94
|
-
? animateVariants.show
|
|
95
|
-
: animateVariants.exit
|
|
96
|
-
}
|
|
97
|
-
className="wp-block-paragraph__drop-zone-foreground"
|
|
98
|
-
/>
|
|
99
|
-
) : null }
|
|
100
|
-
</AnimatePresence>
|
|
101
|
-
</div>
|
|
102
|
-
) : null }
|
|
103
|
-
</Popover>
|
|
104
|
-
);
|
|
105
|
-
}
|