@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
|
@@ -18,29 +18,18 @@ let isTouching = false;
|
|
|
18
18
|
* @type {number}
|
|
19
19
|
*/
|
|
20
20
|
let lastTouchTime = 0;
|
|
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
21
|
const {
|
|
36
22
|
state,
|
|
37
23
|
actions,
|
|
38
24
|
callbacks
|
|
39
25
|
} = store('core/image', {
|
|
40
26
|
state: {
|
|
41
|
-
|
|
27
|
+
currentImageId: null,
|
|
28
|
+
get currentImage() {
|
|
29
|
+
return state.metadata[state.currentImageId];
|
|
30
|
+
},
|
|
42
31
|
get overlayOpened() {
|
|
43
|
-
return state.
|
|
32
|
+
return state.currentImageId !== null;
|
|
44
33
|
},
|
|
45
34
|
get roleAttribute() {
|
|
46
35
|
return state.overlayOpened ? 'dialog' : null;
|
|
@@ -51,36 +40,63 @@ const {
|
|
|
51
40
|
get enlargedSrc() {
|
|
52
41
|
return state.currentImage.uploadedSrc || 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=';
|
|
53
42
|
},
|
|
43
|
+
get figureStyles() {
|
|
44
|
+
return state.overlayOpened && `${state.currentImage.figureStyles?.replace(/margin[^;]*;?/g, '')};`;
|
|
45
|
+
},
|
|
54
46
|
get imgStyles() {
|
|
55
47
|
return state.overlayOpened && `${state.currentImage.imgStyles?.replace(/;$/, '')}; object-fit:cover;`;
|
|
48
|
+
},
|
|
49
|
+
get imageButtonRight() {
|
|
50
|
+
const {
|
|
51
|
+
imageId
|
|
52
|
+
} = getContext();
|
|
53
|
+
return state.metadata[imageId].imageButtonRight;
|
|
54
|
+
},
|
|
55
|
+
get imageButtonTop() {
|
|
56
|
+
const {
|
|
57
|
+
imageId
|
|
58
|
+
} = getContext();
|
|
59
|
+
return state.metadata[imageId].imageButtonTop;
|
|
60
|
+
},
|
|
61
|
+
get isContentHidden() {
|
|
62
|
+
const ctx = getContext();
|
|
63
|
+
return state.overlayEnabled && state.currentImageId === ctx.imageId;
|
|
64
|
+
},
|
|
65
|
+
get isContentVisible() {
|
|
66
|
+
const ctx = getContext();
|
|
67
|
+
return !state.overlayEnabled && state.currentImageId === ctx.imageId;
|
|
56
68
|
}
|
|
57
69
|
},
|
|
58
70
|
actions: {
|
|
59
71
|
showLightbox() {
|
|
60
|
-
const
|
|
72
|
+
const {
|
|
73
|
+
imageId
|
|
74
|
+
} = getContext();
|
|
61
75
|
|
|
62
76
|
// Bails out if the image has not loaded yet.
|
|
63
|
-
if (!
|
|
77
|
+
if (!state.metadata[imageId].imageRef?.complete) {
|
|
64
78
|
return;
|
|
65
79
|
}
|
|
66
80
|
|
|
67
|
-
// Stores the
|
|
81
|
+
// Stores the positions of the scroll to fix it until the overlay is
|
|
68
82
|
// closed.
|
|
69
83
|
state.scrollTopReset = document.documentElement.scrollTop;
|
|
70
84
|
state.scrollLeftReset = document.documentElement.scrollLeft;
|
|
71
85
|
|
|
72
|
-
//
|
|
73
|
-
ctx.currentSrc = ctx.imageRef.currentSrc;
|
|
74
|
-
imageRef = ctx.imageRef;
|
|
75
|
-
buttonRef = ctx.buttonRef;
|
|
76
|
-
state.currentImage = ctx;
|
|
86
|
+
// Sets the current expanded image in the state and enables the overlay.
|
|
77
87
|
state.overlayEnabled = true;
|
|
88
|
+
state.currentImageId = imageId;
|
|
78
89
|
|
|
79
90
|
// Computes the styles of the overlay for the animation.
|
|
80
91
|
callbacks.setOverlayStyles();
|
|
81
92
|
},
|
|
82
93
|
hideLightbox() {
|
|
83
94
|
if (state.overlayEnabled) {
|
|
95
|
+
// Starts the overlay closing animation. The showClosingAnimation
|
|
96
|
+
// class is used to avoid showing it on page load.
|
|
97
|
+
state.showClosingAnimation = true;
|
|
98
|
+
state.overlayEnabled = false;
|
|
99
|
+
|
|
84
100
|
// Waits until the close animation has completed before allowing a
|
|
85
101
|
// user to scroll again. The duration of this animation is defined in
|
|
86
102
|
// the `styles.scss` file, but in any case we should wait a few
|
|
@@ -90,20 +106,13 @@ const {
|
|
|
90
106
|
// Delays before changing the focus. Otherwise the focus ring will
|
|
91
107
|
// appear on Firefox before the image has finished animating, which
|
|
92
108
|
// looks broken.
|
|
93
|
-
buttonRef.focus({
|
|
109
|
+
state.currentImage.buttonRef.focus({
|
|
94
110
|
preventScroll: true
|
|
95
111
|
});
|
|
96
112
|
|
|
97
|
-
// Resets the current image to mark the overlay as closed.
|
|
98
|
-
state.
|
|
99
|
-
imageRef = null;
|
|
100
|
-
buttonRef = null;
|
|
113
|
+
// Resets the current image id to mark the overlay as closed.
|
|
114
|
+
state.currentImageId = null;
|
|
101
115
|
}, 450);
|
|
102
|
-
|
|
103
|
-
// Starts the overlay closing animation. The showClosingAnimation
|
|
104
|
-
// class is used to avoid showing it on page load.
|
|
105
|
-
state.showClosingAnimation = true;
|
|
106
|
-
state.overlayEnabled = false;
|
|
107
116
|
}
|
|
108
117
|
},
|
|
109
118
|
handleKeydown(event) {
|
|
@@ -165,7 +174,7 @@ const {
|
|
|
165
174
|
},
|
|
166
175
|
callbacks: {
|
|
167
176
|
setOverlayStyles() {
|
|
168
|
-
if (!imageRef) {
|
|
177
|
+
if (!state.currentImage.imageRef) {
|
|
169
178
|
return;
|
|
170
179
|
}
|
|
171
180
|
let {
|
|
@@ -173,11 +182,11 @@ const {
|
|
|
173
182
|
naturalHeight,
|
|
174
183
|
offsetWidth: originalWidth,
|
|
175
184
|
offsetHeight: originalHeight
|
|
176
|
-
} = imageRef;
|
|
185
|
+
} = state.currentImage.imageRef;
|
|
177
186
|
let {
|
|
178
187
|
x: screenPosX,
|
|
179
188
|
y: screenPosY
|
|
180
|
-
} = imageRef.getBoundingClientRect();
|
|
189
|
+
} = state.currentImage.imageRef.getBoundingClientRect();
|
|
181
190
|
|
|
182
191
|
// Natural ratio of the image clicked to open the lightbox.
|
|
183
192
|
const naturalRatio = naturalWidth / naturalHeight;
|
|
@@ -214,6 +223,7 @@ const {
|
|
|
214
223
|
let containerMaxHeight = imgMaxHeight;
|
|
215
224
|
let containerWidth = imgMaxWidth;
|
|
216
225
|
let containerHeight = imgMaxHeight;
|
|
226
|
+
|
|
217
227
|
// Checks if the target image has a different ratio than the original
|
|
218
228
|
// one (thumbnail). Recalculates the width and height.
|
|
219
229
|
if (naturalRatio.toFixed(2) !== imgRatio.toFixed(2)) {
|
|
@@ -308,11 +318,14 @@ const {
|
|
|
308
318
|
`;
|
|
309
319
|
},
|
|
310
320
|
setButtonStyles() {
|
|
311
|
-
const
|
|
321
|
+
const {
|
|
322
|
+
imageId
|
|
323
|
+
} = getContext();
|
|
312
324
|
const {
|
|
313
325
|
ref
|
|
314
326
|
} = getElement();
|
|
315
|
-
|
|
327
|
+
state.metadata[imageId].imageRef = ref;
|
|
328
|
+
state.metadata[imageId].currentSrc = ref.currentSrc;
|
|
316
329
|
const {
|
|
317
330
|
naturalWidth,
|
|
318
331
|
naturalHeight,
|
|
@@ -342,11 +355,13 @@ const {
|
|
|
342
355
|
}
|
|
343
356
|
const buttonOffsetTop = figureHeight - offsetHeight;
|
|
344
357
|
const buttonOffsetRight = figureWidth - offsetWidth;
|
|
358
|
+
let imageButtonTop = buttonOffsetTop + 16;
|
|
359
|
+
let imageButtonRight = buttonOffsetRight + 16;
|
|
345
360
|
|
|
346
361
|
// In the case of an image with object-fit: contain, the size of the
|
|
347
362
|
// <img> element can be larger than the image itself, so it needs to
|
|
348
363
|
// calculate where to place the button.
|
|
349
|
-
if (
|
|
364
|
+
if (state.metadata[imageId].scaleAttr === 'contain') {
|
|
350
365
|
// Natural ratio of the image.
|
|
351
366
|
const naturalRatio = naturalWidth / naturalHeight;
|
|
352
367
|
// Offset ratio of the image.
|
|
@@ -355,19 +370,18 @@ const {
|
|
|
355
370
|
// If it reaches the width first, it keeps the width and compute the
|
|
356
371
|
// height.
|
|
357
372
|
const referenceHeight = offsetWidth / naturalRatio;
|
|
358
|
-
|
|
359
|
-
|
|
373
|
+
imageButtonTop = (offsetHeight - referenceHeight) / 2 + buttonOffsetTop + 16;
|
|
374
|
+
imageButtonRight = buttonOffsetRight + 16;
|
|
360
375
|
} else {
|
|
361
376
|
// If it reaches the height first, it keeps the height and compute
|
|
362
377
|
// the width.
|
|
363
378
|
const referenceWidth = offsetHeight * naturalRatio;
|
|
364
|
-
|
|
365
|
-
|
|
379
|
+
imageButtonTop = buttonOffsetTop + 16;
|
|
380
|
+
imageButtonRight = (offsetWidth - referenceWidth) / 2 + buttonOffsetRight + 16;
|
|
366
381
|
}
|
|
367
|
-
} else {
|
|
368
|
-
ctx.imageButtonTop = buttonOffsetTop + 16;
|
|
369
|
-
ctx.imageButtonRight = buttonOffsetRight + 16;
|
|
370
382
|
}
|
|
383
|
+
state.metadata[imageId].imageButtonTop = imageButtonTop;
|
|
384
|
+
state.metadata[imageId].imageButtonRight = imageButtonRight;
|
|
371
385
|
},
|
|
372
386
|
setOverlayFocus() {
|
|
373
387
|
if (state.overlayEnabled) {
|
|
@@ -379,11 +393,13 @@ const {
|
|
|
379
393
|
}
|
|
380
394
|
},
|
|
381
395
|
initTriggerButton() {
|
|
382
|
-
const
|
|
396
|
+
const {
|
|
397
|
+
imageId
|
|
398
|
+
} = getContext();
|
|
383
399
|
const {
|
|
384
400
|
ref
|
|
385
401
|
} = getElement();
|
|
386
|
-
|
|
402
|
+
state.metadata[imageId].buttonRef = ref;
|
|
387
403
|
}
|
|
388
404
|
}
|
|
389
405
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["store","getContext","getElement","isTouching","lastTouchTime","imageRef","buttonRef","state","actions","callbacks","currentImage","overlayOpened","currentSrc","roleAttribute","ariaModal","enlargedSrc","uploadedSrc","imgStyles","replace","showLightbox","ctx","complete","scrollTopReset","document","documentElement","scrollTop","scrollLeftReset","scrollLeft","overlayEnabled","setOverlayStyles","hideLightbox","setTimeout","focus","preventScroll","showClosingAnimation","handleKeydown","event","key","preventDefault","ref","querySelector","handleTouchMove","handleTouchStart","handleTouchEnd","Date","now","handleScroll","window","scrollTo","naturalWidth","naturalHeight","offsetWidth","originalWidth","offsetHeight","originalHeight","x","screenPosX","y","screenPosY","getBoundingClientRect","naturalRatio","originalRatio","scaleAttr","heightWithoutSpace","widthWithoutSpace","imgMaxWidth","parseFloat","targetWidth","imgMaxHeight","targetHeight","imgRatio","containerMaxWidth","containerMaxHeight","containerWidth","containerHeight","toFixed","reducedHeight","reducedWidth","horizontalPadding","innerWidth","verticalPadding","targetMaxWidth","Math","min","targetMaxHeight","innerHeight","targetContainerRatio","containerScale","lightboxImgWidth","lightboxImgHeight","overlayStyles","clientWidth","setButtonStyles","figure","parentElement","figureWidth","figureHeight","clientHeight","caption","captionComputedStyle","getComputedStyle","includes","position","marginTop","marginBottom","buttonOffsetTop","buttonOffsetRight","offsetRatio","referenceHeight","imageButtonTop","imageButtonRight","referenceWidth","setOverlayFocus","initTriggerButton","lock"],"sources":["@wordpress/block-library/src/image/view.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store, getContext, getElement } from '@wordpress/interactivity';\n\n/**\n * Tracks whether user is touching screen; used to differentiate behavior for\n * touch and mouse input.\n *\n * @type {boolean}\n */\nlet isTouching = false;\n\n/**\n * Tracks the last time the screen was touched; used to differentiate behavior\n * for touch and mouse input.\n *\n * @type {number}\n */\nlet lastTouchTime = 0;\n\n/**\n * Stores the image reference of the currently opened lightbox.\n *\n * @type {HTMLElement}\n */\nlet imageRef;\n\n/**\n * Stores the button reference of the currently opened lightbox.\n *\n * @type {HTMLElement}\n */\nlet buttonRef;\n\nconst { state, actions, callbacks } = store(\n\t'core/image',\n\t{\n\t\tstate: {\n\t\t\tcurrentImage: {},\n\t\t\tget overlayOpened() {\n\t\t\t\treturn state.currentImage.currentSrc;\n\t\t\t},\n\t\t\tget roleAttribute() {\n\t\t\t\treturn state.overlayOpened ? 'dialog' : null;\n\t\t\t},\n\t\t\tget ariaModal() {\n\t\t\t\treturn state.overlayOpened ? 'true' : null;\n\t\t\t},\n\t\t\tget enlargedSrc() {\n\t\t\t\treturn (\n\t\t\t\t\tstate.currentImage.uploadedSrc ||\n\t\t\t\t\t'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs='\n\t\t\t\t);\n\t\t\t},\n\t\t\tget imgStyles() {\n\t\t\t\treturn (\n\t\t\t\t\tstate.overlayOpened &&\n\t\t\t\t\t`${ state.currentImage.imgStyles?.replace(\n\t\t\t\t\t\t/;$/,\n\t\t\t\t\t\t''\n\t\t\t\t\t) }; object-fit:cover;`\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t\tactions: {\n\t\t\tshowLightbox() {\n\t\t\t\tconst ctx = getContext();\n\n\t\t\t\t// Bails out if the image has not loaded yet.\n\t\t\t\tif ( ! ctx.imageRef?.complete ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Stores the positons of the scroll to fix it until the overlay is\n\t\t\t\t// closed.\n\t\t\t\tstate.scrollTopReset = document.documentElement.scrollTop;\n\t\t\t\tstate.scrollLeftReset = document.documentElement.scrollLeft;\n\n\t\t\t\t// Moves the information of the expaned image to the state.\n\t\t\t\tctx.currentSrc = ctx.imageRef.currentSrc;\n\t\t\t\timageRef = ctx.imageRef;\n\t\t\t\tbuttonRef = ctx.buttonRef;\n\t\t\t\tstate.currentImage = ctx;\n\t\t\t\tstate.overlayEnabled = true;\n\n\t\t\t\t// Computes the styles of the overlay for the animation.\n\t\t\t\tcallbacks.setOverlayStyles();\n\t\t\t},\n\t\t\thideLightbox() {\n\t\t\t\tif ( state.overlayEnabled ) {\n\t\t\t\t\t// Waits until the close animation has completed before allowing a\n\t\t\t\t\t// user to scroll again. The duration of this animation is defined in\n\t\t\t\t\t// the `styles.scss` file, but in any case we should wait a few\n\t\t\t\t\t// milliseconds longer than the duration, otherwise a user may scroll\n\t\t\t\t\t// too soon and cause the animation to look sloppy.\n\t\t\t\t\tsetTimeout( function () {\n\t\t\t\t\t\t// Delays before changing the focus. Otherwise the focus ring will\n\t\t\t\t\t\t// appear on Firefox before the image has finished animating, which\n\t\t\t\t\t\t// looks broken.\n\t\t\t\t\t\tbuttonRef.focus( {\n\t\t\t\t\t\t\tpreventScroll: true,\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t// Resets the current image to mark the overlay as closed.\n\t\t\t\t\t\tstate.currentImage = {};\n\t\t\t\t\t\timageRef = null;\n\t\t\t\t\t\tbuttonRef = null;\n\t\t\t\t\t}, 450 );\n\n\t\t\t\t\t// Starts the overlay closing animation. The showClosingAnimation\n\t\t\t\t\t// class is used to avoid showing it on page load.\n\t\t\t\t\tstate.showClosingAnimation = true;\n\t\t\t\t\tstate.overlayEnabled = false;\n\t\t\t\t}\n\t\t\t},\n\t\t\thandleKeydown( event ) {\n\t\t\t\tif ( state.overlayEnabled ) {\n\t\t\t\t\t// Focuses the close button when the user presses the tab key.\n\t\t\t\t\tif ( event.key === 'Tab' ) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tconst { ref } = getElement();\n\t\t\t\t\t\tref.querySelector( 'button' ).focus();\n\t\t\t\t\t}\n\t\t\t\t\t// Closes the lightbox when the user presses the escape key.\n\t\t\t\t\tif ( event.key === 'Escape' ) {\n\t\t\t\t\t\tactions.hideLightbox();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\thandleTouchMove( event ) {\n\t\t\t\t// On mobile devices, prevents triggering the scroll event because\n\t\t\t\t// otherwise the page jumps around when it resets the scroll position.\n\t\t\t\t// This also means that closing the lightbox requires that a user\n\t\t\t\t// perform a simple tap. This may be changed in the future if there is a\n\t\t\t\t// better alternative to override or reset the scroll position during\n\t\t\t\t// swipe actions.\n\t\t\t\tif ( state.overlayEnabled ) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t}\n\t\t\t},\n\t\t\thandleTouchStart() {\n\t\t\t\tisTouching = true;\n\t\t\t},\n\t\t\thandleTouchEnd() {\n\t\t\t\t// Waits a few milliseconds before resetting to ensure that pinch to\n\t\t\t\t// zoom works consistently on mobile devices when the lightbox is open.\n\t\t\t\tlastTouchTime = Date.now();\n\t\t\t\tisTouching = false;\n\t\t\t},\n\t\t\thandleScroll() {\n\t\t\t\t// Prevents scrolling behaviors that trigger content shift while the\n\t\t\t\t// lightbox is open. It would be better to accomplish through CSS alone,\n\t\t\t\t// but using overflow: hidden is currently the only way to do so and\n\t\t\t\t// that causes a layout to shift and prevents the zoom animation from\n\t\t\t\t// working in some cases because it's not possible to account for the\n\t\t\t\t// layout shift when doing the animation calculations. Instead, it uses\n\t\t\t\t// JavaScript to prevent and reset the scrolling behavior.\n\t\t\t\tif ( state.overlayOpened ) {\n\t\t\t\t\t// Avoids overriding the scroll behavior on mobile devices because\n\t\t\t\t\t// doing so breaks the pinch to zoom functionality, and users should\n\t\t\t\t\t// be able to zoom in further on the high-res image.\n\t\t\t\t\tif ( ! isTouching && Date.now() - lastTouchTime > 450 ) {\n\t\t\t\t\t\t// It doesn't rely on `event.preventDefault()` to prevent scrolling\n\t\t\t\t\t\t// because the scroll event can't be canceled, so it resets the\n\t\t\t\t\t\t// position instead.\n\t\t\t\t\t\twindow.scrollTo(\n\t\t\t\t\t\t\tstate.scrollLeftReset,\n\t\t\t\t\t\t\tstate.scrollTopReset\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\tcallbacks: {\n\t\t\tsetOverlayStyles() {\n\t\t\t\tif ( ! imageRef ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet {\n\t\t\t\t\tnaturalWidth,\n\t\t\t\t\tnaturalHeight,\n\t\t\t\t\toffsetWidth: originalWidth,\n\t\t\t\t\toffsetHeight: originalHeight,\n\t\t\t\t} = imageRef;\n\t\t\t\tlet { x: screenPosX, y: screenPosY } =\n\t\t\t\t\timageRef.getBoundingClientRect();\n\n\t\t\t\t// Natural ratio of the image clicked to open the lightbox.\n\t\t\t\tconst naturalRatio = naturalWidth / naturalHeight;\n\t\t\t\t// Original ratio of the image clicked to open the lightbox.\n\t\t\t\tlet originalRatio = originalWidth / originalHeight;\n\n\t\t\t\t// If it has object-fit: contain, recalculates the original sizes\n\t\t\t\t// and the screen position without the blank spaces.\n\t\t\t\tif ( state.currentImage.scaleAttr === 'contain' ) {\n\t\t\t\t\tif ( naturalRatio > originalRatio ) {\n\t\t\t\t\t\tconst heightWithoutSpace = originalWidth / naturalRatio;\n\t\t\t\t\t\t// Recalculates screen position without the top space.\n\t\t\t\t\t\tscreenPosY +=\n\t\t\t\t\t\t\t( originalHeight - heightWithoutSpace ) / 2;\n\t\t\t\t\t\toriginalHeight = heightWithoutSpace;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst widthWithoutSpace = originalHeight * naturalRatio;\n\t\t\t\t\t\t// Recalculates screen position without the left space.\n\t\t\t\t\t\tscreenPosX += ( originalWidth - widthWithoutSpace ) / 2;\n\t\t\t\t\t\toriginalWidth = widthWithoutSpace;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\toriginalRatio = originalWidth / originalHeight;\n\n\t\t\t\t// Typically, it uses the image's full-sized dimensions. If those\n\t\t\t\t// dimensions have not been set (i.e. an external image with only one\n\t\t\t\t// size), the image's dimensions in the lightbox are the same\n\t\t\t\t// as those of the image in the content.\n\t\t\t\tlet imgMaxWidth = parseFloat(\n\t\t\t\t\tstate.currentImage.targetWidth !== 'none'\n\t\t\t\t\t\t? state.currentImage.targetWidth\n\t\t\t\t\t\t: naturalWidth\n\t\t\t\t);\n\t\t\t\tlet imgMaxHeight = parseFloat(\n\t\t\t\t\tstate.currentImage.targetHeight !== 'none'\n\t\t\t\t\t\t? state.currentImage.targetHeight\n\t\t\t\t\t\t: naturalHeight\n\t\t\t\t);\n\n\t\t\t\t// Ratio of the biggest image stored in the database.\n\t\t\t\tlet imgRatio = imgMaxWidth / imgMaxHeight;\n\t\t\t\tlet containerMaxWidth = imgMaxWidth;\n\t\t\t\tlet containerMaxHeight = imgMaxHeight;\n\t\t\t\tlet containerWidth = imgMaxWidth;\n\t\t\t\tlet containerHeight = imgMaxHeight;\n\t\t\t\t// Checks if the target image has a different ratio than the original\n\t\t\t\t// one (thumbnail). Recalculates the width and height.\n\t\t\t\tif ( naturalRatio.toFixed( 2 ) !== imgRatio.toFixed( 2 ) ) {\n\t\t\t\t\tif ( naturalRatio > imgRatio ) {\n\t\t\t\t\t\t// If the width is reached before the height, it keeps the maxWidth\n\t\t\t\t\t\t// and recalculates the height unless the difference between the\n\t\t\t\t\t\t// maxHeight and the reducedHeight is higher than the maxWidth,\n\t\t\t\t\t\t// where it keeps the reducedHeight and recalculate the width.\n\t\t\t\t\t\tconst reducedHeight = imgMaxWidth / naturalRatio;\n\t\t\t\t\t\tif ( imgMaxHeight - reducedHeight > imgMaxWidth ) {\n\t\t\t\t\t\t\timgMaxHeight = reducedHeight;\n\t\t\t\t\t\t\timgMaxWidth = reducedHeight * naturalRatio;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\timgMaxHeight = imgMaxWidth / naturalRatio;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// If the height is reached before the width, it keeps the maxHeight\n\t\t\t\t\t\t// and recalculate the width unlesss the difference between the\n\t\t\t\t\t\t// maxWidth and the reducedWidth is higher than the maxHeight, where\n\t\t\t\t\t\t// it keeps the reducedWidth and recalculate the height.\n\t\t\t\t\t\tconst reducedWidth = imgMaxHeight * naturalRatio;\n\t\t\t\t\t\tif ( imgMaxWidth - reducedWidth > imgMaxHeight ) {\n\t\t\t\t\t\t\timgMaxWidth = reducedWidth;\n\t\t\t\t\t\t\timgMaxHeight = reducedWidth / naturalRatio;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\timgMaxWidth = imgMaxHeight * naturalRatio;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcontainerWidth = imgMaxWidth;\n\t\t\t\t\tcontainerHeight = imgMaxHeight;\n\t\t\t\t\timgRatio = imgMaxWidth / imgMaxHeight;\n\n\t\t\t\t\t// Calculates the max size of the container.\n\t\t\t\t\tif ( originalRatio > imgRatio ) {\n\t\t\t\t\t\tcontainerMaxWidth = imgMaxWidth;\n\t\t\t\t\t\tcontainerMaxHeight = containerMaxWidth / originalRatio;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcontainerMaxHeight = imgMaxHeight;\n\t\t\t\t\t\tcontainerMaxWidth = containerMaxHeight * originalRatio;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// If the image has been pixelated on purpose, it keeps that size.\n\t\t\t\tif (\n\t\t\t\t\toriginalWidth > containerWidth ||\n\t\t\t\t\toriginalHeight > containerHeight\n\t\t\t\t) {\n\t\t\t\t\tcontainerWidth = originalWidth;\n\t\t\t\t\tcontainerHeight = originalHeight;\n\t\t\t\t}\n\n\t\t\t\t// Calculates the final lightbox image size and the scale factor.\n\t\t\t\t// MaxWidth is either the window container (accounting for padding) or\n\t\t\t\t// the image resolution.\n\t\t\t\tlet horizontalPadding = 0;\n\t\t\t\tif ( window.innerWidth > 480 ) {\n\t\t\t\t\thorizontalPadding = 80;\n\t\t\t\t} else if ( window.innerWidth > 1920 ) {\n\t\t\t\t\thorizontalPadding = 160;\n\t\t\t\t}\n\t\t\t\tconst verticalPadding = 80;\n\n\t\t\t\tconst targetMaxWidth = Math.min(\n\t\t\t\t\twindow.innerWidth - horizontalPadding,\n\t\t\t\t\tcontainerWidth\n\t\t\t\t);\n\t\t\t\tconst targetMaxHeight = Math.min(\n\t\t\t\t\twindow.innerHeight - verticalPadding,\n\t\t\t\t\tcontainerHeight\n\t\t\t\t);\n\t\t\t\tconst targetContainerRatio = targetMaxWidth / targetMaxHeight;\n\n\t\t\t\tif ( originalRatio > targetContainerRatio ) {\n\t\t\t\t\t// If targetMaxWidth is reached before targetMaxHeight.\n\t\t\t\t\tcontainerWidth = targetMaxWidth;\n\t\t\t\t\tcontainerHeight = containerWidth / originalRatio;\n\t\t\t\t} else {\n\t\t\t\t\t// If targetMaxHeight is reached before targetMaxWidth.\n\t\t\t\t\tcontainerHeight = targetMaxHeight;\n\t\t\t\t\tcontainerWidth = containerHeight * originalRatio;\n\t\t\t\t}\n\n\t\t\t\tconst containerScale = originalWidth / containerWidth;\n\t\t\t\tconst lightboxImgWidth =\n\t\t\t\t\timgMaxWidth * ( containerWidth / containerMaxWidth );\n\t\t\t\tconst lightboxImgHeight =\n\t\t\t\t\timgMaxHeight * ( containerHeight / containerMaxHeight );\n\n\t\t\t\t// As of this writing, using the calculations above will render the\n\t\t\t\t// lightbox with a small, erroneous whitespace on the left side of the\n\t\t\t\t// image in iOS Safari, perhaps due to an inconsistency in how browsers\n\t\t\t\t// handle absolute positioning and CSS transformation. In any case,\n\t\t\t\t// adding 1 pixel to the container width and height solves the problem,\n\t\t\t\t// though this can be removed if the issue is fixed in the future.\n\t\t\t\tstate.overlayStyles = `\n\t\t\t\t:root {\n\t\t\t\t\t--wp--lightbox-initial-top-position: ${ screenPosY }px;\n\t\t\t\t\t--wp--lightbox-initial-left-position: ${ screenPosX }px;\n\t\t\t\t\t--wp--lightbox-container-width: ${ containerWidth + 1 }px;\n\t\t\t\t\t--wp--lightbox-container-height: ${ containerHeight + 1 }px;\n\t\t\t\t\t--wp--lightbox-image-width: ${ lightboxImgWidth }px;\n\t\t\t\t\t--wp--lightbox-image-height: ${ lightboxImgHeight }px;\n\t\t\t\t\t--wp--lightbox-scale: ${ containerScale };\n\t\t\t\t\t--wp--lightbox-scrollbar-width: ${\n\t\t\t\t\t\twindow.innerWidth - document.documentElement.clientWidth\n\t\t\t\t\t}px;\n\t\t\t\t}\n\t\t\t`;\n\t\t\t},\n\t\t\tsetButtonStyles() {\n\t\t\t\tconst ctx = getContext();\n\t\t\t\tconst { ref } = getElement();\n\t\t\t\tctx.imageRef = ref;\n\n\t\t\t\tconst {\n\t\t\t\t\tnaturalWidth,\n\t\t\t\t\tnaturalHeight,\n\t\t\t\t\toffsetWidth,\n\t\t\t\t\toffsetHeight,\n\t\t\t\t} = ref;\n\n\t\t\t\t// If the image isn't loaded yet, it can't calculate where the button\n\t\t\t\t// should be.\n\t\t\t\tif ( naturalWidth === 0 || naturalHeight === 0 ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst figure = ref.parentElement;\n\t\t\t\tconst figureWidth = ref.parentElement.clientWidth;\n\n\t\t\t\t// It needs special handling for the height because a caption will cause\n\t\t\t\t// the figure to be taller than the image, which means it needs to\n\t\t\t\t// account for that when calculating the placement of the button in the\n\t\t\t\t// top right corner of the image.\n\t\t\t\tlet figureHeight = ref.parentElement.clientHeight;\n\t\t\t\tconst caption = figure.querySelector( 'figcaption' );\n\t\t\t\tif ( caption ) {\n\t\t\t\t\tconst captionComputedStyle =\n\t\t\t\t\t\twindow.getComputedStyle( caption );\n\t\t\t\t\tif (\n\t\t\t\t\t\t! [ 'absolute', 'fixed' ].includes(\n\t\t\t\t\t\t\tcaptionComputedStyle.position\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\tfigureHeight =\n\t\t\t\t\t\t\tfigureHeight -\n\t\t\t\t\t\t\tcaption.offsetHeight -\n\t\t\t\t\t\t\tparseFloat( captionComputedStyle.marginTop ) -\n\t\t\t\t\t\t\tparseFloat( captionComputedStyle.marginBottom );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst buttonOffsetTop = figureHeight - offsetHeight;\n\t\t\t\tconst buttonOffsetRight = figureWidth - offsetWidth;\n\n\t\t\t\t// In the case of an image with object-fit: contain, the size of the\n\t\t\t\t// <img> element can be larger than the image itself, so it needs to\n\t\t\t\t// calculate where to place the button.\n\t\t\t\tif ( ctx.scaleAttr === 'contain' ) {\n\t\t\t\t\t// Natural ratio of the image.\n\t\t\t\t\tconst naturalRatio = naturalWidth / naturalHeight;\n\t\t\t\t\t// Offset ratio of the image.\n\t\t\t\t\tconst offsetRatio = offsetWidth / offsetHeight;\n\n\t\t\t\t\tif ( naturalRatio >= offsetRatio ) {\n\t\t\t\t\t\t// If it reaches the width first, it keeps the width and compute the\n\t\t\t\t\t\t// height.\n\t\t\t\t\t\tconst referenceHeight = offsetWidth / naturalRatio;\n\t\t\t\t\t\tctx.imageButtonTop =\n\t\t\t\t\t\t\t( offsetHeight - referenceHeight ) / 2 +\n\t\t\t\t\t\t\tbuttonOffsetTop +\n\t\t\t\t\t\t\t16;\n\t\t\t\t\t\tctx.imageButtonRight = buttonOffsetRight + 16;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// If it reaches the height first, it keeps the height and compute\n\t\t\t\t\t\t// the width.\n\t\t\t\t\t\tconst referenceWidth = offsetHeight * naturalRatio;\n\t\t\t\t\t\tctx.imageButtonTop = buttonOffsetTop + 16;\n\t\t\t\t\t\tctx.imageButtonRight =\n\t\t\t\t\t\t\t( offsetWidth - referenceWidth ) / 2 +\n\t\t\t\t\t\t\tbuttonOffsetRight +\n\t\t\t\t\t\t\t16;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tctx.imageButtonTop = buttonOffsetTop + 16;\n\t\t\t\t\tctx.imageButtonRight = buttonOffsetRight + 16;\n\t\t\t\t}\n\t\t\t},\n\t\t\tsetOverlayFocus() {\n\t\t\t\tif ( state.overlayEnabled ) {\n\t\t\t\t\t// Moves the focus to the dialog when it opens.\n\t\t\t\t\tconst { ref } = getElement();\n\t\t\t\t\tref.focus();\n\t\t\t\t}\n\t\t\t},\n\t\t\tinitTriggerButton() {\n\t\t\t\tconst ctx = getContext();\n\t\t\t\tconst { ref } = getElement();\n\t\t\t\tctx.buttonRef = ref;\n\t\t\t},\n\t\t},\n\t},\n\t{ lock: true }\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,EAAEC,UAAU,EAAEC,UAAU,QAAQ,0BAA0B;;AAExE;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,UAAU,GAAG,KAAK;;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,aAAa,GAAG,CAAC;;AAErB;AACA;AACA;AACA;AACA;AACA,IAAIC,QAAQ;;AAEZ;AACA;AACA;AACA;AACA;AACA,IAAIC,SAAS;AAEb,MAAM;EAAEC,KAAK;EAAEC,OAAO;EAAEC;AAAU,CAAC,GAAGT,KAAK,CAC1C,YAAY,EACZ;EACCO,KAAK,EAAE;IACNG,YAAY,EAAE,CAAC,CAAC;IAChB,IAAIC,aAAaA,CAAA,EAAG;MACnB,OAAOJ,KAAK,CAACG,YAAY,CAACE,UAAU;IACrC,CAAC;IACD,IAAIC,aAAaA,CAAA,EAAG;MACnB,OAAON,KAAK,CAACI,aAAa,GAAG,QAAQ,GAAG,IAAI;IAC7C,CAAC;IACD,IAAIG,SAASA,CAAA,EAAG;MACf,OAAOP,KAAK,CAACI,aAAa,GAAG,MAAM,GAAG,IAAI;IAC3C,CAA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Aa;QACjD;QACA,MAAMyD,WAAW,GAAGxD,WAAW,GAAGE,YAAY;QAE9C,IAAKO,YAAY,IAAI+C,WAAW,EAAG;UAClC;UACA;UACA,MAAMC,eAAe,GAAGzD,WAAW,GAAGS,YAAY;UAClDxC,GAAG,CAACyF,cAAc,GACjB,CAAExD,YAAY,GAAGuD,eAAe,IAAK,CAAC,GACtCH,eAAe,GACf,EAAE;UACHrF,GAAG,CAAC0F,gBAAgB,GAAGJ,iBAAiB,GAAG,EAAE;QAC9C,CAAC,MAAM;UACN;UACA;UACA,MAAMK,cAAc,GAAG1D,YAAY,GAAGO,YAAY;UAClDxC,GAAG,CAACyF,cAAc,GAAGJ,eAAe,GAAG,EAAE;UACzCrF,GAAG,CAAC0F,gBAAgB,GACnB,CAAE3D,WAAW,GAAG4D,cAAc,IAAK,CAAC,GACpCL,iBAAiB,GACjB,EAAE;QACJ;MACD,CAAC,MAAM;QACNtF,GAAG,CAACyF,cAAc,GAAGJ,eAAe,GAAG,EAAE;QACzCrF,GAAG,CAAC0F,gBAAgB,GAAGJ,iBAAiB,GAAG,EAAE;MAC9C;IACD,CAAC;IACDM,eAAeA,CAAA,EAAG;MACjB,IAAKzG,KAAK,CAACqB,cAAc,EAAG;QAC3B;QACA,MAAM;UAAEW;QAAI,CAAC,GAAGrC,UAAU,CAAC,CAAC;QAC5BqC,GAAG,CAACP,KAAK,CAAC,CAAC;MACZ;IACD,CAAC;IACDiF,iBAAiBA,CAAA,EAAG;MACnB,MAAM7F,GAAG,GAAGnB,UAAU,CAAC,CAAC;MACxB,MAAM;QAAEsC;MAAI,CAAC,GAAGrC,UAAU,CAAC,CAAC;MAC5BkB,GAAG,CAACd,SAAS,GAAGiC,GAAG;IACpB;EACD;AACD,CAAC,EACD;EAAE2E,IAAI,EAAE;AAAK,CACd,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["store","getContext","getElement","isTouching","lastTouchTime","state","actions","callbacks","currentImageId","currentImage","metadata","overlayOpened","roleAttribute","ariaModal","enlargedSrc","uploadedSrc","figureStyles","replace","imgStyles","imageButtonRight","imageId","imageButtonTop","isContentHidden","ctx","overlayEnabled","isContentVisible","showLightbox","imageRef","complete","scrollTopReset","document","documentElement","scrollTop","scrollLeftReset","scrollLeft","setOverlayStyles","hideLightbox","showClosingAnimation","setTimeout","buttonRef","focus","preventScroll","handleKeydown","event","key","preventDefault","ref","querySelector","handleTouchMove","handleTouchStart","handleTouchEnd","Date","now","handleScroll","window","scrollTo","naturalWidth","naturalHeight","offsetWidth","originalWidth","offsetHeight","originalHeight","x","screenPosX","y","screenPosY","getBoundingClientRect","naturalRatio","originalRatio","scaleAttr","heightWithoutSpace","widthWithoutSpace","imgMaxWidth","parseFloat","targetWidth","imgMaxHeight","targetHeight","imgRatio","containerMaxWidth","containerMaxHeight","containerWidth","containerHeight","toFixed","reducedHeight","reducedWidth","horizontalPadding","innerWidth","verticalPadding","targetMaxWidth","Math","min","targetMaxHeight","innerHeight","targetContainerRatio","containerScale","lightboxImgWidth","lightboxImgHeight","overlayStyles","clientWidth","setButtonStyles","currentSrc","figure","parentElement","figureWidth","figureHeight","clientHeight","caption","captionComputedStyle","getComputedStyle","includes","position","marginTop","marginBottom","buttonOffsetTop","buttonOffsetRight","offsetRatio","referenceHeight","referenceWidth","setOverlayFocus","initTriggerButton","lock"],"sources":["@wordpress/block-library/src/image/view.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store, getContext, getElement } from '@wordpress/interactivity';\n\n/**\n * Tracks whether user is touching screen; used to differentiate behavior for\n * touch and mouse input.\n *\n * @type {boolean}\n */\nlet isTouching = false;\n\n/**\n * Tracks the last time the screen was touched; used to differentiate behavior\n * for touch and mouse input.\n *\n * @type {number}\n */\nlet lastTouchTime = 0;\n\nconst { state, actions, callbacks } = store(\n\t'core/image',\n\t{\n\t\tstate: {\n\t\t\tcurrentImageId: null,\n\t\t\tget currentImage() {\n\t\t\t\treturn state.metadata[ state.currentImageId ];\n\t\t\t},\n\t\t\tget overlayOpened() {\n\t\t\t\treturn state.currentImageId !== null;\n\t\t\t},\n\t\t\tget roleAttribute() {\n\t\t\t\treturn state.overlayOpened ? 'dialog' : null;\n\t\t\t},\n\t\t\tget ariaModal() {\n\t\t\t\treturn state.overlayOpened ? 'true' : null;\n\t\t\t},\n\t\t\tget enlargedSrc() {\n\t\t\t\treturn (\n\t\t\t\t\tstate.currentImage.uploadedSrc ||\n\t\t\t\t\t'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs='\n\t\t\t\t);\n\t\t\t},\n\t\t\tget figureStyles() {\n\t\t\t\treturn (\n\t\t\t\t\tstate.overlayOpened &&\n\t\t\t\t\t`${ state.currentImage.figureStyles?.replace(\n\t\t\t\t\t\t/margin[^;]*;?/g,\n\t\t\t\t\t\t''\n\t\t\t\t\t) };`\n\t\t\t\t);\n\t\t\t},\n\t\t\tget imgStyles() {\n\t\t\t\treturn (\n\t\t\t\t\tstate.overlayOpened &&\n\t\t\t\t\t`${ state.currentImage.imgStyles?.replace(\n\t\t\t\t\t\t/;$/,\n\t\t\t\t\t\t''\n\t\t\t\t\t) }; object-fit:cover;`\n\t\t\t\t);\n\t\t\t},\n\t\t\tget imageButtonRight() {\n\t\t\t\tconst { imageId } = getContext();\n\t\t\t\treturn state.metadata[ imageId ].imageButtonRight;\n\t\t\t},\n\t\t\tget imageButtonTop() {\n\t\t\t\tconst { imageId } = getContext();\n\t\t\t\treturn state.metadata[ imageId ].imageButtonTop;\n\t\t\t},\n\t\t\tget isContentHidden() {\n\t\t\t\tconst ctx = getContext();\n\t\t\t\treturn (\n\t\t\t\t\tstate.overlayEnabled && state.currentImageId === ctx.imageId\n\t\t\t\t);\n\t\t\t},\n\t\t\tget isContentVisible() {\n\t\t\t\tconst ctx = getContext();\n\t\t\t\treturn (\n\t\t\t\t\t! state.overlayEnabled &&\n\t\t\t\t\tstate.currentImageId === ctx.imageId\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t\tactions: {\n\t\t\tshowLightbox() {\n\t\t\t\tconst { imageId } = getContext();\n\n\t\t\t\t// Bails out if the image has not loaded yet.\n\t\t\t\tif ( ! state.metadata[ imageId ].imageRef?.complete ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Stores the positions of the scroll to fix it until the overlay is\n\t\t\t\t// closed.\n\t\t\t\tstate.scrollTopReset = document.documentElement.scrollTop;\n\t\t\t\tstate.scrollLeftReset = document.documentElement.scrollLeft;\n\n\t\t\t\t// Sets the current expanded image in the state and enables the overlay.\n\t\t\t\tstate.overlayEnabled = true;\n\t\t\t\tstate.currentImageId = imageId;\n\n\t\t\t\t// Computes the styles of the overlay for the animation.\n\t\t\t\tcallbacks.setOverlayStyles();\n\t\t\t},\n\t\t\thideLightbox() {\n\t\t\t\tif ( state.overlayEnabled ) {\n\t\t\t\t\t// Starts the overlay closing animation. The showClosingAnimation\n\t\t\t\t\t// class is used to avoid showing it on page load.\n\t\t\t\t\tstate.showClosingAnimation = true;\n\t\t\t\t\tstate.overlayEnabled = false;\n\n\t\t\t\t\t// Waits until the close animation has completed before allowing a\n\t\t\t\t\t// user to scroll again. The duration of this animation is defined in\n\t\t\t\t\t// the `styles.scss` file, but in any case we should wait a few\n\t\t\t\t\t// milliseconds longer than the duration, otherwise a user may scroll\n\t\t\t\t\t// too soon and cause the animation to look sloppy.\n\t\t\t\t\tsetTimeout( function () {\n\t\t\t\t\t\t// Delays before changing the focus. Otherwise the focus ring will\n\t\t\t\t\t\t// appear on Firefox before the image has finished animating, which\n\t\t\t\t\t\t// looks broken.\n\t\t\t\t\t\tstate.currentImage.buttonRef.focus( {\n\t\t\t\t\t\t\tpreventScroll: true,\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t// Resets the current image id to mark the overlay as closed.\n\t\t\t\t\t\tstate.currentImageId = null;\n\t\t\t\t\t}, 450 );\n\t\t\t\t}\n\t\t\t},\n\t\t\thandleKeydown( event ) {\n\t\t\t\tif ( state.overlayEnabled ) {\n\t\t\t\t\t// Focuses the close button when the user presses the tab key.\n\t\t\t\t\tif ( event.key === 'Tab' ) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tconst { ref } = getElement();\n\t\t\t\t\t\tref.querySelector( 'button' ).focus();\n\t\t\t\t\t}\n\t\t\t\t\t// Closes the lightbox when the user presses the escape key.\n\t\t\t\t\tif ( event.key === 'Escape' ) {\n\t\t\t\t\t\tactions.hideLightbox();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\thandleTouchMove( event ) {\n\t\t\t\t// On mobile devices, prevents triggering the scroll event because\n\t\t\t\t// otherwise the page jumps around when it resets the scroll position.\n\t\t\t\t// This also means that closing the lightbox requires that a user\n\t\t\t\t// perform a simple tap. This may be changed in the future if there is a\n\t\t\t\t// better alternative to override or reset the scroll position during\n\t\t\t\t// swipe actions.\n\t\t\t\tif ( state.overlayEnabled ) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t}\n\t\t\t},\n\t\t\thandleTouchStart() {\n\t\t\t\tisTouching = true;\n\t\t\t},\n\t\t\thandleTouchEnd() {\n\t\t\t\t// Waits a few milliseconds before resetting to ensure that pinch to\n\t\t\t\t// zoom works consistently on mobile devices when the lightbox is open.\n\t\t\t\tlastTouchTime = Date.now();\n\t\t\t\tisTouching = false;\n\t\t\t},\n\t\t\thandleScroll() {\n\t\t\t\t// Prevents scrolling behaviors that trigger content shift while the\n\t\t\t\t// lightbox is open. It would be better to accomplish through CSS alone,\n\t\t\t\t// but using overflow: hidden is currently the only way to do so and\n\t\t\t\t// that causes a layout to shift and prevents the zoom animation from\n\t\t\t\t// working in some cases because it's not possible to account for the\n\t\t\t\t// layout shift when doing the animation calculations. Instead, it uses\n\t\t\t\t// JavaScript to prevent and reset the scrolling behavior.\n\t\t\t\tif ( state.overlayOpened ) {\n\t\t\t\t\t// Avoids overriding the scroll behavior on mobile devices because\n\t\t\t\t\t// doing so breaks the pinch to zoom functionality, and users should\n\t\t\t\t\t// be able to zoom in further on the high-res image.\n\t\t\t\t\tif ( ! isTouching && Date.now() - lastTouchTime > 450 ) {\n\t\t\t\t\t\t// It doesn't rely on `event.preventDefault()` to prevent scrolling\n\t\t\t\t\t\t// because the scroll event can't be canceled, so it resets the\n\t\t\t\t\t\t// position instead.\n\t\t\t\t\t\twindow.scrollTo(\n\t\t\t\t\t\t\tstate.scrollLeftReset,\n\t\t\t\t\t\t\tstate.scrollTopReset\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\tcallbacks: {\n\t\t\tsetOverlayStyles() {\n\t\t\t\tif ( ! state.currentImage.imageRef ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet {\n\t\t\t\t\tnaturalWidth,\n\t\t\t\t\tnaturalHeight,\n\t\t\t\t\toffsetWidth: originalWidth,\n\t\t\t\t\toffsetHeight: originalHeight,\n\t\t\t\t} = state.currentImage.imageRef;\n\t\t\t\tlet { x: screenPosX, y: screenPosY } =\n\t\t\t\t\tstate.currentImage.imageRef.getBoundingClientRect();\n\n\t\t\t\t// Natural ratio of the image clicked to open the lightbox.\n\t\t\t\tconst naturalRatio = naturalWidth / naturalHeight;\n\t\t\t\t// Original ratio of the image clicked to open the lightbox.\n\t\t\t\tlet originalRatio = originalWidth / originalHeight;\n\n\t\t\t\t// If it has object-fit: contain, recalculates the original sizes\n\t\t\t\t// and the screen position without the blank spaces.\n\t\t\t\tif ( state.currentImage.scaleAttr === 'contain' ) {\n\t\t\t\t\tif ( naturalRatio > originalRatio ) {\n\t\t\t\t\t\tconst heightWithoutSpace = originalWidth / naturalRatio;\n\t\t\t\t\t\t// Recalculates screen position without the top space.\n\t\t\t\t\t\tscreenPosY +=\n\t\t\t\t\t\t\t( originalHeight - heightWithoutSpace ) / 2;\n\t\t\t\t\t\toriginalHeight = heightWithoutSpace;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst widthWithoutSpace = originalHeight * naturalRatio;\n\t\t\t\t\t\t// Recalculates screen position without the left space.\n\t\t\t\t\t\tscreenPosX += ( originalWidth - widthWithoutSpace ) / 2;\n\t\t\t\t\t\toriginalWidth = widthWithoutSpace;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\toriginalRatio = originalWidth / originalHeight;\n\n\t\t\t\t// Typically, it uses the image's full-sized dimensions. If those\n\t\t\t\t// dimensions have not been set (i.e. an external image with only one\n\t\t\t\t// size), the image's dimensions in the lightbox are the same\n\t\t\t\t// as those of the image in the content.\n\t\t\t\tlet imgMaxWidth = parseFloat(\n\t\t\t\t\tstate.currentImage.targetWidth !== 'none'\n\t\t\t\t\t\t? state.currentImage.targetWidth\n\t\t\t\t\t\t: naturalWidth\n\t\t\t\t);\n\t\t\t\tlet imgMaxHeight = parseFloat(\n\t\t\t\t\tstate.currentImage.targetHeight !== 'none'\n\t\t\t\t\t\t? state.currentImage.targetHeight\n\t\t\t\t\t\t: naturalHeight\n\t\t\t\t);\n\n\t\t\t\t// Ratio of the biggest image stored in the database.\n\t\t\t\tlet imgRatio = imgMaxWidth / imgMaxHeight;\n\t\t\t\tlet containerMaxWidth = imgMaxWidth;\n\t\t\t\tlet containerMaxHeight = imgMaxHeight;\n\t\t\t\tlet containerWidth = imgMaxWidth;\n\t\t\t\tlet containerHeight = imgMaxHeight;\n\n\t\t\t\t// Checks if the target image has a different ratio than the original\n\t\t\t\t// one (thumbnail). Recalculates the width and height.\n\t\t\t\tif ( naturalRatio.toFixed( 2 ) !== imgRatio.toFixed( 2 ) ) {\n\t\t\t\t\tif ( naturalRatio > imgRatio ) {\n\t\t\t\t\t\t// If the width is reached before the height, it keeps the maxWidth\n\t\t\t\t\t\t// and recalculates the height unless the difference between the\n\t\t\t\t\t\t// maxHeight and the reducedHeight is higher than the maxWidth,\n\t\t\t\t\t\t// where it keeps the reducedHeight and recalculate the width.\n\t\t\t\t\t\tconst reducedHeight = imgMaxWidth / naturalRatio;\n\t\t\t\t\t\tif ( imgMaxHeight - reducedHeight > imgMaxWidth ) {\n\t\t\t\t\t\t\timgMaxHeight = reducedHeight;\n\t\t\t\t\t\t\timgMaxWidth = reducedHeight * naturalRatio;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\timgMaxHeight = imgMaxWidth / naturalRatio;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// If the height is reached before the width, it keeps the maxHeight\n\t\t\t\t\t\t// and recalculate the width unlesss the difference between the\n\t\t\t\t\t\t// maxWidth and the reducedWidth is higher than the maxHeight, where\n\t\t\t\t\t\t// it keeps the reducedWidth and recalculate the height.\n\t\t\t\t\t\tconst reducedWidth = imgMaxHeight * naturalRatio;\n\t\t\t\t\t\tif ( imgMaxWidth - reducedWidth > imgMaxHeight ) {\n\t\t\t\t\t\t\timgMaxWidth = reducedWidth;\n\t\t\t\t\t\t\timgMaxHeight = reducedWidth / naturalRatio;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\timgMaxWidth = imgMaxHeight * naturalRatio;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcontainerWidth = imgMaxWidth;\n\t\t\t\t\tcontainerHeight = imgMaxHeight;\n\t\t\t\t\timgRatio = imgMaxWidth / imgMaxHeight;\n\n\t\t\t\t\t// Calculates the max size of the container.\n\t\t\t\t\tif ( originalRatio > imgRatio ) {\n\t\t\t\t\t\tcontainerMaxWidth = imgMaxWidth;\n\t\t\t\t\t\tcontainerMaxHeight = containerMaxWidth / originalRatio;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcontainerMaxHeight = imgMaxHeight;\n\t\t\t\t\t\tcontainerMaxWidth = containerMaxHeight * originalRatio;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// If the image has been pixelated on purpose, it keeps that size.\n\t\t\t\tif (\n\t\t\t\t\toriginalWidth > containerWidth ||\n\t\t\t\t\toriginalHeight > containerHeight\n\t\t\t\t) {\n\t\t\t\t\tcontainerWidth = originalWidth;\n\t\t\t\t\tcontainerHeight = originalHeight;\n\t\t\t\t}\n\n\t\t\t\t// Calculates the final lightbox image size and the scale factor.\n\t\t\t\t// MaxWidth is either the window container (accounting for padding) or\n\t\t\t\t// the image resolution.\n\t\t\t\tlet horizontalPadding = 0;\n\t\t\t\tif ( window.innerWidth > 480 ) {\n\t\t\t\t\thorizontalPadding = 80;\n\t\t\t\t} else if ( window.innerWidth > 1920 ) {\n\t\t\t\t\thorizontalPadding = 160;\n\t\t\t\t}\n\t\t\t\tconst verticalPadding = 80;\n\n\t\t\t\tconst targetMaxWidth = Math.min(\n\t\t\t\t\twindow.innerWidth - horizontalPadding,\n\t\t\t\t\tcontainerWidth\n\t\t\t\t);\n\t\t\t\tconst targetMaxHeight = Math.min(\n\t\t\t\t\twindow.innerHeight - verticalPadding,\n\t\t\t\t\tcontainerHeight\n\t\t\t\t);\n\t\t\t\tconst targetContainerRatio = targetMaxWidth / targetMaxHeight;\n\n\t\t\t\tif ( originalRatio > targetContainerRatio ) {\n\t\t\t\t\t// If targetMaxWidth is reached before targetMaxHeight.\n\t\t\t\t\tcontainerWidth = targetMaxWidth;\n\t\t\t\t\tcontainerHeight = containerWidth / originalRatio;\n\t\t\t\t} else {\n\t\t\t\t\t// If targetMaxHeight is reached before targetMaxWidth.\n\t\t\t\t\tcontainerHeight = targetMaxHeight;\n\t\t\t\t\tcontainerWidth = containerHeight * originalRatio;\n\t\t\t\t}\n\n\t\t\t\tconst containerScale = originalWidth / containerWidth;\n\t\t\t\tconst lightboxImgWidth =\n\t\t\t\t\timgMaxWidth * ( containerWidth / containerMaxWidth );\n\t\t\t\tconst lightboxImgHeight =\n\t\t\t\t\timgMaxHeight * ( containerHeight / containerMaxHeight );\n\n\t\t\t\t// As of this writing, using the calculations above will render the\n\t\t\t\t// lightbox with a small, erroneous whitespace on the left side of the\n\t\t\t\t// image in iOS Safari, perhaps due to an inconsistency in how browsers\n\t\t\t\t// handle absolute positioning and CSS transformation. In any case,\n\t\t\t\t// adding 1 pixel to the container width and height solves the problem,\n\t\t\t\t// though this can be removed if the issue is fixed in the future.\n\t\t\t\tstate.overlayStyles = `\n\t\t\t\t:root {\n\t\t\t\t\t--wp--lightbox-initial-top-position: ${ screenPosY }px;\n\t\t\t\t\t--wp--lightbox-initial-left-position: ${ screenPosX }px;\n\t\t\t\t\t--wp--lightbox-container-width: ${ containerWidth + 1 }px;\n\t\t\t\t\t--wp--lightbox-container-height: ${ containerHeight + 1 }px;\n\t\t\t\t\t--wp--lightbox-image-width: ${ lightboxImgWidth }px;\n\t\t\t\t\t--wp--lightbox-image-height: ${ lightboxImgHeight }px;\n\t\t\t\t\t--wp--lightbox-scale: ${ containerScale };\n\t\t\t\t\t--wp--lightbox-scrollbar-width: ${\n\t\t\t\t\t\twindow.innerWidth - document.documentElement.clientWidth\n\t\t\t\t\t}px;\n\t\t\t\t}\n\t\t\t`;\n\t\t\t},\n\t\t\tsetButtonStyles() {\n\t\t\t\tconst { imageId } = getContext();\n\t\t\t\tconst { ref } = getElement();\n\n\t\t\t\tstate.metadata[ imageId ].imageRef = ref;\n\t\t\t\tstate.metadata[ imageId ].currentSrc = ref.currentSrc;\n\n\t\t\t\tconst {\n\t\t\t\t\tnaturalWidth,\n\t\t\t\t\tnaturalHeight,\n\t\t\t\t\toffsetWidth,\n\t\t\t\t\toffsetHeight,\n\t\t\t\t} = ref;\n\n\t\t\t\t// If the image isn't loaded yet, it can't calculate where the button\n\t\t\t\t// should be.\n\t\t\t\tif ( naturalWidth === 0 || naturalHeight === 0 ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst figure = ref.parentElement;\n\t\t\t\tconst figureWidth = ref.parentElement.clientWidth;\n\n\t\t\t\t// It needs special handling for the height because a caption will cause\n\t\t\t\t// the figure to be taller than the image, which means it needs to\n\t\t\t\t// account for that when calculating the placement of the button in the\n\t\t\t\t// top right corner of the image.\n\t\t\t\tlet figureHeight = ref.parentElement.clientHeight;\n\t\t\t\tconst caption = figure.querySelector( 'figcaption' );\n\t\t\t\tif ( caption ) {\n\t\t\t\t\tconst captionComputedStyle =\n\t\t\t\t\t\twindow.getComputedStyle( caption );\n\t\t\t\t\tif (\n\t\t\t\t\t\t! [ 'absolute', 'fixed' ].includes(\n\t\t\t\t\t\t\tcaptionComputedStyle.position\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\tfigureHeight =\n\t\t\t\t\t\t\tfigureHeight -\n\t\t\t\t\t\t\tcaption.offsetHeight -\n\t\t\t\t\t\t\tparseFloat( captionComputedStyle.marginTop ) -\n\t\t\t\t\t\t\tparseFloat( captionComputedStyle.marginBottom );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst buttonOffsetTop = figureHeight - offsetHeight;\n\t\t\t\tconst buttonOffsetRight = figureWidth - offsetWidth;\n\n\t\t\t\tlet imageButtonTop = buttonOffsetTop + 16;\n\t\t\t\tlet imageButtonRight = buttonOffsetRight + 16;\n\n\t\t\t\t// In the case of an image with object-fit: contain, the size of the\n\t\t\t\t// <img> element can be larger than the image itself, so it needs to\n\t\t\t\t// calculate where to place the button.\n\t\t\t\tif ( state.metadata[ imageId ].scaleAttr === 'contain' ) {\n\t\t\t\t\t// Natural ratio of the image.\n\t\t\t\t\tconst naturalRatio = naturalWidth / naturalHeight;\n\t\t\t\t\t// Offset ratio of the image.\n\t\t\t\t\tconst offsetRatio = offsetWidth / offsetHeight;\n\n\t\t\t\t\tif ( naturalRatio >= offsetRatio ) {\n\t\t\t\t\t\t// If it reaches the width first, it keeps the width and compute the\n\t\t\t\t\t\t// height.\n\t\t\t\t\t\tconst referenceHeight = offsetWidth / naturalRatio;\n\t\t\t\t\t\timageButtonTop =\n\t\t\t\t\t\t\t( offsetHeight - referenceHeight ) / 2 +\n\t\t\t\t\t\t\tbuttonOffsetTop +\n\t\t\t\t\t\t\t16;\n\t\t\t\t\t\timageButtonRight = buttonOffsetRight + 16;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// If it reaches the height first, it keeps the height and compute\n\t\t\t\t\t\t// the width.\n\t\t\t\t\t\tconst referenceWidth = offsetHeight * naturalRatio;\n\t\t\t\t\t\timageButtonTop = buttonOffsetTop + 16;\n\t\t\t\t\t\timageButtonRight =\n\t\t\t\t\t\t\t( offsetWidth - referenceWidth ) / 2 +\n\t\t\t\t\t\t\tbuttonOffsetRight +\n\t\t\t\t\t\t\t16;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tstate.metadata[ imageId ].imageButtonTop = imageButtonTop;\n\t\t\t\tstate.metadata[ imageId ].imageButtonRight = imageButtonRight;\n\t\t\t},\n\t\t\tsetOverlayFocus() {\n\t\t\t\tif ( state.overlayEnabled ) {\n\t\t\t\t\t// Moves the focus to the dialog when it opens.\n\t\t\t\t\tconst { ref } = getElement();\n\t\t\t\t\tref.focus();\n\t\t\t\t}\n\t\t\t},\n\t\t\tinitTriggerButton() {\n\t\t\t\tconst { imageId } = getContext();\n\t\t\t\tconst { ref } = getElement();\n\t\t\t\tstate.metadata[ imageId ].buttonRef = ref;\n\t\t\t},\n\t\t},\n\t},\n\t{ lock: true }\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,EAAEC,UAAU,EAAEC,UAAU,QAAQ,0BAA0B;;AAExE;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,UAAU,GAAG,KAAK;;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,aAAa,GAAG,CAAC;AAErB,MAAM;EAAEC,KAAK;EAAEC,OAAO;EAAEC;AAAU,CAAC,GAAGP,KAAK,CAC1C,YAAY,EACZ;EACCK,KAAK,EAAE;IACNG,cAAc,EAAE,IAAI;IACpB,IAAIC,YAAYA,CAAA,EAAG;MAClB,OAAOJ,KAAK,CAACK,QAAQ,CAAEL,KAAK,CAACG,cAAc,CAAE;IAC9C,CAAC;IACD,IAAIG,aAAaA,CAAA,EAAG;MACnB,OAAON,KAAK,CAACG,cAAc,KAAK,IAAI;IACrC,CA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
|
38
38
|
},
|
|
39
39
|
supports: {
|
|
40
40
|
align: true,
|
|
41
|
+
color: {
|
|
42
|
+
gradients: true,
|
|
43
|
+
link: true,
|
|
44
|
+
__experimentalDefaultControls: {
|
|
45
|
+
background: true,
|
|
46
|
+
text: true,
|
|
47
|
+
link: true
|
|
48
|
+
}
|
|
49
|
+
},
|
|
41
50
|
html: false,
|
|
42
51
|
spacing: {
|
|
43
52
|
margin: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["comment","icon","initBlock","metadata","$schema","apiVersion","name","title","category","description","keywords","textdomain","attributes","commentsToShow","type","minimum","maximum","displayAvatar","displayDate","displayExcerpt","supports","align","html","spacing","margin","padding","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontWeight","__experimentalFontStyle","__experimentalTextTransform","__experimentalTextDecoration","__experimentalLetterSpacing","
|
|
1
|
+
{"version":3,"names":["comment","icon","initBlock","metadata","$schema","apiVersion","name","title","category","description","keywords","textdomain","attributes","commentsToShow","type","minimum","maximum","displayAvatar","displayDate","displayExcerpt","supports","align","color","gradients","link","__experimentalDefaultControls","background","text","html","spacing","margin","padding","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontWeight","__experimentalFontStyle","__experimentalTextTransform","__experimentalTextDecoration","__experimentalLetterSpacing","interactivity","clientNavigation","editorStyle","style","edit","settings","example","init"],"sources":["@wordpress/block-library/src/latest-comments/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { comment as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {},\n\tedit,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,IAAIC,IAAI,QAAQ,kBAAkB;;AAElD;AACA;AACA;AACA,OAAOC,SAAS,MA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,
|
|
99
99
|
title: __('Outdent'),
|
|
100
|
-
|
|
100
|
+
description: __('Outdent list item'),
|
|
101
101
|
disabled: !canOutdent,
|
|
102
102
|
onClick: outdentList
|
|
103
103
|
})
|
|
@@ -140,7 +140,7 @@ export default function Edit({
|
|
|
140
140
|
children: [/*#__PURE__*/_jsx(ToolbarButton, {
|
|
141
141
|
icon: isRTL() ? formatListBulletsRTL : formatListBullets,
|
|
142
142
|
title: __('Unordered'),
|
|
143
|
-
|
|
143
|
+
description: __('Convert to unordered list'),
|
|
144
144
|
isActive: ordered === false,
|
|
145
145
|
onClick: () => {
|
|
146
146
|
setAttributes({
|
|
@@ -150,7 +150,7 @@ export default function Edit({
|
|
|
150
150
|
}), /*#__PURE__*/_jsx(ToolbarButton, {
|
|
151
151
|
icon: isRTL() ? formatListNumberedRTL : formatListNumbered,
|
|
152
152
|
title: __('Ordered'),
|
|
153
|
-
|
|
153
|
+
description: __('Convert to ordered list'),
|
|
154
154
|
isActive: ordered === true,
|
|
155
155
|
onClick: () => {
|
|
156
156
|
setAttributes({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BlockControls","useBlockProps","useInnerBlocksProps","store","blockEditorStore","ToolbarButton","useDispatch","useSelect","useRegistry","isRTL","__","formatListBullets","formatListBulletsRTL","formatListNumbered","formatListNumberedRTL","formatOutdent","formatOutdentRTL","createBlock","useCallback","useEffect","Platform","deprecated","OrderedListSettings","migrateToListV2","TagName","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","DEFAULT_BLOCK","name","TEMPLATE","NATIVE_MARGIN_SPACING","useMigrateOnLoad","attributes","clientId","registry","updateBlockAttributes","replaceInnerBlocks","values","newAttributes","newInnerBlocks","since","version","alternative","batch","useOutdentList","replaceBlocks","selectionChange","getBlockRootClientId","getBlockAttributes","getBlock","parentBlockId","parentBlockAttributes","newParentBlock","innerBlocks","length","IndentUI","outdentList","canOutdent","select","getBlockName","children","icon","title","describedBy","disabled","onClick","Edit","setAttributes","style","ordered","type","reversed","start","blockProps","isNative","listStyleType","undefined","innerBlocksProps","defaultBlock","directInsert","template","templateLock","templateInsertUpdatesSelection","marginVertical","marginHorizontal","renderAppender","__experimentalCaptureToolbars","controls","group","isActive"],"sources":["@wordpress/block-library/src/list/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { ToolbarButton } from '@wordpress/components';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport {\n\tformatListBullets,\n\tformatListBulletsRTL,\n\tformatListNumbered,\n\tformatListNumberedRTL,\n\tformatOutdent,\n\tformatOutdentRTL,\n} from '@wordpress/icons';\nimport { createBlock } from '@wordpress/blocks';\nimport { useCallback, useEffect, Platform } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport OrderedListSettings from './ordered-list-settings';\nimport { migrateToListV2 } from './utils';\nimport TagName from './tag-name';\n\nconst DEFAULT_BLOCK = {\n\tname: 'core/list-item',\n};\nconst TEMPLATE = [ [ 'core/list-item' ] ];\nconst NATIVE_MARGIN_SPACING = 8;\n\n/**\n * At the moment, deprecations don't handle create blocks from attributes\n * (like when using CPT templates). For this reason, this hook is necessary\n * to avoid breaking templates using the old list block format.\n *\n * @param {Object} attributes Block attributes.\n * @param {string} clientId Block client ID.\n */\nfunction useMigrateOnLoad( attributes, clientId ) {\n\tconst registry = useRegistry();\n\tconst { updateBlockAttributes, replaceInnerBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\n\tuseEffect( () => {\n\t\t// As soon as the block is loaded, migrate it to the new version.\n\n\t\tif ( ! attributes.values ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst [ newAttributes, newInnerBlocks ] = migrateToListV2( attributes );\n\n\t\tdeprecated( 'Value attribute on the list block', {\n\t\t\tsince: '6.0',\n\t\t\tversion: '6.5',\n\t\t\talternative: 'inner blocks',\n\t\t} );\n\n\t\tregistry.batch( () => {\n\t\t\tupdateBlockAttributes( clientId, newAttributes );\n\t\t\treplaceInnerBlocks( clientId, newInnerBlocks );\n\t\t} );\n\t}, [ attributes.values ] );\n}\n\nfunction useOutdentList( clientId ) {\n\tconst { replaceBlocks, selectionChange } = useDispatch( blockEditorStore );\n\tconst { getBlockRootClientId, getBlockAttributes, getBlock } =\n\t\tuseSelect( blockEditorStore );\n\n\treturn useCallback( () => {\n\t\tconst parentBlockId = getBlockRootClientId( clientId );\n\t\tconst parentBlockAttributes = getBlockAttributes( parentBlockId );\n\t\t// Create a new parent block without the inner blocks.\n\t\tconst newParentBlock = createBlock(\n\t\t\t'core/list-item',\n\t\t\tparentBlockAttributes\n\t\t);\n\t\tconst { innerBlocks } = getBlock( clientId );\n\t\t// Replace the parent block with a new parent block without inner blocks,\n\t\t// and make the inner blocks siblings of the parent.\n\t\treplaceBlocks( [ parentBlockId ], [ newParentBlock, ...innerBlocks ] );\n\t\t// Select the last child of the list being outdent.\n\t\tselectionChange( innerBlocks[ innerBlocks.length - 1 ].clientId );\n\t}, [ clientId ] );\n}\n\nfunction IndentUI( { clientId } ) {\n\tconst outdentList = useOutdentList( clientId );\n\tconst canOutdent = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId, getBlockName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn (\n\t\t\t\tgetBlockName( getBlockRootClientId( clientId ) ) ===\n\t\t\t\t'core/list-item'\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ isRTL() ? formatOutdentRTL : formatOutdent }\n\t\t\t\ttitle={ __( 'Outdent' ) }\n\t\t\t\tdescribedBy={ __( 'Outdent list item' ) }\n\t\t\t\tdisabled={ ! canOutdent }\n\t\t\t\tonClick={ outdentList }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default function Edit( { attributes, setAttributes, clientId, style } ) {\n\tconst { ordered, type, reversed, start } = attributes;\n\tconst blockProps = useBlockProps( {\n\t\tstyle: {\n\t\t\t...( Platform.isNative && style ),\n\t\t\tlistStyleType: ordered && type !== 'decimal' ? type : undefined,\n\t\t},\n\t} );\n\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tdefaultBlock: DEFAULT_BLOCK,\n\t\tdirectInsert: true,\n\t\ttemplate: TEMPLATE,\n\t\ttemplateLock: false,\n\t\ttemplateInsertUpdatesSelection: true,\n\t\t...( Platform.isNative && {\n\t\t\tmarginVertical: NATIVE_MARGIN_SPACING,\n\t\t\tmarginHorizontal: NATIVE_MARGIN_SPACING,\n\t\t\trenderAppender: false,\n\t\t} ),\n\t\t__experimentalCaptureToolbars: true,\n\t} );\n\tuseMigrateOnLoad( attributes, clientId );\n\n\tconst controls = (\n\t\t<BlockControls group=\"block\">\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ isRTL() ? formatListBulletsRTL : formatListBullets }\n\t\t\t\ttitle={ __( 'Unordered' ) }\n\t\t\t\tdescribedBy={ __( 'Convert to unordered list' ) }\n\t\t\t\tisActive={ ordered === false }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetAttributes( { ordered: false } );\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ isRTL() ? formatListNumberedRTL : formatListNumbered }\n\t\t\t\ttitle={ __( 'Ordered' ) }\n\t\t\t\tdescribedBy={ __( 'Convert to ordered list' ) }\n\t\t\t\tisActive={ ordered === true }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetAttributes( { ordered: true } );\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<IndentUI clientId={ clientId } />\n\t\t</BlockControls>\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<TagName\n\t\t\t\tordered={ ordered }\n\t\t\t\treversed={ reversed }\n\t\t\t\tstart={ start }\n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ACF/C,IAAA,CAACiC,QAAQ;MAACtB,QAAQ,EAAGA;IAAU,CAAE,CAAC;EAAA,CACpB,CACf;EAED,oBACCP,KAAA,CAAAF,SAAA;IAAAoC,QAAA,gBACCtC,IAAA,CAACF,OAAO;MACPiD,OAAO,EAAGA,OAAS;MACnBE,QAAQ,EAAGA,QAAU;MACrBC,KAAK,EAAGA,KAAO;MAAA,GACVK;IAAgB,CACrB,CAAC,EACAU,QAAQ,EACRlB,OAAO,iBACR/C,IAAA,CAACJ,mBAAmB;MAElBiD,aAAa;MACbI,QAAQ;MACRC,KAAK;MACLF;IAAI,CAEL,CACD;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["BlockControls","useBlockProps","useInnerBlocksProps","store","blockEditorStore","ToolbarButton","useDispatch","useSelect","useRegistry","isRTL","__","formatListBullets","formatListBulletsRTL","formatListNumbered","formatListNumberedRTL","formatOutdent","formatOutdentRTL","createBlock","useCallback","useEffect","Platform","deprecated","OrderedListSettings","migrateToListV2","TagName","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","DEFAULT_BLOCK","name","TEMPLATE","NATIVE_MARGIN_SPACING","useMigrateOnLoad","attributes","clientId","registry","updateBlockAttributes","replaceInnerBlocks","values","newAttributes","newInnerBlocks","since","version","alternative","batch","useOutdentList","replaceBlocks","selectionChange","getBlockRootClientId","getBlockAttributes","getBlock","parentBlockId","parentBlockAttributes","newParentBlock","innerBlocks","length","IndentUI","outdentList","canOutdent","select","getBlockName","children","icon","title","description","disabled","onClick","Edit","setAttributes","style","ordered","type","reversed","start","blockProps","isNative","listStyleType","undefined","innerBlocksProps","defaultBlock","directInsert","template","templateLock","templateInsertUpdatesSelection","marginVertical","marginHorizontal","renderAppender","__experimentalCaptureToolbars","controls","group","isActive"],"sources":["@wordpress/block-library/src/list/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { ToolbarButton } from '@wordpress/components';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport {\n\tformatListBullets,\n\tformatListBulletsRTL,\n\tformatListNumbered,\n\tformatListNumberedRTL,\n\tformatOutdent,\n\tformatOutdentRTL,\n} from '@wordpress/icons';\nimport { createBlock } from '@wordpress/blocks';\nimport { useCallback, useEffect, Platform } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport OrderedListSettings from './ordered-list-settings';\nimport { migrateToListV2 } from './utils';\nimport TagName from './tag-name';\n\nconst DEFAULT_BLOCK = {\n\tname: 'core/list-item',\n};\nconst TEMPLATE = [ [ 'core/list-item' ] ];\nconst NATIVE_MARGIN_SPACING = 8;\n\n/**\n * At the moment, deprecations don't handle create blocks from attributes\n * (like when using CPT templates). For this reason, this hook is necessary\n * to avoid breaking templates using the old list block format.\n *\n * @param {Object} attributes Block attributes.\n * @param {string} clientId Block client ID.\n */\nfunction useMigrateOnLoad( attributes, clientId ) {\n\tconst registry = useRegistry();\n\tconst { updateBlockAttributes, replaceInnerBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\n\tuseEffect( () => {\n\t\t// As soon as the block is loaded, migrate it to the new version.\n\n\t\tif ( ! attributes.values ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst [ newAttributes, newInnerBlocks ] = migrateToListV2( attributes );\n\n\t\tdeprecated( 'Value attribute on the list block', {\n\t\t\tsince: '6.0',\n\t\t\tversion: '6.5',\n\t\t\talternative: 'inner blocks',\n\t\t} );\n\n\t\tregistry.batch( () => {\n\t\t\tupdateBlockAttributes( clientId, newAttributes );\n\t\t\treplaceInnerBlocks( clientId, newInnerBlocks );\n\t\t} );\n\t}, [ attributes.values ] );\n}\n\nfunction useOutdentList( clientId ) {\n\tconst { replaceBlocks, selectionChange } = useDispatch( blockEditorStore );\n\tconst { getBlockRootClientId, getBlockAttributes, getBlock } =\n\t\tuseSelect( blockEditorStore );\n\n\treturn useCallback( () => {\n\t\tconst parentBlockId = getBlockRootClientId( clientId );\n\t\tconst parentBlockAttributes = getBlockAttributes( parentBlockId );\n\t\t// Create a new parent block without the inner blocks.\n\t\tconst newParentBlock = createBlock(\n\t\t\t'core/list-item',\n\t\t\tparentBlockAttributes\n\t\t);\n\t\tconst { innerBlocks } = getBlock( clientId );\n\t\t// Replace the parent block with a new parent block without inner blocks,\n\t\t// and make the inner blocks siblings of the parent.\n\t\treplaceBlocks( [ parentBlockId ], [ newParentBlock, ...innerBlocks ] );\n\t\t// Select the last child of the list being outdent.\n\t\tselectionChange( innerBlocks[ innerBlocks.length - 1 ].clientId );\n\t}, [ clientId ] );\n}\n\nfunction IndentUI( { clientId } ) {\n\tconst outdentList = useOutdentList( clientId );\n\tconst canOutdent = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId, getBlockName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn (\n\t\t\t\tgetBlockName( getBlockRootClientId( clientId ) ) ===\n\t\t\t\t'core/list-item'\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ isRTL() ? formatOutdentRTL : formatOutdent }\n\t\t\t\ttitle={ __( 'Outdent' ) }\n\t\t\t\tdescription={ __( 'Outdent list item' ) }\n\t\t\t\tdisabled={ ! canOutdent }\n\t\t\t\tonClick={ outdentList }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default function Edit( { attributes, setAttributes, clientId, style } ) {\n\tconst { ordered, type, reversed, start } = attributes;\n\tconst blockProps = useBlockProps( {\n\t\tstyle: {\n\t\t\t...( Platform.isNative && style ),\n\t\t\tlistStyleType: ordered && type !== 'decimal' ? type : undefined,\n\t\t},\n\t} );\n\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tdefaultBlock: DEFAULT_BLOCK,\n\t\tdirectInsert: true,\n\t\ttemplate: TEMPLATE,\n\t\ttemplateLock: false,\n\t\ttemplateInsertUpdatesSelection: true,\n\t\t...( Platform.isNative && {\n\t\t\tmarginVertical: NATIVE_MARGIN_SPACING,\n\t\t\tmarginHorizontal: NATIVE_MARGIN_SPACING,\n\t\t\trenderAppender: false,\n\t\t} ),\n\t\t__experimentalCaptureToolbars: true,\n\t} );\n\tuseMigrateOnLoad( attributes, clientId );\n\n\tconst controls = (\n\t\t<BlockControls group=\"block\">\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ isRTL() ? formatListBulletsRTL : formatListBullets }\n\t\t\t\ttitle={ __( 'Unordered' ) }\n\t\t\t\tdescription={ __( 'Convert to unordered list' ) }\n\t\t\t\tisActive={ ordered === false }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetAttributes( { ordered: false } );\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ isRTL() ? formatListNumberedRTL : formatListNumbered }\n\t\t\t\ttitle={ __( 'Ordered' ) }\n\t\t\t\tdescription={ __( 'Convert to ordered list' ) }\n\t\t\t\tisActive={ ordered === true }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetAttributes( { ordered: true } );\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<IndentUI clientId={ clientId } />\n\t\t</BlockControls>\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<TagName\n\t\t\t\tordered={ ordered }\n\t\t\t\treversed={ reversed }\n\t\t\t\tstart={ start }\n\t\t\t\t{ ...innerBlocksProps }\n\t\t\t/>\n\t\t\t{ controls }\n\t\t\t{ ordered && (\n\t\t\t\t<OrderedListSettings\n\t\t\t\t\t{ ...{\n\t\t\t\t\t\tsetAttributes,\n\t\t\t\t\t\treversed,\n\t\t\t\t\t\tstart,\n\t\t\t\t\t\ttype,\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings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QAAQ,EACRlB,OAAO,iBACR/C,IAAA,CAACJ,mBAAmB;MAElBiD,aAAa;MACbI,QAAQ;MACRC,KAAK;MACLF;IAAI,CAEL,CACD;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
@@ -38,14 +38,14 @@ export function IndentUI({
|
|
|
38
38
|
children: [/*#__PURE__*/_jsx(ToolbarButton, {
|
|
39
39
|
icon: isRTL() ? formatOutdentRTL : formatOutdent,
|
|
40
40
|
title: __('Outdent'),
|
|
41
|
-
|
|
41
|
+
description: __('Outdent list item'),
|
|
42
42
|
disabled: !canOutdent,
|
|
43
43
|
onClick: () => outdentListItem()
|
|
44
44
|
}), /*#__PURE__*/_jsx(ToolbarButton, {
|
|
45
45
|
icon: isRTL() ? formatIndentRTL : formatIndent,
|
|
46
46
|
title: __('Indent'),
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
description: __('Indent list item'),
|
|
48
|
+
disabled: !canIndent,
|
|
49
49
|
onClick: () => indentListItem()
|
|
50
50
|
})]
|
|
51
51
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RichText","useBlockProps","useInnerBlocksProps","BlockControls","store","blockEditorStore","isRTL","__","ToolbarButton","formatOutdent","formatOutdentRTL","formatIndentRTL","formatIndent","useMergeRefs","useSelect","useEnter","useSpace","useIndentListItem","useOutdentListItem","useMerge","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","IndentUI","clientId","indentListItem","outdentListItem","canIndent","canOutdent","select","getBlockIndex","getBlockRootClientId","getBlockName","children","icon","title","
|
|
1
|
+
{"version":3,"names":["RichText","useBlockProps","useInnerBlocksProps","BlockControls","store","blockEditorStore","isRTL","__","ToolbarButton","formatOutdent","formatOutdentRTL","formatIndentRTL","formatIndent","useMergeRefs","useSelect","useEnter","useSpace","useIndentListItem","useOutdentListItem","useMerge","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","IndentUI","clientId","indentListItem","outdentListItem","canIndent","canOutdent","select","getBlockIndex","getBlockRootClientId","getBlockName","children","icon","title","description","disabled","onClick","ListItemEdit","attributes","setAttributes","mergeBlocks","placeholder","content","blockProps","innerBlocksProps","renderAppender","__unstableDisableDropZone","useEnterRef","useSpaceRef","onMerge","ref","identifier","tagName","onChange","nextContent","value","group"],"sources":["@wordpress/block-library/src/list-item/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tRichText,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tBlockControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { ToolbarButton } from '@wordpress/components';\nimport {\n\tformatOutdent,\n\tformatOutdentRTL,\n\tformatIndentRTL,\n\tformatIndent,\n} from '@wordpress/icons';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseEnter,\n\tuseSpace,\n\tuseIndentListItem,\n\tuseOutdentListItem,\n\tuseMerge,\n} from './hooks';\n\nexport function IndentUI( { clientId } ) {\n\tconst indentListItem = useIndentListItem( clientId );\n\tconst outdentListItem = useOutdentListItem();\n\tconst { canIndent, canOutdent } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockIndex, getBlockRootClientId, getBlockName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tcanIndent: getBlockIndex( clientId ) > 0,\n\t\t\t\tcanOutdent:\n\t\t\t\t\tgetBlockName(\n\t\t\t\t\t\tgetBlockRootClientId( getBlockRootClientId( clientId ) )\n\t\t\t\t\t) === 'core/list-item',\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ isRTL() ? formatOutdentRTL : formatOutdent }\n\t\t\t\ttitle={ __( 'Outdent' ) }\n\t\t\t\tdescription={ __( 'Outdent list item' ) }\n\t\t\t\tdisabled={ ! canOutdent }\n\t\t\t\tonClick={ () => outdentListItem() }\n\t\t\t/>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ isRTL() ? formatIndentRTL : formatIndent }\n\t\t\t\ttitle={ __( 'Indent' ) }\n\t\t\t\tdescription={ __( 'Indent list item' ) }\n\t\t\t\tdisabled={ ! canIndent }\n\t\t\t\tonClick={ () => indentListItem() }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default function ListItemEdit( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tmergeBlocks,\n} ) {\n\tconst { placeholder, content } = attributes;\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\trenderAppender: false,\n\t\t__unstableDisableDropZone: true,\n\t} );\n\tconst useEnterRef = useEnter( { content, clientId } );\n\tconst useSpaceRef = useSpace( clientId );\n\tconst onMerge = useMerge( clientId, mergeBlocks );\n\treturn (\n\t\t<>\n\t\t\t<li { ...innerBlocksProps }>\n\t\t\t\t<RichText\n\t\t\t\t\tref={ useMergeRefs( [ useEnterRef, useSpaceRef ] ) }\n\t\t\t\t\tidentifier=\"content\"\n\t\t\t\t\ttagName=\"div\"\n\t\t\t\t\tonChange={ ( nextContent ) =>\n\t\t\t\t\t\tsetAttributes( { content: nextContent } )\n\t\t\t\t\t}\n\t\t\t\t\tvalue={ content }\n\t\t\t\t\taria-label={ __( 'List text' ) }\n\t\t\t\t\tplaceholder={ placeholder || __( 'List' ) }\n\t\t\t\t\tonMerge={ onMerge }\n\t\t\t\t/>\n\t\t\t\t{ innerBlocksProps.children }\n\t\t\t</li>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<IndentUI clientId={ clientId } />\n\t\t\t</BlockControls>\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,QAAQ,EACRC,aAAa,EACbC,mBAAmB,EACnBC,aAAa,EACbC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SAASC,KAAK,EAAEC,EAAE,QAA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,OAAS;QACjB,cAAaxC,EAAE,CAAE,WAAY,CAAG;QAChCuC,WAAW,EAAGA,WAAW,IAAIvC,EAAE,CAAE,MAAO,CAAG;QAC3C+C,OAAO,EAAGA;MAAS,CACnB,CAAC,EACAL,gBAAgB,CAACb,QAAQ;IAAA,CACxB,CAAC,eACLf,IAAA,CAAClB,aAAa;MAAC0D,KAAK,EAAC,OAAO;MAAAzB,QAAA,eAC3Bf,IAAA,CAACK,QAAQ;QAACC,QAAQ,EAAGA;MAAU,CAAE;IAAC,CACpB,CAAC;EAAA,CACf,CAAC;AAEL","ignoreList":[]}
|
|
@@ -2,6 +2,5 @@ export { default as useOutdentListItem } from './use-outdent-list-item';
|
|
|
2
2
|
export { default as useIndentListItem } from './use-indent-list-item';
|
|
3
3
|
export { default as useEnter } from './use-enter';
|
|
4
4
|
export { default as useSpace } from './use-space';
|
|
5
|
-
export { default as useSplit } from './use-split';
|
|
6
5
|
export { default as useMerge } from './use-merge';
|
|
7
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["default","useOutdentListItem","useIndentListItem","useEnter","useSpace","
|
|
1
|
+
{"version":3,"names":["default","useOutdentListItem","useIndentListItem","useEnter","useSpace","useMerge"],"sources":["@wordpress/block-library/src/list-item/hooks/index.js"],"sourcesContent":["export { default as useOutdentListItem } from './use-outdent-list-item';\nexport { default as useIndentListItem } from './use-indent-list-item';\nexport { default as useEnter } from './use-enter';\nexport { default as useSpace } from './use-space';\nexport { default as useMerge } from './use-merge';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,kBAAkB,QAAQ,yBAAyB;AACvE,SAASD,OAAO,IAAIE,iBAAiB,QAAQ,wBAAwB;AACrE,SAASF,OAAO,IAAIG,QAAQ,QAAQ,aAAa;AACjD,SAASH,OAAO,IAAII,QAAQ,QAAQ,aAAa;AACjD,SAASJ,OAAO,IAAIK,QAAQ,QAAQ,aAAa","ignoreList":[]}
|
|
@@ -88,7 +88,14 @@ export default function useMerge(clientId, onMerge) {
|
|
|
88
88
|
// list.
|
|
89
89
|
const [nestedListClientId] = getBlockOrder(clientIdB);
|
|
90
90
|
if (nestedListClientId) {
|
|
91
|
-
|
|
91
|
+
// If we are merging with the previous list item, and the
|
|
92
|
+
// previous list item does not have nested list, move the
|
|
93
|
+
// nested list to the previous list item.
|
|
94
|
+
if (getPreviousBlockClientId(clientIdB) === clientIdA && !getBlockOrder(clientIdA).length) {
|
|
95
|
+
moveBlocksToPosition([nestedListClientId], clientIdB, clientIdA);
|
|
96
|
+
} else {
|
|
97
|
+
moveBlocksToPosition(getBlockOrder(nestedListClientId), nestedListClientId, getBlockRootClientId(clientIdA));
|
|
98
|
+
}
|
|
92
99
|
}
|
|
93
100
|
mergeBlocks(clientIdA, clientIdB);
|
|
94
101
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useRegistry","useDispatch","useSelect","store","blockEditorStore","useOutdentListItem","useMerge","clientId","onMerge","registry","getPreviousBlockClientId","getNextBlockClientId","getBlockOrder","getBlockRootClientId","getBlockName","mergeBlocks","moveBlocksToPosition","outdentListItem","getTrailingId","id","order","length","getParentListItemId","listId","parentListItemId","_getNextId","next","getNextId","forward","mergeWithNested","clientIdA","clientIdB","batch","nestedListClientId","nextBlockClientId","previousBlockClientId","trailingId"],"sources":["@wordpress/block-library/src/list-item/hooks/use-merge.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRegistry, useDispatch, useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport useOutdentListItem from './use-outdent-list-item';\n\nexport default function useMerge( clientId, onMerge ) {\n\tconst registry = useRegistry();\n\tconst {\n\t\tgetPreviousBlockClientId,\n\t\tgetNextBlockClientId,\n\t\tgetBlockOrder,\n\t\tgetBlockRootClientId,\n\t\tgetBlockName,\n\t} = useSelect( blockEditorStore );\n\tconst { mergeBlocks, moveBlocksToPosition } =\n\t\tuseDispatch( blockEditorStore );\n\tconst outdentListItem = useOutdentListItem();\n\n\tfunction getTrailingId( id ) {\n\t\tconst order = getBlockOrder( id );\n\n\t\tif ( ! order.length ) {\n\t\t\treturn id;\n\t\t}\n\n\t\treturn getTrailingId( order[ order.length - 1 ] );\n\t}\n\n\tfunction getParentListItemId( id ) {\n\t\tconst listId = getBlockRootClientId( id );\n\t\tconst parentListItemId = getBlockRootClientId( listId );\n\t\tif ( ! parentListItemId ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( getBlockName( parentListItemId ) !== 'core/list-item' ) {\n\t\t\treturn;\n\t\t}\n\t\treturn parentListItemId;\n\t}\n\n\t/**\n\t * Return the next list item with respect to the given list item. If none,\n\t * return the next list item of the parent list item if it exists.\n\t *\n\t * @param {string} id A list item client ID.\n\t * @return {string?} The client ID of the next list item.\n\t */\n\tfunction _getNextId( id ) {\n\t\tconst next = getNextBlockClientId( id );\n\t\tif ( next ) {\n\t\t\treturn next;\n\t\t}\n\t\tconst parentListItemId = getParentListItemId( id );\n\t\tif ( ! parentListItemId ) {\n\t\t\treturn;\n\t\t}\n\t\treturn _getNextId( parentListItemId );\n\t}\n\n\t/**\n\t * Given a client ID, return the client ID of the list item on the next\n\t * line, regardless of indentation level.\n\t *\n\t * @param {string} id The client ID of the current list item.\n\t * @return {string?} The client ID of the next list item.\n\t */\n\tfunction getNextId( id ) {\n\t\tconst order = getBlockOrder( id );\n\n\t\t// If the list item does not have a nested list, return the next list\n\t\t// item.\n\t\tif ( ! order.length ) {\n\t\t\treturn _getNextId( id );\n\t\t}\n\n\t\t// Get the first list item in the nested list.\n\t\treturn getBlockOrder( order[ 0 ] )[ 0 ];\n\t}\n\n\treturn ( forward ) => {\n\t\tfunction mergeWithNested( clientIdA, clientIdB ) {\n\t\t\tregistry.batch( () => {\n\t\t\t\t// When merging a sub list item with a higher next list item, we\n\t\t\t\t// also need to move any nested list items. Check if there's a\n\t\t\t\t// listed list, and append its nested list items to the current\n\t\t\t\t// list.\n\t\t\t\tconst [ nestedListClientId ] = getBlockOrder( clientIdB );\n\t\t\t\tif ( nestedListClientId ) {\n\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\tgetBlockOrder( nestedListClientId ),\n\t\t\t\t\t\tnestedListClientId,\n\t\t\t\t\t\tgetBlockRootClientId( clientIdA )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tmergeBlocks( clientIdA, clientIdB );\n\t\t\t} );\n\t\t}\n\n\t\tif ( forward ) {\n\t\t\tconst nextBlockClientId = getNextId( clientId );\n\n\t\t\tif ( ! nextBlockClientId ) {\n\t\t\t\tonMerge( forward );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( getParentListItemId( nextBlockClientId ) ) {\n\t\t\t\toutdentListItem( nextBlockClientId );\n\t\t\t} else {\n\t\t\t\tmergeWithNested( clientId, nextBlockClientId );\n\t\t\t}\n\t\t} else {\n\t\t\t// Merging is only done from the top level. For lowel levels, the\n\t\t\t// list item is outdented instead.\n\t\t\tconst previousBlockClientId = getPreviousBlockClientId( clientId );\n\t\t\tif ( getParentListItemId( clientId ) ) {\n\t\t\t\toutdentListItem( clientId );\n\t\t\t} else if ( previousBlockClientId ) {\n\t\t\t\tconst trailingId = getTrailingId( previousBlockClientId );\n\t\t\t\tmergeWithNested( trailingId, clientId );\n\t\t\t} else {\n\t\t\t\tonMerge( forward );\n\t\t\t}\n\t\t}\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACrE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;;AAEnE;AACA;AACA;AACA,OAAOC,kBAAkB,MAAM,yBAAyB;AAExD,eAAe,SAASC,QAAQA,CAAEC,QAAQ,EAAEC,OAAO,EAAG;EACrD,MAAMC,QAAQ,GAAGT,WAAW,CAAC,CAAC;EAC9B,MAAM;IACLU,wBAAwB;IACxBC,oBAAoB;IACpB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K,CAACC,MAAM,EAAG;MACrB,OAAOI,UAAU,CAAEN,EAAG,CAAC;IACxB;;IAEA;IACA,OAAOP,aAAa,CAAEQ,KAAK,CAAE,CAAC,CAAG,CAAC,CAAE,CAAC,CAAE;EACxC;EAEA,OAASQ,OAAO,IAAM;IACrB,SAASC,eAAeA,CAAEC,SAAS,EAAEC,SAAS,EAAG;MAChDtB,QAAQ,CAACuB,KAAK,CAAE,MAAM;QACrB;QACA;QACA;QACA;QACA,MAAM,CAAEC,kBAAkB,CAAE,GAAGrB,aAAa,CAAEmB,SAAU,CAAC;QACzD,IAAKE,kBAAkB,EAAG;
|
|
1
|
+
{"version":3,"names":["useRegistry","useDispatch","useSelect","store","blockEditorStore","useOutdentListItem","useMerge","clientId","onMerge","registry","getPreviousBlockClientId","getNextBlockClientId","getBlockOrder","getBlockRootClientId","getBlockName","mergeBlocks","moveBlocksToPosition","outdentListItem","getTrailingId","id","order","length","getParentListItemId","listId","parentListItemId","_getNextId","next","getNextId","forward","mergeWithNested","clientIdA","clientIdB","batch","nestedListClientId","nextBlockClientId","previousBlockClientId","trailingId"],"sources":["@wordpress/block-library/src/list-item/hooks/use-merge.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRegistry, useDispatch, useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport useOutdentListItem from './use-outdent-list-item';\n\nexport default function useMerge( clientId, onMerge ) {\n\tconst registry = useRegistry();\n\tconst {\n\t\tgetPreviousBlockClientId,\n\t\tgetNextBlockClientId,\n\t\tgetBlockOrder,\n\t\tgetBlockRootClientId,\n\t\tgetBlockName,\n\t} = useSelect( blockEditorStore );\n\tconst { mergeBlocks, moveBlocksToPosition } =\n\t\tuseDispatch( blockEditorStore );\n\tconst outdentListItem = useOutdentListItem();\n\n\tfunction getTrailingId( id ) {\n\t\tconst order = getBlockOrder( id );\n\n\t\tif ( ! order.length ) {\n\t\t\treturn id;\n\t\t}\n\n\t\treturn getTrailingId( order[ order.length - 1 ] );\n\t}\n\n\tfunction getParentListItemId( id ) {\n\t\tconst listId = getBlockRootClientId( id );\n\t\tconst parentListItemId = getBlockRootClientId( listId );\n\t\tif ( ! parentListItemId ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( getBlockName( parentListItemId ) !== 'core/list-item' ) {\n\t\t\treturn;\n\t\t}\n\t\treturn parentListItemId;\n\t}\n\n\t/**\n\t * Return the next list item with respect to the given list item. If none,\n\t * return the next list item of the parent list item if it exists.\n\t *\n\t * @param {string} id A list item client ID.\n\t * @return {string?} The client ID of the next list item.\n\t */\n\tfunction _getNextId( id ) {\n\t\tconst next = getNextBlockClientId( id );\n\t\tif ( next ) {\n\t\t\treturn next;\n\t\t}\n\t\tconst parentListItemId = getParentListItemId( id );\n\t\tif ( ! parentListItemId ) {\n\t\t\treturn;\n\t\t}\n\t\treturn _getNextId( parentListItemId );\n\t}\n\n\t/**\n\t * Given a client ID, return the client ID of the list item on the next\n\t * line, regardless of indentation level.\n\t *\n\t * @param {string} id The client ID of the current list item.\n\t * @return {string?} The client ID of the next list item.\n\t */\n\tfunction getNextId( id ) {\n\t\tconst order = getBlockOrder( id );\n\n\t\t// If the list item does not have a nested list, return the next list\n\t\t// item.\n\t\tif ( ! order.length ) {\n\t\t\treturn _getNextId( id );\n\t\t}\n\n\t\t// Get the first list item in the nested list.\n\t\treturn getBlockOrder( order[ 0 ] )[ 0 ];\n\t}\n\n\treturn ( forward ) => {\n\t\tfunction mergeWithNested( clientIdA, clientIdB ) {\n\t\t\tregistry.batch( () => {\n\t\t\t\t// When merging a sub list item with a higher next list item, we\n\t\t\t\t// also need to move any nested list items. Check if there's a\n\t\t\t\t// listed list, and append its nested list items to the current\n\t\t\t\t// list.\n\t\t\t\tconst [ nestedListClientId ] = getBlockOrder( clientIdB );\n\t\t\t\tif ( nestedListClientId ) {\n\t\t\t\t\t// If we are merging with the previous list item, and the\n\t\t\t\t\t// previous list item does not have nested list, move the\n\t\t\t\t\t// nested list to the previous list item.\n\t\t\t\t\tif (\n\t\t\t\t\t\tgetPreviousBlockClientId( clientIdB ) === clientIdA &&\n\t\t\t\t\t\t! getBlockOrder( clientIdA ).length\n\t\t\t\t\t) {\n\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t[ nestedListClientId ],\n\t\t\t\t\t\t\tclientIdB,\n\t\t\t\t\t\t\tclientIdA\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\tgetBlockOrder( nestedListClientId ),\n\t\t\t\t\t\t\tnestedListClientId,\n\t\t\t\t\t\t\tgetBlockRootClientId( clientIdA )\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmergeBlocks( clientIdA, clientIdB );\n\t\t\t} );\n\t\t}\n\n\t\tif ( forward ) {\n\t\t\tconst nextBlockClientId = getNextId( clientId );\n\n\t\t\tif ( ! nextBlockClientId ) {\n\t\t\t\tonMerge( forward );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( getParentListItemId( nextBlockClientId ) ) {\n\t\t\t\toutdentListItem( nextBlockClientId );\n\t\t\t} else {\n\t\t\t\tmergeWithNested( clientId, nextBlockClientId );\n\t\t\t}\n\t\t} else {\n\t\t\t// Merging is only done from the top level. For lowel levels, the\n\t\t\t// list item is outdented instead.\n\t\t\tconst previousBlockClientId = getPreviousBlockClientId( clientId );\n\t\t\tif ( getParentListItemId( clientId ) ) {\n\t\t\t\toutdentListItem( clientId );\n\t\t\t} else if ( previousBlockClientId ) {\n\t\t\t\tconst trailingId = getTrailingId( previousBlockClientId );\n\t\t\t\tmergeWithNested( trailingId, clientId );\n\t\t\t} else {\n\t\t\t\tonMerge( forward );\n\t\t\t}\n\t\t}\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACrE,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