@wordpress/block-library 11.1.0 → 11.2.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 +32 -0
- package/build/accordion-heading/block.json +1 -0
- package/build/archives/block.json +3 -0
- package/build/audio/edit.cjs +2 -1
- package/build/audio/edit.cjs.map +2 -2
- package/build/avatar/block.json +4 -0
- package/build/avatar/edit.cjs +31 -1
- package/build/avatar/edit.cjs.map +3 -3
- package/build/button/block.json +6 -0
- package/build/button/edit.cjs +9 -6
- package/build/button/edit.cjs.map +2 -2
- package/build/buttons/block.json +6 -1
- package/build/code/block.json +4 -0
- package/build/column/edit.cjs +5 -0
- package/build/column/edit.cjs.map +2 -2
- package/build/columns/block.json +4 -0
- package/build/columns/edit.cjs +21 -112
- package/build/columns/edit.cjs.map +3 -3
- package/build/comments/edit/placeholder.cjs +95 -87
- package/build/comments/edit/placeholder.cjs.map +2 -2
- package/build/comments-pagination/block.json +11 -0
- package/build/cover/block.json +2 -1
- package/build/cover/edit/index.cjs +26 -5
- package/build/cover/edit/index.cjs.map +2 -2
- package/build/cover/edit/inspector-controls.cjs +4 -1
- package/build/cover/edit/inspector-controls.cjs.map +2 -2
- package/build/cover/embed-video-utils.cjs +9 -8
- package/build/cover/embed-video-utils.cjs.map +2 -2
- package/build/cover/view.cjs +21 -0
- package/build/cover/view.cjs.map +7 -0
- package/build/details/block.json +3 -0
- package/build/embed/block.json +6 -1
- package/build/file/block.json +5 -0
- package/build/footnotes/block.json +4 -0
- package/build/gallery/block.json +13 -0
- package/build/gallery/dynamic-gallery.cjs +32 -93
- package/build/gallery/dynamic-gallery.cjs.map +3 -3
- package/build/gallery/edit.cjs +103 -40
- package/build/gallery/edit.cjs.map +2 -2
- package/build/gallery/order-controls.cjs +107 -0
- package/build/gallery/order-controls.cjs.map +7 -0
- package/build/gallery/order-images.cjs +92 -0
- package/build/gallery/order-images.cjs.map +7 -0
- package/build/gallery/order-options.cjs +62 -0
- package/build/gallery/order-options.cjs.map +7 -0
- package/build/gallery/use-dynamic-gallery.cjs +1 -7
- package/build/gallery/use-dynamic-gallery.cjs.map +2 -2
- package/build/gallery/use-get-media.cjs +2 -3
- package/build/gallery/use-get-media.cjs.map +2 -2
- package/build/group/edit.cjs +3 -3
- package/build/group/edit.cjs.map +2 -2
- package/build/heading/block.json +5 -0
- package/build/home-link/block.json +12 -0
- package/build/icon/components/custom-inserter/index.cjs +3 -1
- package/build/icon/components/custom-inserter/index.cjs.map +2 -2
- package/build/icon/edit.cjs +49 -5
- package/build/icon/edit.cjs.map +2 -2
- package/build/image/use-open-image-media-editor-modal.cjs +32 -28
- package/build/image/use-open-image-media-editor-modal.cjs.map +2 -2
- package/build/image/view.cjs +44 -50
- package/build/image/view.cjs.map +2 -2
- package/build/latest-comments/block.json +10 -0
- package/build/latest-posts/block.json +4 -0
- package/build/list/block.json +12 -1
- package/build/list-item/block.json +8 -1
- package/build/list-item/index.cjs +4 -0
- package/build/list-item/index.cjs.map +3 -3
- package/build/loginout/block.json +4 -0
- package/build/math/block.json +4 -0
- package/build/media-text/block.json +18 -0
- package/build/navigation-link/link-ui/index.cjs +33 -19
- package/build/navigation-link/link-ui/index.cjs.map +2 -2
- package/build/navigation-link/shared/index.cjs +5 -0
- package/build/navigation-link/shared/index.cjs.map +2 -2
- package/build/navigation-link/shared/use-block-suggestions.cjs +141 -0
- package/build/navigation-link/shared/use-block-suggestions.cjs.map +7 -0
- package/build/page-list/block.json +4 -0
- package/build/paragraph/block.json +1 -0
- package/build/post-author-biography/block.json +1 -0
- package/build/post-comments-form/block.json +5 -0
- package/build/post-content/block.json +2 -1
- package/build/post-excerpt/block.json +4 -0
- package/build/post-featured-image/block.json +1 -0
- package/build/post-featured-image/edit.cjs +1 -1
- package/build/post-featured-image/edit.cjs.map +2 -2
- package/build/post-terms/block.json +4 -0
- package/build/post-time-to-read/block.json +4 -0
- package/build/post-title/block.json +4 -0
- package/build/preformatted/block.json +4 -0
- package/build/pullquote/block.json +2 -1
- package/build/query-no-results/block.json +4 -0
- package/build/query-pagination/block.json +17 -0
- package/build/query-total/block.json +4 -0
- package/build/quote/block.json +2 -0
- package/build/read-more/block.json +5 -0
- package/build/rss/block.json +4 -0
- package/build/search/block.json +2 -1
- package/build/site-tagline/block.json +4 -0
- package/build/site-title/block.json +4 -0
- package/build/social-links/block.json +1 -0
- package/build/tab-list/block.json +4 -0
- package/build/tab-list/edit.cjs +3 -1
- package/build/tab-list/edit.cjs.map +3 -3
- package/build/tab-list/save.cjs +3 -1
- package/build/tab-list/save.cjs.map +3 -3
- package/build/tab-panels/block.json +3 -0
- package/build/tabs/block.json +3 -0
- package/build/term-count/block.json +5 -0
- package/build/term-description/block.json +4 -0
- package/build/term-name/block.json +6 -1
- package/build/term-template/block.json +4 -0
- package/build/utils/waveform-utils.cjs +2 -2
- package/build/utils/waveform-utils.cjs.map +2 -2
- package/build/verse/block.json +4 -0
- package/build/video/block.json +7 -1
- package/build/video/edit.cjs +10 -2
- package/build/video/edit.cjs.map +2 -2
- package/build-module/accordion-heading/block.json +1 -0
- package/build-module/archives/block.json +3 -0
- package/build-module/audio/edit.mjs +2 -1
- package/build-module/audio/edit.mjs.map +2 -2
- package/build-module/avatar/block.json +4 -0
- package/build-module/avatar/edit.mjs +33 -2
- package/build-module/avatar/edit.mjs.map +2 -2
- package/build-module/button/block.json +6 -0
- package/build-module/button/edit.mjs +11 -7
- package/build-module/button/edit.mjs.map +2 -2
- package/build-module/buttons/block.json +6 -1
- package/build-module/code/block.json +4 -0
- package/build-module/column/edit.mjs +5 -0
- package/build-module/column/edit.mjs.map +2 -2
- package/build-module/columns/block.json +4 -0
- package/build-module/columns/edit.mjs +22 -122
- package/build-module/columns/edit.mjs.map +2 -2
- package/build-module/comments/edit/placeholder.mjs +95 -87
- package/build-module/comments/edit/placeholder.mjs.map +2 -2
- package/build-module/comments-pagination/block.json +11 -0
- package/build-module/cover/block.json +2 -1
- package/build-module/cover/edit/index.mjs +32 -6
- package/build-module/cover/edit/index.mjs.map +2 -2
- package/build-module/cover/edit/inspector-controls.mjs +5 -2
- package/build-module/cover/edit/inspector-controls.mjs.map +2 -2
- package/build-module/cover/embed-video-utils.mjs +9 -8
- package/build-module/cover/embed-video-utils.mjs.map +2 -2
- package/build-module/cover/view.mjs +19 -0
- package/build-module/cover/view.mjs.map +7 -0
- package/build-module/details/block.json +3 -0
- package/build-module/embed/block.json +6 -1
- package/build-module/file/block.json +5 -0
- package/build-module/footnotes/block.json +4 -0
- package/build-module/gallery/block.json +13 -0
- package/build-module/gallery/dynamic-gallery.mjs +33 -97
- package/build-module/gallery/dynamic-gallery.mjs.map +2 -2
- package/build-module/gallery/edit.mjs +110 -42
- package/build-module/gallery/edit.mjs.map +2 -2
- package/build-module/gallery/order-controls.mjs +87 -0
- package/build-module/gallery/order-controls.mjs.map +7 -0
- package/build-module/gallery/order-images.mjs +66 -0
- package/build-module/gallery/order-images.mjs.map +7 -0
- package/build-module/gallery/order-options.mjs +33 -0
- package/build-module/gallery/order-options.mjs.map +7 -0
- package/build-module/gallery/use-dynamic-gallery.mjs +1 -7
- package/build-module/gallery/use-dynamic-gallery.mjs.map +2 -2
- package/build-module/gallery/use-get-media.mjs +2 -3
- package/build-module/gallery/use-get-media.mjs.map +2 -2
- package/build-module/group/edit.mjs +4 -4
- package/build-module/group/edit.mjs.map +2 -2
- package/build-module/heading/block.json +5 -0
- package/build-module/home-link/block.json +12 -0
- package/build-module/icon/components/custom-inserter/index.mjs +3 -1
- package/build-module/icon/components/custom-inserter/index.mjs.map +2 -2
- package/build-module/icon/edit.mjs +50 -6
- package/build-module/icon/edit.mjs.map +2 -2
- package/build-module/image/use-open-image-media-editor-modal.mjs +32 -28
- package/build-module/image/use-open-image-media-editor-modal.mjs.map +2 -2
- package/build-module/image/view.mjs +44 -50
- package/build-module/image/view.mjs.map +2 -2
- package/build-module/latest-comments/block.json +10 -0
- package/build-module/latest-posts/block.json +4 -0
- package/build-module/list/block.json +12 -1
- package/build-module/list-item/block.json +8 -1
- package/build-module/list-item/index.mjs +4 -0
- package/build-module/list-item/index.mjs.map +2 -2
- package/build-module/loginout/block.json +4 -0
- package/build-module/math/block.json +4 -0
- package/build-module/media-text/block.json +18 -0
- package/build-module/navigation-link/link-ui/index.mjs +39 -20
- package/build-module/navigation-link/link-ui/index.mjs.map +2 -2
- package/build-module/navigation-link/shared/index.mjs +6 -0
- package/build-module/navigation-link/shared/index.mjs.map +2 -2
- package/build-module/navigation-link/shared/use-block-suggestions.mjs +120 -0
- package/build-module/navigation-link/shared/use-block-suggestions.mjs.map +7 -0
- package/build-module/page-list/block.json +4 -0
- package/build-module/paragraph/block.json +1 -0
- package/build-module/post-author-biography/block.json +1 -0
- package/build-module/post-comments-form/block.json +5 -0
- package/build-module/post-content/block.json +2 -1
- package/build-module/post-excerpt/block.json +4 -0
- package/build-module/post-featured-image/block.json +1 -0
- package/build-module/post-featured-image/edit.mjs +1 -1
- package/build-module/post-featured-image/edit.mjs.map +2 -2
- package/build-module/post-terms/block.json +4 -0
- package/build-module/post-time-to-read/block.json +4 -0
- package/build-module/post-title/block.json +4 -0
- package/build-module/preformatted/block.json +4 -0
- package/build-module/pullquote/block.json +2 -1
- package/build-module/query-no-results/block.json +4 -0
- package/build-module/query-pagination/block.json +17 -0
- package/build-module/query-total/block.json +4 -0
- package/build-module/quote/block.json +2 -0
- package/build-module/read-more/block.json +5 -0
- package/build-module/rss/block.json +4 -0
- package/build-module/search/block.json +2 -1
- package/build-module/site-tagline/block.json +4 -0
- package/build-module/site-title/block.json +4 -0
- package/build-module/social-links/block.json +1 -0
- package/build-module/tab-list/block.json +4 -0
- package/build-module/tab-list/edit.mjs +4 -1
- package/build-module/tab-list/edit.mjs.map +2 -2
- package/build-module/tab-list/save.mjs +4 -1
- package/build-module/tab-list/save.mjs.map +2 -2
- package/build-module/tab-panels/block.json +3 -0
- package/build-module/tabs/block.json +3 -0
- package/build-module/term-count/block.json +5 -0
- package/build-module/term-description/block.json +4 -0
- package/build-module/term-name/block.json +6 -1
- package/build-module/term-template/block.json +4 -0
- package/build-module/utils/waveform-utils.mjs +1 -1
- package/build-module/utils/waveform-utils.mjs.map +1 -1
- package/build-module/verse/block.json +4 -0
- package/build-module/video/block.json +7 -1
- package/build-module/video/edit.mjs +10 -2
- package/build-module/video/edit.mjs.map +2 -2
- package/build-style/avatar/editor-rtl.css +4 -0
- package/build-style/avatar/editor.css +4 -0
- package/build-style/comments-pagination/style-rtl.css +3 -0
- package/build-style/comments-pagination/style.css +3 -0
- package/build-style/common-rtl.css +32 -1
- package/build-style/common.css +35 -2
- package/build-style/editor-rtl.css +11 -4
- package/build-style/editor.css +11 -4
- package/build-style/embed/style-rtl.css +4 -1
- package/build-style/embed/style.css +4 -1
- package/build-style/gallery/editor-rtl.css +1 -3
- package/build-style/gallery/editor.css +1 -3
- package/build-style/image/style-rtl.css +11 -2
- package/build-style/image/style.css +11 -2
- package/build-style/media-text/style-rtl.css +4 -1
- package/build-style/media-text/style.css +4 -1
- package/build-style/query-pagination/style-rtl.css +3 -0
- package/build-style/query-pagination/style.css +3 -0
- package/build-style/style-rtl.css +70 -9
- package/build-style/style.css +73 -10
- package/build-style/table/editor-rtl.css +6 -1
- package/build-style/table/editor.css +6 -1
- package/build-style/table/style-rtl.css +4 -2
- package/build-style/table/style.css +4 -2
- package/build-style/tag-cloud/style-rtl.css +1 -1
- package/build-style/tag-cloud/style.css +1 -1
- package/build-style/verse/style-rtl.css +8 -1
- package/build-style/verse/style.css +8 -1
- package/build-types/gallery/order-controls.d.ts +58 -0
- package/build-types/gallery/order-controls.d.ts.map +1 -0
- package/build-types/gallery/order-options.d.ts +67 -0
- package/build-types/gallery/order-options.d.ts.map +1 -0
- package/package.json +44 -41
- package/src/accordion-heading/README.md +1 -0
- package/src/accordion-heading/block.json +1 -0
- package/src/archives/README.md +2 -0
- package/src/archives/block.json +3 -0
- package/src/audio/edit.jsx +2 -1
- package/src/avatar/README.md +2 -0
- package/src/avatar/block.json +4 -0
- package/src/avatar/edit.jsx +48 -2
- package/src/avatar/editor.scss +4 -0
- package/src/avatar/index.php +5 -3
- package/src/breadcrumbs/index.php +1 -1
- package/src/button/README.md +4 -0
- package/src/button/block.json +6 -0
- package/src/button/edit.jsx +47 -52
- package/src/button/index.php +47 -0
- package/src/buttons/README.md +4 -0
- package/src/buttons/block.json +6 -1
- package/src/code/README.md +3 -0
- package/src/code/block.json +4 -0
- package/src/column/edit.jsx +6 -0
- package/src/columns/README.md +3 -0
- package/src/columns/block.json +4 -0
- package/src/columns/edit.jsx +1 -131
- package/src/comments/edit/placeholder.jsx +5 -1
- package/src/comments-pagination/README.md +4 -0
- package/src/comments-pagination/block.json +11 -0
- package/src/comments-pagination/style.scss +3 -0
- package/src/common.scss +38 -0
- package/src/cover/README.md +1 -0
- package/src/cover/block.json +2 -1
- package/src/cover/edit/index.jsx +38 -6
- package/src/cover/edit/inspector-controls.jsx +10 -1
- package/src/cover/embed-video-utils.js +18 -10
- package/src/cover/index.php +44 -15
- package/src/cover/test/edit.browser.test.js +182 -2
- package/src/cover/test/embed-video-utils.test.js +48 -0
- package/src/cover/view.js +22 -0
- package/src/details/README.md +2 -0
- package/src/details/block.json +3 -0
- package/src/embed/README.md +4 -0
- package/src/embed/block.json +6 -1
- package/src/embed/style.scss +7 -1
- package/src/file/README.md +4 -0
- package/src/file/block.json +5 -0
- package/src/footnotes/README.md +3 -0
- package/src/footnotes/block.json +4 -0
- package/src/gallery/README.md +13 -0
- package/src/gallery/block.json +13 -0
- package/src/gallery/dynamic-gallery.jsx +11 -91
- package/src/gallery/edit.jsx +146 -47
- package/src/gallery/editor.scss +5 -9
- package/src/gallery/order-controls.tsx +143 -0
- package/src/gallery/order-images.js +111 -0
- package/src/gallery/order-options.ts +75 -0
- package/src/gallery/test/edit.jsdom.test.js +87 -10
- package/src/gallery/test/order-images.js +162 -0
- package/src/gallery/use-dynamic-gallery.js +1 -9
- package/src/gallery/use-get-media.js +7 -2
- package/src/group/edit.jsx +5 -5
- package/src/heading/README.md +4 -0
- package/src/heading/block.json +5 -0
- package/src/home-link/README.md +6 -0
- package/src/home-link/block.json +12 -0
- package/src/icon/components/custom-inserter/index.jsx +5 -1
- package/src/icon/edit.jsx +68 -7
- package/src/icon/index.php +1 -1
- package/src/image/index.php +3 -4
- package/src/image/style.scss +14 -2
- package/src/image/test/use-open-image-media-editor-modal.jsdom.test.js +122 -60
- package/src/image/use-open-image-media-editor-modal.js +37 -41
- package/src/image/view.js +64 -68
- package/src/latest-comments/README.md +3 -0
- package/src/latest-comments/block.json +10 -0
- package/src/latest-posts/README.md +3 -0
- package/src/latest-posts/block.json +4 -0
- package/src/list/README.md +6 -0
- package/src/list/block.json +12 -1
- package/src/list-item/README.md +6 -0
- package/src/list-item/block.json +8 -1
- package/src/list-item/index.js +5 -0
- package/src/loginout/README.md +3 -0
- package/src/loginout/block.json +4 -0
- package/src/math/README.md +3 -0
- package/src/math/block.json +4 -0
- package/src/media-text/README.md +17 -0
- package/src/media-text/block.json +18 -0
- package/src/media-text/style.scss +5 -1
- package/src/navigation/test/use-navigation-menu.jsdom.test.js +1 -1
- package/src/navigation-link/README.md +1 -1
- package/src/navigation-link/link-ui/index.jsx +60 -27
- package/src/navigation-link/link-ui/test/get-suggestions-query.jsdom.test.js +67 -0
- package/src/navigation-link/shared/index.js +4 -0
- package/src/navigation-link/shared/test/use-block-suggestions.jsdom.test.js +158 -0
- package/src/navigation-link/shared/test/use-entity-binding.jsdom.test.js +1 -7
- package/src/navigation-link/shared/use-block-suggestions.js +192 -0
- package/src/page-list/README.md +3 -0
- package/src/page-list/block.json +4 -0
- package/src/paragraph/README.md +1 -0
- package/src/paragraph/block.json +1 -0
- package/src/playlist/test/edit-component.jsdom.test.jsx +11 -11
- package/src/playlist-track/test/edit.jsdom.test.jsx +3 -3
- package/src/post-author-biography/README.md +1 -0
- package/src/post-author-biography/block.json +1 -0
- package/src/post-comments-form/README.md +3 -0
- package/src/post-comments-form/block.json +5 -0
- package/src/post-content/README.md +1 -0
- package/src/post-content/block.json +2 -1
- package/src/post-excerpt/README.md +3 -0
- package/src/post-excerpt/block.json +4 -0
- package/src/post-featured-image/block.json +1 -0
- package/src/post-featured-image/edit.jsx +2 -2
- package/src/post-terms/README.md +3 -0
- package/src/post-terms/block.json +4 -0
- package/src/post-time-to-read/README.md +3 -0
- package/src/post-time-to-read/block.json +4 -0
- package/src/post-title/README.md +3 -0
- package/src/post-title/block.json +4 -0
- package/src/preformatted/README.md +3 -0
- package/src/preformatted/block.json +4 -0
- package/src/pullquote/README.md +1 -0
- package/src/pullquote/block.json +2 -1
- package/src/query-no-results/README.md +3 -0
- package/src/query-no-results/block.json +4 -0
- package/src/query-pagination/README.md +4 -0
- package/src/query-pagination/block.json +17 -0
- package/src/query-pagination/style.scss +3 -0
- package/src/query-total/README.md +3 -0
- package/src/query-total/block.json +4 -0
- package/src/quote/README.md +2 -0
- package/src/quote/block.json +2 -0
- package/src/read-more/README.md +3 -0
- package/src/read-more/block.json +5 -0
- package/src/rss/README.md +3 -0
- package/src/rss/block.json +4 -0
- package/src/search/README.md +1 -0
- package/src/search/block.json +2 -1
- package/src/site-tagline/README.md +3 -0
- package/src/site-tagline/block.json +4 -0
- package/src/site-title/README.md +3 -0
- package/src/site-title/block.json +4 -0
- package/src/social-links/README.md +1 -0
- package/src/social-links/block.json +1 -0
- package/src/tab-list/README.md +2 -0
- package/src/tab-list/block.json +4 -0
- package/src/tab-list/edit.jsx +3 -0
- package/src/tab-list/save.jsx +3 -0
- package/src/tab-panels/README.md +2 -0
- package/src/tab-panels/block.json +3 -0
- package/src/table/editor.scss +8 -2
- package/src/table/style.scss +4 -4
- package/src/tabs/README.md +2 -0
- package/src/tabs/block.json +3 -0
- package/src/tag-cloud/style.scss +1 -1
- package/src/template-part/index.php +16 -3
- package/src/term-count/README.md +4 -0
- package/src/term-count/block.json +5 -0
- package/src/term-description/README.md +3 -0
- package/src/term-description/block.json +4 -0
- package/src/term-name/README.md +4 -0
- package/src/term-name/block.json +6 -1
- package/src/term-template/README.md +3 -0
- package/src/term-template/block.json +4 -0
- package/src/utils/test/waveform-player-auto-init.jsdom.test.js +25 -0
- package/src/utils/test/waveform-player-dependency.jsdom.test.js +7 -60
- package/src/utils/test/waveform-utils.browser.test.js +3 -15
- package/src/utils/waveform-utils.js +1 -1
- package/src/verse/README.md +4 -0
- package/src/verse/block.json +4 -0
- package/src/verse/style.scss +11 -2
- package/src/video/README.md +4 -0
- package/src/video/block.json +7 -1
- package/src/video/edit.jsx +13 -2
- package/build/columns/utils.cjs +0 -112
- package/build/columns/utils.cjs.map +0 -7
- package/build-module/columns/utils.mjs +0 -78
- package/build-module/columns/utils.mjs.map +0 -7
- package/src/columns/test/utils.js +0 -331
- package/src/columns/utils.js +0 -176
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { BlockIcon } from '@wordpress/block-editor';
|
|
3
|
+
import {
|
|
4
|
+
addBlockSuggestions,
|
|
5
|
+
BLOCK_SUGGESTION_TYPE,
|
|
6
|
+
isBlockSuggestion,
|
|
7
|
+
} from '../use-block-suggestions';
|
|
8
|
+
|
|
9
|
+
const homeLink = {
|
|
10
|
+
id: 'core/home-link',
|
|
11
|
+
name: 'core/home-link',
|
|
12
|
+
title: 'Home Link',
|
|
13
|
+
icon: { src: 'home' },
|
|
14
|
+
};
|
|
15
|
+
const pageList = {
|
|
16
|
+
id: 'core/page-list',
|
|
17
|
+
name: 'core/page-list',
|
|
18
|
+
title: 'Page List',
|
|
19
|
+
icon: { src: 'list' },
|
|
20
|
+
keywords: [ 'menu', 'navigation' ],
|
|
21
|
+
};
|
|
22
|
+
const pageLinkVariation = {
|
|
23
|
+
id: 'core/navigation-link/page',
|
|
24
|
+
name: 'core/navigation-link',
|
|
25
|
+
title: 'Page Link',
|
|
26
|
+
icon: { src: 'page' },
|
|
27
|
+
};
|
|
28
|
+
const homePage = {
|
|
29
|
+
id: 1,
|
|
30
|
+
title: 'Home Office',
|
|
31
|
+
type: 'page',
|
|
32
|
+
kind: 'post-type',
|
|
33
|
+
url: '/home-office',
|
|
34
|
+
};
|
|
35
|
+
const menuPage = {
|
|
36
|
+
id: 2,
|
|
37
|
+
title: 'Menu',
|
|
38
|
+
type: 'page',
|
|
39
|
+
kind: 'post-type',
|
|
40
|
+
url: '/menu',
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
describe( 'addBlockSuggestions', () => {
|
|
44
|
+
it( 'describes a block as a suggestion that is not a link', () => {
|
|
45
|
+
const [ suggestion ] = addBlockSuggestions( [], [ homeLink ], 'Home' );
|
|
46
|
+
|
|
47
|
+
expect( suggestion ).toEqual( {
|
|
48
|
+
id: 'core/home-link',
|
|
49
|
+
blockItemId: 'core/home-link',
|
|
50
|
+
type: BLOCK_SUGGESTION_TYPE,
|
|
51
|
+
title: 'Home Link',
|
|
52
|
+
icon: expect.anything(),
|
|
53
|
+
typeLabel: 'Block',
|
|
54
|
+
} );
|
|
55
|
+
} );
|
|
56
|
+
|
|
57
|
+
// LinkControl renders an icon it is given as is, so the block's icon
|
|
58
|
+
// object is turned into an element here, where blocks are known about.
|
|
59
|
+
it( 'renders the block icon the way the inserter does', () => {
|
|
60
|
+
const [ suggestion ] = addBlockSuggestions( [], [ homeLink ], 'Home' );
|
|
61
|
+
|
|
62
|
+
expect( suggestion.icon.type ).toBe( BlockIcon );
|
|
63
|
+
expect( suggestion.icon.props.icon ).toBe( homeLink.icon );
|
|
64
|
+
} );
|
|
65
|
+
|
|
66
|
+
it( 'puts a block whose title starts with the search before the links', () => {
|
|
67
|
+
const suggestions = addBlockSuggestions(
|
|
68
|
+
[ homePage ],
|
|
69
|
+
[ homeLink ],
|
|
70
|
+
'home'
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
expect( suggestions.map( ( { title } ) => title ) ).toEqual( [
|
|
74
|
+
'Home Link',
|
|
75
|
+
'Home Office',
|
|
76
|
+
] );
|
|
77
|
+
} );
|
|
78
|
+
|
|
79
|
+
it( 'puts a block that matches any other way after the links', () => {
|
|
80
|
+
// Page List matches "menu" by keyword, not by title.
|
|
81
|
+
const suggestions = addBlockSuggestions(
|
|
82
|
+
[ menuPage ],
|
|
83
|
+
[ pageList ],
|
|
84
|
+
'menu'
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
expect( suggestions.map( ( { title } ) => title ) ).toEqual( [
|
|
88
|
+
'Menu',
|
|
89
|
+
'Page List',
|
|
90
|
+
] );
|
|
91
|
+
} );
|
|
92
|
+
|
|
93
|
+
it( 'leaves out the link variations, which the links already cover', () => {
|
|
94
|
+
const suggestions = addBlockSuggestions(
|
|
95
|
+
[],
|
|
96
|
+
[ pageLinkVariation ],
|
|
97
|
+
'page'
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
expect( suggestions ).toEqual( [] );
|
|
101
|
+
} );
|
|
102
|
+
|
|
103
|
+
it( 'leaves out blocks that cannot be inserted', () => {
|
|
104
|
+
const suggestions = addBlockSuggestions(
|
|
105
|
+
[],
|
|
106
|
+
[ { ...homeLink, isDisabled: true } ],
|
|
107
|
+
'home'
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
expect( suggestions ).toEqual( [] );
|
|
111
|
+
} );
|
|
112
|
+
|
|
113
|
+
it( 'adds every block that matches', () => {
|
|
114
|
+
const items = Array.from( { length: 5 }, ( _, index ) => ( {
|
|
115
|
+
id: `test/home-${ index }`,
|
|
116
|
+
name: `test/home-${ index }`,
|
|
117
|
+
title: `Home ${ index }`,
|
|
118
|
+
} ) );
|
|
119
|
+
|
|
120
|
+
expect( addBlockSuggestions( [], items, 'home' ) ).toHaveLength( 5 );
|
|
121
|
+
} );
|
|
122
|
+
|
|
123
|
+
it( 'returns the links unchanged when no block matches', () => {
|
|
124
|
+
const suggestions = [ homePage ];
|
|
125
|
+
|
|
126
|
+
expect(
|
|
127
|
+
addBlockSuggestions( suggestions, [ homeLink ], 'office' )
|
|
128
|
+
).toBe( suggestions );
|
|
129
|
+
} );
|
|
130
|
+
|
|
131
|
+
it( 'returns the links unchanged when nothing is searched', () => {
|
|
132
|
+
const suggestions = [ homePage ];
|
|
133
|
+
|
|
134
|
+
expect( addBlockSuggestions( suggestions, [ homeLink ], '' ) ).toBe(
|
|
135
|
+
suggestions
|
|
136
|
+
);
|
|
137
|
+
} );
|
|
138
|
+
|
|
139
|
+
// A site can register a post type called "block", whose results arrive
|
|
140
|
+
// with that type, so a block is recognized by something only it carries.
|
|
141
|
+
it( 'tells a block apart from a post of a type called "block"', () => {
|
|
142
|
+
const [ blockSuggestion ] = addBlockSuggestions(
|
|
143
|
+
[],
|
|
144
|
+
[ homeLink ],
|
|
145
|
+
'Home'
|
|
146
|
+
);
|
|
147
|
+
const postOfTypeBlock = {
|
|
148
|
+
id: 12,
|
|
149
|
+
title: 'Home',
|
|
150
|
+
type: 'block',
|
|
151
|
+
kind: 'post-type',
|
|
152
|
+
url: '/block/home',
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
expect( isBlockSuggestion( blockSuggestion ) ).toBe( true );
|
|
156
|
+
expect( isBlockSuggestion( postOfTypeBlock ) ).toBe( false );
|
|
157
|
+
} );
|
|
158
|
+
} );
|
|
@@ -326,10 +326,6 @@ describe( 'useEntityBinding', () => {
|
|
|
326
326
|
} );
|
|
327
327
|
|
|
328
328
|
it( 'handles invalid kind gracefully in createBinding', () => {
|
|
329
|
-
const consoleSpy = vi
|
|
330
|
-
.spyOn( console, 'warn' )
|
|
331
|
-
.mockImplementation( () => {} );
|
|
332
|
-
|
|
333
329
|
const attributes = {
|
|
334
330
|
metadata: {},
|
|
335
331
|
id: null,
|
|
@@ -347,15 +343,13 @@ describe( 'useEntityBinding', () => {
|
|
|
347
343
|
result.current.createBinding();
|
|
348
344
|
} );
|
|
349
345
|
|
|
350
|
-
expect(
|
|
346
|
+
expect( console ).toHaveWarnedWith(
|
|
351
347
|
'Failed to create entity binding:',
|
|
352
348
|
expect.stringContaining( 'Invalid kind "invalid-kind"' )
|
|
353
349
|
);
|
|
354
350
|
|
|
355
351
|
// Should not call updateBlockBindings when validation fails
|
|
356
352
|
expect( mockUpdateBlockBindings ).not.toHaveBeenCalled();
|
|
357
|
-
|
|
358
|
-
consoleSpy.mockRestore();
|
|
359
353
|
} );
|
|
360
354
|
} );
|
|
361
355
|
} );
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
2
|
+
import { speak } from '@wordpress/a11y';
|
|
3
|
+
import { createElement, useCallback } from '@wordpress/element';
|
|
4
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
5
|
+
import {
|
|
6
|
+
createBlock,
|
|
7
|
+
createBlocksFromInnerBlocksTemplate,
|
|
8
|
+
} from '@wordpress/blocks';
|
|
9
|
+
import {
|
|
10
|
+
BlockIcon,
|
|
11
|
+
store as blockEditorStore,
|
|
12
|
+
privateApis as blockEditorPrivateApis,
|
|
13
|
+
} from '@wordpress/block-editor';
|
|
14
|
+
import { unlock } from '../../lock-unlock';
|
|
15
|
+
|
|
16
|
+
const { searchItems, normalizeString } = unlock( blockEditorPrivateApis );
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The `type` of a suggestion that inserts a block rather than setting a link.
|
|
20
|
+
*/
|
|
21
|
+
export const BLOCK_SUGGESTION_TYPE = 'block';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Whether a suggestion inserts a block rather than setting a link.
|
|
25
|
+
*
|
|
26
|
+
* The `type` alone is not enough: a site can register a post type called
|
|
27
|
+
* "block", whose results arrive with that type. Only a block suggestion
|
|
28
|
+
* carries the inserter item it was made from.
|
|
29
|
+
*
|
|
30
|
+
* @param {Object} suggestion A link suggestion.
|
|
31
|
+
* @return {boolean} Whether it is a block suggestion.
|
|
32
|
+
*/
|
|
33
|
+
export function isBlockSuggestion( suggestion ) {
|
|
34
|
+
return (
|
|
35
|
+
suggestion?.type === BLOCK_SUGGESTION_TYPE &&
|
|
36
|
+
typeof suggestion.blockItemId === 'string'
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The link variations are left out: searching already finds the pages, posts
|
|
42
|
+
* and terms they would link to.
|
|
43
|
+
*/
|
|
44
|
+
const EXCLUDED_BLOCK_NAMES = [ 'core/navigation-link' ];
|
|
45
|
+
|
|
46
|
+
// Match on what a block is called, not on its description or category, which
|
|
47
|
+
// would list blocks for words that only happen to describe them.
|
|
48
|
+
const SEARCH_FIELDS = [
|
|
49
|
+
{ get: ( item ) => item.title },
|
|
50
|
+
{ get: ( item ) => item.keywords },
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Adds the blocks that match a search to the link suggestions.
|
|
55
|
+
*
|
|
56
|
+
* A block whose title starts with the search is what was asked for by name,
|
|
57
|
+
* so it goes before the links. Any other matching block goes after them.
|
|
58
|
+
*
|
|
59
|
+
* @param {Array} suggestions Link suggestions.
|
|
60
|
+
* @param {Array} blockItems Inserter items the Navigation allows.
|
|
61
|
+
* @param {string} searchTerm What the user typed.
|
|
62
|
+
* @return {Array} The suggestions, with any matching blocks added.
|
|
63
|
+
*/
|
|
64
|
+
export function addBlockSuggestions( suggestions, blockItems, searchTerm ) {
|
|
65
|
+
if ( ! searchTerm?.trim() ) {
|
|
66
|
+
return suggestions;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const matches = searchItems( blockItems, searchTerm, {
|
|
70
|
+
fields: SEARCH_FIELDS,
|
|
71
|
+
filter: ( item ) =>
|
|
72
|
+
! item.isDisabled && ! EXCLUDED_BLOCK_NAMES.includes( item.name ),
|
|
73
|
+
} );
|
|
74
|
+
|
|
75
|
+
if ( ! matches.length ) {
|
|
76
|
+
return suggestions;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const search = normalizeString( searchTerm.trim() );
|
|
80
|
+
const before = [];
|
|
81
|
+
const after = [];
|
|
82
|
+
|
|
83
|
+
for ( const item of matches ) {
|
|
84
|
+
const suggestion = {
|
|
85
|
+
id: item.id,
|
|
86
|
+
blockItemId: item.id,
|
|
87
|
+
type: BLOCK_SUGGESTION_TYPE,
|
|
88
|
+
title: item.title,
|
|
89
|
+
icon: createElement( BlockIcon, { icon: item.icon } ),
|
|
90
|
+
typeLabel: __( 'Block' ),
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
if ( normalizeString( item.title ).startsWith( search ) ) {
|
|
94
|
+
before.push( suggestion );
|
|
95
|
+
} else {
|
|
96
|
+
after.push( suggestion );
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return [ ...before, ...suggestions, ...after ];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Lists the blocks a Navigation allows in a link's search results, and
|
|
105
|
+
* inserts the one that is chosen.
|
|
106
|
+
*
|
|
107
|
+
* The allowed blocks are read when a search runs, not subscribed to, so an
|
|
108
|
+
* open link UI does no work as the editor changes.
|
|
109
|
+
*
|
|
110
|
+
* @param {Object} options Hook options.
|
|
111
|
+
* @param {string} options.clientId Client ID of the link or submenu.
|
|
112
|
+
* @param {boolean} options.isEnabled Whether to list blocks at all.
|
|
113
|
+
* @param {Function=} options.onBlockInsert Called with the inserted block by a
|
|
114
|
+
* caller that tracks the new link,
|
|
115
|
+
* such as the list view.
|
|
116
|
+
* @param {Function=} options.onClose Closes the link UI.
|
|
117
|
+
* @return {{ transformSuggestions: Function|undefined, insertBlockFromSuggestion: Function }}
|
|
118
|
+
* The `transformSuggestions` to give LinkControl, and the handler for a chosen
|
|
119
|
+
* block suggestion.
|
|
120
|
+
*/
|
|
121
|
+
export function useBlockSuggestions( {
|
|
122
|
+
clientId,
|
|
123
|
+
isEnabled,
|
|
124
|
+
onBlockInsert,
|
|
125
|
+
onClose,
|
|
126
|
+
} ) {
|
|
127
|
+
const {
|
|
128
|
+
getBlockIndex,
|
|
129
|
+
getBlockOrder,
|
|
130
|
+
getBlockRootClientId,
|
|
131
|
+
getInserterItems,
|
|
132
|
+
} = useSelect( blockEditorStore );
|
|
133
|
+
const { insertBlock, replaceBlock } = useDispatch( blockEditorStore );
|
|
134
|
+
|
|
135
|
+
const transformSuggestions = useCallback(
|
|
136
|
+
( suggestions, { isInitialSuggestions, searchTerm } ) =>
|
|
137
|
+
isInitialSuggestions
|
|
138
|
+
? suggestions
|
|
139
|
+
: addBlockSuggestions(
|
|
140
|
+
suggestions,
|
|
141
|
+
getInserterItems( getBlockRootClientId( clientId ) ),
|
|
142
|
+
searchTerm
|
|
143
|
+
),
|
|
144
|
+
[ clientId, getBlockRootClientId, getInserterItems ]
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
const insertBlockFromSuggestion = ( itemId ) => {
|
|
148
|
+
const rootClientId = getBlockRootClientId( clientId );
|
|
149
|
+
const item = getInserterItems( rootClientId ).find(
|
|
150
|
+
( { id } ) => id === itemId
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
if ( ! item ) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const block = createBlock(
|
|
158
|
+
item.name,
|
|
159
|
+
item.initialAttributes,
|
|
160
|
+
createBlocksFromInnerBlocksTemplate( item.innerBlocks )
|
|
161
|
+
);
|
|
162
|
+
const index = getBlockIndex( clientId );
|
|
163
|
+
|
|
164
|
+
if ( onBlockInsert ) {
|
|
165
|
+
// A caller that tracks the new link, such as the list view, removes
|
|
166
|
+
// it itself once told about the block, as with the "Add block" pane.
|
|
167
|
+
insertBlock( block, index, rootClientId, false );
|
|
168
|
+
onBlockInsert( block );
|
|
169
|
+
} else if ( getBlockOrder( clientId ).length ) {
|
|
170
|
+
// A submenu keeps its items, so the block goes before it, where the
|
|
171
|
+
// "Add block" pane puts it.
|
|
172
|
+
insertBlock( block, index, rootClientId );
|
|
173
|
+
onClose?.();
|
|
174
|
+
} else {
|
|
175
|
+
// An empty link is replaced by the block.
|
|
176
|
+
replaceBlock( clientId, block );
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
speak(
|
|
180
|
+
sprintf(
|
|
181
|
+
/* translators: %s: The title of the block that was added. */
|
|
182
|
+
__( '%s block added.' ),
|
|
183
|
+
item.title
|
|
184
|
+
)
|
|
185
|
+
);
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
return {
|
|
189
|
+
transformSuggestions: isEnabled ? transformSuggestions : undefined,
|
|
190
|
+
insertBlockFromSuggestion,
|
|
191
|
+
};
|
|
192
|
+
}
|
package/src/page-list/README.md
CHANGED
|
@@ -47,6 +47,9 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
47
47
|
- `padding`: `true`
|
|
48
48
|
- `margin`: `true`
|
|
49
49
|
- [`shadow`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#shadow): `true`
|
|
50
|
+
- [`dimensions`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#dimensions):
|
|
51
|
+
- `minHeight`: `true`
|
|
52
|
+
- `minWidth`: `true`
|
|
50
53
|
- [`contentRole`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#contentrole): `true`
|
|
51
54
|
|
|
52
55
|
## Context
|
package/src/page-list/block.json
CHANGED
package/src/paragraph/README.md
CHANGED
|
@@ -28,6 +28,7 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
28
28
|
- [`splitting`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#splitting): `true`
|
|
29
29
|
- [`anchor`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#anchor): `true`
|
|
30
30
|
- [`className`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#classname): `false`
|
|
31
|
+
- [`shadow`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#shadow): `true`
|
|
31
32
|
- [`color`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color):
|
|
32
33
|
- [`gradients`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-gradients): `true`
|
|
33
34
|
- [`link`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-link): `true`
|
package/src/paragraph/block.json
CHANGED
|
@@ -9,7 +9,7 @@ let mediaReplaceFlowProps;
|
|
|
9
9
|
// test can look at what ended up in the tracklist.
|
|
10
10
|
let mockTracks = [];
|
|
11
11
|
|
|
12
|
-
vi.mock( '@wordpress/block-editor', () => ( {
|
|
12
|
+
vi.mock( import( '@wordpress/block-editor' ), () => ( {
|
|
13
13
|
store: {},
|
|
14
14
|
BlockControls: ( { children } ) => <div>{ children }</div>,
|
|
15
15
|
BlockIcon: () => <span />,
|
|
@@ -52,7 +52,7 @@ vi.mock( '@wordpress/block-editor', () => ( {
|
|
|
52
52
|
} ),
|
|
53
53
|
} ) );
|
|
54
54
|
|
|
55
|
-
vi.mock( '@wordpress/blocks', () => ( {
|
|
55
|
+
vi.mock( import( '@wordpress/blocks' ), () => ( {
|
|
56
56
|
createBlock: vi.fn( ( name, attributes ) => ( {
|
|
57
57
|
name,
|
|
58
58
|
attributes,
|
|
@@ -60,11 +60,11 @@ vi.mock( '@wordpress/blocks', () => ( {
|
|
|
60
60
|
} ) ),
|
|
61
61
|
} ) );
|
|
62
62
|
|
|
63
|
-
vi.mock( '@wordpress/blob', () => ( {
|
|
63
|
+
vi.mock( import( '@wordpress/blob' ), () => ( {
|
|
64
64
|
createBlobURL: vi.fn( () => 'blob:track' ),
|
|
65
65
|
} ) );
|
|
66
66
|
|
|
67
|
-
vi.mock( '@wordpress/components', () => ( {
|
|
67
|
+
vi.mock( import( '@wordpress/components' ), () => ( {
|
|
68
68
|
Disabled: ( { children } ) => <div>{ children }</div>,
|
|
69
69
|
SelectControl: () => <div />,
|
|
70
70
|
ToggleControl: () => <div />,
|
|
@@ -72,33 +72,33 @@ vi.mock( '@wordpress/components', () => ( {
|
|
|
72
72
|
__experimentalToolsPanelItem: ( { children } ) => <div>{ children }</div>,
|
|
73
73
|
} ) );
|
|
74
74
|
|
|
75
|
-
vi.mock( '@wordpress/data', () => ( {
|
|
75
|
+
vi.mock( import( '@wordpress/data' ), () => ( {
|
|
76
76
|
useDispatch: vi.fn(),
|
|
77
77
|
useSelect: vi.fn(),
|
|
78
78
|
} ) );
|
|
79
79
|
|
|
80
|
-
vi.mock( '@wordpress/i18n', () => ( {
|
|
80
|
+
vi.mock( import( '@wordpress/i18n' ), () => ( {
|
|
81
81
|
__: ( text ) => text,
|
|
82
82
|
_x: ( text ) => text,
|
|
83
83
|
} ) );
|
|
84
84
|
|
|
85
|
-
vi.mock( '@wordpress/icons', () => ( {
|
|
85
|
+
vi.mock( import( '@wordpress/icons' ), () => ( {
|
|
86
86
|
playlist: 'playlist',
|
|
87
87
|
} ) );
|
|
88
88
|
|
|
89
|
-
vi.mock( '@wordpress/notices', () => ( {
|
|
89
|
+
vi.mock( import( '@wordpress/notices' ), () => ( {
|
|
90
90
|
store: {},
|
|
91
91
|
} ) );
|
|
92
92
|
|
|
93
|
-
vi.mock( '../../utils/caption', () => ( {
|
|
93
|
+
vi.mock( import( '../../utils/caption' ), () => ( {
|
|
94
94
|
Caption: () => <figcaption />,
|
|
95
95
|
} ) );
|
|
96
96
|
|
|
97
|
-
vi.mock( '../../utils/hooks', () => ( {
|
|
97
|
+
vi.mock( import( '../../utils/hooks' ), () => ( {
|
|
98
98
|
useToolsPanelDropdownMenuProps: () => ( {} ),
|
|
99
99
|
} ) );
|
|
100
100
|
|
|
101
|
-
vi.mock( '../../utils/waveform-player', () => ( {
|
|
101
|
+
vi.mock( import( '../../utils/waveform-player' ), () => ( {
|
|
102
102
|
WaveformPlayer: () => <div />,
|
|
103
103
|
} ) );
|
|
104
104
|
|
|
@@ -7,7 +7,7 @@ import { useUploadMediaFromBlobURL } from '../../utils/hooks';
|
|
|
7
7
|
|
|
8
8
|
let mockMediaReplaceFlowProps;
|
|
9
9
|
|
|
10
|
-
vi.mock( '@wordpress/block-editor', async () => {
|
|
10
|
+
vi.mock( import( '@wordpress/block-editor' ), async () => {
|
|
11
11
|
const { default: PlainText } =
|
|
12
12
|
await import( '../../../../block-editor/src/components/plain-text' );
|
|
13
13
|
|
|
@@ -44,11 +44,11 @@ vi.mock( import( '@wordpress/data' ), async ( importOriginal ) => {
|
|
|
44
44
|
} );
|
|
45
45
|
} );
|
|
46
46
|
|
|
47
|
-
vi.mock( '@wordpress/notices', () => ( {
|
|
47
|
+
vi.mock( import( '@wordpress/notices' ), () => ( {
|
|
48
48
|
store: 'core/notices',
|
|
49
49
|
} ) );
|
|
50
50
|
|
|
51
|
-
vi.mock( '../../utils/hooks', () => ( {
|
|
51
|
+
vi.mock( import( '../../utils/hooks' ), () => ( {
|
|
52
52
|
useUploadMediaFromBlobURL: vi.fn(),
|
|
53
53
|
} ) );
|
|
54
54
|
|
|
@@ -32,6 +32,7 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
32
32
|
- [`lineHeight`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-lineheight): `true`
|
|
33
33
|
- [`textAlign`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-textalign): `true`
|
|
34
34
|
- `textColumns`: `true`
|
|
35
|
+
- `textIndent`: `true`
|
|
35
36
|
- [`interactivity`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#interactivity):
|
|
36
37
|
- `clientNavigation`: `true`
|
|
37
38
|
|
|
@@ -29,6 +29,9 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
29
29
|
- [`gradients`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-gradients): `true`
|
|
30
30
|
- [`heading`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-heading): `true`
|
|
31
31
|
- [`link`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-link): `true`
|
|
32
|
+
- [`dimensions`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#dimensions):
|
|
33
|
+
- `minHeight`: `true`
|
|
34
|
+
- `minWidth`: `true`
|
|
32
35
|
- [`spacing`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#spacing):
|
|
33
36
|
- `margin`: `true`
|
|
34
37
|
- `padding`: `true`
|
|
@@ -29,6 +29,10 @@
|
|
|
29
29
|
"text": true
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
|
+
"dimensions": {
|
|
33
|
+
"minHeight": true,
|
|
34
|
+
"minWidth": true
|
|
35
|
+
},
|
|
32
36
|
"spacing": {
|
|
33
37
|
"margin": true,
|
|
34
38
|
"padding": true
|
|
@@ -37,6 +41,7 @@
|
|
|
37
41
|
"fontSize": true,
|
|
38
42
|
"lineHeight": true,
|
|
39
43
|
"textAlign": true,
|
|
44
|
+
"__experimentalFontFamily": true,
|
|
40
45
|
"__experimentalFontStyle": true,
|
|
41
46
|
"__experimentalFontWeight": true,
|
|
42
47
|
"__experimentalLetterSpacing": true,
|
|
@@ -30,6 +30,7 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
30
30
|
- `gradient`: `true`
|
|
31
31
|
- [`dimensions`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#dimensions):
|
|
32
32
|
- `minHeight`: `true`
|
|
33
|
+
- `minWidth`: `true`
|
|
33
34
|
- [`shadow`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#shadow): `true`
|
|
34
35
|
- [`spacing`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#spacing):
|
|
35
36
|
- `blockGap`: `true`
|
|
@@ -35,6 +35,9 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
35
35
|
- [`spacing`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#spacing):
|
|
36
36
|
- `margin`: `true`
|
|
37
37
|
- `padding`: `true`
|
|
38
|
+
- [`dimensions`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#dimensions):
|
|
39
|
+
- `minHeight`: `true`
|
|
40
|
+
- `minWidth`: `true`
|
|
38
41
|
- [`typography`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography):
|
|
39
42
|
- [`fontSize`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-fontsize): `true`
|
|
40
43
|
- [`lineHeight`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-lineheight): `true`
|
|
@@ -507,8 +507,8 @@ export default function PostFeaturedImageEdit( {
|
|
|
507
507
|
</BlockControls>
|
|
508
508
|
) }
|
|
509
509
|
<figure { ...blockProps }>
|
|
510
|
-
{ /*
|
|
511
|
-
{ !! isLink ? (
|
|
510
|
+
{ /* Wrap the image in an <a> to pick up the theme's inherited link styles. Never wrap the placeholder, since its buttons must not sit inside an anchor. */ }
|
|
511
|
+
{ !! isLink && ( featuredImage || temporaryURL ) ? (
|
|
512
512
|
<a href={ postPermalink } target={ linkTarget }>
|
|
513
513
|
{ image }
|
|
514
514
|
</a>
|
package/src/post-terms/README.md
CHANGED
|
@@ -32,6 +32,9 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
32
32
|
- [`color`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color):
|
|
33
33
|
- [`gradients`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-gradients): `true`
|
|
34
34
|
- [`link`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-link): `true`
|
|
35
|
+
- [`dimensions`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#dimensions):
|
|
36
|
+
- `minHeight`: `true`
|
|
37
|
+
- `minWidth`: `true`
|
|
35
38
|
- [`shadow`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#shadow): `true`
|
|
36
39
|
- [`spacing`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#spacing):
|
|
37
40
|
- `margin`: `true`
|
|
@@ -29,6 +29,9 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
29
29
|
- `gradient`: `true`
|
|
30
30
|
- [`color`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color):
|
|
31
31
|
- [`gradients`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-gradients): `true`
|
|
32
|
+
- [`dimensions`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#dimensions):
|
|
33
|
+
- `minHeight`: `true`
|
|
34
|
+
- `minWidth`: `true`
|
|
32
35
|
- [`html`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#html): `false`
|
|
33
36
|
- [`shadow`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#shadow): `true`
|
|
34
37
|
- [`spacing`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#spacing):
|