@wordpress/block-library 7.6.0 → 7.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/build/audio/edit.js +1 -0
- package/build/audio/edit.js.map +1 -1
- package/build/audio/index.js +6 -1
- package/build/audio/index.js.map +1 -1
- package/build/audio/save.js +2 -1
- package/build/audio/save.js.map +1 -1
- package/build/avatar/hooks.js +2 -2
- package/build/avatar/hooks.js.map +1 -1
- package/build/block/edit.js.map +1 -1
- package/build/block/edit.native.js.map +1 -1
- package/build/button/deprecated.js +175 -35
- package/build/button/deprecated.js.map +1 -1
- package/build/button/edit.js +1 -1
- package/build/button/edit.js.map +1 -1
- package/build/button/edit.native.js.map +1 -1
- package/build/button/save.js +1 -1
- package/build/button/save.js.map +1 -1
- package/build/buttons/deprecated.js.map +1 -1
- package/build/buttons/edit.js.map +1 -1
- package/build/buttons/edit.native.js.map +1 -1
- package/build/column/deprecated.js.map +1 -1
- package/build/column/edit.js.map +1 -1
- package/build/column/edit.native.js.map +1 -1
- package/build/columns/deprecated.js.map +1 -1
- package/build/columns/edit.js +1 -1
- package/build/columns/edit.js.map +1 -1
- package/build/columns/edit.native.js +1 -1
- package/build/columns/edit.native.js.map +1 -1
- package/build/columns/index.js +3 -1
- package/build/columns/index.js.map +1 -1
- package/build/columns/utils.js +1 -1
- package/build/columns/utils.js.map +1 -1
- package/build/columns/variations.js +2 -2
- package/build/columns/variations.js.map +1 -1
- package/build/comment-author-name/edit.js +3 -3
- package/build/comment-author-name/edit.js.map +1 -1
- package/build/comment-author-name/index.js +0 -4
- package/build/comment-author-name/index.js.map +1 -1
- package/build/comment-date/edit.js +4 -4
- package/build/comment-date/edit.js.map +1 -1
- package/build/comment-date/index.js +0 -4
- package/build/comment-date/index.js.map +1 -1
- package/build/comment-edit-link/index.js +0 -4
- package/build/comment-edit-link/index.js.map +1 -1
- package/build/comment-reply-link/index.js +0 -4
- package/build/comment-reply-link/index.js.map +1 -1
- package/build/comments/edit.js +10 -2
- package/build/comments/edit.js.map +1 -1
- package/build/comments-title/deprecated.js +0 -3
- package/build/comments-title/deprecated.js.map +1 -1
- package/build/comments-title/edit.js +1 -1
- package/build/comments-title/edit.js.map +1 -1
- package/build/cover/controls.native.js.map +1 -1
- package/build/cover/deprecated.js +212 -207
- package/build/cover/deprecated.js.map +1 -1
- package/build/cover/edit/block-controls.js +3 -10
- package/build/cover/edit/block-controls.js.map +1 -1
- package/build/cover/edit/index.js +34 -31
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +34 -6
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/cover/edit.native.js.map +1 -1
- package/build/cover/index.js +1 -0
- package/build/cover/index.js.map +1 -1
- package/build/cover/save.js +18 -5
- package/build/cover/save.js.map +1 -1
- package/build/cover/shared.js +14 -17
- package/build/cover/shared.js.map +1 -1
- package/build/cover/transforms.js.map +1 -1
- package/build/embed/deprecated.js +6 -1
- package/build/embed/deprecated.js.map +1 -1
- package/build/embed/edit.js.map +1 -1
- package/build/embed/edit.native.js.map +1 -1
- package/build/embed/embed-controls.native.js.map +1 -1
- package/build/embed/embed-preview.js +1 -0
- package/build/embed/embed-preview.js.map +1 -1
- package/build/embed/icons.js +21 -1
- package/build/embed/icons.js.map +1 -1
- package/build/embed/index.js +6 -1
- package/build/embed/index.js.map +1 -1
- package/build/embed/save.js +1 -0
- package/build/embed/save.js.map +1 -1
- package/build/embed/transforms.js +6 -1
- package/build/embed/transforms.js.map +1 -1
- package/build/embed/util.js +6 -1
- package/build/embed/util.js.map +1 -1
- package/build/embed/variations.js +11 -0
- package/build/embed/variations.js.map +1 -1
- package/build/file/edit.js +1 -1
- package/build/file/edit.js.map +1 -1
- package/build/file/edit.native.js.map +1 -1
- package/build/file/index.js.map +1 -1
- package/build/file/save.js +9 -1
- package/build/file/save.js.map +1 -1
- package/build/gallery/edit.js +1 -1
- 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.map +1 -1
- package/build/gallery/gap-styles.js +14 -4
- package/build/gallery/gap-styles.js.map +1 -1
- package/build/gallery/index.js +1 -1
- package/build/gallery/index.js.map +1 -1
- package/build/gallery/save.js +1 -1
- package/build/gallery/save.js.map +1 -1
- package/build/gallery/shared.js +27 -10
- package/build/gallery/shared.js.map +1 -1
- package/build/gallery/transforms.js +2 -2
- package/build/gallery/transforms.js.map +1 -1
- package/build/gallery/v1/edit.js +3 -3
- package/build/gallery/v1/edit.js.map +1 -1
- package/build/gallery/v1/gallery-image.js +1 -0
- package/build/gallery/v1/gallery-image.js.map +1 -1
- package/build/gallery/v1/gallery-image.native.js.map +1 -1
- package/build/gallery/v1/gallery.js +1 -1
- package/build/gallery/v1/gallery.js.map +1 -1
- package/build/gallery/v1/save.js +10 -2
- package/build/gallery/v1/save.js.map +1 -1
- package/build/group/index.js +1 -0
- package/build/group/index.js.map +1 -1
- package/build/heading/autogenerate-anchors.js +7 -2
- package/build/heading/autogenerate-anchors.js.map +1 -1
- package/build/heading/deprecated.js.map +1 -1
- package/build/heading/edit.js.map +1 -1
- package/build/html/edit.js +11 -20
- package/build/html/edit.js.map +1 -1
- package/build/html/preview.js +48 -0
- package/build/html/preview.js.map +1 -0
- package/build/image/deprecated.js.map +1 -1
- package/build/image/edit.js +5 -59
- package/build/image/edit.js.map +1 -1
- package/build/image/edit.native.js +58 -4
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +4 -13
- package/build/image/image.js.map +1 -1
- package/build/image/index.js +5 -0
- package/build/image/index.js.map +1 -1
- package/build/image/save.js +1 -0
- package/build/image/save.js.map +1 -1
- package/build/image/transforms.js.map +1 -1
- package/build/image/utils.js +2 -1
- package/build/image/utils.js.map +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/latest-comments/edit.js.map +1 -1
- package/build/latest-posts/edit.js +1 -1
- package/build/latest-posts/edit.js.map +1 -1
- package/build/latest-posts/edit.native.js.map +1 -1
- package/build/list/index.js.map +1 -1
- package/build/list/v2/edit.js.map +1 -1
- package/build/list/v2/transforms.js +33 -17
- package/build/list/v2/transforms.js.map +1 -1
- package/build/list-item/hooks/use-backspace.js.map +1 -1
- package/build/list-item/hooks/use-enter.js +7 -4
- package/build/list-item/hooks/use-enter.js.map +1 -1
- package/build/list-item/hooks/use-indent-list-item.js.map +1 -1
- package/build/list-item/hooks/use-outdent-list-item.js +36 -15
- package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build/list-item/hooks/use-space.js.map +1 -1
- package/build/list-item/hooks/use-split.js +17 -3
- package/build/list-item/hooks/use-split.js.map +1 -1
- package/build/media-text/deprecated.js +5 -3
- package/build/media-text/deprecated.js.map +1 -1
- package/build/media-text/edit.native.js.map +1 -1
- package/build/media-text/media-container.js +3 -3
- package/build/media-text/media-container.js.map +1 -1
- package/build/media-text/media-container.native.js.map +1 -1
- package/build/media-text/save.js +3 -1
- package/build/media-text/save.js.map +1 -1
- package/build/missing/edit.native.js.map +1 -1
- package/build/navigation/deprecated.js.map +1 -1
- package/build/navigation/edit/index.js +1 -1
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
- package/build/navigation/index.js +9 -0
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/use-navigation-entities.js.map +1 -1
- package/build/navigation/use-navigation-menu.js +72 -38
- package/build/navigation/use-navigation-menu.js.map +1 -1
- package/build/navigation/use-template-part-area-label.js +4 -1
- package/build/navigation/use-template-part-area-label.js.map +1 -1
- package/build/navigation/view.js +5 -3
- package/build/navigation/view.js.map +1 -1
- package/build/navigation-link/edit.js +44 -12
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/navigation-submenu/view.js +5 -3
- package/build/navigation-submenu/view.js.map +1 -1
- package/build/page-list/convert-to-links-modal.js.map +1 -1
- package/build/page-list/edit.js.map +1 -1
- package/build/paragraph/deprecated.js +1 -1
- package/build/paragraph/deprecated.js.map +1 -1
- package/build/pattern/edit.js.map +1 -1
- package/build/post-author/edit.js.map +1 -1
- package/build/post-author-name/index.js +3 -0
- package/build/post-author-name/index.js.map +1 -1
- package/build/post-author-name/transforms.js +41 -0
- package/build/post-author-name/transforms.js.map +1 -0
- package/build/post-comments-form/edit.js +12 -2
- package/build/post-comments-form/edit.js.map +1 -1
- package/build/post-comments-form/form.js +11 -1
- package/build/post-comments-form/form.js.map +1 -1
- package/build/post-content/edit.js.map +1 -1
- package/build/post-date/edit.js +13 -7
- package/build/post-date/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +10 -24
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-navigation-link/index.js +4 -0
- package/build/post-navigation-link/index.js.map +1 -1
- package/build/pullquote/deprecated.js.map +1 -1
- package/build/query/edit/index.js +5 -1
- package/build/query/edit/index.js.map +1 -1
- package/build/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build/query/edit/query-toolbar.js +16 -2
- package/build/query/edit/query-toolbar.js.map +1 -1
- package/build/quote/v2/edit.js.map +1 -1
- package/build/search/edit.js +1 -1
- package/build/search/edit.js.map +1 -1
- package/build/search/edit.native.js.map +1 -1
- package/build/search/index.js +4 -0
- package/build/search/index.js.map +1 -1
- package/build/separator/use-deprecated-opacity.js.map +1 -1
- package/build/shortcode/edit.native.js +16 -13
- package/build/shortcode/edit.native.js.map +1 -1
- package/build/site-logo/edit.js +3 -12
- package/build/site-logo/edit.js.map +1 -1
- package/build/social-links/deprecated.js.map +1 -1
- package/build/social-links/edit.js +2 -2
- package/build/social-links/edit.js.map +1 -1
- package/build/social-links/edit.native.js.map +1 -1
- package/build/spacer/controls.js.map +1 -1
- package/build/table/deprecated.js.map +1 -1
- package/build/table/edit.js +1 -0
- package/build/table/edit.js.map +1 -1
- package/build/table/index.js +6 -1
- package/build/table/index.js.map +1 -1
- package/build/table/save.js +2 -1
- package/build/table/save.js.map +1 -1
- package/build/table/state.js.map +1 -1
- package/build/table-of-contents/edit.js +11 -3
- package/build/table-of-contents/edit.js.map +1 -1
- package/build/tag-cloud/edit.js.map +1 -1
- package/build/template-part/edit/advanced-controls.js +4 -1
- package/build/template-part/edit/advanced-controls.js.map +1 -1
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/edit/utils/hooks.js +4 -1
- package/build/template-part/edit/utils/hooks.js.map +1 -1
- package/build/transformationCategories.native.js.map +1 -1
- package/build/video/edit-common-settings.js.map +1 -1
- package/build/video/edit.js +1 -0
- package/build/video/edit.js.map +1 -1
- package/build/video/edit.native.js +43 -0
- package/build/video/edit.native.js.map +1 -1
- package/build/video/index.js +6 -1
- package/build/video/index.js.map +1 -1
- package/build/video/save.js +1 -0
- package/build/video/save.js.map +1 -1
- package/build-module/audio/edit.js +2 -1
- package/build-module/audio/edit.js.map +1 -1
- package/build-module/audio/index.js +6 -1
- package/build-module/audio/index.js.map +1 -1
- package/build-module/audio/save.js +3 -2
- package/build-module/audio/save.js.map +1 -1
- package/build-module/avatar/hooks.js +2 -2
- package/build-module/avatar/hooks.js.map +1 -1
- package/build-module/block/edit.js.map +1 -1
- package/build-module/block/edit.native.js.map +1 -1
- package/build-module/button/deprecated.js +175 -35
- package/build-module/button/deprecated.js.map +1 -1
- package/build-module/button/edit.js +2 -2
- package/build-module/button/edit.js.map +1 -1
- package/build-module/button/edit.native.js.map +1 -1
- package/build-module/button/save.js +2 -2
- package/build-module/button/save.js.map +1 -1
- package/build-module/buttons/deprecated.js.map +1 -1
- package/build-module/buttons/edit.js.map +1 -1
- package/build-module/buttons/edit.native.js.map +1 -1
- package/build-module/column/deprecated.js.map +1 -1
- package/build-module/column/edit.js.map +1 -1
- package/build-module/column/edit.native.js.map +1 -1
- package/build-module/columns/deprecated.js.map +1 -1
- package/build-module/columns/edit.js +2 -2
- package/build-module/columns/edit.js.map +1 -1
- package/build-module/columns/edit.native.js +2 -2
- package/build-module/columns/edit.native.js.map +1 -1
- package/build-module/columns/index.js +3 -1
- package/build-module/columns/index.js.map +1 -1
- package/build-module/columns/utils.js +2 -2
- package/build-module/columns/utils.js.map +1 -1
- package/build-module/columns/variations.js +2 -2
- package/build-module/columns/variations.js.map +1 -1
- package/build-module/comment-author-name/edit.js +3 -3
- package/build-module/comment-author-name/edit.js.map +1 -1
- package/build-module/comment-author-name/index.js +0 -4
- package/build-module/comment-author-name/index.js.map +1 -1
- package/build-module/comment-date/edit.js +4 -4
- package/build-module/comment-date/edit.js.map +1 -1
- package/build-module/comment-date/index.js +0 -4
- package/build-module/comment-date/index.js.map +1 -1
- package/build-module/comment-edit-link/index.js +0 -4
- package/build-module/comment-edit-link/index.js.map +1 -1
- package/build-module/comment-reply-link/index.js +0 -4
- package/build-module/comment-reply-link/index.js.map +1 -1
- package/build-module/comments/edit.js +10 -2
- package/build-module/comments/edit.js.map +1 -1
- package/build-module/comments-title/deprecated.js +0 -3
- package/build-module/comments-title/deprecated.js.map +1 -1
- package/build-module/comments-title/edit.js +1 -1
- package/build-module/comments-title/edit.js.map +1 -1
- package/build-module/cover/controls.native.js.map +1 -1
- package/build-module/cover/deprecated.js +206 -198
- package/build-module/cover/deprecated.js.map +1 -1
- package/build-module/cover/edit/block-controls.js +3 -8
- package/build-module/cover/edit/block-controls.js.map +1 -1
- package/build-module/cover/edit/index.js +36 -33
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +32 -7
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/cover/edit.native.js.map +1 -1
- package/build-module/cover/index.js +1 -0
- package/build-module/cover/index.js.map +1 -1
- package/build-module/cover/save.js +19 -6
- package/build-module/cover/save.js.map +1 -1
- package/build-module/cover/shared.js +11 -12
- package/build-module/cover/shared.js.map +1 -1
- package/build-module/cover/transforms.js.map +1 -1
- package/build-module/embed/deprecated.js +6 -1
- package/build-module/embed/deprecated.js.map +1 -1
- package/build-module/embed/edit.js.map +1 -1
- package/build-module/embed/edit.native.js.map +1 -1
- package/build-module/embed/embed-controls.native.js.map +1 -1
- package/build-module/embed/embed-preview.js +2 -1
- package/build-module/embed/embed-preview.js.map +1 -1
- package/build-module/embed/icons.js +19 -0
- package/build-module/embed/icons.js.map +1 -1
- package/build-module/embed/index.js +6 -1
- package/build-module/embed/index.js.map +1 -1
- package/build-module/embed/save.js +2 -1
- package/build-module/embed/save.js.map +1 -1
- package/build-module/embed/transforms.js +6 -1
- package/build-module/embed/transforms.js.map +1 -1
- package/build-module/embed/util.js +6 -1
- package/build-module/embed/util.js.map +1 -1
- package/build-module/embed/variations.js +12 -1
- package/build-module/embed/variations.js.map +1 -1
- package/build-module/file/edit.js +2 -2
- package/build-module/file/edit.js.map +1 -1
- package/build-module/file/edit.native.js.map +1 -1
- package/build-module/file/index.js.map +1 -1
- package/build-module/file/save.js +7 -2
- package/build-module/file/save.js.map +1 -1
- package/build-module/gallery/edit.js +2 -2
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/gallery.js +2 -2
- package/build-module/gallery/gallery.js.map +1 -1
- package/build-module/gallery/gallery.native.js.map +1 -1
- package/build-module/gallery/gap-styles.js +14 -4
- package/build-module/gallery/gap-styles.js.map +1 -1
- package/build-module/gallery/index.js +1 -1
- package/build-module/gallery/index.js.map +1 -1
- package/build-module/gallery/save.js +2 -2
- package/build-module/gallery/save.js.map +1 -1
- package/build-module/gallery/shared.js +25 -8
- package/build-module/gallery/shared.js.map +1 -1
- package/build-module/gallery/transforms.js +3 -3
- package/build-module/gallery/transforms.js.map +1 -1
- package/build-module/gallery/v1/edit.js +4 -4
- package/build-module/gallery/v1/edit.js.map +1 -1
- package/build-module/gallery/v1/gallery-image.js +2 -1
- package/build-module/gallery/v1/gallery-image.js.map +1 -1
- package/build-module/gallery/v1/gallery-image.native.js.map +1 -1
- package/build-module/gallery/v1/gallery.js +2 -2
- package/build-module/gallery/v1/gallery.js.map +1 -1
- package/build-module/gallery/v1/save.js +8 -3
- package/build-module/gallery/v1/save.js.map +1 -1
- package/build-module/group/index.js +1 -0
- package/build-module/group/index.js.map +1 -1
- package/build-module/heading/autogenerate-anchors.js +5 -2
- package/build-module/heading/autogenerate-anchors.js.map +1 -1
- package/build-module/heading/deprecated.js.map +1 -1
- package/build-module/heading/edit.js.map +1 -1
- package/build-module/html/edit.js +12 -23
- package/build-module/html/edit.js.map +1 -1
- package/build-module/html/preview.js +38 -0
- package/build-module/html/preview.js.map +1 -0
- package/build-module/image/deprecated.js.map +1 -1
- package/build-module/image/edit.js +5 -56
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/edit.native.js +59 -6
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +6 -15
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/index.js +5 -0
- package/build-module/image/index.js.map +1 -1
- package/build-module/image/save.js +2 -1
- package/build-module/image/save.js.map +1 -1
- package/build-module/image/transforms.js.map +1 -1
- package/build-module/image/utils.js +2 -2
- package/build-module/image/utils.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/latest-comments/edit.js.map +1 -1
- package/build-module/latest-posts/edit.js +2 -2
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/latest-posts/edit.native.js.map +1 -1
- package/build-module/list/index.js.map +1 -1
- package/build-module/list/v2/edit.js.map +1 -1
- package/build-module/list/v2/transforms.js +32 -17
- package/build-module/list/v2/transforms.js.map +1 -1
- package/build-module/list-item/hooks/use-backspace.js.map +1 -1
- package/build-module/list-item/hooks/use-enter.js +7 -4
- package/build-module/list-item/hooks/use-enter.js.map +1 -1
- package/build-module/list-item/hooks/use-indent-list-item.js.map +1 -1
- package/build-module/list-item/hooks/use-outdent-list-item.js +34 -15
- package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build-module/list-item/hooks/use-space.js.map +1 -1
- package/build-module/list-item/hooks/use-split.js +19 -5
- package/build-module/list-item/hooks/use-split.js.map +1 -1
- package/build-module/media-text/deprecated.js +3 -1
- package/build-module/media-text/deprecated.js.map +1 -1
- package/build-module/media-text/edit.native.js.map +1 -1
- package/build-module/media-text/media-container.js +3 -1
- package/build-module/media-text/media-container.js.map +1 -1
- package/build-module/media-text/media-container.native.js.map +1 -1
- package/build-module/media-text/save.js +4 -1
- package/build-module/media-text/save.js.map +1 -1
- package/build-module/missing/edit.native.js.map +1 -1
- package/build-module/navigation/deprecated.js.map +1 -1
- package/build-module/navigation/edit/index.js +1 -1
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
- package/build-module/navigation/index.js +9 -0
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/use-navigation-entities.js.map +1 -1
- package/build-module/navigation/use-navigation-menu.js +73 -39
- package/build-module/navigation/use-navigation-menu.js.map +1 -1
- package/build-module/navigation/use-template-part-area-label.js +4 -1
- package/build-module/navigation/use-template-part-area-label.js.map +1 -1
- package/build-module/navigation/view.js +5 -3
- package/build-module/navigation/view.js.map +1 -1
- package/build-module/navigation-link/edit.js +44 -13
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/navigation-submenu/view.js +5 -3
- package/build-module/navigation-submenu/view.js.map +1 -1
- package/build-module/page-list/convert-to-links-modal.js.map +1 -1
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/paragraph/deprecated.js +2 -2
- package/build-module/paragraph/deprecated.js.map +1 -1
- package/build-module/pattern/edit.js.map +1 -1
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-author-name/index.js +2 -0
- package/build-module/post-author-name/index.js.map +1 -1
- package/build-module/post-author-name/transforms.js +32 -0
- package/build-module/post-author-name/transforms.js.map +1 -0
- package/build-module/post-comments-form/edit.js +12 -3
- package/build-module/post-comments-form/edit.js.map +1 -1
- package/build-module/post-comments-form/form.js +7 -1
- package/build-module/post-comments-form/form.js.map +1 -1
- package/build-module/post-content/edit.js.map +1 -1
- package/build-module/post-date/edit.js +15 -9
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +10 -23
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-navigation-link/index.js +4 -0
- package/build-module/post-navigation-link/index.js.map +1 -1
- package/build-module/pullquote/deprecated.js.map +1 -1
- package/build-module/query/edit/index.js +5 -1
- package/build-module/query/edit/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build-module/query/edit/query-toolbar.js +14 -2
- package/build-module/query/edit/query-toolbar.js.map +1 -1
- package/build-module/quote/v2/edit.js.map +1 -1
- package/build-module/search/edit.js +2 -2
- package/build-module/search/edit.js.map +1 -1
- package/build-module/search/edit.native.js.map +1 -1
- package/build-module/search/index.js +4 -0
- package/build-module/search/index.js.map +1 -1
- package/build-module/separator/use-deprecated-opacity.js.map +1 -1
- package/build-module/shortcode/edit.native.js +17 -13
- package/build-module/shortcode/edit.native.js.map +1 -1
- package/build-module/site-logo/edit.js +3 -11
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/social-links/deprecated.js.map +1 -1
- package/build-module/social-links/edit.js +2 -2
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/social-links/edit.native.js.map +1 -1
- package/build-module/spacer/controls.js.map +1 -1
- package/build-module/table/deprecated.js.map +1 -1
- package/build-module/table/edit.js +2 -1
- package/build-module/table/edit.js.map +1 -1
- package/build-module/table/index.js +6 -1
- package/build-module/table/index.js.map +1 -1
- package/build-module/table/save.js +3 -2
- package/build-module/table/save.js.map +1 -1
- package/build-module/table/state.js.map +1 -1
- package/build-module/table-of-contents/edit.js +12 -4
- package/build-module/table-of-contents/edit.js.map +1 -1
- package/build-module/tag-cloud/edit.js.map +1 -1
- package/build-module/template-part/edit/advanced-controls.js +4 -1
- package/build-module/template-part/edit/advanced-controls.js.map +1 -1
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/edit/utils/hooks.js +4 -1
- package/build-module/template-part/edit/utils/hooks.js.map +1 -1
- package/build-module/transformationCategories.native.js.map +1 -1
- package/build-module/video/edit-common-settings.js.map +1 -1
- package/build-module/video/edit.js +2 -1
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/edit.native.js +42 -1
- package/build-module/video/edit.native.js.map +1 -1
- package/build-module/video/index.js +6 -1
- package/build-module/video/index.js.map +1 -1
- package/build-module/video/save.js +2 -1
- package/build-module/video/save.js.map +1 -1
- package/build-style/audio/style-rtl.css +0 -3
- package/build-style/audio/style.css +0 -3
- package/build-style/button/style-rtl.css +5 -5
- package/build-style/button/style.css +5 -5
- package/build-style/common-rtl.css +1 -3
- package/build-style/common.css +1 -3
- package/build-style/cover/editor-rtl.css +11 -0
- package/build-style/cover/editor.css +11 -0
- package/build-style/cover/style-rtl.css +33 -25
- package/build-style/cover/style.css +33 -25
- package/build-style/editor-rtl.css +14 -39
- package/build-style/editor.css +14 -39
- package/build-style/embed/style-rtl.css +0 -1
- package/build-style/embed/style.css +0 -1
- package/build-style/file/style-rtl.css +11 -12
- package/build-style/file/style.css +11 -12
- package/build-style/gallery/style-rtl.css +2 -4
- package/build-style/gallery/style.css +2 -4
- package/build-style/image/style-rtl.css +0 -3
- package/build-style/image/style.css +0 -3
- package/build-style/navigation/style-rtl.css +9 -1
- package/build-style/navigation/style.css +9 -1
- package/build-style/post-comments/style-rtl.css +2 -1
- package/build-style/post-comments/style.css +2 -1
- package/build-style/post-comments-form/editor-rtl.css +3 -0
- package/build-style/post-comments-form/editor.css +3 -0
- package/build-style/post-featured-image/editor-rtl.css +0 -27
- package/build-style/post-featured-image/editor.css +0 -27
- package/build-style/post-template/style-rtl.css +9 -18
- package/build-style/post-template/style.css +9 -18
- package/build-style/search/style-rtl.css +9 -11
- package/build-style/search/style.css +9 -11
- package/build-style/site-logo/editor-rtl.css +0 -12
- package/build-style/site-logo/editor.css +0 -12
- package/build-style/site-logo/style-rtl.css +4 -0
- package/build-style/site-logo/style.css +4 -0
- package/build-style/style-rtl.css +86 -93
- package/build-style/style.css +86 -93
- package/build-style/table/style-rtl.css +0 -1
- package/build-style/table/style.css +0 -1
- package/build-style/video/style-rtl.css +1 -5
- package/build-style/video/style.css +1 -5
- package/package.json +30 -29
- package/src/audio/block.json +6 -1
- package/src/audio/edit.js +4 -0
- package/src/audio/index.js +1 -2
- package/src/audio/save.js +12 -2
- package/src/audio/style.scss +0 -2
- package/src/avatar/hooks.js +2 -2
- package/src/block/edit.js +4 -6
- package/src/block/edit.native.js +12 -16
- package/src/block/test/edit.native.js +5 -8
- package/src/button/deprecated.js +145 -36
- package/src/button/edit.js +7 -11
- package/src/button/edit.native.js +2 -3
- package/src/button/save.js +5 -11
- package/src/button/style.scss +10 -5
- package/src/buttons/deprecated.js +4 -6
- package/src/buttons/edit.js +3 -3
- package/src/buttons/edit.native.js +7 -11
- package/src/buttons/test/__snapshots__/edit.native.js.snap +1 -1
- package/src/buttons/test/edit.native.js +1 -1
- package/src/column/deprecated.js +2 -1
- package/src/column/edit.js +2 -3
- package/src/column/edit.native.js +2 -2
- package/src/columns/block.json +3 -1
- package/src/columns/deprecated.js +4 -2
- package/src/columns/edit.js +6 -7
- package/src/columns/edit.native.js +12 -16
- package/src/columns/index.js +1 -2
- package/src/columns/utils.js +5 -3
- package/src/columns/variations.js +2 -2
- package/src/comment-author-name/block.json +0 -4
- package/src/comment-author-name/edit.js +3 -12
- package/src/comment-date/block.json +0 -4
- package/src/comment-date/edit.js +10 -14
- package/src/comment-date/index.php +0 -3
- package/src/comment-edit-link/block.json +0 -4
- package/src/comment-reply-link/block.json +0 -4
- package/src/comments/edit.js +24 -4
- package/src/comments-title/deprecated.js +0 -2
- package/src/comments-title/edit.js +1 -1
- package/src/comments-title/index.php +1 -1
- package/src/cover/block.json +1 -0
- package/src/cover/controls.native.js +2 -4
- package/src/cover/deprecated.js +237 -195
- package/src/cover/edit/block-controls.js +11 -20
- package/src/cover/edit/index.js +81 -66
- package/src/cover/edit/inspector-controls.js +38 -7
- package/src/cover/edit.native.js +8 -13
- package/src/cover/editor.scss +13 -0
- package/src/cover/index.php +21 -8
- package/src/cover/save.js +28 -16
- package/src/cover/shared.js +5 -7
- package/src/cover/style.scss +27 -22
- package/src/cover/test/edit.native.js +4 -7
- package/src/cover/transforms.js +2 -7
- package/src/embed/block.json +6 -1
- package/src/embed/edit.js +38 -40
- package/src/embed/edit.native.js +46 -49
- package/src/embed/embed-controls.native.js +2 -3
- package/src/embed/embed-preview.js +8 -1
- package/src/embed/icons.js +25 -0
- package/src/embed/save.js +10 -2
- package/src/embed/style.scss +0 -1
- package/src/embed/test/__snapshots__/index.native.js.snap +1 -1
- package/src/embed/test/index.native.js +24 -50
- package/src/embed/variations.js +10 -0
- package/src/file/edit.js +9 -5
- package/src/file/edit.native.js +14 -25
- package/src/file/index.js +1 -2
- package/src/file/save.js +14 -2
- package/src/file/style.scss +16 -15
- package/src/freeform/editor.scss +0 -2
- package/src/gallery/block.json +1 -1
- package/src/gallery/edit.js +8 -6
- package/src/gallery/gallery.js +9 -2
- package/src/gallery/gallery.native.js +2 -4
- package/src/gallery/gap-styles.js +21 -6
- package/src/gallery/index.js +2 -4
- package/src/gallery/index.php +27 -12
- package/src/gallery/save.js +5 -1
- package/src/gallery/shared.js +22 -9
- package/src/gallery/test/__snapshots__/index.native.js.snap +2 -2
- package/src/gallery/test/helpers.native.js +11 -198
- package/src/gallery/test/index.native.js +37 -63
- package/src/gallery/transforms.js +3 -3
- package/src/gallery/v1/edit.js +18 -24
- package/src/gallery/v1/gallery-image.js +10 -11
- package/src/gallery/v1/gallery-image.native.js +8 -17
- package/src/gallery/v1/gallery.js +8 -2
- package/src/gallery/v1/save.js +20 -3
- package/src/group/block.json +1 -0
- package/src/heading/autogenerate-anchors.js +8 -5
- package/src/heading/deprecated.js +6 -21
- package/src/heading/edit.js +2 -3
- package/src/html/edit.js +10 -40
- package/src/html/preview.js +46 -0
- package/src/image/block.json +5 -0
- package/src/image/deprecated.js +6 -29
- package/src/image/edit.js +1 -53
- package/src/image/edit.native.js +75 -24
- package/src/image/image.js +35 -49
- package/src/image/save.js +10 -2
- package/src/image/style.scss +0 -2
- package/src/image/styles.native.scss +11 -0
- package/src/image/test/edit.native.js +51 -19
- package/src/image/transforms.js +4 -3
- package/src/image/utils.js +2 -2
- package/src/index.js +1 -1
- package/src/latest-comments/edit.js +2 -6
- package/src/latest-posts/edit.js +6 -7
- package/src/latest-posts/edit.native.js +10 -15
- package/src/list/index.js +1 -2
- package/src/list/test/migrate.js +1 -2
- package/src/list/v2/edit.js +6 -9
- package/src/list/v2/transforms.js +22 -7
- package/src/list-item/hooks/use-backspace.js +2 -3
- package/src/list-item/hooks/use-enter.js +11 -9
- package/src/list-item/hooks/use-indent-list-item.js +2 -3
- package/src/list-item/hooks/use-outdent-list-item.js +50 -24
- package/src/list-item/hooks/use-space.js +2 -3
- package/src/list-item/hooks/use-split.js +18 -9
- package/src/media-text/deprecated.js +6 -3
- package/src/media-text/edit.native.js +2 -5
- package/src/media-text/media-container.js +1 -1
- package/src/media-text/media-container.native.js +6 -9
- package/src/media-text/save.js +2 -1
- package/src/missing/edit.native.js +2 -3
- package/src/missing/test/edit-integration.native.js +2 -3
- package/src/missing/test/edit.native.js +6 -9
- package/src/navigation/block.json +9 -0
- package/src/navigation/deprecated.js +2 -5
- package/src/navigation/edit/index.js +25 -36
- package/src/navigation/edit/navigation-menu-delete-control.js +2 -3
- package/src/navigation/edit/unsaved-inner-blocks.js +31 -30
- package/src/navigation/edit/use-convert-classic-menu-to-block-menu.js +2 -3
- package/src/navigation/style.scss +10 -1
- package/src/navigation/test/use-navigation-menu.js +241 -0
- package/src/navigation/use-navigation-entities.js +11 -13
- package/src/navigation/use-navigation-menu.js +95 -82
- package/src/navigation/use-template-part-area-label.js +8 -7
- package/src/navigation/view.js +7 -2
- package/src/navigation-link/edit.js +59 -25
- package/src/navigation-link/test/edit.js +2 -24
- package/src/navigation-submenu/edit.js +10 -20
- package/src/navigation-submenu/view.js +7 -2
- package/src/page-list/convert-to-links-modal.js +51 -54
- package/src/page-list/edit.js +6 -6
- package/src/page-list/test/convert-to-links-modal.js +6 -12
- package/src/paragraph/deprecated.js +2 -2
- package/src/pattern/edit.js +2 -4
- package/src/post-author/edit.js +2 -3
- package/src/post-author/index.php +3 -2
- package/src/post-author-name/index.js +2 -0
- package/src/post-author-name/index.php +1 -1
- package/src/post-author-name/transforms.js +25 -0
- package/src/post-comments/index.php +1 -1
- package/src/post-comments/style.scss +7 -3
- package/src/post-comments-form/edit.js +20 -3
- package/src/post-comments-form/editor.scss +4 -0
- package/src/post-comments-form/form.js +11 -1
- package/src/post-comments-form/index.php +1 -1
- package/src/post-content/edit.js +2 -3
- package/src/post-date/edit.js +4 -3
- package/src/post-featured-image/edit.js +14 -30
- package/src/post-featured-image/editor.scss +0 -29
- package/src/post-featured-image/index.php +4 -2
- package/src/post-navigation-link/block.json +4 -0
- package/src/post-template/index.php +15 -3
- package/src/post-template/style.scss +1 -7
- package/src/pullquote/deprecated.js +2 -1
- package/src/query/edit/index.js +10 -10
- package/src/query/edit/inspector-controls/parent-control.js +2 -3
- package/src/query/edit/query-toolbar.js +25 -5
- package/src/query-pagination/index.php +0 -1
- package/src/quote/v2/edit.js +4 -6
- package/src/quote/v2/test/migrate.js +1 -2
- package/src/search/block.json +4 -0
- package/src/search/edit.js +9 -13
- package/src/search/edit.native.js +4 -6
- package/src/search/index.php +38 -23
- package/src/search/style.scss +11 -9
- package/src/separator/use-deprecated-opacity.js +2 -4
- package/src/shortcode/edit.native.js +30 -15
- package/src/shortcode/style.native.scss +11 -4
- package/src/shortcode/test/__snapshots__/edit.native.js.snap +9 -0
- package/src/shortcode/test/edit.native.js +55 -40
- package/src/site-logo/edit.js +3 -17
- package/src/site-logo/editor.scss +0 -14
- package/src/site-logo/style.scss +6 -0
- package/src/social-links/deprecated.js +4 -2
- package/src/social-links/edit.js +11 -10
- package/src/social-links/edit.native.js +3 -5
- package/src/spacer/controls.js +2 -3
- package/src/spacer/test/index.native.js +10 -21
- package/src/table/block.json +6 -1
- package/src/table/deprecated.js +4 -8
- package/src/table/edit.js +2 -0
- package/src/table/save.js +6 -1
- package/src/table/state.js +2 -4
- package/src/table/style.scss +0 -1
- package/src/table-of-contents/edit.js +22 -13
- package/src/tag-cloud/edit.js +4 -7
- package/src/template-part/edit/advanced-controls.js +4 -4
- package/src/template-part/edit/index.js +6 -10
- package/src/template-part/edit/utils/hooks.js +8 -7
- package/src/transformationCategories.native.js +3 -3
- package/src/video/block.json +6 -1
- package/src/video/edit-common-settings.js +2 -8
- package/src/video/edit.js +4 -0
- package/src/video/edit.native.js +38 -16
- package/src/video/index.js +1 -2
- package/src/video/save.js +10 -2
- package/src/video/style.scss +0 -2
|
@@ -16,6 +16,7 @@ import Clipboard from '@react-native-clipboard/clipboard';
|
|
|
16
16
|
*/
|
|
17
17
|
import { getBlockTypes, unregisterBlockType } from '@wordpress/blocks';
|
|
18
18
|
import {
|
|
19
|
+
requestMediaPicker,
|
|
19
20
|
setFeaturedImage,
|
|
20
21
|
sendMediaUpload,
|
|
21
22
|
subscribeMediaUpload,
|
|
@@ -49,6 +50,10 @@ jest.mock( 'lodash', () => {
|
|
|
49
50
|
return { ...actual, delay: ( cb ) => cb() };
|
|
50
51
|
} );
|
|
51
52
|
|
|
53
|
+
function mockGetMedia( media ) {
|
|
54
|
+
jest.spyOn( select( coreStore ), 'getMedia' ).mockReturnValue( media );
|
|
55
|
+
}
|
|
56
|
+
|
|
52
57
|
const apiFetchPromise = Promise.resolve( {} );
|
|
53
58
|
|
|
54
59
|
const clipboardPromise = Promise.resolve( '' );
|
|
@@ -79,7 +84,7 @@ describe( 'Image Block', () => {
|
|
|
79
84
|
<a href="https://cldup.com/cXyG__fTLN.jpg">
|
|
80
85
|
<img src="https://cldup.com/cXyG__fTLN.jpg" alt="" class="wp-image-1"/>
|
|
81
86
|
</a>
|
|
82
|
-
<figcaption>Mountain</figcaption></figure>
|
|
87
|
+
<figcaption class="wp-element-caption">Mountain</figcaption></figure>
|
|
83
88
|
<!-- /wp:image -->`;
|
|
84
89
|
const screen = await initializeEditor( { initialHtml } );
|
|
85
90
|
// We must await the image fetch via `getMedia`
|
|
@@ -95,7 +100,7 @@ describe( 'Image Block', () => {
|
|
|
95
100
|
fireEvent.press( screen.getByText( 'None' ) );
|
|
96
101
|
|
|
97
102
|
const expectedHtml = `<!-- wp:image {"id":1,"sizeSlug":"large","linkDestination":"none","className":"is-style-default"} -->
|
|
98
|
-
<figure class="wp-block-image size-large is-style-default"><img src="https://cldup.com/cXyG__fTLN.jpg" alt="" class="wp-image-1"/><figcaption>Mountain</figcaption></figure>
|
|
103
|
+
<figure class="wp-block-image size-large is-style-default"><img src="https://cldup.com/cXyG__fTLN.jpg" alt="" class="wp-image-1"/><figcaption class="wp-element-caption">Mountain</figcaption></figure>
|
|
99
104
|
<!-- /wp:image -->`;
|
|
100
105
|
expect( getEditorHtml() ).toBe( expectedHtml );
|
|
101
106
|
} );
|
|
@@ -105,7 +110,7 @@ describe( 'Image Block', () => {
|
|
|
105
110
|
<!-- wp:image {"id":1,"sizeSlug":"large","linkDestination":"none","className":"is-style-default"} -->
|
|
106
111
|
<figure class="wp-block-image size-large is-style-default">
|
|
107
112
|
<img src="https://cldup.com/cXyG__fTLN.jpg" alt="" class="wp-image-1"/>
|
|
108
|
-
<figcaption>Mountain</figcaption></figure>
|
|
113
|
+
<figcaption class="wp-element-caption">Mountain</figcaption></figure>
|
|
109
114
|
<!-- /wp:image -->`;
|
|
110
115
|
const screen = await initializeEditor( { initialHtml } );
|
|
111
116
|
// We must await the image fetch via `getMedia`
|
|
@@ -121,7 +126,7 @@ describe( 'Image Block', () => {
|
|
|
121
126
|
fireEvent.press( screen.getByText( 'Media File' ) );
|
|
122
127
|
|
|
123
128
|
const expectedHtml = `<!-- wp:image {"id":1,"sizeSlug":"large","linkDestination":"media","className":"is-style-default"} -->
|
|
124
|
-
<figure class="wp-block-image size-large is-style-default"><a href="https://cldup.com/cXyG__fTLN.jpg"><img src="https://cldup.com/cXyG__fTLN.jpg" alt="" class="wp-image-1"/></a><figcaption>Mountain</figcaption></figure>
|
|
129
|
+
<figure class="wp-block-image size-large is-style-default"><a href="https://cldup.com/cXyG__fTLN.jpg"><img src="https://cldup.com/cXyG__fTLN.jpg" alt="" class="wp-image-1"/></a><figcaption class="wp-element-caption">Mountain</figcaption></figure>
|
|
125
130
|
<!-- /wp:image -->`;
|
|
126
131
|
expect( getEditorHtml() ).toBe( expectedHtml );
|
|
127
132
|
} );
|
|
@@ -131,7 +136,7 @@ describe( 'Image Block', () => {
|
|
|
131
136
|
<!-- wp:image {"id":1,"sizeSlug":"large","linkDestination":"none","className":"is-style-default"} -->
|
|
132
137
|
<figure class="wp-block-image size-large is-style-default">
|
|
133
138
|
<img src="https://cldup.com/cXyG__fTLN.jpg" alt="" class="wp-image-1"/>
|
|
134
|
-
<figcaption>Mountain</figcaption></figure>
|
|
139
|
+
<figcaption class="wp-element-caption">Mountain</figcaption></figure>
|
|
135
140
|
<!-- /wp:image -->`;
|
|
136
141
|
const screen = await initializeEditor( { initialHtml } );
|
|
137
142
|
// We must await the image fetch via `getMedia`
|
|
@@ -154,7 +159,7 @@ describe( 'Image Block', () => {
|
|
|
154
159
|
fireEvent.press( screen.getByA11yLabel( 'Apply' ) );
|
|
155
160
|
|
|
156
161
|
const expectedHtml = `<!-- wp:image {"id":1,"sizeSlug":"large","linkDestination":"custom","className":"is-style-default"} -->
|
|
157
|
-
<figure class="wp-block-image size-large is-style-default"><a href="http://wordpress.org"><img src="https://cldup.com/cXyG__fTLN.jpg" alt="" class="wp-image-1"/></a><figcaption>Mountain</figcaption></figure>
|
|
162
|
+
<figure class="wp-block-image size-large is-style-default"><a href="http://wordpress.org"><img src="https://cldup.com/cXyG__fTLN.jpg" alt="" class="wp-image-1"/></a><figcaption class="wp-element-caption">Mountain</figcaption></figure>
|
|
158
163
|
<!-- /wp:image -->`;
|
|
159
164
|
expect( getEditorHtml() ).toBe( expectedHtml );
|
|
160
165
|
} );
|
|
@@ -164,7 +169,7 @@ describe( 'Image Block', () => {
|
|
|
164
169
|
<!-- wp:image {"id":1,"sizeSlug":"large","linkDestination":"none","className":"is-style-default"} -->
|
|
165
170
|
<figure class="wp-block-image size-large is-style-default">
|
|
166
171
|
<img src="https://cldup.com/cXyG__fTLN.jpg" alt="" class="wp-image-1"/>
|
|
167
|
-
<figcaption>Mountain</figcaption></figure>
|
|
172
|
+
<figcaption class="wp-element-caption">Mountain</figcaption></figure>
|
|
168
173
|
<!-- /wp:image -->`;
|
|
169
174
|
const screen = await initializeEditor( { initialHtml } );
|
|
170
175
|
// We must await the image fetch via `getMedia`
|
|
@@ -192,7 +197,7 @@ describe( 'Image Block', () => {
|
|
|
192
197
|
fireEvent.press( screen.getByText( 'Media File' ) );
|
|
193
198
|
|
|
194
199
|
const expectedHtml = `<!-- wp:image {"id":1,"sizeSlug":"large","linkDestination":"media","className":"is-style-default"} -->
|
|
195
|
-
<figure class="wp-block-image size-large is-style-default"><a href="https://cldup.com/cXyG__fTLN.jpg"><img src="https://cldup.com/cXyG__fTLN.jpg" alt="" class="wp-image-1"/></a><figcaption>Mountain</figcaption></figure>
|
|
200
|
+
<figure class="wp-block-image size-large is-style-default"><a href="https://cldup.com/cXyG__fTLN.jpg"><img src="https://cldup.com/cXyG__fTLN.jpg" alt="" class="wp-image-1"/></a><figcaption class="wp-element-caption">Mountain</figcaption></figure>
|
|
196
201
|
<!-- /wp:image -->`;
|
|
197
202
|
expect( getEditorHtml() ).toBe( expectedHtml );
|
|
198
203
|
} );
|
|
@@ -204,7 +209,7 @@ describe( 'Image Block', () => {
|
|
|
204
209
|
<a href="https://cldup.com/cXyG__fTLN.jpg">
|
|
205
210
|
<img src="https://cldup.com/cXyG__fTLN.jpg?w=683" alt="" class="wp-image-1"/>
|
|
206
211
|
</a>
|
|
207
|
-
<figcaption>Mountain</figcaption></figure>
|
|
212
|
+
<figcaption class="wp-element-caption">Mountain</figcaption></figure>
|
|
208
213
|
<!-- /wp:image -->`;
|
|
209
214
|
const screen = await initializeEditor( { initialHtml } );
|
|
210
215
|
// We must await the image fetch via `getMedia`
|
|
@@ -228,7 +233,7 @@ describe( 'Image Block', () => {
|
|
|
228
233
|
<a href="https://wordpress.org">
|
|
229
234
|
<img src="https://cldup.com/cXyG__fTLN.jpg" alt="" class="wp-image-1"/>
|
|
230
235
|
</a>
|
|
231
|
-
<figcaption>Mountain</figcaption></figure>
|
|
236
|
+
<figcaption class="wp-element-caption">Mountain</figcaption></figure>
|
|
232
237
|
<!-- /wp:image -->`;
|
|
233
238
|
const screen = await initializeEditor( { initialHtml } );
|
|
234
239
|
// We must await the image fetch via `getMedia`
|
|
@@ -246,7 +251,7 @@ describe( 'Image Block', () => {
|
|
|
246
251
|
fireEvent.press( linkTargetButton );
|
|
247
252
|
|
|
248
253
|
const expectedHtml = `<!-- wp:image {"id":1,"sizeSlug":"large","linkDestination":"custom","className":"is-style-default"} -->
|
|
249
|
-
<figure class="wp-block-image size-large is-style-default"><a href="https://wordpress.org" target="_blank" rel="noreferrer noopener"><img src="https://cldup.com/cXyG__fTLN.jpg" alt="" class="wp-image-1"/></a><figcaption>Mountain</figcaption></figure>
|
|
254
|
+
<figure class="wp-block-image size-large is-style-default"><a href="https://wordpress.org" target="_blank" rel="noreferrer noopener"><img src="https://cldup.com/cXyG__fTLN.jpg" alt="" class="wp-image-1"/></a><figcaption class="wp-element-caption">Mountain</figcaption></figure>
|
|
250
255
|
<!-- /wp:image -->`;
|
|
251
256
|
expect( getEditorHtml() ).toBe( expectedHtml );
|
|
252
257
|
} );
|
|
@@ -258,7 +263,7 @@ describe( 'Image Block', () => {
|
|
|
258
263
|
<a href="https://wordpress.org" target="_blank" rel="noreferrer noopener">
|
|
259
264
|
<img src="https://cldup.com/cXyG__fTLN.jpg" alt="" class="wp-image-1"/>
|
|
260
265
|
</a>
|
|
261
|
-
<figcaption>Mountain</figcaption>
|
|
266
|
+
<figcaption class="wp-element-caption">Mountain</figcaption>
|
|
262
267
|
</figure>
|
|
263
268
|
<!-- /wp:image -->`;
|
|
264
269
|
const screen = await initializeEditor( { initialHtml } );
|
|
@@ -277,7 +282,7 @@ describe( 'Image Block', () => {
|
|
|
277
282
|
fireEvent.press( linkTargetButton );
|
|
278
283
|
|
|
279
284
|
const expectedHtml = `<!-- wp:image {"id":1,"sizeSlug":"large","linkDestination":"custom","className":"is-style-default"} -->
|
|
280
|
-
<figure class="wp-block-image size-large is-style-default"><a href="https://wordpress.org"><img src="https://cldup.com/cXyG__fTLN.jpg" alt="" class="wp-image-1"/></a><figcaption>Mountain</figcaption></figure>
|
|
285
|
+
<figure class="wp-block-image size-large is-style-default"><a href="https://wordpress.org"><img src="https://cldup.com/cXyG__fTLN.jpg" alt="" class="wp-image-1"/></a><figcaption class="wp-element-caption">Mountain</figcaption></figure>
|
|
281
286
|
<!-- /wp:image -->`;
|
|
282
287
|
expect( getEditorHtml() ).toBe( expectedHtml );
|
|
283
288
|
} );
|
|
@@ -292,12 +297,6 @@ describe( 'Image Block', () => {
|
|
|
292
297
|
);
|
|
293
298
|
}
|
|
294
299
|
|
|
295
|
-
function mockGetMedia( media ) {
|
|
296
|
-
jest.spyOn( select( coreStore ), 'getMedia' ).mockReturnValueOnce(
|
|
297
|
-
media
|
|
298
|
-
);
|
|
299
|
-
}
|
|
300
|
-
|
|
301
300
|
it( 'does not prompt to replace featured image during a new image upload', () => {
|
|
302
301
|
// Arrange
|
|
303
302
|
const INITIAL_IMAGE = { id: 1, url: 'mock-url-1' };
|
|
@@ -406,4 +405,37 @@ describe( 'Image Block', () => {
|
|
|
406
405
|
);
|
|
407
406
|
} );
|
|
408
407
|
} );
|
|
408
|
+
|
|
409
|
+
it( 'sets src and alt attributes when selecting media', async () => {
|
|
410
|
+
const IMAGE = { id: 1, url: 'mock-image', alt: 'A beautiful mountain' };
|
|
411
|
+
requestMediaPicker.mockImplementationOnce(
|
|
412
|
+
( source, filter, multiple, callback ) => {
|
|
413
|
+
callback( {
|
|
414
|
+
id: IMAGE.id,
|
|
415
|
+
url: IMAGE.url,
|
|
416
|
+
alt: IMAGE.alt,
|
|
417
|
+
} );
|
|
418
|
+
}
|
|
419
|
+
);
|
|
420
|
+
mockGetMedia( {
|
|
421
|
+
id: IMAGE.id,
|
|
422
|
+
source_url: IMAGE.url,
|
|
423
|
+
} );
|
|
424
|
+
|
|
425
|
+
const initialHtml = `
|
|
426
|
+
<!-- wp:image -->
|
|
427
|
+
<figure class="wp-block-image">
|
|
428
|
+
<img alt="" />
|
|
429
|
+
</figure>
|
|
430
|
+
<!-- /wp:image -->`;
|
|
431
|
+
const screen = await initializeEditor( { initialHtml } );
|
|
432
|
+
|
|
433
|
+
fireEvent.press( screen.getByText( 'ADD IMAGE' ) );
|
|
434
|
+
fireEvent.press( screen.getByText( 'WordPress Media Library' ) );
|
|
435
|
+
|
|
436
|
+
const expectedHtml = `<!-- wp:image {"id":${ IMAGE.id },"sizeSlug":"large","linkDestination":"none"} -->
|
|
437
|
+
<figure class="wp-block-image size-large"><img src="${ IMAGE.url }" alt="${ IMAGE.alt }" class="wp-image-${ IMAGE.id }"/></figure>
|
|
438
|
+
<!-- /wp:image -->`;
|
|
439
|
+
expect( getEditorHtml() ).toBe( expectedHtml );
|
|
440
|
+
} );
|
|
409
441
|
} );
|
package/src/image/transforms.js
CHANGED
|
@@ -90,9 +90,10 @@ const transforms = {
|
|
|
90
90
|
node.className +
|
|
91
91
|
' ' +
|
|
92
92
|
node.querySelector( 'img' ).className;
|
|
93
|
-
const alignMatches =
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
const alignMatches =
|
|
94
|
+
/(?:^|\s)align(left|center|right)(?:$|\s)/.exec(
|
|
95
|
+
className
|
|
96
|
+
);
|
|
96
97
|
const anchor = node.id === '' ? undefined : node.id;
|
|
97
98
|
const align = alignMatches ? alignMatches[ 1 ] : undefined;
|
|
98
99
|
const idMatches = /(?:^|\s)wp-image-(\d+)(?:$|\s)/.exec(
|
package/src/image/utils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { isEmpty,
|
|
4
|
+
import { isEmpty, get } from 'lodash';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
@@ -13,7 +13,7 @@ export function removeNewTabRel( currentRel ) {
|
|
|
13
13
|
|
|
14
14
|
if ( currentRel !== undefined && ! isEmpty( newRel ) ) {
|
|
15
15
|
if ( ! isEmpty( newRel ) ) {
|
|
16
|
-
|
|
16
|
+
NEW_TAB_REL.forEach( ( relVal ) => {
|
|
17
17
|
const regExp = new RegExp( '\\b' + relVal + '\\b', 'gi' );
|
|
18
18
|
newRel = newRel.replace( regExp, '' );
|
|
19
19
|
} );
|
package/src/index.js
CHANGED
|
@@ -153,7 +153,7 @@ const getAllBlocks = () => [
|
|
|
153
153
|
buttons,
|
|
154
154
|
calendar,
|
|
155
155
|
categories,
|
|
156
|
-
window.wp && window.wp.oldEditor ? classic :
|
|
156
|
+
...( window.wp && window.wp.oldEditor ? [ classic ] : [] ), // Only add the classic block in WP Context.
|
|
157
157
|
code,
|
|
158
158
|
column,
|
|
159
159
|
columns,
|
|
@@ -25,12 +25,8 @@ const MIN_COMMENTS = 1;
|
|
|
25
25
|
const MAX_COMMENTS = 100;
|
|
26
26
|
|
|
27
27
|
export default function LatestComments( { attributes, setAttributes } ) {
|
|
28
|
-
const {
|
|
29
|
-
|
|
30
|
-
displayAvatar,
|
|
31
|
-
displayDate,
|
|
32
|
-
displayExcerpt,
|
|
33
|
-
} = attributes;
|
|
28
|
+
const { commentsToShow, displayAvatar, displayDate, displayExcerpt } =
|
|
29
|
+
attributes;
|
|
34
30
|
|
|
35
31
|
return (
|
|
36
32
|
<div { ...useBlockProps() }>
|
package/src/latest-posts/edit.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { get, includes, invoke,
|
|
4
|
+
import { get, includes, invoke, pickBy } from 'lodash';
|
|
5
5
|
import classnames from 'classnames';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -113,7 +113,7 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
|
|
|
113
113
|
per_page: postsToShow,
|
|
114
114
|
_embed: 'wp:featuredmedia',
|
|
115
115
|
},
|
|
116
|
-
( value ) =>
|
|
116
|
+
( value ) => typeof value !== 'undefined'
|
|
117
117
|
);
|
|
118
118
|
|
|
119
119
|
return {
|
|
@@ -450,13 +450,12 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
|
|
|
450
450
|
excerptElement.innerText ||
|
|
451
451
|
'';
|
|
452
452
|
|
|
453
|
-
const {
|
|
454
|
-
|
|
455
|
-
alt: featuredImageAlt,
|
|
456
|
-
} = getFeaturedImageDetails( post, featuredImageSizeSlug );
|
|
453
|
+
const { url: imageSourceUrl, alt: featuredImageAlt } =
|
|
454
|
+
getFeaturedImageDetails( post, featuredImageSizeSlug );
|
|
457
455
|
const imageClasses = classnames( {
|
|
458
456
|
'wp-block-latest-posts__featured-image': true,
|
|
459
|
-
[ `align${ featuredImageAlign }` ]:
|
|
457
|
+
[ `align${ featuredImageAlign }` ]:
|
|
458
|
+
!! featuredImageAlign,
|
|
460
459
|
} );
|
|
461
460
|
const renderFeaturedImage =
|
|
462
461
|
displayFeaturedImage && imageSourceUrl;
|
|
@@ -38,23 +38,18 @@ class LatestPostsEdit extends Component {
|
|
|
38
38
|
this.state = {
|
|
39
39
|
categoriesList: [],
|
|
40
40
|
};
|
|
41
|
-
this.onSetDisplayPostContent =
|
|
42
|
-
this
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
this
|
|
46
|
-
);
|
|
41
|
+
this.onSetDisplayPostContent =
|
|
42
|
+
this.onSetDisplayPostContent.bind( this );
|
|
43
|
+
this.onSetDisplayPostContentRadio =
|
|
44
|
+
this.onSetDisplayPostContentRadio.bind( this );
|
|
47
45
|
this.onSetExcerptLength = this.onSetExcerptLength.bind( this );
|
|
48
46
|
this.onSetDisplayPostDate = this.onSetDisplayPostDate.bind( this );
|
|
49
|
-
this.onSetDisplayFeaturedImage =
|
|
50
|
-
this
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
this.onSetAddLinkToFeaturedImage = this.onSetAddLinkToFeaturedImage.bind(
|
|
56
|
-
this
|
|
57
|
-
);
|
|
47
|
+
this.onSetDisplayFeaturedImage =
|
|
48
|
+
this.onSetDisplayFeaturedImage.bind( this );
|
|
49
|
+
this.onSetFeaturedImageAlign =
|
|
50
|
+
this.onSetFeaturedImageAlign.bind( this );
|
|
51
|
+
this.onSetAddLinkToFeaturedImage =
|
|
52
|
+
this.onSetAddLinkToFeaturedImage.bind( this );
|
|
58
53
|
this.onSetOrder = this.onSetOrder.bind( this );
|
|
59
54
|
this.onSetOrderBy = this.onSetOrderBy.bind( this );
|
|
60
55
|
this.onSetPostsToShow = this.onSetPostsToShow.bind( this );
|
package/src/list/index.js
CHANGED
|
@@ -21,8 +21,7 @@ const settingsV1 = {
|
|
|
21
21
|
icon,
|
|
22
22
|
example: {
|
|
23
23
|
attributes: {
|
|
24
|
-
values:
|
|
25
|
-
'<li>Alice.</li><li>The White Rabbit.</li><li>The Cheshire Cat.</li><li>The Mad Hatter.</li><li>The Queen of Hearts.</li>',
|
|
24
|
+
values: '<li>Alice.</li><li>The White Rabbit.</li><li>The Cheshire Cat.</li><li>The Mad Hatter.</li><li>The Queen of Hearts.</li>',
|
|
26
25
|
},
|
|
27
26
|
},
|
|
28
27
|
transforms,
|
package/src/list/test/migrate.js
CHANGED
|
@@ -27,8 +27,7 @@ describe( 'Migrate list block', () => {
|
|
|
27
27
|
|
|
28
28
|
it( 'should migrate the values attribute to inner blocks', () => {
|
|
29
29
|
const [ updatedAttributes, updatedInnerBlocks ] = migrateToListV2( {
|
|
30
|
-
values:
|
|
31
|
-
'<li>test</li><li>test</li><li>test<ol><li>test test</li><li>test est eesssss</li></ol></li>',
|
|
30
|
+
values: '<li>test</li><li>test</li><li>test<ol><li>test test</li><li>test est eesssss</li></ol></li>',
|
|
32
31
|
ordered: false,
|
|
33
32
|
} );
|
|
34
33
|
|
package/src/list/v2/edit.js
CHANGED
|
@@ -45,9 +45,8 @@ const TEMPLATE = [ [ 'core/list-item' ] ];
|
|
|
45
45
|
*/
|
|
46
46
|
function useMigrateOnLoad( attributes, clientId ) {
|
|
47
47
|
const registry = useRegistry();
|
|
48
|
-
const { updateBlockAttributes, replaceInnerBlocks } =
|
|
49
|
-
blockEditorStore
|
|
50
|
-
);
|
|
48
|
+
const { updateBlockAttributes, replaceInnerBlocks } =
|
|
49
|
+
useDispatch( blockEditorStore );
|
|
51
50
|
|
|
52
51
|
useEffect( () => {
|
|
53
52
|
// As soon as the block is loaded, migrate it to the new version.
|
|
@@ -74,9 +73,8 @@ function useMigrateOnLoad( attributes, clientId ) {
|
|
|
74
73
|
function useOutdentList( clientId ) {
|
|
75
74
|
const { canOutdent } = useSelect(
|
|
76
75
|
( innerSelect ) => {
|
|
77
|
-
const { getBlockRootClientId, getBlock } =
|
|
78
|
-
blockEditorStore
|
|
79
|
-
);
|
|
76
|
+
const { getBlockRootClientId, getBlock } =
|
|
77
|
+
innerSelect( blockEditorStore );
|
|
80
78
|
const parentId = getBlockRootClientId( clientId );
|
|
81
79
|
return {
|
|
82
80
|
canOutdent:
|
|
@@ -87,9 +85,8 @@ function useOutdentList( clientId ) {
|
|
|
87
85
|
[ clientId ]
|
|
88
86
|
);
|
|
89
87
|
const { replaceBlocks, selectionChange } = useDispatch( blockEditorStore );
|
|
90
|
-
const { getBlockRootClientId, getBlockAttributes, getBlock } =
|
|
91
|
-
blockEditorStore
|
|
92
|
-
);
|
|
88
|
+
const { getBlockRootClientId, getBlockAttributes, getBlock } =
|
|
89
|
+
useSelect( blockEditorStore );
|
|
93
90
|
|
|
94
91
|
return [
|
|
95
92
|
canOutdent,
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* External dependencies
|
|
6
|
+
*/
|
|
7
|
+
import { flatMap } from 'lodash';
|
|
8
|
+
|
|
1
9
|
/**
|
|
2
10
|
* WordPress dependencies
|
|
3
11
|
*/
|
|
@@ -35,6 +43,15 @@ function getListContentSchema( { phrasingContentSchema } ) {
|
|
|
35
43
|
return listContentSchema;
|
|
36
44
|
}
|
|
37
45
|
|
|
46
|
+
function getListContentFlat( blocks ) {
|
|
47
|
+
return flatMap( blocks, ( { name, attributes, innerBlocks = [] } ) => {
|
|
48
|
+
if ( name === 'core/list-item' ) {
|
|
49
|
+
return [ attributes.content, ...getListContentFlat( innerBlocks ) ];
|
|
50
|
+
}
|
|
51
|
+
return getListContentFlat( innerBlocks );
|
|
52
|
+
} );
|
|
53
|
+
}
|
|
54
|
+
|
|
38
55
|
const transforms = {
|
|
39
56
|
from: [
|
|
40
57
|
{
|
|
@@ -123,13 +140,11 @@ const transforms = {
|
|
|
123
140
|
type: 'block',
|
|
124
141
|
blocks: [ block ],
|
|
125
142
|
transform: ( _attributes, childBlocks ) => {
|
|
126
|
-
return childBlocks
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
} )
|
|
132
|
-
);
|
|
143
|
+
return getListContentFlat( childBlocks ).map( ( content ) =>
|
|
144
|
+
createBlock( block, {
|
|
145
|
+
content,
|
|
146
|
+
} )
|
|
147
|
+
);
|
|
133
148
|
},
|
|
134
149
|
} ) ),
|
|
135
150
|
...[ 'core/quote', 'core/pullquote' ].map( ( block ) => ( {
|
|
@@ -13,9 +13,8 @@ import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
|
13
13
|
import useOutdentListItem from './use-outdent-list-item';
|
|
14
14
|
|
|
15
15
|
export default function useBackspace( props ) {
|
|
16
|
-
const { getSelectionStart, getSelectionEnd } =
|
|
17
|
-
blockEditorStore
|
|
18
|
-
);
|
|
16
|
+
const { getSelectionStart, getSelectionEnd } =
|
|
17
|
+
useSelect( blockEditorStore );
|
|
19
18
|
const propsRef = useRef( props );
|
|
20
19
|
propsRef.current = props;
|
|
21
20
|
const [ canOutdent, outdentListItem ] = useOutdentListItem(
|
|
@@ -18,10 +18,9 @@ import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
|
18
18
|
import useOutdentListItem from './use-outdent-list-item';
|
|
19
19
|
|
|
20
20
|
export default function useEnter( props ) {
|
|
21
|
-
const { replaceBlocks } = useDispatch( blockEditorStore );
|
|
22
|
-
const { getBlock, getBlockRootClientId, getBlockIndex } =
|
|
23
|
-
blockEditorStore
|
|
24
|
-
);
|
|
21
|
+
const { replaceBlocks, selectionChange } = useDispatch( blockEditorStore );
|
|
22
|
+
const { getBlock, getBlockRootClientId, getBlockIndex } =
|
|
23
|
+
useSelect( blockEditorStore );
|
|
25
24
|
const propsRef = useRef( props );
|
|
26
25
|
propsRef.current = props;
|
|
27
26
|
const [ canOutdent, outdentListItem ] = useOutdentListItem(
|
|
@@ -43,8 +42,9 @@ export default function useEnter( props ) {
|
|
|
43
42
|
return;
|
|
44
43
|
}
|
|
45
44
|
// Here we are in top level list so we need to split.
|
|
46
|
-
const
|
|
47
|
-
|
|
45
|
+
const topParentListBlock = getBlock(
|
|
46
|
+
getBlockRootClientId( clientId )
|
|
47
|
+
);
|
|
48
48
|
const blockIndex = getBlockIndex( clientId );
|
|
49
49
|
const head = cloneBlock( {
|
|
50
50
|
...topParentListBlock,
|
|
@@ -70,11 +70,13 @@ export default function useEnter( props ) {
|
|
|
70
70
|
]
|
|
71
71
|
: [];
|
|
72
72
|
replaceBlocks(
|
|
73
|
-
|
|
73
|
+
topParentListBlock.clientId,
|
|
74
74
|
[ head, middle, ...tail ],
|
|
75
|
-
1
|
|
76
|
-
0
|
|
75
|
+
1
|
|
77
76
|
);
|
|
77
|
+
// We manually change the selection here because we are replacing
|
|
78
|
+
// a different block than the selected one.
|
|
79
|
+
selectionChange( middle.clientId );
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
element.addEventListener( 'keydown', onKeyDown );
|
|
@@ -11,9 +11,8 @@ export default function useIndentListItem( clientId ) {
|
|
|
11
11
|
( select ) => select( blockEditorStore ).getBlockIndex( clientId ) > 0,
|
|
12
12
|
[ clientId ]
|
|
13
13
|
);
|
|
14
|
-
const { replaceBlocks, selectionChange, multiSelect } =
|
|
15
|
-
blockEditorStore
|
|
16
|
-
);
|
|
14
|
+
const { replaceBlocks, selectionChange, multiSelect } =
|
|
15
|
+
useDispatch( blockEditorStore );
|
|
17
16
|
const {
|
|
18
17
|
getBlock,
|
|
19
18
|
getPreviousBlockClientId,
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { first, last } from 'lodash';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* WordPress dependencies
|
|
3
8
|
*/
|
|
4
9
|
import { useCallback } from '@wordpress/element';
|
|
5
10
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
11
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
12
|
+
import { cloneBlock } from '@wordpress/blocks';
|
|
7
13
|
|
|
8
14
|
/**
|
|
9
15
|
* Internal dependencies
|
|
@@ -23,7 +29,8 @@ export default function useOutdentListItem( clientId ) {
|
|
|
23
29
|
},
|
|
24
30
|
[ clientId ]
|
|
25
31
|
);
|
|
26
|
-
const { replaceBlocks, selectionChange } =
|
|
32
|
+
const { replaceBlocks, selectionChange, multiSelect } =
|
|
33
|
+
useDispatch( blockEditorStore );
|
|
27
34
|
const {
|
|
28
35
|
getBlockRootClientId,
|
|
29
36
|
getBlockAttributes,
|
|
@@ -31,65 +38,84 @@ export default function useOutdentListItem( clientId ) {
|
|
|
31
38
|
getBlockIndex,
|
|
32
39
|
getSelectionStart,
|
|
33
40
|
getSelectionEnd,
|
|
41
|
+
hasMultiSelection,
|
|
42
|
+
getMultiSelectedBlockClientIds,
|
|
34
43
|
} = useSelect( blockEditorStore );
|
|
35
44
|
|
|
36
45
|
return [
|
|
37
46
|
canOutdent,
|
|
38
47
|
useCallback( () => {
|
|
48
|
+
const _hasMultiSelection = hasMultiSelection();
|
|
49
|
+
const clientIds = _hasMultiSelection
|
|
50
|
+
? getMultiSelectedBlockClientIds()
|
|
51
|
+
: [ clientId ];
|
|
52
|
+
|
|
39
53
|
const selectionStart = getSelectionStart();
|
|
40
54
|
const selectionEnd = getSelectionEnd();
|
|
41
55
|
|
|
42
56
|
const listParentId = getBlockRootClientId( clientId );
|
|
43
57
|
const listAttributes = getBlockAttributes( listParentId );
|
|
44
58
|
const listItemParentId = getBlockRootClientId( listParentId );
|
|
45
|
-
const listItemParentAttributes =
|
|
46
|
-
listItemParentId
|
|
47
|
-
);
|
|
59
|
+
const listItemParentAttributes =
|
|
60
|
+
getBlockAttributes( listItemParentId );
|
|
48
61
|
|
|
49
|
-
const
|
|
62
|
+
const firstIndex = getBlockIndex( first( clientIds ) );
|
|
63
|
+
const lastIndex = getBlockIndex( last( clientIds ) );
|
|
50
64
|
const siblingBlocks = getBlock( listParentId ).innerBlocks;
|
|
51
|
-
const previousSiblings = siblingBlocks.slice( 0,
|
|
52
|
-
const afterSiblings = siblingBlocks.slice(
|
|
65
|
+
const previousSiblings = siblingBlocks.slice( 0, firstIndex );
|
|
66
|
+
const afterSiblings = siblingBlocks.slice( lastIndex + 1 );
|
|
53
67
|
|
|
54
68
|
// Create a new parent list item block with just the siblings
|
|
55
|
-
// that existed before the child item being outdent.
|
|
69
|
+
// that existed before the first child item being outdent.
|
|
56
70
|
const newListItemParent = createListItem(
|
|
57
71
|
listItemParentAttributes,
|
|
58
72
|
listAttributes,
|
|
59
73
|
previousSiblings
|
|
60
74
|
);
|
|
61
75
|
|
|
62
|
-
const
|
|
63
|
-
const childList =
|
|
76
|
+
const lastBlock = getBlock( last( clientIds ) );
|
|
77
|
+
const childList = lastBlock.innerBlocks[ 0 ];
|
|
64
78
|
const childItems = childList?.innerBlocks || [];
|
|
65
79
|
const hasChildItems = !! childItems.length;
|
|
66
80
|
|
|
81
|
+
const newBlocksExcludingLast = clientIds
|
|
82
|
+
.slice( 0, -1 )
|
|
83
|
+
.map( ( _clientId ) => cloneBlock( getBlock( _clientId ) ) );
|
|
84
|
+
|
|
67
85
|
// Create a new list item block whose attributes are equal to the
|
|
68
|
-
// block being outdent and whose children are the children that it had (if any)
|
|
86
|
+
// last block being outdent and whose children are the children that it had (if any)
|
|
69
87
|
// followed by the siblings that existed after it.
|
|
70
|
-
const
|
|
71
|
-
|
|
88
|
+
const newLastItem = createListItem(
|
|
89
|
+
lastBlock.attributes,
|
|
72
90
|
hasChildItems ? childList.attributes : listAttributes,
|
|
73
91
|
[ ...childItems, ...afterSiblings ]
|
|
74
92
|
);
|
|
75
93
|
|
|
76
94
|
// Replace the parent list item block, with a new block containing
|
|
77
|
-
// the previous siblings
|
|
78
|
-
//
|
|
95
|
+
// the previous siblings before the first block being outdent,
|
|
96
|
+
// followed by the blocks being outdent with the after siblings added
|
|
97
|
+
// as children of the last block.
|
|
79
98
|
replaceBlocks(
|
|
80
99
|
[ listItemParentId ],
|
|
81
|
-
[ newListItemParent,
|
|
100
|
+
[ newListItemParent, ...newBlocksExcludingLast, newLastItem ]
|
|
82
101
|
);
|
|
83
102
|
|
|
84
103
|
// Restore the selection state.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
104
|
+
if ( ! _hasMultiSelection ) {
|
|
105
|
+
selectionChange(
|
|
106
|
+
newLastItem.clientId,
|
|
107
|
+
selectionEnd.attributeKey,
|
|
108
|
+
selectionEnd.clientId === selectionStart.clientId
|
|
109
|
+
? selectionStart.offset
|
|
110
|
+
: selectionEnd.offset,
|
|
111
|
+
selectionEnd.offset
|
|
112
|
+
);
|
|
113
|
+
} else {
|
|
114
|
+
multiSelect(
|
|
115
|
+
first( newBlocksExcludingLast ).clientId,
|
|
116
|
+
newLastItem.clientId
|
|
117
|
+
);
|
|
118
|
+
}
|
|
93
119
|
}, [ clientId ] ),
|
|
94
120
|
];
|
|
95
121
|
}
|
|
@@ -12,9 +12,8 @@ import { useSelect } from '@wordpress/data';
|
|
|
12
12
|
import useIndentListItem from './use-indent-list-item';
|
|
13
13
|
|
|
14
14
|
export default function useSpace( clientId ) {
|
|
15
|
-
const { getSelectionStart, getSelectionEnd } =
|
|
16
|
-
blockEditorStore
|
|
17
|
-
);
|
|
15
|
+
const { getSelectionStart, getSelectionEnd } =
|
|
16
|
+
useSelect( blockEditorStore );
|
|
18
17
|
const [ canIndent, indentListItem ] = useIndentListItem( clientId );
|
|
19
18
|
|
|
20
19
|
return useRefEffect(
|