@wordpress/block-library 5.0.1 → 6.0.1
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 +6 -0
- package/README.md +1 -1
- package/build/audio/edit.js +2 -2
- package/build/audio/edit.js.map +1 -1
- package/build/audio/edit.native.js +2 -2
- package/build/audio/edit.native.js.map +1 -1
- package/build/button/edit.js +97 -87
- package/build/button/edit.js.map +1 -1
- package/build/button/edit.native.js +1 -1
- package/build/button/edit.native.js.map +1 -1
- package/build/button/index.js +4 -1
- package/build/button/index.js.map +1 -1
- package/build/buttons/edit.js +2 -1
- package/build/buttons/edit.js.map +1 -1
- package/build/buttons/index.js +2 -1
- package/build/buttons/index.js.map +1 -1
- package/build/buttons/transforms.js +2 -1
- package/build/buttons/transforms.js.map +1 -1
- package/build/column/index.js +4 -1
- package/build/column/index.js.map +1 -1
- package/build/column/save.js +9 -1
- package/build/column/save.js.map +1 -1
- package/build/columns/edit.native.js +5 -2
- package/build/columns/edit.native.js.map +1 -1
- package/build/columns/index.js +10 -1
- package/build/columns/index.js.map +1 -1
- package/build/cover/deprecated.js +0 -27
- package/build/cover/deprecated.js.map +1 -1
- package/build/cover/edit.js +57 -27
- package/build/cover/edit.js.map +1 -1
- package/build/cover/index.js +11 -1
- package/build/cover/index.js.map +1 -1
- package/build/cover/save.js +2 -1
- package/build/cover/save.js.map +1 -1
- package/build/cover/shared.js +1 -0
- package/build/cover/shared.js.map +1 -1
- package/build/cover/transforms.js +4 -0
- package/build/cover/transforms.js.map +1 -1
- package/build/embed/edit.js +1 -5
- package/build/embed/edit.js.map +1 -1
- package/build/embed/edit.native.js +85 -22
- package/build/embed/edit.native.js.map +1 -1
- package/build/embed/embed-bottom-sheet.native.js +17 -16
- package/build/embed/embed-bottom-sheet.native.js.map +1 -1
- package/build/embed/embed-controls.js +4 -1
- package/build/embed/embed-controls.js.map +1 -1
- package/build/embed/embed-no-preview.native.js +22 -9
- package/build/embed/embed-no-preview.native.js.map +1 -1
- package/build/embed/embed-placeholder.native.js +51 -7
- package/build/embed/embed-placeholder.native.js.map +1 -1
- package/build/embed/embed-preview.native.js +28 -10
- package/build/embed/embed-preview.native.js.map +1 -1
- package/build/embed/variations.js +0 -10
- package/build/embed/variations.js.map +1 -1
- package/build/embed/wp-embed-preview.js +44 -56
- package/build/embed/wp-embed-preview.js.map +1 -1
- package/build/embed/wp-embed-preview.native.js +95 -0
- package/build/embed/wp-embed-preview.native.js.map +1 -0
- package/build/file/deprecated.js +108 -0
- package/build/file/deprecated.js.map +1 -0
- package/build/file/edit.js +8 -1
- package/build/file/edit.js.map +1 -1
- package/build/file/index.js +9 -0
- package/build/file/index.js.map +1 -1
- package/build/file/inspector.js +1 -1
- package/build/file/inspector.js.map +1 -1
- package/build/file/save.js +4 -1
- package/build/file/save.js.map +1 -1
- package/build/file/transforms.js +3 -1
- package/build/file/transforms.js.map +1 -1
- package/build/gallery/constants.js +2 -2
- package/build/gallery/constants.js.map +1 -1
- package/build/gallery/deprecated.js +17 -8
- package/build/gallery/deprecated.js.map +1 -1
- package/build/gallery/edit-wrapper.js +63 -0
- package/build/gallery/edit-wrapper.js.map +1 -0
- package/build/gallery/edit.js +225 -231
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/gallery.js +67 -49
- package/build/gallery/gallery.js.map +1 -1
- package/build/gallery/gallery.native.js +42 -79
- package/build/gallery/gallery.native.js.map +1 -1
- package/build/gallery/index.js +31 -7
- package/build/gallery/index.js.map +1 -1
- package/build/gallery/save.js +26 -43
- package/build/gallery/save.js.map +1 -1
- package/build/gallery/shared.js +9 -2
- package/build/gallery/shared.js.map +1 -1
- package/build/gallery/transforms.js +211 -12
- package/build/gallery/transforms.js.map +1 -1
- package/build/gallery/use-get-media.js +58 -0
- package/build/gallery/use-get-media.js.map +1 -0
- package/build/gallery/use-get-new-images.js +58 -0
- package/build/gallery/use-get-new-images.js.map +1 -0
- package/build/gallery/use-image-sizes.js +73 -0
- package/build/gallery/use-image-sizes.js.map +1 -0
- package/build/gallery/use-short-code-transform.js +63 -0
- package/build/gallery/use-short-code-transform.js.map +1 -0
- package/build/gallery/utils.js +51 -0
- package/build/gallery/utils.js.map +1 -0
- package/build/gallery/v1/constants.js +13 -0
- package/build/gallery/v1/constants.js.map +1 -0
- package/build/gallery/v1/edit.js +459 -0
- package/build/gallery/v1/edit.js.map +1 -0
- package/build/gallery/{gallery-button.native.js → v1/gallery-button.native.js} +0 -0
- package/build/gallery/v1/gallery-button.native.js.map +1 -0
- package/build/gallery/{gallery-image.js → v1/gallery-image.js} +0 -0
- package/build/gallery/v1/gallery-image.js.map +1 -0
- package/build/gallery/{gallery-image.native.js → v1/gallery-image.native.js} +0 -0
- package/build/gallery/v1/gallery-image.native.js.map +1 -0
- package/build/gallery/v1/gallery.js +122 -0
- package/build/gallery/v1/gallery.js.map +1 -0
- package/build/gallery/v1/gallery.native.js +159 -0
- package/build/gallery/v1/gallery.native.js.map +1 -0
- package/build/gallery/v1/save.js +75 -0
- package/build/gallery/v1/save.js.map +1 -0
- package/build/gallery/v1/shared.js +26 -0
- package/build/gallery/v1/shared.js.map +1 -0
- package/build/gallery/{tiles.native.js → v1/tiles.native.js} +2 -1
- package/build/gallery/v1/tiles.native.js.map +1 -0
- package/build/gallery/v1/update-gallery-modal.js +110 -0
- package/build/gallery/v1/update-gallery-modal.js.map +1 -0
- package/build/group/edit.js +21 -5
- package/build/group/edit.js.map +1 -1
- package/build/group/index.js +8 -2
- package/build/group/index.js.map +1 -1
- package/build/group/variations.js +31 -0
- package/build/group/variations.js.map +1 -0
- package/build/heading/heading-level-dropdown.js +11 -37
- package/build/heading/heading-level-dropdown.js.map +1 -1
- package/build/home-link/edit.js +2 -2
- package/build/home-link/edit.js.map +1 -1
- package/build/image/edit.js +8 -6
- package/build/image/edit.js.map +1 -1
- package/build/image/edit.native.js +46 -17
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +11 -17
- package/build/image/image.js.map +1 -1
- package/build/image/index.js +1 -0
- package/build/image/index.js.map +1 -1
- package/build/image/transforms.js +30 -7
- package/build/image/transforms.js.map +1 -1
- package/build/image/utils.js +23 -0
- package/build/image/utils.js.map +1 -1
- package/build/index.js +3 -1
- package/build/index.js.map +1 -1
- package/build/latest-comments/edit.js +7 -1
- package/build/latest-comments/edit.js.map +1 -1
- package/build/latest-posts/edit.native.js +12 -6
- package/build/latest-posts/edit.native.js.map +1 -1
- package/build/media-text/edit.js +1 -1
- package/build/media-text/edit.js.map +1 -1
- package/build/media-text/index.js +2 -0
- package/build/media-text/index.js.map +1 -1
- package/build/navigation/block-navigation-list.js +14 -3
- package/build/navigation/block-navigation-list.js.map +1 -1
- package/build/navigation/edit.js +44 -14
- package/build/navigation/edit.js.map +1 -1
- package/build/navigation/index.js +7 -1
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/menu-items-to-blocks.js +6 -5
- package/build/navigation/menu-items-to-blocks.js.map +1 -1
- package/build/navigation/placeholder-preview.js +3 -3
- package/build/navigation/placeholder-preview.js.map +1 -1
- package/build/navigation/placeholder.js +1 -1
- package/build/navigation/placeholder.js.map +1 -1
- package/build/navigation/use-block-navigator.js +2 -1
- package/build/navigation/use-block-navigator.js.map +1 -1
- package/build/navigation/variations.js +2 -3
- package/build/navigation/variations.js.map +1 -1
- package/build/navigation/view.js +53 -1
- package/build/navigation/view.js.map +1 -1
- package/build/navigation-link/edit.js +56 -72
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-link/index.js +6 -2
- package/build/navigation-link/index.js.map +1 -1
- package/build/navigation-link/transforms.js +83 -0
- package/build/navigation-link/transforms.js.map +1 -0
- package/build/navigation-submenu/edit.js +651 -0
- package/build/navigation-submenu/edit.js.map +1 -0
- package/build/navigation-submenu/icons.js +27 -0
- package/build/navigation-submenu/icons.js.map +1 -0
- package/build/navigation-submenu/index.js +89 -0
- package/build/navigation-submenu/index.js.map +1 -0
- package/build/navigation-submenu/save.js +18 -0
- package/build/navigation-submenu/save.js.map +1 -0
- package/build/navigation-submenu/transforms.js +82 -0
- package/build/navigation-submenu/transforms.js.map +1 -0
- package/build/navigation-submenu/view.js +51 -0
- package/build/navigation-submenu/view.js.map +1 -0
- package/build/page-list/convert-to-links-modal.js +19 -1
- package/build/page-list/convert-to-links-modal.js.map +1 -1
- package/build/page-list/edit.js +16 -5
- package/build/page-list/edit.js.map +1 -1
- package/build/page-list/index.js +10 -1
- package/build/page-list/index.js.map +1 -1
- package/build/post-author/index.js +2 -1
- package/build/post-author/index.js.map +1 -1
- package/build/post-comment/edit.js +7 -4
- package/build/post-comment/edit.js.map +1 -1
- package/build/post-comment-author/edit.js +1 -1
- package/build/post-comment-author/edit.js.map +1 -1
- package/build/post-comment-content/edit.js +16 -12
- package/build/post-comment-content/edit.js.map +1 -1
- package/build/post-content/edit.js +1 -3
- package/build/post-content/edit.js.map +1 -1
- package/build/post-date/edit.js +35 -14
- package/build/post-date/edit.js.map +1 -1
- package/build/post-date/index.js +2 -1
- package/build/post-date/index.js.map +1 -1
- package/build/post-excerpt/edit.js +2 -1
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-featured-image/dimension-controls.js +24 -10
- package/build/post-featured-image/dimension-controls.js.map +1 -1
- package/build/post-featured-image/index.js +5 -0
- package/build/post-featured-image/index.js.map +1 -1
- package/build/post-navigation-link/edit.js +19 -3
- package/build/post-navigation-link/edit.js.map +1 -1
- package/build/post-navigation-link/index.js +9 -1
- package/build/post-navigation-link/index.js.map +1 -1
- package/build/post-template/index.js +5 -2
- package/build/post-template/index.js.map +1 -1
- package/build/post-terms/edit.js +4 -2
- package/build/post-terms/edit.js.map +1 -1
- package/build/post-terms/index.js +2 -1
- package/build/post-terms/index.js.map +1 -1
- package/build/post-title/edit.js +3 -3
- package/build/post-title/edit.js.map +1 -1
- package/build/post-title/index.js +4 -1
- package/build/post-title/index.js.map +1 -1
- package/build/query/edit/index.js +3 -1
- package/build/query/edit/index.js.map +1 -1
- package/build/query/variations.js +4 -4
- package/build/query/variations.js.map +1 -1
- package/build/query-pagination/deprecated.js +24 -0
- package/build/query-pagination/deprecated.js.map +1 -0
- package/build/query-pagination/edit.js +54 -3
- package/build/query-pagination/edit.js.map +1 -1
- package/build/query-pagination/index.js +20 -1
- package/build/query-pagination/index.js.map +1 -1
- package/build/query-pagination/query-pagination-arrow-controls.js +38 -0
- package/build/query-pagination/query-pagination-arrow-controls.js.map +1 -0
- package/build/query-pagination/save.js +1 -1
- package/build/query-pagination/save.js.map +1 -1
- package/build/query-pagination-next/edit.js +19 -4
- package/build/query-pagination-next/edit.js.map +1 -1
- package/build/query-pagination-next/index.js +1 -1
- package/build/query-pagination-previous/edit.js +19 -4
- package/build/query-pagination-previous/edit.js.map +1 -1
- package/build/query-pagination-previous/index.js +1 -1
- package/build/site-logo/edit.js +75 -30
- package/build/site-logo/edit.js.map +1 -1
- package/build/site-logo/index.js +7 -2
- package/build/site-logo/index.js.map +1 -1
- package/build/site-tagline/index.js +1 -0
- package/build/site-tagline/index.js.map +1 -1
- package/build/site-title/edit/index.js +25 -6
- package/build/site-title/edit/index.js.map +1 -1
- package/build/site-title/index.js +9 -2
- package/build/site-title/index.js.map +1 -1
- package/build/social-links/deprecated.js +106 -2
- package/build/social-links/deprecated.js.map +1 -1
- package/build/social-links/edit.js +15 -19
- package/build/social-links/edit.js.map +1 -1
- package/build/social-links/index.js +16 -1
- package/build/social-links/index.js.map +1 -1
- package/build/social-links/save.js +1 -3
- package/build/social-links/save.js.map +1 -1
- package/build/table/index.js +1 -1
- package/build/template-part/edit/advanced-controls.js +3 -1
- package/build/template-part/edit/advanced-controls.js.map +1 -1
- package/build/template-part/edit/index.js +1 -4
- package/build/template-part/edit/index.js.map +1 -1
- package/build/video/edit-common-settings.js +1 -1
- package/build/video/edit-common-settings.js.map +1 -1
- package/build/video/edit.js +10 -5
- package/build/video/edit.js.map +1 -1
- package/build/video/tracks-editor.js +3 -1
- package/build/video/tracks-editor.js.map +1 -1
- package/build-module/audio/edit.js +3 -3
- package/build-module/audio/edit.js.map +1 -1
- package/build-module/audio/edit.native.js +3 -3
- package/build-module/audio/edit.native.js.map +1 -1
- package/build-module/button/edit.js +101 -91
- package/build-module/button/edit.js.map +1 -1
- package/build-module/button/edit.native.js +2 -2
- package/build-module/button/edit.native.js.map +1 -1
- package/build-module/button/index.js +4 -1
- package/build-module/button/index.js.map +1 -1
- package/build-module/buttons/edit.js +2 -1
- package/build-module/buttons/edit.js.map +1 -1
- package/build-module/buttons/index.js +2 -1
- package/build-module/buttons/index.js.map +1 -1
- package/build-module/buttons/transforms.js +2 -1
- package/build-module/buttons/transforms.js.map +1 -1
- package/build-module/column/index.js +4 -1
- package/build-module/column/index.js.map +1 -1
- package/build-module/column/save.js +9 -1
- package/build-module/column/save.js.map +1 -1
- package/build-module/columns/edit.native.js +6 -3
- package/build-module/columns/edit.native.js.map +1 -1
- package/build-module/columns/index.js +10 -1
- package/build-module/columns/index.js.map +1 -1
- package/build-module/cover/deprecated.js +0 -27
- package/build-module/cover/deprecated.js.map +1 -1
- package/build-module/cover/edit.js +57 -28
- package/build-module/cover/edit.js.map +1 -1
- package/build-module/cover/index.js +11 -1
- package/build-module/cover/index.js.map +1 -1
- package/build-module/cover/save.js +2 -1
- package/build-module/cover/save.js.map +1 -1
- package/build-module/cover/shared.js +1 -0
- package/build-module/cover/shared.js.map +1 -1
- package/build-module/cover/transforms.js +4 -0
- package/build-module/cover/transforms.js.map +1 -1
- package/build-module/embed/edit.js +1 -5
- package/build-module/embed/edit.js.map +1 -1
- package/build-module/embed/edit.native.js +87 -25
- package/build-module/embed/edit.native.js.map +1 -1
- package/build-module/embed/embed-bottom-sheet.native.js +18 -16
- package/build-module/embed/embed-bottom-sheet.native.js.map +1 -1
- package/build-module/embed/embed-controls.js +4 -1
- package/build-module/embed/embed-controls.js.map +1 -1
- package/build-module/embed/embed-no-preview.native.js +22 -10
- package/build-module/embed/embed-no-preview.native.js.map +1 -1
- package/build-module/embed/embed-placeholder.native.js +51 -8
- package/build-module/embed/embed-placeholder.native.js.map +1 -1
- package/build-module/embed/embed-preview.native.js +26 -11
- package/build-module/embed/embed-preview.native.js.map +1 -1
- package/build-module/embed/variations.js +0 -10
- package/build-module/embed/variations.js.map +1 -1
- package/build-module/embed/wp-embed-preview.js +39 -56
- package/build-module/embed/wp-embed-preview.js.map +1 -1
- package/build-module/embed/wp-embed-preview.native.js +83 -0
- package/build-module/embed/wp-embed-preview.native.js.map +1 -0
- package/build-module/file/deprecated.js +98 -0
- package/build-module/file/deprecated.js.map +1 -0
- package/build-module/file/edit.js +8 -1
- package/build-module/file/edit.js.map +1 -1
- package/build-module/file/index.js +8 -0
- package/build-module/file/index.js.map +1 -1
- package/build-module/file/inspector.js +1 -1
- package/build-module/file/inspector.js.map +1 -1
- package/build-module/file/save.js +4 -1
- package/build-module/file/save.js.map +1 -1
- package/build-module/file/transforms.js +2 -1
- package/build-module/file/transforms.js.map +1 -1
- package/build-module/gallery/constants.js +2 -2
- package/build-module/gallery/constants.js.map +1 -1
- package/build-module/gallery/deprecated.js +15 -7
- package/build-module/gallery/deprecated.js.map +1 -1
- package/build-module/gallery/edit-wrapper.js +50 -0
- package/build-module/gallery/edit-wrapper.js.map +1 -0
- package/build-module/gallery/edit.js +222 -234
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/gallery.js +70 -51
- package/build-module/gallery/gallery.js.map +1 -1
- package/build-module/gallery/gallery.native.js +43 -78
- package/build-module/gallery/gallery.native.js.map +1 -1
- package/build-module/gallery/index.js +30 -6
- package/build-module/gallery/index.js.map +1 -1
- package/build-module/gallery/save.js +24 -43
- package/build-module/gallery/save.js.map +1 -1
- package/build-module/gallery/shared.js +8 -2
- package/build-module/gallery/shared.js.map +1 -1
- package/build-module/gallery/transforms.js +207 -12
- package/build-module/gallery/transforms.js.map +1 -1
- package/build-module/gallery/use-get-media.js +48 -0
- package/build-module/gallery/use-get-media.js.map +1 -0
- package/build-module/gallery/use-get-new-images.js +50 -0
- package/build-module/gallery/use-get-new-images.js.map +1 -0
- package/build-module/gallery/use-image-sizes.js +64 -0
- package/build-module/gallery/use-image-sizes.js.map +1 -0
- package/build-module/gallery/use-short-code-transform.js +53 -0
- package/build-module/gallery/use-short-code-transform.js.map +1 -0
- package/build-module/gallery/utils.js +42 -0
- package/build-module/gallery/utils.js.map +1 -0
- package/build-module/gallery/v1/constants.js +4 -0
- package/build-module/gallery/v1/constants.js.map +1 -0
- package/build-module/gallery/v1/edit.js +430 -0
- package/build-module/gallery/v1/edit.js.map +1 -0
- package/build-module/gallery/{gallery-button.native.js → v1/gallery-button.native.js} +0 -0
- package/build-module/gallery/v1/gallery-button.native.js.map +1 -0
- package/build-module/gallery/{gallery-image.js → v1/gallery-image.js} +0 -0
- package/build-module/gallery/v1/gallery-image.js.map +1 -0
- package/build-module/gallery/{gallery-image.native.js → v1/gallery-image.native.js} +0 -0
- package/build-module/gallery/v1/gallery-image.native.js.map +1 -0
- package/build-module/gallery/v1/gallery.js +102 -0
- package/build-module/gallery/v1/gallery.js.map +1 -0
- package/build-module/gallery/v1/gallery.native.js +136 -0
- package/build-module/gallery/v1/gallery.native.js.map +1 -0
- package/build-module/gallery/v1/save.js +65 -0
- package/build-module/gallery/v1/save.js.map +1 -0
- package/build-module/gallery/v1/shared.js +16 -0
- package/build-module/gallery/v1/shared.js.map +1 -0
- package/build-module/gallery/{tiles.native.js → v1/tiles.native.js} +2 -1
- package/build-module/gallery/v1/tiles.native.js.map +1 -0
- package/build-module/gallery/v1/update-gallery-modal.js +93 -0
- package/build-module/gallery/v1/update-gallery-modal.js.map +1 -0
- package/build-module/group/edit.js +21 -6
- package/build-module/group/edit.js.map +1 -1
- package/build-module/group/index.js +7 -2
- package/build-module/group/index.js.map +1 -1
- package/build-module/group/variations.js +22 -0
- package/build-module/group/variations.js.map +1 -0
- package/build-module/heading/heading-level-dropdown.js +12 -37
- package/build-module/heading/heading-level-dropdown.js.map +1 -1
- package/build-module/home-link/edit.js +2 -2
- package/build-module/home-link/edit.js.map +1 -1
- package/build-module/image/edit.js +8 -6
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/edit.native.js +48 -19
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +11 -15
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/index.js +1 -0
- package/build-module/image/index.js.map +1 -1
- package/build-module/image/transforms.js +26 -7
- package/build-module/image/transforms.js.map +1 -1
- package/build-module/image/utils.js +22 -1
- package/build-module/image/utils.js.map +1 -1
- package/build-module/index.js +2 -1
- package/build-module/index.js.map +1 -1
- package/build-module/latest-comments/edit.js +7 -1
- package/build-module/latest-comments/edit.js.map +1 -1
- package/build-module/latest-posts/edit.native.js +12 -6
- package/build-module/latest-posts/edit.native.js.map +1 -1
- package/build-module/media-text/edit.js +1 -1
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/media-text/index.js +2 -0
- package/build-module/media-text/index.js.map +1 -1
- package/build-module/navigation/block-navigation-list.js +15 -3
- package/build-module/navigation/block-navigation-list.js.map +1 -1
- package/build-module/navigation/edit.js +45 -15
- package/build-module/navigation/edit.js.map +1 -1
- package/build-module/navigation/index.js +7 -1
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/menu-items-to-blocks.js +6 -5
- package/build-module/navigation/menu-items-to-blocks.js.map +1 -1
- package/build-module/navigation/placeholder-preview.js +3 -3
- package/build-module/navigation/placeholder-preview.js.map +1 -1
- package/build-module/navigation/placeholder.js +1 -1
- package/build-module/navigation/placeholder.js.map +1 -1
- package/build-module/navigation/use-block-navigator.js +2 -1
- package/build-module/navigation/use-block-navigator.js.map +1 -1
- package/build-module/navigation/variations.js +2 -3
- package/build-module/navigation/variations.js.map +1 -1
- package/build-module/navigation/view.js +53 -2
- package/build-module/navigation/view.js.map +1 -1
- package/build-module/navigation-link/edit.js +59 -74
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-link/index.js +5 -2
- package/build-module/navigation-link/index.js.map +1 -1
- package/build-module/navigation-link/transforms.js +74 -0
- package/build-module/navigation-link/transforms.js.map +1 -0
- package/build-module/navigation-submenu/edit.js +628 -0
- package/build-module/navigation-submenu/edit.js.map +1 -0
- package/build-module/navigation-submenu/icons.js +17 -0
- package/build-module/navigation-submenu/icons.js.map +1 -0
- package/build-module/navigation-submenu/index.js +74 -0
- package/build-module/navigation-submenu/index.js.map +1 -0
- package/build-module/navigation-submenu/save.js +10 -0
- package/build-module/navigation-submenu/save.js.map +1 -0
- package/build-module/navigation-submenu/transforms.js +73 -0
- package/build-module/navigation-submenu/transforms.js.map +1 -0
- package/build-module/navigation-submenu/view.js +49 -0
- package/build-module/navigation-submenu/view.js.map +1 -0
- package/build-module/page-list/convert-to-links-modal.js +19 -1
- package/build-module/page-list/convert-to-links-modal.js.map +1 -1
- package/build-module/page-list/edit.js +16 -5
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/page-list/index.js +10 -1
- package/build-module/page-list/index.js.map +1 -1
- package/build-module/post-author/index.js +2 -1
- package/build-module/post-author/index.js.map +1 -1
- package/build-module/post-comment/edit.js +8 -6
- package/build-module/post-comment/edit.js.map +1 -1
- package/build-module/post-comment-author/edit.js +1 -1
- package/build-module/post-comment-author/edit.js.map +1 -1
- package/build-module/post-comment-content/edit.js +16 -13
- package/build-module/post-comment-content/edit.js.map +1 -1
- package/build-module/post-content/edit.js +1 -3
- package/build-module/post-content/edit.js.map +1 -1
- package/build-module/post-date/edit.js +36 -16
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-date/index.js +2 -1
- package/build-module/post-date/index.js.map +1 -1
- package/build-module/post-excerpt/edit.js +2 -1
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/post-featured-image/dimension-controls.js +22 -11
- package/build-module/post-featured-image/dimension-controls.js.map +1 -1
- package/build-module/post-featured-image/index.js +5 -0
- package/build-module/post-featured-image/index.js.map +1 -1
- package/build-module/post-navigation-link/edit.js +19 -3
- package/build-module/post-navigation-link/edit.js.map +1 -1
- package/build-module/post-navigation-link/index.js +9 -1
- package/build-module/post-navigation-link/index.js.map +1 -1
- package/build-module/post-template/index.js +6 -3
- package/build-module/post-template/index.js.map +1 -1
- package/build-module/post-terms/edit.js +5 -3
- package/build-module/post-terms/edit.js.map +1 -1
- package/build-module/post-terms/index.js +2 -1
- package/build-module/post-terms/index.js.map +1 -1
- package/build-module/post-title/edit.js +3 -3
- package/build-module/post-title/edit.js.map +1 -1
- package/build-module/post-title/index.js +4 -1
- package/build-module/post-title/index.js.map +1 -1
- package/build-module/query/edit/index.js +4 -2
- package/build-module/query/edit/index.js.map +1 -1
- package/build-module/query/variations.js +4 -4
- package/build-module/query/variations.js.map +1 -1
- package/build-module/query-pagination/deprecated.js +15 -0
- package/build-module/query-pagination/deprecated.js.map +1 -0
- package/build-module/query-pagination/edit.js +52 -5
- package/build-module/query-pagination/edit.js.map +1 -1
- package/build-module/query-pagination/index.js +19 -1
- package/build-module/query-pagination/index.js.map +1 -1
- package/build-module/query-pagination/query-pagination-arrow-controls.js +29 -0
- package/build-module/query-pagination/query-pagination-arrow-controls.js.map +1 -0
- package/build-module/query-pagination/save.js +2 -2
- package/build-module/query-pagination/save.js.map +1 -1
- package/build-module/query-pagination-next/edit.js +18 -4
- package/build-module/query-pagination-next/edit.js.map +1 -1
- package/build-module/query-pagination-next/index.js +1 -1
- package/build-module/query-pagination-previous/edit.js +18 -4
- package/build-module/query-pagination-previous/edit.js.map +1 -1
- package/build-module/query-pagination-previous/index.js +1 -1
- package/build-module/site-logo/edit.js +79 -34
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/site-logo/index.js +7 -2
- package/build-module/site-logo/index.js.map +1 -1
- package/build-module/site-tagline/index.js +1 -0
- package/build-module/site-tagline/index.js.map +1 -1
- package/build-module/site-title/edit/index.js +25 -7
- package/build-module/site-title/edit/index.js.map +1 -1
- package/build-module/site-title/index.js +9 -2
- package/build-module/site-title/index.js.map +1 -1
- package/build-module/social-links/deprecated.js +106 -2
- package/build-module/social-links/deprecated.js.map +1 -1
- package/build-module/social-links/edit.js +16 -20
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/social-links/index.js +16 -1
- package/build-module/social-links/index.js.map +1 -1
- package/build-module/social-links/save.js +1 -3
- package/build-module/social-links/save.js.map +1 -1
- package/build-module/table/index.js +1 -1
- package/build-module/template-part/edit/advanced-controls.js +4 -2
- package/build-module/template-part/edit/advanced-controls.js.map +1 -1
- package/build-module/template-part/edit/index.js +1 -4
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/video/edit-common-settings.js +2 -2
- package/build-module/video/edit-common-settings.js.map +1 -1
- package/build-module/video/edit.js +10 -5
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/tracks-editor.js +2 -1
- package/build-module/video/tracks-editor.js.map +1 -1
- package/build-style/button/style-rtl.css +1 -1
- package/build-style/button/style.css +1 -1
- package/build-style/columns/editor-rtl.css +2 -2
- package/build-style/columns/editor.css +2 -2
- package/build-style/columns/style-rtl.css +4 -4
- package/build-style/columns/style.css +4 -4
- package/build-style/common-rtl.css +4 -105
- package/build-style/common.css +4 -105
- package/build-style/editor-rtl.css +188 -205
- package/build-style/editor.css +188 -205
- package/build-style/embed/style-rtl.css +1 -0
- package/build-style/embed/style.css +1 -0
- package/build-style/gallery/editor-rtl.css +89 -21
- package/build-style/gallery/editor.css +89 -21
- package/build-style/gallery/style-rtl.css +202 -39
- package/build-style/gallery/style.css +202 -39
- package/build-style/group/theme-rtl.css +1 -3
- package/build-style/group/theme.css +1 -3
- package/build-style/heading/style-rtl.css +8 -0
- package/build-style/heading/style.css +8 -0
- package/build-style/html/editor-rtl.css +12 -11
- package/build-style/html/editor.css +12 -11
- package/build-style/list/style-rtl.css +4 -0
- package/build-style/list/style.css +4 -0
- package/build-style/navigation/editor-rtl.css +12 -7
- package/build-style/navigation/editor.css +12 -7
- package/build-style/navigation/style-rtl.css +140 -134
- package/build-style/navigation/style.css +140 -134
- package/build-style/navigation-link/editor-rtl.css +22 -13
- package/build-style/navigation-link/editor.css +22 -13
- package/build-style/{post-content → navigation-submenu}/editor-rtl.css +29 -8
- package/build-style/{post-content → navigation-submenu}/editor.css +29 -8
- package/build-style/{heading/editor.css → navigation-submenu/style-rtl.css} +13 -7
- package/build-style/{heading/editor-rtl.css → navigation-submenu/style.css} +13 -7
- package/build-style/page-list/editor-rtl.css +8 -0
- package/build-style/page-list/editor.css +8 -0
- package/build-style/page-list/style-rtl.css +2 -8
- package/build-style/page-list/style.css +2 -8
- package/build-style/paragraph/style-rtl.css +5 -1
- package/build-style/paragraph/style.css +5 -1
- package/build-style/post-featured-image/editor-rtl.css +4 -8
- package/build-style/post-featured-image/editor.css +4 -8
- package/build-style/post-featured-image/style-rtl.css +1 -0
- package/build-style/post-featured-image/style.css +1 -0
- package/build-style/post-template/style-rtl.css +2 -0
- package/build-style/post-template/style.css +2 -0
- package/build-style/pullquote/style-rtl.css +1 -0
- package/build-style/pullquote/style.css +1 -0
- package/build-style/query-pagination/editor-rtl.css +2 -5
- package/build-style/query-pagination/editor.css +2 -5
- package/build-style/query-pagination/style-rtl.css +17 -6
- package/build-style/query-pagination/style.css +17 -6
- package/build-style/quote/style-rtl.css +3 -0
- package/build-style/quote/style.css +3 -0
- package/build-style/reset-rtl.css +2 -1
- package/build-style/reset.css +2 -1
- package/build-style/social-links/style-rtl.css +0 -5
- package/build-style/social-links/style.css +0 -5
- package/build-style/style-rtl.css +415 -307
- package/build-style/style.css +415 -307
- package/build-style/theme-rtl.css +1 -11
- package/build-style/theme.css +1 -11
- package/package.json +30 -31
- package/src/audio/edit.js +6 -3
- package/src/audio/edit.native.js +9 -3
- package/src/button/block.json +4 -1
- package/src/button/edit.js +107 -115
- package/src/button/edit.native.js +5 -2
- package/src/button/style.scss +1 -1
- package/src/buttons/block.json +2 -1
- package/src/buttons/edit.js +1 -1
- package/src/column/block.json +4 -1
- package/src/column/save.js +11 -1
- package/src/columns/block.json +8 -1
- package/src/columns/edit.native.js +8 -3
- package/src/columns/editor.scss +2 -2
- package/src/columns/index.js +1 -0
- package/src/columns/style.scss +4 -4
- package/src/common.scss +3 -9
- package/src/cover/block.json +11 -1
- package/src/cover/deprecated.js +0 -27
- package/src/cover/edit.js +82 -32
- package/src/cover/save.js +2 -1
- package/src/cover/shared.js +1 -0
- package/src/cover/transforms.js +4 -2
- package/src/editor.scss +4 -20
- package/src/embed/edit.js +1 -11
- package/src/embed/edit.native.js +120 -32
- package/src/embed/embed-bottom-sheet.native.js +26 -20
- package/src/embed/embed-controls.js +10 -1
- package/src/embed/embed-no-preview.native.js +53 -14
- package/src/embed/embed-placeholder.native.js +58 -9
- package/src/embed/embed-preview.native.js +58 -41
- package/src/embed/style.scss +1 -0
- package/src/embed/styles.native.scss +18 -8
- package/src/embed/variations.js +0 -8
- package/src/embed/wp-embed-preview.js +41 -62
- package/src/embed/wp-embed-preview.native.js +80 -0
- package/src/file/block.json +6 -0
- package/src/file/deprecated.js +123 -0
- package/src/file/edit.js +6 -0
- package/src/file/index.js +2 -0
- package/src/file/inspector.js +12 -10
- package/src/file/save.js +3 -0
- package/src/file/test/__snapshots__/edit.native.js.snap +4 -0
- package/src/file/transforms.js +3 -1
- package/src/gallery/block.json +18 -0
- package/src/gallery/constants.js +2 -2
- package/src/gallery/deprecated.js +15 -7
- package/src/gallery/deprecated.scss +132 -0
- package/src/gallery/edit-wrapper.js +47 -0
- package/src/gallery/edit.js +317 -276
- package/src/gallery/editor.scss +106 -22
- package/src/gallery/gallery-styles.native.scss +4 -2
- package/src/gallery/gallery.js +82 -71
- package/src/gallery/gallery.native.js +49 -85
- package/src/gallery/index.js +12 -6
- package/src/gallery/save.js +20 -60
- package/src/gallery/shared.js +9 -2
- package/src/gallery/style.scss +113 -75
- package/src/gallery/transforms.js +212 -11
- package/src/gallery/use-get-media.js +59 -0
- package/src/gallery/use-get-new-images.js +68 -0
- package/src/gallery/use-image-sizes.js +66 -0
- package/src/gallery/use-short-code-transform.js +52 -0
- package/src/gallery/utils.js +46 -0
- package/src/gallery/v1/constants.js +3 -0
- package/src/gallery/v1/edit.js +509 -0
- package/src/gallery/{gallery-button.native.js → v1/gallery-button.native.js} +0 -0
- package/src/gallery/{gallery-image-style.native.scss → v1/gallery-image-style.native.scss} +0 -0
- package/src/gallery/{gallery-image.js → v1/gallery-image.js} +0 -0
- package/src/gallery/{gallery-image.native.js → v1/gallery-image.native.js} +0 -0
- package/src/gallery/v1/gallery-styles.native.scss +8 -0
- package/src/gallery/v1/gallery.js +119 -0
- package/src/gallery/v1/gallery.native.js +162 -0
- package/src/gallery/v1/save.js +81 -0
- package/src/gallery/v1/shared.js +19 -0
- package/src/gallery/{tiles-styles.native.scss → v1/tiles-styles.native.scss} +0 -0
- package/src/gallery/{tiles.native.js → v1/tiles.native.js} +2 -1
- package/src/gallery/v1/update-gallery-modal.js +97 -0
- package/src/group/block.json +4 -1
- package/src/group/edit.js +31 -7
- package/src/group/index.js +2 -0
- package/src/group/theme.scss +1 -3
- package/src/group/variations.js +18 -0
- package/src/heading/heading-level-dropdown.js +26 -58
- package/src/heading/style.scss +3 -0
- package/src/home-link/edit.js +2 -2
- package/src/home-link/index.php +2 -2
- package/src/html/editor.scss +16 -10
- package/src/image/block.json +1 -0
- package/src/image/edit.js +9 -7
- package/src/image/edit.native.js +75 -35
- package/src/image/image.js +10 -14
- package/src/image/styles.native.scss +5 -0
- package/src/image/transforms.js +32 -9
- package/src/image/utils.js +17 -1
- package/src/index.js +2 -0
- package/src/latest-comments/edit.js +4 -0
- package/src/latest-comments/index.php +2 -1
- package/src/latest-posts/edit.native.js +10 -8
- package/src/list/style.scss +8 -3
- package/src/media-text/edit.js +1 -1
- package/src/media-text/index.js +1 -0
- package/src/navigation/block-navigation-list.js +16 -7
- package/src/navigation/block.json +7 -1
- package/src/navigation/edit.js +60 -17
- package/src/navigation/editor.scss +38 -19
- package/src/navigation/index.php +12 -4
- package/src/navigation/menu-items-to-blocks.js +8 -7
- package/src/navigation/placeholder-preview.js +3 -3
- package/src/navigation/placeholder.js +1 -1
- package/src/navigation/style.scss +191 -145
- package/src/navigation/test/menu-items-to-blocks.js +6 -6
- package/src/navigation/use-block-navigator.js +1 -0
- package/src/navigation/variations.js +2 -3
- package/src/navigation/view.js +74 -4
- package/src/navigation-link/block.json +2 -1
- package/src/navigation-link/edit.js +63 -90
- package/src/navigation-link/editor.scss +30 -15
- package/src/navigation-link/index.js +2 -0
- package/src/navigation-link/index.php +8 -8
- package/src/navigation-link/transforms.js +93 -0
- package/src/navigation-submenu/block.json +65 -0
- package/src/navigation-submenu/edit.js +662 -0
- package/src/navigation-submenu/editor.scss +42 -0
- package/src/navigation-submenu/icons.js +16 -0
- package/src/navigation-submenu/index.js +29 -0
- package/src/navigation-submenu/index.php +299 -0
- package/src/navigation-submenu/save.js +8 -0
- package/src/navigation-submenu/style.scss +20 -0
- package/src/navigation-submenu/transforms.js +58 -0
- package/src/navigation-submenu/view.js +62 -0
- package/src/page-list/block.json +11 -1
- package/src/page-list/convert-to-links-modal.js +20 -0
- package/src/page-list/edit.js +18 -4
- package/src/page-list/editor.scss +14 -0
- package/src/page-list/index.php +48 -12
- package/src/page-list/style.scss +2 -14
- package/src/page-list/test/convert-to-links-modal.js +6 -6
- package/src/paragraph/style.scss +10 -1
- package/src/post-author/block.json +2 -1
- package/src/post-comment/edit.js +14 -7
- package/src/post-comment-author/edit.js +13 -10
- package/src/post-comment-content/edit.js +17 -9
- package/src/post-comment-content/index.php +6 -3
- package/src/post-content/edit.js +1 -3
- package/src/post-date/block.json +2 -1
- package/src/post-date/edit.js +36 -22
- package/src/post-excerpt/edit.js +1 -0
- package/src/post-featured-image/block.json +5 -0
- package/src/post-featured-image/dimension-controls.js +43 -35
- package/src/post-featured-image/editor.scss +4 -9
- package/src/post-featured-image/style.scss +1 -0
- package/src/post-navigation-link/block.json +9 -1
- package/src/post-navigation-link/edit.js +29 -2
- package/src/post-navigation-link/index.php +28 -3
- package/src/post-template/block.json +4 -1
- package/src/post-template/index.js +2 -2
- package/src/post-template/index.php +11 -0
- package/src/post-template/style.scss +2 -0
- package/src/post-terms/block.json +2 -1
- package/src/post-terms/edit.js +4 -5
- package/src/post-title/block.json +4 -1
- package/src/post-title/edit.js +4 -6
- package/src/post-title/index.php +1 -1
- package/src/pullquote/style.scss +1 -0
- package/src/query/edit/index.js +3 -3
- package/src/query/variations.js +4 -0
- package/src/query-pagination/block.json +16 -0
- package/src/query-pagination/deprecated.js +19 -0
- package/src/query-pagination/edit.js +58 -3
- package/src/query-pagination/editor.scss +3 -6
- package/src/query-pagination/index.js +2 -0
- package/src/query-pagination/index.php +24 -1
- package/src/query-pagination/query-pagination-arrow-controls.js +44 -0
- package/src/query-pagination/save.js +2 -6
- package/src/query-pagination/style.scss +22 -5
- package/src/query-pagination-next/block.json +1 -1
- package/src/query-pagination-next/edit.js +30 -8
- package/src/query-pagination-next/index.php +5 -1
- package/src/query-pagination-previous/block.json +1 -1
- package/src/query-pagination-previous/edit.js +30 -8
- package/src/query-pagination-previous/index.php +5 -1
- package/src/quote/style.scss +2 -0
- package/src/reset.scss +2 -1
- package/src/search/index.php +12 -15
- package/src/search/test/__snapshots__/edit.native.js.snap +7 -0
- package/src/site-logo/block.json +7 -2
- package/src/site-logo/edit.js +98 -30
- package/src/site-logo/index.php +31 -2
- package/src/site-tagline/block.json +1 -0
- package/src/site-title/block.json +9 -2
- package/src/site-title/edit/index.js +36 -9
- package/src/site-title/index.php +12 -2
- package/src/social-links/block.json +22 -1
- package/src/social-links/deprecated.js +99 -0
- package/src/social-links/edit.js +13 -24
- package/src/social-links/save.js +1 -7
- package/src/social-links/style.scss +0 -8
- package/src/style.scss +1 -5
- package/src/table/block.json +1 -1
- package/src/template-part/edit/advanced-controls.js +3 -3
- package/src/template-part/edit/index.js +0 -3
- package/src/template-part/index.php +1 -1
- package/src/theme.scss +0 -10
- package/src/video/edit-common-settings.js +2 -2
- package/src/video/edit.js +15 -5
- package/src/video/tracks-editor.js +2 -3
- package/build/embed/embed-controls.native.js +0 -32
- package/build/embed/embed-controls.native.js.map +0 -1
- package/build/embed/variations.native.js +0 -10
- package/build/embed/variations.native.js.map +0 -1
- package/build/gallery/gallery-button.native.js.map +0 -1
- package/build/gallery/gallery-image.js.map +0 -1
- package/build/gallery/gallery-image.native.js.map +0 -1
- package/build/gallery/tiles.native.js.map +0 -1
- package/build/image/image-editing/aspect-ratio-dropdown.js +0 -126
- package/build/image/image-editing/aspect-ratio-dropdown.js.map +0 -1
- package/build/image/image-editing/constants.js +0 -16
- package/build/image/image-editing/constants.js.map +0 -1
- package/build/image/image-editing/context.js +0 -59
- package/build/image/image-editing/context.js.map +0 -1
- package/build/image/image-editing/cropper.js +0 -83
- package/build/image/image-editing/cropper.js.map +0 -1
- package/build/image/image-editing/form-controls.js +0 -36
- package/build/image/image-editing/form-controls.js.map +0 -1
- package/build/image/image-editing/index.js +0 -60
- package/build/image/image-editing/index.js.map +0 -1
- package/build/image/image-editing/rotation-button.js +0 -37
- package/build/image/image-editing/rotation-button.js.map +0 -1
- package/build/image/image-editing/use-save-image.js +0 -84
- package/build/image/image-editing/use-save-image.js.map +0 -1
- package/build/image/image-editing/use-transform-image.js +0 -135
- package/build/image/image-editing/use-transform-image.js.map +0 -1
- package/build/image/image-editing/zoom-dropdown.js +0 -55
- package/build/image/image-editing/zoom-dropdown.js.map +0 -1
- package/build-module/embed/embed-controls.native.js +0 -21
- package/build-module/embed/embed-controls.native.js.map +0 -1
- package/build-module/embed/variations.native.js +0 -3
- package/build-module/embed/variations.native.js.map +0 -1
- package/build-module/gallery/gallery-button.native.js.map +0 -1
- package/build-module/gallery/gallery-image.js.map +0 -1
- package/build-module/gallery/gallery-image.native.js.map +0 -1
- package/build-module/gallery/tiles.native.js.map +0 -1
- package/build-module/image/image-editing/aspect-ratio-dropdown.js +0 -115
- package/build-module/image/image-editing/aspect-ratio-dropdown.js.map +0 -1
- package/build-module/image/image-editing/constants.js +0 -7
- package/build-module/image/image-editing/constants.js.map +0 -1
- package/build-module/image/image-editing/context.js +0 -44
- package/build-module/image/image-editing/context.js.map +0 -1
- package/build-module/image/image-editing/cropper.js +0 -69
- package/build-module/image/image-editing/cropper.js.map +0 -1
- package/build-module/image/image-editing/form-controls.js +0 -26
- package/build-module/image/image-editing/form-controls.js.map +0 -1
- package/build-module/image/image-editing/index.js +0 -37
- package/build-module/image/image-editing/index.js.map +0 -1
- package/build-module/image/image-editing/rotation-button.js +0 -26
- package/build-module/image/image-editing/rotation-button.js.map +0 -1
- package/build-module/image/image-editing/use-save-image.js +0 -70
- package/build-module/image/image-editing/use-save-image.js.map +0 -1
- package/build-module/image/image-editing/use-transform-image.js +0 -127
- package/build-module/image/image-editing/use-transform-image.js.map +0 -1
- package/build-module/image/image-editing/zoom-dropdown.js +0 -43
- package/build-module/image/image-editing/zoom-dropdown.js.map +0 -1
- package/src/embed/embed-controls.native.js +0 -23
- package/src/embed/variations.native.js +0 -3
- package/src/heading/editor.scss +0 -20
- package/src/image/image-editing/aspect-ratio-dropdown.js +0 -129
- package/src/image/image-editing/constants.js +0 -6
- package/src/image/image-editing/context.js +0 -56
- package/src/image/image-editing/cropper.js +0 -74
- package/src/image/image-editing/form-controls.js +0 -22
- package/src/image/image-editing/index.js +0 -52
- package/src/image/image-editing/rotation-button.js +0 -24
- package/src/image/image-editing/use-save-image.js +0 -97
- package/src/image/image-editing/use-transform-image.js +0 -162
- package/src/image/image-editing/zoom-dropdown.js +0 -40
- package/src/post-content/editor.scss +0 -11
package/src/embed/edit.native.js
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
5
|
createUpgradedEmbedBlock,
|
|
6
|
+
getClassNames,
|
|
7
|
+
fallback,
|
|
6
8
|
getAttributesFromPreview,
|
|
7
9
|
getEmbedInfoByProvider,
|
|
8
10
|
} from './util';
|
|
@@ -23,7 +25,7 @@ import classnames from 'classnames';
|
|
|
23
25
|
*/
|
|
24
26
|
import { _x } from '@wordpress/i18n';
|
|
25
27
|
import { useState, useEffect } from '@wordpress/element';
|
|
26
|
-
import { useSelect } from '@wordpress/data';
|
|
28
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
27
29
|
import {
|
|
28
30
|
useBlockProps,
|
|
29
31
|
store as blockEditorStore,
|
|
@@ -31,9 +33,18 @@ import {
|
|
|
31
33
|
import { store as coreStore } from '@wordpress/core-data';
|
|
32
34
|
import { View } from '@wordpress/primitives';
|
|
33
35
|
|
|
36
|
+
// The inline preview feature will be released progressible, for this reason
|
|
37
|
+
// the embed will only be considered previewable for the following providers list.
|
|
38
|
+
const PREVIEWABLE_PROVIDERS = [ 'youtube', 'twitter', 'instagram', 'vimeo' ];
|
|
39
|
+
// Some providers are rendering the inline preview as a WordPress embed and
|
|
40
|
+
// are not supported yet, so we need to disallow them with a fixed providers list.
|
|
41
|
+
const NOT_PREVIEWABLE_WP_EMBED_PROVIDERS = [ 'pinterest' ];
|
|
42
|
+
|
|
43
|
+
const WP_EMBED_TYPE = 'wp-embed';
|
|
44
|
+
|
|
34
45
|
const EmbedEdit = ( props ) => {
|
|
35
46
|
const {
|
|
36
|
-
attributes: { providerNameSlug, previewable, responsive, url },
|
|
47
|
+
attributes: { align, providerNameSlug, previewable, responsive, url },
|
|
37
48
|
attributes,
|
|
38
49
|
isSelected,
|
|
39
50
|
onReplace,
|
|
@@ -47,8 +58,8 @@ const EmbedEdit = ( props ) => {
|
|
|
47
58
|
title: _x( 'Embed', 'block title' ),
|
|
48
59
|
icon: embedContentIcon,
|
|
49
60
|
};
|
|
50
|
-
const
|
|
51
|
-
|
|
61
|
+
const embedInfoByProvider = getEmbedInfoByProvider( providerNameSlug );
|
|
62
|
+
const { icon, title } = embedInfoByProvider || defaultEmbedInfo;
|
|
52
63
|
|
|
53
64
|
const { wasBlockJustInserted } = useSelect(
|
|
54
65
|
( select ) => ( {
|
|
@@ -61,13 +72,23 @@ const EmbedEdit = ( props ) => {
|
|
|
61
72
|
const [ isEditingURL, setIsEditingURL ] = useState(
|
|
62
73
|
isSelected && wasBlockJustInserted && ! url
|
|
63
74
|
);
|
|
75
|
+
const [ showEmbedBottomSheet, setShowEmbedBottomSheet ] = useState(
|
|
76
|
+
isEditingURL
|
|
77
|
+
);
|
|
78
|
+
const { invalidateResolution } = useDispatch( coreStore );
|
|
64
79
|
|
|
65
|
-
const {
|
|
80
|
+
const {
|
|
81
|
+
preview,
|
|
82
|
+
fetching,
|
|
83
|
+
themeSupportsResponsive,
|
|
84
|
+
cannotEmbed,
|
|
85
|
+
} = useSelect(
|
|
66
86
|
( select ) => {
|
|
67
87
|
const {
|
|
68
88
|
getEmbedPreview,
|
|
69
89
|
isPreviewEmbedFallback,
|
|
70
90
|
isRequestingEmbedPreview,
|
|
91
|
+
getThemeSupports,
|
|
71
92
|
} = select( coreStore );
|
|
72
93
|
if ( ! url ) {
|
|
73
94
|
return { fetching: false, cannotEmbed: false };
|
|
@@ -97,6 +118,9 @@ const EmbedEdit = ( props ) => {
|
|
|
97
118
|
return {
|
|
98
119
|
preview: validPreview ? embedPreview : undefined,
|
|
99
120
|
fetching: isFetching,
|
|
121
|
+
themeSupportsResponsive: getThemeSupports()[
|
|
122
|
+
'responsive-embeds'
|
|
123
|
+
],
|
|
100
124
|
cannotEmbed: ! validPreview || previewIsFallback,
|
|
101
125
|
};
|
|
102
126
|
},
|
|
@@ -104,22 +128,40 @@ const EmbedEdit = ( props ) => {
|
|
|
104
128
|
);
|
|
105
129
|
|
|
106
130
|
/**
|
|
107
|
-
*
|
|
131
|
+
* Returns the attributes derived from the preview, merged with the current attributes.
|
|
132
|
+
*
|
|
133
|
+
* @param {boolean} ignorePreviousClassName Determines if the previous className attribute should be ignored when merging.
|
|
134
|
+
* @return {Object} Merged attributes.
|
|
108
135
|
*/
|
|
109
|
-
const getMergedAttributes = () => {
|
|
136
|
+
const getMergedAttributes = ( ignorePreviousClassName = false ) => {
|
|
110
137
|
const { allowResponsive, className } = attributes;
|
|
111
138
|
return {
|
|
112
139
|
...attributes,
|
|
113
140
|
...getAttributesFromPreview(
|
|
114
141
|
preview,
|
|
115
142
|
title,
|
|
116
|
-
className,
|
|
143
|
+
ignorePreviousClassName ? undefined : className,
|
|
117
144
|
responsive,
|
|
118
145
|
allowResponsive
|
|
119
146
|
),
|
|
120
147
|
};
|
|
121
148
|
};
|
|
122
149
|
|
|
150
|
+
const toggleResponsive = () => {
|
|
151
|
+
const { allowResponsive, className } = attributes;
|
|
152
|
+
const { html } = preview;
|
|
153
|
+
const newAllowResponsive = ! allowResponsive;
|
|
154
|
+
|
|
155
|
+
setAttributes( {
|
|
156
|
+
allowResponsive: newAllowResponsive,
|
|
157
|
+
className: getClassNames(
|
|
158
|
+
html,
|
|
159
|
+
className,
|
|
160
|
+
responsive && newAllowResponsive
|
|
161
|
+
),
|
|
162
|
+
} );
|
|
163
|
+
};
|
|
164
|
+
|
|
123
165
|
useEffect( () => {
|
|
124
166
|
if ( ! preview?.html || ! cannotEmbed || fetching ) {
|
|
125
167
|
return;
|
|
@@ -134,15 +176,12 @@ const EmbedEdit = ( props ) => {
|
|
|
134
176
|
// Handle incoming preview
|
|
135
177
|
useEffect( () => {
|
|
136
178
|
if ( preview && ! isEditingURL ) {
|
|
137
|
-
//
|
|
138
|
-
//
|
|
139
|
-
// the
|
|
140
|
-
//
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
// that `getMergedAttributes` uses is memoized so that we're not
|
|
144
|
-
// calculating them on every render.
|
|
145
|
-
setAttributes( getMergedAttributes() );
|
|
179
|
+
// When obtaining an incoming preview, we set the attributes derived from
|
|
180
|
+
// the preview data. In this case when getting the merged attributes,
|
|
181
|
+
// we ignore the previous classname because it might not match the expected
|
|
182
|
+
// classes by the new preview.
|
|
183
|
+
setAttributes( getMergedAttributes( true ) );
|
|
184
|
+
|
|
146
185
|
if ( onReplace ) {
|
|
147
186
|
const upgradedBlock = createUpgradedEmbedBlock(
|
|
148
187
|
props,
|
|
@@ -156,6 +195,10 @@ const EmbedEdit = ( props ) => {
|
|
|
156
195
|
}
|
|
157
196
|
}, [ preview, isEditingURL ] );
|
|
158
197
|
|
|
198
|
+
useEffect( () => setShowEmbedBottomSheet( isEditingURL ), [
|
|
199
|
+
isEditingURL,
|
|
200
|
+
] );
|
|
201
|
+
|
|
159
202
|
const blockProps = useBlockProps();
|
|
160
203
|
|
|
161
204
|
if ( fetching ) {
|
|
@@ -167,32 +210,71 @@ const EmbedEdit = ( props ) => {
|
|
|
167
210
|
}
|
|
168
211
|
|
|
169
212
|
const showEmbedPlaceholder = ! preview || cannotEmbed;
|
|
170
|
-
|
|
213
|
+
|
|
214
|
+
// Even though we set attributes that get derived from the preview,
|
|
215
|
+
// we don't access them directly because for the initial render,
|
|
216
|
+
// the `setAttributes` call will not have taken effect. If we're
|
|
217
|
+
// rendering responsive content, setting the responsive classes
|
|
218
|
+
// after the preview has been rendered can result in unwanted
|
|
219
|
+
// clipping or scrollbars. The `getAttributesFromPreview` function
|
|
220
|
+
// that `getMergedAttributes` uses is memoized so that we're not
|
|
221
|
+
// calculating them on every render.
|
|
222
|
+
const {
|
|
223
|
+
type,
|
|
224
|
+
allowResponsive,
|
|
225
|
+
className: classFromPreview,
|
|
226
|
+
} = getMergedAttributes();
|
|
171
227
|
const className = classnames( classFromPreview, props.className );
|
|
172
228
|
|
|
229
|
+
const isProviderPreviewable =
|
|
230
|
+
PREVIEWABLE_PROVIDERS.includes( providerNameSlug ) ||
|
|
231
|
+
// For WordPress embeds, we enable the inline preview for all its providers
|
|
232
|
+
// except the ones that are not supported yet.
|
|
233
|
+
( WP_EMBED_TYPE === type &&
|
|
234
|
+
! NOT_PREVIEWABLE_WP_EMBED_PROVIDERS.includes( providerNameSlug ) );
|
|
235
|
+
|
|
236
|
+
const bottomSheetLabel = WP_EMBED_TYPE === type ? 'WordPress' : title;
|
|
237
|
+
|
|
173
238
|
return (
|
|
174
239
|
<>
|
|
175
240
|
{ showEmbedPlaceholder ? (
|
|
176
|
-
|
|
177
|
-
<
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
label={ title }
|
|
181
|
-
onPress={ ( event ) => {
|
|
182
|
-
onFocus( event );
|
|
183
|
-
setIsEditingURL( true );
|
|
184
|
-
} }
|
|
185
|
-
cannotEmbed={ cannotEmbed }
|
|
241
|
+
<>
|
|
242
|
+
<EmbedControls
|
|
243
|
+
showEditButton={ cannotEmbed }
|
|
244
|
+
switchBackToURLInput={ () => setIsEditingURL( true ) }
|
|
186
245
|
/>
|
|
187
|
-
|
|
246
|
+
<View { ...blockProps }>
|
|
247
|
+
<EmbedPlaceholder
|
|
248
|
+
icon={ icon }
|
|
249
|
+
isSelected={ isSelected }
|
|
250
|
+
label={ title }
|
|
251
|
+
onPress={ ( event ) => {
|
|
252
|
+
onFocus( event );
|
|
253
|
+
setIsEditingURL( true );
|
|
254
|
+
} }
|
|
255
|
+
cannotEmbed={ cannotEmbed }
|
|
256
|
+
fallback={ () => fallback( url, onReplace ) }
|
|
257
|
+
tryAgain={ () => {
|
|
258
|
+
invalidateResolution( 'getEmbedPreview', [
|
|
259
|
+
url,
|
|
260
|
+
] );
|
|
261
|
+
} }
|
|
262
|
+
/>
|
|
263
|
+
</View>
|
|
264
|
+
</>
|
|
188
265
|
) : (
|
|
189
266
|
<>
|
|
190
267
|
<EmbedControls
|
|
191
268
|
showEditButton={ preview && ! cannotEmbed }
|
|
269
|
+
themeSupportsResponsive={ themeSupportsResponsive }
|
|
270
|
+
blockSupportsResponsive={ responsive }
|
|
271
|
+
allowResponsive={ allowResponsive }
|
|
272
|
+
toggleResponsive={ toggleResponsive }
|
|
192
273
|
switchBackToURLInput={ () => setIsEditingURL( true ) }
|
|
193
274
|
/>
|
|
194
275
|
<View { ...blockProps }>
|
|
195
276
|
<EmbedPreview
|
|
277
|
+
align={ align }
|
|
196
278
|
className={ className }
|
|
197
279
|
clientId={ clientId }
|
|
198
280
|
icon={ icon }
|
|
@@ -201,20 +283,26 @@ const EmbedEdit = ( props ) => {
|
|
|
201
283
|
label={ title }
|
|
202
284
|
onFocus={ onFocus }
|
|
203
285
|
preview={ preview }
|
|
286
|
+
isProviderPreviewable={ isProviderPreviewable }
|
|
204
287
|
previewable={ previewable }
|
|
205
288
|
type={ type }
|
|
206
289
|
url={ url }
|
|
290
|
+
isDefaultEmbedInfo={ ! embedInfoByProvider }
|
|
207
291
|
/>
|
|
208
292
|
</View>
|
|
209
293
|
</>
|
|
210
294
|
) }
|
|
211
295
|
<EmbedBottomSheet
|
|
212
296
|
value={ url }
|
|
213
|
-
|
|
214
|
-
|
|
297
|
+
label={ bottomSheetLabel }
|
|
298
|
+
isVisible={ showEmbedBottomSheet }
|
|
299
|
+
onClose={ () => setShowEmbedBottomSheet( false ) }
|
|
215
300
|
onSubmit={ ( value ) => {
|
|
216
|
-
|
|
301
|
+
// The order of the following calls is important, we need to update the URL attribute before changing `isEditingURL`,
|
|
302
|
+
// otherwise the side-effect that potentially replaces the block when updating the local state won't use the new URL
|
|
303
|
+
// for creating the new block.
|
|
217
304
|
setAttributes( { url: value } );
|
|
305
|
+
setIsEditingURL( false );
|
|
218
306
|
} }
|
|
219
307
|
/>
|
|
220
308
|
</>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
4
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
5
5
|
import {
|
|
6
6
|
LinkSettingsNavigation,
|
|
7
7
|
FooterMessageLink,
|
|
@@ -11,28 +11,34 @@ import { useDispatch } from '@wordpress/data';
|
|
|
11
11
|
import { store as noticesStore } from '@wordpress/notices';
|
|
12
12
|
import { useCallback, useState } from '@wordpress/element';
|
|
13
13
|
|
|
14
|
-
const
|
|
15
|
-
url: {
|
|
16
|
-
label: __( 'Embed link' ),
|
|
17
|
-
placeholder: __( 'Add link' ),
|
|
18
|
-
autoFocus: true,
|
|
19
|
-
autoFill: true,
|
|
20
|
-
},
|
|
21
|
-
footer: {
|
|
22
|
-
label: (
|
|
23
|
-
<FooterMessageLink
|
|
24
|
-
href={ __( 'https://wordpress.org/support/article/embeds/' ) }
|
|
25
|
-
value={ __( 'Learn more about embeds' ) }
|
|
26
|
-
/>
|
|
27
|
-
),
|
|
28
|
-
separatorType: 'topFullWidth',
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const EmbedBottomSheet = ( { value, isVisible, onClose, onSubmit } ) => {
|
|
14
|
+
const EmbedBottomSheet = ( { value, label, isVisible, onClose, onSubmit } ) => {
|
|
33
15
|
const [ url, setURL ] = useState( value );
|
|
34
16
|
const { createErrorNotice } = useDispatch( noticesStore );
|
|
35
17
|
|
|
18
|
+
const linkSettingsOptions = {
|
|
19
|
+
url: {
|
|
20
|
+
label: sprintf(
|
|
21
|
+
// translators: %s: embed block variant's label e.g: "Twitter".
|
|
22
|
+
__( '%s link' ),
|
|
23
|
+
label
|
|
24
|
+
),
|
|
25
|
+
placeholder: __( 'Add link' ),
|
|
26
|
+
autoFocus: true,
|
|
27
|
+
autoFill: true,
|
|
28
|
+
},
|
|
29
|
+
footer: {
|
|
30
|
+
label: (
|
|
31
|
+
<FooterMessageLink
|
|
32
|
+
href={ __(
|
|
33
|
+
'https://wordpress.org/support/article/embeds/'
|
|
34
|
+
) }
|
|
35
|
+
value={ __( 'Learn more about embeds' ) }
|
|
36
|
+
/>
|
|
37
|
+
),
|
|
38
|
+
separatorType: 'topFullWidth',
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
|
|
36
42
|
const onDismiss = useCallback( () => {
|
|
37
43
|
if ( url !== '' ) {
|
|
38
44
|
if ( isURL( url ) ) {
|
|
@@ -11,12 +11,21 @@ import {
|
|
|
11
11
|
import { BlockControls, InspectorControls } from '@wordpress/block-editor';
|
|
12
12
|
import { edit } from '@wordpress/icons';
|
|
13
13
|
|
|
14
|
+
function getResponsiveHelp( checked ) {
|
|
15
|
+
return checked
|
|
16
|
+
? __(
|
|
17
|
+
'This embed will preserve its aspect ratio when the browser is resized.'
|
|
18
|
+
)
|
|
19
|
+
: __(
|
|
20
|
+
'This embed may not preserve its aspect ratio when the browser is resized.'
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
14
24
|
const EmbedControls = ( {
|
|
15
25
|
blockSupportsResponsive,
|
|
16
26
|
showEditButton,
|
|
17
27
|
themeSupportsResponsive,
|
|
18
28
|
allowResponsive,
|
|
19
|
-
getResponsiveHelp,
|
|
20
29
|
toggleResponsive,
|
|
21
30
|
switchBackToURLInput,
|
|
22
31
|
} ) => (
|
|
@@ -8,7 +8,7 @@ import { TouchableOpacity, TouchableWithoutFeedback, Text } from 'react-native';
|
|
|
8
8
|
*/
|
|
9
9
|
import { View } from '@wordpress/primitives';
|
|
10
10
|
|
|
11
|
-
import { __ } from '@wordpress/i18n';
|
|
11
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
12
12
|
import { useRef, useState } from '@wordpress/element';
|
|
13
13
|
import { usePreferredColorSchemeStyle } from '@wordpress/compose';
|
|
14
14
|
import { requestPreview } from '@wordpress/react-native-bridge';
|
|
@@ -16,13 +16,21 @@ import { useSelect } from '@wordpress/data';
|
|
|
16
16
|
import { store as editorStore } from '@wordpress/editor';
|
|
17
17
|
import { BottomSheet, Icon, TextControl } from '@wordpress/components';
|
|
18
18
|
import { help } from '@wordpress/icons';
|
|
19
|
+
import { BlockIcon } from '@wordpress/block-editor';
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* Internal dependencies
|
|
22
23
|
*/
|
|
23
24
|
import styles from './styles.scss';
|
|
24
25
|
|
|
25
|
-
const EmbedNoPreview = ( {
|
|
26
|
+
const EmbedNoPreview = ( {
|
|
27
|
+
label,
|
|
28
|
+
icon,
|
|
29
|
+
isSelected,
|
|
30
|
+
onPress,
|
|
31
|
+
previewable,
|
|
32
|
+
isDefaultEmbedInfo,
|
|
33
|
+
} ) => {
|
|
26
34
|
const shouldRequestReview = useRef( false );
|
|
27
35
|
const [ isSheetVisible, setIsSheetVisible ] = useState( false );
|
|
28
36
|
|
|
@@ -38,10 +46,6 @@ const EmbedNoPreview = ( { label, icon, isSelected, onPress } ) => {
|
|
|
38
46
|
styles.embed__label,
|
|
39
47
|
styles[ 'embed__label--dark' ]
|
|
40
48
|
);
|
|
41
|
-
const embedIconStyle = usePreferredColorSchemeStyle(
|
|
42
|
-
styles.embed__icon,
|
|
43
|
-
styles[ 'embed__icon--dark' ]
|
|
44
|
-
);
|
|
45
49
|
const descriptionStyle = usePreferredColorSchemeStyle(
|
|
46
50
|
styles.embed__description,
|
|
47
51
|
styles[ 'embed__description--dark' ]
|
|
@@ -76,11 +80,19 @@ const EmbedNoPreview = ( { label, icon, isSelected, onPress } ) => {
|
|
|
76
80
|
postType === 'page' ? __( 'Preview page' ) : __( 'Preview post' );
|
|
77
81
|
const comingSoonDescription =
|
|
78
82
|
postType === 'page'
|
|
79
|
-
?
|
|
80
|
-
|
|
83
|
+
? sprintf(
|
|
84
|
+
// translators: %s: embed block variant's label e.g: "Twitter".
|
|
85
|
+
__(
|
|
86
|
+
'We’re working hard on adding support for %s previews. In the meantime, you can preview the embedded content on the page.'
|
|
87
|
+
),
|
|
88
|
+
label
|
|
81
89
|
)
|
|
82
|
-
:
|
|
83
|
-
|
|
90
|
+
: sprintf(
|
|
91
|
+
// translators: %s: embed block variant's label e.g: "Twitter".
|
|
92
|
+
__(
|
|
93
|
+
'We’re working hard on adding support for %s previews. In the meantime, you can preview the embedded content on the post.'
|
|
94
|
+
),
|
|
95
|
+
label
|
|
84
96
|
);
|
|
85
97
|
|
|
86
98
|
function onOpenSheet() {
|
|
@@ -109,7 +121,7 @@ const EmbedNoPreview = ( { label, icon, isSelected, onPress } ) => {
|
|
|
109
121
|
onPressContainer();
|
|
110
122
|
}
|
|
111
123
|
|
|
112
|
-
|
|
124
|
+
const embedNoProviderPreview = (
|
|
113
125
|
<>
|
|
114
126
|
<TouchableWithoutFeedback
|
|
115
127
|
accessibilityRole={ 'button' }
|
|
@@ -118,10 +130,14 @@ const EmbedNoPreview = ( { label, icon, isSelected, onPress } ) => {
|
|
|
118
130
|
onPress={ onPressContainer }
|
|
119
131
|
>
|
|
120
132
|
<View style={ containerStyle }>
|
|
121
|
-
<
|
|
133
|
+
<BlockIcon icon={ icon } />
|
|
122
134
|
<Text style={ labelStyle }>{ label }</Text>
|
|
123
135
|
<Text style={ descriptionStyle }>
|
|
124
|
-
{
|
|
136
|
+
{ sprintf(
|
|
137
|
+
// translators: %s: embed block variant's label e.g: "Twitter".
|
|
138
|
+
__( '%s previews not yet available' ),
|
|
139
|
+
label
|
|
140
|
+
) }
|
|
125
141
|
</Text>
|
|
126
142
|
<Text style={ styles.embed__action }>
|
|
127
143
|
{ previewButtonText.toUpperCase() }
|
|
@@ -157,7 +173,15 @@ const EmbedNoPreview = ( { label, icon, isSelected, onPress } ) => {
|
|
|
157
173
|
/>
|
|
158
174
|
</View>
|
|
159
175
|
<Text style={ sheetTitleStyle }>
|
|
160
|
-
{
|
|
176
|
+
{ isDefaultEmbedInfo
|
|
177
|
+
? __( 'Embed block previews are coming soon' )
|
|
178
|
+
: sprintf(
|
|
179
|
+
// translators: %s: embed block variant's label e.g: "Twitter".
|
|
180
|
+
__(
|
|
181
|
+
'%s embed block previews are coming soon'
|
|
182
|
+
),
|
|
183
|
+
label
|
|
184
|
+
) }
|
|
161
185
|
</Text>
|
|
162
186
|
<Text style={ sheetDescriptionStyle }>
|
|
163
187
|
{ comingSoonDescription }
|
|
@@ -181,6 +205,21 @@ const EmbedNoPreview = ( { label, icon, isSelected, onPress } ) => {
|
|
|
181
205
|
</BottomSheet>
|
|
182
206
|
</>
|
|
183
207
|
);
|
|
208
|
+
|
|
209
|
+
return (
|
|
210
|
+
<>
|
|
211
|
+
{ previewable ? (
|
|
212
|
+
embedNoProviderPreview
|
|
213
|
+
) : (
|
|
214
|
+
<View style={ containerStyle }>
|
|
215
|
+
<BlockIcon icon={ icon } />
|
|
216
|
+
<Text style={ labelStyle }>
|
|
217
|
+
{ __( 'No preview available' ) }
|
|
218
|
+
</Text>
|
|
219
|
+
</View>
|
|
220
|
+
) }
|
|
221
|
+
</>
|
|
222
|
+
);
|
|
184
223
|
};
|
|
185
224
|
|
|
186
225
|
export default EmbedNoPreview;
|
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { View, Text, TouchableWithoutFeedback } from 'react-native';
|
|
5
|
+
import { compact } from 'lodash';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* WordPress dependencies
|
|
8
9
|
*/
|
|
9
10
|
import { __ } from '@wordpress/i18n';
|
|
10
11
|
import { usePreferredColorSchemeStyle } from '@wordpress/compose';
|
|
11
|
-
import { Icon } from '@wordpress/components';
|
|
12
|
+
import { Icon, Picker } from '@wordpress/components';
|
|
13
|
+
import { BlockIcon } from '@wordpress/block-editor';
|
|
14
|
+
import { useRef } from '@wordpress/element';
|
|
12
15
|
|
|
13
16
|
/**
|
|
14
17
|
* Internal dependencies
|
|
@@ -22,6 +25,8 @@ const EmbedPlaceholder = ( {
|
|
|
22
25
|
label,
|
|
23
26
|
onPress,
|
|
24
27
|
cannotEmbed,
|
|
28
|
+
fallback,
|
|
29
|
+
tryAgain,
|
|
25
30
|
} ) => {
|
|
26
31
|
const containerStyle = usePreferredColorSchemeStyle(
|
|
27
32
|
styles.embed__container,
|
|
@@ -37,18 +42,54 @@ const EmbedPlaceholder = ( {
|
|
|
37
42
|
styles.embed__action,
|
|
38
43
|
styles[ 'embed__action--dark' ]
|
|
39
44
|
);
|
|
40
|
-
const embedIconStyle = usePreferredColorSchemeStyle(
|
|
41
|
-
styles.embed__icon,
|
|
42
|
-
styles[ 'embed__icon--dark' ]
|
|
43
|
-
);
|
|
44
45
|
const embedIconErrorStyle = styles[ 'embed__icon--error' ];
|
|
45
46
|
|
|
47
|
+
const cannotEmbedMenuPickerRef = useRef();
|
|
48
|
+
|
|
49
|
+
const errorPickerOptions = {
|
|
50
|
+
retry: {
|
|
51
|
+
id: 'retryOption',
|
|
52
|
+
label: __( 'Retry' ),
|
|
53
|
+
value: 'retryOption',
|
|
54
|
+
onSelect: tryAgain,
|
|
55
|
+
},
|
|
56
|
+
convertToLink: {
|
|
57
|
+
id: 'convertToLinkOption',
|
|
58
|
+
label: __( 'Convert to link' ),
|
|
59
|
+
value: 'convertToLinkOption',
|
|
60
|
+
onSelect: fallback,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const options = compact( [
|
|
65
|
+
cannotEmbed && errorPickerOptions.retry,
|
|
66
|
+
cannotEmbed && errorPickerOptions.convertToLink,
|
|
67
|
+
] );
|
|
68
|
+
|
|
69
|
+
function onPickerSelect( value ) {
|
|
70
|
+
const selectedItem = options.find( ( item ) => item.value === value );
|
|
71
|
+
selectedItem.onSelect();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// When the content cannot be embedded the onPress should trigger the Picker instead of the onPress prop.
|
|
75
|
+
function resolveOnPressEvent() {
|
|
76
|
+
if ( cannotEmbed ) {
|
|
77
|
+
cannotEmbedMenuPickerRef.current?.presentPicker();
|
|
78
|
+
} else {
|
|
79
|
+
onPress();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
46
83
|
return (
|
|
47
84
|
<>
|
|
48
85
|
<TouchableWithoutFeedback
|
|
49
86
|
accessibilityRole={ 'button' }
|
|
50
|
-
accessibilityHint={
|
|
51
|
-
|
|
87
|
+
accessibilityHint={
|
|
88
|
+
cannotEmbed
|
|
89
|
+
? __( 'Double tap to view embed options.' )
|
|
90
|
+
: __( 'Double tap to add a link.' )
|
|
91
|
+
}
|
|
92
|
+
onPress={ resolveOnPressEvent }
|
|
52
93
|
disabled={ ! isSelected }
|
|
53
94
|
>
|
|
54
95
|
<View style={ containerStyle }>
|
|
@@ -68,12 +109,20 @@ const EmbedPlaceholder = ( {
|
|
|
68
109
|
{ __( 'Unable to embed media' ) }
|
|
69
110
|
</Text>
|
|
70
111
|
<Text style={ actionStyle }>
|
|
71
|
-
{ __( '
|
|
112
|
+
{ __( 'More options' ) }
|
|
72
113
|
</Text>
|
|
114
|
+
<Picker
|
|
115
|
+
title={ __( 'Embed options' ) }
|
|
116
|
+
ref={ cannotEmbedMenuPickerRef }
|
|
117
|
+
options={ options }
|
|
118
|
+
onChange={ onPickerSelect }
|
|
119
|
+
hideCancelButton
|
|
120
|
+
leftAlign
|
|
121
|
+
/>
|
|
73
122
|
</>
|
|
74
123
|
) : (
|
|
75
124
|
<>
|
|
76
|
-
<
|
|
125
|
+
<BlockIcon icon={ icon } />
|
|
77
126
|
<Text style={ labelStyle }>{ label }</Text>
|
|
78
127
|
<Text style={ actionStyle }>
|
|
79
128
|
{ __( 'ADD LINK' ) }
|