@wordpress/block-library 10.1.1-next.v.202607070741.0 → 10.3.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 +25 -0
- package/build/accordion/block.json +1 -0
- package/build/accordion-panel/block.json +1 -0
- package/build/button/edit.cjs +18 -8
- package/build/button/edit.cjs.map +2 -2
- package/build/code/edit.cjs +3 -1
- package/build/code/edit.cjs.map +2 -2
- package/build/cover/block.json +12 -0
- package/build/cover/edit/block-controls.cjs +14 -5
- package/build/cover/edit/block-controls.cjs.map +2 -2
- package/build/cover/edit/embed-video-url-input.cjs +5 -3
- package/build/cover/edit/embed-video-url-input.cjs.map +3 -3
- package/build/cover/edit/index.cjs +76 -32
- package/build/cover/edit/index.cjs.map +2 -2
- package/build/cover/embed-video-utils.cjs +17 -7
- package/build/cover/embed-video-utils.cjs.map +2 -2
- package/build/details/transforms.cjs +1 -3
- package/build/details/transforms.cjs.map +2 -2
- package/build/embed/edit.cjs +1 -1
- package/build/embed/edit.cjs.map +2 -2
- package/build/embed/embed-placeholder.cjs +1 -2
- package/build/embed/embed-placeholder.cjs.map +2 -2
- package/build/file/edit.cjs +4 -3
- package/build/file/edit.cjs.map +2 -2
- package/build/file/transforms.cjs +25 -60
- package/build/file/transforms.cjs.map +2 -2
- package/build/gallery/block.json +4 -2
- package/build/gallery/dynamic-gallery.cjs +104 -61
- package/build/gallery/dynamic-gallery.cjs.map +3 -3
- package/build/gallery/edit.cjs +1 -1
- package/build/gallery/edit.cjs.map +3 -3
- package/build/gallery/gap-styles.cjs +49 -13
- package/build/gallery/gap-styles.cjs.map +3 -3
- package/build/gallery/use-dynamic-gallery.cjs +15 -8
- package/build/gallery/use-dynamic-gallery.cjs.map +2 -2
- package/build/group/transforms.cjs +1 -1
- package/build/group/transforms.cjs.map +2 -2
- package/build/heading/edit.cjs +1 -1
- package/build/heading/edit.cjs.map +2 -2
- package/build/html/modal.cjs +63 -54
- package/build/html/modal.cjs.map +3 -3
- package/build/icon/block.json +5 -3
- package/build/icon/components/custom-inserter/icon-grid.cjs +25 -12
- package/build/icon/components/custom-inserter/icon-grid.cjs.map +2 -2
- package/build/icon/components/custom-inserter/index.cjs +100 -31
- package/build/icon/components/custom-inserter/index.cjs.map +3 -3
- package/build/icon/edit.cjs +11 -12
- package/build/icon/edit.cjs.map +2 -2
- package/build/image/block.json +1 -1
- package/build/image/edit.cjs +1 -35
- package/build/image/edit.cjs.map +2 -2
- package/build/image/image.cjs +23 -18
- package/build/image/image.cjs.map +3 -3
- package/build/image/transforms.cjs +78 -0
- package/build/image/transforms.cjs.map +3 -3
- package/build/image/use-open-image-media-editor-modal.cjs +6 -2
- package/build/image/use-open-image-media-editor-modal.cjs.map +2 -2
- package/build/index.cjs +18 -8
- package/build/index.cjs.map +2 -2
- package/build/latest-posts/edit.cjs +5 -8
- package/build/latest-posts/edit.cjs.map +2 -2
- package/build/list-item/edit.cjs +1 -1
- package/build/list-item/edit.cjs.map +2 -2
- package/build/list-item/hooks/use-enter.cjs +14 -17
- package/build/list-item/hooks/use-enter.cjs.map +3 -3
- package/build/list-item/hooks/use-indent-list-item.cjs +10 -2
- package/build/list-item/hooks/use-indent-list-item.cjs.map +2 -2
- package/build/list-item/hooks/use-space.cjs +3 -2
- package/build/list-item/hooks/use-space.cjs.map +3 -3
- package/build/math/edit.cjs +39 -56
- package/build/math/edit.cjs.map +3 -3
- package/build/media-text/edit.cjs +2 -1
- package/build/media-text/edit.cjs.map +2 -2
- package/build/more/edit.cjs +2 -2
- package/build/more/edit.cjs.map +2 -2
- package/build/navigation/edit/index.cjs +30 -16
- package/build/navigation/edit/index.cjs.map +3 -3
- package/build/navigation/edit/use-layout-custom-properties.cjs +72 -0
- package/build/navigation/edit/use-layout-custom-properties.cjs.map +7 -0
- package/build/navigation/view.cjs +9 -6
- package/build/navigation/view.cjs.map +2 -2
- package/build/navigation-link/edit.cjs +3 -3
- package/build/navigation-link/edit.cjs.map +2 -2
- package/build/navigation-link/link-ui/index.cjs +2 -2
- package/build/navigation-link/link-ui/index.cjs.map +2 -2
- package/build/paragraph/edit.cjs +5 -2
- package/build/paragraph/edit.cjs.map +3 -3
- package/build/paragraph/index.cjs +4 -1
- package/build/paragraph/index.cjs.map +2 -2
- package/build/paragraph/use-enter.cjs +3 -7
- package/build/paragraph/use-enter.cjs.map +3 -3
- package/build/playlist/block.json +29 -10
- package/build/playlist/context.cjs +2 -1
- package/build/playlist/context.cjs.map +2 -2
- package/build/playlist/edit.cjs +328 -39
- package/build/playlist/edit.cjs.map +3 -3
- package/build/playlist/index.cjs +1 -1
- package/build/playlist/index.cjs.map +2 -2
- package/build/playlist/utils.cjs +37 -8
- package/build/playlist/utils.cjs.map +2 -2
- package/build/playlist/view.cjs +83 -13
- package/build/playlist/view.cjs.map +2 -2
- package/build/playlist-track/block.json +4 -2
- package/build/playlist-track/edit.cjs +115 -70
- package/build/playlist-track/edit.cjs.map +2 -2
- package/build/post-content/block.json +1 -0
- package/build/post-content/edit.cjs +36 -15
- package/build/post-content/edit.cjs.map +2 -2
- package/build/post-featured-image/edit.cjs +3 -2
- package/build/post-featured-image/edit.cjs.map +2 -2
- package/build/post-template/block.json +2 -1
- package/build/post-template/edit.cjs +10 -1
- package/build/post-template/edit.cjs.map +2 -2
- package/build/post-terms/edit.cjs +2 -2
- package/build/post-terms/edit.cjs.map +2 -2
- package/build/post-title/edit.cjs +2 -2
- package/build/post-title/edit.cjs.map +2 -2
- package/build/preformatted/edit.cjs +3 -1
- package/build/preformatted/edit.cjs.map +2 -2
- package/build/pullquote/block.json +3 -1
- package/build/pullquote/edit.cjs +5 -3
- package/build/pullquote/edit.cjs.map +2 -2
- package/build/query/block.json +3 -2
- package/build/query/edit/inspector-controls/index.cjs +42 -5
- package/build/query/edit/inspector-controls/index.cjs.map +2 -2
- package/build/query/edit/inspector-controls/offset-controls.cjs +1 -2
- package/build/query/edit/inspector-controls/offset-controls.cjs.map +2 -2
- package/build/query/edit/inspector-controls/pages-control.cjs +0 -1
- package/build/query/edit/inspector-controls/pages-control.cjs.map +2 -2
- package/build/query/edit/query-content.cjs +10 -3
- package/build/query/edit/query-content.cjs.map +2 -2
- package/build/query/index.cjs +2 -1
- package/build/query/index.cjs.map +2 -2
- package/build/quote/block.json +3 -1
- package/build/quote/transforms.cjs +1 -3
- package/build/quote/transforms.cjs.map +2 -2
- package/build/read-more/edit.cjs +3 -1
- package/build/read-more/edit.cjs.map +2 -2
- package/build/rss/edit.cjs +0 -1
- package/build/rss/edit.cjs.map +2 -2
- package/build/site-tagline/edit.cjs +3 -1
- package/build/site-tagline/edit.cjs.map +2 -2
- package/build/site-title/edit.cjs +3 -1
- package/build/site-title/edit.cjs.map +2 -2
- package/build/social-links/edit.cjs +11 -4
- package/build/social-links/edit.cjs.map +2 -2
- package/build/tab-list/block.json +4 -3
- package/build/tab-list/edit.cjs +67 -11
- package/build/tab-list/edit.cjs.map +3 -3
- package/build/tab-list/tab-movers.cjs +87 -0
- package/build/tab-list/tab-movers.cjs.map +7 -0
- package/build/tab-panel/block.json +1 -6
- package/build/tab-panel/edit.cjs +16 -24
- package/build/tab-panel/edit.cjs.map +2 -2
- package/build/tab-panels/block.json +0 -1
- package/build/table/edit.cjs +1 -1
- package/build/table/edit.cjs.map +2 -2
- package/build/tabs/block.json +0 -5
- package/build/tabs/edit.cjs +4 -39
- package/build/tabs/edit.cjs.map +3 -3
- package/build/tabs/use-tab-actions.cjs +23 -1
- package/build/tabs/use-tab-actions.cjs.map +2 -2
- package/build/tabs/use-tab-list-items-sync.cjs +19 -1
- package/build/tabs/use-tab-list-items-sync.cjs.map +2 -2
- package/build/term-name/block.json +1 -3
- package/build/term-name/deprecated.cjs +105 -0
- package/build/term-name/deprecated.cjs.map +7 -0
- package/build/term-name/edit.cjs +11 -37
- package/build/term-name/edit.cjs.map +3 -3
- package/build/term-name/index.cjs +3 -1
- package/build/term-name/index.cjs.map +3 -3
- package/build/utils/caption.cjs +2 -2
- package/build/utils/caption.cjs.map +2 -2
- package/build/utils/waveform-player.cjs +138 -22
- package/build/utils/waveform-player.cjs.map +2 -2
- package/build/utils/waveform-utils.cjs +315 -17
- package/build/utils/waveform-utils.cjs.map +2 -2
- package/build/verse/edit.cjs +3 -1
- package/build/verse/edit.cjs.map +2 -2
- package/build/video/edit.cjs +2 -11
- package/build/video/edit.cjs.map +3 -3
- package/build/video/tracks-editor.cjs +0 -1
- package/build/video/tracks-editor.cjs.map +2 -2
- package/build-module/accordion/block.json +1 -0
- package/build-module/accordion-panel/block.json +1 -0
- package/build-module/button/edit.mjs +19 -14
- package/build-module/button/edit.mjs.map +2 -2
- package/build-module/code/edit.mjs +3 -1
- package/build-module/code/edit.mjs.map +2 -2
- package/build-module/cover/block.json +12 -0
- package/build-module/cover/edit/block-controls.mjs +14 -5
- package/build-module/cover/edit/block-controls.mjs.map +2 -2
- package/build-module/cover/edit/embed-video-url-input.mjs +5 -4
- package/build-module/cover/edit/embed-video-url-input.mjs.map +2 -2
- package/build-module/cover/edit/index.mjs +79 -35
- package/build-module/cover/edit/index.mjs.map +2 -2
- package/build-module/cover/embed-video-utils.mjs +16 -7
- package/build-module/cover/embed-video-utils.mjs.map +2 -2
- package/build-module/details/transforms.mjs +2 -7
- package/build-module/details/transforms.mjs.map +2 -2
- package/build-module/embed/edit.mjs +1 -1
- package/build-module/embed/edit.mjs.map +2 -2
- package/build-module/embed/embed-placeholder.mjs +1 -2
- package/build-module/embed/embed-placeholder.mjs.map +2 -2
- package/build-module/file/edit.mjs +4 -3
- package/build-module/file/edit.mjs.map +2 -2
- package/build-module/file/transforms.mjs +25 -60
- package/build-module/file/transforms.mjs.map +2 -2
- package/build-module/gallery/block.json +4 -2
- package/build-module/gallery/dynamic-gallery.mjs +104 -61
- package/build-module/gallery/dynamic-gallery.mjs.map +2 -2
- package/build-module/gallery/edit.mjs +3 -3
- package/build-module/gallery/edit.mjs.map +2 -2
- package/build-module/gallery/gap-styles.mjs +53 -14
- package/build-module/gallery/gap-styles.mjs.map +2 -2
- package/build-module/gallery/use-dynamic-gallery.mjs +16 -9
- package/build-module/gallery/use-dynamic-gallery.mjs.map +2 -2
- package/build-module/group/transforms.mjs +2 -5
- package/build-module/group/transforms.mjs.map +2 -2
- package/build-module/heading/edit.mjs +1 -1
- package/build-module/heading/edit.mjs.map +2 -2
- package/build-module/html/modal.mjs +68 -55
- package/build-module/html/modal.mjs.map +2 -2
- package/build-module/icon/block.json +5 -3
- package/build-module/icon/components/custom-inserter/icon-grid.mjs +25 -12
- package/build-module/icon/components/custom-inserter/icon-grid.mjs.map +2 -2
- package/build-module/icon/components/custom-inserter/index.mjs +102 -33
- package/build-module/icon/components/custom-inserter/index.mjs.map +2 -2
- package/build-module/icon/edit.mjs +11 -12
- package/build-module/icon/edit.mjs.map +2 -2
- package/build-module/image/block.json +1 -1
- package/build-module/image/edit.mjs +1 -35
- package/build-module/image/edit.mjs.map +2 -2
- package/build-module/image/image.mjs +23 -18
- package/build-module/image/image.mjs.map +2 -2
- package/build-module/image/transforms.mjs +78 -0
- package/build-module/image/transforms.mjs.map +2 -2
- package/build-module/image/use-open-image-media-editor-modal.mjs +6 -2
- package/build-module/image/use-open-image-media-editor-modal.mjs.map +2 -2
- package/build-module/index.mjs +18 -8
- package/build-module/index.mjs.map +2 -2
- package/build-module/latest-posts/edit.mjs +5 -8
- package/build-module/latest-posts/edit.mjs.map +2 -2
- package/build-module/list-item/edit.mjs +1 -1
- package/build-module/list-item/edit.mjs.map +2 -2
- package/build-module/list-item/hooks/use-enter.mjs +15 -21
- package/build-module/list-item/hooks/use-enter.mjs.map +2 -2
- package/build-module/list-item/hooks/use-indent-list-item.mjs +10 -2
- package/build-module/list-item/hooks/use-indent-list-item.mjs.map +2 -2
- package/build-module/list-item/hooks/use-space.mjs +4 -6
- package/build-module/list-item/hooks/use-space.mjs.map +2 -2
- package/build-module/math/edit.mjs +41 -60
- package/build-module/math/edit.mjs.map +2 -2
- package/build-module/media-text/edit.mjs +2 -1
- package/build-module/media-text/edit.mjs.map +2 -2
- package/build-module/more/edit.mjs +2 -2
- package/build-module/more/edit.mjs.map +2 -2
- package/build-module/navigation/edit/index.mjs +30 -16
- package/build-module/navigation/edit/index.mjs.map +2 -2
- package/build-module/navigation/edit/use-layout-custom-properties.mjs +51 -0
- package/build-module/navigation/edit/use-layout-custom-properties.mjs.map +7 -0
- package/build-module/navigation/view.mjs +9 -6
- package/build-module/navigation/view.mjs.map +2 -2
- package/build-module/navigation-link/edit.mjs +3 -3
- package/build-module/navigation-link/edit.mjs.map +2 -2
- package/build-module/navigation-link/link-ui/index.mjs +2 -2
- package/build-module/navigation-link/link-ui/index.mjs.map +2 -2
- package/build-module/paragraph/edit.mjs +6 -2
- package/build-module/paragraph/edit.mjs.map +2 -2
- package/build-module/paragraph/index.mjs +4 -1
- package/build-module/paragraph/index.mjs.map +2 -2
- package/build-module/paragraph/use-enter.mjs +4 -11
- package/build-module/paragraph/use-enter.mjs.map +2 -2
- package/build-module/playlist/block.json +29 -10
- package/build-module/playlist/context.mjs +2 -1
- package/build-module/playlist/context.mjs.map +2 -2
- package/build-module/playlist/edit.mjs +331 -41
- package/build-module/playlist/edit.mjs.map +2 -2
- package/build-module/playlist/index.mjs +1 -1
- package/build-module/playlist/index.mjs.map +2 -2
- package/build-module/playlist/utils.mjs +35 -7
- package/build-module/playlist/utils.mjs.map +2 -2
- package/build-module/playlist/view.mjs +89 -14
- package/build-module/playlist/view.mjs.map +2 -2
- package/build-module/playlist-track/block.json +4 -2
- package/build-module/playlist-track/edit.mjs +117 -71
- package/build-module/playlist-track/edit.mjs.map +2 -2
- package/build-module/post-content/block.json +1 -0
- package/build-module/post-content/edit.mjs +37 -15
- package/build-module/post-content/edit.mjs.map +2 -2
- package/build-module/post-featured-image/edit.mjs +3 -2
- package/build-module/post-featured-image/edit.mjs.map +2 -2
- package/build-module/post-template/block.json +2 -1
- package/build-module/post-template/edit.mjs +10 -1
- package/build-module/post-template/edit.mjs.map +2 -2
- package/build-module/post-terms/edit.mjs +2 -2
- package/build-module/post-terms/edit.mjs.map +2 -2
- package/build-module/post-title/edit.mjs +2 -2
- package/build-module/post-title/edit.mjs.map +2 -2
- package/build-module/preformatted/edit.mjs +3 -1
- package/build-module/preformatted/edit.mjs.map +2 -2
- package/build-module/pullquote/block.json +3 -1
- package/build-module/pullquote/edit.mjs +5 -3
- package/build-module/pullquote/edit.mjs.map +2 -2
- package/build-module/query/block.json +3 -2
- package/build-module/query/edit/inspector-controls/index.mjs +44 -6
- package/build-module/query/edit/inspector-controls/index.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/offset-controls.mjs +2 -3
- package/build-module/query/edit/inspector-controls/offset-controls.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/pages-control.mjs +0 -1
- package/build-module/query/edit/inspector-controls/pages-control.mjs.map +2 -2
- package/build-module/query/edit/query-content.mjs +10 -3
- package/build-module/query/edit/query-content.mjs.map +2 -2
- package/build-module/query/index.mjs +2 -1
- package/build-module/query/index.mjs.map +2 -2
- package/build-module/quote/block.json +3 -1
- package/build-module/quote/transforms.mjs +2 -4
- package/build-module/quote/transforms.mjs.map +2 -2
- package/build-module/read-more/edit.mjs +3 -1
- package/build-module/read-more/edit.mjs.map +2 -2
- package/build-module/rss/edit.mjs +0 -1
- package/build-module/rss/edit.mjs.map +2 -2
- package/build-module/site-tagline/edit.mjs +3 -1
- package/build-module/site-tagline/edit.mjs.map +2 -2
- package/build-module/site-title/edit.mjs +3 -1
- package/build-module/site-title/edit.mjs.map +2 -2
- package/build-module/social-links/edit.mjs +11 -4
- package/build-module/social-links/edit.mjs.map +2 -2
- package/build-module/tab-list/block.json +4 -3
- package/build-module/tab-list/edit.mjs +74 -13
- package/build-module/tab-list/edit.mjs.map +2 -2
- package/build-module/tab-list/tab-movers.mjs +59 -0
- package/build-module/tab-list/tab-movers.mjs.map +7 -0
- package/build-module/tab-panel/block.json +1 -6
- package/build-module/tab-panel/edit.mjs +17 -25
- package/build-module/tab-panel/edit.mjs.map +2 -2
- package/build-module/tab-panels/block.json +0 -1
- package/build-module/table/edit.mjs +1 -1
- package/build-module/table/edit.mjs.map +2 -2
- package/build-module/tabs/block.json +0 -5
- package/build-module/tabs/edit.mjs +5 -45
- package/build-module/tabs/edit.mjs.map +2 -2
- package/build-module/tabs/use-tab-actions.mjs +23 -1
- package/build-module/tabs/use-tab-actions.mjs.map +2 -2
- package/build-module/tabs/use-tab-list-items-sync.mjs +19 -1
- package/build-module/tabs/use-tab-list-items-sync.mjs.map +2 -2
- package/build-module/term-name/block.json +1 -3
- package/build-module/term-name/deprecated.mjs +74 -0
- package/build-module/term-name/deprecated.mjs.map +7 -0
- package/build-module/term-name/edit.mjs +11 -28
- package/build-module/term-name/edit.mjs.map +2 -2
- package/build-module/term-name/index.mjs +3 -1
- package/build-module/term-name/index.mjs.map +2 -2
- package/build-module/utils/caption.mjs +2 -2
- package/build-module/utils/caption.mjs.map +2 -2
- package/build-module/utils/waveform-player.mjs +144 -23
- package/build-module/utils/waveform-player.mjs.map +2 -2
- package/build-module/utils/waveform-utils.mjs +310 -16
- package/build-module/utils/waveform-utils.mjs.map +2 -2
- package/build-module/verse/edit.mjs +3 -1
- package/build-module/verse/edit.mjs.map +2 -2
- package/build-module/video/edit.mjs +2 -11
- package/build-module/video/edit.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-style/cover/editor-rtl.css +3 -0
- package/build-style/cover/editor.css +3 -0
- package/build-style/editor-rtl.css +61 -59
- package/build-style/editor.css +61 -59
- package/build-style/icon/editor-rtl.css +80 -10
- package/build-style/icon/editor.css +80 -10
- package/build-style/image/editor-rtl.css +3 -32
- package/build-style/image/editor.css +3 -32
- package/build-style/more/editor-rtl.css +2 -2
- package/build-style/more/editor.css +2 -2
- package/build-style/navigation/editor-rtl.css +3 -4
- package/build-style/navigation/editor.css +3 -4
- package/build-style/navigation-link/editor-rtl.css +1 -1
- package/build-style/navigation-link/editor.css +1 -1
- package/build-style/nextpage/editor-rtl.css +2 -2
- package/build-style/nextpage/editor.css +2 -2
- package/build-style/playlist/editor-rtl.css +4 -3
- package/build-style/playlist/editor.css +4 -3
- package/build-style/playlist/style-rtl.css +81 -5
- package/build-style/playlist/style.css +81 -5
- package/build-style/playlist-track/style-rtl.css +10 -0
- package/build-style/playlist-track/style.css +10 -0
- package/build-style/pullquote/editor-rtl.css +4 -0
- package/build-style/pullquote/editor.css +4 -0
- package/build-style/style-rtl.css +91 -5
- package/build-style/style.css +91 -5
- package/build-style/tab-list/editor-rtl.css +101 -0
- package/build-style/tab-list/editor.css +101 -0
- package/build-style/video/editor-rtl.css +1 -1
- package/build-style/video/editor.css +1 -1
- package/build-types/table-of-contents/list.d.ts +1 -1
- package/build-types/table-of-contents/list.d.ts.map +1 -1
- package/package.json +47 -45
- package/src/accordion/README.md +1 -0
- package/src/accordion/block.json +1 -0
- package/src/accordion-panel/block.json +1 -0
- package/src/breadcrumbs/index.php +3 -1
- package/src/button/edit.js +21 -15
- package/src/button/index.php +1 -1
- package/src/code/edit.js +7 -2
- package/src/cover/README.md +60 -0
- package/src/cover/block.json +12 -0
- package/src/cover/edit/block-controls.js +26 -11
- package/src/cover/edit/embed-video-url-input.js +5 -4
- package/src/cover/edit/index.js +109 -46
- package/src/cover/editor.scss +6 -0
- package/src/cover/embed-video-utils.js +38 -13
- package/src/cover/index.php +9 -2
- package/src/details/transforms.js +2 -7
- package/src/editor.scss +1 -0
- package/src/embed/edit.js +3 -1
- package/src/embed/embed-placeholder.js +9 -8
- package/src/file/edit.js +8 -8
- package/src/file/transforms.js +28 -60
- package/src/form/index.php +6 -4
- package/src/gallery/README.md +1 -1
- package/src/gallery/block.json +4 -2
- package/src/gallery/dynamic-gallery.js +133 -74
- package/src/gallery/edit.js +3 -3
- package/src/gallery/gap-styles.js +79 -20
- package/src/gallery/index.php +103 -43
- package/src/gallery/use-dynamic-gallery.js +27 -12
- package/src/group/transforms.js +2 -5
- package/src/heading/edit.js +1 -1
- package/src/html/modal.js +13 -2
- package/src/icon/README.md +1 -3
- package/src/icon/block.json +5 -3
- package/src/icon/components/custom-inserter/icon-grid.js +40 -11
- package/src/icon/components/custom-inserter/index.js +98 -25
- package/src/icon/edit.js +11 -17
- package/src/icon/editor.scss +33 -11
- package/src/image/README.md +1 -1
- package/src/image/block.json +1 -1
- package/src/image/edit.js +1 -57
- package/src/image/editor.scss +6 -44
- package/src/image/image.js +56 -27
- package/src/image/test/use-open-image-media-editor-modal.js +37 -1
- package/src/image/transforms.js +128 -0
- package/src/image/use-open-image-media-editor-modal.js +8 -1
- package/src/index.js +19 -7
- package/src/latest-posts/edit.js +5 -8
- package/src/latest-posts/index.php +49 -18
- package/src/list-item/edit.js +1 -1
- package/src/list-item/hooks/use-enter.js +15 -22
- package/src/list-item/hooks/use-indent-list-item.js +10 -1
- package/src/list-item/hooks/use-space.js +4 -6
- package/src/math/edit.js +42 -59
- package/src/media-text/edit.js +1 -0
- package/src/media-text/editor.scss +1 -0
- package/src/media-text/index.php +11 -2
- package/src/more/edit.js +7 -4
- package/src/more/editor.scss +1 -1
- package/src/navigation/edit/index.js +52 -36
- package/src/navigation/edit/test/layout-custom-properties.js +138 -0
- package/src/navigation/edit/use-layout-custom-properties.js +84 -0
- package/src/navigation/editor.scss +1 -2
- package/src/navigation/index.php +123 -12
- package/src/navigation/test/view.js +51 -0
- package/src/navigation/view.js +15 -14
- package/src/navigation-link/edit.js +11 -7
- package/src/navigation-link/editor.scss +1 -1
- package/src/navigation-link/index.php +70 -3
- package/src/navigation-link/link-ui/index.js +2 -1
- package/src/navigation-link/test/__snapshots__/hooks.js.snap +1 -1
- package/src/navigation-submenu/index.php +6 -3
- package/src/nextpage/editor.scss +1 -1
- package/src/page-list/index.php +4 -3
- package/src/paragraph/edit.js +9 -2
- package/src/paragraph/index.js +4 -1
- package/src/paragraph/use-enter.js +4 -11
- package/src/pattern/index.php +5 -5
- package/src/playlist/README.md +17 -18
- package/src/playlist/block.json +29 -10
- package/src/playlist/context.js +1 -0
- package/src/playlist/edit.js +395 -59
- package/src/playlist/editor.scss +4 -5
- package/src/playlist/index.js +1 -1
- package/src/playlist/index.php +71 -22
- package/src/playlist/style.scss +54 -1
- package/src/playlist/test/edit-component.js +139 -0
- package/src/playlist/test/edit.js +43 -2
- package/src/playlist/utils.js +49 -10
- package/src/playlist/view.js +97 -16
- package/src/playlist-track/README.md +3 -3
- package/src/playlist-track/block.json +4 -2
- package/src/playlist-track/edit.js +116 -75
- package/src/playlist-track/index.php +26 -11
- package/src/playlist-track/style.scss +10 -0
- package/src/playlist-track/test/edit.js +253 -0
- package/src/post-content/README.md +1 -0
- package/src/post-content/block.json +1 -0
- package/src/post-content/edit.js +45 -16
- package/src/post-excerpt/index.php +4 -1
- package/src/post-featured-image/edit.js +3 -2
- package/src/post-featured-image/index.php +4 -1
- package/src/post-template/README.md +1 -0
- package/src/post-template/block.json +2 -1
- package/src/post-template/edit.js +9 -0
- package/src/post-terms/edit.js +7 -4
- package/src/post-title/edit.js +5 -3
- package/src/preformatted/edit.js +7 -2
- package/src/pullquote/README.md +1 -0
- package/src/pullquote/block.json +3 -1
- package/src/pullquote/edit.js +9 -4
- package/src/pullquote/editor.scss +6 -0
- package/src/query/README.md +2 -1
- package/src/query/block.json +3 -2
- package/src/query/edit/inspector-controls/index.js +47 -4
- package/src/query/edit/inspector-controls/offset-controls.js +2 -3
- package/src/query/edit/inspector-controls/pages-control.js +0 -1
- package/src/query/edit/query-content.js +19 -3
- package/src/query/index.js +1 -0
- package/src/quote/README.md +1 -0
- package/src/quote/block.json +3 -1
- package/src/quote/transforms.js +2 -4
- package/src/read-more/edit.js +7 -2
- package/src/rss/edit.js +0 -1
- package/src/rss/index.php +10 -4
- package/src/site-tagline/edit.js +7 -2
- package/src/site-title/edit.js +7 -2
- package/src/social-link/index.php +19 -9
- package/src/social-links/edit.js +21 -12
- package/src/tab-list/README.md +4 -5
- package/src/tab-list/block.json +4 -3
- package/src/tab-list/edit.js +92 -28
- package/src/tab-list/editor.scss +9 -0
- package/src/tab-list/index.php +9 -4
- package/src/tab-list/tab-movers.js +72 -0
- package/src/tab-panel/README.md +4 -6
- package/src/tab-panel/block.json +1 -6
- package/src/tab-panel/edit.js +20 -33
- package/src/tab-panels/README.md +5 -3
- package/src/tab-panels/block.json +0 -1
- package/src/table/edit.js +1 -1
- package/src/table-of-contents/index.php +386 -1
- package/src/tabs/README.md +18 -9
- package/src/tabs/block.json +0 -5
- package/src/tabs/edit.js +7 -64
- package/src/tabs/use-tab-actions.js +32 -3
- package/src/tabs/use-tab-list-items-sync.js +24 -4
- package/src/tag-cloud/index.php +3 -2
- package/src/template-part/index.php +3 -17
- package/src/term-name/README.md +1 -1
- package/src/term-name/block.json +1 -3
- package/src/term-name/deprecated.js +74 -0
- package/src/term-name/edit.js +2 -18
- package/src/term-name/index.js +2 -0
- package/src/utils/caption.js +7 -4
- package/src/utils/media-control.scss +1 -5
- package/src/utils/test/waveform-player.js +297 -34
- package/src/utils/test/waveform-utils.js +473 -5
- package/src/utils/waveform-player.js +189 -59
- package/src/utils/waveform-utils.js +443 -40
- package/src/verse/edit.js +7 -2
- package/src/video/edit.js +0 -8
- package/src/video/editor.scss +1 -1
- package/src/video/index.php +2 -2
- package/src/video/tracks-editor.js +0 -1
- package/build/image/animated-gif-convert-control.cjs +0 -105
- package/build/image/animated-gif-convert-control.cjs.map +0 -7
- package/build/utils/gif-conversion-attributes.cjs +0 -40
- package/build/utils/gif-conversion-attributes.cjs.map +0 -7
- package/build/video/gif-restore-control.cjs +0 -73
- package/build/video/gif-restore-control.cjs.map +0 -7
- package/build-module/image/animated-gif-convert-control.mjs +0 -87
- package/build-module/image/animated-gif-convert-control.mjs.map +0 -7
- package/build-module/utils/gif-conversion-attributes.mjs +0 -15
- package/build-module/utils/gif-conversion-attributes.mjs.map +0 -7
- package/build-module/video/gif-restore-control.mjs +0 -55
- package/build-module/video/gif-restore-control.mjs.map +0 -7
- package/src/image/animated-gif-convert-control.js +0 -135
- package/src/image/test/animated-gif-convert-control.js +0 -276
- package/src/utils/gif-conversion-attributes.js +0 -30
- package/src/utils/test/gif-conversion-attributes.js +0 -60
- package/src/video/gif-restore-control.js +0 -92
package/build/table/edit.cjs
CHANGED
|
@@ -301,7 +301,7 @@ function TableEdit({
|
|
|
301
301
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.BlockControls, { group: "block", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
302
302
|
import_block_editor.AlignmentControl,
|
|
303
303
|
{
|
|
304
|
-
label: (0, import_i18n.__)("
|
|
304
|
+
label: (0, import_i18n.__)("Align column content"),
|
|
305
305
|
alignmentControls: ALIGNMENT_CONTROLS,
|
|
306
306
|
value: getCellAlignment(),
|
|
307
307
|
onChange: (nextAlign) => onChangeColumnAlignment(nextAlign)
|
package/build/table/edit.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/table/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tmemo,\n\tuseCallback,\n\tuseEffect,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\nimport {\n\tInspectorControls,\n\tBlockControls,\n\tRichText,\n\tBlockIcon,\n\tAlignmentControl,\n\tuseBlockProps,\n\t__experimentalUseColorProps as useColorProps,\n\t__experimentalUseBorderProps as useBorderProps,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tButton,\n\tPlaceholder,\n\tTextControl,\n\tToggleControl,\n\tToolbarDropdownMenu,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport {\n\talignLeft,\n\talignRight,\n\talignCenter,\n\tblockTable as icon,\n\ttableColumnAfter,\n\ttableColumnBefore,\n\ttableColumnDelete,\n\ttableRowAfter,\n\ttableRowBefore,\n\ttableRowDelete,\n\ttable,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport {\n\tcreateTable,\n\tupdateSelectedCell,\n\tgetCellAttribute,\n\tinsertRow,\n\tdeleteRow,\n\tinsertColumn,\n\tdeleteColumn,\n\ttoggleSection,\n\tisEmptyTableSection,\n} from './state';\nimport { Caption } from '../utils/caption';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst ALIGNMENT_CONTROLS = [\n\t{\n\t\ticon: alignLeft,\n\t\ttitle: __( 'Align column left' ),\n\t\talign: 'left',\n\t},\n\t{\n\t\ticon: alignCenter,\n\t\ttitle: __( 'Align column center' ),\n\t\talign: 'center',\n\t},\n\t{\n\t\ticon: alignRight,\n\t\ttitle: __( 'Align column right' ),\n\t\talign: 'right',\n\t},\n];\n\nconst cellAriaLabel = {\n\thead: __( 'Header cell text' ),\n\tbody: __( 'Body cell text' ),\n\tfoot: __( 'Footer cell text' ),\n};\n\nconst placeholder = {\n\thead: _x( 'Header label', 'table header' ),\n\tfoot: _x( 'Footer label', 'table footer' ),\n};\n\nfunction TSection( { name, ...props } ) {\n\tconst TagName = `t${ name }`;\n\treturn <TagName { ...props } />;\n}\n\nfunction TableEdit( {\n\tattributes,\n\tsetAttributes,\n\tinsertBlocksAfter,\n\tisSelected: isSingleSelected,\n} ) {\n\tconst { hasFixedLayout, head, foot } = attributes;\n\tconst [ initialRowCount, setInitialRowCount ] = useState( 2 );\n\tconst [ initialColumnCount, setInitialColumnCount ] = useState( 2 );\n\tconst [ selectedCell, setSelectedCell ] = useState();\n\n\tconst colorProps = useColorProps( attributes );\n\tconst borderProps = useBorderProps( attributes );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst tableRef = useRef();\n\tconst [ hasTableCreated, setHasTableCreated ] = useState( false );\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\t/**\n\t * Updates the initial column count used for table creation.\n\t *\n\t * @param {number} count New initial column count.\n\t */\n\tfunction onChangeInitialColumnCount( count ) {\n\t\tsetInitialColumnCount( count );\n\t}\n\n\t/**\n\t * Updates the initial row count used for table creation.\n\t *\n\t * @param {number} count New initial row count.\n\t */\n\tfunction onChangeInitialRowCount( count ) {\n\t\tsetInitialRowCount( count );\n\t}\n\n\t/**\n\t * Creates a table based on dimensions in local state.\n\t *\n\t * @param {Object} event Form submit event.\n\t */\n\tfunction onCreateTable( event ) {\n\t\tevent.preventDefault();\n\n\t\tsetAttributes(\n\t\t\tcreateTable( {\n\t\t\t\trowCount: parseInt( initialRowCount, 10 ) || 2,\n\t\t\t\tcolumnCount: parseInt( initialColumnCount, 10 ) || 2,\n\t\t\t} )\n\t\t);\n\t\tsetHasTableCreated( true );\n\t}\n\n\t/**\n\t * Toggles whether the table has a fixed layout or not.\n\t */\n\tfunction onChangeFixedLayout() {\n\t\tsetAttributes( { hasFixedLayout: ! hasFixedLayout } );\n\t}\n\n\t/**\n\t * Changes the content of the currently selected cell.\n\t *\n\t * @param {Array} content A RichText content value.\n\t */\n\tconst onChange = useCallback(\n\t\tfunction ( content ) {\n\t\t\tif ( ! selectedCell ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsetAttributes( ( currentAttributes ) =>\n\t\t\t\tupdateSelectedCell(\n\t\t\t\t\tcurrentAttributes,\n\t\t\t\t\tselectedCell,\n\t\t\t\t\t( cellAttributes ) => ( {\n\t\t\t\t\t\t...cellAttributes,\n\t\t\t\t\t\tcontent,\n\t\t\t\t\t} )\n\t\t\t\t)\n\t\t\t);\n\t\t},\n\t\t[ selectedCell, setAttributes ]\n\t);\n\n\t/**\n\t * Align text within the a column.\n\t *\n\t * @param {string} align The new alignment to apply to the column.\n\t */\n\tfunction onChangeColumnAlignment( align ) {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Convert the cell selection to a column selection so that alignment\n\t\t// is applied to the entire column.\n\t\tconst columnSelection = {\n\t\t\ttype: 'column',\n\t\t\tcolumnIndex: selectedCell.columnIndex,\n\t\t};\n\n\t\tconst newAttributes = updateSelectedCell(\n\t\t\tattributes,\n\t\t\tcolumnSelection,\n\t\t\t( cellAttributes ) => ( {\n\t\t\t\t...cellAttributes,\n\t\t\t\talign,\n\t\t\t} )\n\t\t);\n\t\tsetAttributes( newAttributes );\n\t}\n\n\t/**\n\t * Get the alignment of the currently selected cell.\n\t *\n\t * @return {string | undefined} The new alignment to apply to the column.\n\t */\n\tfunction getCellAlignment() {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn getCellAttribute( attributes, selectedCell, 'align' );\n\t}\n\n\t/**\n\t * Add or remove a `head` table section.\n\t */\n\tfunction onToggleHeaderSection() {\n\t\tsetAttributes( toggleSection( attributes, 'head' ) );\n\t}\n\n\t/**\n\t * Add or remove a `foot` table section.\n\t */\n\tfunction onToggleFooterSection() {\n\t\tsetAttributes( toggleSection( attributes, 'foot' ) );\n\t}\n\n\t/**\n\t * Inserts a row at the currently selected row index, plus `delta`.\n\t *\n\t * @param {number} delta Offset for selected row index at which to insert.\n\t */\n\tfunction onInsertRow( delta ) {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { sectionName, rowIndex } = selectedCell;\n\t\tconst newRowIndex = rowIndex + delta;\n\n\t\tsetAttributes(\n\t\t\tinsertRow( attributes, {\n\t\t\t\tsectionName,\n\t\t\t\trowIndex: newRowIndex,\n\t\t\t} )\n\t\t);\n\t\t// Select the first cell of the new row.\n\t\tsetSelectedCell( {\n\t\t\tsectionName,\n\t\t\trowIndex: newRowIndex,\n\t\t\tcolumnIndex: 0,\n\t\t\ttype: 'cell',\n\t\t} );\n\t}\n\n\t/**\n\t * Inserts a row before the currently selected row.\n\t */\n\tfunction onInsertRowBefore() {\n\t\tonInsertRow( 0 );\n\t}\n\n\t/**\n\t * Inserts a row after the currently selected row.\n\t */\n\tfunction onInsertRowAfter() {\n\t\tonInsertRow( 1 );\n\t}\n\n\t/**\n\t * Deletes the currently selected row.\n\t */\n\tfunction onDeleteRow() {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { sectionName, rowIndex } = selectedCell;\n\n\t\tsetSelectedCell();\n\t\tsetAttributes( deleteRow( attributes, { sectionName, rowIndex } ) );\n\t}\n\n\t/**\n\t * Inserts a column at the currently selected column index, plus `delta`.\n\t *\n\t * @param {number} delta Offset for selected column index at which to insert.\n\t */\n\tfunction onInsertColumn( delta = 0 ) {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { columnIndex } = selectedCell;\n\t\tconst newColumnIndex = columnIndex + delta;\n\n\t\tsetAttributes(\n\t\t\tinsertColumn( attributes, {\n\t\t\t\tcolumnIndex: newColumnIndex,\n\t\t\t} )\n\t\t);\n\t\t// Select the first cell of the new column.\n\t\tsetSelectedCell( {\n\t\t\trowIndex: 0,\n\t\t\tcolumnIndex: newColumnIndex,\n\t\t\ttype: 'cell',\n\t\t} );\n\t}\n\n\t/**\n\t * Inserts a column before the currently selected column.\n\t */\n\tfunction onInsertColumnBefore() {\n\t\tonInsertColumn( 0 );\n\t}\n\n\t/**\n\t * Inserts a column after the currently selected column.\n\t */\n\tfunction onInsertColumnAfter() {\n\t\tonInsertColumn( 1 );\n\t}\n\n\t/**\n\t * Deletes the currently selected column.\n\t */\n\tfunction onDeleteColumn() {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { sectionName, columnIndex } = selectedCell;\n\n\t\tsetSelectedCell();\n\t\tsetAttributes(\n\t\t\tdeleteColumn( attributes, { sectionName, columnIndex } )\n\t\t);\n\t}\n\n\tuseEffect( () => {\n\t\tif ( ! isSingleSelected ) {\n\t\t\tsetSelectedCell();\n\t\t}\n\t}, [ isSingleSelected ] );\n\n\tuseEffect( () => {\n\t\tif ( hasTableCreated ) {\n\t\t\ttableRef?.current\n\t\t\t\t?.querySelector( 'td div[contentEditable=\"true\"]' )\n\t\t\t\t?.focus();\n\t\t\tsetHasTableCreated( false );\n\t\t}\n\t}, [ hasTableCreated ] );\n\n\tconst sections = [ 'head', 'body', 'foot' ].filter(\n\t\t( name ) => ! isEmptyTableSection( attributes[ name ] )\n\t);\n\n\tconst tableControls = [\n\t\t{\n\t\t\ticon: tableRowBefore,\n\t\t\ttitle: __( 'Insert row before' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertRowBefore,\n\t\t},\n\t\t{\n\t\t\ticon: tableRowAfter,\n\t\t\ttitle: __( 'Insert row after' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertRowAfter,\n\t\t},\n\t\t{\n\t\t\ticon: tableRowDelete,\n\t\t\ttitle: __( 'Delete row' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onDeleteRow,\n\t\t},\n\t\t{\n\t\t\ticon: tableColumnBefore,\n\t\t\ttitle: __( 'Insert column before' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertColumnBefore,\n\t\t},\n\t\t{\n\t\t\ticon: tableColumnAfter,\n\t\t\ttitle: __( 'Insert column after' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertColumnAfter,\n\t\t},\n\t\t{\n\t\t\ticon: tableColumnDelete,\n\t\t\ttitle: __( 'Delete column' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onDeleteColumn,\n\t\t},\n\t];\n\n\tconst renderedSections = sections.map( ( name ) => (\n\t\t<TSection name={ name } key={ name }>\n\t\t\t{ attributes[ name ].map( ( { cells }, rowIndex ) => (\n\t\t\t\t<tr key={ rowIndex }>\n\t\t\t\t\t{ cells.map( ( cellProps, columnIndex ) => {\n\t\t\t\t\t\tconst isSelected =\n\t\t\t\t\t\t\tselectedCell?.sectionName === name &&\n\t\t\t\t\t\t\tselectedCell?.rowIndex === rowIndex &&\n\t\t\t\t\t\t\tselectedCell?.columnIndex === columnIndex;\n\n\t\t\t\t\t\t// Important - the Cell component is memoized to improve typing performance.\n\t\t\t\t\t\t// ensure all props passed have stable references.\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<Cell\n\t\t\t\t\t\t\t\tkey={ columnIndex }\n\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\trowIndex={ rowIndex }\n\t\t\t\t\t\t\t\tcolumnIndex={ columnIndex }\n\t\t\t\t\t\t\t\tonChange={\n\t\t\t\t\t\t\t\t\t// Only pass the `onChange` handler to the selectedCell.\n\t\t\t\t\t\t\t\t\t// Cell components are memoized, so it's best to avoid\n\t\t\t\t\t\t\t\t\t// passing in a value that will cause all cells to re-render\n\t\t\t\t\t\t\t\t\t// whenever it changes.\n\t\t\t\t\t\t\t\t\tisSelected ? onChange : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsetSelectedCell={ setSelectedCell }\n\t\t\t\t\t\t\t\t{ ...cellProps }\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</tr>\n\t\t\t) ) }\n\t\t</TSection>\n\t) );\n\n\tconst isEmpty = ! sections.length;\n\n\treturn (\n\t\t<figure { ...useBlockProps( { ref: tableRef } ) }>\n\t\t\t{ ! isEmpty && blockEditingMode === 'default' && (\n\t\t\t\t<>\n\t\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t\t<AlignmentControl\n\t\t\t\t\t\t\tlabel={ __( 'Change column alignment' ) }\n\t\t\t\t\t\t\talignmentControls={ ALIGNMENT_CONTROLS }\n\t\t\t\t\t\t\tvalue={ getCellAlignment() }\n\t\t\t\t\t\t\tonChange={ ( nextAlign ) =>\n\t\t\t\t\t\t\t\tonChangeColumnAlignment( nextAlign )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t\t<ToolbarDropdownMenu\n\t\t\t\t\t\t\ticon={ table }\n\t\t\t\t\t\t\tlabel={ __( 'Edit table' ) }\n\t\t\t\t\t\t\tcontrols={ tableControls }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\thasFixedLayout: true,\n\t\t\t\t\t\t\thead: [],\n\t\t\t\t\t\t\tfoot: [],\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => hasFixedLayout !== true }\n\t\t\t\t\t\tlabel={ __( 'Fixed width table cells' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { hasFixedLayout: true } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Fixed width table cells' ) }\n\t\t\t\t\t\t\tchecked={ !! hasFixedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeFixedLayout }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t{ ! isEmpty && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\thasValue={ () => head && head.length }\n\t\t\t\t\t\t\t\tlabel={ __( 'Header section' ) }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { head: [] } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Header section' ) }\n\t\t\t\t\t\t\t\t\tchecked={ !! ( head && head.length ) }\n\t\t\t\t\t\t\t\t\tonChange={ onToggleHeaderSection }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\thasValue={ () => foot && foot.length }\n\t\t\t\t\t\t\t\tlabel={ __( 'Footer section' ) }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { foot: [] } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Footer section' ) }\n\t\t\t\t\t\t\t\t\tchecked={ !! ( foot && foot.length ) }\n\t\t\t\t\t\t\t\t\tonChange={ onToggleFooterSection }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t{ ! isEmpty && (\n\t\t\t\t<table\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\tcolorProps.className,\n\t\t\t\t\t\tborderProps.className,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'has-fixed-layout': hasFixedLayout,\n\t\t\t\t\t\t\t// This is required in the editor only to overcome\n\t\t\t\t\t\t\t// the fact the editor rewrites individual border\n\t\t\t\t\t\t\t// widths into a shorthand format.\n\t\t\t\t\t\t\t'has-individual-borders': hasSplitBorders(\n\t\t\t\t\t\t\t\tattributes?.style?.border\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\tstyle={ { ...colorProps.style, ...borderProps.style } }\n\t\t\t\t>\n\t\t\t\t\t{ renderedSections }\n\t\t\t\t</table>\n\t\t\t) }\n\t\t\t{ isEmpty ? (\n\t\t\t\t<Placeholder\n\t\t\t\t\tlabel={ __( 'Table' ) }\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } showColors /> }\n\t\t\t\t\tinstructions={ __( 'Insert a table for sharing data.' ) }\n\t\t\t\t>\n\t\t\t\t\t<form\n\t\t\t\t\t\tclassName=\"blocks-table__placeholder-form\"\n\t\t\t\t\t\tonSubmit={ onCreateTable }\n\t\t\t\t\t>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\tlabel={ __( 'Column count' ) }\n\t\t\t\t\t\t\tvalue={ initialColumnCount }\n\t\t\t\t\t\t\tonChange={ onChangeInitialColumnCount }\n\t\t\t\t\t\t\tmin=\"1\"\n\t\t\t\t\t\t\tclassName=\"blocks-table__placeholder-input\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\tlabel={ __( 'Row count' ) }\n\t\t\t\t\t\t\tvalue={ initialRowCount }\n\t\t\t\t\t\t\tonChange={ onChangeInitialRowCount }\n\t\t\t\t\t\t\tmin=\"1\"\n\t\t\t\t\t\t\tclassName=\"blocks-table__placeholder-input\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create Table' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</form>\n\t\t\t\t</Placeholder>\n\t\t\t) : (\n\t\t\t\t<Caption\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisSelected={ isSingleSelected }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\tlabel={ __( 'Table caption text' ) }\n\t\t\t\t\tshowToolbarButton={\n\t\t\t\t\t\tisSingleSelected && blockEditingMode === 'default'\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t</figure>\n\t);\n}\n\nconst Cell = memo( function ( {\n\ttag: CellTag,\n\tname,\n\tscope,\n\tcolspan,\n\trowspan,\n\trowIndex,\n\tcolumnIndex,\n\talign,\n\tcontent,\n\tonChange,\n\tsetSelectedCell,\n} ) {\n\treturn (\n\t\t<CellTag\n\t\t\tscope={ CellTag === 'th' ? scope : undefined }\n\t\t\tcolSpan={ colspan }\n\t\t\trowSpan={ rowspan }\n\t\t\tclassName={ clsx(\n\t\t\t\t{\n\t\t\t\t\t[ `has-text-align-${ align }` ]: align,\n\t\t\t\t},\n\t\t\t\t'wp-block-table__cell-content'\n\t\t\t) }\n\t\t>\n\t\t\t<RichText\n\t\t\t\tidentifier={ `${ name }.${ rowIndex }.cells.${ columnIndex }.content` }\n\t\t\t\tvalue={ content }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tonFocus={ () => {\n\t\t\t\t\tsetSelectedCell( {\n\t\t\t\t\t\tsectionName: name,\n\t\t\t\t\t\trowIndex,\n\t\t\t\t\t\tcolumnIndex,\n\t\t\t\t\t\ttype: 'cell',\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\taria-label={ cellAriaLabel[ name ] }\n\t\t\t\tplaceholder={ placeholder[ name ] }\n\t\t\t/>\n\t\t</CellTag>\n\t);\n} );\n\nexport default TableEdit;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAMO;AACP,0BAUO;AACP,kBAAuB;AACvB,wBASO;AACP,mBAYO;AAKP,mBAUO;AACP,qBAAwB;AACxB,mBAA+C;AAiCvC;AA/BR,IAA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AI/B,WACC;AAAA,MAAC;AAAA;AAAA,QAEA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA;AAAA;AAAA;AAAA,UAKC,aAAa,WAAW;AAAA;AAAA,QAEzB;AAAA,QACE,GAAG;AAAA;AAAA,MAZC;AAAA,IAaP;AAAA,EAEF,CAAE,KA1BO,QA2BV,CACC,KA9B2B,IA+B9B,CACC;AAEF,QAAM,UAAU,CAAE,SAAS;AAE3B,SACC,6CAAC,YAAS,OAAG,mCAAe,EAAE,KAAK,SAAS,CAAE,GAC3C;AAAA,KAAE,WAAW,qBAAqB,aACnC,4EACC;AAAA,kDAAC,qCAAc,OAAM,SACpB;AAAA,QAAC;AAAA;AAAA,UACA,WAAQ,gBAAI,
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tmemo,\n\tuseCallback,\n\tuseEffect,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\nimport {\n\tInspectorControls,\n\tBlockControls,\n\tRichText,\n\tBlockIcon,\n\tAlignmentControl,\n\tuseBlockProps,\n\t__experimentalUseColorProps as useColorProps,\n\t__experimentalUseBorderProps as useBorderProps,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tButton,\n\tPlaceholder,\n\tTextControl,\n\tToggleControl,\n\tToolbarDropdownMenu,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport {\n\talignLeft,\n\talignRight,\n\talignCenter,\n\tblockTable as icon,\n\ttableColumnAfter,\n\ttableColumnBefore,\n\ttableColumnDelete,\n\ttableRowAfter,\n\ttableRowBefore,\n\ttableRowDelete,\n\ttable,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport {\n\tcreateTable,\n\tupdateSelectedCell,\n\tgetCellAttribute,\n\tinsertRow,\n\tdeleteRow,\n\tinsertColumn,\n\tdeleteColumn,\n\ttoggleSection,\n\tisEmptyTableSection,\n} from './state';\nimport { Caption } from '../utils/caption';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst ALIGNMENT_CONTROLS = [\n\t{\n\t\ticon: alignLeft,\n\t\ttitle: __( 'Align column left' ),\n\t\talign: 'left',\n\t},\n\t{\n\t\ticon: alignCenter,\n\t\ttitle: __( 'Align column center' ),\n\t\talign: 'center',\n\t},\n\t{\n\t\ticon: alignRight,\n\t\ttitle: __( 'Align column right' ),\n\t\talign: 'right',\n\t},\n];\n\nconst cellAriaLabel = {\n\thead: __( 'Header cell text' ),\n\tbody: __( 'Body cell text' ),\n\tfoot: __( 'Footer cell text' ),\n};\n\nconst placeholder = {\n\thead: _x( 'Header label', 'table header' ),\n\tfoot: _x( 'Footer label', 'table footer' ),\n};\n\nfunction TSection( { name, ...props } ) {\n\tconst TagName = `t${ name }`;\n\treturn <TagName { ...props } />;\n}\n\nfunction TableEdit( {\n\tattributes,\n\tsetAttributes,\n\tinsertBlocksAfter,\n\tisSelected: isSingleSelected,\n} ) {\n\tconst { hasFixedLayout, head, foot } = attributes;\n\tconst [ initialRowCount, setInitialRowCount ] = useState( 2 );\n\tconst [ initialColumnCount, setInitialColumnCount ] = useState( 2 );\n\tconst [ selectedCell, setSelectedCell ] = useState();\n\n\tconst colorProps = useColorProps( attributes );\n\tconst borderProps = useBorderProps( attributes );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst tableRef = useRef();\n\tconst [ hasTableCreated, setHasTableCreated ] = useState( false );\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\t/**\n\t * Updates the initial column count used for table creation.\n\t *\n\t * @param {number} count New initial column count.\n\t */\n\tfunction onChangeInitialColumnCount( count ) {\n\t\tsetInitialColumnCount( count );\n\t}\n\n\t/**\n\t * Updates the initial row count used for table creation.\n\t *\n\t * @param {number} count New initial row count.\n\t */\n\tfunction onChangeInitialRowCount( count ) {\n\t\tsetInitialRowCount( count );\n\t}\n\n\t/**\n\t * Creates a table based on dimensions in local state.\n\t *\n\t * @param {Object} event Form submit event.\n\t */\n\tfunction onCreateTable( event ) {\n\t\tevent.preventDefault();\n\n\t\tsetAttributes(\n\t\t\tcreateTable( {\n\t\t\t\trowCount: parseInt( initialRowCount, 10 ) || 2,\n\t\t\t\tcolumnCount: parseInt( initialColumnCount, 10 ) || 2,\n\t\t\t} )\n\t\t);\n\t\tsetHasTableCreated( true );\n\t}\n\n\t/**\n\t * Toggles whether the table has a fixed layout or not.\n\t */\n\tfunction onChangeFixedLayout() {\n\t\tsetAttributes( { hasFixedLayout: ! hasFixedLayout } );\n\t}\n\n\t/**\n\t * Changes the content of the currently selected cell.\n\t *\n\t * @param {Array} content A RichText content value.\n\t */\n\tconst onChange = useCallback(\n\t\tfunction ( content ) {\n\t\t\tif ( ! selectedCell ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsetAttributes( ( currentAttributes ) =>\n\t\t\t\tupdateSelectedCell(\n\t\t\t\t\tcurrentAttributes,\n\t\t\t\t\tselectedCell,\n\t\t\t\t\t( cellAttributes ) => ( {\n\t\t\t\t\t\t...cellAttributes,\n\t\t\t\t\t\tcontent,\n\t\t\t\t\t} )\n\t\t\t\t)\n\t\t\t);\n\t\t},\n\t\t[ selectedCell, setAttributes ]\n\t);\n\n\t/**\n\t * Align text within the a column.\n\t *\n\t * @param {string} align The new alignment to apply to the column.\n\t */\n\tfunction onChangeColumnAlignment( align ) {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Convert the cell selection to a column selection so that alignment\n\t\t// is applied to the entire column.\n\t\tconst columnSelection = {\n\t\t\ttype: 'column',\n\t\t\tcolumnIndex: selectedCell.columnIndex,\n\t\t};\n\n\t\tconst newAttributes = updateSelectedCell(\n\t\t\tattributes,\n\t\t\tcolumnSelection,\n\t\t\t( cellAttributes ) => ( {\n\t\t\t\t...cellAttributes,\n\t\t\t\talign,\n\t\t\t} )\n\t\t);\n\t\tsetAttributes( newAttributes );\n\t}\n\n\t/**\n\t * Get the alignment of the currently selected cell.\n\t *\n\t * @return {string | undefined} The new alignment to apply to the column.\n\t */\n\tfunction getCellAlignment() {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn getCellAttribute( attributes, selectedCell, 'align' );\n\t}\n\n\t/**\n\t * Add or remove a `head` table section.\n\t */\n\tfunction onToggleHeaderSection() {\n\t\tsetAttributes( toggleSection( attributes, 'head' ) );\n\t}\n\n\t/**\n\t * Add or remove a `foot` table section.\n\t */\n\tfunction onToggleFooterSection() {\n\t\tsetAttributes( toggleSection( attributes, 'foot' ) );\n\t}\n\n\t/**\n\t * Inserts a row at the currently selected row index, plus `delta`.\n\t *\n\t * @param {number} delta Offset for selected row index at which to insert.\n\t */\n\tfunction onInsertRow( delta ) {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { sectionName, rowIndex } = selectedCell;\n\t\tconst newRowIndex = rowIndex + delta;\n\n\t\tsetAttributes(\n\t\t\tinsertRow( attributes, {\n\t\t\t\tsectionName,\n\t\t\t\trowIndex: newRowIndex,\n\t\t\t} )\n\t\t);\n\t\t// Select the first cell of the new row.\n\t\tsetSelectedCell( {\n\t\t\tsectionName,\n\t\t\trowIndex: newRowIndex,\n\t\t\tcolumnIndex: 0,\n\t\t\ttype: 'cell',\n\t\t} );\n\t}\n\n\t/**\n\t * Inserts a row before the currently selected row.\n\t */\n\tfunction onInsertRowBefore() {\n\t\tonInsertRow( 0 );\n\t}\n\n\t/**\n\t * Inserts a row after the currently selected row.\n\t */\n\tfunction onInsertRowAfter() {\n\t\tonInsertRow( 1 );\n\t}\n\n\t/**\n\t * Deletes the currently selected row.\n\t */\n\tfunction onDeleteRow() {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { sectionName, rowIndex } = selectedCell;\n\n\t\tsetSelectedCell();\n\t\tsetAttributes( deleteRow( attributes, { sectionName, rowIndex } ) );\n\t}\n\n\t/**\n\t * Inserts a column at the currently selected column index, plus `delta`.\n\t *\n\t * @param {number} delta Offset for selected column index at which to insert.\n\t */\n\tfunction onInsertColumn( delta = 0 ) {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { columnIndex } = selectedCell;\n\t\tconst newColumnIndex = columnIndex + delta;\n\n\t\tsetAttributes(\n\t\t\tinsertColumn( attributes, {\n\t\t\t\tcolumnIndex: newColumnIndex,\n\t\t\t} )\n\t\t);\n\t\t// Select the first cell of the new column.\n\t\tsetSelectedCell( {\n\t\t\trowIndex: 0,\n\t\t\tcolumnIndex: newColumnIndex,\n\t\t\ttype: 'cell',\n\t\t} );\n\t}\n\n\t/**\n\t * Inserts a column before the currently selected column.\n\t */\n\tfunction onInsertColumnBefore() {\n\t\tonInsertColumn( 0 );\n\t}\n\n\t/**\n\t * Inserts a column after the currently selected column.\n\t */\n\tfunction onInsertColumnAfter() {\n\t\tonInsertColumn( 1 );\n\t}\n\n\t/**\n\t * Deletes the currently selected column.\n\t */\n\tfunction onDeleteColumn() {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { sectionName, columnIndex } = selectedCell;\n\n\t\tsetSelectedCell();\n\t\tsetAttributes(\n\t\t\tdeleteColumn( attributes, { sectionName, columnIndex } )\n\t\t);\n\t}\n\n\tuseEffect( () => {\n\t\tif ( ! isSingleSelected ) {\n\t\t\tsetSelectedCell();\n\t\t}\n\t}, [ isSingleSelected ] );\n\n\tuseEffect( () => {\n\t\tif ( hasTableCreated ) {\n\t\t\ttableRef?.current\n\t\t\t\t?.querySelector( 'td div[contentEditable=\"true\"]' )\n\t\t\t\t?.focus();\n\t\t\tsetHasTableCreated( false );\n\t\t}\n\t}, [ hasTableCreated ] );\n\n\tconst sections = [ 'head', 'body', 'foot' ].filter(\n\t\t( name ) => ! isEmptyTableSection( attributes[ name ] )\n\t);\n\n\tconst tableControls = [\n\t\t{\n\t\t\ticon: tableRowBefore,\n\t\t\ttitle: __( 'Insert row before' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertRowBefore,\n\t\t},\n\t\t{\n\t\t\ticon: tableRowAfter,\n\t\t\ttitle: __( 'Insert row after' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertRowAfter,\n\t\t},\n\t\t{\n\t\t\ticon: tableRowDelete,\n\t\t\ttitle: __( 'Delete row' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onDeleteRow,\n\t\t},\n\t\t{\n\t\t\ticon: tableColumnBefore,\n\t\t\ttitle: __( 'Insert column before' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertColumnBefore,\n\t\t},\n\t\t{\n\t\t\ticon: tableColumnAfter,\n\t\t\ttitle: __( 'Insert column after' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertColumnAfter,\n\t\t},\n\t\t{\n\t\t\ticon: tableColumnDelete,\n\t\t\ttitle: __( 'Delete column' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onDeleteColumn,\n\t\t},\n\t];\n\n\tconst renderedSections = sections.map( ( name ) => (\n\t\t<TSection name={ name } key={ name }>\n\t\t\t{ attributes[ name ].map( ( { cells }, rowIndex ) => (\n\t\t\t\t<tr key={ rowIndex }>\n\t\t\t\t\t{ cells.map( ( cellProps, columnIndex ) => {\n\t\t\t\t\t\tconst isSelected =\n\t\t\t\t\t\t\tselectedCell?.sectionName === name &&\n\t\t\t\t\t\t\tselectedCell?.rowIndex === rowIndex &&\n\t\t\t\t\t\t\tselectedCell?.columnIndex === columnIndex;\n\n\t\t\t\t\t\t// Important - the Cell component is memoized to improve typing performance.\n\t\t\t\t\t\t// ensure all props passed have stable references.\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<Cell\n\t\t\t\t\t\t\t\tkey={ columnIndex }\n\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\trowIndex={ rowIndex }\n\t\t\t\t\t\t\t\tcolumnIndex={ columnIndex }\n\t\t\t\t\t\t\t\tonChange={\n\t\t\t\t\t\t\t\t\t// Only pass the `onChange` handler to the selectedCell.\n\t\t\t\t\t\t\t\t\t// Cell components are memoized, so it's best to avoid\n\t\t\t\t\t\t\t\t\t// passing in a value that will cause all cells to re-render\n\t\t\t\t\t\t\t\t\t// whenever it changes.\n\t\t\t\t\t\t\t\t\tisSelected ? onChange : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsetSelectedCell={ setSelectedCell }\n\t\t\t\t\t\t\t\t{ ...cellProps }\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</tr>\n\t\t\t) ) }\n\t\t</TSection>\n\t) );\n\n\tconst isEmpty = ! sections.length;\n\n\treturn (\n\t\t<figure { ...useBlockProps( { ref: tableRef } ) }>\n\t\t\t{ ! isEmpty && blockEditingMode === 'default' && (\n\t\t\t\t<>\n\t\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t\t<AlignmentControl\n\t\t\t\t\t\t\tlabel={ __( 'Align column content' ) }\n\t\t\t\t\t\t\talignmentControls={ ALIGNMENT_CONTROLS }\n\t\t\t\t\t\t\tvalue={ getCellAlignment() }\n\t\t\t\t\t\t\tonChange={ ( nextAlign ) =>\n\t\t\t\t\t\t\t\tonChangeColumnAlignment( nextAlign )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t\t<ToolbarDropdownMenu\n\t\t\t\t\t\t\ticon={ table }\n\t\t\t\t\t\t\tlabel={ __( 'Edit table' ) }\n\t\t\t\t\t\t\tcontrols={ tableControls }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\thasFixedLayout: true,\n\t\t\t\t\t\t\thead: [],\n\t\t\t\t\t\t\tfoot: [],\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => hasFixedLayout !== true }\n\t\t\t\t\t\tlabel={ __( 'Fixed width table cells' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { hasFixedLayout: true } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Fixed width table cells' ) }\n\t\t\t\t\t\t\tchecked={ !! hasFixedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeFixedLayout }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t{ ! isEmpty && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\thasValue={ () => head && head.length }\n\t\t\t\t\t\t\t\tlabel={ __( 'Header section' ) }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { head: [] } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Header section' ) }\n\t\t\t\t\t\t\t\t\tchecked={ !! ( head && head.length ) }\n\t\t\t\t\t\t\t\t\tonChange={ onToggleHeaderSection }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\thasValue={ () => foot && foot.length }\n\t\t\t\t\t\t\t\tlabel={ __( 'Footer section' ) }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { foot: [] } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Footer section' ) }\n\t\t\t\t\t\t\t\t\tchecked={ !! ( foot && foot.length ) }\n\t\t\t\t\t\t\t\t\tonChange={ onToggleFooterSection }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t{ ! isEmpty && (\n\t\t\t\t<table\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\tcolorProps.className,\n\t\t\t\t\t\tborderProps.className,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'has-fixed-layout': hasFixedLayout,\n\t\t\t\t\t\t\t// This is required in the editor only to overcome\n\t\t\t\t\t\t\t// the fact the editor rewrites individual border\n\t\t\t\t\t\t\t// widths into a shorthand format.\n\t\t\t\t\t\t\t'has-individual-borders': hasSplitBorders(\n\t\t\t\t\t\t\t\tattributes?.style?.border\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\tstyle={ { ...colorProps.style, ...borderProps.style } }\n\t\t\t\t>\n\t\t\t\t\t{ renderedSections }\n\t\t\t\t</table>\n\t\t\t) }\n\t\t\t{ isEmpty ? (\n\t\t\t\t<Placeholder\n\t\t\t\t\tlabel={ __( 'Table' ) }\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } showColors /> }\n\t\t\t\t\tinstructions={ __( 'Insert a table for sharing data.' ) }\n\t\t\t\t>\n\t\t\t\t\t<form\n\t\t\t\t\t\tclassName=\"blocks-table__placeholder-form\"\n\t\t\t\t\t\tonSubmit={ onCreateTable }\n\t\t\t\t\t>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\tlabel={ __( 'Column count' ) }\n\t\t\t\t\t\t\tvalue={ initialColumnCount }\n\t\t\t\t\t\t\tonChange={ onChangeInitialColumnCount }\n\t\t\t\t\t\t\tmin=\"1\"\n\t\t\t\t\t\t\tclassName=\"blocks-table__placeholder-input\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\tlabel={ __( 'Row count' ) }\n\t\t\t\t\t\t\tvalue={ initialRowCount }\n\t\t\t\t\t\t\tonChange={ onChangeInitialRowCount }\n\t\t\t\t\t\t\tmin=\"1\"\n\t\t\t\t\t\t\tclassName=\"blocks-table__placeholder-input\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create Table' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</form>\n\t\t\t\t</Placeholder>\n\t\t\t) : (\n\t\t\t\t<Caption\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisSelected={ isSingleSelected }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\tlabel={ __( 'Table caption text' ) }\n\t\t\t\t\tshowToolbarButton={\n\t\t\t\t\t\tisSingleSelected && blockEditingMode === 'default'\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t</figure>\n\t);\n}\n\nconst Cell = memo( function ( {\n\ttag: CellTag,\n\tname,\n\tscope,\n\tcolspan,\n\trowspan,\n\trowIndex,\n\tcolumnIndex,\n\talign,\n\tcontent,\n\tonChange,\n\tsetSelectedCell,\n} ) {\n\treturn (\n\t\t<CellTag\n\t\t\tscope={ CellTag === 'th' ? scope : undefined }\n\t\t\tcolSpan={ colspan }\n\t\t\trowSpan={ rowspan }\n\t\t\tclassName={ clsx(\n\t\t\t\t{\n\t\t\t\t\t[ `has-text-align-${ align }` ]: align,\n\t\t\t\t},\n\t\t\t\t'wp-block-table__cell-content'\n\t\t\t) }\n\t\t>\n\t\t\t<RichText\n\t\t\t\tidentifier={ `${ name }.${ rowIndex }.cells.${ columnIndex }.content` }\n\t\t\t\tvalue={ content }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tonFocus={ () => {\n\t\t\t\t\tsetSelectedCell( {\n\t\t\t\t\t\tsectionName: name,\n\t\t\t\t\t\trowIndex,\n\t\t\t\t\t\tcolumnIndex,\n\t\t\t\t\t\ttype: 'cell',\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\taria-label={ cellAriaLabel[ name ] }\n\t\t\t\tplaceholder={ placeholder[ name ] }\n\t\t\t/>\n\t\t</CellTag>\n\t);\n} );\n\nexport default TableEdit;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAMO;AACP,0BAUO;AACP,kBAAuB;AACvB,wBASO;AACP,mBAYO;AAKP,mBAUO;AACP,qBAAwB;AACxB,mBAA+C;AAiCvC;AA/BR,IAAM,qBAAqB;AAAA,EAC1B;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,mBAAoB;AAAA,IAC/B,OAAO;AAAA,EACR;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,qBAAsB;AAAA,IACjC,OAAO;AAAA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ACR;AAAA,UACA,SAAU,MAAM;AACf,4BAAiB;AAAA,cAChB,aAAa;AAAA,cACb;AAAA,cACA;AAAA,cACA,MAAM;AAAA,YACP,CAAE;AAAA,UACH;AAAA,UACA,cAAa,cAAe,IAAK;AAAA,UACjC,aAAc,YAAa,IAAK;AAAA;AAAA,MACjC;AAAA;AAAA,EACD;AAEF,CAAE;AAEF,IAAO,eAAQ;",
|
|
6
6
|
"names": ["useColorProps", "useBorderProps", "ToolsPanel", "ToolsPanelItem", "clsx", "hasSplitBorders", "icon"]
|
|
7
7
|
}
|
package/build/tabs/block.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
|
3
|
-
"__experimental": true,
|
|
4
3
|
"apiVersion": 3,
|
|
5
4
|
"name": "core/tabs",
|
|
6
5
|
"title": "Tabs",
|
|
@@ -44,10 +43,6 @@
|
|
|
44
43
|
"__experimentalFontFamily": true
|
|
45
44
|
}
|
|
46
45
|
},
|
|
47
|
-
"providesContext": {
|
|
48
|
-
"core/tabs-activeTabIndex": "activeTabIndex",
|
|
49
|
-
"core/tabs-editorActiveTabIndex": "editorActiveTabIndex"
|
|
50
|
-
},
|
|
51
46
|
"usesContext": [ "core/tabs-list", "core/tabs-id" ],
|
|
52
47
|
"style": "wp-block-tabs",
|
|
53
48
|
"viewScriptModule": "@wordpress/block-library/tabs/view"
|
package/build/tabs/edit.cjs
CHANGED
|
@@ -34,47 +34,12 @@ __export(edit_exports, {
|
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(edit_exports);
|
|
36
36
|
var import_block_editor = require("@wordpress/block-editor");
|
|
37
|
-
var import_data = require("@wordpress/data");
|
|
38
|
-
var import_element = require("@wordpress/element");
|
|
39
37
|
var import_tab_toolbar_controls = __toESM(require("./tab-toolbar-controls.cjs"));
|
|
40
38
|
var import_use_tab_list_items_sync = __toESM(require("./use-tab-list-items-sync.cjs"));
|
|
41
39
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
42
|
-
var EMPTY_ARRAY = [];
|
|
43
40
|
var TABS_TEMPLATE = [["core/tab-list"], ["core/tab-panels"]];
|
|
44
|
-
function Edit({ clientId
|
|
45
|
-
|
|
46
|
-
const { tabPanels, tabListClientId } = (0, import_data.useSelect)(
|
|
47
|
-
(select) => {
|
|
48
|
-
const { getBlocks } = select(import_block_editor.store);
|
|
49
|
-
const innerBlocks = getBlocks(clientId);
|
|
50
|
-
const tabPanelsBlock = innerBlocks.find(
|
|
51
|
-
(block) => block.name === "core/tab-panels"
|
|
52
|
-
);
|
|
53
|
-
const tabList = innerBlocks.find(
|
|
54
|
-
(block) => block.name === "core/tab-list"
|
|
55
|
-
);
|
|
56
|
-
return {
|
|
57
|
-
tabPanels: tabPanelsBlock?.innerBlocks ?? EMPTY_ARRAY,
|
|
58
|
-
tabListClientId: tabList?.clientId ?? null
|
|
59
|
-
};
|
|
60
|
-
},
|
|
61
|
-
[clientId]
|
|
62
|
-
);
|
|
63
|
-
(0, import_use_tab_list_items_sync.default)({ tabPanels, tabListClientId });
|
|
64
|
-
const contextValue = (0, import_element.useMemo)(() => {
|
|
65
|
-
const tabList = tabPanels.map((tab, index) => ({
|
|
66
|
-
id: tab.attributes.anchor || `tab-${index}`,
|
|
67
|
-
label: tab.attributes.label || "",
|
|
68
|
-
clientId: tab.clientId,
|
|
69
|
-
index
|
|
70
|
-
}));
|
|
71
|
-
return {
|
|
72
|
-
"core/tabs-list": tabList,
|
|
73
|
-
"core/tabs-id": anchor,
|
|
74
|
-
"core/tabs-activeTabIndex": activeTabIndex,
|
|
75
|
-
"core/tabs-editorActiveTabIndex": editorActiveTabIndex
|
|
76
|
-
};
|
|
77
|
-
}, [tabPanels, anchor, activeTabIndex, editorActiveTabIndex]);
|
|
41
|
+
function Edit({ clientId }) {
|
|
42
|
+
(0, import_use_tab_list_items_sync.default)(clientId);
|
|
78
43
|
const blockProps = (0, import_block_editor.useBlockProps)();
|
|
79
44
|
const innerBlockProps = (0, import_block_editor.useInnerBlocksProps)(blockProps, {
|
|
80
45
|
__experimentalCaptureToolbars: true,
|
|
@@ -82,10 +47,10 @@ function Edit({ clientId, attributes }) {
|
|
|
82
47
|
templateLock: "all",
|
|
83
48
|
renderAppender: false
|
|
84
49
|
});
|
|
85
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.
|
|
50
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { ...innerBlockProps, children: [
|
|
86
51
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tab_toolbar_controls.default, { tabsClientId: clientId }),
|
|
87
52
|
innerBlockProps.children
|
|
88
|
-
] })
|
|
53
|
+
] });
|
|
89
54
|
}
|
|
90
55
|
var edit_default = Edit;
|
|
91
56
|
//# sourceMappingURL=edit.cjs.map
|
package/build/tabs/edit.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/tabs/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport TabToolbarControls from './tab-toolbar-controls';\nimport useTabListItemsSync from './use-tab-list-items-sync';\n\n/**\n * Only the two structural child blocks are specified here — without inner\n * block entries for core/tab-list or core/tab-panels.\n *\n * If inner blocks were included in this template, `synchronizeBlocksWithTemplate`\n * (called whenever templateLock === 'all') would recurse into the containers and\n * truncate them to the template count, causing data loss when a saved block with\n * more than two tabs is re-opened in the editor.\n *\n * Initial tab/panel creation is delegated to the tab-panels template in\n * tab-panels/edit.js (templateLock: false, applied only when empty).\n */\nconst TABS_TEMPLATE = [ [ 'core/tab-list' ], [ 'core/tab-panels' ] ];\n\nfunction Edit( { clientId } ) {\n\tuseTabListItemsSync( clientId );\n\n\tconst blockProps = useBlockProps();\n\n\tconst innerBlockProps = useInnerBlocksProps( blockProps, {\n\t\t__experimentalCaptureToolbars: true,\n\t\ttemplate: TABS_TEMPLATE,\n\t\ttemplateLock: 'all',\n\t\trenderAppender: false,\n\t} );\n\n\treturn (\n\t\t<div { ...innerBlockProps }>\n\t\t\t<TabToolbarControls tabsClientId={ clientId } />\n\t\t\t{ innerBlockProps.children }\n\t\t</div>\n\t);\n}\n\nexport default Edit;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAAmD;AAKnD,kCAA+B;AAC/B,qCAAgC;AA6B9B;AAfF,IAAM,gBAAgB,CAAE,CAAE,eAAgB,GAAG,CAAE,iBAAkB,CAAE;AAEnE,SAAS,KAAM,EAAE,SAAS,GAAI;AAC7B,qCAAAA,SAAqB,QAAS;AAE9B,QAAM,iBAAa,mCAAc;AAEjC,QAAM,sBAAkB,yCAAqB,YAAY;AAAA,IACxD,+BAA+B;AAAA,IAC/B,UAAU;AAAA,IACV,cAAc;AAAA,IACd,gBAAgB;AAAA,EACjB,CAAE;AAEF,SACC,6CAAC,SAAM,GAAG,iBACT;AAAA,gDAAC,4BAAAC,SAAA,EAAmB,cAAe,UAAW;AAAA,IAC5C,gBAAgB;AAAA,KACnB;AAEF;AAEA,IAAO,eAAQ;",
|
|
6
|
+
"names": ["useTabListItemsSync", "TabToolbarControls"]
|
|
7
7
|
}
|
|
@@ -32,6 +32,7 @@ function useTabActions(tabsClientId) {
|
|
|
32
32
|
const {
|
|
33
33
|
insertBlock,
|
|
34
34
|
removeBlock,
|
|
35
|
+
moveBlocksToPosition,
|
|
35
36
|
updateBlockAttributes,
|
|
36
37
|
__unstableMarkNextChangeAsNotPersistent
|
|
37
38
|
} = (0, import_data.useDispatch)(import_block_editor.store);
|
|
@@ -82,6 +83,27 @@ function useTabActions(tabsClientId) {
|
|
|
82
83
|
});
|
|
83
84
|
removeBlock(target.clientId, false);
|
|
84
85
|
};
|
|
85
|
-
|
|
86
|
+
const moveTab = (direction) => {
|
|
87
|
+
const { tabPanelsClientId, tabPanelBlocks, activeIndex } = getTabsState();
|
|
88
|
+
if (!tabPanelsClientId) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const toIndex = activeIndex + direction;
|
|
92
|
+
const target = tabPanelBlocks[activeIndex];
|
|
93
|
+
if (!target || toIndex < 0 || toIndex >= tabPanelBlocks.length) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
97
|
+
updateBlockAttributes(tabsClientId, {
|
|
98
|
+
editorActiveTabIndex: toIndex
|
|
99
|
+
});
|
|
100
|
+
moveBlocksToPosition(
|
|
101
|
+
[target.clientId],
|
|
102
|
+
tabPanelsClientId,
|
|
103
|
+
tabPanelsClientId,
|
|
104
|
+
toIndex
|
|
105
|
+
);
|
|
106
|
+
};
|
|
107
|
+
return { insertTab, removeTab, moveTab };
|
|
86
108
|
}
|
|
87
109
|
//# sourceMappingURL=use-tab-actions.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/tabs/use-tab-actions.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { createBlock } from '@wordpress/blocks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useDispatch, useRegistry } from '@wordpress/data';\n\n/**\n * Provides callbacks to insert and
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,oBAA4B;AAC5B,0BAA0C;AAC1C,kBAAyC;AAY1B,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vB,CAAE;AACF,gBAAa,OAAO,UAAU,KAAM;AAAA,EACrC;AAEA,SAAO,EAAE,WAAW,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { createBlock } from '@wordpress/blocks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useDispatch, useRegistry } from '@wordpress/data';\n\n/**\n * Provides callbacks to insert, remove and move tabs for a tabs block.\n *\n * The hook intentionally avoids subscribing to the store: all data is derived\n * lazily inside the callbacks via `registry.select`, so consumers don't\n * re-render when the tab structure changes.\n *\n * @param {string|null} tabsClientId The client ID of the parent tabs block.\n * @return {{ insertTab: Function, removeTab: Function, moveTab: Function }} Tab action callbacks.\n */\nexport default function useTabActions( tabsClientId ) {\n\tconst registry = useRegistry();\n\tconst {\n\t\tinsertBlock,\n\t\tremoveBlock,\n\t\tmoveBlocksToPosition,\n\t\tupdateBlockAttributes,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t} = useDispatch( blockEditorStore );\n\n\t// Derive the current tabs state at call time without subscribing.\n\tconst getTabsState = () => {\n\t\tconst { getBlocks, getBlockAttributes } =\n\t\t\tregistry.select( blockEditorStore );\n\n\t\tconst tabsAttributes = tabsClientId\n\t\t\t? getBlockAttributes( tabsClientId )\n\t\t\t: undefined;\n\t\tconst tabPanels = tabsClientId\n\t\t\t? getBlocks( tabsClientId ).find(\n\t\t\t\t\t( block ) => block.name === 'core/tab-panels'\n\t\t\t )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\ttabPanelsClientId: tabPanels?.clientId ?? null,\n\t\t\ttabPanelBlocks: tabPanels?.innerBlocks ?? [],\n\t\t\tactiveIndex:\n\t\t\t\ttabsAttributes?.editorActiveTabIndex ??\n\t\t\t\ttabsAttributes?.activeTabIndex ??\n\t\t\t\t0,\n\t\t};\n\t};\n\n\t// Insert a new tab and make it active. Defaults to appending at the end.\n\tconst insertTab = ( atIndex ) => {\n\t\tconst { tabPanelsClientId, tabPanelBlocks } = getTabsState();\n\t\tif ( ! tabPanelsClientId ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst newIndex = atIndex ?? tabPanelBlocks.length;\n\t\tinsertBlock(\n\t\t\tcreateBlock( 'core/tab-panel', { label: __( 'Tab' ) } ),\n\t\t\tnewIndex,\n\t\t\ttabPanelsClientId,\n\t\t\tfalse\n\t\t);\n\n\t\t// Switch editor active tab to the new tab.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tupdateBlockAttributes( tabsClientId, {\n\t\t\teditorActiveTabIndex: newIndex,\n\t\t} );\n\t};\n\n\t// Remove a tab and move the active tab to an adjacent one. Defaults to the\n\t// currently active tab.\n\tconst removeTab = ( atIndex ) => {\n\t\tconst { tabPanelBlocks, activeIndex } = getTabsState();\n\t\tconst tabCount = tabPanelBlocks.length;\n\t\tif ( tabCount <= 1 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst removeIndex = atIndex ?? activeIndex;\n\t\tconst target = tabPanelBlocks[ removeIndex ];\n\t\tif ( ! target ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Calculate new active index after removal.\n\t\tconst newActiveIndex =\n\t\t\tremoveIndex >= tabCount - 1 ? tabCount - 2 : removeIndex;\n\n\t\t// Switch editor to the adjacent tab and remove the current one.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tupdateBlockAttributes( tabsClientId, {\n\t\t\teditorActiveTabIndex: newActiveIndex,\n\t\t} );\n\t\tremoveBlock( target.clientId, false );\n\t};\n\n\t// Move the active tab one position left or right by reordering the\n\t// underlying tab-panel. The tab-list labels follow their panel\n\t// automatically via useTabListItemsSync.\n\tconst moveTab = ( direction ) => {\n\t\tconst { tabPanelsClientId, tabPanelBlocks, activeIndex } =\n\t\t\tgetTabsState();\n\t\tif ( ! tabPanelsClientId ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst toIndex = activeIndex + direction;\n\t\tconst target = tabPanelBlocks[ activeIndex ];\n\t\tif ( ! target || toIndex < 0 || toIndex >= tabPanelBlocks.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tupdateBlockAttributes( tabsClientId, {\n\t\t\teditorActiveTabIndex: toIndex,\n\t\t} );\n\t\tmoveBlocksToPosition(\n\t\t\t[ target.clientId ],\n\t\t\ttabPanelsClientId,\n\t\t\ttabPanelsClientId,\n\t\t\ttoIndex\n\t\t);\n\t};\n\n\treturn { insertTab, removeTab, moveTab };\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,oBAA4B;AAC5B,0BAA0C;AAC1C,kBAAyC;AAY1B,SAAR,cAAgC,cAAe;AACrD,QAAM,eAAW,yBAAY;AAC7B,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,QAAI,yBAAa,oBAAAA,KAAiB;AAGlC,QAAM,eAAe,MAAM;AAC1B,UAAM,EAAE,WAAW,mBAAmB,IACrC,SAAS,OAAQ,oBAAAA,KAAiB;AAEnC,UAAM,iBAAiB,eACpB,mBAAoB,YAAa,IACjC;AACH,UAAM,YAAY,eACf,UAAW,YAAa,EAAE;AAAA,MAC1B,CAAE,UAAW,MAAM,SAAS;AAAA,IAC5B,IACA;AAEH,WAAO;AAAA,MACN,mBAAmB,WAAW,YAAY;AAAA,MAC1C,gBAAgB,WAAW,eAAe,CAAC;AAAA,MAC3C,aACC,gBAAgB,wBAChB,gBAAgB,kBAChB;AAAA,IACF;AAAA,EACD;AAGA,QAAM,YAAY,CAAE,YAAa;AAChC,UAAM,EAAE,mBAAmB,eAAe,IAAI,aAAa;AAC3D,QAAK,CAAE,mBAAoB;AAC1B;AAAA,IACD;AAEA,UAAM,WAAW,WAAW,eAAe;AAC3C;AAAA,UACC,2BAAa,kBAAkB,EAAE,WAAO,gBAAI,KAAM,EAAE,CAAE;AAAA,MACtD;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAGA,4CAAwC;AACxC,0BAAuB,cAAc;AAAA,MACpC,sBAAsB;AAAA,IACvB,CAAE;AAAA,EACH;AAIA,QAAM,YAAY,CAAE,YAAa;AAChC,UAAM,EAAE,gBAAgB,YAAY,IAAI,aAAa;AACrD,UAAM,WAAW,eAAe;AAChC,QAAK,YAAY,GAAI;AACpB;AAAA,IACD;AAEA,UAAM,cAAc,WAAW;AAC/B,UAAM,SAAS,eAAgB,WAAY;AAC3C,QAAK,CAAE,QAAS;AACf;AAAA,IACD;AAGA,UAAM,iBACL,eAAe,WAAW,IAAI,WAAW,IAAI;AAG9C,4CAAwC;AACxC,0BAAuB,cAAc;AAAA,MACpC,sBAAsB;AAAA,IACvB,CAAE;AACF,gBAAa,OAAO,UAAU,KAAM;AAAA,EACrC;AAKA,QAAM,UAAU,CAAE,cAAe;AAChC,UAAM,EAAE,mBAAmB,gBAAgB,YAAY,IACtD,aAAa;AACd,QAAK,CAAE,mBAAoB;AAC1B;AAAA,IACD;AAEA,UAAM,UAAU,cAAc;AAC9B,UAAM,SAAS,eAAgB,WAAY;AAC3C,QAAK,CAAE,UAAU,UAAU,KAAK,WAAW,eAAe,QAAS;AAClE;AAAA,IACD;AAEA,4CAAwC;AACxC,0BAAuB,cAAc;AAAA,MACpC,sBAAsB;AAAA,IACvB,CAAE;AACF;AAAA,MACC,CAAE,OAAO,QAAS;AAAA,MAClB;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,EACD;AAEA,SAAO,EAAE,WAAW,WAAW,QAAQ;AACxC;",
|
|
6
6
|
"names": ["blockEditorStore"]
|
|
7
7
|
}
|
|
@@ -26,7 +26,25 @@ module.exports = __toCommonJS(use_tab_list_items_sync_exports);
|
|
|
26
26
|
var import_block_editor = require("@wordpress/block-editor");
|
|
27
27
|
var import_data = require("@wordpress/data");
|
|
28
28
|
var import_element = require("@wordpress/element");
|
|
29
|
-
|
|
29
|
+
var EMPTY_ARRAY = [];
|
|
30
|
+
function useTabListItemsSync(tabsClientId) {
|
|
31
|
+
const { tabPanels, tabListClientId } = (0, import_data.useSelect)(
|
|
32
|
+
(select) => {
|
|
33
|
+
const { getBlocks } = select(import_block_editor.store);
|
|
34
|
+
const innerBlocks = getBlocks(tabsClientId);
|
|
35
|
+
const tabPanelsBlock = innerBlocks.find(
|
|
36
|
+
(block) => block.name === "core/tab-panels"
|
|
37
|
+
);
|
|
38
|
+
const tabList = innerBlocks.find(
|
|
39
|
+
(block) => block.name === "core/tab-list"
|
|
40
|
+
);
|
|
41
|
+
return {
|
|
42
|
+
tabPanels: tabPanelsBlock?.innerBlocks ?? EMPTY_ARRAY,
|
|
43
|
+
tabListClientId: tabList?.clientId ?? null
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
[tabsClientId]
|
|
47
|
+
);
|
|
30
48
|
const { updateBlockAttributes, __unstableMarkNextChangeAsNotPersistent } = (0, import_data.useDispatch)(import_block_editor.store);
|
|
31
49
|
const { getBlockAttributes } = (0, import_data.useSelect)(import_block_editor.store);
|
|
32
50
|
(0, import_element.useEffect)(() => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/tabs/use-tab-list-items-sync.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Keep the tab-list block's `tabs` attribute in sync with the tab-panel blocks.\n *\n * Whenever the list of core/tab-panel blocks changes (add, remove, reorder, or\n * label edit), this hook updates the `tabs` attribute on the core/tab-list\n * block so that save.js can render the correct buttons.\n *\n * @param {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAA0C;AAC1C,kBAAuC;AACvC,qBAA0B;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\n\nconst EMPTY_ARRAY = [];\n\n/**\n * Keep the tab-list block's `tabs` attribute in sync with the tab-panel blocks.\n *\n * Whenever the list of core/tab-panel blocks changes (add, remove, reorder, or\n * label edit), this hook updates the `tabs` attribute on the core/tab-list\n * block so that save.js can render the correct buttons.\n *\n * @param {string} tabsClientId Client ID of the core/tabs block.\n */\nexport default function useTabListItemsSync( tabsClientId ) {\n\tconst { tabPanels, tabListClientId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlocks } = select( blockEditorStore );\n\t\t\tconst innerBlocks = getBlocks( tabsClientId );\n\n\t\t\tconst tabPanelsBlock = innerBlocks.find(\n\t\t\t\t( block ) => block.name === 'core/tab-panels'\n\t\t\t);\n\t\t\tconst tabList = innerBlocks.find(\n\t\t\t\t( block ) => block.name === 'core/tab-list'\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\ttabPanels: tabPanelsBlock?.innerBlocks ?? EMPTY_ARRAY,\n\t\t\t\ttabListClientId: tabList?.clientId ?? null,\n\t\t\t};\n\t\t},\n\t\t[ tabsClientId ]\n\t);\n\n\tconst { updateBlockAttributes, __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { getBlockAttributes } = useSelect( blockEditorStore );\n\n\tuseEffect( () => {\n\t\tif ( ! tabListClientId ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst newTabs = tabPanels.map( ( tab ) => ( {\n\t\t\tlabel: tab.attributes.label || '',\n\t\t} ) );\n\n\t\t// Skip the update when the stored tabs already match the derived ones.\n\t\tconst currentTabs = getBlockAttributes( tabListClientId )?.tabs ?? [];\n\t\tif ( JSON.stringify( newTabs ) === JSON.stringify( currentTabs ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tupdateBlockAttributes( tabListClientId, { tabs: newTabs } );\n\t}, [\n\t\ttabPanels,\n\t\ttabListClientId,\n\t\tgetBlockAttributes,\n\t\tupdateBlockAttributes,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t] );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAA0C;AAC1C,kBAAuC;AACvC,qBAA0B;AAE1B,IAAM,cAAc,CAAC;AAWN,SAAR,oBAAsC,cAAe;AAC3D,QAAM,EAAE,WAAW,gBAAgB,QAAI;AAAA,IACtC,CAAE,WAAY;AACb,YAAM,EAAE,UAAU,IAAI,OAAQ,oBAAAA,KAAiB;AAC/C,YAAM,cAAc,UAAW,YAAa;AAE5C,YAAM,iBAAiB,YAAY;AAAA,QAClC,CAAE,UAAW,MAAM,SAAS;AAAA,MAC7B;AACA,YAAM,UAAU,YAAY;AAAA,QAC3B,CAAE,UAAW,MAAM,SAAS;AAAA,MAC7B;AAEA,aAAO;AAAA,QACN,WAAW,gBAAgB,eAAe;AAAA,QAC1C,iBAAiB,SAAS,YAAY;AAAA,MACvC;AAAA,IACD;AAAA,IACA,CAAE,YAAa;AAAA,EAChB;AAEA,QAAM,EAAE,uBAAuB,wCAAwC,QACtE,yBAAa,oBAAAA,KAAiB;AAC/B,QAAM,EAAE,mBAAmB,QAAI,uBAAW,oBAAAA,KAAiB;AAE3D,gCAAW,MAAM;AAChB,QAAK,CAAE,iBAAkB;AACxB;AAAA,IACD;AAEA,UAAM,UAAU,UAAU,IAAK,CAAE,SAAW;AAAA,MAC3C,OAAO,IAAI,WAAW,SAAS;AAAA,IAChC,EAAI;AAGJ,UAAM,cAAc,mBAAoB,eAAgB,GAAG,QAAQ,CAAC;AACpE,QAAK,KAAK,UAAW,OAAQ,MAAM,KAAK,UAAW,WAAY,GAAI;AAClE;AAAA,IACD;AAEA,4CAAwC;AACxC,0BAAuB,iBAAiB,EAAE,MAAM,QAAQ,CAAE;AAAA,EAC3D,GAAG;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAE;AACH;",
|
|
6
6
|
"names": ["blockEditorStore"]
|
|
7
7
|
}
|
|
@@ -9,9 +9,6 @@
|
|
|
9
9
|
"textdomain": "default",
|
|
10
10
|
"usesContext": [ "termId", "taxonomy" ],
|
|
11
11
|
"attributes": {
|
|
12
|
-
"textAlign": {
|
|
13
|
-
"type": "string"
|
|
14
|
-
},
|
|
15
12
|
"level": {
|
|
16
13
|
"type": "number",
|
|
17
14
|
"default": 0
|
|
@@ -43,6 +40,7 @@
|
|
|
43
40
|
"typography": {
|
|
44
41
|
"fontSize": true,
|
|
45
42
|
"lineHeight": true,
|
|
43
|
+
"textAlign": true,
|
|
46
44
|
"__experimentalFontFamily": true,
|
|
47
45
|
"__experimentalFontWeight": true,
|
|
48
46
|
"__experimentalFontStyle": true,
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/block-library/src/term-name/deprecated.js
|
|
31
|
+
var deprecated_exports = {};
|
|
32
|
+
__export(deprecated_exports, {
|
|
33
|
+
default: () => deprecated_default
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(deprecated_exports);
|
|
36
|
+
var import_migrate_text_align = __toESM(require("../utils/migrate-text-align.cjs"));
|
|
37
|
+
var v1 = {
|
|
38
|
+
attributes: {
|
|
39
|
+
textAlign: {
|
|
40
|
+
type: "string"
|
|
41
|
+
},
|
|
42
|
+
level: {
|
|
43
|
+
type: "number",
|
|
44
|
+
default: 0
|
|
45
|
+
},
|
|
46
|
+
isLink: {
|
|
47
|
+
type: "boolean",
|
|
48
|
+
default: false
|
|
49
|
+
},
|
|
50
|
+
levelOptions: {
|
|
51
|
+
type: "array"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
supports: {
|
|
55
|
+
anchor: true,
|
|
56
|
+
align: ["wide", "full"],
|
|
57
|
+
html: false,
|
|
58
|
+
color: {
|
|
59
|
+
gradients: true,
|
|
60
|
+
link: true,
|
|
61
|
+
__experimentalDefaultControls: {
|
|
62
|
+
background: true,
|
|
63
|
+
text: true,
|
|
64
|
+
link: true
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
spacing: {
|
|
68
|
+
padding: true
|
|
69
|
+
},
|
|
70
|
+
typography: {
|
|
71
|
+
fontSize: true,
|
|
72
|
+
lineHeight: true,
|
|
73
|
+
__experimentalFontFamily: true,
|
|
74
|
+
__experimentalFontWeight: true,
|
|
75
|
+
__experimentalFontStyle: true,
|
|
76
|
+
__experimentalTextTransform: true,
|
|
77
|
+
__experimentalTextDecoration: true,
|
|
78
|
+
__experimentalLetterSpacing: true,
|
|
79
|
+
__experimentalDefaultControls: {
|
|
80
|
+
fontSize: true
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
interactivity: {
|
|
84
|
+
clientNavigation: true
|
|
85
|
+
},
|
|
86
|
+
__experimentalBorder: {
|
|
87
|
+
radius: true,
|
|
88
|
+
color: true,
|
|
89
|
+
width: true,
|
|
90
|
+
style: true,
|
|
91
|
+
__experimentalDefaultControls: {
|
|
92
|
+
color: true,
|
|
93
|
+
width: true,
|
|
94
|
+
style: true
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
migrate: import_migrate_text_align.default,
|
|
99
|
+
isEligible(attributes) {
|
|
100
|
+
return !!attributes.textAlign;
|
|
101
|
+
},
|
|
102
|
+
save: () => null
|
|
103
|
+
};
|
|
104
|
+
var deprecated_default = [v1];
|
|
105
|
+
//# sourceMappingURL=deprecated.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/term-name/deprecated.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport migrateTextAlign from '../utils/migrate-text-align';\n\nconst v1 = {\n\tattributes: {\n\t\ttextAlign: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tlevel: {\n\t\t\ttype: 'number',\n\t\t\tdefault: 0,\n\t\t},\n\t\tisLink: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t},\n\t\tlevelOptions: {\n\t\t\ttype: 'array',\n\t\t},\n\t},\n\tsupports: {\n\t\tanchor: true,\n\t\talign: [ 'wide', 'full' ],\n\t\thtml: false,\n\t\tcolor: {\n\t\t\tgradients: true,\n\t\t\tlink: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tbackground: true,\n\t\t\t\ttext: true,\n\t\t\t\tlink: true,\n\t\t\t},\n\t\t},\n\t\tspacing: {\n\t\t\tpadding: true,\n\t\t},\n\t\ttypography: {\n\t\t\tfontSize: true,\n\t\t\tlineHeight: true,\n\t\t\t__experimentalFontFamily: true,\n\t\t\t__experimentalFontWeight: true,\n\t\t\t__experimentalFontStyle: true,\n\t\t\t__experimentalTextTransform: true,\n\t\t\t__experimentalTextDecoration: true,\n\t\t\t__experimentalLetterSpacing: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tfontSize: true,\n\t\t\t},\n\t\t},\n\t\tinteractivity: {\n\t\t\tclientNavigation: true,\n\t\t},\n\t\t__experimentalBorder: {\n\t\t\tradius: true,\n\t\t\tcolor: true,\n\t\t\twidth: true,\n\t\t\tstyle: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tcolor: true,\n\t\t\t\twidth: true,\n\t\t\t\tstyle: true,\n\t\t\t},\n\t\t},\n\t},\n\tmigrate: migrateTextAlign,\n\tisEligible( attributes ) {\n\t\treturn !! attributes.textAlign;\n\t},\n\tsave: () => null,\n};\n\nexport default [ v1 ];\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,gCAA6B;AAE7B,IAAM,KAAK;AAAA,EACV,YAAY;AAAA,IACX,WAAW;AAAA,MACV,MAAM;AAAA,IACP;AAAA,IACA,OAAO;AAAA,MACN,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA,IACA,QAAQ;AAAA,MACP,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA,IACA,cAAc;AAAA,MACb,MAAM;AAAA,IACP;AAAA,EACD;AAAA,EACA,UAAU;AAAA,IACT,QAAQ;AAAA,IACR,OAAO,CAAE,QAAQ,MAAO;AAAA,IACxB,MAAM;AAAA,IACN,OAAO;AAAA,MACN,WAAW;AAAA,MACX,MAAM;AAAA,MACN,+BAA+B;AAAA,QAC9B,YAAY;AAAA,QACZ,MAAM;AAAA,QACN,MAAM;AAAA,MACP;AAAA,IACD;AAAA,IACA,SAAS;AAAA,MACR,SAAS;AAAA,IACV;AAAA,IACA,YAAY;AAAA,MACX,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,0BAA0B;AAAA,MAC1B,0BAA0B;AAAA,MAC1B,yBAAyB;AAAA,MACzB,6BAA6B;AAAA,MAC7B,8BAA8B;AAAA,MAC9B,6BAA6B;AAAA,MAC7B,+BAA+B;AAAA,QAC9B,UAAU;AAAA,MACX;AAAA,IACD;AAAA,IACA,eAAe;AAAA,MACd,kBAAkB;AAAA,IACnB;AAAA,IACA,sBAAsB;AAAA,MACrB,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,OAAO;AAAA,MACP,OAAO;AAAA,MACP,+BAA+B;AAAA,QAC9B,OAAO;AAAA,QACP,OAAO;AAAA,QACP,OAAO;AAAA,MACR;AAAA,IACD;AAAA,EACD;AAAA,EACA,SAAS,0BAAAA;AAAA,EACT,WAAY,YAAa;AACxB,WAAO,CAAC,CAAE,WAAW;AAAA,EACtB;AAAA,EACA,MAAM,MAAM;AACb;AAEA,IAAO,qBAAQ,CAAE,EAAG;",
|
|
6
|
+
"names": ["migrateTextAlign"]
|
|
7
|
+
}
|
package/build/term-name/edit.cjs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
|
|
30
20
|
// packages/block-library/src/term-name/edit.js
|
|
@@ -33,7 +23,6 @@ __export(edit_exports, {
|
|
|
33
23
|
default: () => TermNameEdit
|
|
34
24
|
});
|
|
35
25
|
module.exports = __toCommonJS(edit_exports);
|
|
36
|
-
var import_clsx = __toESM(require("clsx"));
|
|
37
26
|
var import_i18n = require("@wordpress/i18n");
|
|
38
27
|
var import_block_editor = require("@wordpress/block-editor");
|
|
39
28
|
var import_components = require("@wordpress/components");
|
|
@@ -46,14 +35,10 @@ function TermNameEdit({
|
|
|
46
35
|
setAttributes,
|
|
47
36
|
context: { termId, taxonomy }
|
|
48
37
|
}) {
|
|
49
|
-
const {
|
|
38
|
+
const { level = 0, isLink, levelOptions } = attributes;
|
|
50
39
|
const { term } = (0, import_use_term_name.useTermName)(termId, taxonomy);
|
|
51
40
|
const termName = term?.name ? (0, import_html_entities.decodeEntities)(term.name) : (0, import_i18n.__)("Term Name");
|
|
52
|
-
const blockProps = (0, import_block_editor.useBlockProps)(
|
|
53
|
-
className: (0, import_clsx.default)({
|
|
54
|
-
[`has-text-align-${textAlign}`]: textAlign
|
|
55
|
-
})
|
|
56
|
-
});
|
|
41
|
+
const blockProps = (0, import_block_editor.useBlockProps)();
|
|
57
42
|
const dropdownMenuProps = (0, import_hooks.useToolsPanelDropdownMenuProps)();
|
|
58
43
|
const TagName = level === 0 ? "p" : `h${level}`;
|
|
59
44
|
let termNameDisplay = termName;
|
|
@@ -68,27 +53,16 @@ function TermNameEdit({
|
|
|
68
53
|
);
|
|
69
54
|
}
|
|
70
55
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
71
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
setAttributes({ level: newLevel });
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
),
|
|
82
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
83
|
-
import_block_editor.AlignmentControl,
|
|
84
|
-
{
|
|
85
|
-
value: textAlign,
|
|
86
|
-
onChange: (nextAlign) => {
|
|
87
|
-
setAttributes({ textAlign: nextAlign });
|
|
88
|
-
}
|
|
56
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.BlockControls, { group: "block", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
57
|
+
import_block_editor.HeadingLevelDropdown,
|
|
58
|
+
{
|
|
59
|
+
value: level,
|
|
60
|
+
options: levelOptions,
|
|
61
|
+
onChange: (newLevel) => {
|
|
62
|
+
setAttributes({ level: newLevel });
|
|
89
63
|
}
|
|
90
|
-
|
|
91
|
-
|
|
64
|
+
}
|
|
65
|
+
) }),
|
|
92
66
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.InspectorControls, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
93
67
|
import_components.__experimentalToolsPanel,
|
|
94
68
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/term-name/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n *
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseBlockProps,\n\tBlockControls,\n\tInspectorControls,\n\tHeadingLevelDropdown,\n} from '@wordpress/block-editor';\nimport {\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\nimport { useTermName } from './use-term-name';\n\nexport default function TermNameEdit( {\n\tattributes,\n\tsetAttributes,\n\tcontext: { termId, taxonomy },\n} ) {\n\tconst { level = 0, isLink, levelOptions } = attributes;\n\tconst { term } = useTermName( termId, taxonomy );\n\n\tconst termName = term?.name\n\t\t? decodeEntities( term.name )\n\t\t: __( 'Term Name' );\n\n\tconst blockProps = useBlockProps();\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst TagName = level === 0 ? 'p' : `h${ level }`;\n\n\tlet termNameDisplay = termName;\n\tif ( isLink ) {\n\t\ttermNameDisplay = (\n\t\t\t<a\n\t\t\t\thref=\"#term-name-pseudo-link\"\n\t\t\t\tonClick={ ( e ) => e.preventDefault() }\n\t\t\t>\n\t\t\t\t{ termName }\n\t\t\t</a>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<HeadingLevelDropdown\n\t\t\t\t\tvalue={ level }\n\t\t\t\t\toptions={ levelOptions }\n\t\t\t\t\tonChange={ ( newLevel ) => {\n\t\t\t\t\t\tsetAttributes( { level: newLevel } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tisLink: false,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => !! isLink }\n\t\t\t\t\t\tlabel={ __( 'Make term name a link' ) }\n\t\t\t\t\t\tonDeselect={ () => setAttributes( { isLink: false } ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Make term name a link' ) }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { isLink: ! isLink } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<TagName { ...blockProps }>{ termNameDisplay }</TagName>\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,0BAKO;AACP,wBAIO;AACP,2BAA+B;AAK/B,mBAA+C;AAC/C,2BAA4B;AAuBzB;AArBY,SAAR,aAA+B;AAAA,EACrC;AAAA,EACA;AAAA,EACA,SAAS,EAAE,QAAQ,SAAS;AAC7B,GAAI;AACH,QAAM,EAAE,QAAQ,GAAG,QAAQ,aAAa,IAAI;AAC5C,QAAM,EAAE,KAAK,QAAI,kCAAa,QAAQ,QAAS;AAE/C,QAAM,WAAW,MAAM,WACpB,qCAAgB,KAAK,IAAK,QAC1B,gBAAI,WAAY;AAEnB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