@wordpress/block-library 9.48.0 → 10.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 +19 -1
- package/build/audio/edit.cjs +8 -1
- package/build/audio/edit.cjs.map +2 -2
- package/build/breadcrumbs/edit.cjs +1 -2
- package/build/breadcrumbs/edit.cjs.map +2 -2
- package/build/button/edit.cjs +1 -2
- package/build/button/edit.cjs.map +2 -2
- package/build/categories/edit.cjs +1 -1
- package/build/categories/edit.cjs.map +1 -1
- package/build/code/edit.cjs +1 -1
- package/build/code/edit.cjs.map +2 -2
- package/build/code/index.cjs +1 -1
- package/build/code/index.cjs.map +1 -1
- package/build/columns/transforms.cjs +65 -0
- package/build/columns/transforms.cjs.map +2 -2
- package/build/columns/utils.cjs.map +1 -1
- package/build/comments/edit/comments-legacy.cjs +1 -1
- package/build/comments/edit/comments-legacy.cjs.map +1 -1
- package/build/comments/edit/placeholder.cjs +4 -4
- package/build/comments/edit/placeholder.cjs.map +1 -1
- package/build/comments-pagination-next/edit.cjs +2 -2
- package/build/comments-pagination-next/edit.cjs.map +1 -1
- package/build/comments-pagination-previous/edit.cjs +2 -2
- package/build/comments-pagination-previous/edit.cjs.map +1 -1
- package/build/cover/deprecated.cjs +3 -3
- package/build/cover/deprecated.cjs.map +2 -2
- package/build/cover/edit/block-controls.cjs +13 -0
- package/build/cover/edit/block-controls.cjs.map +2 -2
- package/build/cover/edit/embed-video-url-input.cjs +0 -1
- package/build/cover/edit/embed-video-url-input.cjs.map +2 -2
- package/build/cover/edit/index.cjs +61 -2
- package/build/cover/edit/index.cjs.map +3 -3
- package/build/cover/edit/inspector-controls.cjs +93 -35
- package/build/cover/edit/inspector-controls.cjs.map +2 -2
- package/build/details/edit.cjs +1 -2
- package/build/details/edit.cjs.map +2 -2
- package/build/embed/embed-placeholder.cjs +1 -1
- package/build/embed/embed-placeholder.cjs.map +2 -2
- package/build/file/edit.cjs +3 -11
- package/build/file/edit.cjs.map +2 -2
- package/build/file/index.cjs +3 -1
- package/build/file/index.cjs.map +3 -3
- package/build/file/transforms.cjs +11 -32
- package/build/file/transforms.cjs.map +2 -2
- package/build/{freeform/convert-to-blocks-button.cjs → file/variations.cjs} +16 -18
- package/build/file/variations.cjs.map +7 -0
- package/build/footnotes/edit.cjs +1 -1
- package/build/footnotes/edit.cjs.map +2 -2
- package/build/form/edit.cjs +0 -2
- package/build/form/edit.cjs.map +2 -2
- package/build/form-input/edit.cjs +1 -3
- package/build/form-input/edit.cjs.map +2 -2
- package/build/freeform/edit.cjs +6 -15
- package/build/freeform/edit.cjs.map +3 -3
- package/build/freeform/migration-notice.cjs.map +2 -2
- package/build/gallery/edit.cjs +212 -331
- package/build/gallery/edit.cjs.map +2 -2
- package/build/gallery/transforms.cjs +43 -0
- package/build/gallery/transforms.cjs.map +2 -2
- package/build/heading/edit.cjs +0 -1
- package/build/heading/edit.cjs.map +2 -2
- package/build/home-link/edit.cjs +1 -2
- package/build/home-link/edit.cjs.map +2 -2
- package/build/html/index.cjs +1 -1
- package/build/html/index.cjs.map +2 -2
- package/build/html/modal.cjs +9 -6
- package/build/html/modal.cjs.map +2 -2
- package/build/icon/block.json +12 -0
- package/build/icon/edit.cjs +90 -41
- package/build/icon/edit.cjs.map +3 -3
- package/build/icon/index.cjs +3 -1
- package/build/icon/index.cjs.map +3 -3
- package/build/{tab/save.cjs → icon/variations.cjs} +14 -15
- package/build/icon/variations.cjs.map +7 -0
- package/build/image/block.json +1 -0
- package/build/image/edit.cjs +4 -3
- package/build/image/edit.cjs.map +2 -2
- package/build/image/image.cjs +91 -29
- package/build/image/image.cjs.map +2 -2
- package/build/image/index.cjs +1 -1
- package/build/image/index.cjs.map +2 -2
- package/build/image/transforms.cjs +9 -3
- package/build/image/transforms.cjs.map +2 -2
- package/build/image/use-open-image-media-editor-modal.cjs +5 -25
- package/build/image/use-open-image-media-editor-modal.cjs.map +2 -2
- package/build/index.cjs +1 -3
- package/build/index.cjs.map +2 -2
- package/build/latest-posts/edit.cjs +1 -1
- package/build/latest-posts/edit.cjs.map +1 -1
- package/build/list/edit.cjs +1 -8
- package/build/list/edit.cjs.map +2 -2
- package/build/list/ordered-list-settings.cjs +1 -45
- package/build/list/ordered-list-settings.cjs.map +2 -2
- package/build/list-item/hooks/use-merge.cjs +47 -24
- package/build/list-item/hooks/use-merge.cjs.map +2 -2
- package/build/math/edit.cjs +1 -1
- package/build/math/index.cjs +1 -1
- package/build/math/index.cjs.map +1 -1
- package/build/media-text/constants.cjs +1 -1
- package/build/media-text/constants.cjs.map +2 -2
- package/build/media-text/index.cjs +1 -1
- package/build/media-text/index.cjs.map +2 -2
- package/build/missing/edit.cjs +2 -2
- package/build/missing/edit.cjs.map +1 -1
- package/build/navigation/edit/index.cjs +34 -39
- package/build/navigation/edit/index.cjs.map +2 -2
- package/build/navigation/edit/navigation-menu-name-control.cjs +0 -1
- package/build/navigation/edit/navigation-menu-name-control.cjs.map +2 -2
- package/build/navigation/edit/navigation-menu-selector.cjs +1 -1
- package/build/navigation/edit/navigation-menu-selector.cjs.map +2 -2
- package/build/navigation/edit/placeholder/index.cjs +1 -1
- package/build/navigation/edit/placeholder/index.cjs.map +2 -2
- package/build/navigation-link/block.json +1 -1
- package/build/navigation-link/edit.cjs +1 -2
- package/build/navigation-link/edit.cjs.map +2 -2
- package/build/navigation-link/link-ui/page-creator.cjs +0 -1
- package/build/navigation-link/link-ui/page-creator.cjs.map +2 -2
- package/build/navigation-link/shared/controls.cjs +0 -2
- package/build/navigation-link/shared/controls.cjs.map +2 -2
- package/build/navigation-submenu/block.json +7 -0
- package/build/navigation-submenu/edit.cjs +3 -2
- package/build/navigation-submenu/edit.cjs.map +2 -2
- package/build/page-list/block.json +2 -5
- package/build/page-list/edit.cjs +1 -11
- package/build/page-list/edit.cjs.map +2 -2
- package/build/paragraph/deprecated.cjs +1 -0
- package/build/paragraph/deprecated.cjs.map +2 -2
- package/build/paragraph/edit.cjs +10 -1
- package/build/paragraph/edit.cjs.map +3 -3
- package/build/playlist/block.json +12 -0
- package/build/playlist/edit.cjs +27 -1
- package/build/playlist/edit.cjs.map +2 -2
- package/build/playlist/save.cjs +8 -1
- package/build/playlist/save.cjs.map +2 -2
- package/build/playlist/view.cjs +1 -0
- package/build/playlist/view.cjs.map +2 -2
- package/build/playlist-track/edit.cjs +0 -3
- package/build/playlist-track/edit.cjs.map +2 -2
- package/build/post-author/edit.cjs +1 -1
- package/build/post-author/edit.cjs.map +2 -2
- package/build/post-author/utils.cjs +1 -1
- package/build/post-author/utils.cjs.map +2 -2
- package/build/post-comment/edit.cjs +0 -1
- package/build/post-comment/edit.cjs.map +2 -2
- package/build/post-date/edit.cjs +2 -2
- package/build/post-date/edit.cjs.map +2 -2
- package/build/post-excerpt/edit.cjs +2 -2
- package/build/post-excerpt/edit.cjs.map +2 -2
- package/build/post-featured-image/block.json +1 -0
- package/build/post-featured-image/dimension-controls.cjs +90 -178
- package/build/post-featured-image/dimension-controls.cjs.map +3 -3
- package/build/post-featured-image/edit.cjs +47 -18
- package/build/post-featured-image/edit.cjs.map +2 -2
- package/build/post-navigation-link/edit.cjs +2 -2
- package/build/post-navigation-link/edit.cjs.map +2 -2
- package/build/post-terms/edit.cjs +0 -1
- package/build/post-terms/edit.cjs.map +2 -2
- package/build/post-time-to-read/edit.cjs +1 -1
- package/build/post-time-to-read/edit.cjs.map +1 -1
- package/build/post-time-to-read/index.cjs +1 -1
- package/build/post-time-to-read/index.cjs.map +2 -2
- package/build/post-time-to-read/variations.cjs +1 -1
- package/build/post-time-to-read/variations.cjs.map +2 -2
- package/build/post-title/edit.cjs +0 -1
- package/build/post-title/edit.cjs.map +2 -2
- package/build/preformatted/edit.cjs +1 -1
- package/build/preformatted/edit.cjs.map +2 -2
- package/build/pullquote/block.json +1 -3
- package/build/pullquote/deprecated.cjs +114 -9
- package/build/pullquote/deprecated.cjs.map +3 -3
- package/build/pullquote/edit.cjs +43 -66
- package/build/pullquote/edit.cjs.map +3 -3
- package/build/pullquote/save.cjs +5 -26
- package/build/pullquote/save.cjs.map +3 -3
- package/build/query/edit/enhanced-pagination-modal.cjs +10 -1
- package/build/query/edit/enhanced-pagination-modal.cjs.map +3 -3
- package/build/query/edit/inspector-controls/enhanced-pagination-control.cjs +1 -1
- package/build/query/edit/inspector-controls/enhanced-pagination-control.cjs.map +1 -1
- package/build/query/edit/inspector-controls/index.cjs +0 -1
- package/build/query/edit/inspector-controls/index.cjs.map +2 -2
- package/build/query/edit/inspector-controls/order-control.cjs +2 -2
- package/build/query/edit/inspector-controls/order-control.cjs.map +2 -2
- package/build/query/utils.cjs +2 -2
- package/build/query/utils.cjs.map +2 -2
- package/build/query-pagination-next/edit.cjs +2 -2
- package/build/query-pagination-next/edit.cjs.map +1 -1
- package/build/query-pagination-previous/edit.cjs +2 -2
- package/build/query-pagination-previous/edit.cjs.map +1 -1
- package/build/query-title/edit.cjs +1 -1
- package/build/query-title/edit.cjs.map +2 -2
- package/build/query-total/edit.cjs +1 -1
- package/build/query-total/edit.cjs.map +2 -2
- package/build/quote/edit.cjs +4 -9
- package/build/quote/edit.cjs.map +2 -2
- package/build/quote/index.cjs +1 -1
- package/build/quote/index.cjs.map +2 -2
- package/build/read-more/edit.cjs +1 -1
- package/build/read-more/edit.cjs.map +2 -2
- package/build/rss/edit.cjs +1 -2
- package/build/rss/edit.cjs.map +2 -2
- package/build/search/block.json +4 -0
- package/build/search/edit.cjs +244 -206
- package/build/search/edit.cjs.map +2 -2
- package/build/shortcode/edit.cjs +1 -1
- package/build/shortcode/edit.cjs.map +2 -2
- package/build/shortcode/transforms.cjs +2 -2
- package/build/shortcode/transforms.cjs.map +2 -2
- package/build/site-logo/edit.cjs +2 -1
- package/build/site-logo/edit.cjs.map +2 -2
- package/build/site-tagline/edit.cjs +1 -1
- package/build/site-tagline/edit.cjs.map +2 -2
- package/build/site-title/edit.cjs +1 -1
- package/build/site-title/edit.cjs.map +2 -2
- package/build/social-link/edit.cjs +0 -3
- package/build/social-link/edit.cjs.map +2 -2
- package/build/tab-list/block.json +33 -20
- package/build/tab-list/edit.cjs +122 -12
- package/build/tab-list/edit.cjs.map +3 -3
- package/build/tab-list/init.cjs +28 -0
- package/build/tab-list/init.cjs.map +7 -0
- package/build/tab-list/save.cjs +33 -3
- package/build/tab-list/save.cjs.map +3 -3
- package/build/tab-panel/add-tab-toolbar-control.cjs +19 -8
- package/build/tab-panel/add-tab-toolbar-control.cjs.map +2 -2
- package/build/tab-panel/block.json +2 -6
- package/build/tab-panel/edit.cjs +0 -9
- package/build/tab-panel/edit.cjs.map +2 -2
- package/build/tab-panel/remove-tab-toolbar-control.cjs +9 -14
- package/build/tab-panel/remove-tab-toolbar-control.cjs.map +2 -2
- package/build/tab-panel/save.cjs +2 -1
- package/build/tab-panel/save.cjs.map +2 -2
- package/build/tab-panels/block.json +2 -28
- package/build/tab-panels/init.cjs +28 -0
- package/build/tab-panels/init.cjs.map +7 -0
- package/build/table/edit.cjs +0 -2
- package/build/table/edit.cjs.map +2 -2
- package/build/table/index.cjs +1 -1
- package/build/table/index.cjs.map +2 -2
- package/build/tabs/block.json +3 -17
- package/build/tabs/edit.cjs +7 -21
- package/build/tabs/edit.cjs.map +3 -3
- package/build/tabs/index.cjs +6 -10
- package/build/tabs/index.cjs.map +2 -2
- package/build/tabs/use-tab-list-items-sync.cjs +53 -0
- package/build/tabs/use-tab-list-items-sync.cjs.map +7 -0
- package/build/tabs/view.cjs +22 -104
- package/build/tabs/view.cjs.map +2 -2
- package/build/template-part/edit/advanced-controls.cjs +0 -1
- package/build/template-part/edit/advanced-controls.cjs.map +2 -2
- package/build/template-part/edit/title-modal.cjs +1 -2
- package/build/template-part/edit/title-modal.cjs.map +2 -2
- package/build/terms-query/edit/inspector-controls/order-control.cjs +2 -2
- package/build/terms-query/edit/inspector-controls/order-control.cjs.map +2 -2
- package/build/utils/style-state.cjs +164 -0
- package/build/utils/style-state.cjs.map +7 -0
- package/build/utils/waveform-player.cjs +42 -9
- package/build/utils/waveform-player.cjs.map +2 -2
- package/build/utils/waveform-utils.cjs +6 -4
- package/build/utils/waveform-utils.cjs.map +2 -2
- package/build/verse/edit.cjs +1 -1
- package/build/verse/edit.cjs.map +2 -2
- package/build/video/edit-common-settings.cjs +3 -6
- package/build/video/edit-common-settings.cjs.map +2 -2
- package/build/video/edit.cjs +3 -2
- package/build/video/edit.cjs.map +2 -2
- package/build/video/tracks-editor.cjs +0 -2
- package/build/video/tracks-editor.cjs.map +2 -2
- package/build-module/audio/edit.mjs +8 -2
- package/build-module/audio/edit.mjs.map +2 -2
- package/build-module/breadcrumbs/edit.mjs +1 -2
- package/build-module/breadcrumbs/edit.mjs.map +2 -2
- package/build-module/button/edit.mjs +1 -2
- package/build-module/button/edit.mjs.map +2 -2
- package/build-module/categories/edit.mjs +1 -1
- package/build-module/categories/edit.mjs.map +1 -1
- package/build-module/code/edit.mjs +1 -1
- package/build-module/code/edit.mjs.map +2 -2
- package/build-module/code/index.mjs +1 -1
- package/build-module/code/index.mjs.map +1 -1
- package/build-module/columns/transforms.mjs +65 -0
- package/build-module/columns/transforms.mjs.map +2 -2
- package/build-module/columns/utils.mjs.map +1 -1
- package/build-module/comments/edit/comments-legacy.mjs +1 -1
- package/build-module/comments/edit/comments-legacy.mjs.map +1 -1
- package/build-module/comments/edit/placeholder.mjs +4 -4
- package/build-module/comments/edit/placeholder.mjs.map +1 -1
- package/build-module/comments-pagination-next/edit.mjs +2 -2
- package/build-module/comments-pagination-next/edit.mjs.map +1 -1
- package/build-module/comments-pagination-previous/edit.mjs +2 -2
- package/build-module/comments-pagination-previous/edit.mjs.map +1 -1
- package/build-module/cover/deprecated.mjs +3 -3
- package/build-module/cover/deprecated.mjs.map +2 -2
- package/build-module/cover/edit/block-controls.mjs +15 -2
- package/build-module/cover/edit/block-controls.mjs.map +2 -2
- package/build-module/cover/edit/embed-video-url-input.mjs +0 -1
- package/build-module/cover/edit/embed-video-url-input.mjs.map +2 -2
- package/build-module/cover/edit/index.mjs +64 -3
- package/build-module/cover/edit/index.mjs.map +2 -2
- package/build-module/cover/edit/inspector-controls.mjs +98 -35
- package/build-module/cover/edit/inspector-controls.mjs.map +2 -2
- package/build-module/details/edit.mjs +1 -2
- package/build-module/details/edit.mjs.map +2 -2
- package/build-module/embed/embed-placeholder.mjs +1 -1
- package/build-module/embed/embed-placeholder.mjs.map +2 -2
- package/build-module/file/edit.mjs +5 -13
- package/build-module/file/edit.mjs.map +2 -2
- package/build-module/file/index.mjs +3 -1
- package/build-module/file/index.mjs.map +2 -2
- package/build-module/file/transforms.mjs +11 -32
- package/build-module/file/transforms.mjs.map +2 -2
- package/build-module/file/variations.mjs +17 -0
- package/build-module/file/variations.mjs.map +7 -0
- package/build-module/footnotes/edit.mjs +1 -1
- package/build-module/footnotes/edit.mjs.map +2 -2
- package/build-module/form/edit.mjs +0 -2
- package/build-module/form/edit.mjs.map +2 -2
- package/build-module/form-input/edit.mjs +1 -3
- package/build-module/form-input/edit.mjs.map +2 -2
- package/build-module/freeform/edit.mjs +6 -15
- package/build-module/freeform/edit.mjs.map +2 -2
- package/build-module/freeform/migration-notice.mjs.map +2 -2
- package/build-module/gallery/edit.mjs +214 -334
- package/build-module/gallery/edit.mjs.map +2 -2
- package/build-module/gallery/transforms.mjs +43 -0
- package/build-module/gallery/transforms.mjs.map +2 -2
- package/build-module/heading/edit.mjs +1 -2
- package/build-module/heading/edit.mjs.map +2 -2
- package/build-module/home-link/edit.mjs +1 -2
- package/build-module/home-link/edit.mjs.map +2 -2
- package/build-module/html/index.mjs +1 -1
- package/build-module/html/index.mjs.map +2 -2
- package/build-module/html/modal.mjs +9 -6
- package/build-module/html/modal.mjs.map +2 -2
- package/build-module/icon/block.json +12 -0
- package/build-module/icon/edit.mjs +94 -42
- package/build-module/icon/edit.mjs.map +2 -2
- package/build-module/icon/index.mjs +3 -1
- package/build-module/icon/index.mjs.map +2 -2
- package/build-module/icon/variations.mjs +13 -0
- package/build-module/icon/variations.mjs.map +7 -0
- package/build-module/image/block.json +1 -0
- package/build-module/image/edit.mjs +4 -3
- package/build-module/image/edit.mjs.map +2 -2
- package/build-module/image/image.mjs +96 -29
- package/build-module/image/image.mjs.map +2 -2
- package/build-module/image/index.mjs +1 -1
- package/build-module/image/index.mjs.map +2 -2
- package/build-module/image/transforms.mjs +9 -3
- package/build-module/image/transforms.mjs.map +2 -2
- package/build-module/image/use-open-image-media-editor-modal.mjs +5 -25
- package/build-module/image/use-open-image-media-editor-modal.mjs.map +2 -2
- package/build-module/index.mjs +1 -3
- package/build-module/index.mjs.map +2 -2
- package/build-module/latest-posts/edit.mjs +1 -1
- package/build-module/latest-posts/edit.mjs.map +1 -1
- package/build-module/list/edit.mjs +2 -9
- package/build-module/list/edit.mjs.map +2 -2
- package/build-module/list/ordered-list-settings.mjs +1 -46
- package/build-module/list/ordered-list-settings.mjs.map +2 -2
- package/build-module/list-item/hooks/use-merge.mjs +48 -25
- package/build-module/list-item/hooks/use-merge.mjs.map +2 -2
- package/build-module/math/edit.mjs +1 -1
- package/build-module/math/index.mjs +1 -1
- package/build-module/math/index.mjs.map +1 -1
- package/build-module/media-text/constants.mjs +1 -1
- package/build-module/media-text/constants.mjs.map +2 -2
- package/build-module/media-text/index.mjs +1 -1
- package/build-module/media-text/index.mjs.map +2 -2
- package/build-module/missing/edit.mjs +2 -2
- package/build-module/missing/edit.mjs.map +1 -1
- package/build-module/navigation/edit/index.mjs +35 -46
- package/build-module/navigation/edit/index.mjs.map +2 -2
- package/build-module/navigation/edit/navigation-menu-name-control.mjs +0 -1
- package/build-module/navigation/edit/navigation-menu-name-control.mjs.map +2 -2
- package/build-module/navigation/edit/navigation-menu-selector.mjs +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.mjs.map +2 -2
- package/build-module/navigation/edit/placeholder/index.mjs +1 -1
- package/build-module/navigation/edit/placeholder/index.mjs.map +2 -2
- package/build-module/navigation-link/block.json +1 -1
- package/build-module/navigation-link/edit.mjs +1 -2
- package/build-module/navigation-link/edit.mjs.map +2 -2
- package/build-module/navigation-link/link-ui/page-creator.mjs +0 -1
- package/build-module/navigation-link/link-ui/page-creator.mjs.map +2 -2
- package/build-module/navigation-link/shared/controls.mjs +0 -2
- package/build-module/navigation-link/shared/controls.mjs.map +2 -2
- package/build-module/navigation-submenu/block.json +7 -0
- package/build-module/navigation-submenu/edit.mjs +3 -2
- package/build-module/navigation-submenu/edit.mjs.map +2 -2
- package/build-module/page-list/block.json +2 -5
- package/build-module/page-list/edit.mjs +1 -11
- package/build-module/page-list/edit.mjs.map +2 -2
- package/build-module/paragraph/deprecated.mjs +1 -0
- package/build-module/paragraph/deprecated.mjs.map +2 -2
- package/build-module/paragraph/edit.mjs +12 -2
- package/build-module/paragraph/edit.mjs.map +2 -2
- package/build-module/playlist/block.json +12 -0
- package/build-module/playlist/edit.mjs +27 -1
- package/build-module/playlist/edit.mjs.map +2 -2
- package/build-module/playlist/save.mjs +8 -1
- package/build-module/playlist/save.mjs.map +2 -2
- package/build-module/playlist/view.mjs +1 -0
- package/build-module/playlist/view.mjs.map +2 -2
- package/build-module/playlist-track/edit.mjs +0 -3
- package/build-module/playlist-track/edit.mjs.map +2 -2
- package/build-module/post-author/edit.mjs +1 -1
- package/build-module/post-author/edit.mjs.map +2 -2
- package/build-module/post-author/utils.mjs +1 -1
- package/build-module/post-author/utils.mjs.map +2 -2
- package/build-module/post-comment/edit.mjs +0 -1
- package/build-module/post-comment/edit.mjs.map +2 -2
- package/build-module/post-date/edit.mjs +2 -2
- package/build-module/post-date/edit.mjs.map +2 -2
- package/build-module/post-excerpt/edit.mjs +2 -2
- package/build-module/post-excerpt/edit.mjs.map +2 -2
- package/build-module/post-featured-image/block.json +1 -0
- package/build-module/post-featured-image/dimension-controls.mjs +99 -187
- package/build-module/post-featured-image/dimension-controls.mjs.map +2 -2
- package/build-module/post-featured-image/edit.mjs +47 -18
- package/build-module/post-featured-image/edit.mjs.map +2 -2
- package/build-module/post-navigation-link/edit.mjs +2 -2
- package/build-module/post-navigation-link/edit.mjs.map +2 -2
- package/build-module/post-terms/edit.mjs +0 -1
- package/build-module/post-terms/edit.mjs.map +2 -2
- package/build-module/post-time-to-read/edit.mjs +1 -1
- package/build-module/post-time-to-read/edit.mjs.map +1 -1
- package/build-module/post-time-to-read/index.mjs +1 -1
- package/build-module/post-time-to-read/index.mjs.map +2 -2
- package/build-module/post-time-to-read/variations.mjs +2 -2
- package/build-module/post-time-to-read/variations.mjs.map +2 -2
- package/build-module/post-title/edit.mjs +0 -1
- package/build-module/post-title/edit.mjs.map +2 -2
- package/build-module/preformatted/edit.mjs +1 -1
- package/build-module/preformatted/edit.mjs.map +2 -2
- package/build-module/pullquote/block.json +1 -3
- package/build-module/pullquote/deprecated.mjs +114 -9
- package/build-module/pullquote/deprecated.mjs.map +2 -2
- package/build-module/pullquote/edit.mjs +44 -72
- package/build-module/pullquote/edit.mjs.map +2 -2
- package/build-module/pullquote/save.mjs +5 -16
- package/build-module/pullquote/save.mjs.map +2 -2
- package/build-module/query/edit/enhanced-pagination-modal.mjs +10 -1
- package/build-module/query/edit/enhanced-pagination-modal.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.mjs +1 -1
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.mjs.map +1 -1
- package/build-module/query/edit/inspector-controls/index.mjs +0 -1
- package/build-module/query/edit/inspector-controls/index.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/order-control.mjs +2 -2
- package/build-module/query/edit/inspector-controls/order-control.mjs.map +2 -2
- package/build-module/query/utils.mjs +2 -2
- package/build-module/query/utils.mjs.map +2 -2
- package/build-module/query-pagination-next/edit.mjs +2 -2
- package/build-module/query-pagination-next/edit.mjs.map +1 -1
- package/build-module/query-pagination-previous/edit.mjs +2 -2
- package/build-module/query-pagination-previous/edit.mjs.map +1 -1
- package/build-module/query-title/edit.mjs +1 -1
- package/build-module/query-title/edit.mjs.map +2 -2
- package/build-module/query-total/edit.mjs +1 -1
- package/build-module/query-total/edit.mjs.map +2 -2
- package/build-module/quote/edit.mjs +5 -10
- package/build-module/quote/edit.mjs.map +2 -2
- package/build-module/quote/index.mjs +1 -1
- package/build-module/quote/index.mjs.map +2 -2
- package/build-module/read-more/edit.mjs +1 -1
- package/build-module/read-more/edit.mjs.map +2 -2
- package/build-module/rss/edit.mjs +1 -2
- package/build-module/rss/edit.mjs.map +2 -2
- package/build-module/search/block.json +4 -0
- package/build-module/search/edit.mjs +244 -206
- package/build-module/search/edit.mjs.map +2 -2
- package/build-module/shortcode/edit.mjs +1 -1
- package/build-module/shortcode/edit.mjs.map +2 -2
- package/build-module/shortcode/transforms.mjs +2 -2
- package/build-module/shortcode/transforms.mjs.map +2 -2
- package/build-module/site-logo/edit.mjs +2 -1
- package/build-module/site-logo/edit.mjs.map +2 -2
- package/build-module/site-tagline/edit.mjs +1 -1
- package/build-module/site-tagline/edit.mjs.map +2 -2
- package/build-module/site-title/edit.mjs +1 -1
- package/build-module/site-title/edit.mjs.map +2 -2
- package/build-module/social-link/edit.mjs +0 -3
- package/build-module/social-link/edit.mjs.map +2 -2
- package/build-module/tab-list/block.json +33 -20
- package/build-module/tab-list/edit.mjs +128 -15
- package/build-module/tab-list/edit.mjs.map +2 -2
- package/build-module/tab-list/init.mjs +7 -0
- package/build-module/tab-list/init.mjs.map +7 -0
- package/build-module/tab-list/save.mjs +29 -4
- package/build-module/tab-list/save.mjs.map +2 -2
- package/build-module/tab-panel/add-tab-toolbar-control.mjs +19 -8
- package/build-module/tab-panel/add-tab-toolbar-control.mjs.map +2 -2
- package/build-module/tab-panel/block.json +2 -6
- package/build-module/tab-panel/edit.mjs +1 -10
- package/build-module/tab-panel/edit.mjs.map +2 -2
- package/build-module/tab-panel/remove-tab-toolbar-control.mjs +9 -14
- package/build-module/tab-panel/remove-tab-toolbar-control.mjs.map +2 -2
- package/build-module/tab-panel/save.mjs +2 -1
- package/build-module/tab-panel/save.mjs.map +2 -2
- package/build-module/tab-panels/block.json +2 -28
- package/build-module/tab-panels/init.mjs +7 -0
- package/build-module/tab-panels/init.mjs.map +7 -0
- package/build-module/table/edit.mjs +0 -2
- package/build-module/table/edit.mjs.map +2 -2
- package/build-module/table/index.mjs +1 -1
- package/build-module/table/index.mjs.map +2 -2
- package/build-module/tabs/block.json +3 -17
- package/build-module/tabs/edit.mjs +7 -21
- package/build-module/tabs/edit.mjs.map +2 -2
- package/build-module/tabs/index.mjs +6 -10
- package/build-module/tabs/index.mjs.map +2 -2
- package/build-module/tabs/use-tab-list-items-sync.mjs +32 -0
- package/build-module/tabs/use-tab-list-items-sync.mjs.map +7 -0
- package/build-module/tabs/view.mjs +22 -104
- package/build-module/tabs/view.mjs.map +2 -2
- package/build-module/template-part/edit/advanced-controls.mjs +0 -1
- package/build-module/template-part/edit/advanced-controls.mjs.map +2 -2
- package/build-module/template-part/edit/title-modal.mjs +1 -2
- package/build-module/template-part/edit/title-modal.mjs.map +2 -2
- package/build-module/terms-query/edit/inspector-controls/order-control.mjs +2 -2
- package/build-module/terms-query/edit/inspector-controls/order-control.mjs.map +2 -2
- package/build-module/utils/style-state.mjs +132 -0
- package/build-module/utils/style-state.mjs.map +7 -0
- package/build-module/utils/waveform-player.mjs +44 -11
- package/build-module/utils/waveform-player.mjs.map +2 -2
- package/build-module/utils/waveform-utils.mjs +6 -4
- package/build-module/utils/waveform-utils.mjs.map +2 -2
- package/build-module/verse/edit.mjs +1 -1
- package/build-module/verse/edit.mjs.map +2 -2
- package/build-module/video/edit-common-settings.mjs +4 -7
- package/build-module/video/edit-common-settings.mjs.map +2 -2
- package/build-module/video/edit.mjs +3 -3
- package/build-module/video/edit.mjs.map +2 -2
- package/build-module/video/tracks-editor.mjs +0 -2
- package/build-module/video/tracks-editor.mjs.map +2 -2
- package/build-style/comment-template/style-rtl.css +1 -0
- package/build-style/comment-template/style.css +1 -0
- package/build-style/common-rtl.css +30 -10
- package/build-style/common.css +30 -10
- package/build-style/cover/style-rtl.css +2 -1
- package/build-style/cover/style.css +2 -1
- package/build-style/editor-rtl.css +22 -30
- package/build-style/editor.css +22 -30
- package/build-style/form-input/style-rtl.css +2 -0
- package/build-style/form-input/style.css +2 -0
- package/build-style/gallery/style-rtl.css +4 -2
- package/build-style/gallery/style.css +4 -2
- package/build-style/icon/style-rtl.css +9 -0
- package/build-style/icon/style.css +9 -0
- package/build-style/media-text/style-rtl.css +2 -1
- package/build-style/media-text/style.css +2 -1
- package/build-style/playlist/style-rtl.css +3 -0
- package/build-style/playlist/style.css +3 -0
- package/build-style/query/editor-rtl.css +8 -4
- package/build-style/query/editor.css +8 -4
- package/build-style/read-more/style-rtl.css +1 -0
- package/build-style/read-more/style.css +1 -0
- package/build-style/reset-rtl.css +3 -1
- package/build-style/reset.css +3 -1
- package/build-style/search/style-rtl.css +3 -1
- package/build-style/search/style.css +3 -1
- package/build-style/site-logo/editor-rtl.css +2 -1
- package/build-style/site-logo/editor.css +2 -1
- package/build-style/style-rtl.css +64 -41
- package/build-style/style.css +64 -41
- package/build-style/{tab → tab-list}/style-rtl.css +5 -3
- package/build-style/{tab → tab-list}/style.css +5 -3
- package/build-style/tab-panel/style-rtl.css +0 -17
- package/build-style/tab-panel/style.css +0 -17
- package/build-style/template-part/editor-rtl.css +8 -4
- package/build-style/template-part/editor.css +8 -4
- package/build-style/video/style-rtl.css +2 -1
- package/build-style/video/style.css +2 -1
- package/package.json +55 -48
- package/src/accordion/README.md +97 -0
- package/src/accordion-heading/README.md +81 -0
- package/src/accordion-item/README.md +85 -0
- package/src/accordion-panel/README.md +74 -0
- package/src/archives/README.md +56 -0
- package/src/audio/README.md +55 -0
- package/src/audio/edit.js +5 -9
- package/src/avatar/README.md +74 -0
- package/src/avatar/index.php +2 -2
- package/src/block/README.md +56 -0
- package/src/block/index.php +2 -26
- package/src/breadcrumbs/README.md +67 -0
- package/src/breadcrumbs/edit.js +0 -1
- package/src/button/README.md +93 -0
- package/src/button/edit.js +0 -1
- package/src/buttons/README.md +80 -0
- package/src/calendar/README.md +51 -0
- package/src/categories/README.md +69 -0
- package/src/code/README.md +55 -0
- package/src/column/README.md +72 -0
- package/src/columns/README.md +90 -0
- package/src/columns/test/transforms.js +164 -0
- package/src/columns/transforms.js +74 -0
- package/src/comment-author-avatar/README.md +63 -0
- package/src/comment-author-avatar/index.php +3 -3
- package/src/comment-author-name/README.md +67 -0
- package/src/comment-author-name/index.php +1 -1
- package/src/comment-content/README.md +61 -0
- package/src/comment-date/README.md +67 -0
- package/src/comment-date/index.php +1 -1
- package/src/comment-edit-link/README.md +67 -0
- package/src/comment-reply-link/README.md +63 -0
- package/src/comment-template/README.md +60 -0
- package/src/comments/README.md +88 -0
- package/src/comments-pagination/README.md +77 -0
- package/src/comments-pagination-next/README.md +64 -0
- package/src/comments-pagination-numbers/README.md +64 -0
- package/src/comments-pagination-previous/README.md +64 -0
- package/src/comments-title/README.md +70 -0
- package/src/common.scss +63 -10
- package/src/cover/README.md +111 -0
- package/src/cover/edit/block-controls.js +14 -2
- package/src/cover/edit/embed-video-url-input.js +0 -1
- package/src/cover/edit/index.js +86 -0
- package/src/cover/edit/inspector-controls.js +124 -54
- package/src/cover/test/edit.js +51 -2
- package/src/details/README.md +65 -0
- package/src/details/edit.js +0 -1
- package/src/editor.scss +0 -2
- package/src/embed/README.md +56 -0
- package/src/file/README.md +60 -0
- package/src/file/edit.js +3 -16
- package/src/file/index.js +2 -0
- package/src/file/transforms.js +12 -31
- package/src/file/variations.js +17 -0
- package/src/footnotes/README.md +64 -0
- package/src/form/README.md +90 -0
- package/src/form/edit.js +0 -2
- package/src/form-input/README.md +74 -0
- package/src/form-input/edit.js +0 -2
- package/src/form-submission-notification/README.md +50 -0
- package/src/form-submit-button/README.md +54 -0
- package/src/freeform/README.md +49 -0
- package/src/freeform/edit.js +6 -29
- package/src/freeform/migration-notice.js +2 -4
- package/src/gallery/README.md +115 -0
- package/src/gallery/edit.js +214 -351
- package/src/gallery/test/transforms.js +155 -0
- package/src/gallery/transforms.js +47 -0
- package/src/group/README.md +80 -0
- package/src/heading/README.md +60 -0
- package/src/heading/edit.js +1 -2
- package/src/home-link/README.md +66 -0
- package/src/home-link/edit.js +0 -1
- package/src/home-link/index.php +3 -15
- package/src/html/README.md +48 -0
- package/src/html/modal.js +3 -0
- package/src/icon/README.md +66 -0
- package/src/icon/block.json +12 -0
- package/src/icon/edit.js +85 -37
- package/src/icon/index.js +3 -1
- package/src/icon/index.php +23 -0
- package/src/icon/style.scss +12 -0
- package/src/icon/variations.js +9 -0
- package/src/image/README.md +103 -0
- package/src/image/block.json +1 -0
- package/src/image/edit.js +8 -3
- package/src/image/image.js +120 -56
- package/src/image/index.php +4 -5
- package/src/image/test/use-open-image-media-editor-modal.js +20 -26
- package/src/image/transforms.js +34 -8
- package/src/image/use-open-image-media-editor-modal.js +24 -42
- package/src/index.js +4 -11
- package/src/latest-comments/README.md +57 -0
- package/src/latest-posts/README.md +71 -0
- package/src/list/README.md +70 -0
- package/src/list/edit.js +2 -9
- package/src/list/ordered-list-settings.js +46 -93
- package/src/list-item/README.md +71 -0
- package/src/list-item/hooks/use-merge.js +53 -46
- package/src/loginout/README.md +56 -0
- package/src/math/README.md +50 -0
- package/src/media-text/README.md +92 -0
- package/src/missing/README.md +55 -0
- package/src/more/README.md +49 -0
- package/src/navigation/README.md +115 -0
- package/src/navigation/edit/index.js +35 -46
- package/src/navigation/edit/navigation-menu-name-control.js +0 -1
- package/src/navigation/index.php +58 -0
- package/src/navigation-link/README.md +93 -0
- package/src/navigation-link/block.json +1 -1
- package/src/navigation-link/edit.js +0 -1
- package/src/navigation-link/index.php +1 -15
- package/src/navigation-link/link-ui/page-creator.js +0 -1
- package/src/navigation-link/shared/controls.js +0 -2
- package/src/navigation-link/test/__snapshots__/hooks.js.snap +5 -0
- package/src/navigation-overlay-close/README.md +48 -0
- package/src/navigation-submenu/README.md +89 -0
- package/src/navigation-submenu/block.json +7 -0
- package/src/navigation-submenu/edit.js +1 -0
- package/src/navigation-submenu/index.php +1 -17
- package/src/nextpage/README.md +50 -0
- package/src/page-list/README.md +84 -0
- package/src/page-list/block.json +2 -5
- package/src/page-list/edit.js +0 -11
- package/src/page-list/index.php +4 -16
- package/src/page-list-item/README.md +77 -0
- package/src/paragraph/README.md +70 -0
- package/src/paragraph/deprecated.js +1 -0
- package/src/paragraph/edit.js +13 -1
- package/src/pattern/README.md +45 -0
- package/src/playlist/README.md +86 -0
- package/src/playlist/block.json +12 -0
- package/src/playlist/edit.js +27 -0
- package/src/playlist/index.php +10 -3
- package/src/playlist/save.js +9 -1
- package/src/playlist/style.scss +7 -0
- package/src/playlist/view.js +1 -0
- package/src/playlist-track/README.md +69 -0
- package/src/playlist-track/edit.js +0 -3
- package/src/post-author/README.md +78 -0
- package/src/post-author-biography/README.md +59 -0
- package/src/post-author-name/README.md +63 -0
- package/src/post-author-name/index.php +1 -1
- package/src/post-comment/README.md +61 -0
- package/src/post-comment/edit.js +0 -1
- package/src/post-comments-count/README.md +58 -0
- package/src/post-comments-form/README.md +59 -0
- package/src/post-comments-link/README.md +60 -0
- package/src/post-content/README.md +71 -0
- package/src/post-date/README.md +65 -0
- package/src/post-date/edit.js +2 -2
- package/src/post-date/index.php +1 -1
- package/src/post-excerpt/README.md +66 -0
- package/src/post-featured-image/README.md +86 -0
- package/src/post-featured-image/block.json +1 -0
- package/src/post-featured-image/dimension-controls.js +105 -184
- package/src/post-featured-image/edit.js +53 -22
- package/src/post-featured-image/index.php +25 -23
- package/src/post-navigation-link/README.md +63 -0
- package/src/post-template/README.md +71 -0
- package/src/post-terms/README.md +65 -0
- package/src/post-terms/edit.js +0 -1
- package/src/post-time-to-read/README.md +63 -0
- package/src/post-time-to-read/index.js +1 -1
- package/src/post-time-to-read/variations.js +2 -2
- package/src/post-title/README.md +69 -0
- package/src/post-title/edit.js +0 -1
- package/src/preformatted/README.md +50 -0
- package/src/pullquote/README.md +64 -0
- package/src/pullquote/block.json +1 -3
- package/src/pullquote/deprecated.js +121 -9
- package/src/pullquote/edit.js +8 -38
- package/src/pullquote/save.js +2 -13
- package/src/query/README.md +64 -0
- package/src/query/edit/enhanced-pagination-modal.js +11 -1
- package/src/query/edit/inspector-controls/index.js +0 -1
- package/src/query-no-results/README.md +65 -0
- package/src/query-pagination/README.md +79 -0
- package/src/query-pagination-next/README.md +67 -0
- package/src/query-pagination-numbers/README.md +65 -0
- package/src/query-pagination-previous/README.md +67 -0
- package/src/query-title/README.md +65 -0
- package/src/query-total/README.md +66 -0
- package/src/quote/README.md +75 -0
- package/src/quote/edit.js +3 -9
- package/src/read-more/README.md +61 -0
- package/src/read-more/index.php +2 -2
- package/src/rss/README.md +62 -0
- package/src/rss/edit.js +0 -1
- package/src/search/README.md +67 -0
- package/src/search/block.json +4 -0
- package/src/search/edit.js +106 -55
- package/src/search/index.php +25 -1
- package/src/separator/README.md +62 -0
- package/src/shortcode/README.md +44 -0
- package/src/shortcode/transforms.js +2 -2
- package/src/site-logo/README.md +72 -0
- package/src/site-logo/edit.js +3 -1
- package/src/site-tagline/README.md +56 -0
- package/src/site-title/README.md +57 -0
- package/src/social-link/README.md +64 -0
- package/src/social-link/edit.js +0 -3
- package/src/social-links/README.md +98 -0
- package/src/spacer/README.md +53 -0
- package/src/style.scss +1 -2
- package/src/tab-list/README.md +81 -0
- package/src/tab-list/block.json +33 -20
- package/src/tab-list/edit.js +153 -15
- package/src/tab-list/index.php +24 -33
- package/src/tab-list/init.js +6 -0
- package/src/tab-list/save.js +39 -4
- package/src/{tab → tab-list}/style.scss +2 -3
- package/src/tab-panel/README.md +72 -0
- package/src/tab-panel/add-tab-toolbar-control.js +24 -11
- package/src/tab-panel/block.json +2 -6
- package/src/tab-panel/edit.js +1 -14
- package/src/tab-panel/index.php +2 -25
- package/src/tab-panel/remove-tab-toolbar-control.js +10 -14
- package/src/tab-panel/save.js +1 -0
- package/src/tab-panel/style.scss +0 -17
- package/src/tab-panels/README.md +59 -0
- package/src/tab-panels/block.json +2 -28
- package/src/tab-panels/init.js +6 -0
- package/src/table/README.md +71 -0
- package/src/table/edit.js +0 -2
- package/src/table-of-contents/README.md +61 -0
- package/src/tabs/README.md +77 -0
- package/src/tabs/block.json +3 -17
- package/src/tabs/edit.js +8 -19
- package/src/tabs/index.js +6 -10
- package/src/tabs/index.php +12 -32
- package/src/tabs/use-tab-list-items-sync.js +49 -0
- package/src/tabs/view.js +22 -110
- package/src/tag-cloud/README.md +62 -0
- package/src/template-part/README.md +48 -0
- package/src/template-part/edit/advanced-controls.js +0 -1
- package/src/template-part/edit/title-modal.js +0 -1
- package/src/term-count/README.md +59 -0
- package/src/term-description/README.md +60 -0
- package/src/term-name/README.md +65 -0
- package/src/term-template/README.md +65 -0
- package/src/terms-query/README.md +58 -0
- package/src/text-columns/README.md +51 -0
- package/src/utils/style-state.js +151 -0
- package/src/utils/test/style-state.js +307 -0
- package/src/utils/test/waveform-player.js +254 -0
- package/src/utils/waveform-player.js +90 -18
- package/src/utils/waveform-utils.js +15 -11
- package/src/verse/README.md +58 -0
- package/src/video/README.md +58 -0
- package/src/video/edit-common-settings.js +4 -7
- package/src/video/edit.js +9 -16
- package/src/video/tracks-editor.js +0 -2
- package/babel-plugin.cjs +0 -150
- package/build/freeform/convert-to-blocks-button.cjs.map +0 -7
- package/build/list-item/utils.cjs +0 -57
- package/build/list-item/utils.cjs.map +0 -7
- package/build/tab/block.json +0 -56
- package/build/tab/controls.cjs +0 -46
- package/build/tab/controls.cjs.map +0 -7
- package/build/tab/edit.cjs +0 -135
- package/build/tab/edit.cjs.map +0 -7
- package/build/tab/index.cjs +0 -58
- package/build/tab/index.cjs.map +0 -7
- package/build/tab/save.cjs.map +0 -7
- package/build/tabs/use-tab-list-sync.cjs +0 -190
- package/build/tabs/use-tab-list-sync.cjs.map +0 -7
- package/build-module/freeform/convert-to-blocks-button.mjs +0 -19
- package/build-module/freeform/convert-to-blocks-button.mjs.map +0 -7
- package/build-module/list-item/utils.mjs +0 -32
- package/build-module/list-item/utils.mjs.map +0 -7
- package/build-module/tab/block.json +0 -56
- package/build-module/tab/controls.mjs +0 -15
- package/build-module/tab/controls.mjs.map +0 -7
- package/build-module/tab/edit.mjs +0 -108
- package/build-module/tab/edit.mjs.map +0 -7
- package/build-module/tab/index.mjs +0 -20
- package/build-module/tab/index.mjs.map +0 -7
- package/build-module/tab/save.mjs +0 -14
- package/build-module/tab/save.mjs.map +0 -7
- package/build-module/tabs/use-tab-list-sync.mjs +0 -169
- package/build-module/tabs/use-tab-list-sync.mjs.map +0 -7
- package/build-style/tab/editor-rtl.css +0 -11
- package/build-style/tab/editor.css +0 -11
- package/build-style/tab-list/editor-rtl.css +0 -6
- package/build-style/tab-list/editor.css +0 -6
- package/build-style/tab-panels/style-rtl.css +0 -4
- package/build-style/tab-panels/style.css +0 -4
- package/src/audio/edit.native.js +0 -250
- package/src/audio/style.native.scss +0 -13
- package/src/audio/test/__snapshots__/edit.native.js.snap +0 -546
- package/src/audio/test/__snapshots__/transforms.native.js.snap +0 -25
- package/src/audio/test/edit.native.js +0 -132
- package/src/audio/test/transforms.native.js +0 -43
- package/src/audio/transforms.native.js +0 -12
- package/src/block/edit-title.native.js +0 -67
- package/src/block/edit.native.js +0 -247
- package/src/block/editor.native.scss +0 -125
- package/src/block/test/__snapshots__/transforms.native.js.snap +0 -15
- package/src/block/test/edit.native.js +0 -262
- package/src/block/test/transforms.native.js +0 -40
- package/src/button/color-background.native.js +0 -41
- package/src/button/edit.native.js +0 -567
- package/src/button/editor.native.scss +0 -70
- package/src/button/rich-text.android.scss +0 -6
- package/src/button/rich-text.ios.scss +0 -6
- package/src/buttons/edit.native.js +0 -157
- package/src/buttons/editor.native.scss +0 -11
- package/src/buttons/test/__snapshots__/edit.native.js.snap +0 -99
- package/src/buttons/test/__snapshots__/transforms.native.js.snap +0 -31
- package/src/buttons/test/edit.native.js +0 -485
- package/src/buttons/test/transforms.native.js +0 -48
- package/src/buttons/transforms.native.js +0 -12
- package/src/code/edit.native.js +0 -70
- package/src/code/test/__snapshots__/edit.native.js.snap +0 -13
- package/src/code/test/edit.native.js +0 -65
- package/src/code/theme.native.scss +0 -22
- package/src/code/transforms.native.js +0 -12
- package/src/column/column-preview.native.js +0 -58
- package/src/column/edit.native.js +0 -273
- package/src/column/editor.native.scss +0 -75
- package/src/columns/columnCalculations.native.js +0 -178
- package/src/columns/edit.native.js +0 -507
- package/src/columns/editor.native.scss +0 -17
- package/src/columns/test/__snapshots__/edit.native.js.snap +0 -305
- package/src/columns/test/__snapshots__/transforms.native.js.snap +0 -61
- package/src/columns/test/edit.native.js +0 -496
- package/src/columns/test/transforms.native.js +0 -89
- package/src/columns/transforms.native.js +0 -12
- package/src/cover/controls.native.js +0 -307
- package/src/cover/edit.native.js +0 -708
- package/src/cover/focal-point-settings-button.native.js +0 -53
- package/src/cover/overlay-color-settings.native.js +0 -106
- package/src/cover/style.native.scss +0 -220
- package/src/cover/test/__snapshots__/edit.native.js.snap +0 -105
- package/src/cover/test/__snapshots__/transforms.native.js.snap +0 -73
- package/src/cover/test/edit.native.js +0 -701
- package/src/cover/test/transforms.native.js +0 -116
- package/src/cover/transforms.native.js +0 -12
- package/src/cover/use-cover-is-dark.native.js +0 -51
- package/src/embed/edit.native.js +0 -345
- package/src/embed/embed-controls.native.js +0 -65
- package/src/embed/embed-link-settings.native.js +0 -99
- package/src/embed/embed-loading.native.js +0 -29
- package/src/embed/embed-no-preview.native.js +0 -230
- package/src/embed/embed-placeholder.native.js +0 -178
- package/src/embed/embed-preview.native.js +0 -157
- package/src/embed/styles.native.scss +0 -196
- package/src/embed/test/__snapshots__/index.native.js.snap +0 -191
- package/src/embed/test/__snapshots__/transforms.native.js.snap +0 -23
- package/src/embed/test/index.native.js +0 -1125
- package/src/embed/test/transforms.native.js +0 -44
- package/src/embed/transforms.native.js +0 -12
- package/src/embed/wp-embed-preview.native.js +0 -80
- package/src/file/edit.native.js +0 -605
- package/src/file/style.native.scss +0 -79
- package/src/file/test/__snapshots__/edit.native.js.snap +0 -580
- package/src/file/test/__snapshots__/transforms.native.js.snap +0 -19
- package/src/file/test/edit.native.js +0 -93
- package/src/file/test/transforms.native.js +0 -43
- package/src/file/transforms.native.js +0 -12
- package/src/freeform/convert-to-blocks-button.js +0 -18
- package/src/freeform/edit.native.js +0 -13
- package/src/freeform/test/__snapshots__/index.native.js.snap +0 -7
- package/src/freeform/test/__snapshots__/transforms.native.js.snap +0 -19
- package/src/freeform/test/index.native.js +0 -57
- package/src/freeform/test/transforms.native.js +0 -39
- package/src/gallery/gallery-styles.native.scss +0 -8
- package/src/gallery/gallery.native.js +0 -124
- package/src/gallery/styles.native.scss +0 -7
- package/src/gallery/test/__snapshots__/index.native.js.snap +0 -177
- package/src/gallery/test/__snapshots__/transforms.native.js.snap +0 -53
- package/src/gallery/test/helpers.native.js +0 -106
- package/src/gallery/test/index.native.js +0 -700
- package/src/gallery/test/transforms.native.js +0 -53
- package/src/gallery/test/use-get-media.native.js +0 -24
- package/src/gallery/transforms.native.js +0 -12
- package/src/gallery/use-get-media.native.js +0 -49
- package/src/group/edit.native.js +0 -137
- package/src/group/editor.native.scss +0 -56
- package/src/group/test/__snapshots__/edit.native.js.snap +0 -19
- package/src/group/test/__snapshots__/transforms.native.js.snap +0 -35
- package/src/group/test/edit.native.js +0 -100
- package/src/group/test/transforms.native.js +0 -73
- package/src/heading/edit.native.js +0 -159
- package/src/heading/test/__snapshots__/index.native.js.snap +0 -43
- package/src/heading/test/__snapshots__/transforms.native.js.snap +0 -47
- package/src/heading/test/index.native.js +0 -257
- package/src/heading/test/transforms.native.js +0 -46
- package/src/heading/transforms.native.js +0 -12
- package/src/html/transforms.native.js +0 -11
- package/src/image/edit.native.js +0 -959
- package/src/image/styles.native.scss +0 -70
- package/src/image/test/__snapshots__/transforms.native.js.snap +0 -49
- package/src/image/test/edit.native.js +0 -459
- package/src/image/test/transforms.native.js +0 -49
- package/src/image/transforms.native.js +0 -12
- package/src/index.native.js +0 -274
- package/src/latest-posts/edit.native.js +0 -294
- package/src/latest-posts/style.native.scss +0 -47
- package/src/latest-posts/test/__snapshots__/edit.native.js.snap +0 -3
- package/src/latest-posts/test/__snapshots__/transforms.native.js.snap +0 -15
- package/src/latest-posts/test/edit.native.js +0 -49
- package/src/latest-posts/test/transforms.native.js +0 -61
- package/src/list/tag-name.native.js +0 -12
- package/src/list/test/__snapshots__/edit.native.js.snap +0 -121
- package/src/list/test/__snapshots__/transforms.native.js.snap +0 -85
- package/src/list/test/edit.native.js +0 -602
- package/src/list/test/transforms.native.js +0 -56
- package/src/list/transforms.native.js +0 -12
- package/src/list-item/edit.native.js +0 -175
- package/src/list-item/hooks/use-enter.native.js +0 -81
- package/src/list-item/icons.native.js +0 -34
- package/src/list-item/list-style-type.native.js +0 -146
- package/src/list-item/style.native.scss +0 -57
- package/src/list-item/utils.js +0 -34
- package/src/media-text/edit.native.js +0 -417
- package/src/media-text/icon-retry.native.js +0 -11
- package/src/media-text/media-container.native.js +0 -393
- package/src/media-text/style.native.scss +0 -191
- package/src/media-text/test/__snapshots__/transforms.native.js.snap +0 -73
- package/src/media-text/test/edit.native.js +0 -58
- package/src/media-text/test/transforms.native.js +0 -116
- package/src/media-text/transforms.native.js +0 -12
- package/src/missing/edit.native.js +0 -294
- package/src/missing/style.native.scss +0 -79
- package/src/missing/test/__snapshots__/edit.native.js.snap +0 -110
- package/src/missing/test/edit-integration.native.js +0 -168
- package/src/missing/test/edit.native.js +0 -81
- package/src/more/edit.native.js +0 -36
- package/src/more/editor.native.scss +0 -21
- package/src/more/test/__snapshots__/edit.native.js.snap +0 -7
- package/src/more/test/__snapshots__/transforms.native.js.snap +0 -19
- package/src/more/test/edit.native.js +0 -41
- package/src/more/test/transforms.native.js +0 -42
- package/src/more/transforms.native.js +0 -12
- package/src/navigation-link/shared/build-css-font-sizes.php +0 -43
- package/src/nextpage/edit.native.js +0 -58
- package/src/nextpage/editor.native.scss +0 -21
- package/src/nextpage/test/__snapshots__/transforms.native.js.snap +0 -19
- package/src/nextpage/test/transforms.native.js +0 -42
- package/src/nextpage/transforms.native.js +0 -12
- package/src/paragraph/edit.native.js +0 -116
- package/src/paragraph/test/__snapshots__/edit.native.js.snap +0 -88
- package/src/paragraph/test/__snapshots__/transforms.native.js.snap +0 -65
- package/src/paragraph/test/edit.native.js +0 -999
- package/src/paragraph/test/transforms.native.js +0 -51
- package/src/paragraph/transforms.native.js +0 -12
- package/src/preformatted/edit.native.js +0 -48
- package/src/preformatted/styles.native.scss +0 -30
- package/src/preformatted/test/__snapshots__/edit.native.js.snap +0 -95
- package/src/preformatted/test/__snapshots__/transforms.native.js.snap +0 -37
- package/src/preformatted/test/edit.native.js +0 -111
- package/src/preformatted/test/transforms.native.js +0 -47
- package/src/preformatted/transforms.native.js +0 -12
- package/src/pullquote/blockquote.native.js +0 -39
- package/src/pullquote/blockquote.native.scss +0 -8
- package/src/pullquote/edit.native.js +0 -128
- package/src/pullquote/figure.native.js +0 -33
- package/src/pullquote/figure.native.scss +0 -16
- package/src/pullquote/test/__snapshots__/transforms.native.js.snap +0 -47
- package/src/pullquote/test/edit.native.js +0 -73
- package/src/pullquote/test/transforms.native.js +0 -46
- package/src/pullquote/transforms.native.js +0 -12
- package/src/quote/test/__snapshots__/transforms.native.js.snap +0 -49
- package/src/quote/test/edit.native.js +0 -94
- package/src/quote/test/transforms.native.js +0 -69
- package/src/quote/transforms.native.js +0 -12
- package/src/search/edit.native.js +0 -486
- package/src/search/style.native.scss +0 -99
- package/src/search/test/__snapshots__/edit.native.js.snap +0 -827
- package/src/search/test/__snapshots__/transforms.native.js.snap +0 -15
- package/src/search/test/edit.native.js +0 -170
- package/src/search/test/transforms.native.js +0 -40
- package/src/separator/separator-settings.native.js +0 -3
- package/src/separator/test/__snapshots__/edit.native.js.snap +0 -7
- package/src/separator/test/__snapshots__/transforms.native.js.snap +0 -25
- package/src/separator/test/edit.native.js +0 -41
- package/src/separator/test/transforms.native.js +0 -42
- package/src/separator/transforms.native.js +0 -12
- package/src/shortcode/edit.native.js +0 -77
- package/src/shortcode/style.native.scss +0 -44
- package/src/shortcode/test/__snapshots__/edit.native.js.snap +0 -9
- package/src/shortcode/test/__snapshots__/transforms.native.js.snap +0 -19
- package/src/shortcode/test/edit.native.js +0 -70
- package/src/shortcode/test/transforms.native.js +0 -42
- package/src/shortcode/transforms.native.js +0 -12
- package/src/social-link/edit.native.js +0 -219
- package/src/social-link/editor.native.scss +0 -18
- package/src/social-links/edit.native.js +0 -147
- package/src/social-links/editor.native.scss +0 -25
- package/src/social-links/test/__snapshots__/edit.native.js.snap +0 -57
- package/src/social-links/test/__snapshots__/transforms.native.js.snap +0 -31
- package/src/social-links/test/edit.native.js +0 -266
- package/src/social-links/test/transforms.native.js +0 -53
- package/src/spacer/controls.native.js +0 -86
- package/src/spacer/edit.native.js +0 -110
- package/src/spacer/editor.native.scss +0 -18
- package/src/spacer/save.native.js +0 -18
- package/src/spacer/test/__snapshots__/index.native.js.snap +0 -43
- package/src/spacer/test/__snapshots__/transforms.native.js.snap +0 -25
- package/src/spacer/test/index.native.js +0 -257
- package/src/spacer/test/transforms.native.js +0 -42
- package/src/tab/block.json +0 -56
- package/src/tab/controls.js +0 -19
- package/src/tab/edit.js +0 -141
- package/src/tab/editor.scss +0 -14
- package/src/tab/index.js +0 -24
- package/src/tab/index.php +0 -70
- package/src/tab/save.js +0 -13
- package/src/tab-list/editor.scss +0 -10
- package/src/tab-panels/style.scss +0 -4
- package/src/table/transforms.native.js +0 -11
- package/src/tabs/use-tab-list-sync.js +0 -237
- package/src/text-columns/transforms.native.js +0 -12
- package/src/utils/init-block.native.js +0 -40
- package/src/utils/transformation-categories.native.js +0 -47
- package/src/verse/test/__snapshots__/edit.native.js.snap +0 -13
- package/src/verse/test/__snapshots__/transforms.native.js.snap +0 -31
- package/src/verse/test/edit.native.js +0 -118
- package/src/verse/test/transforms.native.js +0 -46
- package/src/verse/transforms.native.js +0 -12
- package/src/video/edit.native.js +0 -406
- package/src/video/icon-retry.native.js +0 -11
- package/src/video/style.native.scss +0 -81
- package/src/video/test/__snapshots__/transforms.native.js.snap +0 -41
- package/src/video/test/edit.native.js +0 -53
- package/src/video/test/transforms.native.js +0 -49
- package/src/video/transforms.native.js +0 -12
|
@@ -48,9 +48,13 @@ var import_overlay_controls = __toESM(require("./overlay-controls.cjs"));
|
|
|
48
48
|
var import_overlay = __toESM(require("./overlay.cjs"));
|
|
49
49
|
var import_hooks = require("../utils/hooks.cjs");
|
|
50
50
|
var import_lock_unlock = require("../lock-unlock.cjs");
|
|
51
|
+
var import_style_state = require("../utils/style-state.cjs");
|
|
51
52
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
52
53
|
var ALLOWED_MEDIA_TYPES = ["image"];
|
|
53
|
-
var { ResolutionTool } = (0, import_lock_unlock.unlock)(
|
|
54
|
+
var { isDefaultBlockStyleState, ResolutionTool } = (0, import_lock_unlock.unlock)(
|
|
55
|
+
import_block_editor.privateApis
|
|
56
|
+
);
|
|
57
|
+
var hasDimensionValue = (value) => value !== void 0 && value !== null && value !== "";
|
|
54
58
|
var DEFAULT_MEDIA_SIZE_SLUG = "full";
|
|
55
59
|
function FeaturedImageResolutionTool({ image, value, onChange }) {
|
|
56
60
|
const { imageSizes } = (0, import_data.useSelect)((select) => {
|
|
@@ -119,10 +123,12 @@ function PostFeaturedImageEdit({
|
|
|
119
123
|
const imageId = imageOpener?.groups?.attrs && JSON.parse(imageOpener.groups.attrs)?.id;
|
|
120
124
|
return imageId;
|
|
121
125
|
}, [storedFeaturedImage, useFirstImageFromPost, postContent]);
|
|
122
|
-
const { media, postType, postPermalink,
|
|
126
|
+
const { media, postType, postPermalink, selectedStyleState } = (0, import_data.useSelect)(
|
|
123
127
|
(select) => {
|
|
124
128
|
const { getEntityRecord, getPostType, getEditedEntityRecord } = select(import_core_data.store);
|
|
125
|
-
const {
|
|
129
|
+
const { getSelectedBlockStyleState } = (0, import_lock_unlock.unlock)(
|
|
130
|
+
select(import_block_editor.store)
|
|
131
|
+
);
|
|
126
132
|
return {
|
|
127
133
|
media: featuredImage && getEntityRecord("postType", "attachment", featuredImage, {
|
|
128
134
|
context: "view"
|
|
@@ -133,14 +139,14 @@ function PostFeaturedImageEdit({
|
|
|
133
139
|
postTypeSlug,
|
|
134
140
|
postId
|
|
135
141
|
)?.link,
|
|
136
|
-
|
|
142
|
+
selectedStyleState: getSelectedBlockStyleState(clientId)
|
|
137
143
|
};
|
|
138
144
|
},
|
|
139
145
|
[clientId, featuredImage, postTypeSlug, postId]
|
|
140
146
|
);
|
|
147
|
+
const hasSelectedStyleState = !isDefaultBlockStyleState(selectedStyleState);
|
|
141
148
|
const mediaUrl = media?.media_details?.sizes?.[sizeSlug]?.source_url || media?.source_url;
|
|
142
149
|
const blockProps = (0, import_block_editor.useBlockProps)({
|
|
143
|
-
style: { width, height, aspectRatio },
|
|
144
150
|
className: (0, import_clsx.default)({
|
|
145
151
|
"is-transient": temporaryURL
|
|
146
152
|
})
|
|
@@ -158,8 +164,9 @@ function PostFeaturedImageEdit({
|
|
|
158
164
|
),
|
|
159
165
|
withIllustration: true,
|
|
160
166
|
style: {
|
|
161
|
-
|
|
162
|
-
|
|
167
|
+
aspectRatio,
|
|
168
|
+
height: hasDimensionValue(height) ? height : hasDimensionValue(width) && "auto",
|
|
169
|
+
width: hasDimensionValue(width) ? width : !!aspectRatio && "100%",
|
|
163
170
|
...borderProps.style,
|
|
164
171
|
...shadowProps.style
|
|
165
172
|
},
|
|
@@ -204,15 +211,37 @@ function PostFeaturedImageEdit({
|
|
|
204
211
|
clientId
|
|
205
212
|
}
|
|
206
213
|
) }),
|
|
207
|
-
|
|
208
|
-
|
|
214
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
215
|
+
import_block_editor.InspectorControls,
|
|
209
216
|
{
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
217
|
+
group: "dimensions",
|
|
218
|
+
resetAllFilter: (attrs) => {
|
|
219
|
+
return (0, import_style_state.getDimensionResetAttributes)({
|
|
220
|
+
attributes: attrs,
|
|
221
|
+
selectedState: selectedStyleState,
|
|
222
|
+
hasSelectedStyleState,
|
|
223
|
+
keys: ["aspectRatio", "height", "objectFit", "width"],
|
|
224
|
+
defaultAttributes: {
|
|
225
|
+
aspectRatio: void 0,
|
|
226
|
+
height: void 0,
|
|
227
|
+
scale: void 0,
|
|
228
|
+
width: void 0
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
},
|
|
232
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
233
|
+
import_dimension_controls.default,
|
|
234
|
+
{
|
|
235
|
+
clientId,
|
|
236
|
+
attributes,
|
|
237
|
+
setAttributes,
|
|
238
|
+
media,
|
|
239
|
+
selectedStyleState,
|
|
240
|
+
hasSelectedStyleState
|
|
241
|
+
}
|
|
242
|
+
)
|
|
214
243
|
}
|
|
215
|
-
)
|
|
244
|
+
),
|
|
216
245
|
(featuredImage || isDescendentOfQueryLoop || !postId) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.InspectorControls, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
217
246
|
import_components.__experimentalToolsPanel,
|
|
218
247
|
{
|
|
@@ -230,7 +259,7 @@ function PostFeaturedImageEdit({
|
|
|
230
259
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
231
260
|
import_components.__experimentalToolsPanelItem,
|
|
232
261
|
{
|
|
233
|
-
label: postType?.labels
|
|
262
|
+
label: postType?.labels?.singular_name ? (0, import_i18n.sprintf)(
|
|
234
263
|
// translators: %s: Name of the post type e.g: "post".
|
|
235
264
|
(0, import_i18n.__)("Link to %s"),
|
|
236
265
|
postType.labels.singular_name
|
|
@@ -283,7 +312,6 @@ function PostFeaturedImageEdit({
|
|
|
283
312
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
284
313
|
import_components.TextControl,
|
|
285
314
|
{
|
|
286
|
-
__next40pxDefaultSize: true,
|
|
287
315
|
label: (0, import_i18n.__)("Link relation"),
|
|
288
316
|
help: (0, import_element.createInterpolateElement)(
|
|
289
317
|
(0, import_i18n.__)(
|
|
@@ -332,8 +360,9 @@ function PostFeaturedImageEdit({
|
|
|
332
360
|
const imageStyles = {
|
|
333
361
|
...borderProps.style,
|
|
334
362
|
...shadowProps.style,
|
|
335
|
-
|
|
336
|
-
|
|
363
|
+
aspectRatio,
|
|
364
|
+
height: hasDimensionValue(height) ? height : hasDimensionValue(width) && "auto",
|
|
365
|
+
width: hasDimensionValue(width) ? width : !!aspectRatio && "100%",
|
|
337
366
|
objectFit: !!(height || aspectRatio) && scale
|
|
338
367
|
};
|
|
339
368
|
if (!featuredImage && !temporaryURL) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/post-featured-image/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { isBlobURL } from '@wordpress/blob';\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tToggleControl,\n\tPlaceholder,\n\tButton,\n\tSpinner,\n\tTextControl,\n\tExternalLink,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport {\n\tInspectorControls,\n\tBlockControls,\n\tMediaPlaceholder,\n\tMediaReplaceFlow,\n\tuseBlockProps,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalGetShadowClassesAndStyles as getShadowClassesAndStyles,\n\tuseBlockEditingMode,\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tuseMemo,\n\tuseEffect,\n\tuseState,\n\tcreateInterpolateElement,\n} from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { upload } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport DimensionControls from './dimension-controls';\nimport OverlayControls from './overlay-controls';\nimport Overlay from './overlay';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\nimport { unlock } from '../lock-unlock';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\nconst { ResolutionTool } = unlock( blockEditorPrivateApis );\nconst DEFAULT_MEDIA_SIZE_SLUG = 'full';\n\nfunction FeaturedImageResolutionTool( { image, value, onChange } ) {\n\tconst { imageSizes } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn {\n\t\t\timageSizes: getSettings().imageSizes,\n\t\t};\n\t}, [] );\n\n\tif ( ! imageSizes?.length ) {\n\t\treturn null;\n\t}\n\n\tconst imageSizeOptions = imageSizes\n\t\t.filter(\n\t\t\t( { slug } ) => image?.media_details?.sizes?.[ slug ]?.source_url\n\t\t)\n\t\t.map( ( { name, slug } ) => ( { value: slug, label: name } ) );\n\n\treturn (\n\t\t<ResolutionTool\n\t\t\tvalue={ value }\n\t\t\tdefaultValue={ DEFAULT_MEDIA_SIZE_SLUG }\n\t\t\toptions={ imageSizeOptions }\n\t\t\tonChange={ onChange }\n\t\t/>\n\t);\n}\n\nexport default function PostFeaturedImageEdit( {\n\tclientId,\n\tattributes,\n\tsetAttributes,\n\tcontext: { postId, postType: postTypeSlug, queryId },\n} ) {\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst {\n\t\tisLink,\n\t\taspectRatio,\n\t\theight,\n\t\twidth,\n\t\tscale,\n\t\tsizeSlug,\n\t\trel,\n\t\tlinkTarget,\n\t\tuseFirstImageFromPost,\n\t} = attributes;\n\tconst [ temporaryURL, setTemporaryURL ] = useState();\n\n\tconst [ storedFeaturedImage, setFeaturedImage ] = useEntityProp(\n\t\t'postType',\n\t\tpostTypeSlug,\n\t\t'featured_media',\n\t\tpostId\n\t);\n\n\t// Fallback to post content if no featured image is set.\n\t// This is needed for the \"Use first image from post\" option.\n\tconst [ postContent ] = useEntityProp(\n\t\t'postType',\n\t\tpostTypeSlug,\n\t\t'content',\n\t\tpostId\n\t);\n\n\tconst featuredImage = useMemo( () => {\n\t\tif ( storedFeaturedImage ) {\n\t\t\treturn storedFeaturedImage;\n\t\t}\n\n\t\tif ( ! useFirstImageFromPost ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst imageOpener =\n\t\t\t/<!--\\s+wp:(?:core\\/)?image\\s+(?<attrs>{(?:(?:[^}]+|}+(?=})|(?!}\\s+\\/?-->).)*)?}\\s+)?-->/.exec(\n\t\t\t\tpostContent\n\t\t\t);\n\t\tconst imageId =\n\t\t\timageOpener?.groups?.attrs &&\n\t\t\tJSON.parse( imageOpener.groups.attrs )?.id;\n\t\treturn imageId;\n\t}, [ storedFeaturedImage, useFirstImageFromPost, postContent ] );\n\n\tconst { media, postType, postPermalink, hasSelectedStyleState } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, getPostType, getEditedEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { hasSelectedStyleState: hasSelectedBlockStyleState } =\n\t\t\t\tunlock( select( blockEditorStore ) );\n\t\t\treturn {\n\t\t\t\tmedia:\n\t\t\t\t\tfeaturedImage &&\n\t\t\t\t\tgetEntityRecord( 'postType', 'attachment', featuredImage, {\n\t\t\t\t\t\tcontext: 'view',\n\t\t\t\t\t} ),\n\t\t\t\tpostType: postTypeSlug && getPostType( postTypeSlug ),\n\t\t\t\tpostPermalink: getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostTypeSlug,\n\t\t\t\t\tpostId\n\t\t\t\t)?.link,\n\t\t\t\thasSelectedStyleState: hasSelectedBlockStyleState( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId, featuredImage, postTypeSlug, postId ]\n\t);\n\n\tconst mediaUrl =\n\t\tmedia?.media_details?.sizes?.[ sizeSlug ]?.source_url ||\n\t\tmedia?.source_url;\n\n\tconst blockProps = useBlockProps( {\n\t\tstyle: { width, height, aspectRatio },\n\t\tclassName: clsx( {\n\t\t\t'is-transient': temporaryURL,\n\t\t} ),\n\t} );\n\tconst borderProps = useBorderProps( attributes );\n\tconst shadowProps = getShadowClassesAndStyles( attributes );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst placeholder = ( content ) => {\n\t\treturn (\n\t\t\t<Placeholder\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'block-editor-media-placeholder',\n\t\t\t\t\tborderProps.className\n\t\t\t\t) }\n\t\t\t\twithIllustration\n\t\t\t\tstyle={ {\n\t\t\t\t\theight: !! aspectRatio && '100%',\n\t\t\t\t\twidth: !! aspectRatio && '100%',\n\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t...shadowProps.style,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ content }\n\t\t\t</Placeholder>\n\t\t);\n\t};\n\n\tconst onSelectImage = ( value ) => {\n\t\tif ( value?.id ) {\n\t\t\tsetFeaturedImage( value.id );\n\t\t}\n\n\t\tif ( value?.url && isBlobURL( value.url ) ) {\n\t\t\tsetTemporaryURL( value.url );\n\t\t}\n\t};\n\n\t// On reset image\n\tconst onResetImage = () => {\n\t\tsetAttributes( {\n\t\t\tisLink: false,\n\t\t\tlinkTarget: '_self',\n\t\t\trel: '',\n\t\t\tsizeSlug: undefined,\n\t\t} );\n\t\tsetFeaturedImage( 0 );\n\t};\n\n\t// Reset temporary url when media is available.\n\tuseEffect( () => {\n\t\tif ( mediaUrl && temporaryURL ) {\n\t\t\tsetTemporaryURL();\n\t\t}\n\t}, [ mediaUrl, temporaryURL ] );\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t\tsetTemporaryURL();\n\t};\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst controls = blockEditingMode === 'default' && (\n\t\t<>\n\t\t\t<InspectorControls group=\"color\">\n\t\t\t\t<OverlayControls\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t{ ! hasSelectedStyleState && (\n\t\t\t\t<InspectorControls group=\"dimensions\">\n\t\t\t\t\t<DimensionControls\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\tmedia={ media }\n\t\t\t\t\t/>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t{ ( featuredImage || isDescendentOfQueryLoop || ! postId ) && (\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<ToolsPanel\n\t\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tisLink: false,\n\t\t\t\t\t\t\t\tlinkTarget: '_self',\n\t\t\t\t\t\t\t\trel: '',\n\t\t\t\t\t\t\t\tsizeSlug: DEFAULT_MEDIA_SIZE_SLUG,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tpostType?.labels.singular_name\n\t\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"post\".\n\t\t\t\t\t\t\t\t\t\t\t__( 'Link to %s' ),\n\t\t\t\t\t\t\t\t\t\t\tpostType.labels.singular_name\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t: __( 'Link to post' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\thasValue={ () => !! isLink }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tisLink: false,\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\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Make image a link' ) }\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { isLink: ! isLink } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t\t{ isLink && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\thasValue={ () => '_self' !== linkTarget }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlinkTarget: '_self',\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\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\tlinkTarget: value\n\t\t\t\t\t\t\t\t\t\t\t\t? '_blank'\n\t\t\t\t\t\t\t\t\t\t\t\t: '_self',\n\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isLink && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Link relation' ) }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\thasValue={ () => !! rel }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\trel: '',\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\t\t<TextControl\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Link relation' ) }\n\t\t\t\t\t\t\t\t\thelp={ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t'The <a>Link Relation</a> attribute defines the relationship between a linked resource and the current document.'\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t\t\t\t<ExternalLink href=\"https://developer.mozilla.org/docs/Web/HTML/Attributes/rel\" />\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tvalue={ rel }\n\t\t\t\t\t\t\t\t\tonChange={ ( newRel ) =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( { rel: newRel } )\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</ToolsPanelItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ !! media && (\n\t\t\t\t\t\t\t<FeaturedImageResolutionTool\n\t\t\t\t\t\t\t\timage={ media }\n\t\t\t\t\t\t\t\tvalue={ sizeSlug }\n\t\t\t\t\t\t\t\tonChange={ ( nextSizeSlug ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { sizeSlug: nextSizeSlug } )\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</ToolsPanel>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t</>\n\t);\n\n\tlet image;\n\n\t/**\n\t * A Post Featured Image block should not have image replacement\n\t * or upload options in the following cases:\n\t * - Is placed in a Query Loop. This is a conscious decision to\n\t * prevent content editing of different posts in Query Loop, and\n\t * this could change in the future.\n\t * - Is in a context where it does not have a postId (for example\n\t * in a template or template part).\n\t */\n\tif ( ! featuredImage && ( isDescendentOfQueryLoop || ! postId ) ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ controls }\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t{ !! isLink ? (\n\t\t\t\t\t\t<a href={ postPermalink } target={ linkTarget }>\n\t\t\t\t\t\t\t{ placeholder() }\n\t\t\t\t\t\t</a>\n\t\t\t\t\t) : (\n\t\t\t\t\t\tplaceholder()\n\t\t\t\t\t) }\n\t\t\t\t\t<Overlay\n\t\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t}\n\n\tconst label = __( 'Add a featured image' );\n\tconst imageStyles = {\n\t\t...borderProps.style,\n\t\t...shadowProps.style,\n\t\theight: aspectRatio ? '100%' : height,\n\t\twidth: !! aspectRatio && '100%',\n\t\tobjectFit: !! ( height || aspectRatio ) && scale,\n\t};\n\n\t/**\n\t * When the post featured image block is placed in a context where:\n\t * - It has a postId (for example in a single post)\n\t * - It is not inside a query loop\n\t * - It has no image assigned yet\n\t * Then display the placeholder with the image upload option.\n\t */\n\tif ( ! featuredImage && ! temporaryURL ) {\n\t\timage = (\n\t\t\t<MediaPlaceholder\n\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\taccept=\"image/*\"\n\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\tonError={ onUploadError }\n\t\t\t\tplaceholder={ placeholder }\n\t\t\t\tmediaLibraryButton={ ( { open } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\ttooltipPosition=\"top center\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\topen();\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} }\n\t\t\t/>\n\t\t);\n\t} else {\n\t\t// We have a Featured image so show a Placeholder if is loading.\n\t\timage =\n\t\t\t! media && ! temporaryURL ? (\n\t\t\t\tplaceholder()\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<img\n\t\t\t\t\t\tclassName={ borderProps.className }\n\t\t\t\t\t\tsrc={ temporaryURL || mediaUrl }\n\t\t\t\t\t\talt={\n\t\t\t\t\t\t\tmedia && media?.alt_text\n\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t// translators: %s: The image's alt text.\n\t\t\t\t\t\t\t\t\t\t__( 'Featured image: %s' ),\n\t\t\t\t\t\t\t\t\t\tmedia.alt_text\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t: __( 'Featured image' )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstyle={ imageStyles }\n\t\t\t\t\t/>\n\t\t\t\t\t{ temporaryURL && <Spinner /> }\n\t\t\t\t</>\n\t\t\t);\n\t}\n\n\t/**\n\t * When the post featured image block:\n\t * - Has an image assigned\n\t * - Is not inside a query loop\n\t * Then display the image and the image replacement option.\n\t */\n\treturn (\n\t\t<>\n\t\t\t{ ! temporaryURL && controls }\n\t\t\t{ !! media && ! isDescendentOfQueryLoop && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\t\tmediaId={ featuredImage }\n\t\t\t\t\t\tmediaURL={ mediaUrl }\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\taccept=\"image/*\"\n\t\t\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t\tonReset={ onResetImage }\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t<figure { ...blockProps }>\n\t\t\t\t{ /* If the featured image is linked, wrap in an <a /> tag to trigger any inherited link element styles */ }\n\t\t\t\t{ !! isLink ? (\n\t\t\t\t\t<a href={ postPermalink } target={ linkTarget }>\n\t\t\t\t\t\t{ image }\n\t\t\t\t\t</a>\n\t\t\t\t) : (\n\t\t\t\t\timage\n\t\t\t\t) }\n\t\t\t\t<Overlay\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t</figure>\n\t\t</>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,kBAA0B;AAC1B,uBAAkD;AAClD,kBAAuC;AACvC,wBASO;AACP,0BAWO;AACP,qBAKO;AACP,kBAA4B;AAC5B,mBAAuB;AACvB,qBAAsC;AAKtC,gCAA8B;AAC9B,8BAA4B;AAC5B,qBAAoB;AACpB,mBAA+C;AAC/C,yBAAuB;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { isBlobURL } from '@wordpress/blob';\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tToggleControl,\n\tPlaceholder,\n\tButton,\n\tSpinner,\n\tTextControl,\n\tExternalLink,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport {\n\tInspectorControls,\n\tBlockControls,\n\tMediaPlaceholder,\n\tMediaReplaceFlow,\n\tuseBlockProps,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalGetShadowClassesAndStyles as getShadowClassesAndStyles,\n\tuseBlockEditingMode,\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tuseMemo,\n\tuseEffect,\n\tuseState,\n\tcreateInterpolateElement,\n} from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { upload } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport DimensionControls from './dimension-controls';\nimport OverlayControls from './overlay-controls';\nimport Overlay from './overlay';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\nimport { unlock } from '../lock-unlock';\nimport { getDimensionResetAttributes } from '../utils/style-state';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\nconst { isDefaultBlockStyleState, ResolutionTool } = unlock(\n\tblockEditorPrivateApis\n);\n\nconst hasDimensionValue = ( value ) =>\n\tvalue !== undefined && value !== null && value !== '';\nconst DEFAULT_MEDIA_SIZE_SLUG = 'full';\n\nfunction FeaturedImageResolutionTool( { image, value, onChange } ) {\n\tconst { imageSizes } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn {\n\t\t\timageSizes: getSettings().imageSizes,\n\t\t};\n\t}, [] );\n\n\tif ( ! imageSizes?.length ) {\n\t\treturn null;\n\t}\n\n\tconst imageSizeOptions = imageSizes\n\t\t.filter(\n\t\t\t( { slug } ) => image?.media_details?.sizes?.[ slug ]?.source_url\n\t\t)\n\t\t.map( ( { name, slug } ) => ( { value: slug, label: name } ) );\n\n\treturn (\n\t\t<ResolutionTool\n\t\t\tvalue={ value }\n\t\t\tdefaultValue={ DEFAULT_MEDIA_SIZE_SLUG }\n\t\t\toptions={ imageSizeOptions }\n\t\t\tonChange={ onChange }\n\t\t/>\n\t);\n}\n\nexport default function PostFeaturedImageEdit( {\n\tclientId,\n\tattributes,\n\tsetAttributes,\n\tcontext: { postId, postType: postTypeSlug, queryId },\n} ) {\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst {\n\t\tisLink,\n\t\taspectRatio,\n\t\theight,\n\t\twidth,\n\t\tscale,\n\t\tsizeSlug,\n\t\trel,\n\t\tlinkTarget,\n\t\tuseFirstImageFromPost,\n\t} = attributes;\n\tconst [ temporaryURL, setTemporaryURL ] = useState();\n\n\tconst [ storedFeaturedImage, setFeaturedImage ] = useEntityProp(\n\t\t'postType',\n\t\tpostTypeSlug,\n\t\t'featured_media',\n\t\tpostId\n\t);\n\n\t// Fallback to post content if no featured image is set.\n\t// This is needed for the \"Use first image from post\" option.\n\tconst [ postContent ] = useEntityProp(\n\t\t'postType',\n\t\tpostTypeSlug,\n\t\t'content',\n\t\tpostId\n\t);\n\n\tconst featuredImage = useMemo( () => {\n\t\tif ( storedFeaturedImage ) {\n\t\t\treturn storedFeaturedImage;\n\t\t}\n\n\t\tif ( ! useFirstImageFromPost ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst imageOpener =\n\t\t\t/<!--\\s+wp:(?:core\\/)?image\\s+(?<attrs>{(?:(?:[^}]+|}+(?=})|(?!}\\s+\\/?-->).)*)?}\\s+)?-->/.exec(\n\t\t\t\tpostContent\n\t\t\t);\n\t\tconst imageId =\n\t\t\timageOpener?.groups?.attrs &&\n\t\t\tJSON.parse( imageOpener.groups.attrs )?.id;\n\t\treturn imageId;\n\t}, [ storedFeaturedImage, useFirstImageFromPost, postContent ] );\n\n\tconst { media, postType, postPermalink, selectedStyleState } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, getPostType, getEditedEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getSelectedBlockStyleState } = unlock(\n\t\t\t\tselect( blockEditorStore )\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tmedia:\n\t\t\t\t\tfeaturedImage &&\n\t\t\t\t\tgetEntityRecord( 'postType', 'attachment', featuredImage, {\n\t\t\t\t\t\tcontext: 'view',\n\t\t\t\t\t} ),\n\t\t\t\tpostType: postTypeSlug && getPostType( postTypeSlug ),\n\t\t\t\tpostPermalink: getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostTypeSlug,\n\t\t\t\t\tpostId\n\t\t\t\t)?.link,\n\t\t\t\tselectedStyleState: getSelectedBlockStyleState( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId, featuredImage, postTypeSlug, postId ]\n\t);\n\tconst hasSelectedStyleState =\n\t\t! isDefaultBlockStyleState( selectedStyleState );\n\n\tconst mediaUrl =\n\t\tmedia?.media_details?.sizes?.[ sizeSlug ]?.source_url ||\n\t\tmedia?.source_url;\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( {\n\t\t\t'is-transient': temporaryURL,\n\t\t} ),\n\t} );\n\tconst borderProps = useBorderProps( attributes );\n\tconst shadowProps = getShadowClassesAndStyles( attributes );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst placeholder = ( content ) => {\n\t\treturn (\n\t\t\t<Placeholder\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'block-editor-media-placeholder',\n\t\t\t\t\tborderProps.className\n\t\t\t\t) }\n\t\t\t\twithIllustration\n\t\t\t\tstyle={ {\n\t\t\t\t\taspectRatio,\n\t\t\t\t\theight: hasDimensionValue( height )\n\t\t\t\t\t\t? height\n\t\t\t\t\t\t: hasDimensionValue( width ) && 'auto',\n\t\t\t\t\twidth: hasDimensionValue( width )\n\t\t\t\t\t\t? width\n\t\t\t\t\t\t: !! aspectRatio && '100%',\n\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t...shadowProps.style,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ content }\n\t\t\t</Placeholder>\n\t\t);\n\t};\n\n\tconst onSelectImage = ( value ) => {\n\t\tif ( value?.id ) {\n\t\t\tsetFeaturedImage( value.id );\n\t\t}\n\n\t\tif ( value?.url && isBlobURL( value.url ) ) {\n\t\t\tsetTemporaryURL( value.url );\n\t\t}\n\t};\n\n\t// On reset image\n\tconst onResetImage = () => {\n\t\tsetAttributes( {\n\t\t\tisLink: false,\n\t\t\tlinkTarget: '_self',\n\t\t\trel: '',\n\t\t\tsizeSlug: undefined,\n\t\t} );\n\t\tsetFeaturedImage( 0 );\n\t};\n\n\t// Reset temporary url when media is available.\n\tuseEffect( () => {\n\t\tif ( mediaUrl && temporaryURL ) {\n\t\t\tsetTemporaryURL();\n\t\t}\n\t}, [ mediaUrl, temporaryURL ] );\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t\tsetTemporaryURL();\n\t};\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst controls = blockEditingMode === 'default' && (\n\t\t<>\n\t\t\t<InspectorControls group=\"color\">\n\t\t\t\t<OverlayControls\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls\n\t\t\t\tgroup=\"dimensions\"\n\t\t\t\tresetAllFilter={ ( attrs ) => {\n\t\t\t\t\treturn getDimensionResetAttributes( {\n\t\t\t\t\t\tattributes: attrs,\n\t\t\t\t\t\tselectedState: selectedStyleState,\n\t\t\t\t\t\thasSelectedStyleState,\n\t\t\t\t\t\tkeys: [ 'aspectRatio', 'height', 'objectFit', 'width' ],\n\t\t\t\t\t\tdefaultAttributes: {\n\t\t\t\t\t\t\taspectRatio: undefined,\n\t\t\t\t\t\t\theight: undefined,\n\t\t\t\t\t\t\tscale: undefined,\n\t\t\t\t\t\t\twidth: undefined,\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\t<DimensionControls\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tmedia={ media }\n\t\t\t\t\tselectedStyleState={ selectedStyleState }\n\t\t\t\t\thasSelectedStyleState={ hasSelectedStyleState }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t{ ( featuredImage || isDescendentOfQueryLoop || ! postId ) && (\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<ToolsPanel\n\t\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tisLink: false,\n\t\t\t\t\t\t\t\tlinkTarget: '_self',\n\t\t\t\t\t\t\t\trel: '',\n\t\t\t\t\t\t\t\tsizeSlug: DEFAULT_MEDIA_SIZE_SLUG,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tpostType?.labels?.singular_name\n\t\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"post\".\n\t\t\t\t\t\t\t\t\t\t\t__( 'Link to %s' ),\n\t\t\t\t\t\t\t\t\t\t\tpostType.labels.singular_name\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t: __( 'Link to post' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\thasValue={ () => !! isLink }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tisLink: false,\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\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Make image a link' ) }\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { isLink: ! isLink } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t\t{ isLink && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\thasValue={ () => '_self' !== linkTarget }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlinkTarget: '_self',\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\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\tlinkTarget: value\n\t\t\t\t\t\t\t\t\t\t\t\t? '_blank'\n\t\t\t\t\t\t\t\t\t\t\t\t: '_self',\n\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isLink && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Link relation' ) }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\thasValue={ () => !! rel }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\trel: '',\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\t\t<TextControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Link relation' ) }\n\t\t\t\t\t\t\t\t\thelp={ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t'The <a>Link Relation</a> attribute defines the relationship between a linked resource and the current document.'\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t\t\t\t<ExternalLink href=\"https://developer.mozilla.org/docs/Web/HTML/Attributes/rel\" />\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tvalue={ rel }\n\t\t\t\t\t\t\t\t\tonChange={ ( newRel ) =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( { rel: newRel } )\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</ToolsPanelItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ !! media && (\n\t\t\t\t\t\t\t<FeaturedImageResolutionTool\n\t\t\t\t\t\t\t\timage={ media }\n\t\t\t\t\t\t\t\tvalue={ sizeSlug }\n\t\t\t\t\t\t\t\tonChange={ ( nextSizeSlug ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { sizeSlug: nextSizeSlug } )\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</ToolsPanel>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t</>\n\t);\n\n\tlet image;\n\n\t/**\n\t * A Post Featured Image block should not have image replacement\n\t * or upload options in the following cases:\n\t * - Is placed in a Query Loop. This is a conscious decision to\n\t * prevent content editing of different posts in Query Loop, and\n\t * this could change in the future.\n\t * - Is in a context where it does not have a postId (for example\n\t * in a template or template part).\n\t */\n\tif ( ! featuredImage && ( isDescendentOfQueryLoop || ! postId ) ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ controls }\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t{ !! isLink ? (\n\t\t\t\t\t\t<a href={ postPermalink } target={ linkTarget }>\n\t\t\t\t\t\t\t{ placeholder() }\n\t\t\t\t\t\t</a>\n\t\t\t\t\t) : (\n\t\t\t\t\t\tplaceholder()\n\t\t\t\t\t) }\n\t\t\t\t\t<Overlay\n\t\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t}\n\n\tconst label = __( 'Add a featured image' );\n\tconst imageStyles = {\n\t\t...borderProps.style,\n\t\t...shadowProps.style,\n\t\taspectRatio,\n\t\theight: hasDimensionValue( height )\n\t\t\t? height\n\t\t\t: hasDimensionValue( width ) && 'auto',\n\t\twidth: hasDimensionValue( width ) ? width : !! aspectRatio && '100%',\n\t\tobjectFit: !! ( height || aspectRatio ) && scale,\n\t};\n\n\t/**\n\t * When the post featured image block is placed in a context where:\n\t * - It has a postId (for example in a single post)\n\t * - It is not inside a query loop\n\t * - It has no image assigned yet\n\t * Then display the placeholder with the image upload option.\n\t */\n\tif ( ! featuredImage && ! temporaryURL ) {\n\t\timage = (\n\t\t\t<MediaPlaceholder\n\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\taccept=\"image/*\"\n\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\tonError={ onUploadError }\n\t\t\t\tplaceholder={ placeholder }\n\t\t\t\tmediaLibraryButton={ ( { open } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\ttooltipPosition=\"top center\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\topen();\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} }\n\t\t\t/>\n\t\t);\n\t} else {\n\t\t// We have a Featured image so show a Placeholder if is loading.\n\t\timage =\n\t\t\t! media && ! temporaryURL ? (\n\t\t\t\tplaceholder()\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<img\n\t\t\t\t\t\tclassName={ borderProps.className }\n\t\t\t\t\t\tsrc={ temporaryURL || mediaUrl }\n\t\t\t\t\t\talt={\n\t\t\t\t\t\t\tmedia && media?.alt_text\n\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t// translators: %s: The image's alt text.\n\t\t\t\t\t\t\t\t\t\t__( 'Featured image: %s' ),\n\t\t\t\t\t\t\t\t\t\tmedia.alt_text\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t: __( 'Featured image' )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstyle={ imageStyles }\n\t\t\t\t\t/>\n\t\t\t\t\t{ temporaryURL && <Spinner /> }\n\t\t\t\t</>\n\t\t\t);\n\t}\n\n\t/**\n\t * When the post featured image block:\n\t * - Has an image assigned\n\t * - Is not inside a query loop\n\t * Then display the image and the image replacement option.\n\t */\n\treturn (\n\t\t<>\n\t\t\t{ ! temporaryURL && controls }\n\t\t\t{ !! media && ! isDescendentOfQueryLoop && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\t\tmediaId={ featuredImage }\n\t\t\t\t\t\tmediaURL={ mediaUrl }\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\taccept=\"image/*\"\n\t\t\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t\tonReset={ onResetImage }\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t<figure { ...blockProps }>\n\t\t\t\t{ /* If the featured image is linked, wrap in an <a /> tag to trigger any inherited link element styles */ }\n\t\t\t\t{ !! isLink ? (\n\t\t\t\t\t<a href={ postPermalink } target={ linkTarget }>\n\t\t\t\t\t\t{ image }\n\t\t\t\t\t</a>\n\t\t\t\t) : (\n\t\t\t\t\timage\n\t\t\t\t) }\n\t\t\t\t<Overlay\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t</figure>\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,kBAA0B;AAC1B,uBAAkD;AAClD,kBAAuC;AACvC,wBASO;AACP,0BAWO;AACP,qBAKO;AACP,kBAA4B;AAC5B,mBAAuB;AACvB,qBAAsC;AAKtC,gCAA8B;AAC9B,8BAA4B;AAC5B,qBAAoB;AACpB,mBAA+C;AAC/C,yBAAuB;AACvB,yBAA4C;AA8B1C;AA5BF,IAAM,sBAAsB,CAAE,OAAQ;AACtC,IAAM,EAAE,0BAA0B,eAAe,QAAI;AAAA,EACpD,oBAAAA;AACD;AAEA,IAAM,oBAAoB,CAAE,UAC3B,UAAU,UAAa,UAAU,QAAQ,UAAU;AACpD,IAAM,0BAA0B;AAEhC,SAAS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ACf,QAAO;AAAA,QACP,UAAW;AAAA,QACX,SAAU;AAAA,QACV,SAAU;AAAA;AAAA,IACX,GACD;AAAA,IAED,6CAAC,YAAS,GAAG,YAEV;AAAA,OAAC,CAAE,SACJ,4CAAC,OAAE,MAAO,eAAgB,QAAS,YAChC,iBACH,IAEA;AAAA,MAED;AAAA,QAAC,eAAAA;AAAA,QAAA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACD;AAAA,OACD;AAAA,KACD;AAEF;",
|
|
6
6
|
"names": ["blockEditorPrivateApis", "blockEditorStore", "coreStore", "clsx", "useBorderProps", "getShadowClassesAndStyles", "noticesStore", "OverlayControls", "DimensionControls", "ToolsPanel", "ToolsPanelItem", "Overlay"]
|
|
7
7
|
}
|
|
@@ -39,8 +39,8 @@ function PostNavigationLinkEdit({
|
|
|
39
39
|
let placeholder = isNext ? (0, import_i18n.__)("Next") : (0, import_i18n.__)("Previous");
|
|
40
40
|
const arrowMap = {
|
|
41
41
|
none: "",
|
|
42
|
-
arrow: isNext ? "
|
|
43
|
-
chevron: isNext ? "
|
|
42
|
+
arrow: isNext ? "→" : "←",
|
|
43
|
+
chevron: isNext ? "»" : "«"
|
|
44
44
|
};
|
|
45
45
|
const displayArrow = arrowMap[arrow];
|
|
46
46
|
if (showTitle) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/post-navigation-link/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tToggleControl,\n\tSelectControl,\n} from '@wordpress/components';\nimport {\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { __, _x } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nexport default function PostNavigationLinkEdit( {\n\tcontext: { postType },\n\tattributes: { type, label, showTitle, linkLabel, arrow, taxonomy },\n\tsetAttributes,\n} ) {\n\tconst isNext = type === 'next';\n\tlet placeholder = isNext ? __( 'Next' ) : __( 'Previous' );\n\n\tconst arrowMap = {\n\t\tnone: '',\n\t\tarrow: isNext ? '
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAOO;AACP,0BAIO;AACP,kBAAuB;AACvB,kBAA0B;AAC1B,uBAAmC;AAKnC,mBAA+C;AA2D7C;AAzDa,SAAR,uBAAyC;AAAA,EAC/C,SAAS,EAAE,SAAS;AAAA,EACpB,YAAY,EAAE,MAAM,OAAO,WAAW,WAAW,OAAO,SAAS;AAAA,EACjE;AACD,GAAI;AACH,QAAM,SAAS,SAAS;AACxB,MAAI,cAAc,aAAS,gBAAI,MAAO,QAAI,gBAAI,UAAW;AAEzD,QAAM,WAAW;AAAA,IAChB,MAAM;AAAA,IACN,OAAO,SAAS,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tToggleControl,\n\tSelectControl,\n} from '@wordpress/components';\nimport {\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { __, _x } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nexport default function PostNavigationLinkEdit( {\n\tcontext: { postType },\n\tattributes: { type, label, showTitle, linkLabel, arrow, taxonomy },\n\tsetAttributes,\n} ) {\n\tconst isNext = type === 'next';\n\tlet placeholder = isNext ? __( 'Next' ) : __( 'Previous' );\n\n\tconst arrowMap = {\n\t\tnone: '',\n\t\tarrow: isNext ? '→' : '←',\n\t\tchevron: isNext ? '»' : '«',\n\t};\n\n\tconst displayArrow = arrowMap[ arrow ];\n\n\tif ( showTitle ) {\n\t\tplaceholder = isNext\n\t\t\t? /* translators: Label before for next and previous post. There is a space after the colon. */\n\t\t\t __( 'Next: ' ) // eslint-disable-line @wordpress/i18n-no-flanking-whitespace\n\t\t\t: /* translators: Label before for next and previous post. There is a space after the colon. */\n\t\t\t __( 'Previous: ' ); // eslint-disable-line @wordpress/i18n-no-flanking-whitespace\n\t}\n\n\tconst ariaLabel = isNext ? __( 'Next post' ) : __( 'Previous post' );\n\tconst blockProps = useBlockProps();\n\tconst taxonomies = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getTaxonomies } = select( coreStore );\n\t\t\tconst filteredTaxonomies = getTaxonomies( {\n\t\t\t\ttype: postType,\n\t\t\t\tper_page: -1,\n\t\t\t} );\n\t\t\treturn filteredTaxonomies;\n\t\t},\n\t\t[ postType ]\n\t);\n\tconst getTaxonomyOptions = () => {\n\t\tconst selectOption = {\n\t\t\tlabel: __( 'Unfiltered' ),\n\t\t\tvalue: '',\n\t\t};\n\t\tconst taxonomyOptions = ( taxonomies ?? [] )\n\t\t\t.filter( ( { visibility } ) => !! visibility?.publicly_queryable )\n\t\t\t.map( ( item ) => {\n\t\t\t\treturn {\n\t\t\t\t\tvalue: item.slug,\n\t\t\t\t\tlabel: item.name,\n\t\t\t\t};\n\t\t\t} );\n\n\t\treturn [ selectOption, ...taxonomyOptions ];\n\t};\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tshowTitle: false,\n\t\t\t\t\t\t\tlinkLabel: false,\n\t\t\t\t\t\t\tarrow: 'none',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Display the title as a link' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => showTitle }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showTitle: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Display the title as a link' ) }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'If you have entered a custom label, it will be prepended before the title.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tchecked={ !! showTitle }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tshowTitle: ! showTitle,\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</ToolsPanelItem>\n\t\t\t\t\t{ showTitle && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t'Include the label as part of the link'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\thasValue={ () => !! linkLabel }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { linkLabel: false } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t'Include the label as part of the link'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tchecked={ !! linkLabel }\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlinkLabel: ! linkLabel,\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</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Arrow' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => arrow !== 'none' }\n\t\t\t\t\t\tonDeselect={ () => setAttributes( { arrow: 'none' } ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tlabel={ __( 'Arrow' ) }\n\t\t\t\t\t\t\tvalue={ arrow }\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\tsetAttributes( { arrow: value } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'A decorative arrow for the next and previous link.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"none\"\n\t\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t\t'None',\n\t\t\t\t\t\t\t\t\t'Arrow option for Next/Previous link'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"arrow\"\n\t\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t\t'Arrow',\n\t\t\t\t\t\t\t\t\t'Arrow option for Next/Previous link'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"chevron\"\n\t\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t\t'Chevron',\n\t\t\t\t\t\t\t\t\t'Arrow option for Next/Previous link'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<SelectControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'Filter by taxonomy' ) }\n\t\t\t\t\tvalue={ taxonomy }\n\t\t\t\t\toptions={ getTaxonomyOptions() }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\ttaxonomy: value,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'Only link to posts that have the same taxonomy terms as the current post. For example the same tags or categories.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ ! isNext && displayArrow && (\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName={ `wp-block-post-navigation-link__arrow-previous is-arrow-${ arrow }` }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ displayArrow }\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t\t<RichText\n\t\t\t\t\ttagName=\"a\"\n\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\taria-label={ ariaLabel }\n\t\t\t\t\tplaceholder={ placeholder }\n\t\t\t\t\tvalue={ label }\n\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\tonChange={ ( newLabel ) =>\n\t\t\t\t\t\tsetAttributes( { label: newLabel } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t{ showTitle && (\n\t\t\t\t\t<a\n\t\t\t\t\t\thref=\"#post-navigation-pseudo-link\"\n\t\t\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'An example title' ) }\n\t\t\t\t\t</a>\n\t\t\t\t) }\n\t\t\t\t{ isNext && displayArrow && (\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName={ `wp-block-post-navigation-link__arrow-next is-arrow-${ arrow }` }\n\t\t\t\t\t\taria-hidden\n\t\t\t\t\t>\n\t\t\t\t\t\t{ displayArrow }\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAOO;AACP,0BAIO;AACP,kBAAuB;AACvB,kBAA0B;AAC1B,uBAAmC;AAKnC,mBAA+C;AA2D7C;AAzDa,SAAR,uBAAyC;AAAA,EAC/C,SAAS,EAAE,SAAS;AAAA,EACpB,YAAY,EAAE,MAAM,OAAO,WAAW,WAAW,OAAO,SAAS;AAAA,EACjE;AACD,GAAI;AACH,QAAM,SAAS,SAAS;AACxB,MAAI,cAAc,aAAS,gBAAI,MAAO,QAAI,gBAAI,UAAW;AAEzD,QAAM,WAAW;AAAA,IAChB,MAAM;AAAA,IACN,OAAO,SAAS,MAAM;AAAA,IACtB,SAAS,SAAS,MAAM;AAAA,EACzB;AAEA,QAAM,eAAe,SAAU,KAAM;AAErC,MAAK,WAAY;AAChB,kBAAc;AAAA;AAAA,UAEX,gBAAI,QAAS;AAAA;AAAA;AAAA,UAEb,gBAAI,YAAa;AAAA;AAAA,EACrB;AAEA,QAAM,YAAY,aAAS,gBAAI,WAAY,QAAI,gBAAI,eAAgB;AACnE,QAAM,iBAAa,mCAAc;AACjC,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AA,wBACA,OAAM;AAAA,wBACN,WAAQ;AAAA,0BACP;AAAA,0BACA;AAAA,wBACD;AAAA;AAAA,oBACD;AAAA;AAAA;AAAA,cACD;AAAA;AAAA,UACD;AAAA;AAAA;AAAA,IACD,GACD;AAAA,IACA,4CAAC,yCAAkB,OAAM,YACxB;AAAA,MAAC;AAAA;AAAA,QACA,uBAAqB;AAAA,QACrB,WAAQ,gBAAI,oBAAqB;AAAA,QACjC,OAAQ;AAAA,QACR,SAAU,mBAAmB;AAAA,QAC7B,UAAW,CAAE,UACZ,cAAe;AAAA,UACd,UAAU;AAAA,QACX,CAAE;AAAA,QAEH,UAAO;AAAA,UACN;AAAA,QACD;AAAA;AAAA,IACD,GACD;AAAA,IACA,6CAAC,SAAM,GAAG,YACP;AAAA,OAAE,UAAU,gBACb;AAAA,QAAC;AAAA;AAAA,UACA,WAAY,0DAA2D,KAAM;AAAA,UAE3E;AAAA;AAAA,MACH;AAAA,MAED;AAAA,QAAC;AAAA;AAAA,UACA,SAAQ;AAAA,UACR,YAAW;AAAA,UACX,cAAa;AAAA,UACb;AAAA,UACA,OAAQ;AAAA,UACR,8BAA4B;AAAA,UAC5B,UAAW,CAAE,aACZ,cAAe,EAAE,OAAO,SAAS,CAAE;AAAA;AAAA,MAErC;AAAA,MACE,aACD;AAAA,QAAC;AAAA;AAAA,UACA,MAAK;AAAA,UACL,SAAU,CAAE,UAAW,MAAM,eAAe;AAAA,UAE1C,8BAAI,kBAAmB;AAAA;AAAA,MAC1B;AAAA,MAEC,UAAU,gBACX;AAAA,QAAC;AAAA;AAAA,UACA,WAAY,sDAAuD,KAAM;AAAA,UACzE,eAAW;AAAA,UAET;AAAA;AAAA,MACH;AAAA,OAEF;AAAA,KACD;AAEF;",
|
|
6
6
|
"names": ["coreStore", "ToolsPanel", "ToolsPanelItem", "ToggleGroupControl", "ToggleGroupControlOption"]
|
|
7
7
|
}
|
|
@@ -84,7 +84,6 @@ function PostTermsEdit({
|
|
|
84
84
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.InspectorControls, { group: "advanced", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
85
85
|
import_components.TextControl,
|
|
86
86
|
{
|
|
87
|
-
__next40pxDefaultSize: true,
|
|
88
87
|
autoComplete: "off",
|
|
89
88
|
label: (0, import_i18n.__)("Separator"),
|
|
90
89
|
value: separator || "",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/post-terms/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\tuseBlockDisplayInformation,\n\tRichText,\n} from '@wordpress/block-editor';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\nimport { Spinner, TextControl } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport usePostTerms from './use-post-terms';\n\n// Allowed formats for the prefix and suffix fields.\nconst ALLOWED_FORMATS = [\n\t'core/bold',\n\t'core/image',\n\t'core/italic',\n\t'core/link',\n\t'core/strikethrough',\n\t'core/text-color',\n];\n\nexport default function PostTermsEdit( {\n\tattributes,\n\tclientId,\n\tcontext,\n\tisSelected,\n\tsetAttributes,\n\tinsertBlocksAfter,\n} ) {\n\tconst { term, separator, prefix, suffix } = attributes;\n\tconst { postId, postType } = context;\n\n\tconst selectedTerm = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! term ) {\n\t\t\t\treturn {};\n\t\t\t}\n\t\t\tconst { getTaxonomy } = select( coreStore );\n\t\t\tconst taxonomy = getTaxonomy( term );\n\t\t\treturn taxonomy?.visibility?.publicly_queryable ? taxonomy : {};\n\t\t},\n\t\t[ term ]\n\t);\n\tconst { postTerms, hasPostTerms, isLoading } = usePostTerms( {\n\t\tpostId,\n\t\tterm: selectedTerm,\n\t} );\n\tconst hasPost = postId && postType;\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst blockProps = useBlockProps( {\n\t\tclassName: term && `taxonomy-${ term }`,\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<TextControl\n\t\t\t\t\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAKO;AACP,oBAAiD;AACjD,wBAAqC;AACrC,kBAA0B;AAC1B,2BAA+B;AAC/B,kBAAmB;AACnB,uBAAmC;AAKnC,4BAAyB;AA+CrB;AA5CJ,IAAM,kBAAkB;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEe,SAAR,cAAgC;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,EAAE,MAAM,WAAW,QAAQ,OAAO,IAAI;AAC5C,QAAM,EAAE,QAAQ,SAAS,IAAI;AAE7B,QAAM,mBAAe;AAAA,IACpB,CAAE,WAAY;AACb,UAAK,CAAE,MAAO;AACb,eAAO,CAAC;AAAA,MACT;AACA,YAAM,EAAE,YAAY,IAAI,OAAQ,iBAAAA,KAAU;AAC1C,YAAM,WAAW,YAAa,IAAK;AACnC,aAAO,UAAU,YAAY,qBAAqB,WAAW,CAAC;AAAA,IAC/D;AAAA,IACA,CAAE,IAAK;AAAA,EACR;AACA,QAAM,EAAE,WAAW,cAAc,UAAU,QAAI,sBAAAC,SAAc;AAAA,IAC5D;AAAA,IACA,MAAM;AAAA,EACP,CAAE;AACF,QAAM,UAAU,UAAU;AAC1B,QAAM,uBAAmB,gDAA4B,QAAS;AAC9D,QAAM,iBAAa,mCAAe;AAAA,IACjC,WAAW,QAAQ,YAAa,IAAK;AAAA,EACtC,CAAE;AAEF,SACC,4EACC;AAAA,gDAAC,yCAAkB,OAAM,YACxB;AAAA,MAAC;AAAA;AAAA,QACA,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\tuseBlockDisplayInformation,\n\tRichText,\n} from '@wordpress/block-editor';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\nimport { Spinner, TextControl } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport usePostTerms from './use-post-terms';\n\n// Allowed formats for the prefix and suffix fields.\nconst ALLOWED_FORMATS = [\n\t'core/bold',\n\t'core/image',\n\t'core/italic',\n\t'core/link',\n\t'core/strikethrough',\n\t'core/text-color',\n];\n\nexport default function PostTermsEdit( {\n\tattributes,\n\tclientId,\n\tcontext,\n\tisSelected,\n\tsetAttributes,\n\tinsertBlocksAfter,\n} ) {\n\tconst { term, separator, prefix, suffix } = attributes;\n\tconst { postId, postType } = context;\n\n\tconst selectedTerm = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! term ) {\n\t\t\t\treturn {};\n\t\t\t}\n\t\t\tconst { getTaxonomy } = select( coreStore );\n\t\t\tconst taxonomy = getTaxonomy( term );\n\t\t\treturn taxonomy?.visibility?.publicly_queryable ? taxonomy : {};\n\t\t},\n\t\t[ term ]\n\t);\n\tconst { postTerms, hasPostTerms, isLoading } = usePostTerms( {\n\t\tpostId,\n\t\tterm: selectedTerm,\n\t} );\n\tconst hasPost = postId && postType;\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst blockProps = useBlockProps( {\n\t\tclassName: term && `taxonomy-${ term }`,\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<TextControl\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\tlabel={ __( 'Separator' ) }\n\t\t\t\t\tvalue={ separator || '' }\n\t\t\t\t\tonChange={ ( nextValue ) => {\n\t\t\t\t\t\tsetAttributes( { separator: nextValue } );\n\t\t\t\t\t} }\n\t\t\t\t\thelp={ __( 'Enter character(s) used to separate terms.' ) }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ isLoading && hasPost && <Spinner /> }\n\t\t\t\t{ ! isLoading && ( isSelected || prefix ) && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"prefix\"\n\t\t\t\t\t\tallowedFormats={ ALLOWED_FORMATS }\n\t\t\t\t\t\tclassName=\"wp-block-post-terms__prefix\"\n\t\t\t\t\t\taria-label={ __( 'Prefix' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Prefix' ) + ' ' }\n\t\t\t\t\t\tvalue={ prefix }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { prefix: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttagName=\"span\"\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ( ! hasPost || ! term ) && (\n\t\t\t\t\t<span>{ blockInformation.title }</span>\n\t\t\t\t) }\n\t\t\t\t{ hasPost &&\n\t\t\t\t\t! isLoading &&\n\t\t\t\t\thasPostTerms &&\n\t\t\t\t\tpostTerms\n\t\t\t\t\t\t.map( ( postTerm ) => (\n\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\tkey={ postTerm.id }\n\t\t\t\t\t\t\t\thref={ postTerm.link }\n\t\t\t\t\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t\t\t\t\t\trel=\"tag\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ decodeEntities( postTerm.name ) }\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t) )\n\t\t\t\t\t\t.reduce( ( prev, curr ) => (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{ prev }\n\t\t\t\t\t\t\t\t<span className=\"wp-block-post-terms__separator\">\n\t\t\t\t\t\t\t\t\t{ separator || ' ' }\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t{ curr }\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) ) }\n\t\t\t\t{ hasPost &&\n\t\t\t\t\t! isLoading &&\n\t\t\t\t\t! hasPostTerms &&\n\t\t\t\t\t( selectedTerm?.labels?.no_terms ||\n\t\t\t\t\t\t__( 'Term items not found.' ) ) }\n\t\t\t\t{ ! isLoading && ( isSelected || suffix ) && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"suffix\"\n\t\t\t\t\t\tallowedFormats={ ALLOWED_FORMATS }\n\t\t\t\t\t\tclassName=\"wp-block-post-terms__suffix\"\n\t\t\t\t\t\taria-label={ __( 'Suffix' ) }\n\t\t\t\t\t\tplaceholder={ ' ' + __( 'Suffix' ) }\n\t\t\t\t\t\tvalue={ suffix }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { suffix: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttagName=\"span\"\n\t\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\tcreateBlock( getDefaultBlockName() )\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) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAKO;AACP,oBAAiD;AACjD,wBAAqC;AACrC,kBAA0B;AAC1B,2BAA+B;AAC/B,kBAAmB;AACnB,uBAAmC;AAKnC,4BAAyB;AA+CrB;AA5CJ,IAAM,kBAAkB;AAAA,EACvB;AA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,QAAS;AAAA,UAC1B,iBAAc,gBAAI,QAAS,IAAI;AAAA,UAC/B,OAAQ;AAAA,UACR,UAAW,CAAE,UACZ,cAAe,EAAE,QAAQ,MAAM,CAAE;AAAA,UAElC,SAAQ;AAAA;AAAA,MACT;AAAA,OAEG,CAAE,WAAW,CAAE,SAClB,4CAAC,UAAO,2BAAiB,OAAO;AAAA,MAE/B,WACD,CAAE,aACF,gBACA,UACE,IAAK,CAAE,aACP;AAAA,QAAC;AAAA;AAAA,UAEA,MAAO,SAAS;AAAA,UAChB,SAAU,CAAE,UAAW,MAAM,eAAe;AAAA,UAC5C,KAAI;AAAA,UAEF,mDAAgB,SAAS,IAAK;AAAA;AAAA,QAL1B,SAAS;AAAA,MAMhB,CACC,EACD,OAAQ,CAAE,MAAM,SAChB,4EACG;AAAA;AAAA,QACF,4CAAC,UAAK,WAAU,kCACb,uBAAa,KAChB;AAAA,QACE;AAAA,SACH,CACC;AAAA,MACF,WACD,CAAE,aACF,CAAE,iBACA,cAAc,QAAQ,gBACvB,gBAAI,uBAAwB;AAAA,MAC5B,CAAE,cAAe,cAAc,WAChC;AAAA,QAAC;AAAA;AAAA,UACA,YAAW;AAAA,UACX,gBAAiB;AAAA,UACjB,WAAU;AAAA,UACV,kBAAa,gBAAI,QAAS;AAAA,UAC1B,aAAc,UAAM,gBAAI,QAAS;AAAA,UACjC,OAAQ;AAAA,UACR,UAAW,CAAE,UACZ,cAAe,EAAE,QAAQ,MAAM,CAAE;AAAA,UAElC,SAAQ;AAAA,UACR,wBAAyB,MACxB;AAAA,gBACC,+BAAa,mCAAoB,CAAE;AAAA,UACpC;AAAA;AAAA,MAEF;AAAA,OAEF;AAAA,KACD;AAEF;",
|
|
6
6
|
"names": ["coreStore", "usePostTerms"]
|
|
7
7
|
}
|
|
@@ -73,7 +73,7 @@ function PostTimeToReadEdit({ attributes, setAttributes, context }) {
|
|
|
73
73
|
maxMinutes = maxMinutes + 1;
|
|
74
74
|
}
|
|
75
75
|
const rangeLabel = (0, import_i18n._x)(
|
|
76
|
-
"%1$s
|
|
76
|
+
"%1$s–%2$s minutes",
|
|
77
77
|
"Range of minutes to read"
|
|
78
78
|
);
|
|
79
79
|
return (0, import_i18n.sprintf)(rangeLabel, minMinutes, maxMinutes);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/post-time-to-read/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, _x, _n, sprintf } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { useBlockProps, InspectorControls } from '@wordpress/block-editor';\nimport {\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __unstableSerializeAndClean } from '@wordpress/blocks';\nimport { useEntityProp, useEntityBlockEditor } from '@wordpress/core-data';\nimport { count as wordCount } from '@wordpress/wordcount';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nfunction PostTimeToReadEdit( { attributes, setAttributes, context } ) {\n\tconst { displayAsRange, displayMode, averageReadingSpeed } = attributes;\n\tconst { postId, postType } = context;\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst [ contentStructure ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'content',\n\t\tpostId\n\t);\n\n\tconst [ blocks ] = useEntityBlockEditor( 'postType', postType, {\n\t\tid: postId,\n\t} );\n\n\tconst displayString = useMemo( () => {\n\t\t// Replicates the logic found in getEditedPostContent().\n\t\tlet content;\n\t\tif ( contentStructure instanceof Function ) {\n\t\t\tcontent = contentStructure( { blocks } );\n\t\t} else if ( blocks ) {\n\t\t\t// If we have parsed blocks already, they should be our source of truth.\n\t\t\t// Parsing applies block deprecations and legacy block conversions that\n\t\t\t// unparsed content will not have.\n\t\t\tcontent = __unstableSerializeAndClean( blocks );\n\t\t} else {\n\t\t\tcontent = contentStructure;\n\t\t}\n\n\t\t/*\n\t\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t\t * Do not translate into your own language.\n\t\t */\n\t\tconst wordCountType = _x(\n\t\t\t'words',\n\t\t\t'Word count type. Do not translate!'\n\t\t);\n\n\t\tconst totalWords = wordCount( content || '', wordCountType );\n\n\t\t// Add \"time to read\" part, if enabled.\n\t\tif ( displayMode === 'time' ) {\n\t\t\tif ( displayAsRange ) {\n\t\t\t\tlet maxMinutes = Math.max(\n\t\t\t\t\t1,\n\t\t\t\t\tMath.round( ( totalWords / averageReadingSpeed ) * 1.2 )\n\t\t\t\t);\n\t\t\t\tconst minMinutes = Math.max(\n\t\t\t\t\t1,\n\t\t\t\t\tMath.round( ( totalWords / averageReadingSpeed ) * 0.8 )\n\t\t\t\t);\n\n\t\t\t\tif ( minMinutes === maxMinutes ) {\n\t\t\t\t\tmaxMinutes = maxMinutes + 1;\n\t\t\t\t}\n\t\t\t\t// translators: %1$s: minimum minutes, %2$s: maximum minutes to read the post.\n\t\t\t\tconst rangeLabel = _x(\n\t\t\t\t\t'%1$s
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, _x, _n, sprintf } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { useBlockProps, InspectorControls } from '@wordpress/block-editor';\nimport {\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __unstableSerializeAndClean } from '@wordpress/blocks';\nimport { useEntityProp, useEntityBlockEditor } from '@wordpress/core-data';\nimport { count as wordCount } from '@wordpress/wordcount';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nfunction PostTimeToReadEdit( { attributes, setAttributes, context } ) {\n\tconst { displayAsRange, displayMode, averageReadingSpeed } = attributes;\n\tconst { postId, postType } = context;\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst [ contentStructure ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'content',\n\t\tpostId\n\t);\n\n\tconst [ blocks ] = useEntityBlockEditor( 'postType', postType, {\n\t\tid: postId,\n\t} );\n\n\tconst displayString = useMemo( () => {\n\t\t// Replicates the logic found in getEditedPostContent().\n\t\tlet content;\n\t\tif ( contentStructure instanceof Function ) {\n\t\t\tcontent = contentStructure( { blocks } );\n\t\t} else if ( blocks ) {\n\t\t\t// If we have parsed blocks already, they should be our source of truth.\n\t\t\t// Parsing applies block deprecations and legacy block conversions that\n\t\t\t// unparsed content will not have.\n\t\t\tcontent = __unstableSerializeAndClean( blocks );\n\t\t} else {\n\t\t\tcontent = contentStructure;\n\t\t}\n\n\t\t/*\n\t\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t\t * Do not translate into your own language.\n\t\t */\n\t\tconst wordCountType = _x(\n\t\t\t'words',\n\t\t\t'Word count type. Do not translate!'\n\t\t);\n\n\t\tconst totalWords = wordCount( content || '', wordCountType );\n\n\t\t// Add \"time to read\" part, if enabled.\n\t\tif ( displayMode === 'time' ) {\n\t\t\tif ( displayAsRange ) {\n\t\t\t\tlet maxMinutes = Math.max(\n\t\t\t\t\t1,\n\t\t\t\t\tMath.round( ( totalWords / averageReadingSpeed ) * 1.2 )\n\t\t\t\t);\n\t\t\t\tconst minMinutes = Math.max(\n\t\t\t\t\t1,\n\t\t\t\t\tMath.round( ( totalWords / averageReadingSpeed ) * 0.8 )\n\t\t\t\t);\n\n\t\t\t\tif ( minMinutes === maxMinutes ) {\n\t\t\t\t\tmaxMinutes = maxMinutes + 1;\n\t\t\t\t}\n\t\t\t\t// translators: %1$s: minimum minutes, %2$s: maximum minutes to read the post.\n\t\t\t\tconst rangeLabel = _x(\n\t\t\t\t\t'%1$s–%2$s minutes',\n\t\t\t\t\t'Range of minutes to read'\n\t\t\t\t);\n\t\t\t\treturn sprintf( rangeLabel, minMinutes, maxMinutes );\n\t\t\t}\n\t\t\tconst minutesToRead = Math.max(\n\t\t\t\t1,\n\t\t\t\tMath.round( totalWords / averageReadingSpeed )\n\t\t\t);\n\n\t\t\treturn sprintf(\n\t\t\t\t/* translators: %s: the number of minutes to read the post. */\n\t\t\t\t_n( '%s minute', '%s minutes', minutesToRead ),\n\t\t\t\tminutesToRead\n\t\t\t);\n\t\t}\n\n\t\t// Add \"word count\" part, if enabled.\n\t\tif ( displayMode === 'words' ) {\n\t\t\treturn wordCountType === 'words'\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: %s: the number of words in the post. */\n\t\t\t\t\t\t_n( '%s word', '%s words', totalWords ),\n\t\t\t\t\t\ttotalWords.toLocaleString()\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: %s: the number of characters in the post. */\n\t\t\t\t\t\t_n( '%s character', '%s characters', totalWords ),\n\t\t\t\t\t\ttotalWords.toLocaleString()\n\t\t\t\t );\n\t\t}\n\t}, [\n\t\tcontentStructure,\n\t\tblocks,\n\t\tdisplayAsRange,\n\t\tdisplayMode,\n\t\taverageReadingSpeed,\n\t] );\n\n\tconst blockProps = useBlockProps();\n\n\treturn (\n\t\t<>\n\t\t\t{ displayMode === 'time' && (\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<ToolsPanel\n\t\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tdisplayAsRange: true,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t'Display as range',\n\t\t\t\t\t\t\t\t'Turns reading time range display on or off'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\thasValue={ () => ! displayAsRange }\n\t\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tdisplayAsRange: true,\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\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Display as range' ) }\n\t\t\t\t\t\t\t\tchecked={ !! displayAsRange }\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tdisplayAsRange: ! displayAsRange,\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</ToolsPanelItem>\n\t\t\t\t\t</ToolsPanel>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<div { ...blockProps }>{ displayString }</div>\n\t\t</>\n\t);\n}\n\nexport default PostTimeToReadEdit;\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAoC;AACpC,qBAAwB;AACxB,0BAAiD;AACjD,wBAIO;AACP,oBAA4C;AAC5C,uBAAoD;AACpD,uBAAmC;AAKnC,mBAA+C;AAuG7C;AArGF,SAAS,mBAAoB,EAAE,YAAY,eAAe,QAAQ,GAAI;AACrE,QAAM,EAAE,gBAAgB,aAAa,oBAAoB,IAAI;AAC7D,QAAM,EAAE,QAAQ,SAAS,IAAI;AAC7B,QAAM,wBAAoB,6CAA+B;AAEzD,QAAM,CAAE,gBAAiB,QAAI;AAAA,IAC5B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAE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;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAE;AAEF,QAAM,iBAAa,mCAAc;AAEjC,SACC,4EACG;AAAA,oBAAgB,UACjB,4CAAC,yCACA;AAAA,MAAC,kBAAAC;AAAA,MAAA;AAAA,QACA,WAAQ,gBAAI,UAAW;AAAA,QACvB,UAAW,MAAM;AAChB,wBAAe;AAAA,YACd,gBAAgB;AAAA,UACjB,CAAE;AAAA,QACH;AAAA,QACA;AAAA,QAEA;AAAA,UAAC,kBAAAC;AAAA,UAAA;AAAA,YACA,kBAAgB;AAAA,YAChB,WAAQ;AAAA,cACP;AAAA,cACA;AAAA,YACD;AAAA,YACA,UAAW,MAAM,CAAE;AAAA,YACnB,YAAa,MAAM;AAClB,4BAAe;AAAA,gBACd,gBAAgB;AAAA,cACjB,CAAE;AAAA,YACH;AAAA,YAEA;AAAA,cAAC;AAAA;AAAA,gBACA,WAAQ,gBAAI,kBAAmB;AAAA,gBAC/B,SAAU,CAAC,CAAE;AAAA,gBACb,UAAW,MACV,cAAe;AAAA,kBACd,gBAAgB,CAAE;AAAA,gBACnB,CAAE;AAAA;AAAA,YAEJ;AAAA;AAAA,QACD;AAAA;AAAA,IACD,GACD;AAAA,IAED,4CAAC,SAAM,GAAG,YAAe,yBAAe;AAAA,KACzC;AAEF;AAEA,IAAO,eAAQ;",
|
|
6
6
|
"names": ["wordCount", "ToolsPanel", "ToolsPanelItem"]
|
|
7
7
|
}
|
|
@@ -44,7 +44,7 @@ var import_variations = __toESM(require("./variations.cjs"));
|
|
|
44
44
|
var import_deprecated = __toESM(require("./deprecated.cjs"));
|
|
45
45
|
var { name } = import_block.default;
|
|
46
46
|
var settings = {
|
|
47
|
-
icon: import_icons.
|
|
47
|
+
icon: import_icons.time,
|
|
48
48
|
edit: import_edit.default,
|
|
49
49
|
variations: import_variations.default,
|
|
50
50
|
example: {},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/post-time-to-read/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAGA,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { time as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport variations from './variations';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tvariations,\n\texample: {},\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAGA,mBAA6B;AAK7B,wBAAsB;AACtB,mBAAqB;AACrB,kBAAiB;AACjB,wBAAuB;AACvB,wBAAuB;AAEvB,IAAM,EAAE,KAAK,IAAI,aAAAA;AAGV,IAAM,WAAW;AAAA,EACvB,mBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,8BAAAC;AAAA,EACA,SAAS,CAAC;AAAA,EACV,8BAAAC;AACD;AAEO,IAAM,OAAO,UAAM,kBAAAC,SAAW,EAAE,MAAM,uBAAAC,SAAU,SAAS,CAAE;",
|
|
6
6
|
"names": ["metadata", "icon", "edit", "variations", "deprecated", "initBlock", "metadata"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/post-time-to-read/variations.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { time, wordCount } from '@wordpress/icons';\n\nconst variations = [\n\t{\n\t\tname: 'time-to-read',\n\t\ttitle: __( 'Time to Read' ),\n\t\tdescription: __( 'Show minutes required to finish reading the post.' ),\n\t\tattributes: {\n\t\t\tdisplayMode: 'time',\n\t\t},\n\t\tscope: [ 'inserter', 'transform' ],\n\t\tisActive: ( blockAttributes ) =>\n\t\t\tblockAttributes?.displayMode === 'time',\n\t\ticon: time,\n\t\tisDefault: true,\n\t},\n\t{\n\t\tname: 'word-count',\n\t\ttitle: __( 'Word Count' ),\n\t\tdescription: __( 'Show the number of words in the post.' ),\n\t\tattributes: {\n\t\t\tdisplayMode: 'words',\n\t\t},\n\t\tscope: [ 'inserter', 'transform' ],\n\t\tisActive: ( blockAttributes ) =>\n\t\t\tblockAttributes?.displayMode === 'words',\n\t\ticon: wordCount,\n\t},\n];\n\nexport default variations;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,mBAAgC;AAEhC,IAAM,aAAa;AAAA,EAClB;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,cAAe;AAAA,IAC1B,iBAAa,gBAAI,mDAAoD;AAAA,IACrE,YAAY;AAAA,MACX,aAAa;AAAA,IACd;AAAA,IACA,OAAO,CAAE,YAAY,WAAY;AAAA,IACjC,UAAU,CAAE,oBACX,iBAAiB,gBAAgB;AAAA,IAClC,MAAM;AAAA,IACN,WAAW;AAAA,EACZ;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,YAAa;AAAA,IACxB,iBAAa,gBAAI,uCAAwC;AAAA,IACzD,YAAY;AAAA,MACX,aAAa;AAAA,IACd;AAAA,IACA,OAAO,CAAE,YAAY,WAAY;AAAA,IACjC,UAAU,CAAE,oBACX,iBAAiB,gBAAgB;AAAA,IAClC,MAAM;AAAA,EACP;AACD;AAEA,IAAO,qBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -188,7 +188,6 @@ function PostTitleEdit({
|
|
|
188
188
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
189
189
|
import_components.TextControl,
|
|
190
190
|
{
|
|
191
|
-
__next40pxDefaultSize: true,
|
|
192
191
|
label: (0, import_i18n.__)("Link relation"),
|
|
193
192
|
help: (0, import_element.createInterpolateElement)(
|
|
194
193
|
(0, import_i18n.__)(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/post-title/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\tPlainText,\n\tHeadingLevelDropdown,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport {\n\tToggleControl,\n\tTextControl,\n\tExternalLink,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nexport default function PostTitleEdit( {\n\tattributes: { level, levelOptions, isLink, rel, linkTarget, placeholder },\n\tsetAttributes,\n\tcontext: { postType, postId, queryId },\n\tinsertBlocksAfter,\n} ) {\n\tconst TagName = level === 0 ? 'p' : `h${ level }`;\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst userCanEdit = useSelect(\n\t\t( select ) => {\n\t\t\t/**\n\t\t\t * useCanEditEntity may trigger an OPTIONS request to the REST API\n\t\t\t * via the canUser resolver. However, when the Post Title is a\n\t\t\t * descendant of a Query Loop block, the title cannot be edited. In\n\t\t\t * order to avoid these unnecessary requests, we call the hook\n\t\t\t * without the proper data, resulting in returning early without\n\t\t\t * making them.\n\t\t\t */\n\t\t\tif ( isDescendentOfQueryLoop ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn select( coreStore ).canUser( 'update', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: postType,\n\t\t\t\tid: postId,\n\t\t\t} );\n\t\t},\n\t\t[ isDescendentOfQueryLoop, postType, postId ]\n\t);\n\tconst [ rawTitle = '', setTitle, fullTitle ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'title',\n\t\tpostId\n\t);\n\tconst [ link ] = useEntityProp( 'postType', postType, 'link', postId );\n\tconst onSplitAtEnd = () => {\n\t\tinsertBlocksAfter( createBlock( getDefaultBlockName() ) );\n\t};\n\tconst blockProps = useBlockProps();\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tlet titleElement = (\n\t\t<TagName { ...blockProps }>{ placeholder || __( 'Title' ) }</TagName>\n\t);\n\n\tif ( postType && postId ) {\n\t\ttitleElement = userCanEdit ? (\n\t\t\t<PlainText\n\t\t\t\ttagName={ TagName }\n\t\t\t\tplaceholder={ __( '(no title)' ) }\n\t\t\t\tvalue={ rawTitle }\n\t\t\t\tonChange={ setTitle }\n\t\t\t\t__experimentalVersion={ 2 }\n\t\t\t\t__unstableOnSplitAtEnd={ onSplitAtEnd }\n\t\t\t\t{ ...blockProps }\n\t\t\t/>\n\t\t) : (\n\t\t\t<TagName\n\t\t\t\t{ ...blockProps }\n\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t__html: fullTitle?.rendered || __( '(no title)' ),\n\t\t\t\t} }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( isLink && postType && postId ) {\n\t\ttitleElement = userCanEdit ? (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<PlainText\n\t\t\t\t\ttagName=\"a\"\n\t\t\t\t\thref={ link }\n\t\t\t\t\ttarget={ linkTarget }\n\t\t\t\t\trel={ rel }\n\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t! rawTitle.length ? __( '(no title)' ) : null\n\t\t\t\t\t}\n\t\t\t\t\tvalue={ rawTitle }\n\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t__experimentalVersion={ 2 }\n\t\t\t\t\t__unstableOnSplitAtEnd={ onSplitAtEnd }\n\t\t\t\t/>\n\t\t\t</TagName>\n\t\t) : (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<a\n\t\t\t\t\thref={ link }\n\t\t\t\t\ttarget={ linkTarget }\n\t\t\t\t\trel={ rel }\n\t\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t__html: fullTitle?.rendered || __( '(no title)' ),\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</TagName>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ blockEditingMode === 'default' && (\n\t\t\t\t<>\n\t\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t\t<HeadingLevelDropdown\n\t\t\t\t\t\t\tvalue={ level }\n\t\t\t\t\t\t\toptions={ levelOptions }\n\t\t\t\t\t\t\tonChange={ ( newLevel ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { level: newLevel } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t\t<InspectorControls>\n\t\t\t\t\t\t<ToolsPanel\n\t\t\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\trel: '',\n\t\t\t\t\t\t\t\t\tlinkTarget: '_self',\n\t\t\t\t\t\t\t\t\tisLink: false,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Make title a link' ) }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\thasValue={ () => isLink }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { isLink: false } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Make title a link' ) }\n\t\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( { isLink: ! isLink } )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t\t{ isLink && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\t\t\thasValue={ () =>\n\t\t\t\t\t\t\t\t\t\t\tlinkTarget === '_blank'\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\tlinkTarget: '_self',\n\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\t\tlinkTarget: value\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? '_blank'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: '_self',\n\t\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Link relation' ) }\n\t\t\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\t\t\thasValue={ () => !! rel }\n\t\t\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( { rel: '' } )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t\t\t\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAOO;AACP,wBAMO;AACP,kBAAmB;AACnB,oBAAiD;AACjD,uBAAkD;AAClD,kBAA0B;AAC1B,qBAAyC;AAKzC,mBAA+C;AA8C7C;AA5Ca,SAAR,cAAgC;AAAA,EACtC,YAAY,EAAE,OAAO,cAAc,QAAQ,KAAK,YAAY,YAAY;AAAA,EACxE;AAAA,EACA,SAAS,EAAE,UAAU,QAAQ,QAAQ;AAAA,EACrC;AACD,GAAI;AACH,QAAM,UAAU,UAAU,IAAI,MAAM,IAAK,KAAM;AAC/C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,kBAAAA;AAAA,gBAAA;AAAA,kBACA,WAAQ,gBAAI,iBAAkB;AAAA,kBAC9B,kBAAgB;AAAA,kBAChB,UAAW,MACV,eAAe;AAAA,kBAEhB,YAAa,MACZ,cAAe;AAAA,oBACd,YAAY;AAAA,kBACb,CAAE;AAAA,kBAGH;AAAA,oBAAC;AAAA;AAAA,sBACA,WAAQ,gBAAI,iBAAkB;AAAA,sBAC9B,UAAW,CAAE,UACZ,cAAe;AAAA,wBACd,YAAY,QACT,WACA;AAAA,sBACJ,CAAE;AAAA,sBAEH,SAAU,eAAe;AAAA;AAAA,kBAC1B;AAAA;AAAA,cACD;AAAA,cACA;AAAA,gBAAC,kBAAAA;AAAA,gBAAA;AAAA,kBACA,WAAQ,gBAAI,eAAgB;AAAA,kBAC5B,kBAAgB;AAAA,kBAChB,UAAW,MAAM,CAAC,CAAE;AAAA,kBACpB,YAAa,MACZ,cAAe,EAAE,KAAK,GAAG,CAAE;AAAA,kBAG5B;AAAA,oBAAC;AAAA;AAAA,sBACA,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\tPlainText,\n\tHeadingLevelDropdown,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport {\n\tToggleControl,\n\tTextControl,\n\tExternalLink,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nexport default function PostTitleEdit( {\n\tattributes: { level, levelOptions, isLink, rel, linkTarget, placeholder },\n\tsetAttributes,\n\tcontext: { postType, postId, queryId },\n\tinsertBlocksAfter,\n} ) {\n\tconst TagName = level === 0 ? 'p' : `h${ level }`;\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst userCanEdit = useSelect(\n\t\t( select ) => {\n\t\t\t/**\n\t\t\t * useCanEditEntity may trigger an OPTIONS request to the REST API\n\t\t\t * via the canUser resolver. However, when the Post Title is a\n\t\t\t * descendant of a Query Loop block, the title cannot be edited. In\n\t\t\t * order to avoid these unnecessary requests, we call the hook\n\t\t\t * without the proper data, resulting in returning early without\n\t\t\t * making them.\n\t\t\t */\n\t\t\tif ( isDescendentOfQueryLoop ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn select( coreStore ).canUser( 'update', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: postType,\n\t\t\t\tid: postId,\n\t\t\t} );\n\t\t},\n\t\t[ isDescendentOfQueryLoop, postType, postId ]\n\t);\n\tconst [ rawTitle = '', setTitle, fullTitle ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'title',\n\t\tpostId\n\t);\n\tconst [ link ] = useEntityProp( 'postType', postType, 'link', postId );\n\tconst onSplitAtEnd = () => {\n\t\tinsertBlocksAfter( createBlock( getDefaultBlockName() ) );\n\t};\n\tconst blockProps = useBlockProps();\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tlet titleElement = (\n\t\t<TagName { ...blockProps }>{ placeholder || __( 'Title' ) }</TagName>\n\t);\n\n\tif ( postType && postId ) {\n\t\ttitleElement = userCanEdit ? (\n\t\t\t<PlainText\n\t\t\t\ttagName={ TagName }\n\t\t\t\tplaceholder={ __( '(no title)' ) }\n\t\t\t\tvalue={ rawTitle }\n\t\t\t\tonChange={ setTitle }\n\t\t\t\t__experimentalVersion={ 2 }\n\t\t\t\t__unstableOnSplitAtEnd={ onSplitAtEnd }\n\t\t\t\t{ ...blockProps }\n\t\t\t/>\n\t\t) : (\n\t\t\t<TagName\n\t\t\t\t{ ...blockProps }\n\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t__html: fullTitle?.rendered || __( '(no title)' ),\n\t\t\t\t} }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( isLink && postType && postId ) {\n\t\ttitleElement = userCanEdit ? (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<PlainText\n\t\t\t\t\ttagName=\"a\"\n\t\t\t\t\thref={ link }\n\t\t\t\t\ttarget={ linkTarget }\n\t\t\t\t\trel={ rel }\n\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t! rawTitle.length ? __( '(no title)' ) : null\n\t\t\t\t\t}\n\t\t\t\t\tvalue={ rawTitle }\n\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t__experimentalVersion={ 2 }\n\t\t\t\t\t__unstableOnSplitAtEnd={ onSplitAtEnd }\n\t\t\t\t/>\n\t\t\t</TagName>\n\t\t) : (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<a\n\t\t\t\t\thref={ link }\n\t\t\t\t\ttarget={ linkTarget }\n\t\t\t\t\trel={ rel }\n\t\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t__html: fullTitle?.rendered || __( '(no title)' ),\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</TagName>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ blockEditingMode === 'default' && (\n\t\t\t\t<>\n\t\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t\t<HeadingLevelDropdown\n\t\t\t\t\t\t\tvalue={ level }\n\t\t\t\t\t\t\toptions={ levelOptions }\n\t\t\t\t\t\t\tonChange={ ( newLevel ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { level: newLevel } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t\t<InspectorControls>\n\t\t\t\t\t\t<ToolsPanel\n\t\t\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\trel: '',\n\t\t\t\t\t\t\t\t\tlinkTarget: '_self',\n\t\t\t\t\t\t\t\t\tisLink: false,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Make title a link' ) }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\thasValue={ () => isLink }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { isLink: false } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Make title a link' ) }\n\t\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( { isLink: ! isLink } )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t\t{ isLink && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\t\t\thasValue={ () =>\n\t\t\t\t\t\t\t\t\t\t\tlinkTarget === '_blank'\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\tlinkTarget: '_self',\n\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\t\tlinkTarget: value\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? '_blank'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: '_self',\n\t\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Link relation' ) }\n\t\t\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\t\t\thasValue={ () => !! rel }\n\t\t\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( { rel: '' } )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Link relation' ) }\n\t\t\t\t\t\t\t\t\t\t\thelp={ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'The <a>Link Relation</a> attribute defines the relationship between a linked resource and the current document.'\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ExternalLink href=\"https://developer.mozilla.org/docs/Web/HTML/Attributes/rel\" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tvalue={ rel }\n\t\t\t\t\t\t\t\t\t\t\tonChange={ ( newRel ) =>\n\t\t\t\t\t\t\t\t\t\t\t\tsetAttributes( { rel: newRel } )\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</ToolsPanel>\n\t\t\t\t\t</InspectorControls>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ titleElement }\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAOO;AACP,wBAMO;AACP,kBAAmB;AACnB,oBAAiD;AACjD,uBAAkD;AAClD,kBAA0B;AAC1B,qBAAyC;AAKzC,mBAA+C;AA8C7C;AA5Ca,SAAR,cAAgC;AAAA,EACtC,YAAY,EAAE,OAAO,cAAc,QAAQ,KAAK,YAAY,YAAY;AAAA,EACxE;AAAA,EACA,SAAS,EAAE,UAAU,QAAQ,QAAQ;AAAA,EACrC;AACD,GAAI;AACH,QAAM,UAAU,UAAU,IAAI,MAAM,IAAK,KAAM;AAC/C,QAAM,0BAA0B,OAAO,SAAU,OAAQ;AACzD,QAAM,kBAAc;AAAA,IACnB,CAAE,WAAY;AASb,UAAK,yBAA0B;AAC9B,eAAO;AAAA,MACR;AACA,aAAO,OAAQ,iBAAAA,KAAU,EAAE,QAAS,UAAU;AAAA,QAC7C,MAAM;AAAA,QACN,MAAM;AAAA,QACN,IAAI;AAAA,MACL,CAAE;AAAA,IACH;AAAA,IACA,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AW,CAAE,UACZ,cAAe;AAAA,wBACd,YAAY,QACT,WACA;AAAA,sBACJ,CAAE;AAAA,sBAEH,SAAU,eAAe;AAAA;AAAA,kBAC1B;AAAA;AAAA,cACD;AAAA,cACA;AAAA,gBAAC,kBAAAA;AAAA,gBAAA;AAAA,kBACA,WAAQ,gBAAI,eAAgB;AAAA,kBAC5B,kBAAgB;AAAA,kBAChB,UAAW,MAAM,CAAC,CAAE;AAAA,kBACpB,YAAa,MACZ,cAAe,EAAE,KAAK,GAAG,CAAE;AAAA,kBAG5B;AAAA,oBAAC;AAAA;AAAA,sBACA,WAAQ,gBAAI,eAAgB;AAAA,sBAC5B,UAAO;AAAA,4BACN;AAAA,0BACC;AAAA,wBACD;AAAA,wBACA;AAAA,0BACC,GACC,4CAAC,kCAAa,MAAK,8DAA6D;AAAA,wBAElF;AAAA,sBACD;AAAA,sBACA,OAAQ;AAAA,sBACR,UAAW,CAAE,WACZ,cAAe,EAAE,KAAK,OAAO,CAAE;AAAA;AAAA,kBAEjC;AAAA;AAAA,cACD;AAAA,eACD;AAAA;AAAA;AAAA,MAEF,GACD;AAAA,OACD;AAAA,IAEC;AAAA,KACH;AAEF;",
|
|
6
6
|
"names": ["coreStore", "ToolsPanel", "ToolsPanelItem"]
|
|
7
7
|
}
|
|
@@ -51,7 +51,7 @@ function PreformattedEdit({
|
|
|
51
51
|
},
|
|
52
52
|
onRemove,
|
|
53
53
|
"aria-label": (0, import_i18n.__)("Preformatted text"),
|
|
54
|
-
placeholder: (0, import_i18n.__)("Write preformatted text
|
|
54
|
+
placeholder: (0, import_i18n.__)("Write preformatted text…"),
|
|
55
55
|
onMerge: mergeBlocks,
|
|
56
56
|
...blockProps,
|
|
57
57
|
__unstablePastePlainText: true,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/preformatted/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { RichText, useBlockProps } from '@wordpress/block-editor';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\n\nexport default function PreformattedEdit( {\n\tattributes,\n\tmergeBlocks,\n\tsetAttributes,\n\tonRemove,\n\tinsertBlocksAfter,\n\tstyle,\n} ) {\n\tconst { content } = attributes;\n\tconst blockProps = useBlockProps( { style } );\n\n\treturn (\n\t\t<RichText\n\t\t\ttagName=\"pre\"\n\t\t\tidentifier=\"content\"\n\t\t\tpreserveWhiteSpace\n\t\t\tvalue={ content }\n\t\t\tonChange={ ( nextContent ) => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tcontent: nextContent,\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tonRemove={ onRemove }\n\t\t\taria-label={ __( 'Preformatted text' ) }\n\t\t\tplaceholder={ __( 'Write preformatted text
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,0BAAwC;AACxC,oBAAiD;AAc/C;AAZa,SAAR,iBAAmC;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,EAAE,QAAQ,IAAI;AACpB,QAAM,iBAAa,mCAAe,EAAE,MAAM,CAAE;AAE5C,SACC;AAAA,IAAC;AAAA;AAAA,MACA,SAAQ;AAAA,MACR,YAAW;AAAA,MACX,oBAAkB;AAAA,MAClB,OAAQ;AAAA,MACR,UAAW,CAAE,gBAAiB;AAC7B,sBAAe;AAAA,UACd,SAAS;AAAA,QACV,CAAE;AAAA,MACH;AAAA,MACA;AAAA,MACA,kBAAa,gBAAI,mBAAoB;AAAA,MACrC,iBAAc,gBAAI
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { RichText, useBlockProps } from '@wordpress/block-editor';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\n\nexport default function PreformattedEdit( {\n\tattributes,\n\tmergeBlocks,\n\tsetAttributes,\n\tonRemove,\n\tinsertBlocksAfter,\n\tstyle,\n} ) {\n\tconst { content } = attributes;\n\tconst blockProps = useBlockProps( { style } );\n\n\treturn (\n\t\t<RichText\n\t\t\ttagName=\"pre\"\n\t\t\tidentifier=\"content\"\n\t\t\tpreserveWhiteSpace\n\t\t\tvalue={ content }\n\t\t\tonChange={ ( nextContent ) => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tcontent: nextContent,\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tonRemove={ onRemove }\n\t\t\taria-label={ __( 'Preformatted text' ) }\n\t\t\tplaceholder={ __( 'Write preformatted text…' ) }\n\t\t\tonMerge={ mergeBlocks }\n\t\t\t{ ...blockProps }\n\t\t\t__unstablePastePlainText\n\t\t\t__unstableOnSplitAtDoubleLineEnd={ () =>\n\t\t\t\tinsertBlocksAfter( createBlock( getDefaultBlockName() ) )\n\t\t\t}\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,0BAAwC;AACxC,oBAAiD;AAc/C;AAZa,SAAR,iBAAmC;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,EAAE,QAAQ,IAAI;AACpB,QAAM,iBAAa,mCAAe,EAAE,MAAM,CAAE;AAE5C,SACC;AAAA,IAAC;AAAA;AAAA,MACA,SAAQ;AAAA,MACR,YAAW;AAAA,MACX,oBAAkB;AAAA,MAClB,OAAQ;AAAA,MACR,UAAW,CAAE,gBAAiB;AAC7B,sBAAe;AAAA,UACd,SAAS;AAAA,QACV,CAAE;AAAA,MACH;AAAA,MACA;AAAA,MACA,kBAAa,gBAAI,mBAAoB;AAAA,MACrC,iBAAc,gBAAI,0BAA2B;AAAA,MAC7C,SAAU;AAAA,MACR,GAAG;AAAA,MACL,0BAAwB;AAAA,MACxB,kCAAmC,MAClC,sBAAmB,+BAAa,mCAAoB,CAAE,CAAE;AAAA;AAAA,EAE1D;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -18,9 +18,6 @@
|
|
|
18
18
|
"source": "rich-text",
|
|
19
19
|
"selector": "cite",
|
|
20
20
|
"role": "content"
|
|
21
|
-
},
|
|
22
|
-
"textAlign": {
|
|
23
|
-
"type": "string"
|
|
24
21
|
}
|
|
25
22
|
},
|
|
26
23
|
"supports": {
|
|
@@ -52,6 +49,7 @@
|
|
|
52
49
|
"typography": {
|
|
53
50
|
"fontSize": true,
|
|
54
51
|
"lineHeight": true,
|
|
52
|
+
"textAlign": true,
|
|
55
53
|
"__experimentalFontFamily": true,
|
|
56
54
|
"__experimentalFontWeight": true,
|
|
57
55
|
"__experimentalFontStyle": true,
|