@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
package/src/list/README.md
CHANGED
|
@@ -37,12 +37,17 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
37
37
|
- [`typography`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography):
|
|
38
38
|
- [`fontSize`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-fontsize): `true`
|
|
39
39
|
- [`lineHeight`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-lineheight): `true`
|
|
40
|
+
- [`background`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#background):
|
|
41
|
+
- `backgroundImage`: `true`
|
|
42
|
+
- `backgroundSize`: `true`
|
|
43
|
+
- `gradient`: `true`
|
|
40
44
|
- [`color`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color):
|
|
41
45
|
- [`gradients`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-gradients): `true`
|
|
42
46
|
- [`link`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-link): `true`
|
|
43
47
|
- [`spacing`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#spacing):
|
|
44
48
|
- `margin`: `true`
|
|
45
49
|
- `padding`: `true`
|
|
50
|
+
- [`shadow`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#shadow): `true`
|
|
46
51
|
- [`interactivity`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#interactivity):
|
|
47
52
|
- `clientNavigation`: `true`
|
|
48
53
|
- [`listView`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#listview): `true`
|
|
@@ -52,6 +57,7 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
52
57
|
_Defined via the [`selectors`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-selectors/) property in block.json._
|
|
53
58
|
|
|
54
59
|
- **border**: `.wp-block-list:not(.wp-block-list .wp-block-list)`
|
|
60
|
+
- **shadow**: `.wp-block-list:not(.wp-block-list .wp-block-list)`
|
|
55
61
|
|
|
56
62
|
## Block Markup
|
|
57
63
|
|
package/src/list/block.json
CHANGED
|
@@ -58,6 +58,15 @@
|
|
|
58
58
|
"fontSize": true
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
|
+
"background": {
|
|
62
|
+
"backgroundImage": true,
|
|
63
|
+
"backgroundSize": true,
|
|
64
|
+
"gradient": true,
|
|
65
|
+
"__experimentalDefaultControls": {
|
|
66
|
+
"backgroundImage": true,
|
|
67
|
+
"gradient": true
|
|
68
|
+
}
|
|
69
|
+
},
|
|
61
70
|
"color": {
|
|
62
71
|
"gradients": true,
|
|
63
72
|
"link": true,
|
|
@@ -74,6 +83,7 @@
|
|
|
74
83
|
"padding": false
|
|
75
84
|
}
|
|
76
85
|
},
|
|
86
|
+
"shadow": true,
|
|
77
87
|
"__unstablePasteTextInline": true,
|
|
78
88
|
"__experimentalOnMerge": true,
|
|
79
89
|
"__experimentalSlashInserter": true,
|
|
@@ -83,7 +93,8 @@
|
|
|
83
93
|
"listView": true
|
|
84
94
|
},
|
|
85
95
|
"selectors": {
|
|
86
|
-
"border": ".wp-block-list:not(.wp-block-list .wp-block-list)"
|
|
96
|
+
"border": ".wp-block-list:not(.wp-block-list .wp-block-list)",
|
|
97
|
+
"shadow": ".wp-block-list:not(.wp-block-list .wp-block-list)"
|
|
87
98
|
},
|
|
88
99
|
"editorStyle": "wp-block-list-editor",
|
|
89
100
|
"style": "wp-block-list"
|
package/src/list-item/README.md
CHANGED
|
@@ -33,6 +33,10 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
33
33
|
- [`html`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#html): `false`
|
|
34
34
|
- [`className`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#classname): `false`
|
|
35
35
|
- [`splitting`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#splitting): `true`
|
|
36
|
+
- [`background`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#background):
|
|
37
|
+
- `backgroundImage`: `true`
|
|
38
|
+
- `backgroundSize`: `true`
|
|
39
|
+
- `gradient`: `true`
|
|
36
40
|
- [`color`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color):
|
|
37
41
|
- [`gradients`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-gradients): `true`
|
|
38
42
|
- [`link`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-link): `true`
|
|
@@ -40,6 +44,7 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
40
44
|
- [`spacing`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#spacing):
|
|
41
45
|
- `margin`: `true`
|
|
42
46
|
- `padding`: `true`
|
|
47
|
+
- [`shadow`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#shadow): `true`
|
|
43
48
|
- [`typography`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography):
|
|
44
49
|
- [`fontSize`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-fontsize): `true`
|
|
45
50
|
- [`lineHeight`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-lineheight): `true`
|
|
@@ -52,6 +57,7 @@ _Defined via the [`selectors`](https://developer.wordpress.org/block-editor/refe
|
|
|
52
57
|
|
|
53
58
|
- **root**: `.wp-block-list > li`
|
|
54
59
|
- **border**: `.wp-block-list:not(.wp-block-list .wp-block-list) > li`
|
|
60
|
+
- **shadow**: `.wp-block-list:not(.wp-block-list .wp-block-list) > li`
|
|
55
61
|
|
|
56
62
|
## Block Markup
|
|
57
63
|
|
package/src/list-item/block.json
CHANGED
|
@@ -24,6 +24,11 @@
|
|
|
24
24
|
"html": false,
|
|
25
25
|
"className": false,
|
|
26
26
|
"splitting": true,
|
|
27
|
+
"background": {
|
|
28
|
+
"backgroundImage": true,
|
|
29
|
+
"backgroundSize": true,
|
|
30
|
+
"gradient": true
|
|
31
|
+
},
|
|
27
32
|
"__experimentalBorder": {
|
|
28
33
|
"color": true,
|
|
29
34
|
"radius": true,
|
|
@@ -46,6 +51,7 @@
|
|
|
46
51
|
"padding": false
|
|
47
52
|
}
|
|
48
53
|
},
|
|
54
|
+
"shadow": true,
|
|
49
55
|
"typography": {
|
|
50
56
|
"fontSize": true,
|
|
51
57
|
"lineHeight": true,
|
|
@@ -65,6 +71,7 @@
|
|
|
65
71
|
},
|
|
66
72
|
"selectors": {
|
|
67
73
|
"root": ".wp-block-list > li",
|
|
68
|
-
"border": ".wp-block-list:not(.wp-block-list .wp-block-list) > li"
|
|
74
|
+
"border": ".wp-block-list:not(.wp-block-list .wp-block-list) > li",
|
|
75
|
+
"shadow": ".wp-block-list:not(.wp-block-list .wp-block-list) > li"
|
|
69
76
|
}
|
|
70
77
|
}
|
package/src/list-item/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { listItem as icon } from '@wordpress/icons';
|
|
2
2
|
import { privateApis } from '@wordpress/block-editor';
|
|
3
|
+
import { privateApis as blocksPrivateApis } from '@wordpress/blocks';
|
|
3
4
|
import initBlock from '../utils/init-block';
|
|
4
5
|
import metadata from './block.json';
|
|
5
6
|
import edit from './edit';
|
|
@@ -7,12 +8,16 @@ import save from './save';
|
|
|
7
8
|
import transforms from './transforms';
|
|
8
9
|
import { unlock } from '../lock-unlock';
|
|
9
10
|
|
|
11
|
+
const { editableRootKey } = unlock( blocksPrivateApis );
|
|
12
|
+
|
|
10
13
|
const { name } = metadata;
|
|
11
14
|
|
|
12
15
|
export { metadata, name };
|
|
13
16
|
|
|
14
17
|
export const settings = {
|
|
15
18
|
icon,
|
|
19
|
+
// Opt into the editing host behaviour privately, like the paragraph.
|
|
20
|
+
[ editableRootKey ]: true,
|
|
16
21
|
edit,
|
|
17
22
|
save,
|
|
18
23
|
merge( attributes, attributesToMerge ) {
|
package/src/loginout/README.md
CHANGED
|
@@ -33,6 +33,9 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
33
33
|
- [`text`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-text): `false`
|
|
34
34
|
- [`gradients`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-gradients): `true`
|
|
35
35
|
- [`link`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-link): `true`
|
|
36
|
+
- [`dimensions`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#dimensions):
|
|
37
|
+
- `minHeight`: `true`
|
|
38
|
+
- `minWidth`: `true`
|
|
36
39
|
- [`spacing`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#spacing):
|
|
37
40
|
- `margin`: `true`
|
|
38
41
|
- `padding`: `true`
|
package/src/loginout/block.json
CHANGED
package/src/math/README.md
CHANGED
|
@@ -30,6 +30,9 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
30
30
|
- `gradient`: `true`
|
|
31
31
|
- [`color`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color):
|
|
32
32
|
- [`gradients`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-gradients): `true`
|
|
33
|
+
- [`dimensions`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#dimensions):
|
|
34
|
+
- `minHeight`: `true`
|
|
35
|
+
- `minWidth`: `true`
|
|
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):
|
|
35
38
|
- `margin`: `true`
|
package/src/math/block.json
CHANGED
package/src/media-text/README.md
CHANGED
|
@@ -42,17 +42,27 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
42
42
|
- [`anchor`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#anchor): `true`
|
|
43
43
|
- [`align`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#align): `"wide"`, `"full"`
|
|
44
44
|
- [`html`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#html): `false`
|
|
45
|
+
- [`background`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#background):
|
|
46
|
+
- `backgroundImage`: `true`
|
|
47
|
+
- `backgroundSize`: `true`
|
|
48
|
+
- `gradient`: `true`
|
|
45
49
|
- [`color`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color):
|
|
46
50
|
- [`gradients`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-gradients): `true`
|
|
47
51
|
- [`heading`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-heading): `true`
|
|
48
52
|
- [`link`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-link): `true`
|
|
49
53
|
- [`button`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-button): `true`
|
|
54
|
+
- [`dimensions`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#dimensions):
|
|
55
|
+
- `minHeight`: `true`
|
|
56
|
+
- `minWidth`: `true`
|
|
50
57
|
- [`spacing`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#spacing):
|
|
51
58
|
- `margin`: `true`
|
|
52
59
|
- `padding`: `true`
|
|
60
|
+
- [`shadow`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#shadow): `true`
|
|
53
61
|
- [`typography`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography):
|
|
54
62
|
- [`fontSize`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-fontsize): `true`
|
|
55
63
|
- [`lineHeight`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-lineheight): `true`
|
|
64
|
+
- [`filter`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#filter):
|
|
65
|
+
- [`duotone`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#filter-duotone): `true`
|
|
56
66
|
- [`interactivity`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#interactivity):
|
|
57
67
|
- `clientNavigation`: `true`
|
|
58
68
|
- [`allowedBlocks`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#allowedblocks): `true`
|
|
@@ -66,6 +76,13 @@ _Defined via the [`usesContext` and `providesContext`](https://developer.wordpre
|
|
|
66
76
|
- `postId`
|
|
67
77
|
- `postType`
|
|
68
78
|
|
|
79
|
+
## CSS Selectors
|
|
80
|
+
|
|
81
|
+
_Defined via the [`selectors`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-selectors/) property in block.json._
|
|
82
|
+
|
|
83
|
+
- **filter**:
|
|
84
|
+
- duotone: `.wp-block-media-text > .wp-block-media-text__media img, .wp-block-media-text > .wp-block-media-text__media video`
|
|
85
|
+
|
|
69
86
|
## Block Markup
|
|
70
87
|
|
|
71
88
|
This is a [**hybrid block**](https://developer.wordpress.org/block-editor/getting-started/fundamentals/static-dynamic-rendering/). It saves static markup that the server may enhance during rendering.
|
|
@@ -100,6 +100,11 @@
|
|
|
100
100
|
"anchor": true,
|
|
101
101
|
"align": [ "wide", "full" ],
|
|
102
102
|
"html": false,
|
|
103
|
+
"background": {
|
|
104
|
+
"backgroundImage": true,
|
|
105
|
+
"backgroundSize": true,
|
|
106
|
+
"gradient": true
|
|
107
|
+
},
|
|
103
108
|
"__experimentalBorder": {
|
|
104
109
|
"color": true,
|
|
105
110
|
"radius": true,
|
|
@@ -122,10 +127,15 @@
|
|
|
122
127
|
"text": true
|
|
123
128
|
}
|
|
124
129
|
},
|
|
130
|
+
"dimensions": {
|
|
131
|
+
"minHeight": true,
|
|
132
|
+
"minWidth": true
|
|
133
|
+
},
|
|
125
134
|
"spacing": {
|
|
126
135
|
"margin": true,
|
|
127
136
|
"padding": true
|
|
128
137
|
},
|
|
138
|
+
"shadow": true,
|
|
129
139
|
"typography": {
|
|
130
140
|
"fontSize": true,
|
|
131
141
|
"lineHeight": true,
|
|
@@ -139,11 +149,19 @@
|
|
|
139
149
|
"fontSize": true
|
|
140
150
|
}
|
|
141
151
|
},
|
|
152
|
+
"filter": {
|
|
153
|
+
"duotone": true
|
|
154
|
+
},
|
|
142
155
|
"interactivity": {
|
|
143
156
|
"clientNavigation": true
|
|
144
157
|
},
|
|
145
158
|
"allowedBlocks": true
|
|
146
159
|
},
|
|
160
|
+
"selectors": {
|
|
161
|
+
"filter": {
|
|
162
|
+
"duotone": ".wp-block-media-text > .wp-block-media-text__media img, .wp-block-media-text > .wp-block-media-text__media video"
|
|
163
|
+
}
|
|
164
|
+
},
|
|
147
165
|
"editorStyle": "wp-block-media-text-editor",
|
|
148
166
|
"style": "wp-block-media-text"
|
|
149
167
|
}
|
|
@@ -52,11 +52,15 @@
|
|
|
52
52
|
grid-column: 2;
|
|
53
53
|
grid-row: 1;
|
|
54
54
|
/*rtl:end:ignore*/
|
|
55
|
-
padding: 0 8% 0 8%;
|
|
56
55
|
// stylelint-disable-next-line declaration-property-value-keyword-no-deprecated -- Pending review of overflow-wrap alternative.
|
|
57
56
|
word-break: break-word;
|
|
58
57
|
}
|
|
59
58
|
|
|
59
|
+
// Zero specificity so the default padding can be overridden by theme.json or theme styles.
|
|
60
|
+
:where(.wp-block-media-text > .wp-block-media-text__content) {
|
|
61
|
+
padding: 0 8%;
|
|
62
|
+
}
|
|
63
|
+
|
|
60
64
|
.wp-block-media-text.has-media-on-the-right > .wp-block-media-text__media {
|
|
61
65
|
/*rtl:begin:ignore*/
|
|
62
66
|
grid-column: 2;
|
|
@@ -3,7 +3,7 @@ import { createRegistry, useSelect } from '@wordpress/data';
|
|
|
3
3
|
import { store as coreStore } from '@wordpress/core-data';
|
|
4
4
|
import useNavigationMenu from '../use-navigation-menu';
|
|
5
5
|
|
|
6
|
-
vi.mock( '@wordpress/api-fetch' );
|
|
6
|
+
vi.mock( import( '@wordpress/api-fetch' ) );
|
|
7
7
|
|
|
8
8
|
const BASE_ENTITY = {
|
|
9
9
|
kind: 'postType',
|
|
@@ -20,49 +20,62 @@ import { VisuallyHidden } from '@wordpress/ui';
|
|
|
20
20
|
import { isURL } from '@wordpress/url';
|
|
21
21
|
import { LinkUIPageCreator } from './page-creator';
|
|
22
22
|
import LinkUIBlockInserter from './block-inserter';
|
|
23
|
-
import {
|
|
23
|
+
import {
|
|
24
|
+
isBlockSuggestion,
|
|
25
|
+
useBlockSuggestions,
|
|
26
|
+
useEntityBinding,
|
|
27
|
+
useLinkPreview,
|
|
28
|
+
} from '../shared';
|
|
24
29
|
|
|
25
30
|
/**
|
|
26
|
-
* Given the Link block's type attribute, return the query params
|
|
27
|
-
*
|
|
31
|
+
* Given the Link block's type attribute, return the query params for that one
|
|
32
|
+
* entity type.
|
|
28
33
|
*
|
|
29
34
|
* @param {string} type Link block's type attribute.
|
|
30
35
|
* @param {string} kind Link block's entity of kind (post-type|taxonomy)
|
|
31
|
-
* @return {{ type
|
|
36
|
+
* @return {{ type: string, subtype?: string }} Search query params.
|
|
32
37
|
*/
|
|
33
|
-
|
|
34
|
-
// How many results to show initially and per search.
|
|
35
|
-
const perPage = 20;
|
|
36
|
-
|
|
38
|
+
function getOwnTypeSearchOptions( type, kind ) {
|
|
37
39
|
switch ( type ) {
|
|
38
40
|
case 'post':
|
|
39
41
|
case 'page':
|
|
40
|
-
return { type: 'post', subtype: type
|
|
42
|
+
return { type: 'post', subtype: type };
|
|
41
43
|
case 'category':
|
|
42
|
-
return { type: 'term', subtype: 'category'
|
|
44
|
+
return { type: 'term', subtype: 'category' };
|
|
43
45
|
case 'tag':
|
|
44
|
-
return { type: 'term', subtype: 'post_tag'
|
|
46
|
+
return { type: 'term', subtype: 'post_tag' };
|
|
45
47
|
case 'post_format':
|
|
46
|
-
return { type: 'post-format'
|
|
48
|
+
return { type: 'post-format' };
|
|
47
49
|
default:
|
|
48
50
|
if ( kind === 'taxonomy' ) {
|
|
49
|
-
return { type: 'term', subtype: type
|
|
51
|
+
return { type: 'term', subtype: type };
|
|
50
52
|
}
|
|
51
53
|
if ( kind === 'post-type' ) {
|
|
52
|
-
return { type: 'post', subtype: type
|
|
54
|
+
return { type: 'post', subtype: type };
|
|
53
55
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
initialSuggestionsSearchOptions: {
|
|
58
|
-
type: 'post',
|
|
59
|
-
subtype: 'page',
|
|
60
|
-
perPage,
|
|
61
|
-
},
|
|
62
|
-
};
|
|
56
|
+
// for custom link which has no type
|
|
57
|
+
// always show pages as initial suggestions
|
|
58
|
+
return { type: 'post', subtype: 'page' };
|
|
63
59
|
}
|
|
64
60
|
}
|
|
65
61
|
|
|
62
|
+
/**
|
|
63
|
+
* Given the Link block's type attribute, return the query params to give to
|
|
64
|
+
* /wp/v2/search.
|
|
65
|
+
*
|
|
66
|
+
* @param {string} type Link block's type attribute.
|
|
67
|
+
* @param {string} kind Link block's entity of kind (post-type|taxonomy)
|
|
68
|
+
* @return {Object} Search query params.
|
|
69
|
+
*/
|
|
70
|
+
export function getSuggestionsQuery( type, kind ) {
|
|
71
|
+
const ownType = getOwnTypeSearchOptions( type, kind );
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
preferTypes: [ ownType.subtype ? ownType : ownType.type ],
|
|
75
|
+
initialSuggestionsSearchOptions: { ...ownType, perPage: 20 },
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
66
79
|
function UnforwardedLinkUI( props, ref ) {
|
|
67
80
|
const { label, url, opensInNewTab, type, kind, id } = props.link;
|
|
68
81
|
|
|
@@ -179,6 +192,18 @@ function UnforwardedLinkUI( props, ref ) {
|
|
|
179
192
|
}, [ shouldFocusPane ] );
|
|
180
193
|
|
|
181
194
|
const blockEditingMode = useBlockEditingMode();
|
|
195
|
+
const canAddBlock = blockEditingMode !== 'disabled';
|
|
196
|
+
|
|
197
|
+
// Blocks are listed in the search results only when the "Add block"
|
|
198
|
+
// button would be shown: the link has no URL yet and the block is not
|
|
199
|
+
// locked.
|
|
200
|
+
const { transformSuggestions, insertBlockFromSuggestion } =
|
|
201
|
+
useBlockSuggestions( {
|
|
202
|
+
clientId,
|
|
203
|
+
isEnabled: canAddBlock && ! link?.url?.length,
|
|
204
|
+
onBlockInsert: props.onBlockInsert,
|
|
205
|
+
onClose: props.onClose,
|
|
206
|
+
} );
|
|
182
207
|
|
|
183
208
|
return (
|
|
184
209
|
<Popover
|
|
@@ -213,7 +238,17 @@ function UnforwardedLinkUI( props, ref ) {
|
|
|
213
238
|
noDirectEntry={ !! type }
|
|
214
239
|
noURLSuggestion={ !! type }
|
|
215
240
|
suggestionsQuery={ getSuggestionsQuery( type, kind ) }
|
|
216
|
-
|
|
241
|
+
transformSuggestions={ transformSuggestions }
|
|
242
|
+
onChange={ ( updatedValue ) => {
|
|
243
|
+
if ( isBlockSuggestion( updatedValue ) ) {
|
|
244
|
+
insertBlockFromSuggestion(
|
|
245
|
+
updatedValue.blockItemId
|
|
246
|
+
);
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
props.onChange( updatedValue );
|
|
251
|
+
} }
|
|
217
252
|
onInputChange={ ( value ) => {
|
|
218
253
|
// Observe the input value so we can pass the value to the page creator
|
|
219
254
|
// and restore it on back button click
|
|
@@ -245,9 +280,7 @@ function UnforwardedLinkUI( props, ref ) {
|
|
|
245
280
|
permissions?.canCreate &&
|
|
246
281
|
type === 'page'
|
|
247
282
|
}
|
|
248
|
-
canAddBlock={
|
|
249
|
-
blockEditingMode !== 'disabled'
|
|
250
|
-
}
|
|
283
|
+
canAddBlock={ canAddBlock }
|
|
251
284
|
/>
|
|
252
285
|
);
|
|
253
286
|
} }
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { getSuggestionsQuery } from '..';
|
|
3
|
+
|
|
4
|
+
const PER_PAGE = 20;
|
|
5
|
+
|
|
6
|
+
const LINK_TYPES = [
|
|
7
|
+
[ 'page', 'post-type', { type: 'post', subtype: 'page' } ],
|
|
8
|
+
[ 'post', 'post-type', { type: 'post', subtype: 'post' } ],
|
|
9
|
+
[ 'category', 'taxonomy', { type: 'term', subtype: 'category' } ],
|
|
10
|
+
[ 'tag', 'taxonomy', { type: 'term', subtype: 'post_tag' } ],
|
|
11
|
+
[ 'post_format', 'taxonomy', { type: 'post-format' } ],
|
|
12
|
+
[ 'event', 'post-type', { type: 'post', subtype: 'event' } ],
|
|
13
|
+
[ 'genre', 'taxonomy', { type: 'term', subtype: 'genre' } ],
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
describe( 'getSuggestionsQuery', () => {
|
|
17
|
+
// A typed search is unscoped: naming no type leaves every endpoint to
|
|
18
|
+
// answer it, which is what lets a category be found from a page link.
|
|
19
|
+
it.each( LINK_TYPES )(
|
|
20
|
+
'searches every entity type from a %s link',
|
|
21
|
+
( type, kind ) => {
|
|
22
|
+
const query = getSuggestionsQuery( type, kind );
|
|
23
|
+
|
|
24
|
+
expect( query.type ).toBeUndefined();
|
|
25
|
+
expect( query.subtype ).toBeUndefined();
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
// Searching everything only helps if the link's own kind leads, so the
|
|
30
|
+
// block names it rather than narrowing to it.
|
|
31
|
+
it.each( LINK_TYPES )(
|
|
32
|
+
'ranks the %s link’s own type above the usual order',
|
|
33
|
+
( type, kind, expected ) => {
|
|
34
|
+
expect( getSuggestionsQuery( type, kind ).preferTypes ).toEqual( [
|
|
35
|
+
expected.subtype ? expected : expected.type,
|
|
36
|
+
] );
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
// Before anything is typed there is nothing to rank, so the preview is
|
|
41
|
+
// narrowed to the link's own type instead.
|
|
42
|
+
it.each( LINK_TYPES )(
|
|
43
|
+
'suggests the %s link’s own type before anything is typed',
|
|
44
|
+
( type, kind, expected ) => {
|
|
45
|
+
expect(
|
|
46
|
+
getSuggestionsQuery( type, kind )
|
|
47
|
+
.initialSuggestionsSearchOptions
|
|
48
|
+
).toEqual( { ...expected, perPage: PER_PAGE } );
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
// A custom link points at a URL, and a link just inserted has no type at
|
|
53
|
+
// all, so neither has a kind of its own to preview. Pages are the most
|
|
54
|
+
// likely thing to link to.
|
|
55
|
+
it.each( [
|
|
56
|
+
[ 'a custom link', 'custom', 'custom' ],
|
|
57
|
+
[ 'a link with no type', undefined, undefined ],
|
|
58
|
+
] )(
|
|
59
|
+
'suggests pages before anything is typed for %s',
|
|
60
|
+
( _label, type, kind ) => {
|
|
61
|
+
expect(
|
|
62
|
+
getSuggestionsQuery( type, kind )
|
|
63
|
+
.initialSuggestionsSearchOptions
|
|
64
|
+
).toEqual( { type: 'post', subtype: 'page', perPage: PER_PAGE } );
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
} );
|
|
@@ -19,3 +19,7 @@ export { useEnableLinkStatusValidation } from './use-enable-link-status-validati
|
|
|
19
19
|
export { useIsDraggingWithin } from './use-is-dragging-within';
|
|
20
20
|
export { selectLabelText } from './select-label-text';
|
|
21
21
|
export { useLinkPreview } from './use-link-preview';
|
|
22
|
+
export {
|
|
23
|
+
isBlockSuggestion,
|
|
24
|
+
useBlockSuggestions,
|
|
25
|
+
} from './use-block-suggestions';
|