@wordpress/block-library 11.0.2-next.v.202609171837.0 → 11.1.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 +12 -1
- package/build/accordion/block.json +4 -1
- package/build/accordion-item/block.json +7 -1
- package/build/accordion-panel/block.json +9 -1
- package/build/archives/block.json +9 -0
- package/build/audio/block.json +8 -0
- package/build/breadcrumbs/block.json +3 -0
- package/build/breadcrumbs/edit.cjs.map +3 -3
- package/build/buttons/block.json +9 -0
- package/build/categories/block.json +12 -1
- package/build/code/block.json +9 -0
- package/build/column/block.json +9 -0
- package/build/columns/block.json +9 -0
- package/build/comment-author-name/block.json +3 -0
- package/build/comment-content/block.json +5 -0
- package/build/comment-date/block.json +3 -0
- package/build/comment-edit-link/block.json +3 -0
- package/build/comment-reply-link/block.json +3 -0
- package/build/comments/block.json +10 -0
- package/build/comments-pagination/block.json +3 -0
- package/build/comments-pagination-next/block.json +3 -0
- package/build/comments-pagination-numbers/block.json +3 -0
- package/build/comments-pagination-previous/block.json +6 -0
- package/build/comments-title/block.json +3 -0
- package/build/cover/edit/index.cjs +4 -1
- package/build/cover/edit/index.cjs.map +2 -2
- package/build/cover/edit/inspector-controls.cjs +52 -13
- package/build/cover/edit/inspector-controls.cjs.map +2 -2
- package/build/details/block.json +11 -0
- package/build/file/block.json +9 -0
- package/build/footnotes/block.json +9 -0
- package/build/gallery/block.json +9 -0
- package/build/gallery/edit.cjs +1 -2
- package/build/gallery/edit.cjs.map +2 -2
- package/build/group/block.json +1 -0
- package/build/heading/block.json +9 -0
- package/build/home-link/block.json +18 -0
- package/build/home-link/edit.cjs.map +3 -3
- package/build/image/image.cjs +10 -8
- package/build/image/image.cjs.map +3 -3
- package/build/image/use-open-image-media-editor-modal.cjs +20 -0
- package/build/image/use-open-image-media-editor-modal.cjs.map +2 -2
- package/build/latest-comments/block.json +10 -0
- package/build/latest-posts/block.json +10 -0
- package/build/loginout/block.json +10 -0
- package/build/math/block.json +10 -0
- package/build/media-text/block.json +1 -0
- package/build/navigation/edit/index.cjs +1 -4
- package/build/navigation/edit/index.cjs.map +2 -2
- package/build/navigation-link/link-ui/page-creator.cjs.map +3 -3
- package/build/navigation-link/shared/controls.cjs.map +3 -3
- package/build/navigation-link/shared/use-link-preview.cjs +13 -13
- package/build/navigation-link/shared/use-link-preview.cjs.map +2 -2
- package/build/navigation-overlay-close/block.json +7 -0
- package/build/navigation-submenu/block.json +6 -0
- package/build/navigation-submenu/edit.cjs +9 -1
- package/build/navigation-submenu/edit.cjs.map +3 -3
- package/build/page-list/block.json +10 -0
- package/build/paragraph/edit.cjs +1 -2
- package/build/paragraph/edit.cjs.map +2 -2
- package/build/playlist/block.json +1 -0
- package/build/post-author-biography/block.json +4 -0
- package/build/post-author-name/block.json +5 -0
- package/build/post-comments-count/block.json +3 -0
- package/build/post-comments-form/block.json +10 -0
- package/build/post-content/block.json +2 -0
- package/build/post-date/block.json +3 -0
- package/build/post-excerpt/block.json +5 -0
- package/build/post-featured-image/edit.cjs +11 -9
- package/build/post-featured-image/edit.cjs.map +2 -2
- package/build/post-navigation-link/block.json +30 -0
- package/build/post-navigation-link/edit.cjs +13 -2
- package/build/post-navigation-link/edit.cjs.map +3 -3
- package/build/post-template/block.json +13 -1
- package/build/post-terms/block.json +6 -0
- package/build/post-time-to-read/block.json +6 -0
- package/build/post-title/block.json +10 -0
- package/build/preformatted/block.json +7 -0
- package/build/pullquote/block.json +1 -0
- package/build/query-no-results/block.json +10 -2
- package/build/query-pagination/block.json +3 -0
- package/build/query-pagination-next/block.json +3 -0
- package/build/query-pagination-numbers/block.json +3 -0
- package/build/query-pagination-previous/block.json +3 -0
- package/build/query-title/block.json +3 -0
- package/build/query-total/block.json +6 -0
- package/build/quote/block.json +1 -0
- package/build/read-more/block.json +6 -0
- package/build/rss/block.json +6 -0
- package/build/site-tagline/block.json +8 -1
- package/build/site-title/block.json +7 -1
- package/build/social-links/block.json +3 -0
- package/build/social-links/edit.cjs +2 -3
- package/build/social-links/edit.cjs.map +2 -2
- package/build/tab-panel/block.json +25 -0
- package/build/tab-panel/controls.cjs.map +3 -3
- package/build/tab-panels/block.json +18 -1
- package/build/table-of-contents/block.json +7 -0
- package/build/tabs/block.json +24 -1
- package/build/tag-cloud/block.json +19 -0
- package/build/template-part/edit/selection-modal.cjs.map +1 -1
- package/build/term-count/block.json +7 -0
- package/build/term-description/block.json +9 -0
- package/build/term-name/block.json +10 -0
- package/build/term-template/block.json +10 -1
- package/build/utils/search-patterns.cjs +7 -43
- package/build/utils/search-patterns.cjs.map +3 -3
- package/build/utils/style-state.cjs +4 -6
- package/build/utils/style-state.cjs.map +2 -2
- package/build/video/block.json +6 -0
- package/build/video/edit.cjs +23 -15
- package/build/video/edit.cjs.map +3 -3
- package/build/video/index.cjs +0 -2
- package/build/video/index.cjs.map +3 -3
- package/build/video/save.cjs +5 -1
- package/build/video/save.cjs.map +3 -3
- package/build-module/accordion/block.json +4 -1
- package/build-module/accordion-item/block.json +7 -1
- package/build-module/accordion-panel/block.json +9 -1
- package/build-module/archives/block.json +9 -0
- package/build-module/audio/block.json +8 -0
- package/build-module/breadcrumbs/block.json +3 -0
- package/build-module/breadcrumbs/edit.mjs +3 -3
- package/build-module/breadcrumbs/edit.mjs.map +2 -2
- package/build-module/buttons/block.json +9 -0
- package/build-module/categories/block.json +12 -1
- package/build-module/code/block.json +9 -0
- package/build-module/column/block.json +9 -0
- package/build-module/columns/block.json +9 -0
- package/build-module/comment-author-name/block.json +3 -0
- package/build-module/comment-content/block.json +5 -0
- package/build-module/comment-date/block.json +3 -0
- package/build-module/comment-edit-link/block.json +3 -0
- package/build-module/comment-reply-link/block.json +3 -0
- package/build-module/comments/block.json +10 -0
- package/build-module/comments-pagination/block.json +3 -0
- package/build-module/comments-pagination-next/block.json +3 -0
- package/build-module/comments-pagination-numbers/block.json +3 -0
- package/build-module/comments-pagination-previous/block.json +6 -0
- package/build-module/comments-title/block.json +3 -0
- package/build-module/cover/edit/index.mjs +4 -1
- package/build-module/cover/edit/index.mjs.map +2 -2
- package/build-module/cover/edit/inspector-controls.mjs +57 -14
- package/build-module/cover/edit/inspector-controls.mjs.map +2 -2
- package/build-module/details/block.json +11 -0
- package/build-module/file/block.json +9 -0
- package/build-module/footnotes/block.json +9 -0
- package/build-module/gallery/block.json +9 -0
- package/build-module/gallery/edit.mjs +1 -2
- package/build-module/gallery/edit.mjs.map +2 -2
- package/build-module/group/block.json +1 -0
- package/build-module/heading/block.json +9 -0
- package/build-module/home-link/block.json +18 -0
- package/build-module/home-link/edit.mjs +2 -2
- package/build-module/home-link/edit.mjs.map +2 -2
- package/build-module/image/image.mjs +12 -10
- package/build-module/image/image.mjs.map +2 -2
- package/build-module/image/use-open-image-media-editor-modal.mjs +20 -0
- package/build-module/image/use-open-image-media-editor-modal.mjs.map +2 -2
- package/build-module/latest-comments/block.json +10 -0
- package/build-module/latest-posts/block.json +10 -0
- package/build-module/loginout/block.json +10 -0
- package/build-module/math/block.json +10 -0
- package/build-module/media-text/block.json +1 -0
- package/build-module/navigation/edit/index.mjs +1 -4
- package/build-module/navigation/edit/index.mjs.map +2 -2
- package/build-module/navigation-link/link-ui/page-creator.mjs +2 -2
- package/build-module/navigation-link/link-ui/page-creator.mjs.map +2 -2
- package/build-module/navigation-link/shared/controls.mjs +2 -2
- package/build-module/navigation-link/shared/controls.mjs.map +2 -2
- package/build-module/navigation-link/shared/use-link-preview.mjs +13 -13
- package/build-module/navigation-link/shared/use-link-preview.mjs.map +2 -2
- package/build-module/navigation-overlay-close/block.json +7 -0
- package/build-module/navigation-submenu/block.json +6 -0
- package/build-module/navigation-submenu/edit.mjs +11 -2
- package/build-module/navigation-submenu/edit.mjs.map +2 -2
- package/build-module/page-list/block.json +10 -0
- package/build-module/paragraph/edit.mjs +1 -2
- package/build-module/paragraph/edit.mjs.map +2 -2
- package/build-module/playlist/block.json +1 -0
- package/build-module/post-author-biography/block.json +4 -0
- package/build-module/post-author-name/block.json +5 -0
- package/build-module/post-comments-count/block.json +3 -0
- package/build-module/post-comments-form/block.json +10 -0
- package/build-module/post-content/block.json +2 -0
- package/build-module/post-date/block.json +3 -0
- package/build-module/post-excerpt/block.json +5 -0
- package/build-module/post-featured-image/edit.mjs +11 -9
- package/build-module/post-featured-image/edit.mjs.map +2 -2
- package/build-module/post-navigation-link/block.json +30 -0
- package/build-module/post-navigation-link/edit.mjs +17 -3
- package/build-module/post-navigation-link/edit.mjs.map +2 -2
- package/build-module/post-template/block.json +13 -1
- package/build-module/post-terms/block.json +6 -0
- package/build-module/post-time-to-read/block.json +6 -0
- package/build-module/post-title/block.json +10 -0
- package/build-module/preformatted/block.json +7 -0
- package/build-module/pullquote/block.json +1 -0
- package/build-module/query-no-results/block.json +10 -2
- package/build-module/query-pagination/block.json +3 -0
- package/build-module/query-pagination-next/block.json +3 -0
- package/build-module/query-pagination-numbers/block.json +3 -0
- package/build-module/query-pagination-previous/block.json +3 -0
- package/build-module/query-title/block.json +3 -0
- package/build-module/query-total/block.json +6 -0
- package/build-module/quote/block.json +1 -0
- package/build-module/read-more/block.json +6 -0
- package/build-module/rss/block.json +6 -0
- package/build-module/site-tagline/block.json +8 -1
- package/build-module/site-title/block.json +7 -1
- package/build-module/social-links/block.json +3 -0
- package/build-module/social-links/edit.mjs +2 -3
- package/build-module/social-links/edit.mjs.map +2 -2
- package/build-module/tab-panel/block.json +25 -0
- package/build-module/tab-panel/controls.mjs +2 -2
- package/build-module/tab-panel/controls.mjs.map +2 -2
- package/build-module/tab-panels/block.json +18 -1
- package/build-module/table-of-contents/block.json +7 -0
- package/build-module/tabs/block.json +24 -1
- package/build-module/tag-cloud/block.json +19 -0
- package/build-module/template-part/edit/selection-modal.mjs.map +1 -1
- package/build-module/term-count/block.json +7 -0
- package/build-module/term-description/block.json +9 -0
- package/build-module/term-name/block.json +10 -0
- package/build-module/term-template/block.json +10 -1
- package/build-module/utils/search-patterns.mjs +7 -32
- package/build-module/utils/search-patterns.mjs.map +2 -2
- package/build-module/utils/style-state.mjs +6 -4
- package/build-module/utils/style-state.mjs.map +2 -2
- package/build-module/video/block.json +6 -0
- package/build-module/video/edit.mjs +25 -16
- package/build-module/video/edit.mjs.map +2 -2
- package/build-module/video/index.mjs +0 -2
- package/build-module/video/index.mjs.map +2 -2
- package/build-module/video/save.mjs +7 -2
- package/build-module/video/save.mjs.map +2 -2
- package/build-style/editor-rtl.css +12 -2
- package/build-style/editor.css +12 -2
- package/build-style/image/editor-rtl.css +6 -0
- package/build-style/image/editor.css +6 -0
- package/build-style/navigation/style-rtl.css +18 -3
- package/build-style/navigation/style.css +18 -3
- package/build-style/navigation-link/editor-rtl.css +3 -1
- package/build-style/navigation-link/editor.css +3 -1
- package/build-style/navigation-overlay-close/style-rtl.css +1 -1
- package/build-style/navigation-overlay-close/style.css +1 -1
- package/build-style/navigation-submenu/editor-rtl.css +3 -1
- package/build-style/navigation-submenu/editor.css +3 -1
- package/build-style/post-navigation-link/style-rtl.css +3 -0
- package/build-style/post-navigation-link/style.css +3 -0
- package/build-style/style-rtl.css +24 -4
- package/build-style/style.css +24 -4
- package/build-style/tab-panel/style-rtl.css +2 -0
- package/build-style/tab-panel/style.css +2 -0
- package/package.json +41 -42
- package/src/accordion/README.md +3 -0
- package/src/accordion/block.json +4 -1
- package/src/accordion-item/README.md +5 -0
- package/src/accordion-item/block.json +7 -1
- package/src/accordion-panel/README.md +7 -0
- package/src/accordion-panel/block.json +9 -1
- package/src/archives/README.md +4 -0
- package/src/archives/block.json +9 -0
- package/src/audio/README.md +4 -0
- package/src/audio/block.json +8 -0
- package/src/breadcrumbs/README.md +2 -0
- package/src/breadcrumbs/block.json +3 -0
- package/src/breadcrumbs/edit.jsx +3 -3
- package/src/breadcrumbs/index.php +1 -1
- package/src/buttons/README.md +4 -0
- package/src/buttons/block.json +9 -0
- package/src/categories/README.md +6 -0
- package/src/categories/block.json +12 -1
- package/src/code/README.md +4 -0
- package/src/code/block.json +9 -0
- package/src/column/README.md +4 -0
- package/src/column/block.json +9 -0
- package/src/columns/README.md +4 -0
- package/src/columns/block.json +9 -0
- package/src/comment-author-name/README.md +2 -0
- package/src/comment-author-name/block.json +3 -0
- package/src/comment-content/README.md +4 -0
- package/src/comment-content/block.json +5 -0
- package/src/comment-date/README.md +2 -0
- package/src/comment-date/block.json +3 -0
- package/src/comment-edit-link/README.md +2 -0
- package/src/comment-edit-link/block.json +3 -0
- package/src/comment-reply-link/README.md +2 -0
- package/src/comment-reply-link/block.json +3 -0
- package/src/comments/README.md +5 -0
- package/src/comments/block.json +10 -0
- package/src/comments-pagination/README.md +2 -0
- package/src/comments-pagination/block.json +3 -0
- package/src/comments-pagination-next/README.md +2 -0
- package/src/comments-pagination-next/block.json +3 -0
- package/src/comments-pagination-numbers/README.md +2 -0
- package/src/comments-pagination-numbers/block.json +3 -0
- package/src/comments-pagination-previous/README.md +2 -0
- package/src/comments-pagination-previous/block.json +6 -0
- package/src/comments-title/README.md +2 -0
- package/src/comments-title/block.json +3 -0
- package/src/cover/edit/index.jsx +3 -0
- package/src/cover/edit/inspector-controls.jsx +64 -13
- package/src/cover/test/edit.browser.test.js +18 -2
- package/src/details/README.md +6 -0
- package/src/details/block.json +11 -0
- package/src/file/README.md +4 -0
- package/src/file/block.json +9 -0
- package/src/footnotes/README.md +4 -0
- package/src/footnotes/block.json +9 -0
- package/src/gallery/README.md +4 -0
- package/src/gallery/block.json +9 -0
- package/src/gallery/edit.jsx +1 -2
- package/src/group/README.md +1 -0
- package/src/group/block.json +1 -0
- package/src/heading/README.md +4 -0
- package/src/heading/block.json +9 -0
- package/src/home-link/README.md +5 -0
- package/src/home-link/block.json +18 -0
- package/src/home-link/edit.jsx +2 -2
- package/src/icon/index.php +9 -0
- package/src/image/editor.scss +8 -0
- package/src/image/image.jsx +13 -11
- package/src/image/test/use-open-image-media-editor-modal.jsdom.test.js +139 -0
- package/src/image/use-open-image-media-editor-modal.js +37 -0
- package/src/latest-comments/README.md +5 -0
- package/src/latest-comments/block.json +10 -0
- package/src/latest-posts/README.md +5 -0
- package/src/latest-posts/block.json +10 -0
- package/src/loginout/README.md +5 -0
- package/src/loginout/block.json +10 -0
- package/src/math/README.md +5 -0
- package/src/math/block.json +10 -0
- package/src/media-text/README.md +1 -0
- package/src/media-text/block.json +1 -0
- package/src/navigation/edit/index.jsx +2 -4
- package/src/navigation/style.scss +40 -4
- package/src/navigation-link/editor.scss +6 -1
- package/src/navigation-link/link-ui/page-creator.jsx +2 -2
- package/src/navigation-link/shared/controls.jsx +2 -2
- package/src/navigation-link/shared/test/use-link-preview.jsdom.test.js +22 -22
- package/src/navigation-link/shared/use-link-preview.js +15 -14
- package/src/navigation-overlay-close/README.md +1 -0
- package/src/navigation-overlay-close/block.json +7 -0
- package/src/navigation-overlay-close/style.scss +1 -1
- package/src/navigation-submenu/README.md +7 -0
- package/src/navigation-submenu/block.json +6 -0
- package/src/navigation-submenu/edit.jsx +11 -1
- package/src/navigation-submenu/editor.scss +6 -1
- package/src/navigation-submenu/index.php +11 -0
- package/src/page-list/README.md +5 -0
- package/src/page-list/block.json +10 -0
- package/src/paragraph/edit.jsx +1 -3
- package/src/playlist/README.md +1 -0
- package/src/playlist/block.json +1 -0
- package/src/post-author-biography/README.md +3 -0
- package/src/post-author-biography/block.json +4 -0
- package/src/post-author-name/README.md +4 -0
- package/src/post-author-name/block.json +5 -0
- package/src/post-comments-count/README.md +2 -0
- package/src/post-comments-count/block.json +3 -0
- package/src/post-comments-form/README.md +5 -0
- package/src/post-comments-form/block.json +10 -0
- package/src/post-content/README.md +2 -0
- package/src/post-content/block.json +2 -0
- package/src/post-date/README.md +2 -0
- package/src/post-date/block.json +3 -0
- package/src/post-excerpt/README.md +4 -0
- package/src/post-excerpt/block.json +5 -0
- package/src/post-featured-image/edit.jsx +11 -9
- package/src/post-navigation-link/README.md +12 -0
- package/src/post-navigation-link/block.json +30 -0
- package/src/post-navigation-link/edit.jsx +23 -2
- package/src/post-navigation-link/index.php +94 -5
- package/src/post-navigation-link/style.scss +2 -0
- package/src/post-template/README.md +7 -0
- package/src/post-template/block.json +13 -1
- package/src/post-terms/README.md +5 -0
- package/src/post-terms/block.json +6 -0
- package/src/post-time-to-read/README.md +5 -0
- package/src/post-time-to-read/block.json +6 -0
- package/src/post-title/README.md +5 -0
- package/src/post-title/block.json +10 -0
- package/src/preformatted/README.md +6 -0
- package/src/preformatted/block.json +7 -0
- package/src/pullquote/README.md +1 -0
- package/src/pullquote/block.json +1 -0
- package/src/query-no-results/README.md +7 -0
- package/src/query-no-results/block.json +10 -2
- package/src/query-pagination/README.md +2 -0
- package/src/query-pagination/block.json +3 -0
- package/src/query-pagination-next/README.md +2 -0
- package/src/query-pagination-next/block.json +3 -0
- package/src/query-pagination-numbers/README.md +2 -0
- package/src/query-pagination-numbers/block.json +3 -0
- package/src/query-pagination-previous/README.md +2 -0
- package/src/query-pagination-previous/block.json +3 -0
- package/src/query-title/README.md +2 -0
- package/src/query-title/block.json +3 -0
- package/src/query-total/README.md +5 -0
- package/src/query-total/block.json +6 -0
- package/src/quote/README.md +1 -0
- package/src/quote/block.json +1 -0
- package/src/read-more/README.md +5 -0
- package/src/read-more/block.json +6 -0
- package/src/rss/README.md +5 -0
- package/src/rss/block.json +6 -0
- package/src/site-tagline/README.md +6 -0
- package/src/site-tagline/block.json +8 -1
- package/src/site-title/README.md +5 -0
- package/src/site-title/block.json +7 -1
- package/src/social-links/README.md +2 -0
- package/src/social-links/block.json +3 -0
- package/src/social-links/edit.jsx +2 -3
- package/src/tab-panel/README.md +9 -0
- package/src/tab-panel/block.json +25 -0
- package/src/tab-panel/controls.jsx +2 -2
- package/src/tab-panel/style.scss +5 -2
- package/src/tab-panels/README.md +7 -0
- package/src/tab-panels/block.json +18 -1
- package/src/table-of-contents/README.md +6 -0
- package/src/table-of-contents/block.json +7 -0
- package/src/tabs/README.md +9 -0
- package/src/tabs/block.json +24 -1
- package/src/tag-cloud/README.md +9 -0
- package/src/tag-cloud/block.json +19 -0
- package/src/template-part/edit/selection-modal.jsx +1 -1
- package/src/term-count/README.md +6 -0
- package/src/term-count/block.json +7 -0
- package/src/term-description/README.md +5 -0
- package/src/term-description/block.json +9 -0
- package/src/term-name/README.md +5 -0
- package/src/term-name/block.json +10 -0
- package/src/term-name/index.php +1 -1
- package/src/term-template/README.md +5 -0
- package/src/term-template/block.json +10 -1
- package/src/utils/search-patterns.js +9 -53
- package/src/utils/style-state.js +6 -4
- package/src/utils/test/{search-patterns.js → search-patterns.jsdom.test.js} +1 -22
- package/src/video/README.md +7 -0
- package/src/video/block.json +6 -0
- package/src/video/edit.jsx +56 -51
- package/src/video/index.js +0 -2
- package/src/video/save.jsx +10 -1
- package/build/video/variations.cjs +0 -75
- package/build/video/variations.cjs.map +0 -7
- package/build-module/video/variations.mjs +0 -50
- package/build-module/video/variations.mjs.map +0 -7
- package/src/video/test/variations.js +0 -63
- package/src/video/variations.js +0 -62
package/src/tag-cloud/README.md
CHANGED
|
@@ -25,8 +25,17 @@ _Defined via the [`attributes`](https://developer.wordpress.org/block-editor/ref
|
|
|
25
25
|
_Defined via the [`supports`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/) property in block.json._
|
|
26
26
|
|
|
27
27
|
- [`anchor`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#anchor): `true`
|
|
28
|
+
- [`background`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#background):
|
|
29
|
+
- `backgroundImage`: `true`
|
|
30
|
+
- `backgroundSize`: `true`
|
|
31
|
+
- `gradient`: `true`
|
|
28
32
|
- [`html`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#html): `false`
|
|
29
33
|
- [`align`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#align): `true`
|
|
34
|
+
- [`color`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color):
|
|
35
|
+
- [`background`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-background): `true`
|
|
36
|
+
- [`link`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-link): `true`
|
|
37
|
+
- [`text`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-text): `false`
|
|
38
|
+
- [`shadow`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#shadow): `true`
|
|
30
39
|
- [`spacing`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#spacing):
|
|
31
40
|
- `margin`: `true`
|
|
32
41
|
- `padding`: `true`
|
package/src/tag-cloud/block.json
CHANGED
|
@@ -36,8 +36,27 @@
|
|
|
36
36
|
],
|
|
37
37
|
"supports": {
|
|
38
38
|
"anchor": true,
|
|
39
|
+
"background": {
|
|
40
|
+
"backgroundImage": true,
|
|
41
|
+
"backgroundSize": true,
|
|
42
|
+
"gradient": true,
|
|
43
|
+
"__experimentalDefaultControls": {
|
|
44
|
+
"backgroundImage": true,
|
|
45
|
+
"gradient": true
|
|
46
|
+
}
|
|
47
|
+
},
|
|
39
48
|
"html": false,
|
|
40
49
|
"align": true,
|
|
50
|
+
"color": {
|
|
51
|
+
"background": true,
|
|
52
|
+
"link": true,
|
|
53
|
+
"text": false,
|
|
54
|
+
"__experimentalDefaultControls": {
|
|
55
|
+
"background": true,
|
|
56
|
+
"link": true
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"shadow": true,
|
|
41
60
|
"spacing": {
|
|
42
61
|
"margin": true,
|
|
43
62
|
"padding": true
|
|
@@ -27,7 +27,7 @@ export default function TemplatePartSelectionModal( {
|
|
|
27
27
|
templatePartId
|
|
28
28
|
);
|
|
29
29
|
|
|
30
|
-
// We can map template parts to block
|
|
30
|
+
// We can map template parts to block patterns to reuse the BlockPatternsList UI
|
|
31
31
|
const filteredTemplateParts = useMemo( () => {
|
|
32
32
|
const partsAsPatterns = templateParts.map( ( templatePart ) =>
|
|
33
33
|
mapTemplatePartToBlockPattern( templatePart )
|
package/src/term-count/README.md
CHANGED
|
@@ -22,13 +22,19 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
22
22
|
|
|
23
23
|
- [`anchor`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#anchor): `true`
|
|
24
24
|
- [`html`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#html): `false`
|
|
25
|
+
- [`background`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#background):
|
|
26
|
+
- `backgroundImage`: `true`
|
|
27
|
+
- `backgroundSize`: `true`
|
|
28
|
+
- `gradient`: `true`
|
|
25
29
|
- [`color`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color):
|
|
26
30
|
- [`gradients`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-gradients): `true`
|
|
31
|
+
- [`shadow`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#shadow): `true`
|
|
27
32
|
- [`spacing`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#spacing):
|
|
28
33
|
- `padding`: `true`
|
|
29
34
|
- [`typography`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography):
|
|
30
35
|
- [`fontSize`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-fontsize): `true`
|
|
31
36
|
- [`lineHeight`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-lineheight): `true`
|
|
37
|
+
- [`textAlign`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-textalign): `true`
|
|
32
38
|
- [`interactivity`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#interactivity):
|
|
33
39
|
- `clientNavigation`: `true`
|
|
34
40
|
|
|
@@ -17,6 +17,11 @@
|
|
|
17
17
|
"supports": {
|
|
18
18
|
"anchor": true,
|
|
19
19
|
"html": false,
|
|
20
|
+
"background": {
|
|
21
|
+
"backgroundImage": true,
|
|
22
|
+
"backgroundSize": true,
|
|
23
|
+
"gradient": true
|
|
24
|
+
},
|
|
20
25
|
"color": {
|
|
21
26
|
"gradients": true,
|
|
22
27
|
"__experimentalDefaultControls": {
|
|
@@ -24,12 +29,14 @@
|
|
|
24
29
|
"text": true
|
|
25
30
|
}
|
|
26
31
|
},
|
|
32
|
+
"shadow": true,
|
|
27
33
|
"spacing": {
|
|
28
34
|
"padding": true
|
|
29
35
|
},
|
|
30
36
|
"typography": {
|
|
31
37
|
"fontSize": true,
|
|
32
38
|
"lineHeight": true,
|
|
39
|
+
"textAlign": true,
|
|
33
40
|
"__experimentalFontFamily": true,
|
|
34
41
|
"__experimentalFontWeight": true,
|
|
35
42
|
"__experimentalFontStyle": true,
|
|
@@ -21,6 +21,10 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
21
21
|
- [`anchor`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#anchor): `true`
|
|
22
22
|
- [`align`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#align): `"wide"`, `"full"`
|
|
23
23
|
- [`html`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#html): `false`
|
|
24
|
+
- [`background`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#background):
|
|
25
|
+
- `backgroundImage`: `true`
|
|
26
|
+
- `backgroundSize`: `true`
|
|
27
|
+
- `gradient`: `true`
|
|
24
28
|
- [`color`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color):
|
|
25
29
|
- [`link`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-link): `true`
|
|
26
30
|
- [`spacing`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#spacing):
|
|
@@ -32,6 +36,7 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
32
36
|
- [`textAlign`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-textalign): `true`
|
|
33
37
|
- [`interactivity`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#interactivity):
|
|
34
38
|
- `clientNavigation`: `true`
|
|
39
|
+
- [`shadow`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#shadow): `true`
|
|
35
40
|
|
|
36
41
|
## Context
|
|
37
42
|
|
|
@@ -11,6 +11,14 @@
|
|
|
11
11
|
"anchor": true,
|
|
12
12
|
"align": [ "wide", "full" ],
|
|
13
13
|
"html": false,
|
|
14
|
+
"background": {
|
|
15
|
+
"backgroundImage": true,
|
|
16
|
+
"backgroundSize": true,
|
|
17
|
+
"gradient": true,
|
|
18
|
+
"__experimentalDefaultControls": {
|
|
19
|
+
"backgroundImage": true
|
|
20
|
+
}
|
|
21
|
+
},
|
|
14
22
|
"color": {
|
|
15
23
|
"link": true,
|
|
16
24
|
"__experimentalDefaultControls": {
|
|
@@ -39,6 +47,7 @@
|
|
|
39
47
|
"interactivity": {
|
|
40
48
|
"clientNavigation": true
|
|
41
49
|
},
|
|
50
|
+
"shadow": true,
|
|
42
51
|
"__experimentalBorder": {
|
|
43
52
|
"radius": true,
|
|
44
53
|
"color": true,
|
package/src/term-name/README.md
CHANGED
|
@@ -26,9 +26,14 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
26
26
|
- [`anchor`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#anchor): `true`
|
|
27
27
|
- [`align`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#align): `"wide"`, `"full"`
|
|
28
28
|
- [`html`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#html): `false`
|
|
29
|
+
- [`background`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#background):
|
|
30
|
+
- `backgroundImage`: `true`
|
|
31
|
+
- `backgroundSize`: `true`
|
|
32
|
+
- `gradient`: `true`
|
|
29
33
|
- [`color`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color):
|
|
30
34
|
- [`gradients`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-gradients): `true`
|
|
31
35
|
- [`link`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-link): `true`
|
|
36
|
+
- [`shadow`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#shadow): `true`
|
|
32
37
|
- [`spacing`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#spacing):
|
|
33
38
|
- `padding`: `true`
|
|
34
39
|
- [`typography`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography):
|
package/src/term-name/block.json
CHANGED
|
@@ -25,6 +25,15 @@
|
|
|
25
25
|
"anchor": true,
|
|
26
26
|
"align": [ "wide", "full" ],
|
|
27
27
|
"html": false,
|
|
28
|
+
"background": {
|
|
29
|
+
"backgroundImage": true,
|
|
30
|
+
"backgroundSize": true,
|
|
31
|
+
"gradient": true,
|
|
32
|
+
"__experimentalDefaultControls": {
|
|
33
|
+
"backgroundImage": true,
|
|
34
|
+
"gradient": true
|
|
35
|
+
}
|
|
36
|
+
},
|
|
28
37
|
"color": {
|
|
29
38
|
"gradients": true,
|
|
30
39
|
"link": true,
|
|
@@ -34,6 +43,7 @@
|
|
|
34
43
|
"link": true
|
|
35
44
|
}
|
|
36
45
|
},
|
|
46
|
+
"shadow": true,
|
|
37
47
|
"spacing": {
|
|
38
48
|
"padding": true
|
|
39
49
|
},
|
package/src/term-name/index.php
CHANGED
|
@@ -33,7 +33,7 @@ function render_block_core_term_name( $attributes, $content, $block ) {
|
|
|
33
33
|
return '';
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
$term_name = $term
|
|
36
|
+
$term_name = get_term_field( 'name', $term );
|
|
37
37
|
$level = $attributes['level'] ?? 0;
|
|
38
38
|
$tag_name = 0 === $level ? 'p' : 'h' . (int) $level;
|
|
39
39
|
|
|
@@ -28,6 +28,10 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
28
28
|
- [`html`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#html): `false`
|
|
29
29
|
- [`align`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#align): `"wide"`, `"full"`
|
|
30
30
|
- [`layout`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#layout): `true`
|
|
31
|
+
- [`background`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#background):
|
|
32
|
+
- `backgroundImage`: `true`
|
|
33
|
+
- `backgroundSize`: `true`
|
|
34
|
+
- `gradient`: `true`
|
|
31
35
|
- [`color`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color):
|
|
32
36
|
- [`gradients`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-gradients): `true`
|
|
33
37
|
- [`link`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-link): `true`
|
|
@@ -40,6 +44,7 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
40
44
|
- `blockGap`: `{"__experimentalDefault":"1.25em"}`
|
|
41
45
|
- [`interactivity`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#interactivity):
|
|
42
46
|
- `clientNavigation`: `true`
|
|
47
|
+
- [`shadow`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#shadow): `true`
|
|
43
48
|
|
|
44
49
|
## Context
|
|
45
50
|
|
|
@@ -14,6 +14,14 @@
|
|
|
14
14
|
"html": false,
|
|
15
15
|
"align": [ "wide", "full" ],
|
|
16
16
|
"layout": true,
|
|
17
|
+
"background": {
|
|
18
|
+
"backgroundImage": true,
|
|
19
|
+
"backgroundSize": true,
|
|
20
|
+
"gradient": true,
|
|
21
|
+
"__experimentalDefaultControls": {
|
|
22
|
+
"backgroundImage": true
|
|
23
|
+
}
|
|
24
|
+
},
|
|
17
25
|
"color": {
|
|
18
26
|
"gradients": true,
|
|
19
27
|
"link": true,
|
|
@@ -55,7 +63,8 @@
|
|
|
55
63
|
"color": true,
|
|
56
64
|
"width": true,
|
|
57
65
|
"style": true
|
|
58
|
-
}
|
|
66
|
+
},
|
|
67
|
+
"shadow": true
|
|
59
68
|
},
|
|
60
69
|
"style": "wp-block-term-template",
|
|
61
70
|
"editorStyle": "wp-block-term-template-editor"
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
2
|
+
import { unlock } from '../lock-unlock';
|
|
3
|
+
|
|
4
|
+
const { normalizeString, searchItems } = unlock( blockEditorPrivateApis );
|
|
2
5
|
|
|
3
6
|
/**
|
|
4
7
|
* Sanitizes the search input string.
|
|
@@ -8,49 +11,11 @@ import removeAccents from 'remove-accents';
|
|
|
8
11
|
* @return {string} The normalized search input.
|
|
9
12
|
*/
|
|
10
13
|
export function normalizeSearchInput( input = '' ) {
|
|
11
|
-
|
|
12
|
-
input = removeAccents( input );
|
|
13
|
-
|
|
14
|
-
// Trim & Lowercase.
|
|
15
|
-
input = input.trim().toLowerCase();
|
|
16
|
-
|
|
17
|
-
return input;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Get the search rank for a given pattern and a specific search term.
|
|
22
|
-
*
|
|
23
|
-
* @param {Object} pattern Pattern to rank
|
|
24
|
-
* @param {string} searchValue Search term
|
|
25
|
-
* @return {number} A pattern search rank
|
|
26
|
-
*/
|
|
27
|
-
export function getPatternSearchRank( pattern, searchValue ) {
|
|
28
|
-
const normalizedSearchValue = normalizeSearchInput( searchValue );
|
|
29
|
-
const normalizedTitle = normalizeSearchInput( pattern.title );
|
|
30
|
-
|
|
31
|
-
let rank = 0;
|
|
32
|
-
|
|
33
|
-
if ( normalizedSearchValue === normalizedTitle ) {
|
|
34
|
-
rank += 30;
|
|
35
|
-
} else if ( normalizedTitle.startsWith( normalizedSearchValue ) ) {
|
|
36
|
-
rank += 20;
|
|
37
|
-
} else {
|
|
38
|
-
const searchTerms = normalizedSearchValue.split( ' ' );
|
|
39
|
-
const hasMatchedTerms = searchTerms.every( ( searchTerm ) =>
|
|
40
|
-
normalizedTitle.includes( searchTerm )
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
// Prefer pattern with every search word in the title.
|
|
44
|
-
if ( hasMatchedTerms ) {
|
|
45
|
-
rank += 10;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return rank;
|
|
14
|
+
return normalizeString( input ).trim();
|
|
50
15
|
}
|
|
51
16
|
|
|
52
17
|
/**
|
|
53
|
-
* Filters
|
|
18
|
+
* Filters a pattern list given a search term.
|
|
54
19
|
*
|
|
55
20
|
* @param {Array} patterns Item list
|
|
56
21
|
* @param {string} searchValue Search input.
|
|
@@ -58,16 +23,7 @@ export function getPatternSearchRank( pattern, searchValue ) {
|
|
|
58
23
|
* @return {Array} Filtered pattern list.
|
|
59
24
|
*/
|
|
60
25
|
export function searchPatterns( patterns = [], searchValue = '' ) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const rankedPatterns = patterns
|
|
66
|
-
.map( ( pattern ) => {
|
|
67
|
-
return [ pattern, getPatternSearchRank( pattern, searchValue ) ];
|
|
68
|
-
} )
|
|
69
|
-
.filter( ( [ , rank ] ) => rank > 0 );
|
|
70
|
-
|
|
71
|
-
rankedPatterns.sort( ( [ , rank1 ], [ , rank2 ] ) => rank2 - rank1 );
|
|
72
|
-
return rankedPatterns.map( ( [ pattern ] ) => pattern );
|
|
26
|
+
return searchItems( patterns, searchValue, {
|
|
27
|
+
fields: [ { get: ( pattern ) => pattern.title } ],
|
|
28
|
+
} );
|
|
73
29
|
}
|
package/src/utils/style-state.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
getStyleForState,
|
|
3
|
+
setStyleForState,
|
|
4
|
+
privateApis as blockEditorPrivateApis,
|
|
5
|
+
} from '@wordpress/block-editor';
|
|
2
6
|
import { unlock } from '../lock-unlock';
|
|
3
7
|
|
|
4
|
-
const { cleanEmptyObject
|
|
5
|
-
blockEditorPrivateApis
|
|
6
|
-
);
|
|
8
|
+
const { cleanEmptyObject } = unlock( blockEditorPrivateApis );
|
|
7
9
|
|
|
8
10
|
function getStateStyle( style, selectedState ) {
|
|
9
11
|
return getStyleForState( style, selectedState ) || {};
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import {
|
|
3
|
-
normalizeSearchInput,
|
|
4
|
-
getPatternSearchRank,
|
|
5
|
-
searchPatterns,
|
|
6
|
-
} from '../search-patterns';
|
|
2
|
+
import { normalizeSearchInput, searchPatterns } from '../search-patterns';
|
|
7
3
|
|
|
8
4
|
describe( 'normalizeSearchInput', () => {
|
|
9
5
|
it( 'should remove accents', () => {
|
|
@@ -15,23 +11,6 @@ describe( 'normalizeSearchInput', () => {
|
|
|
15
11
|
} );
|
|
16
12
|
} );
|
|
17
13
|
|
|
18
|
-
describe( 'getPatternSearchRank', () => {
|
|
19
|
-
it( 'should give a high rank to exact matches', () => {
|
|
20
|
-
const pattern = { title: 'Foo' };
|
|
21
|
-
expect( getPatternSearchRank( pattern, 'Foo' ) ).toBe( 30 );
|
|
22
|
-
} );
|
|
23
|
-
|
|
24
|
-
it( 'should give a high rank to prefix matches', () => {
|
|
25
|
-
const pattern = { title: 'Foo' };
|
|
26
|
-
expect( getPatternSearchRank( pattern, 'Fo' ) ).toBe( 20 );
|
|
27
|
-
} );
|
|
28
|
-
|
|
29
|
-
it( 'should give a low rank to no matches', () => {
|
|
30
|
-
const pattern = { title: 'Foo' };
|
|
31
|
-
expect( getPatternSearchRank( pattern, 'Bar' ) ).toBe( 0 );
|
|
32
|
-
} );
|
|
33
|
-
} );
|
|
34
|
-
|
|
35
14
|
describe( 'searchPatterns', () => {
|
|
36
15
|
it( 'should return all patterns if no search term is provided', () => {
|
|
37
16
|
const patterns = [ { title: 'Foo' }, { title: 'Bar' } ];
|
package/src/video/README.md
CHANGED
|
@@ -41,6 +41,13 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
41
41
|
- `padding`: `true`
|
|
42
42
|
- [`interactivity`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#interactivity):
|
|
43
43
|
- `clientNavigation`: `true`
|
|
44
|
+
- [`shadow`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#shadow): `true`
|
|
45
|
+
|
|
46
|
+
## CSS Selectors
|
|
47
|
+
|
|
48
|
+
_Defined via the [`selectors`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-selectors/) property in block.json._
|
|
49
|
+
|
|
50
|
+
- **shadow**: `.wp-block-video video`
|
|
44
51
|
|
|
45
52
|
## Block Markup
|
|
46
53
|
|
package/src/video/block.json
CHANGED
|
@@ -101,8 +101,14 @@
|
|
|
101
101
|
},
|
|
102
102
|
"interactivity": {
|
|
103
103
|
"clientNavigation": true
|
|
104
|
+
},
|
|
105
|
+
"shadow": {
|
|
106
|
+
"__experimentalSkipSerialization": true
|
|
104
107
|
}
|
|
105
108
|
},
|
|
109
|
+
"selectors": {
|
|
110
|
+
"shadow": ".wp-block-video video"
|
|
111
|
+
},
|
|
106
112
|
"editorStyle": "wp-block-video-editor",
|
|
107
113
|
"style": "wp-block-video"
|
|
108
114
|
}
|
package/src/video/edit.jsx
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
MediaReplaceFlow,
|
|
14
14
|
useBlockProps,
|
|
15
15
|
useBlockEditingMode,
|
|
16
|
+
__experimentalGetShadowClassesAndStyles as getShadowClassesAndStyles,
|
|
16
17
|
} from '@wordpress/block-editor';
|
|
17
18
|
import { useRef, useEffect, useState } from '@wordpress/element';
|
|
18
19
|
import { __ } from '@wordpress/i18n';
|
|
@@ -30,7 +31,6 @@ import TracksEditor from './tracks-editor';
|
|
|
30
31
|
import Tracks from './tracks';
|
|
31
32
|
import { Caption } from '../utils/caption';
|
|
32
33
|
import PosterImage from '../utils/poster-image';
|
|
33
|
-
import { isGifVariation } from './variations';
|
|
34
34
|
|
|
35
35
|
const ALLOWED_MEDIA_TYPES = [ 'video' ];
|
|
36
36
|
|
|
@@ -43,8 +43,19 @@ function VideoEdit( {
|
|
|
43
43
|
onReplace,
|
|
44
44
|
} ) {
|
|
45
45
|
const videoPlayer = useRef();
|
|
46
|
-
const {
|
|
47
|
-
|
|
46
|
+
const {
|
|
47
|
+
id,
|
|
48
|
+
controls,
|
|
49
|
+
poster,
|
|
50
|
+
src,
|
|
51
|
+
tracks,
|
|
52
|
+
width,
|
|
53
|
+
height,
|
|
54
|
+
autoplay,
|
|
55
|
+
loop,
|
|
56
|
+
muted,
|
|
57
|
+
playsInline,
|
|
58
|
+
} = attributes;
|
|
48
59
|
// Give the <video> an explicit (non-`auto`) aspect ratio derived from the
|
|
49
60
|
// stored dimensions. The width/height attributes alone only yield
|
|
50
61
|
// `aspect-ratio: auto W/H`, whose `auto` keyword defers to the element's
|
|
@@ -54,6 +65,10 @@ function VideoEdit( {
|
|
|
54
65
|
// swap. A non-`auto` ratio governs the box height throughout the load.
|
|
55
66
|
const aspectRatio =
|
|
56
67
|
width && height ? `${ width } / ${ height }` : undefined;
|
|
68
|
+
const videoStyle = {
|
|
69
|
+
...( aspectRatio && { aspectRatio } ),
|
|
70
|
+
...getShadowClassesAndStyles( attributes ).style,
|
|
71
|
+
};
|
|
57
72
|
const [ temporaryURL, setTemporaryURL ] = useState( attributes.blob );
|
|
58
73
|
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
59
74
|
const blockEditingMode = useBlockEditingMode();
|
|
@@ -72,18 +87,6 @@ function VideoEdit( {
|
|
|
72
87
|
videoPlayer.current.load();
|
|
73
88
|
}
|
|
74
89
|
}, [ poster ] );
|
|
75
|
-
|
|
76
|
-
// The GIF variation plays like an animated GIF in the editor (the playback
|
|
77
|
-
// attributes are applied to the preview <video> below). Regular videos do
|
|
78
|
-
// not autoplay in the editor, so only nudge GIFs into playing after a
|
|
79
|
-
// source change in case the muted autoplay did not start on its own.
|
|
80
|
-
useEffect( () => {
|
|
81
|
-
if ( isGif ) {
|
|
82
|
-
// Browsers allow muted videos to be played programmatically.
|
|
83
|
-
videoPlayer.current?.play().catch( () => {} );
|
|
84
|
-
}
|
|
85
|
-
}, [ isGif, src, poster ] );
|
|
86
|
-
|
|
87
90
|
// TODO: Whether the video was obtained from the media library or was provided by URL, obtain the `videoWidth` and `videoHeight` of the video once its metadata has loaded and persist in the block attributes.
|
|
88
91
|
function onSelectVideo( media ) {
|
|
89
92
|
if ( ! media || ! media.url ) {
|
|
@@ -214,38 +217,36 @@ function VideoEdit( {
|
|
|
214
217
|
</BlockControls>
|
|
215
218
|
</>
|
|
216
219
|
) }
|
|
217
|
-
|
|
218
|
-
<
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
220
|
+
<InspectorControls>
|
|
221
|
+
<ToolsPanel
|
|
222
|
+
label={ __( 'Settings' ) }
|
|
223
|
+
resetAll={ () => {
|
|
224
|
+
setAttributes( {
|
|
225
|
+
autoplay: false,
|
|
226
|
+
controls: true,
|
|
227
|
+
loop: false,
|
|
228
|
+
muted: false,
|
|
229
|
+
playsInline: false,
|
|
230
|
+
preload: 'metadata',
|
|
231
|
+
poster: undefined,
|
|
232
|
+
} );
|
|
233
|
+
} }
|
|
234
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
235
|
+
>
|
|
236
|
+
<VideoCommonSettings
|
|
237
|
+
setAttributes={ setAttributes }
|
|
238
|
+
attributes={ attributes }
|
|
239
|
+
/>
|
|
240
|
+
<PosterImage
|
|
241
|
+
poster={ poster }
|
|
242
|
+
onChange={ ( posterImage ) =>
|
|
222
243
|
setAttributes( {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
poster: undefined,
|
|
230
|
-
} );
|
|
231
|
-
} }
|
|
232
|
-
dropdownMenuProps={ dropdownMenuProps }
|
|
233
|
-
>
|
|
234
|
-
<VideoCommonSettings
|
|
235
|
-
setAttributes={ setAttributes }
|
|
236
|
-
attributes={ attributes }
|
|
237
|
-
/>
|
|
238
|
-
<PosterImage
|
|
239
|
-
poster={ poster }
|
|
240
|
-
onChange={ ( posterImage ) =>
|
|
241
|
-
setAttributes( {
|
|
242
|
-
poster: posterImage?.url,
|
|
243
|
-
} )
|
|
244
|
-
}
|
|
245
|
-
/>
|
|
246
|
-
</ToolsPanel>
|
|
247
|
-
</InspectorControls>
|
|
248
|
-
) }
|
|
244
|
+
poster: posterImage?.url,
|
|
245
|
+
} )
|
|
246
|
+
}
|
|
247
|
+
/>
|
|
248
|
+
</ToolsPanel>
|
|
249
|
+
</InspectorControls>
|
|
249
250
|
<figure { ...blockProps }>
|
|
250
251
|
<video
|
|
251
252
|
controls={ controls }
|
|
@@ -253,13 +254,17 @@ function VideoEdit( {
|
|
|
253
254
|
poster={ poster }
|
|
254
255
|
src={ src || temporaryURL }
|
|
255
256
|
ref={ videoPlayer }
|
|
256
|
-
autoPlay={
|
|
257
|
-
loop={
|
|
258
|
-
muted={
|
|
259
|
-
playsInline={
|
|
257
|
+
autoPlay={ autoplay }
|
|
258
|
+
loop={ loop }
|
|
259
|
+
muted={ muted }
|
|
260
|
+
playsInline={ playsInline }
|
|
260
261
|
width={ width }
|
|
261
262
|
height={ height }
|
|
262
|
-
style={
|
|
263
|
+
style={
|
|
264
|
+
Object.keys( videoStyle ).length
|
|
265
|
+
? videoStyle
|
|
266
|
+
: undefined
|
|
267
|
+
}
|
|
263
268
|
>
|
|
264
269
|
<Tracks tracks={ tracks } />
|
|
265
270
|
</video>
|
package/src/video/index.js
CHANGED
|
@@ -6,7 +6,6 @@ import edit from './edit';
|
|
|
6
6
|
import metadata from './block.json';
|
|
7
7
|
import save from './save';
|
|
8
8
|
import transforms from './transforms';
|
|
9
|
-
import variations from './variations';
|
|
10
9
|
|
|
11
10
|
const { name } = metadata;
|
|
12
11
|
|
|
@@ -22,7 +21,6 @@ export const settings = {
|
|
|
22
21
|
},
|
|
23
22
|
},
|
|
24
23
|
transforms,
|
|
25
|
-
variations,
|
|
26
24
|
deprecated,
|
|
27
25
|
edit,
|
|
28
26
|
save,
|
package/src/video/save.jsx
CHANGED
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
RichText,
|
|
3
3
|
useBlockProps,
|
|
4
4
|
__experimentalGetElementClassName,
|
|
5
|
+
__experimentalGetShadowClassesAndStyles as getShadowClassesAndStyles,
|
|
5
6
|
} from '@wordpress/block-editor';
|
|
6
7
|
import Tracks from './tracks';
|
|
7
8
|
|
|
@@ -27,6 +28,10 @@ export default function save( { attributes } ) {
|
|
|
27
28
|
// `aspect-ratio: auto W/H`, whose `auto` keyword is unreliable during load.
|
|
28
29
|
const aspectRatio =
|
|
29
30
|
width && height ? `${ width } / ${ height }` : undefined;
|
|
31
|
+
const videoStyle = {
|
|
32
|
+
...( aspectRatio && { aspectRatio } ),
|
|
33
|
+
...getShadowClassesAndStyles( attributes ).style,
|
|
34
|
+
};
|
|
30
35
|
return (
|
|
31
36
|
<figure { ...useBlockProps.save() }>
|
|
32
37
|
{ src && (
|
|
@@ -41,7 +46,11 @@ export default function save( { attributes } ) {
|
|
|
41
46
|
playsInline={ playsInline }
|
|
42
47
|
width={ width }
|
|
43
48
|
height={ height }
|
|
44
|
-
style={
|
|
49
|
+
style={
|
|
50
|
+
Object.keys( videoStyle ).length
|
|
51
|
+
? videoStyle
|
|
52
|
+
: undefined
|
|
53
|
+
}
|
|
45
54
|
>
|
|
46
55
|
<Tracks tracks={ tracks } />
|
|
47
56
|
</video>
|