@wordpress/block-library 6.0.25 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/LICENSE.md +1 -1
- package/build/archives/index.js +1 -0
- package/build/archives/index.js.map +1 -1
- package/build/audio/edit.js +19 -4
- package/build/audio/edit.js.map +1 -1
- package/build/audio/index.js +1 -0
- package/build/audio/index.js.map +1 -1
- package/build/block/index.js +1 -0
- package/build/block/index.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 +5 -1
- package/build/button/index.js.map +1 -1
- package/build/buttons/edit.js +6 -0
- package/build/buttons/edit.js.map +1 -1
- package/build/buttons/edit.native.js +16 -6
- package/build/buttons/edit.native.js.map +1 -1
- package/build/buttons/index.js +1 -0
- package/build/buttons/index.js.map +1 -1
- package/build/buttons/transforms.js +1 -0
- package/build/buttons/transforms.js.map +1 -1
- package/build/calendar/index.js +1 -0
- package/build/calendar/index.js.map +1 -1
- package/build/categories/index.js +1 -0
- package/build/categories/index.js.map +1 -1
- package/build/code/index.js +6 -1
- package/build/code/index.js.map +1 -1
- package/build/column/index.js +1 -0
- package/build/column/index.js.map +1 -1
- package/build/columns/index.js +11 -0
- package/build/columns/index.js.map +1 -1
- package/build/comment-author-avatar/edit.js +5 -2
- package/build/comment-author-avatar/edit.js.map +1 -1
- package/build/comment-author-avatar/index.js +7 -2
- package/build/comment-author-avatar/index.js.map +1 -1
- package/build/comment-author-name/index.js +1 -0
- package/build/comment-author-name/index.js.map +1 -1
- package/build/comment-content/index.js +1 -0
- package/build/comment-content/index.js.map +1 -1
- package/build/comment-date/index.js +1 -0
- package/build/comment-date/index.js.map +1 -1
- package/build/comment-edit-link/index.js +2 -1
- package/build/comment-edit-link/index.js.map +1 -1
- package/build/comment-reply-link/index.js +1 -0
- package/build/comment-reply-link/index.js.map +1 -1
- package/build/comment-template/edit.js +117 -26
- package/build/comment-template/edit.js.map +1 -1
- package/build/comment-template/index.js +4 -2
- package/build/comment-template/index.js.map +1 -1
- package/build/comment-template/util.js +68 -0
- package/build/comment-template/util.js.map +1 -0
- package/build/comments-pagination/comments-pagination-arrow-controls.js +39 -0
- package/build/comments-pagination/comments-pagination-arrow-controls.js.map +1 -0
- package/build/comments-pagination/edit.js +79 -0
- package/build/comments-pagination/edit.js.map +1 -0
- package/build/comments-pagination/index.js +71 -0
- package/build/comments-pagination/index.js.map +1 -0
- package/build/comments-pagination/save.js +18 -0
- package/build/comments-pagination/save.js.map +1 -0
- package/build/comments-pagination-next/edit.js +54 -0
- package/build/comments-pagination-next/edit.js.map +1 -0
- package/build/comments-pagination-next/index.js +66 -0
- package/build/comments-pagination-next/index.js.map +1 -0
- package/build/comments-pagination-numbers/edit.js +47 -0
- package/build/comments-pagination-numbers/edit.js.map +1 -0
- package/build/comments-pagination-numbers/index.js +46 -0
- package/build/comments-pagination-numbers/index.js.map +1 -0
- package/build/comments-pagination-previous/edit.js +54 -0
- package/build/comments-pagination-previous/edit.js.map +1 -0
- package/build/comments-pagination-previous/index.js +66 -0
- package/build/comments-pagination-previous/index.js.map +1 -0
- package/build/comments-query-loop/edit/comments-inspector-controls.js +102 -0
- package/build/comments-query-loop/edit/comments-inspector-controls.js.map +1 -0
- package/build/comments-query-loop/edit.js +23 -28
- package/build/comments-query-loop/edit.js.map +1 -1
- package/build/comments-query-loop/index.js +15 -7
- package/build/comments-query-loop/index.js.map +1 -1
- package/build/cover/edit.js +2 -1
- package/build/cover/edit.js.map +1 -1
- package/build/cover/edit.native.js +40 -32
- package/build/cover/edit.native.js.map +1 -1
- package/build/cover/index.js +1 -0
- package/build/cover/index.js.map +1 -1
- package/build/cover/overlay-color-settings.native.js +11 -1
- package/build/cover/overlay-color-settings.native.js.map +1 -1
- package/build/embed/deprecated.js +1 -0
- package/build/embed/deprecated.js.map +1 -1
- package/build/embed/edit.native.js +23 -20
- package/build/embed/edit.native.js.map +1 -1
- package/build/embed/embed-controls.native.js +69 -0
- package/build/embed/embed-controls.native.js.map +1 -0
- package/build/embed/embed-link-settings.native.js +101 -0
- package/build/embed/embed-link-settings.native.js.map +1 -0
- package/build/embed/embed-loading.js +1 -3
- package/build/embed/embed-loading.js.map +1 -1
- package/build/embed/embed-placeholder.native.js +9 -2
- package/build/embed/embed-placeholder.native.js.map +1 -1
- package/build/embed/index.js +1 -0
- package/build/embed/index.js.map +1 -1
- package/build/embed/transforms.js +1 -0
- package/build/embed/transforms.js.map +1 -1
- package/build/embed/util.js +1 -0
- package/build/embed/util.js.map +1 -1
- package/build/file/edit.native.js +5 -2
- package/build/file/edit.native.js.map +1 -1
- package/build/file/index.js +1 -0
- package/build/file/index.js.map +1 -1
- package/build/freeform/index.js +1 -0
- package/build/freeform/index.js.map +1 -1
- package/build/gallery/deprecated.js +4 -0
- package/build/gallery/deprecated.js.map +1 -1
- package/build/gallery/edit.js +31 -12
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/gallery.native.js +1 -1
- package/build/gallery/gallery.native.js.map +1 -1
- package/build/gallery/index.js +1 -0
- package/build/gallery/index.js.map +1 -1
- package/build/group/index.js +19 -1
- package/build/group/index.js.map +1 -1
- package/build/heading/edit.js +2 -0
- package/build/heading/edit.js.map +1 -1
- package/build/heading/index.js +1 -0
- package/build/heading/index.js.map +1 -1
- package/build/heading/transforms.js +1 -0
- package/build/heading/transforms.js.map +1 -1
- package/build/home-link/index.js +1 -0
- package/build/home-link/index.js.map +1 -1
- package/build/html/index.js +1 -0
- package/build/html/index.js.map +1 -1
- package/build/image/edit.js +56 -5
- package/build/image/edit.js.map +1 -1
- package/build/image/edit.native.js +4 -4
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +15 -4
- package/build/image/image.js.map +1 -1
- package/build/image/index.js +5 -1
- package/build/image/index.js.map +1 -1
- package/build/index.js +12 -2
- package/build/index.js.map +1 -1
- package/build/latest-comments/index.js +1 -0
- package/build/latest-comments/index.js.map +1 -1
- package/build/latest-posts/deprecated.js +1 -0
- package/build/latest-posts/deprecated.js.map +1 -1
- package/build/latest-posts/edit.js +1 -1
- package/build/latest-posts/edit.js.map +1 -1
- package/build/latest-posts/index.js +1 -0
- package/build/latest-posts/index.js.map +1 -1
- package/build/list/index.js +1 -0
- package/build/list/index.js.map +1 -1
- package/build/loginout/index.js +1 -0
- package/build/loginout/index.js.map +1 -1
- package/build/media-text/index.js +1 -0
- package/build/media-text/index.js.map +1 -1
- package/build/missing/index.js +1 -0
- package/build/missing/index.js.map +1 -1
- package/build/more/index.js +1 -0
- package/build/more/index.js.map +1 -1
- package/build/navigation/edit/index.js +37 -9
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/inner-blocks.js +3 -1
- package/build/navigation/edit/inner-blocks.js.map +1 -1
- package/build/navigation/edit/overlay-menu-icon.js +36 -0
- package/build/navigation/edit/overlay-menu-icon.js.map +1 -0
- package/build/navigation/edit/placeholder/index.js +11 -7
- package/build/navigation/edit/placeholder/index.js.map +1 -1
- package/build/navigation/edit/responsive-wrapper.js +11 -22
- package/build/navigation/edit/responsive-wrapper.js.map +1 -1
- package/build/navigation/index.js +10 -1
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/menu-items-to-blocks.js +4 -1
- package/build/navigation/menu-items-to-blocks.js.map +1 -1
- package/build/navigation/use-navigation-entities.js +6 -3
- package/build/navigation/use-navigation-entities.js.map +1 -1
- package/build/navigation-area/edit.js +2 -1
- package/build/navigation-area/edit.js.map +1 -1
- package/build/navigation-area/index.js +2 -1
- package/build/navigation-area/index.js.map +1 -1
- package/build/navigation-link/edit.js +7 -0
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-link/index.js +1 -0
- package/build/navigation-link/index.js.map +1 -1
- package/build/navigation-submenu/edit.js +4 -1
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/navigation-submenu/index.js +1 -0
- package/build/navigation-submenu/index.js.map +1 -1
- package/build/nextpage/index.js +1 -0
- package/build/nextpage/index.js.map +1 -1
- package/build/page-list/edit.js +37 -10
- package/build/page-list/edit.js.map +1 -1
- package/build/page-list/index.js +6 -1
- package/build/page-list/index.js.map +1 -1
- package/build/paragraph/edit.js +12 -2
- package/build/paragraph/edit.js.map +1 -1
- package/build/paragraph/index.js +2 -1
- package/build/paragraph/index.js.map +1 -1
- package/build/paragraph/transforms.js +2 -1
- package/build/paragraph/transforms.js.map +1 -1
- package/build/pattern/index.js +1 -0
- package/build/pattern/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-author-name/edit.js +98 -0
- package/build/post-author-name/edit.js.map +1 -0
- package/build/post-author-name/index.js +70 -0
- package/build/post-author-name/index.js.map +1 -0
- package/build/post-comment/index.js +1 -0
- package/build/post-comment/index.js.map +1 -1
- package/build/post-comments/index.js +1 -0
- package/build/post-comments/index.js.map +1 -1
- package/build/post-comments-count/index.js +1 -0
- package/build/post-comments-count/index.js.map +1 -1
- package/build/post-comments-form/index.js +1 -0
- package/build/post-comments-form/index.js.map +1 -1
- package/build/post-comments-link/index.js +1 -0
- package/build/post-comments-link/index.js.map +1 -1
- package/build/post-content/index.js +1 -0
- package/build/post-content/index.js.map +1 -1
- package/build/post-date/index.js +1 -0
- 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-excerpt/index.js +4 -0
- package/build/post-excerpt/index.js.map +1 -1
- package/build/post-excerpt/transforms.js +27 -0
- package/build/post-excerpt/transforms.js.map +1 -0
- package/build/post-featured-image/dimension-controls.js +74 -32
- package/build/post-featured-image/dimension-controls.js.map +1 -1
- package/build/post-featured-image/edit.js +52 -20
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-featured-image/index.js +4 -0
- package/build/post-featured-image/index.js.map +1 -1
- package/build/post-navigation-link/index.js +1 -0
- package/build/post-navigation-link/index.js.map +1 -1
- package/build/post-template/edit.js +34 -7
- package/build/post-template/edit.js.map +1 -1
- package/build/post-template/index.js +2 -1
- package/build/post-template/index.js.map +1 -1
- package/build/post-terms/index.js +1 -0
- package/build/post-terms/index.js.map +1 -1
- package/build/post-title/index.js +1 -0
- package/build/post-title/index.js.map +1 -1
- package/build/preformatted/edit.native.js +3 -6
- package/build/preformatted/edit.native.js.map +1 -1
- package/build/preformatted/index.js +1 -0
- package/build/preformatted/index.js.map +1 -1
- package/build/pullquote/index.js +8 -1
- package/build/pullquote/index.js.map +1 -1
- package/build/query/deprecated.js +96 -3
- package/build/query/deprecated.js.map +1 -1
- package/build/query/edit/index.js +4 -4
- package/build/query/edit/index.js.map +1 -1
- package/build/query/edit/inspector-controls/author-control.js +102 -0
- package/build/query/edit/inspector-controls/author-control.js.map +1 -0
- package/build/query/edit/inspector-controls/index.js +166 -0
- package/build/query/edit/inspector-controls/index.js.map +1 -0
- package/build/query/edit/inspector-controls/order-control.js +55 -0
- package/build/query/edit/inspector-controls/order-control.js.map +1 -0
- package/build/query/edit/inspector-controls/taxonomy-controls.js +158 -0
- package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -0
- package/build/query/index.js +3 -3
- package/build/query/utils.js +49 -38
- package/build/query/utils.js.map +1 -1
- package/build/query/variations.js +0 -4
- package/build/query/variations.js.map +1 -1
- package/build/query-pagination/index.js +2 -1
- package/build/query-pagination/index.js.map +1 -1
- package/build/query-pagination-next/index.js +2 -1
- package/build/query-pagination-next/index.js.map +1 -1
- package/build/query-pagination-numbers/index.js +2 -1
- package/build/query-pagination-numbers/index.js.map +1 -1
- package/build/query-pagination-previous/index.js +2 -1
- package/build/query-pagination-previous/index.js.map +1 -1
- package/build/query-title/index.js +1 -0
- package/build/query-title/index.js.map +1 -1
- package/build/quote/index.js +1 -0
- package/build/quote/index.js.map +1 -1
- package/build/rss/index.js +1 -0
- package/build/rss/index.js.map +1 -1
- package/build/search/edit.js +5 -3
- package/build/search/edit.js.map +1 -1
- package/build/search/edit.native.js +2 -2
- package/build/search/edit.native.js.map +1 -1
- package/build/search/index.js +8 -1
- package/build/search/index.js.map +1 -1
- package/build/separator/index.js +1 -0
- package/build/separator/index.js.map +1 -1
- package/build/shortcode/index.js +1 -0
- package/build/shortcode/index.js.map +1 -1
- package/build/site-logo/edit.js +0 -25
- package/build/site-logo/edit.js.map +1 -1
- package/build/site-logo/index.js +5 -1
- package/build/site-logo/index.js.map +1 -1
- package/build/site-logo/transforms.js +31 -0
- package/build/site-logo/transforms.js.map +1 -0
- package/build/site-tagline/index.js +2 -1
- package/build/site-tagline/index.js.map +1 -1
- package/build/site-title/index.js +4 -0
- package/build/site-title/index.js.map +1 -1
- package/build/site-title/transforms.js +31 -0
- package/build/site-title/transforms.js.map +1 -0
- package/build/social-link/index.js +2 -1
- package/build/social-link/index.js.map +1 -1
- package/build/social-links/edit.js +29 -23
- package/build/social-links/edit.js.map +1 -1
- package/build/social-links/index.js +2 -1
- package/build/social-links/index.js.map +1 -1
- package/build/spacer/controls.js +111 -0
- package/build/spacer/controls.js.map +1 -0
- package/build/spacer/controls.native.js +95 -0
- package/build/spacer/controls.native.js.map +1 -0
- package/build/spacer/deprecated.js +53 -0
- package/build/spacer/deprecated.js.map +1 -0
- package/build/spacer/edit.js +117 -98
- package/build/spacer/edit.js.map +1 -1
- package/build/spacer/edit.native.js +76 -0
- package/build/spacer/edit.native.js.map +1 -0
- package/build/spacer/index.js +8 -4
- package/build/spacer/index.js.map +1 -1
- package/build/spacer/save.js +6 -3
- package/build/spacer/save.js.map +1 -1
- package/build/table/index.js +7 -1
- package/build/table/index.js.map +1 -1
- package/build/table-of-contents/index.js +1 -0
- package/build/table-of-contents/index.js.map +1 -1
- package/build/tag-cloud/index.js +1 -0
- package/build/tag-cloud/index.js.map +1 -1
- package/build/template-part/index.js +1 -0
- package/build/template-part/index.js.map +1 -1
- package/build/term-description/index.js +1 -0
- package/build/term-description/index.js.map +1 -1
- package/build/text-columns/index.js +1 -0
- package/build/text-columns/index.js.map +1 -1
- package/build/verse/index.js +1 -0
- package/build/verse/index.js.map +1 -1
- package/build/video/index.js +1 -0
- package/build/video/index.js.map +1 -1
- package/build-module/archives/index.js +1 -0
- package/build-module/archives/index.js.map +1 -1
- package/build-module/audio/edit.js +17 -5
- package/build-module/audio/edit.js.map +1 -1
- package/build-module/audio/index.js +1 -0
- package/build-module/audio/index.js.map +1 -1
- package/build-module/block/index.js +1 -0
- package/build-module/block/index.js.map +1 -1
- package/build-module/button/edit.native.js +1 -1
- package/build-module/button/edit.native.js.map +1 -1
- package/build-module/button/index.js +5 -1
- package/build-module/button/index.js.map +1 -1
- package/build-module/buttons/edit.js +6 -0
- package/build-module/buttons/edit.js.map +1 -1
- package/build-module/buttons/edit.native.js +17 -7
- package/build-module/buttons/edit.native.js.map +1 -1
- package/build-module/buttons/index.js +1 -0
- package/build-module/buttons/index.js.map +1 -1
- package/build-module/buttons/transforms.js +1 -0
- package/build-module/buttons/transforms.js.map +1 -1
- package/build-module/calendar/index.js +1 -0
- package/build-module/calendar/index.js.map +1 -1
- package/build-module/categories/index.js +1 -0
- package/build-module/categories/index.js.map +1 -1
- package/build-module/code/index.js +6 -1
- package/build-module/code/index.js.map +1 -1
- package/build-module/column/index.js +1 -0
- package/build-module/column/index.js.map +1 -1
- package/build-module/columns/index.js +11 -0
- package/build-module/columns/index.js.map +1 -1
- package/build-module/comment-author-avatar/edit.js +6 -3
- package/build-module/comment-author-avatar/edit.js.map +1 -1
- package/build-module/comment-author-avatar/index.js +7 -2
- package/build-module/comment-author-avatar/index.js.map +1 -1
- package/build-module/comment-author-name/index.js +1 -0
- package/build-module/comment-author-name/index.js.map +1 -1
- package/build-module/comment-content/index.js +1 -0
- package/build-module/comment-content/index.js.map +1 -1
- package/build-module/comment-date/index.js +1 -0
- package/build-module/comment-date/index.js.map +1 -1
- package/build-module/comment-edit-link/index.js +2 -1
- package/build-module/comment-edit-link/index.js.map +1 -1
- package/build-module/comment-reply-link/index.js +1 -0
- package/build-module/comment-reply-link/index.js.map +1 -1
- package/build-module/comment-template/edit.js +116 -26
- package/build-module/comment-template/edit.js.map +1 -1
- package/build-module/comment-template/index.js +4 -2
- package/build-module/comment-template/index.js.map +1 -1
- package/build-module/comment-template/util.js +59 -0
- package/build-module/comment-template/util.js.map +1 -0
- package/build-module/comments-pagination/comments-pagination-arrow-controls.js +30 -0
- package/build-module/comments-pagination/comments-pagination-arrow-controls.js.map +1 -0
- package/build-module/comments-pagination/edit.js +66 -0
- package/build-module/comments-pagination/edit.js.map +1 -0
- package/build-module/comments-pagination/index.js +57 -0
- package/build-module/comments-pagination/index.js.map +1 -0
- package/build-module/comments-pagination/save.js +10 -0
- package/build-module/comments-pagination/save.js.map +1 -0
- package/build-module/comments-pagination-next/edit.js +41 -0
- package/build-module/comments-pagination-next/edit.js.map +1 -0
- package/build-module/comments-pagination-next/index.js +53 -0
- package/build-module/comments-pagination-next/index.js.map +1 -0
- package/build-module/comments-pagination-numbers/edit.js +40 -0
- package/build-module/comments-pagination-numbers/edit.js.map +1 -0
- package/build-module/comments-pagination-numbers/index.js +33 -0
- package/build-module/comments-pagination-numbers/index.js.map +1 -0
- package/build-module/comments-pagination-previous/edit.js +41 -0
- package/build-module/comments-pagination-previous/edit.js.map +1 -0
- package/build-module/comments-pagination-previous/index.js +53 -0
- package/build-module/comments-pagination-previous/index.js.map +1 -0
- package/build-module/comments-query-loop/edit/comments-inspector-controls.js +91 -0
- package/build-module/comments-query-loop/edit/comments-inspector-controls.js.map +1 -0
- package/build-module/comments-query-loop/edit.js +24 -28
- package/build-module/comments-query-loop/edit.js.map +1 -1
- package/build-module/comments-query-loop/index.js +15 -7
- package/build-module/comments-query-loop/index.js.map +1 -1
- package/build-module/cover/edit.js +2 -1
- package/build-module/cover/edit.js.map +1 -1
- package/build-module/cover/edit.native.js +41 -34
- package/build-module/cover/edit.native.js.map +1 -1
- package/build-module/cover/index.js +1 -0
- package/build-module/cover/index.js.map +1 -1
- package/build-module/cover/overlay-color-settings.native.js +11 -1
- package/build-module/cover/overlay-color-settings.native.js.map +1 -1
- package/build-module/embed/deprecated.js +1 -0
- package/build-module/embed/deprecated.js.map +1 -1
- package/build-module/embed/edit.native.js +24 -21
- package/build-module/embed/edit.native.js.map +1 -1
- package/build-module/embed/embed-controls.native.js +54 -0
- package/build-module/embed/embed-controls.native.js.map +1 -0
- package/build-module/embed/embed-link-settings.native.js +90 -0
- package/build-module/embed/embed-link-settings.native.js.map +1 -0
- package/build-module/embed/embed-loading.js +1 -2
- package/build-module/embed/embed-loading.js.map +1 -1
- package/build-module/embed/embed-placeholder.native.js +9 -2
- package/build-module/embed/embed-placeholder.native.js.map +1 -1
- package/build-module/embed/index.js +1 -0
- package/build-module/embed/index.js.map +1 -1
- package/build-module/embed/transforms.js +1 -0
- package/build-module/embed/transforms.js.map +1 -1
- package/build-module/embed/util.js +1 -0
- package/build-module/embed/util.js.map +1 -1
- package/build-module/file/edit.native.js +4 -2
- package/build-module/file/edit.native.js.map +1 -1
- package/build-module/file/index.js +1 -0
- package/build-module/file/index.js.map +1 -1
- package/build-module/freeform/index.js +1 -0
- package/build-module/freeform/index.js.map +1 -1
- package/build-module/gallery/deprecated.js +4 -0
- package/build-module/gallery/deprecated.js.map +1 -1
- package/build-module/gallery/edit.js +32 -13
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/gallery.native.js +1 -1
- package/build-module/gallery/gallery.native.js.map +1 -1
- package/build-module/gallery/index.js +1 -0
- package/build-module/gallery/index.js.map +1 -1
- package/build-module/group/index.js +19 -1
- package/build-module/group/index.js.map +1 -1
- package/build-module/heading/edit.js +3 -1
- package/build-module/heading/edit.js.map +1 -1
- package/build-module/heading/index.js +1 -0
- package/build-module/heading/index.js.map +1 -1
- package/build-module/heading/transforms.js +1 -0
- package/build-module/heading/transforms.js.map +1 -1
- package/build-module/home-link/index.js +1 -0
- package/build-module/home-link/index.js.map +1 -1
- package/build-module/html/index.js +1 -0
- package/build-module/html/index.js.map +1 -1
- package/build-module/image/edit.js +52 -4
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/edit.native.js +4 -4
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +16 -5
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/index.js +5 -1
- package/build-module/image/index.js.map +1 -1
- package/build-module/index.js +7 -2
- package/build-module/index.js.map +1 -1
- package/build-module/latest-comments/index.js +1 -0
- package/build-module/latest-comments/index.js.map +1 -1
- package/build-module/latest-posts/deprecated.js +1 -0
- package/build-module/latest-posts/deprecated.js.map +1 -1
- package/build-module/latest-posts/edit.js +1 -1
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/latest-posts/index.js +1 -0
- package/build-module/latest-posts/index.js.map +1 -1
- package/build-module/list/index.js +1 -0
- package/build-module/list/index.js.map +1 -1
- package/build-module/loginout/index.js +1 -0
- package/build-module/loginout/index.js.map +1 -1
- package/build-module/media-text/index.js +1 -0
- package/build-module/media-text/index.js.map +1 -1
- package/build-module/missing/index.js +1 -0
- package/build-module/missing/index.js.map +1 -1
- package/build-module/more/index.js +1 -0
- package/build-module/more/index.js.map +1 -1
- package/build-module/navigation/edit/index.js +36 -9
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/inner-blocks.js +3 -1
- package/build-module/navigation/edit/inner-blocks.js.map +1 -1
- package/build-module/navigation/edit/overlay-menu-icon.js +28 -0
- package/build-module/navigation/edit/overlay-menu-icon.js.map +1 -0
- package/build-module/navigation/edit/placeholder/index.js +11 -7
- package/build-module/navigation/edit/placeholder/index.js.map +1 -1
- package/build-module/navigation/edit/responsive-wrapper.js +10 -21
- package/build-module/navigation/edit/responsive-wrapper.js.map +1 -1
- package/build-module/navigation/index.js +10 -1
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/menu-items-to-blocks.js +4 -1
- package/build-module/navigation/menu-items-to-blocks.js.map +1 -1
- package/build-module/navigation/use-navigation-entities.js +6 -3
- package/build-module/navigation/use-navigation-entities.js.map +1 -1
- package/build-module/navigation-area/edit.js +2 -1
- package/build-module/navigation-area/edit.js.map +1 -1
- package/build-module/navigation-area/index.js +2 -1
- package/build-module/navigation-area/index.js.map +1 -1
- package/build-module/navigation-link/edit.js +7 -0
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-link/index.js +1 -0
- package/build-module/navigation-link/index.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +4 -1
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/navigation-submenu/index.js +1 -0
- package/build-module/navigation-submenu/index.js.map +1 -1
- package/build-module/nextpage/index.js +1 -0
- package/build-module/nextpage/index.js.map +1 -1
- package/build-module/page-list/edit.js +38 -11
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/page-list/index.js +6 -1
- package/build-module/page-list/index.js.map +1 -1
- package/build-module/paragraph/edit.js +13 -3
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/paragraph/index.js +2 -1
- package/build-module/paragraph/index.js.map +1 -1
- package/build-module/paragraph/transforms.js +2 -1
- package/build-module/paragraph/transforms.js.map +1 -1
- package/build-module/pattern/index.js +1 -0
- package/build-module/pattern/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-author-name/edit.js +85 -0
- package/build-module/post-author-name/edit.js.map +1 -0
- package/build-module/post-author-name/index.js +61 -0
- package/build-module/post-author-name/index.js.map +1 -0
- package/build-module/post-comment/index.js +1 -0
- package/build-module/post-comment/index.js.map +1 -1
- package/build-module/post-comments/index.js +1 -0
- package/build-module/post-comments/index.js.map +1 -1
- package/build-module/post-comments-count/index.js +1 -0
- package/build-module/post-comments-count/index.js.map +1 -1
- package/build-module/post-comments-form/index.js +1 -0
- package/build-module/post-comments-form/index.js.map +1 -1
- package/build-module/post-comments-link/index.js +1 -0
- package/build-module/post-comments-link/index.js.map +1 -1
- package/build-module/post-content/index.js +1 -0
- package/build-module/post-content/index.js.map +1 -1
- package/build-module/post-date/index.js +1 -0
- 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-excerpt/index.js +3 -0
- package/build-module/post-excerpt/index.js.map +1 -1
- package/build-module/post-excerpt/transforms.js +18 -0
- package/build-module/post-excerpt/transforms.js.map +1 -0
- package/build-module/post-featured-image/dimension-controls.js +76 -31
- package/build-module/post-featured-image/dimension-controls.js.map +1 -1
- package/build-module/post-featured-image/edit.js +54 -22
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-featured-image/index.js +4 -0
- package/build-module/post-featured-image/index.js.map +1 -1
- package/build-module/post-navigation-link/index.js +1 -0
- package/build-module/post-navigation-link/index.js.map +1 -1
- package/build-module/post-template/edit.js +34 -7
- package/build-module/post-template/edit.js.map +1 -1
- package/build-module/post-template/index.js +2 -1
- package/build-module/post-template/index.js.map +1 -1
- package/build-module/post-terms/index.js +1 -0
- package/build-module/post-terms/index.js.map +1 -1
- package/build-module/post-title/index.js +1 -0
- package/build-module/post-title/index.js.map +1 -1
- package/build-module/preformatted/edit.native.js +3 -3
- package/build-module/preformatted/edit.native.js.map +1 -1
- package/build-module/preformatted/index.js +1 -0
- package/build-module/preformatted/index.js.map +1 -1
- package/build-module/pullquote/index.js +8 -1
- package/build-module/pullquote/index.js.map +1 -1
- package/build-module/query/deprecated.js +95 -4
- package/build-module/query/deprecated.js.map +1 -1
- package/build-module/query/edit/index.js +3 -3
- package/build-module/query/edit/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/author-control.js +89 -0
- package/build-module/query/edit/inspector-controls/author-control.js.map +1 -0
- package/build-module/query/edit/inspector-controls/index.js +149 -0
- package/build-module/query/edit/inspector-controls/index.js.map +1 -0
- package/build-module/query/edit/inspector-controls/order-control.js +45 -0
- package/build-module/query/edit/inspector-controls/order-control.js.map +1 -0
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js +145 -0
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -0
- package/build-module/query/index.js +3 -3
- package/build-module/query/utils.js +43 -35
- package/build-module/query/utils.js.map +1 -1
- package/build-module/query/variations.js +0 -4
- package/build-module/query/variations.js.map +1 -1
- package/build-module/query-pagination/index.js +2 -1
- package/build-module/query-pagination/index.js.map +1 -1
- package/build-module/query-pagination-next/index.js +2 -1
- package/build-module/query-pagination-next/index.js.map +1 -1
- package/build-module/query-pagination-numbers/index.js +2 -1
- package/build-module/query-pagination-numbers/index.js.map +1 -1
- package/build-module/query-pagination-previous/index.js +2 -1
- package/build-module/query-pagination-previous/index.js.map +1 -1
- package/build-module/query-title/index.js +1 -0
- package/build-module/query-title/index.js.map +1 -1
- package/build-module/quote/index.js +1 -0
- package/build-module/quote/index.js.map +1 -1
- package/build-module/rss/index.js +1 -0
- package/build-module/rss/index.js.map +1 -1
- package/build-module/search/edit.js +5 -3
- package/build-module/search/edit.js.map +1 -1
- package/build-module/search/edit.native.js +2 -2
- package/build-module/search/edit.native.js.map +1 -1
- package/build-module/search/index.js +8 -1
- package/build-module/search/index.js.map +1 -1
- package/build-module/separator/index.js +1 -0
- package/build-module/separator/index.js.map +1 -1
- package/build-module/shortcode/index.js +1 -0
- package/build-module/shortcode/index.js.map +1 -1
- package/build-module/site-logo/edit.js +0 -25
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/site-logo/index.js +4 -1
- package/build-module/site-logo/index.js.map +1 -1
- package/build-module/site-logo/transforms.js +22 -0
- package/build-module/site-logo/transforms.js.map +1 -0
- package/build-module/site-tagline/index.js +2 -1
- package/build-module/site-tagline/index.js.map +1 -1
- package/build-module/site-title/index.js +3 -0
- package/build-module/site-title/index.js.map +1 -1
- package/build-module/site-title/transforms.js +22 -0
- package/build-module/site-title/transforms.js.map +1 -0
- package/build-module/social-link/index.js +2 -1
- package/build-module/social-link/index.js.map +1 -1
- package/build-module/social-links/edit.js +29 -23
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/social-links/index.js +2 -1
- package/build-module/social-links/index.js.map +1 -1
- package/build-module/spacer/controls.js +101 -0
- package/build-module/spacer/controls.js.map +1 -0
- package/build-module/spacer/controls.native.js +82 -0
- package/build-module/spacer/controls.native.js.map +1 -0
- package/build-module/spacer/deprecated.js +44 -0
- package/build-module/spacer/deprecated.js.map +1 -0
- package/build-module/spacer/edit.js +114 -95
- package/build-module/spacer/edit.js.map +1 -1
- package/build-module/spacer/edit.native.js +61 -0
- package/build-module/spacer/edit.native.js.map +1 -0
- package/build-module/spacer/index.js +7 -4
- package/build-module/spacer/index.js.map +1 -1
- package/build-module/spacer/save.js +6 -3
- package/build-module/spacer/save.js.map +1 -1
- package/build-module/table/index.js +7 -1
- package/build-module/table/index.js.map +1 -1
- package/build-module/table-of-contents/index.js +1 -0
- package/build-module/table-of-contents/index.js.map +1 -1
- package/build-module/tag-cloud/index.js +1 -0
- package/build-module/tag-cloud/index.js.map +1 -1
- package/build-module/template-part/index.js +1 -0
- package/build-module/template-part/index.js.map +1 -1
- package/build-module/term-description/index.js +1 -0
- package/build-module/term-description/index.js.map +1 -1
- package/build-module/text-columns/index.js +1 -0
- package/build-module/text-columns/index.js.map +1 -1
- package/build-module/verse/index.js +1 -0
- package/build-module/verse/index.js.map +1 -1
- package/build-module/video/index.js +1 -0
- package/build-module/video/index.js.map +1 -1
- package/build-style/audio/editor-rtl.css +11 -0
- package/build-style/audio/editor.css +11 -0
- package/build-style/code/theme-rtl.css +5 -3
- package/build-style/code/theme.css +5 -3
- package/build-style/columns/editor-rtl.css +0 -10
- package/build-style/columns/editor.css +0 -10
- package/build-style/columns/style-rtl.css +8 -21
- package/build-style/columns/style.css +8 -21
- package/build-style/comment-template/style-rtl.css +91 -0
- package/build-style/comment-template/style.css +91 -0
- package/build-style/{home-link/style.css → comments-pagination/editor-rtl.css} +18 -22
- package/build-style/comments-pagination/editor.css +102 -0
- package/build-style/{home-link → comments-pagination}/style-rtl.css +21 -21
- package/build-style/comments-pagination/style.css +106 -0
- package/build-style/comments-pagination-numbers/editor-rtl.css +85 -0
- package/build-style/comments-pagination-numbers/editor.css +86 -0
- package/build-style/comments-query-loop/editor-rtl.css +79 -0
- package/build-style/comments-query-loop/editor.css +79 -0
- package/build-style/common-rtl.css +19 -0
- package/build-style/common.css +19 -0
- package/build-style/cover/style-rtl.css +4 -0
- package/build-style/cover/style.css +4 -0
- package/build-style/editor-rtl.css +96 -58
- package/build-style/editor.css +99 -58
- package/build-style/embed/editor-rtl.css +0 -12
- package/build-style/embed/editor.css +0 -12
- package/build-style/gallery/editor-rtl.css +7 -18
- package/build-style/gallery/editor.css +7 -18
- package/build-style/gallery/style-rtl.css +3 -0
- package/build-style/gallery/style.css +3 -0
- package/build-style/group/theme-rtl.css +1 -1
- package/build-style/group/theme.css +1 -1
- package/build-style/latest-posts/editor-rtl.css +7 -0
- package/build-style/latest-posts/editor.css +7 -0
- package/build-style/latest-posts/style-rtl.css +0 -9
- package/build-style/latest-posts/style.css +0 -9
- package/build-style/navigation/editor-rtl.css +16 -2
- package/build-style/navigation/editor.css +16 -2
- package/build-style/navigation/style-rtl.css +18 -7
- package/build-style/navigation/style.css +18 -7
- package/build-style/page-list/editor-rtl.css +9 -5
- package/build-style/page-list/editor.css +9 -5
- package/build-style/post-comments/style-rtl.css +9 -4
- package/build-style/post-comments/style.css +9 -4
- package/build-style/post-featured-image/editor-rtl.css +0 -7
- package/build-style/post-featured-image/editor.css +0 -7
- package/build-style/post-featured-image/style-rtl.css +1 -1
- package/build-style/post-featured-image/style.css +1 -1
- package/build-style/post-template/style-rtl.css +4 -0
- package/build-style/post-template/style.css +4 -0
- package/build-style/post-title/style-rtl.css +3 -0
- package/build-style/post-title/style.css +3 -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 +0 -4
- package/build-style/query-pagination/editor.css +0 -4
- package/build-style/social-links/editor-rtl.css +3 -0
- package/build-style/social-links/editor.css +3 -0
- package/build-style/social-links/style-rtl.css +1 -0
- package/build-style/social-links/style.css +1 -0
- package/build-style/spacer/editor-rtl.css +4 -0
- package/build-style/spacer/editor.css +4 -0
- package/build-style/style-rtl.css +141 -87
- package/build-style/style.css +143 -87
- package/build-style/table/style-rtl.css +1 -0
- package/build-style/table/style.css +1 -0
- package/build-style/tag-cloud/style-rtl.css +8 -0
- package/build-style/tag-cloud/style.css +8 -0
- package/build-style/theme-rtl.css +6 -4
- package/build-style/theme.css +6 -4
- package/package.json +30 -30
- package/src/archives/block.json +1 -0
- package/src/archives/index.php +5 -9
- package/src/audio/block.json +1 -0
- package/src/audio/edit.js +18 -2
- package/src/audio/editor.scss +14 -0
- package/src/audio/test/__snapshots__/edit.native.js.snap +22 -0
- package/src/audio/test/edit.native.js +24 -11
- package/src/block/block.json +1 -0
- package/src/block/index.php +7 -2
- package/src/block/test/edit.native.js +10 -12
- package/src/button/block.json +5 -1
- package/src/button/edit.native.js +1 -1
- package/src/buttons/block.json +2 -1
- package/src/buttons/edit.js +17 -0
- package/src/buttons/edit.native.js +17 -5
- package/src/buttons/test/__snapshots__/edit.native.js.snap +27 -0
- package/src/buttons/test/edit.native.js +75 -45
- package/src/calendar/block.json +1 -0
- package/src/calendar/index.php +35 -39
- package/src/categories/block.json +1 -0
- package/src/categories/index.php +1 -1
- package/src/code/block.json +6 -1
- package/src/code/theme.scss +6 -4
- package/src/column/block.json +1 -0
- package/src/columns/block.json +11 -0
- package/src/columns/editor.scss +0 -15
- package/src/columns/style.scss +15 -36
- package/src/comment-author-avatar/block.json +7 -2
- package/src/comment-author-avatar/edit.js +9 -2
- package/src/comment-author-avatar/index.php +25 -6
- package/src/comment-author-name/block.json +1 -0
- package/src/comment-content/block.json +1 -0
- package/src/comment-date/block.json +1 -0
- package/src/comment-date/index.php +2 -2
- package/src/comment-edit-link/block.json +1 -0
- package/src/comment-edit-link/index.js +1 -1
- package/src/comment-reply-link/block.json +1 -0
- package/src/comment-template/block.json +4 -2
- package/src/comment-template/edit.js +127 -42
- package/src/comment-template/index.php +46 -19
- package/src/comment-template/style.scss +17 -0
- package/src/comment-template/test/index.js +45 -0
- package/src/comment-template/util.js +56 -0
- package/src/comments-pagination/block.json +37 -0
- package/src/comments-pagination/comments-pagination-arrow-controls.js +44 -0
- package/src/comments-pagination/edit.js +83 -0
- package/src/comments-pagination/editor.scss +34 -0
- package/src/comments-pagination/index.js +20 -0
- package/src/comments-pagination/index.php +39 -0
- package/src/comments-pagination/save.js +8 -0
- package/src/comments-pagination/style.scss +38 -0
- package/src/comments-pagination-next/block.json +35 -0
- package/src/comments-pagination-next/edit.js +44 -0
- package/src/comments-pagination-next/index.js +18 -0
- package/src/comments-pagination-next/index.php +62 -0
- package/src/comments-pagination-numbers/block.json +15 -0
- package/src/comments-pagination-numbers/edit.js +22 -0
- package/src/comments-pagination-numbers/editor.scss +12 -0
- package/src/comments-pagination-numbers/index.js +18 -0
- package/src/comments-pagination-numbers/index.php +69 -0
- package/src/comments-pagination-previous/block.json +35 -0
- package/src/comments-pagination-previous/edit.js +44 -0
- package/src/comments-pagination-previous/index.js +18 -0
- package/src/comments-pagination-previous/index.php +52 -0
- package/src/comments-query-loop/block.json +15 -7
- package/src/comments-query-loop/edit/comments-inspector-controls.js +93 -0
- package/src/comments-query-loop/edit.js +22 -27
- package/src/comments-query-loop/editor.scss +3 -0
- package/src/common.scss +19 -0
- package/src/cover/block.json +1 -0
- package/src/cover/edit.js +1 -0
- package/src/cover/edit.native.js +35 -19
- package/src/cover/overlay-color-settings.native.js +10 -0
- package/src/cover/style.scss +4 -0
- package/src/cover/test/__snapshots__/edit.native.js.snap +33 -0
- package/src/cover/test/edit.native.js +280 -17
- package/src/editor.scss +3 -0
- package/src/embed/block.json +1 -0
- package/src/embed/edit.native.js +23 -18
- package/src/embed/editor.scss +0 -15
- package/src/embed/embed-controls.native.js +65 -0
- package/src/embed/embed-link-settings.native.js +100 -0
- package/src/embed/embed-loading.js +0 -2
- package/src/embed/embed-placeholder.native.js +8 -0
- package/src/embed/test/__snapshots__/index.native.js.snap +10 -0
- package/src/embed/test/index.native.js +236 -95
- package/src/file/block.json +1 -0
- package/src/file/edit.native.js +6 -2
- package/src/file/index.php +2 -2
- package/src/file/test/__snapshots__/edit.native.js.snap +18 -5
- package/src/file/test/edit.native.js +30 -12
- package/src/freeform/block.json +1 -0
- package/src/gallery/block.json +1 -0
- package/src/gallery/deprecated.js +4 -0
- package/src/gallery/edit.js +42 -11
- package/src/gallery/editor.scss +8 -22
- package/src/gallery/gallery.native.js +1 -1
- package/src/gallery/style.scss +4 -0
- package/src/gallery/test/use-get-new-images.js +93 -0
- package/src/group/block.json +19 -1
- package/src/group/theme.scss +4 -5
- package/src/heading/block.json +1 -0
- package/src/heading/edit.js +2 -1
- package/src/home-link/block.json +1 -0
- package/src/home-link/index.php +3 -3
- package/src/html/block.json +1 -0
- package/src/image/block.json +5 -1
- package/src/image/edit.js +44 -0
- package/src/image/edit.native.js +4 -4
- package/src/image/image.js +14 -3
- package/src/image/index.php +2 -2
- package/src/image/test/edit.native.js +27 -7
- package/src/index.js +10 -0
- package/src/latest-comments/block.json +1 -0
- package/src/latest-comments/index.php +5 -5
- package/src/latest-posts/block.json +1 -0
- package/src/latest-posts/edit.js +1 -1
- package/src/latest-posts/editor.scss +10 -0
- package/src/latest-posts/index.php +14 -12
- package/src/latest-posts/style.scss +0 -12
- package/src/list/block.json +1 -0
- package/src/list/test/edit.native.js +3 -3
- package/src/loginout/block.json +1 -0
- package/src/media-text/block.json +1 -0
- package/src/missing/block.json +1 -0
- package/src/missing/test/__snapshots__/edit.native.js.snap +5 -0
- package/src/missing/test/edit-integration.native.js +2 -2
- package/src/missing/test/edit.native.js +26 -30
- package/src/more/block.json +1 -0
- package/src/navigation/README.md +13 -0
- package/src/navigation/block.json +12 -10
- package/src/navigation/edit/index.js +71 -21
- package/src/navigation/edit/inner-blocks.js +3 -1
- package/src/navigation/edit/overlay-menu-icon.js +21 -0
- package/src/navigation/edit/placeholder/index.js +20 -9
- package/src/navigation/edit/responsive-wrapper.js +12 -13
- package/src/navigation/editor.scss +18 -3
- package/src/navigation/index.php +17 -10
- package/src/navigation/menu-items-to-blocks.js +2 -1
- package/src/navigation/style.scss +24 -7
- package/src/navigation/use-navigation-entities.js +3 -1
- package/src/navigation-area/block.json +3 -7
- package/src/navigation-area/edit.js +2 -1
- package/src/navigation-link/block.json +2 -3
- package/src/navigation-link/edit.js +5 -0
- package/src/navigation-link/index.php +3 -3
- package/src/navigation-submenu/block.json +2 -3
- package/src/navigation-submenu/edit.js +3 -1
- package/src/navigation-submenu/index.php +7 -7
- package/src/nextpage/block.json +1 -0
- package/src/page-list/block.json +4 -0
- package/src/page-list/edit.js +47 -9
- package/src/page-list/editor.scss +8 -5
- package/src/page-list/index.php +15 -10
- package/src/paragraph/block.json +2 -1
- package/src/paragraph/edit.js +12 -4
- package/src/paragraph/test/edit.native.js +4 -13
- package/src/pattern/block.json +1 -0
- package/src/post-author/block.json +2 -1
- package/src/post-author/index.php +1 -1
- package/src/post-author-name/block.json +43 -0
- package/src/post-author-name/edit.js +95 -0
- package/src/post-author-name/index.js +18 -0
- package/src/post-author-name/index.php +49 -0
- package/src/post-comment/block.json +1 -0
- package/src/post-comments/block.json +1 -0
- package/src/post-comments/style.scss +10 -4
- package/src/post-comments-count/block.json +1 -0
- package/src/post-comments-form/block.json +6 -1
- package/src/post-comments-link/block.json +1 -0
- package/src/post-comments-link/index.php +7 -7
- package/src/post-content/block.json +1 -0
- package/src/post-content/index.php +1 -1
- package/src/post-date/block.json +1 -0
- package/src/post-date/index.php +2 -2
- package/src/post-excerpt/block.json +1 -0
- package/src/post-excerpt/edit.js +1 -0
- package/src/post-excerpt/index.js +2 -0
- package/src/post-excerpt/index.php +1 -1
- package/src/post-excerpt/transforms.js +23 -0
- package/src/post-featured-image/block.json +4 -0
- package/src/post-featured-image/dimension-controls.js +103 -51
- package/src/post-featured-image/edit.js +61 -22
- package/src/post-featured-image/editor.scss +0 -8
- package/src/post-featured-image/index.php +3 -2
- package/src/post-featured-image/style.scss +1 -1
- package/src/post-navigation-link/block.json +1 -0
- package/src/post-navigation-link/index.php +4 -4
- package/src/post-template/block.json +2 -1
- package/src/post-template/edit.js +27 -7
- package/src/post-template/index.php +2 -2
- package/src/post-template/style.scss +5 -0
- package/src/post-terms/block.json +1 -0
- package/src/post-terms/index.php +1 -1
- package/src/post-title/block.json +1 -0
- package/src/post-title/index.php +1 -1
- package/src/post-title/style.scss +6 -2
- package/src/preformatted/block.json +1 -0
- package/src/preformatted/edit.native.js +4 -4
- package/src/preformatted/test/__snapshots__/edit.native.js.snap +53 -14
- package/src/preformatted/test/edit.native.js +11 -10
- package/src/pullquote/block.json +8 -1
- package/src/pullquote/style.scss +1 -0
- package/src/query/block.json +3 -3
- package/src/query/deprecated.js +80 -3
- package/src/query/edit/index.js +3 -3
- package/src/query/edit/inspector-controls/author-control.js +78 -0
- package/src/query/edit/inspector-controls/index.js +163 -0
- package/src/query/edit/inspector-controls/order-control.js +41 -0
- package/src/query/edit/inspector-controls/taxonomy-controls.js +118 -0
- package/src/query/test/utils.js +6 -4
- package/src/query/utils.js +45 -35
- package/src/query/variations.js +0 -4
- package/src/query-pagination/block.json +2 -1
- package/src/query-pagination/editor.scss +0 -4
- package/src/query-pagination-next/block.json +2 -1
- package/src/query-pagination-next/index.php +2 -1
- package/src/query-pagination-numbers/block.json +2 -1
- package/src/query-pagination-previous/block.json +2 -1
- package/src/query-pagination-previous/index.php +2 -1
- package/src/query-title/block.json +1 -0
- package/src/quote/block.json +1 -0
- package/src/rss/block.json +1 -0
- package/src/search/block.json +8 -1
- package/src/search/edit.js +2 -1
- package/src/search/edit.native.js +2 -5
- package/src/search/index.php +21 -11
- package/src/search/test/__snapshots__/edit.native.js.snap +7 -15
- package/src/search/test/edit.native.js +32 -24
- package/src/separator/block.json +1 -0
- package/src/shortcode/block.json +1 -0
- package/src/site-logo/block.json +1 -0
- package/src/site-logo/edit.js +1 -32
- package/src/site-logo/index.js +2 -0
- package/src/site-logo/index.php +1 -1
- package/src/site-logo/transforms.js +21 -0
- package/src/site-tagline/block.json +2 -1
- package/src/site-tagline/index.php +1 -1
- package/src/site-title/block.json +1 -0
- package/src/site-title/index.js +2 -0
- package/src/site-title/index.php +4 -4
- package/src/site-title/transforms.js +21 -0
- package/src/social-link/block.json +2 -1
- package/src/social-link/index.php +3 -3
- package/src/social-links/block.json +3 -8
- package/src/social-links/edit.js +29 -26
- package/src/social-links/editor.scss +7 -0
- package/src/social-links/style.scss +3 -0
- package/src/spacer/block.json +4 -3
- package/src/spacer/controls.js +108 -0
- package/src/spacer/controls.native.js +82 -0
- package/src/spacer/deprecated.js +41 -0
- package/src/spacer/edit.js +133 -132
- package/src/spacer/edit.native.js +68 -0
- package/src/spacer/editor.scss +6 -0
- package/src/spacer/index.js +2 -0
- package/src/spacer/save.js +5 -2
- package/src/style.scss +3 -2
- package/src/table/block.json +7 -1
- package/src/table/style.scss +1 -0
- package/src/table-of-contents/block.json +1 -0
- package/src/table-of-contents/index.php +3 -3
- package/src/tag-cloud/block.json +1 -0
- package/src/tag-cloud/index.php +9 -0
- package/src/tag-cloud/style.scss +9 -0
- package/src/template-part/block.json +1 -0
- package/src/template-part/index.php +6 -6
- package/src/term-description/block.json +1 -0
- package/src/text-columns/block.json +1 -0
- package/src/verse/block.json +1 -0
- package/src/verse/test/edit.native.js +7 -10
- package/src/video/block.json +1 -0
- package/build/comments-query-loop/toolbar.js +0 -58
- package/build/comments-query-loop/toolbar.js.map +0 -1
- package/build/embed/embed-bottom-sheet.native.js +0 -85
- package/build/embed/embed-bottom-sheet.native.js.map +0 -1
- package/build/query/edit/query-inspector-controls.js +0 -275
- package/build/query/edit/query-inspector-controls.js.map +0 -1
- package/build-module/comments-query-loop/toolbar.js +0 -48
- package/build-module/comments-query-loop/toolbar.js.map +0 -1
- package/build-module/embed/embed-bottom-sheet.native.js +0 -74
- package/build-module/embed/embed-bottom-sheet.native.js.map +0 -1
- package/build-module/query/edit/query-inspector-controls.js +0 -261
- package/build-module/query/edit/query-inspector-controls.js.map +0 -1
- package/src/comments-query-loop/toolbar.js +0 -57
- package/src/embed/embed-bottom-sheet.native.js +0 -78
- package/src/home-link/style.scss +0 -51
- package/src/query/edit/query-inspector-controls.js +0 -281
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/embed/edit.native.js"],"names":["PREVIEWABLE_PROVIDERS","NOT_PREVIEWABLE_WP_EMBED_PROVIDERS","WP_EMBED_TYPE","EmbedEdit","props","attributes","align","providerNameSlug","previewable","responsive","url","isSelected","onReplace","setAttributes","insertBlocksAfter","onFocus","clientId","defaultEmbedInfo","title","icon","embedContentIcon","embedInfoByProvider","wasBlockJustInserted","select","blockEditorStore","isEditingURL","setIsEditingURL","showEmbedBottomSheet","setShowEmbedBottomSheet","invalidateResolution","coreStore","preview","fetching","themeSupportsResponsive","cannotEmbed","getEmbedPreview","hasFinishedResolution","isPreviewEmbedFallback","getThemeSupports","embedPreview","hasResolvedEmbedPreview","previewIsFallback","badEmbedProvider","html","type","undefined","wordpressCantEmbed","code","validPreview","getMergedAttributes","ignorePreviousClassName","allowResponsive","className","toggleResponsive","newAllowResponsive","newURL","replace","upgradedBlock","blockProps","showEmbedPlaceholder","classFromPreview","isProviderPreviewable","includes","bottomSheetLabel","event","value"],"mappings":";;;;;;;;;AA0BA;;AAvBA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAKA;;AAEA;;AACA;;AAIA;;AACA;;AAjCA;AACA;AACA;;AAeA;AACA;AACA;;AAGA;AACA;AACA;AAWA;AACA;AACA,MAAMA,qBAAqB,GAAG,CAAE,SAAF,EAAa,SAAb,EAAwB,WAAxB,EAAqC,OAArC,CAA9B,C,CACA;AACA;;AACA,MAAMC,kCAAkC,GAAG,CAAE,WAAF,CAA3C;AAEA,MAAMC,aAAa,GAAG,UAAtB;;AAEA,MAAMC,SAAS,GAAKC,KAAF,IAAa;AAC9B,QAAM;AACLC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,KAAF;AAASC,MAAAA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AA,OAAO,EAAG,MAAMC,uBAAuB,CAAE,KAAF,CAJxC;AAKC,IAAA,QAAQ,EAAKqC,KAAF,IAAa;AACvB;AACA;AACA;AACApD,MAAAA,aAAa,CAAE;AAAEH,QAAAA,GAAG,EAAEuD;AAAP,OAAF,CAAb;AACAvC,MAAAA,eAAe,CAAE,KAAF,CAAf;AACA;AAXF,IAxDD,CADD;AAwEA,CAtQD;;eAwQevB,S","sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tcreateUpgradedEmbedBlock,\n\tgetClassNames,\n\tfallback,\n\tgetAttributesFromPreview,\n\tgetEmbedInfoByProvider,\n} from './util';\nimport EmbedControls from './embed-controls';\nimport { embedContentIcon } from './icons';\nimport EmbedLoading from './embed-loading';\nimport EmbedPlaceholder from './embed-placeholder';\nimport EmbedPreview from './embed-preview';\nimport EmbedBottomSheet from './embed-bottom-sheet';\n\n/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { _x } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { View } from '@wordpress/primitives';\n\n// The inline preview feature will be released progressible, for this reason\n// the embed will only be considered previewable for the following providers list.\nconst PREVIEWABLE_PROVIDERS = [ 'youtube', 'twitter', 'instagram', 'vimeo' ];\n// Some providers are rendering the inline preview as a WordPress embed and\n// are not supported yet, so we need to disallow them with a fixed providers list.\nconst NOT_PREVIEWABLE_WP_EMBED_PROVIDERS = [ 'pinterest' ];\n\nconst WP_EMBED_TYPE = 'wp-embed';\n\nconst EmbedEdit = ( props ) => {\n\tconst {\n\t\tattributes: { align, providerNameSlug, previewable, responsive, url },\n\t\tattributes,\n\t\tisSelected,\n\t\tonReplace,\n\t\tsetAttributes,\n\t\tinsertBlocksAfter,\n\t\tonFocus,\n\t\tclientId,\n\t} = props;\n\n\tconst defaultEmbedInfo = {\n\t\ttitle: _x( 'Embed', 'block title' ),\n\t\ticon: embedContentIcon,\n\t};\n\tconst embedInfoByProvider = getEmbedInfoByProvider( providerNameSlug );\n\tconst { icon, title } = embedInfoByProvider || defaultEmbedInfo;\n\n\tconst { wasBlockJustInserted } = useSelect(\n\t\t( select ) => ( {\n\t\t\twasBlockJustInserted: select(\n\t\t\t\tblockEditorStore\n\t\t\t).wasBlockJustInserted( clientId, 'inserter_menu' ),\n\t\t} ),\n\t\t[ clientId ]\n\t);\n\tconst [ isEditingURL, setIsEditingURL ] = useState(\n\t\tisSelected && wasBlockJustInserted && ! url\n\t);\n\tconst [ showEmbedBottomSheet, setShowEmbedBottomSheet ] = useState(\n\t\tisEditingURL\n\t);\n\tconst { invalidateResolution } = useDispatch( coreStore );\n\n\tconst {\n\t\tpreview,\n\t\tfetching,\n\t\tthemeSupportsResponsive,\n\t\tcannotEmbed,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEmbedPreview,\n\t\t\t\thasFinishedResolution,\n\t\t\t\tisPreviewEmbedFallback,\n\t\t\t\tgetThemeSupports,\n\t\t\t} = select( coreStore );\n\t\t\tif ( ! url ) {\n\t\t\t\treturn { fetching: false, cannotEmbed: false };\n\t\t\t}\n\n\t\t\tconst embedPreview = getEmbedPreview( url );\n\t\t\tconst hasResolvedEmbedPreview = hasFinishedResolution(\n\t\t\t\t'getEmbedPreview',\n\t\t\t\t[ url ]\n\t\t\t);\n\t\t\tconst previewIsFallback = isPreviewEmbedFallback( url );\n\n\t\t\t// The external oEmbed provider does not exist. We got no type info and no html.\n\t\t\tconst badEmbedProvider =\n\t\t\t\tembedPreview?.html === false &&\n\t\t\t\tembedPreview?.type === undefined;\n\t\t\t// Some WordPress URLs that can't be embedded will cause the API to return\n\t\t\t// a valid JSON response with no HTML and `code` set to 404, rather\n\t\t\t// than generating a fallback response as other embeds do.\n\t\t\tconst wordpressCantEmbed = embedPreview?.code === '404';\n\t\t\tconst validPreview =\n\t\t\t\t!! embedPreview && ! badEmbedProvider && ! wordpressCantEmbed;\n\n\t\t\treturn {\n\t\t\t\tpreview: validPreview ? embedPreview : undefined,\n\t\t\t\tfetching: ! hasResolvedEmbedPreview,\n\t\t\t\tthemeSupportsResponsive: getThemeSupports()[\n\t\t\t\t\t'responsive-embeds'\n\t\t\t\t],\n\t\t\t\tcannotEmbed: ! validPreview || previewIsFallback,\n\t\t\t};\n\t\t},\n\t\t[ url ]\n\t);\n\n\t/**\n\t * Returns the attributes derived from the preview, merged with the current attributes.\n\t *\n\t * @param {boolean} ignorePreviousClassName Determines if the previous className attribute should be ignored when merging.\n\t * @return {Object} Merged attributes.\n\t */\n\tconst getMergedAttributes = ( ignorePreviousClassName = false ) => {\n\t\tconst { allowResponsive, className } = attributes;\n\t\treturn {\n\t\t\t...attributes,\n\t\t\t...getAttributesFromPreview(\n\t\t\t\tpreview,\n\t\t\t\ttitle,\n\t\t\t\tignorePreviousClassName ? undefined : className,\n\t\t\t\tresponsive,\n\t\t\t\tallowResponsive\n\t\t\t),\n\t\t};\n\t};\n\n\tconst toggleResponsive = () => {\n\t\tconst { allowResponsive, className } = attributes;\n\t\tconst { html } = preview;\n\t\tconst newAllowResponsive = ! allowResponsive;\n\n\t\tsetAttributes( {\n\t\t\tallowResponsive: newAllowResponsive,\n\t\t\tclassName: getClassNames(\n\t\t\t\thtml,\n\t\t\t\tclassName,\n\t\t\t\tresponsive && newAllowResponsive\n\t\t\t),\n\t\t} );\n\t};\n\n\tuseEffect( () => {\n\t\tif ( ! preview?.html || ! cannotEmbed || fetching ) {\n\t\t\treturn;\n\t\t}\n\t\t// At this stage, we're not fetching the preview and know it can't be embedded,\n\t\t// so try removing any trailing slash, and resubmit.\n\t\tconst newURL = url.replace( /\\/$/, '' );\n\t\tsetIsEditingURL( false );\n\t\tsetAttributes( { url: newURL } );\n\t}, [ preview?.html, url ] );\n\n\t// Handle incoming preview\n\tuseEffect( () => {\n\t\tif ( preview && ! isEditingURL ) {\n\t\t\t// When obtaining an incoming preview, we set the attributes derived from\n\t\t\t// the preview data. In this case when getting the merged attributes,\n\t\t\t// we ignore the previous classname because it might not match the expected\n\t\t\t// classes by the new preview.\n\t\t\tsetAttributes( getMergedAttributes( true ) );\n\n\t\t\tif ( onReplace ) {\n\t\t\t\tconst upgradedBlock = createUpgradedEmbedBlock(\n\t\t\t\t\tprops,\n\t\t\t\t\tgetMergedAttributes()\n\t\t\t\t);\n\n\t\t\t\tif ( upgradedBlock ) {\n\t\t\t\t\tonReplace( upgradedBlock );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}, [ preview, isEditingURL ] );\n\n\tuseEffect( () => setShowEmbedBottomSheet( isEditingURL ), [\n\t\tisEditingURL,\n\t] );\n\n\tconst blockProps = useBlockProps();\n\n\tif ( fetching ) {\n\t\treturn (\n\t\t\t<View { ...blockProps }>\n\t\t\t\t<EmbedLoading />\n\t\t\t</View>\n\t\t);\n\t}\n\n\tconst showEmbedPlaceholder = ! preview || cannotEmbed;\n\n\t// Even though we set attributes that get derived from the preview,\n\t// we don't access them directly because for the initial render,\n\t// the `setAttributes` call will not have taken effect. If we're\n\t// rendering responsive content, setting the responsive classes\n\t// after the preview has been rendered can result in unwanted\n\t// clipping or scrollbars. The `getAttributesFromPreview` function\n\t// that `getMergedAttributes` uses is memoized so that we're not\n\t// calculating them on every render.\n\tconst {\n\t\ttype,\n\t\tallowResponsive,\n\t\tclassName: classFromPreview,\n\t} = getMergedAttributes();\n\tconst className = classnames( classFromPreview, props.className );\n\n\tconst isProviderPreviewable =\n\t\tPREVIEWABLE_PROVIDERS.includes( providerNameSlug ) ||\n\t\t// For WordPress embeds, we enable the inline preview for all its providers\n\t\t// except the ones that are not supported yet.\n\t\t( WP_EMBED_TYPE === type &&\n\t\t\t! NOT_PREVIEWABLE_WP_EMBED_PROVIDERS.includes( providerNameSlug ) );\n\n\tconst bottomSheetLabel = WP_EMBED_TYPE === type ? 'WordPress' : title;\n\n\treturn (\n\t\t<>\n\t\t\t{ showEmbedPlaceholder ? (\n\t\t\t\t<>\n\t\t\t\t\t<EmbedControls\n\t\t\t\t\t\tshowEditButton={ cannotEmbed }\n\t\t\t\t\t\tswitchBackToURLInput={ () => setIsEditingURL( true ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<View { ...blockProps }>\n\t\t\t\t\t\t<EmbedPlaceholder\n\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tlabel={ title }\n\t\t\t\t\t\t\tonPress={ ( event ) => {\n\t\t\t\t\t\t\t\tonFocus( event );\n\t\t\t\t\t\t\t\tsetIsEditingURL( true );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tcannotEmbed={ cannotEmbed }\n\t\t\t\t\t\t\tfallback={ () => fallback( url, onReplace ) }\n\t\t\t\t\t\t\ttryAgain={ () => {\n\t\t\t\t\t\t\t\tinvalidateResolution( 'getEmbedPreview', [\n\t\t\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\t\t] );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</View>\n\t\t\t\t</>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<EmbedControls\n\t\t\t\t\t\tshowEditButton={ preview && ! cannotEmbed }\n\t\t\t\t\t\tthemeSupportsResponsive={ themeSupportsResponsive }\n\t\t\t\t\t\tblockSupportsResponsive={ responsive }\n\t\t\t\t\t\tallowResponsive={ allowResponsive }\n\t\t\t\t\t\ttoggleResponsive={ toggleResponsive }\n\t\t\t\t\t\tswitchBackToURLInput={ () => setIsEditingURL( true ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<View { ...blockProps }>\n\t\t\t\t\t\t<EmbedPreview\n\t\t\t\t\t\t\talign={ align }\n\t\t\t\t\t\t\tclassName={ className }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tlabel={ title }\n\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\tpreview={ preview }\n\t\t\t\t\t\t\tisProviderPreviewable={ isProviderPreviewable }\n\t\t\t\t\t\t\tpreviewable={ previewable }\n\t\t\t\t\t\t\ttype={ type }\n\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\tisDefaultEmbedInfo={ ! embedInfoByProvider }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</View>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<EmbedBottomSheet\n\t\t\t\tvalue={ url }\n\t\t\t\tlabel={ bottomSheetLabel }\n\t\t\t\tisVisible={ showEmbedBottomSheet }\n\t\t\t\tonClose={ () => setShowEmbedBottomSheet( false ) }\n\t\t\t\tonSubmit={ ( value ) => {\n\t\t\t\t\t// The order of the following calls is important, we need to update the URL attribute before changing `isEditingURL`,\n\t\t\t\t\t// otherwise the side-effect that potentially replaces the block when updating the local state won't use the new URL\n\t\t\t\t\t// for creating the new block.\n\t\t\t\t\tsetAttributes( { url: value } );\n\t\t\t\t\tsetIsEditingURL( false );\n\t\t\t\t} }\n\t\t\t/>\n\t\t</>\n\t);\n};\n\nexport default EmbedEdit;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/embed/edit.native.js"],"names":["PREVIEWABLE_PROVIDERS","NOT_PREVIEWABLE_WP_EMBED_PROVIDERS","WP_EMBED_TYPE","EmbedEdit","props","attributes","align","providerNameSlug","previewable","responsive","url","isSelected","onReplace","setAttributes","insertBlocksAfter","onFocus","clientId","defaultEmbedInfo","title","icon","embedContentIcon","embedInfoByProvider","wasBlockJustInserted","select","blockEditorStore","isEditingURL","setIsEditingURL","showEmbedBottomSheet","setShowEmbedBottomSheet","invalidateResolution","coreStore","preview","fetching","themeSupportsResponsive","cannotEmbed","getEmbedPreview","hasFinishedResolution","isPreviewEmbedFallback","getThemeSupports","embedPreview","hasResolvedEmbedPreview","previewIsFallback","badEmbedProvider","html","type","undefined","wordpressCantEmbed","code","validPreview","getMergedAttributes","ignorePreviousClassName","allowResponsive","className","toggleResponsive","newAllowResponsive","newURL","replace","upgradedBlock","onEditURL","value","blockProps","showEmbedPlaceholder","classFromPreview","isProviderPreviewable","includes","linkLabel","event"],"mappings":";;;;;;;;;AA0BA;;AAvBA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAKA;;AAEA;;AACA;;AAIA;;AACA;;AAjCA;AACA;AACA;;AAeA;AACA;AACA;;AAGA;AACA;AACA;AAWA;AACA;AACA,MAAMA,qBAAqB,GAAG,CAAE,SAAF,EAAa,SAAb,EAAwB,WAAxB,EAAqC,OAArC,CAA9B,C,CACA;AACA;;AACA,MAAMC,kCAAkC,GAAG,CAAE,WAAF,CAA3C;AAEA,MAAMC,aAAa,GAAG,UAAtB;;AAEA,MAAMC,SAAS,GAAKC,KAAF,IAAa;AAC9B,QAAM;AACLC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,KAAF;AAASC,MAAAA,gBAAT;AAA2BC,MAAAA,WAA3B;AAAwCC,MAAAA,UAAxC;AAAoDC,MAAAA;AAApD,KADP;AAELL,IAAAA,UAFK;AAGLM,IAAAA,UAHK;AAILC,IAAAA,SAJK;AAKLC,IAAAA,aALK;AAMLC,IAAAA,iBANK;AAOLC,IAAAA,OAPK;AAQLC,IAAAA;AARK,MASFZ,KATJ;AAWA,QAAMa,gBAAgB,GAAG;AACxBC,IAAAA,KAAK,EAAE,cAAI,OAAJ,EAAa,aAAb,CADiB;AAExBC,IAAAA,IAAI,EAAEC;AAFkB,GAAzB;AAIA,QAAMC,mBAAmB,GAAG,kCAAwBd,gBAAxB,CAA5B;AACA,QAAM;AAAEY,IAAAA,IAAF;AAAQD,IAAAA;AAAR,MAAkBG,mBAAmB,IAAIJ,gBAA/C;AAEA,QAAM;AAA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AAuB,EAAGxB,UAF3B;AAGC,IAAA,eAAe,EAAG0C,eAHnB;AAIC,IAAA,gBAAgB,EAAGE,gBAJpB;AAKC,IAAA,GAAG,EAAG3C,GALP;AAMC,IAAA,SAAS,EAAGuD,SANb;AAOC,IAAA,SAAS,EAAGP;AAPb,IADD,EAUC,4BAAC,gBAAD,EAAWE,UAAX,EACC,4BAAC,qBAAD;AACC,IAAA,KAAK,EAAGtD,KADT;AAEC,IAAA,SAAS,EAAG8C,SAFb;AAGC,IAAA,QAAQ,EAAGpC,QAHZ;AAIC,IAAA,IAAI,EAAGG,IAJR;AAKC,IAAA,iBAAiB,EAAGL,iBALrB;AAMC,IAAA,UAAU,EAAGH,UANd;AAOC,IAAA,KAAK,EAAGO,KAPT;AAQC,IAAA,OAAO,EAAGH,OARX;AASC,IAAA,OAAO,EAAGgB,OATX;AAUC,IAAA,qBAAqB,EAAGgC,qBAVzB;AAWC,IAAA,WAAW,EAAGvD,WAXf;AAYC,IAAA,IAAI,EAAGoC,IAZR;AAaC,IAAA,GAAG,EAAGlC,GAbP;AAcC,IAAA,kBAAkB,EAAG,CAAEW;AAdxB,IADD,CAVD,CA1BF,EAwDC,4BAAC,0BAAD,CACC;AADD;AAEC,IAAA,SAAS,MAFV;AAGC,IAAA,KAAK,EAAGX,GAHT;AAIC,IAAA,KAAK,EAAGuD,SAJT;AAKC,IAAA,SAAS,EAAGtC,oBALb;AAMC,IAAA,OAAO,EAAG,MAAMC,uBAAuB,CAAE,KAAF,CANxC;AAOC,IAAA,QAAQ,EAAG8B,SAPZ;AAQC,IAAA,eAAe;AARhB,IAxDD,CADD;AAqEA,CA3QD;;eA6QevD,S","sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tcreateUpgradedEmbedBlock,\n\tgetClassNames,\n\tfallback,\n\tgetAttributesFromPreview,\n\tgetEmbedInfoByProvider,\n} from './util';\nimport EmbedControls from './embed-controls';\nimport { embedContentIcon } from './icons';\nimport EmbedLoading from './embed-loading';\nimport EmbedPlaceholder from './embed-placeholder';\nimport EmbedPreview from './embed-preview';\nimport EmbedLinkSettings from './embed-link-settings';\n\n/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { _x } from '@wordpress/i18n';\nimport { useCallback, useState, useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { View } from '@wordpress/primitives';\n\n// The inline preview feature will be released progressible, for this reason\n// the embed will only be considered previewable for the following providers list.\nconst PREVIEWABLE_PROVIDERS = [ 'youtube', 'twitter', 'instagram', 'vimeo' ];\n// Some providers are rendering the inline preview as a WordPress embed and\n// are not supported yet, so we need to disallow them with a fixed providers list.\nconst NOT_PREVIEWABLE_WP_EMBED_PROVIDERS = [ 'pinterest' ];\n\nconst WP_EMBED_TYPE = 'wp-embed';\n\nconst EmbedEdit = ( props ) => {\n\tconst {\n\t\tattributes: { align, providerNameSlug, previewable, responsive, url },\n\t\tattributes,\n\t\tisSelected,\n\t\tonReplace,\n\t\tsetAttributes,\n\t\tinsertBlocksAfter,\n\t\tonFocus,\n\t\tclientId,\n\t} = props;\n\n\tconst defaultEmbedInfo = {\n\t\ttitle: _x( 'Embed', 'block title' ),\n\t\ticon: embedContentIcon,\n\t};\n\tconst embedInfoByProvider = getEmbedInfoByProvider( providerNameSlug );\n\tconst { icon, title } = embedInfoByProvider || defaultEmbedInfo;\n\n\tconst { wasBlockJustInserted } = useSelect(\n\t\t( select ) => ( {\n\t\t\twasBlockJustInserted: select(\n\t\t\t\tblockEditorStore\n\t\t\t).wasBlockJustInserted( clientId, 'inserter_menu' ),\n\t\t} ),\n\t\t[ clientId ]\n\t);\n\tconst [ isEditingURL, setIsEditingURL ] = useState(\n\t\tisSelected && wasBlockJustInserted && ! url\n\t);\n\tconst [ showEmbedBottomSheet, setShowEmbedBottomSheet ] = useState(\n\t\tisEditingURL\n\t);\n\tconst { invalidateResolution } = useDispatch( coreStore );\n\n\tconst {\n\t\tpreview,\n\t\tfetching,\n\t\tthemeSupportsResponsive,\n\t\tcannotEmbed,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEmbedPreview,\n\t\t\t\thasFinishedResolution,\n\t\t\t\tisPreviewEmbedFallback,\n\t\t\t\tgetThemeSupports,\n\t\t\t} = select( coreStore );\n\t\t\tif ( ! url ) {\n\t\t\t\treturn { fetching: false, cannotEmbed: false };\n\t\t\t}\n\n\t\t\tconst embedPreview = getEmbedPreview( url );\n\t\t\tconst hasResolvedEmbedPreview = hasFinishedResolution(\n\t\t\t\t'getEmbedPreview',\n\t\t\t\t[ url ]\n\t\t\t);\n\t\t\tconst previewIsFallback = isPreviewEmbedFallback( url );\n\n\t\t\t// The external oEmbed provider does not exist. We got no type info and no html.\n\t\t\tconst badEmbedProvider =\n\t\t\t\tembedPreview?.html === false &&\n\t\t\t\tembedPreview?.type === undefined;\n\t\t\t// Some WordPress URLs that can't be embedded will cause the API to return\n\t\t\t// a valid JSON response with no HTML and `code` set to 404, rather\n\t\t\t// than generating a fallback response as other embeds do.\n\t\t\tconst wordpressCantEmbed = embedPreview?.code === '404';\n\t\t\tconst validPreview =\n\t\t\t\t!! embedPreview && ! badEmbedProvider && ! wordpressCantEmbed;\n\n\t\t\treturn {\n\t\t\t\tpreview: validPreview ? embedPreview : undefined,\n\t\t\t\tfetching: ! hasResolvedEmbedPreview,\n\t\t\t\tthemeSupportsResponsive: getThemeSupports()[\n\t\t\t\t\t'responsive-embeds'\n\t\t\t\t],\n\t\t\t\tcannotEmbed: ! validPreview || previewIsFallback,\n\t\t\t};\n\t\t},\n\t\t[ url ]\n\t);\n\n\t/**\n\t * Returns the attributes derived from the preview, merged with the current attributes.\n\t *\n\t * @param {boolean} ignorePreviousClassName Determines if the previous className attribute should be ignored when merging.\n\t * @return {Object} Merged attributes.\n\t */\n\tconst getMergedAttributes = ( ignorePreviousClassName = false ) => {\n\t\tconst { allowResponsive, className } = attributes;\n\t\treturn {\n\t\t\t...attributes,\n\t\t\t...getAttributesFromPreview(\n\t\t\t\tpreview,\n\t\t\t\ttitle,\n\t\t\t\tignorePreviousClassName ? undefined : className,\n\t\t\t\tresponsive,\n\t\t\t\tallowResponsive\n\t\t\t),\n\t\t};\n\t};\n\n\tconst toggleResponsive = () => {\n\t\tconst { allowResponsive, className } = attributes;\n\t\tconst { html } = preview;\n\t\tconst newAllowResponsive = ! allowResponsive;\n\n\t\tsetAttributes( {\n\t\t\tallowResponsive: newAllowResponsive,\n\t\t\tclassName: getClassNames(\n\t\t\t\thtml,\n\t\t\t\tclassName,\n\t\t\t\tresponsive && newAllowResponsive\n\t\t\t),\n\t\t} );\n\t};\n\n\tuseEffect( () => {\n\t\tif ( ! preview?.html || ! cannotEmbed || fetching ) {\n\t\t\treturn;\n\t\t}\n\t\t// At this stage, we're not fetching the preview and know it can't be embedded,\n\t\t// so try removing any trailing slash, and resubmit.\n\t\tconst newURL = url.replace( /\\/$/, '' );\n\t\tsetIsEditingURL( false );\n\t\tsetAttributes( { url: newURL } );\n\t}, [ preview?.html, url ] );\n\n\t// Handle incoming preview\n\tuseEffect( () => {\n\t\tif ( preview && ! isEditingURL ) {\n\t\t\t// When obtaining an incoming preview, we set the attributes derived from\n\t\t\t// the preview data. In this case when getting the merged attributes,\n\t\t\t// we ignore the previous classname because it might not match the expected\n\t\t\t// classes by the new preview.\n\t\t\tsetAttributes( getMergedAttributes( true ) );\n\n\t\t\tif ( onReplace ) {\n\t\t\t\tconst upgradedBlock = createUpgradedEmbedBlock(\n\t\t\t\t\tprops,\n\t\t\t\t\tgetMergedAttributes()\n\t\t\t\t);\n\n\t\t\t\tif ( upgradedBlock ) {\n\t\t\t\t\tonReplace( upgradedBlock );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}, [ preview, isEditingURL ] );\n\n\tuseEffect( () => setShowEmbedBottomSheet( isEditingURL ), [\n\t\tisEditingURL,\n\t] );\n\n\tconst onEditURL = useCallback( ( value ) => {\n\t\t// The order of the following calls is important, we need to update the URL attribute before changing `isEditingURL`,\n\t\t// otherwise the side-effect that potentially replaces the block when updating the local state won't use the new URL\n\t\t// for creating the new block.\n\t\tsetAttributes( { url: value } );\n\t\tsetIsEditingURL( false );\n\t}, [] );\n\n\tconst blockProps = useBlockProps();\n\n\tif ( fetching ) {\n\t\treturn (\n\t\t\t<View { ...blockProps }>\n\t\t\t\t<EmbedLoading />\n\t\t\t</View>\n\t\t);\n\t}\n\n\tconst showEmbedPlaceholder = ! preview || cannotEmbed;\n\n\t// Even though we set attributes that get derived from the preview,\n\t// we don't access them directly because for the initial render,\n\t// the `setAttributes` call will not have taken effect. If we're\n\t// rendering responsive content, setting the responsive classes\n\t// after the preview has been rendered can result in unwanted\n\t// clipping or scrollbars. The `getAttributesFromPreview` function\n\t// that `getMergedAttributes` uses is memoized so that we're not\n\t// calculating them on every render.\n\tconst {\n\t\ttype,\n\t\tallowResponsive,\n\t\tclassName: classFromPreview,\n\t} = getMergedAttributes();\n\tconst className = classnames( classFromPreview, props.className );\n\n\tconst isProviderPreviewable =\n\t\tPREVIEWABLE_PROVIDERS.includes( providerNameSlug ) ||\n\t\t// For WordPress embeds, we enable the inline preview for all its providers\n\t\t// except the ones that are not supported yet.\n\t\t( WP_EMBED_TYPE === type &&\n\t\t\t! NOT_PREVIEWABLE_WP_EMBED_PROVIDERS.includes( providerNameSlug ) );\n\n\tconst linkLabel = WP_EMBED_TYPE === type ? 'WordPress' : title;\n\n\treturn (\n\t\t<>\n\t\t\t{ showEmbedPlaceholder ? (\n\t\t\t\t<>\n\t\t\t\t\t<View { ...blockProps }>\n\t\t\t\t\t\t<EmbedPlaceholder\n\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tlabel={ title }\n\t\t\t\t\t\t\tonPress={ ( event ) => {\n\t\t\t\t\t\t\t\tonFocus( event );\n\t\t\t\t\t\t\t\tsetIsEditingURL( true );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tcannotEmbed={ cannotEmbed }\n\t\t\t\t\t\t\tfallback={ () => fallback( url, onReplace ) }\n\t\t\t\t\t\t\ttryAgain={ () => {\n\t\t\t\t\t\t\t\tinvalidateResolution( 'getEmbedPreview', [\n\t\t\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\t\t] );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\topenEmbedLinkSettings={ () =>\n\t\t\t\t\t\t\t\tsetShowEmbedBottomSheet( true )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</View>\n\t\t\t\t</>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<EmbedControls\n\t\t\t\t\t\tthemeSupportsResponsive={ themeSupportsResponsive }\n\t\t\t\t\t\tblockSupportsResponsive={ responsive }\n\t\t\t\t\t\tallowResponsive={ allowResponsive }\n\t\t\t\t\t\ttoggleResponsive={ toggleResponsive }\n\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\tlinkLabel={ linkLabel }\n\t\t\t\t\t\tonEditURL={ onEditURL }\n\t\t\t\t\t/>\n\t\t\t\t\t<View { ...blockProps }>\n\t\t\t\t\t\t<EmbedPreview\n\t\t\t\t\t\t\talign={ align }\n\t\t\t\t\t\t\tclassName={ className }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tlabel={ title }\n\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\tpreview={ preview }\n\t\t\t\t\t\t\tisProviderPreviewable={ isProviderPreviewable }\n\t\t\t\t\t\t\tpreviewable={ previewable }\n\t\t\t\t\t\t\ttype={ type }\n\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\tisDefaultEmbedInfo={ ! embedInfoByProvider }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</View>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<EmbedLinkSettings\n\t\t\t\t// eslint-disable-next-line jsx-a11y/no-autofocus\n\t\t\t\tautoFocus\n\t\t\t\tvalue={ url }\n\t\t\t\tlabel={ linkLabel }\n\t\t\t\tisVisible={ showEmbedBottomSheet }\n\t\t\t\tonClose={ () => setShowEmbedBottomSheet( false ) }\n\t\t\t\tonSubmit={ onEditURL }\n\t\t\t\twithBottomSheet\n\t\t\t/>\n\t\t</>\n\t);\n};\n\nexport default EmbedEdit;\n"]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _embedLinkSettings = _interopRequireDefault(require("./embed-link-settings"));
|
|
13
|
+
|
|
14
|
+
var _i18n = require("@wordpress/i18n");
|
|
15
|
+
|
|
16
|
+
var _components = require("@wordpress/components");
|
|
17
|
+
|
|
18
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
19
|
+
|
|
20
|
+
var _data = require("@wordpress/data");
|
|
21
|
+
|
|
22
|
+
var _editPost = require("@wordpress/edit-post");
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Internal dependencies
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* WordPress dependencies
|
|
30
|
+
*/
|
|
31
|
+
function getResponsiveHelp(checked) {
|
|
32
|
+
return checked ? (0, _i18n.__)('This embed will preserve its aspect ratio when the browser is resized.') : (0, _i18n.__)('This embed may not preserve its aspect ratio when the browser is resized.');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const EmbedControls = _ref => {
|
|
36
|
+
let {
|
|
37
|
+
blockSupportsResponsive,
|
|
38
|
+
themeSupportsResponsive,
|
|
39
|
+
allowResponsive,
|
|
40
|
+
toggleResponsive,
|
|
41
|
+
url,
|
|
42
|
+
linkLabel,
|
|
43
|
+
onEditURL
|
|
44
|
+
} = _ref;
|
|
45
|
+
const {
|
|
46
|
+
closeGeneralSidebar: closeSettingsBottomSheet
|
|
47
|
+
} = (0, _data.useDispatch)(_editPost.store);
|
|
48
|
+
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_blockEditor.InspectorControls, null, themeSupportsResponsive && blockSupportsResponsive && (0, _element.createElement)(_components.PanelBody, {
|
|
49
|
+
title: (0, _i18n.__)('Media settings')
|
|
50
|
+
}, (0, _element.createElement)(_components.ToggleControl, {
|
|
51
|
+
label: (0, _i18n.__)('Resize for smaller devices'),
|
|
52
|
+
checked: allowResponsive,
|
|
53
|
+
help: getResponsiveHelp,
|
|
54
|
+
onChange: toggleResponsive
|
|
55
|
+
})), (0, _element.createElement)(_components.PanelBody, {
|
|
56
|
+
title: (0, _i18n.__)('Link settings')
|
|
57
|
+
}, (0, _element.createElement)(_embedLinkSettings.default, {
|
|
58
|
+
value: url,
|
|
59
|
+
label: linkLabel,
|
|
60
|
+
onSubmit: value => {
|
|
61
|
+
closeSettingsBottomSheet();
|
|
62
|
+
onEditURL(value);
|
|
63
|
+
}
|
|
64
|
+
}))));
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
var _default = EmbedControls;
|
|
68
|
+
exports.default = _default;
|
|
69
|
+
//# sourceMappingURL=embed-controls.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/embed/embed-controls.native.js"],"names":["getResponsiveHelp","checked","EmbedControls","blockSupportsResponsive","themeSupportsResponsive","allowResponsive","toggleResponsive","url","linkLabel","onEditURL","closeGeneralSidebar","closeSettingsBottomSheet","editPostStore","value"],"mappings":";;;;;;;;;;;AAGA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AAXA;AACA;AACA;;AAEA;AACA;AACA;AAOA,SAASA,iBAAT,CAA4BC,OAA5B,EAAsC;AACrC,SAAOA,OAAO,GACX,cACA,wEADA,CADW,GAIX,cACA,2EADA,CAJH;AAOA;;AAED,MAAMC,aAAa,GAAG,QAQf;AAAA,MARiB;AACvBC,IAAAA,uBADuB;AAEvBC,IAAAA,uBAFuB;AAGvBC,IAAAA,eAHuB;AAIvBC,IAAAA,gBAJuB;AAKvBC,IAAAA,GALuB;AAMvBC,IAAAA,SANuB;AAOvBC,IAAAA;AAPuB,GAQjB;AACN,QAAM;AAAEC,IAAAA,mBAAmB,EAAEC;AAAvB,MAAoD,uBACzDC,eADyD,CAA1D;AAIA,SACC,qDACC,4BAAC,8BAAD,QACGR,uBAAuB,IAAID,uBAA3B,IACD,4BAAC,qBAAD;AAAW,IAAA,KAAK,EAAG,cAAI,gBAAJ;AAAnB,KACC,4BAAC,yBAAD;AACC,IAAA,KAAK,EAAG,cAAI,4BAAJ,CADT;AAEC,IAAA,OAAO,EAAGE,eAFX;AAGC,IAAA,IAAI,EAAGL,iBAHR;AAIC,IAAA,QAAQ,EAAGM;AAJZ,IADD,CAFF,EAWC,4BAAC,qBAAD;AAAW,IAAA,KAAK,EAAG,cAAI,eAAJ;AAAnB,KACC,4BAAC,0BAAD;AACC,IAAA,KAAK,EAAGC,GADT;AAEC,IAAA,KAAK,EAAGC,SAFT;AAGC,IAAA,QAAQ,EAAKK,KAAF,IAAa;AACvBF,MAAAA,wBAAwB;AACxBF,MAAAA,SAAS,CAAEI,KAAF,CAAT;AACA;AANF,IADD,CAXD,CADD,CADD;AA0BA,CAvCD;;eAyCeX,a","sourcesContent":["/**\n * Internal dependencies\n */\nimport EmbedLinkSettings from './embed-link-settings';\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { PanelBody, ToggleControl } from '@wordpress/components';\nimport { InspectorControls } from '@wordpress/block-editor';\nimport { useDispatch } from '@wordpress/data';\nimport { store as editPostStore } from '@wordpress/edit-post';\n\nfunction getResponsiveHelp( checked ) {\n\treturn checked\n\t\t? __(\n\t\t\t\t'This embed will preserve its aspect ratio when the browser is resized.'\n\t\t )\n\t\t: __(\n\t\t\t\t'This embed may not preserve its aspect ratio when the browser is resized.'\n\t\t );\n}\n\nconst EmbedControls = ( {\n\tblockSupportsResponsive,\n\tthemeSupportsResponsive,\n\tallowResponsive,\n\ttoggleResponsive,\n\turl,\n\tlinkLabel,\n\tonEditURL,\n} ) => {\n\tconst { closeGeneralSidebar: closeSettingsBottomSheet } = useDispatch(\n\t\teditPostStore\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t{ themeSupportsResponsive && blockSupportsResponsive && (\n\t\t\t\t\t<PanelBody title={ __( 'Media settings' ) }>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Resize for smaller devices' ) }\n\t\t\t\t\t\t\tchecked={ allowResponsive }\n\t\t\t\t\t\t\thelp={ getResponsiveHelp }\n\t\t\t\t\t\t\tonChange={ toggleResponsive }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelBody>\n\t\t\t\t) }\n\t\t\t\t<PanelBody title={ __( 'Link settings' ) }>\n\t\t\t\t\t<EmbedLinkSettings\n\t\t\t\t\t\tvalue={ url }\n\t\t\t\t\t\tlabel={ linkLabel }\n\t\t\t\t\t\tonSubmit={ ( value ) => {\n\t\t\t\t\t\t\tcloseSettingsBottomSheet();\n\t\t\t\t\t\t\tonEditURL( value );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n};\n\nexport default EmbedControls;\n"]}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _element = require("@wordpress/element");
|
|
9
|
+
|
|
10
|
+
var _i18n = require("@wordpress/i18n");
|
|
11
|
+
|
|
12
|
+
var _components = require("@wordpress/components");
|
|
13
|
+
|
|
14
|
+
var _url = require("@wordpress/url");
|
|
15
|
+
|
|
16
|
+
var _data = require("@wordpress/data");
|
|
17
|
+
|
|
18
|
+
var _notices = require("@wordpress/notices");
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* WordPress dependencies
|
|
22
|
+
*/
|
|
23
|
+
const EmbedLinkSettings = _ref => {
|
|
24
|
+
let {
|
|
25
|
+
autoFocus,
|
|
26
|
+
value,
|
|
27
|
+
label,
|
|
28
|
+
isVisible,
|
|
29
|
+
onClose,
|
|
30
|
+
onSubmit,
|
|
31
|
+
withBottomSheet
|
|
32
|
+
} = _ref;
|
|
33
|
+
const url = (0, _element.useRef)(value);
|
|
34
|
+
const [inputURL, setInputURL] = (0, _element.useState)(value);
|
|
35
|
+
const {
|
|
36
|
+
createErrorNotice
|
|
37
|
+
} = (0, _data.useDispatch)(_notices.store);
|
|
38
|
+
const linkSettingsOptions = {
|
|
39
|
+
url: {
|
|
40
|
+
label: (0, _i18n.sprintf)( // translators: %s: embed block variant's label e.g: "Twitter".
|
|
41
|
+
(0, _i18n.__)('%s link'), label),
|
|
42
|
+
placeholder: (0, _i18n.__)('Add link'),
|
|
43
|
+
autoFocus,
|
|
44
|
+
autoFill: true
|
|
45
|
+
},
|
|
46
|
+
footer: {
|
|
47
|
+
label: (0, _element.createElement)(_components.FooterMessageLink, {
|
|
48
|
+
href: (0, _i18n.__)('https://wordpress.org/support/article/embeds/'),
|
|
49
|
+
value: (0, _i18n.__)('Learn more about embeds')
|
|
50
|
+
}),
|
|
51
|
+
separatorType: 'topFullWidth'
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
const onDismiss = (0, _element.useCallback)(() => {
|
|
55
|
+
if (!(0, _url.isURL)(url.current) && url.current !== '') {
|
|
56
|
+
createErrorNotice((0, _i18n.__)('Invalid URL. Please enter a valid URL.')); // If the URL was already defined, we submit it to stop showing the embed placeholder.
|
|
57
|
+
|
|
58
|
+
onSubmit(value);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
onSubmit(url.current);
|
|
63
|
+
}, [onSubmit, value]);
|
|
64
|
+
(0, _element.useEffect)(() => {
|
|
65
|
+
url.current = value;
|
|
66
|
+
setInputURL(value);
|
|
67
|
+
}, [value]);
|
|
68
|
+
/**
|
|
69
|
+
* If the Embed Bottom Sheet component does not utilize a bottom sheet then the onDismiss action is not
|
|
70
|
+
* called. Here we are wiring the onDismiss to the onClose callback that gets triggered when input is submitted.
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
const performOnCloseOperations = (0, _element.useCallback)(() => {
|
|
74
|
+
if (onClose) {
|
|
75
|
+
onClose();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (!withBottomSheet) {
|
|
79
|
+
onDismiss();
|
|
80
|
+
}
|
|
81
|
+
}, [onClose]);
|
|
82
|
+
const onSetAttributes = (0, _element.useCallback)(attributes => {
|
|
83
|
+
url.current = attributes.url;
|
|
84
|
+
setInputURL(attributes.url);
|
|
85
|
+
}, []);
|
|
86
|
+
return (0, _element.createElement)(_components.LinkSettingsNavigation, {
|
|
87
|
+
isVisible: isVisible,
|
|
88
|
+
url: inputURL,
|
|
89
|
+
onClose: performOnCloseOperations,
|
|
90
|
+
onDismiss: onDismiss,
|
|
91
|
+
setAttributes: onSetAttributes,
|
|
92
|
+
options: linkSettingsOptions,
|
|
93
|
+
testID: "embed-edit-url-modal",
|
|
94
|
+
withBottomSheet: withBottomSheet,
|
|
95
|
+
showIcon: true
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
var _default = EmbedLinkSettings;
|
|
100
|
+
exports.default = _default;
|
|
101
|
+
//# sourceMappingURL=embed-link-settings.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/embed/embed-link-settings.native.js"],"names":["EmbedLinkSettings","autoFocus","value","label","isVisible","onClose","onSubmit","withBottomSheet","url","inputURL","setInputURL","createErrorNotice","noticesStore","linkSettingsOptions","placeholder","autoFill","footer","separatorType","onDismiss","current","performOnCloseOperations","onSetAttributes","attributes"],"mappings":";;;;;;;AAWA;;AARA;;AACA;;AAIA;;AACA;;AACA;;AAVA;AACA;AACA;AAWA,MAAMA,iBAAiB,GAAG,QAQnB;AAAA,MARqB;AAC3BC,IAAAA,SAD2B;AAE3BC,IAAAA,KAF2B;AAG3BC,IAAAA,KAH2B;AAI3BC,IAAAA,SAJ2B;AAK3BC,IAAAA,OAL2B;AAM3BC,IAAAA,QAN2B;AAO3BC,IAAAA;AAP2B,GAQrB;AACN,QAAMC,GAAG,GAAG,qBAAQN,KAAR,CAAZ;AACA,QAAM,CAAEO,QAAF,EAAYC,WAAZ,IAA4B,uBAAUR,KAAV,CAAlC;AACA,QAAM;AAAES,IAAAA;AAAF,MAAwB,uBAAaC,cAAb,CAA9B;AAEA,QAAMC,mBAAmB,GAAG;AAC3BL,IAAAA,GAAG,EAAE;AACJL,MAAAA,KAAK,EAAE,oBACN;AACA,oBAAI,SAAJ,CAFM,EAGNA,KAHM,CADH;AAMJW,MAAAA,WAAW,EAAE,cAAI,UAAJ,CANT;AAOJb,MAAAA,SAPI;AAQJc,MAAAA,QAAQ,EAAE;AARN,KADsB;AAW3BC,IAAAA,MAAM,EAAE;AACPb,MAAAA,KAAK,EACJ,4BAAC,6BAAD;AACC,QAAA,IAAI,EAAG,cACN,+CADM,CADR;AAIC,QAAA,KAAK,EAAG,cAAI,yBAAJ;AAJT,QAFM;AASPc,MAAAA,aAAa,EAAE;AATR;AAXmB,GAA5B;AAwBA,QAAMC,SAAS,GAAG,0BAAa,MAAM;AACpC,Q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*/\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tLinkSettingsNavigation,\n\tFooterMessageLink,\n} from '@wordpress/components';\nimport { isURL } from '@wordpress/url';\nimport { useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useCallback, useEffect, useRef, useState } from '@wordpress/element';\n\nconst EmbedLinkSettings = ( {\n\tautoFocus,\n\tvalue,\n\tlabel,\n\tisVisible,\n\tonClose,\n\tonSubmit,\n\twithBottomSheet,\n} ) => {\n\tconst url = useRef( value );\n\tconst [ inputURL, setInputURL ] = useState( value );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tconst linkSettingsOptions = {\n\t\turl: {\n\t\t\tlabel: sprintf(\n\t\t\t\t// translators: %s: embed block variant's label e.g: \"Twitter\".\n\t\t\t\t__( '%s link' ),\n\t\t\t\tlabel\n\t\t\t),\n\t\t\tplaceholder: __( 'Add link' ),\n\t\t\tautoFocus,\n\t\t\tautoFill: true,\n\t\t},\n\t\tfooter: {\n\t\t\tlabel: (\n\t\t\t\t<FooterMessageLink\n\t\t\t\t\thref={ __(\n\t\t\t\t\t\t'https://wordpress.org/support/article/embeds/'\n\t\t\t\t\t) }\n\t\t\t\t\tvalue={ __( 'Learn more about embeds' ) }\n\t\t\t\t/>\n\t\t\t),\n\t\t\tseparatorType: 'topFullWidth',\n\t\t},\n\t};\n\n\tconst onDismiss = useCallback( () => {\n\t\tif ( ! isURL( url.current ) && url.current !== '' ) {\n\t\t\tcreateErrorNotice( __( 'Invalid URL. Please enter a valid URL.' ) );\n\t\t\t// If the URL was already defined, we submit it to stop showing the embed placeholder.\n\t\t\tonSubmit( value );\n\t\t\treturn;\n\t\t}\n\t\tonSubmit( url.current );\n\t}, [ onSubmit, value ] );\n\n\tuseEffect( () => {\n\t\turl.current = value;\n\t\tsetInputURL( value );\n\t}, [ value ] );\n\n\t/**\n\t * If the Embed Bottom Sheet component does not utilize a bottom sheet then the onDismiss action is not\n\t * called. Here we are wiring the onDismiss to the onClose callback that gets triggered when input is submitted.\n\t */\n\tconst performOnCloseOperations = useCallback( () => {\n\t\tif ( onClose ) {\n\t\t\tonClose();\n\t\t}\n\n\t\tif ( ! withBottomSheet ) {\n\t\t\tonDismiss();\n\t\t}\n\t}, [ onClose ] );\n\n\tconst onSetAttributes = useCallback( ( attributes ) => {\n\t\turl.current = attributes.url;\n\t\tsetInputURL( attributes.url );\n\t}, [] );\n\n\treturn (\n\t\t<LinkSettingsNavigation\n\t\t\tisVisible={ isVisible }\n\t\t\turl={ inputURL }\n\t\t\tonClose={ performOnCloseOperations }\n\t\t\tonDismiss={ onDismiss }\n\t\t\tsetAttributes={ onSetAttributes }\n\t\t\toptions={ linkSettingsOptions }\n\t\t\ttestID=\"embed-edit-url-modal\"\n\t\t\twithBottomSheet={ withBottomSheet }\n\t\t\tshowIcon\n\t\t/>\n\t);\n};\n\nexport default EmbedLinkSettings;\n"]}
|
|
@@ -7,8 +7,6 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _element = require("@wordpress/element");
|
|
9
9
|
|
|
10
|
-
var _i18n = require("@wordpress/i18n");
|
|
11
|
-
|
|
12
10
|
var _components = require("@wordpress/components");
|
|
13
11
|
|
|
14
12
|
/**
|
|
@@ -16,7 +14,7 @@ var _components = require("@wordpress/components");
|
|
|
16
14
|
*/
|
|
17
15
|
const EmbedLoading = () => (0, _element.createElement)("div", {
|
|
18
16
|
className: "wp-block-embed is-loading"
|
|
19
|
-
}, (0, _element.createElement)(_components.Spinner, null)
|
|
17
|
+
}, (0, _element.createElement)(_components.Spinner, null));
|
|
20
18
|
|
|
21
19
|
var _default = EmbedLoading;
|
|
22
20
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/embed/embed-loading.js"],"names":["EmbedLoading"],"mappings":";;;;;;;;;AAGA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/embed/embed-loading.js"],"names":["EmbedLoading"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGA,MAAMA,YAAY,GAAG,MACpB;AAAK,EAAA,SAAS,EAAC;AAAf,GACC,4BAAC,mBAAD,OADD,CADD;;eAMeA,Y","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Spinner } from '@wordpress/components';\n\nconst EmbedLoading = () => (\n\t<div className=\"wp-block-embed is-loading\">\n\t\t<Spinner />\n\t</div>\n);\n\nexport default EmbedLoading;\n"]}
|
|
@@ -44,7 +44,8 @@ const EmbedPlaceholder = _ref => {
|
|
|
44
44
|
onPress,
|
|
45
45
|
cannotEmbed,
|
|
46
46
|
fallback,
|
|
47
|
-
tryAgain
|
|
47
|
+
tryAgain,
|
|
48
|
+
openEmbedLinkSettings
|
|
48
49
|
} = _ref;
|
|
49
50
|
const containerStyle = (0, _compose.usePreferredColorSchemeStyle)(_styles.default.embed__container, _styles.default['embed__container--dark']);
|
|
50
51
|
const labelStyle = (0, _compose.usePreferredColorSchemeStyle)(_styles.default.embed__label, _styles.default['embed__label--dark']);
|
|
@@ -65,9 +66,15 @@ const EmbedPlaceholder = _ref => {
|
|
|
65
66
|
label: (0, _i18n.__)('Convert to link'),
|
|
66
67
|
value: 'convertToLinkOption',
|
|
67
68
|
onSelect: fallback
|
|
69
|
+
},
|
|
70
|
+
editLink: {
|
|
71
|
+
id: 'editLinkOption',
|
|
72
|
+
label: (0, _i18n.__)('Edit link'),
|
|
73
|
+
value: 'editLinkOption',
|
|
74
|
+
onSelect: openEmbedLinkSettings
|
|
68
75
|
}
|
|
69
76
|
};
|
|
70
|
-
const options = (0, _lodash.compact)([cannotEmbed && errorPickerOptions.retry, cannotEmbed && errorPickerOptions.convertToLink]);
|
|
77
|
+
const options = (0, _lodash.compact)([cannotEmbed && errorPickerOptions.retry, cannotEmbed && errorPickerOptions.convertToLink, cannotEmbed && errorPickerOptions.editLink]);
|
|
71
78
|
|
|
72
79
|
function onPickerSelect(value) {
|
|
73
80
|
const selectedItem = options.find(item => item.value === value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/embed/embed-placeholder.native.js"],"names":["EmbedPlaceholder","icon","isSelected","label","onPress","cannotEmbed","fallback","tryAgain","containerStyle","styles","embed__container","labelStyle","embed__label","descriptionStyle","embed__description","descriptionErrorStyle","actionStyle","embed__action","embedIconErrorStyle","cannotEmbedMenuPickerRef","errorPickerOptions","retry","id","value","onSelect","convertToLink","options","onPickerSelect","selectedItem","find","item","resolveOnPressEvent","current","presentPicker","noticeOutline","fill"],"mappings":";;;;;;;;;AAaA;;AAVA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AAnBA;AACA;AACA;;AAIA;AACA;AACA;;AAOA;AACA;AACA;AAIA,MAAMA,gBAAgB,GAAG,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/embed/embed-placeholder.native.js"],"names":["EmbedPlaceholder","icon","isSelected","label","onPress","cannotEmbed","fallback","tryAgain","openEmbedLinkSettings","containerStyle","styles","embed__container","labelStyle","embed__label","descriptionStyle","embed__description","descriptionErrorStyle","actionStyle","embed__action","embedIconErrorStyle","cannotEmbedMenuPickerRef","errorPickerOptions","retry","id","value","onSelect","convertToLink","editLink","options","onPickerSelect","selectedItem","find","item","resolveOnPressEvent","current","presentPicker","noticeOutline","fill"],"mappings":";;;;;;;;;AAaA;;AAVA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AAnBA;AACA;AACA;;AAIA;AACA;AACA;;AAOA;AACA;AACA;AAIA,MAAMA,gBAAgB,GAAG,QASlB;AAAA,MAToB;AAC1BC,IAAAA,IAD0B;AAE1BC,IAAAA,UAF0B;AAG1BC,IAAAA,KAH0B;AAI1BC,IAAAA,OAJ0B;AAK1BC,IAAAA,WAL0B;AAM1BC,IAAAA,QAN0B;AAO1BC,IAAAA,QAP0B;AAQ1BC,IAAAA;AAR0B,GASpB;AACN,QAAMC,cAAc,GAAG,2CACtBC,gBA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K,EAAGW;AAAd,KAA6BT,KAA7B,CAFD,EAGC,4BAAC,iBAAD;AAAM,IAAA,KAAK,EAAGc;AAAd,KACG,cAAI,UAAJ,CADH,CAHD,CA7BF,CAVD,CADD,CADD;AAqDA,CA1HD;;eA4HejB,gB","sourcesContent":["/**\n * External dependencies\n */\nimport { View, Text, TouchableWithoutFeedback } from 'react-native';\nimport { compact } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\nimport { Icon, Picker } from '@wordpress/components';\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport styles from './styles.scss';\nimport { noticeOutline } from '../../../components/src/mobile/gridicons';\n\nconst EmbedPlaceholder = ( {\n\ticon,\n\tisSelected,\n\tlabel,\n\tonPress,\n\tcannotEmbed,\n\tfallback,\n\ttryAgain,\n\topenEmbedLinkSettings,\n} ) => {\n\tconst containerStyle = usePreferredColorSchemeStyle(\n\t\tstyles.embed__container,\n\t\tstyles[ 'embed__container--dark' ]\n\t);\n\tconst labelStyle = usePreferredColorSchemeStyle(\n\t\tstyles.embed__label,\n\t\tstyles[ 'embed__label--dark' ]\n\t);\n\tconst descriptionStyle = styles.embed__description;\n\tconst descriptionErrorStyle = styles[ 'embed__description--error' ];\n\tconst actionStyle = usePreferredColorSchemeStyle(\n\t\tstyles.embed__action,\n\t\tstyles[ 'embed__action--dark' ]\n\t);\n\tconst embedIconErrorStyle = styles[ 'embed__icon--error' ];\n\n\tconst cannotEmbedMenuPickerRef = useRef();\n\n\tconst errorPickerOptions = {\n\t\tretry: {\n\t\t\tid: 'retryOption',\n\t\t\tlabel: __( 'Retry' ),\n\t\t\tvalue: 'retryOption',\n\t\t\tonSelect: tryAgain,\n\t\t},\n\t\tconvertToLink: {\n\t\t\tid: 'convertToLinkOption',\n\t\t\tlabel: __( 'Convert to link' ),\n\t\t\tvalue: 'convertToLinkOption',\n\t\t\tonSelect: fallback,\n\t\t},\n\t\teditLink: {\n\t\t\tid: 'editLinkOption',\n\t\t\tlabel: __( 'Edit link' ),\n\t\t\tvalue: 'editLinkOption',\n\t\t\tonSelect: openEmbedLinkSettings,\n\t\t},\n\t};\n\n\tconst options = compact( [\n\t\tcannotEmbed && errorPickerOptions.retry,\n\t\tcannotEmbed && errorPickerOptions.convertToLink,\n\t\tcannotEmbed && errorPickerOptions.editLink,\n\t] );\n\n\tfunction onPickerSelect( value ) {\n\t\tconst selectedItem = options.find( ( item ) => item.value === value );\n\t\tselectedItem.onSelect();\n\t}\n\n\t// When the content cannot be embedded the onPress should trigger the Picker instead of the onPress prop.\n\tfunction resolveOnPressEvent() {\n\t\tif ( cannotEmbed ) {\n\t\t\tcannotEmbedMenuPickerRef.current?.presentPicker();\n\t\t} else {\n\t\t\tonPress();\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<TouchableWithoutFeedback\n\t\t\t\taccessibilityRole={ 'button' }\n\t\t\t\taccessibilityHint={\n\t\t\t\t\tcannotEmbed\n\t\t\t\t\t\t? __( 'Double tap to view embed options.' )\n\t\t\t\t\t\t: __( 'Double tap to add a link.' )\n\t\t\t\t}\n\t\t\t\tonPress={ resolveOnPressEvent }\n\t\t\t\tdisabled={ ! isSelected }\n\t\t\t>\n\t\t\t\t<View style={ containerStyle }>\n\t\t\t\t\t{ cannotEmbed ? (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\ticon={ noticeOutline }\n\t\t\t\t\t\t\t\tfill={ embedIconErrorStyle.fill }\n\t\t\t\t\t\t\t\tstyle={ embedIconErrorStyle }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t\t\tdescriptionStyle,\n\t\t\t\t\t\t\t\t\tdescriptionErrorStyle,\n\t\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Unable to embed media' ) }\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t<Text style={ actionStyle }>\n\t\t\t\t\t\t\t\t{ __( 'More options' ) }\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t<Picker\n\t\t\t\t\t\t\t\ttitle={ __( 'Embed options' ) }\n\t\t\t\t\t\t\t\tref={ cannotEmbedMenuPickerRef }\n\t\t\t\t\t\t\t\toptions={ options }\n\t\t\t\t\t\t\t\tonChange={ onPickerSelect }\n\t\t\t\t\t\t\t\thideCancelButton\n\t\t\t\t\t\t\t\tleftAlign\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<BlockIcon icon={ icon } />\n\t\t\t\t\t\t\t<Text style={ labelStyle }>{ label }</Text>\n\t\t\t\t\t\t\t<Text style={ actionStyle }>\n\t\t\t\t\t\t\t\t{ __( 'ADD LINK' ) }\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</View>\n\t\t\t</TouchableWithoutFeedback>\n\t\t</>\n\t);\n};\n\nexport default EmbedPlaceholder;\n"]}
|
package/build/embed/index.js
CHANGED
package/build/embed/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/embed/index.js"],"names":["name","metadata","settings","icon","embedContentIcon","edit","save","transforms","variations","deprecated"],"mappings":";;;;;;;;;AAGA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AATA;AACA;AACA
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/embed/index.js"],"names":["name","metadata","settings","icon","embedContentIcon","edit","save","transforms","variations","deprecated"],"mappings":";;;;;;;;;AAGA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AATA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAGO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAEC,uBADiB;AAEvBC,EAAAA,IAAI,EAAJA,aAFuB;AAGvBC,EAAAA,IAAI,EAAJA,aAHuB;AAIvBC,EAAAA,UAAU,EAAVA,mBAJuB;AAKvBC,EAAAA,UAAU,EAAVA,mBALuB;AAMvBC,EAAAA,UAAU,EAAVA;AANuB,CAAjB","sourcesContent":["/**\n * Internal dependencies\n */\nimport edit from './edit';\nimport save from './save';\nimport metadata from './block.json';\nimport transforms from './transforms';\nimport variations from './variations';\nimport deprecated from './deprecated';\nimport { embedContentIcon } from './icons';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon: embedContentIcon,\n\tedit,\n\tsave,\n\ttransforms,\n\tvariations,\n\tdeprecated,\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/embed/transforms.js"],"names":["name","EMBED_BLOCK","metadata","transforms","from","type","isMatch","node","nodeName","test","textContent","match","length","transform","url","trim","to","blocks","caption","value","content"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/embed/transforms.js"],"names":["name","EMBED_BLOCK","metadata","transforms","from","type","isMatch","node","nodeName","test","textContent","match","length","transform","url","trim","to","blocks","caption","value","content"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAM;AAAEA,EAAAA,IAAI,EAAEC;AAAR,IAAwBC,QAA9B;AAEA;AACA;AACA;;AACA,MAAMC,UAAU,GAAG;AAClBC,EAAAA,IAAI,EAAE,CACL;AACCC,IAAAA,IAAI,EAAE,KADP;AAECC,IAAAA,OAAO,EAAIC,IAAF;AAAA;;AAAA,aACRA,IAAI,CAACC,QAAL,KAAkB,GAAlB,IACA,4BAA4BC,IAA5B,CAAkCF,IAAI,CAACG,WAAvC,CADA,IAEA,sBAAAH,IAAI,CAACG,WAAL,iGAAkBC,KAAlB,CAAyB,SAAzB,iFAAsCC,MAAtC,MAAiD,CAHzC;AAAA,KAFV;AAMCC,IAAAA,SAAS,EAAIN,IAAF,IAAY;AACtB,aAAO,yBAAaN,WAAb,EAA0B;AAChCa,QAAAA,GAAG,EAAEP,IAAI,CAACG,WAAL,CAAiBK,IAAjB;AAD2B,OAA1B,CAAP;AAGA;AAVF,GADK,CADY;AAelBC,EAAAA,EAAE,EAAE,CACH;AACCX,IAAAA,IAAI,EAAE,OADP;AAECY,IAAAA,MAAM,EAAE,CAAE,gBAAF,CAFT;AAGCX,IAAAA,OAAO,EAAE;AAAA,UAAE;AAAEQ,QAAAA;AAAF,OAAF;AAAA,aAAe,CAAC,CAAEA,GAAlB;AAAA,KAHV;AAICD,IAAAA,SAAS,EAAE,SAAwB;AAAA,UAAtB;AAAEC,QAAAA,GAAF;AAAOI,QAAAA;AAAP,OAAsB;AAClC,UAAIC,KAAK,GAAI,YAAYL,GAAK,KAAKA,GAAK,MAAxC;;AACA,UAAKI,OAAL,aAAKA,OAAL,eAAKA,OAAO,CAAEH,IAAT,EAAL,EAAuB;AACtBI,QAAAA,KAAK,IAAK,SAASD,OAAS,EAA5B;AACA;;AACD,aAAO,yBAAa,gBAAb,EAA+B;AACrCE,QAAAA,OAAO,EAAED;AAD4B,OAA/B,CAAP;AAGA;AAZF,GADG;AAfc,CAAnB;eAiCehB,U","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\n\nconst { name: EMBED_BLOCK } = metadata;\n\n/**\n * Default transforms for generic embeds.\n */\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'raw',\n\t\t\tisMatch: ( node ) =>\n\t\t\t\tnode.nodeName === 'P' &&\n\t\t\t\t/^\\s*(https?:\\/\\/\\S+)\\s*$/i.test( node.textContent ) &&\n\t\t\t\tnode.textContent?.match( /https/gi )?.length === 1,\n\t\t\ttransform: ( node ) => {\n\t\t\t\treturn createBlock( EMBED_BLOCK, {\n\t\t\t\t\turl: node.textContent.trim(),\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t],\n\tto: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/paragraph' ],\n\t\t\tisMatch: ( { url } ) => !! url,\n\t\t\ttransform: ( { url, caption } ) => {\n\t\t\t\tlet value = `<a href=\"${ url }\">${ url }</a>`;\n\t\t\t\tif ( caption?.trim() ) {\n\t\t\t\t\tvalue += `<br />${ caption }`;\n\t\t\t\t}\n\t\t\t\treturn createBlock( 'core/paragraph', {\n\t\t\t\t\tcontent: value,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n"]}
|
package/build/embed/util.js
CHANGED
package/build/embed/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/embed/util.js"],"names":["name","DEFAULT_EMBED_BLOCK","metadata","getEmbedInfoByProvider","provider","find","matchesPatterns","url","patterns","some","pattern","match","findMoreSuitableBlock","isFromWordPress","html","includes","getPhotoHtml","photo","imageUrl","thumbnail_url","photoPreview","title","createUpgradedEmbedBlock","props","attributesFromPreview","preview","attributes","providerNameSlug","type","restAttributes","matchedBlock","isCurrentBlockWP","WP_EMBED_TYPE","shouldCreateNewBlock","wpVariation","removeAspectRatioClasses","existingClassNames","aspectRatioClassNames","ASPECT_RATIOS","reduce","accumulator","className","getClassNames","allowResponsive","previewDocument","document","implementation","createHTMLDocument","body","innerHTML","iframe","querySelector","height","width","aspectRatio","toFixed","ratioIndex","length","potentialRatio","ratio","ratioDiff","fallback","onReplace","link","content","getAttributesFromPreview","currentClassNames","isResponsive","provider_name","providerName","toLowerCase"],"mappings":";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WAAO,EAAP;AACA;;AAED,QAAMC,UAAU,GAAG,EAAnB,CALI,CAMJ;;AACA,MAAI;AAAEE,IAAAA,IAAI,GAAG;AAAT,MAAoBH,OAAxB,CAPI,CAQJ;AACA;;AACA,QAAM;AAAEX,IAAAA,IAAF;AAAQsD,IAAAA,aAAa,EAAEC;AAAvB,MAAwC5C,OAA9C;AACA,QAAME,gBAAgB,GAAG,uBACxB,CAAE0C,YAAY,IAAIhD,KAAlB,EAA0BiD,WAA1B,EADwB,CAAzB;;AAIA,MAAKzD,eAAe,CAAEC,IAAF,CAApB,EAA+B;AAC9Bc,IAAAA,IAAI,GAAGI,wBAAP;AACA;;AAED,MAAKlB,IAAI,IAAI,YAAYc,IAAzB,EAAgC;AAC/BF,IAAAA,UAAU,CAACE,IAAX,GAAkBA,IAAlB;AACAF,IAAAA,UAAU,CAACC,gBAAX,GAA8BA,gBAA9B;AACA;;AAEDD,EAAAA,UAAU,CAACe,SAAX,GAAuBC,aAAa,CACnC5B,IADmC,EAEnCoD,iBAFmC,EAGnCC,YAAY,IAAIxB,eAHmB,CAApC;AAMA,SAAOjB,UAAP;AACA,CAtCsC,CAAjC","sourcesContent":["/**\n * Internal dependencies\n */\nimport { ASPECT_RATIOS, WP_EMBED_TYPE } from './constants';\n\n/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\nimport classnames from 'classnames/dedupe';\nimport memoize from 'memize';\n\n/**\n * WordPress dependencies\n */\nimport { renderToString } from '@wordpress/element';\nimport {\n\tcreateBlock,\n\tgetBlockType,\n\tgetBlockVariations,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\n\nconst { name: DEFAULT_EMBED_BLOCK } = metadata;\n\n/** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */\n\n/**\n * Returns the embed block's information by matching the provided service provider\n *\n * @param {string} provider The embed block's provider\n * @return {WPBlockVariation} The embed block's information\n */\nexport const getEmbedInfoByProvider = ( provider ) =>\n\tgetBlockVariations( DEFAULT_EMBED_BLOCK )?.find(\n\t\t( { name } ) => name === provider\n\t);\n\n/**\n * Returns true if any of the regular expressions match the URL.\n *\n * @param {string} url The URL to test.\n * @param {Array} patterns The list of regular expressions to test agains.\n * @return {boolean} True if any of the regular expressions match the URL.\n */\nexport const matchesPatterns = ( url, patterns = [] ) =>\n\tpatterns.some( ( pattern ) => url.match( pattern ) );\n\n/**\n * Finds the block variation that should be used for the URL,\n * based on the provided URL and the variation's patterns.\n *\n * @param {string} url The URL to test.\n * @return {WPBlockVariation} The block variation that should be used for this URL\n */\nexport const findMoreSuitableBlock = ( url ) =>\n\tgetBlockVariations( DEFAULT_EMBED_BLOCK )?.find( ( { patterns } ) =>\n\t\tmatchesPatterns( url, patterns )\n\t);\n\nexport const isFromWordPress = ( html ) =>\n\thtml && html.includes( 'class=\"wp-embedded-content\"' );\n\nexport const getPhotoHtml = ( photo ) => {\n\t// 100% width for the preview so it fits nicely into the document, some \"thumbnails\" are\n\t// actually the full size photo. If thumbnails not found, use full image.\n\tconst imageUrl = photo.thumbnail_url || photo.url;\n\tconst photoPreview = (\n\t\t<p>\n\t\t\t<img src={ imageUrl } alt={ photo.title } width=\"100%\" />\n\t\t</p>\n\t);\n\treturn renderToString( photoPreview );\n};\n\n/**\n * Creates a more suitable embed block based on the passed in props\n * and attributes generated from an embed block's preview.\n *\n * We require `attributesFromPreview` to be generated from the latest attributes\n * and preview, and because of the way the react lifecycle operates, we can't\n * guarantee that the attributes contained in the block's props are the latest\n * versions, so we require that these are generated separately.\n * See `getAttributesFromPreview` in the generated embed edit component.\n *\n * @param {Object} props The block's props.\n * @param {Object} [attributesFromPreview] Attributes generated from the block's most up to date preview.\n * @return {Object|undefined} A more suitable embed block if one exists.\n */\nexport const createUpgradedEmbedBlock = (\n\tprops,\n\tattributesFromPreview = {}\n) => {\n\tconst { preview, attributes = {} } = props;\n\tconst { url, providerNameSlug, type, ...restAttributes } = attributes;\n\n\tif ( ! url || ! getBlockType( DEFAULT_EMBED_BLOCK ) ) return;\n\n\tconst matchedBlock = findMoreSuitableBlock( url );\n\n\t// WordPress blocks can work on multiple sites, and so don't have patterns,\n\t// so if we're in a WordPress block, assume the user has chosen it for a WordPress URL.\n\tconst isCurrentBlockWP =\n\t\tproviderNameSlug === 'wordpress' || type === WP_EMBED_TYPE;\n\t// if current block is not WordPress and a more suitable block found\n\t// that is different from the current one, create the new matched block\n\tconst shouldCreateNewBlock =\n\t\t! isCurrentBlockWP &&\n\t\tmatchedBlock &&\n\t\t( matchedBlock.attributes.providerNameSlug !== providerNameSlug ||\n\t\t\t! providerNameSlug );\n\tif ( shouldCreateNewBlock ) {\n\t\treturn createBlock( DEFAULT_EMBED_BLOCK, {\n\t\t\turl,\n\t\t\t...restAttributes,\n\t\t\t...matchedBlock.attributes,\n\t\t} );\n\t}\n\n\tconst wpVariation = getBlockVariations( DEFAULT_EMBED_BLOCK )?.find(\n\t\t( { name } ) => name === 'wordpress'\n\t);\n\n\t// We can't match the URL for WordPress embeds, we have to check the HTML instead.\n\tif (\n\t\t! wpVariation ||\n\t\t! preview ||\n\t\t! isFromWordPress( preview.html ) ||\n\t\tisCurrentBlockWP\n\t) {\n\t\treturn;\n\t}\n\n\t// This is not the WordPress embed block so transform it into one.\n\treturn createBlock( DEFAULT_EMBED_BLOCK, {\n\t\turl,\n\t\t...wpVariation.attributes,\n\t\t// By now we have the preview, but when the new block first renders, it\n\t\t// won't have had all the attributes set, and so won't get the correct\n\t\t// type and it won't render correctly. So, we pass through the current attributes\n\t\t// here so that the initial render works when we switch to the WordPress\n\t\t// block. This only affects the WordPress block because it can't be\n\t\t// rendered in the usual Sandbox (it has a sandbox of its own) and it\n\t\t// relies on the preview to set the correct render type.\n\t\t...attributesFromPreview,\n\t} );\n};\n\n/**\n * Removes all previously set aspect ratio related classes and return the rest\n * existing class names.\n *\n * @param {string} existingClassNames Any existing class names.\n * @return {string} The class names without any aspect ratio related class.\n */\nexport const removeAspectRatioClasses = ( existingClassNames ) => {\n\tif ( ! existingClassNames ) {\n\t\t// Avoids extraneous work and also, by returning the same value as\n\t\t// received, ensures the post is not dirtied by a change of the block\n\t\t// attribute from `undefined` to an emtpy string.\n\t\treturn existingClassNames;\n\t}\n\tconst aspectRatioClassNames = ASPECT_RATIOS.reduce(\n\t\t( accumulator, { className } ) => {\n\t\t\taccumulator[ className ] = false;\n\t\t\treturn accumulator;\n\t\t},\n\t\t{ 'wp-has-aspect-ratio': false }\n\t);\n\treturn classnames( existingClassNames, aspectRatioClassNames );\n};\n\n/**\n * Returns class names with any relevant responsive aspect ratio names.\n *\n * @param {string} html The preview HTML that possibly contains an iframe with width and height set.\n * @param {string} existingClassNames Any existing class names.\n * @param {boolean} allowResponsive If the responsive class names should be added, or removed.\n * @return {string} Deduped class names.\n */\nexport function getClassNames(\n\thtml,\n\texistingClassNames,\n\tallowResponsive = true\n) {\n\tif ( ! allowResponsive ) {\n\t\treturn removeAspectRatioClasses( existingClassNames );\n\t}\n\n\tconst previewDocument = document.implementation.createHTMLDocument( '' );\n\tpreviewDocument.body.innerHTML = html;\n\tconst iframe = previewDocument.body.querySelector( 'iframe' );\n\n\t// If we have a fixed aspect iframe, and it's a responsive embed block.\n\tif ( iframe && iframe.height && iframe.width ) {\n\t\tconst aspectRatio = ( iframe.width / iframe.height ).toFixed( 2 );\n\t\t// Given the actual aspect ratio, find the widest ratio to support it.\n\t\tfor (\n\t\t\tlet ratioIndex = 0;\n\t\t\tratioIndex < ASPECT_RATIOS.length;\n\t\t\tratioIndex++\n\t\t) {\n\t\t\tconst potentialRatio = ASPECT_RATIOS[ ratioIndex ];\n\t\t\tif ( aspectRatio >= potentialRatio.ratio ) {\n\t\t\t\t// Evaluate the difference between actual aspect ratio and closest match.\n\t\t\t\t// If the difference is too big, do not scale the embed according to aspect ratio.\n\t\t\t\tconst ratioDiff = aspectRatio - potentialRatio.ratio;\n\t\t\t\tif ( ratioDiff > 0.1 ) {\n\t\t\t\t\t// No close aspect ratio match found.\n\t\t\t\t\treturn removeAspectRatioClasses( existingClassNames );\n\t\t\t\t}\n\t\t\t\t// Close aspect ratio match found.\n\t\t\t\treturn classnames(\n\t\t\t\t\tremoveAspectRatioClasses( existingClassNames ),\n\t\t\t\t\tpotentialRatio.className,\n\t\t\t\t\t'wp-has-aspect-ratio'\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn existingClassNames;\n}\n\n/**\n * Fallback behaviour for unembeddable URLs.\n * Creates a paragraph block containing a link to the URL, and calls `onReplace`.\n *\n * @param {string} url The URL that could not be embedded.\n * @param {Function} onReplace Function to call with the created fallback block.\n */\nexport function fallback( url, onReplace ) {\n\tconst link = <a href={ url }>{ url }</a>;\n\tonReplace(\n\t\tcreateBlock( 'core/paragraph', { content: renderToString( link ) } )\n\t);\n}\n\n/***\n * Gets block attributes based on the preview and responsive state.\n *\n * @param {Object} preview The preview data.\n * @param {string} title The block's title, e.g. Twitter.\n * @param {Object} currentClassNames The block's current class names.\n * @param {boolean} isResponsive Boolean indicating if the block supports responsive content.\n * @param {boolean} allowResponsive Apply responsive classes to fixed size content.\n * @return {Object} Attributes and values.\n */\nexport const getAttributesFromPreview = memoize(\n\t(\n\t\tpreview,\n\t\ttitle,\n\t\tcurrentClassNames,\n\t\tisResponsive,\n\t\tallowResponsive = true\n\t) => {\n\t\tif ( ! preview ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst attributes = {};\n\t\t// Some plugins only return HTML with no type info, so default this to 'rich'.\n\t\tlet { type = 'rich' } = preview;\n\t\t// If we got a provider name from the API, use it for the slug, otherwise we use the title,\n\t\t// because not all embed code gives us a provider name.\n\t\tconst { html, provider_name: providerName } = preview;\n\t\tconst providerNameSlug = kebabCase(\n\t\t\t( providerName || title ).toLowerCase()\n\t\t);\n\n\t\tif ( isFromWordPress( html ) ) {\n\t\t\ttype = WP_EMBED_TYPE;\n\t\t}\n\n\t\tif ( html || 'photo' === type ) {\n\t\t\tattributes.type = type;\n\t\t\tattributes.providerNameSlug = providerNameSlug;\n\t\t}\n\n\t\tattributes.className = getClassNames(\n\t\t\thtml,\n\t\t\tcurrentClassNames,\n\t\t\tisResponsive && allowResponsive\n\t\t);\n\n\t\treturn attributes;\n\t}\n);\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/embed/util.js"],"names":["name","DEFAULT_EMBED_BLOCK","metadata","getEmbedInfoByProvider","provider","find","matchesPatterns","url","patterns","some","pattern","match","findMoreSuitableBlock","isFromWordPress","html","includes","getPhotoHtml","photo","imageUrl","thumbnail_url","photoPreview","title","createUpgradedEmbedBlock","props","attributesFromPreview","preview","attributes","providerNameSlug","type","restAttributes","matchedBlock","isCurrentBlockWP","WP_EMBED_TYPE","shouldCreateNewBlock","wpVariation","removeAspectRatioClasses","existingClassNames","aspectRatioClassNames","ASPECT_RATIOS","reduce","accumulator","className","getClassNames","allowResponsive","previewDocument","document","implementation","createHTMLDocument","body","innerHTML","iframe","querySelector","height","width","aspectRatio","toFixed","ratioIndex","length","potentialRatio","ratio","ratioDiff","fallback","onReplace","link","content","getAttributesFromPreview","currentClassNames","isResponsive","provider_name","providerName","toLowerCase"],"mappings":";;;;;;;;;;;;;AAeA;;AAZA;;AAKA;;AACA;;AACA;;AAMA;;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAQA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAM;AAAEA,EAAAA,IAAI,EAAEC;AAAR,IAAgCC,QAAtC;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AACO,MAAMC,sBAAsB,GAAKC,QAAF;AAAA;;AAAA,gCACrC,gCAAoBH,mBAApB,CADqC,wDACrC,oBAA2CI,IAA3C,CACC;AAAA,QAAE;AAAEL,MAAAA;AAAF,KAAF;AAAA,WAAgBA,IAAI,KAAKI,QAAzB;AAAA,GADD,CADqC;AAAA,CAA/B;AAKP;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AAC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,CAACC,gBAAX,GAA8BA,gBAA9B;AACA;;AAEDD,EAAAA,UAAU,CAACe,SAAX,GAAuBC,aAAa,CACnC5B,IADmC,EAEnCoD,iBAFmC,EAGnCC,YAAY,IAAIxB,eAHmB,CAApC;AAMA,SAAOjB,UAAP;AACA,CAtCsC,CAAjC","sourcesContent":["/**\n * Internal dependencies\n */\nimport { ASPECT_RATIOS, WP_EMBED_TYPE } from './constants';\n\n/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\nimport classnames from 'classnames/dedupe';\nimport memoize from 'memize';\n\n/**\n * WordPress dependencies\n */\nimport { renderToString } from '@wordpress/element';\nimport {\n\tcreateBlock,\n\tgetBlockType,\n\tgetBlockVariations,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\n\nconst { name: DEFAULT_EMBED_BLOCK } = metadata;\n\n/** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */\n\n/**\n * Returns the embed block's information by matching the provided service provider\n *\n * @param {string} provider The embed block's provider\n * @return {WPBlockVariation} The embed block's information\n */\nexport const getEmbedInfoByProvider = ( provider ) =>\n\tgetBlockVariations( DEFAULT_EMBED_BLOCK )?.find(\n\t\t( { name } ) => name === provider\n\t);\n\n/**\n * Returns true if any of the regular expressions match the URL.\n *\n * @param {string} url The URL to test.\n * @param {Array} patterns The list of regular expressions to test agains.\n * @return {boolean} True if any of the regular expressions match the URL.\n */\nexport const matchesPatterns = ( url, patterns = [] ) =>\n\tpatterns.some( ( pattern ) => url.match( pattern ) );\n\n/**\n * Finds the block variation that should be used for the URL,\n * based on the provided URL and the variation's patterns.\n *\n * @param {string} url The URL to test.\n * @return {WPBlockVariation} The block variation that should be used for this URL\n */\nexport const findMoreSuitableBlock = ( url ) =>\n\tgetBlockVariations( DEFAULT_EMBED_BLOCK )?.find( ( { patterns } ) =>\n\t\tmatchesPatterns( url, patterns )\n\t);\n\nexport const isFromWordPress = ( html ) =>\n\thtml && html.includes( 'class=\"wp-embedded-content\"' );\n\nexport const getPhotoHtml = ( photo ) => {\n\t// 100% width for the preview so it fits nicely into the document, some \"thumbnails\" are\n\t// actually the full size photo. If thumbnails not found, use full image.\n\tconst imageUrl = photo.thumbnail_url || photo.url;\n\tconst photoPreview = (\n\t\t<p>\n\t\t\t<img src={ imageUrl } alt={ photo.title } width=\"100%\" />\n\t\t</p>\n\t);\n\treturn renderToString( photoPreview );\n};\n\n/**\n * Creates a more suitable embed block based on the passed in props\n * and attributes generated from an embed block's preview.\n *\n * We require `attributesFromPreview` to be generated from the latest attributes\n * and preview, and because of the way the react lifecycle operates, we can't\n * guarantee that the attributes contained in the block's props are the latest\n * versions, so we require that these are generated separately.\n * See `getAttributesFromPreview` in the generated embed edit component.\n *\n * @param {Object} props The block's props.\n * @param {Object} [attributesFromPreview] Attributes generated from the block's most up to date preview.\n * @return {Object|undefined} A more suitable embed block if one exists.\n */\nexport const createUpgradedEmbedBlock = (\n\tprops,\n\tattributesFromPreview = {}\n) => {\n\tconst { preview, attributes = {} } = props;\n\tconst { url, providerNameSlug, type, ...restAttributes } = attributes;\n\n\tif ( ! url || ! getBlockType( DEFAULT_EMBED_BLOCK ) ) return;\n\n\tconst matchedBlock = findMoreSuitableBlock( url );\n\n\t// WordPress blocks can work on multiple sites, and so don't have patterns,\n\t// so if we're in a WordPress block, assume the user has chosen it for a WordPress URL.\n\tconst isCurrentBlockWP =\n\t\tproviderNameSlug === 'wordpress' || type === WP_EMBED_TYPE;\n\t// if current block is not WordPress and a more suitable block found\n\t// that is different from the current one, create the new matched block\n\tconst shouldCreateNewBlock =\n\t\t! isCurrentBlockWP &&\n\t\tmatchedBlock &&\n\t\t( matchedBlock.attributes.providerNameSlug !== providerNameSlug ||\n\t\t\t! providerNameSlug );\n\tif ( shouldCreateNewBlock ) {\n\t\treturn createBlock( DEFAULT_EMBED_BLOCK, {\n\t\t\turl,\n\t\t\t...restAttributes,\n\t\t\t...matchedBlock.attributes,\n\t\t} );\n\t}\n\n\tconst wpVariation = getBlockVariations( DEFAULT_EMBED_BLOCK )?.find(\n\t\t( { name } ) => name === 'wordpress'\n\t);\n\n\t// We can't match the URL for WordPress embeds, we have to check the HTML instead.\n\tif (\n\t\t! wpVariation ||\n\t\t! preview ||\n\t\t! isFromWordPress( preview.html ) ||\n\t\tisCurrentBlockWP\n\t) {\n\t\treturn;\n\t}\n\n\t// This is not the WordPress embed block so transform it into one.\n\treturn createBlock( DEFAULT_EMBED_BLOCK, {\n\t\turl,\n\t\t...wpVariation.attributes,\n\t\t// By now we have the preview, but when the new block first renders, it\n\t\t// won't have had all the attributes set, and so won't get the correct\n\t\t// type and it won't render correctly. So, we pass through the current attributes\n\t\t// here so that the initial render works when we switch to the WordPress\n\t\t// block. This only affects the WordPress block because it can't be\n\t\t// rendered in the usual Sandbox (it has a sandbox of its own) and it\n\t\t// relies on the preview to set the correct render type.\n\t\t...attributesFromPreview,\n\t} );\n};\n\n/**\n * Removes all previously set aspect ratio related classes and return the rest\n * existing class names.\n *\n * @param {string} existingClassNames Any existing class names.\n * @return {string} The class names without any aspect ratio related class.\n */\nexport const removeAspectRatioClasses = ( existingClassNames ) => {\n\tif ( ! existingClassNames ) {\n\t\t// Avoids extraneous work and also, by returning the same value as\n\t\t// received, ensures the post is not dirtied by a change of the block\n\t\t// attribute from `undefined` to an emtpy string.\n\t\treturn existingClassNames;\n\t}\n\tconst aspectRatioClassNames = ASPECT_RATIOS.reduce(\n\t\t( accumulator, { className } ) => {\n\t\t\taccumulator[ className ] = false;\n\t\t\treturn accumulator;\n\t\t},\n\t\t{ 'wp-has-aspect-ratio': false }\n\t);\n\treturn classnames( existingClassNames, aspectRatioClassNames );\n};\n\n/**\n * Returns class names with any relevant responsive aspect ratio names.\n *\n * @param {string} html The preview HTML that possibly contains an iframe with width and height set.\n * @param {string} existingClassNames Any existing class names.\n * @param {boolean} allowResponsive If the responsive class names should be added, or removed.\n * @return {string} Deduped class names.\n */\nexport function getClassNames(\n\thtml,\n\texistingClassNames,\n\tallowResponsive = true\n) {\n\tif ( ! allowResponsive ) {\n\t\treturn removeAspectRatioClasses( existingClassNames );\n\t}\n\n\tconst previewDocument = document.implementation.createHTMLDocument( '' );\n\tpreviewDocument.body.innerHTML = html;\n\tconst iframe = previewDocument.body.querySelector( 'iframe' );\n\n\t// If we have a fixed aspect iframe, and it's a responsive embed block.\n\tif ( iframe && iframe.height && iframe.width ) {\n\t\tconst aspectRatio = ( iframe.width / iframe.height ).toFixed( 2 );\n\t\t// Given the actual aspect ratio, find the widest ratio to support it.\n\t\tfor (\n\t\t\tlet ratioIndex = 0;\n\t\t\tratioIndex < ASPECT_RATIOS.length;\n\t\t\tratioIndex++\n\t\t) {\n\t\t\tconst potentialRatio = ASPECT_RATIOS[ ratioIndex ];\n\t\t\tif ( aspectRatio >= potentialRatio.ratio ) {\n\t\t\t\t// Evaluate the difference between actual aspect ratio and closest match.\n\t\t\t\t// If the difference is too big, do not scale the embed according to aspect ratio.\n\t\t\t\tconst ratioDiff = aspectRatio - potentialRatio.ratio;\n\t\t\t\tif ( ratioDiff > 0.1 ) {\n\t\t\t\t\t// No close aspect ratio match found.\n\t\t\t\t\treturn removeAspectRatioClasses( existingClassNames );\n\t\t\t\t}\n\t\t\t\t// Close aspect ratio match found.\n\t\t\t\treturn classnames(\n\t\t\t\t\tremoveAspectRatioClasses( existingClassNames ),\n\t\t\t\t\tpotentialRatio.className,\n\t\t\t\t\t'wp-has-aspect-ratio'\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn existingClassNames;\n}\n\n/**\n * Fallback behaviour for unembeddable URLs.\n * Creates a paragraph block containing a link to the URL, and calls `onReplace`.\n *\n * @param {string} url The URL that could not be embedded.\n * @param {Function} onReplace Function to call with the created fallback block.\n */\nexport function fallback( url, onReplace ) {\n\tconst link = <a href={ url }>{ url }</a>;\n\tonReplace(\n\t\tcreateBlock( 'core/paragraph', { content: renderToString( link ) } )\n\t);\n}\n\n/***\n * Gets block attributes based on the preview and responsive state.\n *\n * @param {Object} preview The preview data.\n * @param {string} title The block's title, e.g. Twitter.\n * @param {Object} currentClassNames The block's current class names.\n * @param {boolean} isResponsive Boolean indicating if the block supports responsive content.\n * @param {boolean} allowResponsive Apply responsive classes to fixed size content.\n * @return {Object} Attributes and values.\n */\nexport const getAttributesFromPreview = memoize(\n\t(\n\t\tpreview,\n\t\ttitle,\n\t\tcurrentClassNames,\n\t\tisResponsive,\n\t\tallowResponsive = true\n\t) => {\n\t\tif ( ! preview ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst attributes = {};\n\t\t// Some plugins only return HTML with no type info, so default this to 'rich'.\n\t\tlet { type = 'rich' } = preview;\n\t\t// If we got a provider name from the API, use it for the slug, otherwise we use the title,\n\t\t// because not all embed code gives us a provider name.\n\t\tconst { html, provider_name: providerName } = preview;\n\t\tconst providerNameSlug = kebabCase(\n\t\t\t( providerName || title ).toLowerCase()\n\t\t);\n\n\t\tif ( isFromWordPress( html ) ) {\n\t\t\ttype = WP_EMBED_TYPE;\n\t\t}\n\n\t\tif ( html || 'photo' === type ) {\n\t\t\tattributes.type = type;\n\t\t\tattributes.providerNameSlug = providerNameSlug;\n\t\t}\n\n\t\tattributes.className = getClassNames(\n\t\t\thtml,\n\t\t\tcurrentClassNames,\n\t\t\tisResponsive && allowResponsive\n\t\t);\n\n\t\treturn attributes;\n\t}\n);\n"]}
|
|
@@ -11,6 +11,8 @@ var _element = require("@wordpress/element");
|
|
|
11
11
|
|
|
12
12
|
var _reactNative = require("react-native");
|
|
13
13
|
|
|
14
|
+
var _clipboard = _interopRequireDefault(require("@react-native-clipboard/clipboard"));
|
|
15
|
+
|
|
14
16
|
var _reactNativeBridge = require("@wordpress/react-native-bridge");
|
|
15
17
|
|
|
16
18
|
var _blockEditor = require("@wordpress/block-editor");
|
|
@@ -147,7 +149,7 @@ class FileEdit extends _element.Component {
|
|
|
147
149
|
href
|
|
148
150
|
} = this.props.attributes;
|
|
149
151
|
|
|
150
|
-
|
|
152
|
+
_clipboard.default.setString(href);
|
|
151
153
|
|
|
152
154
|
this.setState({
|
|
153
155
|
isUrlCopied: true
|
|
@@ -421,7 +423,8 @@ class FileEdit extends _element.Component {
|
|
|
421
423
|
onLongPress: openMediaOptions,
|
|
422
424
|
disabled: !isSelected
|
|
423
425
|
}, (0, _element.createElement)(_reactNative.View, {
|
|
424
|
-
onLayout: this.onLayout
|
|
426
|
+
onLayout: this.onLayout,
|
|
427
|
+
testID: "file-edit-container"
|
|
425
428
|
}, this.getPlaceholderWidth(placeholderText), isUploadInProgress || this.getToolbarEditButton(openMediaOptions), getMediaOptions(), isSelected && this.getInspectorControls(attributes, media, isUploadInProgress, isUploadFailed), (0, _element.createElement)(_reactNative.View, {
|
|
426
429
|
style: _style.default.container
|
|
427
430
|
}, (0, _element.createElement)(_blockEditor.RichText, {
|