@wordpress/block-library 7.16.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 +4 -1
- package/build/archives/edit.js +1 -0
- package/build/archives/edit.js.map +1 -1
- 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/edit.js +40 -32
- package/build/comment-template/edit.js.map +1 -1
- package/build/comment-template/index.js +6 -2
- package/build/comment-template/index.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/inspector-controls.js +3 -7
- package/build/cover/edit/inspector-controls.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/deprecated.js +43 -4
- package/build/embed/deprecated.js.map +1 -1
- package/build/embed/variations.js +1 -1
- package/build/embed/variations.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/transforms.js +3 -3
- package/build/gallery/transforms.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 +3 -2
- 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 +33 -12
- 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/latest-posts/edit.js +1 -1
- package/build/latest-posts/edit.js.map +1 -1
- package/build/list/transforms.js +9 -1
- package/build/list/transforms.js.map +1 -1
- package/build/list/utils.js +4 -8
- package/build/list/utils.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 +24 -10
- 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 +45 -31
- 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/unsaved-inner-blocks.js +3 -1
- package/build/navigation/edit/unsaved-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 +5 -3
- 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/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-count/index.js +4 -0
- package/build/post-comments-count/index.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/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/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 +3 -4
- package/build/search/edit.js.map +1 -1
- package/build/site-logo/edit.js +7 -10
- 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 +2 -2
- 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/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/archives/edit.js +1 -0
- package/build-module/archives/edit.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/edit.js +38 -30
- package/build-module/comment-template/edit.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/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/inspector-controls.js +4 -8
- package/build-module/cover/edit/inspector-controls.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/deprecated.js +44 -5
- package/build-module/embed/deprecated.js.map +1 -1
- package/build-module/embed/variations.js +1 -1
- package/build-module/embed/variations.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/transforms.js +4 -4
- package/build-module/gallery/transforms.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 +4 -3
- 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 +36 -15
- 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/latest-posts/edit.js +2 -2
- package/build-module/latest-posts/edit.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/utils.js +5 -9
- package/build-module/list/utils.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 +24 -9
- 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 +45 -31
- 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/unsaved-inner-blocks.js +3 -1
- package/build-module/navigation/edit/unsaved-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 +5 -4
- 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/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-count/index.js +4 -0
- package/build-module/post-comments-count/index.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/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/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 +4 -5
- package/build-module/search/edit.js.map +1 -1
- package/build-module/site-logo/edit.js +8 -11
- 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 +3 -3
- 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-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/archives/style-rtl.css +4 -0
- package/build-style/archives/style.css +4 -0
- 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/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 +13 -21
- package/build-style/editor.css +13 -21
- 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 +5 -4
- package/build-style/navigation/editor.css +5 -4
- package/build-style/navigation/style-rtl.css +3 -1
- package/build-style/navigation/style.css +3 -1
- package/build-style/paragraph/editor-rtl.css +0 -16
- package/build-style/paragraph/editor.css +0 -16
- package/build-style/post-comments-form/style-rtl.css +3 -0
- package/build-style/post-comments-form/style.css +3 -0
- 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 +16 -1
- package/build-style/style.css +16 -1
- package/build-style/tag-cloud/style-rtl.css +3 -0
- package/build-style/tag-cloud/style.css +3 -0
- package/package.json +29 -28
- package/src/archives/edit.js +1 -0
- package/src/archives/style.scss +5 -0
- package/src/audio/edit.js +79 -24
- package/src/avatar/index.php +1 -1
- package/src/button/edit.js +1 -1
- package/src/button/style.scss +2 -0
- package/src/buttons/edit.native.js +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/block.json +6 -2
- package/src/comment-template/edit.js +47 -34
- package/src/comment-template/style.scss +2 -0
- 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/inspector-controls.js +11 -13
- package/src/cover/edit/use-cover-is-dark.js +11 -11
- package/src/cover/editor.scss +7 -0
- package/src/embed/deprecated.js +53 -26
- package/src/embed/variations.js +1 -1
- 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/transforms.js +8 -5
- package/src/gallery/use-image-sizes.js +3 -2
- package/src/gallery/v1/edit.js +4 -3
- package/src/group/edit.js +10 -2
- package/src/group/editor.scss +1 -0
- package/src/image/edit.native.js +1 -1
- package/src/image/editor.scss +4 -1
- package/src/image/image.js +75 -33
- package/src/image/transforms.js +1 -7
- package/src/latest-posts/edit.js +2 -2
- package/src/list/test/edit.native.js +102 -3
- package/src/list/transforms.js +11 -0
- package/src/list/utils.js +3 -11
- 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 +9 -8
- package/src/navigation/block.json +4 -1
- package/src/navigation/edit/index.js +61 -37
- package/src/navigation/edit/inner-blocks.js +2 -5
- package/src/navigation/edit/unsaved-inner-blocks.js +9 -2
- 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 +5 -4
- package/src/navigation/index.php +103 -6
- package/src/navigation/style.scss +3 -1
- package/src/navigation-link/edit.js +6 -5
- package/src/navigation-link/index.php +8 -1
- package/src/navigation-submenu/edit.js +7 -5
- package/src/navigation-submenu/index.php +8 -1
- package/src/page-list/block.json +1 -5
- package/src/page-list/edit.js +36 -22
- 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-count/block.json +4 -0
- package/src/post-comments-form/block.json +4 -0
- package/src/post-comments-form/form.js +2 -3
- 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/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 +7 -2
- package/src/search/index.php +21 -13
- package/src/site-logo/edit.js +12 -10
- package/src/site-logo/editor.scss +1 -0
- 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 +3 -3
- 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/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
- 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/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
|
|
|
@@ -281,7 +281,7 @@ export function deleteColumn( state, { columnIndex } ) {
|
|
|
281
281
|
}
|
|
282
282
|
|
|
283
283
|
/**
|
|
284
|
-
* Toggles the
|
|
284
|
+
* Toggles the existence of a section.
|
|
285
285
|
*
|
|
286
286
|
* @param {Object} state Current table state.
|
|
287
287
|
* @param {string} sectionName Name of the section to toggle.
|
|
@@ -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,9 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { isEmpty, mapValues
|
|
5
|
-
|
|
6
|
-
const identity = ( x ) => x;
|
|
4
|
+
import { isEmpty, mapValues } from 'lodash';
|
|
7
5
|
|
|
8
6
|
/**
|
|
9
7
|
* Removed empty nodes from nested objects.
|
|
@@ -19,9 +17,10 @@ const cleanEmptyObject = ( object ) => {
|
|
|
19
17
|
) {
|
|
20
18
|
return object;
|
|
21
19
|
}
|
|
22
|
-
const cleanedNestedObjects =
|
|
23
|
-
mapValues( object, cleanEmptyObject )
|
|
24
|
-
|
|
20
|
+
const cleanedNestedObjects = Object.fromEntries(
|
|
21
|
+
Object.entries( mapValues( object, cleanEmptyObject ) ).filter(
|
|
22
|
+
( [ , value ] ) => Boolean( value )
|
|
23
|
+
)
|
|
25
24
|
);
|
|
26
25
|
return isEmpty( cleanedNestedObjects ) ? undefined : cleanedNestedObjects;
|
|
27
26
|
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { RichText, useBlockProps } from '@wordpress/block-editor';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import metadata from './block.json';
|
|
10
|
+
import Tracks from './tracks';
|
|
11
|
+
|
|
12
|
+
const { attributes: blockAttributes } = metadata;
|
|
13
|
+
|
|
14
|
+
// In #41140 support was added to global styles for caption elements which added a `wp-element-caption` classname
|
|
15
|
+
// to the video figcaption element.
|
|
16
|
+
const v1 = {
|
|
17
|
+
attributes: blockAttributes,
|
|
18
|
+
save( { attributes } ) {
|
|
19
|
+
const {
|
|
20
|
+
autoplay,
|
|
21
|
+
caption,
|
|
22
|
+
controls,
|
|
23
|
+
loop,
|
|
24
|
+
muted,
|
|
25
|
+
poster,
|
|
26
|
+
preload,
|
|
27
|
+
src,
|
|
28
|
+
playsInline,
|
|
29
|
+
tracks,
|
|
30
|
+
} = attributes;
|
|
31
|
+
return (
|
|
32
|
+
<figure { ...useBlockProps.save() }>
|
|
33
|
+
{ src && (
|
|
34
|
+
<video
|
|
35
|
+
autoPlay={ autoplay }
|
|
36
|
+
controls={ controls }
|
|
37
|
+
loop={ loop }
|
|
38
|
+
muted={ muted }
|
|
39
|
+
poster={ poster }
|
|
40
|
+
preload={ preload !== 'metadata' ? preload : undefined }
|
|
41
|
+
src={ src }
|
|
42
|
+
playsInline={ playsInline }
|
|
43
|
+
>
|
|
44
|
+
<Tracks tracks={ tracks } />
|
|
45
|
+
</video>
|
|
46
|
+
) }
|
|
47
|
+
{ ! RichText.isEmpty( caption ) && (
|
|
48
|
+
<RichText.Content tagName="figcaption" value={ caption } />
|
|
49
|
+
) }
|
|
50
|
+
</figure>
|
|
51
|
+
);
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const deprecated = [ v1 ];
|
|
56
|
+
|
|
57
|
+
export default deprecated;
|
package/src/video/edit.js
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
PanelBody,
|
|
15
15
|
Spinner,
|
|
16
16
|
Placeholder,
|
|
17
|
+
ToolbarButton,
|
|
17
18
|
} from '@wordpress/components';
|
|
18
19
|
import {
|
|
19
20
|
BlockControls,
|
|
@@ -28,11 +29,11 @@ import {
|
|
|
28
29
|
store as blockEditorStore,
|
|
29
30
|
__experimentalGetElementClassName,
|
|
30
31
|
} from '@wordpress/block-editor';
|
|
31
|
-
import { useRef, useEffect } from '@wordpress/element';
|
|
32
|
+
import { useRef, useEffect, useState, useCallback } from '@wordpress/element';
|
|
32
33
|
import { __, sprintf } from '@wordpress/i18n';
|
|
33
|
-
import { useInstanceId } from '@wordpress/compose';
|
|
34
|
+
import { useInstanceId, usePrevious } from '@wordpress/compose';
|
|
34
35
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
35
|
-
import { video as icon } from '@wordpress/icons';
|
|
36
|
+
import { video as icon, caption as captionIcon } from '@wordpress/icons';
|
|
36
37
|
import { createBlock, getDefaultBlockName } from '@wordpress/blocks';
|
|
37
38
|
import { store as noticesStore } from '@wordpress/notices';
|
|
38
39
|
|
|
@@ -76,6 +77,8 @@ function VideoEdit( {
|
|
|
76
77
|
const videoPlayer = useRef();
|
|
77
78
|
const posterImageButton = useRef();
|
|
78
79
|
const { id, caption, controls, poster, src, tracks } = attributes;
|
|
80
|
+
const prevCaption = usePrevious( caption );
|
|
81
|
+
const [ showCaption, setShowCaption ] = useState( !! caption );
|
|
79
82
|
const isTemporaryVideo = ! id && isBlobURL( src );
|
|
80
83
|
const mediaUpload = useSelect(
|
|
81
84
|
( select ) => select( blockEditorStore ).getSettings().mediaUpload,
|
|
@@ -103,6 +106,30 @@ function VideoEdit( {
|
|
|
103
106
|
}
|
|
104
107
|
}, [ poster ] );
|
|
105
108
|
|
|
109
|
+
// We need to show the caption when changes come from
|
|
110
|
+
// history navigation(undo/redo).
|
|
111
|
+
useEffect( () => {
|
|
112
|
+
if ( caption && ! prevCaption ) {
|
|
113
|
+
setShowCaption( true );
|
|
114
|
+
}
|
|
115
|
+
}, [ caption, prevCaption ] );
|
|
116
|
+
|
|
117
|
+
// Focus the caption when we click to add one.
|
|
118
|
+
const captionRef = useCallback(
|
|
119
|
+
( node ) => {
|
|
120
|
+
if ( node && ! caption ) {
|
|
121
|
+
node.focus();
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
[ caption ]
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
useEffect( () => {
|
|
128
|
+
if ( ! isSelected && ! caption ) {
|
|
129
|
+
setShowCaption( false );
|
|
130
|
+
}
|
|
131
|
+
}, [ isSelected, caption ] );
|
|
132
|
+
|
|
106
133
|
function onSelectVideo( media ) {
|
|
107
134
|
if ( ! media || ! media.url ) {
|
|
108
135
|
// In this case there was an error
|
|
@@ -112,6 +139,7 @@ function VideoEdit( {
|
|
|
112
139
|
src: undefined,
|
|
113
140
|
id: undefined,
|
|
114
141
|
poster: undefined,
|
|
142
|
+
caption: undefined,
|
|
115
143
|
} );
|
|
116
144
|
return;
|
|
117
145
|
}
|
|
@@ -123,6 +151,7 @@ function VideoEdit( {
|
|
|
123
151
|
id: media.id,
|
|
124
152
|
poster:
|
|
125
153
|
media.image?.src !== media.icon ? media.image?.src : undefined,
|
|
154
|
+
caption: media.caption,
|
|
126
155
|
} );
|
|
127
156
|
}
|
|
128
157
|
|
|
@@ -186,6 +215,23 @@ function VideoEdit( {
|
|
|
186
215
|
return (
|
|
187
216
|
<>
|
|
188
217
|
<BlockControls group="block">
|
|
218
|
+
<ToolbarButton
|
|
219
|
+
onClick={ () => {
|
|
220
|
+
setShowCaption( ! showCaption );
|
|
221
|
+
if ( showCaption && caption ) {
|
|
222
|
+
setAttributes( { caption: undefined } );
|
|
223
|
+
}
|
|
224
|
+
} }
|
|
225
|
+
icon={ captionIcon }
|
|
226
|
+
isPressed={ showCaption }
|
|
227
|
+
label={
|
|
228
|
+
showCaption
|
|
229
|
+
? __( 'Remove caption' )
|
|
230
|
+
: __( 'Add caption' )
|
|
231
|
+
}
|
|
232
|
+
/>
|
|
233
|
+
</BlockControls>
|
|
234
|
+
<BlockControls>
|
|
189
235
|
<TracksEditor
|
|
190
236
|
tracks={ tracks }
|
|
191
237
|
onChange={ ( newTracks ) => {
|
|
@@ -278,26 +324,28 @@ function VideoEdit( {
|
|
|
278
324
|
</video>
|
|
279
325
|
</Disabled>
|
|
280
326
|
{ isTemporaryVideo && <Spinner /> }
|
|
281
|
-
{
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
327
|
+
{ showCaption &&
|
|
328
|
+
( ! RichText.isEmpty( caption ) || isSelected ) && (
|
|
329
|
+
<RichText
|
|
330
|
+
tagName="figcaption"
|
|
331
|
+
className={ __experimentalGetElementClassName(
|
|
332
|
+
'caption'
|
|
333
|
+
) }
|
|
334
|
+
aria-label={ __( 'Video caption text' ) }
|
|
335
|
+
ref={ captionRef }
|
|
336
|
+
placeholder={ __( 'Add caption' ) }
|
|
337
|
+
value={ caption }
|
|
338
|
+
onChange={ ( value ) =>
|
|
339
|
+
setAttributes( { caption: value } )
|
|
340
|
+
}
|
|
341
|
+
inlineToolbar
|
|
342
|
+
__unstableOnSplitAtEnd={ () =>
|
|
343
|
+
insertBlocksAfter(
|
|
344
|
+
createBlock( getDefaultBlockName() )
|
|
345
|
+
)
|
|
346
|
+
}
|
|
347
|
+
/>
|
|
348
|
+
) }
|
|
301
349
|
</figure>
|
|
302
350
|
</>
|
|
303
351
|
);
|
package/src/video/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import { video as icon } from '@wordpress/icons';
|
|
|
8
8
|
* Internal dependencies
|
|
9
9
|
*/
|
|
10
10
|
import initBlock from '../utils/init-block';
|
|
11
|
+
import deprecated from './deprecated';
|
|
11
12
|
import edit from './edit';
|
|
12
13
|
import metadata from './block.json';
|
|
13
14
|
import save from './save';
|
|
@@ -27,6 +28,7 @@ export const settings = {
|
|
|
27
28
|
},
|
|
28
29
|
},
|
|
29
30
|
transforms,
|
|
31
|
+
deprecated,
|
|
30
32
|
edit,
|
|
31
33
|
save,
|
|
32
34
|
};
|
|
@@ -7,11 +7,9 @@ import {
|
|
|
7
7
|
MenuItem,
|
|
8
8
|
FormFileUpload,
|
|
9
9
|
MenuGroup,
|
|
10
|
+
ToolbarGroup,
|
|
10
11
|
ToolbarButton,
|
|
11
12
|
Dropdown,
|
|
12
|
-
SVG,
|
|
13
|
-
Rect,
|
|
14
|
-
Path,
|
|
15
13
|
Button,
|
|
16
14
|
TextControl,
|
|
17
15
|
SelectControl,
|
|
@@ -38,23 +36,6 @@ const KIND_OPTIONS = [
|
|
|
38
36
|
{ label: __( 'Metadata' ), value: 'metadata' },
|
|
39
37
|
];
|
|
40
38
|
|
|
41
|
-
const captionIcon = (
|
|
42
|
-
<SVG width="18" height="14" viewBox="0 0 18 14" role="img" fill="none">
|
|
43
|
-
<Rect
|
|
44
|
-
x="0.75"
|
|
45
|
-
y="0.75"
|
|
46
|
-
width="16.5"
|
|
47
|
-
height="12.5"
|
|
48
|
-
rx="1.25"
|
|
49
|
-
stroke="black"
|
|
50
|
-
strokeWidth="1.5"
|
|
51
|
-
fill="none"
|
|
52
|
-
/>
|
|
53
|
-
<Path d="M3 7H15" stroke="black" strokeWidth="1.5" />
|
|
54
|
-
<Path d="M3 10L15 10" stroke="black" strokeWidth="1.5" />
|
|
55
|
-
</SVG>
|
|
56
|
-
);
|
|
57
|
-
|
|
58
39
|
function TrackList( { tracks, onEditPress } ) {
|
|
59
40
|
let content;
|
|
60
41
|
if ( tracks.length === 0 ) {
|
|
@@ -200,14 +181,17 @@ export default function TracksEditor( { tracks = [], onChange } ) {
|
|
|
200
181
|
<Dropdown
|
|
201
182
|
contentClassName="block-library-video-tracks-editor"
|
|
202
183
|
renderToggle={ ( { isOpen, onToggle } ) => (
|
|
203
|
-
<
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
184
|
+
<ToolbarGroup>
|
|
185
|
+
<ToolbarButton
|
|
186
|
+
label={ __( 'Text tracks' ) }
|
|
187
|
+
showTooltip
|
|
188
|
+
aria-expanded={ isOpen }
|
|
189
|
+
aria-haspopup="true"
|
|
190
|
+
onClick={ onToggle }
|
|
191
|
+
>
|
|
192
|
+
{ __( 'Text tracks' ) }
|
|
193
|
+
</ToolbarButton>
|
|
194
|
+
</ToolbarGroup>
|
|
211
195
|
) }
|
|
212
196
|
renderContent={ () => {
|
|
213
197
|
if ( trackBeingEdited !== null ) {
|
|
@@ -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":"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","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,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":"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","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"]}
|