@wordpress/block-library 10.6.1-next.v.202609031004.0 → 11.0.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 +9 -1
- package/build/audio/edit.cjs +5 -5
- package/build/audio/edit.cjs.map +2 -2
- package/build/audio/index.cjs +0 -37
- package/build/audio/index.cjs.map +3 -3
- package/build/button/index.cjs +0 -34
- package/build/button/index.cjs.map +3 -3
- package/build/code/index.cjs +0 -17
- package/build/code/index.cjs.map +3 -3
- package/build/cover/index.cjs +0 -38
- package/build/cover/index.cjs.map +3 -3
- package/build/details/index.cjs +0 -17
- package/build/details/index.cjs.map +3 -3
- package/build/file/index.cjs +0 -43
- package/build/file/index.cjs.map +3 -3
- package/build/footnotes/format.cjs +1 -1
- package/build/footnotes/format.cjs.map +2 -2
- package/build/gallery/dynamic-gallery.cjs +12 -9
- package/build/gallery/dynamic-gallery.cjs.map +2 -2
- package/build/heading/index.cjs +0 -16
- package/build/heading/index.cjs.map +3 -3
- package/build/image/image.cjs +1 -2
- package/build/image/image.cjs.map +2 -2
- package/build/image/index.cjs +0 -81
- package/build/image/index.cjs.map +3 -3
- package/build/index.cjs +0 -10
- package/build/index.cjs.map +2 -2
- package/build/list-item/edit.cjs +14 -11
- package/build/list-item/edit.cjs.map +2 -2
- package/build/list-item/hooks/index.cjs +6 -9
- package/build/list-item/hooks/index.cjs.map +2 -2
- package/build/list-item/hooks/use-enter.cjs +62 -67
- package/build/list-item/hooks/use-enter.cjs.map +3 -3
- package/build/list-item/hooks/use-merge.cjs +26 -44
- package/build/list-item/hooks/use-merge.cjs.map +3 -3
- package/build/list-item/hooks/use-multi-select-tab.cjs +80 -0
- package/build/list-item/hooks/use-multi-select-tab.cjs.map +7 -0
- package/build/list-item/hooks/use-tab.cjs +65 -0
- package/build/list-item/hooks/use-tab.cjs.map +7 -0
- package/build/list-item/index.cjs +0 -17
- package/build/list-item/index.cjs.map +3 -3
- package/build/list-item/utils.cjs +169 -0
- package/build/list-item/utils.cjs.map +7 -0
- package/build/media-text/index.cjs +0 -50
- package/build/media-text/index.cjs.map +3 -3
- package/build/media-text/media-container.cjs +16 -11
- package/build/media-text/media-container.cjs.map +2 -2
- package/build/more/index.cjs +0 -18
- package/build/more/index.cjs.map +3 -3
- package/build/navigation/constants.cjs +1 -1
- package/build/navigation/constants.cjs.map +1 -1
- package/build/navigation-link/block.json +1 -1
- package/build/navigation-link/deprecated.cjs +69 -0
- package/build/navigation-link/deprecated.cjs.map +7 -0
- package/build/navigation-link/index.cjs +6 -74
- package/build/navigation-link/index.cjs.map +4 -4
- package/build/{form-submit-button/init.cjs → navigation-link/variations.cjs} +23 -8
- package/build/navigation-link/variations.cjs.map +7 -0
- package/build/navigation-submenu/index.cjs +0 -32
- package/build/navigation-submenu/index.cjs.map +3 -3
- package/build/paragraph/index.cjs +0 -17
- package/build/paragraph/index.cjs.map +3 -3
- package/build/paragraph/use-enter.cjs +8 -4
- package/build/paragraph/use-enter.cjs.map +2 -2
- package/build/post-template/edit.cjs +3 -1
- package/build/post-template/edit.cjs.map +2 -2
- package/build/preformatted/index.cjs +0 -17
- package/build/preformatted/index.cjs.map +3 -3
- package/build/pullquote/index.cjs +0 -24
- package/build/pullquote/index.cjs.map +3 -3
- package/build/query/edit/inspector-controls/index.cjs +9 -4
- package/build/query/edit/inspector-controls/index.cjs.map +2 -2
- package/build/search/index.cjs +0 -31
- package/build/search/index.cjs.map +3 -3
- package/build/site-tagline/edit.cjs +11 -17
- package/build/site-tagline/edit.cjs.map +2 -2
- package/build/site-title/edit.cjs +12 -18
- package/build/site-title/edit.cjs.map +2 -2
- package/build/social-link/index.cjs +0 -31
- package/build/social-link/index.cjs.map +3 -3
- package/build/verse/index.cjs +0 -17
- package/build/verse/index.cjs.map +3 -3
- package/build/video/index.cjs +0 -40
- package/build/video/index.cjs.map +3 -3
- package/build/video/tracks-editor.cjs +2 -3
- package/build/video/tracks-editor.cjs.map +3 -3
- package/build-module/audio/edit.mjs +5 -5
- package/build-module/audio/edit.mjs.map +2 -2
- package/build-module/audio/index.mjs +0 -37
- package/build-module/audio/index.mjs.map +2 -2
- package/build-module/button/index.mjs +0 -34
- package/build-module/button/index.mjs.map +2 -2
- package/build-module/code/index.mjs +0 -17
- package/build-module/code/index.mjs.map +2 -2
- package/build-module/cover/index.mjs +0 -38
- package/build-module/cover/index.mjs.map +2 -2
- package/build-module/details/index.mjs +0 -17
- package/build-module/details/index.mjs.map +2 -2
- package/build-module/file/index.mjs +1 -44
- package/build-module/file/index.mjs.map +2 -2
- package/build-module/footnotes/format.mjs +1 -1
- package/build-module/footnotes/format.mjs.map +2 -2
- package/build-module/gallery/dynamic-gallery.mjs +12 -9
- package/build-module/gallery/dynamic-gallery.mjs.map +2 -2
- package/build-module/heading/index.mjs +1 -21
- package/build-module/heading/index.mjs.map +2 -2
- package/build-module/image/image.mjs +1 -2
- package/build-module/image/image.mjs.map +2 -2
- package/build-module/image/index.mjs +0 -81
- package/build-module/image/index.mjs.map +2 -2
- package/build-module/index.mjs +0 -10
- package/build-module/index.mjs.map +2 -2
- package/build-module/list-item/edit.mjs +20 -18
- package/build-module/list-item/edit.mjs.map +2 -2
- package/build-module/list-item/hooks/index.mjs +8 -10
- package/build-module/list-item/hooks/index.mjs.map +2 -2
- package/build-module/list-item/hooks/use-enter.mjs +63 -58
- package/build-module/list-item/hooks/use-enter.mjs.map +2 -2
- package/build-module/list-item/hooks/use-merge.mjs +27 -35
- package/build-module/list-item/hooks/use-merge.mjs.map +2 -2
- package/build-module/list-item/hooks/use-multi-select-tab.mjs +59 -0
- package/build-module/list-item/hooks/use-multi-select-tab.mjs.map +7 -0
- package/build-module/list-item/hooks/use-tab.mjs +44 -0
- package/build-module/list-item/hooks/use-tab.mjs.map +7 -0
- package/build-module/list-item/index.mjs +0 -17
- package/build-module/list-item/index.mjs.map +2 -2
- package/build-module/list-item/utils.mjs +140 -0
- package/build-module/list-item/utils.mjs.map +7 -0
- package/build-module/media-text/index.mjs +0 -50
- package/build-module/media-text/index.mjs.map +2 -2
- package/build-module/media-text/media-container.mjs +17 -12
- package/build-module/media-text/media-container.mjs.map +2 -2
- package/build-module/more/index.mjs +0 -18
- package/build-module/more/index.mjs.map +2 -2
- package/build-module/navigation/constants.mjs +1 -1
- package/build-module/navigation/constants.mjs.map +1 -1
- package/build-module/navigation-link/block.json +1 -1
- package/build-module/navigation-link/deprecated.mjs +48 -0
- package/build-module/navigation-link/deprecated.mjs.map +7 -0
- package/build-module/navigation-link/index.mjs +7 -75
- package/build-module/navigation-link/index.mjs.map +3 -3
- package/build-module/navigation-link/variations.mjs +22 -0
- package/build-module/navigation-link/variations.mjs.map +7 -0
- package/build-module/navigation-submenu/index.mjs +1 -33
- package/build-module/navigation-submenu/index.mjs.map +2 -2
- package/build-module/paragraph/index.mjs +0 -17
- package/build-module/paragraph/index.mjs.map +2 -2
- package/build-module/paragraph/use-enter.mjs +8 -4
- package/build-module/paragraph/use-enter.mjs.map +2 -2
- package/build-module/post-template/edit.mjs +3 -1
- package/build-module/post-template/edit.mjs.map +2 -2
- package/build-module/preformatted/index.mjs +0 -17
- package/build-module/preformatted/index.mjs.map +2 -2
- package/build-module/pullquote/index.mjs +0 -24
- package/build-module/pullquote/index.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/index.mjs +9 -4
- package/build-module/query/edit/inspector-controls/index.mjs.map +2 -2
- package/build-module/search/index.mjs +0 -31
- package/build-module/search/index.mjs.map +2 -2
- package/build-module/site-tagline/edit.mjs +13 -19
- package/build-module/site-tagline/edit.mjs.map +2 -2
- package/build-module/site-title/edit.mjs +14 -20
- package/build-module/site-title/edit.mjs.map +2 -2
- package/build-module/social-link/index.mjs +0 -31
- package/build-module/social-link/index.mjs.map +2 -2
- package/build-module/verse/index.mjs +0 -17
- package/build-module/verse/index.mjs.map +2 -2
- package/build-module/video/index.mjs +0 -40
- package/build-module/video/index.mjs.map +2 -2
- package/build-module/video/tracks-editor.mjs +3 -5
- package/build-module/video/tracks-editor.mjs.map +2 -2
- package/build-style/editor-rtl.css +8 -51
- package/build-style/editor.css +8 -51
- package/build-style/navigation/editor-rtl.css +8 -0
- package/build-style/navigation/editor.css +8 -0
- package/build-style/style-rtl.css +0 -47
- package/build-style/style.css +0 -47
- package/build-types/navigation-link/deprecated.d.ts +48 -0
- package/build-types/navigation-link/deprecated.d.ts.map +1 -0
- package/package.json +42 -43
- package/src/accordion/index.php +2 -2
- package/src/accordion-item/index.php +1 -1
- package/src/audio/edit.jsx +6 -7
- package/src/audio/index.js +0 -37
- package/src/breadcrumbs/index.php +4 -4
- package/src/button/index.js +0 -34
- package/src/button/test/get-experimental-label.jsdom.test.js +1 -0
- package/src/code/index.js +0 -18
- package/src/columns/test/transforms.jsdom.test.js +1 -0
- package/src/comment-template/index.php +2 -2
- package/src/cover/index.js +0 -39
- package/src/cover/test/edit.jsdom.test.js +18 -17
- package/src/cover/test/transforms.jsdom.test.js +1 -0
- package/src/details/index.js +0 -18
- package/src/editor.scss +0 -2
- package/src/embed/test/index.jsdom.test.js +5 -1
- package/src/file/index.js +1 -43
- package/src/footnotes/format.jsx +5 -1
- package/src/gallery/dynamic-gallery.jsx +5 -2
- package/src/gallery/test/edit.jsdom.test.js +4 -0
- package/src/gallery/test/transforms.jsdom.test.js +1 -0
- package/src/gallery/test/use-get-new-images.jsdom.test.jsx +1 -0
- package/src/group/test/placeholder.jsdom.test.jsx +1 -0
- package/src/heading/index.js +1 -22
- package/src/heading/index.php +1 -1
- package/src/home-link/index.php +2 -2
- package/src/html/test/index.jsdom.test.js +9 -0
- package/src/html/test/utils.jsdom.test.js +1 -0
- package/src/image/image.jsx +1 -4
- package/src/image/index.js +0 -80
- package/src/image/test/transforms.jsdom.test.js +1 -0
- package/src/image/test/use-open-image-media-editor-modal.jsdom.test.js +30 -29
- package/src/index.jsx +0 -11
- package/src/latest-posts/test/deprecated.jsdom.test.js +1 -0
- package/src/list/index.php +1 -1
- package/src/list-item/edit.jsx +20 -20
- package/src/list-item/hooks/index.js +2 -3
- package/src/list-item/hooks/use-enter.js +82 -70
- package/src/list-item/hooks/use-merge.js +28 -36
- package/src/list-item/hooks/use-multi-select-tab.js +83 -0
- package/src/list-item/hooks/use-tab.js +62 -0
- package/src/list-item/index.js +0 -18
- package/src/list-item/utils.js +236 -0
- package/src/media-text/index.js +0 -50
- package/src/media-text/media-container.jsx +22 -12
- package/src/more/index.js +0 -19
- package/src/navigation/constants.js +1 -1
- package/src/navigation/edit/test/layout-custom-properties.jsdom.test.js +8 -7
- package/src/navigation/edit/test/navigation-menu-selector.jsdom.test.jsx +23 -14
- package/src/navigation/edit/test/overlay-template-part-selector.jsdom.test.jsx +22 -20
- package/src/navigation/edit/test/responsive-wrapper.jsdom.test.jsx +14 -13
- package/src/navigation/edit/test/use-create-overlay.jsdom.test.js +19 -24
- package/src/navigation/editor.scss +13 -0
- package/src/navigation/index.php +14 -14
- package/src/navigation/test/menu-items-to-blocks.jsdom.test.js +3 -2
- package/src/navigation/test/use-navigation-menu.jsdom.test.js +7 -4
- package/src/navigation/test/view.jsdom.test.js +4 -2
- package/src/navigation-link/block.json +1 -1
- package/src/navigation-link/deprecated.tsx +58 -0
- package/src/navigation-link/{index.jsx → index.js} +5 -77
- package/src/navigation-link/index.php +5 -5
- package/src/navigation-link/shared/test/controls.jsdom.test.jsx +18 -18
- package/src/navigation-link/shared/test/use-enable-link-status-validation.jsdom.test.js +8 -6
- package/src/navigation-link/shared/test/use-entity-binding.jsdom.test.js +12 -11
- package/src/navigation-link/shared/test/use-handle-link-change.jsdom.test.js +23 -20
- package/src/navigation-link/shared/test/use-link-preview.jsdom.test.js +17 -14
- package/src/navigation-link/test/__snapshots__/hooks.jsdom.test.js.snap +2 -2
- package/src/navigation-link/test/hooks.jsdom.test.js +1 -0
- package/src/navigation-link/variations.js +19 -0
- package/src/navigation-submenu/index.js +1 -33
- package/src/page-list/index.php +10 -10
- package/src/page-list/test/convert-to-navigation-links.jsdom.test.js +3 -2
- package/src/paragraph/index.js +0 -18
- package/src/paragraph/use-enter.js +13 -6
- package/src/playlist/test/edit-component.jsdom.test.jsx +31 -30
- package/src/playlist/test/edit.jsdom.test.js +1 -0
- package/src/playlist/test/transforms.jsdom.test.js +1 -0
- package/src/playlist-track/test/edit.jsdom.test.jsx +20 -19
- package/src/post-author/index.php +3 -3
- package/src/post-author-biography/index.php +3 -3
- package/src/post-author-name/index.php +3 -3
- package/src/post-comments-link/index.php +4 -4
- package/src/post-date/test/edit.jsdom.test.js +1 -0
- package/src/post-template/edit.jsx +3 -1
- package/src/post-time-to-read/index.php +3 -3
- package/src/preformatted/index.js +0 -18
- package/src/pullquote/index.js +0 -24
- package/src/query/edit/inspector-controls/index.jsx +9 -4
- package/src/query/index.php +2 -2
- package/src/query/test/utils.jsdom.test.js +1 -0
- package/src/quote/test/migrate.jsdom.test.js +1 -0
- package/src/read-more/index.php +1 -1
- package/src/search/index.js +0 -30
- package/src/search/index.php +1 -1
- package/src/separator/test/edit.jsdom.test.jsx +5 -4
- package/src/site-logo/index.php +1 -1
- package/src/site-tagline/edit.jsx +18 -27
- package/src/site-title/edit.jsx +20 -27
- package/src/social-link/index.js +0 -32
- package/src/social-link/index.php +0 -1
- package/src/style.scss +0 -1
- package/src/table-of-contents/index.php +3 -3
- package/src/utils/test/style-state.jsdom.test.js +1 -0
- package/src/utils/test/waveform-player-dependency.jsdom.test.js +15 -21
- package/src/verse/index.js +0 -18
- package/src/video/index.js +0 -40
- package/src/video/tracks-editor.jsx +4 -5
- package/build/form/block.json +0 -65
- package/build/form/deprecated.cjs +0 -111
- package/build/form/deprecated.cjs.map +0 -7
- package/build/form/edit.cjs +0 -180
- package/build/form/edit.cjs.map +0 -7
- package/build/form/icons.cjs +0 -33
- package/build/form/icons.cjs.map +0 -7
- package/build/form/index.cjs +0 -118
- package/build/form/index.cjs.map +0 -7
- package/build/form/init.cjs +0 -28
- package/build/form/init.cjs.map +0 -7
- package/build/form/save.cjs +0 -40
- package/build/form/save.cjs.map +0 -7
- package/build/form/utils.cjs +0 -61
- package/build/form/utils.cjs.map +0 -7
- package/build/form/variations.cjs +0 -152
- package/build/form/variations.cjs.map +0 -7
- package/build/form/view.cjs +0 -48
- package/build/form/view.cjs.map +0 -7
- package/build/form-input/block.json +0 -72
- package/build/form-input/deprecated.cjs +0 -252
- package/build/form-input/deprecated.cjs.map +0 -7
- package/build/form-input/edit.cjs +0 -206
- package/build/form-input/edit.cjs.map +0 -7
- package/build/form-input/icons.cjs +0 -33
- package/build/form-input/icons.cjs.map +0 -7
- package/build/form-input/index.cjs +0 -63
- package/build/form-input/index.cjs.map +0 -7
- package/build/form-input/init.cjs +0 -28
- package/build/form-input/init.cjs.map +0 -7
- package/build/form-input/save.cjs +0 -88
- package/build/form-input/save.cjs.map +0 -7
- package/build/form-input/variations.cjs +0 -105
- package/build/form-input/variations.cjs.map +0 -7
- package/build/form-submission-notification/block.json +0 -19
- package/build/form-submission-notification/edit.cjs +0 -71
- package/build/form-submission-notification/edit.cjs.map +0 -7
- package/build/form-submission-notification/index.cjs +0 -73
- package/build/form-submission-notification/index.cjs.map +0 -7
- package/build/form-submission-notification/init.cjs +0 -28
- package/build/form-submission-notification/init.cjs.map +0 -7
- package/build/form-submission-notification/save.cjs +0 -54
- package/build/form-submission-notification/save.cjs.map +0 -7
- package/build/form-submission-notification/variations.cjs +0 -78
- package/build/form-submission-notification/variations.cjs.map +0 -7
- package/build/form-submit-button/block.json +0 -15
- package/build/form-submit-button/edit.cjs +0 -36
- package/build/form-submit-button/edit.cjs.map +0 -7
- package/build/form-submit-button/index.cjs +0 -75
- package/build/form-submit-button/index.cjs.map +0 -7
- package/build/form-submit-button/init.cjs.map +0 -7
- package/build/form-submit-button/save.cjs +0 -32
- package/build/form-submit-button/save.cjs.map +0 -7
- package/build/list-item/hooks/use-indent-list-item.cjs +0 -79
- package/build/list-item/hooks/use-indent-list-item.cjs.map +0 -7
- package/build/list-item/hooks/use-outdent-list-item.cjs +0 -106
- package/build/list-item/hooks/use-outdent-list-item.cjs.map +0 -7
- package/build/list-item/hooks/use-space.cjs +0 -83
- package/build/list-item/hooks/use-space.cjs.map +0 -7
- package/build-module/form/block.json +0 -65
- package/build-module/form/deprecated.mjs +0 -96
- package/build-module/form/deprecated.mjs.map +0 -7
- package/build-module/form/edit.mjs +0 -170
- package/build-module/form/edit.mjs.map +0 -7
- package/build-module/form/icons.mjs +0 -8
- package/build-module/form/icons.mjs.map +0 -7
- package/build-module/form/index.mjs +0 -83
- package/build-module/form/index.mjs.map +0 -7
- package/build-module/form/init.mjs +0 -7
- package/build-module/form/init.mjs.map +0 -7
- package/build-module/form/save.mjs +0 -19
- package/build-module/form/save.mjs.map +0 -7
- package/build-module/form/utils.mjs +0 -35
- package/build-module/form/utils.mjs.map +0 -7
- package/build-module/form/variations.mjs +0 -134
- package/build-module/form/variations.mjs.map +0 -7
- package/build-module/form/view.mjs +0 -46
- package/build-module/form/view.mjs.map +0 -7
- package/build-module/form-input/block.json +0 -72
- package/build-module/form-input/deprecated.mjs +0 -226
- package/build-module/form-input/deprecated.mjs.map +0 -7
- package/build-module/form-input/edit.mjs +0 -186
- package/build-module/form-input/edit.mjs.map +0 -7
- package/build-module/form-input/icons.mjs +0 -8
- package/build-module/form-input/icons.mjs.map +0 -7
- package/build-module/form-input/index.mjs +0 -25
- package/build-module/form-input/index.mjs.map +0 -7
- package/build-module/form-input/init.mjs +0 -7
- package/build-module/form-input/init.mjs.map +0 -7
- package/build-module/form-input/save.mjs +0 -62
- package/build-module/form-input/save.mjs.map +0 -7
- package/build-module/form-input/variations.mjs +0 -84
- package/build-module/form-input/variations.mjs.map +0 -7
- package/build-module/form-submission-notification/block.json +0 -19
- package/build-module/form-submission-notification/edit.mjs +0 -45
- package/build-module/form-submission-notification/edit.mjs.map +0 -7
- package/build-module/form-submission-notification/index.mjs +0 -35
- package/build-module/form-submission-notification/index.mjs.map +0 -7
- package/build-module/form-submission-notification/init.mjs +0 -7
- package/build-module/form-submission-notification/init.mjs.map +0 -7
- package/build-module/form-submission-notification/save.mjs +0 -23
- package/build-module/form-submission-notification/save.mjs.map +0 -7
- package/build-module/form-submission-notification/variations.mjs +0 -57
- package/build-module/form-submission-notification/variations.mjs.map +0 -7
- package/build-module/form-submit-button/block.json +0 -15
- package/build-module/form-submit-button/edit.mjs +0 -15
- package/build-module/form-submit-button/edit.mjs.map +0 -7
- package/build-module/form-submit-button/index.mjs +0 -37
- package/build-module/form-submit-button/index.mjs.map +0 -7
- package/build-module/form-submit-button/init.mjs +0 -7
- package/build-module/form-submit-button/init.mjs.map +0 -7
- package/build-module/form-submit-button/save.mjs +0 -11
- package/build-module/form-submit-button/save.mjs.map +0 -7
- package/build-module/list-item/hooks/use-indent-list-item.mjs +0 -58
- package/build-module/list-item/hooks/use-indent-list-item.mjs.map +0 -7
- package/build-module/list-item/hooks/use-outdent-list-item.mjs +0 -85
- package/build-module/list-item/hooks/use-outdent-list-item.mjs.map +0 -7
- package/build-module/list-item/hooks/use-space.mjs +0 -52
- package/build-module/list-item/hooks/use-space.mjs.map +0 -7
- package/build-style/form-input/editor-rtl.css +0 -19
- package/build-style/form-input/editor.css +0 -19
- package/build-style/form-input/style-rtl.css +0 -46
- package/build-style/form-input/style.css +0 -46
- package/build-style/form-submission-notification/editor-rtl.css +0 -30
- package/build-style/form-submission-notification/editor.css +0 -30
- package/build-style/form-submit-button/style-rtl.css +0 -3
- package/build-style/form-submit-button/style.css +0 -3
- package/src/form/README.md +0 -90
- package/src/form/block.json +0 -65
- package/src/form/deprecated.jsx +0 -93
- package/src/form/edit.jsx +0 -169
- package/src/form/icons.jsx +0 -7
- package/src/form/index.js +0 -91
- package/src/form/index.php +0 -197
- package/src/form/init.js +0 -3
- package/src/form/save.jsx +0 -15
- package/src/form/utils.js +0 -36
- package/src/form/variations.js +0 -133
- package/src/form/view.js +0 -54
- package/src/form-input/README.md +0 -74
- package/src/form-input/block.json +0 -72
- package/src/form-input/deprecated.jsx +0 -248
- package/src/form-input/edit.jsx +0 -187
- package/src/form-input/editor.scss +0 -24
- package/src/form-input/icons.jsx +0 -7
- package/src/form-input/index.js +0 -22
- package/src/form-input/index.php +0 -47
- package/src/form-input/init.js +0 -3
- package/src/form-input/save.jsx +0 -89
- package/src/form-input/style.scss +0 -64
- package/src/form-input/variations.js +0 -82
- package/src/form-submission-notification/README.md +0 -50
- package/src/form-submission-notification/block.json +0 -19
- package/src/form-submission-notification/edit.jsx +0 -44
- package/src/form-submission-notification/editor.scss +0 -45
- package/src/form-submission-notification/index.js +0 -33
- package/src/form-submission-notification/index.php +0 -48
- package/src/form-submission-notification/init.js +0 -3
- package/src/form-submission-notification/save.jsx +0 -18
- package/src/form-submission-notification/variations.js +0 -56
- package/src/form-submit-button/README.md +0 -54
- package/src/form-submit-button/block.json +0 -15
- package/src/form-submit-button/edit.jsx +0 -12
- package/src/form-submit-button/index.js +0 -35
- package/src/form-submit-button/init.js +0 -3
- package/src/form-submit-button/save.jsx +0 -10
- package/src/form-submit-button/style.scss +0 -3
- package/src/list-item/hooks/use-indent-list-item.js +0 -73
- package/src/list-item/hooks/use-outdent-list-item.js +0 -100
- package/src/list-item/hooks/use-space.js +0 -66
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
// packages/block-library/src/navigation-link/index.
|
|
2
|
-
import { _x,
|
|
1
|
+
// packages/block-library/src/navigation-link/index.js
|
|
2
|
+
import { _x, sprintf } from "@wordpress/i18n";
|
|
3
3
|
import { customLink as linkIcon } from "@wordpress/icons";
|
|
4
|
-
import { InnerBlocks } from "@wordpress/block-editor";
|
|
5
4
|
import { addFilter } from "@wordpress/hooks";
|
|
6
|
-
import
|
|
5
|
+
import deprecated from "./deprecated.mjs";
|
|
7
6
|
import initBlock from "../utils/init-block.mjs";
|
|
8
7
|
import metadata from "./block.json";
|
|
9
8
|
import edit from "./edit.mjs";
|
|
10
9
|
import save from "./save.mjs";
|
|
11
10
|
import { enhanceNavigationLinkVariations } from "./hooks.mjs";
|
|
12
11
|
import transforms from "./transforms.mjs";
|
|
13
|
-
import
|
|
14
|
-
import { jsx } from "react/jsx-runtime";
|
|
15
|
-
var { fieldsKey, formKey } = unlock(blocksPrivateApis);
|
|
12
|
+
import variations from "./variations.mjs";
|
|
16
13
|
var { name } = metadata;
|
|
17
14
|
var settings = {
|
|
18
15
|
icon: linkIcon,
|
|
@@ -44,75 +41,10 @@ var settings = {
|
|
|
44
41
|
url: "https://example.com"
|
|
45
42
|
}
|
|
46
43
|
},
|
|
47
|
-
deprecated
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return attributes.nofollow;
|
|
51
|
-
},
|
|
52
|
-
attributes: {
|
|
53
|
-
label: {
|
|
54
|
-
type: "string"
|
|
55
|
-
},
|
|
56
|
-
type: {
|
|
57
|
-
type: "string"
|
|
58
|
-
},
|
|
59
|
-
nofollow: {
|
|
60
|
-
type: "boolean"
|
|
61
|
-
},
|
|
62
|
-
description: {
|
|
63
|
-
type: "string"
|
|
64
|
-
},
|
|
65
|
-
id: {
|
|
66
|
-
type: "number"
|
|
67
|
-
},
|
|
68
|
-
opensInNewTab: {
|
|
69
|
-
type: "boolean",
|
|
70
|
-
default: false
|
|
71
|
-
},
|
|
72
|
-
url: {
|
|
73
|
-
type: "string"
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
migrate({ nofollow, ...rest }) {
|
|
77
|
-
return {
|
|
78
|
-
rel: nofollow ? "nofollow" : "",
|
|
79
|
-
...rest
|
|
80
|
-
};
|
|
81
|
-
},
|
|
82
|
-
save() {
|
|
83
|
-
return /* @__PURE__ */ jsx(InnerBlocks.Content, {});
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
],
|
|
87
|
-
transforms
|
|
44
|
+
deprecated,
|
|
45
|
+
transforms,
|
|
46
|
+
variations
|
|
88
47
|
};
|
|
89
|
-
if (window.__experimentalContentOnlyInspectorFields) {
|
|
90
|
-
settings[fieldsKey] = [
|
|
91
|
-
{
|
|
92
|
-
id: "label",
|
|
93
|
-
label: __("Label"),
|
|
94
|
-
type: "text",
|
|
95
|
-
Edit: "rich-text"
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
id: "link",
|
|
99
|
-
label: __("Link"),
|
|
100
|
-
type: "url",
|
|
101
|
-
Edit: "link",
|
|
102
|
-
getValue: ({ item }) => ({
|
|
103
|
-
url: item.url,
|
|
104
|
-
rel: item.rel
|
|
105
|
-
}),
|
|
106
|
-
setValue: ({ value }) => ({
|
|
107
|
-
url: value.url,
|
|
108
|
-
rel: value.rel
|
|
109
|
-
})
|
|
110
|
-
}
|
|
111
|
-
];
|
|
112
|
-
settings[formKey] = {
|
|
113
|
-
fields: ["label", "link"]
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
48
|
var init = () => {
|
|
117
49
|
addFilter(
|
|
118
50
|
"blocks.registerBlockType",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/navigation-link/index.
|
|
4
|
-
"sourcesContent": ["import { _x,
|
|
5
|
-
"mappings": ";AAAA,SAAS,IAAI,
|
|
3
|
+
"sources": ["../../src/navigation-link/index.js"],
|
|
4
|
+
"sourcesContent": ["import { _x, sprintf } from '@wordpress/i18n';\nimport { customLink as linkIcon } from '@wordpress/icons';\nimport { addFilter } from '@wordpress/hooks';\nimport deprecated from './deprecated';\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\nimport { enhanceNavigationLinkVariations } from './hooks';\nimport transforms from './transforms';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon: linkIcon,\n\n\t__experimentalLabel( attributes, { context } ) {\n\t\tif ( context === 'list-view' ) {\n\t\t\treturn attributes?.label;\n\t\t}\n\n\t\tif ( context === 'appender' ) {\n\t\t\tconst type = attributes?.type || 'link';\n\t\t\treturn sprintf(\n\t\t\t\t/* translators: %s: block type (e.g., 'page', 'post', 'category') */\n\t\t\t\t_x( 'Add %s', 'add default block type' ),\n\t\t\t\ttype\n\t\t\t);\n\t\t}\n\n\t\t// Backwards compatibility - return label for unknown contexts\n\t\treturn attributes?.label;\n\t},\n\n\tmerge( leftAttributes, { label: rightLabel = '' } ) {\n\t\treturn {\n\t\t\t...leftAttributes,\n\t\t\tlabel: leftAttributes.label + rightLabel,\n\t\t};\n\t},\n\n\tedit,\n\n\tsave,\n\n\texample: {\n\t\tattributes: {\n\t\t\tlabel: _x( 'Example Link', 'navigation link preview example' ),\n\t\t\turl: 'https://example.com',\n\t\t},\n\t},\n\n\tdeprecated,\n\ttransforms,\n\tvariations,\n};\n\nexport const init = () => {\n\taddFilter(\n\t\t'blocks.registerBlockType',\n\t\t'core/navigation-link',\n\t\tenhanceNavigationLinkVariations\n\t);\n\n\treturn initBlock( { name, metadata, settings } );\n};\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,IAAI,eAAe;AAC5B,SAAS,cAAc,gBAAgB;AACvC,SAAS,iBAAiB;AAC1B,OAAO,gBAAgB;AACvB,OAAO,eAAe;AACtB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,UAAU;AACjB,SAAS,uCAAuC;AAChD,OAAO,gBAAgB;AACvB,OAAO,gBAAgB;AAEvB,IAAM,EAAE,KAAK,IAAI;AAIV,IAAM,WAAW;AAAA,EACvB,MAAM;AAAA,EAEN,oBAAqB,YAAY,EAAE,QAAQ,GAAI;AAC9C,QAAK,YAAY,aAAc;AAC9B,aAAO,YAAY;AAAA,IACpB;AAEA,QAAK,YAAY,YAAa;AAC7B,YAAM,OAAO,YAAY,QAAQ;AACjC,aAAO;AAAA;AAAA,QAEN,GAAI,UAAU,wBAAyB;AAAA,QACvC;AAAA,MACD;AAAA,IACD;AAGA,WAAO,YAAY;AAAA,EACpB;AAAA,EAEA,MAAO,gBAAgB,EAAE,OAAO,aAAa,GAAG,GAAI;AACnD,WAAO;AAAA,MACN,GAAG;AAAA,MACH,OAAO,eAAe,QAAQ;AAAA,IAC/B;AAAA,EACD;AAAA,EAEA;AAAA,EAEA;AAAA,EAEA,SAAS;AAAA,IACR,YAAY;AAAA,MACX,OAAO,GAAI,gBAAgB,iCAAkC;AAAA,MAC7D,KAAK;AAAA,IACN;AAAA,EACD;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AACD;AAEO,IAAM,OAAO,MAAM;AACzB;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,SAAO,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;AAChD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// packages/block-library/src/navigation-link/variations.js
|
|
2
|
+
import { __ } from "@wordpress/i18n";
|
|
3
|
+
import { customLink as linkIcon } from "@wordpress/icons";
|
|
4
|
+
var variations = [
|
|
5
|
+
{
|
|
6
|
+
name: "custom-link",
|
|
7
|
+
title: __("Custom Link"),
|
|
8
|
+
description: __("Add a custom link to your navigation."),
|
|
9
|
+
icon: linkIcon,
|
|
10
|
+
attributes: {
|
|
11
|
+
kind: "custom"
|
|
12
|
+
},
|
|
13
|
+
isActive: (blockAttributes) => blockAttributes.kind === "custom",
|
|
14
|
+
isDefault: true,
|
|
15
|
+
scope: ["inserter"]
|
|
16
|
+
}
|
|
17
|
+
];
|
|
18
|
+
var variations_default = variations;
|
|
19
|
+
export {
|
|
20
|
+
variations_default as default
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=variations.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/navigation-link/variations.js"],
|
|
4
|
+
"sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport { customLink as linkIcon } from '@wordpress/icons';\n\nconst variations = [\n\t{\n\t\tname: 'custom-link',\n\t\ttitle: __( 'Custom Link' ),\n\t\tdescription: __( 'Add a custom link to your navigation.' ),\n\t\ticon: linkIcon,\n\t\tattributes: {\n\t\t\tkind: 'custom',\n\t\t},\n\t\tisActive: ( blockAttributes ) => blockAttributes.kind === 'custom',\n\t\tisDefault: true,\n\t\tscope: [ 'inserter' ],\n\t},\n];\n\nexport default variations;\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,UAAU;AACnB,SAAS,cAAc,gBAAgB;AAEvC,IAAM,aAAa;AAAA,EAClB;AAAA,IACC,MAAM;AAAA,IACN,OAAO,GAAI,aAAc;AAAA,IACzB,aAAa,GAAI,uCAAwC;AAAA,IACzD,MAAM;AAAA,IACN,YAAY;AAAA,MACX,MAAM;AAAA,IACP;AAAA,IACA,UAAU,CAAE,oBAAqB,gBAAgB,SAAS;AAAA,IAC1D,WAAW;AAAA,IACX,OAAO,CAAE,UAAW;AAAA,EACrB;AACD;AAEA,IAAO,qBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
// packages/block-library/src/navigation-submenu/index.js
|
|
2
2
|
import { page, addSubmenu } from "@wordpress/icons";
|
|
3
|
-
import { _x
|
|
4
|
-
import { privateApis as blocksPrivateApis } from "@wordpress/blocks";
|
|
3
|
+
import { _x } from "@wordpress/i18n";
|
|
5
4
|
import initBlock from "../utils/init-block.mjs";
|
|
6
5
|
import metadata from "./block.json";
|
|
7
6
|
import edit from "./edit.mjs";
|
|
8
7
|
import save from "./save.mjs";
|
|
9
8
|
import transforms from "./transforms.mjs";
|
|
10
|
-
import { unlock } from "../lock-unlock.mjs";
|
|
11
|
-
var { fieldsKey, formKey } = unlock(blocksPrivateApis);
|
|
12
9
|
var { name } = metadata;
|
|
13
10
|
var settings = {
|
|
14
11
|
icon: ({ context }) => {
|
|
@@ -35,35 +32,6 @@ var settings = {
|
|
|
35
32
|
save,
|
|
36
33
|
transforms
|
|
37
34
|
};
|
|
38
|
-
if (window.__experimentalContentOnlyInspectorFields) {
|
|
39
|
-
settings[fieldsKey] = [
|
|
40
|
-
{
|
|
41
|
-
id: "label",
|
|
42
|
-
label: __("Label"),
|
|
43
|
-
type: "text",
|
|
44
|
-
Edit: "rich-text"
|
|
45
|
-
//TODO: replace with custom component
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
id: "link",
|
|
49
|
-
label: __("Link"),
|
|
50
|
-
type: "url",
|
|
51
|
-
Edit: "link",
|
|
52
|
-
// TODO: replace with custom component
|
|
53
|
-
getValue: ({ item }) => ({
|
|
54
|
-
url: item.url,
|
|
55
|
-
rel: item.rel
|
|
56
|
-
}),
|
|
57
|
-
setValue: ({ value }) => ({
|
|
58
|
-
url: value.url,
|
|
59
|
-
rel: value.rel
|
|
60
|
-
})
|
|
61
|
-
}
|
|
62
|
-
];
|
|
63
|
-
settings[formKey] = {
|
|
64
|
-
fields: ["label", "link"]
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
35
|
var init = () => initBlock({ name, metadata, settings });
|
|
68
36
|
export {
|
|
69
37
|
init,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/navigation-submenu/index.js"],
|
|
4
|
-
"sourcesContent": ["import { page, addSubmenu } from '@wordpress/icons';\nimport { _x
|
|
5
|
-
"mappings": ";AAAA,SAAS,MAAM,kBAAkB;AACjC,SAAS,
|
|
4
|
+
"sourcesContent": ["import { page, addSubmenu } from '@wordpress/icons';\nimport { _x } from '@wordpress/i18n';\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon: ( { context } ) => {\n\t\tif ( context === 'list-view' ) {\n\t\t\treturn page;\n\t\t}\n\t\treturn addSubmenu;\n\t},\n\t__experimentalLabel( attributes, { context } ) {\n\t\tconst { label } = attributes;\n\n\t\tconst customName = attributes?.metadata?.name;\n\n\t\t// In the list view and breadcrumb, use the block's menu label as the label.\n\t\t// If the menu label is empty, fall back to the default label.\n\t\tif (\n\t\t\t( context === 'list-view' || context === 'breadcrumb' ) &&\n\t\t\tcustomName\n\t\t) {\n\t\t\treturn customName;\n\t\t}\n\n\t\treturn label;\n\t},\n\tedit,\n\texample: {\n\t\tattributes: {\n\t\t\tlabel: _x( 'About', 'Example link text for Navigation Submenu' ),\n\t\t\ttype: 'page',\n\t\t},\n\t},\n\tsave,\n\ttransforms,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,MAAM,kBAAkB;AACjC,SAAS,UAAU;AACnB,OAAO,eAAe;AACtB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AAEvB,IAAM,EAAE,KAAK,IAAI;AAIV,IAAM,WAAW;AAAA,EACvB,MAAM,CAAE,EAAE,QAAQ,MAAO;AACxB,QAAK,YAAY,aAAc;AAC9B,aAAO;AAAA,IACR;AACA,WAAO;AAAA,EACR;AAAA,EACA,oBAAqB,YAAY,EAAE,QAAQ,GAAI;AAC9C,UAAM,EAAE,MAAM,IAAI;AAElB,UAAM,aAAa,YAAY,UAAU;AAIzC,SACG,YAAY,eAAe,YAAY,iBACzC,YACC;AACD,aAAO;AAAA,IACR;AAEA,WAAO;AAAA,EACR;AAAA,EACA;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA,MACX,OAAO,GAAI,SAAS,0CAA2C;AAAA,MAC/D,MAAM;AAAA,IACP;AAAA,EACD;AAAA,EACA;AAAA,EACA;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
// packages/block-library/src/paragraph/index.js
|
|
2
2
|
import { __ } from "@wordpress/i18n";
|
|
3
3
|
import { paragraph as icon } from "@wordpress/icons";
|
|
4
|
-
import { privateApis as blocksPrivateApis } from "@wordpress/blocks";
|
|
5
4
|
import initBlock from "../utils/init-block.mjs";
|
|
6
5
|
import deprecated from "./deprecated.mjs";
|
|
7
6
|
import edit from "./edit.mjs";
|
|
8
7
|
import metadata from "./block.json";
|
|
9
8
|
import save from "./save.mjs";
|
|
10
9
|
import transforms from "./transforms.mjs";
|
|
11
|
-
import { unlock } from "../lock-unlock.mjs";
|
|
12
|
-
var { fieldsKey, formKey } = unlock(blocksPrivateApis);
|
|
13
10
|
var { name } = metadata;
|
|
14
11
|
var settings = {
|
|
15
12
|
icon,
|
|
@@ -43,20 +40,6 @@ var settings = {
|
|
|
43
40
|
edit,
|
|
44
41
|
save
|
|
45
42
|
};
|
|
46
|
-
if (window.__experimentalContentOnlyInspectorFields) {
|
|
47
|
-
settings[fieldsKey] = [
|
|
48
|
-
{
|
|
49
|
-
id: "content",
|
|
50
|
-
label: __("Content"),
|
|
51
|
-
type: "text",
|
|
52
|
-
Edit: "rich-text"
|
|
53
|
-
// TODO: replace with custom component
|
|
54
|
-
}
|
|
55
|
-
];
|
|
56
|
-
settings[formKey] = {
|
|
57
|
-
fields: ["content"]
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
43
|
var init = () => initBlock({ name, metadata, settings });
|
|
61
44
|
export {
|
|
62
45
|
init,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/paragraph/index.js"],
|
|
4
|
-
"sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport { paragraph as icon } from '@wordpress/icons';\nimport
|
|
5
|
-
"mappings": ";AAAA,SAAS,UAAU;AACnB,SAAS,aAAa,YAAY;AAClC,
|
|
4
|
+
"sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport { paragraph as icon } from '@wordpress/icons';\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tcontent: __(\n\t\t\t\t'In a village of La Mancha, the name of which I have no desire to call to mind, there lived not long since one of those gentlemen that keep a lance in the lance-rack, an old buckler, a lean hack, and a greyhound for coursing.'\n\t\t\t),\n\t\t},\n\t},\n\t__experimentalLabel( attributes, { context } ) {\n\t\tconst customName = attributes?.metadata?.name;\n\n\t\tif (\n\t\t\t( context === 'list-view' || context === 'breadcrumb' ) &&\n\t\t\tcustomName\n\t\t) {\n\t\t\treturn customName;\n\t\t}\n\n\t\tif ( context === 'accessibility' ) {\n\t\t\tif ( customName ) {\n\t\t\t\treturn customName;\n\t\t\t}\n\n\t\t\tconst { content } = attributes;\n\t\t\treturn ! content || content.length === 0 ? __( 'Empty' ) : content;\n\t\t}\n\t},\n\ttransforms,\n\tdeprecated,\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\tcontent:\n\t\t\t\t( attributes.content || '' ) +\n\t\t\t\t( attributesToMerge.content || '' ),\n\t\t};\n\t},\n\tedit,\n\tsave,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,UAAU;AACnB,SAAS,aAAa,YAAY;AAClC,OAAO,eAAe;AACtB,OAAO,gBAAgB;AACvB,OAAO,UAAU;AACjB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AAEvB,IAAM,EAAE,KAAK,IAAI;AAIV,IAAM,WAAW;AAAA,EACvB;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA,MACX,SAAS;AAAA,QACR;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAAA,EACA,oBAAqB,YAAY,EAAE,QAAQ,GAAI;AAC9C,UAAM,aAAa,YAAY,UAAU;AAEzC,SACG,YAAY,eAAe,YAAY,iBACzC,YACC;AACD,aAAO;AAAA,IACR;AAEA,QAAK,YAAY,iBAAkB;AAClC,UAAK,YAAa;AACjB,eAAO;AAAA,MACR;AAEA,YAAM,EAAE,QAAQ,IAAI;AACpB,aAAO,CAAE,WAAW,QAAQ,WAAW,IAAI,GAAI,OAAQ,IAAI;AAAA,IAC5D;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA,MAAO,YAAY,mBAAoB;AACtC,WAAO;AAAA,MACN,UACG,WAAW,WAAW,OACtB,kBAAkB,WAAW;AAAA,IACjC;AAAA,EACD;AAAA,EACA;AAAA,EACA;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { useRef } from "@wordpress/element";
|
|
3
3
|
import { useRefEffect } from "@wordpress/compose";
|
|
4
4
|
import { privateApis as richTextPrivateApis } from "@wordpress/rich-text";
|
|
5
|
-
import { ENTER } from "@wordpress/keycodes";
|
|
6
5
|
import { useSelect, useDispatch, useRegistry } from "@wordpress/data";
|
|
7
6
|
import { store as blockEditorStore } from "@wordpress/block-editor";
|
|
8
7
|
import {
|
|
@@ -27,11 +26,11 @@ function useOnEnter(props) {
|
|
|
27
26
|
const propsRef = useRef(props);
|
|
28
27
|
propsRef.current = props;
|
|
29
28
|
return useRefEffect((element) => {
|
|
30
|
-
function
|
|
29
|
+
function onBeforeInput(event) {
|
|
31
30
|
if (event.defaultPrevented) {
|
|
32
31
|
return;
|
|
33
32
|
}
|
|
34
|
-
if (event.
|
|
33
|
+
if (event.inputType !== "insertParagraph") {
|
|
35
34
|
return;
|
|
36
35
|
}
|
|
37
36
|
const { content, clientId } = propsRef.current;
|
|
@@ -89,7 +88,12 @@ function useOnEnter(props) {
|
|
|
89
88
|
selectionChange(middle.clientId);
|
|
90
89
|
});
|
|
91
90
|
}
|
|
92
|
-
return subscribeOwnedListener(
|
|
91
|
+
return subscribeOwnedListener(
|
|
92
|
+
element,
|
|
93
|
+
"beforeinput",
|
|
94
|
+
onBeforeInput,
|
|
95
|
+
true
|
|
96
|
+
);
|
|
93
97
|
}, []);
|
|
94
98
|
}
|
|
95
99
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/paragraph/use-enter.js"],
|
|
4
|
-
"sourcesContent": ["import { useRef } from '@wordpress/element';\nimport { useRefEffect } from '@wordpress/compose';\nimport { privateApis as richTextPrivateApis } from '@wordpress/rich-text';\nimport {
|
|
5
|
-
"mappings": ";AAAA,SAAS,cAAc;AACvB,SAAS,oBAAoB;AAC7B,SAAS,eAAe,2BAA2B;AACnD,SAAS,
|
|
4
|
+
"sourcesContent": ["import { useRef } from '@wordpress/element';\nimport { useRefEffect } from '@wordpress/compose';\nimport { privateApis as richTextPrivateApis } from '@wordpress/rich-text';\nimport { useSelect, useDispatch, useRegistry } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport {\n\thasBlockSupport,\n\tcreateBlock,\n\tcloneBlock,\n\tgetDefaultBlockName,\n} from '@wordpress/blocks';\nimport { unlock } from '../lock-unlock';\n\nconst { subscribeOwnedListener } = unlock( richTextPrivateApis );\n\nexport function useOnEnter( props ) {\n\tconst { batch } = useRegistry();\n\tconst { moveBlocksToPosition, replaceBlocks, selectionChange } =\n\t\tuseDispatch( blockEditorStore );\n\tconst {\n\t\tgetBlockRootClientId,\n\t\tgetBlockIndex,\n\t\tgetBlockOrder,\n\t\tgetBlockName,\n\t\tgetBlock,\n\t\tcanInsertBlockType,\n\t} = useSelect( blockEditorStore );\n\tconst propsRef = useRef( props );\n\tpropsRef.current = props;\n\treturn useRefEffect( ( element ) => {\n\t\tfunction onBeforeInput( event ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( event.inputType !== 'insertParagraph' ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst { content, clientId } = propsRef.current;\n\n\t\t\t// The paragraph should be empty.\n\t\t\tif ( content.length ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst wrapperClientId = getBlockRootClientId( clientId );\n\n\t\t\tif (\n\t\t\t\t! hasBlockSupport(\n\t\t\t\t\tgetBlockName( wrapperClientId ),\n\t\t\t\t\t'__experimentalOnEnter',\n\t\t\t\t\tfalse\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst order = getBlockOrder( wrapperClientId );\n\t\t\tconst position = order.indexOf( clientId );\n\n\t\t\t// If it is the last block, exit.\n\t\t\tif ( position === order.length - 1 ) {\n\t\t\t\tlet newWrapperClientId = wrapperClientId;\n\n\t\t\t\twhile (\n\t\t\t\t\t! canInsertBlockType(\n\t\t\t\t\t\tgetBlockName( clientId ),\n\t\t\t\t\t\tgetBlockRootClientId( newWrapperClientId )\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tnewWrapperClientId =\n\t\t\t\t\t\tgetBlockRootClientId( newWrapperClientId );\n\t\t\t\t}\n\n\t\t\t\tif ( typeof newWrapperClientId === 'string' ) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t[ clientId ],\n\t\t\t\t\t\twrapperClientId,\n\t\t\t\t\t\tgetBlockRootClientId( newWrapperClientId ),\n\t\t\t\t\t\tgetBlockIndex( newWrapperClientId ) + 1\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst defaultBlockName = getDefaultBlockName();\n\t\t\tconst wrapperBlockName = getBlockName( wrapperClientId );\n\t\t\tconst grandparentClientId = getBlockRootClientId( wrapperClientId );\n\n\t\t\tif (\n\t\t\t\t! canInsertBlockType( defaultBlockName, grandparentClientId ) ||\n\t\t\t\t! canInsertBlockType( wrapperBlockName, grandparentClientId )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tevent.preventDefault();\n\n\t\t\t// If it is in the middle, split the block in two.\n\t\t\tconst wrapperBlock = getBlock( wrapperClientId );\n\t\t\tconst head = cloneBlock( {\n\t\t\t\t...wrapperBlock,\n\t\t\t\tinnerBlocks: wrapperBlock.innerBlocks.slice( 0, position ),\n\t\t\t} );\n\t\t\tconst middle = createBlock( defaultBlockName );\n\t\t\tconst tail = cloneBlock( {\n\t\t\t\t...wrapperBlock,\n\t\t\t\tinnerBlocks: wrapperBlock.innerBlocks.slice( position + 1 ),\n\t\t\t} );\n\n\t\t\tbatch( () => {\n\t\t\t\treplaceBlocks( wrapperClientId, [ head, middle, tail ] );\n\t\t\t\t// The selected paragraph is a descendant of the replaced\n\t\t\t\t// wrapper, so `replaceBlocks` leaves the selection stale.\n\t\t\t\t// Move it to the new default block explicitly.\n\t\t\t\tselectionChange( middle.clientId );\n\t\t\t} );\n\t\t}\n\n\t\t// Enter is handled on beforeinput: moving focus while the keydown\n\t\t// is still being handled leaves the iOS keyboard's\n\t\t// auto-capitalization stale. Capture phase so we run before\n\t\t// writing-flow's ancestor-bubble handler that gates on\n\t\t// `event.defaultPrevented`.\n\t\treturn subscribeOwnedListener(\n\t\t\telement,\n\t\t\t'beforeinput',\n\t\t\tonBeforeInput,\n\t\t\ttrue\n\t\t);\n\t}, [] );\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,cAAc;AACvB,SAAS,oBAAoB;AAC7B,SAAS,eAAe,2BAA2B;AACnD,SAAS,WAAW,aAAa,mBAAmB;AACpD,SAAS,SAAS,wBAAwB;AAC1C;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,cAAc;AAEvB,IAAM,EAAE,uBAAuB,IAAI,OAAQ,mBAAoB;AAExD,SAAS,WAAY,OAAQ;AACnC,QAAM,EAAE,MAAM,IAAI,YAAY;AAC9B,QAAM,EAAE,sBAAsB,eAAe,gBAAgB,IAC5D,YAAa,gBAAiB;AAC/B,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;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AY,MAAO,GAAG,QAAS;AAAA,MAC1D,CAAE;AACF,YAAM,SAAS,YAAa,gBAAiB;AAC7C,YAAM,OAAO,WAAY;AAAA,QACxB,GAAG;AAAA,QACH,aAAa,aAAa,YAAY,MAAO,WAAW,CAAE;AAAA,MAC3D,CAAE;AAEF,YAAO,MAAM;AACZ,sBAAe,iBAAiB,CAAE,MAAM,QAAQ,IAAK,CAAE;AAIvD,wBAAiB,OAAO,QAAS;AAAA,MAClC,CAAE;AAAA,IACH;AAOA,WAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,EACD,GAAG,CAAC,CAAE;AACP;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/post-template/edit.jsx"],
|
|
4
|
-
"sourcesContent": ["import clsx from 'clsx';\nimport { memo, useMemo, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tBlockContextProvider,\n\t__experimentalUseBlockPreview as useBlockPreview,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { Spinner, ToolbarGroup } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { list, grid } from '@wordpress/icons';\n\n// The Post Template's layout attribute arranges the post items, not the\n// blocks of the template, which always stack vertically inside each post\n// item. Override the inherited layout so inner block UI (movers, inserters,\n// grid controls) doesn't follow the post items' grid.\nconst INNER_BLOCKS_LAYOUT = { type: 'default' };\n\nfunction PostTemplateInnerBlocks( { classList } ) {\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{ className: clsx( 'wp-block-post', classList ) },\n\t\t{\n\t\t\t__unstableDisableLayoutClassNames: true,\n\t\t\tlayout: INNER_BLOCKS_LAYOUT,\n\t\t}\n\t);\n\treturn <li { ...innerBlocksProps } />;\n}\n\nfunction PostTemplateBlockPreview( {\n\tblocks,\n\tblockContextId,\n\tclassList,\n\tisHidden,\n\tsetActiveBlockContextId,\n} ) {\n\tconst blockPreviewProps = useBlockPreview( {\n\t\tblocks,\n\t\tprops: {\n\t\t\tclassName: clsx( 'wp-block-post', classList ),\n\t\t},\n\t} );\n\n\tconst handleOnClick = () => {\n\t\tsetActiveBlockContextId( blockContextId );\n\t};\n\n\tconst style = {\n\t\tdisplay: isHidden ? 'none' : undefined,\n\t};\n\n\treturn (\n\t\t<li\n\t\t\t{ ...blockPreviewProps }\n\t\t\ttabIndex={ 0 }\n\t\t\t// eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role\n\t\t\trole=\"button\"\n\t\t\tonClick={ handleOnClick }\n\t\t\tonKeyPress={ handleOnClick }\n\t\t\tstyle={ style }\n\t\t/>\n\t);\n}\n\nconst MemoizedPostTemplateBlockPreview = memo( PostTemplateBlockPreview );\n\nexport default function PostTemplateEdit( {\n\tsetAttributes,\n\tclientId,\n\tcontext: {\n\t\tquery: {\n\t\t\tperPage,\n\t\t\toffset = 0,\n\t\t\tpostType,\n\t\t\torder,\n\t\t\torderBy,\n\t\t\tauthor,\n\t\t\tsearch,\n\t\t\texclude,\n\t\t\tsticky,\n\t\t\tinherit,\n\t\t\ttaxQuery,\n\t\t\tparents,\n\t\t\tpages,\n\t\t\tformat,\n\t\t\texcludeCurrent,\n\t\t\t// We gather extra query args to pass to the REST API call.\n\t\t\t// This way extenders of Query Loop can add their own query args,\n\t\t\t// and have accurate previews in the editor.\n\t\t\t// Noting though that these args should either be supported by the\n\t\t\t// REST API or be handled by custom REST filters like `rest_{$this->post_type}_query`.\n\t\t\t...restQueryArgs\n\t\t} = {},\n\t\ttemplateSlug,\n\t\tpreviewPostType,\n\t\tpostId,\n\t},\n\tattributes: { layout },\n\t__unstableLayoutClassNames,\n} ) {\n\tconst {\n\t\ttype: layoutType,\n\t\tcolumnCount = 3,\n\t\tminimumColumnWidth,\n\t} = layout || {};\n\tconst [ activeBlockContextId, setActiveBlockContextId ] = useState();\n\tconst { posts, blocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, getTaxonomies } = select( coreStore );\n\t\t\tconst { getBlocks } = select( blockEditorStore );\n\t\t\tconst templateCategory =\n\t\t\t\tinherit &&\n\t\t\t\ttemplateSlug?.startsWith( 'category-' ) &&\n\t\t\t\tgetEntityRecords( 'taxonomy', 'category', {\n\t\t\t\t\tcontext: 'view',\n\t\t\t\t\tper_page: 1,\n\t\t\t\t\t_fields: [ 'id' ],\n\t\t\t\t\tslug: templateSlug.replace( 'category-', '' ),\n\t\t\t\t} );\n\t\t\tconst templateTag =\n\t\t\t\tinherit &&\n\t\t\t\ttemplateSlug?.startsWith( 'tag-' ) &&\n\t\t\t\tgetEntityRecords( 'taxonomy', 'post_tag', {\n\t\t\t\t\tcontext: 'view',\n\t\t\t\t\tper_page: 1,\n\t\t\t\t\t_fields: [ 'id' ],\n\t\t\t\t\tslug: templateSlug.replace( 'tag-', '' ),\n\t\t\t\t} );\n\t\t\tconst query = {\n\t\t\t\toffset: offset || 0,\n\t\t\t\torder,\n\t\t\t\torderby: orderBy,\n\t\t\t};\n\t\t\t// There is no need to build the taxQuery if we inherit.\n\t\t\tif ( taxQuery && ! inherit ) {\n\t\t\t\tconst taxonomies = getTaxonomies( {\n\t\t\t\t\ttype: postType,\n\t\t\t\t\tper_page: -1,\n\t\t\t\t\tcontext: 'view',\n\t\t\t\t} );\n\t\t\t\t// Build REST API parameters from taxonomy terms, e.g.\n\t\t\t\t// `category`, `tags_exclude`.\n\t\t\t\tconst buildTaxQuery = ( terms, suffix = '' ) => {\n\t\t\t\t\treturn Object.entries( terms || {} ).reduce(\n\t\t\t\t\t\t( accumulator, [ taxonomySlug, termIds ] ) => {\n\t\t\t\t\t\t\tconst taxonomy = taxonomies?.find(\n\t\t\t\t\t\t\t\t( { slug } ) => slug === taxonomySlug\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif ( taxonomy?.rest_base && termIds?.length ) {\n\t\t\t\t\t\t\t\taccumulator[ taxonomy.rest_base + suffix ] =\n\t\t\t\t\t\t\t\t\ttermIds;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn accumulator;\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{}\n\t\t\t\t\t);\n\t\t\t\t};\n\t\t\t\tconst builtTaxQuery = buildTaxQuery( taxQuery.include );\n\t\t\t\tif ( taxQuery.exclude ) {\n\t\t\t\t\tObject.assign(\n\t\t\t\t\t\tbuiltTaxQuery,\n\t\t\t\t\t\tbuildTaxQuery( taxQuery.exclude, '_exclude' )\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif ( !! Object.keys( builtTaxQuery ).length ) {\n\t\t\t\t\tObject.assign( query, builtTaxQuery );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( perPage ) {\n\t\t\t\tquery.per_page = perPage;\n\t\t\t}\n\t\t\tif ( author ) {\n\t\t\t\tquery.author = author;\n\t\t\t}\n\t\t\tif ( search ) {\n\t\t\t\tquery.search = search;\n\t\t\t}\n\t\t\tif ( exclude?.length ) {\n\t\t\t\tquery.exclude = exclude;\n\t\t\t}\n\t\t\tif ( parents?.length ) {\n\t\t\t\tquery.parent = parents;\n\t\t\t}\n\t\t\tif ( format?.length ) {\n\t\t\t\tquery.format = format;\n\t\t\t}\n\t\t\tif ( excludeCurrent && postId ) {\n\t\t\t\tif ( query.exclude ) {\n\t\t\t\t\tquery.exclude = [ ...query.exclude, postId ];\n\t\t\t\t} else {\n\t\t\t\t\tquery.exclude = [ postId ];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/*\n\t\t\t * Handle cases where sticky is set to `exclude` or `only`.\n\t\t\t * Which works as a `post__in/post__not_in` query for sticky posts.\n\t\t\t */\n\t\t\tif ( [ 'exclude', 'only' ].includes( sticky ) ) {\n\t\t\t\tquery.sticky = sticky === 'only';\n\t\t\t}\n\n\t\t\t// Empty string represents the default behavior of including sticky posts.\n\t\t\tif ( [ '', 'ignore' ].includes( sticky ) ) {\n\t\t\t\t// Remove any leftover sticky query parameter.\n\t\t\t\tdelete query.sticky;\n\t\t\t\tquery.ignore_sticky = sticky === 'ignore';\n\t\t\t}\n\n\t\t\t// If `inherit` is truthy, adjust conditionally the query to create a better preview.\n\t\t\tlet currentPostType = postType;\n\t\t\tif ( inherit ) {\n\t\t\t\t// Change the post-type if needed.\n\t\t\t\tif ( templateSlug?.startsWith( 'archive-' ) ) {\n\t\t\t\t\tquery.postType = templateSlug.replace( 'archive-', '' );\n\t\t\t\t\tcurrentPostType = query.postType;\n\t\t\t\t} else if ( templateCategory ) {\n\t\t\t\t\tquery.categories = templateCategory[ 0 ]?.id;\n\t\t\t\t} else if ( templateTag ) {\n\t\t\t\t\tquery.tags = templateTag[ 0 ]?.id;\n\t\t\t\t} else if (\n\t\t\t\t\ttemplateSlug?.startsWith( 'taxonomy-post_format' )\n\t\t\t\t) {\n\t\t\t\t\t// Get the post format slug from the template slug by removing the prefix.\n\t\t\t\t\tquery.format = templateSlug.replace(\n\t\t\t\t\t\t'taxonomy-post_format-post-format-',\n\t\t\t\t\t\t''\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// When we preview Query Loop blocks we should prefer the current\n\t\t\t// block's postType, which is passed through block context.\n\t\t\tconst usedPostType = previewPostType || currentPostType;\n\t\t\treturn {\n\t\t\t\tposts: getEntityRecords( 'postType', usedPostType, {\n\t\t\t\t\t...query,\n\t\t\t\t\t...restQueryArgs,\n\t\t\t\t} ),\n\t\t\t\tblocks: getBlocks( clientId ),\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tperPage,\n\t\t\toffset,\n\t\t\torder,\n\t\t\torderBy,\n\t\t\tclientId,\n\t\t\tauthor,\n\t\t\tsearch,\n\t\t\tpostType,\n\t\t\texclude,\n\t\t\tsticky,\n\t\t\tinherit,\n\t\t\ttemplateSlug,\n\t\t\ttaxQuery,\n\t\t\tparents,\n\t\t\tformat,\n\t\t\trestQueryArgs,\n\t\t\tpreviewPostType,\n\t\t]\n\t);\n\tconst blockContexts = useMemo(\n\t\t() =>\n\t\t\tposts?.map( ( post ) => ( {\n\t\t\t\tpostType: post.type,\n\t\t\t\tpostId: post.id,\n\t\t\t\tclassList: post.class_list ?? '',\n\t\t\t} ) ),\n\t\t[ posts ]\n\t);\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( __unstableLayoutClassNames, {\n\t\t\t[ `columns-${ columnCount }` ]:\n\t\t\t\tlayoutType === 'grid' && columnCount, // Ensure column count is flagged via classname for backwards compatibility.\n\t\t\t'has-native-responsive-grid':\n\t\t\t\tlayoutType === 'grid' && columnCount && minimumColumnWidth, // Flag native responsive grid when minimum column width is provided.\n\t\t} ),\n\t} );\n\n\tif ( ! posts ) {\n\t\treturn (\n\t\t\t<p { ...blockProps }>\n\t\t\t\t<Spinner />\n\t\t\t</p>\n\t\t);\n\t}\n\n\tif ( ! posts.length ) {\n\t\treturn <p { ...blockProps }> { __( 'No results found.' ) }</p>;\n\t}\n\n\tconst setDisplayLayout = ( newDisplayLayout ) =>\n\t\tsetAttributes( {\n\t\t\tlayout: { ...layout, ...newDisplayLayout },\n\t\t} );\n\n\tconst displayLayoutControls = [\n\t\t{\n\t\t\ticon: list,\n\t\t\ttitle: _x( 'List view', 'Post template block display setting' ),\n\t\t\tonClick: () => setDisplayLayout( { type: 'default' } ),\n\t\t\tisActive: layoutType === 'default' || layoutType === 'constrained',\n\t\t},\n\t\t{\n\t\t\ticon: grid,\n\t\t\ttitle: _x( 'Grid view', 'Post template block display setting' ),\n\t\t\tonClick: () =>\n\t\t\t\tsetDisplayLayout( {\n\t\t\t\t\ttype: 'grid',\n\t\t\t\t\tcolumnCount,\n\t\t\t\t} ),\n\t\t\tisActive: layoutType === 'grid',\n\t\t},\n\t];\n\n\t// To avoid flicker when switching active block contexts, a preview is rendered\n\t// for each block context, but the preview for the active block context is hidden.\n\t// This ensures that when it is displayed again, the cached rendering of the\n\t// block preview is used, instead of having to re-render the preview from scratch.\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup controls={ displayLayoutControls } />\n\t\t\t</BlockControls>\n\n\t\t\t<ul { ...blockProps }>\n\t\t\t\t{ blockContexts &&\n\t\t\t\t\tblockContexts.map( ( blockContext ) => (\n\t\t\t\t\t\t<BlockContextProvider\n\t\t\t\t\t\t\tkey={ blockContext.postId }\n\t\t\t\t\t\t\tvalue={ blockContext }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ blockContext.postId ===\n\t\t\t\t\t\t\t( activeBlockContextId ||\n\t\t\t\t\t\t\t\tblockContexts[ 0 ]?.postId ) ? (\n\t\t\t\t\t\t\t\t<PostTemplateInnerBlocks\n\t\t\t\t\t\t\t\t\tclassList={ blockContext.classList }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) : null }\n\t\t\t\t\t\t\t<MemoizedPostTemplateBlockPreview\n\t\t\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\t\t\tblockContextId={ blockContext.postId }\n\t\t\t\t\t\t\t\tclassList={ blockContext.classList }\n\t\t\t\t\t\t\t\tsetActiveBlockContextId={\n\t\t\t\t\t\t\t\t\tsetActiveBlockContextId\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisHidden={\n\t\t\t\t\t\t\t\t\tblockContext.postId ===\n\t\t\t\t\t\t\t\t\t( activeBlockContextId ||\n\t\t\t\t\t\t\t\t\t\tblockContexts[ 0 ]?.postId )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</BlockContextProvider>\n\t\t\t\t\t) ) }\n\t\t\t</ul>\n\t\t</>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAAA,OAAO,UAAU;AACjB,SAAS,MAAM,SAAS,gBAAgB;AACxC,SAAS,iBAAiB;AAC1B,SAAS,IAAI,UAAU;AACvB;AAAA,EACC;AAAA,EACA;AAAA,EACA,iCAAiC;AAAA,EACjC;AAAA,EACA;AAAA,EACA,SAAS;AAAA,OACH;AACP,SAAS,SAAS,oBAAoB;AACtC,SAAS,SAAS,iBAAiB;AACnC,SAAS,MAAM,YAAY;AAgBnB,
|
|
4
|
+
"sourcesContent": ["import clsx from 'clsx';\nimport { memo, useMemo, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tBlockContextProvider,\n\t__experimentalUseBlockPreview as useBlockPreview,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { Spinner, ToolbarGroup } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { list, grid } from '@wordpress/icons';\n\n// The Post Template's layout attribute arranges the post items, not the\n// blocks of the template, which always stack vertically inside each post\n// item. Override the inherited layout so inner block UI (movers, inserters,\n// grid controls) doesn't follow the post items' grid.\nconst INNER_BLOCKS_LAYOUT = { type: 'default' };\n\nfunction PostTemplateInnerBlocks( { classList } ) {\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{ className: clsx( 'wp-block-post', classList ) },\n\t\t{\n\t\t\t__unstableDisableLayoutClassNames: true,\n\t\t\tlayout: INNER_BLOCKS_LAYOUT,\n\t\t}\n\t);\n\treturn <li { ...innerBlocksProps } />;\n}\n\nfunction PostTemplateBlockPreview( {\n\tblocks,\n\tblockContextId,\n\tclassList,\n\tisHidden,\n\tsetActiveBlockContextId,\n} ) {\n\tconst blockPreviewProps = useBlockPreview( {\n\t\tblocks,\n\t\tprops: {\n\t\t\tclassName: clsx( 'wp-block-post', classList ),\n\t\t},\n\t} );\n\n\tconst handleOnClick = () => {\n\t\tsetActiveBlockContextId( blockContextId );\n\t};\n\n\tconst style = {\n\t\tdisplay: isHidden ? 'none' : undefined,\n\t};\n\n\treturn (\n\t\t<li\n\t\t\t{ ...blockPreviewProps }\n\t\t\ttabIndex={ 0 }\n\t\t\t// eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role\n\t\t\trole=\"button\"\n\t\t\tonClick={ handleOnClick }\n\t\t\tonKeyPress={ handleOnClick }\n\t\t\tstyle={ style }\n\t\t/>\n\t);\n}\n\nconst MemoizedPostTemplateBlockPreview = memo( PostTemplateBlockPreview );\n\nexport default function PostTemplateEdit( {\n\tsetAttributes,\n\tclientId,\n\tcontext: {\n\t\tquery: {\n\t\t\tperPage,\n\t\t\toffset = 0,\n\t\t\t// Match `build_query_vars_from_query_block()`, which queries posts when\n\t\t\t// `query` has no post type.\n\t\t\tpostType = 'post',\n\t\t\torder,\n\t\t\torderBy,\n\t\t\tauthor,\n\t\t\tsearch,\n\t\t\texclude,\n\t\t\tsticky,\n\t\t\tinherit,\n\t\t\ttaxQuery,\n\t\t\tparents,\n\t\t\tpages,\n\t\t\tformat,\n\t\t\texcludeCurrent,\n\t\t\t// We gather extra query args to pass to the REST API call.\n\t\t\t// This way extenders of Query Loop can add their own query args,\n\t\t\t// and have accurate previews in the editor.\n\t\t\t// Noting though that these args should either be supported by the\n\t\t\t// REST API or be handled by custom REST filters like `rest_{$this->post_type}_query`.\n\t\t\t...restQueryArgs\n\t\t} = {},\n\t\ttemplateSlug,\n\t\tpreviewPostType,\n\t\tpostId,\n\t},\n\tattributes: { layout },\n\t__unstableLayoutClassNames,\n} ) {\n\tconst {\n\t\ttype: layoutType,\n\t\tcolumnCount = 3,\n\t\tminimumColumnWidth,\n\t} = layout || {};\n\tconst [ activeBlockContextId, setActiveBlockContextId ] = useState();\n\tconst { posts, blocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, getTaxonomies } = select( coreStore );\n\t\t\tconst { getBlocks } = select( blockEditorStore );\n\t\t\tconst templateCategory =\n\t\t\t\tinherit &&\n\t\t\t\ttemplateSlug?.startsWith( 'category-' ) &&\n\t\t\t\tgetEntityRecords( 'taxonomy', 'category', {\n\t\t\t\t\tcontext: 'view',\n\t\t\t\t\tper_page: 1,\n\t\t\t\t\t_fields: [ 'id' ],\n\t\t\t\t\tslug: templateSlug.replace( 'category-', '' ),\n\t\t\t\t} );\n\t\t\tconst templateTag =\n\t\t\t\tinherit &&\n\t\t\t\ttemplateSlug?.startsWith( 'tag-' ) &&\n\t\t\t\tgetEntityRecords( 'taxonomy', 'post_tag', {\n\t\t\t\t\tcontext: 'view',\n\t\t\t\t\tper_page: 1,\n\t\t\t\t\t_fields: [ 'id' ],\n\t\t\t\t\tslug: templateSlug.replace( 'tag-', '' ),\n\t\t\t\t} );\n\t\t\tconst query = {\n\t\t\t\toffset: offset || 0,\n\t\t\t\torder,\n\t\t\t\torderby: orderBy,\n\t\t\t};\n\t\t\t// There is no need to build the taxQuery if we inherit.\n\t\t\tif ( taxQuery && ! inherit ) {\n\t\t\t\tconst taxonomies = getTaxonomies( {\n\t\t\t\t\ttype: postType,\n\t\t\t\t\tper_page: -1,\n\t\t\t\t\tcontext: 'view',\n\t\t\t\t} );\n\t\t\t\t// Build REST API parameters from taxonomy terms, e.g.\n\t\t\t\t// `category`, `tags_exclude`.\n\t\t\t\tconst buildTaxQuery = ( terms, suffix = '' ) => {\n\t\t\t\t\treturn Object.entries( terms || {} ).reduce(\n\t\t\t\t\t\t( accumulator, [ taxonomySlug, termIds ] ) => {\n\t\t\t\t\t\t\tconst taxonomy = taxonomies?.find(\n\t\t\t\t\t\t\t\t( { slug } ) => slug === taxonomySlug\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif ( taxonomy?.rest_base && termIds?.length ) {\n\t\t\t\t\t\t\t\taccumulator[ taxonomy.rest_base + suffix ] =\n\t\t\t\t\t\t\t\t\ttermIds;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn accumulator;\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{}\n\t\t\t\t\t);\n\t\t\t\t};\n\t\t\t\tconst builtTaxQuery = buildTaxQuery( taxQuery.include );\n\t\t\t\tif ( taxQuery.exclude ) {\n\t\t\t\t\tObject.assign(\n\t\t\t\t\t\tbuiltTaxQuery,\n\t\t\t\t\t\tbuildTaxQuery( taxQuery.exclude, '_exclude' )\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif ( !! Object.keys( builtTaxQuery ).length ) {\n\t\t\t\t\tObject.assign( query, builtTaxQuery );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( perPage ) {\n\t\t\t\tquery.per_page = perPage;\n\t\t\t}\n\t\t\tif ( author ) {\n\t\t\t\tquery.author = author;\n\t\t\t}\n\t\t\tif ( search ) {\n\t\t\t\tquery.search = search;\n\t\t\t}\n\t\t\tif ( exclude?.length ) {\n\t\t\t\tquery.exclude = exclude;\n\t\t\t}\n\t\t\tif ( parents?.length ) {\n\t\t\t\tquery.parent = parents;\n\t\t\t}\n\t\t\tif ( format?.length ) {\n\t\t\t\tquery.format = format;\n\t\t\t}\n\t\t\tif ( excludeCurrent && postId ) {\n\t\t\t\tif ( query.exclude ) {\n\t\t\t\t\tquery.exclude = [ ...query.exclude, postId ];\n\t\t\t\t} else {\n\t\t\t\t\tquery.exclude = [ postId ];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/*\n\t\t\t * Handle cases where sticky is set to `exclude` or `only`.\n\t\t\t * Which works as a `post__in/post__not_in` query for sticky posts.\n\t\t\t */\n\t\t\tif ( [ 'exclude', 'only' ].includes( sticky ) ) {\n\t\t\t\tquery.sticky = sticky === 'only';\n\t\t\t}\n\n\t\t\t// Empty string represents the default behavior of including sticky posts.\n\t\t\tif ( [ '', 'ignore' ].includes( sticky ) ) {\n\t\t\t\t// Remove any leftover sticky query parameter.\n\t\t\t\tdelete query.sticky;\n\t\t\t\tquery.ignore_sticky = sticky === 'ignore';\n\t\t\t}\n\n\t\t\t// If `inherit` is truthy, adjust conditionally the query to create a better preview.\n\t\t\tlet currentPostType = postType;\n\t\t\tif ( inherit ) {\n\t\t\t\t// Change the post-type if needed.\n\t\t\t\tif ( templateSlug?.startsWith( 'archive-' ) ) {\n\t\t\t\t\tquery.postType = templateSlug.replace( 'archive-', '' );\n\t\t\t\t\tcurrentPostType = query.postType;\n\t\t\t\t} else if ( templateCategory ) {\n\t\t\t\t\tquery.categories = templateCategory[ 0 ]?.id;\n\t\t\t\t} else if ( templateTag ) {\n\t\t\t\t\tquery.tags = templateTag[ 0 ]?.id;\n\t\t\t\t} else if (\n\t\t\t\t\ttemplateSlug?.startsWith( 'taxonomy-post_format' )\n\t\t\t\t) {\n\t\t\t\t\t// Get the post format slug from the template slug by removing the prefix.\n\t\t\t\t\tquery.format = templateSlug.replace(\n\t\t\t\t\t\t'taxonomy-post_format-post-format-',\n\t\t\t\t\t\t''\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// When we preview Query Loop blocks we should prefer the current\n\t\t\t// block's postType, which is passed through block context.\n\t\t\tconst usedPostType = previewPostType || currentPostType;\n\t\t\treturn {\n\t\t\t\tposts: getEntityRecords( 'postType', usedPostType, {\n\t\t\t\t\t...query,\n\t\t\t\t\t...restQueryArgs,\n\t\t\t\t} ),\n\t\t\t\tblocks: getBlocks( clientId ),\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tperPage,\n\t\t\toffset,\n\t\t\torder,\n\t\t\torderBy,\n\t\t\tclientId,\n\t\t\tauthor,\n\t\t\tsearch,\n\t\t\tpostType,\n\t\t\texclude,\n\t\t\tsticky,\n\t\t\tinherit,\n\t\t\ttemplateSlug,\n\t\t\ttaxQuery,\n\t\t\tparents,\n\t\t\tformat,\n\t\t\trestQueryArgs,\n\t\t\tpreviewPostType,\n\t\t]\n\t);\n\tconst blockContexts = useMemo(\n\t\t() =>\n\t\t\tposts?.map( ( post ) => ( {\n\t\t\t\tpostType: post.type,\n\t\t\t\tpostId: post.id,\n\t\t\t\tclassList: post.class_list ?? '',\n\t\t\t} ) ),\n\t\t[ posts ]\n\t);\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( __unstableLayoutClassNames, {\n\t\t\t[ `columns-${ columnCount }` ]:\n\t\t\t\tlayoutType === 'grid' && columnCount, // Ensure column count is flagged via classname for backwards compatibility.\n\t\t\t'has-native-responsive-grid':\n\t\t\t\tlayoutType === 'grid' && columnCount && minimumColumnWidth, // Flag native responsive grid when minimum column width is provided.\n\t\t} ),\n\t} );\n\n\tif ( ! posts ) {\n\t\treturn (\n\t\t\t<p { ...blockProps }>\n\t\t\t\t<Spinner />\n\t\t\t</p>\n\t\t);\n\t}\n\n\tif ( ! posts.length ) {\n\t\treturn <p { ...blockProps }> { __( 'No results found.' ) }</p>;\n\t}\n\n\tconst setDisplayLayout = ( newDisplayLayout ) =>\n\t\tsetAttributes( {\n\t\t\tlayout: { ...layout, ...newDisplayLayout },\n\t\t} );\n\n\tconst displayLayoutControls = [\n\t\t{\n\t\t\ticon: list,\n\t\t\ttitle: _x( 'List view', 'Post template block display setting' ),\n\t\t\tonClick: () => setDisplayLayout( { type: 'default' } ),\n\t\t\tisActive: layoutType === 'default' || layoutType === 'constrained',\n\t\t},\n\t\t{\n\t\t\ticon: grid,\n\t\t\ttitle: _x( 'Grid view', 'Post template block display setting' ),\n\t\t\tonClick: () =>\n\t\t\t\tsetDisplayLayout( {\n\t\t\t\t\ttype: 'grid',\n\t\t\t\t\tcolumnCount,\n\t\t\t\t} ),\n\t\t\tisActive: layoutType === 'grid',\n\t\t},\n\t];\n\n\t// To avoid flicker when switching active block contexts, a preview is rendered\n\t// for each block context, but the preview for the active block context is hidden.\n\t// This ensures that when it is displayed again, the cached rendering of the\n\t// block preview is used, instead of having to re-render the preview from scratch.\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup controls={ displayLayoutControls } />\n\t\t\t</BlockControls>\n\n\t\t\t<ul { ...blockProps }>\n\t\t\t\t{ blockContexts &&\n\t\t\t\t\tblockContexts.map( ( blockContext ) => (\n\t\t\t\t\t\t<BlockContextProvider\n\t\t\t\t\t\t\tkey={ blockContext.postId }\n\t\t\t\t\t\t\tvalue={ blockContext }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ blockContext.postId ===\n\t\t\t\t\t\t\t( activeBlockContextId ||\n\t\t\t\t\t\t\t\tblockContexts[ 0 ]?.postId ) ? (\n\t\t\t\t\t\t\t\t<PostTemplateInnerBlocks\n\t\t\t\t\t\t\t\t\tclassList={ blockContext.classList }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) : null }\n\t\t\t\t\t\t\t<MemoizedPostTemplateBlockPreview\n\t\t\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\t\t\tblockContextId={ blockContext.postId }\n\t\t\t\t\t\t\t\tclassList={ blockContext.classList }\n\t\t\t\t\t\t\t\tsetActiveBlockContextId={\n\t\t\t\t\t\t\t\t\tsetActiveBlockContextId\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisHidden={\n\t\t\t\t\t\t\t\t\tblockContext.postId ===\n\t\t\t\t\t\t\t\t\t( activeBlockContextId ||\n\t\t\t\t\t\t\t\t\t\tblockContexts[ 0 ]?.postId )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</BlockContextProvider>\n\t\t\t\t\t) ) }\n\t\t\t</ul>\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,OAAO,UAAU;AACjB,SAAS,MAAM,SAAS,gBAAgB;AACxC,SAAS,iBAAiB;AAC1B,SAAS,IAAI,UAAU;AACvB;AAAA,EACC;AAAA,EACA;AAAA,EACA,iCAAiC;AAAA,EACjC;AAAA,EACA;AAAA,EACA,SAAS;AAAA,OACH;AACP,SAAS,SAAS,oBAAoB;AACtC,SAAS,SAAS,iBAAiB;AACnC,SAAS,MAAM,YAAY;AAgBnB,SA0SN,UA1SM,KA0QC,YA1QD;AAVR,IAAM,sBAAsB,EAAE,MAAM,UAAU;AAE9C,SAAS,wBAAyB,EAAE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C;AAAA,MAC9D,SAAS,MAAM,iBAAkB,EAAE,MAAM,UAAU,CAAE;AAAA,MACrD,UAAU,eAAe,aAAa,eAAe;AAAA,IACtD;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,OAAO,GAAI,aAAa,qCAAsC;AAAA,MAC9D,SAAS,MACR,iBAAkB;AAAA,QACjB,MAAM;AAAA,QACN;AAAA,MACD,CAAE;AAAA,MACH,UAAU,eAAe;AAAA,IAC1B;AAAA,EACD;AAMA,SACC,iCACC;AAAA,wBAAC,iBACA,8BAAC,gBAAa,UAAW,uBAAwB,GAClD;AAAA,IAEA,oBAAC,QAAK,GAAG,YACN,2BACD,cAAc,IAAK,CAAE,iBACpB;AAAA,MAAC;AAAA;AAAA,QAEA,OAAQ;AAAA,QAEN;AAAA,uBAAa,YACb,wBACD,cAAe,CAAE,GAAG,UACpB;AAAA,YAAC;AAAA;AAAA,cACA,WAAY,aAAa;AAAA;AAAA,UAC1B,IACG;AAAA,UACJ;AAAA,YAAC;AAAA;AAAA,cACA;AAAA,cACA,gBAAiB,aAAa;AAAA,cAC9B,WAAY,aAAa;AAAA,cACzB;AAAA,cAGA,UACC,aAAa,YACX,wBACD,cAAe,CAAE,GAAG;AAAA;AAAA,UAEvB;AAAA;AAAA;AAAA,MAtBM,aAAa;AAAA,IAuBpB,CACC,GACJ;AAAA,KACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
// packages/block-library/src/preformatted/index.js
|
|
2
2
|
import { __ } from "@wordpress/i18n";
|
|
3
3
|
import { preformatted as icon } from "@wordpress/icons";
|
|
4
|
-
import { privateApis as blocksPrivateApis } from "@wordpress/blocks";
|
|
5
4
|
import initBlock from "../utils/init-block.mjs";
|
|
6
5
|
import edit from "./edit.mjs";
|
|
7
6
|
import metadata from "./block.json";
|
|
8
7
|
import save from "./save.mjs";
|
|
9
8
|
import transforms from "./transforms.mjs";
|
|
10
|
-
import { unlock } from "../lock-unlock.mjs";
|
|
11
|
-
var { fieldsKey, formKey } = unlock(blocksPrivateApis);
|
|
12
9
|
var { name } = metadata;
|
|
13
10
|
var settings = {
|
|
14
11
|
icon,
|
|
@@ -31,20 +28,6 @@ var settings = {
|
|
|
31
28
|
};
|
|
32
29
|
}
|
|
33
30
|
};
|
|
34
|
-
if (window.__experimentalContentOnlyInspectorFields) {
|
|
35
|
-
settings[fieldsKey] = [
|
|
36
|
-
{
|
|
37
|
-
id: "content",
|
|
38
|
-
label: __("Content"),
|
|
39
|
-
type: "text",
|
|
40
|
-
Edit: "rich-text"
|
|
41
|
-
// TODO: replace with custom component
|
|
42
|
-
}
|
|
43
|
-
];
|
|
44
|
-
settings[formKey] = {
|
|
45
|
-
fields: ["content"]
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
31
|
var init = () => initBlock({ name, metadata, settings });
|
|
49
32
|
export {
|
|
50
33
|
init,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/preformatted/index.js"],
|
|
4
|
-
"sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport { preformatted as icon } from '@wordpress/icons';\nimport
|
|
5
|
-
"mappings": ";AAAA,SAAS,UAAU;AACnB,SAAS,gBAAgB,YAAY;AACrC,
|
|
4
|
+
"sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport { preformatted as icon } from '@wordpress/icons';\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\t/* eslint-disable @wordpress/i18n-no-collapsible-whitespace */\n\t\t\t// translators: Sample content for the Preformatted block. Can be replaced with a more locale-adequate work.\n\t\t\tcontent: __(\n\t\t\t\t'EXT. XANADU - FAINT DAWN - 1940 (MINIATURE)\\nWindow, very small in the distance, illuminated.\\nAll around this is an almost totally black screen. Now, as the camera moves slowly towards the window which is almost a postage stamp in the frame, other forms appear;'\n\t\t\t),\n\t\t\t/* eslint-enable @wordpress/i18n-no-collapsible-whitespace */\n\t\t},\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\tcontent: attributes.content + '\\n\\n' + attributesToMerge.content,\n\t\t};\n\t},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,UAAU;AACnB,SAAS,gBAAgB,YAAY;AACrC,OAAO,eAAe;AACtB,OAAO,UAAU;AACjB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AAEvB,IAAM,EAAE,KAAK,IAAI;AAIV,IAAM,WAAW;AAAA,EACvB;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA;AAAA;AAAA,MAGX,SAAS;AAAA,QACR;AAAA,MACD;AAAA;AAAA,IAED;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,MAAO,YAAY,mBAAoB;AACtC,WAAO;AAAA,MACN,SAAS,WAAW,UAAU,SAAS,kBAAkB;AAAA,IAC1D;AAAA,EACD;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
// packages/block-library/src/pullquote/index.js
|
|
2
2
|
import { __ } from "@wordpress/i18n";
|
|
3
3
|
import { pullquote as icon } from "@wordpress/icons";
|
|
4
|
-
import { privateApis as blocksPrivateApis } from "@wordpress/blocks";
|
|
5
4
|
import initBlock from "../utils/init-block.mjs";
|
|
6
5
|
import deprecated from "./deprecated.mjs";
|
|
7
6
|
import edit from "./edit.mjs";
|
|
8
7
|
import metadata from "./block.json";
|
|
9
8
|
import save from "./save.mjs";
|
|
10
9
|
import transforms from "./transforms.mjs";
|
|
11
|
-
import { unlock } from "../lock-unlock.mjs";
|
|
12
|
-
var { fieldsKey, formKey } = unlock(blocksPrivateApis);
|
|
13
10
|
var { name } = metadata;
|
|
14
11
|
var settings = {
|
|
15
12
|
icon,
|
|
@@ -29,27 +26,6 @@ var settings = {
|
|
|
29
26
|
save,
|
|
30
27
|
deprecated
|
|
31
28
|
};
|
|
32
|
-
if (window.__experimentalContentOnlyInspectorFields) {
|
|
33
|
-
settings[fieldsKey] = [
|
|
34
|
-
{
|
|
35
|
-
id: "value",
|
|
36
|
-
label: __("Content"),
|
|
37
|
-
type: "text",
|
|
38
|
-
Edit: "rich-text"
|
|
39
|
-
// TODO: replace with custom component
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
id: "citation",
|
|
43
|
-
label: __("Citation"),
|
|
44
|
-
type: "text",
|
|
45
|
-
Edit: "rich-text"
|
|
46
|
-
// TODO: replace with custom component
|
|
47
|
-
}
|
|
48
|
-
];
|
|
49
|
-
settings[formKey] = {
|
|
50
|
-
fields: ["value", "citation"]
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
29
|
var init = () => initBlock({ name, metadata, settings });
|
|
54
30
|
export {
|
|
55
31
|
init,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/pullquote/index.js"],
|
|
4
|
-
"sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport { pullquote as icon } from '@wordpress/icons';\nimport
|
|
5
|
-
"mappings": ";AAAA,SAAS,UAAU;AACnB,SAAS,aAAa,YAAY;AAClC,
|
|
4
|
+
"sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport { pullquote as icon } from '@wordpress/icons';\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tvalue:\n\t\t\t\t// translators: Quote serving as example for the Pullquote block. Attributed to Matt Mullenweg.\n\t\t\t\t__(\n\t\t\t\t\t'One of the hardest things to do in technology is disrupt yourself.'\n\t\t\t\t),\n\t\t\tcitation: __( 'Matt Mullenweg' ),\n\t\t},\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,UAAU;AACnB,SAAS,aAAa,YAAY;AAClC,OAAO,eAAe;AACtB,OAAO,gBAAgB;AACvB,OAAO,UAAU;AACjB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AAEvB,IAAM,EAAE,KAAK,IAAI;AAIV,IAAM,WAAW;AAAA,EACvB;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA,MACX;AAAA;AAAA,QAEC;AAAA,UACC;AAAA,QACD;AAAA;AAAA,MACD,UAAU,GAAI,gBAAiB;AAAA,IAChC;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -42,7 +42,9 @@ function QueryInspectorControls(props) {
|
|
|
42
42
|
orderBy,
|
|
43
43
|
author: authorIds,
|
|
44
44
|
pages,
|
|
45
|
-
|
|
45
|
+
// Match `build_query_vars_from_query_block()`, which queries posts when
|
|
46
|
+
// `query` has no post type.
|
|
47
|
+
postType = "post",
|
|
46
48
|
perPage,
|
|
47
49
|
offset,
|
|
48
50
|
sticky,
|
|
@@ -130,7 +132,7 @@ function QueryInspectorControls(props) {
|
|
|
130
132
|
);
|
|
131
133
|
const showExcludeCurrentControl = shouldExcludeCurrentPost && isControlAllowed(allowedControls, "excludeCurrent");
|
|
132
134
|
const postTypeSingularName = useSelect(
|
|
133
|
-
(select) => select(coreStore).getPostType(postType)?.labels
|
|
135
|
+
(select) => select(coreStore).getPostType(postType)?.labels?.singular_name,
|
|
134
136
|
[postType]
|
|
135
137
|
);
|
|
136
138
|
const showFiltersPanel = showTaxControl || showAuthorControl || showSearchControl || showParentControl || showFormatControl || showExcludeCurrentControl;
|
|
@@ -401,7 +403,7 @@ function QueryInspectorControls(props) {
|
|
|
401
403
|
ToolsPanelItem,
|
|
402
404
|
{
|
|
403
405
|
hasValue: () => !!querySearch,
|
|
404
|
-
label: __("
|
|
406
|
+
label: __("Search terms"),
|
|
405
407
|
onDeselect: () => {
|
|
406
408
|
setQuery({ search: "" });
|
|
407
409
|
setQuerySearch("");
|
|
@@ -409,7 +411,10 @@ function QueryInspectorControls(props) {
|
|
|
409
411
|
children: /* @__PURE__ */ jsx(
|
|
410
412
|
TextControl,
|
|
411
413
|
{
|
|
412
|
-
label: __("
|
|
414
|
+
label: __("Search terms"),
|
|
415
|
+
help: __(
|
|
416
|
+
"Filter the query by keywords that appear in the content, title, or excerpt."
|
|
417
|
+
),
|
|
413
418
|
value: querySearch,
|
|
414
419
|
onChange: (newQuerySearch) => {
|
|
415
420
|
debouncedQuerySearch(newQuerySearch);
|