@wordpress/block-library 6.0.1 → 6.0.5
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/build/block/edit.js +1 -1
- package/build/block/edit.js.map +1 -1
- package/build/button/deprecated.js +155 -10
- package/build/button/deprecated.js.map +1 -1
- package/build/button/edit.native.js +257 -330
- package/build/button/edit.native.js.map +1 -1
- package/build/button/index.js +4 -1
- package/build/button/index.js.map +1 -1
- package/build/buttons/deprecated.js +84 -2
- package/build/buttons/deprecated.js.map +1 -1
- package/build/buttons/edit.js +6 -42
- package/build/buttons/edit.js.map +1 -1
- package/build/buttons/index.js +16 -14
- package/build/buttons/index.js.map +1 -1
- package/build/buttons/save.js +4 -20
- package/build/buttons/save.js.map +1 -1
- package/build/buttons/transforms.js +15 -10
- package/build/buttons/transforms.js.map +1 -1
- package/build/categories/edit.js +16 -6
- package/build/categories/edit.js.map +1 -1
- package/build/categories/index.js +4 -0
- package/build/categories/index.js.map +1 -1
- package/build/code/edit.native.js +8 -5
- package/build/code/edit.native.js.map +1 -1
- package/build/code/index.js +24 -1
- package/build/code/index.js.map +1 -1
- package/build/column/edit.js +4 -2
- package/build/column/edit.js.map +1 -1
- package/build/column/index.js +4 -0
- package/build/column/index.js.map +1 -1
- package/build/column/save.js +7 -3
- package/build/column/save.js.map +1 -1
- package/build/columns/edit.js +1 -1
- package/build/columns/edit.js.map +1 -1
- package/build/columns/index.js +1 -0
- package/build/columns/index.js.map +1 -1
- package/build/columns/save.js +7 -2
- package/build/columns/save.js.map +1 -1
- package/build/comment-author-avatar/edit.js +83 -0
- package/build/comment-author-avatar/edit.js.map +1 -0
- package/build/{post-comment-date → comment-author-avatar}/index.js +25 -9
- package/build/comment-author-avatar/index.js.map +1 -0
- package/build/comment-author-name/deprecated.js +69 -0
- package/build/comment-author-name/deprecated.js.map +1 -0
- package/build/comment-author-name/edit.js +112 -0
- package/build/comment-author-name/edit.js.map +1 -0
- package/build/comment-author-name/index.js +77 -0
- package/build/comment-author-name/index.js.map +1 -0
- package/build/comment-content/edit.js +74 -0
- package/build/comment-content/edit.js.map +1 -0
- package/build/comment-content/index.js +68 -0
- package/build/comment-content/index.js.map +1 -0
- package/build/comment-date/deprecated.js +68 -0
- package/build/comment-date/deprecated.js.map +1 -0
- package/build/comment-date/edit.js +95 -0
- package/build/comment-date/edit.js.map +1 -0
- package/build/comment-date/index.js +72 -0
- package/build/comment-date/index.js.map +1 -0
- package/build/comment-edit-link/edit.js +61 -0
- package/build/comment-edit-link/edit.js.map +1 -0
- package/build/comment-edit-link/index.js +67 -0
- package/build/comment-edit-link/index.js.map +1 -0
- package/build/comment-reply-link/edit.js +63 -0
- package/build/comment-reply-link/edit.js.map +1 -0
- package/build/comment-reply-link/index.js +63 -0
- package/build/comment-reply-link/index.js.map +1 -0
- package/build/comment-template/edit.js +82 -0
- package/build/comment-template/edit.js.map +1 -0
- package/build/{post-comment-content → comment-template}/index.js +13 -8
- package/build/comment-template/index.js.map +1 -0
- package/build/comment-template/save.js +18 -0
- package/build/comment-template/save.js.map +1 -0
- package/build/comments-query-loop/edit.js +64 -0
- package/build/comments-query-loop/edit.js.map +1 -0
- package/build/comments-query-loop/index.js +67 -0
- package/build/comments-query-loop/index.js.map +1 -0
- package/build/comments-query-loop/save.js +22 -0
- package/build/comments-query-loop/save.js.map +1 -0
- package/build/comments-query-loop/toolbar.js +54 -0
- package/build/comments-query-loop/toolbar.js.map +1 -0
- package/build/cover/deprecated.js +180 -20
- package/build/cover/deprecated.js.map +1 -1
- package/build/cover/edit.js +62 -28
- package/build/cover/edit.js.map +1 -1
- package/build/cover/edit.native.js +6 -2
- package/build/cover/edit.native.js.map +1 -1
- package/build/cover/index.js +12 -1
- package/build/cover/index.js.map +1 -1
- package/build/cover/save.js +17 -14
- package/build/cover/save.js.map +1 -1
- package/build/cover/shared.js +3 -2
- package/build/cover/shared.js.map +1 -1
- package/build/embed/edit.native.js +4 -8
- package/build/embed/edit.native.js.map +1 -1
- package/build/embed/embed-bottom-sheet.native.js +4 -5
- package/build/embed/embed-bottom-sheet.native.js.map +1 -1
- package/build/embed/embed-no-preview.native.js +2 -1
- package/build/embed/embed-no-preview.native.js.map +1 -1
- package/build/embed/icons.js +16 -1
- package/build/embed/icons.js.map +1 -1
- package/build/embed/transforms.native.js +3 -1
- package/build/embed/transforms.native.js.map +1 -1
- package/build/embed/variations.js +20 -0
- package/build/embed/variations.js.map +1 -1
- package/build/freeform/edit.js +16 -4
- package/build/freeform/edit.js.map +1 -1
- package/build/gallery/edit.js +7 -0
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/gallery.js +1 -1
- package/build/gallery/gallery.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 +6 -1
- package/build/gallery/index.js.map +1 -1
- package/build/gallery/save.js +7 -2
- package/build/gallery/save.js.map +1 -1
- package/build/gallery/shared.js +0 -7
- package/build/gallery/shared.js.map +1 -1
- package/build/gallery/use-get-media.js +4 -10
- package/build/gallery/use-get-media.js.map +1 -1
- package/build/gallery/use-mobile-warning.js +43 -0
- package/build/gallery/use-mobile-warning.js.map +1 -0
- package/build/group/edit.js +1 -1
- package/build/group/edit.js.map +1 -1
- package/build/group/index.js +1 -0
- package/build/group/index.js.map +1 -1
- package/build/group/save.js +4 -5
- package/build/group/save.js.map +1 -1
- package/build/group/variations.js +2 -1
- package/build/group/variations.js.map +1 -1
- package/build/heading/autogenerate-anchors.js +90 -0
- package/build/heading/autogenerate-anchors.js.map +1 -0
- package/build/heading/edit.js +42 -5
- package/build/heading/edit.js.map +1 -1
- package/build/heading/index.js +14 -2
- package/build/heading/index.js.map +1 -1
- package/build/heading/transforms.js +14 -2
- package/build/heading/transforms.js.map +1 -1
- package/build/image/edit.native.js +126 -60
- package/build/image/edit.native.js.map +1 -1
- package/build/image/index.js +1 -1
- package/build/image/transforms.js +2 -1
- package/build/image/transforms.js.map +1 -1
- package/build/index.js +83 -70
- package/build/index.js.map +1 -1
- package/build/index.native.js +3 -1
- package/build/index.native.js.map +1 -1
- package/build/list/deprecated.js +111 -0
- package/build/list/deprecated.js.map +1 -0
- package/build/list/index.js +15 -3
- package/build/list/index.js.map +1 -1
- package/build/media-text/edit.js +1 -1
- package/build/media-text/edit.js.map +1 -1
- package/build/media-text/save.js +3 -3
- package/build/media-text/save.js.map +1 -1
- package/build/navigation/deprecated.js +340 -23
- package/build/navigation/deprecated.js.map +1 -1
- package/build/navigation/edit/index.js +372 -0
- package/build/navigation/edit/index.js.map +1 -0
- package/build/navigation/edit/inner-blocks.js +100 -0
- package/build/navigation/edit/inner-blocks.js.map +1 -0
- package/build/navigation/edit/navigation-menu-delete-control.js +60 -0
- package/build/navigation/edit/navigation-menu-delete-control.js.map +1 -0
- package/build/navigation/edit/navigation-menu-name-control.js +27 -0
- package/build/navigation/edit/navigation-menu-name-control.js.map +1 -0
- package/build/navigation/edit/navigation-menu-name-modal.js +54 -0
- package/build/navigation/edit/navigation-menu-name-modal.js.map +1 -0
- package/build/navigation/edit/navigation-menu-publish-button.js +53 -0
- package/build/navigation/edit/navigation-menu-publish-button.js.map +1 -0
- package/build/navigation/edit/navigation-menu-selector.js +49 -0
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -0
- package/build/navigation/edit/placeholder/index.js +207 -0
- package/build/navigation/edit/placeholder/index.js.map +1 -0
- package/build/navigation/{placeholder-preview.js → edit/placeholder/placeholder-preview.js} +14 -2
- package/build/navigation/edit/placeholder/placeholder-preview.js.map +1 -0
- package/build/navigation/{responsive-wrapper.js → edit/responsive-wrapper.js} +9 -5
- package/build/navigation/edit/responsive-wrapper.js.map +1 -0
- package/build/navigation/edit/unsaved-inner-blocks.js +153 -0
- package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -0
- package/build/navigation/{block-navigation-list.js → edit/use-list-view-modal.js} +34 -3
- package/build/navigation/edit/use-list-view-modal.js.map +1 -0
- package/build/navigation/index.js +25 -13
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/save.js +10 -1
- package/build/navigation/save.js.map +1 -1
- package/build/navigation/use-navigation-menu.js +40 -0
- package/build/navigation/use-navigation-menu.js.map +1 -0
- package/build/navigation/use-template-part-area-label.js +74 -0
- package/build/navigation/use-template-part-area-label.js.map +1 -0
- package/build/navigation/view.js +29 -26
- package/build/navigation/view.js.map +1 -1
- package/build/navigation-area/edit.js +97 -0
- package/build/navigation-area/edit.js.map +1 -0
- package/build/navigation-area/index.js +61 -0
- package/build/navigation-area/index.js.map +1 -0
- package/build/navigation-area/inner-blocks.js +33 -0
- package/build/navigation-area/inner-blocks.js.map +1 -0
- package/build/navigation-area/save.js +18 -0
- package/build/navigation-area/save.js.map +1 -0
- package/build/navigation-link/edit.js +69 -7
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-link/transforms.js +5 -1
- package/build/navigation-link/transforms.js.map +1 -1
- package/build/navigation-submenu/edit.js +2 -2
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/page-list/edit.js +125 -84
- package/build/page-list/edit.js.map +1 -1
- package/build/page-list/index.js +1 -35
- package/build/page-list/index.js.map +1 -1
- package/build/paragraph/edit.native.js +2 -1
- package/build/paragraph/edit.native.js.map +1 -1
- package/build/paragraph/index.js +8 -1
- package/build/paragraph/index.js.map +1 -1
- package/build/paragraph/transforms.js +8 -1
- package/build/paragraph/transforms.js.map +1 -1
- package/build/pattern/edit.js +43 -0
- package/build/pattern/edit.js.map +1 -0
- package/build/{post-comment-author → pattern}/index.js +11 -10
- package/build/pattern/index.js.map +1 -0
- package/build/post-author/index.js +12 -1
- package/build/post-author/index.js.map +1 -1
- package/build/post-comment/edit.js +7 -8
- package/build/post-comment/edit.js.map +1 -1
- package/build/post-comment/index.js +4 -3
- package/build/post-comment/index.js.map +1 -1
- package/build/post-comment/save.js +5 -1
- package/build/post-comment/save.js.map +1 -1
- package/build/post-comments/index.js +8 -1
- package/build/post-comments/index.js.map +1 -1
- package/build/post-comments-count/index.js +7 -1
- package/build/post-comments-count/index.js.map +1 -1
- package/build/post-comments-form/index.js +9 -2
- package/build/post-comments-form/index.js.map +1 -1
- package/build/post-comments-link/index.js +8 -1
- package/build/post-comments-link/index.js.map +1 -1
- package/build/post-content/edit.js +2 -2
- package/build/post-content/edit.js.map +1 -1
- package/build/post-date/deprecated.js +71 -0
- package/build/post-date/deprecated.js.map +1 -0
- package/build/post-date/edit.js +1 -1
- package/build/post-date/edit.js.map +1 -1
- package/build/post-date/index.js +12 -2
- package/build/post-date/index.js.map +1 -1
- package/build/post-excerpt/edit.js +1 -1
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-excerpt/index.js +12 -1
- package/build/post-excerpt/index.js.map +1 -1
- package/build/post-featured-image/index.js +5 -1
- package/build/post-featured-image/index.js.map +1 -1
- package/build/post-navigation-link/index.js +8 -1
- package/build/post-navigation-link/index.js.map +1 -1
- package/build/post-template/edit.js +8 -4
- package/build/post-template/edit.js.map +1 -1
- package/build/post-terms/edit.js +2 -6
- package/build/post-terms/edit.js.map +1 -1
- package/build/post-terms/index.js +7 -1
- package/build/post-terms/index.js.map +1 -1
- package/build/post-terms/use-post-terms.js +3 -1
- package/build/post-terms/use-post-terms.js.map +1 -1
- package/build/post-title/deprecated.js +84 -0
- package/build/post-title/deprecated.js.map +1 -0
- package/build/post-title/edit.js +1 -1
- package/build/post-title/edit.js.map +1 -1
- package/build/post-title/index.js +14 -2
- package/build/post-title/index.js.map +1 -1
- package/build/preformatted/edit.js +5 -2
- package/build/preformatted/edit.js.map +1 -1
- package/build/preformatted/edit.native.js +16 -6
- package/build/preformatted/edit.native.js.map +1 -1
- package/build/preformatted/index.js +9 -1
- package/build/preformatted/index.js.map +1 -1
- package/build/pullquote/blockquote.native.js +14 -2
- package/build/pullquote/blockquote.native.js.map +1 -1
- package/build/pullquote/edit.native.js +124 -0
- package/build/pullquote/edit.native.js.map +1 -0
- package/build/pullquote/figure.native.js +20 -8
- package/build/pullquote/figure.native.js.map +1 -1
- package/build/pullquote/index.js +12 -0
- package/build/pullquote/index.js.map +1 -1
- package/build/query/edit/index.js +1 -1
- package/build/query/edit/index.js.map +1 -1
- package/build/query/save.js +5 -1
- package/build/query/save.js.map +1 -1
- package/build/query-pagination/edit.js +1 -1
- package/build/query-pagination/edit.js.map +1 -1
- package/build/query-pagination-next/index.js +8 -1
- package/build/query-pagination-next/index.js.map +1 -1
- package/build/query-pagination-previous/index.js +8 -1
- package/build/query-pagination-previous/index.js.map +1 -1
- package/build/query-title/deprecated.js +70 -0
- package/build/query-title/deprecated.js.map +1 -0
- package/build/query-title/index.js +17 -2
- package/build/query-title/index.js.map +1 -1
- package/build/quote/deprecated.js +9 -0
- package/build/quote/deprecated.js.map +1 -1
- package/build/quote/index.js +17 -1
- package/build/quote/index.js.map +1 -1
- package/build/search/edit.js +27 -1
- package/build/search/edit.js.map +1 -1
- package/build/search/edit.native.js +38 -7
- package/build/search/edit.native.js.map +1 -1
- package/build/separator/separator-settings.js +1 -0
- package/build/separator/separator-settings.js.map +1 -1
- package/build/site-logo/edit.js +46 -21
- package/build/site-logo/edit.js.map +1 -1
- package/build/site-logo/index.js +6 -0
- package/build/site-logo/index.js.map +1 -1
- package/build/site-tagline/deprecated.js +68 -0
- package/build/site-tagline/deprecated.js.map +1 -0
- package/build/site-tagline/index.js +11 -3
- package/build/site-tagline/index.js.map +1 -1
- package/build/site-title/deprecated.js +81 -0
- package/build/site-title/deprecated.js.map +1 -0
- package/build/site-title/index.js +15 -2
- package/build/site-title/index.js.map +1 -1
- package/build/social-links/edit.js +2 -1
- package/build/social-links/edit.js.map +1 -1
- package/build/social-links/index.js +1 -0
- package/build/social-links/index.js.map +1 -1
- package/build/social-links/save.js +7 -2
- package/build/social-links/save.js.map +1 -1
- package/build/table/index.js +11 -0
- package/build/table/index.js.map +1 -1
- package/build/template-part/edit/inner-blocks.js +1 -1
- package/build/template-part/edit/inner-blocks.js.map +1 -1
- package/build/template-part/edit/placeholder/index.js +3 -3
- package/build/template-part/edit/placeholder/index.js.map +1 -1
- package/build/template-part/edit/placeholder/patterns-setup.js +3 -2
- package/build/template-part/edit/placeholder/patterns-setup.js.map +1 -1
- package/build/template-part/edit/selection/template-part-previews.js +1 -1
- package/build/template-part/edit/selection/template-part-previews.js.map +1 -1
- package/build/template-part/variations.js +1 -1
- package/build/template-part/variations.js.map +1 -1
- package/build/term-description/edit.js +1 -1
- package/build/term-description/edit.js.map +1 -1
- package/build/term-description/index.js +4 -1
- package/build/term-description/index.js.map +1 -1
- package/build/utils/clean-empty-object.js +31 -0
- package/build/utils/clean-empty-object.js.map +1 -0
- package/build/utils/migrate-font-family.js +49 -0
- package/build/utils/migrate-font-family.js.map +1 -0
- package/build/verse/deprecated.js +93 -14
- package/build/verse/deprecated.js.map +1 -1
- package/build/verse/index.js +10 -1
- package/build/verse/index.js.map +1 -1
- package/build-module/block/edit.js +1 -1
- package/build-module/block/edit.js.map +1 -1
- package/build-module/button/deprecated.js +155 -11
- package/build-module/button/deprecated.js.map +1 -1
- package/build-module/button/edit.native.js +259 -331
- package/build-module/button/edit.native.js.map +1 -1
- package/build-module/button/index.js +4 -1
- package/build-module/button/index.js.map +1 -1
- package/build-module/buttons/deprecated.js +82 -3
- package/build-module/buttons/deprecated.js.map +1 -1
- package/build-module/buttons/edit.js +6 -39
- package/build-module/buttons/edit.js.map +1 -1
- package/build-module/buttons/index.js +16 -13
- package/build-module/buttons/index.js.map +1 -1
- package/build-module/buttons/save.js +4 -18
- package/build-module/buttons/save.js.map +1 -1
- package/build-module/buttons/transforms.js +15 -10
- package/build-module/buttons/transforms.js.map +1 -1
- package/build-module/categories/edit.js +16 -6
- package/build-module/categories/edit.js.map +1 -1
- package/build-module/categories/index.js +4 -0
- package/build-module/categories/index.js.map +1 -1
- package/build-module/code/edit.native.js +9 -5
- package/build-module/code/edit.native.js.map +1 -1
- package/build-module/code/index.js +24 -1
- package/build-module/code/index.js.map +1 -1
- package/build-module/column/edit.js +4 -2
- package/build-module/column/edit.js.map +1 -1
- package/build-module/column/index.js +4 -0
- package/build-module/column/index.js.map +1 -1
- package/build-module/column/save.js +6 -4
- package/build-module/column/save.js.map +1 -1
- package/build-module/columns/edit.js +1 -1
- package/build-module/columns/edit.js.map +1 -1
- package/build-module/columns/index.js +1 -0
- package/build-module/columns/index.js.map +1 -1
- package/build-module/columns/save.js +5 -3
- package/build-module/columns/save.js.map +1 -1
- package/build-module/comment-author-avatar/edit.js +69 -0
- package/build-module/comment-author-avatar/edit.js.map +1 -0
- package/build-module/comment-author-avatar/index.js +52 -0
- package/build-module/comment-author-avatar/index.js.map +1 -0
- package/build-module/comment-author-name/deprecated.js +58 -0
- package/build-module/comment-author-name/deprecated.js.map +1 -0
- package/build-module/comment-author-name/edit.js +97 -0
- package/build-module/comment-author-name/edit.js.map +1 -0
- package/build-module/comment-author-name/index.js +63 -0
- package/build-module/comment-author-name/index.js.map +1 -0
- package/build-module/comment-content/edit.js +61 -0
- package/build-module/comment-content/edit.js.map +1 -0
- package/build-module/comment-content/index.js +55 -0
- package/build-module/comment-content/index.js.map +1 -0
- package/build-module/comment-date/deprecated.js +57 -0
- package/build-module/comment-date/deprecated.js.map +1 -0
- package/build-module/comment-date/edit.js +85 -0
- package/build-module/comment-date/edit.js.map +1 -0
- package/build-module/comment-date/index.js +58 -0
- package/build-module/comment-date/index.js.map +1 -0
- package/build-module/comment-edit-link/edit.js +48 -0
- package/build-module/comment-edit-link/edit.js.map +1 -0
- package/build-module/comment-edit-link/index.js +54 -0
- package/build-module/comment-edit-link/index.js.map +1 -0
- package/build-module/comment-reply-link/edit.js +50 -0
- package/build-module/comment-reply-link/edit.js.map +1 -0
- package/build-module/comment-reply-link/index.js +50 -0
- package/build-module/comment-reply-link/index.js.map +1 -0
- package/build-module/comment-template/edit.js +71 -0
- package/build-module/comment-template/edit.js.map +1 -0
- package/build-module/comment-template/index.js +35 -0
- package/build-module/comment-template/index.js.map +1 -0
- package/build-module/comment-template/save.js +10 -0
- package/build-module/comment-template/save.js.map +1 -0
- package/build-module/comments-query-loop/edit.js +50 -0
- package/build-module/comments-query-loop/edit.js.map +1 -0
- package/build-module/comments-query-loop/index.js +53 -0
- package/build-module/comments-query-loop/index.js.map +1 -0
- package/build-module/comments-query-loop/save.js +14 -0
- package/build-module/comments-query-loop/save.js.map +1 -0
- package/build-module/comments-query-loop/toolbar.js +44 -0
- package/build-module/comments-query-loop/toolbar.js.map +1 -0
- package/build-module/cover/deprecated.js +183 -21
- package/build-module/cover/deprecated.js.map +1 -1
- package/build-module/cover/edit.js +62 -28
- package/build-module/cover/edit.js.map +1 -1
- package/build-module/cover/edit.native.js +6 -2
- package/build-module/cover/edit.native.js.map +1 -1
- package/build-module/cover/index.js +12 -1
- package/build-module/cover/index.js.map +1 -1
- package/build-module/cover/save.js +18 -15
- package/build-module/cover/save.js.map +1 -1
- package/build-module/cover/shared.js +3 -2
- package/build-module/cover/shared.js.map +1 -1
- package/build-module/embed/edit.native.js +4 -8
- package/build-module/embed/edit.native.js.map +1 -1
- package/build-module/embed/embed-bottom-sheet.native.js +4 -5
- package/build-module/embed/embed-bottom-sheet.native.js.map +1 -1
- package/build-module/embed/embed-no-preview.native.js +2 -1
- package/build-module/embed/embed-no-preview.native.js.map +1 -1
- package/build-module/embed/icons.js +13 -0
- package/build-module/embed/icons.js.map +1 -1
- package/build-module/embed/transforms.native.js +2 -1
- package/build-module/embed/transforms.native.js.map +1 -1
- package/build-module/embed/variations.js +21 -1
- package/build-module/embed/variations.js.map +1 -1
- package/build-module/freeform/edit.js +16 -5
- package/build-module/freeform/edit.js.map +1 -1
- package/build-module/gallery/edit.js +6 -0
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/gallery.js +1 -1
- package/build-module/gallery/gallery.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 +6 -1
- package/build-module/gallery/index.js.map +1 -1
- package/build-module/gallery/save.js +5 -3
- package/build-module/gallery/save.js.map +1 -1
- package/build-module/gallery/shared.js +0 -6
- package/build-module/gallery/shared.js.map +1 -1
- package/build-module/gallery/use-get-media.js +4 -10
- package/build-module/gallery/use-get-media.js.map +1 -1
- package/build-module/gallery/use-mobile-warning.js +32 -0
- package/build-module/gallery/use-mobile-warning.js.map +1 -0
- package/build-module/group/edit.js +1 -1
- package/build-module/group/edit.js.map +1 -1
- package/build-module/group/index.js +1 -0
- package/build-module/group/index.js.map +1 -1
- package/build-module/group/save.js +5 -6
- package/build-module/group/save.js.map +1 -1
- package/build-module/group/variations.js +2 -1
- package/build-module/group/variations.js.map +1 -1
- package/build-module/heading/autogenerate-anchors.js +77 -0
- package/build-module/heading/autogenerate-anchors.js.map +1 -0
- package/build-module/heading/edit.js +43 -7
- package/build-module/heading/edit.js.map +1 -1
- package/build-module/heading/index.js +14 -2
- package/build-module/heading/index.js.map +1 -1
- package/build-module/heading/transforms.js +14 -2
- package/build-module/heading/transforms.js.map +1 -1
- package/build-module/image/edit.native.js +128 -63
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/index.js +1 -1
- package/build-module/image/transforms.js +2 -1
- package/build-module/image/transforms.js.map +1 -1
- package/build-module/index.js +59 -53
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +1 -2
- package/build-module/index.native.js.map +1 -1
- package/build-module/list/deprecated.js +99 -0
- package/build-module/list/deprecated.js.map +1 -0
- package/build-module/list/index.js +14 -3
- package/build-module/list/index.js.map +1 -1
- package/build-module/media-text/edit.js +1 -1
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/media-text/save.js +4 -4
- package/build-module/media-text/save.js.map +1 -1
- package/build-module/navigation/deprecated.js +336 -23
- package/build-module/navigation/deprecated.js.map +1 -1
- package/build-module/navigation/edit/index.js +346 -0
- package/build-module/navigation/edit/index.js.map +1 -0
- package/build-module/navigation/edit/inner-blocks.js +87 -0
- package/build-module/navigation/edit/inner-blocks.js.map +1 -0
- package/build-module/navigation/edit/navigation-menu-delete-control.js +50 -0
- package/build-module/navigation/edit/navigation-menu-delete-control.js.map +1 -0
- package/build-module/navigation/edit/navigation-menu-name-control.js +17 -0
- package/build-module/navigation/edit/navigation-menu-name-control.js.map +1 -0
- package/build-module/navigation/edit/navigation-menu-name-modal.js +46 -0
- package/build-module/navigation/edit/navigation-menu-name-modal.js.map +1 -0
- package/build-module/navigation/edit/navigation-menu-publish-button.js +40 -0
- package/build-module/navigation/edit/navigation-menu-publish-button.js.map +1 -0
- package/build-module/navigation/edit/navigation-menu-selector.js +36 -0
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -0
- package/build-module/navigation/edit/placeholder/index.js +189 -0
- package/build-module/navigation/edit/placeholder/index.js.map +1 -0
- package/build-module/navigation/{placeholder-preview.js → edit/placeholder/placeholder-preview.js} +11 -2
- package/build-module/navigation/edit/placeholder/placeholder-preview.js.map +1 -0
- package/build-module/navigation/{responsive-wrapper.js → edit/responsive-wrapper.js} +9 -5
- package/build-module/navigation/edit/responsive-wrapper.js.map +1 -0
- package/build-module/navigation/edit/unsaved-inner-blocks.js +136 -0
- package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -0
- package/build-module/navigation/{block-navigation-list.js → edit/use-list-view-modal.js} +31 -2
- package/build-module/navigation/edit/use-list-view-modal.js.map +1 -0
- package/build-module/navigation/index.js +25 -12
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/save.js +10 -1
- package/build-module/navigation/save.js.map +1 -1
- package/build-module/navigation/use-navigation-menu.js +31 -0
- package/build-module/navigation/use-navigation-menu.js.map +1 -0
- package/build-module/navigation/use-template-part-area-label.js +63 -0
- package/build-module/navigation/use-template-part-area-label.js.map +1 -0
- package/build-module/navigation/view.js +28 -26
- package/build-module/navigation/view.js.map +1 -1
- package/build-module/navigation-area/edit.js +82 -0
- package/build-module/navigation-area/edit.js.map +1 -0
- package/build-module/navigation-area/index.js +47 -0
- package/build-module/navigation-area/index.js.map +1 -0
- package/build-module/navigation-area/inner-blocks.js +25 -0
- package/build-module/navigation-area/inner-blocks.js.map +1 -0
- package/build-module/navigation-area/save.js +10 -0
- package/build-module/navigation-area/save.js.map +1 -0
- package/build-module/navigation-link/edit.js +72 -10
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-link/transforms.js +5 -1
- package/build-module/navigation-link/transforms.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +2 -2
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/page-list/edit.js +127 -86
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/page-list/index.js +1 -35
- package/build-module/page-list/index.js.map +1 -1
- package/build-module/paragraph/edit.native.js +2 -1
- package/build-module/paragraph/edit.native.js.map +1 -1
- package/build-module/paragraph/index.js +8 -1
- package/build-module/paragraph/index.js.map +1 -1
- package/build-module/paragraph/transforms.js +8 -1
- package/build-module/paragraph/transforms.js.map +1 -1
- package/build-module/pattern/edit.js +35 -0
- package/build-module/pattern/edit.js.map +1 -0
- package/build-module/pattern/index.js +29 -0
- package/build-module/pattern/index.js.map +1 -0
- package/build-module/post-author/index.js +12 -1
- package/build-module/post-author/index.js.map +1 -1
- package/build-module/post-comment/edit.js +8 -9
- package/build-module/post-comment/edit.js.map +1 -1
- package/build-module/post-comment/index.js +4 -3
- package/build-module/post-comment/index.js.map +1 -1
- package/build-module/post-comment/save.js +4 -2
- package/build-module/post-comment/save.js.map +1 -1
- package/build-module/post-comments/index.js +8 -1
- package/build-module/post-comments/index.js.map +1 -1
- package/build-module/post-comments-count/index.js +7 -1
- package/build-module/post-comments-count/index.js.map +1 -1
- package/build-module/post-comments-form/index.js +9 -2
- package/build-module/post-comments-form/index.js.map +1 -1
- package/build-module/post-comments-link/index.js +8 -1
- package/build-module/post-comments-link/index.js.map +1 -1
- package/build-module/post-content/edit.js +2 -2
- package/build-module/post-content/edit.js.map +1 -1
- package/build-module/post-date/deprecated.js +60 -0
- package/build-module/post-date/deprecated.js.map +1 -0
- package/build-module/post-date/edit.js +1 -1
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-date/index.js +11 -2
- package/build-module/post-date/index.js.map +1 -1
- package/build-module/post-excerpt/edit.js +1 -1
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/post-excerpt/index.js +12 -1
- package/build-module/post-excerpt/index.js.map +1 -1
- package/build-module/post-featured-image/index.js +5 -1
- package/build-module/post-featured-image/index.js.map +1 -1
- package/build-module/post-navigation-link/index.js +8 -1
- package/build-module/post-navigation-link/index.js.map +1 -1
- package/build-module/post-template/edit.js +10 -5
- package/build-module/post-template/edit.js.map +1 -1
- package/build-module/post-terms/edit.js +2 -6
- package/build-module/post-terms/edit.js.map +1 -1
- package/build-module/post-terms/index.js +7 -1
- package/build-module/post-terms/index.js.map +1 -1
- package/build-module/post-terms/use-post-terms.js +3 -1
- package/build-module/post-terms/use-post-terms.js.map +1 -1
- package/build-module/post-title/deprecated.js +73 -0
- package/build-module/post-title/deprecated.js.map +1 -0
- package/build-module/post-title/edit.js +1 -1
- package/build-module/post-title/edit.js.map +1 -1
- package/build-module/post-title/index.js +13 -2
- package/build-module/post-title/index.js.map +1 -1
- package/build-module/preformatted/edit.js +5 -2
- package/build-module/preformatted/edit.js.map +1 -1
- package/build-module/preformatted/edit.native.js +17 -6
- package/build-module/preformatted/edit.native.js.map +1 -1
- package/build-module/preformatted/index.js +9 -1
- package/build-module/preformatted/index.js.map +1 -1
- package/build-module/pullquote/blockquote.native.js +14 -2
- package/build-module/pullquote/blockquote.native.js.map +1 -1
- package/build-module/pullquote/edit.native.js +112 -0
- package/build-module/pullquote/edit.native.js.map +1 -0
- package/build-module/pullquote/figure.native.js +20 -9
- package/build-module/pullquote/figure.native.js.map +1 -1
- package/build-module/pullquote/index.js +12 -0
- package/build-module/pullquote/index.js.map +1 -1
- package/build-module/query/edit/index.js +1 -1
- package/build-module/query/edit/index.js.map +1 -1
- package/build-module/query/save.js +4 -2
- package/build-module/query/save.js.map +1 -1
- package/build-module/query-pagination/edit.js +1 -1
- package/build-module/query-pagination/edit.js.map +1 -1
- package/build-module/query-pagination-next/index.js +8 -1
- package/build-module/query-pagination-next/index.js.map +1 -1
- package/build-module/query-pagination-previous/index.js +8 -1
- package/build-module/query-pagination-previous/index.js.map +1 -1
- package/build-module/query-title/deprecated.js +59 -0
- package/build-module/query-title/deprecated.js.map +1 -0
- package/build-module/query-title/index.js +16 -2
- package/build-module/query-title/index.js.map +1 -1
- package/build-module/quote/deprecated.js +9 -0
- package/build-module/quote/deprecated.js.map +1 -1
- package/build-module/quote/index.js +17 -1
- package/build-module/quote/index.js.map +1 -1
- package/build-module/search/edit.js +28 -2
- package/build-module/search/edit.js.map +1 -1
- package/build-module/search/edit.native.js +38 -7
- package/build-module/search/edit.native.js.map +1 -1
- package/build-module/separator/separator-settings.js +1 -0
- package/build-module/separator/separator-settings.js.map +1 -1
- package/build-module/site-logo/edit.js +49 -26
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/site-logo/index.js +6 -0
- package/build-module/site-logo/index.js.map +1 -1
- package/build-module/site-tagline/deprecated.js +57 -0
- package/build-module/site-tagline/deprecated.js.map +1 -0
- package/build-module/site-tagline/index.js +10 -3
- package/build-module/site-tagline/index.js.map +1 -1
- package/build-module/site-title/deprecated.js +70 -0
- package/build-module/site-title/deprecated.js.map +1 -0
- package/build-module/site-title/index.js +14 -2
- package/build-module/site-title/index.js.map +1 -1
- package/build-module/social-links/edit.js +2 -1
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/social-links/index.js +1 -0
- package/build-module/social-links/index.js.map +1 -1
- package/build-module/social-links/save.js +5 -3
- package/build-module/social-links/save.js.map +1 -1
- package/build-module/table/index.js +11 -0
- package/build-module/table/index.js.map +1 -1
- package/build-module/template-part/edit/inner-blocks.js +1 -1
- package/build-module/template-part/edit/inner-blocks.js.map +1 -1
- package/build-module/template-part/edit/placeholder/index.js +3 -3
- package/build-module/template-part/edit/placeholder/index.js.map +1 -1
- package/build-module/template-part/edit/placeholder/patterns-setup.js +3 -2
- package/build-module/template-part/edit/placeholder/patterns-setup.js.map +1 -1
- package/build-module/template-part/edit/selection/template-part-previews.js +1 -1
- package/build-module/template-part/edit/selection/template-part-previews.js.map +1 -1
- package/build-module/template-part/variations.js +2 -2
- package/build-module/template-part/variations.js.map +1 -1
- package/build-module/term-description/edit.js +1 -1
- package/build-module/term-description/edit.js.map +1 -1
- package/build-module/term-description/index.js +4 -1
- package/build-module/term-description/index.js.map +1 -1
- package/build-module/utils/clean-empty-object.js +22 -0
- package/build-module/utils/clean-empty-object.js.map +1 -0
- package/build-module/utils/migrate-font-family.js +38 -0
- package/build-module/utils/migrate-font-family.js.map +1 -0
- package/build-module/verse/deprecated.js +90 -15
- package/build-module/verse/deprecated.js.map +1 -1
- package/build-module/verse/index.js +10 -1
- package/build-module/verse/index.js.map +1 -1
- package/build-style/button/editor-rtl.css +0 -1
- package/build-style/button/editor.css +0 -1
- package/build-style/button/style-rtl.css +15 -27
- package/build-style/button/style.css +15 -27
- package/build-style/buttons/editor-rtl.css +4 -8
- package/build-style/buttons/editor.css +4 -8
- package/build-style/buttons/style-rtl.css +1 -35
- package/build-style/buttons/style.css +1 -48
- package/build-style/columns/style-rtl.css +1 -1
- package/build-style/columns/style.css +1 -1
- package/build-style/common-rtl.css +2 -16
- package/build-style/common.css +2 -16
- package/build-style/cover/editor-rtl.css +14 -32
- package/build-style/cover/editor.css +14 -32
- package/build-style/cover/style-rtl.css +28 -40
- package/build-style/cover/style.css +28 -40
- package/build-style/editor-rtl.css +198 -145
- package/build-style/editor.css +198 -145
- package/build-style/image/editor-rtl.css +1 -0
- package/build-style/image/editor.css +1 -0
- package/build-style/image/style-rtl.css +4 -0
- package/build-style/image/style.css +4 -0
- package/build-style/media-text/style-rtl.css +1 -0
- package/build-style/media-text/style.css +1 -0
- package/build-style/navigation/editor-rtl.css +58 -16
- package/build-style/navigation/editor.css +58 -16
- package/build-style/navigation/style-rtl.css +51 -112
- package/build-style/navigation/style.css +51 -112
- package/build-style/navigation-link/editor-rtl.css +31 -14
- package/build-style/navigation-link/editor.css +31 -14
- package/build-style/navigation-link/style-rtl.css +1 -1
- package/build-style/navigation-link/style.css +1 -1
- package/build-style/navigation-submenu/editor-rtl.css +1 -1
- package/build-style/navigation-submenu/editor.css +1 -1
- package/build-style/navigation-submenu/style-rtl.css +2 -0
- package/build-style/navigation-submenu/style.css +2 -0
- package/build-style/page-list/style-rtl.css +4 -16
- package/build-style/page-list/style.css +4 -16
- package/build-style/post-author/style-rtl.css +0 -1
- package/build-style/post-author/style.css +0 -1
- package/build-style/post-comments/style-rtl.css +21 -1
- package/build-style/post-comments/style.css +21 -1
- package/build-style/post-comments-form/style-rtl.css +29 -0
- package/build-style/post-comments-form/style.css +29 -0
- package/build-style/post-featured-image/editor-rtl.css +1 -1
- package/build-style/post-featured-image/editor.css +1 -1
- package/build-style/post-featured-image/style-rtl.css +1 -1
- package/build-style/post-featured-image/style.css +1 -1
- package/build-style/quote/theme-rtl.css +1 -1
- package/build-style/quote/theme.css +1 -1
- package/build-style/reset-rtl.css +0 -5
- package/build-style/reset.css +0 -5
- package/build-style/search/style-rtl.css +18 -6
- package/build-style/search/style.css +18 -6
- package/build-style/separator/style-rtl.css +0 -1
- package/build-style/separator/style.css +0 -1
- package/build-style/site-logo/editor-rtl.css +82 -14
- package/build-style/site-logo/editor.css +82 -14
- package/build-style/site-logo/style-rtl.css +6 -2
- package/build-style/site-logo/style.css +6 -2
- package/build-style/social-link/editor-rtl.css +4 -0
- package/build-style/social-link/editor.css +4 -0
- package/build-style/social-links/editor-rtl.css +4 -0
- package/build-style/social-links/editor.css +4 -0
- package/build-style/social-links/style-rtl.css +7 -1
- package/build-style/social-links/style.css +7 -1
- package/build-style/style-rtl.css +192 -261
- package/build-style/style.css +192 -274
- package/build-style/template-part/editor-rtl.css +0 -7
- package/build-style/template-part/editor.css +0 -7
- package/build-style/theme-rtl.css +1 -1
- package/build-style/theme.css +1 -1
- package/package.json +20 -19
- package/src/audio/test/edit.native.js +4 -0
- package/src/block/edit.js +1 -1
- package/src/button/block.json +4 -1
- package/src/button/deprecated.js +149 -4
- package/src/button/edit.native.js +319 -366
- package/src/button/editor.scss +0 -1
- package/src/button/style.scss +18 -41
- package/src/buttons/block.json +15 -10
- package/src/buttons/deprecated.js +76 -3
- package/src/buttons/edit.js +4 -49
- package/src/buttons/editor.scss +8 -9
- package/src/buttons/index.js +0 -2
- package/src/buttons/save.js +4 -21
- package/src/buttons/style.scss +1 -51
- package/src/categories/block.json +4 -0
- package/src/categories/edit.js +36 -18
- package/src/categories/index.php +3 -0
- package/src/code/block.json +24 -1
- package/src/code/edit.native.js +12 -14
- package/src/column/block.json +4 -0
- package/src/column/edit.js +8 -2
- package/src/column/save.js +9 -12
- package/src/columns/block.json +1 -0
- package/src/columns/edit.js +1 -1
- package/src/columns/save.js +5 -6
- package/src/columns/style.scss +1 -1
- package/src/comment-author-avatar/block.json +34 -0
- package/src/comment-author-avatar/edit.js +96 -0
- package/src/comment-author-avatar/index.js +18 -0
- package/src/comment-author-avatar/index.php +62 -0
- package/src/comment-author-name/block.json +43 -0
- package/src/comment-author-name/deprecated.js +50 -0
- package/src/comment-author-name/edit.js +124 -0
- package/src/comment-author-name/index.js +20 -0
- package/src/comment-author-name/index.php +57 -0
- package/src/comment-content/block.json +37 -0
- package/src/comment-content/edit.js +80 -0
- package/src/{post-comment-content → comment-content}/index.js +1 -1
- package/src/comment-content/index.php +56 -0
- package/src/comment-date/block.json +38 -0
- package/src/comment-date/deprecated.js +49 -0
- package/src/comment-date/edit.js +106 -0
- package/src/{post-comment-date → comment-date}/index.js +2 -0
- package/src/comment-date/index.php +56 -0
- package/src/comment-edit-link/block.json +36 -0
- package/src/comment-edit-link/edit.js +68 -0
- package/src/{post-comment-author → comment-edit-link}/index.js +5 -5
- package/src/comment-edit-link/index.php +58 -0
- package/src/comment-reply-link/block.json +32 -0
- package/src/comment-reply-link/edit.js +59 -0
- package/src/comment-reply-link/index.js +18 -0
- package/src/comment-reply-link/index.php +80 -0
- package/src/comment-template/block.json +15 -0
- package/src/comment-template/edit.js +100 -0
- package/src/comment-template/index.js +20 -0
- package/src/comment-template/index.php +65 -0
- package/src/comment-template/save.js +8 -0
- package/src/comments-query-loop/block.json +33 -0
- package/src/comments-query-loop/edit.js +53 -0
- package/src/comments-query-loop/index.js +20 -0
- package/src/comments-query-loop/save.js +14 -0
- package/src/comments-query-loop/toolbar.js +57 -0
- package/src/common.scss +3 -17
- package/src/cover/block.json +12 -1
- package/src/cover/deprecated.js +707 -510
- package/src/cover/edit.js +70 -42
- package/src/cover/edit.native.js +5 -1
- package/src/cover/editor.scss +20 -38
- package/src/cover/save.js +30 -26
- package/src/cover/shared.js +3 -2
- package/src/cover/style.scss +9 -7
- package/src/editor.scss +4 -20
- package/src/embed/edit.native.js +6 -9
- package/src/embed/embed-bottom-sheet.native.js +4 -5
- package/src/embed/embed-no-preview.native.js +1 -0
- package/src/embed/icons.js +11 -0
- package/src/embed/test/__snapshots__/index.native.js.snap +181 -0
- package/src/embed/test/index.native.js +991 -0
- package/src/embed/transforms.native.js +2 -0
- package/src/embed/variations.js +21 -0
- package/src/file/test/__snapshots__/edit.native.js.snap +6 -3
- package/src/file/test/edit.native.js +4 -0
- package/src/freeform/edit.js +14 -4
- package/src/gallery/block.json +6 -1
- package/src/gallery/edit.js +7 -0
- package/src/gallery/editor.scss +0 -1
- package/src/gallery/gallery.js +1 -4
- package/src/gallery/gallery.native.js +1 -4
- package/src/gallery/index.php +52 -0
- package/src/gallery/save.js +9 -3
- package/src/gallery/shared.js +0 -7
- package/src/gallery/use-get-media.js +6 -11
- package/src/gallery/use-mobile-warning.js +28 -0
- package/src/group/block.json +1 -0
- package/src/group/edit.js +1 -1
- package/src/group/save.js +3 -8
- package/src/group/variations.js +1 -1
- package/src/heading/autogenerate-anchors.js +81 -0
- package/src/heading/block.json +14 -2
- package/src/heading/edit.js +42 -4
- package/src/home-link/index.php +3 -1
- package/src/image/block.json +1 -1
- package/src/image/edit.native.js +120 -64
- package/src/image/editor.scss +1 -0
- package/src/image/index.php +42 -0
- package/src/image/style.scss +8 -2
- package/src/image/test/edit.native.js +225 -40
- package/src/image/transforms.js +4 -0
- package/src/index.js +96 -88
- package/src/index.native.js +1 -1
- package/src/list/block.json +11 -2
- package/src/list/deprecated.js +79 -0
- package/src/list/index.js +2 -0
- package/src/media-text/edit.js +1 -1
- package/src/media-text/save.js +6 -4
- package/src/media-text/style.scss +1 -0
- package/src/navigation/block.json +41 -13
- package/src/navigation/deprecated.js +336 -27
- package/src/navigation/edit/index.js +510 -0
- package/src/navigation/edit/inner-blocks.js +134 -0
- package/src/navigation/edit/navigation-menu-delete-control.js +81 -0
- package/src/navigation/edit/navigation-menu-name-control.js +22 -0
- package/src/navigation/edit/navigation-menu-name-modal.js +69 -0
- package/src/navigation/edit/navigation-menu-publish-button.js +57 -0
- package/src/navigation/edit/navigation-menu-selector.js +42 -0
- package/src/navigation/edit/placeholder/index.js +257 -0
- package/src/navigation/{placeholder-preview.js → edit/placeholder/placeholder-preview.js} +13 -2
- package/src/navigation/{responsive-wrapper.js → edit/responsive-wrapper.js} +8 -6
- package/src/navigation/edit/unsaved-inner-blocks.js +197 -0
- package/src/navigation/edit/use-list-view-modal.js +72 -0
- package/src/navigation/editor.scss +86 -31
- package/src/navigation/index.js +0 -2
- package/src/navigation/index.php +54 -107
- package/src/navigation/save.js +7 -1
- package/src/navigation/style.scss +81 -155
- package/src/navigation/use-navigation-menu.js +60 -0
- package/src/navigation/use-template-part-area-label.js +78 -0
- package/src/navigation/view.js +33 -32
- package/src/navigation-area/block.json +27 -0
- package/src/navigation-area/edit.js +105 -0
- package/src/navigation-area/index.js +26 -0
- package/src/navigation-area/index.php +21 -0
- package/src/navigation-area/inner-blocks.js +24 -0
- package/src/navigation-area/save.js +8 -0
- package/src/navigation-link/edit.js +97 -12
- package/src/navigation-link/editor.scss +30 -19
- package/src/navigation-link/index.php +8 -10
- package/src/navigation-link/style.scss +1 -1
- package/src/navigation-link/transforms.js +5 -1
- package/src/navigation-submenu/edit.js +2 -2
- package/src/navigation-submenu/editor.scss +1 -1
- package/src/navigation-submenu/index.php +10 -9
- package/src/navigation-submenu/style.scss +5 -0
- package/src/page-list/block.json +0 -33
- package/src/page-list/edit.js +168 -110
- package/src/page-list/index.php +27 -26
- package/src/page-list/style.scss +4 -23
- package/src/paragraph/block.json +8 -1
- package/src/paragraph/edit.native.js +1 -0
- package/src/pattern/block.json +17 -0
- package/src/pattern/edit.js +41 -0
- package/src/pattern/index.js +12 -0
- package/src/pattern/index.php +44 -0
- package/src/post-author/block.json +12 -1
- package/src/post-author/style.scss +0 -1
- package/src/post-comment/block.json +4 -3
- package/src/post-comment/edit.js +16 -13
- package/src/post-comment/save.js +4 -6
- package/src/post-comments/block.json +8 -1
- package/src/post-comments/index.php +12 -3
- package/src/post-comments/style.scss +27 -1
- package/src/post-comments-count/block.json +7 -1
- package/src/post-comments-form/block.json +9 -2
- package/src/post-comments-form/index.php +0 -14
- package/src/post-comments-form/style.scss +47 -7
- package/src/post-comments-link/block.json +8 -1
- package/src/post-content/edit.js +2 -2
- package/src/post-date/block.json +8 -1
- package/src/post-date/deprecated.js +52 -0
- package/src/post-date/edit.js +1 -1
- package/src/post-date/index.js +2 -0
- package/src/post-excerpt/block.json +12 -1
- package/src/post-excerpt/edit.js +1 -7
- package/src/post-excerpt/index.php +7 -1
- package/src/post-featured-image/block.json +5 -1
- package/src/post-featured-image/editor.scss +1 -1
- package/src/post-featured-image/style.scss +1 -1
- package/src/post-navigation-link/block.json +8 -1
- package/src/post-navigation-link/index.php +1 -2
- package/src/post-template/edit.js +8 -3
- package/src/post-template/index.php +0 -11
- package/src/post-terms/block.json +7 -1
- package/src/post-terms/edit.js +2 -14
- package/src/post-terms/use-post-terms.js +1 -1
- package/src/post-title/block.json +10 -1
- package/src/post-title/deprecated.js +65 -0
- package/src/post-title/edit.js +1 -1
- package/src/post-title/index.js +2 -0
- package/src/post-title/index.php +7 -2
- package/src/preformatted/block.json +9 -1
- package/src/preformatted/edit.js +2 -1
- package/src/preformatted/edit.native.js +20 -6
- package/src/preformatted/styles.native.scss +5 -0
- package/src/preformatted/test/__snapshots__/edit.native.js.snap +20 -2
- package/src/pullquote/block.json +12 -0
- package/src/pullquote/blockquote.native.js +12 -2
- package/src/pullquote/edit.native.js +129 -0
- package/src/pullquote/figure.native.js +17 -7
- package/src/query/edit/index.js +1 -1
- package/src/query/save.js +4 -6
- package/src/query-pagination/edit.js +1 -1
- package/src/query-pagination-next/block.json +8 -1
- package/src/query-pagination-previous/block.json +8 -1
- package/src/query-title/block.json +13 -1
- package/src/query-title/deprecated.js +51 -0
- package/src/query-title/index.js +2 -0
- package/src/quote/block.json +15 -1
- package/src/quote/deprecated.js +10 -0
- package/src/quote/theme.scss +1 -0
- package/src/reset.scss +0 -9
- package/src/search/edit.js +29 -0
- package/src/search/edit.native.js +46 -12
- package/src/search/style.scss +54 -52
- package/src/search/test/__snapshots__/edit.native.js.snap +33 -5
- package/src/search/test/edit.native.js +4 -0
- package/src/separator/separator-settings.js +1 -0
- package/src/separator/style.scss +0 -1
- package/src/site-logo/block.json +6 -0
- package/src/site-logo/edit.js +59 -34
- package/src/site-logo/editor.scss +101 -16
- package/src/site-logo/index.php +20 -19
- package/src/site-logo/style.scss +8 -2
- package/src/site-tagline/block.json +7 -2
- package/src/site-tagline/deprecated.js +49 -0
- package/src/site-tagline/index.js +2 -0
- package/src/site-title/block.json +11 -1
- package/src/site-title/deprecated.js +62 -0
- package/src/site-title/index.js +2 -0
- package/src/site-title/index.php +3 -0
- package/src/social-link/editor.scss +4 -0
- package/src/social-links/block.json +1 -0
- package/src/social-links/edit.js +2 -1
- package/src/social-links/editor.scss +4 -0
- package/src/social-links/save.js +4 -6
- package/src/social-links/style.scss +8 -1
- package/src/table/block.json +11 -0
- package/src/template-part/edit/inner-blocks.js +1 -1
- package/src/template-part/edit/placeholder/index.js +5 -3
- package/src/template-part/edit/placeholder/patterns-setup.js +3 -2
- package/src/template-part/edit/selection/template-part-previews.js +3 -1
- package/src/template-part/editor.scss +0 -16
- package/src/template-part/index.php +6 -3
- package/src/template-part/variations.js +2 -2
- package/src/term-description/block.json +4 -1
- package/src/term-description/edit.js +1 -1
- package/src/utils/clean-empty-object.js +23 -0
- package/src/utils/migrate-font-family.js +37 -0
- package/src/verse/block.json +10 -1
- package/src/verse/deprecated.js +86 -25
- package/build/buttons/variations.js +0 -33
- package/build/buttons/variations.js.map +0 -1
- package/build/navigation/block-navigation-list.js.map +0 -1
- package/build/navigation/edit.js +0 -304
- package/build/navigation/edit.js.map +0 -1
- package/build/navigation/placeholder-preview.js.map +0 -1
- package/build/navigation/placeholder.js +0 -129
- package/build/navigation/placeholder.js.map +0 -1
- package/build/navigation/responsive-wrapper.js.map +0 -1
- package/build/navigation/use-block-navigator.js +0 -51
- package/build/navigation/use-block-navigator.js.map +0 -1
- package/build/navigation/variations.js +0 -32
- package/build/navigation/variations.js.map +0 -1
- package/build/post-comment-author/edit.js +0 -51
- package/build/post-comment-author/edit.js.map +0 -1
- package/build/post-comment-author/index.js.map +0 -1
- package/build/post-comment-content/edit.js +0 -37
- package/build/post-comment-content/edit.js.map +0 -1
- package/build/post-comment-content/index.js.map +0 -1
- package/build/post-comment-date/edit.js +0 -62
- package/build/post-comment-date/edit.js.map +0 -1
- package/build/post-comment-date/index.js.map +0 -1
- package/build-module/buttons/variations.js +0 -24
- package/build-module/buttons/variations.js.map +0 -1
- package/build-module/navigation/block-navigation-list.js.map +0 -1
- package/build-module/navigation/edit.js +0 -284
- package/build-module/navigation/edit.js.map +0 -1
- package/build-module/navigation/placeholder-preview.js.map +0 -1
- package/build-module/navigation/placeholder.js +0 -113
- package/build-module/navigation/placeholder.js.map +0 -1
- package/build-module/navigation/responsive-wrapper.js.map +0 -1
- package/build-module/navigation/use-block-navigator.js +0 -39
- package/build-module/navigation/use-block-navigator.js.map +0 -1
- package/build-module/navigation/variations.js +0 -23
- package/build-module/navigation/variations.js.map +0 -1
- package/build-module/post-comment-author/edit.js +0 -40
- package/build-module/post-comment-author/edit.js.map +0 -1
- package/build-module/post-comment-author/index.js +0 -31
- package/build-module/post-comment-author/index.js.map +0 -1
- package/build-module/post-comment-content/edit.js +0 -27
- package/build-module/post-comment-content/edit.js.map +0 -1
- package/build-module/post-comment-content/index.js +0 -31
- package/build-module/post-comment-content/index.js.map +0 -1
- package/build-module/post-comment-date/edit.js +0 -52
- package/build-module/post-comment-date/edit.js.map +0 -1
- package/build-module/post-comment-date/index.js +0 -36
- package/build-module/post-comment-date/index.js.map +0 -1
- package/build-style/post-author/editor-rtl.css +0 -104
- package/build-style/post-author/editor.css +0 -104
- package/build-style/query-title/editor-rtl.css +0 -80
- package/build-style/query-title/editor.css +0 -80
- package/build-style/term-description/editor-rtl.css +0 -80
- package/build-style/term-description/editor.css +0 -80
- package/src/buttons/variations.js +0 -24
- package/src/navigation/block-navigation-list.js +0 -38
- package/src/navigation/edit.js +0 -411
- package/src/navigation/placeholder.js +0 -154
- package/src/navigation/use-block-navigator.js +0 -46
- package/src/navigation/variations.js +0 -23
- package/src/post-author/editor.scss +0 -35
- package/src/post-comment-author/block.json +0 -13
- package/src/post-comment-author/edit.js +0 -35
- package/src/post-comment-author/index.php +0 -41
- package/src/post-comment-content/block.json +0 -13
- package/src/post-comment-content/edit.js +0 -32
- package/src/post-comment-content/index.php +0 -42
- package/src/post-comment-date/block.json +0 -18
- package/src/post-comment-date/edit.js +0 -54
- package/src/post-comment-date/index.php +0 -44
- package/src/query-title/editor.scss +0 -4
- package/src/term-description/editor.scss +0 -4
|
@@ -0,0 +1,991 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
getEditorHtml,
|
|
6
|
+
initializeEditor,
|
|
7
|
+
fireEvent,
|
|
8
|
+
waitFor,
|
|
9
|
+
within,
|
|
10
|
+
} from 'test/helpers';
|
|
11
|
+
import { Clipboard, Platform } from 'react-native';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* WordPress dependencies
|
|
15
|
+
*/
|
|
16
|
+
import {
|
|
17
|
+
getBlockTypes,
|
|
18
|
+
setDefaultBlockName,
|
|
19
|
+
unregisterBlockType,
|
|
20
|
+
} from '@wordpress/blocks';
|
|
21
|
+
import fetchRequest from '@wordpress/api-fetch';
|
|
22
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
23
|
+
import { dispatch } from '@wordpress/data';
|
|
24
|
+
import { requestPreview } from '@wordpress/react-native-bridge';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Internal dependencies
|
|
28
|
+
*/
|
|
29
|
+
import * as paragraph from '../../paragraph';
|
|
30
|
+
import * as embed from '..';
|
|
31
|
+
import { registerBlock } from '../..';
|
|
32
|
+
|
|
33
|
+
// Override modal mock to prevent unmounting it when is not visible.
|
|
34
|
+
// This is required to be able to trigger onClose and onDismiss events when
|
|
35
|
+
// the modal is dismissed.
|
|
36
|
+
jest.mock( 'react-native-modal', () => {
|
|
37
|
+
const mockComponent = require( 'react-native/jest/mockComponent' );
|
|
38
|
+
return mockComponent( 'react-native-modal' );
|
|
39
|
+
} );
|
|
40
|
+
const MODAL_DISMISS_EVENT = Platform.OS === 'ios' ? 'onDismiss' : 'onModalHide';
|
|
41
|
+
|
|
42
|
+
// oEmbed response mocks
|
|
43
|
+
const RICH_TEXT_EMBED_SUCCESS_RESPONSE = {
|
|
44
|
+
url: 'https://twitter.com/notnownikki',
|
|
45
|
+
html: '<p>Mock success response.</p>',
|
|
46
|
+
type: 'rich',
|
|
47
|
+
provider_name: 'Twitter',
|
|
48
|
+
provider_url: 'https://twitter.com',
|
|
49
|
+
version: '1.0',
|
|
50
|
+
};
|
|
51
|
+
const VIDEO_EMBED_SUCCESS_RESPONSE = {
|
|
52
|
+
url: 'https://www.youtube.com/watch?v=lXMskKTw3Bc',
|
|
53
|
+
html: '<iframe width="16" height="9"></iframe>',
|
|
54
|
+
type: 'video',
|
|
55
|
+
provider_name: 'YouTube',
|
|
56
|
+
provider_url: 'https://youtube.com',
|
|
57
|
+
version: '1.0',
|
|
58
|
+
};
|
|
59
|
+
const MOCK_EMBED_PHOTO_SUCCESS_RESPONSE = {
|
|
60
|
+
url: 'https://cloudup.com/cQFlxqtY4ob',
|
|
61
|
+
html: '<p>Mock success response.</p>',
|
|
62
|
+
type: 'photo',
|
|
63
|
+
provider_name: 'Cloudup',
|
|
64
|
+
provider_url: 'https://cloudup.com',
|
|
65
|
+
version: '1.0',
|
|
66
|
+
};
|
|
67
|
+
const MOCK_BAD_WORDPRESS_RESPONSE = {
|
|
68
|
+
code: 'oembed_invalid_url',
|
|
69
|
+
message: 'Not Found',
|
|
70
|
+
data: {
|
|
71
|
+
status: 404,
|
|
72
|
+
},
|
|
73
|
+
html: false,
|
|
74
|
+
};
|
|
75
|
+
const MOCK_BAD_EMBED_PROVIDER_RESPONSE = {
|
|
76
|
+
url: 'https://youtu.be/BAD_URL',
|
|
77
|
+
html: '<p>Mock bad response.</p>',
|
|
78
|
+
provider_name: 'Embed Provider',
|
|
79
|
+
version: '1.0',
|
|
80
|
+
};
|
|
81
|
+
const EMBED_NULL_RESPONSE = null;
|
|
82
|
+
|
|
83
|
+
// Embed block HTML examples
|
|
84
|
+
const EMPTY_EMBED_HTML = '<!-- wp:embed /-->';
|
|
85
|
+
const RICH_TEXT_EMBED_HTML = `<!-- wp:embed {"url":"https://twitter.com/notnownikki","type":"rich","providerNameSlug":"twitter","responsive":true} -->
|
|
86
|
+
<figure class="wp-block-embed is-type-rich is-provider-twitter wp-block-embed-twitter"><div class="wp-block-embed__wrapper">
|
|
87
|
+
https://twitter.com/notnownikki
|
|
88
|
+
</div></figure>
|
|
89
|
+
<!-- /wp:embed -->`;
|
|
90
|
+
const RICH_TEXT_ERROR_EMBED_HTML = `<!-- wp:embed {"url":"https://twitter.com/testing","type":"rich","providerNameSlug":"twitter","responsive":true} -->
|
|
91
|
+
<figure class="wp-block-embed is-type-rich is-provider-twitter wp-block-embed-twitter"><div class="wp-block-embed__wrapper">
|
|
92
|
+
https://twitter.com/testing
|
|
93
|
+
</div></figure>
|
|
94
|
+
<!-- /wp:embed -->`;
|
|
95
|
+
const PHOTO_EMBED_HTML = `<!-- wp:embed {"url":"https://cloudup.com/cQFlxqtY4ob","type":"photo","providerNameSlug":"cloudup","responsive":true} -->
|
|
96
|
+
<figure class="wp-block-embed is-type-photo is-provider-cloudup wp-block-embed-cloudup"><div class="wp-block-embed__wrapper">
|
|
97
|
+
https://cloudup.com/cQFlxqtY4ob
|
|
98
|
+
</div></figure>
|
|
99
|
+
<!-- /wp:embed -->`;
|
|
100
|
+
const WP_EMBED_HTML = `<!-- wp:embed {"url":"https://wordpress.org/news/2021/07/tatum/","type":"wp-embed","providerNameSlug":"wordpress-news"} -->
|
|
101
|
+
<figure class="wp-block-embed is-type-wp-embed is-provider-wordpress-news wp-block-embed-wordpress-news"><div class="wp-block-embed__wrapper">
|
|
102
|
+
https://wordpress.org/news/2021/07/tatum/
|
|
103
|
+
</div></figure>
|
|
104
|
+
<!-- /wp:embed -->`;
|
|
105
|
+
|
|
106
|
+
const EMPTY_PARAGRAPH_HTML =
|
|
107
|
+
'<!-- wp:paragraph --><p></p><!-- /wp:paragraph -->';
|
|
108
|
+
|
|
109
|
+
const MOST_USED_PROVIDERS = embed.settings.variations.filter( ( { name } ) =>
|
|
110
|
+
[ 'youtube', 'twitter', 'wordpress', 'vimeo' ].includes( name )
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
// Return specified mocked responses for the oembed endpoint.
|
|
114
|
+
const mockEmbedResponses = ( mockedResponses ) => {
|
|
115
|
+
fetchRequest.mockImplementation( ( { path } ) => {
|
|
116
|
+
if ( path.startsWith( '/wp/v2/themes' ) ) {
|
|
117
|
+
return Promise.resolve( [
|
|
118
|
+
{ theme_supports: { 'responsive-embeds': true } },
|
|
119
|
+
] );
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const matchedEmbedResponse = mockedResponses.find(
|
|
123
|
+
( mockedResponse ) =>
|
|
124
|
+
path ===
|
|
125
|
+
`/oembed/1.0/proxy?url=${ encodeURIComponent(
|
|
126
|
+
mockedResponse.url
|
|
127
|
+
) }`
|
|
128
|
+
);
|
|
129
|
+
return Promise.resolve( matchedEmbedResponse || {} );
|
|
130
|
+
} );
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const insertEmbedBlock = async ( blockTitle = 'Embed' ) => {
|
|
134
|
+
const editor = await initializeEditor( {
|
|
135
|
+
initialHtml: '',
|
|
136
|
+
} );
|
|
137
|
+
const { getByA11yLabel, getByText } = editor;
|
|
138
|
+
|
|
139
|
+
// Open inserter menu
|
|
140
|
+
fireEvent.press( await waitFor( () => getByA11yLabel( 'Add block' ) ) );
|
|
141
|
+
|
|
142
|
+
// Insert embed block
|
|
143
|
+
fireEvent.press( await waitFor( () => getByText( blockTitle ) ) );
|
|
144
|
+
|
|
145
|
+
// Return the embed block
|
|
146
|
+
const block = await waitFor( () =>
|
|
147
|
+
getByA11yLabel( /Embed Block\. Row 1/ )
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
return { ...editor, block };
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const initializeWithEmbedBlock = async ( initialHtml, selectBlock = true ) => {
|
|
154
|
+
const editor = await initializeEditor( { initialHtml } );
|
|
155
|
+
const { getByA11yLabel } = editor;
|
|
156
|
+
|
|
157
|
+
const block = await waitFor( () =>
|
|
158
|
+
getByA11yLabel( /Embed Block\. Row 1/ )
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
if ( selectBlock ) {
|
|
162
|
+
// Select block
|
|
163
|
+
fireEvent.press( block );
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return { ...editor, block };
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
beforeAll( () => {
|
|
170
|
+
// Paragraph block needs to be registered because by default a paragraph
|
|
171
|
+
// block is added to empty posts.
|
|
172
|
+
registerBlock( paragraph );
|
|
173
|
+
registerBlock( embed );
|
|
174
|
+
setDefaultBlockName( paragraph.name );
|
|
175
|
+
} );
|
|
176
|
+
|
|
177
|
+
beforeEach( () => {
|
|
178
|
+
// Invalidate embed preview resolutions
|
|
179
|
+
dispatch( coreStore ).invalidateResolutionForStoreSelector(
|
|
180
|
+
'getEmbedPreview'
|
|
181
|
+
);
|
|
182
|
+
// Mock embed responses
|
|
183
|
+
mockEmbedResponses( [
|
|
184
|
+
RICH_TEXT_EMBED_SUCCESS_RESPONSE,
|
|
185
|
+
VIDEO_EMBED_SUCCESS_RESPONSE,
|
|
186
|
+
MOCK_EMBED_PHOTO_SUCCESS_RESPONSE,
|
|
187
|
+
MOCK_BAD_EMBED_PROVIDER_RESPONSE,
|
|
188
|
+
] );
|
|
189
|
+
} );
|
|
190
|
+
|
|
191
|
+
afterAll( () => {
|
|
192
|
+
// Clean up registered blocks
|
|
193
|
+
getBlockTypes().forEach( ( block ) => {
|
|
194
|
+
unregisterBlockType( block.name );
|
|
195
|
+
} );
|
|
196
|
+
} );
|
|
197
|
+
|
|
198
|
+
describe( 'Embed block', () => {
|
|
199
|
+
describe( 'insertion', () => {
|
|
200
|
+
it( 'inserts generic embed block', async () => {
|
|
201
|
+
const { block } = await insertEmbedBlock();
|
|
202
|
+
|
|
203
|
+
const blockName = within( block ).getByText( 'Embed' );
|
|
204
|
+
|
|
205
|
+
expect( blockName ).toBeDefined();
|
|
206
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
207
|
+
} );
|
|
208
|
+
|
|
209
|
+
MOST_USED_PROVIDERS.forEach( ( { title } ) =>
|
|
210
|
+
it( `inserts ${ title } embed block`, async () => {
|
|
211
|
+
const { block } = await insertEmbedBlock( title );
|
|
212
|
+
const blockName = within( block ).getByText( title );
|
|
213
|
+
|
|
214
|
+
expect( blockName ).toBeDefined();
|
|
215
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
216
|
+
} )
|
|
217
|
+
);
|
|
218
|
+
} );
|
|
219
|
+
|
|
220
|
+
describe( 'set URL upon block insertion', () => {
|
|
221
|
+
it( 'sets empty URL when dismissing edit URL modal', async () => {
|
|
222
|
+
const { getByTestId } = await insertEmbedBlock();
|
|
223
|
+
|
|
224
|
+
// Wait for edit URL modal to be visible
|
|
225
|
+
const embedEditURLModal = getByTestId( 'embed-edit-url-modal' );
|
|
226
|
+
await waitFor( () => embedEditURLModal.props.isVisible );
|
|
227
|
+
|
|
228
|
+
// Dismiss the edit URL modal
|
|
229
|
+
fireEvent( embedEditURLModal, 'backdropPress' );
|
|
230
|
+
fireEvent( embedEditURLModal, MODAL_DISMISS_EVENT );
|
|
231
|
+
|
|
232
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
233
|
+
} );
|
|
234
|
+
|
|
235
|
+
it( 'sets a valid URL when dismissing edit URL modal', async () => {
|
|
236
|
+
const expectedURL = 'https://twitter.com/notnownikki';
|
|
237
|
+
|
|
238
|
+
const {
|
|
239
|
+
getByA11yLabel,
|
|
240
|
+
getByPlaceholderText,
|
|
241
|
+
getByTestId,
|
|
242
|
+
} = await insertEmbedBlock();
|
|
243
|
+
|
|
244
|
+
// Wait for edit URL modal to be visible
|
|
245
|
+
const embedEditURLModal = getByTestId( 'embed-edit-url-modal' );
|
|
246
|
+
await waitFor( () => embedEditURLModal.props.isVisible );
|
|
247
|
+
|
|
248
|
+
// Set an URL
|
|
249
|
+
const linkTextInput = getByPlaceholderText( 'Add link' );
|
|
250
|
+
fireEvent( linkTextInput, 'focus' );
|
|
251
|
+
fireEvent.changeText( linkTextInput, expectedURL );
|
|
252
|
+
|
|
253
|
+
// Dismiss the edit URL modal
|
|
254
|
+
fireEvent( embedEditURLModal, 'backdropPress' );
|
|
255
|
+
fireEvent( embedEditURLModal, MODAL_DISMISS_EVENT );
|
|
256
|
+
|
|
257
|
+
// Wait for block settings button to be present
|
|
258
|
+
const settingsButton = await waitFor( () =>
|
|
259
|
+
getByA11yLabel( 'Open Settings' )
|
|
260
|
+
);
|
|
261
|
+
|
|
262
|
+
expect( settingsButton ).toBeDefined();
|
|
263
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
264
|
+
} );
|
|
265
|
+
|
|
266
|
+
it( 'auto-pastes the URL from clipboard', async () => {
|
|
267
|
+
const clipboardURL = 'https://twitter.com/notnownikki';
|
|
268
|
+
|
|
269
|
+
// Mock clipboard
|
|
270
|
+
Clipboard.getString.mockResolvedValue( clipboardURL );
|
|
271
|
+
|
|
272
|
+
const {
|
|
273
|
+
getByA11yLabel,
|
|
274
|
+
getByTestId,
|
|
275
|
+
getByText,
|
|
276
|
+
} = await insertEmbedBlock();
|
|
277
|
+
|
|
278
|
+
// Wait for edit URL modal to be visible
|
|
279
|
+
const embedEditURLModal = getByTestId( 'embed-edit-url-modal' );
|
|
280
|
+
await waitFor( () => embedEditURLModal.props.isVisible );
|
|
281
|
+
|
|
282
|
+
// Get embed link
|
|
283
|
+
const embedLink = await waitFor( () => getByText( clipboardURL ) );
|
|
284
|
+
|
|
285
|
+
// Dismiss the edit URL modal
|
|
286
|
+
fireEvent( embedEditURLModal, 'backdropPress' );
|
|
287
|
+
fireEvent( embedEditURLModal, MODAL_DISMISS_EVENT );
|
|
288
|
+
|
|
289
|
+
// Wait for block settings button to be present
|
|
290
|
+
const settingsButton = await waitFor( () =>
|
|
291
|
+
getByA11yLabel( 'Open Settings' )
|
|
292
|
+
);
|
|
293
|
+
|
|
294
|
+
expect( embedLink ).toBeDefined();
|
|
295
|
+
expect( settingsButton ).toBeDefined();
|
|
296
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
297
|
+
|
|
298
|
+
Clipboard.getString.mockReset();
|
|
299
|
+
} );
|
|
300
|
+
} );
|
|
301
|
+
|
|
302
|
+
describe( 'set URL when empty block', () => {
|
|
303
|
+
it( 'sets empty URL when dismissing edit URL modal', async () => {
|
|
304
|
+
const { getByTestId, getByText } = await initializeWithEmbedBlock(
|
|
305
|
+
EMPTY_EMBED_HTML
|
|
306
|
+
);
|
|
307
|
+
|
|
308
|
+
// Edit URL
|
|
309
|
+
fireEvent.press( await waitFor( () => getByText( 'ADD LINK' ) ) );
|
|
310
|
+
|
|
311
|
+
// Wait for edit URL modal to be visible
|
|
312
|
+
const embedEditURLModal = getByTestId( 'embed-edit-url-modal' );
|
|
313
|
+
await waitFor( () => embedEditURLModal.props.isVisible );
|
|
314
|
+
|
|
315
|
+
// Dismiss the edit URL modal
|
|
316
|
+
fireEvent( embedEditURLModal, 'backdropPress' );
|
|
317
|
+
fireEvent( embedEditURLModal, MODAL_DISMISS_EVENT );
|
|
318
|
+
|
|
319
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
320
|
+
} );
|
|
321
|
+
|
|
322
|
+
it( 'sets a valid URL when dismissing edit URL modal', async () => {
|
|
323
|
+
const expectedURL = 'https://twitter.com/notnownikki';
|
|
324
|
+
|
|
325
|
+
const {
|
|
326
|
+
getByA11yLabel,
|
|
327
|
+
getByPlaceholderText,
|
|
328
|
+
getByTestId,
|
|
329
|
+
getByText,
|
|
330
|
+
} = await initializeWithEmbedBlock( EMPTY_EMBED_HTML );
|
|
331
|
+
|
|
332
|
+
// Edit URL
|
|
333
|
+
fireEvent.press( getByText( 'ADD LINK' ) );
|
|
334
|
+
|
|
335
|
+
// Wait for edit URL modal to be visible
|
|
336
|
+
const embedEditURLModal = getByTestId( 'embed-edit-url-modal' );
|
|
337
|
+
await waitFor( () => embedEditURLModal.props.isVisible );
|
|
338
|
+
|
|
339
|
+
// Set an URL
|
|
340
|
+
const linkTextInput = getByPlaceholderText( 'Add link' );
|
|
341
|
+
fireEvent( linkTextInput, 'focus' );
|
|
342
|
+
fireEvent.changeText( linkTextInput, expectedURL );
|
|
343
|
+
|
|
344
|
+
// Dismiss the edit URL modal
|
|
345
|
+
fireEvent( embedEditURLModal, 'backdropPress' );
|
|
346
|
+
fireEvent( embedEditURLModal, MODAL_DISMISS_EVENT );
|
|
347
|
+
|
|
348
|
+
// Wait for block settings button to be present
|
|
349
|
+
const settingsButton = await waitFor( () =>
|
|
350
|
+
getByA11yLabel( 'Open Settings' )
|
|
351
|
+
);
|
|
352
|
+
|
|
353
|
+
expect( settingsButton ).toBeDefined();
|
|
354
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
355
|
+
} );
|
|
356
|
+
|
|
357
|
+
it( 'auto-pastes the URL from clipboard', async () => {
|
|
358
|
+
const clipboardURL = 'https://twitter.com/notnownikki';
|
|
359
|
+
|
|
360
|
+
// Mock clipboard
|
|
361
|
+
Clipboard.getString.mockResolvedValue( clipboardURL );
|
|
362
|
+
|
|
363
|
+
const {
|
|
364
|
+
getByA11yLabel,
|
|
365
|
+
getByTestId,
|
|
366
|
+
getByText,
|
|
367
|
+
} = await initializeWithEmbedBlock( EMPTY_EMBED_HTML );
|
|
368
|
+
|
|
369
|
+
// Edit URL
|
|
370
|
+
fireEvent.press( getByText( 'ADD LINK' ) );
|
|
371
|
+
|
|
372
|
+
// Wait for edit URL modal to be visible
|
|
373
|
+
const embedEditURLModal = getByTestId( 'embed-edit-url-modal' );
|
|
374
|
+
await waitFor( () => embedEditURLModal.props.isVisible );
|
|
375
|
+
|
|
376
|
+
// Get embed link
|
|
377
|
+
const embedLink = await waitFor( () => getByText( clipboardURL ) );
|
|
378
|
+
|
|
379
|
+
// Dismiss the edit URL modal
|
|
380
|
+
fireEvent( embedEditURLModal, 'backdropPress' );
|
|
381
|
+
fireEvent( embedEditURLModal, MODAL_DISMISS_EVENT );
|
|
382
|
+
|
|
383
|
+
// Wait for block settings button to be present
|
|
384
|
+
const settingsButton = await waitFor( () =>
|
|
385
|
+
getByA11yLabel( 'Open Settings' )
|
|
386
|
+
);
|
|
387
|
+
|
|
388
|
+
expect( embedLink ).toBeDefined();
|
|
389
|
+
expect( settingsButton ).toBeDefined();
|
|
390
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
391
|
+
|
|
392
|
+
Clipboard.getString.mockReset();
|
|
393
|
+
} );
|
|
394
|
+
} );
|
|
395
|
+
|
|
396
|
+
describe( 'edit URL', () => {
|
|
397
|
+
it( 'keeps the previous URL if no URL is set', async () => {
|
|
398
|
+
const {
|
|
399
|
+
getByA11yLabel,
|
|
400
|
+
getByTestId,
|
|
401
|
+
} = await initializeWithEmbedBlock( RICH_TEXT_EMBED_HTML );
|
|
402
|
+
|
|
403
|
+
// Edit URL
|
|
404
|
+
fireEvent.press(
|
|
405
|
+
await waitFor( () => getByA11yLabel( 'Edit URL' ) )
|
|
406
|
+
);
|
|
407
|
+
|
|
408
|
+
// Wait for edit URL modal to be visible
|
|
409
|
+
const embedEditURLModal = getByTestId( 'embed-edit-url-modal' );
|
|
410
|
+
await waitFor( () => embedEditURLModal.props.isVisible );
|
|
411
|
+
|
|
412
|
+
// Dismiss the edit URL modal
|
|
413
|
+
fireEvent( embedEditURLModal, 'backdropPress' );
|
|
414
|
+
fireEvent( embedEditURLModal, MODAL_DISMISS_EVENT );
|
|
415
|
+
|
|
416
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
417
|
+
} );
|
|
418
|
+
|
|
419
|
+
it( 'replaces URL', async () => {
|
|
420
|
+
const initialURL = 'https://twitter.com/notnownikki';
|
|
421
|
+
const expectedURL = 'https://www.youtube.com/watch?v=lXMskKTw3Bc';
|
|
422
|
+
|
|
423
|
+
const {
|
|
424
|
+
getByA11yLabel,
|
|
425
|
+
getByDisplayValue,
|
|
426
|
+
getByTestId,
|
|
427
|
+
} = await initializeWithEmbedBlock( RICH_TEXT_EMBED_HTML );
|
|
428
|
+
|
|
429
|
+
// Edit URL
|
|
430
|
+
fireEvent.press(
|
|
431
|
+
await waitFor( () => getByA11yLabel( 'Edit URL' ) )
|
|
432
|
+
);
|
|
433
|
+
|
|
434
|
+
// Wait for edit URL modal to be visible
|
|
435
|
+
const embedEditURLModal = getByTestId( 'embed-edit-url-modal' );
|
|
436
|
+
await waitFor( () => embedEditURLModal.props.isVisible );
|
|
437
|
+
|
|
438
|
+
// Start editing link
|
|
439
|
+
fireEvent.press(
|
|
440
|
+
getByA11yLabel( `Twitter link, ${ initialURL }` )
|
|
441
|
+
);
|
|
442
|
+
|
|
443
|
+
// Replace URL
|
|
444
|
+
const linkTextInput = getByDisplayValue( initialURL );
|
|
445
|
+
fireEvent( linkTextInput, 'focus' );
|
|
446
|
+
fireEvent.changeText( linkTextInput, expectedURL );
|
|
447
|
+
|
|
448
|
+
// Dismiss the edit URL modal
|
|
449
|
+
fireEvent( embedEditURLModal, 'backdropPress' );
|
|
450
|
+
fireEvent( embedEditURLModal, MODAL_DISMISS_EVENT );
|
|
451
|
+
|
|
452
|
+
// Get YouTube link field
|
|
453
|
+
const youtubeLinkField = await waitFor( () =>
|
|
454
|
+
getByA11yLabel( `YouTube link, ${ expectedURL }` )
|
|
455
|
+
);
|
|
456
|
+
|
|
457
|
+
expect( youtubeLinkField ).toBeDefined();
|
|
458
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
459
|
+
} );
|
|
460
|
+
|
|
461
|
+
it( 'keeps the previous URL if an invalid URL is set', async () => {
|
|
462
|
+
const previousURL = 'https://twitter.com/notnownikki';
|
|
463
|
+
const invalidURL = 'http://';
|
|
464
|
+
|
|
465
|
+
const {
|
|
466
|
+
getByA11yLabel,
|
|
467
|
+
getByDisplayValue,
|
|
468
|
+
getByTestId,
|
|
469
|
+
getByText,
|
|
470
|
+
} = await initializeWithEmbedBlock( RICH_TEXT_EMBED_HTML );
|
|
471
|
+
|
|
472
|
+
// Edit URL
|
|
473
|
+
fireEvent.press(
|
|
474
|
+
await waitFor( () => getByA11yLabel( 'Edit URL' ) )
|
|
475
|
+
);
|
|
476
|
+
|
|
477
|
+
// Wait for edit URL modal to be visible
|
|
478
|
+
const embedEditURLModal = getByTestId( 'embed-edit-url-modal' );
|
|
479
|
+
await waitFor( () => embedEditURLModal.props.isVisible );
|
|
480
|
+
|
|
481
|
+
// Start editing link
|
|
482
|
+
fireEvent.press(
|
|
483
|
+
getByA11yLabel( `Twitter link, ${ previousURL }` )
|
|
484
|
+
);
|
|
485
|
+
|
|
486
|
+
// Replace URL
|
|
487
|
+
const linkTextInput = getByDisplayValue( previousURL );
|
|
488
|
+
fireEvent( linkTextInput, 'focus' );
|
|
489
|
+
fireEvent.changeText( linkTextInput, invalidURL );
|
|
490
|
+
|
|
491
|
+
// Dismiss the edit URL modal
|
|
492
|
+
fireEvent( embedEditURLModal, 'backdropPress' );
|
|
493
|
+
fireEvent( embedEditURLModal, MODAL_DISMISS_EVENT );
|
|
494
|
+
|
|
495
|
+
const errorNotice = await waitFor( () =>
|
|
496
|
+
getByText( 'Invalid URL. Please enter a valid URL.' )
|
|
497
|
+
);
|
|
498
|
+
|
|
499
|
+
expect( errorNotice ).toBeDefined();
|
|
500
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
501
|
+
} );
|
|
502
|
+
|
|
503
|
+
// This test case covers the bug fixed in PR #35460
|
|
504
|
+
it( 'edits URL after dismissing two times the edit URL bottom sheet with empty value', async () => {
|
|
505
|
+
const { block, getByTestId, getByText } = await insertEmbedBlock();
|
|
506
|
+
|
|
507
|
+
// Wait for edit URL modal to be visible
|
|
508
|
+
const embedEditURLModal = getByTestId( 'embed-edit-url-modal' );
|
|
509
|
+
await waitFor( () => embedEditURLModal.props.isVisible );
|
|
510
|
+
|
|
511
|
+
// Dismiss the edit URL modal
|
|
512
|
+
fireEvent( embedEditURLModal, 'backdropPress' );
|
|
513
|
+
fireEvent( embedEditURLModal, MODAL_DISMISS_EVENT );
|
|
514
|
+
|
|
515
|
+
// Select block
|
|
516
|
+
fireEvent.press( block );
|
|
517
|
+
|
|
518
|
+
// Edit URL
|
|
519
|
+
fireEvent.press( getByText( 'ADD LINK' ) );
|
|
520
|
+
|
|
521
|
+
// Wait for edit URL modal to be visible
|
|
522
|
+
await waitFor( () => embedEditURLModal.props.isVisible );
|
|
523
|
+
|
|
524
|
+
// Dismiss the edit URL modal
|
|
525
|
+
fireEvent( embedEditURLModal, 'backdropPress' );
|
|
526
|
+
fireEvent( embedEditURLModal, MODAL_DISMISS_EVENT );
|
|
527
|
+
|
|
528
|
+
// Edit URL
|
|
529
|
+
fireEvent.press( getByText( 'ADD LINK' ) );
|
|
530
|
+
|
|
531
|
+
// Wait for edit URL modal to be visible
|
|
532
|
+
const isVisibleThirdTime = await waitFor(
|
|
533
|
+
() => embedEditURLModal.props.isVisible
|
|
534
|
+
);
|
|
535
|
+
|
|
536
|
+
expect( isVisibleThirdTime ).toBeTruthy();
|
|
537
|
+
} );
|
|
538
|
+
|
|
539
|
+
// This test case covers the bug fixed in PR #35013
|
|
540
|
+
it( 'edits URL when edited after setting a bad URL of a provider', async () => {
|
|
541
|
+
const badURL = 'https://youtu.be/BAD_URL';
|
|
542
|
+
const expectedURL = 'https://twitter.com/notnownikki';
|
|
543
|
+
|
|
544
|
+
const {
|
|
545
|
+
getByA11yLabel,
|
|
546
|
+
getByDisplayValue,
|
|
547
|
+
getByPlaceholderText,
|
|
548
|
+
getByTestId,
|
|
549
|
+
} = await insertEmbedBlock();
|
|
550
|
+
|
|
551
|
+
// Wait for edit URL modal to be visible
|
|
552
|
+
let embedEditURLModal = getByTestId( 'embed-edit-url-modal' );
|
|
553
|
+
await waitFor( () => embedEditURLModal.props.isVisible );
|
|
554
|
+
|
|
555
|
+
// Set an bad URL
|
|
556
|
+
let linkTextInput = getByPlaceholderText( 'Add link' );
|
|
557
|
+
fireEvent( linkTextInput, 'focus' );
|
|
558
|
+
fireEvent.changeText( linkTextInput, badURL );
|
|
559
|
+
|
|
560
|
+
// Dismiss the edit URL modal
|
|
561
|
+
fireEvent( embedEditURLModal, 'backdropPress' );
|
|
562
|
+
fireEvent( embedEditURLModal, MODAL_DISMISS_EVENT );
|
|
563
|
+
|
|
564
|
+
// Edit URL
|
|
565
|
+
fireEvent.press(
|
|
566
|
+
await waitFor( () => getByA11yLabel( 'Edit URL' ) )
|
|
567
|
+
);
|
|
568
|
+
|
|
569
|
+
// Wait for edit URL modal to be visible
|
|
570
|
+
embedEditURLModal = getByTestId( 'embed-edit-url-modal' );
|
|
571
|
+
await waitFor( () => embedEditURLModal.props.isVisible );
|
|
572
|
+
|
|
573
|
+
// Start editing link
|
|
574
|
+
fireEvent.press( getByA11yLabel( `Embed link, ${ badURL }` ) );
|
|
575
|
+
|
|
576
|
+
// Replace URL
|
|
577
|
+
linkTextInput = getByDisplayValue( badURL );
|
|
578
|
+
fireEvent( linkTextInput, 'focus' );
|
|
579
|
+
fireEvent.changeText( linkTextInput, expectedURL );
|
|
580
|
+
|
|
581
|
+
// Dismiss the edit URL modal
|
|
582
|
+
fireEvent( embedEditURLModal, 'backdropPress' );
|
|
583
|
+
fireEvent( embedEditURLModal, MODAL_DISMISS_EVENT );
|
|
584
|
+
|
|
585
|
+
// Get Twitter link field
|
|
586
|
+
const twitterLinkField = await waitFor( () =>
|
|
587
|
+
getByA11yLabel( `Twitter link, ${ expectedURL }` )
|
|
588
|
+
);
|
|
589
|
+
|
|
590
|
+
expect( twitterLinkField ).toBeDefined();
|
|
591
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
592
|
+
} );
|
|
593
|
+
} );
|
|
594
|
+
|
|
595
|
+
describe( 'alignment options', () => {
|
|
596
|
+
[
|
|
597
|
+
'Align left',
|
|
598
|
+
'Align center',
|
|
599
|
+
'Align right',
|
|
600
|
+
'Wide width',
|
|
601
|
+
'Full width',
|
|
602
|
+
].forEach( ( alignmentOption ) =>
|
|
603
|
+
it( `sets ${ alignmentOption } option`, async () => {
|
|
604
|
+
const {
|
|
605
|
+
getByA11yLabel,
|
|
606
|
+
getByText,
|
|
607
|
+
} = await initializeWithEmbedBlock( RICH_TEXT_EMBED_HTML );
|
|
608
|
+
|
|
609
|
+
// Open alignment options
|
|
610
|
+
fireEvent.press(
|
|
611
|
+
await waitFor( () => getByA11yLabel( 'Align' ) )
|
|
612
|
+
);
|
|
613
|
+
|
|
614
|
+
// Select alignment option
|
|
615
|
+
fireEvent.press(
|
|
616
|
+
await waitFor( () => getByText( alignmentOption ) )
|
|
617
|
+
);
|
|
618
|
+
|
|
619
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
620
|
+
} )
|
|
621
|
+
);
|
|
622
|
+
} );
|
|
623
|
+
|
|
624
|
+
describe( 'retry', () => {
|
|
625
|
+
it( 'retries loading the preview if initial request failed', async () => {
|
|
626
|
+
// Return bad response for the first request to oembed endpoint
|
|
627
|
+
// and success response for the rest of requests.
|
|
628
|
+
let isFirstEmbedRequest = true;
|
|
629
|
+
fetchRequest.mockImplementation( ( { path } ) => {
|
|
630
|
+
let response = {};
|
|
631
|
+
const isEmbedRequest = path.startsWith( '/oembed/1.0/proxy' );
|
|
632
|
+
if ( isEmbedRequest ) {
|
|
633
|
+
if ( isFirstEmbedRequest ) {
|
|
634
|
+
isFirstEmbedRequest = false;
|
|
635
|
+
response = MOCK_BAD_WORDPRESS_RESPONSE;
|
|
636
|
+
} else {
|
|
637
|
+
response = RICH_TEXT_EMBED_SUCCESS_RESPONSE;
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
return Promise.resolve( response );
|
|
641
|
+
} );
|
|
642
|
+
|
|
643
|
+
const {
|
|
644
|
+
getByA11yLabel,
|
|
645
|
+
getByText,
|
|
646
|
+
} = await initializeWithEmbedBlock( RICH_TEXT_EMBED_HTML );
|
|
647
|
+
|
|
648
|
+
// Retry request
|
|
649
|
+
fireEvent.press( getByText( 'More options' ) );
|
|
650
|
+
fireEvent.press( getByText( 'Retry' ) );
|
|
651
|
+
|
|
652
|
+
// Wait for edit URL button to be present
|
|
653
|
+
const editURLButton = await waitFor( () =>
|
|
654
|
+
getByA11yLabel( 'Edit URL' )
|
|
655
|
+
);
|
|
656
|
+
|
|
657
|
+
expect( editURLButton ).toBeDefined();
|
|
658
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
659
|
+
} );
|
|
660
|
+
it( 'converts to link if preview request failed', async () => {
|
|
661
|
+
// Return bad response for requests to oembed endpoint.
|
|
662
|
+
fetchRequest.mockImplementation( ( { path } ) => {
|
|
663
|
+
const isEmbedRequest = path.startsWith( '/oembed/1.0/proxy' );
|
|
664
|
+
return Promise.resolve(
|
|
665
|
+
isEmbedRequest ? MOCK_BAD_WORDPRESS_RESPONSE : {}
|
|
666
|
+
);
|
|
667
|
+
} );
|
|
668
|
+
|
|
669
|
+
const {
|
|
670
|
+
getByA11yLabel,
|
|
671
|
+
getByText,
|
|
672
|
+
} = await initializeWithEmbedBlock( RICH_TEXT_EMBED_HTML );
|
|
673
|
+
|
|
674
|
+
// Convert embed to link
|
|
675
|
+
fireEvent.press( getByText( 'More options' ) );
|
|
676
|
+
fireEvent.press( getByText( 'Convert to link' ) );
|
|
677
|
+
|
|
678
|
+
// Get paragraph block where the link is created
|
|
679
|
+
const paragraphBlock = await waitFor( () =>
|
|
680
|
+
getByA11yLabel( /Paragraph Block\. Row 1/ )
|
|
681
|
+
);
|
|
682
|
+
|
|
683
|
+
expect( paragraphBlock ).toBeDefined();
|
|
684
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
685
|
+
} );
|
|
686
|
+
} );
|
|
687
|
+
|
|
688
|
+
describe( 'preview coming soon', () => {
|
|
689
|
+
it( 'previews post for providers which embed preview is not available yet', async () => {
|
|
690
|
+
const { getByText, getByTestId } = await initializeWithEmbedBlock(
|
|
691
|
+
PHOTO_EMBED_HTML
|
|
692
|
+
);
|
|
693
|
+
|
|
694
|
+
// Try to preview the post
|
|
695
|
+
fireEvent.press( getByText( 'PREVIEW POST' ) );
|
|
696
|
+
|
|
697
|
+
// Wait for no preview modal to be visible
|
|
698
|
+
const noPreviewModal = getByTestId( 'embed-no-preview-modal' );
|
|
699
|
+
await waitFor( () => noPreviewModal.props.isVisible );
|
|
700
|
+
|
|
701
|
+
// Preview post
|
|
702
|
+
fireEvent.press( getByText( 'Preview post' ) );
|
|
703
|
+
|
|
704
|
+
// Dismiss the no preview modal
|
|
705
|
+
fireEvent( noPreviewModal, 'backdropPress' );
|
|
706
|
+
fireEvent( noPreviewModal, MODAL_DISMISS_EVENT );
|
|
707
|
+
|
|
708
|
+
expect( requestPreview ).toHaveBeenCalled();
|
|
709
|
+
} );
|
|
710
|
+
|
|
711
|
+
it( 'dismisses no preview modal', async () => {
|
|
712
|
+
const { getByText, getByTestId } = await initializeWithEmbedBlock(
|
|
713
|
+
PHOTO_EMBED_HTML
|
|
714
|
+
);
|
|
715
|
+
|
|
716
|
+
// Try to preview the post
|
|
717
|
+
fireEvent.press( getByText( 'PREVIEW POST' ) );
|
|
718
|
+
|
|
719
|
+
// Wait for no preview modal to be visible
|
|
720
|
+
const noPreviewModal = getByTestId( 'embed-no-preview-modal' );
|
|
721
|
+
await waitFor( () => noPreviewModal.props.isVisible );
|
|
722
|
+
|
|
723
|
+
// Dismiss modal
|
|
724
|
+
fireEvent.press( getByText( 'Dismiss' ) );
|
|
725
|
+
|
|
726
|
+
// Wait for no preview modal to be not visible
|
|
727
|
+
await waitFor( () => ! noPreviewModal.props.isVisible );
|
|
728
|
+
|
|
729
|
+
expect( requestPreview ).not.toHaveBeenCalled();
|
|
730
|
+
} );
|
|
731
|
+
} );
|
|
732
|
+
|
|
733
|
+
describe( 'create by pasting URL', () => {
|
|
734
|
+
it( 'creates embed block when pasting URL in paragraph block', async () => {
|
|
735
|
+
const expectedURL = 'https://www.youtube.com/watch?v=lXMskKTw3Bc';
|
|
736
|
+
|
|
737
|
+
const {
|
|
738
|
+
getByA11yLabel,
|
|
739
|
+
getByPlaceholderText,
|
|
740
|
+
getByTestId,
|
|
741
|
+
getByText,
|
|
742
|
+
} = await initializeEditor( {
|
|
743
|
+
initialHtml: EMPTY_PARAGRAPH_HTML,
|
|
744
|
+
} );
|
|
745
|
+
|
|
746
|
+
// Paste URL in paragraph block
|
|
747
|
+
const paragraphText = getByPlaceholderText( 'Start writing…' );
|
|
748
|
+
fireEvent( paragraphText, 'focus' );
|
|
749
|
+
fireEvent( paragraphText, 'paste', {
|
|
750
|
+
preventDefault: jest.fn(),
|
|
751
|
+
nativeEvent: {
|
|
752
|
+
eventCount: 1,
|
|
753
|
+
target: undefined,
|
|
754
|
+
files: [],
|
|
755
|
+
pastedHtml: expectedURL,
|
|
756
|
+
pastedText: expectedURL,
|
|
757
|
+
},
|
|
758
|
+
} );
|
|
759
|
+
|
|
760
|
+
// Wait for embed handler picker to be visible
|
|
761
|
+
await waitFor(
|
|
762
|
+
() => getByTestId( 'embed-handler-picker' ).props.isVisible
|
|
763
|
+
);
|
|
764
|
+
|
|
765
|
+
// Select create embed option
|
|
766
|
+
fireEvent.press( getByText( 'Create embed' ) );
|
|
767
|
+
|
|
768
|
+
// Get the created embed block
|
|
769
|
+
const embedBlock = await waitFor( () =>
|
|
770
|
+
getByA11yLabel( /Embed Block\. Row 1/ )
|
|
771
|
+
);
|
|
772
|
+
|
|
773
|
+
expect( embedBlock ).toBeDefined();
|
|
774
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
775
|
+
} );
|
|
776
|
+
|
|
777
|
+
it( 'creates link when pasting URL in paragraph block', async () => {
|
|
778
|
+
const expectedURL = 'https://www.youtube.com/watch?v=lXMskKTw3Bc';
|
|
779
|
+
|
|
780
|
+
const {
|
|
781
|
+
getByDisplayValue,
|
|
782
|
+
getByPlaceholderText,
|
|
783
|
+
getByTestId,
|
|
784
|
+
getByText,
|
|
785
|
+
} = await initializeEditor( {
|
|
786
|
+
initialHtml: EMPTY_PARAGRAPH_HTML,
|
|
787
|
+
} );
|
|
788
|
+
|
|
789
|
+
// Paste URL in paragraph block
|
|
790
|
+
const paragraphText = getByPlaceholderText( 'Start writing…' );
|
|
791
|
+
fireEvent( paragraphText, 'focus' );
|
|
792
|
+
fireEvent( paragraphText, 'paste', {
|
|
793
|
+
preventDefault: jest.fn(),
|
|
794
|
+
nativeEvent: {
|
|
795
|
+
eventCount: 1,
|
|
796
|
+
target: undefined,
|
|
797
|
+
files: [],
|
|
798
|
+
pastedHtml: expectedURL,
|
|
799
|
+
pastedText: expectedURL,
|
|
800
|
+
},
|
|
801
|
+
} );
|
|
802
|
+
|
|
803
|
+
// Wait for embed handler picker to be visible
|
|
804
|
+
await waitFor(
|
|
805
|
+
() => getByTestId( 'embed-handler-picker' ).props.isVisible
|
|
806
|
+
);
|
|
807
|
+
|
|
808
|
+
// Select create link option
|
|
809
|
+
fireEvent.press( getByText( 'Create link' ) );
|
|
810
|
+
|
|
811
|
+
// Get the link text
|
|
812
|
+
const linkText = await waitFor( () =>
|
|
813
|
+
getByDisplayValue(
|
|
814
|
+
`<p><a href="${ expectedURL }">${ expectedURL }</a></p>`
|
|
815
|
+
)
|
|
816
|
+
);
|
|
817
|
+
|
|
818
|
+
expect( linkText ).toBeDefined();
|
|
819
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
820
|
+
} );
|
|
821
|
+
} );
|
|
822
|
+
|
|
823
|
+
describe( 'insert via slash inserter', () => {
|
|
824
|
+
it( 'insert generic embed block', async () => {
|
|
825
|
+
const embedBlockSlashInserter = '/Embed';
|
|
826
|
+
const {
|
|
827
|
+
getByPlaceholderText,
|
|
828
|
+
getByA11yLabel,
|
|
829
|
+
getByText,
|
|
830
|
+
} = await initializeEditor( { initialHtml: EMPTY_PARAGRAPH_HTML } );
|
|
831
|
+
|
|
832
|
+
const paragraphText = getByPlaceholderText( 'Start writing…' );
|
|
833
|
+
fireEvent( paragraphText, 'focus' );
|
|
834
|
+
// Trigger onSelectionChange to update both the current text and text selection.
|
|
835
|
+
// This event is required by the autocompleter, as it only displays the slash inserter
|
|
836
|
+
// if the text selection is located at the end of the text, for this reason,
|
|
837
|
+
// the start and end arguments match the text length.
|
|
838
|
+
fireEvent(
|
|
839
|
+
paragraphText,
|
|
840
|
+
'onSelectionChange',
|
|
841
|
+
embedBlockSlashInserter.length,
|
|
842
|
+
embedBlockSlashInserter.length,
|
|
843
|
+
embedBlockSlashInserter,
|
|
844
|
+
{
|
|
845
|
+
nativeEvent: {
|
|
846
|
+
eventCount: 1,
|
|
847
|
+
target: undefined,
|
|
848
|
+
text: embedBlockSlashInserter,
|
|
849
|
+
},
|
|
850
|
+
}
|
|
851
|
+
);
|
|
852
|
+
|
|
853
|
+
fireEvent.press( await waitFor( () => getByText( 'Embed' ) ) );
|
|
854
|
+
|
|
855
|
+
const block = await waitFor( () =>
|
|
856
|
+
getByA11yLabel( /Embed Block\. Row 1/ )
|
|
857
|
+
);
|
|
858
|
+
|
|
859
|
+
const blockName = within( block ).getByText( 'Embed' );
|
|
860
|
+
|
|
861
|
+
expect( blockName ).toBeDefined();
|
|
862
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
863
|
+
} );
|
|
864
|
+
|
|
865
|
+
MOST_USED_PROVIDERS.forEach( ( { title } ) =>
|
|
866
|
+
it( `inserts ${ title } embed block`, async () => {
|
|
867
|
+
const embedBlockSlashInserter = `/${ title }`;
|
|
868
|
+
const {
|
|
869
|
+
getByPlaceholderText,
|
|
870
|
+
getByA11yLabel,
|
|
871
|
+
getByText,
|
|
872
|
+
} = await initializeEditor( {
|
|
873
|
+
initialHtml: EMPTY_PARAGRAPH_HTML,
|
|
874
|
+
} );
|
|
875
|
+
|
|
876
|
+
const paragraphText = getByPlaceholderText( 'Start writing…' );
|
|
877
|
+
fireEvent( paragraphText, 'focus' );
|
|
878
|
+
// Trigger onSelectionChange to update both the current text and text selection.
|
|
879
|
+
// This event is required by the autocompleter, as it only displays the slash inserter
|
|
880
|
+
// if the text selection is located at the end of the text, for this reason,
|
|
881
|
+
// the start and end arguments match the text length.
|
|
882
|
+
fireEvent(
|
|
883
|
+
paragraphText,
|
|
884
|
+
'onSelectionChange',
|
|
885
|
+
embedBlockSlashInserter.length,
|
|
886
|
+
embedBlockSlashInserter.length,
|
|
887
|
+
embedBlockSlashInserter,
|
|
888
|
+
{
|
|
889
|
+
nativeEvent: {
|
|
890
|
+
eventCount: 1,
|
|
891
|
+
target: undefined,
|
|
892
|
+
text: embedBlockSlashInserter,
|
|
893
|
+
},
|
|
894
|
+
}
|
|
895
|
+
);
|
|
896
|
+
|
|
897
|
+
fireEvent.press( await waitFor( () => getByText( title ) ) );
|
|
898
|
+
|
|
899
|
+
const block = await waitFor( () =>
|
|
900
|
+
getByA11yLabel( /Embed Block\. Row 1/ )
|
|
901
|
+
);
|
|
902
|
+
|
|
903
|
+
const blockName = within( block ).getByText( title );
|
|
904
|
+
|
|
905
|
+
expect( blockName ).toBeDefined();
|
|
906
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
907
|
+
} )
|
|
908
|
+
);
|
|
909
|
+
} );
|
|
910
|
+
|
|
911
|
+
it( 'sets block caption', async () => {
|
|
912
|
+
const expectedCaption = 'Caption';
|
|
913
|
+
|
|
914
|
+
const {
|
|
915
|
+
getByPlaceholderText,
|
|
916
|
+
getByDisplayValue,
|
|
917
|
+
} = await initializeWithEmbedBlock( RICH_TEXT_EMBED_HTML );
|
|
918
|
+
|
|
919
|
+
// Set a caption
|
|
920
|
+
const captionField = getByPlaceholderText( 'Add caption' );
|
|
921
|
+
fireEvent( captionField, 'focus' );
|
|
922
|
+
fireEvent( captionField, 'onChange', {
|
|
923
|
+
nativeEvent: {
|
|
924
|
+
eventCount: 1,
|
|
925
|
+
target: undefined,
|
|
926
|
+
text: expectedCaption,
|
|
927
|
+
},
|
|
928
|
+
} );
|
|
929
|
+
|
|
930
|
+
// Get current caption
|
|
931
|
+
const caption = await waitFor( () =>
|
|
932
|
+
getByDisplayValue( `<p>${ expectedCaption }</p>` )
|
|
933
|
+
);
|
|
934
|
+
|
|
935
|
+
expect( caption ).toBeDefined();
|
|
936
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
937
|
+
} );
|
|
938
|
+
|
|
939
|
+
it( 'displays cannot embed on the placeholder if preview data is null', async () => {
|
|
940
|
+
// Return null response for requests to oembed endpoint.
|
|
941
|
+
fetchRequest.mockImplementation( ( { path } ) => {
|
|
942
|
+
const isEmbedRequest = path.startsWith( '/oembed/1.0/proxy' );
|
|
943
|
+
return Promise.resolve( isEmbedRequest ? EMBED_NULL_RESPONSE : {} );
|
|
944
|
+
} );
|
|
945
|
+
|
|
946
|
+
const { getByText } = await initializeWithEmbedBlock(
|
|
947
|
+
RICH_TEXT_ERROR_EMBED_HTML
|
|
948
|
+
);
|
|
949
|
+
|
|
950
|
+
const cannotEmbedText = getByText( 'Unable to embed media' );
|
|
951
|
+
|
|
952
|
+
expect( cannotEmbedText ).toBeDefined();
|
|
953
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
954
|
+
} );
|
|
955
|
+
|
|
956
|
+
describe( 'block settings', () => {
|
|
957
|
+
it( 'toggles resize for smaller devices media settings', async () => {
|
|
958
|
+
const {
|
|
959
|
+
getByA11yLabel,
|
|
960
|
+
getByText,
|
|
961
|
+
} = await initializeWithEmbedBlock( RICH_TEXT_EMBED_HTML );
|
|
962
|
+
|
|
963
|
+
fireEvent.press(
|
|
964
|
+
await waitFor( () => getByA11yLabel( 'Open Settings' ) )
|
|
965
|
+
);
|
|
966
|
+
|
|
967
|
+
fireEvent.press(
|
|
968
|
+
await waitFor( () => getByText( /Resize for smaller devices/ ) )
|
|
969
|
+
);
|
|
970
|
+
|
|
971
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
972
|
+
} );
|
|
973
|
+
|
|
974
|
+
it( 'does not show settings button if responsive is not supported', async () => {
|
|
975
|
+
const { getByA11yLabel } = await initializeWithEmbedBlock(
|
|
976
|
+
WP_EMBED_HTML
|
|
977
|
+
);
|
|
978
|
+
|
|
979
|
+
let settingsButton;
|
|
980
|
+
try {
|
|
981
|
+
settingsButton = await waitFor( () =>
|
|
982
|
+
getByA11yLabel( 'Open Settings' )
|
|
983
|
+
);
|
|
984
|
+
} catch ( e ) {
|
|
985
|
+
// NOOP
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
expect( settingsButton ).not.toBeDefined();
|
|
989
|
+
} );
|
|
990
|
+
} );
|
|
991
|
+
} );
|