@wordpress/block-library 10.0.1 → 10.1.1-next.v.202607070741.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 +11 -0
- package/build/accordion/edit.cjs +0 -1
- package/build/accordion/edit.cjs.map +2 -2
- package/build/accordion/view.cjs +23 -0
- package/build/accordion/view.cjs.map +2 -2
- package/build/accordion-heading/deprecated.cjs +121 -1
- package/build/accordion-heading/deprecated.cjs.map +2 -2
- package/build/accordion-heading/edit.cjs +18 -1
- package/build/accordion-heading/edit.cjs.map +3 -3
- package/build/accordion-heading/save.cjs +18 -1
- package/build/accordion-heading/save.cjs.map +3 -3
- package/build/accordion-panel/edit.cjs +1 -1
- package/build/accordion-panel/edit.cjs.map +2 -2
- package/build/archives/edit.cjs +0 -1
- package/build/archives/edit.cjs.map +2 -2
- package/build/audio/edit.cjs +0 -1
- package/build/audio/edit.cjs.map +2 -2
- package/build/avatar/edit.cjs +0 -1
- package/build/avatar/edit.cjs.map +2 -2
- package/build/avatar/user-control.cjs +0 -1
- package/build/avatar/user-control.cjs.map +2 -2
- package/build/categories/edit.cjs +0 -1
- package/build/categories/edit.cjs.map +2 -2
- package/build/code/transforms.cjs +5 -3
- package/build/code/transforms.cjs.map +2 -2
- package/build/column/edit.cjs +0 -1
- package/build/column/edit.cjs.map +2 -2
- package/build/columns/edit.cjs +0 -1
- package/build/columns/edit.cjs.map +2 -2
- package/build/columns/transforms.cjs +9 -2
- package/build/columns/transforms.cjs.map +2 -2
- package/build/comment-author-avatar/edit.cjs +0 -1
- package/build/comment-author-avatar/edit.cjs.map +2 -2
- package/build/comments-pagination/comments-pagination-arrow-controls.cjs +0 -1
- package/build/comments-pagination/comments-pagination-arrow-controls.cjs.map +2 -2
- package/build/cover/edit/inspector-controls.cjs +1 -3
- package/build/cover/edit/inspector-controls.cjs.map +2 -2
- package/build/details/transforms.cjs +3 -1
- package/build/details/transforms.cjs.map +2 -2
- package/build/embed/edit.cjs +2 -3
- package/build/embed/edit.cjs.map +2 -2
- package/build/embed/embed-placeholder.cjs +20 -20
- package/build/embed/embed-placeholder.cjs.map +3 -3
- package/build/file/inspector.cjs +0 -2
- package/build/file/inspector.cjs.map +2 -2
- package/build/form/edit.cjs +0 -2
- package/build/form/edit.cjs.map +2 -2
- package/build/freeform/convert-to-blocks-button.cjs +52 -0
- package/build/freeform/convert-to-blocks-button.cjs.map +7 -0
- package/build/freeform/edit.cjs +14 -33
- package/build/freeform/edit.cjs.map +3 -3
- package/build/freeform/index.cjs +1 -7
- package/build/freeform/index.cjs.map +3 -3
- package/build/gallery/block.json +4 -1
- package/build/gallery/dynamic-gallery.cjs +263 -0
- package/build/gallery/dynamic-gallery.cjs.map +7 -0
- package/build/gallery/dynamic-source.cjs +85 -0
- package/build/gallery/dynamic-source.cjs.map +7 -0
- package/build/gallery/edit.cjs +285 -205
- package/build/gallery/edit.cjs.map +3 -3
- package/build/gallery/gallery.cjs +0 -3
- package/build/gallery/gallery.cjs.map +2 -2
- package/build/gallery/index.cjs +2 -0
- package/build/gallery/index.cjs.map +3 -3
- package/build/gallery/save.cjs +16 -12
- package/build/gallery/save.cjs.map +2 -2
- package/build/gallery/use-dynamic-gallery.cjs +181 -0
- package/build/gallery/use-dynamic-gallery.cjs.map +7 -0
- package/build/gallery/variations.cjs +54 -0
- package/build/gallery/variations.cjs.map +7 -0
- package/build/group/edit.cjs +1 -2
- package/build/group/edit.cjs.map +2 -2
- package/build/group/transforms.cjs +3 -7
- package/build/group/transforms.cjs.map +2 -2
- package/build/heading/edit.cjs +10 -3
- package/build/heading/edit.cjs.map +2 -2
- package/build/html/block.json +2 -2
- package/build/html/edit.cjs +65 -23
- package/build/html/edit.cjs.map +3 -3
- package/build/html/index.cjs +3 -3
- package/build/html/index.cjs.map +2 -2
- package/build/html/modal.cjs +4 -8
- package/build/html/modal.cjs.map +2 -2
- package/build/html/save.cjs +2 -4
- package/build/html/save.cjs.map +2 -2
- package/build/html/transforms.cjs +7 -5
- package/build/html/transforms.cjs.map +2 -2
- package/build/image/animated-gif-convert-control.cjs +105 -0
- package/build/image/animated-gif-convert-control.cjs.map +7 -0
- package/build/image/edit.cjs +34 -0
- package/build/image/edit.cjs.map +2 -2
- package/build/image/image.cjs +38 -66
- package/build/image/image.cjs.map +3 -3
- package/build/index.cjs.map +2 -2
- package/build/latest-comments/edit.cjs +0 -2
- package/build/latest-comments/edit.cjs.map +2 -2
- package/build/latest-posts/block.json +8 -9
- package/build/latest-posts/constants.cjs +0 -3
- package/build/latest-posts/constants.cjs.map +2 -2
- package/build/latest-posts/deprecated.cjs +100 -8
- package/build/latest-posts/deprecated.cjs.map +2 -2
- package/build/latest-posts/edit.cjs +62 -76
- package/build/latest-posts/edit.cjs.map +2 -2
- package/build/list/ordered-list-settings.cjs +0 -1
- package/build/list/ordered-list-settings.cjs.map +2 -2
- package/build/media-text/edit.cjs +0 -1
- package/build/media-text/edit.cjs.map +2 -2
- package/build/missing/edit.cjs +1 -3
- package/build/missing/edit.cjs.map +2 -2
- package/build/navigation/edit/index.cjs +0 -1
- package/build/navigation/edit/index.cjs.map +2 -2
- package/build/navigation/edit/overlay-menu-preview-controls.cjs +0 -1
- package/build/navigation/edit/overlay-menu-preview-controls.cjs.map +2 -2
- package/build/navigation/edit/overlay-menu-preview.cjs +0 -1
- package/build/navigation/edit/overlay-menu-preview.cjs.map +2 -2
- package/build/navigation/edit/overlay-template-part-selector.cjs +0 -1
- package/build/navigation/edit/overlay-template-part-selector.cjs.map +2 -2
- package/build/navigation/edit/overlay-visibility-control.cjs +0 -1
- package/build/navigation/edit/overlay-visibility-control.cjs.map +2 -2
- package/build/navigation-link/shared/use-link-preview.cjs +11 -1
- package/build/navigation-link/shared/use-link-preview.cjs.map +2 -2
- package/build/navigation-overlay-close/edit.cjs +0 -1
- package/build/navigation-overlay-close/edit.cjs.map +2 -2
- package/build/page-list/edit.cjs +0 -1
- package/build/page-list/edit.cjs.map +2 -2
- package/build/playlist/block.json +1 -7
- package/build/playlist/context.cjs +36 -0
- package/build/playlist/context.cjs.map +7 -0
- package/build/playlist/edit.cjs +43 -69
- package/build/playlist/edit.cjs.map +3 -3
- package/build/playlist/utils.cjs +0 -3
- package/build/playlist/utils.cjs.map +3 -3
- package/build/playlist/view.cjs +4 -4
- package/build/playlist/view.cjs.map +2 -2
- package/build/playlist-track/block.json +1 -4
- package/build/playlist-track/edit.cjs +22 -8
- package/build/playlist-track/edit.cjs.map +3 -3
- package/build/post-author/edit.cjs +0 -2
- package/build/post-author/edit.cjs.map +2 -2
- package/build/post-excerpt/edit.cjs +0 -1
- package/build/post-excerpt/edit.cjs.map +2 -2
- package/build/post-featured-image/overlay-controls.cjs +1 -2
- package/build/post-featured-image/overlay-controls.cjs.map +2 -2
- package/build/post-navigation-link/edit.cjs +0 -2
- package/build/post-navigation-link/edit.cjs.map +2 -2
- package/build/query/edit/inspector-controls/author-control.cjs +1 -2
- package/build/query/edit/inspector-controls/author-control.cjs.map +2 -2
- package/build/query/edit/inspector-controls/format-controls.cjs +1 -2
- package/build/query/edit/inspector-controls/format-controls.cjs.map +2 -2
- package/build/query/edit/inspector-controls/index.cjs +0 -3
- package/build/query/edit/inspector-controls/index.cjs.map +2 -2
- package/build/query/edit/inspector-controls/order-control.cjs +0 -1
- package/build/query/edit/inspector-controls/order-control.cjs.map +2 -2
- package/build/query/edit/inspector-controls/parent-control.cjs +0 -1
- package/build/query/edit/inspector-controls/parent-control.cjs.map +2 -2
- package/build/query/edit/inspector-controls/per-page-control.cjs +0 -1
- package/build/query/edit/inspector-controls/per-page-control.cjs.map +2 -2
- package/build/query/edit/inspector-controls/sticky-control.cjs +0 -1
- package/build/query/edit/inspector-controls/sticky-control.cjs.map +2 -2
- package/build/query/edit/inspector-controls/taxonomy-controls.cjs +1 -2
- package/build/query/edit/inspector-controls/taxonomy-controls.cjs.map +2 -2
- package/build/query-pagination/query-pagination-arrow-controls.cjs +0 -1
- package/build/query-pagination/query-pagination-arrow-controls.cjs.map +2 -2
- package/build/query-pagination-numbers/edit.cjs +0 -1
- package/build/query-pagination-numbers/edit.cjs.map +2 -2
- package/build/quote/transforms.cjs +1 -5
- package/build/quote/transforms.cjs.map +2 -2
- package/build/rss/edit.cjs +0 -3
- package/build/rss/edit.cjs.map +2 -2
- package/build/search/edit.cjs +0 -4
- package/build/search/edit.cjs.map +2 -2
- package/build/separator/edit.cjs +1 -2
- package/build/separator/edit.cjs.map +2 -2
- package/build/site-logo/edit.cjs +34 -63
- package/build/site-logo/edit.cjs.map +3 -3
- package/build/social-links/edit.cjs +0 -1
- package/build/social-links/edit.cjs.map +2 -2
- package/build/spacer/controls.cjs +2 -4
- package/build/spacer/controls.cjs.map +2 -2
- package/build/spacer/edit.cjs +1 -2
- package/build/spacer/edit.cjs.map +2 -2
- package/build/tab-list/block.json +3 -2
- package/build/tab-list/edit.cjs +38 -51
- package/build/tab-list/edit.cjs.map +3 -3
- package/build/tab-list/save.cjs +4 -3
- package/build/tab-list/save.cjs.map +2 -2
- package/build/tab-panel/controls.cjs +2 -4
- package/build/tab-panel/controls.cjs.map +3 -3
- package/build/tab-panels/edit.cjs +2 -4
- package/build/tab-panels/edit.cjs.map +3 -3
- package/build/table-of-contents/edit.cjs +0 -1
- package/build/table-of-contents/edit.cjs.map +2 -2
- package/build/tabs/edit.cjs +2 -2
- package/build/tabs/edit.cjs.map +3 -3
- package/build/tabs/tab-toolbar-controls.cjs +74 -0
- package/build/tabs/tab-toolbar-controls.cjs.map +7 -0
- package/build/tabs/use-tab-actions.cjs +87 -0
- package/build/tabs/use-tab-actions.cjs.map +7 -0
- package/build/tabs/use-tab-list-items-sync.cjs +4 -4
- package/build/tabs/use-tab-list-items-sync.cjs.map +2 -2
- package/build/tag-cloud/edit.cjs +2 -6
- package/build/tag-cloud/edit.cjs.map +2 -2
- package/build/template-part/edit/advanced-controls.cjs +0 -1
- package/build/template-part/edit/advanced-controls.cjs.map +2 -2
- package/build/template-part/edit/import-controls.cjs +1 -2
- package/build/template-part/edit/import-controls.cjs.map +2 -2
- package/build/terms-query/edit/inspector-controls/include-control.cjs +0 -1
- package/build/terms-query/edit/inspector-controls/include-control.cjs.map +2 -2
- package/build/terms-query/edit/inspector-controls/inherit-control.cjs +0 -1
- package/build/terms-query/edit/inspector-controls/inherit-control.cjs.map +2 -2
- package/build/terms-query/edit/inspector-controls/max-terms-control.cjs +0 -1
- package/build/terms-query/edit/inspector-controls/max-terms-control.cjs.map +2 -2
- package/build/terms-query/edit/inspector-controls/order-control.cjs +0 -1
- package/build/terms-query/edit/inspector-controls/order-control.cjs.map +2 -2
- package/build/terms-query/edit/inspector-controls/taxonomy-control.cjs +0 -1
- package/build/terms-query/edit/inspector-controls/taxonomy-control.cjs.map +2 -2
- package/build/text-columns/edit.cjs +0 -1
- package/build/text-columns/edit.cjs.map +2 -2
- package/build/utils/gif-conversion-attributes.cjs +40 -0
- package/build/utils/gif-conversion-attributes.cjs.map +7 -0
- package/build/verse/block.json +3 -1
- package/build/video/block.json +6 -0
- package/build/video/edit-common-settings.cjs +0 -1
- package/build/video/edit-common-settings.cjs.map +2 -2
- package/build/video/edit.cjs +28 -3
- package/build/video/edit.cjs.map +3 -3
- package/build/video/gif-restore-control.cjs +73 -0
- package/build/video/gif-restore-control.cjs.map +7 -0
- package/build/video/index.cjs +2 -0
- package/build/video/index.cjs.map +3 -3
- package/build/video/save.cjs +7 -1
- package/build/video/save.cjs.map +2 -2
- package/build/video/tracks-editor.cjs +0 -1
- package/build/video/tracks-editor.cjs.map +2 -2
- package/build/video/variations.cjs +75 -0
- package/build/video/variations.cjs.map +7 -0
- package/build-module/accordion/edit.mjs +0 -1
- package/build-module/accordion/edit.mjs.map +2 -2
- package/build-module/accordion/view.mjs +23 -0
- package/build-module/accordion/view.mjs.map +2 -2
- package/build-module/accordion-heading/deprecated.mjs +121 -1
- package/build-module/accordion-heading/deprecated.mjs.map +2 -2
- package/build-module/accordion-heading/edit.mjs +8 -1
- package/build-module/accordion-heading/edit.mjs.map +2 -2
- package/build-module/accordion-heading/save.mjs +8 -1
- package/build-module/accordion-heading/save.mjs.map +2 -2
- package/build-module/accordion-panel/edit.mjs +1 -1
- package/build-module/accordion-panel/edit.mjs.map +2 -2
- package/build-module/archives/edit.mjs +0 -1
- package/build-module/archives/edit.mjs.map +2 -2
- package/build-module/audio/edit.mjs +0 -1
- package/build-module/audio/edit.mjs.map +2 -2
- package/build-module/avatar/edit.mjs +0 -1
- package/build-module/avatar/edit.mjs.map +2 -2
- package/build-module/avatar/user-control.mjs +0 -1
- package/build-module/avatar/user-control.mjs.map +2 -2
- package/build-module/categories/edit.mjs +0 -1
- package/build-module/categories/edit.mjs.map +2 -2
- package/build-module/code/transforms.mjs +6 -4
- package/build-module/code/transforms.mjs.map +2 -2
- package/build-module/column/edit.mjs +0 -1
- package/build-module/column/edit.mjs.map +2 -2
- package/build-module/columns/edit.mjs +0 -1
- package/build-module/columns/edit.mjs.map +2 -2
- package/build-module/columns/transforms.mjs +9 -2
- package/build-module/columns/transforms.mjs.map +2 -2
- package/build-module/comment-author-avatar/edit.mjs +0 -1
- package/build-module/comment-author-avatar/edit.mjs.map +2 -2
- package/build-module/comments-pagination/comments-pagination-arrow-controls.mjs +0 -1
- package/build-module/comments-pagination/comments-pagination-arrow-controls.mjs.map +2 -2
- package/build-module/cover/edit/inspector-controls.mjs +1 -3
- package/build-module/cover/edit/inspector-controls.mjs.map +2 -2
- package/build-module/details/transforms.mjs +7 -2
- package/build-module/details/transforms.mjs.map +2 -2
- package/build-module/embed/edit.mjs +2 -3
- package/build-module/embed/edit.mjs.map +2 -2
- package/build-module/embed/embed-placeholder.mjs +20 -23
- package/build-module/embed/embed-placeholder.mjs.map +2 -2
- package/build-module/file/inspector.mjs +0 -2
- package/build-module/file/inspector.mjs.map +2 -2
- package/build-module/form/edit.mjs +0 -2
- package/build-module/form/edit.mjs.map +2 -2
- package/build-module/freeform/convert-to-blocks-button.mjs +31 -0
- package/build-module/freeform/convert-to-blocks-button.mjs.map +7 -0
- package/build-module/freeform/edit.mjs +15 -34
- package/build-module/freeform/edit.mjs.map +2 -2
- package/build-module/freeform/index.mjs +1 -7
- package/build-module/freeform/index.mjs.map +2 -2
- package/build-module/gallery/block.json +4 -1
- package/build-module/gallery/dynamic-gallery.mjs +253 -0
- package/build-module/gallery/dynamic-gallery.mjs.map +7 -0
- package/build-module/gallery/dynamic-source.mjs +55 -0
- package/build-module/gallery/dynamic-source.mjs.map +7 -0
- package/build-module/gallery/edit.mjs +288 -206
- package/build-module/gallery/edit.mjs.map +2 -2
- package/build-module/gallery/gallery.mjs +0 -3
- package/build-module/gallery/gallery.mjs.map +2 -2
- package/build-module/gallery/index.mjs +2 -0
- package/build-module/gallery/index.mjs.map +2 -2
- package/build-module/gallery/save.mjs +16 -12
- package/build-module/gallery/save.mjs.map +2 -2
- package/build-module/gallery/use-dynamic-gallery.mjs +167 -0
- package/build-module/gallery/use-dynamic-gallery.mjs.map +7 -0
- package/build-module/gallery/variations.mjs +33 -0
- package/build-module/gallery/variations.mjs.map +7 -0
- package/build-module/group/edit.mjs +1 -2
- package/build-module/group/edit.mjs.map +2 -2
- package/build-module/group/transforms.mjs +7 -8
- package/build-module/group/transforms.mjs.map +2 -2
- package/build-module/heading/edit.mjs +11 -4
- package/build-module/heading/edit.mjs.map +2 -2
- package/build-module/html/block.json +2 -2
- package/build-module/html/edit.mjs +69 -25
- package/build-module/html/edit.mjs.map +2 -2
- package/build-module/html/index.mjs +3 -3
- package/build-module/html/index.mjs.map +2 -2
- package/build-module/html/modal.mjs +4 -8
- package/build-module/html/modal.mjs.map +2 -2
- package/build-module/html/save.mjs +2 -4
- package/build-module/html/save.mjs.map +2 -2
- package/build-module/html/transforms.mjs +8 -6
- package/build-module/html/transforms.mjs.map +2 -2
- package/build-module/image/animated-gif-convert-control.mjs +87 -0
- package/build-module/image/animated-gif-convert-control.mjs.map +7 -0
- package/build-module/image/edit.mjs +34 -0
- package/build-module/image/edit.mjs.map +2 -2
- package/build-module/image/image.mjs +28 -67
- package/build-module/image/image.mjs.map +2 -2
- package/build-module/index.mjs.map +2 -2
- package/build-module/latest-comments/edit.mjs +0 -2
- package/build-module/latest-comments/edit.mjs.map +2 -2
- package/build-module/latest-posts/block.json +8 -9
- package/build-module/latest-posts/constants.mjs +0 -2
- package/build-module/latest-posts/constants.mjs.map +2 -2
- package/build-module/latest-posts/deprecated.mjs +100 -8
- package/build-module/latest-posts/deprecated.mjs.map +2 -2
- package/build-module/latest-posts/edit.mjs +62 -77
- package/build-module/latest-posts/edit.mjs.map +2 -2
- package/build-module/list/ordered-list-settings.mjs +0 -1
- package/build-module/list/ordered-list-settings.mjs.map +2 -2
- package/build-module/media-text/edit.mjs +0 -1
- package/build-module/media-text/edit.mjs.map +2 -2
- package/build-module/missing/edit.mjs +1 -3
- package/build-module/missing/edit.mjs.map +2 -2
- package/build-module/navigation/edit/index.mjs +0 -1
- package/build-module/navigation/edit/index.mjs.map +2 -2
- package/build-module/navigation/edit/overlay-menu-preview-controls.mjs +0 -1
- package/build-module/navigation/edit/overlay-menu-preview-controls.mjs.map +2 -2
- package/build-module/navigation/edit/overlay-menu-preview.mjs +0 -1
- package/build-module/navigation/edit/overlay-menu-preview.mjs.map +2 -2
- package/build-module/navigation/edit/overlay-template-part-selector.mjs +0 -1
- package/build-module/navigation/edit/overlay-template-part-selector.mjs.map +2 -2
- package/build-module/navigation/edit/overlay-visibility-control.mjs +0 -1
- package/build-module/navigation/edit/overlay-visibility-control.mjs.map +2 -2
- package/build-module/navigation-link/shared/use-link-preview.mjs +11 -1
- package/build-module/navigation-link/shared/use-link-preview.mjs.map +2 -2
- package/build-module/navigation-overlay-close/edit.mjs +0 -1
- package/build-module/navigation-overlay-close/edit.mjs.map +2 -2
- package/build-module/page-list/edit.mjs +0 -1
- package/build-module/page-list/edit.mjs.map +2 -2
- package/build-module/playlist/block.json +1 -7
- package/build-module/playlist/context.mjs +11 -0
- package/build-module/playlist/context.mjs.map +7 -0
- package/build-module/playlist/edit.mjs +44 -70
- package/build-module/playlist/edit.mjs.map +2 -2
- package/build-module/playlist/utils.mjs +0 -3
- package/build-module/playlist/utils.mjs.map +2 -2
- package/build-module/playlist/view.mjs +4 -4
- package/build-module/playlist/view.mjs.map +2 -2
- package/build-module/playlist-track/block.json +1 -4
- package/build-module/playlist-track/edit.mjs +23 -9
- package/build-module/playlist-track/edit.mjs.map +2 -2
- package/build-module/post-author/edit.mjs +0 -2
- package/build-module/post-author/edit.mjs.map +2 -2
- package/build-module/post-excerpt/edit.mjs +0 -1
- package/build-module/post-excerpt/edit.mjs.map +2 -2
- package/build-module/post-featured-image/overlay-controls.mjs +1 -2
- package/build-module/post-featured-image/overlay-controls.mjs.map +2 -2
- package/build-module/post-navigation-link/edit.mjs +0 -2
- package/build-module/post-navigation-link/edit.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/author-control.mjs +1 -2
- package/build-module/query/edit/inspector-controls/author-control.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/format-controls.mjs +1 -2
- package/build-module/query/edit/inspector-controls/format-controls.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/index.mjs +0 -3
- package/build-module/query/edit/inspector-controls/index.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/order-control.mjs +0 -1
- package/build-module/query/edit/inspector-controls/order-control.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/parent-control.mjs +0 -1
- package/build-module/query/edit/inspector-controls/parent-control.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/per-page-control.mjs +0 -1
- package/build-module/query/edit/inspector-controls/per-page-control.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/sticky-control.mjs +0 -1
- package/build-module/query/edit/inspector-controls/sticky-control.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/taxonomy-controls.mjs +1 -2
- package/build-module/query/edit/inspector-controls/taxonomy-controls.mjs.map +2 -2
- package/build-module/query-pagination/query-pagination-arrow-controls.mjs +0 -1
- package/build-module/query-pagination/query-pagination-arrow-controls.mjs.map +2 -2
- package/build-module/query-pagination-numbers/edit.mjs +0 -1
- package/build-module/query-pagination-numbers/edit.mjs.map +2 -2
- package/build-module/quote/transforms.mjs +6 -6
- package/build-module/quote/transforms.mjs.map +2 -2
- package/build-module/rss/edit.mjs +0 -3
- package/build-module/rss/edit.mjs.map +2 -2
- package/build-module/search/edit.mjs +0 -4
- package/build-module/search/edit.mjs.map +2 -2
- package/build-module/separator/edit.mjs +1 -2
- package/build-module/separator/edit.mjs.map +2 -2
- package/build-module/site-logo/edit.mjs +34 -64
- package/build-module/site-logo/edit.mjs.map +2 -2
- package/build-module/social-links/edit.mjs +0 -1
- package/build-module/social-links/edit.mjs.map +2 -2
- package/build-module/spacer/controls.mjs +2 -4
- package/build-module/spacer/controls.mjs.map +2 -2
- package/build-module/spacer/edit.mjs +1 -2
- package/build-module/spacer/edit.mjs.map +2 -2
- package/build-module/tab-list/block.json +3 -2
- package/build-module/tab-list/edit.mjs +39 -52
- package/build-module/tab-list/edit.mjs.map +2 -2
- package/build-module/tab-list/save.mjs +5 -3
- package/build-module/tab-list/save.mjs.map +2 -2
- package/build-module/tab-panel/controls.mjs +2 -4
- package/build-module/tab-panel/controls.mjs.map +2 -2
- package/build-module/tab-panels/edit.mjs +2 -4
- package/build-module/tab-panels/edit.mjs.map +2 -2
- package/build-module/table-of-contents/edit.mjs +0 -1
- package/build-module/table-of-contents/edit.mjs.map +2 -2
- package/build-module/tabs/edit.mjs +2 -2
- package/build-module/tabs/edit.mjs.map +2 -2
- package/build-module/tabs/tab-toolbar-controls.mjs +46 -0
- package/build-module/tabs/tab-toolbar-controls.mjs.map +7 -0
- package/build-module/tabs/use-tab-actions.mjs +66 -0
- package/build-module/tabs/use-tab-actions.mjs.map +7 -0
- package/build-module/tabs/use-tab-list-items-sync.mjs +6 -6
- package/build-module/tabs/use-tab-list-items-sync.mjs.map +2 -2
- package/build-module/tag-cloud/edit.mjs +2 -6
- package/build-module/tag-cloud/edit.mjs.map +2 -2
- package/build-module/template-part/edit/advanced-controls.mjs +0 -1
- package/build-module/template-part/edit/advanced-controls.mjs.map +2 -2
- package/build-module/template-part/edit/import-controls.mjs +1 -2
- package/build-module/template-part/edit/import-controls.mjs.map +2 -2
- package/build-module/terms-query/edit/inspector-controls/include-control.mjs +0 -1
- package/build-module/terms-query/edit/inspector-controls/include-control.mjs.map +2 -2
- package/build-module/terms-query/edit/inspector-controls/inherit-control.mjs +0 -1
- package/build-module/terms-query/edit/inspector-controls/inherit-control.mjs.map +2 -2
- package/build-module/terms-query/edit/inspector-controls/max-terms-control.mjs +0 -1
- package/build-module/terms-query/edit/inspector-controls/max-terms-control.mjs.map +2 -2
- package/build-module/terms-query/edit/inspector-controls/order-control.mjs +0 -1
- package/build-module/terms-query/edit/inspector-controls/order-control.mjs.map +2 -2
- package/build-module/terms-query/edit/inspector-controls/taxonomy-control.mjs +0 -1
- package/build-module/terms-query/edit/inspector-controls/taxonomy-control.mjs.map +2 -2
- package/build-module/text-columns/edit.mjs +0 -1
- package/build-module/text-columns/edit.mjs.map +2 -2
- package/build-module/utils/gif-conversion-attributes.mjs +15 -0
- package/build-module/utils/gif-conversion-attributes.mjs.map +7 -0
- package/build-module/verse/block.json +3 -1
- package/build-module/video/block.json +6 -0
- package/build-module/video/edit-common-settings.mjs +0 -1
- package/build-module/video/edit-common-settings.mjs.map +2 -2
- package/build-module/video/edit.mjs +28 -3
- package/build-module/video/edit.mjs.map +2 -2
- package/build-module/video/gif-restore-control.mjs +55 -0
- package/build-module/video/gif-restore-control.mjs.map +7 -0
- package/build-module/video/index.mjs +2 -0
- package/build-module/video/index.mjs.map +2 -2
- package/build-module/video/save.mjs +7 -1
- package/build-module/video/save.mjs.map +2 -2
- package/build-module/video/tracks-editor.mjs +0 -1
- package/build-module/video/tracks-editor.mjs.map +2 -2
- package/build-module/video/variations.mjs +50 -0
- package/build-module/video/variations.mjs.map +7 -0
- package/build-style/accordion-panel/style-rtl.css +1 -2
- package/build-style/accordion-panel/style.css +1 -2
- package/build-style/audio/style-rtl.css +6 -0
- package/build-style/audio/style.css +6 -0
- package/build-style/audio/theme-rtl.css +6 -0
- package/build-style/audio/theme.css +6 -0
- package/build-style/columns/style-rtl.css +6 -0
- package/build-style/columns/style.css +6 -0
- package/build-style/common-rtl.css +6 -4
- package/build-style/common.css +6 -4
- package/build-style/editor-rtl.css +38 -3
- package/build-style/editor.css +38 -3
- package/build-style/embed/style-rtl.css +6 -0
- package/build-style/embed/style.css +6 -0
- package/build-style/embed/theme-rtl.css +6 -0
- package/build-style/embed/theme.css +6 -0
- package/build-style/freeform/editor-rtl.css +6 -0
- package/build-style/freeform/editor.css +6 -0
- package/build-style/gallery/editor-rtl.css +27 -3
- package/build-style/gallery/editor.css +27 -3
- package/build-style/gallery/style-rtl.css +6 -0
- package/build-style/gallery/style.css +6 -0
- package/build-style/gallery/theme-rtl.css +6 -0
- package/build-style/gallery/theme.css +6 -0
- package/build-style/html/editor-rtl.css +13 -0
- package/build-style/html/editor.css +13 -0
- package/build-style/image/editor-rtl.css +10 -0
- package/build-style/image/editor.css +10 -0
- package/build-style/image/style-rtl.css +6 -1
- package/build-style/image/style.css +6 -1
- package/build-style/image/theme-rtl.css +6 -0
- package/build-style/image/theme.css +6 -0
- package/build-style/latest-posts/style-rtl.css +26 -15
- package/build-style/latest-posts/style.css +26 -15
- package/build-style/navigation/editor-rtl.css +6 -0
- package/build-style/navigation/editor.css +6 -0
- package/build-style/navigation/style-rtl.css +6 -0
- package/build-style/navigation/style.css +6 -0
- package/build-style/navigation-submenu/editor-rtl.css +6 -0
- package/build-style/navigation-submenu/editor.css +6 -0
- package/build-style/page-list/editor-rtl.css +6 -0
- package/build-style/page-list/editor.css +6 -0
- package/build-style/playlist/style-rtl.css +121 -19
- package/build-style/playlist/style.css +121 -19
- package/build-style/post-template/style-rtl.css +6 -0
- package/build-style/post-template/style.css +6 -0
- package/build-style/query/editor-rtl.css +6 -0
- package/build-style/query/editor.css +6 -0
- package/build-style/rss/style-rtl.css +6 -0
- package/build-style/rss/style.css +6 -0
- package/build-style/shortcode/editor-rtl.css +6 -0
- package/build-style/shortcode/editor.css +6 -0
- package/build-style/style-rtl.css +145 -38
- package/build-style/style.css +145 -38
- package/build-style/table/editor-rtl.css +6 -0
- package/build-style/table/editor.css +6 -0
- package/build-style/table/theme-rtl.css +6 -0
- package/build-style/table/theme.css +6 -0
- package/build-style/template-part/editor-rtl.css +6 -0
- package/build-style/template-part/editor.css +6 -0
- package/build-style/theme-rtl.css +6 -0
- package/build-style/theme.css +6 -0
- package/build-style/video/style-rtl.css +6 -0
- package/build-style/video/style.css +6 -0
- package/build-style/video/theme-rtl.css +6 -0
- package/build-style/video/theme.css +6 -0
- package/package.json +43 -41
- package/src/accordion/README.md +1 -1
- package/src/accordion/edit.js +0 -1
- package/src/accordion/view.js +24 -0
- package/src/accordion-heading/README.md +1 -1
- package/src/accordion-heading/deprecated.js +122 -1
- package/src/accordion-heading/edit.js +12 -1
- package/src/accordion-heading/save.js +12 -1
- package/src/accordion-item/README.md +1 -1
- package/src/accordion-item/index.php +2 -1
- package/src/accordion-panel/edit.js +1 -1
- package/src/accordion-panel/style.scss +1 -4
- package/src/archives/edit.js +0 -1
- package/src/audio/edit.js +0 -1
- package/src/avatar/edit.js +0 -1
- package/src/avatar/user-control.js +0 -1
- package/src/categories/edit.js +0 -1
- package/src/code/transforms.js +6 -4
- package/src/column/edit.js +0 -1
- package/src/columns/edit.js +0 -1
- package/src/columns/transforms.js +9 -2
- package/src/comment-author-avatar/edit.js +0 -1
- package/src/comments-pagination/comments-pagination-arrow-controls.js +0 -1
- package/src/common.scss +0 -4
- package/src/cover/edit/inspector-controls.js +0 -2
- package/src/cover/test/edit.js +4 -42
- package/src/details/transforms.js +7 -2
- package/src/embed/edit.js +4 -5
- package/src/embed/embed-placeholder.js +16 -19
- package/src/file/inspector.js +0 -2
- package/src/form/edit.js +0 -2
- package/src/freeform/convert-to-blocks-button.js +33 -0
- package/src/freeform/edit.js +11 -21
- package/src/freeform/index.js +1 -9
- package/src/gallery/README.md +3 -0
- package/src/gallery/block.json +4 -1
- package/src/gallery/dynamic-gallery.js +384 -0
- package/src/gallery/dynamic-source.js +117 -0
- package/src/gallery/edit.js +152 -46
- package/src/gallery/editor.scss +32 -4
- package/src/gallery/gallery.js +0 -7
- package/src/gallery/index.js +2 -0
- package/src/gallery/index.php +277 -0
- package/src/gallery/save.js +22 -11
- package/src/gallery/test/dynamic-source.js +90 -0
- package/src/gallery/use-dynamic-gallery.js +275 -0
- package/src/gallery/variations.js +37 -0
- package/src/group/edit.js +2 -3
- package/src/group/transforms.js +7 -8
- package/src/heading/edit.js +19 -14
- package/src/home-link/index.php +1 -1
- package/src/html/README.md +2 -1
- package/src/html/block.json +2 -2
- package/src/html/edit.js +86 -14
- package/src/html/editor.scss +10 -0
- package/src/html/index.js +3 -4
- package/src/html/modal.js +5 -9
- package/src/html/save.js +4 -7
- package/src/html/test/index.js +143 -0
- package/src/html/transforms.js +11 -6
- package/src/icon/index.php +38 -45
- package/src/image/animated-gif-convert-control.js +135 -0
- package/src/image/edit.js +52 -0
- package/src/image/editor.scss +9 -0
- package/src/image/image.js +121 -180
- package/src/image/style.scss +0 -1
- package/src/image/test/animated-gif-convert-control.js +276 -0
- package/src/image/test/use-open-image-media-editor-modal.js +19 -4
- package/src/index.js +0 -2
- package/src/latest-comments/edit.js +0 -2
- package/src/latest-posts/README.md +2 -2
- package/src/latest-posts/block.json +8 -9
- package/src/latest-posts/constants.js +0 -1
- package/src/latest-posts/deprecated.js +112 -9
- package/src/latest-posts/edit.js +33 -45
- package/src/latest-posts/index.php +14 -3
- package/src/latest-posts/style.scss +12 -2
- package/src/latest-posts/test/deprecated.js +153 -0
- package/src/list/ordered-list-settings.js +0 -1
- package/src/media-text/edit.js +0 -1
- package/src/missing/edit.js +1 -3
- package/src/navigation/edit/index.js +0 -1
- package/src/navigation/edit/overlay-menu-preview-controls.js +0 -1
- package/src/navigation/edit/overlay-menu-preview.js +0 -1
- package/src/navigation/edit/overlay-template-part-selector.js +0 -1
- package/src/navigation/edit/overlay-visibility-control.js +0 -1
- package/src/navigation-link/shared/test/controls.js +0 -4
- package/src/navigation-link/shared/test/use-entity-binding.js +8 -12
- package/src/navigation-link/shared/test/use-handle-link-change.test.js +0 -4
- package/src/navigation-link/shared/test/use-link-preview.test.js +17 -4
- package/src/navigation-link/shared/use-link-preview.js +24 -4
- package/src/navigation-overlay-close/edit.js +0 -1
- package/src/page-list/edit.js +0 -1
- package/src/page-list/index.php +1 -1
- package/src/playlist/README.md +0 -2
- package/src/playlist/block.json +1 -7
- package/src/playlist/context.js +9 -0
- package/src/playlist/edit.js +51 -82
- package/src/playlist/index.php +37 -26
- package/src/playlist/style.scss +0 -5
- package/src/playlist/test/edit.js +0 -10
- package/src/playlist/utils.js +0 -6
- package/src/playlist/view.js +4 -4
- package/src/playlist-track/README.md +0 -2
- package/src/playlist-track/block.json +1 -4
- package/src/playlist-track/edit.js +25 -16
- package/src/playlist-track/index.php +4 -11
- package/src/post-author/edit.js +0 -2
- package/src/post-excerpt/edit.js +0 -1
- package/src/post-featured-image/overlay-controls.js +0 -1
- package/src/post-navigation-link/edit.js +0 -2
- package/src/query/edit/inspector-controls/author-control.js +0 -1
- package/src/query/edit/inspector-controls/format-controls.js +0 -1
- package/src/query/edit/inspector-controls/index.js +0 -3
- package/src/query/edit/inspector-controls/order-control.js +0 -1
- package/src/query/edit/inspector-controls/parent-control.js +0 -1
- package/src/query/edit/inspector-controls/per-page-control.js +0 -1
- package/src/query/edit/inspector-controls/sticky-control.js +0 -1
- package/src/query/edit/inspector-controls/taxonomy-controls.js +0 -1
- package/src/query-pagination/query-pagination-arrow-controls.js +0 -1
- package/src/query-pagination-numbers/edit.js +0 -1
- package/src/quote/transforms.js +6 -6
- package/src/rss/edit.js +0 -3
- package/src/search/edit.js +0 -4
- package/src/separator/edit.js +0 -1
- package/src/site-logo/edit.js +38 -78
- package/src/social-links/edit.js +0 -1
- package/src/spacer/controls.js +2 -4
- package/src/spacer/edit.js +2 -3
- package/src/tab-list/block.json +3 -2
- package/src/tab-list/edit.js +53 -55
- package/src/tab-list/save.js +5 -4
- package/src/tab-panel/controls.js +2 -4
- package/src/tab-panels/edit.js +2 -4
- package/src/table-of-contents/edit.js +0 -1
- package/src/tabs/edit.js +2 -2
- package/src/tabs/tab-toolbar-controls.js +58 -0
- package/src/tabs/use-tab-actions.js +102 -0
- package/src/tabs/use-tab-list-items-sync.js +7 -8
- package/src/tag-cloud/edit.js +0 -4
- package/src/tag-cloud/index.php +1 -1
- package/src/template-part/edit/advanced-controls.js +0 -1
- package/src/template-part/edit/import-controls.js +0 -1
- package/src/terms-query/edit/inspector-controls/include-control.js +0 -1
- package/src/terms-query/edit/inspector-controls/inherit-control.js +0 -1
- package/src/terms-query/edit/inspector-controls/max-terms-control.js +0 -1
- package/src/terms-query/edit/inspector-controls/order-control.js +0 -1
- package/src/terms-query/edit/inspector-controls/taxonomy-control.js +0 -1
- package/src/text-columns/edit.js +0 -1
- package/src/utils/gif-conversion-attributes.js +30 -0
- package/src/utils/test/gif-conversion-attributes.js +60 -0
- package/src/utils/test/waveform-player.js +0 -4
- package/src/utils/test/waveform-utils.js +0 -4
- package/src/verse/README.md +1 -0
- package/src/verse/block.json +3 -1
- package/src/video/README.md +2 -0
- package/src/video/block.json +6 -0
- package/src/video/edit-common-settings.js +0 -1
- package/src/video/edit.js +38 -1
- package/src/video/gif-restore-control.js +92 -0
- package/src/video/index.js +2 -0
- package/src/video/save.js +12 -0
- package/src/video/test/variations.js +65 -0
- package/src/video/tracks-editor.js +0 -1
- package/src/video/variations.js +65 -0
- package/build/freeform/migration-notice.cjs +0 -58
- package/build/freeform/migration-notice.cjs.map +0 -7
- package/build/tab-panel/add-tab-toolbar-control.cjs +0 -90
- package/build/tab-panel/add-tab-toolbar-control.cjs.map +0 -7
- package/build/tab-panel/remove-tab-toolbar-control.cjs +0 -99
- package/build/tab-panel/remove-tab-toolbar-control.cjs.map +0 -7
- package/build/tabs/controls.cjs +0 -45
- package/build/tabs/controls.cjs.map +0 -7
- package/build-module/freeform/migration-notice.mjs +0 -37
- package/build-module/freeform/migration-notice.mjs.map +0 -7
- package/build-module/tab-panel/add-tab-toolbar-control.mjs +0 -72
- package/build-module/tab-panel/add-tab-toolbar-control.mjs.map +0 -7
- package/build-module/tab-panel/remove-tab-toolbar-control.mjs +0 -81
- package/build-module/tab-panel/remove-tab-toolbar-control.mjs.map +0 -7
- package/build-module/tabs/controls.mjs +0 -14
- package/build-module/tabs/controls.mjs.map +0 -7
- package/src/freeform/migration-notice.js +0 -49
- package/src/tab-panel/add-tab-toolbar-control.js +0 -90
- package/src/tab-panel/remove-tab-toolbar-control.js +0 -110
- package/src/tabs/controls.js +0 -14
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/spacer/controls.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tInspectorControls,\n\tuseSettings,\n\t__experimentalSpacingSizesControl as SpacingSizesControl,\n\tisValueSpacingPreset,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,0BAMO;AACP,wBAMO;AACP,qBAA8B;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tInspectorControls,\n\tuseSettings,\n\t__experimentalSpacingSizesControl as SpacingSizesControl,\n\tisValueSpacingPreset,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\nimport { MIN_SPACER_SIZE } from './constants';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst { useSpacingSizes } = unlock( blockEditorPrivateApis );\n\nfunction DimensionInput( { label, onChange, isResizing, value = '' } ) {\n\tconst inputId = useInstanceId( UnitControl, 'block-spacer-height-input' );\n\tconst spacingSizes = useSpacingSizes();\n\tconst [ spacingUnits ] = useSettings( 'spacing.units' );\n\t// In most contexts the spacer size cannot meaningfully be set to a\n\t// percentage, since this is relative to the parent container. This\n\t// unit is disabled from the UI.\n\tconst availableUnits = spacingUnits\n\t\t? spacingUnits.filter( ( unit ) => unit !== '%' )\n\t\t: [ 'px', 'em', 'rem', 'vw', 'vh' ];\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits,\n\t\tdefaultValues: { px: 100, em: 10, rem: 10, vw: 10, vh: 25 },\n\t} );\n\n\t// Force the unit to update to `px` when the Spacer is being resized.\n\tconst [ parsedQuantity, parsedUnit ] =\n\t\tparseQuantityAndUnitFromRawValue( value );\n\tconst computedValue = isValueSpacingPreset( value )\n\t\t? value\n\t\t: [ parsedQuantity, isResizing ? 'px' : parsedUnit ].join( '' );\n\n\treturn (\n\t\t<>\n\t\t\t{ spacingSizes?.length < 2 ? (\n\t\t\t\t<UnitControl\n\t\t\t\t\tid={ inputId }\n\t\t\t\t\tisResetValueOnUnitChange\n\t\t\t\t\tmin={ MIN_SPACER_SIZE }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tvalue={ computedValue }\n\t\t\t\t\tunits={ units }\n\t\t\t\t\tlabel={ label }\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<div className=\"tools-panel-item-spacing\">\n\t\t\t\t\t<SpacingSizesControl\n\t\t\t\t\t\tvalues={ { all: computedValue } }\n\t\t\t\t\t\tonChange={ ( { all } ) => {\n\t\t\t\t\t\t\tonChange( all );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\tsides={ [ 'all' ] }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\tsplitOnAxis={ false }\n\t\t\t\t\t\tshowSideInLabel={ false }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default function SpacerControls( {\n\tsetAttributes,\n\torientation,\n\theight,\n\twidth,\n\tisResizing,\n} ) {\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\treturn (\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\twidth: undefined,\n\t\t\t\t\t\theight: '100px',\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{ orientation === 'horizontal' && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => width !== undefined }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { width: undefined } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<DimensionInput\n\t\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\t\tvalue={ width }\n\t\t\t\t\t\t\tonChange={ ( nextWidth ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { width: nextWidth } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisResizing={ isResizing }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t\t{ orientation !== 'horizontal' && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Height' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => height !== '100px' }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { height: '100px' } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<DimensionInput\n\t\t\t\t\t\t\tlabel={ __( 'Height' ) }\n\t\t\t\t\t\t\tvalue={ height }\n\t\t\t\t\t\t\tonChange={ ( nextHeight ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { height: nextHeight } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisResizing={ isResizing }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,0BAMO;AACP,wBAMO;AACP,qBAA8B;AAK9B,yBAAuB;AACvB,uBAAgC;AAChC,mBAA+C;AA4B7C;AA1BF,IAAM,EAAE,gBAAgB,QAAI,2BAAQ,oBAAAA,WAAuB;AAE3D,SAAS,eAAgB,EAAE,OAAO,UAAU,YAAY,QAAQ,GAAG,GAAI;AACtE,QAAM,cAAU,8BAAe,kBAAAC,2BAAa,2BAA4B;AACxE,QAAM,eAAe,gBAAgB;AACrC,QAAM,CAAE,YAAa,QAAI,iCAAa,eAAgB;AAItD,QAAM,iBAAiB,eACpB,aAAa,OAA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;AAAA,UAAC,kBAAAC;AAAA,UAAA;AAAA,YACA,WAAQ,gBAAI,OAAQ;AAAA,YACpB,kBAAgB;AAAA,YAChB,UAAW,MAAM,UAAU;AAAA,YAC3B,YAAa,MACZ,cAAe,EAAE,OAAO,OAAU,CAAE;AAAA,YAGrC;AAAA,cAAC;AAAA;AAAA,gBACA,WAAQ,gBAAI,OAAQ;AAAA,gBACpB,OAAQ;AAAA,gBACR,UAAW,CAAE,cACZ,cAAe,EAAE,OAAO,UAAU,CAAE;AAAA,gBAErC;AAAA;AAAA,YACD;AAAA;AAAA,QACD;AAAA,QAEC,gBAAgB,gBACjB;AAAA,UAAC,kBAAAA;AAAA,UAAA;AAAA,YACA,WAAQ,gBAAI,QAAS;AAAA,YACrB,kBAAgB;AAAA,YAChB,UAAW,MAAM,WAAW;AAAA,YAC5B,YAAa,MACZ,cAAe,EAAE,QAAQ,QAAQ,CAAE;AAAA,YAGpC;AAAA,cAAC;AAAA;AAAA,gBACA,WAAQ,gBAAI,QAAS;AAAA,gBACrB,OAAQ;AAAA,gBACR,UAAW,CAAE,eACZ,cAAe,EAAE,QAAQ,WAAW,CAAE;AAAA,gBAEvC;AAAA;AAAA,YACD;AAAA;AAAA,QACD;AAAA;AAAA;AAAA,EAEF,GACD;AAEF;",
|
|
6
6
|
"names": ["blockEditorPrivateApis", "UnitControl", "useCustomUnits", "parseQuantityAndUnitFromRawValue", "SpacingSizesControl", "ToolsPanel", "ToolsPanelItem"]
|
|
7
7
|
}
|
package/build/spacer/edit.cjs
CHANGED
|
@@ -37,7 +37,6 @@ var import_clsx = __toESM(require("clsx"));
|
|
|
37
37
|
var import_block_editor = require("@wordpress/block-editor");
|
|
38
38
|
var import_components = require("@wordpress/components");
|
|
39
39
|
var import_element = require("@wordpress/element");
|
|
40
|
-
var import_primitives = require("@wordpress/primitives");
|
|
41
40
|
var import_data = require("@wordpress/data");
|
|
42
41
|
var import_lock_unlock = require("../lock-unlock.cjs");
|
|
43
42
|
var import_controls = __toESM(require("./controls.cjs"));
|
|
@@ -299,7 +298,7 @@ var SpacerEdit = ({
|
|
|
299
298
|
const blockEditingMode = (0, import_block_editor.useBlockEditingMode)();
|
|
300
299
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
301
300
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
302
|
-
|
|
301
|
+
"div",
|
|
303
302
|
{
|
|
304
303
|
...(0, import_block_editor.useBlockProps)({
|
|
305
304
|
style,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/spacer/edit.js"],
|
|
4
|
-
"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\tuseBlockEditingMode,\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\tconst blockEditingMode = useBlockEditingMode();\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{ blockEditingMode === 'default' &&\n\t\t\t\t\tresizableBoxWithOrientation( 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"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,0BAOO;AACP,wBAA6B;AAC7B,qBAAoC;AACpC,
|
|
4
|
+
"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\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport { ResizableBox } from '@wordpress/components';\nimport { useState, useEffect } from '@wordpress/element';\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\tconst blockEditingMode = useBlockEditingMode();\n\n\treturn (\n\t\t<>\n\t\t\t<div\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{ blockEditingMode === 'default' &&\n\t\t\t\t\tresizableBoxWithOrientation( inheritedOrientation ) }\n\t\t\t</div>\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"],
|
|
5
|
+
"mappings": ";;;;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,yBAAyB,eACtB,EAAE,OAAO,OAAU,IACnB,EAAE,QAAQ,OAAU;AAAA,MACxB;AAAA,IACD,WAAY,CAAE,iBAAkB,eAAe,WAAa;AAC3D,4BAAuB;AAAA,QACtB,GAAK,yBAAyB,eAC3B,EAAE,OAAO,SAAS,IAClB,EAAE,QAAQ,SAAS;AAAA,QACtB,OAAO;AAAA,UACN,GAAG;AAAA,UACH,QAAQ;AAAA,YACP,GAAG;AAAA,YACH,UAAU;AAAA,YACV,aAAa;AAAA,UACd;AAAA,QACD;AAAA,MACD,CAAE;AAAA,IACH;AAAA,EACD,GAAG;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAE;AAEF,QAAM,uBAAmB,yCAAoB;AAE7C,SACC,4EACC;AAAA;AAAA,MAAC;AAAA;AAAA,QACE,OAAG,mCAAe;AAAA,UACnB;AAAA,UACA,eAAW,YAAAD,SAAM,WAAW;AAAA,YAC3B,yBAAyB;AAAA,UAC1B,CAAE;AAAA,QACH,CAAE;AAAA,QAEA,+BAAqB,aACtB,4BAA6B,oBAAqB;AAAA;AAAA,IACpD;AAAA,IACE,CAAE,gBACH;AAAA,MAAC,gBAAAE;AAAA,MAAA;AAAA,QACA;AAAA,QACA,QAAS,mBAAmB;AAAA,QAC5B,OAAQ,kBAAkB;AAAA,QAC1B,aAAc;AAAA,QACd;AAAA;AAAA,IACD;AAAA,KAEF;AAEF;AAEA,IAAO,eAAQ;",
|
|
6
6
|
"names": ["blockEditorPrivateApis", "clsx", "blockEditorStore", "SpacerControls"]
|
|
7
7
|
}
|
package/build/tab-list/edit.cjs
CHANGED
|
@@ -38,8 +38,8 @@ var import_i18n = require("@wordpress/i18n");
|
|
|
38
38
|
var import_block_editor = require("@wordpress/block-editor");
|
|
39
39
|
var import_data = require("@wordpress/data");
|
|
40
40
|
var import_element = require("@wordpress/element");
|
|
41
|
-
var
|
|
42
|
-
var
|
|
41
|
+
var import_tab_toolbar_controls = __toESM(require("../tabs/tab-toolbar-controls.cjs"));
|
|
42
|
+
var import_use_tab_actions = __toESM(require("../tabs/use-tab-actions.cjs"));
|
|
43
43
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
44
44
|
var EMPTY_ARRAY = [];
|
|
45
45
|
function Edit({
|
|
@@ -65,33 +65,24 @@ function Edit({
|
|
|
65
65
|
},
|
|
66
66
|
[clientId]
|
|
67
67
|
);
|
|
68
|
+
const { isBlockSelected, hasSelectedInnerBlock } = (0, import_data.useSelect)(import_block_editor.store);
|
|
69
|
+
const { updateBlockAttributes, __unstableMarkNextChangeAsNotPersistent } = (0, import_data.useDispatch)(import_block_editor.store);
|
|
70
|
+
const { insertTab, removeTab } = (0, import_use_tab_actions.default)(tabsClientId);
|
|
68
71
|
const effectiveActiveIndex = editorActiveTabIndex ?? activeTabIndex;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
__unstableMarkNextChangeAsNotPersistent
|
|
84
|
-
]
|
|
85
|
-
);
|
|
86
|
-
const handleLabelChange = (0, import_element.useCallback)(
|
|
87
|
-
(tabIndex, newLabel) => {
|
|
88
|
-
const tab = tabsList[tabIndex];
|
|
89
|
-
if (tab?.clientId) {
|
|
90
|
-
updateBlockAttributes(tab.clientId, { label: newLabel });
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
[tabsList, updateBlockAttributes]
|
|
94
|
-
);
|
|
72
|
+
function selectTabPanel(tabIndex) {
|
|
73
|
+
if (tabsClientId && tabIndex !== effectiveActiveIndex) {
|
|
74
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
75
|
+
updateBlockAttributes(tabsClientId, {
|
|
76
|
+
editorActiveTabIndex: tabIndex
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function handleLabelChange(tabIndex, newLabel) {
|
|
81
|
+
const tab = tabsList[tabIndex];
|
|
82
|
+
if (tab?.clientId) {
|
|
83
|
+
updateBlockAttributes(tab.clientId, { label: newLabel });
|
|
84
|
+
}
|
|
85
|
+
}
|
|
95
86
|
const menuRef = (0, import_element.useRef)();
|
|
96
87
|
const prevTabCountRef = (0, import_element.useRef)(tabsList.length);
|
|
97
88
|
(0, import_element.useEffect)(() => {
|
|
@@ -100,27 +91,23 @@ function Edit({
|
|
|
100
91
|
if (!menuRef.current || tabsList.length === prevCount) {
|
|
101
92
|
return;
|
|
102
93
|
}
|
|
94
|
+
if (!isBlockSelected(tabsClientId) && !hasSelectedInnerBlock(tabsClientId, true)) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
103
97
|
const focusButtonAt = (index) => {
|
|
104
98
|
window.requestAnimationFrame(() => {
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
if (!target) {
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
const richText = target.querySelector("[contenteditable]");
|
|
111
|
-
if (richText) {
|
|
112
|
-
richText.focus();
|
|
113
|
-
} else {
|
|
114
|
-
target.focus();
|
|
115
|
-
}
|
|
99
|
+
const button = menuRef.current?.querySelectorAll("button")?.[index];
|
|
100
|
+
(button?.querySelector("[contenteditable]") ?? button)?.focus();
|
|
116
101
|
});
|
|
117
102
|
};
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
103
|
+
focusButtonAt(effectiveActiveIndex);
|
|
104
|
+
}, [
|
|
105
|
+
effectiveActiveIndex,
|
|
106
|
+
hasSelectedInnerBlock,
|
|
107
|
+
isBlockSelected,
|
|
108
|
+
tabsClientId,
|
|
109
|
+
tabsList.length
|
|
110
|
+
]);
|
|
124
111
|
const blockProps = (0, import_block_editor.useBlockProps)({
|
|
125
112
|
role: "tablist",
|
|
126
113
|
ref: menuRef,
|
|
@@ -135,8 +122,7 @@ function Edit({
|
|
|
135
122
|
...spacingProps.style
|
|
136
123
|
};
|
|
137
124
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
138
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
139
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_remove_tab_toolbar_control.default, { tabsClientId }),
|
|
125
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tab_toolbar_controls.default, { tabsClientId }),
|
|
140
126
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ...blockProps, children: tabsList.map((tab, index) => {
|
|
141
127
|
const isActive = index === effectiveActiveIndex;
|
|
142
128
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -148,9 +134,8 @@ function Edit({
|
|
|
148
134
|
className: buttonClassName || void 0,
|
|
149
135
|
style: buttonStyle,
|
|
150
136
|
tabIndex: -1,
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
handleTabClick(index);
|
|
137
|
+
onFocus: () => {
|
|
138
|
+
selectTabPanel(index);
|
|
154
139
|
},
|
|
155
140
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
156
141
|
import_block_editor.RichText,
|
|
@@ -159,7 +144,9 @@ function Edit({
|
|
|
159
144
|
withoutInteractiveFormatting: true,
|
|
160
145
|
placeholder: (0, import_i18n.__)("Tab title"),
|
|
161
146
|
value: tab.label,
|
|
162
|
-
onChange: (newLabel) => handleLabelChange(index, newLabel)
|
|
147
|
+
onChange: (newLabel) => handleLabelChange(index, newLabel),
|
|
148
|
+
__unstableOnSplitAtEnd: () => insertTab(index + 1),
|
|
149
|
+
onRemove: () => removeTab(index)
|
|
163
150
|
}
|
|
164
151
|
)
|
|
165
152
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/tab-list/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tRichText,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalUseColorProps as useColorProps,\n\t__experimentalGetSpacingClassesAndStyles as getSpacingClassesAndStyles,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,kBAAmB;AACnB,0BAOO;AACP,kBAAuC;AACvC,
|
|
6
|
-
"names": ["useColorProps", "useBorderProps", "getSpacingClassesAndStyles", "blockEditorStore", "
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tRichText,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalUseColorProps as useColorProps,\n\t__experimentalGetSpacingClassesAndStyles as getSpacingClassesAndStyles,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport TabToolbarControls from '../tabs/tab-toolbar-controls';\nimport useTabActions from '../tabs/use-tab-actions';\n\nconst EMPTY_ARRAY = [];\n\nfunction Edit( {\n\tattributes,\n\tclientId,\n\tcontext,\n\t__unstableLayoutClassNames: layoutClassNames,\n} ) {\n\tconst tabsList = context[ 'core/tabs-list' ] || EMPTY_ARRAY;\n\n\tconst colorProps = useColorProps( attributes );\n\tconst borderProps = useBorderProps( attributes );\n\tconst spacingProps = getSpacingClassesAndStyles( attributes );\n\n\tconst { tabsClientId, editorActiveTabIndex, activeTabIndex } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\tconst _tabsClientId = getBlockRootClientId( clientId );\n\t\t\tconst tabsAttributes = _tabsClientId\n\t\t\t\t? getBlockAttributes( _tabsClientId )\n\t\t\t\t: {};\n\n\t\t\treturn {\n\t\t\t\ttabsClientId: _tabsClientId,\n\t\t\t\teditorActiveTabIndex: tabsAttributes?.editorActiveTabIndex,\n\t\t\t\tactiveTabIndex: tabsAttributes?.activeTabIndex ?? 0,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { isBlockSelected, hasSelectedInnerBlock } =\n\t\tuseSelect( blockEditorStore );\n\tconst { updateBlockAttributes, __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { insertTab, removeTab } = useTabActions( tabsClientId );\n\n\tconst effectiveActiveIndex = editorActiveTabIndex ?? activeTabIndex;\n\n\tfunction selectTabPanel( tabIndex ) {\n\t\tif ( tabsClientId && tabIndex !== effectiveActiveIndex ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tupdateBlockAttributes( tabsClientId, {\n\t\t\t\teditorActiveTabIndex: tabIndex,\n\t\t\t} );\n\t\t}\n\t}\n\n\tfunction handleLabelChange( tabIndex, newLabel ) {\n\t\tconst tab = tabsList[ tabIndex ];\n\t\tif ( tab?.clientId ) {\n\t\t\tupdateBlockAttributes( tab.clientId, { label: newLabel } );\n\t\t}\n\t}\n\n\tconst menuRef = useRef();\n\tconst prevTabCountRef = useRef( tabsList.length );\n\n\t// When tabs are added or removed, focus the appropriate button.\n\tuseEffect( () => {\n\t\tconst prevCount = prevTabCountRef.current;\n\t\tprevTabCountRef.current = tabsList.length;\n\n\t\tif ( ! menuRef.current || tabsList.length === prevCount ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Only move focus during active editing, not external data changes.\n\t\tif (\n\t\t\t! isBlockSelected( tabsClientId ) &&\n\t\t\t! hasSelectedInnerBlock( tabsClientId, true )\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst focusButtonAt = ( index ) => {\n\t\t\twindow.requestAnimationFrame( () => {\n\t\t\t\tconst button =\n\t\t\t\t\tmenuRef.current?.querySelectorAll( 'button' )?.[ index ];\n\t\t\t\t(\n\t\t\t\t\tbutton?.querySelector( '[contenteditable]' ) ?? button\n\t\t\t\t)?.focus();\n\t\t\t} );\n\t\t};\n\n\t\tfocusButtonAt( effectiveActiveIndex );\n\t}, [\n\t\teffectiveActiveIndex,\n\t\thasSelectedInnerBlock,\n\t\tisBlockSelected,\n\t\ttabsClientId,\n\t\ttabsList.length,\n\t] );\n\n\tconst blockProps = useBlockProps( {\n\t\trole: 'tablist',\n\t\tref: menuRef,\n\t\t// Applied manually since this block has no inner blocks for the layout\n\t\t// support to add its container classes to.\n\t\tclassName: layoutClassNames,\n\t} );\n\n\tconst buttonClassName = clsx( colorProps.className, borderProps.className );\n\n\tconst buttonStyle = {\n\t\t...colorProps.style,\n\t\t...borderProps.style,\n\t\t...spacingProps.style,\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<TabToolbarControls tabsClientId={ tabsClientId } />\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ tabsList.map( ( tab, index ) => {\n\t\t\t\t\tconst isActive = index === effectiveActiveIndex;\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\tkey={ tab.clientId || index }\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\trole=\"tab\"\n\t\t\t\t\t\t\taria-selected={ isActive }\n\t\t\t\t\t\t\tclassName={ buttonClassName || undefined }\n\t\t\t\t\t\t\tstyle={ buttonStyle }\n\t\t\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t\t\t\t// Activate the matching panel whenever this tab\n\t\t\t\t\t\t\t// receives focus — whether from a click or the caret\n\t\t\t\t\t\t\t// moving into the label via the keyboard.\n\t\t\t\t\t\t\tonFocus={ () => {\n\t\t\t\t\t\t\t\tselectTabPanel( index );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\t\ttagName=\"span\"\n\t\t\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\t\t\tplaceholder={ __( 'Tab title' ) }\n\t\t\t\t\t\t\t\tvalue={ tab.label }\n\t\t\t\t\t\t\t\tonChange={ ( newLabel ) =>\n\t\t\t\t\t\t\t\t\thandleLabelChange( index, newLabel )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\t\t\t\tinsertTab( index + 1 )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonRemove={ () => removeTab( index ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</button>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default Edit;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,kBAAmB;AACnB,0BAOO;AACP,kBAAuC;AACvC,qBAAkC;AAKlC,kCAA+B;AAC/B,6BAA0B;AAkHxB;AAhHF,IAAM,cAAc,CAAC;AAErB,SAAS,KAAM;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA,4BAA4B;AAC7B,GAAI;AACH,QAAM,WAAW,QAAS,gBAAiB,KAAK;AAEhD,QAAM,iBAAa,oBAAAA,6BAAe,UAAW;AAC7C,QAAM,kBAAc,oBAAAC,8BAAgB,UAAW;AAC/C,QAAM,mBAAe,oBAAAC,0CAA4B,UAAW;AAE5D,QAAM,EAAE,cAAc,sBAAsB,eAAe,QAAI;AAAA,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eAAQ;",
|
|
6
|
+
"names": ["useColorProps", "useBorderProps", "getSpacingClassesAndStyles", "blockEditorStore", "useTabActions", "clsx", "TabToolbarControls"]
|
|
7
7
|
}
|
package/build/tab-list/save.cjs
CHANGED
|
@@ -51,13 +51,14 @@ function save({ attributes }) {
|
|
|
51
51
|
...spacingProps.style
|
|
52
52
|
};
|
|
53
53
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ...blockProps, children: tabs.map((tab, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
54
|
-
|
|
54
|
+
import_block_editor.RichText.Content,
|
|
55
55
|
{
|
|
56
56
|
className: buttonClassName || void 0,
|
|
57
57
|
style: buttonStyle,
|
|
58
|
+
tagName: "button",
|
|
59
|
+
value: tab.label,
|
|
58
60
|
type: "button",
|
|
59
|
-
role: "tab"
|
|
60
|
-
children: tab.label
|
|
61
|
+
role: "tab"
|
|
61
62
|
},
|
|
62
63
|
index
|
|
63
64
|
)) });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/tab-list/save.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseBlockProps,\n\t__experimentalGetBorderClassesAndStyles as getBorderClassesAndStyles,\n\t__experimentalGetColorClassesAndStyles as getColorClassesAndStyles,\n\t__experimentalGetSpacingClassesAndStyles as getSpacingClassesAndStyles,\n} from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\tconst { tabs } = attributes;\n\tconst blockProps = useBlockProps.save( {\n\t\trole: 'tablist',\n\t} );\n\n\tconst colorProps = getColorClassesAndStyles( attributes );\n\tconst borderProps = getBorderClassesAndStyles( attributes );\n\tconst spacingProps = getSpacingClassesAndStyles( attributes );\n\n\tconst buttonClassName = clsx( colorProps.className, borderProps.className );\n\n\tconst buttonStyle = {\n\t\t...colorProps.style,\n\t\t...borderProps.style,\n\t\t...spacingProps.style,\n\t};\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t{ tabs.map( ( tab, index ) => (\n\t\t\t\t<
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tRichText,\n\tuseBlockProps,\n\t__experimentalGetBorderClassesAndStyles as getBorderClassesAndStyles,\n\t__experimentalGetColorClassesAndStyles as getColorClassesAndStyles,\n\t__experimentalGetSpacingClassesAndStyles as getSpacingClassesAndStyles,\n} from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\tconst { tabs } = attributes;\n\tconst blockProps = useBlockProps.save( {\n\t\trole: 'tablist',\n\t} );\n\n\tconst colorProps = getColorClassesAndStyles( attributes );\n\tconst borderProps = getBorderClassesAndStyles( attributes );\n\tconst spacingProps = getSpacingClassesAndStyles( attributes );\n\n\tconst buttonClassName = clsx( colorProps.className, borderProps.className );\n\n\tconst buttonStyle = {\n\t\t...colorProps.style,\n\t\t...borderProps.style,\n\t\t...spacingProps.style,\n\t};\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t{ tabs.map( ( tab, index ) => (\n\t\t\t\t<RichText.Content\n\t\t\t\t\tkey={ index }\n\t\t\t\t\tclassName={ buttonClassName || undefined }\n\t\t\t\t\tstyle={ buttonStyle }\n\t\t\t\t\ttagName=\"button\"\n\t\t\t\t\tvalue={ tab.label }\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\trole=\"tab\"\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</div>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,0BAMO;AAuBH;AArBW,SAAR,KAAuB,EAAE,WAAW,GAAI;AAC9C,QAAM,EAAE,KAAK,IAAI;AACjB,QAAM,aAAa,kCAAc,KAAM;AAAA,IACtC,MAAM;AAAA,EACP,CAAE;AAEF,QAAM,iBAAa,oBAAAA,wCAA0B,UAAW;AACxD,QAAM,kBAAc,oBAAAC,yCAA2B,UAAW;AAC1D,QAAM,mBAAe,oBAAAC,0CAA4B,UAAW;AAE5D,QAAM,sBAAkB,YAAAC,SAAM,WAAW,WAAW,YAAY,SAAU;AAE1E,QAAM,cAAc;AAAA,IACnB,GAAG,WAAW;AAAA,IACd,GAAG,YAAY;AAAA,IACf,GAAG,aAAa;AAAA,EACjB;AAEA,SACC,4CAAC,SAAM,GAAG,YACP,eAAK,IAAK,CAAE,KAAK,UAClB;AAAA,IAAC,6BAAS;AAAA,IAAT;AAAA,MAEA,WAAY,mBAAmB;AAAA,MAC/B,OAAQ;AAAA,MACR,SAAQ;AAAA,MACR,OAAQ,IAAI;AAAA,MACZ,MAAK;AAAA,MACL,MAAK;AAAA;AAAA,IANC;AAAA,EAOP,CACC,GACH;AAEF;",
|
|
6
6
|
"names": ["getColorClassesAndStyles", "getBorderClassesAndStyles", "getSpacingClassesAndStyles", "clsx"]
|
|
7
7
|
}
|
|
@@ -37,16 +37,14 @@ var import_block_editor = require("@wordpress/block-editor");
|
|
|
37
37
|
var import_components = require("@wordpress/components");
|
|
38
38
|
var import_i18n = require("@wordpress/i18n");
|
|
39
39
|
var import_data = require("@wordpress/data");
|
|
40
|
-
var
|
|
41
|
-
var import_remove_tab_toolbar_control = __toESM(require("./remove-tab-toolbar-control.cjs"));
|
|
40
|
+
var import_tab_toolbar_controls = __toESM(require("../tabs/tab-toolbar-controls.cjs"));
|
|
42
41
|
var import_hooks = require("../utils/hooks.cjs");
|
|
43
42
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
44
43
|
function Controls({ tabsClientId, blockIndex, isDefaultTab }) {
|
|
45
44
|
const { updateBlockAttributes } = (0, import_data.useDispatch)(import_block_editor.store);
|
|
46
45
|
const dropdownMenuProps = (0, import_hooks.useToolsPanelDropdownMenuProps)();
|
|
47
46
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
48
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
49
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_remove_tab_toolbar_control.default, { tabsClientId }),
|
|
47
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tab_toolbar_controls.default, { tabsClientId }),
|
|
50
48
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.InspectorControls, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
51
49
|
import_components.__experimentalToolsPanel,
|
|
52
50
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/tab-panel/controls.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tInspectorControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tCheckboxControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAGO;AACP,wBAIO;AACP,kBAAmB;AACnB,kBAA4B;AAK5B,
|
|
6
|
-
"names": ["blockEditorStore", "
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tInspectorControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tCheckboxControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport TabToolbarControls from '../tabs/tab-toolbar-controls';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nexport default function Controls( { tabsClientId, blockIndex, isDefaultTab } ) {\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\treturn (\n\t\t<>\n\t\t\t<TabToolbarControls tabsClientId={ tabsClientId } />\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tupdateBlockAttributes( tabsClientId, {\n\t\t\t\t\t\t\tactiveTabIndex: 0,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Default tab' ) }\n\t\t\t\t\t\thasValue={ () => isDefaultTab && blockIndex !== 0 }\n\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\tupdateBlockAttributes( tabsClientId, {\n\t\t\t\t\t\t\t\tactiveTabIndex: 0,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\tlabel={ __( 'Default tab' ) }\n\t\t\t\t\t\t\tchecked={ isDefaultTab }\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\tupdateBlockAttributes( tabsClientId, {\n\t\t\t\t\t\t\t\t\tactiveTabIndex: value ? blockIndex : 0,\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\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7
7
|
}
|
|
@@ -36,8 +36,7 @@ module.exports = __toCommonJS(edit_exports);
|
|
|
36
36
|
var import_block_editor = require("@wordpress/block-editor");
|
|
37
37
|
var import_data = require("@wordpress/data");
|
|
38
38
|
var import_i18n = require("@wordpress/i18n");
|
|
39
|
-
var
|
|
40
|
-
var import_remove_tab_toolbar_control = __toESM(require("../tab-panel/remove-tab-toolbar-control.cjs"));
|
|
39
|
+
var import_tab_toolbar_controls = __toESM(require("../tabs/tab-toolbar-controls.cjs"));
|
|
41
40
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
42
41
|
var TAB_PANELS_TEMPLATE = [
|
|
43
42
|
["core/tab-panel", { label: (0, import_i18n.__)("Tab") }],
|
|
@@ -56,8 +55,7 @@ function Edit({ clientId }) {
|
|
|
56
55
|
[clientId]
|
|
57
56
|
);
|
|
58
57
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
59
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
60
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_remove_tab_toolbar_control.default, { tabsClientId }),
|
|
58
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tab_toolbar_controls.default, { tabsClientId }),
|
|
61
59
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ...innerBlocksProps })
|
|
62
60
|
] });
|
|
63
61
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/tab-panels/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAIO;AACP,kBAA0B;AAC1B,kBAAmB;AAKnB,
|
|
6
|
-
"names": ["blockEditorStore", "
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport TabToolbarControls from '../tabs/tab-toolbar-controls';\n\n/**\n * Initial template applied only when the block is first inserted (i.e. when\n * inner blocks are empty). templateLock is false, so this is never applied to\n * existing blocks that already have tab panels saved.\n */\nconst TAB_PANELS_TEMPLATE = [\n\t[ 'core/tab-panel', { label: __( 'Tab' ) } ],\n\t[ 'core/tab-panel', { label: __( 'Tab' ) } ],\n];\n\nexport default function Edit( { clientId } ) {\n\tconst blockProps = useBlockProps();\n\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TAB_PANELS_TEMPLATE,\n\t\ttemplateLock: false,\n\t\trenderAppender: false, // Appender handled by individual tab blocks\n\t} );\n\n\t// Get the parent tabs block clientId\n\tconst tabsClientId = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlockRootClientId( clientId ),\n\t\t[ clientId ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<TabToolbarControls tabsClientId={ tabsClientId } />\n\t\t\t<div { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAIO;AACP,kBAA0B;AAC1B,kBAAmB;AAKnB,kCAA+B;AA6B7B;AAtBF,IAAM,sBAAsB;AAAA,EAC3B,CAAE,kBAAkB,EAAE,WAAO,gBAAI,KAAM,EAAE,CAAE;AAAA,EAC3C,CAAE,kBAAkB,EAAE,WAAO,gBAAI,KAAM,EAAE,CAAE;AAC5C;AAEe,SAAR,KAAuB,EAAE,SAAS,GAAI;AAC5C,QAAM,iBAAa,mCAAc;AAEjC,QAAM,uBAAmB,yCAAqB,YAAY;AAAA,IACzD,UAAU;AAAA,IACV,cAAc;AAAA,IACd,gBAAgB;AAAA;AAAA,EACjB,CAAE;AAGF,QAAM,mBAAe;AAAA,IACpB,CAAE,WACD,OAAQ,oBAAAA,KAAiB,EAAE,qBAAsB,QAAS;AAAA,IAC3D,CAAE,QAAS;AAAA,EACZ;AAEA,SACC,4EACC;AAAA,gDAAC,4BAAAC,SAAA,EAAmB,cAA8B;AAAA,IAClD,4CAAC,SAAM,GAAG,kBAAmB;AAAA,KAC9B;AAEF;",
|
|
6
|
+
"names": ["blockEditorStore", "TabToolbarControls"]
|
|
7
7
|
}
|
|
@@ -172,7 +172,6 @@ function TableOfContentsEdit({
|
|
|
172
172
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
173
173
|
import_components.SelectControl,
|
|
174
174
|
{
|
|
175
|
-
__next40pxDefaultSize: true,
|
|
176
175
|
label: (0, import_i18n.__)("Include headings down to level"),
|
|
177
176
|
value: maxLevel || "",
|
|
178
177
|
options: [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/table-of-contents/edit.js"],
|
|
4
|
-
"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\tSelectControl,\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 { __, isRTL } from '@wordpress/i18n';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as noticeStore } from '@wordpress/notices';\nimport {\n\ttableOfContents as icon,\n\tformatListBullets,\n\tformatListBulletsRTL,\n\tformatListNumbered,\n\tformatListNumberedRTL,\n} 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 The 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 {number|undefined} props.attributes.maxLevel The maximum heading level to include, or null to include all levels.\n * @param {boolean} props.attributes.ordered Whether to display as an ordered list (true) or unordered list (false).\n * @param {string} props.clientId The client id.\n * @param {(attributes: Object) => void} props.setAttributes The set attributes function.\n *\n * @return {Component} The component.\n */\nexport default function TableOfContentsEdit( {\n\tattributes: {\n\t\theadings = [],\n\t\tonlyIncludeCurrentPage,\n\t\tmaxLevel,\n\t\tordered = true,\n\t},\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 = (\n\t\t<BlockControls>\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\ticon={ isRTL() ? formatListBulletsRTL : formatListBullets }\n\t\t\t\t\ttitle={ __( 'Unordered' ) }\n\t\t\t\t\tdescription={ __( 'Convert to unordered list' ) }\n\t\t\t\t\tonClick={ () => setAttributes( { ordered: false } ) }\n\t\t\t\t\tisActive={ ordered === false }\n\t\t\t\t/>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\ticon={\n\t\t\t\t\t\tisRTL() ? formatListNumberedRTL : formatListNumbered\n\t\t\t\t\t}\n\t\t\t\t\ttitle={ __( 'Ordered' ) }\n\t\t\t\t\tdescription={ __( 'Convert to ordered list' ) }\n\t\t\t\t\tonClick={ () => setAttributes( { ordered: true } ) }\n\t\t\t\t\tisActive={ ordered === true }\n\t\t\t\t/>\n\t\t\t</ToolbarGroup>\n\t\t\t{ canInsertList && (\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\tcreateBlock( 'core/list', {\n\t\t\t\t\t\t\t\t\tordered,\n\t\t\t\t\t\t\t\t\tvalues: renderToString(\n\t\t\t\t\t\t\t\t\t\t<TableOfContentsList\n\t\t\t\t\t\t\t\t\t\t\tnestedHeadingList={ headingTree }\n\t\t\t\t\t\t\t\t\t\t\tordered={ ordered }\n\t\t\t\t\t\t\t\t\t\t/>\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\t\t{ __( 'Convert to static list' ) }\n\t\t\t\t\t</ToolbarButton>\n\t\t\t\t</ToolbarGroup>\n\t\t\t) }\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\tmaxLevel: undefined,\n\t\t\t\t\t\tordered: true,\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\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\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! maxLevel }\n\t\t\t\t\tlabel={ __( 'Limit heading levels' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { maxLevel: undefined } )\n\t\t\t\t\t}\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAMO;AACP,oBAA4B;AAC5B,wBAQO;AACP,kBAAuC;AACvC,qBAA+B;AAC/B,kBAA0B;AAC1B,qBAA8B;AAC9B,qBAAqC;AACrC,mBAMO;AAKP,kBAAgC;AAChC,mBAA0C;AAC1C,mBAAmC;AACnC,IAAAA,gBAA+C;AA+D5C;AA7CY,SAAR,oBAAsC;AAAA,EAC5C,YAAY;AAAA,IACX,WAAW,CAAC;AAAA,IACZ;AAAA,IACA;AAAA,IACA,UAAU;AAAA,EACX;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,uCAAoB,QAAS;AAE7B,QAAM,iBAAa,mCAAc;AACjC,QAAM,iBAAa;AAAA,IAClB;AAAA,IACA;AAAA,EACD;AAGA,QAAM,EAAE,oBAAoB,QAAI,yBAAa,eAAAC,KAAY;AACzD,QAAM,iCAAiC,CAAE,UAAW;AACnD,UAAM,eAAe;AACrB,4BAAqB,gBAAI,mCAAoC,GAAG;AAAA,MAC/D,IAAI,8DAA+D,UAAW;AAAA,MAC9E,MAAM;AAAA,IACP,CAAE;AAAA,EACH;AAEA,QAAM,oBAAgB;AAAA,IACrB,CAAE,WAAY;AACb,YAAM,EAAE,sBAAsB,mBAAmB,IAChD,OAAQ,oBAAAC,KAAiB;AAC1B,YAAM,eAAe,qBAAsB,QAAS;AAEpD,aAAO,mBAAoB,aAAa,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H;AAAA,MACA;AAAA,MAEA;AAAA;AAAA,UAAC,kBAAAC;AAAA,UAAA;AAAA,YACA,UAAW,MAAM,CAAC,CAAE;AAAA,YACpB,WAAQ,gBAAI,2BAA4B;AAAA,YACxC,YAAa,MACZ,cAAe,EAAE,wBAAwB,MAAM,CAAE;AAAA,YAElD,kBAAgB;AAAA,YAEhB;AAAA,cAAC;AAAA;AAAA,gBACA,WAAQ,gBAAI,2BAA4B;AAAA,gBACxC,SAAU;AAAA,gBACV,UAAW,CAAE,UACZ,cAAe,EAAE,wBAAwB,MAAM,CAAE;AAAA,gBAElD,MACC,6BACG;AAAA,kBACA;AAAA,gBACA,QACA;AAAA,kBACA;AAAA,gBACA;AAAA;AAAA,YAEL;AAAA;AAAA,QACD;AAAA,QACA;AAAA,UAAC,kBAAAA;AAAA,UAAA;AAAA,YACA,UAAW,MAAM,CAAC,CAAE;AAAA,YACpB,WAAQ,gBAAI,sBAAuB;AAAA,YACnC,YAAa,MACZ,cAAe,EAAE,UAAU,OAAU,CAAE;AAAA,YAExC,kBAAgB;AAAA,YAEhB;AAAA,cAAC;AAAA;AAAA,gBACA,
|
|
4
|
+
"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\tSelectControl,\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 { __, isRTL } from '@wordpress/i18n';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as noticeStore } from '@wordpress/notices';\nimport {\n\ttableOfContents as icon,\n\tformatListBullets,\n\tformatListBulletsRTL,\n\tformatListNumbered,\n\tformatListNumberedRTL,\n} 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 The 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 {number|undefined} props.attributes.maxLevel The maximum heading level to include, or null to include all levels.\n * @param {boolean} props.attributes.ordered Whether to display as an ordered list (true) or unordered list (false).\n * @param {string} props.clientId The client id.\n * @param {(attributes: Object) => void} props.setAttributes The set attributes function.\n *\n * @return {Component} The component.\n */\nexport default function TableOfContentsEdit( {\n\tattributes: {\n\t\theadings = [],\n\t\tonlyIncludeCurrentPage,\n\t\tmaxLevel,\n\t\tordered = true,\n\t},\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 = (\n\t\t<BlockControls>\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\ticon={ isRTL() ? formatListBulletsRTL : formatListBullets }\n\t\t\t\t\ttitle={ __( 'Unordered' ) }\n\t\t\t\t\tdescription={ __( 'Convert to unordered list' ) }\n\t\t\t\t\tonClick={ () => setAttributes( { ordered: false } ) }\n\t\t\t\t\tisActive={ ordered === false }\n\t\t\t\t/>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\ticon={\n\t\t\t\t\t\tisRTL() ? formatListNumberedRTL : formatListNumbered\n\t\t\t\t\t}\n\t\t\t\t\ttitle={ __( 'Ordered' ) }\n\t\t\t\t\tdescription={ __( 'Convert to ordered list' ) }\n\t\t\t\t\tonClick={ () => setAttributes( { ordered: true } ) }\n\t\t\t\t\tisActive={ ordered === true }\n\t\t\t\t/>\n\t\t\t</ToolbarGroup>\n\t\t\t{ canInsertList && (\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\tcreateBlock( 'core/list', {\n\t\t\t\t\t\t\t\t\tordered,\n\t\t\t\t\t\t\t\t\tvalues: renderToString(\n\t\t\t\t\t\t\t\t\t\t<TableOfContentsList\n\t\t\t\t\t\t\t\t\t\t\tnestedHeadingList={ headingTree }\n\t\t\t\t\t\t\t\t\t\t\tordered={ ordered }\n\t\t\t\t\t\t\t\t\t\t/>\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\t\t{ __( 'Convert to static list' ) }\n\t\t\t\t\t</ToolbarButton>\n\t\t\t\t</ToolbarGroup>\n\t\t\t) }\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\tmaxLevel: undefined,\n\t\t\t\t\t\tordered: true,\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\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\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! maxLevel }\n\t\t\t\t\tlabel={ __( 'Limit heading levels' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { maxLevel: undefined } )\n\t\t\t\t\t}\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\tlabel={ __( 'Include headings down to level' ) }\n\t\t\t\t\t\tvalue={ maxLevel || '' }\n\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t{ value: '', label: __( 'All levels' ) },\n\t\t\t\t\t\t\t{ value: '1', label: __( 'Heading 1' ) },\n\t\t\t\t\t\t\t{ value: '2', label: __( 'Heading 2' ) },\n\t\t\t\t\t\t\t{ value: '3', label: __( 'Heading 3' ) },\n\t\t\t\t\t\t\t{ value: '4', label: __( 'Heading 4' ) },\n\t\t\t\t\t\t\t{ value: '5', label: __( 'Heading 5' ) },\n\t\t\t\t\t\t\t{ value: '6', label: __( 'Heading 6' ) },\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tmaxLevel: value ? parseInt( value ) : undefined,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t! maxLevel\n\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t'Including all heading levels in the table of contents.'\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'Only include headings up to and including this level.'\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\tconst ListTag = ordered ? 'ol' : 'ul';\n\n\treturn (\n\t\t<>\n\t\t\t<nav { ...blockProps }>\n\t\t\t\t<ListTag>\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\tordered={ ordered }\n\t\t\t\t\t/>\n\t\t\t\t</ListTag>\n\t\t\t</nav>\n\t\t\t{ toolbarControls }\n\t\t\t{ inspectorControls }\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAMO;AACP,oBAA4B;AAC5B,wBAQO;AACP,kBAAuC;AACvC,qBAA+B;AAC/B,kBAA0B;AAC1B,qBAA8B;AAC9B,qBAAqC;AACrC,mBAMO;AAKP,kBAAgC;AAChC,mBAA0C;AAC1C,mBAAmC;AACnC,IAAAA,gBAA+C;AA+D5C;AA7CY,SAAR,oBAAsC;AAAA,EAC5C,YAAY;AAAA,IACX,WAAW,CAAC;AAAA,IACZ;AAAA,IACA;AAAA,IACA,UAAU;AAAA,EACX;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,uCAAoB,QAAS;AAE7B,QAAM,iBAAa,mCAAc;AACjC,QAAM,iBAAa;AAAA,IAClB;AAAA,IACA;AAAA,EACD;AAGA,QAAM,EAAE,oBAAoB,QAAI,yBAAa,eAAAC,KAAY;AACzD,QAAM,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KAAK,WAAO,gBAAI,WAAY,EAAE;AAAA,kBACvC,EAAE,OAAO,KAAK,WAAO,gBAAI,WAAY,EAAE;AAAA,kBACvC,EAAE,OAAO,KAAK,WAAO,gBAAI,WAAY,EAAE;AAAA,kBACvC,EAAE,OAAO,KAAK,WAAO,gBAAI,WAAY,EAAE;AAAA,kBACvC,EAAE,OAAO,KAAK,WAAO,gBAAI,WAAY,EAAE;AAAA,gBACxC;AAAA,gBACA,UAAW,CAAE,UACZ,cAAe;AAAA,kBACd,UAAU,QAAQ,SAAU,KAAM,IAAI;AAAA,gBACvC,CAAE;AAAA,gBAEH,MACC,CAAE,eACC;AAAA,kBACA;AAAA,gBACA,QACA;AAAA,kBACA;AAAA,gBACA;AAAA;AAAA,YAEL;AAAA;AAAA,QACD;AAAA;AAAA;AAAA,EACD,GACD;AAMD,MAAK,SAAS,WAAW,GAAI;AAC5B,WACC,4EACC;AAAA,kDAAC,SAAM,GAAG,YACT;AAAA,QAAC;AAAA;AAAA,UACA,MAAO,4CAAC,iCAAU,MAAO,aAAAC,iBAAO;AAAA,UAChC,WAAQ,gBAAI,mBAAoB;AAAA,UAChC,kBAAe;AAAA,YACd;AAAA,UACD;AAAA;AAAA,MACD,GACD;AAAA,MACE;AAAA,OACH;AAAA,EAEF;AAEA,QAAM,UAAU,UAAU,OAAO;AAEjC,SACC,4EACC;AAAA,gDAAC,SAAM,GAAG,YACT,sDAAC,WACA;AAAA,MAAC,YAAAH;AAAA,MAAA;AAAA,QACA,mBAAoB;AAAA,QACpB,uBAAqB;AAAA,QACrB,SAAU;AAAA,QACV;AAAA;AAAA,IACD,GACD,GACD;AAAA,IACE;AAAA,IACA;AAAA,KACH;AAEF;",
|
|
6
6
|
"names": ["import_hooks", "noticeStore", "blockEditorStore", "TableOfContentsList", "ToolsPanel", "ToolsPanelItem", "icon"]
|
|
7
7
|
}
|
package/build/tabs/edit.cjs
CHANGED
|
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(edit_exports);
|
|
|
36
36
|
var import_block_editor = require("@wordpress/block-editor");
|
|
37
37
|
var import_data = require("@wordpress/data");
|
|
38
38
|
var import_element = require("@wordpress/element");
|
|
39
|
-
var
|
|
39
|
+
var import_tab_toolbar_controls = __toESM(require("./tab-toolbar-controls.cjs"));
|
|
40
40
|
var import_use_tab_list_items_sync = __toESM(require("./use-tab-list-items-sync.cjs"));
|
|
41
41
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
42
42
|
var EMPTY_ARRAY = [];
|
|
@@ -83,7 +83,7 @@ function Edit({ clientId, attributes }) {
|
|
|
83
83
|
renderAppender: false
|
|
84
84
|
});
|
|
85
85
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.BlockContextProvider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { ...innerBlockProps, children: [
|
|
86
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
86
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tab_toolbar_controls.default, { tabsClientId: clientId }),
|
|
87
87
|
innerBlockProps.children
|
|
88
88
|
] }) });
|
|
89
89
|
}
|