@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
package/build/spacer/edit.js
CHANGED
|
@@ -124,6 +124,9 @@ const SpacerEdit = ({
|
|
|
124
124
|
const [temporaryWidth, setTemporaryWidth] = (0, _element.useState)(null);
|
|
125
125
|
const onResizeStart = () => toggleSelection(false);
|
|
126
126
|
const onResizeStop = () => toggleSelection(true);
|
|
127
|
+
const {
|
|
128
|
+
__unstableMarkNextChangeAsNotPersistent
|
|
129
|
+
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
127
130
|
const handleOnVerticalResizeStop = newHeight => {
|
|
128
131
|
onResizeStop();
|
|
129
132
|
if (isFlexLayout) {
|
|
@@ -232,12 +235,19 @@ const SpacerEdit = ({
|
|
|
232
235
|
});
|
|
233
236
|
};
|
|
234
237
|
(0, _element.useEffect)(() => {
|
|
235
|
-
|
|
238
|
+
// To avoid interfering with undo/redo operations any changes in this
|
|
239
|
+
// effect must not make history and should be preceded by
|
|
240
|
+
// `__unstableMarkNextChangeAsNotPersistent()`.
|
|
241
|
+
const setAttributesCovertly = nextAttributes => {
|
|
242
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
243
|
+
setAttributes(nextAttributes);
|
|
244
|
+
};
|
|
245
|
+
if (isFlexLayout && selfStretch !== 'fill' && selfStretch !== 'fit' && flexSize === undefined) {
|
|
236
246
|
if (inheritedOrientation === 'horizontal') {
|
|
237
247
|
// If spacer is moving from a vertical container to a horizontal container,
|
|
238
248
|
// it might not have width but have height instead.
|
|
239
249
|
const newSize = (0, _blockEditor.getCustomValueFromPreset)(width, spacingSizes) || (0, _blockEditor.getCustomValueFromPreset)(height, spacingSizes) || '100px';
|
|
240
|
-
|
|
250
|
+
setAttributesCovertly({
|
|
241
251
|
width: '0px',
|
|
242
252
|
style: {
|
|
243
253
|
...blockStyle,
|
|
@@ -250,7 +260,7 @@ const SpacerEdit = ({
|
|
|
250
260
|
});
|
|
251
261
|
} else {
|
|
252
262
|
const newSize = (0, _blockEditor.getCustomValueFromPreset)(height, spacingSizes) || (0, _blockEditor.getCustomValueFromPreset)(width, spacingSizes) || '100px';
|
|
253
|
-
|
|
263
|
+
setAttributesCovertly({
|
|
254
264
|
height: '0px',
|
|
255
265
|
style: {
|
|
256
266
|
...blockStyle,
|
|
@@ -263,26 +273,18 @@ const SpacerEdit = ({
|
|
|
263
273
|
});
|
|
264
274
|
}
|
|
265
275
|
} else if (isFlexLayout && (selfStretch === 'fill' || selfStretch === 'fit')) {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
}
|
|
271
|
-
setAttributes({
|
|
272
|
-
height: undefined
|
|
273
|
-
});
|
|
274
|
-
}
|
|
276
|
+
setAttributesCovertly(inheritedOrientation === 'horizontal' ? {
|
|
277
|
+
width: undefined
|
|
278
|
+
} : {
|
|
279
|
+
height: undefined
|
|
280
|
+
});
|
|
275
281
|
} else if (!isFlexLayout && (selfStretch || flexSize)) {
|
|
276
|
-
|
|
277
|
-
|
|
282
|
+
setAttributesCovertly({
|
|
283
|
+
...(inheritedOrientation === 'horizontal' ? {
|
|
278
284
|
width: flexSize
|
|
279
|
-
}
|
|
280
|
-
} else {
|
|
281
|
-
setAttributes({
|
|
285
|
+
} : {
|
|
282
286
|
height: flexSize
|
|
283
|
-
})
|
|
284
|
-
}
|
|
285
|
-
setAttributes({
|
|
287
|
+
}),
|
|
286
288
|
style: {
|
|
287
289
|
...blockStyle,
|
|
288
290
|
layout: {
|
|
@@ -293,7 +295,7 @@ const SpacerEdit = ({
|
|
|
293
295
|
}
|
|
294
296
|
});
|
|
295
297
|
}
|
|
296
|
-
}, [blockStyle, flexSize, height, inheritedOrientation, isFlexLayout, layout, selfStretch, setAttributes, spacingSizes, width]);
|
|
298
|
+
}, [blockStyle, flexSize, height, inheritedOrientation, isFlexLayout, layout, selfStretch, setAttributes, spacingSizes, width, __unstableMarkNextChangeAsNotPersistent]);
|
|
297
299
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
298
300
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.View, {
|
|
299
301
|
...(0, _blockEditor.useBlockProps)({
|
package/build/spacer/edit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_blockEditor","_components","_element","_primitives","_data","_lockUnlock","_controls","_constants","_jsxRuntime","useSpacingSizes","unlock","blockEditorPrivateApis","ResizableSpacer","orientation","onResizeStart","onResize","onResizeStop","isSelected","isResizing","setIsResizing","props","getCurrentSize","elt","clientWidth","clientHeight","getNextVal","jsx","ResizableBox","className","clsx","_event","_direction","nextVal","__experimentalShowTooltip","__experimentalTooltipProps","axis","position","isVisible","showHandle","SpacerEdit","attributes","setAttributes","toggleSelection","context","__unstableParentLayout","parentLayout","disableCustomSpacingSizes","useSelect","select","editorSettings","blockEditorStore","getSettings","parentOrientation","type","default","defaultType","isFlexLayout","inheritedOrientation","height","width","style","blockStyle","layout","selfStretch","flexSize","spacingSizes","useState","temporaryHeight","setTemporaryHeight","temporaryWidth","setTemporaryWidth","handleOnVerticalResizeStop","newHeight","handleOnHorizontalResizeStop","newWidth","getHeightForVerticalBlocks","undefined","getSpacingPresetCssVar","getWidthForHorizontalBlocks","sizeConditionalOnOrientation","minWidth","flexBasis","flexGrow","resizableBoxWithOrientation","blockOrientation","MIN_SPACER_SIZE","enable","top","right","bottom","left","topRight","bottomRight","bottomLeft","topLeft","Fragment","children","minHeight","useEffect","newSize","getCustomValueFromPreset","jsxs","View","useBlockProps","_default","exports"],"sources":["@wordpress/block-library/src/spacer/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseBlockProps,\n\tgetCustomValueFromPreset,\n\tgetSpacingPresetCssVar,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { ResizableBox } from '@wordpress/components';\nimport { useState, useEffect } from '@wordpress/element';\nimport { View } from '@wordpress/primitives';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\nimport SpacerControls from './controls';\nimport { MIN_SPACER_SIZE } from './constants';\n\nconst { useSpacingSizes } = unlock( blockEditorPrivateApis );\n\nconst ResizableSpacer = ( {\n\torientation,\n\tonResizeStart,\n\tonResize,\n\tonResizeStop,\n\tisSelected,\n\tisResizing,\n\tsetIsResizing,\n\t...props\n} ) => {\n\tconst getCurrentSize = ( elt ) => {\n\t\treturn orientation === 'horizontal'\n\t\t\t? elt.clientWidth\n\t\t\t: elt.clientHeight;\n\t};\n\n\tconst getNextVal = ( elt ) => {\n\t\treturn `${ getCurrentSize( elt ) }px`;\n\t};\n\n\treturn (\n\t\t<ResizableBox\n\t\t\tclassName={ clsx( 'block-library-spacer__resize-container', {\n\t\t\t\t'resize-horizontal': orientation === 'horizontal',\n\t\t\t\t'is-resizing': isResizing,\n\t\t\t\t'is-selected': isSelected,\n\t\t\t} ) }\n\t\t\tonResizeStart={ ( _event, _direction, elt ) => {\n\t\t\t\tconst nextVal = getNextVal( elt );\n\t\t\t\tonResizeStart( nextVal );\n\t\t\t\tonResize( nextVal );\n\t\t\t} }\n\t\t\tonResize={ ( _event, _direction, elt ) => {\n\t\t\t\tonResize( getNextVal( elt ) );\n\t\t\t\tif ( ! isResizing ) {\n\t\t\t\t\tsetIsResizing( true );\n\t\t\t\t}\n\t\t\t} }\n\t\t\tonResizeStop={ ( _event, _direction, elt ) => {\n\t\t\t\tconst nextVal = getCurrentSize( elt );\n\t\t\t\tonResizeStop( `${ nextVal }px` );\n\t\t\t\tsetIsResizing( false );\n\t\t\t} }\n\t\t\t__experimentalShowTooltip\n\t\t\t__experimentalTooltipProps={ {\n\t\t\t\taxis: orientation === 'horizontal' ? 'x' : 'y',\n\t\t\t\tposition: 'corner',\n\t\t\t\tisVisible: isResizing,\n\t\t\t} }\n\t\t\tshowHandle={ isSelected }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n};\n\nconst SpacerEdit = ( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\n\ttoggleSelection,\n\tcontext,\n\t__unstableParentLayout: parentLayout,\n\tclassName,\n} ) => {\n\tconst disableCustomSpacingSizes = useSelect( ( select ) => {\n\t\tconst editorSettings = select( blockEditorStore ).getSettings();\n\t\treturn editorSettings?.disableCustomSpacingSizes;\n\t} );\n\tconst { orientation } = context;\n\tconst {\n\t\torientation: parentOrientation,\n\t\ttype,\n\t\tdefault: { type: defaultType } = {},\n\t} = parentLayout || {};\n\t// Check if the spacer is inside a flex container.\n\tconst isFlexLayout =\n\t\ttype === 'flex' || ( ! type && defaultType === 'flex' );\n\t// If the spacer is inside a flex container, it should either inherit the orientation\n\t// of the parent or use the flex default orientation.\n\tconst inheritedOrientation =\n\t\t! parentOrientation && isFlexLayout\n\t\t\t? 'horizontal'\n\t\t\t: parentOrientation || orientation;\n\tconst { height, width, style: blockStyle = {} } = attributes;\n\n\tconst { layout = {} } = blockStyle;\n\tconst { selfStretch, flexSize } = layout;\n\n\tconst spacingSizes = useSpacingSizes();\n\n\tconst [ isResizing, setIsResizing ] = useState( false );\n\tconst [ temporaryHeight, setTemporaryHeight ] = useState( null );\n\tconst [ temporaryWidth, setTemporaryWidth ] = useState( null );\n\n\tconst onResizeStart = () => toggleSelection( false );\n\tconst onResizeStop = () => toggleSelection( true );\n\n\tconst handleOnVerticalResizeStop = ( newHeight ) => {\n\t\tonResizeStop();\n\n\t\tif ( isFlexLayout ) {\n\t\t\tsetAttributes( {\n\t\t\t\tstyle: {\n\t\t\t\t\t...blockStyle,\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\t...layout,\n\t\t\t\t\t\tflexSize: newHeight,\n\t\t\t\t\t\tselfStretch: 'fixed',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\tsetAttributes( { height: newHeight } );\n\t\tsetTemporaryHeight( null );\n\t};\n\n\tconst handleOnHorizontalResizeStop = ( newWidth ) => {\n\t\tonResizeStop();\n\n\t\tif ( isFlexLayout ) {\n\t\t\tsetAttributes( {\n\t\t\t\tstyle: {\n\t\t\t\t\t...blockStyle,\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\t...layout,\n\t\t\t\t\t\tflexSize: newWidth,\n\t\t\t\t\t\tselfStretch: 'fixed',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\tsetAttributes( { width: newWidth } );\n\t\tsetTemporaryWidth( null );\n\t};\n\n\tconst getHeightForVerticalBlocks = () => {\n\t\tif ( isFlexLayout ) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn temporaryHeight || getSpacingPresetCssVar( height ) || undefined;\n\t};\n\n\tconst getWidthForHorizontalBlocks = () => {\n\t\tif ( isFlexLayout ) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn temporaryWidth || getSpacingPresetCssVar( width ) || undefined;\n\t};\n\n\tconst sizeConditionalOnOrientation =\n\t\tinheritedOrientation === 'horizontal'\n\t\t\t? temporaryWidth || flexSize\n\t\t\t: temporaryHeight || flexSize;\n\n\tconst style = {\n\t\theight:\n\t\t\tinheritedOrientation === 'horizontal'\n\t\t\t\t? 24\n\t\t\t\t: getHeightForVerticalBlocks(),\n\t\twidth:\n\t\t\tinheritedOrientation === 'horizontal'\n\t\t\t\t? getWidthForHorizontalBlocks()\n\t\t\t\t: undefined,\n\t\t// In vertical flex containers, the spacer shrinks to nothing without a minimum width.\n\t\tminWidth:\n\t\t\tinheritedOrientation === 'vertical' && isFlexLayout\n\t\t\t\t? 48\n\t\t\t\t: undefined,\n\t\t// Add flex-basis so temporary sizes are respected.\n\t\tflexBasis: isFlexLayout ? sizeConditionalOnOrientation : undefined,\n\t\t// Remove flex-grow when resizing.\n\t\tflexGrow: isFlexLayout && isResizing ? 0 : undefined,\n\t};\n\n\tconst resizableBoxWithOrientation = ( blockOrientation ) => {\n\t\tif ( blockOrientation === 'horizontal' ) {\n\t\t\treturn (\n\t\t\t\t<ResizableSpacer\n\t\t\t\t\tminWidth={ MIN_SPACER_SIZE }\n\t\t\t\t\tenable={ {\n\t\t\t\t\t\ttop: false,\n\t\t\t\t\t\tright: true,\n\t\t\t\t\t\tbottom: false,\n\t\t\t\t\t\tleft: false,\n\t\t\t\t\t\ttopRight: false,\n\t\t\t\t\t\tbottomRight: false,\n\t\t\t\t\t\tbottomLeft: false,\n\t\t\t\t\t\ttopLeft: false,\n\t\t\t\t\t} }\n\t\t\t\t\torientation={ blockOrientation }\n\t\t\t\t\tonResizeStart={ onResizeStart }\n\t\t\t\t\tonResize={ setTemporaryWidth }\n\t\t\t\t\tonResizeStop={ handleOnHorizontalResizeStop }\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\tisResizing={ isResizing }\n\t\t\t\t\tsetIsResizing={ setIsResizing }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<ResizableSpacer\n\t\t\t\t\tminHeight={ MIN_SPACER_SIZE }\n\t\t\t\t\tenable={ {\n\t\t\t\t\t\ttop: false,\n\t\t\t\t\t\tright: false,\n\t\t\t\t\t\tbottom: true,\n\t\t\t\t\t\tleft: false,\n\t\t\t\t\t\ttopRight: false,\n\t\t\t\t\t\tbottomRight: false,\n\t\t\t\t\t\tbottomLeft: false,\n\t\t\t\t\t\ttopLeft: false,\n\t\t\t\t\t} }\n\t\t\t\t\torientation={ blockOrientation }\n\t\t\t\t\tonResizeStart={ onResizeStart }\n\t\t\t\t\tonResize={ setTemporaryHeight }\n\t\t\t\t\tonResizeStop={ handleOnVerticalResizeStop }\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\tisResizing={ isResizing }\n\t\t\t\t\tsetIsResizing={ setIsResizing }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t};\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\tisFlexLayout &&\n\t\t\tselfStretch !== 'fill' &&\n\t\t\tselfStretch !== 'fit' &&\n\t\t\t! flexSize\n\t\t) {\n\t\t\tif ( inheritedOrientation === 'horizontal' ) {\n\t\t\t\t// If spacer is moving from a vertical container to a horizontal container,\n\t\t\t\t// it might not have width but have height instead.\n\t\t\t\tconst newSize =\n\t\t\t\t\tgetCustomValueFromPreset( width, spacingSizes ) ||\n\t\t\t\t\tgetCustomValueFromPreset( height, spacingSizes ) ||\n\t\t\t\t\t'100px';\n\t\t\t\tsetAttributes( {\n\t\t\t\t\twidth: '0px',\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\t...blockStyle,\n\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\tflexSize: newSize,\n\t\t\t\t\t\t\tselfStretch: 'fixed',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tconst newSize =\n\t\t\t\t\tgetCustomValueFromPreset( height, spacingSizes ) ||\n\t\t\t\t\tgetCustomValueFromPreset( width, spacingSizes ) ||\n\t\t\t\t\t'100px';\n\t\t\t\tsetAttributes( {\n\t\t\t\t\theight: '0px',\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\t...blockStyle,\n\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\tflexSize: newSize,\n\t\t\t\t\t\t\tselfStretch: 'fixed',\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} else if (\n\t\t\tisFlexLayout &&\n\t\t\t( selfStretch === 'fill' || selfStretch === 'fit' )\n\t\t) {\n\t\t\tif ( inheritedOrientation === 'horizontal' ) {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\twidth: undefined,\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\theight: undefined,\n\t\t\t\t} );\n\t\t\t}\n\t\t} else if ( ! isFlexLayout && ( selfStretch || flexSize ) ) {\n\t\t\tif ( inheritedOrientation === 'horizontal' ) {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\twidth: flexSize,\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\theight: flexSize,\n\t\t\t\t} );\n\t\t\t}\n\t\t\tsetAttributes( {\n\t\t\t\tstyle: {\n\t\t\t\t\t...blockStyle,\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\t...layout,\n\t\t\t\t\t\tflexSize: undefined,\n\t\t\t\t\t\tselfStretch: undefined,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\t}, [\n\t\tblockStyle,\n\t\tflexSize,\n\t\theight,\n\t\tinheritedOrientation,\n\t\tisFlexLayout,\n\t\tlayout,\n\t\tselfStretch,\n\t\tsetAttributes,\n\t\tspacingSizes,\n\t\twidth,\n\t] );\n\n\treturn (\n\t\t<>\n\t\t\t<View\n\t\t\t\t{ ...useBlockProps( {\n\t\t\t\t\tstyle,\n\t\t\t\t\tclassName: clsx( className, {\n\t\t\t\t\t\t'custom-sizes-disabled': disableCustomSpacingSizes,\n\t\t\t\t\t} ),\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t{ resizableBoxWithOrientation( inheritedOrientation ) }\n\t\t\t</View>\n\t\t\t{ ! isFlexLayout && (\n\t\t\t\t<SpacerControls\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\theight={ temporaryHeight || height }\n\t\t\t\t\twidth={ temporaryWidth || width }\n\t\t\t\t\torientation={ inheritedOrientation }\n\t\t\t\t\tisResizing={ isResizing }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n};\n\nexport default SpacerEdit;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAOA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAKA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AAA8C,IAAAS,WAAA,GAAAT,OAAA;AAzB9C;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;;AAKA,MAAM;EAAEU;AAAgB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAE5D,MAAMC,eAAe,GAAGA,CAAE;EACzBC,WAAW;EACXC,aAAa;EACbC,QAAQ;EACRC,YAAY;EACZC,UAAU;EACVC,UAAU;EACVC,aAAa;EACb,GAAGC;AACJ,CAAC,KAAM;EACN,MAAMC,cAAc,GAAKC,GAAG,IAAM;IACjC,OAAOT,WAAW,KAAK,YAAY,GAChCS,GAAG,CAACC,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nB3C,KAAK;QACLhC,SAAS,EAAE,IAAAC,aAAI,EAAED,SAAS,EAAE;UAC3B,uBAAuB,EAAEkB;QAC1B,CAAE;MACH,CAAE,CAAC;MAAAkD,QAAA,EAEDb,2BAA2B,CAAE1B,oBAAqB;IAAC,CAChD,CAAC,EACL,CAAED,YAAY,iBACf,IAAAhD,WAAA,CAAAkB,GAAA,EAACpB,SAAA,CAAAgD,OAAc;MACdb,aAAa,EAAGA,aAAe;MAC/BiB,MAAM,EAAGS,eAAe,IAAIT,MAAQ;MACpCC,KAAK,EAAGU,cAAc,IAAIV,KAAO;MACjC9C,WAAW,EAAG4C,oBAAsB;MACpCvC,UAAU,EAAGA;IAAY,CACzB,CACD;EAAA,CACA,CAAC;AAEL,CAAC;AAAC,IAAAsF,QAAA,GAAAC,OAAA,CAAAnD,OAAA,GAEaf,UAAU","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_blockEditor","_components","_element","_primitives","_data","_lockUnlock","_controls","_constants","_jsxRuntime","useSpacingSizes","unlock","blockEditorPrivateApis","ResizableSpacer","orientation","onResizeStart","onResize","onResizeStop","isSelected","isResizing","setIsResizing","props","getCurrentSize","elt","clientWidth","clientHeight","getNextVal","jsx","ResizableBox","className","clsx","_event","_direction","nextVal","__experimentalShowTooltip","__experimentalTooltipProps","axis","position","isVisible","showHandle","SpacerEdit","attributes","setAttributes","toggleSelection","context","__unstableParentLayout","parentLayout","disableCustomSpacingSizes","useSelect","select","editorSettings","blockEditorStore","getSettings","parentOrientation","type","default","defaultType","isFlexLayout","inheritedOrientation","height","width","style","blockStyle","layout","selfStretch","flexSize","spacingSizes","useState","temporaryHeight","setTemporaryHeight","temporaryWidth","setTemporaryWidth","__unstableMarkNextChangeAsNotPersistent","useDispatch","handleOnVerticalResizeStop","newHeight","handleOnHorizontalResizeStop","newWidth","getHeightForVerticalBlocks","undefined","getSpacingPresetCssVar","getWidthForHorizontalBlocks","sizeConditionalOnOrientation","minWidth","flexBasis","flexGrow","resizableBoxWithOrientation","blockOrientation","MIN_SPACER_SIZE","enable","top","right","bottom","left","topRight","bottomRight","bottomLeft","topLeft","Fragment","children","minHeight","useEffect","setAttributesCovertly","nextAttributes","newSize","getCustomValueFromPreset","jsxs","View","useBlockProps","_default","exports"],"sources":["@wordpress/block-library/src/spacer/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseBlockProps,\n\tgetCustomValueFromPreset,\n\tgetSpacingPresetCssVar,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { ResizableBox } from '@wordpress/components';\nimport { useState, useEffect } from '@wordpress/element';\nimport { View } from '@wordpress/primitives';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\nimport SpacerControls from './controls';\nimport { MIN_SPACER_SIZE } from './constants';\n\nconst { useSpacingSizes } = unlock( blockEditorPrivateApis );\n\nconst ResizableSpacer = ( {\n\torientation,\n\tonResizeStart,\n\tonResize,\n\tonResizeStop,\n\tisSelected,\n\tisResizing,\n\tsetIsResizing,\n\t...props\n} ) => {\n\tconst getCurrentSize = ( elt ) => {\n\t\treturn orientation === 'horizontal'\n\t\t\t? elt.clientWidth\n\t\t\t: elt.clientHeight;\n\t};\n\n\tconst getNextVal = ( elt ) => {\n\t\treturn `${ getCurrentSize( elt ) }px`;\n\t};\n\n\treturn (\n\t\t<ResizableBox\n\t\t\tclassName={ clsx( 'block-library-spacer__resize-container', {\n\t\t\t\t'resize-horizontal': orientation === 'horizontal',\n\t\t\t\t'is-resizing': isResizing,\n\t\t\t\t'is-selected': isSelected,\n\t\t\t} ) }\n\t\t\tonResizeStart={ ( _event, _direction, elt ) => {\n\t\t\t\tconst nextVal = getNextVal( elt );\n\t\t\t\tonResizeStart( nextVal );\n\t\t\t\tonResize( nextVal );\n\t\t\t} }\n\t\t\tonResize={ ( _event, _direction, elt ) => {\n\t\t\t\tonResize( getNextVal( elt ) );\n\t\t\t\tif ( ! isResizing ) {\n\t\t\t\t\tsetIsResizing( true );\n\t\t\t\t}\n\t\t\t} }\n\t\t\tonResizeStop={ ( _event, _direction, elt ) => {\n\t\t\t\tconst nextVal = getCurrentSize( elt );\n\t\t\t\tonResizeStop( `${ nextVal }px` );\n\t\t\t\tsetIsResizing( false );\n\t\t\t} }\n\t\t\t__experimentalShowTooltip\n\t\t\t__experimentalTooltipProps={ {\n\t\t\t\taxis: orientation === 'horizontal' ? 'x' : 'y',\n\t\t\t\tposition: 'corner',\n\t\t\t\tisVisible: isResizing,\n\t\t\t} }\n\t\t\tshowHandle={ isSelected }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n};\n\nconst SpacerEdit = ( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\n\ttoggleSelection,\n\tcontext,\n\t__unstableParentLayout: parentLayout,\n\tclassName,\n} ) => {\n\tconst disableCustomSpacingSizes = useSelect( ( select ) => {\n\t\tconst editorSettings = select( blockEditorStore ).getSettings();\n\t\treturn editorSettings?.disableCustomSpacingSizes;\n\t} );\n\tconst { orientation } = context;\n\tconst {\n\t\torientation: parentOrientation,\n\t\ttype,\n\t\tdefault: { type: defaultType } = {},\n\t} = parentLayout || {};\n\t// Check if the spacer is inside a flex container.\n\tconst isFlexLayout =\n\t\ttype === 'flex' || ( ! type && defaultType === 'flex' );\n\t// If the spacer is inside a flex container, it should either inherit the orientation\n\t// of the parent or use the flex default orientation.\n\tconst inheritedOrientation =\n\t\t! parentOrientation && isFlexLayout\n\t\t\t? 'horizontal'\n\t\t\t: parentOrientation || orientation;\n\tconst { height, width, style: blockStyle = {} } = attributes;\n\n\tconst { layout = {} } = blockStyle;\n\tconst { selfStretch, flexSize } = layout;\n\n\tconst spacingSizes = useSpacingSizes();\n\n\tconst [ isResizing, setIsResizing ] = useState( false );\n\tconst [ temporaryHeight, setTemporaryHeight ] = useState( null );\n\tconst [ temporaryWidth, setTemporaryWidth ] = useState( null );\n\n\tconst onResizeStart = () => toggleSelection( false );\n\tconst onResizeStop = () => toggleSelection( true );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst handleOnVerticalResizeStop = ( newHeight ) => {\n\t\tonResizeStop();\n\n\t\tif ( isFlexLayout ) {\n\t\t\tsetAttributes( {\n\t\t\t\tstyle: {\n\t\t\t\t\t...blockStyle,\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\t...layout,\n\t\t\t\t\t\tflexSize: newHeight,\n\t\t\t\t\t\tselfStretch: 'fixed',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\tsetAttributes( { height: newHeight } );\n\t\tsetTemporaryHeight( null );\n\t};\n\n\tconst handleOnHorizontalResizeStop = ( newWidth ) => {\n\t\tonResizeStop();\n\n\t\tif ( isFlexLayout ) {\n\t\t\tsetAttributes( {\n\t\t\t\tstyle: {\n\t\t\t\t\t...blockStyle,\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\t...layout,\n\t\t\t\t\t\tflexSize: newWidth,\n\t\t\t\t\t\tselfStretch: 'fixed',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\tsetAttributes( { width: newWidth } );\n\t\tsetTemporaryWidth( null );\n\t};\n\n\tconst getHeightForVerticalBlocks = () => {\n\t\tif ( isFlexLayout ) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn temporaryHeight || getSpacingPresetCssVar( height ) || undefined;\n\t};\n\n\tconst getWidthForHorizontalBlocks = () => {\n\t\tif ( isFlexLayout ) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn temporaryWidth || getSpacingPresetCssVar( width ) || undefined;\n\t};\n\n\tconst sizeConditionalOnOrientation =\n\t\tinheritedOrientation === 'horizontal'\n\t\t\t? temporaryWidth || flexSize\n\t\t\t: temporaryHeight || flexSize;\n\n\tconst style = {\n\t\theight:\n\t\t\tinheritedOrientation === 'horizontal'\n\t\t\t\t? 24\n\t\t\t\t: getHeightForVerticalBlocks(),\n\t\twidth:\n\t\t\tinheritedOrientation === 'horizontal'\n\t\t\t\t? getWidthForHorizontalBlocks()\n\t\t\t\t: undefined,\n\t\t// In vertical flex containers, the spacer shrinks to nothing without a minimum width.\n\t\tminWidth:\n\t\t\tinheritedOrientation === 'vertical' && isFlexLayout\n\t\t\t\t? 48\n\t\t\t\t: undefined,\n\t\t// Add flex-basis so temporary sizes are respected.\n\t\tflexBasis: isFlexLayout ? sizeConditionalOnOrientation : undefined,\n\t\t// Remove flex-grow when resizing.\n\t\tflexGrow: isFlexLayout && isResizing ? 0 : undefined,\n\t};\n\n\tconst resizableBoxWithOrientation = ( blockOrientation ) => {\n\t\tif ( blockOrientation === 'horizontal' ) {\n\t\t\treturn (\n\t\t\t\t<ResizableSpacer\n\t\t\t\t\tminWidth={ MIN_SPACER_SIZE }\n\t\t\t\t\tenable={ {\n\t\t\t\t\t\ttop: false,\n\t\t\t\t\t\tright: true,\n\t\t\t\t\t\tbottom: false,\n\t\t\t\t\t\tleft: false,\n\t\t\t\t\t\ttopRight: false,\n\t\t\t\t\t\tbottomRight: false,\n\t\t\t\t\t\tbottomLeft: false,\n\t\t\t\t\t\ttopLeft: false,\n\t\t\t\t\t} }\n\t\t\t\t\torientation={ blockOrientation }\n\t\t\t\t\tonResizeStart={ onResizeStart }\n\t\t\t\t\tonResize={ setTemporaryWidth }\n\t\t\t\t\tonResizeStop={ handleOnHorizontalResizeStop }\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\tisResizing={ isResizing }\n\t\t\t\t\tsetIsResizing={ setIsResizing }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<ResizableSpacer\n\t\t\t\t\tminHeight={ MIN_SPACER_SIZE }\n\t\t\t\t\tenable={ {\n\t\t\t\t\t\ttop: false,\n\t\t\t\t\t\tright: false,\n\t\t\t\t\t\tbottom: true,\n\t\t\t\t\t\tleft: false,\n\t\t\t\t\t\ttopRight: false,\n\t\t\t\t\t\tbottomRight: false,\n\t\t\t\t\t\tbottomLeft: false,\n\t\t\t\t\t\ttopLeft: false,\n\t\t\t\t\t} }\n\t\t\t\t\torientation={ blockOrientation }\n\t\t\t\t\tonResizeStart={ onResizeStart }\n\t\t\t\t\tonResize={ setTemporaryHeight }\n\t\t\t\t\tonResizeStop={ handleOnVerticalResizeStop }\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\tisResizing={ isResizing }\n\t\t\t\t\tsetIsResizing={ setIsResizing }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t};\n\n\tuseEffect( () => {\n\t\t// To avoid interfering with undo/redo operations any changes in this\n\t\t// effect must not make history and should be preceded by\n\t\t// `__unstableMarkNextChangeAsNotPersistent()`.\n\t\tconst setAttributesCovertly = ( nextAttributes ) => {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( nextAttributes );\n\t\t};\n\n\t\tif (\n\t\t\tisFlexLayout &&\n\t\t\tselfStretch !== 'fill' &&\n\t\t\tselfStretch !== 'fit' &&\n\t\t\tflexSize === undefined\n\t\t) {\n\t\t\tif ( inheritedOrientation === 'horizontal' ) {\n\t\t\t\t// If spacer is moving from a vertical container to a horizontal container,\n\t\t\t\t// it might not have width but have height instead.\n\t\t\t\tconst newSize =\n\t\t\t\t\tgetCustomValueFromPreset( width, spacingSizes ) ||\n\t\t\t\t\tgetCustomValueFromPreset( height, spacingSizes ) ||\n\t\t\t\t\t'100px';\n\t\t\t\tsetAttributesCovertly( {\n\t\t\t\t\twidth: '0px',\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\t...blockStyle,\n\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\tflexSize: newSize,\n\t\t\t\t\t\t\tselfStretch: 'fixed',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tconst newSize =\n\t\t\t\t\tgetCustomValueFromPreset( height, spacingSizes ) ||\n\t\t\t\t\tgetCustomValueFromPreset( width, spacingSizes ) ||\n\t\t\t\t\t'100px';\n\t\t\t\tsetAttributesCovertly( {\n\t\t\t\t\theight: '0px',\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\t...blockStyle,\n\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\tflexSize: newSize,\n\t\t\t\t\t\t\tselfStretch: 'fixed',\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} else if (\n\t\t\tisFlexLayout &&\n\t\t\t( selfStretch === 'fill' || selfStretch === 'fit' )\n\t\t) {\n\t\t\tsetAttributesCovertly(\n\t\t\t\tinheritedOrientation === 'horizontal'\n\t\t\t\t\t? { width: undefined }\n\t\t\t\t\t: { height: undefined }\n\t\t\t);\n\t\t} else if ( ! isFlexLayout && ( selfStretch || flexSize ) ) {\n\t\t\tsetAttributesCovertly( {\n\t\t\t\t...( inheritedOrientation === 'horizontal'\n\t\t\t\t\t? { width: flexSize }\n\t\t\t\t\t: { height: flexSize } ),\n\t\t\t\tstyle: {\n\t\t\t\t\t...blockStyle,\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\t...layout,\n\t\t\t\t\t\tflexSize: undefined,\n\t\t\t\t\t\tselfStretch: undefined,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\t}, [\n\t\tblockStyle,\n\t\tflexSize,\n\t\theight,\n\t\tinheritedOrientation,\n\t\tisFlexLayout,\n\t\tlayout,\n\t\tselfStretch,\n\t\tsetAttributes,\n\t\tspacingSizes,\n\t\twidth,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t] );\n\n\treturn (\n\t\t<>\n\t\t\t<View\n\t\t\t\t{ ...useBlockProps( {\n\t\t\t\t\tstyle,\n\t\t\t\t\tclassName: clsx( className, {\n\t\t\t\t\t\t'custom-sizes-disabled': disableCustomSpacingSizes,\n\t\t\t\t\t} ),\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t{ resizableBoxWithOrientation( inheritedOrientation ) }\n\t\t\t</View>\n\t\t\t{ ! isFlexLayout && (\n\t\t\t\t<SpacerControls\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\theight={ temporaryHeight || height }\n\t\t\t\t\twidth={ temporaryWidth || width }\n\t\t\t\t\torientation={ inheritedOrientation }\n\t\t\t\t\tisResizing={ isResizing }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n};\n\nexport default SpacerEdit;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAOA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAKA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AAA8C,IAAAS,WAAA,GAAAT,OAAA;AAzB9C;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;;AAKA,MAAM;EAAEU;AAAgB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAE5D,MAAMC,eAAe,GAAGA,CAAE;EACzBC,WAAW;EACXC,aAAa;EACbC,QAAQ;EACRC,YAAY;EACZC,UAAU;EACVC,UAAU;EACVC,aAAa;EACb,GAAGC;AACJ,CAAC,KAAM;EACN,MAAMC,cAAc,GAAKC,GAAG,IAAM;IACjC,OAAOT,WAAW,KAAK,YAAY,GAChCS,GAAG,CAACC,WAAW,GACfD,GAAG,CAACE,YAAY;EACpB,CAAC;EAED,MAAMC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A,CAAAkB,GAAA,EAACvB,WAAA,CAAAuG,IAAI;MAAA,GACC,IAAAC,0BAAa,EAAE;QACnB/C,KAAK;QACLhC,SAAS,EAAE,IAAAC,aAAI,EAAED,SAAS,EAAE;UAC3B,uBAAuB,EAAEkB;QAC1B,CAAE;MACH,CAAE,CAAC;MAAAoD,QAAA,EAEDb,2BAA2B,CAAE5B,oBAAqB;IAAC,CAChD,CAAC,EACL,CAAED,YAAY,iBACf,IAAAhD,WAAA,CAAAkB,GAAA,EAACpB,SAAA,CAAAgD,OAAc;MACdb,aAAa,EAAGA,aAAe;MAC/BiB,MAAM,EAAGS,eAAe,IAAIT,MAAQ;MACpCC,KAAK,EAAGU,cAAc,IAAIV,KAAO;MACjC9C,WAAW,EAAG4C,oBAAsB;MACpCvC,UAAU,EAAGA;IAAY,CACzB,CACD;EAAA,CACA,CAAC;AAEL,CAAC;AAAC,IAAA0F,QAAA,GAAAC,OAAA,CAAAvD,OAAA,GAEaf,UAAU","ignoreList":[]}
|
|
@@ -17,6 +17,7 @@ var _icons = require("@wordpress/icons");
|
|
|
17
17
|
var _list = _interopRequireDefault(require("./list"));
|
|
18
18
|
var _utils = require("./utils");
|
|
19
19
|
var _hooks = require("./hooks");
|
|
20
|
+
var _hooks2 = require("../utils/hooks");
|
|
20
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
22
|
/**
|
|
22
23
|
* WordPress dependencies
|
|
@@ -73,6 +74,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
73
74
|
const {
|
|
74
75
|
replaceBlocks
|
|
75
76
|
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
77
|
+
const dropdownMenuProps = (0, _hooks2.useToolsPanelDropdownMenuProps)();
|
|
76
78
|
const headingTree = (0, _utils.linearToNestedHeadingList)(headings);
|
|
77
79
|
const toolbarControls = canInsertList && /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.BlockControls, {
|
|
78
80
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarGroup, {
|
|
@@ -88,16 +90,30 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
88
90
|
})
|
|
89
91
|
});
|
|
90
92
|
const inspectorControls = /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.InspectorControls, {
|
|
91
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanel, {
|
|
94
|
+
label: (0, _i18n.__)('Settings'),
|
|
95
|
+
resetAll: () => {
|
|
96
|
+
setAttributes({
|
|
97
|
+
onlyIncludeCurrentPage: false
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
dropdownMenuProps: dropdownMenuProps,
|
|
101
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
|
|
102
|
+
hasValue: () => !!onlyIncludeCurrentPage,
|
|
95
103
|
label: (0, _i18n.__)('Only include current page'),
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
onlyIncludeCurrentPage: value
|
|
104
|
+
onDeselect: () => setAttributes({
|
|
105
|
+
onlyIncludeCurrentPage: false
|
|
99
106
|
}),
|
|
100
|
-
|
|
107
|
+
isShownByDefault: true,
|
|
108
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
|
|
109
|
+
__nextHasNoMarginBottom: true,
|
|
110
|
+
label: (0, _i18n.__)('Only include current page'),
|
|
111
|
+
checked: onlyIncludeCurrentPage,
|
|
112
|
+
onChange: value => setAttributes({
|
|
113
|
+
onlyIncludeCurrentPage: value
|
|
114
|
+
}),
|
|
115
|
+
help: onlyIncludeCurrentPage ? (0, _i18n.__)('Only including headings from the current page (if the post is paginated).') : (0, _i18n.__)('Include headings from all pages (if the post is paginated).')
|
|
116
|
+
})
|
|
101
117
|
})
|
|
102
118
|
})
|
|
103
119
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blockEditor","require","_blocks","_components","_data","_element","_i18n","_compose","_notices","_icons","_list","_interopRequireDefault","_utils","_hooks","_jsxRuntime","TableOfContentsEdit","attributes","headings","onlyIncludeCurrentPage","clientId","setAttributes","useObserveHeadings","blockProps","useBlockProps","instanceId","useInstanceId","createWarningNotice","useDispatch","noticeStore","showRedirectionPreventedNotice","event","preventDefault","__","id","type","canInsertList","useSelect","select","getBlockRootClientId","canInsertBlockType","blockEditorStore","rootClientId","replaceBlocks","headingTree","linearToNestedHeadingList","toolbarControls","jsx","BlockControls","children","ToolbarGroup","ToolbarButton","onClick","createBlock","ordered","values","renderToString","default","nestedHeadingList","inspectorControls","InspectorControls","PanelBody","title","ToggleControl","__nextHasNoMarginBottom","label","checked","onChange","value","help","length","jsxs","Fragment","Placeholder","icon","BlockIcon","instructions","disableLinkActivation"],"sources":["@wordpress/block-library/src/table-of-contents/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tInspectorControls,\n\tstore as blockEditorStore,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\nimport {\n\tPanelBody,\n\tPlaceholder,\n\tToggleControl,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { renderToString } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as noticeStore } from '@wordpress/notices';\nimport { tableOfContents as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport TableOfContentsList from './list';\nimport { linearToNestedHeadingList } from './utils';\nimport { useObserveHeadings } from './hooks';\n\n/** @typedef {import('./utils').HeadingData} HeadingData */\n\n/**\n * Table of Contents block edit component.\n *\n * @param {Object} props The props.\n * @param {Object} props.attributes The block attributes.\n * @param {HeadingData[]} props.attributes.headings A list of data for each heading in the post.\n * @param {boolean} props.attributes.onlyIncludeCurrentPage Whether to only include headings from the current page (if the post is paginated).\n * @param {string} props.clientId\n * @param {(attributes: Object) => void} props.setAttributes\n *\n * @return {Component} The component.\n */\nexport default function TableOfContentsEdit( {\n\tattributes: { headings = [], onlyIncludeCurrentPage },\n\tclientId,\n\tsetAttributes,\n} ) {\n\tuseObserveHeadings( clientId );\n\n\tconst blockProps = useBlockProps();\n\tconst instanceId = useInstanceId(\n\t\tTableOfContentsEdit,\n\t\t'table-of-contents'\n\t);\n\n\t// If a user clicks to a link prevent redirection and show a warning.\n\tconst { createWarningNotice } = useDispatch( noticeStore );\n\tconst showRedirectionPreventedNotice = ( event ) => {\n\t\tevent.preventDefault();\n\t\tcreateWarningNotice( __( 'Links are disabled in the editor.' ), {\n\t\t\tid: `block-library/core/table-of-contents/redirection-prevented/${ instanceId }`,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t};\n\n\tconst canInsertList = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId, canInsertBlockType } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\treturn canInsertBlockType( 'core/list', rootClientId );\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\n\tconst headingTree = linearToNestedHeadingList( headings );\n\n\tconst toolbarControls = canInsertList && (\n\t\t<BlockControls>\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlock( 'core/list', {\n\t\t\t\t\t\t\t\tordered: true,\n\t\t\t\t\t\t\t\tvalues: renderToString(\n\t\t\t\t\t\t\t\t\t<TableOfContentsList\n\t\t\t\t\t\t\t\t\t\tnestedHeadingList={ headingTree }\n\t\t\t\t\t\t\t\t\t/>\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}\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Convert to static list' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t</ToolbarGroup>\n\t\t</BlockControls>\n\t);\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t<ToggleControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Only include current page' ) }\n\t\t\t\t\tchecked={ onlyIncludeCurrentPage }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { onlyIncludeCurrentPage: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={\n\t\t\t\t\t\tonlyIncludeCurrentPage\n\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t'Only including headings from the current page (if the post is paginated).'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'Include headings from all pages (if the post is paginated).'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n\n\t// If there are no headings or the only heading is empty.\n\t// Note that the toolbar controls are intentionally omitted since the\n\t// \"Convert to static list\" option is useless to the placeholder state.\n\tif ( headings.length === 0 ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<Placeholder\n\t\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\t\tlabel={ __( 'Table of Contents' ) }\n\t\t\t\t\t\tinstructions={ __(\n\t\t\t\t\t\t\t'Start adding Heading blocks to create a table of contents. Headings with HTML anchors will be linked here.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t{ inspectorControls }\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<nav { ...blockProps }>\n\t\t\t\t<ol>\n\t\t\t\t\t<TableOfContentsList\n\t\t\t\t\t\tnestedHeadingList={ headingTree }\n\t\t\t\t\t\tdisableLinkActivation\n\t\t\t\t\t\tonClick={ showRedirectionPreventedNotice }\n\t\t\t\t\t/>\n\t\t\t\t</ol>\n\t\t\t</nav>\n\t\t\t{ toolbarControls }\n\t\t\t{ inspectorControls }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAOA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAOA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAKA,IAAAS,KAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AAA6C,IAAAa,WAAA,GAAAb,OAAA;AA9B7C;AACA;AACA;;AAuBA;AACA;AACA;;AAKA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACe,SAASc,mBAAmBA,CAAE;EAC5CC,UAAU,EAAE;IAAEC,QAAQ,GAAG,EAAE;IAAEC;EAAuB,CAAC;EACrDC,QAAQ;EACRC;AACD,CAAC,EAAG;EACH,IAAAC,yBAAkB,EAAEF,QAAS,CAAC;EAE9B,MAAMG,UAAU,GAAG,IAAAC,0BAAa,EAAC,CAAC;EAClC,MAAMC,UAAU,GAAG,IAAAC,sBAAa,EAC/BV,mBAAmB,EACnB,mBACD,CAAC;;EAED;EACA,MAAM;IAAEW;EAAoB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,cAAY,CAAC;EAC1D,MAAMC,8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AA,CAAAwD,IAAA,EAAAxD,WAAA,CAAAyD,QAAA;IAAAvB,QAAA,gBACC,IAAAlC,WAAA,CAAAgC,GAAA;MAAA,GAAUxB,UAAU;MAAA0B,QAAA,eACnB,IAAAlC,WAAA,CAAAgC,GAAA;QAAAE,QAAA,eACC,IAAAlC,WAAA,CAAAgC,GAAA,EAACpC,KAAA,CAAA8C,OAAmB;UACnBC,iBAAiB,EAAGd,WAAa;UACjCiC,qBAAqB;UACrBzB,OAAO,EAAGtB;QAAgC,CAC1C;MAAC,CACC;IAAC,CACD,CAAC,EACJgB,eAAe,EACfa,iBAAiB;EAAA,CAClB,CAAC;AAEL","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_blockEditor","require","_blocks","_components","_data","_element","_i18n","_compose","_notices","_icons","_list","_interopRequireDefault","_utils","_hooks","_hooks2","_jsxRuntime","TableOfContentsEdit","attributes","headings","onlyIncludeCurrentPage","clientId","setAttributes","useObserveHeadings","blockProps","useBlockProps","instanceId","useInstanceId","createWarningNotice","useDispatch","noticeStore","showRedirectionPreventedNotice","event","preventDefault","__","id","type","canInsertList","useSelect","select","getBlockRootClientId","canInsertBlockType","blockEditorStore","rootClientId","replaceBlocks","dropdownMenuProps","useToolsPanelDropdownMenuProps","headingTree","linearToNestedHeadingList","toolbarControls","jsx","BlockControls","children","ToolbarGroup","ToolbarButton","onClick","createBlock","ordered","values","renderToString","default","nestedHeadingList","inspectorControls","InspectorControls","__experimentalToolsPanel","label","resetAll","__experimentalToolsPanelItem","hasValue","onDeselect","isShownByDefault","ToggleControl","__nextHasNoMarginBottom","checked","onChange","value","help","length","jsxs","Fragment","Placeholder","icon","BlockIcon","instructions","disableLinkActivation"],"sources":["@wordpress/block-library/src/table-of-contents/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tInspectorControls,\n\tstore as blockEditorStore,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\nimport {\n\tPlaceholder,\n\tToggleControl,\n\tToolbarButton,\n\tToolbarGroup,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { renderToString } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as noticeStore } from '@wordpress/notices';\nimport { tableOfContents as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport TableOfContentsList from './list';\nimport { linearToNestedHeadingList } from './utils';\nimport { useObserveHeadings } from './hooks';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\n/** @typedef {import('./utils').HeadingData} HeadingData */\n\n/**\n * Table of Contents block edit component.\n *\n * @param {Object} props The props.\n * @param {Object} props.attributes The block attributes.\n * @param {HeadingData[]} props.attributes.headings A list of data for each heading in the post.\n * @param {boolean} props.attributes.onlyIncludeCurrentPage Whether to only include headings from the current page (if the post is paginated).\n * @param {string} props.clientId\n * @param {(attributes: Object) => void} props.setAttributes\n *\n * @return {Component} The component.\n */\nexport default function TableOfContentsEdit( {\n\tattributes: { headings = [], onlyIncludeCurrentPage },\n\tclientId,\n\tsetAttributes,\n} ) {\n\tuseObserveHeadings( clientId );\n\n\tconst blockProps = useBlockProps();\n\tconst instanceId = useInstanceId(\n\t\tTableOfContentsEdit,\n\t\t'table-of-contents'\n\t);\n\n\t// If a user clicks to a link prevent redirection and show a warning.\n\tconst { createWarningNotice } = useDispatch( noticeStore );\n\tconst showRedirectionPreventedNotice = ( event ) => {\n\t\tevent.preventDefault();\n\t\tcreateWarningNotice( __( 'Links are disabled in the editor.' ), {\n\t\t\tid: `block-library/core/table-of-contents/redirection-prevented/${ instanceId }`,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t};\n\n\tconst canInsertList = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId, canInsertBlockType } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\treturn canInsertBlockType( 'core/list', rootClientId );\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst headingTree = linearToNestedHeadingList( headings );\n\n\tconst toolbarControls = canInsertList && (\n\t\t<BlockControls>\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlock( 'core/list', {\n\t\t\t\t\t\t\t\tordered: true,\n\t\t\t\t\t\t\t\tvalues: renderToString(\n\t\t\t\t\t\t\t\t\t<TableOfContentsList\n\t\t\t\t\t\t\t\t\t\tnestedHeadingList={ headingTree }\n\t\t\t\t\t\t\t\t\t/>\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}\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Convert to static list' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t</ToolbarGroup>\n\t\t</BlockControls>\n\t);\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\tresetAll={ () => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tonlyIncludeCurrentPage: false,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! onlyIncludeCurrentPage }\n\t\t\t\t\tlabel={ __( 'Only include current page' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { onlyIncludeCurrentPage: false } )\n\t\t\t\t\t}\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Only include current page' ) }\n\t\t\t\t\t\tchecked={ onlyIncludeCurrentPage }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { onlyIncludeCurrentPage: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\tonlyIncludeCurrentPage\n\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t'Only including headings from the current page (if the post is paginated).'\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t'Include headings from all pages (if the post is paginated).'\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n\n\t// If there are no headings or the only heading is empty.\n\t// Note that the toolbar controls are intentionally omitted since the\n\t// \"Convert to static list\" option is useless to the placeholder state.\n\tif ( headings.length === 0 ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<Placeholder\n\t\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\t\tlabel={ __( 'Table of Contents' ) }\n\t\t\t\t\t\tinstructions={ __(\n\t\t\t\t\t\t\t'Start adding Heading blocks to create a table of contents. Headings with HTML anchors will be linked here.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t{ inspectorControls }\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<nav { ...blockProps }>\n\t\t\t\t<ol>\n\t\t\t\t\t<TableOfContentsList\n\t\t\t\t\t\tnestedHeadingList={ headingTree }\n\t\t\t\t\t\tdisableLinkActivation\n\t\t\t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,QAAA,eACnB,IAAApC,WAAA,CAAAkC,GAAA,EAAC9C,WAAA,CAAA4E,WAAW;UACXC,IAAI,eAAG,IAAAjE,WAAA,CAAAkC,GAAA,EAACjD,YAAA,CAAAiF,SAAS;YAACD,IAAI,EAAGA;UAAM,CAAE,CAAG;UACpChB,KAAK,EAAG,IAAA/B,QAAE,EAAE,mBAAoB,CAAG;UACnCiD,YAAY,EAAG,IAAAjD,QAAE,EAChB,4GACD;QAAG,CACH;MAAC,CACE,CAAC,EACJ4B,iBAAiB;IAAA,CAClB,CAAC;EAEL;EAEA,oBACC,IAAA9C,WAAA,CAAA8D,IAAA,EAAA9D,WAAA,CAAA+D,QAAA;IAAA3B,QAAA,gBACC,IAAApC,WAAA,CAAAkC,GAAA;MAAA,GAAU1B,UAAU;MAAA4B,QAAA,eACnB,IAAApC,WAAA,CAAAkC,GAAA;QAAAE,QAAA,eACC,IAAApC,WAAA,CAAAkC,GAAA,EAACvC,KAAA,CAAAiD,OAAmB;UACnBC,iBAAiB,EAAGd,WAAa;UACjCqC,qBAAqB;UACrB7B,OAAO,EAAGxB;QAAgC,CAC1C;MAAC,CACC;IAAC,CACD,CAAC,EACJkB,eAAe,EACfa,iBAAiB;EAAA,CAClB,CAAC;AAEL","ignoreList":[]}
|
|
@@ -10,6 +10,7 @@ var _components = require("@wordpress/components");
|
|
|
10
10
|
var _i18n = require("@wordpress/i18n");
|
|
11
11
|
var _data = require("@wordpress/data");
|
|
12
12
|
var _importControls = require("./import-controls");
|
|
13
|
+
var _messages = require("../../utils/messages");
|
|
13
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
15
|
/**
|
|
15
16
|
* WordPress dependencies
|
|
@@ -19,14 +20,6 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
19
20
|
* Internal dependencies
|
|
20
21
|
*/
|
|
21
22
|
|
|
22
|
-
const htmlElementMessages = {
|
|
23
|
-
header: (0, _i18n.__)('The <header> element should represent introductory content, typically a group of introductory or navigational aids.'),
|
|
24
|
-
main: (0, _i18n.__)('The <main> element should be used for the primary content of your document only.'),
|
|
25
|
-
section: (0, _i18n.__)("The <section> element should represent a standalone portion of the document that can't be better represented by another element."),
|
|
26
|
-
article: (0, _i18n.__)('The <article> element should represent a self-contained, syndicatable portion of the document.'),
|
|
27
|
-
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."),
|
|
28
|
-
footer: (0, _i18n.__)('The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).')
|
|
29
|
-
};
|
|
30
23
|
function TemplatePartAdvancedControls({
|
|
31
24
|
tagName,
|
|
32
25
|
setAttributes,
|
|
@@ -99,7 +92,7 @@ function TemplatePartAdvancedControls({
|
|
|
99
92
|
onChange: value => setAttributes({
|
|
100
93
|
tagName: value
|
|
101
94
|
}),
|
|
102
|
-
help: htmlElementMessages[tagName]
|
|
95
|
+
help: _messages.htmlElementMessages[tagName]
|
|
103
96
|
}), !hasInnerBlocks && /*#__PURE__*/(0, _jsxRuntime.jsx)(_importControls.TemplatePartImportControls, {
|
|
104
97
|
area: area,
|
|
105
98
|
setAttributes: setAttributes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_coreData","require","_components","_i18n","_data","_importControls","
|
|
1
|
+
{"version":3,"names":["_coreData","require","_components","_i18n","_data","_importControls","_messages","_jsxRuntime","TemplatePartAdvancedControls","tagName","setAttributes","isEntityAvailable","templatePartId","defaultWrapper","hasInnerBlocks","area","setArea","useEntityProp","title","setTitle","defaultTemplatePartAreas","useSelect","select","coreStore","getEntityRecord","default_template_part_areas","areaOptions","map","label","_area","value","jsxs","Fragment","children","jsx","TextControl","__next40pxDefaultSize","__nextHasNoMarginBottom","__","onChange","onFocus","event","target","SelectControl","labelPosition","options","sprintf","help","htmlElementMessages","TemplatePartImportControls"],"sources":["@wordpress/block-library/src/template-part/edit/advanced-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { SelectControl, TextControl } from '@wordpress/components';\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { TemplatePartImportControls } from './import-controls';\nimport { htmlElementMessages } from '../../utils/messages';\n\nexport function TemplatePartAdvancedControls( {\n\ttagName,\n\tsetAttributes,\n\tisEntityAvailable,\n\ttemplatePartId,\n\tdefaultWrapper,\n\thasInnerBlocks,\n} ) {\n\tconst [ area, setArea ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t'area',\n\t\ttemplatePartId\n\t);\n\n\tconst [ title, setTitle ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t'title',\n\t\ttemplatePartId\n\t);\n\n\tconst defaultTemplatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord( 'root', '__unstableBase' )\n\t\t\t\t?.default_template_part_areas || [],\n\t\t[]\n\t);\n\n\tconst areaOptions = defaultTemplatePartAreas.map(\n\t\t( { label, area: _area } ) => ( {\n\t\t\tlabel,\n\t\t\tvalue: _area,\n\t\t} )\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ isEntityAvailable && (\n\t\t\t\t<>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Title' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tsetTitle( value );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonFocus={ ( event ) => event.target.select() }\n\t\t\t\t\t/>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Area' ) }\n\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\toptions={ areaOptions }\n\t\t\t\t\t\tvalue={ area }\n\t\t\t\t\t\tonChange={ setArea }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\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{\n\t\t\t\t\t\tlabel: sprintf(\n\t\t\t\t\t\t\t/* translators: %s: HTML tag based on area. */\n\t\t\t\t\t\t\t__( 'Default based on area (%s)' ),\n\t\t\t\t\t\t\t`<${ defaultWrapper }>`\n\t\t\t\t\t\t),\n\t\t\t\t\t\tvalue: '',\n\t\t\t\t\t},\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\t{ label: '<div>', value: 'div' },\n\t\t\t\t] }\n\t\t\t\tvalue={ tagName || '' }\n\t\t\t\tonChange={ ( value ) => setAttributes( { tagName: value } ) }\n\t\t\t\thelp={ htmlElementMessages[ tagName ] }\n\t\t\t/>\n\t\t\t{ ! hasInnerBlocks && (\n\t\t\t\t<TemplatePartImportControls\n\t\t\t\t\tarea={ area }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAA2D,IAAAM,WAAA,GAAAN,OAAA;AAZ3D;AACA;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,cAAc,iBACjB,IAAAP,WAAA,CAAA2B,GAAA,EAAC7B,eAAA,CAAA4C,0BAA0B;MAC1BlC,IAAI,EAAGA,IAAM;MACbL,aAAa,EAAGA;IAAe,CAC/B,CACD;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.htmlElementMessages = void 0;
|
|
7
|
+
var _i18n = require("@wordpress/i18n");
|
|
8
|
+
/**
|
|
9
|
+
* WordPress dependencies
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const htmlElementMessages = exports.htmlElementMessages = {
|
|
13
|
+
article: (0, _i18n.__)('The <article> element should represent a self-contained, syndicatable portion of the document.'),
|
|
14
|
+
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."),
|
|
15
|
+
div: (0, _i18n.__)('The <div> element should only be used if the block is a design element with no semantic meaning.'),
|
|
16
|
+
footer: (0, _i18n.__)('The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'),
|
|
17
|
+
header: (0, _i18n.__)('The <header> element should represent introductory content, typically a group of introductory or navigational aids.'),
|
|
18
|
+
main: (0, _i18n.__)('The <main> element should be used for the primary content of your document only.'),
|
|
19
|
+
nav: (0, _i18n.__)('The <nav> element should be used to identify groups of links that are intended to be used for website or page content navigation.'),
|
|
20
|
+
section: (0, _i18n.__)("The <section> element should represent a standalone portion of the document that can't be better represented by another element.")
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_i18n","require","htmlElementMessages","exports","article","__","aside","div","footer","header","main","nav","section"],"sources":["@wordpress/block-library/src/utils/messages.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nexport const htmlElementMessages = {\n\tarticle: __(\n\t\t'The <article> element should represent a self-contained, syndicatable portion of the document.'\n\t),\n\taside: __(\n\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),\n\tdiv: __(\n\t\t'The <div> element should only be used if the block is a design element with no semantic meaning.'\n\t),\n\tfooter: __(\n\t\t'The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'\n\t),\n\theader: __(\n\t\t'The <header> element should represent introductory content, typically a group of introductory or navigational aids.'\n\t),\n\tmain: __(\n\t\t'The <main> element should be used for the primary content of your document only.'\n\t),\n\tnav: __(\n\t\t'The <nav> element should be used to identify groups of links that are intended to be used for website or page content navigation.'\n\t),\n\tsection: __(\n\t\t\"The <section> element should represent a standalone portion of the document that can't be better represented by another element.\"\n\t),\n};\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGO,MAAMC,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAG;EAClCE,OAAO,EAAE,IAAAC,QAAE,EACV,gGACD,CAAC;EACDC,KAAK,EAAE,IAAAD,QAAE,EACR,uIACD,CAAC;EACDE,GAAG,EAAE,IAAAF,QAAE,EACN,kGACD,CAAC;EACDG,MAAM,EAAE,IAAAH,QAAE,EACT,8HACD,CAAC;EACDI,MAAM,EAAE,IAAAJ,QAAE,EACT,qHACD,CAAC;EACDK,IAAI,EAAE,IAAAL,QAAE,EACP,kFACD,CAAC;EACDM,GAAG,EAAE,IAAAN,QAAE,EACN,mIACD,CAAC;EACDO,OAAO,EAAE,IAAAP,QAAE,EACV,kIACD;AACD,CAAC","ignoreList":[]}
|
|
@@ -138,7 +138,7 @@ const VideoSettings = ({
|
|
|
138
138
|
/* translators: Setting to play videos within the webpage on mobile browsers rather than opening in a fullscreen player. */,
|
|
139
139
|
label: (0, _i18n.__)('Play inline'),
|
|
140
140
|
onChange: toggleFactory.playsInline,
|
|
141
|
-
checked: playsInline,
|
|
141
|
+
checked: !!playsInline,
|
|
142
142
|
help: (0, _i18n.__)('When enabled, videos will play directly within the webpage on mobile browsers, instead of opening in a fullscreen player.')
|
|
143
143
|
})
|
|
144
144
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_element","_jsxRuntime","options","value","label","__","_x","VideoSettings","setAttributes","attributes","autoplay","controls","loop","muted","playsInline","preload","autoPlayHelpText","getAutoplayHelp","Platform","select","web","useCallback","checked","native","toggleFactory","useMemo","toggleAttribute","attribute","newValue","onChangePreload","jsxs","Fragment","children","jsx","__experimentalToolsPanelItem","isShownByDefault","hasValue","onDeselect","ToggleControl","__nextHasNoMarginBottom","onChange","help","SelectControl","__next40pxDefaultSize","hideCancelButton","_default","exports","default"],"sources":["@wordpress/block-library/src/video/edit-common-settings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tToggleControl,\n\tSelectControl,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useMemo, useCallback, Platform } from '@wordpress/element';\n\nconst options = [\n\t{ value: 'auto', label: __( 'Auto' ) },\n\t{ value: 'metadata', label: __( 'Metadata' ) },\n\t{ value: 'none', label: _x( 'None', 'Preload value' ) },\n];\n\nconst VideoSettings = ( { setAttributes, attributes } ) => {\n\tconst { autoplay, controls, loop, muted, playsInline, preload } =\n\t\tattributes;\n\n\tconst autoPlayHelpText = __(\n\t\t'Autoplay may cause usability issues for some users.'\n\t);\n\tconst getAutoplayHelp = Platform.select( {\n\t\tweb: useCallback( ( checked ) => {\n\t\t\treturn checked ? autoPlayHelpText : null;\n\t\t}, [] ),\n\t\tnative: autoPlayHelpText,\n\t} );\n\n\tconst toggleFactory = useMemo( () => {\n\t\tconst toggleAttribute = ( attribute ) => {\n\t\t\treturn ( newValue ) => {\n\t\t\t\tsetAttributes( { [ attribute ]: newValue } );\n\t\t\t};\n\t\t};\n\n\t\treturn {\n\t\t\tautoplay: toggleAttribute( 'autoplay' ),\n\t\t\tloop: toggleAttribute( 'loop' ),\n\t\t\tmuted: toggleAttribute( 'muted' ),\n\t\t\tcontrols: toggleAttribute( 'controls' ),\n\t\t\tplaysInline: toggleAttribute( 'playsInline' ),\n\t\t};\n\t}, [] );\n\n\tconst onChangePreload = useCallback( ( value ) => {\n\t\tsetAttributes( { preload: value } );\n\t}, [] );\n\n\treturn (\n\t\t<>\n\t\t\t<ToolsPanelItem\n\t\t\t\tlabel={ __( 'Autoplay' ) }\n\t\t\t\tisShownByDefault\n\t\t\t\thasValue={ () => !! autoplay }\n\t\t\t\tonDeselect={ () => {\n\t\t\t\t\tsetAttributes( { autoplay: false } );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<ToggleControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Autoplay' ) }\n\t\t\t\t\tonChange={ toggleFactory.autoplay }\n\t\t\t\t\tchecked={ !! autoplay }\n\t\t\t\t\thelp={ getAutoplayHelp }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t\t<ToolsPanelItem\n\t\t\t\tlabel={ __( 'Loop' ) }\n\t\t\t\tisShownByDefault\n\t\t\t\thasValue={ () => !! loop }\n\t\t\t\tonDeselect={ () => {\n\t\t\t\t\tsetAttributes( { loop: false } );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<ToggleControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Loop' ) }\n\t\t\t\t\tonChange={ toggleFactory.loop }\n\t\t\t\t\tchecked={ !! loop }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t\t<ToolsPanelItem\n\t\t\t\tlabel={ __( 'Muted' ) }\n\t\t\t\tisShownByDefault\n\t\t\t\thasValue={ () => !! muted }\n\t\t\t\tonDeselect={ () => {\n\t\t\t\t\tsetAttributes( { muted: false } );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<ToggleControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Muted' ) }\n\t\t\t\t\tonChange={ toggleFactory.muted }\n\t\t\t\t\tchecked={ !! muted }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t\t<ToolsPanelItem\n\t\t\t\tlabel={ __( 'Playback controls' ) }\n\t\t\t\tisShownByDefault\n\t\t\t\thasValue={ () => ! controls }\n\t\t\t\tonDeselect={ () => {\n\t\t\t\t\tsetAttributes( { controls: true } );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<ToggleControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Playback controls' ) }\n\t\t\t\t\tonChange={ toggleFactory.controls }\n\t\t\t\t\tchecked={ !! controls }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t\t<ToolsPanelItem\n\t\t\t\tlabel={ __( 'Play inline' ) }\n\t\t\t\tisShownByDefault\n\t\t\t\thasValue={ () => !! playsInline }\n\t\t\t\tonDeselect={ () => {\n\t\t\t\t\tsetAttributes( { playsInline: false } );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<ToggleControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/* translators: Setting to play videos within the webpage on mobile browsers rather than opening in a fullscreen player. */\n\t\t\t\t\tlabel={ __( 'Play inline' ) }\n\t\t\t\t\tonChange={ toggleFactory.playsInline }\n\t\t\t\t\tchecked={ playsInline }\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'When enabled, videos will play directly within the webpage on mobile browsers, instead of opening in a fullscreen player.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t\t<ToolsPanelItem\n\t\t\t\tlabel={ __( 'Preload' ) }\n\t\t\t\tisShownByDefault\n\t\t\t\thasValue={ () => preload !== 'metadata' }\n\t\t\t\tonDeselect={ () => {\n\t\t\t\t\tsetAttributes( { preload: 'metadata' } );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<SelectControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Preload' ) }\n\t\t\t\t\tvalue={ preload }\n\t\t\t\t\tonChange={ onChangePreload }\n\t\t\t\t\toptions={ options }\n\t\t\t\t\thideCancelButton\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t</>\n\t);\n};\n\nexport default VideoSettings;\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAF,OAAA;AAAoE,IAAAG,WAAA,GAAAH,OAAA;AATpE;AACA;AACA;;AASA,MAAMI,OAAO,GAAG,CACf;EAAEC,KAAK,EAAE,MAAM;EAAEC,KAAK,EAAE,IAAAC,QAAE,EAAE,MAAO;AAAE,CAAC,EACtC;EAAEF,KAAK,EAAE,UAAU;EAAEC,KAAK,EAAE,IAAAC,QAAE,EAAE,UAAW;AAAE,CAAC,EAC9C;EAAEF,KAAK,EAAE,MAAM;EAAEC,KAAK,EAAE,IAAAE,QAAE,EAAE,MAAM,EAAE,eAAgB;AAAE,CAAC,CACvD;AAED,MAAMC,aAAa,GAAGA,CAAE;EAAEC,aAAa;EAAEC;AAAW,CAAC,KAAM;EAC1D,MAAM;IAAEC,QAAQ;IAAEC,QAAQ;IAAEC,IAAI;IAAEC,KAAK;IAAEC,WAAW;IAAEC;EAAQ,CAAC,GAC9DN,UAAU;EAEX,MAAMO,gBAAgB,GAAG,IAAAX,QAAE,EAC1B,qDACD,CAAC;EACD,MAAMY,eAAe,GAAGC,iBAAQ,CAACC,MAAM,CAAE;IACxCC,GAAG,EAAE,IAAAC,oBAAW,EAAIC,OAAO,IAAM;MAChC,OAAOA,OAAO,GAAGN,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AAA,CAAAgC,GAAA,EAAClC,WAAA,CAAAmC,4BAAc;MACd9B,KAAK,EAAG,IAAAC,QAAE,EAAE,mBAAoB,CAAG;MACnC8B,gBAAgB;MAChBC,QAAQ,EAAGA,CAAA,KAAM,CAAEzB,QAAU;MAC7B0B,UAAU,EAAGA,CAAA,KAAM;QAClB7B,aAAa,CAAE;UAAEG,QAAQ,EAAE;QAAK,CAAE,CAAC;MACpC,CAAG;MAAAqB,QAAA,eAEH,IAAA/B,WAAA,CAAAgC,GAAA,EAAClC,WAAA,CAAAuC,aAAa;QACbC,uBAAuB;QACvBnC,KAAK,EAAG,IAAAC,QAAE,EAAE,mBAAoB,CAAG;QACnCmC,QAAQ,EAAGhB,aAAa,CAACb,QAAU;QACnCW,OAAO,EAAG,CAAC,CAAEX;MAAU,CACvB;IAAC,CACa,CAAC,eACjB,IAAAV,WAAA,CAAAgC,GAAA,EAAClC,WAAA,CAAAmC,4BAAc;MACd9B,KAAK,EAAG,IAAAC,QAAE,EAAE,aAAc,CAAG;MAC7B8B,gBAAgB;MAChBC,QAAQ,EAAGA,CAAA,KAAM,CAAC,CAAEtB,WAAa;MACjCuB,UAAU,EAAGA,CAAA,KAAM;QAClB7B,aAAa,CAAE;UAAEM,WAAW,EAAE;QAAM,CAAE,CAAC;MACxC,CAAG;MAAAkB,QAAA,eAEH,IAAA/B,WAAA,CAAAgC,GAAA,EAAClC,WAAA,CAAAuC,aAAa;QACbC,uBAAuB;QACvB;QACAnC,KAAK,EAAG,IAAAC,QAAE,EAAE,aAAc,CAAG;QAC7BmC,QAAQ,EAAGhB,aAAa,CAACV,WAAa;QACtCQ,OAAO,
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_element","_jsxRuntime","options","value","label","__","_x","VideoSettings","setAttributes","attributes","autoplay","controls","loop","muted","playsInline","preload","autoPlayHelpText","getAutoplayHelp","Platform","select","web","useCallback","checked","native","toggleFactory","useMemo","toggleAttribute","attribute","newValue","onChangePreload","jsxs","Fragment","children","jsx","__experimentalToolsPanelItem","isShownByDefault","hasValue","onDeselect","ToggleControl","__nextHasNoMarginBottom","onChange","help","SelectControl","__next40pxDefaultSize","hideCancelButton","_default","exports","default"],"sources":["@wordpress/block-library/src/video/edit-common-settings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tToggleControl,\n\tSelectControl,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useMemo, useCallback, Platform } from '@wordpress/element';\n\nconst options = [\n\t{ value: 'auto', label: __( 'Auto' ) },\n\t{ value: 'metadata', label: __( 'Metadata' ) },\n\t{ value: 'none', label: _x( 'None', 'Preload value' ) },\n];\n\nconst VideoSettings = ( { setAttributes, attributes } ) => {\n\tconst { autoplay, controls, loop, muted, playsInline, preload } =\n\t\tattributes;\n\n\tconst autoPlayHelpText = __(\n\t\t'Autoplay may cause usability issues for some users.'\n\t);\n\tconst getAutoplayHelp = Platform.select( {\n\t\tweb: useCallback( ( checked ) => {\n\t\t\treturn checked ? autoPlayHelpText : null;\n\t\t}, [] ),\n\t\tnative: autoPlayHelpText,\n\t} );\n\n\tconst toggleFactory = useMemo( () => {\n\t\tconst toggleAttribute = ( attribute ) => {\n\t\t\treturn ( newValue ) => {\n\t\t\t\tsetAttributes( { [ attribute ]: newValue } );\n\t\t\t};\n\t\t};\n\n\t\treturn {\n\t\t\tautoplay: toggleAttribute( 'autoplay' ),\n\t\t\tloop: toggleAttribute( 'loop' ),\n\t\t\tmuted: toggleAttribute( 'muted' ),\n\t\t\tcontrols: toggleAttribute( 'controls' ),\n\t\t\tplaysInline: toggleAttribute( 'playsInline' ),\n\t\t};\n\t}, [] );\n\n\tconst onChangePreload = useCallback( ( value ) => {\n\t\tsetAttributes( { preload: value } );\n\t}, [] );\n\n\treturn (\n\t\t<>\n\t\t\t<ToolsPanelItem\n\t\t\t\tlabel={ __( 'Autoplay' ) }\n\t\t\t\tisShownByDefault\n\t\t\t\thasValue={ () => !! autoplay }\n\t\t\t\tonDeselect={ () => {\n\t\t\t\t\tsetAttributes( { autoplay: false } );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<ToggleControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Autoplay' ) }\n\t\t\t\t\tonChange={ toggleFactory.autoplay }\n\t\t\t\t\tchecked={ !! autoplay }\n\t\t\t\t\thelp={ getAutoplayHelp }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t\t<ToolsPanelItem\n\t\t\t\tlabel={ __( 'Loop' ) }\n\t\t\t\tisShownByDefault\n\t\t\t\thasValue={ () => !! loop }\n\t\t\t\tonDeselect={ () => {\n\t\t\t\t\tsetAttributes( { loop: false } );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<ToggleControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Loop' ) }\n\t\t\t\t\tonChange={ toggleFactory.loop }\n\t\t\t\t\tchecked={ !! loop }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t\t<ToolsPanelItem\n\t\t\t\tlabel={ __( 'Muted' ) }\n\t\t\t\tisShownByDefault\n\t\t\t\thasValue={ () => !! muted }\n\t\t\t\tonDeselect={ () => {\n\t\t\t\t\tsetAttributes( { muted: false } );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<ToggleControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Muted' ) }\n\t\t\t\t\tonChange={ toggleFactory.muted }\n\t\t\t\t\tchecked={ !! muted }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t\t<ToolsPanelItem\n\t\t\t\tlabel={ __( 'Playback controls' ) }\n\t\t\t\tisShownByDefault\n\t\t\t\thasValue={ () => ! controls }\n\t\t\t\tonDeselect={ () => {\n\t\t\t\t\tsetAttributes( { controls: true } );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<ToggleControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Playback controls' ) }\n\t\t\t\t\tonChange={ toggleFactory.controls }\n\t\t\t\t\tchecked={ !! controls }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t\t<ToolsPanelItem\n\t\t\t\tlabel={ __( 'Play inline' ) }\n\t\t\t\tisShownByDefault\n\t\t\t\thasValue={ () => !! playsInline }\n\t\t\t\tonDeselect={ () => {\n\t\t\t\t\tsetAttributes( { playsInline: false } );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<ToggleControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/* translators: Setting to play videos within the webpage on mobile browsers rather than opening in a fullscreen player. */\n\t\t\t\t\tlabel={ __( 'Play inline' ) }\n\t\t\t\t\tonChange={ toggleFactory.playsInline }\n\t\t\t\t\tchecked={ !! playsInline }\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'When enabled, videos will play directly within the webpage on mobile browsers, instead of opening in a fullscreen player.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t\t<ToolsPanelItem\n\t\t\t\tlabel={ __( 'Preload' ) }\n\t\t\t\tisShownByDefault\n\t\t\t\thasValue={ () => preload !== 'metadata' }\n\t\t\t\tonDeselect={ () => {\n\t\t\t\t\tsetAttributes( { preload: 'metadata' } );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<SelectControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Preload' ) }\n\t\t\t\t\tvalue={ preload }\n\t\t\t\t\tonChange={ onChangePreload }\n\t\t\t\t\toptions={ options }\n\t\t\t\t\thideCancelButton\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t</>\n\t);\n};\n\nexport default VideoSettings;\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAA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MAAA,CAChB;IAAC,CACa,CAAC;EAAA,CAChB,CAAC;AAEL,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaxC,aAAa","ignoreList":[]}
|
|
@@ -53,7 +53,7 @@ class VideoEdit extends _element.Component {
|
|
|
53
53
|
this.finishMediaUploadWithFailure = this.finishMediaUploadWithFailure.bind(this);
|
|
54
54
|
this.updateMediaProgress = this.updateMediaProgress.bind(this);
|
|
55
55
|
this.onVideoPressed = this.onVideoPressed.bind(this);
|
|
56
|
-
this.
|
|
56
|
+
this.onVideoContainerLayout = this.onVideoContainerLayout.bind(this);
|
|
57
57
|
this.onFocusCaption = this.onFocusCaption.bind(this);
|
|
58
58
|
}
|
|
59
59
|
componentDidMount() {
|
|
@@ -185,7 +185,7 @@ class VideoEdit extends _element.Component {
|
|
|
185
185
|
createErrorNotice((0, _i18n.__)('Invalid URL.'));
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
|
|
188
|
+
onVideoContainerLayout(event) {
|
|
189
189
|
const {
|
|
190
190
|
width
|
|
191
191
|
} = event.nativeEvent.layout;
|
|
@@ -305,7 +305,7 @@ class VideoEdit extends _element.Component {
|
|
|
305
305
|
};
|
|
306
306
|
const containerStyle = showVideo && isSelected ? _style.default.containerFocused : _style.default.container;
|
|
307
307
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
308
|
-
onLayout: this.
|
|
308
|
+
onLayout: this.onVideoContainerLayout,
|
|
309
309
|
style: containerStyle,
|
|
310
310
|
children: [showVideo && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
311
311
|
style: _style.default.videoContainer,
|