@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
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// packages/block-library/src/image/animated-gif-convert-control.js
|
|
21
|
-
var animated_gif_convert_control_exports = {};
|
|
22
|
-
__export(animated_gif_convert_control_exports, {
|
|
23
|
-
default: () => AnimatedGifConvertControl
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(animated_gif_convert_control_exports);
|
|
26
|
-
var import_components = require("@wordpress/components");
|
|
27
|
-
var import_block_editor = require("@wordpress/block-editor");
|
|
28
|
-
var import_core_data = require("@wordpress/core-data");
|
|
29
|
-
var import_blocks = require("@wordpress/blocks");
|
|
30
|
-
var import_data = require("@wordpress/data");
|
|
31
|
-
var import_icons = require("@wordpress/icons");
|
|
32
|
-
var import_i18n = require("@wordpress/i18n");
|
|
33
|
-
var import_gif_conversion_attributes = require("../utils/gif-conversion-attributes.cjs");
|
|
34
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
-
function AnimatedGifConvertControl({ attributes, clientId }) {
|
|
36
|
-
const { id, url, caption } = attributes;
|
|
37
|
-
const { replaceBlocks } = (0, import_data.useDispatch)(import_block_editor.store);
|
|
38
|
-
const companion = (0, import_data.useSelect)(
|
|
39
|
-
(select) => {
|
|
40
|
-
if (!id) {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
const urlPath = url?.split(/[?#]/)[0];
|
|
44
|
-
if (!urlPath?.toLowerCase().endsWith(".gif")) {
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
const { getBlockRootClientId, getBlockName } = select(import_block_editor.store);
|
|
48
|
-
const rootClientId = getBlockRootClientId(clientId);
|
|
49
|
-
if (rootClientId && getBlockName(rootClientId) === "core/gallery") {
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
const record = select(import_core_data.store).getEntityRecord(
|
|
53
|
-
"postType",
|
|
54
|
-
"attachment",
|
|
55
|
-
id,
|
|
56
|
-
{ context: "view" }
|
|
57
|
-
);
|
|
58
|
-
const details = record?.media_details;
|
|
59
|
-
if (!details?.animated_video || !record?.source_url) {
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
|
-
return {
|
|
63
|
-
sourceUrl: record.source_url,
|
|
64
|
-
video: details.animated_video,
|
|
65
|
-
poster: details.animated_video_poster,
|
|
66
|
-
width: details.width,
|
|
67
|
-
height: details.height
|
|
68
|
-
};
|
|
69
|
-
},
|
|
70
|
-
[id, url, clientId]
|
|
71
|
-
);
|
|
72
|
-
if (!companion) {
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
function convertToVideo() {
|
|
76
|
-
const dir = companion.sourceUrl.slice(
|
|
77
|
-
0,
|
|
78
|
-
companion.sourceUrl.lastIndexOf("/") + 1
|
|
79
|
-
);
|
|
80
|
-
replaceBlocks(
|
|
81
|
-
clientId,
|
|
82
|
-
(0, import_blocks.createBlock)("core/video", {
|
|
83
|
-
...(0, import_gif_conversion_attributes.getCarriedGifConversionAttributes)(attributes),
|
|
84
|
-
id,
|
|
85
|
-
src: dir + companion.video,
|
|
86
|
-
poster: companion.poster ? dir + companion.poster : void 0,
|
|
87
|
-
caption,
|
|
88
|
-
controls: false,
|
|
89
|
-
loop: true,
|
|
90
|
-
autoplay: true,
|
|
91
|
-
muted: true,
|
|
92
|
-
playsInline: true,
|
|
93
|
-
// Carry the GIF's intrinsic dimensions so the <video> keeps its
|
|
94
|
-
// aspect ratio from the first paint. Without them the element
|
|
95
|
-
// collapses to the browser-default size and then jumps once the
|
|
96
|
-
// poster/metadata load, which shows up as a brief duplicated
|
|
97
|
-
// image during the swap.
|
|
98
|
-
width: companion.width,
|
|
99
|
-
height: companion.height
|
|
100
|
-
})
|
|
101
|
-
);
|
|
102
|
-
}
|
|
103
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.BlockControls, { group: "other", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.ToolbarButton, { icon: import_icons.video, onClick: convertToVideo, children: (0, import_i18n.__)("Display as video") }) }) });
|
|
104
|
-
}
|
|
105
|
-
//# sourceMappingURL=animated-gif-convert-control.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/image/animated-gif-convert-control.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { ToolbarButton, ToolbarGroup } from '@wordpress/components';\nimport {\n\tBlockControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { createBlock } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { video as videoIcon } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { getCarriedGifConversionAttributes } from '../utils/gif-conversion-attributes';\n\n/**\n * Toolbar control that turns an animated GIF Image block into a converted Video\n * block once the GIF's sideloaded video companion is available.\n *\n * Mirrors the Video block's \"Display as GIF\" toolbar control. Fresh uploads\n * are swapped automatically from the image block's `onSelectImage`; this\n * control is the explicit path for image blocks that came from saved post\n * content (or that the author restored from a converted Video block via\n * \"Display as GIF\") and now want to be played as a looping video.\n *\n * @param {Object} props Component props.\n * @param {Object} props.attributes Image block attributes.\n * @param {string} props.clientId Block client ID.\n *\n * @return {Component|null} The control, or null when conversion does not apply.\n */\nexport default function AnimatedGifConvertControl( { attributes, clientId } ) {\n\tconst { id, url, caption } = attributes;\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\n\tconst companion = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! id ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\t/*\n\t\t\t * Only animated GIFs have a video companion. Gate on the `.gif`\n\t\t\t * extension so an ordinary image never triggers an attachment\n\t\t\t * REST fetch just to discover it has no companion. Strip any\n\t\t\t * query string or fragment first so a URL like `cat.gif?ver=2`\n\t\t\t * still matches.\n\t\t\t */\n\t\t\tconst urlPath = url?.split( /[?#]/ )[ 0 ];\n\t\t\tif ( ! urlPath?.toLowerCase().endsWith( '.gif' ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\t// A gallery only accepts `core/image` children, so swapping the\n\t\t\t// image for a video block there would be rejected. Hide the\n\t\t\t// control inside a gallery; the converted video is still\n\t\t\t// sideloaded and stored for use elsewhere.\n\t\t\tconst { getBlockRootClientId, getBlockName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\tif (\n\t\t\t\trootClientId &&\n\t\t\t\tgetBlockName( rootClientId ) === 'core/gallery'\n\t\t\t) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst record = select( coreStore ).getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'attachment',\n\t\t\t\tid,\n\t\t\t\t{ context: 'view' }\n\t\t\t);\n\t\t\tconst details = record?.media_details;\n\t\t\tif ( ! details?.animated_video || ! record?.source_url ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tsourceUrl: record.source_url,\n\t\t\t\tvideo: details.animated_video,\n\t\t\t\tposter: details.animated_video_poster,\n\t\t\t\twidth: details.width,\n\t\t\t\theight: details.height,\n\t\t\t};\n\t\t},\n\t\t[ id, url, clientId ]\n\t);\n\n\tif ( ! companion ) {\n\t\treturn null;\n\t}\n\n\tfunction convertToVideo() {\n\t\t// Companion files are sideloaded next to the GIF, so they share its\n\t\t// directory; build their URLs from the GIF's own source URL.\n\t\tconst dir = companion.sourceUrl.slice(\n\t\t\t0,\n\t\t\tcompanion.sourceUrl.lastIndexOf( '/' ) + 1\n\t\t);\n\n\t\treplaceBlocks(\n\t\t\tclientId,\n\t\t\tcreateBlock( 'core/video', {\n\t\t\t\t...getCarriedGifConversionAttributes( attributes ),\n\t\t\t\tid,\n\t\t\t\tsrc: dir + companion.video,\n\t\t\t\tposter: companion.poster ? dir + companion.poster : undefined,\n\t\t\t\tcaption,\n\t\t\t\tcontrols: false,\n\t\t\t\tloop: true,\n\t\t\t\tautoplay: true,\n\t\t\t\tmuted: true,\n\t\t\t\tplaysInline: true,\n\t\t\t\t// Carry the GIF's intrinsic dimensions so the <video> keeps its\n\t\t\t\t// aspect ratio from the first paint. Without them the element\n\t\t\t\t// collapses to the browser-default size and then jumps once the\n\t\t\t\t// poster/metadata load, which shows up as a brief duplicated\n\t\t\t\t// image during the swap.\n\t\t\t\twidth: companion.width,\n\t\t\t\theight: companion.height,\n\t\t\t} )\n\t\t);\n\t}\n\n\treturn (\n\t\t<BlockControls group=\"other\">\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton icon={ videoIcon } onClick={ convertToVideo }>\n\t\t\t\t\t{ __( 'Display as video' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t</ToolbarGroup>\n\t\t</BlockControls>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA4C;AAC5C,0BAGO;AACP,uBAAmC;AACnC,oBAA4B;AAC5B,kBAAuC;AACvC,mBAAmC;AACnC,kBAAmB;AAKnB,uCAAkD;AA+G9C;AA7FW,SAAR,0BAA4C,EAAE,YAAY,SAAS,GAAI;AAC7E,QAAM,EAAE,IAAI,KAAK,QAAQ,IAAI;AAC7B,QAAM,EAAE,cAAc,QAAI,yBAAa,oBAAAA,KAAiB;AAExD,QAAM,gBAAY;AAAA,IACjB,CAAE,WAAY;AACb,UAAK,CAAE,IAAK;AACX,eAAO;AAAA,MACR;AAQA,YAAM,UAAU,KAAK,MAAO,MAAO,EAAG,CAAE;AACxC,UAAK,CAAE,SAAS,YAAY,EAAE,SAAU,MAAO,GAAI;AAClD,eAAO;AAAA,MACR;AAKA,YAAM,EAAE,sBAAsB,aAAa,IAC1C,OAAQ,oBAAAA,KAAiB;AAC1B,YAAM,eAAe,qBAAsB,QAAS;AACpD,UACC,gBACA,aAAc,YAAa,MAAM,gBAChC;AACD,eAAO;AAAA,MACR;AACA,YAAM,SAAS,OAAQ,iBAAAC,KAAU,EAAE;AAAA,QAClC;AAAA,QACA;AAAA,QACA;AAAA,QACA,EAAE,SAAS,OAAO;AAAA,MACnB;AACA,YAAM,UAAU,QAAQ;AACxB,UAAK,CAAE,SAAS,kBAAkB,CAAE,QAAQ,YAAa;AACxD,eAAO;AAAA,MACR;AACA,aAAO;AAAA,QACN,WAAW,OAAO;AAAA,QAClB,OAAO,QAAQ;AAAA,QACf,QAAQ,QAAQ;AAAA,QAChB,OAAO,QAAQ;AAAA,QACf,QAAQ,QAAQ;AAAA,MACjB;AAAA,IACD;AAAA,IACA,CAAE,IAAI,KAAK,QAAS;AAAA,EACrB;AAEA,MAAK,CAAE,WAAY;AAClB,WAAO;AAAA,EACR;AAEA,WAAS,iBAAiB;AAGzB,UAAM,MAAM,UAAU,UAAU;AAAA,MAC/B;AAAA,MACA,UAAU,UAAU,YAAa,GAAI,IAAI;AAAA,IAC1C;AAEA;AAAA,MACC;AAAA,UACA,2BAAa,cAAc;AAAA,QAC1B,OAAG,oEAAmC,UAAW;AAAA,QACjD;AAAA,QACA,KAAK,MAAM,UAAU;AAAA,QACrB,QAAQ,UAAU,SAAS,MAAM,UAAU,SAAS;AAAA,QACpD;AAAA,QACA,UAAU;AAAA,QACV,MAAM;AAAA,QACN,UAAU;AAAA,QACV,OAAO;AAAA,QACP,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAMb,OAAO,UAAU;AAAA,QACjB,QAAQ,UAAU;AAAA,MACnB,CAAE;AAAA,IACH;AAAA,EACD;AAEA,SACC,4CAAC,qCAAc,OAAM,SACpB,sDAAC,kCACA,sDAAC,mCAAc,MAAO,aAAAC,OAAY,SAAU,gBACzC,8BAAI,kBAAmB,GAC1B,GACD,GACD;AAEF;",
|
|
6
|
-
"names": ["blockEditorStore", "coreStore", "videoIcon"]
|
|
7
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// packages/block-library/src/utils/gif-conversion-attributes.js
|
|
21
|
-
var gif_conversion_attributes_exports = {};
|
|
22
|
-
__export(gif_conversion_attributes_exports, {
|
|
23
|
-
getCarriedGifConversionAttributes: () => getCarriedGifConversionAttributes
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(gif_conversion_attributes_exports);
|
|
26
|
-
function getCarriedGifConversionAttributes(attributes) {
|
|
27
|
-
const { align, anchor, className, style } = attributes;
|
|
28
|
-
const margin = style?.spacing?.margin;
|
|
29
|
-
return {
|
|
30
|
-
...align && { align },
|
|
31
|
-
...anchor && { anchor },
|
|
32
|
-
...className && { className },
|
|
33
|
-
...margin && { style: { spacing: { margin } } }
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
-
0 && (module.exports = {
|
|
38
|
-
getCarriedGifConversionAttributes
|
|
39
|
-
});
|
|
40
|
-
//# sourceMappingURL=gif-conversion-attributes.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils/gif-conversion-attributes.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Returns the subset of block attributes that should be carried over when\n * converting between the animated-GIF Image block and its converted Video\n * block (in either direction).\n *\n * The conversion swaps one block for another via `createBlock`, which would\n * otherwise drop everything the author set on the original block. This carries\n * the attributes both blocks support, so the conversion (and its reverse) keeps\n * them: block alignment, the HTML anchor, custom class names, and margin\n * spacing.\n *\n * Image-only attributes such as links (`href`/`linkDestination`), sizing\n * (`sizeSlug`/`scale`), and `border`/`shadow` styles are intentionally not\n * carried: the Video block has no equivalent, so copying them would leave\n * attributes the target block cannot represent.\n *\n * @param {Object} attributes Source block attributes.\n * @return {Object} Attributes to spread into the converted block.\n */\nexport function getCarriedGifConversionAttributes( attributes ) {\n\tconst { align, anchor, className, style } = attributes;\n\tconst margin = style?.spacing?.margin;\n\n\treturn {\n\t\t...( align && { align } ),\n\t\t...( anchor && { anchor } ),\n\t\t...( className && { className } ),\n\t\t...( margin && { style: { spacing: { margin } } } ),\n\t};\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmBO,SAAS,kCAAmC,YAAa;AAC/D,QAAM,EAAE,OAAO,QAAQ,WAAW,MAAM,IAAI;AAC5C,QAAM,SAAS,OAAO,SAAS;AAE/B,SAAO;AAAA,IACN,GAAK,SAAS,EAAE,MAAM;AAAA,IACtB,GAAK,UAAU,EAAE,OAAO;AAAA,IACxB,GAAK,aAAa,EAAE,UAAU;AAAA,IAC9B,GAAK,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;AAAA,EACjD;AACD;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// packages/block-library/src/video/gif-restore-control.js
|
|
21
|
-
var gif_restore_control_exports = {};
|
|
22
|
-
__export(gif_restore_control_exports, {
|
|
23
|
-
default: () => GifRestoreControl
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(gif_restore_control_exports);
|
|
26
|
-
var import_components = require("@wordpress/components");
|
|
27
|
-
var import_block_editor = require("@wordpress/block-editor");
|
|
28
|
-
var import_core_data = require("@wordpress/core-data");
|
|
29
|
-
var import_blocks = require("@wordpress/blocks");
|
|
30
|
-
var import_data = require("@wordpress/data");
|
|
31
|
-
var import_icons = require("@wordpress/icons");
|
|
32
|
-
var import_i18n = require("@wordpress/i18n");
|
|
33
|
-
var import_gif_conversion_attributes = require("../utils/gif-conversion-attributes.cjs");
|
|
34
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
-
function GifRestoreControl({ attributes, clientId }) {
|
|
36
|
-
const { id, caption } = attributes;
|
|
37
|
-
const { replaceBlocks } = (0, import_data.useDispatch)(import_block_editor.store);
|
|
38
|
-
const gif = (0, import_data.useSelect)(
|
|
39
|
-
(select) => {
|
|
40
|
-
if (!id) {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
const record = select(import_core_data.store).getEntityRecord(
|
|
44
|
-
"postType",
|
|
45
|
-
"attachment",
|
|
46
|
-
id,
|
|
47
|
-
{ context: "view" }
|
|
48
|
-
);
|
|
49
|
-
if (!record?.mime_type?.startsWith("image/")) {
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
return record;
|
|
53
|
-
},
|
|
54
|
-
[id]
|
|
55
|
-
);
|
|
56
|
-
if (!gif?.source_url) {
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
function restoreToImage() {
|
|
60
|
-
replaceBlocks(
|
|
61
|
-
clientId,
|
|
62
|
-
(0, import_blocks.createBlock)("core/image", {
|
|
63
|
-
...(0, import_gif_conversion_attributes.getCarriedGifConversionAttributes)(attributes),
|
|
64
|
-
id,
|
|
65
|
-
url: gif.source_url,
|
|
66
|
-
alt: gif.alt_text || "",
|
|
67
|
-
caption
|
|
68
|
-
})
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.BlockControls, { group: "other", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.ToolbarButton, { icon: import_icons.image, onClick: restoreToImage, children: (0, import_i18n.__)("Display as GIF") }) }) });
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=gif-restore-control.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/video/gif-restore-control.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { ToolbarButton, ToolbarGroup } from '@wordpress/components';\nimport {\n\tBlockControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { createBlock } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { image as imageIcon } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { getCarriedGifConversionAttributes } from '../utils/gif-conversion-attributes';\n\n/**\n * Toolbar control that turns a converted GIF video block back into the original\n * animated GIF Image block.\n *\n * An animated GIF uploaded through the editor is converted to a muted, looping\n * video and presented as the Video block's \"GIF\" variation, while the original\n * GIF stays the underlying image attachment. This control switches the block\n * back to a `core/image` pointing at that GIF and opts the image out of being\n * re-converted.\n *\n * It only renders when the block's media is an image attachment (i.e. an\n * editor-converted GIF), so it never appears on regular videos that happen to\n * be muted and looping.\n *\n * @param {Object} props Component props.\n * @param {Object} props.attributes Video block attributes.\n * @param {string} props.clientId Block client ID.\n *\n * @return {Component|null} The control, or null when restoring does not apply.\n */\nexport default function GifRestoreControl( { attributes, clientId } ) {\n\tconst { id, caption } = attributes;\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\n\t// The original GIF is the underlying image attachment. Only offer the\n\t// restore when the media resolves to an image (an editor-converted GIF),\n\t// not when a regular video has simply been set to loop/autoplay/mute.\n\tconst gif = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! id ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst record = select( coreStore ).getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'attachment',\n\t\t\t\tid,\n\t\t\t\t{ context: 'view' }\n\t\t\t);\n\t\t\tif ( ! record?.mime_type?.startsWith( 'image/' ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn record;\n\t\t},\n\t\t[ id ]\n\t);\n\n\tif ( ! gif?.source_url ) {\n\t\treturn null;\n\t}\n\n\tfunction restoreToImage() {\n\t\treplaceBlocks(\n\t\t\tclientId,\n\t\t\tcreateBlock( 'core/image', {\n\t\t\t\t...getCarriedGifConversionAttributes( attributes ),\n\t\t\t\tid,\n\t\t\t\turl: gif.source_url,\n\t\t\t\talt: gif.alt_text || '',\n\t\t\t\tcaption,\n\t\t\t} )\n\t\t);\n\t}\n\n\treturn (\n\t\t<BlockControls group=\"other\">\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton icon={ imageIcon } onClick={ restoreToImage }>\n\t\t\t\t\t{ __( 'Display as GIF' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t</ToolbarGroup>\n\t\t</BlockControls>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA4C;AAC5C,0BAGO;AACP,uBAAmC;AACnC,oBAA4B;AAC5B,kBAAuC;AACvC,mBAAmC;AACnC,kBAAmB;AAKnB,uCAAkD;AAoE9C;AA9CW,SAAR,kBAAoC,EAAE,YAAY,SAAS,GAAI;AACrE,QAAM,EAAE,IAAI,QAAQ,IAAI;AACxB,QAAM,EAAE,cAAc,QAAI,yBAAa,oBAAAA,KAAiB;AAKxD,QAAM,UAAM;AAAA,IACX,CAAE,WAAY;AACb,UAAK,CAAE,IAAK;AACX,eAAO;AAAA,MACR;AACA,YAAM,SAAS,OAAQ,iBAAAC,KAAU,EAAE;AAAA,QAClC;AAAA,QACA;AAAA,QACA;AAAA,QACA,EAAE,SAAS,OAAO;AAAA,MACnB;AACA,UAAK,CAAE,QAAQ,WAAW,WAAY,QAAS,GAAI;AAClD,eAAO;AAAA,MACR;AACA,aAAO;AAAA,IACR;AAAA,IACA,CAAE,EAAG;AAAA,EACN;AAEA,MAAK,CAAE,KAAK,YAAa;AACxB,WAAO;AAAA,EACR;AAEA,WAAS,iBAAiB;AACzB;AAAA,MACC;AAAA,UACA,2BAAa,cAAc;AAAA,QAC1B,OAAG,oEAAmC,UAAW;AAAA,QACjD;AAAA,QACA,KAAK,IAAI;AAAA,QACT,KAAK,IAAI,YAAY;AAAA,QACrB;AAAA,MACD,CAAE;AAAA,IACH;AAAA,EACD;AAEA,SACC,4CAAC,qCAAc,OAAM,SACpB,sDAAC,kCACA,sDAAC,mCAAc,MAAO,aAAAC,OAAY,SAAU,gBACzC,8BAAI,gBAAiB,GACxB,GACD,GACD;AAEF;",
|
|
6
|
-
"names": ["blockEditorStore", "coreStore", "imageIcon"]
|
|
7
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
// packages/block-library/src/image/animated-gif-convert-control.js
|
|
2
|
-
import { ToolbarButton, ToolbarGroup } from "@wordpress/components";
|
|
3
|
-
import {
|
|
4
|
-
BlockControls,
|
|
5
|
-
store as blockEditorStore
|
|
6
|
-
} from "@wordpress/block-editor";
|
|
7
|
-
import { store as coreStore } from "@wordpress/core-data";
|
|
8
|
-
import { createBlock } from "@wordpress/blocks";
|
|
9
|
-
import { useDispatch, useSelect } from "@wordpress/data";
|
|
10
|
-
import { video as videoIcon } from "@wordpress/icons";
|
|
11
|
-
import { __ } from "@wordpress/i18n";
|
|
12
|
-
import { getCarriedGifConversionAttributes } from "../utils/gif-conversion-attributes.mjs";
|
|
13
|
-
import { jsx } from "react/jsx-runtime";
|
|
14
|
-
function AnimatedGifConvertControl({ attributes, clientId }) {
|
|
15
|
-
const { id, url, caption } = attributes;
|
|
16
|
-
const { replaceBlocks } = useDispatch(blockEditorStore);
|
|
17
|
-
const companion = useSelect(
|
|
18
|
-
(select) => {
|
|
19
|
-
if (!id) {
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
const urlPath = url?.split(/[?#]/)[0];
|
|
23
|
-
if (!urlPath?.toLowerCase().endsWith(".gif")) {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
const { getBlockRootClientId, getBlockName } = select(blockEditorStore);
|
|
27
|
-
const rootClientId = getBlockRootClientId(clientId);
|
|
28
|
-
if (rootClientId && getBlockName(rootClientId) === "core/gallery") {
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
const record = select(coreStore).getEntityRecord(
|
|
32
|
-
"postType",
|
|
33
|
-
"attachment",
|
|
34
|
-
id,
|
|
35
|
-
{ context: "view" }
|
|
36
|
-
);
|
|
37
|
-
const details = record?.media_details;
|
|
38
|
-
if (!details?.animated_video || !record?.source_url) {
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
return {
|
|
42
|
-
sourceUrl: record.source_url,
|
|
43
|
-
video: details.animated_video,
|
|
44
|
-
poster: details.animated_video_poster,
|
|
45
|
-
width: details.width,
|
|
46
|
-
height: details.height
|
|
47
|
-
};
|
|
48
|
-
},
|
|
49
|
-
[id, url, clientId]
|
|
50
|
-
);
|
|
51
|
-
if (!companion) {
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
function convertToVideo() {
|
|
55
|
-
const dir = companion.sourceUrl.slice(
|
|
56
|
-
0,
|
|
57
|
-
companion.sourceUrl.lastIndexOf("/") + 1
|
|
58
|
-
);
|
|
59
|
-
replaceBlocks(
|
|
60
|
-
clientId,
|
|
61
|
-
createBlock("core/video", {
|
|
62
|
-
...getCarriedGifConversionAttributes(attributes),
|
|
63
|
-
id,
|
|
64
|
-
src: dir + companion.video,
|
|
65
|
-
poster: companion.poster ? dir + companion.poster : void 0,
|
|
66
|
-
caption,
|
|
67
|
-
controls: false,
|
|
68
|
-
loop: true,
|
|
69
|
-
autoplay: true,
|
|
70
|
-
muted: true,
|
|
71
|
-
playsInline: true,
|
|
72
|
-
// Carry the GIF's intrinsic dimensions so the <video> keeps its
|
|
73
|
-
// aspect ratio from the first paint. Without them the element
|
|
74
|
-
// collapses to the browser-default size and then jumps once the
|
|
75
|
-
// poster/metadata load, which shows up as a brief duplicated
|
|
76
|
-
// image during the swap.
|
|
77
|
-
width: companion.width,
|
|
78
|
-
height: companion.height
|
|
79
|
-
})
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
return /* @__PURE__ */ jsx(BlockControls, { group: "other", children: /* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsx(ToolbarButton, { icon: videoIcon, onClick: convertToVideo, children: __("Display as video") }) }) });
|
|
83
|
-
}
|
|
84
|
-
export {
|
|
85
|
-
AnimatedGifConvertControl as default
|
|
86
|
-
};
|
|
87
|
-
//# sourceMappingURL=animated-gif-convert-control.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/image/animated-gif-convert-control.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { ToolbarButton, ToolbarGroup } from '@wordpress/components';\nimport {\n\tBlockControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { createBlock } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { video as videoIcon } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { getCarriedGifConversionAttributes } from '../utils/gif-conversion-attributes';\n\n/**\n * Toolbar control that turns an animated GIF Image block into a converted Video\n * block once the GIF's sideloaded video companion is available.\n *\n * Mirrors the Video block's \"Display as GIF\" toolbar control. Fresh uploads\n * are swapped automatically from the image block's `onSelectImage`; this\n * control is the explicit path for image blocks that came from saved post\n * content (or that the author restored from a converted Video block via\n * \"Display as GIF\") and now want to be played as a looping video.\n *\n * @param {Object} props Component props.\n * @param {Object} props.attributes Image block attributes.\n * @param {string} props.clientId Block client ID.\n *\n * @return {Component|null} The control, or null when conversion does not apply.\n */\nexport default function AnimatedGifConvertControl( { attributes, clientId } ) {\n\tconst { id, url, caption } = attributes;\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\n\tconst companion = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! id ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\t/*\n\t\t\t * Only animated GIFs have a video companion. Gate on the `.gif`\n\t\t\t * extension so an ordinary image never triggers an attachment\n\t\t\t * REST fetch just to discover it has no companion. Strip any\n\t\t\t * query string or fragment first so a URL like `cat.gif?ver=2`\n\t\t\t * still matches.\n\t\t\t */\n\t\t\tconst urlPath = url?.split( /[?#]/ )[ 0 ];\n\t\t\tif ( ! urlPath?.toLowerCase().endsWith( '.gif' ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\t// A gallery only accepts `core/image` children, so swapping the\n\t\t\t// image for a video block there would be rejected. Hide the\n\t\t\t// control inside a gallery; the converted video is still\n\t\t\t// sideloaded and stored for use elsewhere.\n\t\t\tconst { getBlockRootClientId, getBlockName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\tif (\n\t\t\t\trootClientId &&\n\t\t\t\tgetBlockName( rootClientId ) === 'core/gallery'\n\t\t\t) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst record = select( coreStore ).getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'attachment',\n\t\t\t\tid,\n\t\t\t\t{ context: 'view' }\n\t\t\t);\n\t\t\tconst details = record?.media_details;\n\t\t\tif ( ! details?.animated_video || ! record?.source_url ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tsourceUrl: record.source_url,\n\t\t\t\tvideo: details.animated_video,\n\t\t\t\tposter: details.animated_video_poster,\n\t\t\t\twidth: details.width,\n\t\t\t\theight: details.height,\n\t\t\t};\n\t\t},\n\t\t[ id, url, clientId ]\n\t);\n\n\tif ( ! companion ) {\n\t\treturn null;\n\t}\n\n\tfunction convertToVideo() {\n\t\t// Companion files are sideloaded next to the GIF, so they share its\n\t\t// directory; build their URLs from the GIF's own source URL.\n\t\tconst dir = companion.sourceUrl.slice(\n\t\t\t0,\n\t\t\tcompanion.sourceUrl.lastIndexOf( '/' ) + 1\n\t\t);\n\n\t\treplaceBlocks(\n\t\t\tclientId,\n\t\t\tcreateBlock( 'core/video', {\n\t\t\t\t...getCarriedGifConversionAttributes( attributes ),\n\t\t\t\tid,\n\t\t\t\tsrc: dir + companion.video,\n\t\t\t\tposter: companion.poster ? dir + companion.poster : undefined,\n\t\t\t\tcaption,\n\t\t\t\tcontrols: false,\n\t\t\t\tloop: true,\n\t\t\t\tautoplay: true,\n\t\t\t\tmuted: true,\n\t\t\t\tplaysInline: true,\n\t\t\t\t// Carry the GIF's intrinsic dimensions so the <video> keeps its\n\t\t\t\t// aspect ratio from the first paint. Without them the element\n\t\t\t\t// collapses to the browser-default size and then jumps once the\n\t\t\t\t// poster/metadata load, which shows up as a brief duplicated\n\t\t\t\t// image during the swap.\n\t\t\t\twidth: companion.width,\n\t\t\t\theight: companion.height,\n\t\t\t} )\n\t\t);\n\t}\n\n\treturn (\n\t\t<BlockControls group=\"other\">\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton icon={ videoIcon } onClick={ convertToVideo }>\n\t\t\t\t\t{ __( 'Display as video' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t</ToolbarGroup>\n\t\t</BlockControls>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,eAAe,oBAAoB;AAC5C;AAAA,EACC;AAAA,EACA,SAAS;AAAA,OACH;AACP,SAAS,SAAS,iBAAiB;AACnC,SAAS,mBAAmB;AAC5B,SAAS,aAAa,iBAAiB;AACvC,SAAS,SAAS,iBAAiB;AACnC,SAAS,UAAU;AAKnB,SAAS,yCAAyC;AA+G9C;AA7FW,SAAR,0BAA4C,EAAE,YAAY,SAAS,GAAI;AAC7E,QAAM,EAAE,IAAI,KAAK,QAAQ,IAAI;AAC7B,QAAM,EAAE,cAAc,IAAI,YAAa,gBAAiB;AAExD,QAAM,YAAY;AAAA,IACjB,CAAE,WAAY;AACb,UAAK,CAAE,IAAK;AACX,eAAO;AAAA,MACR;AAQA,YAAM,UAAU,KAAK,MAAO,MAAO,EAAG,CAAE;AACxC,UAAK,CAAE,SAAS,YAAY,EAAE,SAAU,MAAO,GAAI;AAClD,eAAO;AAAA,MACR;AAKA,YAAM,EAAE,sBAAsB,aAAa,IAC1C,OAAQ,gBAAiB;AAC1B,YAAM,eAAe,qBAAsB,QAAS;AACpD,UACC,gBACA,aAAc,YAAa,MAAM,gBAChC;AACD,eAAO;AAAA,MACR;AACA,YAAM,SAAS,OAAQ,SAAU,EAAE;AAAA,QAClC;AAAA,QACA;AAAA,QACA;AAAA,QACA,EAAE,SAAS,OAAO;AAAA,MACnB;AACA,YAAM,UAAU,QAAQ;AACxB,UAAK,CAAE,SAAS,kBAAkB,CAAE,QAAQ,YAAa;AACxD,eAAO;AAAA,MACR;AACA,aAAO;AAAA,QACN,WAAW,OAAO;AAAA,QAClB,OAAO,QAAQ;AAAA,QACf,QAAQ,QAAQ;AAAA,QAChB,OAAO,QAAQ;AAAA,QACf,QAAQ,QAAQ;AAAA,MACjB;AAAA,IACD;AAAA,IACA,CAAE,IAAI,KAAK,QAAS;AAAA,EACrB;AAEA,MAAK,CAAE,WAAY;AAClB,WAAO;AAAA,EACR;AAEA,WAAS,iBAAiB;AAGzB,UAAM,MAAM,UAAU,UAAU;AAAA,MAC/B;AAAA,MACA,UAAU,UAAU,YAAa,GAAI,IAAI;AAAA,IAC1C;AAEA;AAAA,MACC;AAAA,MACA,YAAa,cAAc;AAAA,QAC1B,GAAG,kCAAmC,UAAW;AAAA,QACjD;AAAA,QACA,KAAK,MAAM,UAAU;AAAA,QACrB,QAAQ,UAAU,SAAS,MAAM,UAAU,SAAS;AAAA,QACpD;AAAA,QACA,UAAU;AAAA,QACV,MAAM;AAAA,QACN,UAAU;AAAA,QACV,OAAO;AAAA,QACP,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAMb,OAAO,UAAU;AAAA,QACjB,QAAQ,UAAU;AAAA,MACnB,CAAE;AAAA,IACH;AAAA,EACD;AAEA,SACC,oBAAC,iBAAc,OAAM,SACpB,8BAAC,gBACA,8BAAC,iBAAc,MAAO,WAAY,SAAU,gBACzC,aAAI,kBAAmB,GAC1B,GACD,GACD;AAEF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// packages/block-library/src/utils/gif-conversion-attributes.js
|
|
2
|
-
function getCarriedGifConversionAttributes(attributes) {
|
|
3
|
-
const { align, anchor, className, style } = attributes;
|
|
4
|
-
const margin = style?.spacing?.margin;
|
|
5
|
-
return {
|
|
6
|
-
...align && { align },
|
|
7
|
-
...anchor && { anchor },
|
|
8
|
-
...className && { className },
|
|
9
|
-
...margin && { style: { spacing: { margin } } }
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
export {
|
|
13
|
-
getCarriedGifConversionAttributes
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=gif-conversion-attributes.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils/gif-conversion-attributes.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Returns the subset of block attributes that should be carried over when\n * converting between the animated-GIF Image block and its converted Video\n * block (in either direction).\n *\n * The conversion swaps one block for another via `createBlock`, which would\n * otherwise drop everything the author set on the original block. This carries\n * the attributes both blocks support, so the conversion (and its reverse) keeps\n * them: block alignment, the HTML anchor, custom class names, and margin\n * spacing.\n *\n * Image-only attributes such as links (`href`/`linkDestination`), sizing\n * (`sizeSlug`/`scale`), and `border`/`shadow` styles are intentionally not\n * carried: the Video block has no equivalent, so copying them would leave\n * attributes the target block cannot represent.\n *\n * @param {Object} attributes Source block attributes.\n * @return {Object} Attributes to spread into the converted block.\n */\nexport function getCarriedGifConversionAttributes( attributes ) {\n\tconst { align, anchor, className, style } = attributes;\n\tconst margin = style?.spacing?.margin;\n\n\treturn {\n\t\t...( align && { align } ),\n\t\t...( anchor && { anchor } ),\n\t\t...( className && { className } ),\n\t\t...( margin && { style: { spacing: { margin } } } ),\n\t};\n}\n"],
|
|
5
|
-
"mappings": ";AAmBO,SAAS,kCAAmC,YAAa;AAC/D,QAAM,EAAE,OAAO,QAAQ,WAAW,MAAM,IAAI;AAC5C,QAAM,SAAS,OAAO,SAAS;AAE/B,SAAO;AAAA,IACN,GAAK,SAAS,EAAE,MAAM;AAAA,IACtB,GAAK,UAAU,EAAE,OAAO;AAAA,IACxB,GAAK,aAAa,EAAE,UAAU;AAAA,IAC9B,GAAK,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;AAAA,EACjD;AACD;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
// packages/block-library/src/video/gif-restore-control.js
|
|
2
|
-
import { ToolbarButton, ToolbarGroup } from "@wordpress/components";
|
|
3
|
-
import {
|
|
4
|
-
BlockControls,
|
|
5
|
-
store as blockEditorStore
|
|
6
|
-
} from "@wordpress/block-editor";
|
|
7
|
-
import { store as coreStore } from "@wordpress/core-data";
|
|
8
|
-
import { createBlock } from "@wordpress/blocks";
|
|
9
|
-
import { useDispatch, useSelect } from "@wordpress/data";
|
|
10
|
-
import { image as imageIcon } from "@wordpress/icons";
|
|
11
|
-
import { __ } from "@wordpress/i18n";
|
|
12
|
-
import { getCarriedGifConversionAttributes } from "../utils/gif-conversion-attributes.mjs";
|
|
13
|
-
import { jsx } from "react/jsx-runtime";
|
|
14
|
-
function GifRestoreControl({ attributes, clientId }) {
|
|
15
|
-
const { id, caption } = attributes;
|
|
16
|
-
const { replaceBlocks } = useDispatch(blockEditorStore);
|
|
17
|
-
const gif = useSelect(
|
|
18
|
-
(select) => {
|
|
19
|
-
if (!id) {
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
const record = select(coreStore).getEntityRecord(
|
|
23
|
-
"postType",
|
|
24
|
-
"attachment",
|
|
25
|
-
id,
|
|
26
|
-
{ context: "view" }
|
|
27
|
-
);
|
|
28
|
-
if (!record?.mime_type?.startsWith("image/")) {
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
return record;
|
|
32
|
-
},
|
|
33
|
-
[id]
|
|
34
|
-
);
|
|
35
|
-
if (!gif?.source_url) {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
function restoreToImage() {
|
|
39
|
-
replaceBlocks(
|
|
40
|
-
clientId,
|
|
41
|
-
createBlock("core/image", {
|
|
42
|
-
...getCarriedGifConversionAttributes(attributes),
|
|
43
|
-
id,
|
|
44
|
-
url: gif.source_url,
|
|
45
|
-
alt: gif.alt_text || "",
|
|
46
|
-
caption
|
|
47
|
-
})
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
return /* @__PURE__ */ jsx(BlockControls, { group: "other", children: /* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsx(ToolbarButton, { icon: imageIcon, onClick: restoreToImage, children: __("Display as GIF") }) }) });
|
|
51
|
-
}
|
|
52
|
-
export {
|
|
53
|
-
GifRestoreControl as default
|
|
54
|
-
};
|
|
55
|
-
//# sourceMappingURL=gif-restore-control.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/video/gif-restore-control.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { ToolbarButton, ToolbarGroup } from '@wordpress/components';\nimport {\n\tBlockControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { createBlock } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { image as imageIcon } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { getCarriedGifConversionAttributes } from '../utils/gif-conversion-attributes';\n\n/**\n * Toolbar control that turns a converted GIF video block back into the original\n * animated GIF Image block.\n *\n * An animated GIF uploaded through the editor is converted to a muted, looping\n * video and presented as the Video block's \"GIF\" variation, while the original\n * GIF stays the underlying image attachment. This control switches the block\n * back to a `core/image` pointing at that GIF and opts the image out of being\n * re-converted.\n *\n * It only renders when the block's media is an image attachment (i.e. an\n * editor-converted GIF), so it never appears on regular videos that happen to\n * be muted and looping.\n *\n * @param {Object} props Component props.\n * @param {Object} props.attributes Video block attributes.\n * @param {string} props.clientId Block client ID.\n *\n * @return {Component|null} The control, or null when restoring does not apply.\n */\nexport default function GifRestoreControl( { attributes, clientId } ) {\n\tconst { id, caption } = attributes;\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\n\t// The original GIF is the underlying image attachment. Only offer the\n\t// restore when the media resolves to an image (an editor-converted GIF),\n\t// not when a regular video has simply been set to loop/autoplay/mute.\n\tconst gif = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! id ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst record = select( coreStore ).getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'attachment',\n\t\t\t\tid,\n\t\t\t\t{ context: 'view' }\n\t\t\t);\n\t\t\tif ( ! record?.mime_type?.startsWith( 'image/' ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn record;\n\t\t},\n\t\t[ id ]\n\t);\n\n\tif ( ! gif?.source_url ) {\n\t\treturn null;\n\t}\n\n\tfunction restoreToImage() {\n\t\treplaceBlocks(\n\t\t\tclientId,\n\t\t\tcreateBlock( 'core/image', {\n\t\t\t\t...getCarriedGifConversionAttributes( attributes ),\n\t\t\t\tid,\n\t\t\t\turl: gif.source_url,\n\t\t\t\talt: gif.alt_text || '',\n\t\t\t\tcaption,\n\t\t\t} )\n\t\t);\n\t}\n\n\treturn (\n\t\t<BlockControls group=\"other\">\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton icon={ imageIcon } onClick={ restoreToImage }>\n\t\t\t\t\t{ __( 'Display as GIF' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t</ToolbarGroup>\n\t\t</BlockControls>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,eAAe,oBAAoB;AAC5C;AAAA,EACC;AAAA,EACA,SAAS;AAAA,OACH;AACP,SAAS,SAAS,iBAAiB;AACnC,SAAS,mBAAmB;AAC5B,SAAS,aAAa,iBAAiB;AACvC,SAAS,SAAS,iBAAiB;AACnC,SAAS,UAAU;AAKnB,SAAS,yCAAyC;AAoE9C;AA9CW,SAAR,kBAAoC,EAAE,YAAY,SAAS,GAAI;AACrE,QAAM,EAAE,IAAI,QAAQ,IAAI;AACxB,QAAM,EAAE,cAAc,IAAI,YAAa,gBAAiB;AAKxD,QAAM,MAAM;AAAA,IACX,CAAE,WAAY;AACb,UAAK,CAAE,IAAK;AACX,eAAO;AAAA,MACR;AACA,YAAM,SAAS,OAAQ,SAAU,EAAE;AAAA,QAClC;AAAA,QACA;AAAA,QACA;AAAA,QACA,EAAE,SAAS,OAAO;AAAA,MACnB;AACA,UAAK,CAAE,QAAQ,WAAW,WAAY,QAAS,GAAI;AAClD,eAAO;AAAA,MACR;AACA,aAAO;AAAA,IACR;AAAA,IACA,CAAE,EAAG;AAAA,EACN;AAEA,MAAK,CAAE,KAAK,YAAa;AACxB,WAAO;AAAA,EACR;AAEA,WAAS,iBAAiB;AACzB;AAAA,MACC;AAAA,MACA,YAAa,cAAc;AAAA,QAC1B,GAAG,kCAAmC,UAAW;AAAA,QACjD;AAAA,QACA,KAAK,IAAI;AAAA,QACT,KAAK,IAAI,YAAY;AAAA,QACrB;AAAA,MACD,CAAE;AAAA,IACH;AAAA,EACD;AAEA,SACC,oBAAC,iBAAc,OAAM,SACpB,8BAAC,gBACA,8BAAC,iBAAc,MAAO,WAAY,SAAU,gBACzC,aAAI,gBAAiB,GACxB,GACD,GACD;AAEF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { ToolbarButton, ToolbarGroup } from '@wordpress/components';
|
|
5
|
-
import {
|
|
6
|
-
BlockControls,
|
|
7
|
-
store as blockEditorStore,
|
|
8
|
-
} from '@wordpress/block-editor';
|
|
9
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
10
|
-
import { createBlock } from '@wordpress/blocks';
|
|
11
|
-
import { useDispatch, useSelect } from '@wordpress/data';
|
|
12
|
-
import { video as videoIcon } from '@wordpress/icons';
|
|
13
|
-
import { __ } from '@wordpress/i18n';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Internal dependencies
|
|
17
|
-
*/
|
|
18
|
-
import { getCarriedGifConversionAttributes } from '../utils/gif-conversion-attributes';
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Toolbar control that turns an animated GIF Image block into a converted Video
|
|
22
|
-
* block once the GIF's sideloaded video companion is available.
|
|
23
|
-
*
|
|
24
|
-
* Mirrors the Video block's "Display as GIF" toolbar control. Fresh uploads
|
|
25
|
-
* are swapped automatically from the image block's `onSelectImage`; this
|
|
26
|
-
* control is the explicit path for image blocks that came from saved post
|
|
27
|
-
* content (or that the author restored from a converted Video block via
|
|
28
|
-
* "Display as GIF") and now want to be played as a looping video.
|
|
29
|
-
*
|
|
30
|
-
* @param {Object} props Component props.
|
|
31
|
-
* @param {Object} props.attributes Image block attributes.
|
|
32
|
-
* @param {string} props.clientId Block client ID.
|
|
33
|
-
*
|
|
34
|
-
* @return {Component|null} The control, or null when conversion does not apply.
|
|
35
|
-
*/
|
|
36
|
-
export default function AnimatedGifConvertControl( { attributes, clientId } ) {
|
|
37
|
-
const { id, url, caption } = attributes;
|
|
38
|
-
const { replaceBlocks } = useDispatch( blockEditorStore );
|
|
39
|
-
|
|
40
|
-
const companion = useSelect(
|
|
41
|
-
( select ) => {
|
|
42
|
-
if ( ! id ) {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
/*
|
|
46
|
-
* Only animated GIFs have a video companion. Gate on the `.gif`
|
|
47
|
-
* extension so an ordinary image never triggers an attachment
|
|
48
|
-
* REST fetch just to discover it has no companion. Strip any
|
|
49
|
-
* query string or fragment first so a URL like `cat.gif?ver=2`
|
|
50
|
-
* still matches.
|
|
51
|
-
*/
|
|
52
|
-
const urlPath = url?.split( /[?#]/ )[ 0 ];
|
|
53
|
-
if ( ! urlPath?.toLowerCase().endsWith( '.gif' ) ) {
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
// A gallery only accepts `core/image` children, so swapping the
|
|
57
|
-
// image for a video block there would be rejected. Hide the
|
|
58
|
-
// control inside a gallery; the converted video is still
|
|
59
|
-
// sideloaded and stored for use elsewhere.
|
|
60
|
-
const { getBlockRootClientId, getBlockName } =
|
|
61
|
-
select( blockEditorStore );
|
|
62
|
-
const rootClientId = getBlockRootClientId( clientId );
|
|
63
|
-
if (
|
|
64
|
-
rootClientId &&
|
|
65
|
-
getBlockName( rootClientId ) === 'core/gallery'
|
|
66
|
-
) {
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
const record = select( coreStore ).getEntityRecord(
|
|
70
|
-
'postType',
|
|
71
|
-
'attachment',
|
|
72
|
-
id,
|
|
73
|
-
{ context: 'view' }
|
|
74
|
-
);
|
|
75
|
-
const details = record?.media_details;
|
|
76
|
-
if ( ! details?.animated_video || ! record?.source_url ) {
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
return {
|
|
80
|
-
sourceUrl: record.source_url,
|
|
81
|
-
video: details.animated_video,
|
|
82
|
-
poster: details.animated_video_poster,
|
|
83
|
-
width: details.width,
|
|
84
|
-
height: details.height,
|
|
85
|
-
};
|
|
86
|
-
},
|
|
87
|
-
[ id, url, clientId ]
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
if ( ! companion ) {
|
|
91
|
-
return null;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function convertToVideo() {
|
|
95
|
-
// Companion files are sideloaded next to the GIF, so they share its
|
|
96
|
-
// directory; build their URLs from the GIF's own source URL.
|
|
97
|
-
const dir = companion.sourceUrl.slice(
|
|
98
|
-
0,
|
|
99
|
-
companion.sourceUrl.lastIndexOf( '/' ) + 1
|
|
100
|
-
);
|
|
101
|
-
|
|
102
|
-
replaceBlocks(
|
|
103
|
-
clientId,
|
|
104
|
-
createBlock( 'core/video', {
|
|
105
|
-
...getCarriedGifConversionAttributes( attributes ),
|
|
106
|
-
id,
|
|
107
|
-
src: dir + companion.video,
|
|
108
|
-
poster: companion.poster ? dir + companion.poster : undefined,
|
|
109
|
-
caption,
|
|
110
|
-
controls: false,
|
|
111
|
-
loop: true,
|
|
112
|
-
autoplay: true,
|
|
113
|
-
muted: true,
|
|
114
|
-
playsInline: true,
|
|
115
|
-
// Carry the GIF's intrinsic dimensions so the <video> keeps its
|
|
116
|
-
// aspect ratio from the first paint. Without them the element
|
|
117
|
-
// collapses to the browser-default size and then jumps once the
|
|
118
|
-
// poster/metadata load, which shows up as a brief duplicated
|
|
119
|
-
// image during the swap.
|
|
120
|
-
width: companion.width,
|
|
121
|
-
height: companion.height,
|
|
122
|
-
} )
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return (
|
|
127
|
-
<BlockControls group="other">
|
|
128
|
-
<ToolbarGroup>
|
|
129
|
-
<ToolbarButton icon={ videoIcon } onClick={ convertToVideo }>
|
|
130
|
-
{ __( 'Display as video' ) }
|
|
131
|
-
</ToolbarButton>
|
|
132
|
-
</ToolbarGroup>
|
|
133
|
-
</BlockControls>
|
|
134
|
-
);
|
|
135
|
-
}
|