@wordpress/block-library 9.2.0 → 9.4.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 -0
- package/build/audio/edit.js +20 -8
- package/build/audio/edit.js.map +1 -1
- package/build/audio/index.js +4 -0
- package/build/audio/index.js.map +1 -1
- package/build/audio/transforms.js +1 -1
- package/build/audio/transforms.js.map +1 -1
- package/build/block/edit.js +38 -24
- package/build/block/edit.js.map +1 -1
- package/build/block/index.js +5 -1
- package/build/block/index.js.map +1 -1
- package/build/button/edit.js +1 -1
- package/build/button/edit.js.map +1 -1
- package/build/buttons/index.js +26 -0
- package/build/buttons/index.js.map +1 -1
- package/build/categories/edit.js +20 -3
- package/build/categories/edit.js.map +1 -1
- package/build/categories/index.js +8 -0
- package/build/categories/index.js.map +1 -1
- package/build/columns/index.js +2 -2
- package/build/columns/index.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +2 -1
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/embed/embed-preview.js +4 -4
- package/build/embed/embed-preview.js.map +1 -1
- package/build/embed/variations.js +39 -34
- package/build/embed/variations.js.map +1 -1
- package/build/file/edit.js +14 -6
- package/build/file/edit.js.map +1 -1
- package/build/file/index.js +4 -0
- package/build/file/index.js.map +1 -1
- package/build/file/transforms.js +2 -3
- package/build/file/transforms.js.map +1 -1
- package/build/footnotes/index.js +1 -1
- package/build/footnotes/index.js.map +1 -1
- package/build/form-input/edit.js +2 -0
- package/build/form-input/edit.js.map +1 -1
- package/build/gallery/deprecated.js +6 -54
- package/build/gallery/deprecated.js.map +1 -1
- package/build/gallery/edit.js +9 -8
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/index.js +12 -2
- package/build/gallery/index.js.map +1 -1
- package/build/gallery/save.js +0 -11
- package/build/gallery/save.js.map +1 -1
- package/build/gallery/shared.js +0 -27
- package/build/gallery/shared.js.map +1 -1
- package/build/gallery/transforms.js +29 -80
- package/build/gallery/transforms.js.map +1 -1
- package/build/group/deprecated.js +2 -5
- package/build/group/deprecated.js.map +1 -1
- package/build/group/index.js +1 -0
- package/build/group/index.js.map +1 -1
- package/build/group/placeholder.js +5 -0
- package/build/group/placeholder.js.map +1 -1
- package/build/heading/index.js +14 -1
- package/build/heading/index.js.map +1 -1
- package/build/image/edit.js +14 -22
- package/build/image/edit.js.map +1 -1
- package/build/image/image.js +54 -28
- package/build/image/image.js.map +1 -1
- package/build/image/index.js +7 -0
- package/build/image/index.js.map +1 -1
- package/build/image/transforms.js +1 -1
- package/build/image/transforms.js.map +1 -1
- package/build/image/view.js +65 -49
- package/build/image/view.js.map +1 -1
- package/build/latest-comments/index.js +9 -0
- package/build/latest-comments/index.js.map +1 -1
- package/build/list/edit.js +3 -3
- package/build/list/edit.js.map +1 -1
- package/build/list-item/edit.js +3 -3
- package/build/list-item/edit.js.map +1 -1
- package/build/list-item/hooks/index.js +0 -7
- package/build/list-item/hooks/index.js.map +1 -1
- package/build/list-item/hooks/use-merge.js +8 -1
- package/build/list-item/hooks/use-merge.js.map +1 -1
- package/build/list-item/index.js +11 -1
- package/build/list-item/index.js.map +1 -1
- package/build/loginout/index.js +3 -0
- package/build/loginout/index.js.map +1 -1
- package/build/media-text/edit.js +3 -2
- package/build/media-text/edit.js.map +1 -1
- package/build/media-text/index.js +12 -0
- package/build/media-text/index.js.map +1 -1
- package/build/navigation/edit/navigation-menu-delete-control.js +1 -0
- package/build/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build/navigation/use-navigation-menu.js +5 -1
- package/build/navigation/use-navigation-menu.js.map +1 -1
- package/build/navigation-link/link-ui.js +13 -17
- package/build/navigation-link/link-ui.js.map +1 -1
- package/build/navigation-submenu/edit.js +1 -12
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/page-list/convert-to-links-modal.js +1 -1
- package/build/page-list/convert-to-links-modal.js.map +1 -1
- package/build/page-list/edit.js +2 -1
- package/build/page-list/edit.js.map +1 -1
- package/build/page-list-item/edit.js +4 -1
- package/build/page-list-item/edit.js.map +1 -1
- package/build/paragraph/index.js +6 -0
- package/build/paragraph/index.js.map +1 -1
- package/build/paragraph/transforms.js +6 -0
- package/build/paragraph/transforms.js.map +1 -1
- package/build/post-author/index.js +8 -0
- package/build/post-author/index.js.map +1 -1
- package/build/post-author-biography/index.js +3 -0
- package/build/post-author-biography/index.js.map +1 -1
- package/build/post-author-name/index.js +3 -0
- package/build/post-author-name/index.js.map +1 -1
- package/build/post-content/index.js +3 -0
- package/build/post-content/index.js.map +1 -1
- package/build/post-date/edit.js +3 -1
- package/build/post-date/edit.js.map +1 -1
- package/build/post-date/index.js +3 -0
- package/build/post-date/index.js.map +1 -1
- package/build/post-excerpt/edit.js +1 -0
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-excerpt/index.js +3 -0
- package/build/post-excerpt/index.js.map +1 -1
- package/build/post-featured-image/index.js +3 -0
- package/build/post-featured-image/index.js.map +1 -1
- package/build/post-terms/index.js +3 -0
- package/build/post-terms/index.js.map +1 -1
- package/build/post-title/edit.js +5 -1
- package/build/post-title/edit.js.map +1 -1
- package/build/post-title/index.js +3 -0
- package/build/post-title/index.js.map +1 -1
- package/build/query/edit/inspector-controls/author-control.js +3 -1
- package/build/query/edit/inspector-controls/author-control.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +27 -8
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/inspector-controls/order-control.js +1 -0
- package/build/query/edit/inspector-controls/order-control.js.map +1 -1
- package/build/query/edit/inspector-controls/parent-control.js +2 -1
- package/build/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build/query/edit/inspector-controls/sticky-control.js +1 -0
- package/build/query/edit/inspector-controls/sticky-control.js.map +1 -1
- package/build/query/edit/inspector-controls/taxonomy-controls.js +5 -2
- package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build/query/edit/query-content.js +11 -2
- package/build/query/edit/query-content.js.map +1 -1
- package/build/query/edit/query-placeholder.js +1 -14
- package/build/query/edit/query-placeholder.js.map +1 -1
- package/build/query/edit/query-toolbar.js +54 -61
- package/build/query/edit/query-toolbar.js.map +1 -1
- package/build/query/index.js +34 -0
- package/build/query/index.js.map +1 -1
- package/build/query/utils.js +5 -1
- package/build/query/utils.js.map +1 -1
- package/build/query/variations.js +9 -55
- package/build/query/variations.js.map +1 -1
- package/build/query-pagination-numbers/edit.js +1 -0
- package/build/query-pagination-numbers/edit.js.map +1 -1
- package/build/query-title/edit.js +11 -19
- package/build/query-title/edit.js.map +1 -1
- package/build/query-title/use-archive-label.js +95 -0
- package/build/query-title/use-archive-label.js.map +1 -0
- package/build/quote/index.js +15 -1
- package/build/quote/index.js.map +1 -1
- package/build/search/index.js +3 -0
- package/build/search/index.js.map +1 -1
- package/build/site-logo/edit.js +4 -1
- package/build/site-logo/edit.js.map +1 -1
- package/build/site-tagline/edit.js +5 -2
- package/build/site-tagline/edit.js.map +1 -1
- package/build/site-tagline/index.js +6 -1
- package/build/site-tagline/index.js.map +1 -1
- package/build/site-title/edit.js +4 -1
- package/build/site-title/edit.js.map +1 -1
- package/build/site-title/index.js +6 -1
- package/build/site-title/index.js.map +1 -1
- package/build/social-link/edit.js +27 -7
- package/build/social-link/edit.js.map +1 -1
- package/build/social-link/icons/soundcloud.js +1 -1
- package/build/social-link/icons/soundcloud.js.map +1 -1
- package/build/social-links/index.js +12 -0
- package/build/social-links/index.js.map +1 -1
- package/build/table/edit.js +8 -17
- package/build/table/edit.js.map +1 -1
- package/build/tag-cloud/edit.js +4 -1
- package/build/tag-cloud/edit.js.map +1 -1
- package/build/template-part/edit/index.js +5 -3
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/edit/inner-blocks.js +8 -3
- package/build/template-part/edit/inner-blocks.js.map +1 -1
- package/build/template-part/edit/placeholder.js +23 -3
- package/build/template-part/edit/placeholder.js.map +1 -1
- package/build/template-part/edit/title-modal.js +21 -9
- package/build/template-part/edit/title-modal.js.map +1 -1
- package/build/term-description/index.js +12 -0
- package/build/term-description/index.js.map +1 -1
- package/build/utils/hooks.js +17 -1
- package/build/utils/hooks.js.map +1 -1
- package/build/video/deprecated.js +4 -0
- package/build/video/deprecated.js.map +1 -1
- package/build/video/edit.js +17 -7
- package/build/video/edit.js.map +1 -1
- package/build/video/index.js +4 -0
- package/build/video/index.js.map +1 -1
- package/build/video/transforms.js +1 -1
- package/build/video/transforms.js.map +1 -1
- package/build-module/audio/edit.js +20 -8
- package/build-module/audio/edit.js.map +1 -1
- package/build-module/audio/index.js +4 -0
- package/build-module/audio/index.js.map +1 -1
- package/build-module/audio/transforms.js +1 -1
- package/build-module/audio/transforms.js.map +1 -1
- package/build-module/block/edit.js +38 -24
- package/build-module/block/edit.js.map +1 -1
- package/build-module/block/index.js +5 -1
- package/build-module/block/index.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/index.js +26 -0
- package/build-module/buttons/index.js.map +1 -1
- package/build-module/categories/edit.js +21 -4
- package/build-module/categories/edit.js.map +1 -1
- package/build-module/categories/index.js +8 -0
- package/build-module/categories/index.js.map +1 -1
- package/build-module/columns/index.js +2 -2
- package/build-module/columns/index.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +2 -1
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/embed/embed-preview.js +4 -4
- package/build-module/embed/embed-preview.js.map +1 -1
- package/build-module/embed/variations.js +40 -35
- package/build-module/embed/variations.js.map +1 -1
- package/build-module/file/edit.js +15 -7
- package/build-module/file/edit.js.map +1 -1
- package/build-module/file/index.js +4 -0
- package/build-module/file/index.js.map +1 -1
- package/build-module/file/transforms.js +2 -3
- package/build-module/file/transforms.js.map +1 -1
- package/build-module/footnotes/index.js +1 -1
- package/build-module/footnotes/index.js.map +1 -1
- package/build-module/form-input/edit.js +2 -0
- package/build-module/form-input/edit.js.map +1 -1
- package/build-module/gallery/deprecated.js +6 -54
- package/build-module/gallery/deprecated.js.map +1 -1
- package/build-module/gallery/edit.js +10 -9
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/index.js +11 -1
- package/build-module/gallery/index.js.map +1 -1
- package/build-module/gallery/save.js +0 -11
- package/build-module/gallery/save.js.map +1 -1
- package/build-module/gallery/shared.js +0 -25
- package/build-module/gallery/shared.js.map +1 -1
- package/build-module/gallery/transforms.js +29 -80
- package/build-module/gallery/transforms.js.map +1 -1
- package/build-module/group/deprecated.js +2 -5
- package/build-module/group/deprecated.js.map +1 -1
- package/build-module/group/index.js +1 -0
- package/build-module/group/index.js.map +1 -1
- package/build-module/group/placeholder.js +5 -0
- package/build-module/group/placeholder.js.map +1 -1
- package/build-module/heading/index.js +14 -1
- package/build-module/heading/index.js.map +1 -1
- package/build-module/image/edit.js +13 -21
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/image.js +50 -24
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/index.js +7 -0
- package/build-module/image/index.js.map +1 -1
- package/build-module/image/transforms.js +1 -1
- package/build-module/image/transforms.js.map +1 -1
- package/build-module/image/view.js +65 -49
- package/build-module/image/view.js.map +1 -1
- package/build-module/latest-comments/index.js +9 -0
- package/build-module/latest-comments/index.js.map +1 -1
- package/build-module/list/edit.js +3 -3
- package/build-module/list/edit.js.map +1 -1
- package/build-module/list-item/edit.js +3 -3
- package/build-module/list-item/edit.js.map +1 -1
- package/build-module/list-item/hooks/index.js +0 -1
- package/build-module/list-item/hooks/index.js.map +1 -1
- package/build-module/list-item/hooks/use-merge.js +8 -1
- package/build-module/list-item/hooks/use-merge.js.map +1 -1
- package/build-module/list-item/index.js +11 -1
- package/build-module/list-item/index.js.map +1 -1
- package/build-module/loginout/index.js +3 -0
- package/build-module/loginout/index.js.map +1 -1
- package/build-module/media-text/edit.js +3 -2
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/media-text/index.js +12 -0
- package/build-module/media-text/index.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-delete-control.js +1 -0
- package/build-module/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build-module/navigation/use-navigation-menu.js +5 -1
- package/build-module/navigation/use-navigation-menu.js.map +1 -1
- package/build-module/navigation-link/link-ui.js +13 -17
- package/build-module/navigation-link/link-ui.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +1 -12
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/page-list/convert-to-links-modal.js +1 -1
- package/build-module/page-list/convert-to-links-modal.js.map +1 -1
- package/build-module/page-list/edit.js +2 -1
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/page-list-item/edit.js +4 -1
- package/build-module/page-list-item/edit.js.map +1 -1
- package/build-module/paragraph/index.js +6 -0
- package/build-module/paragraph/index.js.map +1 -1
- package/build-module/paragraph/transforms.js +6 -0
- package/build-module/paragraph/transforms.js.map +1 -1
- package/build-module/post-author/index.js +8 -0
- package/build-module/post-author/index.js.map +1 -1
- package/build-module/post-author-biography/index.js +3 -0
- package/build-module/post-author-biography/index.js.map +1 -1
- package/build-module/post-author-name/index.js +3 -0
- package/build-module/post-author-name/index.js.map +1 -1
- package/build-module/post-content/index.js +3 -0
- package/build-module/post-content/index.js.map +1 -1
- package/build-module/post-date/edit.js +4 -2
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-date/index.js +3 -0
- package/build-module/post-date/index.js.map +1 -1
- package/build-module/post-excerpt/edit.js +1 -0
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/post-excerpt/index.js +3 -0
- package/build-module/post-excerpt/index.js.map +1 -1
- package/build-module/post-featured-image/index.js +3 -0
- package/build-module/post-featured-image/index.js.map +1 -1
- package/build-module/post-terms/index.js +3 -0
- package/build-module/post-terms/index.js.map +1 -1
- package/build-module/post-title/edit.js +5 -1
- package/build-module/post-title/edit.js.map +1 -1
- package/build-module/post-title/index.js +3 -0
- package/build-module/post-title/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/author-control.js +3 -1
- package/build-module/query/edit/inspector-controls/author-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +28 -9
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/order-control.js +1 -0
- package/build-module/query/edit/inspector-controls/order-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/parent-control.js +2 -1
- package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/sticky-control.js +1 -0
- package/build-module/query/edit/inspector-controls/sticky-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js +6 -4
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build-module/query/edit/query-content.js +11 -2
- package/build-module/query/edit/query-content.js.map +1 -1
- package/build-module/query/edit/query-placeholder.js +1 -14
- package/build-module/query/edit/query-placeholder.js.map +1 -1
- package/build-module/query/edit/query-toolbar.js +55 -62
- package/build-module/query/edit/query-toolbar.js.map +1 -1
- package/build-module/query/index.js +34 -0
- package/build-module/query/index.js.map +1 -1
- package/build-module/query/utils.js +5 -1
- package/build-module/query/utils.js.map +1 -1
- package/build-module/query/variations.js +4 -50
- package/build-module/query/variations.js.map +1 -1
- package/build-module/query-pagination-numbers/edit.js +1 -0
- package/build-module/query-pagination-numbers/edit.js.map +1 -1
- package/build-module/query-title/edit.js +12 -20
- package/build-module/query-title/edit.js.map +1 -1
- package/build-module/query-title/use-archive-label.js +88 -0
- package/build-module/query-title/use-archive-label.js.map +1 -0
- package/build-module/quote/index.js +15 -1
- package/build-module/quote/index.js.map +1 -1
- package/build-module/search/index.js +3 -0
- package/build-module/search/index.js.map +1 -1
- package/build-module/site-logo/edit.js +4 -1
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/site-tagline/edit.js +5 -2
- package/build-module/site-tagline/edit.js.map +1 -1
- package/build-module/site-tagline/index.js +6 -1
- package/build-module/site-tagline/index.js.map +1 -1
- package/build-module/site-title/edit.js +4 -1
- package/build-module/site-title/edit.js.map +1 -1
- package/build-module/site-title/index.js +6 -1
- package/build-module/site-title/index.js.map +1 -1
- package/build-module/social-link/edit.js +28 -8
- package/build-module/social-link/edit.js.map +1 -1
- package/build-module/social-link/icons/soundcloud.js +1 -1
- package/build-module/social-link/icons/soundcloud.js.map +1 -1
- package/build-module/social-links/index.js +12 -0
- package/build-module/social-links/index.js.map +1 -1
- package/build-module/table/edit.js +9 -18
- package/build-module/table/edit.js.map +1 -1
- package/build-module/tag-cloud/edit.js +4 -1
- package/build-module/tag-cloud/edit.js.map +1 -1
- package/build-module/template-part/edit/index.js +5 -3
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/edit/inner-blocks.js +8 -3
- package/build-module/template-part/edit/inner-blocks.js.map +1 -1
- package/build-module/template-part/edit/placeholder.js +23 -3
- package/build-module/template-part/edit/placeholder.js.map +1 -1
- package/build-module/template-part/edit/title-modal.js +21 -9
- package/build-module/template-part/edit/title-modal.js.map +1 -1
- package/build-module/term-description/index.js +12 -0
- package/build-module/term-description/index.js.map +1 -1
- package/build-module/utils/hooks.js +16 -1
- package/build-module/utils/hooks.js.map +1 -1
- package/build-module/video/deprecated.js +4 -0
- package/build-module/video/deprecated.js.map +1 -1
- package/build-module/video/edit.js +18 -8
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/index.js +4 -0
- package/build-module/video/index.js.map +1 -1
- package/build-module/video/transforms.js +1 -1
- package/build-module/video/transforms.js.map +1 -1
- package/build-style/categories/editor-rtl.css +4 -0
- package/build-style/categories/editor.css +4 -0
- package/build-style/categories/style-rtl.css +4 -0
- package/build-style/categories/style.css +4 -0
- package/build-style/editor-rtl.css +16 -12
- package/build-style/editor.css +16 -12
- package/build-style/image/editor-rtl.css +8 -4
- package/build-style/image/editor.css +8 -4
- package/build-style/image/style-rtl.css +19 -0
- package/build-style/image/style.css +19 -0
- package/build-style/list/style-rtl.css +1 -1
- package/build-style/list/style.css +1 -1
- package/build-style/navigation/style-rtl.css +1 -4
- package/build-style/navigation/style.css +1 -4
- package/build-style/post-comments-form/style-rtl.css +12 -11
- package/build-style/post-comments-form/style.css +12 -11
- package/build-style/query/editor-rtl.css +3 -7
- package/build-style/query/editor.css +3 -7
- package/build-style/search/editor-rtl.css +1 -1
- package/build-style/search/editor.css +1 -1
- package/build-style/social-links/style-rtl.css +93 -93
- package/build-style/social-links/style.css +93 -93
- package/build-style/style-rtl.css +131 -109
- package/build-style/style.css +131 -109
- package/build-style/term-description/style-rtl.css +1 -0
- package/build-style/term-description/style.css +1 -0
- package/package.json +35 -35
- package/src/audio/block.json +4 -0
- package/src/audio/edit.js +19 -7
- package/src/audio/transforms.js +1 -1
- package/src/block/block.json +5 -1
- package/src/block/edit.js +58 -28
- package/src/block/test/edit.native.js +6 -2
- package/src/button/edit.js +1 -1
- package/src/button/index.php +14 -1
- package/src/buttons/block.json +20 -0
- package/src/buttons/index.js +6 -0
- package/src/categories/block.json +8 -0
- package/src/categories/edit.js +32 -4
- package/src/categories/editor.scss +4 -0
- package/src/categories/index.php +4 -1
- package/src/categories/style.scss +4 -0
- package/src/columns/index.js +1 -1
- package/src/cover/edit/inspector-controls.js +1 -0
- package/src/embed/embed-preview.js +4 -6
- package/src/embed/test/__snapshots__/index.native.js.snap +8 -8
- package/src/embed/test/index.js +1 -1
- package/src/embed/test/index.native.js +24 -23
- package/src/embed/variations.js +43 -35
- package/src/file/block.json +4 -0
- package/src/file/edit.js +19 -6
- package/src/file/transforms.js +1 -2
- package/src/footnotes/index.js +1 -2
- package/src/form-input/edit.js +2 -0
- package/src/gallery/block.json +10 -0
- package/src/gallery/deprecated.js +6 -55
- package/src/gallery/edit.js +13 -10
- package/src/gallery/gallery-styles.native.scss +0 -2
- package/src/gallery/index.js +1 -1
- package/src/gallery/save.js +0 -10
- package/src/gallery/shared.js +0 -28
- package/src/gallery/transforms.js +56 -99
- package/src/group/block.json +1 -0
- package/src/group/deprecated.js +3 -7
- package/src/group/placeholder.js +7 -0
- package/src/heading/block.json +12 -0
- package/src/heading/index.js +1 -0
- package/src/image/block.json +7 -0
- package/src/image/edit.js +11 -20
- package/src/image/editor.scss +6 -1
- package/src/image/image.js +91 -49
- package/src/image/index.php +58 -20
- package/src/image/style.scss +22 -0
- package/src/image/test/edit.native.js +1 -0
- package/src/image/transforms.js +1 -1
- package/src/image/view.js +69 -49
- package/src/latest-comments/block.json +9 -0
- package/src/list/edit.js +3 -3
- package/src/list/style.scss +1 -1
- package/src/list-item/block.json +11 -1
- package/src/list-item/edit.js +3 -3
- package/src/list-item/hooks/index.js +0 -1
- package/src/list-item/hooks/use-merge.js +19 -5
- package/src/loginout/block.json +3 -0
- package/src/media-text/block.json +12 -0
- package/src/media-text/edit.js +3 -2
- package/src/navigation/edit/navigation-menu-delete-control.js +1 -0
- package/src/navigation/index.php +1 -1
- package/src/navigation/style.scss +4 -9
- package/src/navigation/test/use-navigation-menu.js +54 -15
- package/src/navigation/use-navigation-menu.js +5 -1
- package/src/navigation-link/link-ui.js +8 -14
- package/src/navigation-submenu/edit.js +2 -14
- package/src/page-list/convert-to-links-modal.js +1 -1
- package/src/page-list/edit.js +2 -1
- package/src/page-list-item/edit.js +4 -4
- package/src/paragraph/block.json +6 -0
- package/src/post-author/index.js +8 -0
- package/src/post-author-biography/block.json +3 -0
- package/src/post-author-name/block.json +3 -0
- package/src/post-comments-form/style.scss +16 -13
- package/src/post-content/block.json +3 -0
- package/src/post-date/block.json +3 -0
- package/src/post-date/edit.js +5 -1
- package/src/post-date/index.php +8 -2
- package/src/post-excerpt/block.json +3 -0
- package/src/post-excerpt/edit.js +1 -0
- package/src/post-featured-image/block.json +3 -0
- package/src/post-terms/block.json +3 -0
- package/src/post-title/block.json +3 -0
- package/src/post-title/edit.js +5 -5
- package/src/query/edit/inspector-controls/author-control.js +2 -0
- package/src/query/edit/inspector-controls/index.js +44 -16
- package/src/query/edit/inspector-controls/order-control.js +1 -0
- package/src/query/edit/inspector-controls/parent-control.js +1 -0
- package/src/query/edit/inspector-controls/sticky-control.js +1 -0
- package/src/query/edit/inspector-controls/taxonomy-controls.js +8 -3
- package/src/query/edit/query-content.js +17 -3
- package/src/query/edit/query-placeholder.js +1 -21
- package/src/query/edit/query-toolbar.js +60 -72
- package/src/query/editor.scss +4 -9
- package/src/query/index.js +40 -0
- package/src/query/utils.js +4 -0
- package/src/query/variations.js +4 -46
- package/src/query-pagination-numbers/edit.js +1 -0
- package/src/query-title/edit.js +10 -17
- package/src/query-title/use-archive-label.js +99 -0
- package/src/quote/block.json +15 -1
- package/src/search/block.json +3 -0
- package/src/search/editor.scss +1 -1
- package/src/site-logo/edit.js +4 -1
- package/src/site-tagline/block.json +6 -1
- package/src/site-tagline/edit.js +5 -2
- package/src/site-title/edit.js +4 -1
- package/src/site-title/index.js +6 -1
- package/src/social-link/edit.js +29 -3
- package/src/social-link/icons/soundcloud.js +1 -1
- package/src/social-link/socials-with-bg.scss +1 -1
- package/src/social-link/socials-without-bg.scss +1 -1
- package/src/social-links/block.json +12 -0
- package/src/social-links/style.scss +2 -2
- package/src/table/edit.js +11 -24
- package/src/tag-cloud/edit.js +7 -1
- package/src/template-part/edit/index.js +5 -3
- package/src/template-part/edit/inner-blocks.js +8 -5
- package/src/template-part/edit/placeholder.js +31 -6
- package/src/template-part/edit/title-modal.js +19 -5
- package/src/term-description/block.json +12 -0
- package/src/term-description/style.scss +2 -0
- package/src/utils/hooks.js +19 -2
- package/src/video/block.json +4 -0
- package/src/video/edit.js +23 -8
- package/src/video/transforms.js +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/build/gallery/edit-wrapper.js +0 -37
- package/build/gallery/edit-wrapper.js.map +0 -1
- package/build/gallery/v1/constants.js +0 -10
- package/build/gallery/v1/constants.js.map +0 -1
- package/build/gallery/v1/edit.js +0 -399
- package/build/gallery/v1/edit.js.map +0 -1
- package/build/gallery/v1/gallery-button.native.js +0 -55
- package/build/gallery/v1/gallery-button.native.js.map +0 -1
- package/build/gallery/v1/gallery-image.js +0 -285
- package/build/gallery/v1/gallery-image.js.map +0 -1
- package/build/gallery/v1/gallery-image.native.js +0 -297
- package/build/gallery/v1/gallery-image.native.js.map +0 -1
- package/build/gallery/v1/gallery.js +0 -112
- package/build/gallery/v1/gallery.js.map +0 -1
- package/build/gallery/v1/gallery.native.js +0 -139
- package/build/gallery/v1/gallery.native.js.map +0 -1
- package/build/gallery/v1/save.js +0 -81
- package/build/gallery/v1/save.js.map +0 -1
- package/build/gallery/v1/shared.js +0 -17
- package/build/gallery/v1/shared.js.map +0 -1
- package/build/gallery/v1/tiles.native.js +0 -83
- package/build/gallery/v1/tiles.native.js.map +0 -1
- package/build/list-item/hooks/use-split.js +0 -39
- package/build/list-item/hooks/use-split.js.map +0 -1
- package/build/utils/constants.js +0 -15
- package/build/utils/constants.js.map +0 -1
- package/build-module/gallery/edit-wrapper.js +0 -31
- package/build-module/gallery/edit-wrapper.js.map +0 -1
- package/build-module/gallery/v1/constants.js +0 -4
- package/build-module/gallery/v1/constants.js.map +0 -1
- package/build-module/gallery/v1/edit.js +0 -393
- package/build-module/gallery/v1/edit.js.map +0 -1
- package/build-module/gallery/v1/gallery-button.native.js +0 -46
- package/build-module/gallery/v1/gallery-button.native.js.map +0 -1
- package/build-module/gallery/v1/gallery-image.js +0 -279
- package/build-module/gallery/v1/gallery-image.js.map +0 -1
- package/build-module/gallery/v1/gallery-image.native.js +0 -291
- package/build-module/gallery/v1/gallery-image.native.js.map +0 -1
- package/build-module/gallery/v1/gallery.js +0 -104
- package/build-module/gallery/v1/gallery.js.map +0 -1
- package/build-module/gallery/v1/gallery.native.js +0 -131
- package/build-module/gallery/v1/gallery.native.js.map +0 -1
- package/build-module/gallery/v1/save.js +0 -74
- package/build-module/gallery/v1/save.js.map +0 -1
- package/build-module/gallery/v1/shared.js +0 -10
- package/build-module/gallery/v1/shared.js.map +0 -1
- package/build-module/gallery/v1/tiles.native.js +0 -75
- package/build-module/gallery/v1/tiles.native.js.map +0 -1
- package/build-module/list-item/hooks/use-split.js +0 -32
- package/build-module/list-item/hooks/use-split.js.map +0 -1
- package/build-module/utils/constants.js +0 -9
- package/build-module/utils/constants.js.map +0 -1
- package/src/gallery/edit-wrapper.js +0 -27
- package/src/gallery/v1/constants.js +0 -3
- package/src/gallery/v1/edit.js +0 -450
- package/src/gallery/v1/gallery-button.native.js +0 -47
- package/src/gallery/v1/gallery-image-style.native.scss +0 -109
- package/src/gallery/v1/gallery-image.js +0 -293
- package/src/gallery/v1/gallery-image.native.js +0 -348
- package/src/gallery/v1/gallery-styles.native.scss +0 -8
- package/src/gallery/v1/gallery.js +0 -125
- package/src/gallery/v1/gallery.native.js +0 -162
- package/src/gallery/v1/save.js +0 -98
- package/src/gallery/v1/shared.js +0 -19
- package/src/gallery/v1/tiles-styles.native.scss +0 -11
- package/src/gallery/v1/tiles.native.js +0 -79
- package/src/list-item/hooks/use-split.js +0 -33
- package/src/utils/constants.js +0 -8
|
@@ -1,293 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import clsx from 'clsx';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { Component } from '@wordpress/element';
|
|
10
|
-
import { Button, Spinner, ButtonGroup } from '@wordpress/components';
|
|
11
|
-
import { __ } from '@wordpress/i18n';
|
|
12
|
-
import { BACKSPACE, DELETE } from '@wordpress/keycodes';
|
|
13
|
-
import { withSelect, withDispatch } from '@wordpress/data';
|
|
14
|
-
import {
|
|
15
|
-
RichText,
|
|
16
|
-
MediaPlaceholder,
|
|
17
|
-
store as blockEditorStore,
|
|
18
|
-
__experimentalGetElementClassName,
|
|
19
|
-
} from '@wordpress/block-editor';
|
|
20
|
-
import { isBlobURL } from '@wordpress/blob';
|
|
21
|
-
import { compose } from '@wordpress/compose';
|
|
22
|
-
import {
|
|
23
|
-
closeSmall,
|
|
24
|
-
chevronLeft,
|
|
25
|
-
chevronRight,
|
|
26
|
-
edit,
|
|
27
|
-
image as imageIcon,
|
|
28
|
-
} from '@wordpress/icons';
|
|
29
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Internal dependencies
|
|
33
|
-
*/
|
|
34
|
-
import { pickRelevantMediaFiles } from './shared';
|
|
35
|
-
import {
|
|
36
|
-
LINK_DESTINATION_ATTACHMENT,
|
|
37
|
-
LINK_DESTINATION_MEDIA,
|
|
38
|
-
} from './constants';
|
|
39
|
-
|
|
40
|
-
const isTemporaryImage = ( id, url ) => ! id && isBlobURL( url );
|
|
41
|
-
|
|
42
|
-
class GalleryImage extends Component {
|
|
43
|
-
constructor() {
|
|
44
|
-
super( ...arguments );
|
|
45
|
-
|
|
46
|
-
this.onSelectImage = this.onSelectImage.bind( this );
|
|
47
|
-
this.onRemoveImage = this.onRemoveImage.bind( this );
|
|
48
|
-
this.bindContainer = this.bindContainer.bind( this );
|
|
49
|
-
this.onEdit = this.onEdit.bind( this );
|
|
50
|
-
this.onSelectImageFromLibrary =
|
|
51
|
-
this.onSelectImageFromLibrary.bind( this );
|
|
52
|
-
this.onSelectCustomURL = this.onSelectCustomURL.bind( this );
|
|
53
|
-
this.state = {
|
|
54
|
-
isEditing: false,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
bindContainer( ref ) {
|
|
59
|
-
this.container = ref;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
onSelectImage() {
|
|
63
|
-
if ( ! this.props.isSelected ) {
|
|
64
|
-
this.props.onSelect();
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
onRemoveImage( event ) {
|
|
69
|
-
if (
|
|
70
|
-
this.container === this.container.ownerDocument.activeElement &&
|
|
71
|
-
this.props.isSelected &&
|
|
72
|
-
[ BACKSPACE, DELETE ].indexOf( event.keyCode ) !== -1
|
|
73
|
-
) {
|
|
74
|
-
event.preventDefault();
|
|
75
|
-
this.props.onRemove();
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
onEdit() {
|
|
80
|
-
this.setState( {
|
|
81
|
-
isEditing: true,
|
|
82
|
-
} );
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
componentDidUpdate() {
|
|
86
|
-
const { image, url, __unstableMarkNextChangeAsNotPersistent } =
|
|
87
|
-
this.props;
|
|
88
|
-
if ( image && ! url ) {
|
|
89
|
-
__unstableMarkNextChangeAsNotPersistent();
|
|
90
|
-
this.props.setAttributes( {
|
|
91
|
-
url: image.source_url,
|
|
92
|
-
alt: image.alt_text,
|
|
93
|
-
} );
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
deselectOnBlur() {
|
|
98
|
-
this.props.onDeselect();
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
onSelectImageFromLibrary( media ) {
|
|
102
|
-
const { setAttributes, id, url, alt, caption, sizeSlug } = this.props;
|
|
103
|
-
if ( ! media || ! media.url ) {
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
let mediaAttributes = pickRelevantMediaFiles( media, sizeSlug );
|
|
108
|
-
|
|
109
|
-
// If the current image is temporary but an alt text was meanwhile
|
|
110
|
-
// written by the user, make sure the text is not overwritten.
|
|
111
|
-
if ( isTemporaryImage( id, url ) ) {
|
|
112
|
-
if ( alt ) {
|
|
113
|
-
const { alt: omittedAlt, ...restMediaAttributes } =
|
|
114
|
-
mediaAttributes;
|
|
115
|
-
mediaAttributes = restMediaAttributes;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// If a caption text was meanwhile written by the user,
|
|
120
|
-
// make sure the text is not overwritten by empty captions.
|
|
121
|
-
if ( caption && ! mediaAttributes.caption ) {
|
|
122
|
-
const { caption: omittedCaption, ...restMediaAttributes } =
|
|
123
|
-
mediaAttributes;
|
|
124
|
-
mediaAttributes = restMediaAttributes;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
setAttributes( mediaAttributes );
|
|
128
|
-
this.setState( {
|
|
129
|
-
isEditing: false,
|
|
130
|
-
} );
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
onSelectCustomURL( newURL ) {
|
|
134
|
-
const { setAttributes, url } = this.props;
|
|
135
|
-
if ( newURL !== url ) {
|
|
136
|
-
setAttributes( {
|
|
137
|
-
url: newURL,
|
|
138
|
-
id: undefined,
|
|
139
|
-
} );
|
|
140
|
-
this.setState( {
|
|
141
|
-
isEditing: false,
|
|
142
|
-
} );
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
render() {
|
|
147
|
-
const {
|
|
148
|
-
url,
|
|
149
|
-
alt,
|
|
150
|
-
id,
|
|
151
|
-
linkTo,
|
|
152
|
-
link,
|
|
153
|
-
isFirstItem,
|
|
154
|
-
isLastItem,
|
|
155
|
-
isSelected,
|
|
156
|
-
caption,
|
|
157
|
-
onRemove,
|
|
158
|
-
onMoveForward,
|
|
159
|
-
onMoveBackward,
|
|
160
|
-
setAttributes,
|
|
161
|
-
'aria-label': ariaLabel,
|
|
162
|
-
} = this.props;
|
|
163
|
-
const { isEditing } = this.state;
|
|
164
|
-
|
|
165
|
-
let href;
|
|
166
|
-
|
|
167
|
-
switch ( linkTo ) {
|
|
168
|
-
case LINK_DESTINATION_MEDIA:
|
|
169
|
-
href = url;
|
|
170
|
-
break;
|
|
171
|
-
case LINK_DESTINATION_ATTACHMENT:
|
|
172
|
-
href = link;
|
|
173
|
-
break;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
const img = (
|
|
177
|
-
// Disable reason: Image itself is not meant to be interactive, but should
|
|
178
|
-
// direct image selection and unfocus caption fields.
|
|
179
|
-
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
|
|
180
|
-
<>
|
|
181
|
-
<img
|
|
182
|
-
src={ url }
|
|
183
|
-
alt={ alt }
|
|
184
|
-
data-id={ id }
|
|
185
|
-
onKeyDown={ this.onRemoveImage }
|
|
186
|
-
tabIndex="0"
|
|
187
|
-
aria-label={ ariaLabel }
|
|
188
|
-
ref={ this.bindContainer }
|
|
189
|
-
/>
|
|
190
|
-
{ isBlobURL( url ) && <Spinner /> }
|
|
191
|
-
</>
|
|
192
|
-
/* eslint-enable jsx-a11y/no-noninteractive-element-interactions */
|
|
193
|
-
);
|
|
194
|
-
|
|
195
|
-
const className = clsx( {
|
|
196
|
-
'is-selected': isSelected,
|
|
197
|
-
'is-transient': isBlobURL( url ),
|
|
198
|
-
} );
|
|
199
|
-
|
|
200
|
-
return (
|
|
201
|
-
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
202
|
-
<figure
|
|
203
|
-
className={ className }
|
|
204
|
-
onClick={ this.onSelectImage }
|
|
205
|
-
onFocus={ this.onSelectImage }
|
|
206
|
-
>
|
|
207
|
-
{ ! isEditing && ( href ? <a href={ href }>{ img }</a> : img ) }
|
|
208
|
-
{ isEditing && (
|
|
209
|
-
<MediaPlaceholder
|
|
210
|
-
labels={ { title: __( 'Edit gallery image' ) } }
|
|
211
|
-
icon={ imageIcon }
|
|
212
|
-
onSelect={ this.onSelectImageFromLibrary }
|
|
213
|
-
onSelectURL={ this.onSelectCustomURL }
|
|
214
|
-
accept="image/*"
|
|
215
|
-
allowedTypes={ [ 'image' ] }
|
|
216
|
-
value={ { id, src: url } }
|
|
217
|
-
/>
|
|
218
|
-
) }
|
|
219
|
-
<ButtonGroup className="block-library-gallery-item__inline-menu is-left">
|
|
220
|
-
<Button
|
|
221
|
-
icon={ chevronLeft }
|
|
222
|
-
onClick={ isFirstItem ? undefined : onMoveBackward }
|
|
223
|
-
label={ __( 'Move image backward' ) }
|
|
224
|
-
aria-disabled={ isFirstItem }
|
|
225
|
-
// Disable reason: Truly disable when image is not selected.
|
|
226
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
227
|
-
disabled={ ! isSelected }
|
|
228
|
-
/>
|
|
229
|
-
<Button
|
|
230
|
-
icon={ chevronRight }
|
|
231
|
-
onClick={ isLastItem ? undefined : onMoveForward }
|
|
232
|
-
label={ __( 'Move image forward' ) }
|
|
233
|
-
aria-disabled={ isLastItem }
|
|
234
|
-
// Disable reason: Truly disable when image is not selected.
|
|
235
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
236
|
-
disabled={ ! isSelected }
|
|
237
|
-
/>
|
|
238
|
-
</ButtonGroup>
|
|
239
|
-
<ButtonGroup className="block-library-gallery-item__inline-menu is-right">
|
|
240
|
-
<Button
|
|
241
|
-
icon={ edit }
|
|
242
|
-
onClick={ this.onEdit }
|
|
243
|
-
label={ __( 'Replace image' ) }
|
|
244
|
-
// Disable reason: Truly disable when image is not selected.
|
|
245
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
246
|
-
disabled={ ! isSelected }
|
|
247
|
-
/>
|
|
248
|
-
<Button
|
|
249
|
-
icon={ closeSmall }
|
|
250
|
-
onClick={ onRemove }
|
|
251
|
-
label={ __( 'Remove image' ) }
|
|
252
|
-
// Disable reason: Truly disable when image is not selected.
|
|
253
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
254
|
-
disabled={ ! isSelected }
|
|
255
|
-
/>
|
|
256
|
-
</ButtonGroup>
|
|
257
|
-
{ ! isEditing && ( isSelected || caption ) && (
|
|
258
|
-
<RichText
|
|
259
|
-
tagName="figcaption"
|
|
260
|
-
className={ __experimentalGetElementClassName(
|
|
261
|
-
'caption'
|
|
262
|
-
) }
|
|
263
|
-
aria-label={ __( 'Image caption text' ) }
|
|
264
|
-
placeholder={ isSelected ? __( 'Add caption' ) : null }
|
|
265
|
-
value={ caption }
|
|
266
|
-
onChange={ ( newCaption ) =>
|
|
267
|
-
setAttributes( { caption: newCaption } )
|
|
268
|
-
}
|
|
269
|
-
inlineToolbar
|
|
270
|
-
/>
|
|
271
|
-
) }
|
|
272
|
-
</figure>
|
|
273
|
-
);
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
export default compose( [
|
|
278
|
-
withSelect( ( select, ownProps ) => {
|
|
279
|
-
const { getMedia } = select( coreStore );
|
|
280
|
-
const { id } = ownProps;
|
|
281
|
-
|
|
282
|
-
return {
|
|
283
|
-
image: id ? getMedia( parseInt( id, 10 ) ) : null,
|
|
284
|
-
};
|
|
285
|
-
} ),
|
|
286
|
-
withDispatch( ( dispatch ) => {
|
|
287
|
-
const { __unstableMarkNextChangeAsNotPersistent } =
|
|
288
|
-
dispatch( blockEditorStore );
|
|
289
|
-
return {
|
|
290
|
-
__unstableMarkNextChangeAsNotPersistent,
|
|
291
|
-
};
|
|
292
|
-
} ),
|
|
293
|
-
] )( GalleryImage );
|
|
@@ -1,348 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
StyleSheet,
|
|
6
|
-
View,
|
|
7
|
-
ScrollView,
|
|
8
|
-
TouchableWithoutFeedback,
|
|
9
|
-
} from 'react-native';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* WordPress dependencies
|
|
13
|
-
*/
|
|
14
|
-
import {
|
|
15
|
-
requestImageFailedRetryDialog,
|
|
16
|
-
requestImageUploadCancelDialog,
|
|
17
|
-
requestImageFullscreenPreview,
|
|
18
|
-
} from '@wordpress/react-native-bridge';
|
|
19
|
-
import { Component } from '@wordpress/element';
|
|
20
|
-
import { Image } from '@wordpress/components';
|
|
21
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
22
|
-
import { Caption, MediaUploadProgress } from '@wordpress/block-editor';
|
|
23
|
-
import { getProtocol } from '@wordpress/url';
|
|
24
|
-
import { withPreferredColorScheme } from '@wordpress/compose';
|
|
25
|
-
import { arrowLeft, arrowRight, warning } from '@wordpress/icons';
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Internal dependencies
|
|
29
|
-
*/
|
|
30
|
-
import Button from './gallery-button';
|
|
31
|
-
import style from './gallery-image-style.scss';
|
|
32
|
-
|
|
33
|
-
const { compose } = StyleSheet;
|
|
34
|
-
|
|
35
|
-
const separatorStyle = compose( style.separator, {
|
|
36
|
-
borderRightWidth: StyleSheet.hairlineWidth,
|
|
37
|
-
} );
|
|
38
|
-
const buttonStyle = compose( style.button, { aspectRatio: 1 } );
|
|
39
|
-
const ICON_SIZE_ARROW = 15;
|
|
40
|
-
|
|
41
|
-
class GalleryImage extends Component {
|
|
42
|
-
constructor() {
|
|
43
|
-
super( ...arguments );
|
|
44
|
-
|
|
45
|
-
this.onSelectImage = this.onSelectImage.bind( this );
|
|
46
|
-
this.onSelectCaption = this.onSelectCaption.bind( this );
|
|
47
|
-
this.onMediaPressed = this.onMediaPressed.bind( this );
|
|
48
|
-
this.onCaptionChange = this.onCaptionChange.bind( this );
|
|
49
|
-
this.onSelectMedia = this.onSelectMedia.bind( this );
|
|
50
|
-
|
|
51
|
-
this.updateMediaProgress = this.updateMediaProgress.bind( this );
|
|
52
|
-
this.finishMediaUploadWithSuccess =
|
|
53
|
-
this.finishMediaUploadWithSuccess.bind( this );
|
|
54
|
-
this.finishMediaUploadWithFailure =
|
|
55
|
-
this.finishMediaUploadWithFailure.bind( this );
|
|
56
|
-
this.renderContent = this.renderContent.bind( this );
|
|
57
|
-
|
|
58
|
-
this.state = {
|
|
59
|
-
captionSelected: false,
|
|
60
|
-
isUploadInProgress: false,
|
|
61
|
-
didUploadFail: false,
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
onSelectCaption() {
|
|
66
|
-
if ( ! this.state.captionSelected ) {
|
|
67
|
-
this.setState( {
|
|
68
|
-
captionSelected: true,
|
|
69
|
-
} );
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if ( ! this.props.isSelected ) {
|
|
73
|
-
this.props.onSelect();
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
onMediaPressed() {
|
|
78
|
-
const { id, url, isSelected } = this.props;
|
|
79
|
-
const { captionSelected, isUploadInProgress, didUploadFail } =
|
|
80
|
-
this.state;
|
|
81
|
-
|
|
82
|
-
this.onSelectImage();
|
|
83
|
-
|
|
84
|
-
if ( isUploadInProgress ) {
|
|
85
|
-
requestImageUploadCancelDialog( id );
|
|
86
|
-
} else if (
|
|
87
|
-
didUploadFail ||
|
|
88
|
-
( id && getProtocol( url ) === 'file:' )
|
|
89
|
-
) {
|
|
90
|
-
requestImageFailedRetryDialog( id );
|
|
91
|
-
} else if ( isSelected && ! captionSelected ) {
|
|
92
|
-
requestImageFullscreenPreview( url );
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
onSelectImage() {
|
|
97
|
-
if ( ! this.props.isBlockSelected ) {
|
|
98
|
-
this.props.onSelectBlock();
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if ( ! this.props.isSelected ) {
|
|
102
|
-
this.props.onSelect();
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if ( this.state.captionSelected ) {
|
|
106
|
-
this.setState( {
|
|
107
|
-
captionSelected: false,
|
|
108
|
-
} );
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
onSelectMedia( media ) {
|
|
113
|
-
const { setAttributes } = this.props;
|
|
114
|
-
setAttributes( media );
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
onCaptionChange( caption ) {
|
|
118
|
-
const { setAttributes } = this.props;
|
|
119
|
-
setAttributes( { caption } );
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
componentDidUpdate( prevProps ) {
|
|
123
|
-
const { isSelected, image, url } = this.props;
|
|
124
|
-
if ( image && ! url ) {
|
|
125
|
-
this.props.setAttributes( {
|
|
126
|
-
url: image.source_url,
|
|
127
|
-
alt: image.alt_text,
|
|
128
|
-
} );
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// Unselect the caption so when the user selects other image and comeback
|
|
132
|
-
// the caption is not immediately selected.
|
|
133
|
-
if (
|
|
134
|
-
this.state.captionSelected &&
|
|
135
|
-
! isSelected &&
|
|
136
|
-
prevProps.isSelected
|
|
137
|
-
) {
|
|
138
|
-
this.setState( {
|
|
139
|
-
captionSelected: false,
|
|
140
|
-
} );
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
updateMediaProgress() {
|
|
145
|
-
if ( ! this.state.isUploadInProgress ) {
|
|
146
|
-
this.setState( { isUploadInProgress: true } );
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
finishMediaUploadWithSuccess( payload ) {
|
|
151
|
-
this.setState( {
|
|
152
|
-
isUploadInProgress: false,
|
|
153
|
-
didUploadFail: false,
|
|
154
|
-
} );
|
|
155
|
-
|
|
156
|
-
this.props.setAttributes( {
|
|
157
|
-
id: payload.mediaServerId,
|
|
158
|
-
url: payload.mediaUrl,
|
|
159
|
-
} );
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
finishMediaUploadWithFailure() {
|
|
163
|
-
this.setState( {
|
|
164
|
-
isUploadInProgress: false,
|
|
165
|
-
didUploadFail: true,
|
|
166
|
-
} );
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
renderContent( params ) {
|
|
170
|
-
const {
|
|
171
|
-
url,
|
|
172
|
-
isFirstItem,
|
|
173
|
-
isLastItem,
|
|
174
|
-
isSelected,
|
|
175
|
-
caption,
|
|
176
|
-
onRemove,
|
|
177
|
-
onMoveForward,
|
|
178
|
-
onMoveBackward,
|
|
179
|
-
'aria-label': ariaLabel,
|
|
180
|
-
isCropped,
|
|
181
|
-
getStylesFromColorScheme,
|
|
182
|
-
isRTL,
|
|
183
|
-
} = this.props;
|
|
184
|
-
|
|
185
|
-
const { isUploadInProgress, captionSelected } = this.state;
|
|
186
|
-
const { isUploadFailed, retryMessage } = params;
|
|
187
|
-
const resizeMode = isCropped ? 'cover' : 'contain';
|
|
188
|
-
|
|
189
|
-
const captionPlaceholderStyle = getStylesFromColorScheme(
|
|
190
|
-
style.captionPlaceholder,
|
|
191
|
-
style.captionPlaceholderDark
|
|
192
|
-
);
|
|
193
|
-
|
|
194
|
-
const shouldShowCaptionEditable = ! isUploadFailed && isSelected;
|
|
195
|
-
const shouldShowCaptionExpanded =
|
|
196
|
-
! isUploadFailed && ! isSelected && !! caption;
|
|
197
|
-
|
|
198
|
-
const captionContainerStyle = shouldShowCaptionExpanded
|
|
199
|
-
? style.captionExpandedContainer
|
|
200
|
-
: style.captionContainer;
|
|
201
|
-
|
|
202
|
-
const captionStyle = shouldShowCaptionExpanded
|
|
203
|
-
? style.captionExpanded
|
|
204
|
-
: style.caption;
|
|
205
|
-
|
|
206
|
-
const mediaPickerOptions = [
|
|
207
|
-
{
|
|
208
|
-
destructiveButton: true,
|
|
209
|
-
id: 'removeImage',
|
|
210
|
-
label: __( 'Remove' ),
|
|
211
|
-
onPress: onRemove,
|
|
212
|
-
separated: true,
|
|
213
|
-
value: 'removeImage',
|
|
214
|
-
},
|
|
215
|
-
];
|
|
216
|
-
|
|
217
|
-
return (
|
|
218
|
-
<>
|
|
219
|
-
<Image
|
|
220
|
-
alt={ ariaLabel }
|
|
221
|
-
height={ style.image.height }
|
|
222
|
-
isSelected={ isSelected }
|
|
223
|
-
isUploadFailed={ isUploadFailed }
|
|
224
|
-
isUploadInProgress={ isUploadInProgress }
|
|
225
|
-
mediaPickerOptions={ mediaPickerOptions }
|
|
226
|
-
onSelectMediaUploadOption={ this.onSelectMedia }
|
|
227
|
-
resizeMode={ resizeMode }
|
|
228
|
-
url={ url }
|
|
229
|
-
retryMessage={ retryMessage }
|
|
230
|
-
retryIcon={ warning }
|
|
231
|
-
/>
|
|
232
|
-
|
|
233
|
-
{ ! isUploadInProgress && isSelected && (
|
|
234
|
-
<View style={ style.toolbarContainer }>
|
|
235
|
-
<View style={ style.toolbar }>
|
|
236
|
-
<View style={ style.moverButtonContainer }>
|
|
237
|
-
<Button
|
|
238
|
-
style={ buttonStyle }
|
|
239
|
-
icon={ isRTL ? arrowRight : arrowLeft }
|
|
240
|
-
iconSize={ ICON_SIZE_ARROW }
|
|
241
|
-
onClick={
|
|
242
|
-
isFirstItem ? undefined : onMoveBackward
|
|
243
|
-
}
|
|
244
|
-
accessibilityLabel={ __(
|
|
245
|
-
'Move Image Backward'
|
|
246
|
-
) }
|
|
247
|
-
aria-disabled={ isFirstItem }
|
|
248
|
-
disabled={ ! isSelected }
|
|
249
|
-
/>
|
|
250
|
-
<View style={ separatorStyle } />
|
|
251
|
-
<Button
|
|
252
|
-
style={ buttonStyle }
|
|
253
|
-
icon={ isRTL ? arrowLeft : arrowRight }
|
|
254
|
-
iconSize={ ICON_SIZE_ARROW }
|
|
255
|
-
onClick={
|
|
256
|
-
isLastItem ? undefined : onMoveForward
|
|
257
|
-
}
|
|
258
|
-
accessibilityLabel={ __(
|
|
259
|
-
'Move Image Forward'
|
|
260
|
-
) }
|
|
261
|
-
aria-disabled={ isLastItem }
|
|
262
|
-
disabled={ ! isSelected }
|
|
263
|
-
/>
|
|
264
|
-
</View>
|
|
265
|
-
</View>
|
|
266
|
-
</View>
|
|
267
|
-
) }
|
|
268
|
-
|
|
269
|
-
{ ! isUploadInProgress &&
|
|
270
|
-
( shouldShowCaptionEditable ||
|
|
271
|
-
shouldShowCaptionExpanded ) && (
|
|
272
|
-
<View style={ captionContainerStyle }>
|
|
273
|
-
<ScrollView
|
|
274
|
-
nestedScrollEnabled
|
|
275
|
-
keyboardShouldPersistTaps="handled"
|
|
276
|
-
bounces={ false }
|
|
277
|
-
>
|
|
278
|
-
<Caption
|
|
279
|
-
inlineToolbar
|
|
280
|
-
isSelected={ isSelected && captionSelected }
|
|
281
|
-
onChange={ this.onCaptionChange }
|
|
282
|
-
onFocus={ this.onSelectCaption }
|
|
283
|
-
placeholder={
|
|
284
|
-
isSelected ? __( 'Add caption' ) : null
|
|
285
|
-
}
|
|
286
|
-
placeholderTextColor={
|
|
287
|
-
captionPlaceholderStyle.color
|
|
288
|
-
}
|
|
289
|
-
style={ captionStyle }
|
|
290
|
-
value={ caption }
|
|
291
|
-
/>
|
|
292
|
-
</ScrollView>
|
|
293
|
-
</View>
|
|
294
|
-
) }
|
|
295
|
-
</>
|
|
296
|
-
);
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
render() {
|
|
300
|
-
const { id, onRemove, getStylesFromColorScheme, isSelected } =
|
|
301
|
-
this.props;
|
|
302
|
-
|
|
303
|
-
const containerStyle = getStylesFromColorScheme(
|
|
304
|
-
style.galleryImageContainer,
|
|
305
|
-
style.galleryImageContainerDark
|
|
306
|
-
);
|
|
307
|
-
|
|
308
|
-
return (
|
|
309
|
-
<TouchableWithoutFeedback
|
|
310
|
-
onPress={ this.onMediaPressed }
|
|
311
|
-
accessible={ ! isSelected } // We need only child views to be accessible after the selection.
|
|
312
|
-
accessibilityLabel={ this.accessibilityLabelImageContainer() } // if we don't set this explicitly it reads system provided accessibilityLabels of all child components and those include pretty technical words which don't make sense
|
|
313
|
-
accessibilityRole="imagebutton" // this makes VoiceOver to read a description of image provided by system on iOS and lets user know this is a button which conveys the message of tappablity
|
|
314
|
-
>
|
|
315
|
-
<View style={ containerStyle }>
|
|
316
|
-
<MediaUploadProgress
|
|
317
|
-
mediaId={ id }
|
|
318
|
-
onUpdateMediaProgress={ this.updateMediaProgress }
|
|
319
|
-
onFinishMediaUploadWithSuccess={
|
|
320
|
-
this.finishMediaUploadWithSuccess
|
|
321
|
-
}
|
|
322
|
-
onFinishMediaUploadWithFailure={
|
|
323
|
-
this.finishMediaUploadWithFailure
|
|
324
|
-
}
|
|
325
|
-
onMediaUploadStateReset={ onRemove }
|
|
326
|
-
renderContent={ this.renderContent }
|
|
327
|
-
/>
|
|
328
|
-
</View>
|
|
329
|
-
</TouchableWithoutFeedback>
|
|
330
|
-
);
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
accessibilityLabelImageContainer() {
|
|
334
|
-
const { caption, 'aria-label': ariaLabel } = this.props;
|
|
335
|
-
|
|
336
|
-
return ! caption
|
|
337
|
-
? ariaLabel
|
|
338
|
-
: ariaLabel +
|
|
339
|
-
'. ' +
|
|
340
|
-
sprintf(
|
|
341
|
-
/* translators: accessibility text. %s: image caption. */
|
|
342
|
-
__( 'Image caption. %s' ),
|
|
343
|
-
caption
|
|
344
|
-
);
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
export default withPreferredColorScheme( GalleryImage );
|