@wordpress/block-library 7.7.0 → 7.10.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.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.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/comment-template/index.js +1 -1
- package/build/comments/deprecated.js +65 -0
- package/build/comments/deprecated.js.map +1 -0
- package/build/comments/edit.js +10 -2
- package/build/comments/edit.js.map +1 -1
- package/build/comments/index.js +5 -2
- package/build/comments/index.js.map +1 -1
- package/build/comments-pagination/index.js +1 -1
- package/build/comments-title/deprecated.js +1 -4
- 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/comments-title/index.js +1 -1
- package/build/cover/controls.native.js.map +1 -1
- package/build/cover/deprecated.js.map +1 -1
- package/build/cover/edit/block-controls.js +5 -22
- package/build/cover/edit/block-controls.js.map +1 -1
- package/build/cover/edit/cover-placeholder.js +3 -1
- package/build/cover/edit/cover-placeholder.js.map +1 -1
- package/build/cover/edit/index.js +38 -30
- 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.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 +1 -1
- package/build/file/save.js.map +1 -1
- package/build/gallery/edit.js +10 -18
- 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/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 +32 -22
- package/build/gallery/transforms.js.map +1 -1
- package/build/gallery/use-get-media.js +7 -18
- package/build/gallery/use-get-media.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/edit.js +1 -3
- 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/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/heading/heading-level-dropdown.js +2 -1
- package/build/heading/heading-level-dropdown.js.map +1 -1
- package/build/heading/index.js +9 -4
- package/build/heading/index.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.native.js +2 -1
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +1 -0
- 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 +2 -2
- 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/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/more/edit.js +2 -4
- package/build/more/edit.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 +6 -1
- package/build/navigation/view.js.map +1 -1
- package/build/navigation-link/edit.js +14 -8
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-link/hooks.js +0 -16
- package/build/navigation-link/hooks.js.map +1 -1
- package/build/navigation-link/index.js +1 -1
- package/build/navigation-link/index.js.map +1 -1
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/navigation-submenu/view.js +6 -1
- package/build/navigation-submenu/view.js.map +1 -1
- package/build/nextpage/edit.js +1 -3
- package/build/nextpage/edit.js.map +1 -1
- package/build/page-list/convert-to-links-modal.js.map +1 -1
- package/build/page-list/edit.js +2 -2
- 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-comments-form/edit.js +14 -6
- package/build/post-comments-form/edit.js.map +1 -1
- package/build/post-comments-form/form.js +1 -1
- package/build/post-comments-form/form.js.map +1 -1
- package/build/post-content/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/post-terms/index.js +1 -1
- package/build/post-terms/index.js.map +1 -1
- package/build/post-title/index.js +1 -0
- package/build/post-title/index.js.map +1 -1
- package/build/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/index.js +1 -1
- package/build/query/edit/inspector-controls/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/query/index.js +1 -1
- package/build/query/index.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/separator/use-deprecated-opacity.js.map +1 -1
- package/build/shortcode/edit.native.js.map +1 -1
- package/build/site-logo/edit.js +8 -25
- package/build/site-logo/edit.js.map +1 -1
- package/build/site-title/edit/level-toolbar.js +2 -1
- package/build/site-title/edit/level-toolbar.js.map +1 -1
- package/build/social-links/deprecated.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.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/template-part/index.js +1 -1
- package/build/template-part/index.js.map +1 -1
- package/build/template-part/variations.js +0 -16
- package/build/template-part/variations.js.map +1 -1
- package/build/transformationCategories.native.js.map +1 -1
- package/build/utils/clean-empty-object.js +5 -3
- package/build/utils/clean-empty-object.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/video/tracks-editor.js +9 -11
- package/build/video/tracks-editor.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.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.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/comment-template/index.js +1 -1
- package/build-module/comments/deprecated.js +54 -0
- package/build-module/comments/deprecated.js.map +1 -0
- package/build-module/comments/edit.js +10 -2
- package/build-module/comments/edit.js.map +1 -1
- package/build-module/comments/index.js +4 -2
- package/build-module/comments/index.js.map +1 -1
- package/build-module/comments-pagination/index.js +1 -1
- package/build-module/comments-title/deprecated.js +1 -4
- 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/comments-title/index.js +1 -1
- package/build-module/cover/controls.native.js.map +1 -1
- package/build-module/cover/deprecated.js.map +1 -1
- package/build-module/cover/edit/block-controls.js +6 -21
- package/build-module/cover/edit/block-controls.js.map +1 -1
- package/build-module/cover/edit/cover-placeholder.js +3 -1
- package/build-module/cover/edit/cover-placeholder.js.map +1 -1
- package/build-module/cover/edit/index.js +39 -31
- 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.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 +2 -2
- package/build-module/file/save.js.map +1 -1
- package/build-module/gallery/edit.js +11 -18
- 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/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 +33 -23
- package/build-module/gallery/transforms.js.map +1 -1
- package/build-module/gallery/use-get-media.js +6 -16
- package/build-module/gallery/use-get-media.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/edit.js +1 -3
- 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/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/heading/heading-level-dropdown.js +2 -1
- package/build-module/heading/heading-level-dropdown.js.map +1 -1
- package/build-module/heading/index.js +9 -4
- package/build-module/heading/index.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.native.js +2 -1
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +2 -1
- 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 +3 -3
- 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/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/more/edit.js +2 -4
- package/build-module/more/edit.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 +6 -1
- package/build-module/navigation/view.js.map +1 -1
- package/build-module/navigation-link/edit.js +14 -8
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-link/hooks.js +0 -13
- package/build-module/navigation-link/hooks.js.map +1 -1
- package/build-module/navigation-link/index.js +1 -1
- package/build-module/navigation-link/index.js.map +1 -1
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/navigation-submenu/view.js +6 -1
- package/build-module/navigation-submenu/view.js.map +1 -1
- package/build-module/nextpage/edit.js +1 -3
- package/build-module/nextpage/edit.js.map +1 -1
- package/build-module/page-list/convert-to-links-modal.js.map +1 -1
- package/build-module/page-list/edit.js +2 -2
- 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-comments-form/edit.js +14 -7
- package/build-module/post-comments-form/edit.js.map +1 -1
- package/build-module/post-comments-form/form.js +2 -2
- 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-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/post-terms/index.js +1 -1
- package/build-module/post-terms/index.js.map +1 -1
- package/build-module/post-title/index.js +1 -0
- package/build-module/post-title/index.js.map +1 -1
- package/build-module/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/index.js +1 -1
- package/build-module/query/edit/inspector-controls/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/query/index.js +1 -1
- package/build-module/query/index.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/separator/use-deprecated-opacity.js.map +1 -1
- package/build-module/shortcode/edit.native.js.map +1 -1
- package/build-module/site-logo/edit.js +8 -24
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/site-title/edit/level-toolbar.js +2 -1
- package/build-module/site-title/edit/level-toolbar.js.map +1 -1
- package/build-module/social-links/deprecated.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.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/template-part/index.js +1 -1
- package/build-module/template-part/index.js.map +1 -1
- package/build-module/template-part/variations.js +0 -13
- package/build-module/template-part/variations.js.map +1 -1
- package/build-module/transformationCategories.native.js.map +1 -1
- package/build-module/utils/clean-empty-object.js +5 -2
- package/build-module/utils/clean-empty-object.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-module/video/tracks-editor.js +9 -11
- package/build-module/video/tracks-editor.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/comment-template/style-rtl.css +12 -0
- package/build-style/comment-template/style.css +12 -0
- 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 +1 -2
- package/build-style/cover/style.css +1 -2
- package/build-style/editor-rtl.css +15 -40
- package/build-style/editor.css +15 -40
- package/build-style/elements-rtl.css +82 -0
- package/build-style/elements.css +82 -0
- 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/query/editor-rtl.css +1 -1
- package/build-style/query/editor.css +1 -1
- package/build-style/search/style-rtl.css +9 -11
- package/build-style/search/style.css +9 -11
- package/build-style/search/theme-rtl.css +5 -0
- package/build-style/search/theme.css +5 -0
- package/build-style/site-logo/editor-rtl.css +0 -12
- package/build-style/site-logo/editor.css +0 -12
- package/build-style/style-rtl.css +69 -70
- package/build-style/style.css +69 -70
- package/build-style/table/style-rtl.css +0 -1
- package/build-style/table/style.css +0 -1
- package/build-style/theme-rtl.css +5 -0
- package/build-style/theme.css +5 -0
- 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 +10 -46
- package/src/button/edit.js +6 -12
- package/src/button/edit.native.js +2 -3
- package/src/button/save.js +4 -12
- 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/column/deprecated.js +2 -1
- package/src/column/edit.js +2 -3
- package/src/column/edit.native.js +2 -2
- 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/comment-template/block.json +1 -1
- package/src/comment-template/style.scss +14 -0
- package/src/comments/block.json +1 -1
- package/src/comments/deprecated.js +53 -0
- package/src/comments/edit.js +24 -4
- package/src/comments/index.js +2 -0
- package/src/comments-pagination/block.json +1 -1
- package/src/comments-title/block.json +1 -1
- 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 +10 -15
- package/src/cover/edit/block-controls.js +15 -40
- package/src/cover/edit/cover-placeholder.js +2 -0
- package/src/cover/edit/index.js +74 -55
- 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 +2 -3
- package/src/cover/test/edit.native.js +4 -7
- package/src/cover/transforms.js +2 -7
- package/src/elements.scss +6 -0
- 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 +6 -6
- package/src/file/edit.native.js +14 -25
- package/src/file/index.js +1 -2
- package/src/file/save.js +2 -2
- package/src/file/style.scss +16 -15
- package/src/freeform/editor.scss +0 -2
- package/src/gallery/edit.js +16 -27
- package/src/gallery/gallery.js +9 -2
- package/src/gallery/gallery.native.js +2 -4
- package/src/gallery/index.js +2 -4
- package/src/gallery/index.php +5 -1
- 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 +28 -13
- package/src/gallery/use-get-media.js +11 -28
- 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/group/edit.js +1 -3
- package/src/heading/autogenerate-anchors.js +8 -5
- package/src/heading/deprecated.js +6 -21
- package/src/heading/edit.js +2 -3
- package/src/heading/heading-level-dropdown.js +1 -0
- package/src/heading/index.js +8 -2
- 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.native.js +15 -26
- package/src/image/image.js +33 -38
- package/src/image/save.js +10 -2
- package/src/image/style.scss +0 -2
- 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 +7 -12
- 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/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/more/edit.js +9 -11
- 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 +11 -2
- 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 +6 -1
- package/src/navigation-link/edit.js +24 -20
- package/src/navigation-link/hooks.js +0 -14
- package/src/navigation-link/index.js +1 -1
- package/src/navigation-link/test/__snapshots__/hooks.js.snap +0 -93
- package/src/navigation-link/test/edit.js +2 -4
- package/src/navigation-link/test/hooks.js +0 -12
- package/src/navigation-submenu/edit.js +10 -20
- package/src/navigation-submenu/view.js +6 -1
- package/src/nextpage/edit.js +1 -3
- package/src/page-list/convert-to-links-modal.js +51 -54
- package/src/page-list/edit.js +9 -11
- 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-comments/index.php +1 -1
- package/src/post-comments/style.scss +7 -3
- package/src/post-comments-form/edit.js +24 -10
- package/src/post-comments-form/editor.scss +4 -0
- package/src/post-comments-form/form.js +2 -2
- package/src/post-comments-form/index.php +1 -1
- package/src/post-content/edit.js +2 -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 +23 -17
- package/src/post-template/style.scss +1 -7
- package/src/post-terms/index.js +1 -1
- package/src/post-title/block.json +1 -0
- package/src/pullquote/deprecated.js +2 -1
- package/src/query/edit/index.js +10 -10
- package/src/query/edit/inspector-controls/index.js +1 -1
- package/src/query/edit/inspector-controls/parent-control.js +2 -3
- package/src/query/edit/query-toolbar.js +25 -5
- package/src/query/editor.scss +1 -1
- package/src/query/index.js +1 -1
- package/src/query-no-results/index.php +10 -8
- package/src/quote/v2/edit.js +4 -6
- package/src/quote/v2/test/migrate.js +1 -2
- package/src/search/edit.js +8 -14
- package/src/search/edit.native.js +4 -6
- package/src/search/index.php +12 -10
- package/src/search/style.scss +11 -9
- package/src/search/theme.scss +5 -0
- package/src/separator/use-deprecated-opacity.js +2 -4
- package/src/shortcode/edit.native.js +4 -3
- package/src/shortcode/test/edit.native.js +2 -5
- package/src/site-logo/edit.js +5 -28
- package/src/site-logo/editor.scss +0 -14
- package/src/site-title/edit/level-toolbar.js +1 -0
- package/src/social-link/index.php +16 -0
- package/src/social-links/deprecated.js +4 -2
- 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/style.scss +1 -0
- 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 +6 -10
- 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/template-part/index.js +1 -1
- package/src/template-part/variations.js +0 -11
- package/src/transformationCategories.native.js +3 -3
- package/src/utils/clean-empty-object.js +8 -2
- 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
- package/src/video/tracks-editor.js +1 -1
- package/build/gallery/use-short-code-transform.js +0 -64
- package/build/gallery/use-short-code-transform.js.map +0 -1
- package/build/navigation-link/fallback-variations.js +0 -75
- package/build/navigation-link/fallback-variations.js.map +0 -1
- package/build/template-part/fallback-variations.js +0 -59
- package/build/template-part/fallback-variations.js.map +0 -1
- package/build-module/gallery/use-short-code-transform.js +0 -54
- package/build-module/gallery/use-short-code-transform.js.map +0 -1
- package/build-module/navigation-link/fallback-variations.js +0 -65
- package/build-module/navigation-link/fallback-variations.js.map +0 -1
- package/build-module/template-part/fallback-variations.js +0 -47
- package/build-module/template-part/fallback-variations.js.map +0 -1
- package/src/gallery/use-short-code-transform.js +0 -55
- package/src/navigation-link/fallback-variations.js +0 -65
- package/src/template-part/fallback-variations.js +0 -51
package/src/video/edit.native.js
CHANGED
|
@@ -36,11 +36,13 @@ import { __, sprintf } from '@wordpress/i18n';
|
|
|
36
36
|
import { isURL, getProtocol } from '@wordpress/url';
|
|
37
37
|
import { doAction, hasAction } from '@wordpress/hooks';
|
|
38
38
|
import { video as SvgIcon, replace } from '@wordpress/icons';
|
|
39
|
-
import { withSelect } from '@wordpress/data';
|
|
39
|
+
import { withDispatch, withSelect } from '@wordpress/data';
|
|
40
|
+
import { store as noticesStore } from '@wordpress/notices';
|
|
40
41
|
|
|
41
42
|
/**
|
|
42
43
|
* Internal dependencies
|
|
43
44
|
*/
|
|
45
|
+
import { createUpgradedEmbedBlock } from '../embed/util';
|
|
44
46
|
import style from './style.scss';
|
|
45
47
|
import SvgIconRetry from './icon-retry';
|
|
46
48
|
import VideoCommonSettings from './edit-common-settings';
|
|
@@ -61,15 +63,13 @@ class VideoEdit extends Component {
|
|
|
61
63
|
};
|
|
62
64
|
|
|
63
65
|
this.mediaUploadStateReset = this.mediaUploadStateReset.bind( this );
|
|
64
|
-
this.onSelectMediaUploadOption =
|
|
65
|
-
this
|
|
66
|
-
);
|
|
67
|
-
this.finishMediaUploadWithSuccess =
|
|
68
|
-
this
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
this
|
|
72
|
-
);
|
|
66
|
+
this.onSelectMediaUploadOption =
|
|
67
|
+
this.onSelectMediaUploadOption.bind( this );
|
|
68
|
+
this.onSelectURL = this.onSelectURL.bind( this );
|
|
69
|
+
this.finishMediaUploadWithSuccess =
|
|
70
|
+
this.finishMediaUploadWithSuccess.bind( this );
|
|
71
|
+
this.finishMediaUploadWithFailure =
|
|
72
|
+
this.finishMediaUploadWithFailure.bind( this );
|
|
73
73
|
this.updateMediaProgress = this.updateMediaProgress.bind( this );
|
|
74
74
|
this.onVideoPressed = this.onVideoPressed.bind( this );
|
|
75
75
|
this.onVideoContanerLayout = this.onVideoContanerLayout.bind( this );
|
|
@@ -160,6 +160,25 @@ class VideoEdit extends Component {
|
|
|
160
160
|
setAttributes( { id, src: url } );
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
+
onSelectURL( url ) {
|
|
164
|
+
const { createErrorNotice, onReplace, setAttributes } = this.props;
|
|
165
|
+
|
|
166
|
+
if ( isURL( url ) ) {
|
|
167
|
+
// Check if there's an embed block that handles this URL.
|
|
168
|
+
const embedBlock = createUpgradedEmbedBlock( {
|
|
169
|
+
attributes: { url },
|
|
170
|
+
} );
|
|
171
|
+
if ( undefined !== embedBlock ) {
|
|
172
|
+
onReplace( embedBlock );
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
setAttributes( { id: url, src: url } );
|
|
177
|
+
} else {
|
|
178
|
+
createErrorNotice( __( 'Invalid URL.' ) );
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
163
182
|
onVideoContanerLayout( event ) {
|
|
164
183
|
const { width } = event.nativeEvent.layout;
|
|
165
184
|
const height = width / VIDEO_ASPECT_RATIO;
|
|
@@ -191,12 +210,8 @@ class VideoEdit extends Component {
|
|
|
191
210
|
}
|
|
192
211
|
|
|
193
212
|
render() {
|
|
194
|
-
const {
|
|
195
|
-
|
|
196
|
-
attributes,
|
|
197
|
-
isSelected,
|
|
198
|
-
wasBlockJustInserted,
|
|
199
|
-
} = this.props;
|
|
213
|
+
const { setAttributes, attributes, isSelected, wasBlockJustInserted } =
|
|
214
|
+
this.props;
|
|
200
215
|
const { id, src } = attributes;
|
|
201
216
|
const { videoContainerHeight } = this.state;
|
|
202
217
|
|
|
@@ -205,6 +220,7 @@ class VideoEdit extends Component {
|
|
|
205
220
|
allowedTypes={ [ MEDIA_TYPE_VIDEO ] }
|
|
206
221
|
isReplacingMedia={ true }
|
|
207
222
|
onSelect={ this.onSelectMediaUploadOption }
|
|
223
|
+
onSelectURL={ this.onSelectURL }
|
|
208
224
|
render={ ( { open, getMediaOptions } ) => {
|
|
209
225
|
return (
|
|
210
226
|
<ToolbarGroup>
|
|
@@ -226,6 +242,7 @@ class VideoEdit extends Component {
|
|
|
226
242
|
<MediaPlaceholder
|
|
227
243
|
allowedTypes={ [ MEDIA_TYPE_VIDEO ] }
|
|
228
244
|
onSelect={ this.onSelectMediaUploadOption }
|
|
245
|
+
onSelectURL={ this.onSelectURL }
|
|
229
246
|
icon={ this.getIcon( ICON_TYPE.PLACEHOLDER ) }
|
|
230
247
|
onFocus={ this.props.onFocus }
|
|
231
248
|
autoOpenMediaUpload={
|
|
@@ -378,5 +395,10 @@ export default compose( [
|
|
|
378
395
|
'inserter_menu'
|
|
379
396
|
),
|
|
380
397
|
} ) ),
|
|
398
|
+
withDispatch( ( dispatch ) => {
|
|
399
|
+
const { createErrorNotice } = dispatch( noticesStore );
|
|
400
|
+
|
|
401
|
+
return { createErrorNotice };
|
|
402
|
+
} ),
|
|
381
403
|
withPreferredColorScheme,
|
|
382
404
|
] )( VideoEdit );
|
package/src/video/index.js
CHANGED
|
@@ -20,8 +20,7 @@ export const settings = {
|
|
|
20
20
|
icon,
|
|
21
21
|
example: {
|
|
22
22
|
attributes: {
|
|
23
|
-
src:
|
|
24
|
-
'https://upload.wikimedia.org/wikipedia/commons/c/ca/Wood_thrush_in_Central_Park_switch_sides_%2816510%29.webm',
|
|
23
|
+
src: 'https://upload.wikimedia.org/wikipedia/commons/c/ca/Wood_thrush_in_Central_Park_switch_sides_%2816510%29.webm',
|
|
25
24
|
// translators: Caption accompanying a video of the wood thrush singing, which serves as an example for the Video block.
|
|
26
25
|
caption: __( 'Wood thrush singing in Central Park, NYC.' ),
|
|
27
26
|
},
|
package/src/video/save.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
RichText,
|
|
6
|
+
useBlockProps,
|
|
7
|
+
__experimentalGetElementClassName,
|
|
8
|
+
} from '@wordpress/block-editor';
|
|
5
9
|
|
|
6
10
|
/**
|
|
7
11
|
* Internal dependencies
|
|
@@ -38,7 +42,11 @@ export default function save( { attributes } ) {
|
|
|
38
42
|
</video>
|
|
39
43
|
) }
|
|
40
44
|
{ ! RichText.isEmpty( caption ) && (
|
|
41
|
-
<RichText.Content
|
|
45
|
+
<RichText.Content
|
|
46
|
+
className={ __experimentalGetElementClassName( 'caption' ) }
|
|
47
|
+
tagName="figcaption"
|
|
48
|
+
value={ caption }
|
|
49
|
+
/>
|
|
42
50
|
) }
|
|
43
51
|
</figure>
|
|
44
52
|
);
|
package/src/video/style.scss
CHANGED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = useShortCodeTransform;
|
|
7
|
-
|
|
8
|
-
var _lodash = require("lodash");
|
|
9
|
-
|
|
10
|
-
var _data = require("@wordpress/data");
|
|
11
|
-
|
|
12
|
-
var _coreData = require("@wordpress/core-data");
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* External dependencies
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* WordPress dependencies
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Shortcode transforms don't currently have a tranform method and so can't use a selector to
|
|
24
|
-
* retrieve the data for each image being transformer, so this selector handle this post transformation.
|
|
25
|
-
*
|
|
26
|
-
* @param {Array} shortCodeTransforms An array of image data passed from the shortcode transform.
|
|
27
|
-
*
|
|
28
|
-
* @return {Array} An array of extended image data objects for each of the shortcode transform images.
|
|
29
|
-
*/
|
|
30
|
-
function useShortCodeTransform(shortCodeTransforms) {
|
|
31
|
-
const newImageData = (0, _data.useSelect)(select => {
|
|
32
|
-
if (!shortCodeTransforms || shortCodeTransforms.length === 0) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const imageIds = shortCodeTransforms.map(image => image.id);
|
|
37
|
-
return select(_coreData.store).getMediaItems({
|
|
38
|
-
include: imageIds.join(','),
|
|
39
|
-
per_page: imageIds.length,
|
|
40
|
-
orderby: 'include'
|
|
41
|
-
});
|
|
42
|
-
}, [shortCodeTransforms]);
|
|
43
|
-
|
|
44
|
-
if (!newImageData) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if ((0, _lodash.every)(newImageData, img => img && img.source_url)) {
|
|
49
|
-
return newImageData.map(imageData => {
|
|
50
|
-
var _imageData$caption;
|
|
51
|
-
|
|
52
|
-
return {
|
|
53
|
-
id: imageData.id,
|
|
54
|
-
type: 'image',
|
|
55
|
-
url: imageData.source_url,
|
|
56
|
-
mime: imageData.mime_type,
|
|
57
|
-
alt: imageData.alt_text,
|
|
58
|
-
link: imageData.link,
|
|
59
|
-
caption: imageData === null || imageData === void 0 ? void 0 : (_imageData$caption = imageData.caption) === null || _imageData$caption === void 0 ? void 0 : _imageData$caption.raw
|
|
60
|
-
};
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
//# sourceMappingURL=use-short-code-transform.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/gallery/use-short-code-transform.js"],"names":["useShortCodeTransform","shortCodeTransforms","newImageData","select","length","imageIds","map","image","id","coreStore","getMediaItems","include","join","per_page","orderby","img","source_url","imageData","type","url","mime","mime_type","alt","alt_text","link","caption","raw"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,qBAAT,CAAgCC,mBAAhC,EAAsD;AACpE,QAAMC,YAAY,GAAG,qBAClBC,MAAF,IAAc;AACb,QAAK,CAAEF,mBAAF,IAAyBA,mBAAmB,CAACG,MAApB,KAA+B,CAA7D,EAAiE;AAChE;AACA;;AAED,UAAMC,QAAQ,GAAGJ,mBAAmB,CAACK,GAApB,CAA2BC,KAAF,IAAaA,KAAK,CAACC,EAA5C,CAAjB;AAEA,WAAOL,MAAM,CAAEM,eAAF,CAAN,CAAoBC,aAApB,CAAmC;AACzCC,MAAAA,OAAO,EAAEN,QAAQ,CAACO,IAAT,CAAe,GAAf,CADgC;AAEzCC,MAAAA,QAAQ,EAAER,QAAQ,CAACD,MAFsB;AAGzCU,MAAAA,OAAO,EAAE;AAHgC,KAAnC,CAAP;AAKA,GAbmB,EAcpB,CAAEb,mBAAF,CAdoB,CAArB;;AAiBA,MAAK,CAAEC,YAAP,EAAsB;AACrB;AACA;;AAED,MAAK,mBAAOA,YAAP,EAAuBa,GAAF,IAAWA,GAAG,IAAIA,GAAG,CAACC,UAA3C,CAAL,EAA+D;AAC9D,WAAOd,YAAY,CAACI,GAAb,CAAoBW,SAAF,IAAiB;AAAA;;AACzC,aAAO;AACNT,QAAAA,EAAE,EAAES,SAAS,CAACT,EADR;AAENU,QAAAA,IAAI,EAAE,OAFA;AAGNC,QAAAA,GAAG,EAAEF,SAAS,CAACD,UAHT;AAINI,QAAAA,IAAI,EAAEH,SAAS,CAACI,SAJV;AAKNC,QAAAA,GAAG,EAAEL,SAAS,CAACM,QALT;AAMNC,QAAAA,IAAI,EAAEP,SAAS,CAACO,IANV;AAONC,QAAAA,OAAO,EAAER,SAAF,aAAEA,SAAF,6CAAEA,SAAS,CAAEQ,OAAb,uDAAE,mBAAoBC;AAPvB,OAAP;AASA,KAVM,CAAP;AAWA;AACD","sourcesContent":["/**\n * External dependencies\n */\nimport { every } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Shortcode transforms don't currently have a tranform method and so can't use a selector to\n * retrieve the data for each image being transformer, so this selector handle this post transformation.\n *\n * @param {Array} shortCodeTransforms An array of image data passed from the shortcode transform.\n *\n * @return {Array} An array of extended image data objects for each of the shortcode transform images.\n */\nexport default function useShortCodeTransform( shortCodeTransforms ) {\n\tconst newImageData = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! shortCodeTransforms || shortCodeTransforms.length === 0 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst imageIds = shortCodeTransforms.map( ( image ) => image.id );\n\n\t\t\treturn select( coreStore ).getMediaItems( {\n\t\t\t\tinclude: imageIds.join( ',' ),\n\t\t\t\tper_page: imageIds.length,\n\t\t\t\torderby: 'include',\n\t\t\t} );\n\t\t},\n\t\t[ shortCodeTransforms ]\n\t);\n\n\tif ( ! newImageData ) {\n\t\treturn;\n\t}\n\n\tif ( every( newImageData, ( img ) => img && img.source_url ) ) {\n\t\treturn newImageData.map( ( imageData ) => {\n\t\t\treturn {\n\t\t\t\tid: imageData.id,\n\t\t\t\ttype: 'image',\n\t\t\t\turl: imageData.source_url,\n\t\t\t\tmime: imageData.mime_type,\n\t\t\t\talt: imageData.alt_text,\n\t\t\t\tlink: imageData.link,\n\t\t\t\tcaption: imageData?.caption?.raw,\n\t\t\t};\n\t\t} );\n\t}\n}\n"]}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _i18n = require("@wordpress/i18n");
|
|
9
|
-
|
|
10
|
-
var _icons = require("@wordpress/icons");
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* WordPress dependencies
|
|
14
|
-
*/
|
|
15
|
-
// FALLBACK: this is only used when the server does not understand the variations property in the
|
|
16
|
-
// register_block_type call. see navigation-link/index.php.
|
|
17
|
-
// Delete this file when supported WP ranges understand the `variations` property when passed to
|
|
18
|
-
// register_block_type in index.php.
|
|
19
|
-
const fallbackVariations = [{
|
|
20
|
-
name: 'link',
|
|
21
|
-
isDefault: true,
|
|
22
|
-
title: (0, _i18n.__)('Custom Link'),
|
|
23
|
-
description: (0, _i18n.__)('A link to a custom URL.'),
|
|
24
|
-
attributes: {}
|
|
25
|
-
}, {
|
|
26
|
-
name: 'post',
|
|
27
|
-
icon: _icons.postContent,
|
|
28
|
-
title: (0, _i18n.__)('Post Link'),
|
|
29
|
-
description: (0, _i18n.__)('A link to a post.'),
|
|
30
|
-
attributes: {
|
|
31
|
-
type: 'post',
|
|
32
|
-
kind: 'post-type'
|
|
33
|
-
}
|
|
34
|
-
}, {
|
|
35
|
-
name: 'page',
|
|
36
|
-
icon: _icons.page,
|
|
37
|
-
title: (0, _i18n.__)('Page Link'),
|
|
38
|
-
description: (0, _i18n.__)('A link to a page.'),
|
|
39
|
-
attributes: {
|
|
40
|
-
type: 'page',
|
|
41
|
-
kind: 'post-type'
|
|
42
|
-
}
|
|
43
|
-
}, {
|
|
44
|
-
name: 'category',
|
|
45
|
-
icon: _icons.category,
|
|
46
|
-
title: (0, _i18n.__)('Category Link'),
|
|
47
|
-
description: (0, _i18n.__)('A link to a category.'),
|
|
48
|
-
attributes: {
|
|
49
|
-
type: 'category',
|
|
50
|
-
kind: 'taxonomy'
|
|
51
|
-
}
|
|
52
|
-
}, {
|
|
53
|
-
name: 'tag',
|
|
54
|
-
icon: _icons.tag,
|
|
55
|
-
title: (0, _i18n.__)('Tag Link'),
|
|
56
|
-
description: (0, _i18n.__)('A link to a tag.'),
|
|
57
|
-
attributes: {
|
|
58
|
-
type: 'tag',
|
|
59
|
-
kind: 'taxonomy'
|
|
60
|
-
}
|
|
61
|
-
}];
|
|
62
|
-
/**
|
|
63
|
-
* Add `isActive` function to all `navigation link` variations, if not defined.
|
|
64
|
-
* `isActive` function is used to find a variation match from a created
|
|
65
|
-
* Block by providing its attributes.
|
|
66
|
-
*/
|
|
67
|
-
|
|
68
|
-
fallbackVariations.forEach(variation => {
|
|
69
|
-
if (variation.isActive) return;
|
|
70
|
-
|
|
71
|
-
variation.isActive = (blockAttributes, variationAttributes) => blockAttributes.type === variationAttributes.type;
|
|
72
|
-
});
|
|
73
|
-
var _default = fallbackVariations;
|
|
74
|
-
exports.default = _default;
|
|
75
|
-
//# sourceMappingURL=fallback-variations.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/navigation-link/fallback-variations.js"],"names":["fallbackVariations","name","isDefault","title","description","attributes","icon","postIcon","type","kind","pageIcon","categoryIcon","tagIcon","forEach","variation","isActive","blockAttributes","variationAttributes"],"mappings":";;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AASA;AACA;AACA;AACA;AACA,MAAMA,kBAAkB,GAAG,CAC1B;AACCC,EAAAA,IAAI,EAAE,MADP;AAECC,EAAAA,SAAS,EAAE,IAFZ;AAGCC,EAAAA,KAAK,EAAE,cAAI,aAAJ,CAHR;AAICC,EAAAA,WAAW,EAAE,cAAI,yBAAJ,CAJd;AAKCC,EAAAA,UAAU,EAAE;AALb,CAD0B,EAQ1B;AACCJ,EAAAA,IAAI,EAAE,MADP;AAECK,EAAAA,IAAI,EAAEC,kBAFP;AAGCJ,EAAAA,KAAK,EAAE,cAAI,WAAJ,CAHR;AAICC,EAAAA,WAAW,EAAE,cAAI,mBAAJ,CAJd;AAKCC,EAAAA,UAAU,EAAE;AAAEG,IAAAA,IAAI,EAAE,MAAR;AAAgBC,IAAAA,IAAI,EAAE;AAAtB;AALb,CAR0B,EAe1B;AACCR,EAAAA,IAAI,EAAE,MADP;AAECK,EAAAA,IAAI,EAAEI,WAFP;AAGCP,EAAAA,KAAK,EAAE,cAAI,WAAJ,CAHR;AAICC,EAAAA,WAAW,EAAE,cAAI,mBAAJ,CAJd;AAKCC,EAAAA,UAAU,EAAE;AAAEG,IAAAA,IAAI,EAAE,MAAR;AAAgBC,IAAAA,IAAI,EAAE;AAAtB;AALb,CAf0B,EAsB1B;AACCR,EAAAA,IAAI,EAAE,UADP;AAECK,EAAAA,IAAI,EAAEK,eAFP;AAGCR,EAAAA,KAAK,EAAE,cAAI,eAAJ,CAHR;AAICC,EAAAA,WAAW,EAAE,cAAI,uBAAJ,CAJd;AAKCC,EAAAA,UAAU,EAAE;AAAEG,IAAAA,IAAI,EAAE,UAAR;AAAoBC,IAAAA,IAAI,EAAE;AAA1B;AALb,CAtB0B,EA6B1B;AACCR,EAAAA,IAAI,EAAE,KADP;AAECK,EAAAA,IAAI,EAAEM,UAFP;AAGCT,EAAAA,KAAK,EAAE,cAAI,UAAJ,CAHR;AAICC,EAAAA,WAAW,EAAE,cAAI,kBAAJ,CAJd;AAKCC,EAAAA,UAAU,EAAE;AAAEG,IAAAA,IAAI,EAAE,KAAR;AAAeC,IAAAA,IAAI,EAAE;AAArB;AALb,CA7B0B,CAA3B;AAsCA;AACA;AACA;AACA;AACA;;AACAT,kBAAkB,CAACa,OAAnB,CAA8BC,SAAF,IAAiB;AAC5C,MAAKA,SAAS,CAACC,QAAf,EAA0B;;AAC1BD,EAAAA,SAAS,CAACC,QAAV,GAAqB,CAAEC,eAAF,EAAmBC,mBAAnB,KACpBD,eAAe,CAACR,IAAhB,KAAyBS,mBAAmB,CAACT,IAD9C;AAEA,CAJD;eAMeR,kB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tcategory as categoryIcon,\n\tpage as pageIcon,\n\tpostContent as postIcon,\n\ttag as tagIcon,\n} from '@wordpress/icons';\n\n// FALLBACK: this is only used when the server does not understand the variations property in the\n// register_block_type call. see navigation-link/index.php.\n// Delete this file when supported WP ranges understand the `variations` property when passed to\n// register_block_type in index.php.\nconst fallbackVariations = [\n\t{\n\t\tname: 'link',\n\t\tisDefault: true,\n\t\ttitle: __( 'Custom Link' ),\n\t\tdescription: __( 'A link to a custom URL.' ),\n\t\tattributes: {},\n\t},\n\t{\n\t\tname: 'post',\n\t\ticon: postIcon,\n\t\ttitle: __( 'Post Link' ),\n\t\tdescription: __( 'A link to a post.' ),\n\t\tattributes: { type: 'post', kind: 'post-type' },\n\t},\n\t{\n\t\tname: 'page',\n\t\ticon: pageIcon,\n\t\ttitle: __( 'Page Link' ),\n\t\tdescription: __( 'A link to a page.' ),\n\t\tattributes: { type: 'page', kind: 'post-type' },\n\t},\n\t{\n\t\tname: 'category',\n\t\ticon: categoryIcon,\n\t\ttitle: __( 'Category Link' ),\n\t\tdescription: __( 'A link to a category.' ),\n\t\tattributes: { type: 'category', kind: 'taxonomy' },\n\t},\n\t{\n\t\tname: 'tag',\n\t\ticon: tagIcon,\n\t\ttitle: __( 'Tag Link' ),\n\t\tdescription: __( 'A link to a tag.' ),\n\t\tattributes: { type: 'tag', kind: 'taxonomy' },\n\t},\n];\n\n/**\n * Add `isActive` function to all `navigation link` variations, if not defined.\n * `isActive` function is used to find a variation match from a created\n * Block by providing its attributes.\n */\nfallbackVariations.forEach( ( variation ) => {\n\tif ( variation.isActive ) return;\n\tvariation.isActive = ( blockAttributes, variationAttributes ) =>\n\t\tblockAttributes.type === variationAttributes.type;\n} );\n\nexport default fallbackVariations;\n"]}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _i18n = require("@wordpress/i18n");
|
|
9
|
-
|
|
10
|
-
var _icons = require("@wordpress/icons");
|
|
11
|
-
|
|
12
|
-
var _coreData = require("@wordpress/core-data");
|
|
13
|
-
|
|
14
|
-
var _data = require("@wordpress/data");
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* WordPress dependencies
|
|
18
|
-
*/
|
|
19
|
-
const fallbackVariations = [{
|
|
20
|
-
name: 'header',
|
|
21
|
-
icon: _icons.header,
|
|
22
|
-
title: (0, _i18n.__)('Header'),
|
|
23
|
-
description: (0, _i18n.__)('The Header template defines a page area that typically contains a title, logo, and main navigation.'),
|
|
24
|
-
attributes: {
|
|
25
|
-
area: 'header'
|
|
26
|
-
},
|
|
27
|
-
scope: ['inserter']
|
|
28
|
-
}, {
|
|
29
|
-
name: 'footer',
|
|
30
|
-
icon: _icons.footer,
|
|
31
|
-
title: (0, _i18n.__)('Footer'),
|
|
32
|
-
description: (0, _i18n.__)('The Footer template defines a page area that typically contains site credits, social links, or any other combination of blocks.'),
|
|
33
|
-
attributes: {
|
|
34
|
-
area: 'footer'
|
|
35
|
-
},
|
|
36
|
-
scope: ['inserter']
|
|
37
|
-
}];
|
|
38
|
-
fallbackVariations.forEach(variation => {
|
|
39
|
-
if (variation.isActive) return;
|
|
40
|
-
|
|
41
|
-
variation.isActive = (blockAttributes, variationAttributes) => {
|
|
42
|
-
const {
|
|
43
|
-
area,
|
|
44
|
-
theme,
|
|
45
|
-
slug
|
|
46
|
-
} = blockAttributes; // We first check the `area` block attribute which is set during insertion.
|
|
47
|
-
// This property is removed on the creation of a template part.
|
|
48
|
-
|
|
49
|
-
if (area) return area === variationAttributes.area; // Find a matching variation from the created template part
|
|
50
|
-
// by checking the entity's `area` property.
|
|
51
|
-
|
|
52
|
-
if (!slug) return false;
|
|
53
|
-
const entity = (0, _data.select)(_coreData.store).getEntityRecord('postType', 'wp_template_part', `${theme}//${slug}`);
|
|
54
|
-
return (entity === null || entity === void 0 ? void 0 : entity.area) === variationAttributes.area;
|
|
55
|
-
};
|
|
56
|
-
});
|
|
57
|
-
var _default = fallbackVariations;
|
|
58
|
-
exports.default = _default;
|
|
59
|
-
//# sourceMappingURL=fallback-variations.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/template-part/fallback-variations.js"],"names":["fallbackVariations","name","icon","headerIcon","title","description","attributes","area","scope","footerIcon","forEach","variation","isActive","blockAttributes","variationAttributes","theme","slug","entity","coreDataStore","getEntityRecord"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AANA;AACA;AACA;AAMA,MAAMA,kBAAkB,GAAG,CAC1B;AACCC,EAAAA,IAAI,EAAE,QADP;AAECC,EAAAA,IAAI,EAAEC,aAFP;AAGCC,EAAAA,KAAK,EAAE,cAAI,QAAJ,CAHR;AAICC,EAAAA,WAAW,EAAE,cACZ,qGADY,CAJd;AAOCC,EAAAA,UAAU,EAAE;AAAEC,IAAAA,IAAI,EAAE;AAAR,GAPb;AAQCC,EAAAA,KAAK,EAAE,CAAE,UAAF;AARR,CAD0B,EAW1B;AACCP,EAAAA,IAAI,EAAE,QADP;AAECC,EAAAA,IAAI,EAAEO,aAFP;AAGCL,EAAAA,KAAK,EAAE,cAAI,QAAJ,CAHR;AAICC,EAAAA,WAAW,EAAE,cACZ,iIADY,CAJd;AAOCC,EAAAA,UAAU,EAAE;AAAEC,IAAAA,IAAI,EAAE;AAAR,GAPb;AAQCC,EAAAA,KAAK,EAAE,CAAE,UAAF;AARR,CAX0B,CAA3B;AAuBAR,kBAAkB,CAACU,OAAnB,CAA8BC,SAAF,IAAiB;AAC5C,MAAKA,SAAS,CAACC,QAAf,EAA0B;;AAC1BD,EAAAA,SAAS,CAACC,QAAV,GAAqB,CAAEC,eAAF,EAAmBC,mBAAnB,KAA4C;AAChE,UAAM;AAAEP,MAAAA,IAAF;AAAQQ,MAAAA,KAAR;AAAeC,MAAAA;AAAf,QAAwBH,eAA9B,CADgE,CAEhE;AACA;;AACA,QAAKN,IAAL,EAAY,OAAOA,IAAI,KAAKO,mBAAmB,CAACP,IAApC,CAJoD,CAKhE;AACA;;AACA,QAAK,CAAES,IAAP,EAAc,OAAO,KAAP;AACd,UAAMC,MAAM,GAAG,kBAAQC,eAAR,EAAwBC,eAAxB,CACd,UADc,EAEd,kBAFc,EAGb,GAAGJ,KAAO,KAAKC,IAAM,EAHR,CAAf;AAKA,WAAO,CAAAC,MAAM,SAAN,IAAAA,MAAM,WAAN,YAAAA,MAAM,CAAEV,IAAR,MAAiBO,mBAAmB,CAACP,IAA5C;AACA,GAdD;AAeA,CAjBD;eAmBeP,kB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { header as headerIcon, footer as footerIcon } from '@wordpress/icons';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { select } from '@wordpress/data';\n\nconst fallbackVariations = [\n\t{\n\t\tname: 'header',\n\t\ticon: headerIcon,\n\t\ttitle: __( 'Header' ),\n\t\tdescription: __(\n\t\t\t'The Header template defines a page area that typically contains a title, logo, and main navigation.'\n\t\t),\n\t\tattributes: { area: 'header' },\n\t\tscope: [ 'inserter' ],\n\t},\n\t{\n\t\tname: 'footer',\n\t\ticon: footerIcon,\n\t\ttitle: __( 'Footer' ),\n\t\tdescription: __(\n\t\t\t'The Footer template defines a page area that typically contains site credits, social links, or any other combination of blocks.'\n\t\t),\n\t\tattributes: { area: 'footer' },\n\t\tscope: [ 'inserter' ],\n\t},\n];\n\nfallbackVariations.forEach( ( variation ) => {\n\tif ( variation.isActive ) return;\n\tvariation.isActive = ( blockAttributes, variationAttributes ) => {\n\t\tconst { area, theme, slug } = blockAttributes;\n\t\t// We first check the `area` block attribute which is set during insertion.\n\t\t// This property is removed on the creation of a template part.\n\t\tif ( area ) return area === variationAttributes.area;\n\t\t// Find a matching variation from the created template part\n\t\t// by checking the entity's `area` property.\n\t\tif ( ! slug ) return false;\n\t\tconst entity = select( coreDataStore ).getEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\t`${ theme }//${ slug }`\n\t\t);\n\t\treturn entity?.area === variationAttributes.area;\n\t};\n} );\n\nexport default fallbackVariations;\n"]}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { every } from 'lodash';
|
|
5
|
-
/**
|
|
6
|
-
* WordPress dependencies
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { useSelect } from '@wordpress/data';
|
|
10
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
11
|
-
/**
|
|
12
|
-
* Shortcode transforms don't currently have a tranform method and so can't use a selector to
|
|
13
|
-
* retrieve the data for each image being transformer, so this selector handle this post transformation.
|
|
14
|
-
*
|
|
15
|
-
* @param {Array} shortCodeTransforms An array of image data passed from the shortcode transform.
|
|
16
|
-
*
|
|
17
|
-
* @return {Array} An array of extended image data objects for each of the shortcode transform images.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
export default function useShortCodeTransform(shortCodeTransforms) {
|
|
21
|
-
const newImageData = useSelect(select => {
|
|
22
|
-
if (!shortCodeTransforms || shortCodeTransforms.length === 0) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const imageIds = shortCodeTransforms.map(image => image.id);
|
|
27
|
-
return select(coreStore).getMediaItems({
|
|
28
|
-
include: imageIds.join(','),
|
|
29
|
-
per_page: imageIds.length,
|
|
30
|
-
orderby: 'include'
|
|
31
|
-
});
|
|
32
|
-
}, [shortCodeTransforms]);
|
|
33
|
-
|
|
34
|
-
if (!newImageData) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (every(newImageData, img => img && img.source_url)) {
|
|
39
|
-
return newImageData.map(imageData => {
|
|
40
|
-
var _imageData$caption;
|
|
41
|
-
|
|
42
|
-
return {
|
|
43
|
-
id: imageData.id,
|
|
44
|
-
type: 'image',
|
|
45
|
-
url: imageData.source_url,
|
|
46
|
-
mime: imageData.mime_type,
|
|
47
|
-
alt: imageData.alt_text,
|
|
48
|
-
link: imageData.link,
|
|
49
|
-
caption: imageData === null || imageData === void 0 ? void 0 : (_imageData$caption = imageData.caption) === null || _imageData$caption === void 0 ? void 0 : _imageData$caption.raw
|
|
50
|
-
};
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=use-short-code-transform.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/gallery/use-short-code-transform.js"],"names":["every","useSelect","store","coreStore","useShortCodeTransform","shortCodeTransforms","newImageData","select","length","imageIds","map","image","id","getMediaItems","include","join","per_page","orderby","img","source_url","imageData","type","url","mime","mime_type","alt","alt_text","link","caption","raw"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAT,QAAsB,QAAtB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,qBAAT,CAAgCC,mBAAhC,EAAsD;AACpE,QAAMC,YAAY,GAAGL,SAAS,CAC3BM,MAAF,IAAc;AACb,QAAK,CAAEF,mBAAF,IAAyBA,mBAAmB,CAACG,MAApB,KAA+B,CAA7D,EAAiE;AAChE;AACA;;AAED,UAAMC,QAAQ,GAAGJ,mBAAmB,CAACK,GAApB,CAA2BC,KAAF,IAAaA,KAAK,CAACC,EAA5C,CAAjB;AAEA,WAAOL,MAAM,CAAEJ,SAAF,CAAN,CAAoBU,aAApB,CAAmC;AACzCC,MAAAA,OAAO,EAAEL,QAAQ,CAACM,IAAT,CAAe,GAAf,CADgC;AAEzCC,MAAAA,QAAQ,EAAEP,QAAQ,CAACD,MAFsB;AAGzCS,MAAAA,OAAO,EAAE;AAHgC,KAAnC,CAAP;AAKA,GAb4B,EAc7B,CAAEZ,mBAAF,CAd6B,CAA9B;;AAiBA,MAAK,CAAEC,YAAP,EAAsB;AACrB;AACA;;AAED,MAAKN,KAAK,CAAEM,YAAF,EAAkBY,GAAF,IAAWA,GAAG,IAAIA,GAAG,CAACC,UAAtC,CAAV,EAA+D;AAC9D,WAAOb,YAAY,CAACI,GAAb,CAAoBU,SAAF,IAAiB;AAAA;;AACzC,aAAO;AACNR,QAAAA,EAAE,EAAEQ,SAAS,CAACR,EADR;AAENS,QAAAA,IAAI,EAAE,OAFA;AAGNC,QAAAA,GAAG,EAAEF,SAAS,CAACD,UAHT;AAINI,QAAAA,IAAI,EAAEH,SAAS,CAACI,SAJV;AAKNC,QAAAA,GAAG,EAAEL,SAAS,CAACM,QALT;AAMNC,QAAAA,IAAI,EAAEP,SAAS,CAACO,IANV;AAONC,QAAAA,OAAO,EAAER,SAAF,aAAEA,SAAF,6CAAEA,SAAS,CAAEQ,OAAb,uDAAE,mBAAoBC;AAPvB,OAAP;AASA,KAVM,CAAP;AAWA;AACD","sourcesContent":["/**\n * External dependencies\n */\nimport { every } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Shortcode transforms don't currently have a tranform method and so can't use a selector to\n * retrieve the data for each image being transformer, so this selector handle this post transformation.\n *\n * @param {Array} shortCodeTransforms An array of image data passed from the shortcode transform.\n *\n * @return {Array} An array of extended image data objects for each of the shortcode transform images.\n */\nexport default function useShortCodeTransform( shortCodeTransforms ) {\n\tconst newImageData = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! shortCodeTransforms || shortCodeTransforms.length === 0 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst imageIds = shortCodeTransforms.map( ( image ) => image.id );\n\n\t\t\treturn select( coreStore ).getMediaItems( {\n\t\t\t\tinclude: imageIds.join( ',' ),\n\t\t\t\tper_page: imageIds.length,\n\t\t\t\torderby: 'include',\n\t\t\t} );\n\t\t},\n\t\t[ shortCodeTransforms ]\n\t);\n\n\tif ( ! newImageData ) {\n\t\treturn;\n\t}\n\n\tif ( every( newImageData, ( img ) => img && img.source_url ) ) {\n\t\treturn newImageData.map( ( imageData ) => {\n\t\t\treturn {\n\t\t\t\tid: imageData.id,\n\t\t\t\ttype: 'image',\n\t\t\t\turl: imageData.source_url,\n\t\t\t\tmime: imageData.mime_type,\n\t\t\t\talt: imageData.alt_text,\n\t\t\t\tlink: imageData.link,\n\t\t\t\tcaption: imageData?.caption?.raw,\n\t\t\t};\n\t\t} );\n\t}\n}\n"]}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { category as categoryIcon, page as pageIcon, postContent as postIcon, tag as tagIcon } from '@wordpress/icons'; // FALLBACK: this is only used when the server does not understand the variations property in the
|
|
6
|
-
// register_block_type call. see navigation-link/index.php.
|
|
7
|
-
// Delete this file when supported WP ranges understand the `variations` property when passed to
|
|
8
|
-
// register_block_type in index.php.
|
|
9
|
-
|
|
10
|
-
const fallbackVariations = [{
|
|
11
|
-
name: 'link',
|
|
12
|
-
isDefault: true,
|
|
13
|
-
title: __('Custom Link'),
|
|
14
|
-
description: __('A link to a custom URL.'),
|
|
15
|
-
attributes: {}
|
|
16
|
-
}, {
|
|
17
|
-
name: 'post',
|
|
18
|
-
icon: postIcon,
|
|
19
|
-
title: __('Post Link'),
|
|
20
|
-
description: __('A link to a post.'),
|
|
21
|
-
attributes: {
|
|
22
|
-
type: 'post',
|
|
23
|
-
kind: 'post-type'
|
|
24
|
-
}
|
|
25
|
-
}, {
|
|
26
|
-
name: 'page',
|
|
27
|
-
icon: pageIcon,
|
|
28
|
-
title: __('Page Link'),
|
|
29
|
-
description: __('A link to a page.'),
|
|
30
|
-
attributes: {
|
|
31
|
-
type: 'page',
|
|
32
|
-
kind: 'post-type'
|
|
33
|
-
}
|
|
34
|
-
}, {
|
|
35
|
-
name: 'category',
|
|
36
|
-
icon: categoryIcon,
|
|
37
|
-
title: __('Category Link'),
|
|
38
|
-
description: __('A link to a category.'),
|
|
39
|
-
attributes: {
|
|
40
|
-
type: 'category',
|
|
41
|
-
kind: 'taxonomy'
|
|
42
|
-
}
|
|
43
|
-
}, {
|
|
44
|
-
name: 'tag',
|
|
45
|
-
icon: tagIcon,
|
|
46
|
-
title: __('Tag Link'),
|
|
47
|
-
description: __('A link to a tag.'),
|
|
48
|
-
attributes: {
|
|
49
|
-
type: 'tag',
|
|
50
|
-
kind: 'taxonomy'
|
|
51
|
-
}
|
|
52
|
-
}];
|
|
53
|
-
/**
|
|
54
|
-
* Add `isActive` function to all `navigation link` variations, if not defined.
|
|
55
|
-
* `isActive` function is used to find a variation match from a created
|
|
56
|
-
* Block by providing its attributes.
|
|
57
|
-
*/
|
|
58
|
-
|
|
59
|
-
fallbackVariations.forEach(variation => {
|
|
60
|
-
if (variation.isActive) return;
|
|
61
|
-
|
|
62
|
-
variation.isActive = (blockAttributes, variationAttributes) => blockAttributes.type === variationAttributes.type;
|
|
63
|
-
});
|
|
64
|
-
export default fallbackVariations;
|
|
65
|
-
//# sourceMappingURL=fallback-variations.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/navigation-link/fallback-variations.js"],"names":["__","category","categoryIcon","page","pageIcon","postContent","postIcon","tag","tagIcon","fallbackVariations","name","isDefault","title","description","attributes","icon","type","kind","forEach","variation","isActive","blockAttributes","variationAttributes"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SACCC,QAAQ,IAAIC,YADb,EAECC,IAAI,IAAIC,QAFT,EAGCC,WAAW,IAAIC,QAHhB,EAICC,GAAG,IAAIC,OAJR,QAKO,kBALP,C,CAOA;AACA;AACA;AACA;;AACA,MAAMC,kBAAkB,GAAG,CAC1B;AACCC,EAAAA,IAAI,EAAE,MADP;AAECC,EAAAA,SAAS,EAAE,IAFZ;AAGCC,EAAAA,KAAK,EAAEZ,EAAE,CAAE,aAAF,CAHV;AAICa,EAAAA,WAAW,EAAEb,EAAE,CAAE,yBAAF,CAJhB;AAKCc,EAAAA,UAAU,EAAE;AALb,CAD0B,EAQ1B;AACCJ,EAAAA,IAAI,EAAE,MADP;AAECK,EAAAA,IAAI,EAAET,QAFP;AAGCM,EAAAA,KAAK,EAAEZ,EAAE,CAAE,WAAF,CAHV;AAICa,EAAAA,WAAW,EAAEb,EAAE,CAAE,mBAAF,CAJhB;AAKCc,EAAAA,UAAU,EAAE;AAAEE,IAAAA,IAAI,EAAE,MAAR;AAAgBC,IAAAA,IAAI,EAAE;AAAtB;AALb,CAR0B,EAe1B;AACCP,EAAAA,IAAI,EAAE,MADP;AAECK,EAAAA,IAAI,EAAEX,QAFP;AAGCQ,EAAAA,KAAK,EAAEZ,EAAE,CAAE,WAAF,CAHV;AAICa,EAAAA,WAAW,EAAEb,EAAE,CAAE,mBAAF,CAJhB;AAKCc,EAAAA,UAAU,EAAE;AAAEE,IAAAA,IAAI,EAAE,MAAR;AAAgBC,IAAAA,IAAI,EAAE;AAAtB;AALb,CAf0B,EAsB1B;AACCP,EAAAA,IAAI,EAAE,UADP;AAECK,EAAAA,IAAI,EAAEb,YAFP;AAGCU,EAAAA,KAAK,EAAEZ,EAAE,CAAE,eAAF,CAHV;AAICa,EAAAA,WAAW,EAAEb,EAAE,CAAE,uBAAF,CAJhB;AAKCc,EAAAA,UAAU,EAAE;AAAEE,IAAAA,IAAI,EAAE,UAAR;AAAoBC,IAAAA,IAAI,EAAE;AAA1B;AALb,CAtB0B,EA6B1B;AACCP,EAAAA,IAAI,EAAE,KADP;AAECK,EAAAA,IAAI,EAAEP,OAFP;AAGCI,EAAAA,KAAK,EAAEZ,EAAE,CAAE,UAAF,CAHV;AAICa,EAAAA,WAAW,EAAEb,EAAE,CAAE,kBAAF,CAJhB;AAKCc,EAAAA,UAAU,EAAE;AAAEE,IAAAA,IAAI,EAAE,KAAR;AAAeC,IAAAA,IAAI,EAAE;AAArB;AALb,CA7B0B,CAA3B;AAsCA;AACA;AACA;AACA;AACA;;AACAR,kBAAkB,CAACS,OAAnB,CAA8BC,SAAF,IAAiB;AAC5C,MAAKA,SAAS,CAACC,QAAf,EAA0B;;AAC1BD,EAAAA,SAAS,CAACC,QAAV,GAAqB,CAAEC,eAAF,EAAmBC,mBAAnB,KACpBD,eAAe,CAACL,IAAhB,KAAyBM,mBAAmB,CAACN,IAD9C;AAEA,CAJD;AAMA,eAAeP,kBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tcategory as categoryIcon,\n\tpage as pageIcon,\n\tpostContent as postIcon,\n\ttag as tagIcon,\n} from '@wordpress/icons';\n\n// FALLBACK: this is only used when the server does not understand the variations property in the\n// register_block_type call. see navigation-link/index.php.\n// Delete this file when supported WP ranges understand the `variations` property when passed to\n// register_block_type in index.php.\nconst fallbackVariations = [\n\t{\n\t\tname: 'link',\n\t\tisDefault: true,\n\t\ttitle: __( 'Custom Link' ),\n\t\tdescription: __( 'A link to a custom URL.' ),\n\t\tattributes: {},\n\t},\n\t{\n\t\tname: 'post',\n\t\ticon: postIcon,\n\t\ttitle: __( 'Post Link' ),\n\t\tdescription: __( 'A link to a post.' ),\n\t\tattributes: { type: 'post', kind: 'post-type' },\n\t},\n\t{\n\t\tname: 'page',\n\t\ticon: pageIcon,\n\t\ttitle: __( 'Page Link' ),\n\t\tdescription: __( 'A link to a page.' ),\n\t\tattributes: { type: 'page', kind: 'post-type' },\n\t},\n\t{\n\t\tname: 'category',\n\t\ticon: categoryIcon,\n\t\ttitle: __( 'Category Link' ),\n\t\tdescription: __( 'A link to a category.' ),\n\t\tattributes: { type: 'category', kind: 'taxonomy' },\n\t},\n\t{\n\t\tname: 'tag',\n\t\ticon: tagIcon,\n\t\ttitle: __( 'Tag Link' ),\n\t\tdescription: __( 'A link to a tag.' ),\n\t\tattributes: { type: 'tag', kind: 'taxonomy' },\n\t},\n];\n\n/**\n * Add `isActive` function to all `navigation link` variations, if not defined.\n * `isActive` function is used to find a variation match from a created\n * Block by providing its attributes.\n */\nfallbackVariations.forEach( ( variation ) => {\n\tif ( variation.isActive ) return;\n\tvariation.isActive = ( blockAttributes, variationAttributes ) =>\n\t\tblockAttributes.type === variationAttributes.type;\n} );\n\nexport default fallbackVariations;\n"]}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { header as headerIcon, footer as footerIcon } from '@wordpress/icons';
|
|
6
|
-
import { store as coreDataStore } from '@wordpress/core-data';
|
|
7
|
-
import { select } from '@wordpress/data';
|
|
8
|
-
const fallbackVariations = [{
|
|
9
|
-
name: 'header',
|
|
10
|
-
icon: headerIcon,
|
|
11
|
-
title: __('Header'),
|
|
12
|
-
description: __('The Header template defines a page area that typically contains a title, logo, and main navigation.'),
|
|
13
|
-
attributes: {
|
|
14
|
-
area: 'header'
|
|
15
|
-
},
|
|
16
|
-
scope: ['inserter']
|
|
17
|
-
}, {
|
|
18
|
-
name: 'footer',
|
|
19
|
-
icon: footerIcon,
|
|
20
|
-
title: __('Footer'),
|
|
21
|
-
description: __('The Footer template defines a page area that typically contains site credits, social links, or any other combination of blocks.'),
|
|
22
|
-
attributes: {
|
|
23
|
-
area: 'footer'
|
|
24
|
-
},
|
|
25
|
-
scope: ['inserter']
|
|
26
|
-
}];
|
|
27
|
-
fallbackVariations.forEach(variation => {
|
|
28
|
-
if (variation.isActive) return;
|
|
29
|
-
|
|
30
|
-
variation.isActive = (blockAttributes, variationAttributes) => {
|
|
31
|
-
const {
|
|
32
|
-
area,
|
|
33
|
-
theme,
|
|
34
|
-
slug
|
|
35
|
-
} = blockAttributes; // We first check the `area` block attribute which is set during insertion.
|
|
36
|
-
// This property is removed on the creation of a template part.
|
|
37
|
-
|
|
38
|
-
if (area) return area === variationAttributes.area; // Find a matching variation from the created template part
|
|
39
|
-
// by checking the entity's `area` property.
|
|
40
|
-
|
|
41
|
-
if (!slug) return false;
|
|
42
|
-
const entity = select(coreDataStore).getEntityRecord('postType', 'wp_template_part', `${theme}//${slug}`);
|
|
43
|
-
return (entity === null || entity === void 0 ? void 0 : entity.area) === variationAttributes.area;
|
|
44
|
-
};
|
|
45
|
-
});
|
|
46
|
-
export default fallbackVariations;
|
|
47
|
-
//# sourceMappingURL=fallback-variations.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/template-part/fallback-variations.js"],"names":["__","header","headerIcon","footer","footerIcon","store","coreDataStore","select","fallbackVariations","name","icon","title","description","attributes","area","scope","forEach","variation","isActive","blockAttributes","variationAttributes","theme","slug","entity","getEntityRecord"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAM,IAAIC,UAAnB,EAA+BC,MAAM,IAAIC,UAAzC,QAA2D,kBAA3D;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,sBAAvC;AACA,SAASC,MAAT,QAAuB,iBAAvB;AAEA,MAAMC,kBAAkB,GAAG,CAC1B;AACCC,EAAAA,IAAI,EAAE,QADP;AAECC,EAAAA,IAAI,EAAER,UAFP;AAGCS,EAAAA,KAAK,EAAEX,EAAE,CAAE,QAAF,CAHV;AAICY,EAAAA,WAAW,EAAEZ,EAAE,CACd,qGADc,CAJhB;AAOCa,EAAAA,UAAU,EAAE;AAAEC,IAAAA,IAAI,EAAE;AAAR,GAPb;AAQCC,EAAAA,KAAK,EAAE,CAAE,UAAF;AARR,CAD0B,EAW1B;AACCN,EAAAA,IAAI,EAAE,QADP;AAECC,EAAAA,IAAI,EAAEN,UAFP;AAGCO,EAAAA,KAAK,EAAEX,EAAE,CAAE,QAAF,CAHV;AAICY,EAAAA,WAAW,EAAEZ,EAAE,CACd,iIADc,CAJhB;AAOCa,EAAAA,UAAU,EAAE;AAAEC,IAAAA,IAAI,EAAE;AAAR,GAPb;AAQCC,EAAAA,KAAK,EAAE,CAAE,UAAF;AARR,CAX0B,CAA3B;AAuBAP,kBAAkB,CAACQ,OAAnB,CAA8BC,SAAF,IAAiB;AAC5C,MAAKA,SAAS,CAACC,QAAf,EAA0B;;AAC1BD,EAAAA,SAAS,CAACC,QAAV,GAAqB,CAAEC,eAAF,EAAmBC,mBAAnB,KAA4C;AAChE,UAAM;AAAEN,MAAAA,IAAF;AAAQO,MAAAA,KAAR;AAAeC,MAAAA;AAAf,QAAwBH,eAA9B,CADgE,CAEhE;AACA;;AACA,QAAKL,IAAL,EAAY,OAAOA,IAAI,KAAKM,mBAAmB,CAACN,IAApC,CAJoD,CAKhE;AACA;;AACA,QAAK,CAAEQ,IAAP,EAAc,OAAO,KAAP;AACd,UAAMC,MAAM,GAAGhB,MAAM,CAAED,aAAF,CAAN,CAAwBkB,eAAxB,CACd,UADc,EAEd,kBAFc,EAGb,GAAGH,KAAO,KAAKC,IAAM,EAHR,CAAf;AAKA,WAAO,CAAAC,MAAM,SAAN,IAAAA,MAAM,WAAN,YAAAA,MAAM,CAAET,IAAR,MAAiBM,mBAAmB,CAACN,IAA5C;AACA,GAdD;AAeA,CAjBD;AAmBA,eAAeN,kBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { header as headerIcon, footer as footerIcon } from '@wordpress/icons';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { select } from '@wordpress/data';\n\nconst fallbackVariations = [\n\t{\n\t\tname: 'header',\n\t\ticon: headerIcon,\n\t\ttitle: __( 'Header' ),\n\t\tdescription: __(\n\t\t\t'The Header template defines a page area that typically contains a title, logo, and main navigation.'\n\t\t),\n\t\tattributes: { area: 'header' },\n\t\tscope: [ 'inserter' ],\n\t},\n\t{\n\t\tname: 'footer',\n\t\ticon: footerIcon,\n\t\ttitle: __( 'Footer' ),\n\t\tdescription: __(\n\t\t\t'The Footer template defines a page area that typically contains site credits, social links, or any other combination of blocks.'\n\t\t),\n\t\tattributes: { area: 'footer' },\n\t\tscope: [ 'inserter' ],\n\t},\n];\n\nfallbackVariations.forEach( ( variation ) => {\n\tif ( variation.isActive ) return;\n\tvariation.isActive = ( blockAttributes, variationAttributes ) => {\n\t\tconst { area, theme, slug } = blockAttributes;\n\t\t// We first check the `area` block attribute which is set during insertion.\n\t\t// This property is removed on the creation of a template part.\n\t\tif ( area ) return area === variationAttributes.area;\n\t\t// Find a matching variation from the created template part\n\t\t// by checking the entity's `area` property.\n\t\tif ( ! slug ) return false;\n\t\tconst entity = select( coreDataStore ).getEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\t`${ theme }//${ slug }`\n\t\t);\n\t\treturn entity?.area === variationAttributes.area;\n\t};\n} );\n\nexport default fallbackVariations;\n"]}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { every } from 'lodash';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { useSelect } from '@wordpress/data';
|
|
10
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Shortcode transforms don't currently have a tranform method and so can't use a selector to
|
|
14
|
-
* retrieve the data for each image being transformer, so this selector handle this post transformation.
|
|
15
|
-
*
|
|
16
|
-
* @param {Array} shortCodeTransforms An array of image data passed from the shortcode transform.
|
|
17
|
-
*
|
|
18
|
-
* @return {Array} An array of extended image data objects for each of the shortcode transform images.
|
|
19
|
-
*/
|
|
20
|
-
export default function useShortCodeTransform( shortCodeTransforms ) {
|
|
21
|
-
const newImageData = useSelect(
|
|
22
|
-
( select ) => {
|
|
23
|
-
if ( ! shortCodeTransforms || shortCodeTransforms.length === 0 ) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const imageIds = shortCodeTransforms.map( ( image ) => image.id );
|
|
28
|
-
|
|
29
|
-
return select( coreStore ).getMediaItems( {
|
|
30
|
-
include: imageIds.join( ',' ),
|
|
31
|
-
per_page: imageIds.length,
|
|
32
|
-
orderby: 'include',
|
|
33
|
-
} );
|
|
34
|
-
},
|
|
35
|
-
[ shortCodeTransforms ]
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
if ( ! newImageData ) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if ( every( newImageData, ( img ) => img && img.source_url ) ) {
|
|
43
|
-
return newImageData.map( ( imageData ) => {
|
|
44
|
-
return {
|
|
45
|
-
id: imageData.id,
|
|
46
|
-
type: 'image',
|
|
47
|
-
url: imageData.source_url,
|
|
48
|
-
mime: imageData.mime_type,
|
|
49
|
-
alt: imageData.alt_text,
|
|
50
|
-
link: imageData.link,
|
|
51
|
-
caption: imageData?.caption?.raw,
|
|
52
|
-
};
|
|
53
|
-
} );
|
|
54
|
-
}
|
|
55
|
-
}
|