@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
|
@@ -9,19 +9,25 @@ import classnames from 'classnames/dedupe';
|
|
|
9
9
|
* WordPress dependencies
|
|
10
10
|
*/
|
|
11
11
|
import { View } from '@wordpress/primitives';
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
import {
|
|
13
|
+
BlockCaption,
|
|
14
|
+
store as blockEditorStore,
|
|
15
|
+
} from '@wordpress/block-editor';
|
|
14
16
|
import { __, sprintf } from '@wordpress/i18n';
|
|
15
17
|
import { memo, useState } from '@wordpress/element';
|
|
16
18
|
import { SandBox } from '@wordpress/components';
|
|
19
|
+
import { useSelect } from '@wordpress/data';
|
|
17
20
|
|
|
18
21
|
/**
|
|
19
22
|
* Internal dependencies
|
|
20
23
|
*/
|
|
21
24
|
import { getPhotoHtml } from './util';
|
|
22
25
|
import EmbedNoPreview from './embed-no-preview';
|
|
26
|
+
import WpEmbedPreview from './wp-embed-preview';
|
|
27
|
+
import styles from './styles.scss';
|
|
23
28
|
|
|
24
29
|
const EmbedPreview = ( {
|
|
30
|
+
align,
|
|
25
31
|
className,
|
|
26
32
|
clientId,
|
|
27
33
|
icon,
|
|
@@ -31,10 +37,19 @@ const EmbedPreview = ( {
|
|
|
31
37
|
onFocus,
|
|
32
38
|
preview,
|
|
33
39
|
previewable,
|
|
40
|
+
isProviderPreviewable,
|
|
34
41
|
type,
|
|
35
42
|
url,
|
|
43
|
+
isDefaultEmbedInfo,
|
|
36
44
|
} ) => {
|
|
37
45
|
const [ isCaptionSelected, setIsCaptionSelected ] = useState( false );
|
|
46
|
+
const { locale } = useSelect( blockEditorStore ).getSettings();
|
|
47
|
+
|
|
48
|
+
const wrapperStyle = styles[ 'embed-preview__wrapper' ];
|
|
49
|
+
const wrapperAlignStyle =
|
|
50
|
+
styles[ `embed-preview__wrapper--align-${ align }` ];
|
|
51
|
+
const sandboxAlignStyle =
|
|
52
|
+
styles[ `embed-preview__sandbox--align-${ align }` ];
|
|
38
53
|
|
|
39
54
|
function accessibilityLabelCreator( caption ) {
|
|
40
55
|
return isEmpty( caption )
|
|
@@ -77,33 +92,36 @@ const EmbedPreview = ( {
|
|
|
77
92
|
'wp-block-embed__wrapper'
|
|
78
93
|
);
|
|
79
94
|
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
95
|
+
const PreviewContent = 'wp-embed' === type ? WpEmbedPreview : SandBox;
|
|
96
|
+
const embedWrapper = (
|
|
97
|
+
<>
|
|
98
|
+
<TouchableWithoutFeedback
|
|
99
|
+
onPress={ () => {
|
|
100
|
+
if ( onFocus ) {
|
|
101
|
+
onFocus();
|
|
102
|
+
}
|
|
103
|
+
if ( isCaptionSelected ) {
|
|
104
|
+
setIsCaptionSelected( false );
|
|
105
|
+
}
|
|
106
|
+
} }
|
|
107
|
+
>
|
|
108
|
+
<View
|
|
109
|
+
pointerEvents="box-only"
|
|
110
|
+
style={ [ wrapperStyle, wrapperAlignStyle ] }
|
|
93
111
|
>
|
|
94
|
-
<
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
</
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
112
|
+
<PreviewContent
|
|
113
|
+
html={ html }
|
|
114
|
+
lang={ locale }
|
|
115
|
+
title={ iframeTitle }
|
|
116
|
+
type={ sandboxClassnames }
|
|
117
|
+
providerUrl={ providerUrl }
|
|
118
|
+
url={ url }
|
|
119
|
+
containerStyle={ sandboxAlignStyle }
|
|
120
|
+
/>
|
|
121
|
+
</View>
|
|
122
|
+
</TouchableWithoutFeedback>
|
|
123
|
+
</>
|
|
124
|
+
);
|
|
107
125
|
return (
|
|
108
126
|
<TouchableWithoutFeedback
|
|
109
127
|
accessible={ ! isSelected }
|
|
@@ -111,19 +129,18 @@ const EmbedPreview = ( {
|
|
|
111
129
|
disabled={ ! isSelected }
|
|
112
130
|
>
|
|
113
131
|
<View>
|
|
114
|
-
{
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
132
|
+
{ isProviderPreviewable && previewable ? (
|
|
133
|
+
embedWrapper
|
|
134
|
+
) : (
|
|
135
|
+
<EmbedNoPreview
|
|
136
|
+
label={ label }
|
|
137
|
+
icon={ icon }
|
|
138
|
+
isSelected={ isSelected }
|
|
139
|
+
onPress={ () => setIsCaptionSelected( false ) }
|
|
140
|
+
previewable={ previewable }
|
|
141
|
+
isDefaultEmbedInfo={ isDefaultEmbedInfo }
|
|
142
|
+
/>
|
|
143
|
+
) }
|
|
127
144
|
<BlockCaption
|
|
128
145
|
accessibilityLabelCreator={ accessibilityLabelCreator }
|
|
129
146
|
accessible
|
package/src/embed/style.scss
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
.wp-block-embed {
|
|
23
23
|
margin: 0 0 1em 0;
|
|
24
|
+
overflow-wrap: break-word; // Break long strings of text without spaces so they don't overflow the block.
|
|
24
25
|
|
|
25
26
|
// Supply caption styles to embeds, even if the theme hasn't opted in.
|
|
26
27
|
// Reason being: the new markup, figcaptions, are not likely to be styled in the majority of existing themes,
|
|
@@ -19,14 +19,6 @@
|
|
|
19
19
|
background-color: $background-dark-secondary;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
.embed__icon {
|
|
23
|
-
fill: $light-secondary;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.embed__icon--dark {
|
|
27
|
-
fill: $dark-secondary;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
22
|
.embed__icon--error {
|
|
31
23
|
margin-bottom: 6;
|
|
32
24
|
fill: $alert-red;
|
|
@@ -80,6 +72,24 @@
|
|
|
80
72
|
align-items: center;
|
|
81
73
|
}
|
|
82
74
|
|
|
75
|
+
.embed-preview__wrapper {
|
|
76
|
+
flex: 1;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.embed-preview__wrapper--align-left {
|
|
80
|
+
align-items: flex-start;
|
|
81
|
+
}
|
|
82
|
+
.embed-preview__wrapper--align-right {
|
|
83
|
+
align-items: flex-end;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.embed-preview__sandbox--align-left {
|
|
87
|
+
max-width: 360px;
|
|
88
|
+
}
|
|
89
|
+
.embed-preview__sandbox--align-right {
|
|
90
|
+
max-width: 360px;
|
|
91
|
+
}
|
|
92
|
+
|
|
83
93
|
.embed-preview__loading--dark {
|
|
84
94
|
background-color: $background-dark-secondary;
|
|
85
95
|
}
|
package/src/embed/variations.js
CHANGED
|
@@ -205,14 +205,6 @@ const variations = [
|
|
|
205
205
|
],
|
|
206
206
|
attributes: { providerNameSlug: 'kickstarter', responsive: true },
|
|
207
207
|
},
|
|
208
|
-
{
|
|
209
|
-
name: 'meetup-com',
|
|
210
|
-
title: 'Meetup.com',
|
|
211
|
-
icon: embedContentIcon,
|
|
212
|
-
description: __( 'Embed Meetup.com content.' ),
|
|
213
|
-
patterns: [ /^https?:\/\/(www\.)?meetu(\.ps|p\.com)\/.+/i ],
|
|
214
|
-
attributes: { providerNameSlug: 'meetup-com', responsive: true },
|
|
215
|
-
},
|
|
216
208
|
{
|
|
217
209
|
name: 'mixcloud',
|
|
218
210
|
title: 'Mixcloud',
|
|
@@ -1,96 +1,75 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
+
import { useMergeRefs, useFocusableIframe } from '@wordpress/compose';
|
|
4
5
|
import { useRef, useEffect, useMemo } from '@wordpress/element';
|
|
5
6
|
|
|
6
7
|
/** @typedef {import('@wordpress/element').WPSyntheticEvent} WPSyntheticEvent */
|
|
7
8
|
|
|
9
|
+
const attributeMap = {
|
|
10
|
+
class: 'className',
|
|
11
|
+
frameborder: 'frameBorder',
|
|
12
|
+
marginheight: 'marginHeight',
|
|
13
|
+
marginwidth: 'marginWidth',
|
|
14
|
+
};
|
|
15
|
+
|
|
8
16
|
export default function WpEmbedPreview( { html } ) {
|
|
9
17
|
const ref = useRef();
|
|
18
|
+
const props = useMemo( () => {
|
|
19
|
+
const doc = new window.DOMParser().parseFromString( html, 'text/html' );
|
|
20
|
+
const iframe = doc.querySelector( 'iframe' );
|
|
21
|
+
const iframeProps = {};
|
|
22
|
+
|
|
23
|
+
if ( ! iframe ) return iframeProps;
|
|
24
|
+
|
|
25
|
+
Array.from( iframe.attributes ).forEach( ( { name, value } ) => {
|
|
26
|
+
if ( name === 'style' ) return;
|
|
27
|
+
iframeProps[ attributeMap[ name ] || name ] = value;
|
|
28
|
+
} );
|
|
29
|
+
|
|
30
|
+
return iframeProps;
|
|
31
|
+
}, [ html ] );
|
|
10
32
|
|
|
11
33
|
useEffect( () => {
|
|
12
34
|
const { ownerDocument } = ref.current;
|
|
13
35
|
const { defaultView } = ownerDocument;
|
|
14
36
|
|
|
15
37
|
/**
|
|
16
|
-
* Checks for WordPress embed events signaling the height change when
|
|
17
|
-
* content loads or iframe's window is resized. The event is
|
|
18
|
-
* WordPress core via the window.postMessage API.
|
|
38
|
+
* Checks for WordPress embed events signaling the height change when
|
|
39
|
+
* iframe content loads or iframe's window is resized. The event is
|
|
40
|
+
* sent from WordPress core via the window.postMessage API.
|
|
19
41
|
*
|
|
20
42
|
* References:
|
|
21
|
-
* window.postMessage:
|
|
22
|
-
*
|
|
23
|
-
* WordPress core embed-template on
|
|
43
|
+
* window.postMessage:
|
|
44
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
|
|
45
|
+
* WordPress core embed-template on load:
|
|
46
|
+
* https://github.com/WordPress/WordPress/blob/HEAD/wp-includes/js/wp-embed-template.js#L143
|
|
47
|
+
* WordPress core embed-template on resize:
|
|
48
|
+
* https://github.com/WordPress/WordPress/blob/HEAD/wp-includes/js/wp-embed-template.js#L187
|
|
24
49
|
*
|
|
25
|
-
* @param {
|
|
50
|
+
* @param {MessageEvent} event Message event.
|
|
26
51
|
*/
|
|
27
52
|
function resizeWPembeds( { data: { secret, message, value } = {} } ) {
|
|
28
|
-
if (
|
|
29
|
-
[ secret, message, value ].some(
|
|
30
|
-
( attribute ) => ! attribute
|
|
31
|
-
) ||
|
|
32
|
-
message !== 'height'
|
|
33
|
-
) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
ownerDocument
|
|
38
|
-
.querySelectorAll( `iframe[data-secret="${ secret }"` )
|
|
39
|
-
.forEach( ( iframe ) => {
|
|
40
|
-
if ( +iframe.height !== value ) {
|
|
41
|
-
iframe.height = value;
|
|
42
|
-
}
|
|
43
|
-
} );
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Checks whether the wp embed iframe is the activeElement,
|
|
48
|
-
* if it is dispatch a focus event.
|
|
49
|
-
*/
|
|
50
|
-
function checkFocus() {
|
|
51
|
-
const { activeElement } = ownerDocument;
|
|
52
|
-
|
|
53
|
-
if (
|
|
54
|
-
activeElement.tagName !== 'IFRAME' ||
|
|
55
|
-
activeElement.parentNode !== ref.current
|
|
56
|
-
) {
|
|
53
|
+
if ( message !== 'height' || secret !== props[ 'data-secret' ] ) {
|
|
57
54
|
return;
|
|
58
55
|
}
|
|
59
56
|
|
|
60
|
-
|
|
57
|
+
ref.current.height = value;
|
|
61
58
|
}
|
|
62
59
|
|
|
63
60
|
defaultView.addEventListener( 'message', resizeWPembeds );
|
|
64
|
-
defaultView.addEventListener( 'blur', checkFocus );
|
|
65
|
-
|
|
66
61
|
return () => {
|
|
67
62
|
defaultView.removeEventListener( 'message', resizeWPembeds );
|
|
68
|
-
defaultView.removeEventListener( 'blur', checkFocus );
|
|
69
63
|
};
|
|
70
64
|
}, [] );
|
|
71
65
|
|
|
72
|
-
const __html = useMemo( () => {
|
|
73
|
-
const doc = new window.DOMParser().parseFromString( html, 'text/html' );
|
|
74
|
-
const iframe = doc.querySelector( 'iframe' );
|
|
75
|
-
|
|
76
|
-
if ( iframe ) {
|
|
77
|
-
iframe.removeAttribute( 'style' );
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const blockQuote = doc.querySelector( 'blockquote' );
|
|
81
|
-
|
|
82
|
-
if ( blockQuote ) {
|
|
83
|
-
blockQuote.style.display = 'none';
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return doc.body.innerHTML;
|
|
87
|
-
}, [ html ] );
|
|
88
|
-
|
|
89
66
|
return (
|
|
90
|
-
<div
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
67
|
+
<div className="wp-block-embed__wrapper">
|
|
68
|
+
<iframe
|
|
69
|
+
ref={ useMergeRefs( [ ref, useFocusableIframe() ] ) }
|
|
70
|
+
title={ props.title }
|
|
71
|
+
{ ...props }
|
|
72
|
+
/>
|
|
73
|
+
</div>
|
|
95
74
|
);
|
|
96
75
|
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { memo, useMemo } from '@wordpress/element';
|
|
5
|
+
import { SandBox } from '@wordpress/components';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Checks for WordPress embed events signaling the height change when iframe
|
|
9
|
+
* content loads or iframe's window is resized. The event is sent from
|
|
10
|
+
* WordPress core via the window.postMessage API.
|
|
11
|
+
*
|
|
12
|
+
* References:
|
|
13
|
+
* window.postMessage: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
|
|
14
|
+
* WordPress core embed-template on load: https://github.com/WordPress/WordPress/blob/HEAD/wp-includes/js/wp-embed-template.js#L143
|
|
15
|
+
* WordPress core embed-template on resize: https://github.com/WordPress/WordPress/blob/HEAD/wp-includes/js/wp-embed-template.js#L187
|
|
16
|
+
*/
|
|
17
|
+
const observeAndResizeJS = `
|
|
18
|
+
( function() {
|
|
19
|
+
if ( ! document.body || ! window.parent ) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function sendResize( { data: { secret, message, value } = {} } ) {
|
|
24
|
+
if (
|
|
25
|
+
[ secret, message, value ].some(
|
|
26
|
+
( attribute ) => ! attribute
|
|
27
|
+
) ||
|
|
28
|
+
message !== 'height'
|
|
29
|
+
) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
document
|
|
34
|
+
.querySelectorAll( 'iframe[data-secret="' + secret + '"' )
|
|
35
|
+
.forEach( ( iframe ) => {
|
|
36
|
+
if ( +iframe.height !== value ) {
|
|
37
|
+
iframe.height = value;
|
|
38
|
+
}
|
|
39
|
+
} );
|
|
40
|
+
|
|
41
|
+
// The function postMessage is exposed by the react-native-webview library
|
|
42
|
+
// to communicate between React Native and the WebView, in this case,
|
|
43
|
+
// we use it for notifying resize changes.
|
|
44
|
+
window.ReactNativeWebView.postMessage(JSON.stringify( {
|
|
45
|
+
action: 'resize',
|
|
46
|
+
height: value,
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
window.addEventListener( 'message', sendResize );
|
|
51
|
+
} )();`;
|
|
52
|
+
|
|
53
|
+
function WpEmbedPreview( { html, ...rest } ) {
|
|
54
|
+
const wpEmbedHtml = useMemo( () => {
|
|
55
|
+
const doc = new window.DOMParser().parseFromString( html, 'text/html' );
|
|
56
|
+
const iframe = doc.querySelector( 'iframe' );
|
|
57
|
+
|
|
58
|
+
if ( iframe ) {
|
|
59
|
+
iframe.removeAttribute( 'style' );
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const blockQuote = doc.querySelector( 'blockquote' );
|
|
63
|
+
|
|
64
|
+
if ( blockQuote ) {
|
|
65
|
+
blockQuote.innerHTML = '';
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return doc.body.innerHTML;
|
|
69
|
+
}, [ html ] );
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<SandBox
|
|
73
|
+
customJS={ observeAndResizeJS }
|
|
74
|
+
html={ wpEmbedHtml }
|
|
75
|
+
{ ...rest }
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export default memo( WpEmbedPreview );
|
package/src/file/block.json
CHANGED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { RichText, useBlockProps } from '@wordpress/block-editor';
|
|
5
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
6
|
+
|
|
7
|
+
// Version of the file block without PR#28062 accessibility fix.
|
|
8
|
+
const deprecated = [
|
|
9
|
+
{
|
|
10
|
+
attributes: {
|
|
11
|
+
id: {
|
|
12
|
+
type: 'number',
|
|
13
|
+
},
|
|
14
|
+
href: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
},
|
|
17
|
+
fileName: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
source: 'html',
|
|
20
|
+
selector: 'a:not([download])',
|
|
21
|
+
},
|
|
22
|
+
textLinkHref: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
source: 'attribute',
|
|
25
|
+
selector: 'a:not([download])',
|
|
26
|
+
attribute: 'href',
|
|
27
|
+
},
|
|
28
|
+
textLinkTarget: {
|
|
29
|
+
type: 'string',
|
|
30
|
+
source: 'attribute',
|
|
31
|
+
selector: 'a:not([download])',
|
|
32
|
+
attribute: 'target',
|
|
33
|
+
},
|
|
34
|
+
showDownloadButton: {
|
|
35
|
+
type: 'boolean',
|
|
36
|
+
default: true,
|
|
37
|
+
},
|
|
38
|
+
downloadButtonText: {
|
|
39
|
+
type: 'string',
|
|
40
|
+
source: 'html',
|
|
41
|
+
selector: 'a[download]',
|
|
42
|
+
},
|
|
43
|
+
displayPreview: {
|
|
44
|
+
type: 'boolean',
|
|
45
|
+
},
|
|
46
|
+
previewHeight: {
|
|
47
|
+
type: 'number',
|
|
48
|
+
default: 600,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
supports: {
|
|
52
|
+
anchor: true,
|
|
53
|
+
align: true,
|
|
54
|
+
},
|
|
55
|
+
save( { attributes } ) {
|
|
56
|
+
const {
|
|
57
|
+
href,
|
|
58
|
+
fileName,
|
|
59
|
+
textLinkHref,
|
|
60
|
+
textLinkTarget,
|
|
61
|
+
showDownloadButton,
|
|
62
|
+
downloadButtonText,
|
|
63
|
+
displayPreview,
|
|
64
|
+
previewHeight,
|
|
65
|
+
} = attributes;
|
|
66
|
+
|
|
67
|
+
const pdfEmbedLabel = RichText.isEmpty( fileName )
|
|
68
|
+
? __( 'PDF embed' )
|
|
69
|
+
: sprintf(
|
|
70
|
+
/* translators: %s: filename. */
|
|
71
|
+
__( 'Embed of %s.' ),
|
|
72
|
+
fileName
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
href && (
|
|
77
|
+
<div { ...useBlockProps.save() }>
|
|
78
|
+
{ displayPreview && (
|
|
79
|
+
<>
|
|
80
|
+
<object
|
|
81
|
+
className="wp-block-file__embed"
|
|
82
|
+
data={ href }
|
|
83
|
+
type="application/pdf"
|
|
84
|
+
style={ {
|
|
85
|
+
width: '100%',
|
|
86
|
+
height: `${ previewHeight }px`,
|
|
87
|
+
} }
|
|
88
|
+
aria-label={ pdfEmbedLabel }
|
|
89
|
+
/>
|
|
90
|
+
</>
|
|
91
|
+
) }
|
|
92
|
+
{ ! RichText.isEmpty( fileName ) && (
|
|
93
|
+
<a
|
|
94
|
+
href={ textLinkHref }
|
|
95
|
+
target={ textLinkTarget }
|
|
96
|
+
rel={
|
|
97
|
+
textLinkTarget
|
|
98
|
+
? 'noreferrer noopener'
|
|
99
|
+
: undefined
|
|
100
|
+
}
|
|
101
|
+
>
|
|
102
|
+
<RichText.Content value={ fileName } />
|
|
103
|
+
</a>
|
|
104
|
+
) }
|
|
105
|
+
{ showDownloadButton && (
|
|
106
|
+
<a
|
|
107
|
+
href={ href }
|
|
108
|
+
className="wp-block-file__button"
|
|
109
|
+
download={ true }
|
|
110
|
+
>
|
|
111
|
+
<RichText.Content
|
|
112
|
+
value={ downloadButtonText }
|
|
113
|
+
/>
|
|
114
|
+
</a>
|
|
115
|
+
) }
|
|
116
|
+
</div>
|
|
117
|
+
)
|
|
118
|
+
);
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
];
|
|
122
|
+
|
|
123
|
+
export default deprecated;
|
package/src/file/edit.js
CHANGED
|
@@ -65,6 +65,7 @@ function FileEdit( {
|
|
|
65
65
|
setAttributes,
|
|
66
66
|
noticeUI,
|
|
67
67
|
noticeOperations,
|
|
68
|
+
clientId,
|
|
68
69
|
} ) {
|
|
69
70
|
const {
|
|
70
71
|
id,
|
|
@@ -113,6 +114,11 @@ function FileEdit( {
|
|
|
113
114
|
}
|
|
114
115
|
}, [] );
|
|
115
116
|
|
|
117
|
+
useEffect( () => {
|
|
118
|
+
// Add a unique fileId to each file block
|
|
119
|
+
setAttributes( { fileId: `wp-block-file--media-${ clientId }` } );
|
|
120
|
+
}, [ clientId ] );
|
|
121
|
+
|
|
116
122
|
function onSelectFile( newMedia ) {
|
|
117
123
|
if ( newMedia && newMedia.url ) {
|
|
118
124
|
setHasError( false );
|
package/src/file/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import { file as icon } from '@wordpress/icons';
|
|
|
7
7
|
/**
|
|
8
8
|
* Internal dependencies
|
|
9
9
|
*/
|
|
10
|
+
import deprecated from './deprecated';
|
|
10
11
|
import edit from './edit';
|
|
11
12
|
import metadata from './block.json';
|
|
12
13
|
import save from './save';
|
|
@@ -26,6 +27,7 @@ export const settings = {
|
|
|
26
27
|
},
|
|
27
28
|
},
|
|
28
29
|
transforms,
|
|
30
|
+
deprecated,
|
|
29
31
|
edit,
|
|
30
32
|
save,
|
|
31
33
|
};
|
package/src/file/inspector.js
CHANGED
|
@@ -54,16 +54,18 @@ export default function FileBlockInspector( {
|
|
|
54
54
|
checked={ !! displayPreview }
|
|
55
55
|
onChange={ changeDisplayPreview }
|
|
56
56
|
/>
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
57
|
+
{ displayPreview && (
|
|
58
|
+
<RangeControl
|
|
59
|
+
label={ __( 'Height in pixels' ) }
|
|
60
|
+
min={ MIN_PREVIEW_HEIGHT }
|
|
61
|
+
max={ Math.max(
|
|
62
|
+
MAX_PREVIEW_HEIGHT,
|
|
63
|
+
previewHeight
|
|
64
|
+
) }
|
|
65
|
+
value={ previewHeight }
|
|
66
|
+
onChange={ changePreviewHeight }
|
|
67
|
+
/>
|
|
68
|
+
) }
|
|
67
69
|
</PanelBody>
|
|
68
70
|
) }
|
|
69
71
|
<PanelBody title={ __( 'Text link settings' ) }>
|
package/src/file/save.js
CHANGED
|
@@ -7,6 +7,7 @@ import { __, sprintf } from '@wordpress/i18n';
|
|
|
7
7
|
export default function save( { attributes } ) {
|
|
8
8
|
const {
|
|
9
9
|
href,
|
|
10
|
+
fileId,
|
|
10
11
|
fileName,
|
|
11
12
|
textLinkHref,
|
|
12
13
|
textLinkTarget,
|
|
@@ -43,6 +44,7 @@ export default function save( { attributes } ) {
|
|
|
43
44
|
) }
|
|
44
45
|
{ ! RichText.isEmpty( fileName ) && (
|
|
45
46
|
<a
|
|
47
|
+
id={ fileId }
|
|
46
48
|
href={ textLinkHref }
|
|
47
49
|
target={ textLinkTarget }
|
|
48
50
|
rel={
|
|
@@ -57,6 +59,7 @@ export default function save( { attributes } ) {
|
|
|
57
59
|
href={ href }
|
|
58
60
|
className="wp-block-file__button"
|
|
59
61
|
download={ true }
|
|
62
|
+
aria-describedby={ fileId }
|
|
60
63
|
>
|
|
61
64
|
<RichText.Content value={ downloadButtonText } />
|
|
62
65
|
</a>
|
|
@@ -61,6 +61,7 @@ exports[`File block renders file error state without crashing 1`] = `
|
|
|
61
61
|
disableEditingMenu={false}
|
|
62
62
|
focusable={true}
|
|
63
63
|
fontFamily="serif"
|
|
64
|
+
fontSize={16}
|
|
64
65
|
isMultiline={false}
|
|
65
66
|
maxImagesWidth={200}
|
|
66
67
|
onBackspace={[Function]}
|
|
@@ -150,6 +151,7 @@ exports[`File block renders file error state without crashing 1`] = `
|
|
|
150
151
|
disableEditingMenu={false}
|
|
151
152
|
focusable={true}
|
|
152
153
|
fontFamily="serif"
|
|
154
|
+
fontSize={16}
|
|
153
155
|
isMultiline={false}
|
|
154
156
|
maxImagesWidth={200}
|
|
155
157
|
minWidth={40}
|
|
@@ -259,6 +261,7 @@ exports[`File block renders file without crashing 1`] = `
|
|
|
259
261
|
disableEditingMenu={false}
|
|
260
262
|
focusable={true}
|
|
261
263
|
fontFamily="serif"
|
|
264
|
+
fontSize={16}
|
|
262
265
|
isMultiline={false}
|
|
263
266
|
maxImagesWidth={200}
|
|
264
267
|
onBackspace={[Function]}
|
|
@@ -330,6 +333,7 @@ exports[`File block renders file without crashing 1`] = `
|
|
|
330
333
|
disableEditingMenu={false}
|
|
331
334
|
focusable={true}
|
|
332
335
|
fontFamily="serif"
|
|
336
|
+
fontSize={16}
|
|
333
337
|
isMultiline={false}
|
|
334
338
|
maxImagesWidth={200}
|
|
335
339
|
minWidth={40}
|