@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
package/src/image/image.js
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
__experimentalToolsPanel as ToolsPanel,
|
|
15
15
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
16
16
|
__experimentalUseCustomUnits as useCustomUnits,
|
|
17
|
+
Placeholder,
|
|
17
18
|
} from '@wordpress/components';
|
|
18
19
|
import { useViewportMatch } from '@wordpress/compose';
|
|
19
20
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
@@ -49,7 +50,7 @@ import { Caption } from '../utils/caption';
|
|
|
49
50
|
/**
|
|
50
51
|
* Module constants
|
|
51
52
|
*/
|
|
52
|
-
import {
|
|
53
|
+
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
53
54
|
import { MIN_SIZE, ALLOWED_MEDIA_TYPES } from './constants';
|
|
54
55
|
import { evalAspectRatio } from './utils';
|
|
55
56
|
|
|
@@ -176,14 +177,14 @@ export default function Image( {
|
|
|
176
177
|
] = useState( {} );
|
|
177
178
|
const [ isEditingImage, setIsEditingImage ] = useState( false );
|
|
178
179
|
const [ externalBlob, setExternalBlob ] = useState();
|
|
180
|
+
const [ hasImageErrored, setHasImageErrored ] = useState( false );
|
|
179
181
|
const hasNonContentControls = blockEditingMode === 'default';
|
|
180
182
|
const isContentOnlyMode = blockEditingMode === 'contentOnly';
|
|
181
183
|
const isResizable =
|
|
182
184
|
allowResize &&
|
|
183
185
|
hasNonContentControls &&
|
|
184
186
|
! isWideAligned &&
|
|
185
|
-
isLargeViewport
|
|
186
|
-
parentLayoutType !== 'grid';
|
|
187
|
+
isLargeViewport;
|
|
187
188
|
const imageSizeOptions = imageSizes
|
|
188
189
|
.filter(
|
|
189
190
|
( { slug } ) => image?.media_details?.sizes?.[ slug ]?.source_url
|
|
@@ -246,15 +247,24 @@ export default function Image( {
|
|
|
246
247
|
}
|
|
247
248
|
|
|
248
249
|
function onImageError() {
|
|
250
|
+
setHasImageErrored( true );
|
|
251
|
+
|
|
249
252
|
// Check if there's an embed block that handles this URL, e.g., instagram URL.
|
|
250
253
|
// See: https://github.com/WordPress/gutenberg/pull/11472
|
|
251
254
|
const embedBlock = createUpgradedEmbedBlock( { attributes: { url } } );
|
|
252
|
-
|
|
253
255
|
if ( undefined !== embedBlock ) {
|
|
254
256
|
onReplace( embedBlock );
|
|
255
257
|
}
|
|
256
258
|
}
|
|
257
259
|
|
|
260
|
+
function onImageLoad( event ) {
|
|
261
|
+
setHasImageErrored( false );
|
|
262
|
+
setLoadedNaturalSize( {
|
|
263
|
+
loadedNaturalWidth: event.target?.naturalWidth,
|
|
264
|
+
loadedNaturalHeight: event.target?.naturalHeight,
|
|
265
|
+
} );
|
|
266
|
+
}
|
|
267
|
+
|
|
258
268
|
function onSetHref( props ) {
|
|
259
269
|
setAttributes( props );
|
|
260
270
|
}
|
|
@@ -373,6 +383,8 @@ export default function Image( {
|
|
|
373
383
|
const lightboxChecked =
|
|
374
384
|
!! lightbox?.enabled || ( ! lightbox && !! lightboxSetting?.enabled );
|
|
375
385
|
|
|
386
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
387
|
+
|
|
376
388
|
const dimensionsControl = (
|
|
377
389
|
<DimensionsTool
|
|
378
390
|
value={ { width, height, scale, aspectRatio } }
|
|
@@ -403,6 +415,20 @@ export default function Image( {
|
|
|
403
415
|
/>
|
|
404
416
|
);
|
|
405
417
|
|
|
418
|
+
const aspectRatioControl = (
|
|
419
|
+
<DimensionsTool
|
|
420
|
+
value={ { aspectRatio } }
|
|
421
|
+
onChange={ ( { aspectRatio: newAspectRatio } ) => {
|
|
422
|
+
setAttributes( {
|
|
423
|
+
aspectRatio: newAspectRatio,
|
|
424
|
+
scale: 'cover',
|
|
425
|
+
} );
|
|
426
|
+
} }
|
|
427
|
+
defaultAspectRatio="auto"
|
|
428
|
+
tools={ [ 'aspectRatio' ] }
|
|
429
|
+
/>
|
|
430
|
+
);
|
|
431
|
+
|
|
406
432
|
const resetAll = () => {
|
|
407
433
|
setAttributes( {
|
|
408
434
|
alt: undefined,
|
|
@@ -419,9 +445,12 @@ export default function Image( {
|
|
|
419
445
|
<ToolsPanel
|
|
420
446
|
label={ __( 'Settings' ) }
|
|
421
447
|
resetAll={ resetAll }
|
|
422
|
-
dropdownMenuProps={
|
|
448
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
423
449
|
>
|
|
424
|
-
{ isResizable &&
|
|
450
|
+
{ isResizable &&
|
|
451
|
+
( parentLayoutType === 'grid'
|
|
452
|
+
? aspectRatioControl
|
|
453
|
+
: dimensionsControl ) }
|
|
425
454
|
</ToolsPanel>
|
|
426
455
|
</InspectorControls>
|
|
427
456
|
);
|
|
@@ -443,16 +472,12 @@ export default function Image( {
|
|
|
443
472
|
return {};
|
|
444
473
|
}
|
|
445
474
|
const { getBlockBindingsSource } = unlock( select( blocksStore ) );
|
|
446
|
-
const { getBlockParentsByBlockName } = unlock(
|
|
447
|
-
select( blockEditorStore )
|
|
448
|
-
);
|
|
449
475
|
const {
|
|
450
476
|
url: urlBinding,
|
|
451
477
|
alt: altBinding,
|
|
452
478
|
title: titleBinding,
|
|
453
479
|
} = metadata?.bindings || {};
|
|
454
|
-
const hasParentPattern =
|
|
455
|
-
getBlockParentsByBlockName( clientId, 'core/block' ).length > 0;
|
|
480
|
+
const hasParentPattern = !! context[ 'pattern/overrides' ];
|
|
456
481
|
const urlBindingSource = getBlockBindingsSource(
|
|
457
482
|
urlBinding?.source
|
|
458
483
|
);
|
|
@@ -465,7 +490,7 @@ export default function Image( {
|
|
|
465
490
|
return {
|
|
466
491
|
lockUrlControls:
|
|
467
492
|
!! urlBinding &&
|
|
468
|
-
! urlBindingSource?.canUserEditValue( {
|
|
493
|
+
! urlBindingSource?.canUserEditValue?.( {
|
|
469
494
|
select,
|
|
470
495
|
context,
|
|
471
496
|
args: urlBinding?.args,
|
|
@@ -480,7 +505,7 @@ export default function Image( {
|
|
|
480
505
|
hasParentPattern,
|
|
481
506
|
lockAltControls:
|
|
482
507
|
!! altBinding &&
|
|
483
|
-
! altBindingSource?.canUserEditValue( {
|
|
508
|
+
! altBindingSource?.canUserEditValue?.( {
|
|
484
509
|
select,
|
|
485
510
|
context,
|
|
486
511
|
args: altBinding?.args,
|
|
@@ -494,7 +519,7 @@ export default function Image( {
|
|
|
494
519
|
: __( 'Connected to dynamic data' ),
|
|
495
520
|
lockTitleControls:
|
|
496
521
|
!! titleBinding &&
|
|
497
|
-
! titleBindingSource?.canUserEditValue( {
|
|
522
|
+
! titleBindingSource?.canUserEditValue?.( {
|
|
498
523
|
select,
|
|
499
524
|
context,
|
|
500
525
|
args: titleBinding?.args,
|
|
@@ -508,7 +533,12 @@ export default function Image( {
|
|
|
508
533
|
: __( 'Connected to dynamic data' ),
|
|
509
534
|
};
|
|
510
535
|
},
|
|
511
|
-
[
|
|
536
|
+
[
|
|
537
|
+
arePatternOverridesEnabled,
|
|
538
|
+
context,
|
|
539
|
+
isSingleSelected,
|
|
540
|
+
metadata?.bindings,
|
|
541
|
+
]
|
|
512
542
|
);
|
|
513
543
|
|
|
514
544
|
const showUrlInput =
|
|
@@ -691,7 +721,7 @@ export default function Image( {
|
|
|
691
721
|
<ToolsPanel
|
|
692
722
|
label={ __( 'Settings' ) }
|
|
693
723
|
resetAll={ resetAll }
|
|
694
|
-
dropdownMenuProps={
|
|
724
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
695
725
|
>
|
|
696
726
|
{ isSingleSelected && (
|
|
697
727
|
<ToolsPanelItem
|
|
@@ -735,7 +765,10 @@ export default function Image( {
|
|
|
735
765
|
/>
|
|
736
766
|
</ToolsPanelItem>
|
|
737
767
|
) }
|
|
738
|
-
{ isResizable &&
|
|
768
|
+
{ isResizable &&
|
|
769
|
+
( parentLayoutType === 'grid'
|
|
770
|
+
? aspectRatioControl
|
|
771
|
+
: dimensionsControl ) }
|
|
739
772
|
{ !! imageSizeOptions.length && (
|
|
740
773
|
<ResolutionTool
|
|
741
774
|
value={ sizeSlug }
|
|
@@ -793,37 +826,46 @@ export default function Image( {
|
|
|
793
826
|
const shadowProps = getShadowClassesAndStyles( attributes );
|
|
794
827
|
const isRounded = attributes.className?.includes( 'is-style-rounded' );
|
|
795
828
|
|
|
796
|
-
let img =
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
829
|
+
let img =
|
|
830
|
+
temporaryURL && hasImageErrored ? (
|
|
831
|
+
// Show a placeholder during upload when the blob URL can't be loaded. This can
|
|
832
|
+
// happen when the user uploads a HEIC image in a browser that doesn't support them.
|
|
833
|
+
<Placeholder
|
|
834
|
+
className="wp-block-image__placeholder"
|
|
835
|
+
withIllustration
|
|
836
|
+
>
|
|
837
|
+
<Spinner />
|
|
838
|
+
</Placeholder>
|
|
839
|
+
) : (
|
|
840
|
+
// Disable reason: Image itself is not meant to be interactive, but
|
|
841
|
+
// should direct focus to block.
|
|
842
|
+
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */
|
|
843
|
+
<>
|
|
844
|
+
<img
|
|
845
|
+
src={ temporaryURL || url }
|
|
846
|
+
alt={ defaultedAlt }
|
|
847
|
+
onError={ onImageError }
|
|
848
|
+
onLoad={ onImageLoad }
|
|
849
|
+
ref={ imageRef }
|
|
850
|
+
className={ borderProps.className }
|
|
851
|
+
style={ {
|
|
852
|
+
width:
|
|
853
|
+
( width && height ) || aspectRatio
|
|
854
|
+
? '100%'
|
|
855
|
+
: undefined,
|
|
856
|
+
height:
|
|
857
|
+
( width && height ) || aspectRatio
|
|
858
|
+
? '100%'
|
|
859
|
+
: undefined,
|
|
860
|
+
objectFit: scale,
|
|
861
|
+
...borderProps.style,
|
|
862
|
+
...shadowProps.style,
|
|
863
|
+
} }
|
|
864
|
+
/>
|
|
865
|
+
{ temporaryURL && <Spinner /> }
|
|
866
|
+
</>
|
|
867
|
+
/* eslint-enable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */
|
|
868
|
+
);
|
|
827
869
|
|
|
828
870
|
if ( canEditImage && isEditingImage ) {
|
|
829
871
|
img = (
|
|
@@ -845,7 +887,7 @@ export default function Image( {
|
|
|
845
887
|
/>
|
|
846
888
|
</ImageWrapper>
|
|
847
889
|
);
|
|
848
|
-
} else if ( ! isResizable ) {
|
|
890
|
+
} else if ( ! isResizable || parentLayoutType === 'grid' ) {
|
|
849
891
|
img = (
|
|
850
892
|
<div style={ { width, height, aspectRatio } }>
|
|
851
893
|
<ImageWrapper href={ href }>{ img }</ImageWrapper>
|
package/src/image/index.php
CHANGED
|
@@ -28,12 +28,33 @@ function render_block_core_image( $attributes, $content, $block ) {
|
|
|
28
28
|
return '';
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
$has_id_binding = isset( $attributes['metadata']['bindings']['id'] ) && isset( $attributes['id'] );
|
|
32
|
+
|
|
33
|
+
// Ensure the `wp-image-id` classname on the image block supports block bindings.
|
|
34
|
+
if ( $has_id_binding ) {
|
|
35
|
+
// If there's a mismatch with the 'wp-image-' class and the actual id, the id was
|
|
36
|
+
// probably overridden by block bindings. Update it to the correct value.
|
|
37
|
+
// See https://github.com/WordPress/gutenberg/issues/62886 for why this is needed.
|
|
38
|
+
$id = $attributes['id'];
|
|
39
|
+
$image_classnames = $p->get_attribute( 'class' );
|
|
40
|
+
$class_with_binding_value = "wp-image-$id";
|
|
41
|
+
if ( is_string( $image_classnames ) && ! str_contains( $image_classnames, $class_with_binding_value ) ) {
|
|
42
|
+
$image_classnames = preg_replace( '/wp-image-(\d+)/', $class_with_binding_value, $image_classnames );
|
|
43
|
+
$p->set_attribute( 'class', $image_classnames );
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// For backwards compatibility, the data-id html attribute is only set for
|
|
48
|
+
// image blocks nested in a gallery. Detect if the image is in a gallery by
|
|
49
|
+
// checking the data-id attribute.
|
|
50
|
+
// See the `block_core_gallery_data_id_backcompatibility` function.
|
|
31
51
|
if ( isset( $attributes['data-id'] ) ) {
|
|
32
|
-
//
|
|
33
|
-
//
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
$
|
|
52
|
+
// If there's a binding for the `id`, the `id` attribute is used for the
|
|
53
|
+
// value, since `data-id` does not support block bindings.
|
|
54
|
+
// Else the `data-id` is used for backwards compatibility, since
|
|
55
|
+
// third parties may be filtering its value.
|
|
56
|
+
$data_id = $has_id_binding ? $attributes['id'] : $attributes['data-id'];
|
|
57
|
+
$p->set_attribute( 'data-id', $data_id );
|
|
37
58
|
}
|
|
38
59
|
|
|
39
60
|
$link_destination = isset( $attributes['linkDestination'] ) ? $attributes['linkDestination'] : 'none';
|
|
@@ -164,22 +185,37 @@ function block_core_image_render_lightbox( $block_content, $block ) {
|
|
|
164
185
|
$p->seek( 'figure' );
|
|
165
186
|
$figure_class_names = $p->get_attribute( 'class' );
|
|
166
187
|
$figure_styles = $p->get_attribute( 'style' );
|
|
188
|
+
|
|
189
|
+
// Create unique id and set the image metadata in the state.
|
|
190
|
+
$unique_image_id = uniqid();
|
|
191
|
+
|
|
192
|
+
wp_interactivity_state(
|
|
193
|
+
'core/image',
|
|
194
|
+
array(
|
|
195
|
+
'metadata' => array(
|
|
196
|
+
$unique_image_id => array(
|
|
197
|
+
'uploadedSrc' => $img_uploaded_src,
|
|
198
|
+
'figureClassNames' => $figure_class_names,
|
|
199
|
+
'figureStyles' => $figure_styles,
|
|
200
|
+
'imgClassNames' => $img_class_names,
|
|
201
|
+
'imgStyles' => $img_styles,
|
|
202
|
+
'targetWidth' => $img_width,
|
|
203
|
+
'targetHeight' => $img_height,
|
|
204
|
+
'scaleAttr' => $block['attrs']['scale'] ?? false,
|
|
205
|
+
'ariaLabel' => $aria_label,
|
|
206
|
+
'alt' => $alt,
|
|
207
|
+
),
|
|
208
|
+
),
|
|
209
|
+
)
|
|
210
|
+
);
|
|
211
|
+
|
|
167
212
|
$p->add_class( 'wp-lightbox-container' );
|
|
168
213
|
$p->set_attribute( 'data-wp-interactive', 'core/image' );
|
|
169
214
|
$p->set_attribute(
|
|
170
215
|
'data-wp-context',
|
|
171
216
|
wp_json_encode(
|
|
172
217
|
array(
|
|
173
|
-
'
|
|
174
|
-
'figureClassNames' => $figure_class_names,
|
|
175
|
-
'figureStyles' => $figure_styles,
|
|
176
|
-
'imgClassNames' => $img_class_names,
|
|
177
|
-
'imgStyles' => $img_styles,
|
|
178
|
-
'targetWidth' => $img_width,
|
|
179
|
-
'targetHeight' => $img_height,
|
|
180
|
-
'scaleAttr' => $block['attrs']['scale'] ?? false,
|
|
181
|
-
'ariaLabel' => $aria_label,
|
|
182
|
-
'alt' => $alt,
|
|
218
|
+
'imageId' => $unique_image_id,
|
|
183
219
|
),
|
|
184
220
|
JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP
|
|
185
221
|
)
|
|
@@ -194,6 +230,8 @@ function block_core_image_render_lightbox( $block_content, $block ) {
|
|
|
194
230
|
// contain a caption, and we don't want to trigger the lightbox when the
|
|
195
231
|
// caption is clicked.
|
|
196
232
|
$p->set_attribute( 'data-wp-on-async--click', 'actions.showLightbox' );
|
|
233
|
+
$p->set_attribute( 'data-wp-class--hide', 'state.isContentHidden' );
|
|
234
|
+
$p->set_attribute( 'data-wp-class--show', 'state.isContentVisible' );
|
|
197
235
|
|
|
198
236
|
$body_content = $p->get_updated_html();
|
|
199
237
|
|
|
@@ -210,8 +248,8 @@ function block_core_image_render_lightbox( $block_content, $block ) {
|
|
|
210
248
|
aria-label="' . esc_attr( $aria_label ) . '"
|
|
211
249
|
data-wp-init="callbacks.initTriggerButton"
|
|
212
250
|
data-wp-on-async--click="actions.showLightbox"
|
|
213
|
-
data-wp-style--right="
|
|
214
|
-
data-wp-style--top="
|
|
251
|
+
data-wp-style--right="state.imageButtonRight"
|
|
252
|
+
data-wp-style--top="state.imageButtonTop"
|
|
215
253
|
>
|
|
216
254
|
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="none" viewBox="0 0 12 12">
|
|
217
255
|
<path fill="#fff" d="M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z" />
|
|
@@ -267,15 +305,15 @@ function block_core_image_print_lightbox_overlay() {
|
|
|
267
305
|
tabindex="-1"
|
|
268
306
|
>
|
|
269
307
|
<button type="button" aria-label="$close_button_label" style="fill: $close_button_color" class="close-button">
|
|
270
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20" aria-hidden="true" focusable="false"><path d="
|
|
308
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20" aria-hidden="true" focusable="false"><path d="m13.06 12 6.47-6.47-1.06-1.06L12 10.94 5.53 4.47 4.47 5.53 10.94 12l-6.47 6.47 1.06 1.06L12 13.06l6.47 6.47 1.06-1.06L13.06 12Z"></path></svg>
|
|
271
309
|
</button>
|
|
272
310
|
<div class="lightbox-image-container">
|
|
273
|
-
<figure data-wp-bind--class="state.currentImage.figureClassNames" data-wp-bind--style="state.
|
|
311
|
+
<figure data-wp-bind--class="state.currentImage.figureClassNames" data-wp-bind--style="state.figureStyles">
|
|
274
312
|
<img data-wp-bind--alt="state.currentImage.alt" data-wp-bind--class="state.currentImage.imgClassNames" data-wp-bind--style="state.imgStyles" data-wp-bind--src="state.currentImage.currentSrc">
|
|
275
313
|
</figure>
|
|
276
314
|
</div>
|
|
277
315
|
<div class="lightbox-image-container">
|
|
278
|
-
<figure data-wp-bind--class="state.currentImage.figureClassNames" data-wp-bind--style="state.
|
|
316
|
+
<figure data-wp-bind--class="state.currentImage.figureClassNames" data-wp-bind--style="state.figureStyles">
|
|
279
317
|
<img data-wp-bind--alt="state.currentImage.alt" data-wp-bind--class="state.currentImage.imgClassNames" data-wp-bind--style="state.imgStyles" data-wp-bind--src="state.enlargedSrc">
|
|
280
318
|
</figure>
|
|
281
319
|
</div>
|
package/src/image/style.scss
CHANGED
|
@@ -9,6 +9,16 @@
|
|
|
9
9
|
max-width: 100%;
|
|
10
10
|
vertical-align: bottom;
|
|
11
11
|
box-sizing: border-box;
|
|
12
|
+
|
|
13
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
14
|
+
&.hide {
|
|
15
|
+
visibility: hidden;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&.show {
|
|
19
|
+
animation: show-content-image 0.4s;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
12
22
|
}
|
|
13
23
|
|
|
14
24
|
// The following style maintains border radius application for deprecated
|
|
@@ -319,6 +329,18 @@
|
|
|
319
329
|
}
|
|
320
330
|
}
|
|
321
331
|
|
|
332
|
+
@keyframes show-content-image {
|
|
333
|
+
0% {
|
|
334
|
+
visibility: hidden;
|
|
335
|
+
}
|
|
336
|
+
99% {
|
|
337
|
+
visibility: hidden;
|
|
338
|
+
}
|
|
339
|
+
100% {
|
|
340
|
+
visibility: visible;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
322
344
|
@keyframes turn-on-visibility {
|
|
323
345
|
0% {
|
|
324
346
|
opacity: 0;
|
package/src/image/transforms.js
CHANGED
package/src/image/view.js
CHANGED
|
@@ -19,27 +19,16 @@ let isTouching = false;
|
|
|
19
19
|
*/
|
|
20
20
|
let lastTouchTime = 0;
|
|
21
21
|
|
|
22
|
-
/**
|
|
23
|
-
* Stores the image reference of the currently opened lightbox.
|
|
24
|
-
*
|
|
25
|
-
* @type {HTMLElement}
|
|
26
|
-
*/
|
|
27
|
-
let imageRef;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Stores the button reference of the currently opened lightbox.
|
|
31
|
-
*
|
|
32
|
-
* @type {HTMLElement}
|
|
33
|
-
*/
|
|
34
|
-
let buttonRef;
|
|
35
|
-
|
|
36
22
|
const { state, actions, callbacks } = store(
|
|
37
23
|
'core/image',
|
|
38
24
|
{
|
|
39
25
|
state: {
|
|
40
|
-
|
|
26
|
+
currentImageId: null,
|
|
27
|
+
get currentImage() {
|
|
28
|
+
return state.metadata[ state.currentImageId ];
|
|
29
|
+
},
|
|
41
30
|
get overlayOpened() {
|
|
42
|
-
return state.
|
|
31
|
+
return state.currentImageId !== null;
|
|
43
32
|
},
|
|
44
33
|
get roleAttribute() {
|
|
45
34
|
return state.overlayOpened ? 'dialog' : null;
|
|
@@ -53,6 +42,15 @@ const { state, actions, callbacks } = store(
|
|
|
53
42
|
'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs='
|
|
54
43
|
);
|
|
55
44
|
},
|
|
45
|
+
get figureStyles() {
|
|
46
|
+
return (
|
|
47
|
+
state.overlayOpened &&
|
|
48
|
+
`${ state.currentImage.figureStyles?.replace(
|
|
49
|
+
/margin[^;]*;?/g,
|
|
50
|
+
''
|
|
51
|
+
) };`
|
|
52
|
+
);
|
|
53
|
+
},
|
|
56
54
|
get imgStyles() {
|
|
57
55
|
return (
|
|
58
56
|
state.overlayOpened &&
|
|
@@ -62,33 +60,56 @@ const { state, actions, callbacks } = store(
|
|
|
62
60
|
) }; object-fit:cover;`
|
|
63
61
|
);
|
|
64
62
|
},
|
|
63
|
+
get imageButtonRight() {
|
|
64
|
+
const { imageId } = getContext();
|
|
65
|
+
return state.metadata[ imageId ].imageButtonRight;
|
|
66
|
+
},
|
|
67
|
+
get imageButtonTop() {
|
|
68
|
+
const { imageId } = getContext();
|
|
69
|
+
return state.metadata[ imageId ].imageButtonTop;
|
|
70
|
+
},
|
|
71
|
+
get isContentHidden() {
|
|
72
|
+
const ctx = getContext();
|
|
73
|
+
return (
|
|
74
|
+
state.overlayEnabled && state.currentImageId === ctx.imageId
|
|
75
|
+
);
|
|
76
|
+
},
|
|
77
|
+
get isContentVisible() {
|
|
78
|
+
const ctx = getContext();
|
|
79
|
+
return (
|
|
80
|
+
! state.overlayEnabled &&
|
|
81
|
+
state.currentImageId === ctx.imageId
|
|
82
|
+
);
|
|
83
|
+
},
|
|
65
84
|
},
|
|
66
85
|
actions: {
|
|
67
86
|
showLightbox() {
|
|
68
|
-
const
|
|
87
|
+
const { imageId } = getContext();
|
|
69
88
|
|
|
70
89
|
// Bails out if the image has not loaded yet.
|
|
71
|
-
if ( !
|
|
90
|
+
if ( ! state.metadata[ imageId ].imageRef?.complete ) {
|
|
72
91
|
return;
|
|
73
92
|
}
|
|
74
93
|
|
|
75
|
-
// Stores the
|
|
94
|
+
// Stores the positions of the scroll to fix it until the overlay is
|
|
76
95
|
// closed.
|
|
77
96
|
state.scrollTopReset = document.documentElement.scrollTop;
|
|
78
97
|
state.scrollLeftReset = document.documentElement.scrollLeft;
|
|
79
98
|
|
|
80
|
-
//
|
|
81
|
-
ctx.currentSrc = ctx.imageRef.currentSrc;
|
|
82
|
-
imageRef = ctx.imageRef;
|
|
83
|
-
buttonRef = ctx.buttonRef;
|
|
84
|
-
state.currentImage = ctx;
|
|
99
|
+
// Sets the current expanded image in the state and enables the overlay.
|
|
85
100
|
state.overlayEnabled = true;
|
|
101
|
+
state.currentImageId = imageId;
|
|
86
102
|
|
|
87
103
|
// Computes the styles of the overlay for the animation.
|
|
88
104
|
callbacks.setOverlayStyles();
|
|
89
105
|
},
|
|
90
106
|
hideLightbox() {
|
|
91
107
|
if ( state.overlayEnabled ) {
|
|
108
|
+
// Starts the overlay closing animation. The showClosingAnimation
|
|
109
|
+
// class is used to avoid showing it on page load.
|
|
110
|
+
state.showClosingAnimation = true;
|
|
111
|
+
state.overlayEnabled = false;
|
|
112
|
+
|
|
92
113
|
// Waits until the close animation has completed before allowing a
|
|
93
114
|
// user to scroll again. The duration of this animation is defined in
|
|
94
115
|
// the `styles.scss` file, but in any case we should wait a few
|
|
@@ -98,20 +119,13 @@ const { state, actions, callbacks } = store(
|
|
|
98
119
|
// Delays before changing the focus. Otherwise the focus ring will
|
|
99
120
|
// appear on Firefox before the image has finished animating, which
|
|
100
121
|
// looks broken.
|
|
101
|
-
buttonRef.focus( {
|
|
122
|
+
state.currentImage.buttonRef.focus( {
|
|
102
123
|
preventScroll: true,
|
|
103
124
|
} );
|
|
104
125
|
|
|
105
|
-
// Resets the current image to mark the overlay as closed.
|
|
106
|
-
state.
|
|
107
|
-
imageRef = null;
|
|
108
|
-
buttonRef = null;
|
|
126
|
+
// Resets the current image id to mark the overlay as closed.
|
|
127
|
+
state.currentImageId = null;
|
|
109
128
|
}, 450 );
|
|
110
|
-
|
|
111
|
-
// Starts the overlay closing animation. The showClosingAnimation
|
|
112
|
-
// class is used to avoid showing it on page load.
|
|
113
|
-
state.showClosingAnimation = true;
|
|
114
|
-
state.overlayEnabled = false;
|
|
115
129
|
}
|
|
116
130
|
},
|
|
117
131
|
handleKeydown( event ) {
|
|
@@ -174,7 +188,7 @@ const { state, actions, callbacks } = store(
|
|
|
174
188
|
},
|
|
175
189
|
callbacks: {
|
|
176
190
|
setOverlayStyles() {
|
|
177
|
-
if ( ! imageRef ) {
|
|
191
|
+
if ( ! state.currentImage.imageRef ) {
|
|
178
192
|
return;
|
|
179
193
|
}
|
|
180
194
|
|
|
@@ -183,9 +197,9 @@ const { state, actions, callbacks } = store(
|
|
|
183
197
|
naturalHeight,
|
|
184
198
|
offsetWidth: originalWidth,
|
|
185
199
|
offsetHeight: originalHeight,
|
|
186
|
-
} = imageRef;
|
|
200
|
+
} = state.currentImage.imageRef;
|
|
187
201
|
let { x: screenPosX, y: screenPosY } =
|
|
188
|
-
imageRef.getBoundingClientRect();
|
|
202
|
+
state.currentImage.imageRef.getBoundingClientRect();
|
|
189
203
|
|
|
190
204
|
// Natural ratio of the image clicked to open the lightbox.
|
|
191
205
|
const naturalRatio = naturalWidth / naturalHeight;
|
|
@@ -231,6 +245,7 @@ const { state, actions, callbacks } = store(
|
|
|
231
245
|
let containerMaxHeight = imgMaxHeight;
|
|
232
246
|
let containerWidth = imgMaxWidth;
|
|
233
247
|
let containerHeight = imgMaxHeight;
|
|
248
|
+
|
|
234
249
|
// Checks if the target image has a different ratio than the original
|
|
235
250
|
// one (thumbnail). Recalculates the width and height.
|
|
236
251
|
if ( naturalRatio.toFixed( 2 ) !== imgRatio.toFixed( 2 ) ) {
|
|
@@ -341,9 +356,11 @@ const { state, actions, callbacks } = store(
|
|
|
341
356
|
`;
|
|
342
357
|
},
|
|
343
358
|
setButtonStyles() {
|
|
344
|
-
const
|
|
359
|
+
const { imageId } = getContext();
|
|
345
360
|
const { ref } = getElement();
|
|
346
|
-
|
|
361
|
+
|
|
362
|
+
state.metadata[ imageId ].imageRef = ref;
|
|
363
|
+
state.metadata[ imageId ].currentSrc = ref.currentSrc;
|
|
347
364
|
|
|
348
365
|
const {
|
|
349
366
|
naturalWidth,
|
|
@@ -386,10 +403,13 @@ const { state, actions, callbacks } = store(
|
|
|
386
403
|
const buttonOffsetTop = figureHeight - offsetHeight;
|
|
387
404
|
const buttonOffsetRight = figureWidth - offsetWidth;
|
|
388
405
|
|
|
406
|
+
let imageButtonTop = buttonOffsetTop + 16;
|
|
407
|
+
let imageButtonRight = buttonOffsetRight + 16;
|
|
408
|
+
|
|
389
409
|
// In the case of an image with object-fit: contain, the size of the
|
|
390
410
|
// <img> element can be larger than the image itself, so it needs to
|
|
391
411
|
// calculate where to place the button.
|
|
392
|
-
if (
|
|
412
|
+
if ( state.metadata[ imageId ].scaleAttr === 'contain' ) {
|
|
393
413
|
// Natural ratio of the image.
|
|
394
414
|
const naturalRatio = naturalWidth / naturalHeight;
|
|
395
415
|
// Offset ratio of the image.
|
|
@@ -399,25 +419,25 @@ const { state, actions, callbacks } = store(
|
|
|
399
419
|
// If it reaches the width first, it keeps the width and compute the
|
|
400
420
|
// height.
|
|
401
421
|
const referenceHeight = offsetWidth / naturalRatio;
|
|
402
|
-
|
|
422
|
+
imageButtonTop =
|
|
403
423
|
( offsetHeight - referenceHeight ) / 2 +
|
|
404
424
|
buttonOffsetTop +
|
|
405
425
|
16;
|
|
406
|
-
|
|
426
|
+
imageButtonRight = buttonOffsetRight + 16;
|
|
407
427
|
} else {
|
|
408
428
|
// If it reaches the height first, it keeps the height and compute
|
|
409
429
|
// the width.
|
|
410
430
|
const referenceWidth = offsetHeight * naturalRatio;
|
|
411
|
-
|
|
412
|
-
|
|
431
|
+
imageButtonTop = buttonOffsetTop + 16;
|
|
432
|
+
imageButtonRight =
|
|
413
433
|
( offsetWidth - referenceWidth ) / 2 +
|
|
414
434
|
buttonOffsetRight +
|
|
415
435
|
16;
|
|
416
436
|
}
|
|
417
|
-
} else {
|
|
418
|
-
ctx.imageButtonTop = buttonOffsetTop + 16;
|
|
419
|
-
ctx.imageButtonRight = buttonOffsetRight + 16;
|
|
420
437
|
}
|
|
438
|
+
|
|
439
|
+
state.metadata[ imageId ].imageButtonTop = imageButtonTop;
|
|
440
|
+
state.metadata[ imageId ].imageButtonRight = imageButtonRight;
|
|
421
441
|
},
|
|
422
442
|
setOverlayFocus() {
|
|
423
443
|
if ( state.overlayEnabled ) {
|
|
@@ -427,9 +447,9 @@ const { state, actions, callbacks } = store(
|
|
|
427
447
|
}
|
|
428
448
|
},
|
|
429
449
|
initTriggerButton() {
|
|
430
|
-
const
|
|
450
|
+
const { imageId } = getContext();
|
|
431
451
|
const { ref } = getElement();
|
|
432
|
-
|
|
452
|
+
state.metadata[ imageId ].buttonRef = ref;
|
|
433
453
|
},
|
|
434
454
|
},
|
|
435
455
|
},
|