@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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 10.3.0 (2026-07-29)
|
|
6
|
+
|
|
7
|
+
### Enhancements
|
|
8
|
+
|
|
9
|
+
- Playlist: Shorten the track toolbar button label from "Add track" to "Add".
|
|
10
|
+
- Gallery: Rename the dynamic variation's "Convert to images" action to "Detach", and confirm it in a dialog explaining that the gallery will keep its current images but stop updating automatically ([#80727](https://github.com/WordPress/gutenberg/pull/80727)).
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- Playlist: Update `@arraypress/waveform-player` to `^1.23.0`, which no longer sets `crossorigin="anonymous"` on its audio element, fixing playback of tracks served without CORS headers such as media offloaded to a CDN ([#80533](https://github.com/WordPress/gutenberg/pull/80533)).
|
|
15
|
+
|
|
16
|
+
### Internal
|
|
17
|
+
|
|
18
|
+
- Update `memize` to 2.1.1 ([#80764](https://github.com/WordPress/gutenberg/pull/80764)).
|
|
19
|
+
- Image: Check only `window.__clientSideMediaProcessing` for sideloading status, following the removal of the redundant `window.__heicUploadSupport` flag ([#80452](https://github.com/WordPress/gutenberg/pull/80452)).
|
|
20
|
+
|
|
21
|
+
## 10.2.0 (2026-07-14)
|
|
22
|
+
|
|
23
|
+
### Enhancements
|
|
24
|
+
|
|
25
|
+
- Make the Playlist and Playlist Track blocks stable ([#80203](https://github.com/WordPress/gutenberg/pull/80203)).
|
|
26
|
+
- Use the emphasis font-weight token for UI emphasis ([#80093](https://github.com/WordPress/gutenberg/pull/80093)).
|
|
27
|
+
- Widen React peer dependency ranges to `^18 || ^19` to support both React 18 and React 19 environments ([#80024](https://github.com/WordPress/gutenberg/pull/80024)).
|
|
28
|
+
- Make the Tabs, Tab List, Tab Panels, and Tab Panel blocks stable ([#80163](https://github.com/WordPress/gutenberg/pull/80163)).
|
|
29
|
+
|
|
5
30
|
## 10.1.0 (2026-07-01)
|
|
6
31
|
|
|
7
32
|
## 10.0.0 (2026-06-24)
|
package/build/button/edit.cjs
CHANGED
|
@@ -43,6 +43,7 @@ var import_icons = require("@wordpress/icons");
|
|
|
43
43
|
var import_blocks = require("@wordpress/blocks");
|
|
44
44
|
var import_compose = require("@wordpress/compose");
|
|
45
45
|
var import_data = require("@wordpress/data");
|
|
46
|
+
var import_ui = require("@wordpress/ui");
|
|
46
47
|
var import_constants = require("./constants.cjs");
|
|
47
48
|
var import_get_updated_link_attributes = require("./get-updated-link-attributes.cjs");
|
|
48
49
|
var import_remove_anchor_tag = __toESM(require("../utils/remove-anchor-tag.cjs"));
|
|
@@ -59,18 +60,21 @@ var LINK_SETTINGS = [
|
|
|
59
60
|
title: (0, import_i18n.__)("Mark as nofollow")
|
|
60
61
|
}
|
|
61
62
|
];
|
|
62
|
-
function useEnter(
|
|
63
|
+
function useEnter(clientId) {
|
|
63
64
|
const { replaceBlocks, selectionChange } = (0, import_data.useDispatch)(import_block_editor.store);
|
|
64
|
-
const {
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
const {
|
|
66
|
+
getBlock,
|
|
67
|
+
getBlockAttributes,
|
|
68
|
+
getBlockRootClientId,
|
|
69
|
+
getBlockIndex
|
|
70
|
+
} = (0, import_data.useSelect)(import_block_editor.store);
|
|
67
71
|
return (0, import_compose.useRefEffect)((element) => {
|
|
68
72
|
function onKeyDown(event) {
|
|
69
73
|
if (event.defaultPrevented || event.keyCode !== import_keycodes.ENTER) {
|
|
70
74
|
return;
|
|
71
75
|
}
|
|
72
|
-
const {
|
|
73
|
-
if (
|
|
76
|
+
const { text } = getBlockAttributes(clientId) ?? {};
|
|
77
|
+
if (text?.length) {
|
|
74
78
|
return;
|
|
75
79
|
}
|
|
76
80
|
event.preventDefault();
|
|
@@ -229,7 +233,7 @@ function ButtonEdit(props) {
|
|
|
229
233
|
() => ({ url, opensInNewTab, nofollow }),
|
|
230
234
|
[url, opensInNewTab, nofollow]
|
|
231
235
|
);
|
|
232
|
-
const useEnterRef = useEnter(
|
|
236
|
+
const useEnterRef = useEnter(clientId);
|
|
233
237
|
const mergedRef = (0, import_compose.useMergeRefs)([useEnterRef, richTextRef]);
|
|
234
238
|
const [fluidTypographySettings, layout, dimensionSizes] = (0, import_block_editor.useSettings)(
|
|
235
239
|
"typography.fluid",
|
|
@@ -403,7 +407,13 @@ function ButtonEdit(props) {
|
|
|
403
407
|
"The <a>Link Relation</a> attribute defines the relationship between a linked resource and the current document."
|
|
404
408
|
),
|
|
405
409
|
{
|
|
406
|
-
a: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
410
|
+
a: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
411
|
+
import_ui.Link,
|
|
412
|
+
{
|
|
413
|
+
openInNewTab: true,
|
|
414
|
+
href: "https://developer.mozilla.org/docs/Web/HTML/Attributes/rel"
|
|
415
|
+
}
|
|
416
|
+
)
|
|
407
417
|
}
|
|
408
418
|
),
|
|
409
419
|
value: rel || "",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/button/edit.js"],
|
|
4
|
-
"sourcesContent": ["import clsx from 'clsx';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tuseEffect,\n\tuseState,\n\tuseRef,\n\tuseMemo,\n\tcreateInterpolateElement,\n} from '@wordpress/element';\nimport {\n\tTextControl,\n\tToolbarButton,\n\tPopover,\n\tExternalLink,\n} from '@wordpress/components';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n\tLinkControl,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalUseColorProps as useColorProps,\n\t__experimentalGetSpacingClassesAndStyles as useSpacingProps,\n\t__experimentalGetShadowClassesAndStyles as useShadowProps,\n\t__experimentalGetDimensionsClassesAndStyles as useDimensionsProps,\n\t__experimentalGetElementClassName,\n\tstore as blockEditorStore,\n\tuseBlockEditingMode,\n\tgetTypographyClassesAndStyles as useTypographyProps,\n\tuseSettings,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { displayShortcut, isKeyboardEvent, ENTER } from '@wordpress/keycodes';\nimport { link, linkOff } from '@wordpress/icons';\nimport {\n\tcreateBlock,\n\tcloneBlock,\n\tgetDefaultBlockName,\n\tgetBlockBindingsSource,\n} from '@wordpress/blocks';\nimport {\n\tuseMergeRefs,\n\tuseRefEffect,\n\tprivateApis as composePrivateApis,\n} from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { NEW_TAB_TARGET, NOFOLLOW_REL } from './constants';\nimport { getUpdatedLinkAttributes } from './get-updated-link-attributes';\nimport removeAnchorTag from '../utils/remove-anchor-tag';\nimport { unlock } from '../lock-unlock';\nimport useDeprecatedTextAlign from '../utils/deprecated-text-align-attributes';\nimport { getWidthClasses, isPercentageWidth } from './utils';\n\nconst { HTMLElementControl } = unlock( blockEditorPrivateApis );\nconst { subscribeDelegatedListener } = unlock( composePrivateApis );\n\nconst LINK_SETTINGS = [\n\t...LinkControl.DEFAULT_LINK_SETTINGS,\n\t{\n\t\tid: 'nofollow',\n\t\ttitle: __( 'Mark as nofollow' ),\n\t},\n];\n\nfunction useEnter( props ) {\n\tconst { replaceBlocks, selectionChange } = useDispatch( blockEditorStore );\n\tconst { getBlock, getBlockRootClientId, getBlockIndex } =\n\t\tuseSelect( blockEditorStore );\n\tconst propsRef = useRef( props );\n\tpropsRef.current = props;\n\treturn useRefEffect( ( element ) => {\n\t\tfunction onKeyDown( event ) {\n\t\t\tif ( event.defaultPrevented || event.keyCode !== ENTER ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst { content, clientId } = propsRef.current;\n\t\t\tif ( content.length ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\t\t\tconst topParentListBlock = getBlock(\n\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t);\n\t\t\tconst blockIndex = getBlockIndex( clientId );\n\t\t\tconst head = cloneBlock( {\n\t\t\t\t...topParentListBlock,\n\t\t\t\tinnerBlocks: topParentListBlock.innerBlocks.slice(\n\t\t\t\t\t0,\n\t\t\t\t\tblockIndex\n\t\t\t\t),\n\t\t\t} );\n\t\t\tconst middle = createBlock( getDefaultBlockName() );\n\t\t\tconst after = topParentListBlock.innerBlocks.slice(\n\t\t\t\tblockIndex + 1\n\t\t\t);\n\t\t\tconst tail = after.length\n\t\t\t\t? [\n\t\t\t\t\t\tcloneBlock( {\n\t\t\t\t\t\t\t...topParentListBlock,\n\t\t\t\t\t\t\tinnerBlocks: after,\n\t\t\t\t\t\t} ),\n\t\t\t\t ]\n\t\t\t\t: [];\n\t\t\treplaceBlocks(\n\t\t\t\ttopParentListBlock.clientId,\n\t\t\t\t[ head, middle, ...tail ],\n\t\t\t\t1\n\t\t\t);\n\t\t\t// We manually change the selection here because we are replacing\n\t\t\t// a different block than the selected one.\n\t\t\tselectionChange( middle.clientId );\n\t\t}\n\n\t\t// Capture phase so we run before writing-flow's ancestor-bubble\n\t\t// keydown handlers that gate on `event.defaultPrevented`.\n\t\treturn subscribeDelegatedListener(\n\t\t\telement,\n\t\t\t'keydown',\n\t\t\tonKeyDown,\n\t\t\ttrue\n\t\t);\n\t}, [] );\n}\n\nfunction ButtonEdit( props ) {\n\tconst {\n\t\tattributes,\n\t\tsetAttributes,\n\t\tclassName,\n\t\tisSelected,\n\t\tonReplace,\n\t\tmergeBlocks,\n\t\tclientId,\n\t\tcontext,\n\t} = props;\n\tconst {\n\t\ttagName,\n\t\tlinkTarget,\n\t\tplaceholder,\n\t\trel,\n\t\tstyle,\n\t\ttext,\n\t\turl,\n\t\tmetadata,\n\t} = attributes;\n\tconst width = style?.dimensions?.width;\n\n\tuseDeprecatedTextAlign( props );\n\n\tconst TagName = tagName || 'a';\n\n\tfunction onKeyDown( event ) {\n\t\tif ( isKeyboardEvent.primary( event, 'k' ) ) {\n\t\t\tstartEditing( event );\n\t\t} else if ( isKeyboardEvent.primaryShift( event, 'k' ) ) {\n\t\t\tunlink();\n\t\t\trichTextRef.current?.focus();\n\t\t}\n\t}\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\n\tconst borderProps = useBorderProps( attributes );\n\tconst colorProps = useColorProps( attributes );\n\tconst spacingProps = useSpacingProps( attributes );\n\tconst shadowProps = useShadowProps( attributes );\n\tconst dimensionsProps = useDimensionsProps( attributes );\n\tconst ref = useRef();\n\tconst richTextRef = useRef();\n\tconst blockProps = useBlockProps( {\n\t\tref: useMergeRefs( [ setPopoverAnchor, ref ] ),\n\t\tonKeyDown,\n\t} );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst [ isEditingURL, setIsEditingURL ] = useState( false );\n\tconst isURLSet = !! url;\n\tconst opensInNewTab = linkTarget === NEW_TAB_TARGET;\n\tconst nofollow = !! rel?.includes( NOFOLLOW_REL );\n\tconst isLinkTag = 'a' === TagName;\n\n\tconst {\n\t\tcreatePageEntity,\n\t\tuserCanCreatePages,\n\t\tlockUrlControls = false,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! isSelected ) {\n\t\t\t\treturn {};\n\t\t\t}\n\n\t\t\tconst _settings = select( blockEditorStore ).getSettings();\n\n\t\t\tconst blockBindingsSource = getBlockBindingsSource(\n\t\t\t\tmetadata?.bindings?.url?.source\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tcreatePageEntity: _settings.__experimentalCreatePageEntity,\n\t\t\t\tuserCanCreatePages: _settings.__experimentalUserCanCreatePages,\n\t\t\t\tlockUrlControls:\n\t\t\t\t\t!! metadata?.bindings?.url &&\n\t\t\t\t\t! blockBindingsSource?.canUserEditValue?.( {\n\t\t\t\t\t\tselect,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\targs: metadata?.bindings?.url?.args,\n\t\t\t\t\t} ),\n\t\t\t};\n\t\t},\n\t\t[ context, isSelected, metadata?.bindings?.url ]\n\t);\n\n\tasync function handleCreate( pageTitle ) {\n\t\tconst page = await createPageEntity( {\n\t\t\ttitle: pageTitle,\n\t\t\tstatus: 'draft',\n\t\t} );\n\n\t\treturn {\n\t\t\tid: page.id,\n\t\t\ttype: page.type,\n\t\t\ttitle: page.title.rendered,\n\t\t\turl: page.link,\n\t\t\tkind: 'post-type',\n\t\t};\n\t}\n\n\tfunction createButtonText( searchTerm ) {\n\t\treturn createInterpolateElement(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t__( 'Create page: <mark>%s</mark>' ),\n\t\t\t\tsearchTerm\n\t\t\t),\n\t\t\t{ mark: <mark /> }\n\t\t);\n\t}\n\n\tfunction startEditing( event ) {\n\t\tevent.preventDefault();\n\t\tsetIsEditingURL( true );\n\t}\n\n\tfunction unlink() {\n\t\tsetAttributes( {\n\t\t\turl: undefined,\n\t\t\tlinkTarget: undefined,\n\t\t\trel: undefined,\n\t\t} );\n\t\tsetIsEditingURL( false );\n\t}\n\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsEditingURL( false );\n\t\t}\n\t}, [ isSelected ] );\n\n\t// Memoize link value to avoid overriding the LinkControl's internal state.\n\t// This is a temporary fix. See https://github.com/WordPress/gutenberg/issues/51256.\n\tconst linkValue = useMemo(\n\t\t() => ( { url, opensInNewTab, nofollow } ),\n\t\t[ url, opensInNewTab, nofollow ]\n\t);\n\n\tconst useEnterRef = useEnter( { content: text, clientId } );\n\tconst mergedRef = useMergeRefs( [ useEnterRef, richTextRef ] );\n\n\tconst [ fluidTypographySettings, layout, dimensionSizes ] = useSettings(\n\t\t'typography.fluid',\n\t\t'layout',\n\t\t'dimensions.dimensionSizes'\n\t);\n\tconst dimensionPresets = useMemo( () => {\n\t\tif ( ! dimensionSizes ) {\n\t\t\treturn [];\n\t\t}\n\t\treturn [\n\t\t\t...( dimensionSizes?.custom ?? [] ),\n\t\t\t...( dimensionSizes?.theme ?? [] ),\n\t\t\t...( dimensionSizes?.default ?? [] ),\n\t\t];\n\t}, [ dimensionSizes ] );\n\tconst typographyProps = useTypographyProps( attributes, {\n\t\ttypography: {\n\t\t\tfluid: fluidTypographySettings,\n\t\t},\n\t\tlayout: {\n\t\t\twideSize: layout?.wideSize,\n\t\t},\n\t} );\n\n\t// Resolve preset dimension references to their actual values.\n\tconst resolvedWidth = useMemo( () => {\n\t\tif ( ! width ) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst presetPrefix = 'var:preset|dimension|';\n\t\tif ( width.startsWith( presetPrefix ) ) {\n\t\t\tconst slug = width.slice( presetPrefix.length );\n\t\t\tconst preset = dimensionPresets?.find( ( p ) => p.slug === slug );\n\t\t\treturn preset?.size ?? width;\n\t\t}\n\t\treturn width;\n\t}, [ width, dimensionPresets ] );\n\n\tconst hasNonContentControls = blockEditingMode === 'default';\n\tconst hasBlockControls =\n\t\thasNonContentControls || ( isLinkTag && ! lockUrlControls );\n\tconst classes = clsx(\n\t\tblockProps.className,\n\t\tgetWidthClasses( resolvedWidth )\n\t);\n\n\tconst widthStyle = useMemo( () => {\n\t\tif ( ! width ) {\n\t\t\treturn {};\n\t\t}\n\t\tif ( isPercentageWidth( resolvedWidth ) ) {\n\t\t\treturn {\n\t\t\t\t'--wp--block-button--width': parseFloat( resolvedWidth ),\n\t\t\t};\n\t\t}\n\t\treturn dimensionsProps.style;\n\t}, [ width, resolvedWidth, dimensionsProps.style ] );\n\n\treturn (\n\t\t<>\n\t\t\t<div\n\t\t\t\t{ ...blockProps }\n\t\t\t\tclassName={ classes }\n\t\t\t\tstyle={ { ...blockProps.style, ...widthStyle } }\n\t\t\t>\n\t\t\t\t<RichText\n\t\t\t\t\tref={ mergedRef }\n\t\t\t\t\taria-label={ __( 'Button text' ) }\n\t\t\t\t\tplaceholder={ placeholder || __( 'Add text…' ) }\n\t\t\t\t\tvalue={ text }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\ttext: removeAnchorTag( value ),\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t'wp-block-button__link',\n\t\t\t\t\t\tcolorProps.className,\n\t\t\t\t\t\tborderProps.className,\n\t\t\t\t\t\ttypographyProps.className,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// For backwards compatibility add style that isn't\n\t\t\t\t\t\t\t// provided via block support.\n\t\t\t\t\t\t\t'no-border-radius': style?.border?.radius === 0,\n\t\t\t\t\t\t\t[ `has-custom-font-size` ]:\n\t\t\t\t\t\t\t\tblockProps.style.fontSize,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t__experimentalGetElementClassName( 'button' )\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t\t...colorProps.style,\n\t\t\t\t\t\t...spacingProps.style,\n\t\t\t\t\t\t...shadowProps.style,\n\t\t\t\t\t\t...typographyProps.style,\n\t\t\t\t\t\twritingMode: undefined,\n\t\t\t\t\t} }\n\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\tonMerge={ mergeBlocks }\n\t\t\t\t\tidentifier=\"text\"\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t{ hasBlockControls && (\n\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t{ isLinkTag && ! lockUrlControls && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tname=\"link\"\n\t\t\t\t\t\t\ticon={ ! isURLSet ? link : linkOff }\n\t\t\t\t\t\t\ttitle={ ! isURLSet ? __( 'Link' ) : __( 'Unlink' ) }\n\t\t\t\t\t\t\tshortcut={\n\t\t\t\t\t\t\t\t! isURLSet\n\t\t\t\t\t\t\t\t\t? displayShortcut.primary( 'k' )\n\t\t\t\t\t\t\t\t\t: displayShortcut.primaryShift( 'k' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonClick={ ! isURLSet ? startEditing : unlink }\n\t\t\t\t\t\t\tisActive={ isURLSet }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t{ isLinkTag &&\n\t\t\t\tisSelected &&\n\t\t\t\t( isEditingURL || isURLSet ) &&\n\t\t\t\t! lockUrlControls && (\n\t\t\t\t\t<Popover\n\t\t\t\t\t\tplacement=\"bottom\"\n\t\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\t\tsetIsEditingURL( false );\n\t\t\t\t\t\t\trichTextRef.current?.focus();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\t\tfocusOnMount={ isEditingURL ? 'firstElement' : false }\n\t\t\t\t\t\t__unstableSlotName=\"__unstable-block-tools-after\"\n\t\t\t\t\t\tshift\n\t\t\t\t\t>\n\t\t\t\t\t\t<LinkControl\n\t\t\t\t\t\t\tvalue={ linkValue }\n\t\t\t\t\t\t\tonChange={ ( {\n\t\t\t\t\t\t\t\turl: newURL,\n\t\t\t\t\t\t\t\topensInNewTab: newOpensInNewTab,\n\t\t\t\t\t\t\t\tnofollow: newNofollow,\n\t\t\t\t\t\t\t} ) =>\n\t\t\t\t\t\t\t\tsetAttributes(\n\t\t\t\t\t\t\t\t\tgetUpdatedLinkAttributes( {\n\t\t\t\t\t\t\t\t\t\trel,\n\t\t\t\t\t\t\t\t\t\turl: newURL,\n\t\t\t\t\t\t\t\t\t\topensInNewTab: newOpensInNewTab,\n\t\t\t\t\t\t\t\t\t\tnofollow: newNofollow,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\t\tunlink();\n\t\t\t\t\t\t\t\trichTextRef.current?.focus();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tforceIsEditingLink={ isEditingURL }\n\t\t\t\t\t\t\tsettings={ LINK_SETTINGS }\n\t\t\t\t\t\t\tcreateSuggestion={\n\t\t\t\t\t\t\t\tcreatePageEntity && handleCreate\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\twithCreateSuggestion={ userCanCreatePages }\n\t\t\t\t\t\t\tcreateSuggestionButtonText={ createButtonText }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Popover>\n\t\t\t\t) }\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<HTMLElementControl\n\t\t\t\t\ttagName={ tagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<a>)' ), value: 'a' },\n\t\t\t\t\t\t{ label: '<button>', value: 'button' },\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t\t{ isLinkTag && (\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Link relation' ) }\n\t\t\t\t\t\thelp={ createInterpolateElement(\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'The <a>Link Relation</a> attribute defines the relationship between a linked resource and the current document.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t<ExternalLink href=\"https://developer.mozilla.org/docs/Web/HTML/Attributes/rel\" />\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\t\tonChange={ ( newRel ) =>\n\t\t\t\t\t\t\tsetAttributes( { rel: newRel } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n}\n\nexport default ButtonEdit;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,kBAA4B;AAC5B,qBAMO;AACP,
|
|
4
|
+
"sourcesContent": ["import clsx from 'clsx';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tuseEffect,\n\tuseState,\n\tuseRef,\n\tuseMemo,\n\tcreateInterpolateElement,\n} from '@wordpress/element';\nimport { TextControl, ToolbarButton, Popover } from '@wordpress/components';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n\tLinkControl,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalUseColorProps as useColorProps,\n\t__experimentalGetSpacingClassesAndStyles as useSpacingProps,\n\t__experimentalGetShadowClassesAndStyles as useShadowProps,\n\t__experimentalGetDimensionsClassesAndStyles as useDimensionsProps,\n\t__experimentalGetElementClassName,\n\tstore as blockEditorStore,\n\tuseBlockEditingMode,\n\tgetTypographyClassesAndStyles as useTypographyProps,\n\tuseSettings,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { displayShortcut, isKeyboardEvent, ENTER } from '@wordpress/keycodes';\nimport { link, linkOff } from '@wordpress/icons';\nimport {\n\tcreateBlock,\n\tcloneBlock,\n\tgetDefaultBlockName,\n\tgetBlockBindingsSource,\n} from '@wordpress/blocks';\nimport {\n\tuseMergeRefs,\n\tuseRefEffect,\n\tprivateApis as composePrivateApis,\n} from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Link } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { NEW_TAB_TARGET, NOFOLLOW_REL } from './constants';\nimport { getUpdatedLinkAttributes } from './get-updated-link-attributes';\nimport removeAnchorTag from '../utils/remove-anchor-tag';\nimport { unlock } from '../lock-unlock';\nimport useDeprecatedTextAlign from '../utils/deprecated-text-align-attributes';\nimport { getWidthClasses, isPercentageWidth } from './utils';\n\nconst { HTMLElementControl } = unlock( blockEditorPrivateApis );\nconst { subscribeDelegatedListener } = unlock( composePrivateApis );\n\nconst LINK_SETTINGS = [\n\t...LinkControl.DEFAULT_LINK_SETTINGS,\n\t{\n\t\tid: 'nofollow',\n\t\ttitle: __( 'Mark as nofollow' ),\n\t},\n];\n\nfunction useEnter( clientId ) {\n\tconst { replaceBlocks, selectionChange } = useDispatch( blockEditorStore );\n\tconst {\n\t\tgetBlock,\n\t\tgetBlockAttributes,\n\t\tgetBlockRootClientId,\n\t\tgetBlockIndex,\n\t} = useSelect( blockEditorStore );\n\n\treturn useRefEffect( ( element ) => {\n\t\tfunction onKeyDown( event ) {\n\t\t\tif ( event.defaultPrevented || event.keyCode !== ENTER ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst { text } = getBlockAttributes( clientId ) ?? {};\n\t\t\tif ( text?.length ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\t\t\tconst topParentListBlock = getBlock(\n\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t);\n\t\t\tconst blockIndex = getBlockIndex( clientId );\n\t\t\tconst head = cloneBlock( {\n\t\t\t\t...topParentListBlock,\n\t\t\t\tinnerBlocks: topParentListBlock.innerBlocks.slice(\n\t\t\t\t\t0,\n\t\t\t\t\tblockIndex\n\t\t\t\t),\n\t\t\t} );\n\t\t\tconst middle = createBlock( getDefaultBlockName() );\n\t\t\tconst after = topParentListBlock.innerBlocks.slice(\n\t\t\t\tblockIndex + 1\n\t\t\t);\n\t\t\tconst tail = after.length\n\t\t\t\t? [\n\t\t\t\t\t\tcloneBlock( {\n\t\t\t\t\t\t\t...topParentListBlock,\n\t\t\t\t\t\t\tinnerBlocks: after,\n\t\t\t\t\t\t} ),\n\t\t\t\t ]\n\t\t\t\t: [];\n\t\t\treplaceBlocks(\n\t\t\t\ttopParentListBlock.clientId,\n\t\t\t\t[ head, middle, ...tail ],\n\t\t\t\t1\n\t\t\t);\n\t\t\t// We manually change the selection here because we are replacing\n\t\t\t// a different block than the selected one.\n\t\t\tselectionChange( middle.clientId );\n\t\t}\n\n\t\t// Capture phase so we run before writing-flow's ancestor-bubble\n\t\t// keydown handlers that gate on `event.defaultPrevented`.\n\t\treturn subscribeDelegatedListener(\n\t\t\telement,\n\t\t\t'keydown',\n\t\t\tonKeyDown,\n\t\t\ttrue\n\t\t);\n\t}, [] );\n}\n\nfunction ButtonEdit( props ) {\n\tconst {\n\t\tattributes,\n\t\tsetAttributes,\n\t\tclassName,\n\t\tisSelected,\n\t\tonReplace,\n\t\tmergeBlocks,\n\t\tclientId,\n\t\tcontext,\n\t} = props;\n\tconst {\n\t\ttagName,\n\t\tlinkTarget,\n\t\tplaceholder,\n\t\trel,\n\t\tstyle,\n\t\ttext,\n\t\turl,\n\t\tmetadata,\n\t} = attributes;\n\tconst width = style?.dimensions?.width;\n\n\tuseDeprecatedTextAlign( props );\n\n\tconst TagName = tagName || 'a';\n\n\tfunction onKeyDown( event ) {\n\t\tif ( isKeyboardEvent.primary( event, 'k' ) ) {\n\t\t\tstartEditing( event );\n\t\t} else if ( isKeyboardEvent.primaryShift( event, 'k' ) ) {\n\t\t\tunlink();\n\t\t\trichTextRef.current?.focus();\n\t\t}\n\t}\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\n\tconst borderProps = useBorderProps( attributes );\n\tconst colorProps = useColorProps( attributes );\n\tconst spacingProps = useSpacingProps( attributes );\n\tconst shadowProps = useShadowProps( attributes );\n\tconst dimensionsProps = useDimensionsProps( attributes );\n\tconst ref = useRef();\n\tconst richTextRef = useRef();\n\tconst blockProps = useBlockProps( {\n\t\tref: useMergeRefs( [ setPopoverAnchor, ref ] ),\n\t\tonKeyDown,\n\t} );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst [ isEditingURL, setIsEditingURL ] = useState( false );\n\tconst isURLSet = !! url;\n\tconst opensInNewTab = linkTarget === NEW_TAB_TARGET;\n\tconst nofollow = !! rel?.includes( NOFOLLOW_REL );\n\tconst isLinkTag = 'a' === TagName;\n\n\tconst {\n\t\tcreatePageEntity,\n\t\tuserCanCreatePages,\n\t\tlockUrlControls = false,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! isSelected ) {\n\t\t\t\treturn {};\n\t\t\t}\n\n\t\t\tconst _settings = select( blockEditorStore ).getSettings();\n\n\t\t\tconst blockBindingsSource = getBlockBindingsSource(\n\t\t\t\tmetadata?.bindings?.url?.source\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tcreatePageEntity: _settings.__experimentalCreatePageEntity,\n\t\t\t\tuserCanCreatePages: _settings.__experimentalUserCanCreatePages,\n\t\t\t\tlockUrlControls:\n\t\t\t\t\t!! metadata?.bindings?.url &&\n\t\t\t\t\t! blockBindingsSource?.canUserEditValue?.( {\n\t\t\t\t\t\tselect,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\targs: metadata?.bindings?.url?.args,\n\t\t\t\t\t} ),\n\t\t\t};\n\t\t},\n\t\t[ context, isSelected, metadata?.bindings?.url ]\n\t);\n\n\tasync function handleCreate( pageTitle ) {\n\t\tconst page = await createPageEntity( {\n\t\t\ttitle: pageTitle,\n\t\t\tstatus: 'draft',\n\t\t} );\n\n\t\treturn {\n\t\t\tid: page.id,\n\t\t\ttype: page.type,\n\t\t\ttitle: page.title.rendered,\n\t\t\turl: page.link,\n\t\t\tkind: 'post-type',\n\t\t};\n\t}\n\n\tfunction createButtonText( searchTerm ) {\n\t\treturn createInterpolateElement(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t__( 'Create page: <mark>%s</mark>' ),\n\t\t\t\tsearchTerm\n\t\t\t),\n\t\t\t{ mark: <mark /> }\n\t\t);\n\t}\n\n\tfunction startEditing( event ) {\n\t\tevent.preventDefault();\n\t\tsetIsEditingURL( true );\n\t}\n\n\tfunction unlink() {\n\t\tsetAttributes( {\n\t\t\turl: undefined,\n\t\t\tlinkTarget: undefined,\n\t\t\trel: undefined,\n\t\t} );\n\t\tsetIsEditingURL( false );\n\t}\n\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsEditingURL( false );\n\t\t}\n\t}, [ isSelected ] );\n\n\t// Memoize link value to avoid overriding the LinkControl's internal state.\n\t// This is a temporary fix. See https://github.com/WordPress/gutenberg/issues/51256.\n\tconst linkValue = useMemo(\n\t\t() => ( { url, opensInNewTab, nofollow } ),\n\t\t[ url, opensInNewTab, nofollow ]\n\t);\n\n\tconst useEnterRef = useEnter( clientId );\n\tconst mergedRef = useMergeRefs( [ useEnterRef, richTextRef ] );\n\n\tconst [ fluidTypographySettings, layout, dimensionSizes ] = useSettings(\n\t\t'typography.fluid',\n\t\t'layout',\n\t\t'dimensions.dimensionSizes'\n\t);\n\tconst dimensionPresets = useMemo( () => {\n\t\tif ( ! dimensionSizes ) {\n\t\t\treturn [];\n\t\t}\n\t\treturn [\n\t\t\t...( dimensionSizes?.custom ?? [] ),\n\t\t\t...( dimensionSizes?.theme ?? [] ),\n\t\t\t...( dimensionSizes?.default ?? [] ),\n\t\t];\n\t}, [ dimensionSizes ] );\n\tconst typographyProps = useTypographyProps( attributes, {\n\t\ttypography: {\n\t\t\tfluid: fluidTypographySettings,\n\t\t},\n\t\tlayout: {\n\t\t\twideSize: layout?.wideSize,\n\t\t},\n\t} );\n\n\t// Resolve preset dimension references to their actual values.\n\tconst resolvedWidth = useMemo( () => {\n\t\tif ( ! width ) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst presetPrefix = 'var:preset|dimension|';\n\t\tif ( width.startsWith( presetPrefix ) ) {\n\t\t\tconst slug = width.slice( presetPrefix.length );\n\t\t\tconst preset = dimensionPresets?.find( ( p ) => p.slug === slug );\n\t\t\treturn preset?.size ?? width;\n\t\t}\n\t\treturn width;\n\t}, [ width, dimensionPresets ] );\n\n\tconst hasNonContentControls = blockEditingMode === 'default';\n\tconst hasBlockControls =\n\t\thasNonContentControls || ( isLinkTag && ! lockUrlControls );\n\tconst classes = clsx(\n\t\tblockProps.className,\n\t\tgetWidthClasses( resolvedWidth )\n\t);\n\n\tconst widthStyle = useMemo( () => {\n\t\tif ( ! width ) {\n\t\t\treturn {};\n\t\t}\n\t\tif ( isPercentageWidth( resolvedWidth ) ) {\n\t\t\treturn {\n\t\t\t\t'--wp--block-button--width': parseFloat( resolvedWidth ),\n\t\t\t};\n\t\t}\n\t\treturn dimensionsProps.style;\n\t}, [ width, resolvedWidth, dimensionsProps.style ] );\n\n\treturn (\n\t\t<>\n\t\t\t<div\n\t\t\t\t{ ...blockProps }\n\t\t\t\tclassName={ classes }\n\t\t\t\tstyle={ { ...blockProps.style, ...widthStyle } }\n\t\t\t>\n\t\t\t\t<RichText\n\t\t\t\t\tref={ mergedRef }\n\t\t\t\t\taria-label={ __( 'Button text' ) }\n\t\t\t\t\tplaceholder={ placeholder || __( 'Add text…' ) }\n\t\t\t\t\tvalue={ text }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\ttext: removeAnchorTag( value ),\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t'wp-block-button__link',\n\t\t\t\t\t\tcolorProps.className,\n\t\t\t\t\t\tborderProps.className,\n\t\t\t\t\t\ttypographyProps.className,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// For backwards compatibility add style that isn't\n\t\t\t\t\t\t\t// provided via block support.\n\t\t\t\t\t\t\t'no-border-radius': style?.border?.radius === 0,\n\t\t\t\t\t\t\t[ `has-custom-font-size` ]:\n\t\t\t\t\t\t\t\tblockProps.style.fontSize,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t__experimentalGetElementClassName( 'button' )\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t\t...colorProps.style,\n\t\t\t\t\t\t...spacingProps.style,\n\t\t\t\t\t\t...shadowProps.style,\n\t\t\t\t\t\t...typographyProps.style,\n\t\t\t\t\t\twritingMode: undefined,\n\t\t\t\t\t} }\n\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\tonMerge={ mergeBlocks }\n\t\t\t\t\tidentifier=\"text\"\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t{ hasBlockControls && (\n\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t{ isLinkTag && ! lockUrlControls && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tname=\"link\"\n\t\t\t\t\t\t\ticon={ ! isURLSet ? link : linkOff }\n\t\t\t\t\t\t\ttitle={ ! isURLSet ? __( 'Link' ) : __( 'Unlink' ) }\n\t\t\t\t\t\t\tshortcut={\n\t\t\t\t\t\t\t\t! isURLSet\n\t\t\t\t\t\t\t\t\t? displayShortcut.primary( 'k' )\n\t\t\t\t\t\t\t\t\t: displayShortcut.primaryShift( 'k' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonClick={ ! isURLSet ? startEditing : unlink }\n\t\t\t\t\t\t\tisActive={ isURLSet }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t{ isLinkTag &&\n\t\t\t\tisSelected &&\n\t\t\t\t( isEditingURL || isURLSet ) &&\n\t\t\t\t! lockUrlControls && (\n\t\t\t\t\t<Popover\n\t\t\t\t\t\tplacement=\"bottom\"\n\t\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\t\tsetIsEditingURL( false );\n\t\t\t\t\t\t\trichTextRef.current?.focus();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\t\tfocusOnMount={ isEditingURL ? 'firstElement' : false }\n\t\t\t\t\t\t__unstableSlotName=\"__unstable-block-tools-after\"\n\t\t\t\t\t\tshift\n\t\t\t\t\t>\n\t\t\t\t\t\t<LinkControl\n\t\t\t\t\t\t\tvalue={ linkValue }\n\t\t\t\t\t\t\tonChange={ ( {\n\t\t\t\t\t\t\t\turl: newURL,\n\t\t\t\t\t\t\t\topensInNewTab: newOpensInNewTab,\n\t\t\t\t\t\t\t\tnofollow: newNofollow,\n\t\t\t\t\t\t\t} ) =>\n\t\t\t\t\t\t\t\tsetAttributes(\n\t\t\t\t\t\t\t\t\tgetUpdatedLinkAttributes( {\n\t\t\t\t\t\t\t\t\t\trel,\n\t\t\t\t\t\t\t\t\t\turl: newURL,\n\t\t\t\t\t\t\t\t\t\topensInNewTab: newOpensInNewTab,\n\t\t\t\t\t\t\t\t\t\tnofollow: newNofollow,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\t\tunlink();\n\t\t\t\t\t\t\t\trichTextRef.current?.focus();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tforceIsEditingLink={ isEditingURL }\n\t\t\t\t\t\t\tsettings={ LINK_SETTINGS }\n\t\t\t\t\t\t\tcreateSuggestion={\n\t\t\t\t\t\t\t\tcreatePageEntity && handleCreate\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\twithCreateSuggestion={ userCanCreatePages }\n\t\t\t\t\t\t\tcreateSuggestionButtonText={ createButtonText }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Popover>\n\t\t\t\t) }\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<HTMLElementControl\n\t\t\t\t\ttagName={ tagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<a>)' ), value: 'a' },\n\t\t\t\t\t\t{ label: '<button>', value: 'button' },\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t\t{ isLinkTag && (\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Link relation' ) }\n\t\t\t\t\t\thelp={ createInterpolateElement(\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'The <a>Link Relation</a> attribute defines the relationship between a linked resource and the current document.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t<Link\n\t\t\t\t\t\t\t\t\t\topenInNewTab\n\t\t\t\t\t\t\t\t\t\thref=\"https://developer.mozilla.org/docs/Web/HTML/Attributes/rel\"\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\t\tonChange={ ( newRel ) =>\n\t\t\t\t\t\t\tsetAttributes( { rel: newRel } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n}\n\nexport default ButtonEdit;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,kBAA4B;AAC5B,qBAMO;AACP,wBAAoD;AACpD,0BAiBO;AACP,sBAAwD;AACxD,mBAA8B;AAC9B,oBAKO;AACP,qBAIO;AACP,kBAAuC;AACvC,gBAAqB;AAKrB,uBAA6C;AAC7C,yCAAyC;AACzC,+BAA4B;AAC5B,yBAAuB;AACvB,8CAAmC;AACnC,mBAAmD;AA4LxC;AA1LX,IAAM,EAAE,mBAAmB,QAAI,2BAAQ,oBAAAA,WAA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AA,YAC3C,EAAE,OAAO,YAAY,OAAO,SAAS;AAAA,UACtC;AAAA;AAAA,MACD;AAAA,MACE,aACD;AAAA,QAAC;AAAA;AAAA,UACA,WAAQ,gBAAI,eAAgB;AAAA,UAC5B,UAAO;AAAA,gBACN;AAAA,cACC;AAAA,YACD;AAAA,YACA;AAAA,cACC,GACC;AAAA,gBAAC;AAAA;AAAA,kBACA,cAAY;AAAA,kBACZ,MAAK;AAAA;AAAA,cACN;AAAA,YAEF;AAAA,UACD;AAAA,UACA,OAAQ,OAAO;AAAA,UACf,UAAW,CAAE,WACZ,cAAe,EAAE,KAAK,OAAO,CAAE;AAAA;AAAA,MAEjC;AAAA,OAEF;AAAA,KACD;AAEF;AAEA,IAAO,eAAQ;",
|
|
6
6
|
"names": ["blockEditorPrivateApis", "composePrivateApis", "blockEditorStore", "useDeprecatedTextAlign", "useBorderProps", "useColorProps", "useSpacingProps", "useShadowProps", "useDimensionsProps", "useTypographyProps", "clsx", "removeAnchorTag"]
|
|
7
7
|
}
|
package/build/code/edit.cjs
CHANGED
|
@@ -48,7 +48,9 @@ function CodeEdit({
|
|
|
48
48
|
"aria-label": (0, import_i18n.__)("Code"),
|
|
49
49
|
preserveWhiteSpace: true,
|
|
50
50
|
__unstablePastePlainText: true,
|
|
51
|
-
__unstableOnSplitAtDoubleLineEnd: () => insertBlocksAfter(
|
|
51
|
+
__unstableOnSplitAtDoubleLineEnd: insertBlocksAfter ? () => insertBlocksAfter(
|
|
52
|
+
(0, import_blocks.createBlock)((0, import_blocks.getDefaultBlockName)())
|
|
53
|
+
) : void 0,
|
|
52
54
|
style: { whiteSpace: "break-spaces" }
|
|
53
55
|
}
|
|
54
56
|
) });
|
package/build/code/edit.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/code/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { RichText, useBlockProps } from '@wordpress/block-editor';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\n\nexport default function CodeEdit( {\n\tattributes,\n\tsetAttributes,\n\tonRemove,\n\tinsertBlocksAfter,\n\tmergeBlocks,\n} ) {\n\tconst blockProps = useBlockProps();\n\treturn (\n\t\t<pre { ...blockProps }>\n\t\t\t<RichText\n\t\t\t\ttagName=\"code\"\n\t\t\t\tidentifier=\"content\"\n\t\t\t\tvalue={ attributes.content }\n\t\t\t\tonChange={ ( content ) => setAttributes( { content } ) }\n\t\t\t\tonRemove={ onRemove }\n\t\t\t\tonMerge={ mergeBlocks }\n\t\t\t\tplaceholder={ __( 'Write code…' ) }\n\t\t\t\taria-label={ __( 'Code' ) }\n\t\t\t\tpreserveWhiteSpace\n\t\t\t\t__unstablePastePlainText\n\t\t\t\t__unstableOnSplitAtDoubleLineEnd={ () =>\n\t\t\t\t\tinsertBlocksAfter(
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,0BAAwC;AACxC,oBAAiD;AAY9C;AAVY,SAAR,SAA2B;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,iBAAa,mCAAc;AACjC,SACC,4CAAC,SAAM,GAAG,YACT;AAAA,IAAC;AAAA;AAAA,MACA,SAAQ;AAAA,MACR,YAAW;AAAA,MACX,OAAQ,WAAW;AAAA,MACnB,UAAW,CAAE,YAAa,cAAe,EAAE,QAAQ,CAAE;AAAA,MACrD;AAAA,MACA,SAAU;AAAA,MACV,iBAAc,gBAAI,aAAc;AAAA,MAChC,kBAAa,gBAAI,MAAO;AAAA,MACxB,oBAAkB;AAAA,MAClB,0BAAwB;AAAA,MACxB,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { RichText, useBlockProps } from '@wordpress/block-editor';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\n\nexport default function CodeEdit( {\n\tattributes,\n\tsetAttributes,\n\tonRemove,\n\tinsertBlocksAfter,\n\tmergeBlocks,\n} ) {\n\tconst blockProps = useBlockProps();\n\treturn (\n\t\t<pre { ...blockProps }>\n\t\t\t<RichText\n\t\t\t\ttagName=\"code\"\n\t\t\t\tidentifier=\"content\"\n\t\t\t\tvalue={ attributes.content }\n\t\t\t\tonChange={ ( content ) => setAttributes( { content } ) }\n\t\t\t\tonRemove={ onRemove }\n\t\t\t\tonMerge={ mergeBlocks }\n\t\t\t\tplaceholder={ __( 'Write code…' ) }\n\t\t\t\taria-label={ __( 'Code' ) }\n\t\t\t\tpreserveWhiteSpace\n\t\t\t\t__unstablePastePlainText\n\t\t\t\t__unstableOnSplitAtDoubleLineEnd={\n\t\t\t\t\tinsertBlocksAfter\n\t\t\t\t\t\t? () =>\n\t\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\t\tcreateBlock( getDefaultBlockName() )\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\tstyle={ { whiteSpace: 'break-spaces' } }\n\t\t\t/>\n\t\t</pre>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,0BAAwC;AACxC,oBAAiD;AAY9C;AAVY,SAAR,SAA2B;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,iBAAa,mCAAc;AACjC,SACC,4CAAC,SAAM,GAAG,YACT;AAAA,IAAC;AAAA;AAAA,MACA,SAAQ;AAAA,MACR,YAAW;AAAA,MACX,OAAQ,WAAW;AAAA,MACnB,UAAW,CAAE,YAAa,cAAe,EAAE,QAAQ,CAAE;AAAA,MACrD;AAAA,MACA,SAAU;AAAA,MACV,iBAAc,gBAAI,aAAc;AAAA,MAChC,kBAAa,gBAAI,MAAO;AAAA,MACxB,oBAAkB;AAAA,MAClB,0BAAwB;AAAA,MACxB,kCACC,oBACG,MACA;AAAA,YACC,+BAAa,mCAAoB,CAAE;AAAA,MACpC,IACA;AAAA,MAEJ,OAAQ,EAAE,YAAY,eAAe;AAAA;AAAA,EACtC,GACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build/cover/block.json
CHANGED
|
@@ -85,10 +85,22 @@
|
|
|
85
85
|
"source": "attribute",
|
|
86
86
|
"selector": "video",
|
|
87
87
|
"attribute": "poster"
|
|
88
|
+
},
|
|
89
|
+
"allowedVideoProviders": {
|
|
90
|
+
"type": "array",
|
|
91
|
+
"default": [
|
|
92
|
+
"youtube",
|
|
93
|
+
"vimeo",
|
|
94
|
+
"videopress",
|
|
95
|
+
"animoto",
|
|
96
|
+
"tiktok",
|
|
97
|
+
"wordpress-tv"
|
|
98
|
+
]
|
|
88
99
|
}
|
|
89
100
|
},
|
|
90
101
|
"usesContext": [ "postId", "postType" ],
|
|
91
102
|
"supports": {
|
|
103
|
+
"__experimentalOnEnter": true,
|
|
92
104
|
"anchor": true,
|
|
93
105
|
"align": true,
|
|
94
106
|
"html": false,
|
|
@@ -41,6 +41,7 @@ var import_icons = require("@wordpress/icons");
|
|
|
41
41
|
var import_shared = require("../shared.cjs");
|
|
42
42
|
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
43
43
|
var import_embed_video_url_input = __toESM(require("./embed-video-url-input.cjs"));
|
|
44
|
+
var import_embed_video_utils = require("../embed-video-utils.cjs");
|
|
44
45
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
45
46
|
var { cleanEmptyObject } = (0, import_lock_unlock.unlock)(import_block_editor.privateApis);
|
|
46
47
|
function CoverBlockControls({
|
|
@@ -54,6 +55,7 @@ function CoverBlockControls({
|
|
|
54
55
|
onEditMedia,
|
|
55
56
|
editMediaButtonRef,
|
|
56
57
|
showEditMediaButton,
|
|
58
|
+
isEditMediaDisabled,
|
|
57
59
|
blockEditingMode
|
|
58
60
|
}) {
|
|
59
61
|
const {
|
|
@@ -62,9 +64,14 @@ function CoverBlockControls({
|
|
|
62
64
|
useFeaturedImage,
|
|
63
65
|
minHeight,
|
|
64
66
|
minHeightUnit,
|
|
65
|
-
backgroundType
|
|
67
|
+
backgroundType,
|
|
68
|
+
allowedVideoProviders
|
|
66
69
|
} = attributes;
|
|
67
70
|
const { hasInnerBlocks, url } = currentSettings;
|
|
71
|
+
const filteredVideoProviders = (0, import_embed_video_utils.getAllowedVideoProviders)(
|
|
72
|
+
allowedVideoProviders
|
|
73
|
+
);
|
|
74
|
+
const hasAllowedVideoProviders = filteredVideoProviders.length > 0;
|
|
68
75
|
const [prevMinHeightValue, setPrevMinHeightValue] = (0, import_element.useState)(minHeight);
|
|
69
76
|
const [prevMinHeightUnit, setPrevMinHeightUnit] = (0, import_element.useState)(minHeightUnit);
|
|
70
77
|
const [isEmbedUrlInputOpen, setIsEmbedUrlInputOpen] = (0, import_element.useState)(false);
|
|
@@ -126,7 +133,8 @@ function CoverBlockControls({
|
|
|
126
133
|
icon: import_icons.crop,
|
|
127
134
|
label: (0, import_i18n.__)("Crop background image"),
|
|
128
135
|
onClick: onEditMedia,
|
|
129
|
-
"aria-haspopup": "dialog"
|
|
136
|
+
"aria-haspopup": "dialog",
|
|
137
|
+
disabled: isEditMediaDisabled
|
|
130
138
|
}
|
|
131
139
|
)
|
|
132
140
|
] }),
|
|
@@ -142,7 +150,7 @@ function CoverBlockControls({
|
|
|
142
150
|
name: !url ? (0, import_i18n.__)("Add media") : (0, import_i18n.__)("Replace"),
|
|
143
151
|
onReset: onClearMedia,
|
|
144
152
|
variant: "toolbar",
|
|
145
|
-
children: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
153
|
+
children: ({ onClose }) => hasAllowedVideoProviders ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
146
154
|
import_components.MenuItem,
|
|
147
155
|
{
|
|
148
156
|
icon: import_icons.link,
|
|
@@ -152,7 +160,7 @@ function CoverBlockControls({
|
|
|
152
160
|
},
|
|
153
161
|
children: (0, import_i18n.__)("Embed video from URL")
|
|
154
162
|
}
|
|
155
|
-
)
|
|
163
|
+
) : null
|
|
156
164
|
}
|
|
157
165
|
) }),
|
|
158
166
|
isEmbedUrlInputOpen && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -162,7 +170,8 @@ function CoverBlockControls({
|
|
|
162
170
|
onSelectEmbedUrl(embedUrl);
|
|
163
171
|
},
|
|
164
172
|
onClose: () => setIsEmbedUrlInputOpen(false),
|
|
165
|
-
initialUrl: backgroundType === import_shared.EMBED_VIDEO_BACKGROUND_TYPE ? url : ""
|
|
173
|
+
initialUrl: backgroundType === import_shared.EMBED_VIDEO_BACKGROUND_TYPE ? url : "",
|
|
174
|
+
allowedVideoProviders: filteredVideoProviders
|
|
166
175
|
}
|
|
167
176
|
)
|
|
168
177
|
] });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cover/edit/block-controls.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\n\nimport {\n\tBlockControls,\n\tMediaReplaceFlow,\n\t__experimentalBlockAlignmentMatrixControl as BlockAlignmentMatrixControl,\n\t__experimentalBlockFullHeightAligmentControl as FullHeightAlignmentControl,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { MenuItem, ToolbarButton } from '@wordpress/components';\nimport { crop, link } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { ALLOWED_MEDIA_TYPES, EMBED_VIDEO_BACKGROUND_TYPE } from '../shared';\nimport { unlock } from '../../lock-unlock';\nimport EmbedVideoUrlInput from './embed-video-url-input';\n\nconst { cleanEmptyObject } = unlock( blockEditorPrivateApis );\n\nexport default function CoverBlockControls( {\n\tattributes,\n\tsetAttributes,\n\tonSelectMedia,\n\tcurrentSettings,\n\ttoggleUseFeaturedImage,\n\tonClearMedia,\n\tonSelectEmbedUrl,\n\tonEditMedia,\n\teditMediaButtonRef,\n\tshowEditMediaButton,\n\tblockEditingMode,\n} ) {\n\tconst {\n\t\tcontentPosition,\n\t\tid,\n\t\tuseFeaturedImage,\n\t\tminHeight,\n\t\tminHeightUnit,\n\t\tbackgroundType,\n\t} = attributes;\n\tconst { hasInnerBlocks, url } = currentSettings;\n\n\tconst [ prevMinHeightValue, setPrevMinHeightValue ] = useState( minHeight );\n\tconst [ prevMinHeightUnit, setPrevMinHeightUnit ] =\n\t\tuseState( minHeightUnit );\n\tconst [ isEmbedUrlInputOpen, setIsEmbedUrlInputOpen ] = useState( false );\n\tconst isMinFullHeight =\n\t\tminHeightUnit === 'vh' &&\n\t\tminHeight === 100 &&\n\t\t! attributes?.style?.dimensions?.aspectRatio;\n\tconst isContentOnlyMode = blockEditingMode === 'contentOnly';\n\n\tconst toggleMinFullHeight = () => {\n\t\tif ( isMinFullHeight ) {\n\t\t\t// If there aren't previous values, take the default ones.\n\t\t\tif ( prevMinHeightUnit === 'vh' && prevMinHeightValue === 100 ) {\n\t\t\t\treturn setAttributes( {\n\t\t\t\t\tminHeight: undefined,\n\t\t\t\t\tminHeightUnit: undefined,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\t// Set the previous values of height.\n\t\t\treturn setAttributes( {\n\t\t\t\tminHeight: prevMinHeightValue,\n\t\t\t\tminHeightUnit: prevMinHeightUnit,\n\t\t\t} );\n\t\t}\n\n\t\tsetPrevMinHeightValue( minHeight );\n\t\tsetPrevMinHeightUnit( minHeightUnit );\n\n\t\t// Set full height, and clear any aspect ratio value.\n\t\treturn setAttributes( {\n\t\t\tminHeight: 100,\n\t\t\tminHeightUnit: 'vh',\n\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t...attributes?.style,\n\t\t\t\tdimensions: {\n\t\t\t\t\t...attributes?.style?.dimensions,\n\t\t\t\t\taspectRatio: undefined, // Reset aspect ratio when minHeight is set.\n\t\t\t\t},\n\t\t\t} ),\n\t\t} );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t{ ! isContentOnlyMode && (\n\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t<BlockAlignmentMatrixControl\n\t\t\t\t\t\tlabel={ __( 'Change content position' ) }\n\t\t\t\t\t\tvalue={ contentPosition }\n\t\t\t\t\t\tonChange={ ( nextPosition ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tcontentPosition: nextPosition,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisDisabled={ ! hasInnerBlocks }\n\t\t\t\t\t/>\n\t\t\t\t\t<FullHeightAlignmentControl\n\t\t\t\t\t\tisActive={ isMinFullHeight }\n\t\t\t\t\t\tonToggle={ toggleMinFullHeight }\n\t\t\t\t\t\tisDisabled={ ! hasInnerBlocks }\n\t\t\t\t\t/>\n\t\t\t\t\t{ showEditMediaButton && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tref={ editMediaButtonRef }\n\t\t\t\t\t\t\ticon={ crop }\n\t\t\t\t\t\t\tlabel={ __( 'Crop background image' ) }\n\t\t\t\t\t\t\tonClick={ onEditMedia }\n\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t<BlockControls group=\"other\">\n\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\tmediaId={ id }\n\t\t\t\t\tmediaURL={ url }\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\tonSelect={ onSelectMedia }\n\t\t\t\t\tonToggleFeaturedImage={ toggleUseFeaturedImage }\n\t\t\t\t\tuseFeaturedImage={ useFeaturedImage }\n\t\t\t\t\tname={ ! url ? __( 'Add media' ) : __( 'Replace' ) }\n\t\t\t\t\tonReset={ onClearMedia }\n\t\t\t\t\tvariant=\"toolbar\"\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose } )
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAyB;AAEzB,0BAMO;AACP,kBAAmB;AACnB,wBAAwC;AACxC,mBAA2B;AAK3B,oBAAiE;AACjE,yBAAuB;AACvB,mCAA+B;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\n\nimport {\n\tBlockControls,\n\tMediaReplaceFlow,\n\t__experimentalBlockAlignmentMatrixControl as BlockAlignmentMatrixControl,\n\t__experimentalBlockFullHeightAligmentControl as FullHeightAlignmentControl,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { MenuItem, ToolbarButton } from '@wordpress/components';\nimport { crop, link } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { ALLOWED_MEDIA_TYPES, EMBED_VIDEO_BACKGROUND_TYPE } from '../shared';\nimport { unlock } from '../../lock-unlock';\nimport EmbedVideoUrlInput from './embed-video-url-input';\nimport { getAllowedVideoProviders } from '../embed-video-utils';\n\nconst { cleanEmptyObject } = unlock( blockEditorPrivateApis );\n\nexport default function CoverBlockControls( {\n\tattributes,\n\tsetAttributes,\n\tonSelectMedia,\n\tcurrentSettings,\n\ttoggleUseFeaturedImage,\n\tonClearMedia,\n\tonSelectEmbedUrl,\n\tonEditMedia,\n\teditMediaButtonRef,\n\tshowEditMediaButton,\n\tisEditMediaDisabled,\n\tblockEditingMode,\n} ) {\n\tconst {\n\t\tcontentPosition,\n\t\tid,\n\t\tuseFeaturedImage,\n\t\tminHeight,\n\t\tminHeightUnit,\n\t\tbackgroundType,\n\t\tallowedVideoProviders,\n\t} = attributes;\n\tconst { hasInnerBlocks, url } = currentSettings;\n\n\tconst filteredVideoProviders = getAllowedVideoProviders(\n\t\tallowedVideoProviders\n\t);\n\tconst hasAllowedVideoProviders = filteredVideoProviders.length > 0;\n\n\tconst [ prevMinHeightValue, setPrevMinHeightValue ] = useState( minHeight );\n\tconst [ prevMinHeightUnit, setPrevMinHeightUnit ] =\n\t\tuseState( minHeightUnit );\n\tconst [ isEmbedUrlInputOpen, setIsEmbedUrlInputOpen ] = useState( false );\n\tconst isMinFullHeight =\n\t\tminHeightUnit === 'vh' &&\n\t\tminHeight === 100 &&\n\t\t! attributes?.style?.dimensions?.aspectRatio;\n\tconst isContentOnlyMode = blockEditingMode === 'contentOnly';\n\n\tconst toggleMinFullHeight = () => {\n\t\tif ( isMinFullHeight ) {\n\t\t\t// If there aren't previous values, take the default ones.\n\t\t\tif ( prevMinHeightUnit === 'vh' && prevMinHeightValue === 100 ) {\n\t\t\t\treturn setAttributes( {\n\t\t\t\t\tminHeight: undefined,\n\t\t\t\t\tminHeightUnit: undefined,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\t// Set the previous values of height.\n\t\t\treturn setAttributes( {\n\t\t\t\tminHeight: prevMinHeightValue,\n\t\t\t\tminHeightUnit: prevMinHeightUnit,\n\t\t\t} );\n\t\t}\n\n\t\tsetPrevMinHeightValue( minHeight );\n\t\tsetPrevMinHeightUnit( minHeightUnit );\n\n\t\t// Set full height, and clear any aspect ratio value.\n\t\treturn setAttributes( {\n\t\t\tminHeight: 100,\n\t\t\tminHeightUnit: 'vh',\n\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t...attributes?.style,\n\t\t\t\tdimensions: {\n\t\t\t\t\t...attributes?.style?.dimensions,\n\t\t\t\t\taspectRatio: undefined, // Reset aspect ratio when minHeight is set.\n\t\t\t\t},\n\t\t\t} ),\n\t\t} );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t{ ! isContentOnlyMode && (\n\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t<BlockAlignmentMatrixControl\n\t\t\t\t\t\tlabel={ __( 'Change content position' ) }\n\t\t\t\t\t\tvalue={ contentPosition }\n\t\t\t\t\t\tonChange={ ( nextPosition ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tcontentPosition: nextPosition,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisDisabled={ ! hasInnerBlocks }\n\t\t\t\t\t/>\n\t\t\t\t\t<FullHeightAlignmentControl\n\t\t\t\t\t\tisActive={ isMinFullHeight }\n\t\t\t\t\t\tonToggle={ toggleMinFullHeight }\n\t\t\t\t\t\tisDisabled={ ! hasInnerBlocks }\n\t\t\t\t\t/>\n\t\t\t\t\t{ showEditMediaButton && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tref={ editMediaButtonRef }\n\t\t\t\t\t\t\ticon={ crop }\n\t\t\t\t\t\t\tlabel={ __( 'Crop background image' ) }\n\t\t\t\t\t\t\tonClick={ onEditMedia }\n\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t\t// Disable rather than hide while the edited image\n\t\t\t\t\t\t\t// loads, so the button keeps focus when the modal\n\t\t\t\t\t\t\t// closes instead of dropping it to the canvas.\n\t\t\t\t\t\t\tdisabled={ isEditMediaDisabled }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t<BlockControls group=\"other\">\n\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\tmediaId={ id }\n\t\t\t\t\tmediaURL={ url }\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\tonSelect={ onSelectMedia }\n\t\t\t\t\tonToggleFeaturedImage={ toggleUseFeaturedImage }\n\t\t\t\t\tuseFeaturedImage={ useFeaturedImage }\n\t\t\t\t\tname={ ! url ? __( 'Add media' ) : __( 'Replace' ) }\n\t\t\t\t\tonReset={ onClearMedia }\n\t\t\t\t\tvariant=\"toolbar\"\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose } ) =>\n\t\t\t\t\t\thasAllowedVideoProviders ? (\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\ticon={ link }\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tsetIsEmbedUrlInputOpen( true );\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Embed video from URL' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t) : null\n\t\t\t\t\t}\n\t\t\t\t</MediaReplaceFlow>\n\t\t\t</BlockControls>\n\t\t\t{ isEmbedUrlInputOpen && (\n\t\t\t\t<EmbedVideoUrlInput\n\t\t\t\t\tonSubmit={ ( embedUrl ) => {\n\t\t\t\t\t\tonSelectEmbedUrl( embedUrl );\n\t\t\t\t\t} }\n\t\t\t\t\tonClose={ () => setIsEmbedUrlInputOpen( false ) }\n\t\t\t\t\tinitialUrl={\n\t\t\t\t\t\tbackgroundType === EMBED_VIDEO_BACKGROUND_TYPE\n\t\t\t\t\t\t\t? url\n\t\t\t\t\t\t\t: ''\n\t\t\t\t\t}\n\t\t\t\t\tallowedVideoProviders={ filteredVideoProviders }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAyB;AAEzB,0BAMO;AACP,kBAAmB;AACnB,wBAAwC;AACxC,mBAA2B;AAK3B,oBAAiE;AACjE,yBAAuB;AACvB,mCAA+B;AAC/B,+BAAyC;AA+EvC;AA7EF,IAAM,EAAE,iBAAiB,QAAI,2BAAQ,oBAAAA,WAAuB;AAE7C,SAAR,mBAAqC;AAAA,EAC3C;AAAA,EACA;AAAA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Control", "FullHeightAlignmentControl", "EmbedVideoUrlInput"]
|
|
7
7
|
}
|
|
@@ -26,12 +26,14 @@ module.exports = __toCommonJS(embed_video_url_input_exports);
|
|
|
26
26
|
var import_element = require("@wordpress/element");
|
|
27
27
|
var import_components = require("@wordpress/components");
|
|
28
28
|
var import_i18n = require("@wordpress/i18n");
|
|
29
|
+
var import_ui = require("@wordpress/ui");
|
|
29
30
|
var import_embed_video_utils = require("../embed-video-utils.cjs");
|
|
30
31
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
32
|
function EmbedVideoUrlInput({
|
|
32
33
|
onSubmit,
|
|
33
34
|
onClose,
|
|
34
|
-
initialUrl = ""
|
|
35
|
+
initialUrl = "",
|
|
36
|
+
allowedVideoProviders
|
|
35
37
|
}) {
|
|
36
38
|
const [url, setUrl] = (0, import_element.useState)(initialUrl);
|
|
37
39
|
const [error, setError] = (0, import_element.useState)("");
|
|
@@ -40,7 +42,7 @@ function EmbedVideoUrlInput({
|
|
|
40
42
|
setError((0, import_i18n.__)("Please enter a URL."));
|
|
41
43
|
return;
|
|
42
44
|
}
|
|
43
|
-
if (!(0, import_embed_video_utils.isValidVideoEmbedUrl)(url)) {
|
|
45
|
+
if (!(0, import_embed_video_utils.isValidVideoEmbedUrl)(url, allowedVideoProviders)) {
|
|
44
46
|
setError(
|
|
45
47
|
(0, import_i18n.__)(
|
|
46
48
|
"This URL is not supported. Please enter a valid video link from a supported provider."
|
|
@@ -59,7 +61,7 @@ function EmbedVideoUrlInput({
|
|
|
59
61
|
onCancel: onClose,
|
|
60
62
|
confirmButtonText: (0, import_i18n.__)("Add video"),
|
|
61
63
|
size: "medium",
|
|
62
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
64
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ui.Stack, { direction: "column", gap: "lg", children: [
|
|
63
65
|
error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Notice, { status: "error", isDismissible: false, children: error }),
|
|
64
66
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
65
67
|
import_components.TextControl,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cover/edit/embed-video-url-input.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport {\n\t__experimentalConfirmDialog as ConfirmDialog,\n\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAyB;AACzB,
|
|
6
|
-
"names": ["ConfirmDialog"
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport {\n\t__experimentalConfirmDialog as ConfirmDialog,\n\tTextControl,\n\tNotice,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { Stack } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { isValidVideoEmbedUrl } from '../embed-video-utils';\n\nexport default function EmbedVideoUrlInput( {\n\tonSubmit,\n\tonClose,\n\tinitialUrl = '',\n\tallowedVideoProviders,\n} ) {\n\tconst [ url, setUrl ] = useState( initialUrl );\n\tconst [ error, setError ] = useState( '' );\n\n\tconst handleConfirm = () => {\n\t\tif ( ! url ) {\n\t\t\tsetError( __( 'Please enter a URL.' ) );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! isValidVideoEmbedUrl( url, allowedVideoProviders ) ) {\n\t\t\tsetError(\n\t\t\t\t__(\n\t\t\t\t\t'This URL is not supported. Please enter a valid video link from a supported provider.'\n\t\t\t\t)\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tonSubmit( url );\n\t\tonClose();\n\t};\n\n\treturn (\n\t\t<ConfirmDialog\n\t\t\tisOpen\n\t\t\tonConfirm={ handleConfirm }\n\t\t\tonCancel={ onClose }\n\t\t\tconfirmButtonText={ __( 'Add video' ) }\n\t\t\tsize=\"medium\"\n\t\t>\n\t\t\t<Stack direction=\"column\" gap=\"lg\">\n\t\t\t\t{ error && (\n\t\t\t\t\t<Notice status=\"error\" isDismissible={ false }>\n\t\t\t\t\t\t{ error }\n\t\t\t\t\t</Notice>\n\t\t\t\t) }\n\t\t\t\t<TextControl\n\t\t\t\t\ttype=\"url\"\n\t\t\t\t\tlabel={ __( 'Video URL' ) }\n\t\t\t\t\tvalue={ url }\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\tsetUrl( value );\n\t\t\t\t\t\tsetError( '' );\n\t\t\t\t\t} }\n\t\t\t\t\tplaceholder={ __(\n\t\t\t\t\t\t'Enter YouTube, Vimeo, or other video URL'\n\t\t\t\t\t) }\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'Add a background video to the cover block that will autoplay in a loop.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</Stack>\n\t\t</ConfirmDialog>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAyB;AACzB,wBAIO;AACP,kBAAmB;AACnB,gBAAsB;AAKtB,+BAAqC;AAsClC;AApCY,SAAR,mBAAqC;AAAA,EAC3C;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb;AACD,GAAI;AACH,QAAM,CAAE,KAAK,MAAO,QAAI,yBAAU,UAAW;AAC7C,QAAM,CAAE,OAAO,QAAS,QAAI,yBAAU,EAAG;AAEzC,QAAM,gBAAgB,MAAM;AAC3B,QAAK,CAAE,KAAM;AACZ,mBAAU,gBAAI,qBAAsB,CAAE;AACtC;AAAA,IACD;AAEA,QAAK,KAAE,+CAAsB,KAAK,qBAAsB,GAAI;AAC3D;AAAA,YACC;AAAA,UACC;AAAA,QACD;AAAA,MACD;AACA;AAAA,IACD;AAEA,aAAU,GAAI;AACd,YAAQ;AAAA,EACT;AAEA,SACC;AAAA,I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