@wordpress/block-library 9.15.1 → 9.17.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/archives/edit.js +2 -2
- package/build/archives/edit.js.map +1 -1
- package/build/button/edit.js +2 -1
- package/build/button/edit.js.map +1 -1
- package/build/categories/edit.js +115 -37
- package/build/categories/edit.js.map +1 -1
- package/build/columns/edit.js +1 -1
- package/build/columns/edit.js.map +1 -1
- package/build/columns/edit.native.js +1 -1
- package/build/columns/edit.native.js.map +1 -1
- package/build/comment-template/edit.js +2 -2
- package/build/comment-template/edit.js.map +1 -1
- package/build/comments/edit/comments-inspector-controls.js +6 -5
- package/build/comments/edit/comments-inspector-controls.js.map +1 -1
- package/build/comments-pagination/index.js +5 -0
- package/build/comments-pagination/index.js.map +1 -1
- package/build/comments-pagination-next/index.js +7 -6
- package/build/comments-pagination-next/index.js.map +1 -1
- package/build/comments-pagination-previous/index.js +7 -6
- package/build/comments-pagination-previous/index.js.map +1 -1
- package/build/cover/deprecated.js +1 -1
- package/build/cover/deprecated.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +2 -9
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/details/edit.js +27 -18
- package/build/details/edit.js.map +1 -1
- package/build/details/index.js +12 -0
- package/build/details/index.js.map +1 -1
- package/build/details/save.js +2 -0
- package/build/details/save.js.map +1 -1
- package/build/embed/transforms.js +5 -2
- package/build/embed/transforms.js.map +1 -1
- package/build/embed/util.js +1 -1
- package/build/embed/util.js.map +1 -1
- package/build/file/edit.js +7 -4
- package/build/file/edit.js.map +1 -1
- package/build/file/transforms.js +1 -1
- package/build/file/transforms.js.map +1 -1
- package/build/file/utils/index.js +1 -1
- package/build/file/utils/index.js.map +1 -1
- package/build/form/variations.js +1 -1
- package/build/form/variations.js.map +1 -1
- package/build/form-input/edit.js +1 -1
- package/build/form-input/edit.js.map +1 -1
- package/build/gallery/edit.js +1 -1
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/transforms.js +2 -2
- package/build/gallery/transforms.js.map +1 -1
- package/build/gallery/use-get-new-images.js +1 -1
- package/build/gallery/use-get-new-images.js.map +1 -1
- package/build/group/edit.js +2 -9
- package/build/group/edit.js.map +1 -1
- package/build/home-link/edit.js +1 -2
- package/build/home-link/edit.js.map +1 -1
- package/build/latest-comments/edit.js +73 -26
- package/build/latest-comments/edit.js.map +1 -1
- package/build/latest-posts/constants.js +2 -1
- package/build/latest-posts/constants.js.map +1 -1
- package/build/latest-posts/edit.js +91 -38
- package/build/latest-posts/edit.js.map +1 -1
- package/build/list-item/edit.native.js +2 -2
- package/build/list-item/edit.native.js.map +1 -1
- package/build/list-item/index.js +1 -1
- package/build/media-text/edit.native.js +2 -2
- package/build/media-text/edit.native.js.map +1 -1
- package/build/media-text/media-container.native.js +4 -4
- package/build/media-text/media-container.native.js.map +1 -1
- package/build/navigation/edit/index.js +8 -4
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js +4 -4
- package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
- package/build/navigation/edit/use-generate-default-navigation-title.js +4 -4
- package/build/navigation/edit/use-generate-default-navigation-title.js.map +1 -1
- package/build/navigation/index.js +15 -0
- package/build/navigation/index.js.map +1 -1
- package/build/navigation-link/edit.js +15 -20
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-link/link-ui.js +9 -18
- package/build/navigation-link/link-ui.js.map +1 -1
- package/build/navigation-submenu/edit.js +1 -1
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/navigation-submenu/index.js +7 -0
- package/build/navigation-submenu/index.js.map +1 -1
- package/build/page-list/edit.js +1 -1
- package/build/page-list/edit.js.map +1 -1
- package/build/page-list/index.js +11 -0
- package/build/page-list/index.js.map +1 -1
- package/build/paragraph/edit.js +4 -14
- package/build/paragraph/edit.js.map +1 -1
- package/build/pattern/index.js +1 -1
- package/build/post-author-name/edit.js +41 -12
- package/build/post-author-name/edit.js.map +1 -1
- package/build/post-comments-link/index.js +7 -1
- package/build/post-comments-link/index.js.map +1 -1
- package/build/post-content/index.js +1 -0
- package/build/post-content/index.js.map +1 -1
- package/build/post-date/edit.js +1 -1
- package/build/post-date/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +0 -6
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-featured-image/overlay-controls.js +2 -1
- package/build/post-featured-image/overlay-controls.js.map +1 -1
- package/build/post-navigation-link/variations.js +2 -2
- package/build/post-navigation-link/variations.js.map +1 -1
- package/build/post-terms/edit.js +1 -0
- package/build/post-terms/edit.js.map +1 -1
- package/build/post-time-to-read/index.js +1 -1
- package/build/query/edit/inspector-controls/author-control.js +1 -1
- package/build/query/edit/inspector-controls/author-control.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +110 -61
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/query-content.js +2 -6
- package/build/query/edit/query-content.js.map +1 -1
- package/build/query/utils.js +1 -1
- package/build/query/utils.js.map +1 -1
- package/build/query-no-results/index.js +1 -1
- package/build/query-pagination-numbers/edit.js +1 -1
- package/build/query-pagination-numbers/edit.js.map +1 -1
- package/build/query-title/edit.js +40 -14
- package/build/query-title/edit.js.map +1 -1
- package/build/query-total/index.js +7 -1
- package/build/query-total/index.js.map +1 -1
- package/build/quote/transforms.js +1 -1
- package/build/quote/transforms.js.map +1 -1
- package/build/read-more/edit.js +25 -7
- package/build/read-more/edit.js.map +1 -1
- package/build/rss/edit.js +1 -0
- package/build/rss/edit.js.map +1 -1
- package/build/rss/index.js +6 -0
- package/build/rss/index.js.map +1 -1
- package/build/search/edit.js +67 -48
- package/build/search/edit.js.map +1 -1
- package/build/separator/edit.js +2 -4
- package/build/separator/edit.js.map +1 -1
- package/build/site-logo/edit.js +26 -35
- package/build/site-logo/edit.js.map +1 -1
- package/build/social-links/edit.js +2 -1
- package/build/social-links/edit.js.map +1 -1
- package/build/spacer/controls.js +13 -9
- package/build/spacer/controls.js.map +1 -1
- package/build/spacer/edit.js +23 -21
- package/build/spacer/edit.js.map +1 -1
- package/build/table-of-contents/edit.js +24 -8
- package/build/table-of-contents/edit.js.map +1 -1
- package/build/template-part/edit/advanced-controls.js +2 -9
- package/build/template-part/edit/advanced-controls.js.map +1 -1
- package/build/utils/messages.js +22 -0
- package/build/utils/messages.js.map +1 -0
- package/build/video/edit-common-settings.js +1 -1
- package/build/video/edit-common-settings.js.map +1 -1
- package/build/video/edit.native.js +3 -3
- package/build/video/edit.native.js.map +1 -1
- package/build-module/archives/edit.js +2 -2
- package/build-module/archives/edit.js.map +1 -1
- package/build-module/button/edit.js +3 -2
- package/build-module/button/edit.js.map +1 -1
- package/build-module/categories/edit.js +116 -38
- package/build-module/categories/edit.js.map +1 -1
- package/build-module/columns/edit.js +1 -1
- package/build-module/columns/edit.js.map +1 -1
- package/build-module/columns/edit.native.js +1 -1
- package/build-module/columns/edit.native.js.map +1 -1
- package/build-module/comment-template/edit.js +2 -2
- package/build-module/comment-template/edit.js.map +1 -1
- package/build-module/comments/edit/comments-inspector-controls.js +5 -4
- package/build-module/comments/edit/comments-inspector-controls.js.map +1 -1
- package/build-module/comments-pagination/index.js +5 -0
- package/build-module/comments-pagination/index.js.map +1 -1
- package/build-module/comments-pagination-next/index.js +7 -6
- package/build-module/comments-pagination-next/index.js.map +1 -1
- package/build-module/comments-pagination-previous/index.js +7 -6
- package/build-module/comments-pagination-previous/index.js.map +1 -1
- package/build-module/cover/deprecated.js +1 -1
- package/build-module/cover/deprecated.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +1 -8
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/details/edit.js +29 -20
- package/build-module/details/edit.js.map +1 -1
- package/build-module/details/index.js +12 -0
- package/build-module/details/index.js.map +1 -1
- package/build-module/details/save.js +2 -0
- package/build-module/details/save.js.map +1 -1
- package/build-module/embed/transforms.js +5 -2
- package/build-module/embed/transforms.js.map +1 -1
- package/build-module/embed/util.js +1 -1
- package/build-module/embed/util.js.map +1 -1
- package/build-module/file/edit.js +7 -4
- package/build-module/file/edit.js.map +1 -1
- package/build-module/file/transforms.js +1 -1
- package/build-module/file/transforms.js.map +1 -1
- package/build-module/file/utils/index.js +1 -1
- package/build-module/file/utils/index.js.map +1 -1
- package/build-module/form/variations.js +1 -1
- package/build-module/form/variations.js.map +1 -1
- package/build-module/form-input/edit.js +1 -1
- package/build-module/form-input/edit.js.map +1 -1
- package/build-module/gallery/edit.js +1 -1
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/transforms.js +2 -2
- package/build-module/gallery/transforms.js.map +1 -1
- package/build-module/gallery/use-get-new-images.js +1 -1
- package/build-module/gallery/use-get-new-images.js.map +1 -1
- package/build-module/group/edit.js +1 -8
- package/build-module/group/edit.js.map +1 -1
- package/build-module/home-link/edit.js +1 -2
- package/build-module/home-link/edit.js.map +1 -1
- package/build-module/latest-comments/edit.js +74 -27
- package/build-module/latest-comments/edit.js.map +1 -1
- package/build-module/latest-posts/constants.js +1 -0
- package/build-module/latest-posts/constants.js.map +1 -1
- package/build-module/latest-posts/edit.js +93 -40
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/list-item/edit.native.js +2 -2
- package/build-module/list-item/edit.native.js.map +1 -1
- package/build-module/list-item/index.js +1 -1
- package/build-module/media-text/edit.native.js +2 -2
- package/build-module/media-text/edit.native.js.map +1 -1
- package/build-module/media-text/media-container.native.js +4 -4
- package/build-module/media-text/media-container.native.js.map +1 -1
- package/build-module/navigation/edit/index.js +8 -4
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js +4 -4
- package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
- package/build-module/navigation/edit/use-generate-default-navigation-title.js +4 -4
- package/build-module/navigation/edit/use-generate-default-navigation-title.js.map +1 -1
- package/build-module/navigation/index.js +15 -0
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation-link/edit.js +16 -21
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-link/link-ui.js +9 -18
- package/build-module/navigation-link/link-ui.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +1 -1
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/navigation-submenu/index.js +7 -0
- package/build-module/navigation-submenu/index.js.map +1 -1
- package/build-module/page-list/edit.js +1 -1
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/page-list/index.js +11 -0
- package/build-module/page-list/index.js.map +1 -1
- package/build-module/paragraph/edit.js +5 -15
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/pattern/index.js +1 -1
- package/build-module/post-author-name/edit.js +42 -13
- package/build-module/post-author-name/edit.js.map +1 -1
- package/build-module/post-comments-link/index.js +7 -1
- package/build-module/post-comments-link/index.js.map +1 -1
- package/build-module/post-content/index.js +1 -0
- package/build-module/post-content/index.js.map +1 -1
- package/build-module/post-date/edit.js +1 -1
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +0 -6
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-featured-image/overlay-controls.js +2 -1
- package/build-module/post-featured-image/overlay-controls.js.map +1 -1
- package/build-module/post-navigation-link/variations.js +2 -2
- package/build-module/post-navigation-link/variations.js.map +1 -1
- package/build-module/post-terms/edit.js +1 -0
- package/build-module/post-terms/edit.js.map +1 -1
- package/build-module/post-time-to-read/index.js +1 -1
- package/build-module/query/edit/inspector-controls/author-control.js +1 -1
- package/build-module/query/edit/inspector-controls/author-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +111 -62
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/query-content.js +1 -5
- package/build-module/query/edit/query-content.js.map +1 -1
- package/build-module/query/utils.js +1 -1
- package/build-module/query/utils.js.map +1 -1
- package/build-module/query-no-results/index.js +1 -1
- package/build-module/query-pagination-numbers/edit.js +1 -1
- package/build-module/query-pagination-numbers/edit.js.map +1 -1
- package/build-module/query-title/edit.js +41 -15
- package/build-module/query-title/edit.js.map +1 -1
- package/build-module/query-total/index.js +7 -1
- package/build-module/query-total/index.js.map +1 -1
- package/build-module/quote/transforms.js +1 -1
- package/build-module/quote/transforms.js.map +1 -1
- package/build-module/read-more/edit.js +26 -8
- package/build-module/read-more/edit.js.map +1 -1
- package/build-module/rss/edit.js +1 -0
- package/build-module/rss/edit.js.map +1 -1
- package/build-module/rss/index.js +6 -0
- package/build-module/rss/index.js.map +1 -1
- package/build-module/search/edit.js +69 -50
- package/build-module/search/edit.js.map +1 -1
- package/build-module/separator/edit.js +1 -3
- package/build-module/separator/edit.js.map +1 -1
- package/build-module/site-logo/edit.js +27 -36
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/social-links/edit.js +2 -1
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/spacer/controls.js +13 -9
- package/build-module/spacer/controls.js.map +1 -1
- package/build-module/spacer/edit.js +24 -22
- package/build-module/spacer/edit.js.map +1 -1
- package/build-module/table-of-contents/edit.js +25 -9
- package/build-module/table-of-contents/edit.js.map +1 -1
- package/build-module/template-part/edit/advanced-controls.js +1 -8
- package/build-module/template-part/edit/advanced-controls.js.map +1 -1
- package/build-module/utils/messages.js +15 -0
- package/build-module/utils/messages.js.map +1 -0
- package/build-module/video/edit-common-settings.js +1 -1
- package/build-module/video/edit-common-settings.js.map +1 -1
- package/build-module/video/edit.native.js +3 -3
- package/build-module/video/edit.native.js.map +1 -1
- package/build-style/editor-rtl.css +12 -86
- package/build-style/editor.css +12 -86
- package/build-style/freeform/editor-rtl.css +2 -4
- package/build-style/freeform/editor.css +2 -4
- package/build-style/gallery/editor-rtl.css +0 -46
- package/build-style/gallery/editor.css +0 -46
- package/build-style/image/style-rtl.css +24 -10
- package/build-style/image/style.css +24 -10
- package/build-style/navigation/style-rtl.css +8 -6
- package/build-style/navigation/style.css +8 -6
- package/build-style/navigation-link/editor-rtl.css +3 -0
- package/build-style/navigation-link/editor.css +3 -0
- package/build-style/paragraph/editor-rtl.css +4 -0
- package/build-style/paragraph/editor.css +4 -0
- package/build-style/post-featured-image/editor-rtl.css +1 -1
- package/build-style/post-featured-image/editor.css +1 -1
- package/build-style/query/editor-rtl.css +0 -27
- package/build-style/query/editor.css +0 -27
- package/build-style/site-logo/editor-rtl.css +2 -8
- package/build-style/site-logo/editor.css +2 -8
- package/build-style/social-links/style-rtl.css +2 -5
- package/build-style/social-links/style.css +2 -5
- package/build-style/style-rtl.css +34 -21
- package/build-style/style.css +34 -21
- package/package.json +35 -35
- package/src/archives/edit.js +2 -2
- package/src/audio/test/transforms.native.js +4 -3
- package/src/button/edit.js +6 -2
- package/src/categories/edit.js +133 -45
- package/src/columns/edit.js +1 -1
- package/src/columns/edit.native.js +1 -1
- package/src/comment-template/edit.js +2 -2
- package/src/comments/edit/comments-inspector-controls.js +5 -8
- package/src/comments-pagination/block.json +5 -0
- package/src/comments-pagination-next/block.json +0 -5
- package/src/comments-pagination-next/index.js +6 -0
- package/src/comments-pagination-previous/block.json +0 -5
- package/src/comments-pagination-previous/index.js +6 -0
- package/src/cover/deprecated.js +1 -1
- package/src/cover/edit/inspector-controls.js +1 -21
- package/src/cover/test/__snapshots__/edit.native.js.snap +1 -1
- package/src/cover/test/edit.js +7 -7
- package/src/cover/test/edit.native.js +2 -2
- package/src/cover/test/transforms.native.js +9 -5
- package/src/details/block.json +12 -0
- package/src/details/edit.js +29 -24
- package/src/details/save.js +6 -2
- package/src/editor.scss +1 -1
- package/src/embed/test/index.js +1 -1
- package/src/embed/transforms.js +3 -1
- package/src/embed/util.js +1 -1
- package/src/file/edit.js +4 -3
- package/src/file/test/transforms.native.js +4 -3
- package/src/file/transforms.js +1 -1
- package/src/file/utils/index.js +1 -1
- package/src/form/variations.js +1 -1
- package/src/form-input/edit.js +1 -1
- package/src/freeform/editor.scss +4 -3
- package/src/gallery/edit.js +1 -1
- package/src/gallery/editor.scss +0 -54
- package/src/gallery/test/transforms.native.js +4 -3
- package/src/gallery/transforms.js +2 -2
- package/src/gallery/use-get-new-images.js +1 -1
- package/src/group/edit.js +1 -20
- package/src/home-link/edit.js +0 -6
- package/src/image/block.json +8 -1
- package/src/image/editor.scss +1 -1
- package/src/image/index.php +9 -13
- package/src/image/style.scss +17 -7
- package/src/image/test/edit.native.js +1 -1
- package/src/image/test/transforms.native.js +4 -3
- package/src/latest-comments/edit.js +93 -33
- package/src/latest-posts/constants.js +1 -0
- package/src/latest-posts/edit.js +119 -44
- package/src/list/test/edit.native.js +10 -10
- package/src/list-item/block.json +1 -1
- package/src/list-item/edit.native.js +2 -2
- package/src/media-text/edit.native.js +2 -2
- package/src/media-text/media-container.native.js +4 -4
- package/src/media-text/test/transforms.native.js +9 -5
- package/src/navigation/edit/index.js +4 -0
- package/src/navigation/edit/use-convert-classic-menu-to-block-menu.js +4 -4
- package/src/navigation/edit/use-generate-default-navigation-title.js +4 -4
- package/src/navigation/index.js +20 -0
- package/src/navigation/style.scss +7 -4
- package/src/navigation-link/edit.js +26 -30
- package/src/navigation-link/editor.scss +27 -18
- package/src/navigation-link/link-ui.js +7 -13
- package/src/navigation-submenu/edit.js +1 -1
- package/src/navigation-submenu/index.js +7 -0
- package/src/navigation-submenu/index.php +21 -4
- package/src/page-list/block.json +11 -0
- package/src/page-list/edit.js +52 -50
- package/src/paragraph/edit.js +3 -18
- package/src/paragraph/editor.scss +7 -0
- package/src/paragraph/style.scss +1 -1
- package/src/pattern/block.json +1 -1
- package/src/post-author-name/edit.js +53 -15
- package/src/post-comments-link/block.json +7 -1
- package/src/post-content/block.json +2 -1
- package/src/post-date/edit.js +1 -3
- package/src/post-featured-image/edit.js +2 -15
- package/src/post-featured-image/editor.scss +2 -2
- package/src/post-featured-image/overlay-controls.js +1 -0
- package/src/post-navigation-link/variations.js +2 -2
- package/src/post-terms/edit.js +1 -0
- package/src/post-time-to-read/block.json +1 -1
- package/src/query/edit/inspector-controls/author-control.js +1 -1
- package/src/query/edit/inspector-controls/index.js +148 -88
- package/src/query/edit/query-content.js +1 -11
- package/src/query/editor.scss +0 -31
- package/src/query/utils.js +1 -1
- package/src/query-no-results/block.json +1 -1
- package/src/query-pagination-numbers/edit.js +1 -1
- package/src/query-title/edit.js +61 -19
- package/src/query-total/block.json +7 -1
- package/src/quote/transforms.js +1 -1
- package/src/read-more/edit.js +35 -11
- package/src/rss/block.json +6 -0
- package/src/rss/edit.js +1 -0
- package/src/search/edit.js +100 -71
- package/src/separator/deprecated.scss +1 -1
- package/src/separator/edit.js +1 -6
- package/src/site-logo/edit.js +34 -47
- package/src/site-logo/editor.scss +3 -6
- package/src/social-link/index.php +2 -2
- package/src/social-links/edit.js +1 -0
- package/src/social-links/style.scss +3 -3
- package/src/spacer/controls.js +10 -9
- package/src/spacer/edit.js +25 -23
- package/src/table-of-contents/edit.js +38 -19
- package/src/template-part/edit/advanced-controls.js +1 -21
- package/src/utils/messages.js +31 -0
- package/src/video/edit-common-settings.js +1 -1
- package/src/video/edit.native.js +3 -3
- package/src/video/test/transforms.native.js +4 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blocks","require","_blob","_hooks","_constants","parseShortcodeIds","ids","split","map","id","parseInt","updateThirdPartyTransformToGallery","block","name","attributes","images","length","innerBlocks","url","alt","createBlock","sizeSlug","linkDestination","addFilter","updateThirdPartyTransformFromGallery","toBlock","fromBlocks","from","Array","isArray","galleryBlock","find","transformedBlock","includes","transforms","type","isMultiBlock","blocks","transform","align","every","attribute","undefined","validImages","filter","image","width","height","tag","named","columns","link","orderby","imageIds","linkTo","LINK_DESTINATION_NONE","LINK_DESTINATION_ATTACHMENT","LINK_DESTINATION_MEDIA","randomOrder","imageId","isMatch","priority","files","file","indexOf","blob","createBlobURL","to","caption","title","href","rel","linkClass","imageSizeSlug","linkTarget","anchor","className","_default","exports","default"],"sources":["@wordpress/block-library/src/gallery/transforms.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\nimport { createBlobURL } from '@wordpress/blob';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport {\n\tLINK_DESTINATION_ATTACHMENT,\n\tLINK_DESTINATION_NONE,\n\tLINK_DESTINATION_MEDIA,\n} from './constants';\n\nconst parseShortcodeIds = ( ids ) => {\n\tif ( ! ids ) {\n\t\treturn [];\n\t}\n\n\treturn ids.split( ',' ).map( ( id ) => parseInt( id, 10 ) );\n};\n\n/**\n * Third party block plugins don't have an easy way to detect if the\n * innerBlocks version of the Gallery is running when they run a\n * 3rdPartyBlock -> GalleryBlock transform so this tranform filter\n * will handle this. Once the innerBlocks version is the default\n * in a core release, this could be deprecated and removed after\n * plugin authors have been given time to update transforms.\n *\n * @typedef {Object} Attributes\n * @typedef {Object} Block\n * @property {Attributes} attributes The attributes of the block.\n * @param {Block} block The transformed block.\n * @return {Block} The transformed block.\n */\nfunction updateThirdPartyTransformToGallery( block ) {\n\tif (\n\t\tblock.name === 'core/gallery' &&\n\t\tblock.attributes?.images.length > 0\n\t) {\n\t\tconst innerBlocks = block.attributes.images.map(\n\t\t\t( { url, id, alt } ) => {\n\t\t\t\treturn createBlock( 'core/image', {\n\t\t\t\t\turl,\n\t\t\t\t\tid: id ? parseInt( id, 10 ) : null,\n\t\t\t\t\talt,\n\t\t\t\t\tsizeSlug: block.attributes.sizeSlug,\n\t\t\t\t\tlinkDestination: block.attributes.linkDestination,\n\t\t\t\t} );\n\t\t\t}\n\t\t);\n\n\t\tdelete block.attributes.ids;\n\t\tdelete block.attributes.images;\n\t\tblock.innerBlocks = innerBlocks;\n\t}\n\n\treturn block;\n}\naddFilter(\n\t'blocks.switchToBlockType.transformedBlock',\n\t'core/gallery/update-third-party-transform-to',\n\tupdateThirdPartyTransformToGallery\n);\n\n/**\n * Third party block plugins don't have an easy way to detect if the\n * innerBlocks version of the Gallery is running when they run a\n * GalleryBlock -> 3rdPartyBlock transform so this transform filter\n * will handle this. Once the innerBlocks version is the default\n * in a core release, this could be deprecated and removed after\n * plugin authors have been given time to update transforms.\n *\n * @typedef {Object} Attributes\n * @typedef {Object} Block\n * @property {Attributes} attributes The attributes of the block.\n * @param {Block} toBlock The block to transform to.\n * @param {Block[]} fromBlocks The blocks to transform from.\n * @return {Block} The transformed block.\n */\nfunction updateThirdPartyTransformFromGallery( toBlock, fromBlocks ) {\n\tconst from = Array.isArray( fromBlocks ) ? fromBlocks : [ fromBlocks ];\n\tconst galleryBlock = from.find(\n\t\t( transformedBlock ) =>\n\t\t\ttransformedBlock.name === 'core/gallery' &&\n\t\t\ttransformedBlock.innerBlocks.length > 0 &&\n\t\t\t! transformedBlock.attributes.images?.length > 0 &&\n\t\t\t! toBlock.name.includes( 'core/' )\n\t);\n\n\tif ( galleryBlock ) {\n\t\tconst images = galleryBlock.innerBlocks.map(\n\t\t\t( { attributes: { url, id, alt } } ) => ( {\n\t\t\t\turl,\n\t\t\t\tid: id ? parseInt( id, 10 ) : null,\n\t\t\t\talt,\n\t\t\t} )\n\t\t);\n\t\tconst ids = images.map( ( { id } ) => id );\n\t\tgalleryBlock.attributes.images = images;\n\t\tgalleryBlock.attributes.ids = ids;\n\t}\n\n\treturn toBlock;\n}\naddFilter(\n\t'blocks.switchToBlockType.transformedBlock',\n\t'core/gallery/update-third-party-transform-from',\n\tupdateThirdPartyTransformFromGallery\n);\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tisMultiBlock: true,\n\t\t\tblocks: [ 'core/image' ],\n\t\t\ttransform: ( attributes ) => {\n\t\t\t\t// Init the align and size from the first item which may be either the placeholder or an image.\n\t\t\t\tlet { align, sizeSlug } = attributes[ 0 ];\n\t\t\t\t// Loop through all the images and check if they have the same align and size.\n\t\t\t\talign = attributes.every(\n\t\t\t\t\t( attribute ) => attribute.align === align\n\t\t\t\t)\n\t\t\t\t\t? align\n\t\t\t\t\t: undefined;\n\t\t\t\tsizeSlug = attributes.every(\n\t\t\t\t\t( attribute ) => attribute.sizeSlug === sizeSlug\n\t\t\t\t)\n\t\t\t\t\t? sizeSlug\n\t\t\t\t\t: undefined;\n\n\t\t\t\tconst validImages = attributes.filter( ( { url } ) => url );\n\n\t\t\t\tconst innerBlocks = validImages.map( ( image ) => {\n\t\t\t\t\t// Gallery images can't currently be resized so make sure height and width are undefined.\n\t\t\t\t\timage.width = undefined;\n\t\t\t\t\timage.height = undefined;\n\t\t\t\t\treturn createBlock( 'core/image', image );\n\t\t\t\t} );\n\n\t\t\t\treturn createBlock(\n\t\t\t\t\t'core/gallery',\n\t\t\t\t\t{\n\t\t\t\t\t\talign,\n\t\t\t\t\t\tsizeSlug,\n\t\t\t\t\t},\n\t\t\t\t\tinnerBlocks\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'shortcode',\n\t\t\ttag: 'gallery',\n\t\t\ttransform( { named: { ids, columns = 3, link, orderby } } ) {\n\t\t\t\tconst imageIds = parseShortcodeIds( ids ).map( ( id ) =>\n\t\t\t\t\tparseInt( id, 10 )\n\t\t\t\t);\n\n\t\t\t\tlet linkTo = LINK_DESTINATION_NONE;\n\t\t\t\tif ( link === 'post' ) {\n\t\t\t\t\tlinkTo = LINK_DESTINATION_ATTACHMENT;\n\t\t\t\t} else if ( link === 'file' ) {\n\t\t\t\t\tlinkTo = LINK_DESTINATION_MEDIA;\n\t\t\t\t}\n\n\t\t\t\tconst galleryBlock = createBlock(\n\t\t\t\t\t'core/gallery',\n\t\t\t\t\t{\n\t\t\t\t\t\tcolumns: parseInt( columns, 10 ),\n\t\t\t\t\t\tlinkTo,\n\t\t\t\t\t\trandomOrder: orderby === 'rand',\n\t\t\t\t\t},\n\t\t\t\t\timageIds.map( ( imageId ) =>\n\t\t\t\t\t\tcreateBlock( 'core/image', { id: imageId } )\n\t\t\t\t\t)\n\t\t\t\t);\n\n\t\t\t\treturn galleryBlock;\n\t\t\t},\n\t\t\tisMatch( { named } ) {\n\t\t\t\treturn undefined !== named.ids;\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t// When created by drag and dropping multiple files on an insertion point. Because multiple\n\t\t\t// files must not be transformed to a gallery when dropped within a gallery there is another transform\n\t\t\t// within the image block to handle that case. Therefore this transform has to have priority 1\n\t\t\t// set so that it overrrides the image block transformation when mulitple images are dropped outside\n\t\t\t// of a gallery block.\n\t\t\ttype: 'files',\n\t\t\tpriority: 1,\n\t\t\tisMatch( files ) {\n\t\t\t\treturn (\n\t\t\t\t\tfiles.length !== 1 &&\n\t\t\t\t\tfiles.every(\n\t\t\t\t\t\t( file ) => file.type.indexOf( 'image/' ) === 0\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t},\n\t\t\ttransform( files ) {\n\t\t\t\tconst innerBlocks = files.map( ( file ) =>\n\t\t\t\t\tcreateBlock( 'core/image', {\n\t\t\t\t\t\tblob: createBlobURL( file ),\n\t\t\t\t\t} )\n\t\t\t\t);\n\n\t\t\t\treturn createBlock( 'core/gallery', {}, innerBlocks );\n\t\t\t},\n\t\t},\n\t],\n\tto: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/image' ],\n\t\t\ttransform: ( { align }, innerBlocks ) => {\n\t\t\t\tif ( innerBlocks.length > 0 ) {\n\t\t\t\t\treturn innerBlocks.map(\n\t\t\t\t\t\t( {\n\t\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\t\talt,\n\t\t\t\t\t\t\t\tcaption,\n\t\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\t\thref,\n\t\t\t\t\t\t\t\trel,\n\t\t\t\t\t\t\t\tlinkClass,\n\t\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t\tsizeSlug: imageSizeSlug,\n\t\t\t\t\t\t\t\tlinkDestination,\n\t\t\t\t\t\t\t\tlinkTarget,\n\t\t\t\t\t\t\t\tanchor,\n\t\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t} ) =>\n\t\t\t\t\t\t\tcreateBlock( 'core/image', {\n\t\t\t\t\t\t\t\talign,\n\t\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\t\talt,\n\t\t\t\t\t\t\t\tcaption,\n\t\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\t\thref,\n\t\t\t\t\t\t\t\trel,\n\t\t\t\t\t\t\t\tlinkClass,\n\t\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t\tsizeSlug: imageSizeSlug,\n\t\t\t\t\t\t\t\tlinkDestination,\n\t\t\t\t\t\t\t\tlinkTarget,\n\t\t\t\t\t\t\t\tanchor,\n\t\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn createBlock( 'core/image', { align } );\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAKA,IAAAG,UAAA,GAAAH,OAAA;AAVA;AACA;AACA;;AAKA;AACA;AACA;;AAOA,MAAMI,iBAAiB,GAAKC,GAAG,IAAM;EACpC,IAAK,CAAEA,GAAG,EAAG;IACZ,OAAO,EAAE;EACV;EAEA,OAAOA,GAAG,CAACC,KAAK,CAAE,GAAI,CAAC,CAACC,GAAG,CAAIC,EAAE,IAAMC,QAAQ,CAAED,EAAE,EAAE,EAAG,CAAE,CAAC;AAC5D,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASE,kCAAkCA,CAAEC,KAAK,EAAG;EACpD,IACCA,KAAK,CAACC,IAAI,KAAK,cAAc,IAC7BD,KAAK,CAACE,UAAU,EAAEC,MAAM,CAACC,MAAM,GAAG,CAAC,EAClC;IACD,MAAMC,WAAW,GA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AE,CACJ,CAAC;MACF;MACA,OAAO,IAAAxD,mBAAW,EAAE,YAAY,EAAE;QAAEmB;MAAM,CAAE,CAAC;IAC9C;EACD,CAAC;AAEH,CAAC;AAAC,IAAAsC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa7C,UAAU","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_blocks","require","_blob","_hooks","_constants","parseShortcodeIds","ids","split","map","id","parseInt","updateThirdPartyTransformToGallery","block","name","attributes","images","length","innerBlocks","url","alt","createBlock","sizeSlug","linkDestination","addFilter","updateThirdPartyTransformFromGallery","toBlock","fromBlocks","from","Array","isArray","galleryBlock","find","transformedBlock","includes","transforms","type","isMultiBlock","blocks","transform","align","every","attribute","undefined","validImages","filter","image","width","height","tag","named","columns","link","orderby","imageIds","linkTo","LINK_DESTINATION_NONE","LINK_DESTINATION_ATTACHMENT","LINK_DESTINATION_MEDIA","randomOrder","imageId","isMatch","priority","files","file","indexOf","blob","createBlobURL","to","caption","title","href","rel","linkClass","imageSizeSlug","linkTarget","anchor","className","_default","exports","default"],"sources":["@wordpress/block-library/src/gallery/transforms.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\nimport { createBlobURL } from '@wordpress/blob';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport {\n\tLINK_DESTINATION_ATTACHMENT,\n\tLINK_DESTINATION_NONE,\n\tLINK_DESTINATION_MEDIA,\n} from './constants';\n\nconst parseShortcodeIds = ( ids ) => {\n\tif ( ! ids ) {\n\t\treturn [];\n\t}\n\n\treturn ids.split( ',' ).map( ( id ) => parseInt( id, 10 ) );\n};\n\n/**\n * Third party block plugins don't have an easy way to detect if the\n * innerBlocks version of the Gallery is running when they run a\n * 3rdPartyBlock -> GalleryBlock transform so this transform filter\n * will handle this. Once the innerBlocks version is the default\n * in a core release, this could be deprecated and removed after\n * plugin authors have been given time to update transforms.\n *\n * @typedef {Object} Attributes\n * @typedef {Object} Block\n * @property {Attributes} attributes The attributes of the block.\n * @param {Block} block The transformed block.\n * @return {Block} The transformed block.\n */\nfunction updateThirdPartyTransformToGallery( block ) {\n\tif (\n\t\tblock.name === 'core/gallery' &&\n\t\tblock.attributes?.images.length > 0\n\t) {\n\t\tconst innerBlocks = block.attributes.images.map(\n\t\t\t( { url, id, alt } ) => {\n\t\t\t\treturn createBlock( 'core/image', {\n\t\t\t\t\turl,\n\t\t\t\t\tid: id ? parseInt( id, 10 ) : null,\n\t\t\t\t\talt,\n\t\t\t\t\tsizeSlug: block.attributes.sizeSlug,\n\t\t\t\t\tlinkDestination: block.attributes.linkDestination,\n\t\t\t\t} );\n\t\t\t}\n\t\t);\n\n\t\tdelete block.attributes.ids;\n\t\tdelete block.attributes.images;\n\t\tblock.innerBlocks = innerBlocks;\n\t}\n\n\treturn block;\n}\naddFilter(\n\t'blocks.switchToBlockType.transformedBlock',\n\t'core/gallery/update-third-party-transform-to',\n\tupdateThirdPartyTransformToGallery\n);\n\n/**\n * Third party block plugins don't have an easy way to detect if the\n * innerBlocks version of the Gallery is running when they run a\n * GalleryBlock -> 3rdPartyBlock transform so this transform filter\n * will handle this. Once the innerBlocks version is the default\n * in a core release, this could be deprecated and removed after\n * plugin authors have been given time to update transforms.\n *\n * @typedef {Object} Attributes\n * @typedef {Object} Block\n * @property {Attributes} attributes The attributes of the block.\n * @param {Block} toBlock The block to transform to.\n * @param {Block[]} fromBlocks The blocks to transform from.\n * @return {Block} The transformed block.\n */\nfunction updateThirdPartyTransformFromGallery( toBlock, fromBlocks ) {\n\tconst from = Array.isArray( fromBlocks ) ? fromBlocks : [ fromBlocks ];\n\tconst galleryBlock = from.find(\n\t\t( transformedBlock ) =>\n\t\t\ttransformedBlock.name === 'core/gallery' &&\n\t\t\ttransformedBlock.innerBlocks.length > 0 &&\n\t\t\t! transformedBlock.attributes.images?.length > 0 &&\n\t\t\t! toBlock.name.includes( 'core/' )\n\t);\n\n\tif ( galleryBlock ) {\n\t\tconst images = galleryBlock.innerBlocks.map(\n\t\t\t( { attributes: { url, id, alt } } ) => ( {\n\t\t\t\turl,\n\t\t\t\tid: id ? parseInt( id, 10 ) : null,\n\t\t\t\talt,\n\t\t\t} )\n\t\t);\n\t\tconst ids = images.map( ( { id } ) => id );\n\t\tgalleryBlock.attributes.images = images;\n\t\tgalleryBlock.attributes.ids = ids;\n\t}\n\n\treturn toBlock;\n}\naddFilter(\n\t'blocks.switchToBlockType.transformedBlock',\n\t'core/gallery/update-third-party-transform-from',\n\tupdateThirdPartyTransformFromGallery\n);\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tisMultiBlock: true,\n\t\t\tblocks: [ 'core/image' ],\n\t\t\ttransform: ( attributes ) => {\n\t\t\t\t// Init the align and size from the first item which may be either the placeholder or an image.\n\t\t\t\tlet { align, sizeSlug } = attributes[ 0 ];\n\t\t\t\t// Loop through all the images and check if they have the same align and size.\n\t\t\t\talign = attributes.every(\n\t\t\t\t\t( attribute ) => attribute.align === align\n\t\t\t\t)\n\t\t\t\t\t? align\n\t\t\t\t\t: undefined;\n\t\t\t\tsizeSlug = attributes.every(\n\t\t\t\t\t( attribute ) => attribute.sizeSlug === sizeSlug\n\t\t\t\t)\n\t\t\t\t\t? sizeSlug\n\t\t\t\t\t: undefined;\n\n\t\t\t\tconst validImages = attributes.filter( ( { url } ) => url );\n\n\t\t\t\tconst innerBlocks = validImages.map( ( image ) => {\n\t\t\t\t\t// Gallery images can't currently be resized so make sure height and width are undefined.\n\t\t\t\t\timage.width = undefined;\n\t\t\t\t\timage.height = undefined;\n\t\t\t\t\treturn createBlock( 'core/image', image );\n\t\t\t\t} );\n\n\t\t\t\treturn createBlock(\n\t\t\t\t\t'core/gallery',\n\t\t\t\t\t{\n\t\t\t\t\t\talign,\n\t\t\t\t\t\tsizeSlug,\n\t\t\t\t\t},\n\t\t\t\t\tinnerBlocks\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'shortcode',\n\t\t\ttag: 'gallery',\n\t\t\ttransform( { named: { ids, columns = 3, link, orderby } } ) {\n\t\t\t\tconst imageIds = parseShortcodeIds( ids ).map( ( id ) =>\n\t\t\t\t\tparseInt( id, 10 )\n\t\t\t\t);\n\n\t\t\t\tlet linkTo = LINK_DESTINATION_NONE;\n\t\t\t\tif ( link === 'post' ) {\n\t\t\t\t\tlinkTo = LINK_DESTINATION_ATTACHMENT;\n\t\t\t\t} else if ( link === 'file' ) {\n\t\t\t\t\tlinkTo = LINK_DESTINATION_MEDIA;\n\t\t\t\t}\n\n\t\t\t\tconst galleryBlock = createBlock(\n\t\t\t\t\t'core/gallery',\n\t\t\t\t\t{\n\t\t\t\t\t\tcolumns: parseInt( columns, 10 ),\n\t\t\t\t\t\tlinkTo,\n\t\t\t\t\t\trandomOrder: orderby === 'rand',\n\t\t\t\t\t},\n\t\t\t\t\timageIds.map( ( imageId ) =>\n\t\t\t\t\t\tcreateBlock( 'core/image', { id: imageId } )\n\t\t\t\t\t)\n\t\t\t\t);\n\n\t\t\t\treturn galleryBlock;\n\t\t\t},\n\t\t\tisMatch( { named } ) {\n\t\t\t\treturn undefined !== named.ids;\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t// When created by drag and dropping multiple files on an insertion point. Because multiple\n\t\t\t// files must not be transformed to a gallery when dropped within a gallery there is another transform\n\t\t\t// within the image block to handle that case. Therefore this transform has to have priority 1\n\t\t\t// set so that it overrides the image block transformation when multiple images are dropped outside\n\t\t\t// of a gallery block.\n\t\t\ttype: 'files',\n\t\t\tpriority: 1,\n\t\t\tisMatch( files ) {\n\t\t\t\treturn (\n\t\t\t\t\tfiles.length !== 1 &&\n\t\t\t\t\tfiles.every(\n\t\t\t\t\t\t( file ) => file.type.indexOf( 'image/' ) === 0\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t},\n\t\t\ttransform( files ) {\n\t\t\t\tconst innerBlocks = files.map( ( file ) =>\n\t\t\t\t\tcreateBlock( 'core/image', {\n\t\t\t\t\t\tblob: createBlobURL( file ),\n\t\t\t\t\t} )\n\t\t\t\t);\n\n\t\t\t\treturn createBlock( 'core/gallery', {}, innerBlocks );\n\t\t\t},\n\t\t},\n\t],\n\tto: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/image' ],\n\t\t\ttransform: ( { align }, innerBlocks ) => {\n\t\t\t\tif ( innerBlocks.length > 0 ) {\n\t\t\t\t\treturn innerBlocks.map(\n\t\t\t\t\t\t( {\n\t\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\t\talt,\n\t\t\t\t\t\t\t\tcaption,\n\t\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\t\thref,\n\t\t\t\t\t\t\t\trel,\n\t\t\t\t\t\t\t\tlinkClass,\n\t\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t\tsizeSlug: imageSizeSlug,\n\t\t\t\t\t\t\t\tlinkDestination,\n\t\t\t\t\t\t\t\tlinkTarget,\n\t\t\t\t\t\t\t\tanchor,\n\t\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t} ) =>\n\t\t\t\t\t\t\tcreateBlock( 'core/image', {\n\t\t\t\t\t\t\t\talign,\n\t\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\t\talt,\n\t\t\t\t\t\t\t\tcaption,\n\t\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\t\thref,\n\t\t\t\t\t\t\t\trel,\n\t\t\t\t\t\t\t\tlinkClass,\n\t\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t\tsizeSlug: imageSizeSlug,\n\t\t\t\t\t\t\t\tlinkDestination,\n\t\t\t\t\t\t\t\tlinkTarget,\n\t\t\t\t\t\t\t\tanchor,\n\t\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn createBlock( 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;IACtD;EACD,CAAC,CACD;EACDkD,EAAE,EAAE,CACH;IACChC,IAAI,EAAE,OAAO;IACbE,MAAM,EAAE,CAAE,YAAY,CAAE;IACxBC,SAAS,EAAEA,CAAE;MAAEC;IAAM,CAAC,EAAEtB,WAAW,KAAM;MACxC,IAAKA,WAAW,CAACD,MAAM,GAAG,CAAC,EAAG;QAC7B,OAAOC,WAAW,CAACT,GAAG,CACrB,CAAE;UACDM,UAAU,EAAE;YACXI,GAAG;YACHC,GAAG;YACHiD,OAAO;YACPC,KAAK;YACLC,IAAI;YACJC,GAAG;YACHC,SAAS;YACT/D,EAAE;YACFY,QAAQ,EAAEoD,aAAa;YACvBnD,eAAe;YACfoD,UAAU;YACVC,MAAM;YACNC;UACD;QACD,CAAC,KACA,IAAAxD,mBAAW,EAAE,YAAY,EAAE;UAC1BmB,KAAK;UACLrB,GAAG;UACHC,GAAG;UACHiD,OAAO;UACPC,KAAK;UACLC,IAAI;UACJC,GAAG;UACHC,SAAS;UACT/D,EAAE;UACFY,QAAQ,EAAEoD,aAAa;UACvBnD,eAAe;UACfoD,UAAU;UACVC,MAAM;UACNC;QACD,CAAE,CACJ,CAAC;MACF;MACA,OAAO,IAAAxD,mBAAW,EAAE,YAAY,EAAE;QAAEmB;MAAM,CAAE,CAAC;IAC9C;EACD,CAAC;AAEH,CAAC;AAAC,IAAAsC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa7C,UAAU","ignoreList":[]}
|
|
@@ -45,7 +45,7 @@ function useGetNewImages(images, imageData) {
|
|
|
45
45
|
|
|
46
46
|
// Now check for any new images that have been added to InnerBlocks and for which
|
|
47
47
|
// we have the imageData we need for setting default block attributes.
|
|
48
|
-
const newImages = images.filter(image => !newCurrentImages.find(currentImage => image.clientId && currentImage.clientId === image.clientId) && imageData?.find(img => img.id === image.id) && !image.
|
|
48
|
+
const newImages = images.filter(image => !newCurrentImages.find(currentImage => image.clientId && currentImage.clientId === image.clientId) && imageData?.find(img => img.id === image.id) && !image.fromSavedContent);
|
|
49
49
|
if (imagesUpdated || newImages?.length > 0) {
|
|
50
50
|
setCurrentImages([...newCurrentImages, ...newImages]);
|
|
51
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","useGetNewImages","images","imageData","currentImages","setCurrentImages","useState","useMemo","getNewImages","imagesUpdated","newCurrentImages","filter","currentImg","find","img","clientId","length","forEach","image","fromSavedContent","currentImage","id","push","newImages"
|
|
1
|
+
{"version":3,"names":["_element","require","useGetNewImages","images","imageData","currentImages","setCurrentImages","useState","useMemo","getNewImages","imagesUpdated","newCurrentImages","filter","currentImg","find","img","clientId","length","forEach","image","fromSavedContent","currentImage","id","push","newImages"],"sources":["@wordpress/block-library/src/gallery/use-get-new-images.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useState } from '@wordpress/element';\n\n/**\n * Keeps track of images already in the gallery to allow new innerBlocks to be identified. This\n * is required so default gallery attributes can be applied without overwriting any custom\n * attributes applied to existing images.\n *\n * @param {Array} images Basic image block data taken from current gallery innerBlock\n * @param {Array} imageData The related image data for each of the current gallery images.\n *\n * @return {Array} An array of any new images that have been added to the gallery.\n */\nexport default function useGetNewImages( images, imageData ) {\n\tconst [ currentImages, setCurrentImages ] = useState( [] );\n\n\treturn useMemo( () => getNewImages(), [ images, imageData ] );\n\n\tfunction getNewImages() {\n\t\tlet imagesUpdated = false;\n\n\t\t// First lets check if any images have been deleted.\n\t\tconst newCurrentImages = currentImages.filter( ( currentImg ) =>\n\t\t\timages.find( ( img ) => {\n\t\t\t\treturn currentImg.clientId === img.clientId;\n\t\t\t} )\n\t\t);\n\n\t\tif ( newCurrentImages.length < currentImages.length ) {\n\t\t\timagesUpdated = true;\n\t\t}\n\n\t\t// Now lets see if we have any images hydrated from saved content and if so\n\t\t// add them to currentImages state.\n\t\timages.forEach( ( image ) => {\n\t\t\tif (\n\t\t\t\timage.fromSavedContent &&\n\t\t\t\t! newCurrentImages.find(\n\t\t\t\t\t( currentImage ) => currentImage.id === image.id\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\timagesUpdated = true;\n\t\t\t\tnewCurrentImages.push( image );\n\t\t\t}\n\t\t} );\n\n\t\t// Now check for any new images that have been added to InnerBlocks and for which\n\t\t// we have the imageData we need for setting default block attributes.\n\t\tconst newImages = images.filter(\n\t\t\t( image ) =>\n\t\t\t\t! newCurrentImages.find(\n\t\t\t\t\t( currentImage ) =>\n\t\t\t\t\t\timage.clientId &&\n\t\t\t\t\t\tcurrentImage.clientId === image.clientId\n\t\t\t\t) &&\n\t\t\t\timageData?.find( ( img ) => img.id === image.id ) &&\n\t\t\t\t! image.fromSavedContent\n\t\t);\n\n\t\tif ( imagesUpdated || newImages?.length > 0 ) {\n\t\t\tsetCurrentImages( [ ...newCurrentImages, ...newImages ] );\n\t\t}\n\n\t\treturn newImages.length > 0 ? newImages : null;\n\t}\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,eAAeA,CAAEC,MAAM,EAAEC,SAAS,EAAG;EAC5D,MAAM,CAAEC,aAAa,EAAEC,gBAAgB,CAAE,GAAG,IAAAC,iBAAQ,EAAE,EAAG,CAAC;EAE1D,OAAO,IAAAC,gBAAO,EAAE,MAAMC,YAAY,CAAC,CAAC,EAAE,CAAEN,MAAM,EAAEC,SAAS,CAAG,CAAC;EAE7D,SAASK,YAAYA,CAAA,EAAG;IACvB,IAAIC,aAAa,GAAG,KAAK;;IAEzB;IACA,MAAMC,gBAAgB,GAAGN,aAAa,CAACO,MAAM,CAAIC,UAAU,IAC1DV,MAAM,CAACW,IAAI,CAAIC,GAAG,IAAM;MACvB,OAAOF,UAAU,CAACG,QAAQ,KAAKD,GAAG,CAACC,QAAQ;IAC5C,CAAE,CACH,CAAC;IAED,IAAKL,gBAAgB,CAACM,MAAM,GAAGZ,aAAa,CAACY,MAAM,EAAG;MACrDP,aAAa,GAAG,IAAI;IACrB;;IAEA;IACA;IACAP,MAAM,CAACe,OAAO,CAAIC,KAAK,IAAM;MAC5B,IACCA,KAAK,CAACC,gBAAgB,IACtB,CAAET,gBAAgB,CAACG,IAAI,CACpBO,YAAY,IAAMA,YAAY,CAACC,EAAE,KAAKH,KAAK,CAACG,EAC/C,CAAC,EACA;QACDZ,aAAa,GAAG,IAAI;QACpBC,gBAAgB,CAACY,IAAI,CAAEJ,KAAM,CAAC;MAC/B;IACD,CAAE,CAAC;;IAEH;IACA;IACA,MAAMK,SAAS,GAAGrB,MAAM,CAACS,MAAM,CAC5BO,KAAK,IACN,CAAER,gBAAgB,CAACG,IAAI,CACpBO,YAAY,IACbF,KAAK,CAACH,QAAQ,IACdK,YAAY,CAACL,QAAQ,KAAKG,KAAK,CAACH,QAClC,CAAC,IACDZ,SAAS,EAAEU,IAAI,CAAIC,GAAG,IAAMA,GAAG,CAACO,EAAE,KAAKH,KAAK,CAACG,EAAG,CAAC,IACjD,CAAEH,KAAK,CAACC,gBACV,CAAC;IAED,IAAKV,aAAa,IAAIc,SAAS,EAAEP,MAAM,GAAG,CAAC,EAAG;MAC7CX,gBAAgB,CAAE,CAAE,GAAGK,gBAAgB,EAAE,GAAGa,SAAS,CAAG,CAAC;IAC1D;IAEA,OAAOA,SAAS,CAACP,MAAM,GAAG,CAAC,GAAGO,SAAS,GAAG,IAAI;EAC/C;AACD","ignoreList":[]}
|
package/build/group/edit.js
CHANGED
|
@@ -11,6 +11,7 @@ var _element = require("@wordpress/element");
|
|
|
11
11
|
var _i18n = require("@wordpress/i18n");
|
|
12
12
|
var _primitives = require("@wordpress/primitives");
|
|
13
13
|
var _placeholder = _interopRequireWildcard(require("./placeholder"));
|
|
14
|
+
var _messages = require("../utils/messages");
|
|
14
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
16
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
16
17
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -34,14 +35,6 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
34
35
|
tagName,
|
|
35
36
|
onSelectTagName
|
|
36
37
|
}) {
|
|
37
|
-
const htmlElementMessages = {
|
|
38
|
-
header: (0, _i18n.__)('The <header> element should represent introductory content, typically a group of introductory or navigational aids.'),
|
|
39
|
-
main: (0, _i18n.__)('The <main> element should be used for the primary content of your document only.'),
|
|
40
|
-
section: (0, _i18n.__)("The <section> element should represent a standalone portion of the document that can't be better represented by another element."),
|
|
41
|
-
article: (0, _i18n.__)('The <article> element should represent a self-contained, syndicatable portion of the document.'),
|
|
42
|
-
aside: (0, _i18n.__)("The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content."),
|
|
43
|
-
footer: (0, _i18n.__)('The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).')
|
|
44
|
-
};
|
|
45
38
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.InspectorControls, {
|
|
46
39
|
group: "advanced",
|
|
47
40
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SelectControl, {
|
|
@@ -72,7 +65,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
72
65
|
}],
|
|
73
66
|
value: tagName,
|
|
74
67
|
onChange: onSelectTagName,
|
|
75
|
-
help: htmlElementMessages[tagName]
|
|
68
|
+
help: _messages.htmlElementMessages[tagName]
|
|
76
69
|
})
|
|
77
70
|
});
|
|
78
71
|
}
|
package/build/group/edit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_blockEditor","_components","_element","_i18n","_primitives","_placeholder","_interopRequireWildcard","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","GroupEditControls","tagName","onSelectTagName","htmlElementMessages","header","__","main","section","article","aside","footer","jsx","InspectorControls","group","children","SelectControl","__nextHasNoMarginBottom","__next40pxDefaultSize","label","options","value","onChange","help","GroupEdit","attributes","name","setAttributes","clientId","hasInnerBlocks","themeSupportsLayout","useSelect","select","getBlock","getSettings","blockEditorStore","block","innerBlocks","length","supportsLayout","TagName","templateLock","allowedBlocks","layout","type","layoutSupportEnabled","ref","useRef","blockProps","useBlockProps","showPlaceholder","setShowPlaceholder","useShouldShowPlaceHolder","usedLayoutType","renderAppender","InnerBlocks","ButtonBlockAppender","innerBlocksProps","useInnerBlocksProps","className","dropZoneElement","current","selectBlock","useDispatch","selectVariation","nextVariation","jsxs","Fragment","View","onSelect","_default","exports"],"sources":["@wordpress/block-library/src/group/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tInnerBlocks,\n\tuseBlockProps,\n\tInspectorControls,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { SelectControl } from '@wordpress/components';\nimport { useRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { View } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport GroupPlaceHolder, { useShouldShowPlaceHolder } from './placeholder';\n\n/**\n * Render inspector controls for the Group block.\n *\n * @param {Object} props Component props.\n * @param {string} props.tagName The HTML tag name.\n * @param {Function} props.onSelectTagName onChange function for the SelectControl.\n *\n * @return {JSX.Element} The control group.\n */\nfunction GroupEditControls( { tagName, onSelectTagName } ) {\n\tconst htmlElementMessages = {\n\t\theader: __(\n\t\t\t'The <header> element should represent introductory content, typically a group of introductory or navigational aids.'\n\t\t),\n\t\tmain: __(\n\t\t\t'The <main> element should be used for the primary content of your document only.'\n\t\t),\n\t\tsection: __(\n\t\t\t\"The <section> element should represent a standalone portion of the document that can't be better represented by another element.\"\n\t\t),\n\t\tarticle: __(\n\t\t\t'The <article> element should represent a self-contained, syndicatable portion of the document.'\n\t\t),\n\t\taside: __(\n\t\t\t\"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.\"\n\t\t),\n\t\tfooter: __(\n\t\t\t'The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'\n\t\t),\n\t};\n\treturn (\n\t\t<InspectorControls group=\"advanced\">\n\t\t\t<SelectControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\toptions={ [\n\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t] }\n\t\t\t\tvalue={ tagName }\n\t\t\t\tonChange={ onSelectTagName }\n\t\t\t\thelp={ htmlElementMessages[ tagName ] }\n\t\t\t/>\n\t\t</InspectorControls>\n\t);\n}\n\nfunction GroupEdit( { attributes, name, setAttributes, clientId } ) {\n\tconst { hasInnerBlocks, themeSupportsLayout } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlock, getSettings } = select( blockEditorStore );\n\t\t\tconst block = getBlock( clientId );\n\t\t\treturn {\n\t\t\t\thasInnerBlocks: !! ( block && block.innerBlocks.length ),\n\t\t\t\tthemeSupportsLayout: getSettings()?.supportsLayout,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst {\n\t\ttagName: TagName = 'div',\n\t\ttemplateLock,\n\t\tallowedBlocks,\n\t\tlayout = {},\n\t} = attributes;\n\n\t// Layout settings.\n\tconst { type = 'default' } = layout;\n\tconst layoutSupportEnabled =\n\t\tthemeSupportsLayout || type === 'flex' || type === 'grid';\n\n\t// Hooks.\n\tconst ref = useRef();\n\tconst blockProps = useBlockProps( { ref } );\n\n\tconst [ showPlaceholder, setShowPlaceholder ] = useShouldShowPlaceHolder( {\n\t\tattributes,\n\t\tusedLayoutType: type,\n\t\thasInnerBlocks,\n\t} );\n\n\t// Default to the regular appender being rendered.\n\tlet renderAppender;\n\tif ( showPlaceholder ) {\n\t\t// In the placeholder state, ensure the appender is not rendered.\n\t\t// This is needed because `...innerBlocksProps` is used in the placeholder\n\t\t// state so that blocks can dragged onto the placeholder area\n\t\t// from both the list view and in the editor canvas.\n\t\trenderAppender = false;\n\t} else if ( ! hasInnerBlocks ) {\n\t\t// When there is no placeholder, but the block is also empty,\n\t\t// use the larger button appender.\n\t\trenderAppender = InnerBlocks.ButtonBlockAppender;\n\t}\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\tlayoutSupportEnabled\n\t\t\t? blockProps\n\t\t\t: { className: 'wp-block-group__inner-container' },\n\t\t{\n\t\t\tdropZoneElement: ref.current,\n\t\t\ttemplateLock,\n\t\t\tallowedBlocks,\n\t\t\trenderAppender,\n\t\t}\n\t);\n\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\n\tconst selectVariation = ( nextVariation ) => {\n\t\tsetAttributes( nextVariation.attributes );\n\t\tselectBlock( clientId, -1 );\n\t\tsetShowPlaceholder( false );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<GroupEditControls\n\t\t\t\ttagName={ TagName }\n\t\t\t\tonSelectTagName={ ( value ) =>\n\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ showPlaceholder && (\n\t\t\t\t<View>\n\t\t\t\t\t{ innerBlocksProps.children }\n\t\t\t\t\t<GroupPlaceHolder\n\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\tonSelect={ selectVariation }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t) }\n\t\t\t{ layoutSupportEnabled && ! showPlaceholder && (\n\t\t\t\t<TagName { ...innerBlocksProps } />\n\t\t\t) }\n\t\t\t{ /* Ideally this is not needed but it's there for backward compatibility reason\n\t\t\t\tto keep this div for themes that might rely on its presence */ }\n\t\t\t{ ! layoutSupportEnabled && ! showPlaceholder && (\n\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t\t</TagName>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default GroupEdit;\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAOA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAKA,IAAAM,YAAA,GAAAC,uBAAA,CAAAP,OAAA;AAA2E,IAAAQ,WAAA,GAAAR,OAAA;AAAA,SAAAS,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA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AAa,CAACxC,UAAW,CAAC;IACzCqC,WAAW,CAAElC,QAAQ,EAAE,CAAC,CAAE,CAAC;IAC3BuB,kBAAkB,CAAE,KAAM,CAAC;EAC5B,CAAC;EAED,oBACC,IAAAvE,WAAA,CAAAsF,IAAA,EAAAtF,WAAA,CAAAuF,QAAA;IAAApD,QAAA,gBACC,IAAAnC,WAAA,CAAAgC,GAAA,EAACX,iBAAiB;MACjBC,OAAO,EAAGsC,OAAS;MACnBrC,eAAe,EAAKkB,KAAK,IACxBM,aAAa,CAAE;QAAEzB,OAAO,EAAEmB;MAAM,CAAE;IAClC,CACD,CAAC,EACA6B,eAAe,iBAChB,IAAAtE,WAAA,CAAAsF,IAAA,EAACzF,WAAA,CAAA2F,IAAI;MAAArD,QAAA,GACF0C,gBAAgB,CAAC1C,QAAQ,eAC3B,IAAAnC,WAAA,CAAAgC,GAAA,EAAClC,YAAA,CAAAS,OAAgB;QAChBuC,IAAI,EAAGA,IAAM;QACb2C,QAAQ,EAAGL;MAAiB,CAC5B,CAAC;IAAA,CACG,CACN,EACCnB,oBAAoB,IAAI,CAAEK,eAAe,iBAC1C,IAAAtE,WAAA,CAAAgC,GAAA,EAAC4B,OAAO;MAAA,GAAMiB;IAAgB,CAAI,CAClC,EAGC,CAAEZ,oBAAoB,IAAI,CAAEK,eAAe,iBAC5C,IAAAtE,WAAA,CAAAgC,GAAA,EAAC4B,OAAO;MAAA,GAAMQ,UAAU;MAAAjC,QAAA,eACvB,IAAAnC,WAAA,CAAAgC,GAAA;QAAA,GAAU6C;MAAgB,CAAI;IAAC,CACvB,CACT;EAAA,CACA,CAAC;AAEL;AAAC,IAAAa,QAAA,GAAAC,OAAA,CAAApF,OAAA,GAEcqC,SAAS","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_data","require","_blockEditor","_components","_element","_i18n","_primitives","_placeholder","_interopRequireWildcard","_messages","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","GroupEditControls","tagName","onSelectTagName","jsx","InspectorControls","group","children","SelectControl","__nextHasNoMarginBottom","__next40pxDefaultSize","label","__","options","value","onChange","help","htmlElementMessages","GroupEdit","attributes","name","setAttributes","clientId","hasInnerBlocks","themeSupportsLayout","useSelect","select","getBlock","getSettings","blockEditorStore","block","innerBlocks","length","supportsLayout","TagName","templateLock","allowedBlocks","layout","type","layoutSupportEnabled","ref","useRef","blockProps","useBlockProps","showPlaceholder","setShowPlaceholder","useShouldShowPlaceHolder","usedLayoutType","renderAppender","InnerBlocks","ButtonBlockAppender","innerBlocksProps","useInnerBlocksProps","className","dropZoneElement","current","selectBlock","useDispatch","selectVariation","nextVariation","jsxs","Fragment","View","onSelect","_default","exports"],"sources":["@wordpress/block-library/src/group/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tInnerBlocks,\n\tuseBlockProps,\n\tInspectorControls,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { SelectControl } from '@wordpress/components';\nimport { useRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { View } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport GroupPlaceHolder, { useShouldShowPlaceHolder } from './placeholder';\nimport { htmlElementMessages } from '../utils/messages';\n\n/**\n * Render inspector controls for the Group block.\n *\n * @param {Object} props Component props.\n * @param {string} props.tagName The HTML tag name.\n * @param {Function} props.onSelectTagName onChange function for the SelectControl.\n *\n * @return {JSX.Element} The control group.\n */\nfunction GroupEditControls( { tagName, onSelectTagName } ) {\n\treturn (\n\t\t<InspectorControls group=\"advanced\">\n\t\t\t<SelectControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\toptions={ [\n\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t] }\n\t\t\t\tvalue={ tagName }\n\t\t\t\tonChange={ onSelectTagName }\n\t\t\t\thelp={ htmlElementMessages[ tagName ] }\n\t\t\t/>\n\t\t</InspectorControls>\n\t);\n}\n\nfunction GroupEdit( { attributes, name, setAttributes, clientId } ) {\n\tconst { hasInnerBlocks, themeSupportsLayout } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlock, getSettings } = select( blockEditorStore );\n\t\t\tconst block = getBlock( clientId );\n\t\t\treturn {\n\t\t\t\thasInnerBlocks: !! ( block && block.innerBlocks.length ),\n\t\t\t\tthemeSupportsLayout: getSettings()?.supportsLayout,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst {\n\t\ttagName: TagName = 'div',\n\t\ttemplateLock,\n\t\tallowedBlocks,\n\t\tlayout = {},\n\t} = attributes;\n\n\t// Layout settings.\n\tconst { type = 'default' } = layout;\n\tconst layoutSupportEnabled =\n\t\tthemeSupportsLayout || type === 'flex' || type === 'grid';\n\n\t// Hooks.\n\tconst ref = useRef();\n\tconst blockProps = useBlockProps( { ref } );\n\n\tconst [ showPlaceholder, setShowPlaceholder ] = useShouldShowPlaceHolder( {\n\t\tattributes,\n\t\tusedLayoutType: type,\n\t\thasInnerBlocks,\n\t} );\n\n\t// Default to the regular appender being rendered.\n\tlet renderAppender;\n\tif ( showPlaceholder ) {\n\t\t// In the placeholder state, ensure the appender is not rendered.\n\t\t// This is needed because `...innerBlocksProps` is used in the placeholder\n\t\t// state so that blocks can dragged onto the placeholder area\n\t\t// from both the list view and in the editor canvas.\n\t\trenderAppender = false;\n\t} else if ( ! hasInnerBlocks ) {\n\t\t// When there is no placeholder, but the block is also empty,\n\t\t// use the larger button appender.\n\t\trenderAppender = InnerBlocks.ButtonBlockAppender;\n\t}\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\tlayoutSupportEnabled\n\t\t\t? blockProps\n\t\t\t: { className: 'wp-block-group__inner-container' },\n\t\t{\n\t\t\tdropZoneElement: ref.current,\n\t\t\ttemplateLock,\n\t\t\tallowedBlocks,\n\t\t\trenderAppender,\n\t\t}\n\t);\n\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\n\tconst selectVariation = ( nextVariation ) => {\n\t\tsetAttributes( nextVariation.attributes );\n\t\tselectBlock( clientId, -1 );\n\t\tsetShowPlaceholder( false );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<GroupEditControls\n\t\t\t\ttagName={ TagName }\n\t\t\t\tonSelectTagName={ ( value ) =>\n\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ showPlaceholder && (\n\t\t\t\t<View>\n\t\t\t\t\t{ innerBlocksProps.children }\n\t\t\t\t\t<GroupPlaceHolder\n\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\tonSelect={ selectVariation }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t) }\n\t\t\t{ layoutSupportEnabled && ! showPlaceholder && (\n\t\t\t\t<TagName { ...innerBlocksProps } />\n\t\t\t) }\n\t\t\t{ /* Ideally this is not needed but it's there for backward compatibility reason\n\t\t\t\tto keep this div for themes that might rely on its presence */ }\n\t\t\t{ ! layoutSupportEnabled && ! showPlaceholder && (\n\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t\t</TagName>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default GroupEdit;\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAOA,IAAAE,WAAA,GA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AC,IAAAa,QAAA,GAAAC,OAAA,CAAA9E,OAAA,GAEc+B,SAAS","ignoreList":[]}
|
package/build/home-link/edit.js
CHANGED
|
@@ -64,8 +64,7 @@ function HomeEdit({
|
|
|
64
64
|
},
|
|
65
65
|
"aria-label": (0, _i18n.__)('Home link text'),
|
|
66
66
|
placeholder: (0, _i18n.__)('Add home link'),
|
|
67
|
-
withoutInteractiveFormatting: true
|
|
68
|
-
allowedFormats: ['core/bold', 'core/italic', 'core/image', 'core/strikethrough']
|
|
67
|
+
withoutInteractiveFormatting: true
|
|
69
68
|
})
|
|
70
69
|
})
|
|
71
70
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_blockEditor","_i18n","_data","_coreData","_jsxRuntime","preventDefault","event","HomeEdit","attributes","setAttributes","context","_attributes$label","homeUrl","useSelect","select","coreStore","getEntityRecord","home","textColor","backgroundColor","style","blockProps","useBlockProps","className","clsx","color","text","background","jsx","children","href","onClick","RichText","identifier","value","label","__","onChange","labelValue","placeholder","withoutInteractiveFormatting"
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_blockEditor","_i18n","_data","_coreData","_jsxRuntime","preventDefault","event","HomeEdit","attributes","setAttributes","context","_attributes$label","homeUrl","useSelect","select","coreStore","getEntityRecord","home","textColor","backgroundColor","style","blockProps","useBlockProps","className","clsx","color","text","background","jsx","children","href","onClick","RichText","identifier","value","label","__","onChange","labelValue","placeholder","withoutInteractiveFormatting"],"sources":["@wordpress/block-library/src/home-link/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { RichText, useBlockProps } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\nconst preventDefault = ( event ) => event.preventDefault();\n\nexport default function HomeEdit( { attributes, setAttributes, context } ) {\n\tconst homeUrl = useSelect( ( select ) => {\n\t\t// Site index.\n\t\treturn select( coreStore ).getEntityRecord( 'root', '__unstableBase' )\n\t\t\t?.home;\n\t}, [] );\n\n\tconst { textColor, backgroundColor, style } = context;\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( 'wp-block-navigation-item', {\n\t\t\t'has-text-color': !! textColor || !! style?.color?.text,\n\t\t\t[ `has-${ textColor }-color` ]: !! textColor,\n\t\t\t'has-background': !! backgroundColor || !! style?.color?.background,\n\t\t\t[ `has-${ backgroundColor }-background-color` ]: !! backgroundColor,\n\t\t} ),\n\t\tstyle: {\n\t\t\tcolor: style?.color?.text,\n\t\t\tbackgroundColor: style?.color?.background,\n\t\t},\n\t} );\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<a\n\t\t\t\tclassName=\"wp-block-home-link__content wp-block-navigation-item__content\"\n\t\t\t\thref={ homeUrl }\n\t\t\t\tonClick={ preventDefault }\n\t\t\t>\n\t\t\t\t<RichText\n\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\tclassName=\"wp-block-home-link__label\"\n\t\t\t\t\tvalue={ attributes.label ?? __( 'Home' ) }\n\t\t\t\t\tonChange={ ( labelValue ) => {\n\t\t\t\t\t\tsetAttributes( { label: labelValue } );\n\t\t\t\t\t} }\n\t\t\t\t\taria-label={ __( 'Home link text' ) }\n\t\t\t\t\tplaceholder={ __( 'Add home link' ) }\n\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t/>\n\t\t\t</a>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAA0D,IAAAK,WAAA,GAAAL,OAAA;AAX1D;AACA;AACA;;AAGA;AACA;AACA;;AAMA,MAAMM,cAAc,GAAKC,K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,UAAU,EAAC,OAAO;QAClBV,SAAS,EAAC,2BAA2B;QACrCW,KAAK,GAAAvB,iBAAA,GAAGH,UAAU,CAAC2B,KAAK,cAAAxB,iBAAA,cAAAA,iBAAA,GAAI,IAAAyB,QAAE,EAAE,MAAO,CAAG;QAC1CC,QAAQ,EAAKC,UAAU,IAAM;UAC5B7B,aAAa,CAAE;YAAE0B,KAAK,EAAEG;UAAW,CAAE,CAAC;QACvC,CAAG;QACH,cAAa,IAAAF,QAAE,EAAE,gBAAiB,CAAG;QACrCG,WAAW,EAAG,IAAAH,QAAE,EAAE,eAAgB,CAAG;QACrCI,4BAA4B;MAAA,CAC5B;IAAC,CACA;EAAC,CACA,CAAC;AAER","ignoreList":[]}
|
|
@@ -9,11 +9,16 @@ var _blockEditor = require("@wordpress/block-editor");
|
|
|
9
9
|
var _components = require("@wordpress/components");
|
|
10
10
|
var _serverSideRender = _interopRequireDefault(require("@wordpress/server-side-render"));
|
|
11
11
|
var _i18n = require("@wordpress/i18n");
|
|
12
|
+
var _hooks = require("../utils/hooks");
|
|
12
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
14
|
/**
|
|
14
15
|
* WordPress dependencies
|
|
15
16
|
*/
|
|
16
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Internal dependencies
|
|
20
|
+
*/
|
|
21
|
+
|
|
17
22
|
/**
|
|
18
23
|
* Minimum number of comments a user can show using this block.
|
|
19
24
|
*
|
|
@@ -42,43 +47,85 @@ function LatestComments({
|
|
|
42
47
|
spacing: undefined
|
|
43
48
|
}
|
|
44
49
|
};
|
|
50
|
+
const dropdownMenuProps = (0, _hooks.useToolsPanelDropdownMenuProps)();
|
|
45
51
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
46
52
|
...(0, _blockEditor.useBlockProps)(),
|
|
47
53
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.InspectorControls, {
|
|
48
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
54
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalToolsPanel, {
|
|
55
|
+
label: (0, _i18n.__)('Settings'),
|
|
56
|
+
resetAll: () => {
|
|
57
|
+
setAttributes({
|
|
58
|
+
commentsToShow: 5,
|
|
59
|
+
displayAvatar: true,
|
|
60
|
+
displayDate: true,
|
|
61
|
+
displayExcerpt: true
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
dropdownMenuProps: dropdownMenuProps,
|
|
65
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
|
|
66
|
+
hasValue: () => !displayAvatar,
|
|
52
67
|
label: (0, _i18n.__)('Display avatar'),
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
68
|
+
onDeselect: () => setAttributes({
|
|
69
|
+
displayAvatar: true
|
|
70
|
+
}),
|
|
71
|
+
isShownByDefault: true,
|
|
72
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
|
|
73
|
+
__nextHasNoMarginBottom: true,
|
|
74
|
+
label: (0, _i18n.__)('Display avatar'),
|
|
75
|
+
checked: displayAvatar,
|
|
76
|
+
onChange: () => setAttributes({
|
|
77
|
+
displayAvatar: !displayAvatar
|
|
78
|
+
})
|
|
56
79
|
})
|
|
57
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.
|
|
58
|
-
|
|
80
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
|
|
81
|
+
hasValue: () => !displayDate,
|
|
59
82
|
label: (0, _i18n.__)('Display date'),
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
83
|
+
onDeselect: () => setAttributes({
|
|
84
|
+
displayDate: true
|
|
85
|
+
}),
|
|
86
|
+
isShownByDefault: true,
|
|
87
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
|
|
88
|
+
__nextHasNoMarginBottom: true,
|
|
89
|
+
label: (0, _i18n.__)('Display date'),
|
|
90
|
+
checked: displayDate,
|
|
91
|
+
onChange: () => setAttributes({
|
|
92
|
+
displayDate: !displayDate
|
|
93
|
+
})
|
|
63
94
|
})
|
|
64
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.
|
|
65
|
-
|
|
95
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
|
|
96
|
+
hasValue: () => !displayExcerpt,
|
|
66
97
|
label: (0, _i18n.__)('Display excerpt'),
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
98
|
+
onDeselect: () => setAttributes({
|
|
99
|
+
displayExcerpt: true
|
|
100
|
+
}),
|
|
101
|
+
isShownByDefault: true,
|
|
102
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
|
|
103
|
+
__nextHasNoMarginBottom: true,
|
|
104
|
+
label: (0, _i18n.__)('Display excerpt'),
|
|
105
|
+
checked: displayExcerpt,
|
|
106
|
+
onChange: () => setAttributes({
|
|
107
|
+
displayExcerpt: !displayExcerpt
|
|
108
|
+
})
|
|
70
109
|
})
|
|
71
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.
|
|
72
|
-
|
|
73
|
-
__next40pxDefaultSize: true,
|
|
110
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
|
|
111
|
+
hasValue: () => commentsToShow !== 5,
|
|
74
112
|
label: (0, _i18n.__)('Number of comments'),
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
commentsToShow: value
|
|
113
|
+
onDeselect: () => setAttributes({
|
|
114
|
+
commentsToShow: 5
|
|
78
115
|
}),
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
116
|
+
isShownByDefault: true,
|
|
117
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.RangeControl, {
|
|
118
|
+
__nextHasNoMarginBottom: true,
|
|
119
|
+
__next40pxDefaultSize: true,
|
|
120
|
+
label: (0, _i18n.__)('Number of comments'),
|
|
121
|
+
value: commentsToShow,
|
|
122
|
+
onChange: value => setAttributes({
|
|
123
|
+
commentsToShow: value
|
|
124
|
+
}),
|
|
125
|
+
min: MIN_COMMENTS,
|
|
126
|
+
max: MAX_COMMENTS,
|
|
127
|
+
required: true
|
|
128
|
+
})
|
|
82
129
|
})]
|
|
83
130
|
})
|
|
84
131
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Disabled, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blockEditor","require","_components","_serverSideRender","_interopRequireDefault","_i18n","_jsxRuntime","MIN_COMMENTS","MAX_COMMENTS","LatestComments","attributes","setAttributes","commentsToShow","displayAvatar","displayDate","displayExcerpt","serverSideAttributes","style","spacing","undefined","jsxs","useBlockProps","children","jsx","InspectorControls","
|
|
1
|
+
{"version":3,"names":["_blockEditor","require","_components","_serverSideRender","_interopRequireDefault","_i18n","_hooks","_jsxRuntime","MIN_COMMENTS","MAX_COMMENTS","LatestComments","attributes","setAttributes","commentsToShow","displayAvatar","displayDate","displayExcerpt","serverSideAttributes","style","spacing","undefined","dropdownMenuProps","useToolsPanelDropdownMenuProps","jsxs","useBlockProps","children","jsx","InspectorControls","__experimentalToolsPanel","label","__","resetAll","__experimentalToolsPanelItem","hasValue","onDeselect","isShownByDefault","ToggleControl","__nextHasNoMarginBottom","checked","onChange","RangeControl","__next40pxDefaultSize","value","min","max","required","Disabled","default","block","urlQueryArgs","_locale"],"sources":["@wordpress/block-library/src/latest-comments/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport {\n\tDisabled,\n\tRangeControl,\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport ServerSideRender from '@wordpress/server-side-render';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\n/**\n * Minimum number of comments a user can show using this block.\n *\n * @type {number}\n */\nconst MIN_COMMENTS = 1;\n/**\n * Maximum number of comments a user can show using this block.\n *\n * @type {number}\n */\nconst MAX_COMMENTS = 100;\n\nexport default function LatestComments( { attributes, setAttributes } ) {\n\tconst { commentsToShow, displayAvatar, displayDate, displayExcerpt } =\n\t\tattributes;\n\n\tconst serverSideAttributes = {\n\t\t...attributes,\n\t\tstyle: {\n\t\t\t...attributes?.style,\n\t\t\tspacing: undefined,\n\t\t},\n\t};\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\treturn (\n\t\t<div { ...useBlockProps() }>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tcommentsToShow: 5,\n\t\t\t\t\t\t\tdisplayAvatar: true,\n\t\t\t\t\t\t\tdisplayDate: true,\n\t\t\t\t\t\t\tdisplayExcerpt: true,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => ! displayAvatar }\n\t\t\t\t\t\tlabel={ __( 'Display avatar' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { displayAvatar: true } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Display avatar' ) }\n\t\t\t\t\t\t\tchecked={ displayAvatar }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tdisplayAvatar: ! displayAvatar,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => ! displayDate }\n\t\t\t\t\t\tlabel={ __( 'Display date' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { displayDate: true } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Display date' ) }\n\t\t\t\t\t\t\tchecked={ displayDate }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { displayDate: ! displayDate } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => ! displayExcerpt }\n\t\t\t\t\t\tlabel={ __( 'Display excerpt' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { displayExcerpt: true } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Display excerpt' ) }\n\t\t\t\t\t\t\tchecked={ displayExcerpt }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tdisplayExcerpt: ! displayExcerpt,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => commentsToShow !== 5 }\n\t\t\t\t\t\tlabel={ __( 'Number of comments' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { commentsToShow: 5 } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tlabel={ __( 'Number of comments' ) }\n\t\t\t\t\t\t\tvalue={ commentsToShow }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { commentsToShow: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmin={ MIN_COMMENTS }\n\t\t\t\t\t\t\tmax={ MAX_COMMENTS }\n\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<Disabled>\n\t\t\t\t<ServerSideRender\n\t\t\t\t\tblock=\"core/latest-comments\"\n\t\t\t\t\tattributes={ serverSideAttributes }\n\t\t\t\t\t// The preview uses the site's locale to make it more true to how\n\t\t\t\t\t// the block appears on the frontend. Setting the locale\n\t\t\t\t\t// explicitly prevents any middleware from setting it to 'user'.\n\t\t\t\t\turlQueryArgs={ { _locale: 'site' } }\n\t\t\t\t/>\n\t\t\t</Disabled>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAOA,IAAAE,iBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;A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
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.MIN_EXCERPT_LENGTH = exports.MAX_POSTS_COLUMNS = exports.MAX_EXCERPT_LENGTH = void 0;
|
|
6
|
+
exports.MIN_EXCERPT_LENGTH = exports.MAX_POSTS_COLUMNS = exports.MAX_EXCERPT_LENGTH = exports.DEFAULT_EXCERPT_LENGTH = void 0;
|
|
7
7
|
const MIN_EXCERPT_LENGTH = exports.MIN_EXCERPT_LENGTH = 10;
|
|
8
8
|
const MAX_EXCERPT_LENGTH = exports.MAX_EXCERPT_LENGTH = 100;
|
|
9
9
|
const MAX_POSTS_COLUMNS = exports.MAX_POSTS_COLUMNS = 6;
|
|
10
|
+
const DEFAULT_EXCERPT_LENGTH = exports.DEFAULT_EXCERPT_LENGTH = 55;
|
|
10
11
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MIN_EXCERPT_LENGTH","exports","MAX_EXCERPT_LENGTH","MAX_POSTS_COLUMNS"],"sources":["@wordpress/block-library/src/latest-posts/constants.js"],"sourcesContent":["export const MIN_EXCERPT_LENGTH = 10;\nexport const MAX_EXCERPT_LENGTH = 100;\nexport const MAX_POSTS_COLUMNS = 6;\n"],"mappings":";;;;;;AAAO,MAAMA,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,EAAE;AAC7B,MAAME,kBAAkB,GAAAD,OAAA,CAAAC,kBAAA,GAAG,GAAG;AAC9B,MAAMC,iBAAiB,GAAAF,OAAA,CAAAE,iBAAA,GAAG,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["MIN_EXCERPT_LENGTH","exports","MAX_EXCERPT_LENGTH","MAX_POSTS_COLUMNS","DEFAULT_EXCERPT_LENGTH"],"sources":["@wordpress/block-library/src/latest-posts/constants.js"],"sourcesContent":["export const MIN_EXCERPT_LENGTH = 10;\nexport const MAX_EXCERPT_LENGTH = 100;\nexport const MAX_POSTS_COLUMNS = 6;\nexport const DEFAULT_EXCERPT_LENGTH = 55;\n"],"mappings":";;;;;;AAAO,MAAMA,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,EAAE;AAC7B,MAAME,kBAAkB,GAAAD,OAAA,CAAAC,kBAAA,GAAG,GAAG;AAC9B,MAAMC,iBAAiB,GAAAF,OAAA,CAAAE,iBAAA,GAAG,CAAC;AAC3B,MAAMC,sBAAsB,GAAAH,OAAA,CAAAG,sBAAA,GAAG,EAAE","ignoreList":[]}
|
|
@@ -18,6 +18,7 @@ var _notices = require("@wordpress/notices");
|
|
|
18
18
|
var _compose = require("@wordpress/compose");
|
|
19
19
|
var _element = require("@wordpress/element");
|
|
20
20
|
var _constants = require("./constants");
|
|
21
|
+
var _hooks = require("../utils/hooks");
|
|
21
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
23
|
/**
|
|
23
24
|
* External dependencies
|
|
@@ -56,6 +57,7 @@ function LatestPostsEdit({
|
|
|
56
57
|
}) {
|
|
57
58
|
var _categoriesList$reduc;
|
|
58
59
|
const instanceId = (0, _compose.useInstanceId)(LatestPostsEdit);
|
|
60
|
+
const dropdownMenuProps = (0, _hooks.useToolsPanelDropdownMenuProps)();
|
|
59
61
|
const {
|
|
60
62
|
postsToShow,
|
|
61
63
|
order,
|
|
@@ -171,54 +173,105 @@ function LatestPostsEdit({
|
|
|
171
173
|
}];
|
|
172
174
|
const hasPosts = !!latestPosts?.length;
|
|
173
175
|
const inspectorControls = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_blockEditor.InspectorControls, {
|
|
174
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
176
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalToolsPanel, {
|
|
177
|
+
label: (0, _i18n.__)('Post content'),
|
|
178
|
+
resetAll: () => setAttributes({
|
|
179
|
+
displayPostContent: false,
|
|
180
|
+
displayPostContentRadio: 'excerpt',
|
|
181
|
+
excerptLength: _constants.DEFAULT_EXCERPT_LENGTH
|
|
182
|
+
}),
|
|
183
|
+
dropdownMenuProps: dropdownMenuProps,
|
|
184
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
|
|
185
|
+
hasValue: () => !!displayPostContent,
|
|
178
186
|
label: (0, _i18n.__)('Post content'),
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
187
|
+
onDeselect: () => setAttributes({
|
|
188
|
+
displayPostContent: false
|
|
189
|
+
}),
|
|
190
|
+
isShownByDefault: true,
|
|
191
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
|
|
192
|
+
__nextHasNoMarginBottom: true,
|
|
193
|
+
label: (0, _i18n.__)('Post content'),
|
|
194
|
+
checked: displayPostContent,
|
|
195
|
+
onChange: value => setAttributes({
|
|
196
|
+
displayPostContent: value
|
|
197
|
+
})
|
|
182
198
|
})
|
|
183
|
-
}), displayPostContent && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.
|
|
199
|
+
}), displayPostContent && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
|
|
200
|
+
hasValue: () => displayPostContentRadio !== 'excerpt',
|
|
184
201
|
label: (0, _i18n.__)('Show'),
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
label: (0, _i18n.__)('
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
202
|
+
onDeselect: () => setAttributes({
|
|
203
|
+
displayPostContentRadio: 'excerpt'
|
|
204
|
+
}),
|
|
205
|
+
isShownByDefault: true,
|
|
206
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.RadioControl, {
|
|
207
|
+
label: (0, _i18n.__)('Show'),
|
|
208
|
+
selected: displayPostContentRadio,
|
|
209
|
+
options: [{
|
|
210
|
+
label: (0, _i18n.__)('Excerpt'),
|
|
211
|
+
value: 'excerpt'
|
|
212
|
+
}, {
|
|
213
|
+
label: (0, _i18n.__)('Full post'),
|
|
214
|
+
value: 'full_post'
|
|
215
|
+
}],
|
|
216
|
+
onChange: value => setAttributes({
|
|
217
|
+
displayPostContentRadio: value
|
|
218
|
+
})
|
|
195
219
|
})
|
|
196
|
-
}), displayPostContent && displayPostContentRadio === 'excerpt' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.
|
|
197
|
-
|
|
198
|
-
__next40pxDefaultSize: true,
|
|
220
|
+
}), displayPostContent && displayPostContentRadio === 'excerpt' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
|
|
221
|
+
hasValue: () => excerptLength !== _constants.DEFAULT_EXCERPT_LENGTH,
|
|
199
222
|
label: (0, _i18n.__)('Max number of words'),
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
excerptLength: value
|
|
223
|
+
onDeselect: () => setAttributes({
|
|
224
|
+
excerptLength: _constants.DEFAULT_EXCERPT_LENGTH
|
|
203
225
|
}),
|
|
204
|
-
|
|
205
|
-
|
|
226
|
+
isShownByDefault: true,
|
|
227
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.RangeControl, {
|
|
228
|
+
__nextHasNoMarginBottom: true,
|
|
229
|
+
__next40pxDefaultSize: true,
|
|
230
|
+
label: (0, _i18n.__)('Max number of words'),
|
|
231
|
+
value: excerptLength,
|
|
232
|
+
onChange: value => setAttributes({
|
|
233
|
+
excerptLength: value
|
|
234
|
+
}),
|
|
235
|
+
min: _constants.MIN_EXCERPT_LENGTH,
|
|
236
|
+
max: _constants.MAX_EXCERPT_LENGTH
|
|
237
|
+
})
|
|
206
238
|
})]
|
|
207
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
239
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalToolsPanel, {
|
|
240
|
+
label: (0, _i18n.__)('Post meta'),
|
|
241
|
+
resetAll: () => setAttributes({
|
|
242
|
+
displayAuthor: false,
|
|
243
|
+
displayPostDate: false
|
|
244
|
+
}),
|
|
245
|
+
dropdownMenuProps: dropdownMenuProps,
|
|
246
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
|
|
247
|
+
hasValue: () => !!displayAuthor,
|
|
211
248
|
label: (0, _i18n.__)('Display author name'),
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
249
|
+
onDeselect: () => setAttributes({
|
|
250
|
+
displayAuthor: false
|
|
251
|
+
}),
|
|
252
|
+
isShownByDefault: true,
|
|
253
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
|
|
254
|
+
__nextHasNoMarginBottom: true,
|
|
255
|
+
label: (0, _i18n.__)('Display author name'),
|
|
256
|
+
checked: displayAuthor,
|
|
257
|
+
onChange: value => setAttributes({
|
|
258
|
+
displayAuthor: value
|
|
259
|
+
})
|
|
215
260
|
})
|
|
216
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.
|
|
217
|
-
|
|
261
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
|
|
262
|
+
hasValue: () => !!displayPostDate,
|
|
218
263
|
label: (0, _i18n.__)('Display post date'),
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
264
|
+
onDeselect: () => setAttributes({
|
|
265
|
+
displayPostDate: false
|
|
266
|
+
}),
|
|
267
|
+
isShownByDefault: true,
|
|
268
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
|
|
269
|
+
__nextHasNoMarginBottom: true,
|
|
270
|
+
label: (0, _i18n.__)('Display post date'),
|
|
271
|
+
checked: displayPostDate,
|
|
272
|
+
onChange: value => setAttributes({
|
|
273
|
+
displayPostDate: value
|
|
274
|
+
})
|
|
222
275
|
})
|
|
223
276
|
})]
|
|
224
277
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.PanelBody, {
|