@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/image/image.jsx
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
Spinner,
|
|
7
7
|
TextareaControl as WCTextareaControl,
|
|
8
8
|
TextControl,
|
|
9
|
-
CheckboxControl,
|
|
9
|
+
CheckboxControl as WCCheckboxControl,
|
|
10
10
|
ToolbarButton,
|
|
11
11
|
ToolbarGroup,
|
|
12
12
|
__experimentalToolsPanel as ToolsPanel,
|
|
@@ -73,7 +73,6 @@ import { evalAspectRatio, mediaPosition } from './utils';
|
|
|
73
73
|
|
|
74
74
|
const {
|
|
75
75
|
DimensionsTool,
|
|
76
|
-
isDefaultBlockStyleState,
|
|
77
76
|
ResolutionTool,
|
|
78
77
|
mediaEditKey,
|
|
79
78
|
mediaSideloadFromUrlKey,
|
|
@@ -666,20 +665,23 @@ export default function Image( {
|
|
|
666
665
|
|
|
667
666
|
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
668
667
|
|
|
669
|
-
const selectedStyleState = useSelect(
|
|
668
|
+
const { selectedStyleState, hasSelectedStyleState } = useSelect(
|
|
670
669
|
( select ) => {
|
|
671
670
|
if ( ! isSingleSelected ) {
|
|
672
|
-
return
|
|
671
|
+
return {
|
|
672
|
+
selectedStyleState: undefined,
|
|
673
|
+
hasSelectedStyleState: false,
|
|
674
|
+
};
|
|
673
675
|
}
|
|
674
|
-
const { getSelectedBlockStyleState } =
|
|
675
|
-
select( blockEditorStore )
|
|
676
|
-
|
|
677
|
-
|
|
676
|
+
const { getSelectedBlockStyleState, hasSelectedBlockStyleState } =
|
|
677
|
+
select( blockEditorStore );
|
|
678
|
+
return {
|
|
679
|
+
selectedStyleState: getSelectedBlockStyleState( clientId ),
|
|
680
|
+
hasSelectedStyleState: hasSelectedBlockStyleState( clientId ),
|
|
681
|
+
};
|
|
678
682
|
},
|
|
679
683
|
[ clientId, isSingleSelected ]
|
|
680
684
|
);
|
|
681
|
-
const hasSelectedStyleState =
|
|
682
|
-
! isDefaultBlockStyleState( selectedStyleState );
|
|
683
685
|
const selectedStyleStateKey = getStyleStateKey( selectedStyleState );
|
|
684
686
|
const activeWidth = getActiveDimensionValue( {
|
|
685
687
|
attributes,
|
|
@@ -1043,7 +1045,7 @@ export default function Image( {
|
|
|
1043
1045
|
setAttributes( { isDecorative: false } )
|
|
1044
1046
|
}
|
|
1045
1047
|
>
|
|
1046
|
-
<
|
|
1048
|
+
<WCCheckboxControl
|
|
1047
1049
|
label={ __( 'Mark as decorative' ) }
|
|
1048
1050
|
checked={ !! isDecorative }
|
|
1049
1051
|
onChange={ updateIsDecorative }
|
|
@@ -623,6 +623,145 @@ describe( 'useOpenImageMediaEditorModal', () => {
|
|
|
623
623
|
} );
|
|
624
624
|
} );
|
|
625
625
|
|
|
626
|
+
it( 'restores the alt text and caption a save overwrote when undoing back to the previous attachment', async () => {
|
|
627
|
+
const originalAttachment = {
|
|
628
|
+
id: 1,
|
|
629
|
+
alt_text: 'Original alt',
|
|
630
|
+
caption: { raw: 'Original caption' },
|
|
631
|
+
};
|
|
632
|
+
const croppedAttachment = {
|
|
633
|
+
id: 2,
|
|
634
|
+
alt_text: 'Updated alt',
|
|
635
|
+
caption: { raw: 'Updated caption' },
|
|
636
|
+
};
|
|
637
|
+
const registry = createRegistry( {
|
|
638
|
+
getEditedEntityRecord: ( kind, name, attachmentId ) =>
|
|
639
|
+
attachmentId === 1 ? originalAttachment : undefined,
|
|
640
|
+
resolveGetEntityRecord: ( kind, name, attachmentId ) =>
|
|
641
|
+
attachmentId === 2 ? croppedAttachment : originalAttachment,
|
|
642
|
+
} );
|
|
643
|
+
useRegistry.mockReturnValue( registry );
|
|
644
|
+
const setAttributes = vi.fn();
|
|
645
|
+
const openMediaEditorModal = vi.fn();
|
|
646
|
+
mockMediaEditorModalSetting( openMediaEditorModal );
|
|
647
|
+
const { result } = renderHook( () =>
|
|
648
|
+
useOpenImageMediaEditorModal( {
|
|
649
|
+
attributes: {
|
|
650
|
+
id: 1,
|
|
651
|
+
url: 'original.jpg',
|
|
652
|
+
alt: 'Original alt',
|
|
653
|
+
caption: 'Original caption',
|
|
654
|
+
},
|
|
655
|
+
setAttributes,
|
|
656
|
+
} )
|
|
657
|
+
);
|
|
658
|
+
|
|
659
|
+
await act( async () => {
|
|
660
|
+
await result.current();
|
|
661
|
+
} );
|
|
662
|
+
const onUpdate = openMediaEditorModal.mock.calls[ 0 ][ 0 ].onUpdate;
|
|
663
|
+
await act( async () => {
|
|
664
|
+
await onUpdate( { id: 2, url: 'cropped.jpg' } );
|
|
665
|
+
} );
|
|
666
|
+
// The media editor's Undo only reports the previous attachment.
|
|
667
|
+
await act( async () => {
|
|
668
|
+
await onUpdate( { id: 1, url: 'original.jpg' } );
|
|
669
|
+
} );
|
|
670
|
+
|
|
671
|
+
expect( setAttributes ).toHaveBeenCalledTimes( 2 );
|
|
672
|
+
expect( setAttributes ).toHaveBeenNthCalledWith( 1, {
|
|
673
|
+
id: 2,
|
|
674
|
+
url: 'cropped.jpg',
|
|
675
|
+
alt: 'Updated alt',
|
|
676
|
+
caption: 'Updated caption',
|
|
677
|
+
} );
|
|
678
|
+
expect( setAttributes ).toHaveBeenNthCalledWith( 2, {
|
|
679
|
+
id: 1,
|
|
680
|
+
url: 'original.jpg',
|
|
681
|
+
alt: 'Original alt',
|
|
682
|
+
caption: 'Original caption',
|
|
683
|
+
} );
|
|
684
|
+
} );
|
|
685
|
+
|
|
686
|
+
it( 'does not restore overwritten metadata when a later session saves back to the previous attachment', async () => {
|
|
687
|
+
const originalAttachment = {
|
|
688
|
+
id: 1,
|
|
689
|
+
alt_text: 'Original alt',
|
|
690
|
+
caption: { raw: 'Original caption' },
|
|
691
|
+
};
|
|
692
|
+
const croppedAttachment = {
|
|
693
|
+
id: 2,
|
|
694
|
+
alt_text: 'Updated alt',
|
|
695
|
+
caption: { raw: 'Updated caption' },
|
|
696
|
+
};
|
|
697
|
+
const registry = createRegistry( {
|
|
698
|
+
getEditedEntityRecord: ( kind, name, attachmentId ) =>
|
|
699
|
+
attachmentId === 1 ? originalAttachment : croppedAttachment,
|
|
700
|
+
resolveGetEntityRecord: ( kind, name, attachmentId ) =>
|
|
701
|
+
attachmentId === 2
|
|
702
|
+
? croppedAttachment
|
|
703
|
+
: {
|
|
704
|
+
...originalAttachment,
|
|
705
|
+
alt_text: 'Server alt',
|
|
706
|
+
caption: { raw: 'Server caption' },
|
|
707
|
+
},
|
|
708
|
+
} );
|
|
709
|
+
useRegistry.mockReturnValue( registry );
|
|
710
|
+
const setAttributes = vi.fn();
|
|
711
|
+
const openMediaEditorModal = vi.fn();
|
|
712
|
+
mockMediaEditorModalSetting( openMediaEditorModal );
|
|
713
|
+
const { result, rerender } = renderHook(
|
|
714
|
+
( { attributes } ) =>
|
|
715
|
+
useOpenImageMediaEditorModal( { attributes, setAttributes } ),
|
|
716
|
+
{
|
|
717
|
+
initialProps: {
|
|
718
|
+
attributes: {
|
|
719
|
+
id: 1,
|
|
720
|
+
url: 'original.jpg',
|
|
721
|
+
alt: 'Original alt',
|
|
722
|
+
caption: 'Original caption',
|
|
723
|
+
},
|
|
724
|
+
},
|
|
725
|
+
}
|
|
726
|
+
);
|
|
727
|
+
|
|
728
|
+
await act( async () => {
|
|
729
|
+
await result.current();
|
|
730
|
+
} );
|
|
731
|
+
await act( async () => {
|
|
732
|
+
await openMediaEditorModal.mock.calls[ 0 ][ 0 ].onUpdate( {
|
|
733
|
+
id: 2,
|
|
734
|
+
url: 'cropped.jpg',
|
|
735
|
+
} );
|
|
736
|
+
} );
|
|
737
|
+
rerender( {
|
|
738
|
+
attributes: {
|
|
739
|
+
id: 2,
|
|
740
|
+
url: 'cropped.jpg',
|
|
741
|
+
alt: 'Updated alt',
|
|
742
|
+
caption: 'Updated caption',
|
|
743
|
+
},
|
|
744
|
+
} );
|
|
745
|
+
// Opening the modal again starts a new session, so a save in it that
|
|
746
|
+
// happens to return the block to attachment 1 is not the Undo.
|
|
747
|
+
await act( async () => {
|
|
748
|
+
await result.current();
|
|
749
|
+
} );
|
|
750
|
+
await act( async () => {
|
|
751
|
+
await openMediaEditorModal.mock.calls[ 1 ][ 0 ].onUpdate( {
|
|
752
|
+
id: 1,
|
|
753
|
+
url: 'original.jpg',
|
|
754
|
+
} );
|
|
755
|
+
} );
|
|
756
|
+
|
|
757
|
+
expect( setAttributes ).toHaveBeenLastCalledWith( {
|
|
758
|
+
id: 1,
|
|
759
|
+
url: 'original.jpg',
|
|
760
|
+
alt: 'Server alt',
|
|
761
|
+
caption: 'Server caption',
|
|
762
|
+
} );
|
|
763
|
+
} );
|
|
764
|
+
|
|
626
765
|
it( 'resolves fresh metadata when the new attachment id has an incomplete cached record', async () => {
|
|
627
766
|
const originalAttachment = {
|
|
628
767
|
id: 1,
|
|
@@ -268,6 +268,11 @@ export function useOpenImageMediaEditorModal( {
|
|
|
268
268
|
// Incremented on every handleMediaUpdate call; stale async continuations
|
|
269
269
|
// check against this to bail out if a newer update has since started.
|
|
270
270
|
const mediaEditorMetadataSyncRequestRef = useRef( 0 );
|
|
271
|
+
// The alt text and caption a save overwrote on the block, and the
|
|
272
|
+
// attachment it moved the block away from. The media editor's Undo moves
|
|
273
|
+
// the block back but reports only that attachment's id and url, so this is
|
|
274
|
+
// what lets the update restore the block's own metadata too.
|
|
275
|
+
const mediaEditorUndoMetadataRef = useRef();
|
|
271
276
|
|
|
272
277
|
useEffect( () => {
|
|
273
278
|
blockAttributesRef.current = {
|
|
@@ -344,6 +349,10 @@ export function useOpenImageMediaEditorModal( {
|
|
|
344
349
|
// reuse a stale snapshot.
|
|
345
350
|
const originalAttachment = mediaEditorMetadataBaselineRef.current;
|
|
346
351
|
mediaEditorMetadataBaselineRef.current = undefined;
|
|
352
|
+
// Likewise the metadata the last save overwrote: only the update
|
|
353
|
+
// straight after that save, its Undo, may restore it.
|
|
354
|
+
const undoMetadata = mediaEditorUndoMetadataRef.current;
|
|
355
|
+
mediaEditorUndoMetadataRef.current = undefined;
|
|
347
356
|
const syncRequest = ++mediaEditorMetadataSyncRequestRef.current;
|
|
348
357
|
const nextAttributes = {};
|
|
349
358
|
|
|
@@ -413,6 +422,22 @@ export function useOpenImageMediaEditorModal( {
|
|
|
413
422
|
nextAttributes,
|
|
414
423
|
resolvedMetadataAttributes
|
|
415
424
|
);
|
|
425
|
+
|
|
426
|
+
// Only a save to a new attachment offers an Undo, so
|
|
427
|
+
// only then keep the values being overwritten.
|
|
428
|
+
if ( isNewAttachment ) {
|
|
429
|
+
mediaEditorUndoMetadataRef.current = {
|
|
430
|
+
id: currentBlockAttributes.id,
|
|
431
|
+
attributes: Object.fromEntries(
|
|
432
|
+
Object.keys(
|
|
433
|
+
resolvedMetadataAttributes
|
|
434
|
+
).map( ( key ) => [
|
|
435
|
+
key,
|
|
436
|
+
latestBlockAttributes[ key ],
|
|
437
|
+
] )
|
|
438
|
+
),
|
|
439
|
+
};
|
|
440
|
+
}
|
|
416
441
|
}
|
|
417
442
|
}
|
|
418
443
|
|
|
@@ -444,6 +469,13 @@ export function useOpenImageMediaEditorModal( {
|
|
|
444
469
|
}
|
|
445
470
|
}
|
|
446
471
|
|
|
472
|
+
// The media editor's Undo: the block is going back to the
|
|
473
|
+
// attachment the last save moved it away from, so put back the
|
|
474
|
+
// alt text and caption that save overwrote.
|
|
475
|
+
if ( undoMetadata?.id === newId ) {
|
|
476
|
+
Object.assign( nextAttributes, undoMetadata.attributes );
|
|
477
|
+
}
|
|
478
|
+
|
|
447
479
|
if ( Object.keys( nextAttributes ).length ) {
|
|
448
480
|
blockAttributesRef.current = {
|
|
449
481
|
...blockAttributesRef.current,
|
|
@@ -465,6 +497,11 @@ export function useOpenImageMediaEditorModal( {
|
|
|
465
497
|
return;
|
|
466
498
|
}
|
|
467
499
|
|
|
500
|
+
// A new session starts. Drop any metadata kept for the last save's
|
|
501
|
+
// Undo, so a save in this session that returns the block to that same
|
|
502
|
+
// attachment isn't mistaken for it.
|
|
503
|
+
mediaEditorUndoMetadataRef.current = undefined;
|
|
504
|
+
|
|
468
505
|
// Snapshot the attachment's current metadata before the user makes
|
|
469
506
|
// any changes so handleMediaUpdate can compare against it later. Use
|
|
470
507
|
// the cached record when it's already present; only resolve when
|
|
@@ -26,6 +26,10 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
26
26
|
|
|
27
27
|
- [`anchor`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#anchor): `true`
|
|
28
28
|
- [`align`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#align): `true`
|
|
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`
|
|
@@ -33,6 +37,7 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
33
37
|
- [`spacing`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#spacing):
|
|
34
38
|
- `margin`: `true`
|
|
35
39
|
- `padding`: `true`
|
|
40
|
+
- [`shadow`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#shadow): `true`
|
|
36
41
|
- [`typography`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography):
|
|
37
42
|
- [`fontSize`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-fontsize): `true`
|
|
38
43
|
- [`lineHeight`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-lineheight): `true`
|
|
@@ -31,6 +31,15 @@
|
|
|
31
31
|
"supports": {
|
|
32
32
|
"anchor": true,
|
|
33
33
|
"align": true,
|
|
34
|
+
"background": {
|
|
35
|
+
"backgroundImage": true,
|
|
36
|
+
"backgroundSize": true,
|
|
37
|
+
"gradient": true,
|
|
38
|
+
"__experimentalDefaultControls": {
|
|
39
|
+
"backgroundImage": true,
|
|
40
|
+
"gradient": true
|
|
41
|
+
}
|
|
42
|
+
},
|
|
34
43
|
"color": {
|
|
35
44
|
"gradients": true,
|
|
36
45
|
"link": true,
|
|
@@ -45,6 +54,7 @@
|
|
|
45
54
|
"margin": true,
|
|
46
55
|
"padding": true
|
|
47
56
|
},
|
|
57
|
+
"shadow": true,
|
|
48
58
|
"typography": {
|
|
49
59
|
"fontSize": true,
|
|
50
60
|
"lineHeight": true,
|
|
@@ -40,6 +40,10 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
40
40
|
- [`align`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#align): `true`
|
|
41
41
|
- [`html`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#html): `false`
|
|
42
42
|
- [`layout`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#layout): `true`
|
|
43
|
+
- [`background`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#background):
|
|
44
|
+
- `backgroundImage`: `true`
|
|
45
|
+
- `backgroundSize`: `true`
|
|
46
|
+
- `gradient`: `true`
|
|
43
47
|
- [`color`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color):
|
|
44
48
|
- [`gradients`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-gradients): `true`
|
|
45
49
|
- [`link`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-link): `true`
|
|
@@ -50,6 +54,7 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
50
54
|
- [`typography`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography):
|
|
51
55
|
- [`fontSize`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-fontsize): `true`
|
|
52
56
|
- [`lineHeight`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-lineheight): `true`
|
|
57
|
+
- [`shadow`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#shadow): `true`
|
|
53
58
|
- [`interactivity`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#interactivity):
|
|
54
59
|
- `clientNavigation`: `true`
|
|
55
60
|
|
|
@@ -79,6 +79,15 @@
|
|
|
79
79
|
"align": true,
|
|
80
80
|
"html": false,
|
|
81
81
|
"layout": true,
|
|
82
|
+
"background": {
|
|
83
|
+
"backgroundImage": true,
|
|
84
|
+
"backgroundSize": true,
|
|
85
|
+
"gradient": true,
|
|
86
|
+
"__experimentalDefaultControls": {
|
|
87
|
+
"backgroundImage": true,
|
|
88
|
+
"gradient": true
|
|
89
|
+
}
|
|
90
|
+
},
|
|
82
91
|
"color": {
|
|
83
92
|
"gradients": true,
|
|
84
93
|
"link": true,
|
|
@@ -123,6 +132,7 @@
|
|
|
123
132
|
"style": true
|
|
124
133
|
}
|
|
125
134
|
},
|
|
135
|
+
"shadow": true,
|
|
126
136
|
"interactivity": {
|
|
127
137
|
"clientNavigation": true
|
|
128
138
|
}
|
package/src/loginout/README.md
CHANGED
|
@@ -24,6 +24,10 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
24
24
|
|
|
25
25
|
- [`anchor`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#anchor): `true`
|
|
26
26
|
- [`className`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#classname): `true`
|
|
27
|
+
- [`background`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#background):
|
|
28
|
+
- `backgroundImage`: `true`
|
|
29
|
+
- `backgroundSize`: `true`
|
|
30
|
+
- `gradient`: `true`
|
|
27
31
|
- [`color`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color):
|
|
28
32
|
- [`background`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-background): `true`
|
|
29
33
|
- [`text`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-text): `false`
|
|
@@ -35,6 +39,7 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
35
39
|
- [`typography`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography):
|
|
36
40
|
- [`fontSize`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-fontsize): `true`
|
|
37
41
|
- [`lineHeight`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-lineheight): `true`
|
|
42
|
+
- [`shadow`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#shadow): `true`
|
|
38
43
|
- [`interactivity`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#interactivity):
|
|
39
44
|
- `clientNavigation`: `true`
|
|
40
45
|
|
package/src/loginout/block.json
CHANGED
|
@@ -23,6 +23,15 @@
|
|
|
23
23
|
"supports": {
|
|
24
24
|
"anchor": true,
|
|
25
25
|
"className": true,
|
|
26
|
+
"background": {
|
|
27
|
+
"backgroundImage": true,
|
|
28
|
+
"backgroundSize": true,
|
|
29
|
+
"gradient": true,
|
|
30
|
+
"__experimentalDefaultControls": {
|
|
31
|
+
"backgroundImage": true,
|
|
32
|
+
"gradient": true
|
|
33
|
+
}
|
|
34
|
+
},
|
|
26
35
|
"color": {
|
|
27
36
|
"background": true,
|
|
28
37
|
"text": false,
|
|
@@ -56,6 +65,7 @@
|
|
|
56
65
|
"width": true,
|
|
57
66
|
"style": true
|
|
58
67
|
},
|
|
68
|
+
"shadow": true,
|
|
59
69
|
"interactivity": {
|
|
60
70
|
"clientNavigation": true
|
|
61
71
|
}
|
package/src/math/README.md
CHANGED
|
@@ -24,8 +24,13 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
24
24
|
|
|
25
25
|
- [`anchor`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#anchor): `true`
|
|
26
26
|
- [`html`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#html): `false`
|
|
27
|
+
- [`background`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#background):
|
|
28
|
+
- `backgroundImage`: `true`
|
|
29
|
+
- `backgroundSize`: `true`
|
|
30
|
+
- `gradient`: `true`
|
|
27
31
|
- [`color`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color):
|
|
28
32
|
- [`gradients`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-gradients): `true`
|
|
33
|
+
- [`shadow`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#shadow): `true`
|
|
29
34
|
- [`spacing`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#spacing):
|
|
30
35
|
- `margin`: `true`
|
|
31
36
|
- `padding`: `true`
|
package/src/math/block.json
CHANGED
|
@@ -16,6 +16,15 @@
|
|
|
16
16
|
"style": true,
|
|
17
17
|
"width": true
|
|
18
18
|
},
|
|
19
|
+
"background": {
|
|
20
|
+
"backgroundImage": true,
|
|
21
|
+
"backgroundSize": true,
|
|
22
|
+
"gradient": true,
|
|
23
|
+
"__experimentalDefaultControls": {
|
|
24
|
+
"backgroundImage": true,
|
|
25
|
+
"gradient": true
|
|
26
|
+
}
|
|
27
|
+
},
|
|
19
28
|
"color": {
|
|
20
29
|
"gradients": true,
|
|
21
30
|
"__experimentalDefaultControls": {
|
|
@@ -23,6 +32,7 @@
|
|
|
23
32
|
"text": true
|
|
24
33
|
}
|
|
25
34
|
},
|
|
35
|
+
"shadow": true,
|
|
26
36
|
"spacing": {
|
|
27
37
|
"margin": true,
|
|
28
38
|
"padding": true,
|
package/src/media-text/README.md
CHANGED
|
@@ -46,6 +46,7 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
46
46
|
- [`gradients`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-gradients): `true`
|
|
47
47
|
- [`heading`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-heading): `true`
|
|
48
48
|
- [`link`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-link): `true`
|
|
49
|
+
- [`button`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-button): `true`
|
|
49
50
|
- [`spacing`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#spacing):
|
|
50
51
|
- `margin`: `true`
|
|
51
52
|
- `padding`: `true`
|
|
@@ -295,10 +295,8 @@ function Navigation( {
|
|
|
295
295
|
hasSelectedStyleState,
|
|
296
296
|
} = useSelect(
|
|
297
297
|
( select ) => {
|
|
298
|
-
const {
|
|
299
|
-
|
|
300
|
-
hasSelectedStyleState: hasSelectedBlockStyleState,
|
|
301
|
-
} = unlock( select( blockEditorStore ) );
|
|
298
|
+
const { getSettings, hasSelectedBlockStyleState } =
|
|
299
|
+
select( blockEditorStore );
|
|
302
300
|
const settings = getSettings();
|
|
303
301
|
|
|
304
302
|
return {
|
|
@@ -123,6 +123,24 @@ $navigation-icon-size: 24px;
|
|
|
123
123
|
--navigation-layout-direction: column;
|
|
124
124
|
--navigation-layout-justify: initial;
|
|
125
125
|
--navigation-layout-align: flex-start;
|
|
126
|
+
|
|
127
|
+
// Align wrapped label text with the item justification. Only vertical
|
|
128
|
+
// menus need it: a horizontal item is only ever as wide as its own text.
|
|
129
|
+
text-align: var(--navigation-layout-text-align, inherit);
|
|
130
|
+
|
|
131
|
+
// Buttons declare their own text-align, and a directly declared value
|
|
132
|
+
// beats an inherited one, so opt submenu toggles back in.
|
|
133
|
+
.wp-block-navigation-item__content {
|
|
134
|
+
text-align: inherit;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Flyout submenus are separate panels, so they keep their own
|
|
138
|
+
// alignment rather than following the parent menu's justification.
|
|
139
|
+
// open-always submenus render inline as part of the same vertical
|
|
140
|
+
// stack instead, so they should keep following it.
|
|
141
|
+
.wp-block-navigation-item:not(.open-always) > .wp-block-navigation__submenu-container {
|
|
142
|
+
text-align: initial;
|
|
143
|
+
}
|
|
126
144
|
}
|
|
127
145
|
|
|
128
146
|
&.no-wrap {
|
|
@@ -132,6 +150,7 @@ $navigation-icon-size: 24px;
|
|
|
132
150
|
&.items-justified-center {
|
|
133
151
|
--navigation-layout-justification-setting: center;
|
|
134
152
|
--navigation-layout-justify: center;
|
|
153
|
+
--navigation-layout-text-align: center;
|
|
135
154
|
|
|
136
155
|
&.is-vertical {
|
|
137
156
|
--navigation-layout-align: center;
|
|
@@ -141,6 +160,7 @@ $navigation-icon-size: 24px;
|
|
|
141
160
|
&.items-justified-right {
|
|
142
161
|
--navigation-layout-justification-setting: flex-end;
|
|
143
162
|
--navigation-layout-justify: flex-end;
|
|
163
|
+
--navigation-layout-text-align: end;
|
|
144
164
|
|
|
145
165
|
&.is-vertical {
|
|
146
166
|
--navigation-layout-align: flex-end;
|
|
@@ -248,18 +268,18 @@ $navigation-icon-size: 24px;
|
|
|
248
268
|
height: auto;
|
|
249
269
|
}
|
|
250
270
|
|
|
251
|
-
// Show submenus on hover unless they open on click.
|
|
271
|
+
// Show submenus on hover unless they open on click or are always shown.
|
|
252
272
|
// Restricted to true-hover devices to prevent sticky touch-hover on mobile.
|
|
253
273
|
@media (hover: hover) {
|
|
254
|
-
&:not(.open-on-click):hover > .wp-block-navigation__submenu-container {
|
|
274
|
+
&:not(.open-on-click):not(.open-always):hover > .wp-block-navigation__submenu-container {
|
|
255
275
|
@include show-submenu;
|
|
256
276
|
min-width: 200px;
|
|
257
277
|
}
|
|
258
278
|
}
|
|
259
279
|
// Keep submenus open when focus is within.
|
|
260
|
-
&:not(.open-on-click):not(.open-on-hover-click):focus-within > .wp-block-navigation__submenu-container,
|
|
280
|
+
&:not(.open-on-click):not(.open-on-hover-click):not(.open-always):focus-within > .wp-block-navigation__submenu-container,
|
|
261
281
|
// Show submenus on click.
|
|
262
|
-
.wp-block-navigation-submenu__toggle[aria-expanded="true"] ~ .wp-block-navigation__submenu-container {
|
|
282
|
+
&:not(.open-always) .wp-block-navigation-submenu__toggle[aria-expanded="true"] ~ .wp-block-navigation__submenu-container {
|
|
263
283
|
@include show-submenu;
|
|
264
284
|
min-width: 200px;
|
|
265
285
|
}
|
|
@@ -313,6 +333,8 @@ $navigation-icon-size: 24px;
|
|
|
313
333
|
border: none;
|
|
314
334
|
background-color: transparent;
|
|
315
335
|
color: inherit;
|
|
336
|
+
// Has to be !important to override the inline instance style.
|
|
337
|
+
box-shadow: none !important;
|
|
316
338
|
}
|
|
317
339
|
}
|
|
318
340
|
}
|
|
@@ -607,6 +629,7 @@ button.wp-block-navigation-item__content {
|
|
|
607
629
|
|
|
608
630
|
// Inherit alignment settings from container.
|
|
609
631
|
align-items: var(--navigation-layout-justification-setting, inherit);
|
|
632
|
+
text-align: var(--navigation-layout-text-align, inherit);
|
|
610
633
|
|
|
611
634
|
// Always align the contents of the menu to the top.
|
|
612
635
|
&,
|
|
@@ -645,11 +668,18 @@ button.wp-block-navigation-item__content {
|
|
|
645
668
|
// Apply top padding to nested submenus.
|
|
646
669
|
.wp-block-navigation__submenu-container {
|
|
647
670
|
padding-top: var(--wp--style--block-gap, 2em);
|
|
671
|
+
|
|
672
|
+
// Unfolded inline here, not shown as a panel, so submenus
|
|
673
|
+
// follow the menu's justification.
|
|
674
|
+
text-align: inherit;
|
|
648
675
|
}
|
|
649
676
|
|
|
650
677
|
// A default padding is added to submenu items. It's not appropriate inside the modal.
|
|
651
678
|
.wp-block-navigation-item__content {
|
|
652
679
|
padding: 0;
|
|
680
|
+
|
|
681
|
+
// See the note on submenu toggles above.
|
|
682
|
+
text-align: inherit;
|
|
653
683
|
}
|
|
654
684
|
|
|
655
685
|
// Default column display for overlay menu contents.
|
|
@@ -673,6 +703,12 @@ button.wp-block-navigation-item__content {
|
|
|
673
703
|
background: transparent !important;
|
|
674
704
|
}
|
|
675
705
|
|
|
706
|
+
// Submenus unfold inline here, so drop the dropdown shadow.
|
|
707
|
+
// Has to be !important to override the inline instance style.
|
|
708
|
+
.wp-block-navigation-item .wp-block-navigation__submenu-container {
|
|
709
|
+
box-shadow: none !important;
|
|
710
|
+
}
|
|
711
|
+
|
|
676
712
|
// Override justification dropdown menu positioning rules.
|
|
677
713
|
.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container {
|
|
678
714
|
right: auto;
|
|
@@ -35,11 +35,16 @@
|
|
|
35
35
|
// We use important here because if the parent block is selected and submenus are present, they should always be visible.
|
|
36
36
|
visibility: visible !important;
|
|
37
37
|
opacity: 1 !important;
|
|
38
|
-
min-width: 200px !important;
|
|
39
38
|
height: auto !important;
|
|
40
39
|
width: auto !important;
|
|
41
40
|
overflow: visible !important;
|
|
42
41
|
}
|
|
42
|
+
|
|
43
|
+
// Always-open submenus are laid out inline rather than as a flyout,
|
|
44
|
+
// so the flyout minimum width would only make them jump when selected.
|
|
45
|
+
&:not(.open-always) > .wp-block-navigation__submenu-container {
|
|
46
|
+
min-width: 200px !important;
|
|
47
|
+
}
|
|
43
48
|
}
|
|
44
49
|
}
|
|
45
50
|
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
Button,
|
|
3
3
|
TextControl,
|
|
4
4
|
Notice,
|
|
5
|
-
CheckboxControl,
|
|
5
|
+
CheckboxControl as WCCheckboxControl,
|
|
6
6
|
__experimentalVStack as VStack,
|
|
7
7
|
__experimentalHStack as HStack,
|
|
8
8
|
} from '@wordpress/components';
|
|
@@ -127,7 +127,7 @@ export function LinkUIPageCreator( {
|
|
|
127
127
|
value={ title }
|
|
128
128
|
/>
|
|
129
129
|
|
|
130
|
-
<
|
|
130
|
+
<WCCheckboxControl
|
|
131
131
|
label={ __( 'Publish' ) }
|
|
132
132
|
help={ __(
|
|
133
133
|
"Turn off to save as a draft. Drafts won't appear on your site until published."
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
Button,
|
|
3
3
|
__experimentalToolsPanel as ToolsPanel,
|
|
4
4
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
5
|
-
CheckboxControl,
|
|
5
|
+
CheckboxControl as WCCheckboxControl,
|
|
6
6
|
TextControl,
|
|
7
7
|
TextareaControl as WCTextareaControl,
|
|
8
8
|
} from '@wordpress/components';
|
|
@@ -214,7 +214,7 @@ export function Controls( {
|
|
|
214
214
|
}
|
|
215
215
|
isShownByDefault
|
|
216
216
|
>
|
|
217
|
-
<
|
|
217
|
+
<WCCheckboxControl
|
|
218
218
|
label={ __( 'Open in new tab' ) }
|
|
219
219
|
checked={ opensInNewTab }
|
|
220
220
|
onChange={ ( value ) =>
|