@wordpress/block-library 7.8.0 → 7.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/build/audio/edit.js +1 -0
- package/build/audio/edit.js.map +1 -1
- package/build/audio/save.js +2 -1
- package/build/audio/save.js.map +1 -1
- package/build/avatar/hooks.js +2 -2
- package/build/avatar/hooks.js.map +1 -1
- package/build/button/edit.js +3 -2
- package/build/button/edit.js.map +1 -1
- package/build/button/index.js +1 -24
- package/build/button/index.js.map +1 -1
- package/build/button/save.js +1 -1
- package/build/button/save.js.map +1 -1
- package/build/buttons/edit.js +1 -1
- package/build/buttons/edit.js.map +1 -1
- package/build/columns/edit.native.js +1 -1
- package/build/columns/edit.native.js.map +1 -1
- package/build/columns/variations.js +2 -2
- package/build/columns/variations.js.map +1 -1
- package/build/comment-author-name/edit.js +3 -5
- package/build/comment-author-name/edit.js.map +1 -1
- package/build/comment-author-name/index.js +0 -4
- package/build/comment-author-name/index.js.map +1 -1
- package/build/comment-date/edit.js +4 -4
- package/build/comment-date/edit.js.map +1 -1
- package/build/comment-date/index.js +0 -4
- package/build/comment-date/index.js.map +1 -1
- package/build/comment-edit-link/index.js +0 -4
- package/build/comment-edit-link/index.js.map +1 -1
- package/build/comment-reply-link/index.js +0 -4
- package/build/comment-reply-link/index.js.map +1 -1
- package/build/comment-template/index.js +1 -1
- package/build/comments/deprecated.js +65 -0
- package/build/comments/deprecated.js.map +1 -0
- package/build/comments/edit/comments-legacy.js +73 -0
- package/build/comments/edit/comments-legacy.js.map +1 -0
- package/build/comments/{edit.js → edit/index.js} +17 -30
- package/build/comments/edit/index.js.map +1 -0
- package/build/comments/edit/placeholder.js +117 -0
- package/build/comments/edit/placeholder.js.map +1 -0
- package/build/comments/edit/template.js +39 -0
- package/build/comments/edit/template.js.map +1 -0
- package/build/comments/index.js +11 -3
- package/build/comments/index.js.map +1 -1
- package/build/comments/save.js +12 -4
- package/build/comments/save.js.map +1 -1
- package/build/comments-pagination/index.js +1 -1
- package/build/comments-title/deprecated.js +1 -4
- package/build/comments-title/deprecated.js.map +1 -1
- package/build/comments-title/index.js +1 -1
- package/build/cover/edit/block-controls.js +2 -12
- package/build/cover/edit/block-controls.js.map +1 -1
- package/build/cover/edit/cover-placeholder.js +3 -1
- package/build/cover/edit/cover-placeholder.js.map +1 -1
- package/build/cover/edit/index.js +19 -4
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/index.js +1 -0
- package/build/cover/index.js.map +1 -1
- package/build/cover/transforms.js +3 -2
- package/build/cover/transforms.js.map +1 -1
- package/build/embed/embed-placeholder.native.js +1 -3
- package/build/embed/embed-placeholder.native.js.map +1 -1
- package/build/embed/embed-preview.js +1 -0
- package/build/embed/embed-preview.js.map +1 -1
- package/build/embed/icons.js +21 -1
- package/build/embed/icons.js.map +1 -1
- package/build/embed/save.js +1 -0
- package/build/embed/save.js.map +1 -1
- package/build/embed/variations.js +11 -0
- package/build/embed/variations.js.map +1 -1
- package/build/file/edit.js +1 -1
- package/build/file/edit.js.map +1 -1
- package/build/file/save.js +1 -1
- package/build/file/save.js.map +1 -1
- package/build/gallery/edit.js +11 -19
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/gallery.js +1 -1
- package/build/gallery/gallery.js.map +1 -1
- package/build/gallery/save.js +1 -1
- package/build/gallery/save.js.map +1 -1
- package/build/gallery/transforms.js +32 -22
- package/build/gallery/transforms.js.map +1 -1
- package/build/gallery/use-get-media.js +7 -18
- package/build/gallery/use-get-media.js.map +1 -1
- package/build/gallery/use-get-media.native.js +59 -0
- package/build/gallery/use-get-media.native.js.map +1 -0
- package/build/gallery/v1/edit.js +3 -3
- package/build/gallery/v1/edit.js.map +1 -1
- package/build/gallery/v1/gallery-image.js +1 -0
- package/build/gallery/v1/gallery-image.js.map +1 -1
- package/build/gallery/v1/gallery.js +1 -1
- package/build/gallery/v1/gallery.js.map +1 -1
- package/build/gallery/v1/save.js +10 -2
- package/build/gallery/v1/save.js.map +1 -1
- package/build/group/edit.js +1 -3
- package/build/group/edit.js.map +1 -1
- package/build/group/index.js +2 -0
- package/build/group/index.js.map +1 -1
- package/build/group/variations.js +1 -1
- package/build/group/variations.js.map +1 -1
- package/build/heading/heading-level-dropdown.js +2 -1
- package/build/heading/heading-level-dropdown.js.map +1 -1
- package/build/heading/index.js +9 -4
- package/build/heading/index.js.map +1 -1
- package/build/html/edit.js +11 -20
- package/build/html/edit.js.map +1 -1
- package/build/html/preview.js +48 -0
- package/build/html/preview.js.map +1 -0
- package/build/image/deprecated.js +77 -9
- package/build/image/deprecated.js.map +1 -1
- package/build/image/edit.js +3 -1
- package/build/image/edit.js.map +1 -1
- package/build/image/edit.native.js +20 -9
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +28 -20
- package/build/image/image.js.map +1 -1
- package/build/image/index.js +7 -1
- package/build/image/index.js.map +1 -1
- package/build/image/save.js +9 -2
- package/build/image/save.js.map +1 -1
- package/build/index.js +1 -3
- package/build/index.js.map +1 -1
- package/build/index.native.js +3 -13
- package/build/index.native.js.map +1 -1
- package/build/latest-posts/edit.js +1 -1
- package/build/latest-posts/edit.js.map +1 -1
- package/build/list/transforms.js +4 -63
- package/build/list/transforms.js.map +1 -1
- package/build/list/v2/transforms.js +31 -42
- package/build/list/v2/transforms.js.map +1 -1
- package/build/list-item/edit.js +14 -9
- package/build/list-item/edit.js.map +1 -1
- package/build/list-item/hooks/index.js +8 -8
- package/build/list-item/hooks/index.js.map +1 -1
- package/build/list-item/hooks/use-enter.js +7 -4
- package/build/list-item/hooks/use-enter.js.map +1 -1
- package/build/list-item/hooks/use-merge.js +174 -0
- package/build/list-item/hooks/use-merge.js.map +1 -0
- package/build/list-item/hooks/use-outdent-list-item.js +93 -36
- package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build/list-item/utils.js +125 -1
- package/build/list-item/utils.js.map +1 -1
- package/build/media-text/deprecated.js +134 -7
- package/build/media-text/deprecated.js.map +1 -1
- package/build/media-text/edit.js +2 -2
- package/build/media-text/edit.js.map +1 -1
- package/build/media-text/save.js +13 -0
- package/build/media-text/save.js.map +1 -1
- package/build/more/edit.js +2 -4
- package/build/more/edit.js.map +1 -1
- package/build/more/save.js +1 -7
- package/build/more/save.js.map +1 -1
- package/build/navigation/edit/index.js +1 -1
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/index.js +9 -0
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/use-navigation-menu.js +16 -74
- package/build/navigation/use-navigation-menu.js.map +1 -1
- package/build/navigation/view.js +6 -1
- package/build/navigation/view.js.map +1 -1
- package/build/navigation-link/edit.js +5 -4
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-link/hooks.js +0 -16
- package/build/navigation-link/hooks.js.map +1 -1
- package/build/navigation-link/index.js +1 -1
- package/build/navigation-link/index.js.map +1 -1
- package/build/navigation-submenu/edit.js +2 -1
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/navigation-submenu/view.js +6 -1
- package/build/navigation-submenu/view.js.map +1 -1
- package/build/nextpage/edit.js +1 -3
- package/build/nextpage/edit.js.map +1 -1
- package/build/page-list/edit.js +10 -3
- package/build/page-list/edit.js.map +1 -1
- package/build/paragraph/edit.js +7 -11
- package/build/paragraph/edit.js.map +1 -1
- package/build/post-comments-form/edit.js +4 -37
- package/build/post-comments-form/edit.js.map +1 -1
- package/build/post-comments-form/form.js +47 -3
- package/build/post-comments-form/form.js.map +1 -1
- package/build/post-terms/edit.js +3 -2
- package/build/post-terms/edit.js.map +1 -1
- package/build/post-terms/index.js +1 -1
- package/build/post-terms/index.js.map +1 -1
- package/build/post-title/index.js +1 -0
- package/build/post-title/index.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +1 -1
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/index.js +1 -1
- package/build/query/index.js.map +1 -1
- package/build/query-no-results/edit.js +1 -1
- package/build/query-no-results/edit.js.map +1 -1
- package/build/query-pagination-next/edit.js +2 -1
- package/build/query-pagination-next/edit.js.map +1 -1
- package/build/query-pagination-previous/edit.js +2 -1
- package/build/query-pagination-previous/edit.js.map +1 -1
- package/build/quote/deprecated.js +168 -36
- package/build/quote/deprecated.js.map +1 -1
- package/build/quote/edit.js +76 -39
- package/build/quote/edit.js.map +1 -1
- package/build/quote/index.js +9 -45
- package/build/quote/index.js.map +1 -1
- package/build/quote/save.js +1 -5
- package/build/quote/save.js.map +1 -1
- package/build/quote/transforms.js +110 -158
- package/build/quote/transforms.js.map +1 -1
- package/build/search/edit.js +1 -1
- package/build/search/edit.js.map +1 -1
- package/build/site-logo/edit.js +5 -13
- package/build/site-logo/edit.js.map +1 -1
- package/build/site-title/edit/level-toolbar.js +2 -1
- package/build/site-title/edit/level-toolbar.js.map +1 -1
- package/build/social-link/icons/index.js +13 -0
- package/build/social-link/icons/index.js.map +1 -1
- package/build/social-link/icons/whatsapp.js +25 -0
- package/build/social-link/icons/whatsapp.js.map +1 -0
- package/build/social-link/variations.js +7 -0
- package/build/social-link/variations.js.map +1 -1
- package/build/table/edit.js +1 -0
- package/build/table/edit.js.map +1 -1
- package/build/table/save.js +2 -1
- package/build/table/save.js.map +1 -1
- package/build/template-part/edit/index.js +17 -8
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/edit/selection-modal.js +33 -13
- package/build/template-part/edit/selection-modal.js.map +1 -1
- package/build/template-part/edit/utils/search.js +94 -0
- package/build/template-part/edit/utils/search.js.map +1 -0
- package/build/template-part/index.js +1 -1
- package/build/template-part/index.js.map +1 -1
- package/build/template-part/variations.js +0 -16
- package/build/template-part/variations.js.map +1 -1
- package/build/utils/clean-empty-object.js +5 -3
- package/build/utils/clean-empty-object.js.map +1 -1
- package/build/video/edit.js +1 -0
- package/build/video/edit.js.map +1 -1
- package/build/video/save.js +1 -0
- package/build/video/save.js.map +1 -1
- package/build/video/tracks-editor.js +9 -11
- package/build/video/tracks-editor.js.map +1 -1
- package/build-module/audio/edit.js +2 -1
- package/build-module/audio/edit.js.map +1 -1
- package/build-module/audio/save.js +3 -2
- package/build-module/audio/save.js.map +1 -1
- package/build-module/avatar/hooks.js +2 -2
- package/build-module/avatar/hooks.js.map +1 -1
- package/build-module/button/edit.js +4 -3
- package/build-module/button/edit.js.map +1 -1
- package/build-module/button/index.js +1 -24
- package/build-module/button/index.js.map +1 -1
- package/build-module/button/save.js +2 -2
- package/build-module/button/save.js.map +1 -1
- package/build-module/buttons/edit.js +2 -2
- package/build-module/buttons/edit.js.map +1 -1
- package/build-module/columns/edit.native.js +2 -2
- package/build-module/columns/edit.native.js.map +1 -1
- package/build-module/columns/variations.js +2 -2
- package/build-module/columns/variations.js.map +1 -1
- package/build-module/comment-author-name/edit.js +3 -5
- package/build-module/comment-author-name/edit.js.map +1 -1
- package/build-module/comment-author-name/index.js +0 -4
- package/build-module/comment-author-name/index.js.map +1 -1
- package/build-module/comment-date/edit.js +4 -4
- package/build-module/comment-date/edit.js.map +1 -1
- package/build-module/comment-date/index.js +0 -4
- package/build-module/comment-date/index.js.map +1 -1
- package/build-module/comment-edit-link/index.js +0 -4
- package/build-module/comment-edit-link/index.js.map +1 -1
- package/build-module/comment-reply-link/index.js +0 -4
- package/build-module/comment-reply-link/index.js.map +1 -1
- package/build-module/comment-template/index.js +1 -1
- package/build-module/comments/deprecated.js +54 -0
- package/build-module/comments/deprecated.js.map +1 -0
- package/build-module/comments/edit/comments-legacy.js +59 -0
- package/build-module/comments/edit/comments-legacy.js.map +1 -0
- package/build-module/comments/edit/index.js +37 -0
- package/build-module/comments/edit/index.js.map +1 -0
- package/build-module/comments/edit/placeholder.js +102 -0
- package/build-module/comments/edit/placeholder.js.map +1 -0
- package/build-module/comments/edit/template.js +32 -0
- package/build-module/comments/edit/template.js.map +1 -0
- package/build-module/comments/index.js +10 -3
- package/build-module/comments/index.js.map +1 -1
- package/build-module/comments/save.js +9 -4
- package/build-module/comments/save.js.map +1 -1
- package/build-module/comments-pagination/index.js +1 -1
- package/build-module/comments-title/deprecated.js +1 -4
- package/build-module/comments-title/deprecated.js.map +1 -1
- package/build-module/comments-title/index.js +1 -1
- package/build-module/cover/edit/block-controls.js +3 -13
- package/build-module/cover/edit/block-controls.js.map +1 -1
- package/build-module/cover/edit/cover-placeholder.js +3 -1
- package/build-module/cover/edit/cover-placeholder.js.map +1 -1
- package/build-module/cover/edit/index.js +19 -4
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/index.js +1 -0
- package/build-module/cover/index.js.map +1 -1
- package/build-module/cover/transforms.js +3 -2
- package/build-module/cover/transforms.js.map +1 -1
- package/build-module/embed/embed-placeholder.native.js +1 -2
- package/build-module/embed/embed-placeholder.native.js.map +1 -1
- package/build-module/embed/embed-preview.js +2 -1
- package/build-module/embed/embed-preview.js.map +1 -1
- package/build-module/embed/icons.js +19 -0
- package/build-module/embed/icons.js.map +1 -1
- package/build-module/embed/save.js +2 -1
- package/build-module/embed/save.js.map +1 -1
- package/build-module/embed/variations.js +12 -1
- package/build-module/embed/variations.js.map +1 -1
- package/build-module/file/edit.js +2 -2
- package/build-module/file/edit.js.map +1 -1
- package/build-module/file/save.js +2 -2
- package/build-module/file/save.js.map +1 -1
- package/build-module/gallery/edit.js +11 -18
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/gallery.js +2 -2
- package/build-module/gallery/gallery.js.map +1 -1
- package/build-module/gallery/save.js +2 -2
- package/build-module/gallery/save.js.map +1 -1
- package/build-module/gallery/transforms.js +33 -23
- package/build-module/gallery/transforms.js.map +1 -1
- package/build-module/gallery/use-get-media.js +6 -16
- package/build-module/gallery/use-get-media.js.map +1 -1
- package/build-module/gallery/use-get-media.native.js +50 -0
- package/build-module/gallery/use-get-media.native.js.map +1 -0
- package/build-module/gallery/v1/edit.js +4 -4
- package/build-module/gallery/v1/edit.js.map +1 -1
- package/build-module/gallery/v1/gallery-image.js +2 -1
- package/build-module/gallery/v1/gallery-image.js.map +1 -1
- package/build-module/gallery/v1/gallery.js +2 -2
- package/build-module/gallery/v1/gallery.js.map +1 -1
- package/build-module/gallery/v1/save.js +8 -3
- package/build-module/gallery/v1/save.js.map +1 -1
- package/build-module/group/edit.js +1 -3
- package/build-module/group/edit.js.map +1 -1
- package/build-module/group/index.js +2 -0
- package/build-module/group/index.js.map +1 -1
- package/build-module/group/variations.js +2 -2
- package/build-module/group/variations.js.map +1 -1
- package/build-module/heading/heading-level-dropdown.js +2 -1
- package/build-module/heading/heading-level-dropdown.js.map +1 -1
- package/build-module/heading/index.js +9 -4
- package/build-module/heading/index.js.map +1 -1
- package/build-module/html/edit.js +12 -23
- package/build-module/html/edit.js.map +1 -1
- package/build-module/html/preview.js +38 -0
- package/build-module/html/preview.js.map +1 -0
- package/build-module/image/deprecated.js +77 -9
- package/build-module/image/deprecated.js.map +1 -1
- package/build-module/image/edit.js +5 -3
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/edit.native.js +20 -9
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +30 -22
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/index.js +7 -1
- package/build-module/image/index.js.map +1 -1
- package/build-module/image/save.js +10 -3
- package/build-module/image/save.js.map +1 -1
- package/build-module/index.js +1 -2
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +3 -13
- package/build-module/index.native.js.map +1 -1
- package/build-module/latest-posts/edit.js +2 -2
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/list/transforms.js +4 -63
- package/build-module/list/transforms.js.map +1 -1
- package/build-module/list/v2/transforms.js +32 -44
- package/build-module/list/v2/transforms.js.map +1 -1
- package/build-module/list-item/edit.js +14 -10
- package/build-module/list-item/edit.js.map +1 -1
- package/build-module/list-item/hooks/index.js +1 -1
- package/build-module/list-item/hooks/index.js.map +1 -1
- package/build-module/list-item/hooks/use-enter.js +7 -4
- package/build-module/list-item/hooks/use-enter.js.map +1 -1
- package/build-module/list-item/hooks/use-merge.js +160 -0
- package/build-module/list-item/hooks/use-merge.js.map +1 -0
- package/build-module/list-item/hooks/use-outdent-list-item.js +88 -33
- package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build-module/list-item/utils.js +123 -2
- package/build-module/list-item/utils.js.map +1 -1
- package/build-module/media-text/deprecated.js +134 -8
- package/build-module/media-text/deprecated.js.map +1 -1
- package/build-module/media-text/edit.js +2 -2
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/media-text/save.js +13 -0
- package/build-module/media-text/save.js.map +1 -1
- package/build-module/more/edit.js +2 -4
- package/build-module/more/edit.js.map +1 -1
- package/build-module/more/save.js +1 -6
- package/build-module/more/save.js.map +1 -1
- package/build-module/navigation/edit/index.js +1 -1
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/index.js +9 -0
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/use-navigation-menu.js +17 -75
- package/build-module/navigation/use-navigation-menu.js.map +1 -1
- package/build-module/navigation/view.js +6 -1
- package/build-module/navigation/view.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-link/hooks.js +0 -13
- package/build-module/navigation-link/hooks.js.map +1 -1
- package/build-module/navigation-link/index.js +1 -1
- package/build-module/navigation-link/index.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +2 -1
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/navigation-submenu/view.js +6 -1
- package/build-module/navigation-submenu/view.js.map +1 -1
- package/build-module/nextpage/edit.js +1 -3
- package/build-module/nextpage/edit.js.map +1 -1
- package/build-module/page-list/edit.js +10 -3
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/paragraph/edit.js +8 -12
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/post-comments-form/edit.js +5 -35
- package/build-module/post-comments-form/edit.js.map +1 -1
- package/build-module/post-comments-form/form.js +46 -5
- package/build-module/post-comments-form/form.js.map +1 -1
- package/build-module/post-terms/edit.js +3 -2
- package/build-module/post-terms/edit.js.map +1 -1
- package/build-module/post-terms/index.js +1 -1
- package/build-module/post-terms/index.js.map +1 -1
- package/build-module/post-title/index.js +1 -0
- package/build-module/post-title/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +1 -1
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/index.js +1 -1
- package/build-module/query/index.js.map +1 -1
- package/build-module/query-no-results/edit.js +2 -2
- package/build-module/query-no-results/edit.js.map +1 -1
- package/build-module/query-pagination-next/edit.js +2 -1
- package/build-module/query-pagination-next/edit.js.map +1 -1
- package/build-module/query-pagination-previous/edit.js +2 -1
- package/build-module/query-pagination-previous/edit.js.map +1 -1
- package/build-module/quote/deprecated.js +162 -36
- package/build-module/quote/deprecated.js.map +1 -1
- package/build-module/quote/edit.js +77 -43
- package/build-module/quote/edit.js.map +1 -1
- package/build-module/quote/index.js +9 -39
- package/build-module/quote/index.js.map +1 -1
- package/build-module/quote/save.js +4 -8
- package/build-module/quote/save.js.map +1 -1
- package/build-module/quote/transforms.js +111 -158
- package/build-module/quote/transforms.js.map +1 -1
- package/build-module/search/edit.js +2 -2
- package/build-module/search/edit.js.map +1 -1
- package/build-module/site-logo/edit.js +5 -13
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/site-title/edit/level-toolbar.js +2 -1
- package/build-module/site-title/edit/level-toolbar.js.map +1 -1
- package/build-module/social-link/icons/index.js +1 -0
- package/build-module/social-link/icons/index.js.map +1 -1
- package/build-module/social-link/icons/whatsapp.js +15 -0
- package/build-module/social-link/icons/whatsapp.js.map +1 -0
- package/build-module/social-link/variations.js +8 -1
- package/build-module/social-link/variations.js.map +1 -1
- package/build-module/table/edit.js +2 -1
- package/build-module/table/edit.js.map +1 -1
- package/build-module/table/save.js +3 -2
- package/build-module/table/save.js.map +1 -1
- package/build-module/template-part/edit/index.js +20 -11
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/edit/selection-modal.js +33 -15
- package/build-module/template-part/edit/selection-modal.js.map +1 -1
- package/build-module/template-part/edit/utils/search.js +84 -0
- package/build-module/template-part/edit/utils/search.js.map +1 -0
- package/build-module/template-part/index.js +1 -1
- package/build-module/template-part/index.js.map +1 -1
- package/build-module/template-part/variations.js +0 -13
- package/build-module/template-part/variations.js.map +1 -1
- package/build-module/utils/clean-empty-object.js +5 -2
- package/build-module/utils/clean-empty-object.js.map +1 -1
- package/build-module/video/edit.js +2 -1
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/save.js +2 -1
- package/build-module/video/save.js.map +1 -1
- package/build-module/video/tracks-editor.js +9 -11
- package/build-module/video/tracks-editor.js.map +1 -1
- package/build-style/button/style-rtl.css +6 -1
- package/build-style/button/style.css +6 -1
- package/build-style/comment-template/style-rtl.css +12 -0
- package/build-style/comment-template/style.css +12 -0
- package/build-style/comments/editor-rtl.css +122 -0
- package/build-style/comments/editor.css +122 -0
- package/build-style/{post-comments → comments}/style-rtl.css +3 -1
- package/build-style/{post-comments → comments}/style.css +3 -1
- package/build-style/common-rtl.css +7 -0
- package/build-style/common.css +7 -0
- package/build-style/cover/style-rtl.css +2 -2
- package/build-style/cover/style.css +2 -2
- package/build-style/editor-elements-rtl.css +85 -0
- package/build-style/editor-elements.css +85 -0
- package/build-style/editor-rtl.css +154 -10
- package/build-style/editor.css +154 -10
- package/build-style/{post-comments/editor-rtl.css → elements-rtl.css} +5 -2
- package/build-style/{post-comments/editor.css → elements.css} +5 -2
- package/build-style/file/style-rtl.css +5 -8
- package/build-style/file/style.css +5 -8
- package/build-style/gallery/style-rtl.css +7 -2
- package/build-style/gallery/style.css +7 -2
- package/build-style/image/editor-rtl.css +4 -3
- package/build-style/image/editor.css +4 -3
- package/build-style/image/style-rtl.css +33 -3
- package/build-style/image/style.css +33 -3
- package/build-style/navigation/style-rtl.css +9 -1
- package/build-style/navigation/style.css +9 -1
- package/build-style/post-comments-form/editor-rtl.css +3 -0
- package/build-style/post-comments-form/editor.css +3 -0
- package/build-style/post-comments-form/style-rtl.css +0 -1
- package/build-style/post-comments-form/style.css +0 -1
- package/build-style/post-template/style-rtl.css +9 -18
- package/build-style/post-template/style.css +9 -18
- package/build-style/query/editor-rtl.css +1 -1
- package/build-style/query/editor.css +1 -1
- package/build-style/search/style-rtl.css +6 -8
- package/build-style/search/style.css +6 -8
- package/build-style/search/theme-rtl.css +5 -0
- package/build-style/search/theme.css +5 -0
- package/build-style/social-link/editor-rtl.css +1 -0
- package/build-style/social-link/editor.css +1 -0
- package/build-style/social-links/style-rtl.css +8 -0
- package/build-style/social-links/style.css +8 -0
- package/build-style/style-rtl.css +216 -154
- package/build-style/style.css +216 -154
- package/build-style/template-part/editor-rtl.css +14 -3
- package/build-style/template-part/editor.css +14 -3
- package/build-style/theme-rtl.css +5 -0
- package/build-style/theme.css +5 -0
- package/package.json +28 -28
- package/src/audio/edit.js +4 -0
- package/src/audio/save.js +12 -2
- package/src/avatar/hooks.js +6 -9
- package/src/button/block.json +1 -24
- package/src/button/edit.js +3 -2
- package/src/button/save.js +2 -2
- package/src/button/style.scss +13 -1
- package/src/buttons/edit.js +1 -5
- package/src/columns/edit.native.js +2 -2
- package/src/columns/variations.js +2 -2
- package/src/comment-author-name/block.json +0 -4
- package/src/comment-author-name/edit.js +3 -12
- package/src/comment-date/block.json +0 -4
- package/src/comment-date/edit.js +10 -14
- package/src/comment-date/index.php +0 -3
- package/src/comment-edit-link/block.json +0 -4
- package/src/comment-reply-link/block.json +0 -4
- package/src/comment-template/block.json +1 -1
- package/src/comment-template/style.scss +14 -0
- package/src/comments/block.json +7 -2
- package/src/comments/deprecated.js +53 -0
- package/src/comments/edit/comments-legacy.js +71 -0
- package/src/comments/edit/index.js +35 -0
- package/src/comments/edit/placeholder.js +124 -0
- package/src/comments/{edit.js → edit/template.js} +25 -32
- package/src/comments/editor.scss +9 -0
- package/src/comments/index.js +2 -0
- package/src/comments/index.php +219 -0
- package/src/comments/save.js +8 -7
- package/src/{post-comments → comments}/style.scss +14 -3
- package/src/comments-pagination/block.json +1 -1
- package/src/comments-title/block.json +1 -1
- package/src/comments-title/deprecated.js +0 -2
- package/src/common.scss +2 -0
- package/src/cover/block.json +1 -0
- package/src/cover/edit/block-controls.js +4 -20
- package/src/cover/edit/cover-placeholder.js +2 -0
- package/src/cover/edit/index.js +16 -0
- package/src/cover/index.php +21 -8
- package/src/cover/style.scss +2 -2
- package/src/cover/transforms.js +2 -2
- package/src/editor-elements.scss +10 -0
- package/src/editor.scss +2 -1
- package/src/elements.scss +6 -0
- package/src/embed/embed-placeholder.native.js +2 -3
- package/src/embed/embed-preview.js +8 -1
- package/src/embed/icons.js +25 -0
- package/src/embed/save.js +10 -2
- package/src/embed/test/__snapshots__/index.native.js.snap +1 -1
- package/src/embed/variations.js +10 -0
- package/src/file/edit.js +4 -2
- package/src/file/save.js +2 -2
- package/src/file/style.scss +5 -5
- package/src/freeform/editor.scss +0 -2
- package/src/gallery/edit.js +12 -23
- package/src/gallery/gallery.js +9 -2
- package/src/gallery/index.php +5 -1
- package/src/gallery/save.js +5 -1
- package/src/gallery/style.scss +10 -1
- package/src/gallery/test/__snapshots__/index.native.js.snap +2 -2
- package/src/gallery/test/helpers.native.js +11 -198
- package/src/gallery/test/index.native.js +19 -29
- package/src/gallery/transforms.js +28 -13
- package/src/gallery/use-get-media.js +11 -28
- package/src/gallery/use-get-media.native.js +44 -0
- package/src/gallery/v1/edit.js +3 -4
- package/src/gallery/v1/gallery-image.js +4 -0
- package/src/gallery/v1/gallery.js +8 -2
- package/src/gallery/v1/save.js +20 -3
- package/src/group/block.json +2 -0
- package/src/group/edit.js +1 -3
- package/src/group/variations.js +2 -2
- package/src/heading/heading-level-dropdown.js +1 -0
- package/src/heading/index.js +8 -2
- package/src/html/edit.js +10 -40
- package/src/html/preview.js +46 -0
- package/src/image/block.json +7 -1
- package/src/image/deprecated.js +86 -0
- package/src/image/edit.js +6 -1
- package/src/image/edit.native.js +19 -7
- package/src/image/editor.scss +9 -4
- package/src/image/image.js +28 -16
- package/src/image/save.js +20 -3
- package/src/image/style.scss +39 -3
- package/src/image/test/edit.native.js +51 -19
- package/src/index.js +0 -2
- package/src/index.native.js +2 -11
- package/src/latest-posts/edit.js +2 -6
- package/src/list/transforms.js +0 -47
- package/src/list/v2/transforms.js +23 -46
- package/src/list-item/edit.js +10 -12
- package/src/list-item/hooks/index.js +1 -1
- package/src/list-item/hooks/use-enter.js +9 -6
- package/src/list-item/hooks/use-merge.js +141 -0
- package/src/list-item/hooks/use-outdent-list-item.js +79 -54
- package/src/list-item/utils.js +27 -3
- package/src/media-text/deprecated.js +148 -1
- package/src/media-text/edit.js +2 -1
- package/src/media-text/save.js +18 -0
- package/src/more/edit.js +9 -11
- package/src/more/save.js +3 -6
- package/src/navigation/block.json +9 -0
- package/src/navigation/edit/index.js +1 -0
- package/src/navigation/style.scss +11 -2
- package/src/navigation/test/use-navigation-menu.js +16 -11
- package/src/navigation/use-navigation-menu.js +26 -83
- package/src/navigation/view.js +6 -1
- package/src/navigation-link/edit.js +4 -3
- package/src/navigation-link/hooks.js +0 -14
- package/src/navigation-link/index.js +1 -1
- package/src/navigation-link/test/__snapshots__/hooks.js.snap +0 -93
- package/src/navigation-link/test/hooks.js +0 -12
- package/src/navigation-submenu/edit.js +1 -0
- package/src/navigation-submenu/view.js +6 -1
- package/src/nextpage/edit.js +1 -3
- package/src/page-list/edit.js +12 -5
- package/src/paragraph/edit.js +8 -14
- package/src/post-comments-form/edit.js +3 -58
- package/src/post-comments-form/editor.scss +4 -0
- package/src/post-comments-form/form.js +81 -6
- package/src/post-comments-form/index.php +1 -1
- package/src/post-comments-form/style.scss +0 -1
- package/src/post-featured-image/index.php +4 -2
- package/src/post-template/index.php +23 -17
- package/src/post-template/style.scss +1 -7
- package/src/post-terms/edit.js +3 -2
- package/src/post-terms/index.js +1 -1
- package/src/post-title/block.json +1 -0
- package/src/query/edit/inspector-controls/index.js +1 -1
- package/src/query/editor.scss +1 -1
- package/src/query/index.js +1 -1
- package/src/query-no-results/edit.js +2 -5
- package/src/query-no-results/index.php +10 -8
- package/src/query-pagination-next/edit.js +1 -0
- package/src/query-pagination-previous/edit.js +1 -0
- package/src/quote/deprecated.js +213 -99
- package/src/quote/edit.js +77 -52
- package/src/quote/index.js +10 -33
- package/src/quote/save.js +5 -5
- package/src/quote/{v2/test → test}/migrate.js +2 -7
- package/src/quote/transforms.js +117 -147
- package/src/search/edit.js +2 -2
- package/src/search/index.php +12 -10
- package/src/search/style.scss +9 -8
- package/src/search/theme.scss +5 -0
- package/src/site-logo/edit.js +2 -11
- package/src/site-title/edit/level-toolbar.js +1 -0
- package/src/social-link/editor.scss +3 -0
- package/src/social-link/icons/index.js +1 -0
- package/src/social-link/icons/whatsapp.js +10 -0
- package/src/social-link/index.php +20 -0
- package/src/social-link/socials-with-bg.scss +5 -0
- package/src/social-link/socials-without-bg.scss +5 -0
- package/src/social-link/variations.js +7 -0
- package/src/style.scss +1 -1
- package/src/table/edit.js +2 -0
- package/src/table/save.js +6 -1
- package/src/template-part/edit/index.js +37 -24
- package/src/template-part/edit/selection-modal.js +68 -40
- package/src/template-part/edit/utils/search.js +76 -0
- package/src/template-part/editor.scss +21 -9
- package/src/template-part/index.js +1 -1
- package/src/template-part/index.php +56 -2
- package/src/template-part/variations.js +0 -11
- package/src/utils/clean-empty-object.js +8 -2
- package/src/video/edit.js +4 -0
- package/src/video/save.js +10 -2
- package/src/video/tracks-editor.js +1 -1
- package/build/comments/edit.js.map +0 -1
- package/build/gallery/use-short-code-transform.js +0 -64
- package/build/gallery/use-short-code-transform.js.map +0 -1
- package/build/list-item/hooks/use-backspace.js +0 -59
- package/build/list-item/hooks/use-backspace.js.map +0 -1
- package/build/navigation-link/fallback-variations.js +0 -75
- package/build/navigation-link/fallback-variations.js.map +0 -1
- package/build/post-comments/edit.js +0 -184
- package/build/post-comments/edit.js.map +0 -1
- package/build/post-comments/index.js +0 -72
- package/build/post-comments/index.js.map +0 -1
- package/build/quote/v2/deprecated.js +0 -133
- package/build/quote/v2/deprecated.js.map +0 -1
- package/build/quote/v2/edit.js +0 -139
- package/build/quote/v2/edit.js.map +0 -1
- package/build/quote/v2/index.js +0 -49
- package/build/quote/v2/index.js.map +0 -1
- package/build/quote/v2/save.js +0 -43
- package/build/quote/v2/save.js.map +0 -1
- package/build/quote/v2/transforms.js +0 -156
- package/build/quote/v2/transforms.js.map +0 -1
- package/build/template-part/fallback-variations.js +0 -59
- package/build/template-part/fallback-variations.js.map +0 -1
- package/build-module/comments/edit.js +0 -51
- package/build-module/comments/edit.js.map +0 -1
- package/build-module/gallery/use-short-code-transform.js +0 -54
- package/build-module/gallery/use-short-code-transform.js.map +0 -1
- package/build-module/list-item/hooks/use-backspace.js +0 -44
- package/build-module/list-item/hooks/use-backspace.js.map +0 -1
- package/build-module/navigation-link/fallback-variations.js +0 -65
- package/build-module/navigation-link/fallback-variations.js.map +0 -1
- package/build-module/post-comments/edit.js +0 -171
- package/build-module/post-comments/edit.js.map +0 -1
- package/build-module/post-comments/index.js +0 -59
- package/build-module/post-comments/index.js.map +0 -1
- package/build-module/quote/v2/deprecated.js +0 -116
- package/build-module/quote/v2/deprecated.js.map +0 -1
- package/build-module/quote/v2/edit.js +0 -122
- package/build-module/quote/v2/edit.js.map +0 -1
- package/build-module/quote/v2/index.js +0 -33
- package/build-module/quote/v2/index.js.map +0 -1
- package/build-module/quote/v2/save.js +0 -30
- package/build-module/quote/v2/save.js.map +0 -1
- package/build-module/quote/v2/transforms.js +0 -147
- package/build-module/quote/v2/transforms.js.map +0 -1
- package/build-module/template-part/fallback-variations.js +0 -47
- package/build-module/template-part/fallback-variations.js.map +0 -1
- package/src/gallery/use-short-code-transform.js +0 -55
- package/src/list-item/hooks/use-backspace.js +0 -51
- package/src/navigation-link/fallback-variations.js +0 -65
- package/src/post-comments/block.json +0 -45
- package/src/post-comments/edit.js +0 -247
- package/src/post-comments/editor.scss +0 -3
- package/src/post-comments/index.js +0 -18
- package/src/post-comments/index.php +0 -87
- package/src/quote/v2/deprecated.js +0 -107
- package/src/quote/v2/edit.js +0 -139
- package/src/quote/v2/index.js +0 -36
- package/src/quote/v2/save.js +0 -26
- package/src/quote/v2/transforms.js +0 -155
- package/src/template-part/fallback-variations.js +0 -51
|
@@ -2,28 +2,14 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
initializeEditor,
|
|
5
|
+
addBlock,
|
|
7
6
|
fireEvent,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
getBlock,
|
|
8
|
+
getInnerBlock,
|
|
9
|
+
initializeEditor,
|
|
10
|
+
triggerBlockListLayout,
|
|
11
11
|
} from 'test/helpers';
|
|
12
12
|
|
|
13
|
-
/**
|
|
14
|
-
* WordPress dependencies
|
|
15
|
-
*/
|
|
16
|
-
import {
|
|
17
|
-
requestMediaPicker,
|
|
18
|
-
subscribeMediaUpload,
|
|
19
|
-
} from '@wordpress/react-native-bridge';
|
|
20
|
-
import {
|
|
21
|
-
MEDIA_UPLOAD_STATE_UPLOADING,
|
|
22
|
-
MEDIA_UPLOAD_STATE_SUCCEEDED,
|
|
23
|
-
MEDIA_UPLOAD_STATE_FAILED,
|
|
24
|
-
MEDIA_UPLOAD_STATE_RESET,
|
|
25
|
-
} from '@wordpress/block-editor';
|
|
26
|
-
|
|
27
13
|
/**
|
|
28
14
|
* Adds a Gallery block via the block picker.
|
|
29
15
|
*
|
|
@@ -31,54 +17,10 @@ import {
|
|
|
31
17
|
*/
|
|
32
18
|
export const addGalleryBlock = async () => {
|
|
33
19
|
const screen = await initializeEditor();
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
fireEvent.press( getByA11yLabel( 'Add block' ) );
|
|
37
|
-
|
|
38
|
-
const blockList = getByTestId( 'InserterUI-Blocks' );
|
|
39
|
-
// onScroll event used to force the FlatList to render all items
|
|
40
|
-
fireEvent.scroll( blockList, {
|
|
41
|
-
nativeEvent: {
|
|
42
|
-
contentOffset: { y: 0, x: 0 },
|
|
43
|
-
contentSize: { width: 100, height: 100 },
|
|
44
|
-
layoutMeasurement: { width: 100, height: 100 },
|
|
45
|
-
},
|
|
46
|
-
} );
|
|
47
|
-
|
|
48
|
-
fireEvent.press( await waitFor( () => getByText( 'Gallery' ) ) );
|
|
49
|
-
|
|
20
|
+
await addBlock( screen, 'Gallery' );
|
|
50
21
|
return screen;
|
|
51
22
|
};
|
|
52
23
|
|
|
53
|
-
/**
|
|
54
|
-
* The gallery items are rendered via the FlatList of the inner block list.
|
|
55
|
-
* In order to render the items of a FlatList, it's required to trigger the
|
|
56
|
-
* "onLayout" event. Additionally, the call is wrapped over "waitForStoreResolvers"
|
|
57
|
-
* because the gallery items request the media data associated with the image to
|
|
58
|
-
* be rendered via the "getMedia" selector.
|
|
59
|
-
*
|
|
60
|
-
* @param {import('react-test-renderer').ReactTestInstance} galleryBlock Gallery block instance to trigger layout event.
|
|
61
|
-
* @param {Object} [options] Configuration options for the event.
|
|
62
|
-
* @param {number} [options.width] Width value to be passed to the event.
|
|
63
|
-
*/
|
|
64
|
-
export const triggerGalleryLayout = async (
|
|
65
|
-
galleryBlock,
|
|
66
|
-
{ width = 320 } = {}
|
|
67
|
-
) =>
|
|
68
|
-
waitForStoreResolvers( () =>
|
|
69
|
-
fireEvent(
|
|
70
|
-
within( galleryBlock ).getByTestId( 'block-list-wrapper' ),
|
|
71
|
-
'layout',
|
|
72
|
-
{
|
|
73
|
-
nativeEvent: {
|
|
74
|
-
layout: {
|
|
75
|
-
width,
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
}
|
|
79
|
-
)
|
|
80
|
-
);
|
|
81
|
-
|
|
82
24
|
/**
|
|
83
25
|
* Initialize the editor with HTML generated of Gallery block.
|
|
84
26
|
*
|
|
@@ -106,12 +48,11 @@ export const initializeWithGalleryBlock = async ( {
|
|
|
106
48
|
useLocalUrl,
|
|
107
49
|
} );
|
|
108
50
|
const screen = await initializeEditor( { initialHtml } );
|
|
109
|
-
const { getByA11yLabel } = screen;
|
|
110
51
|
|
|
111
|
-
const galleryBlock =
|
|
52
|
+
const galleryBlock = getBlock( screen, 'Gallery' );
|
|
112
53
|
|
|
113
54
|
if ( numberOfItems > 0 ) {
|
|
114
|
-
await
|
|
55
|
+
await triggerBlockListLayout( galleryBlock, { width } );
|
|
115
56
|
}
|
|
116
57
|
|
|
117
58
|
if ( selected ) {
|
|
@@ -125,109 +66,11 @@ export const initializeWithGalleryBlock = async ( {
|
|
|
125
66
|
* Gets a gallery item within a Gallery block.
|
|
126
67
|
*
|
|
127
68
|
* @param {import('react-test-renderer').ReactTestInstance} galleryBlock Gallery block instance.
|
|
128
|
-
* @param {number}
|
|
69
|
+
* @param {number} rowIndex Row position within the Gallery block.
|
|
129
70
|
* @return {import('react-test-renderer').ReactTestInstance} Gallery item.
|
|
130
71
|
*/
|
|
131
|
-
export const getGalleryItem = ( galleryBlock,
|
|
132
|
-
|
|
133
|
-
new RegExp( `Image Block\\. Row ${ rowPosition }` )
|
|
134
|
-
);
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Sets up the media upload mock functions for testing.
|
|
139
|
-
*
|
|
140
|
-
* @typedef {Object} MediaUploadMockFunctions
|
|
141
|
-
* @property {Function} notifyUploadingState Notify uploading state for a media item.
|
|
142
|
-
* @property {Function} notifySucceedState Notify succeed state for a media item.
|
|
143
|
-
* @property {Function} notifyFailedState Notify failed state for a media item.
|
|
144
|
-
* @property {Function} notifyResetState Notify reset state for a media item.
|
|
145
|
-
*
|
|
146
|
-
* @return {MediaUploadMockFunctions} Notify state functions.
|
|
147
|
-
*/
|
|
148
|
-
export const setupMediaUpload = () => {
|
|
149
|
-
const mediaUploadListeners = [];
|
|
150
|
-
subscribeMediaUpload.mockImplementation( ( callback ) => {
|
|
151
|
-
mediaUploadListeners.push( callback );
|
|
152
|
-
return { remove: jest.fn() };
|
|
153
|
-
} );
|
|
154
|
-
const notifyMediaUpload = ( payload ) =>
|
|
155
|
-
mediaUploadListeners.forEach( ( listener ) => listener( payload ) );
|
|
156
|
-
|
|
157
|
-
return {
|
|
158
|
-
notifyUploadingState: async ( mediaItem ) =>
|
|
159
|
-
act( async () => {
|
|
160
|
-
notifyMediaUpload( {
|
|
161
|
-
state: MEDIA_UPLOAD_STATE_UPLOADING,
|
|
162
|
-
mediaId: mediaItem.localId,
|
|
163
|
-
progress: 0.25,
|
|
164
|
-
} );
|
|
165
|
-
} ),
|
|
166
|
-
notifySucceedState: async ( mediaItem ) =>
|
|
167
|
-
act( async () => {
|
|
168
|
-
notifyMediaUpload( {
|
|
169
|
-
state: MEDIA_UPLOAD_STATE_SUCCEEDED,
|
|
170
|
-
mediaId: mediaItem.localId,
|
|
171
|
-
mediaUrl: mediaItem.serverUrl,
|
|
172
|
-
mediaServerId: mediaItem.serverId,
|
|
173
|
-
} );
|
|
174
|
-
} ),
|
|
175
|
-
notifyFailedState: async ( mediaItem ) =>
|
|
176
|
-
act( async () => {
|
|
177
|
-
notifyMediaUpload( {
|
|
178
|
-
state: MEDIA_UPLOAD_STATE_FAILED,
|
|
179
|
-
mediaId: mediaItem.localId,
|
|
180
|
-
progress: 0.5,
|
|
181
|
-
} );
|
|
182
|
-
} ),
|
|
183
|
-
notifyResetState: async ( mediaItem ) =>
|
|
184
|
-
act( async () => {
|
|
185
|
-
notifyMediaUpload( {
|
|
186
|
-
state: MEDIA_UPLOAD_STATE_RESET,
|
|
187
|
-
mediaId: mediaItem.localId,
|
|
188
|
-
progress: 0,
|
|
189
|
-
} );
|
|
190
|
-
} ),
|
|
191
|
-
};
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
*
|
|
196
|
-
* Sets up Media Picker mock functions.
|
|
197
|
-
*
|
|
198
|
-
* @typedef {Object} MediaPickerMockFunctions
|
|
199
|
-
* @property {Function} expectMediaPickerCall Checks if the request media picker function has been called with specific arguments.
|
|
200
|
-
* @property {Function} mediaPickerCallback Callback function to notify the media items picked from the media picker.
|
|
201
|
-
*
|
|
202
|
-
* @return {MediaPickerMockFunctions} Media picker mock functions.
|
|
203
|
-
*/
|
|
204
|
-
export const setupMediaPicker = () => {
|
|
205
|
-
let mediaPickerCallback;
|
|
206
|
-
requestMediaPicker.mockImplementation(
|
|
207
|
-
( source, filter, multiple, callback ) => {
|
|
208
|
-
mediaPickerCallback = callback;
|
|
209
|
-
}
|
|
210
|
-
);
|
|
211
|
-
return {
|
|
212
|
-
expectMediaPickerCall: ( source, filter, multiple ) =>
|
|
213
|
-
expect( requestMediaPicker ).toHaveBeenCalledWith(
|
|
214
|
-
source,
|
|
215
|
-
filter,
|
|
216
|
-
multiple,
|
|
217
|
-
mediaPickerCallback
|
|
218
|
-
),
|
|
219
|
-
mediaPickerCallback: async ( ...mediaItems ) =>
|
|
220
|
-
act( async () =>
|
|
221
|
-
mediaPickerCallback(
|
|
222
|
-
mediaItems.map( ( { localId, localUrl } ) => ( {
|
|
223
|
-
type: 'image',
|
|
224
|
-
url: localUrl,
|
|
225
|
-
id: localId,
|
|
226
|
-
} ) )
|
|
227
|
-
)
|
|
228
|
-
),
|
|
229
|
-
};
|
|
230
|
-
};
|
|
72
|
+
export const getGalleryItem = ( galleryBlock, rowIndex ) =>
|
|
73
|
+
getInnerBlock( galleryBlock, 'Image', { rowIndex } );
|
|
231
74
|
|
|
232
75
|
/**
|
|
233
76
|
* Generates the HTML of a Gallery block.
|
|
@@ -261,33 +104,3 @@ export const generateGalleryBlock = (
|
|
|
261
104
|
<figure class="wp-block-gallery has-nested-images columns-default is-cropped">${ galleryItems }</figure>
|
|
262
105
|
<!-- /wp:gallery -->`;
|
|
263
106
|
};
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* Sets the text of a caption.
|
|
267
|
-
*
|
|
268
|
-
* @param {import('react-test-renderer').ReactTestInstance} element Caption test instance.
|
|
269
|
-
* @param {string} text Text to be set.
|
|
270
|
-
*/
|
|
271
|
-
export const setCaption = ( element, text ) => {
|
|
272
|
-
fireEvent( element, 'focus' );
|
|
273
|
-
fireEvent( element, 'onChange', {
|
|
274
|
-
nativeEvent: {
|
|
275
|
-
eventCount: 1,
|
|
276
|
-
target: undefined,
|
|
277
|
-
text,
|
|
278
|
-
},
|
|
279
|
-
} );
|
|
280
|
-
};
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* Opens the block settings of the current selected block.
|
|
284
|
-
*
|
|
285
|
-
* @param {import('@testing-library/react-native').RenderAPI} screen The Testing Library screen.
|
|
286
|
-
*/
|
|
287
|
-
export const openBlockSettings = async ( screen ) => {
|
|
288
|
-
const { getByA11yLabel, getByTestId } = screen;
|
|
289
|
-
fireEvent.press( getByA11yLabel( 'Open Settings' ) );
|
|
290
|
-
await waitFor(
|
|
291
|
-
() => getByTestId( 'block-settings-modal' ).props.isVisible
|
|
292
|
-
);
|
|
293
|
-
};
|
|
@@ -3,17 +3,22 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
5
|
act,
|
|
6
|
+
changeTextOfRichText,
|
|
7
|
+
fireEvent,
|
|
8
|
+
getBlock,
|
|
6
9
|
getEditorHtml,
|
|
7
10
|
initializeEditor,
|
|
8
|
-
|
|
11
|
+
openBlockSettings,
|
|
12
|
+
setupCoreBlocks,
|
|
13
|
+
setupMediaPicker,
|
|
14
|
+
setupMediaUpload,
|
|
15
|
+
triggerBlockListLayout,
|
|
9
16
|
within,
|
|
10
17
|
} from 'test/helpers';
|
|
11
18
|
|
|
12
19
|
/**
|
|
13
20
|
* WordPress dependencies
|
|
14
21
|
*/
|
|
15
|
-
import { getBlockTypes, unregisterBlockType } from '@wordpress/blocks';
|
|
16
|
-
import { registerCoreBlocks } from '@wordpress/block-library';
|
|
17
22
|
import { Platform } from '@wordpress/element';
|
|
18
23
|
import {
|
|
19
24
|
getOtherMediaOptions,
|
|
@@ -28,12 +33,7 @@ import {
|
|
|
28
33
|
addGalleryBlock,
|
|
29
34
|
initializeWithGalleryBlock,
|
|
30
35
|
getGalleryItem,
|
|
31
|
-
setupMediaUpload,
|
|
32
36
|
generateGalleryBlock,
|
|
33
|
-
setCaption,
|
|
34
|
-
setupMediaPicker,
|
|
35
|
-
triggerGalleryLayout,
|
|
36
|
-
openBlockSettings,
|
|
37
37
|
} from './helpers';
|
|
38
38
|
|
|
39
39
|
const media = [
|
|
@@ -57,23 +57,13 @@ const media = [
|
|
|
57
57
|
},
|
|
58
58
|
];
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
// Register all core blocks
|
|
62
|
-
registerCoreBlocks();
|
|
63
|
-
} );
|
|
64
|
-
|
|
65
|
-
afterAll( () => {
|
|
66
|
-
// Clean up registered blocks
|
|
67
|
-
getBlockTypes().forEach( ( block ) => {
|
|
68
|
-
unregisterBlockType( block.name );
|
|
69
|
-
} );
|
|
70
|
-
} );
|
|
60
|
+
setupCoreBlocks();
|
|
71
61
|
|
|
72
62
|
describe( 'Gallery block', () => {
|
|
73
63
|
it( 'inserts block', async () => {
|
|
74
|
-
const
|
|
64
|
+
const screen = await addGalleryBlock();
|
|
75
65
|
|
|
76
|
-
expect(
|
|
66
|
+
expect( getBlock( screen, 'Gallery' ) ).toBeVisible();
|
|
77
67
|
expect( getEditorHtml() ).toMatchSnapshot();
|
|
78
68
|
} );
|
|
79
69
|
|
|
@@ -183,7 +173,7 @@ describe( 'Gallery block', () => {
|
|
|
183
173
|
const captionField = within(
|
|
184
174
|
getByA11yLabel( /Gallery caption. Empty/ )
|
|
185
175
|
).getByPlaceholderText( 'Add caption' );
|
|
186
|
-
|
|
176
|
+
changeTextOfRichText(
|
|
187
177
|
captionField,
|
|
188
178
|
'<strong>Bold</strong> <em>italic</em> <s>strikethrough</s> gallery caption'
|
|
189
179
|
);
|
|
@@ -207,7 +197,7 @@ describe( 'Gallery block', () => {
|
|
|
207
197
|
// Set gallery item caption
|
|
208
198
|
const captionField =
|
|
209
199
|
within( galleryItem ).getByPlaceholderText( 'Add caption' );
|
|
210
|
-
|
|
200
|
+
changeTextOfRichText(
|
|
211
201
|
captionField,
|
|
212
202
|
'<strong>Bold</strong> <em>italic</em> <s>strikethrough</s> image caption'
|
|
213
203
|
);
|
|
@@ -234,7 +224,7 @@ describe( 'Gallery block', () => {
|
|
|
234
224
|
await mediaPickerCallback( media[ 0 ], media[ 1 ] );
|
|
235
225
|
|
|
236
226
|
// Check that gallery items are visible
|
|
237
|
-
await
|
|
227
|
+
await triggerBlockListLayout( galleryBlock );
|
|
238
228
|
const galleryItem1 = getGalleryItem( galleryBlock, 1 );
|
|
239
229
|
const galleryItem2 = getGalleryItem( galleryBlock, 2 );
|
|
240
230
|
expect( galleryItem1 ).toBeVisible();
|
|
@@ -272,7 +262,7 @@ describe( 'Gallery block', () => {
|
|
|
272
262
|
await mediaPickerCallback( media[ 0 ], media[ 1 ] );
|
|
273
263
|
|
|
274
264
|
// Check that gallery items are visible
|
|
275
|
-
await
|
|
265
|
+
await triggerBlockListLayout( galleryBlock );
|
|
276
266
|
const galleryItem1 = getGalleryItem( galleryBlock, 1 );
|
|
277
267
|
const galleryItem2 = getGalleryItem( galleryBlock, 2 );
|
|
278
268
|
expect( galleryItem1 ).toBeVisible();
|
|
@@ -326,7 +316,7 @@ describe( 'Gallery block', () => {
|
|
|
326
316
|
await mediaPickerCallback( media[ 0 ] );
|
|
327
317
|
|
|
328
318
|
// Check gallery item is visible
|
|
329
|
-
await
|
|
319
|
+
await triggerBlockListLayout( galleryBlock );
|
|
330
320
|
const galleryItem = getGalleryItem( galleryBlock, 1 );
|
|
331
321
|
expect( galleryItem ).toBeVisible();
|
|
332
322
|
|
|
@@ -382,7 +372,7 @@ describe( 'Gallery block', () => {
|
|
|
382
372
|
);
|
|
383
373
|
|
|
384
374
|
// Check that gallery items are visible
|
|
385
|
-
await
|
|
375
|
+
await triggerBlockListLayout( galleryBlock );
|
|
386
376
|
const galleryItem1 = getGalleryItem( galleryBlock, 1 );
|
|
387
377
|
const galleryItem2 = getGalleryItem( galleryBlock, 2 );
|
|
388
378
|
expect( galleryItem1 ).toBeVisible();
|
|
@@ -420,7 +410,7 @@ describe( 'Gallery block', () => {
|
|
|
420
410
|
await mediaPickerCallback( media[ 0 ], media[ 1 ] );
|
|
421
411
|
|
|
422
412
|
// Check that gallery items are visible
|
|
423
|
-
await
|
|
413
|
+
await triggerBlockListLayout( galleryBlock );
|
|
424
414
|
const galleryItem1 = getGalleryItem( galleryBlock, 1 );
|
|
425
415
|
const galleryItem2 = getGalleryItem( galleryBlock, 2 );
|
|
426
416
|
expect( galleryItem1 ).toBeVisible();
|
|
@@ -519,7 +509,7 @@ describe( 'Gallery block', () => {
|
|
|
519
509
|
await mediaPickerCallback( otherAppsMedia[ 0 ], otherAppsMedia[ 1 ] );
|
|
520
510
|
|
|
521
511
|
// Check that gallery items are visible
|
|
522
|
-
await
|
|
512
|
+
await triggerBlockListLayout( galleryBlock );
|
|
523
513
|
const galleryItem1 = getGalleryItem( galleryBlock, 1 );
|
|
524
514
|
const galleryItem2 = getGalleryItem( galleryBlock, 2 );
|
|
525
515
|
expect( galleryItem1 ).toBeVisible();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { filter, every
|
|
4
|
+
import { filter, every } from 'lodash';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -160,7 +160,7 @@ const transforms = {
|
|
|
160
160
|
return createBlock( 'core/gallery', {
|
|
161
161
|
images: validImages.map(
|
|
162
162
|
( { id, url, alt, caption } ) => ( {
|
|
163
|
-
id: toString(
|
|
163
|
+
id: id.toString(),
|
|
164
164
|
url,
|
|
165
165
|
alt,
|
|
166
166
|
caption,
|
|
@@ -182,7 +182,7 @@ const transforms = {
|
|
|
182
182
|
shortcode: ( { named: { ids } } ) => {
|
|
183
183
|
if ( ! isGalleryV2Enabled() ) {
|
|
184
184
|
return parseShortcodeIds( ids ).map( ( id ) => ( {
|
|
185
|
-
id: toString(
|
|
185
|
+
id: id.toString(),
|
|
186
186
|
} ) );
|
|
187
187
|
}
|
|
188
188
|
},
|
|
@@ -195,16 +195,6 @@ const transforms = {
|
|
|
195
195
|
}
|
|
196
196
|
},
|
|
197
197
|
},
|
|
198
|
-
shortCodeTransforms: {
|
|
199
|
-
type: 'array',
|
|
200
|
-
shortcode: ( { named: { ids } } ) => {
|
|
201
|
-
if ( isGalleryV2Enabled() ) {
|
|
202
|
-
return parseShortcodeIds( ids ).map( ( id ) => ( {
|
|
203
|
-
id: parseInt( id ),
|
|
204
|
-
} ) );
|
|
205
|
-
}
|
|
206
|
-
},
|
|
207
|
-
},
|
|
208
198
|
columns: {
|
|
209
199
|
type: 'number',
|
|
210
200
|
shortcode: ( { named: { columns = '3' } } ) => {
|
|
@@ -235,6 +225,31 @@ const transforms = {
|
|
|
235
225
|
},
|
|
236
226
|
},
|
|
237
227
|
},
|
|
228
|
+
transform( { named: { ids, columns = 3, link } } ) {
|
|
229
|
+
const imageIds = parseShortcodeIds( ids ).map( ( id ) =>
|
|
230
|
+
parseInt( id, 10 )
|
|
231
|
+
);
|
|
232
|
+
|
|
233
|
+
let linkTo = LINK_DESTINATION_NONE;
|
|
234
|
+
if ( link === 'post' ) {
|
|
235
|
+
linkTo = LINK_DESTINATION_ATTACHMENT;
|
|
236
|
+
} else if ( link === 'file' ) {
|
|
237
|
+
linkTo = LINK_DESTINATION_MEDIA;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const galleryBlock = createBlock(
|
|
241
|
+
'core/gallery',
|
|
242
|
+
{
|
|
243
|
+
columns: parseInt( columns, 10 ),
|
|
244
|
+
linkTo,
|
|
245
|
+
},
|
|
246
|
+
imageIds.map( ( imageId ) =>
|
|
247
|
+
createBlock( 'core/image', { id: imageId } )
|
|
248
|
+
)
|
|
249
|
+
);
|
|
250
|
+
|
|
251
|
+
return galleryBlock;
|
|
252
|
+
},
|
|
238
253
|
isMatch( { named } ) {
|
|
239
254
|
return undefined !== named.ids;
|
|
240
255
|
},
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { useState } from '@wordpress/element';
|
|
5
4
|
import { useSelect } from '@wordpress/data';
|
|
6
5
|
import { store as coreStore } from '@wordpress/core-data';
|
|
7
6
|
|
|
7
|
+
const EMPTY_IMAGE_MEDIA = [];
|
|
8
|
+
|
|
8
9
|
/**
|
|
9
10
|
* Retrieves the extended media info for each gallery image from the store. This is used to
|
|
10
11
|
* determine which image size options are available for the current gallery.
|
|
@@ -14,42 +15,24 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
14
15
|
* @return {Array} An array of media info options for each gallery image.
|
|
15
16
|
*/
|
|
16
17
|
export default function useGetMedia( innerBlockImages ) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const imageMedia = useSelect(
|
|
18
|
+
return useSelect(
|
|
20
19
|
( select ) => {
|
|
21
|
-
if ( ! innerBlockImages?.length ) {
|
|
22
|
-
return currentImageMedia;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
20
|
const imageIds = innerBlockImages
|
|
26
21
|
.map( ( imageBlock ) => imageBlock.attributes.id )
|
|
27
22
|
.filter( ( id ) => id !== undefined );
|
|
28
23
|
|
|
29
24
|
if ( imageIds.length === 0 ) {
|
|
30
|
-
return
|
|
25
|
+
return EMPTY_IMAGE_MEDIA;
|
|
31
26
|
}
|
|
32
27
|
|
|
33
|
-
return
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
28
|
+
return (
|
|
29
|
+
select( coreStore ).getMediaItems( {
|
|
30
|
+
include: imageIds.join( ',' ),
|
|
31
|
+
per_page: imageIds.length,
|
|
32
|
+
orderby: 'include',
|
|
33
|
+
} ) ?? EMPTY_IMAGE_MEDIA
|
|
34
|
+
);
|
|
38
35
|
},
|
|
39
36
|
[ innerBlockImages ]
|
|
40
37
|
);
|
|
41
|
-
|
|
42
|
-
if (
|
|
43
|
-
imageMedia?.length !== currentImageMedia?.length ||
|
|
44
|
-
imageMedia?.some(
|
|
45
|
-
( newImage ) =>
|
|
46
|
-
! currentImageMedia.find(
|
|
47
|
-
( currentImage ) => currentImage.id === newImage.id
|
|
48
|
-
)
|
|
49
|
-
)
|
|
50
|
-
) {
|
|
51
|
-
setCurrentImageMedia( imageMedia );
|
|
52
|
-
return imageMedia;
|
|
53
|
-
}
|
|
54
|
-
return currentImageMedia;
|
|
55
38
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useSelect } from '@wordpress/data';
|
|
5
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
6
|
+
|
|
7
|
+
const EMPTY_IMAGE_MEDIA = [];
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Retrieves the extended media info for each gallery image from the store. This is used to
|
|
11
|
+
* determine which image size options are available for the current gallery.
|
|
12
|
+
*
|
|
13
|
+
* @param {Array} innerBlockImages An array of the innerBlock images currently in the gallery.
|
|
14
|
+
*
|
|
15
|
+
* @return {Array} An array of media info options for each gallery image.
|
|
16
|
+
*/
|
|
17
|
+
export default function useGetMedia( innerBlockImages ) {
|
|
18
|
+
return useSelect(
|
|
19
|
+
( select ) => {
|
|
20
|
+
const imagesUploading = innerBlockImages.some(
|
|
21
|
+
( { attributes } ) => attributes?.url?.indexOf( 'file:' ) === 0
|
|
22
|
+
);
|
|
23
|
+
const imageIds = innerBlockImages
|
|
24
|
+
.filter( ( { attributes } ) => {
|
|
25
|
+
const { id, url } = attributes;
|
|
26
|
+
return id !== undefined && url?.indexOf( 'file:' ) !== 0;
|
|
27
|
+
} )
|
|
28
|
+
.map( ( imageBlock ) => imageBlock.attributes.id );
|
|
29
|
+
|
|
30
|
+
if ( imageIds.length === 0 || imagesUploading ) {
|
|
31
|
+
return EMPTY_IMAGE_MEDIA;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
select( coreStore ).getMediaItems( {
|
|
36
|
+
include: imageIds.join( ',' ),
|
|
37
|
+
per_page: imageIds.length,
|
|
38
|
+
orderby: 'include',
|
|
39
|
+
} ) ?? EMPTY_IMAGE_MEDIA
|
|
40
|
+
);
|
|
41
|
+
},
|
|
42
|
+
[ innerBlockImages ]
|
|
43
|
+
);
|
|
44
|
+
}
|
package/src/gallery/v1/edit.js
CHANGED
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
map,
|
|
12
12
|
reduce,
|
|
13
13
|
some,
|
|
14
|
-
toString,
|
|
15
14
|
} from 'lodash';
|
|
16
15
|
|
|
17
16
|
/**
|
|
@@ -226,7 +225,7 @@ function GalleryEdit( props ) {
|
|
|
226
225
|
// The image id in both the images and attachmentCaptions arrays is a
|
|
227
226
|
// string, so ensure comparison works correctly by converting the
|
|
228
227
|
// newImage.id to a string.
|
|
229
|
-
const newImageId =
|
|
228
|
+
const newImageId = newImage.id.toString();
|
|
230
229
|
const currentImage = find( images, { id: newImageId } );
|
|
231
230
|
const currentImageCaption = currentImage
|
|
232
231
|
? currentImage.caption
|
|
@@ -253,7 +252,7 @@ function GalleryEdit( props ) {
|
|
|
253
252
|
newImages.map( ( newImage ) => ( {
|
|
254
253
|
// Store the attachmentCaption id as a string for consistency
|
|
255
254
|
// with the type of the id in the images attribute.
|
|
256
|
-
id:
|
|
255
|
+
id: newImage.id.toString(),
|
|
257
256
|
caption: newImage.caption,
|
|
258
257
|
} ) )
|
|
259
258
|
);
|
|
@@ -264,7 +263,7 @@ function GalleryEdit( props ) {
|
|
|
264
263
|
// The id value is stored in a data attribute, so when the
|
|
265
264
|
// block is parsed it's converted to a string. Converting
|
|
266
265
|
// to a string here ensures it's type is consistent.
|
|
267
|
-
id:
|
|
266
|
+
id: newImage.id.toString(),
|
|
268
267
|
} ) ),
|
|
269
268
|
columns: attributes.columns
|
|
270
269
|
? Math.min( newImages.length, attributes.columns )
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
RichText,
|
|
17
17
|
MediaPlaceholder,
|
|
18
18
|
store as blockEditorStore,
|
|
19
|
+
__experimentalGetElementClassName,
|
|
19
20
|
} from '@wordpress/block-editor';
|
|
20
21
|
import { isBlobURL } from '@wordpress/blob';
|
|
21
22
|
import { compose } from '@wordpress/compose';
|
|
@@ -245,6 +246,9 @@ class GalleryImage extends Component {
|
|
|
245
246
|
{ ! isEditing && ( isSelected || caption ) && (
|
|
246
247
|
<RichText
|
|
247
248
|
tagName="figcaption"
|
|
249
|
+
className={ __experimentalGetElementClassName(
|
|
250
|
+
'caption'
|
|
251
|
+
) }
|
|
248
252
|
aria-label={ __( 'Image caption text' ) }
|
|
249
253
|
placeholder={ isSelected ? __( 'Add caption' ) : null }
|
|
250
254
|
value={ caption }
|
|
@@ -6,7 +6,10 @@ import classnames from 'classnames';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
RichText,
|
|
11
|
+
__experimentalGetElementClassName,
|
|
12
|
+
} from '@wordpress/block-editor';
|
|
10
13
|
import { VisuallyHidden } from '@wordpress/components';
|
|
11
14
|
import { __, sprintf } from '@wordpress/i18n';
|
|
12
15
|
import { createBlock, getDefaultBlockName } from '@wordpress/blocks';
|
|
@@ -94,7 +97,10 @@ export const Gallery = ( props ) => {
|
|
|
94
97
|
<RichTextVisibilityHelper
|
|
95
98
|
isHidden={ ! isSelected && RichText.isEmpty( caption ) }
|
|
96
99
|
tagName="figcaption"
|
|
97
|
-
className=
|
|
100
|
+
className={ classnames(
|
|
101
|
+
'blocks-gallery-caption',
|
|
102
|
+
__experimentalGetElementClassName( 'caption' )
|
|
103
|
+
) }
|
|
98
104
|
aria-label={ __( 'Gallery caption text' ) }
|
|
99
105
|
placeholder={ __( 'Write gallery caption…' ) }
|
|
100
106
|
value={ caption }
|
package/src/gallery/v1/save.js
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* WordPress dependencies
|
|
3
8
|
*/
|
|
4
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
RichText,
|
|
11
|
+
useBlockProps,
|
|
12
|
+
__experimentalGetElementClassName,
|
|
13
|
+
} from '@wordpress/block-editor';
|
|
5
14
|
|
|
6
15
|
/**
|
|
7
16
|
* Internal dependencies
|
|
@@ -60,7 +69,12 @@ export default function saveV1( { attributes } ) {
|
|
|
60
69
|
{ ! RichText.isEmpty( image.caption ) && (
|
|
61
70
|
<RichText.Content
|
|
62
71
|
tagName="figcaption"
|
|
63
|
-
className=
|
|
72
|
+
className={ classnames(
|
|
73
|
+
'blocks-gallery-item',
|
|
74
|
+
__experimentalGetElementClassName(
|
|
75
|
+
'caption'
|
|
76
|
+
)
|
|
77
|
+
) }
|
|
64
78
|
value={ image.caption }
|
|
65
79
|
/>
|
|
66
80
|
) }
|
|
@@ -72,7 +86,10 @@ export default function saveV1( { attributes } ) {
|
|
|
72
86
|
{ ! RichText.isEmpty( caption ) && (
|
|
73
87
|
<RichText.Content
|
|
74
88
|
tagName="figcaption"
|
|
75
|
-
className=
|
|
89
|
+
className={ classnames(
|
|
90
|
+
'blocks-gallery-caption',
|
|
91
|
+
__experimentalGetElementClassName( 'caption' )
|
|
92
|
+
) }
|
|
76
93
|
value={ caption }
|
|
77
94
|
/>
|
|
78
95
|
) }
|