@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
|
@@ -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
|
}
|
|
@@ -49,36 +49,34 @@ var import_page_creator = require("./page-creator.cjs");
|
|
|
49
49
|
var import_block_inserter = __toESM(require("./block-inserter.cjs"));
|
|
50
50
|
var import_shared = require("../shared/index.cjs");
|
|
51
51
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
52
|
-
function
|
|
53
|
-
const perPage = 20;
|
|
52
|
+
function getOwnTypeSearchOptions(type, kind) {
|
|
54
53
|
switch (type) {
|
|
55
54
|
case "post":
|
|
56
55
|
case "page":
|
|
57
|
-
return { type: "post", subtype: type
|
|
56
|
+
return { type: "post", subtype: type };
|
|
58
57
|
case "category":
|
|
59
|
-
return { type: "term", subtype: "category"
|
|
58
|
+
return { type: "term", subtype: "category" };
|
|
60
59
|
case "tag":
|
|
61
|
-
return { type: "term", subtype: "post_tag"
|
|
60
|
+
return { type: "term", subtype: "post_tag" };
|
|
62
61
|
case "post_format":
|
|
63
|
-
return { type: "post-format"
|
|
62
|
+
return { type: "post-format" };
|
|
64
63
|
default:
|
|
65
64
|
if (kind === "taxonomy") {
|
|
66
|
-
return { type: "term", subtype: type
|
|
65
|
+
return { type: "term", subtype: type };
|
|
67
66
|
}
|
|
68
67
|
if (kind === "post-type") {
|
|
69
|
-
return { type: "post", subtype: type
|
|
68
|
+
return { type: "post", subtype: type };
|
|
70
69
|
}
|
|
71
|
-
return {
|
|
72
|
-
// for custom link which has no type
|
|
73
|
-
// always show pages as initial suggestions
|
|
74
|
-
initialSuggestionsSearchOptions: {
|
|
75
|
-
type: "post",
|
|
76
|
-
subtype: "page",
|
|
77
|
-
perPage
|
|
78
|
-
}
|
|
79
|
-
};
|
|
70
|
+
return { type: "post", subtype: "page" };
|
|
80
71
|
}
|
|
81
72
|
}
|
|
73
|
+
function getSuggestionsQuery(type, kind) {
|
|
74
|
+
const ownType = getOwnTypeSearchOptions(type, kind);
|
|
75
|
+
return {
|
|
76
|
+
preferTypes: [ownType.subtype ? ownType : ownType.type],
|
|
77
|
+
initialSuggestionsSearchOptions: { ...ownType, perPage: 20 }
|
|
78
|
+
};
|
|
79
|
+
}
|
|
82
80
|
function UnforwardedLinkUI(props, ref) {
|
|
83
81
|
const { label, url, opensInNewTab, type, kind, id } = props.link;
|
|
84
82
|
const { entityRecord, hasBinding, isEntityAvailable } = props.entity || {};
|
|
@@ -164,6 +162,13 @@ function UnforwardedLinkUI(props, ref) {
|
|
|
164
162
|
}
|
|
165
163
|
}, [shouldFocusPane]);
|
|
166
164
|
const blockEditingMode = (0, import_block_editor.useBlockEditingMode)();
|
|
165
|
+
const canAddBlock = blockEditingMode !== "disabled";
|
|
166
|
+
const { transformSuggestions, insertBlockFromSuggestion } = (0, import_shared.useBlockSuggestions)({
|
|
167
|
+
clientId,
|
|
168
|
+
isEnabled: canAddBlock && !link?.url?.length,
|
|
169
|
+
onBlockInsert: props.onBlockInsert,
|
|
170
|
+
onClose: props.onClose
|
|
171
|
+
});
|
|
167
172
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
168
173
|
import_components.Popover,
|
|
169
174
|
{
|
|
@@ -198,7 +203,16 @@ function UnforwardedLinkUI(props, ref) {
|
|
|
198
203
|
noDirectEntry: !!type,
|
|
199
204
|
noURLSuggestion: !!type,
|
|
200
205
|
suggestionsQuery: getSuggestionsQuery(type, kind),
|
|
201
|
-
|
|
206
|
+
transformSuggestions,
|
|
207
|
+
onChange: (updatedValue) => {
|
|
208
|
+
if ((0, import_shared.isBlockSuggestion)(updatedValue)) {
|
|
209
|
+
insertBlockFromSuggestion(
|
|
210
|
+
updatedValue.blockItemId
|
|
211
|
+
);
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
props.onChange(updatedValue);
|
|
215
|
+
},
|
|
202
216
|
onInputChange: (value) => {
|
|
203
217
|
searchInputValueRef.current = value;
|
|
204
218
|
},
|
|
@@ -223,7 +237,7 @@ function UnforwardedLinkUI(props, ref) {
|
|
|
223
237
|
setAddingPage(true);
|
|
224
238
|
},
|
|
225
239
|
canAddPage: blockEditingMode !== "disabled" && permissions?.canCreate && type === "page",
|
|
226
|
-
canAddBlock
|
|
240
|
+
canAddBlock
|
|
227
241
|
}
|
|
228
242
|
);
|
|
229
243
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/navigation-link/link-ui/index.jsx"],
|
|
4
|
-
"sourcesContent": ["import { __unstableStripHTML as stripHTML, focus } from '@wordpress/dom';\nimport {\n\tPopover,\n\tButton,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { LinkControl, useBlockEditingMode } from '@wordpress/block-editor';\nimport {\n\tuseMemo,\n\tuseState,\n\tuseRef,\n\tuseEffect,\n\tforwardRef,\n} from '@wordpress/element';\nimport { useResourcePermissions } from '@wordpress/core-data';\nimport { plus } from '@wordpress/icons';\nimport { useInstanceId } from '@wordpress/compose';\nimport { VisuallyHidden } from '@wordpress/ui';\nimport { isURL } from '@wordpress/url';\nimport { LinkUIPageCreator } from './page-creator';\nimport LinkUIBlockInserter from './block-inserter';\nimport { useEntityBinding, useLinkPreview } from '../shared';\n\n/**\n * Given the Link block's type attribute, return the query params to give to\n * /wp/v2/search.\n *\n * @param {string} type Link block's type attribute.\n * @param {string} kind Link block's entity of kind (post-type|taxonomy)\n * @return {{ type?: string, subtype?: string }} Search query params.\n */\nexport function getSuggestionsQuery( type, kind ) {\n\t// How many results to show initially and per search.\n\tconst perPage = 20;\n\n\tswitch ( type ) {\n\t\tcase 'post':\n\t\tcase 'page':\n\t\t\treturn { type: 'post', subtype: type, perPage };\n\t\tcase 'category':\n\t\t\treturn { type: 'term', subtype: 'category', perPage };\n\t\tcase 'tag':\n\t\t\treturn { type: 'term', subtype: 'post_tag', perPage };\n\t\tcase 'post_format':\n\t\t\treturn { type: 'post-format', perPage };\n\t\tdefault:\n\t\t\tif ( kind === 'taxonomy' ) {\n\t\t\t\treturn { type: 'term', subtype: type, perPage };\n\t\t\t}\n\t\t\tif ( kind === 'post-type' ) {\n\t\t\t\treturn { type: 'post', subtype: type, perPage };\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t// for custom link which has no type\n\t\t\t\t// always show pages as initial suggestions\n\t\t\t\tinitialSuggestionsSearchOptions: {\n\t\t\t\t\ttype: 'post',\n\t\t\t\t\tsubtype: 'page',\n\t\t\t\t\tperPage,\n\t\t\t\t},\n\t\t\t};\n\t}\n}\n\nfunction UnforwardedLinkUI( props, ref ) {\n\tconst { label, url, opensInNewTab, type, kind, id } = props.link;\n\n\tconst { entityRecord, hasBinding, isEntityAvailable } = props.entity || {};\n\n\tconst { image, badges } = useLinkPreview( {\n\t\turl,\n\t\tentityRecord,\n\t\ttype,\n\t\thasBinding,\n\t\tisEntityAvailable,\n\t} );\n\n\tconst { clientId } = props;\n\tconst postType = type || 'page';\n\n\tconst [ addingBlock, setAddingBlock ] = useState( false );\n\tconst [ addingPage, setAddingPage ] = useState( false );\n\tconst [ shouldFocusPane, setShouldFocusPane ] = useState( null );\n\t// Stable initial value for LinkControl's uncontrolled inputValue prop.\n\t// We track the search with the searchInputValueRef, then update the\n\t// initialSearchValue state with the observed searchInputValueRef\n\t// when mounting the LinkControl. If LinkControl becomes a fully\n\t// controlled component, then we can remove this extra complexity.\n\tconst [ initialSearchValue, setInitialSearchValue ] = useState( '' );\n\t// Tracks the live search input between renders without causing re-renders.\n\tconst searchInputValueRef = useRef( '' );\n\t// Call this instead of setting searchInputValueRef.current and\n\t// setInitialSearchValue separately, to keep both in sync.\n\tconst updateSearchValue = ( value ) => {\n\t\tsearchInputValueRef.current = value;\n\t\tsetInitialSearchValue( value );\n\t};\n\tconst linkControlWrapperRef = useRef();\n\tconst addPageButtonRef = useRef();\n\tconst addBlockButtonRef = useRef();\n\tconst permissions = useResourcePermissions( {\n\t\tkind: 'postType',\n\t\tname: postType,\n\t} );\n\n\t// Use the entity binding hook to get binding status\n\tconst { isBoundEntityAvailable } = useEntityBinding( {\n\t\tclientId,\n\t\tattributes: props.link,\n\t} );\n\n\t// Memoize link value to avoid overriding the LinkControl's internal state.\n\t// This is a temporary fix. See https://github.com/WordPress/gutenberg/issues/50976#issuecomment-1568226407.\n\tconst link = useMemo(\n\t\t() => ( {\n\t\t\turl,\n\t\t\topensInNewTab,\n\t\t\ttitle: label && stripHTML( label ),\n\t\t\tentityTitle: entityRecord?.title?.rendered || entityRecord?.name,\n\t\t\tkind,\n\t\t\ttype,\n\t\t\tid,\n\t\t\timage,\n\t\t\tbadges,\n\t\t} ),\n\t\t[\n\t\t\tlabel,\n\t\t\topensInNewTab,\n\t\t\turl,\n\t\t\tkind,\n\t\t\ttype,\n\t\t\tid,\n\t\t\timage,\n\t\t\tbadges,\n\t\t\tentityRecord,\n\t\t]\n\t);\n\n\tconst handlePageCreated = ( pageLink ) => {\n\t\t// Set the new page as the current link\n\t\tprops.onChange( pageLink );\n\t\t// Return to main Link UI and focus the first focusable element\n\t\tsetAddingPage( false );\n\t\tsetShouldFocusPane( true );\n\t\t// Clear search input value\n\t\tupdateSearchValue( '' );\n\t};\n\n\tconst dialogTitleId = useInstanceId(\n\t\tLinkUI,\n\t\t'link-ui-link-control__title'\n\t);\n\tconst dialogDescriptionId = useInstanceId(\n\t\tLinkUI,\n\t\t'link-ui-link-control__description'\n\t);\n\n\t// Focus management when transitioning between panes\n\tuseEffect( () => {\n\t\tif ( shouldFocusPane && linkControlWrapperRef.current ) {\n\t\t\t// If we have a specific element to focus, focus it\n\t\t\tif ( shouldFocusPane?.current ) {\n\t\t\t\t// Focus the specific element passed\n\t\t\t\tshouldFocusPane.current.focus();\n\t\t\t} else {\n\t\t\t\t// Focus the first tabbable element (keyboard-accessible, excluding tabindex=\"-1\")\n\t\t\t\tconst tabbableElements = focus.tabbable.find(\n\t\t\t\t\tlinkControlWrapperRef.current\n\t\t\t\t);\n\t\t\t\tconst nextFocusTarget =\n\t\t\t\t\ttabbableElements[ 0 ] || linkControlWrapperRef.current;\n\t\t\t\tnextFocusTarget.focus();\n\t\t\t}\n\n\t\t\t// Reset the state\n\t\t\tsetShouldFocusPane( false );\n\t\t}\n\t}, [ shouldFocusPane ] );\n\n\tconst blockEditingMode = useBlockEditingMode();\n\n\treturn (\n\t\t<Popover\n\t\t\tref={ ref }\n\t\t\tplacement=\"bottom\"\n\t\t\tonClose={ props.onClose }\n\t\t\tanchor={ props.anchor }\n\t\t\tshift\n\t\t>\n\t\t\t{ ! addingBlock && ! addingPage && (\n\t\t\t\t<div\n\t\t\t\t\tref={ linkControlWrapperRef }\n\t\t\t\t\trole=\"dialog\"\n\t\t\t\t\taria-labelledby={ dialogTitleId }\n\t\t\t\t\taria-describedby={ dialogDescriptionId }\n\t\t\t\t>\n\t\t\t\t\t<VisuallyHidden>\n\t\t\t\t\t\t<h2 id={ dialogTitleId }>{ __( 'Add link' ) }</h2>\n\n\t\t\t\t\t\t<p id={ dialogDescriptionId }>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Search for and add a link to your Navigation.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t<LinkControl\n\t\t\t\t\t\thasTextControl\n\t\t\t\t\t\thasRichPreviews\n\t\t\t\t\t\tvalue={ link }\n\t\t\t\t\t\tshowInitialSuggestions\n\t\t\t\t\t\twithCreateSuggestion={ false }\n\t\t\t\t\t\tnoDirectEntry={ !! type }\n\t\t\t\t\t\tnoURLSuggestion={ !! type }\n\t\t\t\t\t\tsuggestionsQuery={ getSuggestionsQuery( type, kind ) }\n\t\t\t\t\t\tonChange={ props.onChange }\n\t\t\t\t\t\tonInputChange={ ( value ) => {\n\t\t\t\t\t\t\t// Observe the input value so we can pass the value to the page creator\n\t\t\t\t\t\t\t// and restore it on back button click\n\t\t\t\t\t\t\tsearchInputValueRef.current = value;\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tinputValue={ initialSearchValue }\n\t\t\t\t\t\tonRemove={ props.onRemove }\n\t\t\t\t\t\tonCancel={ props.onCancel }\n\t\t\t\t\t\thandleEntities={ isBoundEntityAvailable }\n\t\t\t\t\t\tforceIsEditingLink={ link?.url ? false : undefined }\n\t\t\t\t\t\trenderControlBottom={ () => {\n\t\t\t\t\t\t\t// Don't show the tools when there is submitted link (preview state).\n\t\t\t\t\t\t\tif ( link?.url?.length ) {\n\t\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<LinkUITools\n\t\t\t\t\t\t\t\t\taddPageButtonRef={ addPageButtonRef }\n\t\t\t\t\t\t\t\t\taddBlockButtonRef={ addBlockButtonRef }\n\t\t\t\t\t\t\t\t\tsetAddingBlock={ () => {\n\t\t\t\t\t\t\t\t\t\tsetAddingBlock( true );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tsetAddingPage={ () => {\n\t\t\t\t\t\t\t\t\t\tsetAddingPage( true );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tcanAddPage={\n\t\t\t\t\t\t\t\t\t\tblockEditingMode !== 'disabled' &&\n\t\t\t\t\t\t\t\t\t\tpermissions?.canCreate &&\n\t\t\t\t\t\t\t\t\t\ttype === 'page'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcanAddBlock={\n\t\t\t\t\t\t\t\t\t\tblockEditingMode !== 'disabled'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ addingBlock && (\n\t\t\t\t<LinkUIBlockInserter\n\t\t\t\t\tclientId={ props.clientId }\n\t\t\t\t\tonBack={ () => {\n\t\t\t\t\t\tsetAddingBlock( false );\n\t\t\t\t\t\tsetShouldFocusPane( addBlockButtonRef );\n\t\t\t\t\t\tupdateSearchValue( searchInputValueRef.current );\n\t\t\t\t\t} }\n\t\t\t\t\tonBlockInsert={ props?.onBlockInsert }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ addingPage && (\n\t\t\t\t<LinkUIPageCreator\n\t\t\t\t\tpostType={ postType }\n\t\t\t\t\tonBack={ () => {\n\t\t\t\t\t\tsetAddingPage( false );\n\t\t\t\t\t\tsetShouldFocusPane( addPageButtonRef );\n\t\t\t\t\t\tupdateSearchValue( searchInputValueRef.current );\n\t\t\t\t\t} }\n\t\t\t\t\tonPageCreated={ handlePageCreated }\n\t\t\t\t\tinitialTitle={\n\t\t\t\t\t\tsearchInputValueRef.current &&\n\t\t\t\t\t\t! isURL( searchInputValueRef.current )\n\t\t\t\t\t\t\t? searchInputValueRef.current\n\t\t\t\t\t\t\t: ''\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t</Popover>\n\t);\n}\n\nexport const LinkUI = forwardRef( UnforwardedLinkUI );\n\nconst LinkUITools = ( {\n\taddPageButtonRef,\n\taddBlockButtonRef,\n\tsetAddingBlock,\n\tsetAddingPage,\n\tcanAddPage,\n\tcanAddBlock,\n} ) => {\n\tconst blockInserterAriaRole = 'listbox';\n\n\t// Don't render anything if neither button should be shown\n\tif ( ! canAddPage && ! canAddBlock ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<VStack spacing={ 0 } className=\"link-ui-tools\">\n\t\t\t{ canAddPage && (\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tref={ addPageButtonRef }\n\t\t\t\t\ticon={ plus }\n\t\t\t\t\tonClick={ ( e ) => {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\tsetAddingPage( true );\n\t\t\t\t\t} }\n\t\t\t\t\taria-haspopup={ blockInserterAriaRole }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Create page' ) }\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t\t{ canAddBlock && (\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tref={ addBlockButtonRef }\n\t\t\t\t\ticon={ plus }\n\t\t\t\t\tonClick={ ( e ) => {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\tsetAddingBlock( true );\n\t\t\t\t\t} }\n\t\t\t\t\taria-haspopup={ blockInserterAriaRole }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Add block' ) }\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t</VStack>\n\t);\n};\n\nexport default LinkUITools;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAwD;AACxD,wBAIO;AACP,kBAAmB;AACnB,0BAAiD;AACjD,qBAMO;AACP,uBAAuC;AACvC,mBAAqB;AACrB,qBAA8B;AAC9B,gBAA+B;AAC/B,iBAAsB;AACtB,0BAAkC;AAClC,4BAAgC;AAChC,
|
|
4
|
+
"sourcesContent": ["import { __unstableStripHTML as stripHTML, focus } from '@wordpress/dom';\nimport {\n\tPopover,\n\tButton,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { LinkControl, useBlockEditingMode } from '@wordpress/block-editor';\nimport {\n\tuseMemo,\n\tuseState,\n\tuseRef,\n\tuseEffect,\n\tforwardRef,\n} from '@wordpress/element';\nimport { useResourcePermissions } from '@wordpress/core-data';\nimport { plus } from '@wordpress/icons';\nimport { useInstanceId } from '@wordpress/compose';\nimport { VisuallyHidden } from '@wordpress/ui';\nimport { isURL } from '@wordpress/url';\nimport { LinkUIPageCreator } from './page-creator';\nimport LinkUIBlockInserter from './block-inserter';\nimport {\n\tisBlockSuggestion,\n\tuseBlockSuggestions,\n\tuseEntityBinding,\n\tuseLinkPreview,\n} from '../shared';\n\n/**\n * Given the Link block's type attribute, return the query params for that one\n * entity type.\n *\n * @param {string} type Link block's type attribute.\n * @param {string} kind Link block's entity of kind (post-type|taxonomy)\n * @return {{ type: string, subtype?: string }} Search query params.\n */\nfunction getOwnTypeSearchOptions( type, kind ) {\n\tswitch ( type ) {\n\t\tcase 'post':\n\t\tcase 'page':\n\t\t\treturn { type: 'post', subtype: type };\n\t\tcase 'category':\n\t\t\treturn { type: 'term', subtype: 'category' };\n\t\tcase 'tag':\n\t\t\treturn { type: 'term', subtype: 'post_tag' };\n\t\tcase 'post_format':\n\t\t\treturn { type: 'post-format' };\n\t\tdefault:\n\t\t\tif ( kind === 'taxonomy' ) {\n\t\t\t\treturn { type: 'term', subtype: type };\n\t\t\t}\n\t\t\tif ( kind === 'post-type' ) {\n\t\t\t\treturn { type: 'post', subtype: type };\n\t\t\t}\n\t\t\t// for custom link which has no type\n\t\t\t// always show pages as initial suggestions\n\t\t\treturn { type: 'post', subtype: 'page' };\n\t}\n}\n\n/**\n * Given the Link block's type attribute, return the query params to give to\n * /wp/v2/search.\n *\n * @param {string} type Link block's type attribute.\n * @param {string} kind Link block's entity of kind (post-type|taxonomy)\n * @return {Object} Search query params.\n */\nexport function getSuggestionsQuery( type, kind ) {\n\tconst ownType = getOwnTypeSearchOptions( type, kind );\n\n\treturn {\n\t\tpreferTypes: [ ownType.subtype ? ownType : ownType.type ],\n\t\tinitialSuggestionsSearchOptions: { ...ownType, perPage: 20 },\n\t};\n}\n\nfunction UnforwardedLinkUI( props, ref ) {\n\tconst { label, url, opensInNewTab, type, kind, id } = props.link;\n\n\tconst { entityRecord, hasBinding, isEntityAvailable } = props.entity || {};\n\n\tconst { image, badges } = useLinkPreview( {\n\t\turl,\n\t\tentityRecord,\n\t\ttype,\n\t\thasBinding,\n\t\tisEntityAvailable,\n\t} );\n\n\tconst { clientId } = props;\n\tconst postType = type || 'page';\n\n\tconst [ addingBlock, setAddingBlock ] = useState( false );\n\tconst [ addingPage, setAddingPage ] = useState( false );\n\tconst [ shouldFocusPane, setShouldFocusPane ] = useState( null );\n\t// Stable initial value for LinkControl's uncontrolled inputValue prop.\n\t// We track the search with the searchInputValueRef, then update the\n\t// initialSearchValue state with the observed searchInputValueRef\n\t// when mounting the LinkControl. If LinkControl becomes a fully\n\t// controlled component, then we can remove this extra complexity.\n\tconst [ initialSearchValue, setInitialSearchValue ] = useState( '' );\n\t// Tracks the live search input between renders without causing re-renders.\n\tconst searchInputValueRef = useRef( '' );\n\t// Call this instead of setting searchInputValueRef.current and\n\t// setInitialSearchValue separately, to keep both in sync.\n\tconst updateSearchValue = ( value ) => {\n\t\tsearchInputValueRef.current = value;\n\t\tsetInitialSearchValue( value );\n\t};\n\tconst linkControlWrapperRef = useRef();\n\tconst addPageButtonRef = useRef();\n\tconst addBlockButtonRef = useRef();\n\tconst permissions = useResourcePermissions( {\n\t\tkind: 'postType',\n\t\tname: postType,\n\t} );\n\n\t// Use the entity binding hook to get binding status\n\tconst { isBoundEntityAvailable } = useEntityBinding( {\n\t\tclientId,\n\t\tattributes: props.link,\n\t} );\n\n\t// Memoize link value to avoid overriding the LinkControl's internal state.\n\t// This is a temporary fix. See https://github.com/WordPress/gutenberg/issues/50976#issuecomment-1568226407.\n\tconst link = useMemo(\n\t\t() => ( {\n\t\t\turl,\n\t\t\topensInNewTab,\n\t\t\ttitle: label && stripHTML( label ),\n\t\t\tentityTitle: entityRecord?.title?.rendered || entityRecord?.name,\n\t\t\tkind,\n\t\t\ttype,\n\t\t\tid,\n\t\t\timage,\n\t\t\tbadges,\n\t\t} ),\n\t\t[\n\t\t\tlabel,\n\t\t\topensInNewTab,\n\t\t\turl,\n\t\t\tkind,\n\t\t\ttype,\n\t\t\tid,\n\t\t\timage,\n\t\t\tbadges,\n\t\t\tentityRecord,\n\t\t]\n\t);\n\n\tconst handlePageCreated = ( pageLink ) => {\n\t\t// Set the new page as the current link\n\t\tprops.onChange( pageLink );\n\t\t// Return to main Link UI and focus the first focusable element\n\t\tsetAddingPage( false );\n\t\tsetShouldFocusPane( true );\n\t\t// Clear search input value\n\t\tupdateSearchValue( '' );\n\t};\n\n\tconst dialogTitleId = useInstanceId(\n\t\tLinkUI,\n\t\t'link-ui-link-control__title'\n\t);\n\tconst dialogDescriptionId = useInstanceId(\n\t\tLinkUI,\n\t\t'link-ui-link-control__description'\n\t);\n\n\t// Focus management when transitioning between panes\n\tuseEffect( () => {\n\t\tif ( shouldFocusPane && linkControlWrapperRef.current ) {\n\t\t\t// If we have a specific element to focus, focus it\n\t\t\tif ( shouldFocusPane?.current ) {\n\t\t\t\t// Focus the specific element passed\n\t\t\t\tshouldFocusPane.current.focus();\n\t\t\t} else {\n\t\t\t\t// Focus the first tabbable element (keyboard-accessible, excluding tabindex=\"-1\")\n\t\t\t\tconst tabbableElements = focus.tabbable.find(\n\t\t\t\t\tlinkControlWrapperRef.current\n\t\t\t\t);\n\t\t\t\tconst nextFocusTarget =\n\t\t\t\t\ttabbableElements[ 0 ] || linkControlWrapperRef.current;\n\t\t\t\tnextFocusTarget.focus();\n\t\t\t}\n\n\t\t\t// Reset the state\n\t\t\tsetShouldFocusPane( false );\n\t\t}\n\t}, [ shouldFocusPane ] );\n\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst canAddBlock = blockEditingMode !== 'disabled';\n\n\t// Blocks are listed in the search results only when the \"Add block\"\n\t// button would be shown: the link has no URL yet and the block is not\n\t// locked.\n\tconst { transformSuggestions, insertBlockFromSuggestion } =\n\t\tuseBlockSuggestions( {\n\t\t\tclientId,\n\t\t\tisEnabled: canAddBlock && ! link?.url?.length,\n\t\t\tonBlockInsert: props.onBlockInsert,\n\t\t\tonClose: props.onClose,\n\t\t} );\n\n\treturn (\n\t\t<Popover\n\t\t\tref={ ref }\n\t\t\tplacement=\"bottom\"\n\t\t\tonClose={ props.onClose }\n\t\t\tanchor={ props.anchor }\n\t\t\tshift\n\t\t>\n\t\t\t{ ! addingBlock && ! addingPage && (\n\t\t\t\t<div\n\t\t\t\t\tref={ linkControlWrapperRef }\n\t\t\t\t\trole=\"dialog\"\n\t\t\t\t\taria-labelledby={ dialogTitleId }\n\t\t\t\t\taria-describedby={ dialogDescriptionId }\n\t\t\t\t>\n\t\t\t\t\t<VisuallyHidden>\n\t\t\t\t\t\t<h2 id={ dialogTitleId }>{ __( 'Add link' ) }</h2>\n\n\t\t\t\t\t\t<p id={ dialogDescriptionId }>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Search for and add a link to your Navigation.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t<LinkControl\n\t\t\t\t\t\thasTextControl\n\t\t\t\t\t\thasRichPreviews\n\t\t\t\t\t\tvalue={ link }\n\t\t\t\t\t\tshowInitialSuggestions\n\t\t\t\t\t\twithCreateSuggestion={ false }\n\t\t\t\t\t\tnoDirectEntry={ !! type }\n\t\t\t\t\t\tnoURLSuggestion={ !! type }\n\t\t\t\t\t\tsuggestionsQuery={ getSuggestionsQuery( type, kind ) }\n\t\t\t\t\t\ttransformSuggestions={ transformSuggestions }\n\t\t\t\t\t\tonChange={ ( updatedValue ) => {\n\t\t\t\t\t\t\tif ( isBlockSuggestion( updatedValue ) ) {\n\t\t\t\t\t\t\t\tinsertBlockFromSuggestion(\n\t\t\t\t\t\t\t\t\tupdatedValue.blockItemId\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tprops.onChange( updatedValue );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonInputChange={ ( value ) => {\n\t\t\t\t\t\t\t// Observe the input value so we can pass the value to the page creator\n\t\t\t\t\t\t\t// and restore it on back button click\n\t\t\t\t\t\t\tsearchInputValueRef.current = value;\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tinputValue={ initialSearchValue }\n\t\t\t\t\t\tonRemove={ props.onRemove }\n\t\t\t\t\t\tonCancel={ props.onCancel }\n\t\t\t\t\t\thandleEntities={ isBoundEntityAvailable }\n\t\t\t\t\t\tforceIsEditingLink={ link?.url ? false : undefined }\n\t\t\t\t\t\trenderControlBottom={ () => {\n\t\t\t\t\t\t\t// Don't show the tools when there is submitted link (preview state).\n\t\t\t\t\t\t\tif ( link?.url?.length ) {\n\t\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<LinkUITools\n\t\t\t\t\t\t\t\t\taddPageButtonRef={ addPageButtonRef }\n\t\t\t\t\t\t\t\t\taddBlockButtonRef={ addBlockButtonRef }\n\t\t\t\t\t\t\t\t\tsetAddingBlock={ () => {\n\t\t\t\t\t\t\t\t\t\tsetAddingBlock( true );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tsetAddingPage={ () => {\n\t\t\t\t\t\t\t\t\t\tsetAddingPage( true );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tcanAddPage={\n\t\t\t\t\t\t\t\t\t\tblockEditingMode !== 'disabled' &&\n\t\t\t\t\t\t\t\t\t\tpermissions?.canCreate &&\n\t\t\t\t\t\t\t\t\t\ttype === 'page'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcanAddBlock={ canAddBlock }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ addingBlock && (\n\t\t\t\t<LinkUIBlockInserter\n\t\t\t\t\tclientId={ props.clientId }\n\t\t\t\t\tonBack={ () => {\n\t\t\t\t\t\tsetAddingBlock( false );\n\t\t\t\t\t\tsetShouldFocusPane( addBlockButtonRef );\n\t\t\t\t\t\tupdateSearchValue( searchInputValueRef.current );\n\t\t\t\t\t} }\n\t\t\t\t\tonBlockInsert={ props?.onBlockInsert }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ addingPage && (\n\t\t\t\t<LinkUIPageCreator\n\t\t\t\t\tpostType={ postType }\n\t\t\t\t\tonBack={ () => {\n\t\t\t\t\t\tsetAddingPage( false );\n\t\t\t\t\t\tsetShouldFocusPane( addPageButtonRef );\n\t\t\t\t\t\tupdateSearchValue( searchInputValueRef.current );\n\t\t\t\t\t} }\n\t\t\t\t\tonPageCreated={ handlePageCreated }\n\t\t\t\t\tinitialTitle={\n\t\t\t\t\t\tsearchInputValueRef.current &&\n\t\t\t\t\t\t! isURL( searchInputValueRef.current )\n\t\t\t\t\t\t\t? searchInputValueRef.current\n\t\t\t\t\t\t\t: ''\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t</Popover>\n\t);\n}\n\nexport const LinkUI = forwardRef( UnforwardedLinkUI );\n\nconst LinkUITools = ( {\n\taddPageButtonRef,\n\taddBlockButtonRef,\n\tsetAddingBlock,\n\tsetAddingPage,\n\tcanAddPage,\n\tcanAddBlock,\n} ) => {\n\tconst blockInserterAriaRole = 'listbox';\n\n\t// Don't render anything if neither button should be shown\n\tif ( ! canAddPage && ! canAddBlock ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<VStack spacing={ 0 } className=\"link-ui-tools\">\n\t\t\t{ canAddPage && (\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tref={ addPageButtonRef }\n\t\t\t\t\ticon={ plus }\n\t\t\t\t\tonClick={ ( e ) => {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\tsetAddingPage( true );\n\t\t\t\t\t} }\n\t\t\t\t\taria-haspopup={ blockInserterAriaRole }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Create page' ) }\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t\t{ canAddBlock && (\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tref={ addBlockButtonRef }\n\t\t\t\t\ticon={ plus }\n\t\t\t\t\tonClick={ ( e ) => {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\tsetAddingBlock( true );\n\t\t\t\t\t} }\n\t\t\t\t\taria-haspopup={ blockInserterAriaRole }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Add block' ) }\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t</VStack>\n\t);\n};\n\nexport default LinkUITools;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAwD;AACxD,wBAIO;AACP,kBAAmB;AACnB,0BAAiD;AACjD,qBAMO;AACP,uBAAuC;AACvC,mBAAqB;AACrB,qBAA8B;AAC9B,gBAA+B;AAC/B,iBAAsB;AACtB,0BAAkC;AAClC,4BAAgC;AAChC,oBAKO;AAmMF;AAzLL,SAAS,wBAAyB,MAAM,MAAO;AAC9C,UAAS,MAAO;AAAA,IACf,KAAK;AAAA,IACL,KAAK;AACJ,aAAO,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,IACtC,KAAK;AACJ,aAAO,EAAE,MAAM,QAAQ,SAAS,WAAW;AAAA,IAC5C,KAAK;AACJ,aAAO,EAAE,MAAM,QAAQ,SAAS,WAAW;AAAA,IAC5C,KAAK;AACJ,aAAO,EAAE,MAAM,cAAc;AAAA,IAC9B;AACC,UAAK,SAAS,YAAa;AAC1B,eAAO,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACtC;AACA,UAAK,SAAS,aAAc;AAC3B,eAAO,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACtC;AAGA,aAAO,EAAE,MAAM,QAAQ,SAAS,O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A,QACA,iBAAgB;AAAA,QAEd,8BAAI,WAAY;AAAA;AAAA,IACnB;AAAA,KAEF;AAEF;AAEA,IAAO,kBAAQ;",
|
|
6
6
|
"names": ["stripHTML", "LinkUIBlockInserter", "VStack"]
|
|
7
7
|
}
|
|
@@ -25,8 +25,10 @@ __export(shared_exports, {
|
|
|
25
25
|
LinkUI: () => import_link_ui.LinkUI,
|
|
26
26
|
buildNavigationLinkEntityBinding: () => import_use_entity_binding.buildNavigationLinkEntityBinding,
|
|
27
27
|
getInvalidLinkHelpText: () => import_controls.getInvalidLinkHelpText,
|
|
28
|
+
isBlockSuggestion: () => import_use_block_suggestions.isBlockSuggestion,
|
|
28
29
|
selectLabelText: () => import_select_label_text.selectLabelText,
|
|
29
30
|
updateAttributes: () => import_update_attributes.updateAttributes,
|
|
31
|
+
useBlockSuggestions: () => import_use_block_suggestions.useBlockSuggestions,
|
|
30
32
|
useEnableLinkStatusValidation: () => import_use_enable_link_status_validation.useEnableLinkStatusValidation,
|
|
31
33
|
useEntityBinding: () => import_use_entity_binding.useEntityBinding,
|
|
32
34
|
useHandleLinkChange: () => import_use_handle_link_change.useHandleLinkChange,
|
|
@@ -46,6 +48,7 @@ var import_use_enable_link_status_validation = require("./use-enable-link-status
|
|
|
46
48
|
var import_use_is_dragging_within = require("./use-is-dragging-within.cjs");
|
|
47
49
|
var import_select_label_text = require("./select-label-text.cjs");
|
|
48
50
|
var import_use_link_preview = require("./use-link-preview.cjs");
|
|
51
|
+
var import_use_block_suggestions = require("./use-block-suggestions.cjs");
|
|
49
52
|
// Annotate the CommonJS export names for ESM import in node:
|
|
50
53
|
0 && (module.exports = {
|
|
51
54
|
Controls,
|
|
@@ -53,8 +56,10 @@ var import_use_link_preview = require("./use-link-preview.cjs");
|
|
|
53
56
|
LinkUI,
|
|
54
57
|
buildNavigationLinkEntityBinding,
|
|
55
58
|
getInvalidLinkHelpText,
|
|
59
|
+
isBlockSuggestion,
|
|
56
60
|
selectLabelText,
|
|
57
61
|
updateAttributes,
|
|
62
|
+
useBlockSuggestions,
|
|
58
63
|
useEnableLinkStatusValidation,
|
|
59
64
|
useEntityBinding,
|
|
60
65
|
useHandleLinkChange,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/navigation-link/shared/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Shared components for Navigation Link and Navigation Submenu blocks.\n *\n * This module provides common functionality that can be used by both blocks\n * to reduce code duplication and ensure consistent behavior.\n */\n\nexport { Controls, getInvalidLinkHelpText } from './controls';\nexport { updateAttributes } from './update-attributes';\nexport {\n\tuseEntityBinding,\n\tbuildNavigationLinkEntityBinding,\n} from './use-entity-binding';\nexport { LinkUI } from '../link-ui';\nexport { useHandleLinkChange } from './use-handle-link-change';\nexport { useIsInvalidLink } from './use-is-invalid-link';\nexport { InvalidDraftDisplay } from './invalid-draft-display';\nexport { useEnableLinkStatusValidation } from './use-enable-link-status-validation';\nexport { useIsDraggingWithin } from './use-is-dragging-within';\nexport { selectLabelText } from './select-label-text';\nexport { useLinkPreview } from './use-link-preview';\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,sBAAiD;AACjD,+BAAiC;AACjC,gCAGO;AACP,qBAAuB;AACvB,oCAAoC;AACpC,iCAAiC;AACjC,mCAAoC;AACpC,+CAA8C;AAC9C,oCAAoC;AACpC,+BAAgC;AAChC,8BAA+B;",
|
|
4
|
+
"sourcesContent": ["/**\n * Shared components for Navigation Link and Navigation Submenu blocks.\n *\n * This module provides common functionality that can be used by both blocks\n * to reduce code duplication and ensure consistent behavior.\n */\n\nexport { Controls, getInvalidLinkHelpText } from './controls';\nexport { updateAttributes } from './update-attributes';\nexport {\n\tuseEntityBinding,\n\tbuildNavigationLinkEntityBinding,\n} from './use-entity-binding';\nexport { LinkUI } from '../link-ui';\nexport { useHandleLinkChange } from './use-handle-link-change';\nexport { useIsInvalidLink } from './use-is-invalid-link';\nexport { InvalidDraftDisplay } from './invalid-draft-display';\nexport { useEnableLinkStatusValidation } from './use-enable-link-status-validation';\nexport { useIsDraggingWithin } from './use-is-dragging-within';\nexport { selectLabelText } from './select-label-text';\nexport { useLinkPreview } from './use-link-preview';\nexport {\n\tisBlockSuggestion,\n\tuseBlockSuggestions,\n} from './use-block-suggestions';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,sBAAiD;AACjD,+BAAiC;AACjC,gCAGO;AACP,qBAAuB;AACvB,oCAAoC;AACpC,iCAAiC;AACjC,mCAAoC;AACpC,+CAA8C;AAC9C,oCAAoC;AACpC,+BAAgC;AAChC,8BAA+B;AAC/B,mCAGO;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/block-library/src/navigation-link/shared/use-block-suggestions.js
|
|
21
|
+
var use_block_suggestions_exports = {};
|
|
22
|
+
__export(use_block_suggestions_exports, {
|
|
23
|
+
BLOCK_SUGGESTION_TYPE: () => BLOCK_SUGGESTION_TYPE,
|
|
24
|
+
addBlockSuggestions: () => addBlockSuggestions,
|
|
25
|
+
isBlockSuggestion: () => isBlockSuggestion,
|
|
26
|
+
useBlockSuggestions: () => useBlockSuggestions
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(use_block_suggestions_exports);
|
|
29
|
+
var import_i18n = require("@wordpress/i18n");
|
|
30
|
+
var import_a11y = require("@wordpress/a11y");
|
|
31
|
+
var import_element = require("@wordpress/element");
|
|
32
|
+
var import_data = require("@wordpress/data");
|
|
33
|
+
var import_blocks = require("@wordpress/blocks");
|
|
34
|
+
var import_block_editor = require("@wordpress/block-editor");
|
|
35
|
+
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
36
|
+
var { searchItems, normalizeString } = (0, import_lock_unlock.unlock)(import_block_editor.privateApis);
|
|
37
|
+
var BLOCK_SUGGESTION_TYPE = "block";
|
|
38
|
+
function isBlockSuggestion(suggestion) {
|
|
39
|
+
return suggestion?.type === BLOCK_SUGGESTION_TYPE && typeof suggestion.blockItemId === "string";
|
|
40
|
+
}
|
|
41
|
+
var EXCLUDED_BLOCK_NAMES = ["core/navigation-link"];
|
|
42
|
+
var SEARCH_FIELDS = [
|
|
43
|
+
{ get: (item) => item.title },
|
|
44
|
+
{ get: (item) => item.keywords }
|
|
45
|
+
];
|
|
46
|
+
function addBlockSuggestions(suggestions, blockItems, searchTerm) {
|
|
47
|
+
if (!searchTerm?.trim()) {
|
|
48
|
+
return suggestions;
|
|
49
|
+
}
|
|
50
|
+
const matches = searchItems(blockItems, searchTerm, {
|
|
51
|
+
fields: SEARCH_FIELDS,
|
|
52
|
+
filter: (item) => !item.isDisabled && !EXCLUDED_BLOCK_NAMES.includes(item.name)
|
|
53
|
+
});
|
|
54
|
+
if (!matches.length) {
|
|
55
|
+
return suggestions;
|
|
56
|
+
}
|
|
57
|
+
const search = normalizeString(searchTerm.trim());
|
|
58
|
+
const before = [];
|
|
59
|
+
const after = [];
|
|
60
|
+
for (const item of matches) {
|
|
61
|
+
const suggestion = {
|
|
62
|
+
id: item.id,
|
|
63
|
+
blockItemId: item.id,
|
|
64
|
+
type: BLOCK_SUGGESTION_TYPE,
|
|
65
|
+
title: item.title,
|
|
66
|
+
icon: (0, import_element.createElement)(import_block_editor.BlockIcon, { icon: item.icon }),
|
|
67
|
+
typeLabel: (0, import_i18n.__)("Block")
|
|
68
|
+
};
|
|
69
|
+
if (normalizeString(item.title).startsWith(search)) {
|
|
70
|
+
before.push(suggestion);
|
|
71
|
+
} else {
|
|
72
|
+
after.push(suggestion);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return [...before, ...suggestions, ...after];
|
|
76
|
+
}
|
|
77
|
+
function useBlockSuggestions({
|
|
78
|
+
clientId,
|
|
79
|
+
isEnabled,
|
|
80
|
+
onBlockInsert,
|
|
81
|
+
onClose
|
|
82
|
+
}) {
|
|
83
|
+
const {
|
|
84
|
+
getBlockIndex,
|
|
85
|
+
getBlockOrder,
|
|
86
|
+
getBlockRootClientId,
|
|
87
|
+
getInserterItems
|
|
88
|
+
} = (0, import_data.useSelect)(import_block_editor.store);
|
|
89
|
+
const { insertBlock, replaceBlock } = (0, import_data.useDispatch)(import_block_editor.store);
|
|
90
|
+
const transformSuggestions = (0, import_element.useCallback)(
|
|
91
|
+
(suggestions, { isInitialSuggestions, searchTerm }) => isInitialSuggestions ? suggestions : addBlockSuggestions(
|
|
92
|
+
suggestions,
|
|
93
|
+
getInserterItems(getBlockRootClientId(clientId)),
|
|
94
|
+
searchTerm
|
|
95
|
+
),
|
|
96
|
+
[clientId, getBlockRootClientId, getInserterItems]
|
|
97
|
+
);
|
|
98
|
+
const insertBlockFromSuggestion = (itemId) => {
|
|
99
|
+
const rootClientId = getBlockRootClientId(clientId);
|
|
100
|
+
const item = getInserterItems(rootClientId).find(
|
|
101
|
+
({ id }) => id === itemId
|
|
102
|
+
);
|
|
103
|
+
if (!item) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const block = (0, import_blocks.createBlock)(
|
|
107
|
+
item.name,
|
|
108
|
+
item.initialAttributes,
|
|
109
|
+
(0, import_blocks.createBlocksFromInnerBlocksTemplate)(item.innerBlocks)
|
|
110
|
+
);
|
|
111
|
+
const index = getBlockIndex(clientId);
|
|
112
|
+
if (onBlockInsert) {
|
|
113
|
+
insertBlock(block, index, rootClientId, false);
|
|
114
|
+
onBlockInsert(block);
|
|
115
|
+
} else if (getBlockOrder(clientId).length) {
|
|
116
|
+
insertBlock(block, index, rootClientId);
|
|
117
|
+
onClose?.();
|
|
118
|
+
} else {
|
|
119
|
+
replaceBlock(clientId, block);
|
|
120
|
+
}
|
|
121
|
+
(0, import_a11y.speak)(
|
|
122
|
+
(0, import_i18n.sprintf)(
|
|
123
|
+
/* translators: %s: The title of the block that was added. */
|
|
124
|
+
(0, import_i18n.__)("%s block added."),
|
|
125
|
+
item.title
|
|
126
|
+
)
|
|
127
|
+
);
|
|
128
|
+
};
|
|
129
|
+
return {
|
|
130
|
+
transformSuggestions: isEnabled ? transformSuggestions : void 0,
|
|
131
|
+
insertBlockFromSuggestion
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
135
|
+
0 && (module.exports = {
|
|
136
|
+
BLOCK_SUGGESTION_TYPE,
|
|
137
|
+
addBlockSuggestions,
|
|
138
|
+
isBlockSuggestion,
|
|
139
|
+
useBlockSuggestions
|
|
140
|
+
});
|
|
141
|
+
//# sourceMappingURL=use-block-suggestions.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/navigation-link/shared/use-block-suggestions.js"],
|
|
4
|
+
"sourcesContent": ["import { __, sprintf } from '@wordpress/i18n';\nimport { speak } from '@wordpress/a11y';\nimport { createElement, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tcreateBlock,\n\tcreateBlocksFromInnerBlocksTemplate,\n} from '@wordpress/blocks';\nimport {\n\tBlockIcon,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { unlock } from '../../lock-unlock';\n\nconst { searchItems, normalizeString } = unlock( blockEditorPrivateApis );\n\n/**\n * The `type` of a suggestion that inserts a block rather than setting a link.\n */\nexport const BLOCK_SUGGESTION_TYPE = 'block';\n\n/**\n * Whether a suggestion inserts a block rather than setting a link.\n *\n * The `type` alone is not enough: a site can register a post type called\n * \"block\", whose results arrive with that type. Only a block suggestion\n * carries the inserter item it was made from.\n *\n * @param {Object} suggestion A link suggestion.\n * @return {boolean} Whether it is a block suggestion.\n */\nexport function isBlockSuggestion( suggestion ) {\n\treturn (\n\t\tsuggestion?.type === BLOCK_SUGGESTION_TYPE &&\n\t\ttypeof suggestion.blockItemId === 'string'\n\t);\n}\n\n/**\n * The link variations are left out: searching already finds the pages, posts\n * and terms they would link to.\n */\nconst EXCLUDED_BLOCK_NAMES = [ 'core/navigation-link' ];\n\n// Match on what a block is called, not on its description or category, which\n// would list blocks for words that only happen to describe them.\nconst SEARCH_FIELDS = [\n\t{ get: ( item ) => item.title },\n\t{ get: ( item ) => item.keywords },\n];\n\n/**\n * Adds the blocks that match a search to the link suggestions.\n *\n * A block whose title starts with the search is what was asked for by name,\n * so it goes before the links. Any other matching block goes after them.\n *\n * @param {Array} suggestions Link suggestions.\n * @param {Array} blockItems Inserter items the Navigation allows.\n * @param {string} searchTerm What the user typed.\n * @return {Array} The suggestions, with any matching blocks added.\n */\nexport function addBlockSuggestions( suggestions, blockItems, searchTerm ) {\n\tif ( ! searchTerm?.trim() ) {\n\t\treturn suggestions;\n\t}\n\n\tconst matches = searchItems( blockItems, searchTerm, {\n\t\tfields: SEARCH_FIELDS,\n\t\tfilter: ( item ) =>\n\t\t\t! item.isDisabled && ! EXCLUDED_BLOCK_NAMES.includes( item.name ),\n\t} );\n\n\tif ( ! matches.length ) {\n\t\treturn suggestions;\n\t}\n\n\tconst search = normalizeString( searchTerm.trim() );\n\tconst before = [];\n\tconst after = [];\n\n\tfor ( const item of matches ) {\n\t\tconst suggestion = {\n\t\t\tid: item.id,\n\t\t\tblockItemId: item.id,\n\t\t\ttype: BLOCK_SUGGESTION_TYPE,\n\t\t\ttitle: item.title,\n\t\t\ticon: createElement( BlockIcon, { icon: item.icon } ),\n\t\t\ttypeLabel: __( 'Block' ),\n\t\t};\n\n\t\tif ( normalizeString( item.title ).startsWith( search ) ) {\n\t\t\tbefore.push( suggestion );\n\t\t} else {\n\t\t\tafter.push( suggestion );\n\t\t}\n\t}\n\n\treturn [ ...before, ...suggestions, ...after ];\n}\n\n/**\n * Lists the blocks a Navigation allows in a link's search results, and\n * inserts the one that is chosen.\n *\n * The allowed blocks are read when a search runs, not subscribed to, so an\n * open link UI does no work as the editor changes.\n *\n * @param {Object} options Hook options.\n * @param {string} options.clientId Client ID of the link or submenu.\n * @param {boolean} options.isEnabled Whether to list blocks at all.\n * @param {Function=} options.onBlockInsert Called with the inserted block by a\n * caller that tracks the new link,\n * such as the list view.\n * @param {Function=} options.onClose Closes the link UI.\n * @return {{ transformSuggestions: Function|undefined, insertBlockFromSuggestion: Function }}\n * The `transformSuggestions` to give LinkControl, and the handler for a chosen\n * block suggestion.\n */\nexport function useBlockSuggestions( {\n\tclientId,\n\tisEnabled,\n\tonBlockInsert,\n\tonClose,\n} ) {\n\tconst {\n\t\tgetBlockIndex,\n\t\tgetBlockOrder,\n\t\tgetBlockRootClientId,\n\t\tgetInserterItems,\n\t} = useSelect( blockEditorStore );\n\tconst { insertBlock, replaceBlock } = useDispatch( blockEditorStore );\n\n\tconst transformSuggestions = useCallback(\n\t\t( suggestions, { isInitialSuggestions, searchTerm } ) =>\n\t\t\tisInitialSuggestions\n\t\t\t\t? suggestions\n\t\t\t\t: addBlockSuggestions(\n\t\t\t\t\t\tsuggestions,\n\t\t\t\t\t\tgetInserterItems( getBlockRootClientId( clientId ) ),\n\t\t\t\t\t\tsearchTerm\n\t\t\t\t\t),\n\t\t[ clientId, getBlockRootClientId, getInserterItems ]\n\t);\n\n\tconst insertBlockFromSuggestion = ( itemId ) => {\n\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\tconst item = getInserterItems( rootClientId ).find(\n\t\t\t( { id } ) => id === itemId\n\t\t);\n\n\t\tif ( ! item ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst block = createBlock(\n\t\t\titem.name,\n\t\t\titem.initialAttributes,\n\t\t\tcreateBlocksFromInnerBlocksTemplate( item.innerBlocks )\n\t\t);\n\t\tconst index = getBlockIndex( clientId );\n\n\t\tif ( onBlockInsert ) {\n\t\t\t// A caller that tracks the new link, such as the list view, removes\n\t\t\t// it itself once told about the block, as with the \"Add block\" pane.\n\t\t\tinsertBlock( block, index, rootClientId, false );\n\t\t\tonBlockInsert( block );\n\t\t} else if ( getBlockOrder( clientId ).length ) {\n\t\t\t// A submenu keeps its items, so the block goes before it, where the\n\t\t\t// \"Add block\" pane puts it.\n\t\t\tinsertBlock( block, index, rootClientId );\n\t\t\tonClose?.();\n\t\t} else {\n\t\t\t// An empty link is replaced by the block.\n\t\t\treplaceBlock( clientId, block );\n\t\t}\n\n\t\tspeak(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: The title of the block that was added. */\n\t\t\t\t__( '%s block added.' ),\n\t\t\t\titem.title\n\t\t\t)\n\t\t);\n\t};\n\n\treturn {\n\t\ttransformSuggestions: isEnabled ? transformSuggestions : undefined,\n\t\tinsertBlockFromSuggestion,\n\t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ACD;AAEA,SAAO;AAAA,IACN,sBAAsB,YAAY,uBAAuB;AAAA,IACzD;AAAA,EACD;AACD;",
|
|
6
|
+
"names": ["blockEditorPrivateApis", "blockEditorStore"]
|
|
7
|
+
}
|
|
@@ -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,
|
|
@@ -428,7 +428,7 @@ function PostFeaturedImageEdit({
|
|
|
428
428
|
}
|
|
429
429
|
) }),
|
|
430
430
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("figure", { ...blockProps, children: [
|
|
431
|
-
!!isLink ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: postPermalink, target: linkTarget, children: image }) : image,
|
|
431
|
+
!!isLink && (featuredImage || temporaryURL) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: postPermalink, target: linkTarget, children: image }) : image,
|
|
432
432
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
433
433
|
import_overlay.default,
|
|
434
434
|
{
|