@wordpress/block-library 8.9.0 → 8.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build/block/edit.native.js +17 -10
- package/build/block/edit.native.js.map +1 -1
- package/build/code/index.js +1 -0
- package/build/code/index.js.map +1 -1
- package/build/column/index.js +1 -1
- package/build/columns/transforms.js +1 -5
- package/build/columns/transforms.js.map +1 -1
- package/build/comment-author-name/edit.js +1 -1
- package/build/comment-author-name/edit.js.map +1 -1
- package/build/comment-edit-link/edit.js +1 -1
- package/build/comment-edit-link/edit.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +1 -1
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/cover/edit/resizable-cover-popover.js +3 -3
- package/build/cover/edit/resizable-cover-popover.js.map +1 -1
- package/build/cover/index.js +1 -1
- package/build/cover/variations.js +1 -1
- package/build/cover/variations.js.map +1 -1
- package/build/details/edit.js +19 -5
- package/build/details/edit.js.map +1 -1
- package/build/details/index.js +14 -10
- package/build/details/index.js.map +1 -1
- package/build/details/save.js +4 -1
- package/build/details/save.js.map +1 -1
- package/build/embed/variations.js +2 -2
- package/build/embed/variations.js.map +1 -1
- package/build/file/interactivity.js +19 -0
- package/build/file/interactivity.js.map +1 -0
- package/build/file/{utils.js → utils/index.js} +1 -1
- package/build/file/utils/index.js.map +1 -0
- package/build/file/view.js +1 -1
- package/build/file/view.js.map +1 -1
- package/build/freeform/modal.js +20 -17
- package/build/freeform/modal.js.map +1 -1
- package/build/gallery/edit.js +2 -8
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/v1/edit.js +1 -7
- package/build/gallery/v1/edit.js.map +1 -1
- package/build/gallery/v1/gallery-image.native.js +1 -3
- package/build/gallery/v1/gallery-image.native.js.map +1 -1
- package/build/group/transforms.js +0 -5
- package/build/group/transforms.js.map +1 -1
- package/build/image/deprecated.js +2 -4
- package/build/image/deprecated.js.map +1 -1
- package/build/image/edit.js +13 -11
- package/build/image/edit.js.map +1 -1
- package/build/image/image.js +7 -12
- package/build/image/image.js.map +1 -1
- package/build/image/index.js +3 -0
- package/build/image/index.js.map +1 -1
- package/build/image/interactivity.js +102 -0
- package/build/image/interactivity.js.map +1 -0
- package/build/image/save.js +2 -4
- package/build/image/save.js.map +1 -1
- package/build/image/utils.js +10 -18
- package/build/image/utils.js.map +1 -1
- package/build/index.js +0 -6
- package/build/index.js.map +1 -1
- package/build/index.native.js +1 -1
- package/build/index.native.js.map +1 -1
- package/build/latest-posts/edit.native.js +1 -3
- package/build/latest-posts/edit.native.js.map +1 -1
- package/build/list/edit.js +1 -1
- package/build/list/edit.js.map +1 -1
- package/build/list-item/edit.native.js +1 -1
- package/build/list-item/edit.native.js.map +1 -1
- package/build/list-item/transforms.js +4 -1
- package/build/list-item/transforms.js.map +1 -1
- package/build/list-item/utils.js +5 -1
- package/build/list-item/utils.js.map +1 -1
- package/build/loginout/index.js +11 -1
- package/build/loginout/index.js.map +1 -1
- package/build/media-text/deprecated.js +4 -6
- package/build/media-text/deprecated.js.map +1 -1
- package/build/media-text/edit.js +13 -11
- package/build/media-text/edit.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/save.js +1 -3
- package/build/media-text/save.js.map +1 -1
- package/build/navigation/constants.js +15 -0
- package/build/navigation/constants.js.map +1 -0
- package/build/navigation/edit/index.js +16 -26
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/inner-blocks.js +5 -7
- package/build/navigation/edit/inner-blocks.js.map +1 -1
- package/build/navigation/edit/leaf-more-menu.js +148 -0
- package/build/navigation/edit/leaf-more-menu.js.map +1 -0
- package/build/navigation/edit/menu-inspector-controls.js +53 -8
- package/build/navigation/edit/menu-inspector-controls.js.map +1 -1
- package/build/navigation/edit/navigation-menu-delete-control.js +6 -6
- package/build/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build/navigation/edit/unsaved-inner-blocks.js +12 -25
- package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js +1 -1
- package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
- package/build/navigation/interactivity.js +157 -0
- package/build/navigation/interactivity.js.map +1 -0
- package/build/navigation-link/edit.js +7 -5
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-link/update-attributes.js +5 -5
- package/build/navigation-link/update-attributes.js.map +1 -1
- package/build/navigation-submenu/edit.js +7 -5
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/paragraph/index.js +5 -1
- package/build/paragraph/index.js.map +1 -1
- package/build/paragraph/transforms.js +5 -1
- package/build/paragraph/transforms.js.map +1 -1
- package/build/pattern/edit.js +42 -8
- package/build/pattern/edit.js.map +1 -1
- package/build/pattern/index.js +12 -5
- package/build/pattern/index.js.map +1 -1
- package/build/pattern/v1/edit.js +57 -0
- package/build/pattern/v1/edit.js.map +1 -0
- package/build/post-author-name/edit.js +1 -1
- package/build/post-author-name/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +1 -2
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-featured-image/overlay.js +5 -0
- package/build/post-featured-image/overlay.js.map +1 -1
- package/build/post-title/edit.js +24 -7
- package/build/post-title/edit.js.map +1 -1
- package/build/preformatted/edit.native.js +3 -2
- package/build/preformatted/edit.native.js.map +1 -1
- package/build/quote/transforms.js +23 -37
- package/build/quote/transforms.js.map +1 -1
- package/build/read-more/edit.js +1 -1
- package/build/read-more/edit.js.map +1 -1
- package/build/search/edit.js +9 -1
- package/build/search/edit.js.map +1 -1
- package/build/site-title/edit/index.js +1 -1
- package/build/site-title/edit/index.js.map +1 -1
- package/build/social-link/edit.js +21 -4
- package/build/social-link/edit.js.map +1 -1
- package/build/social-links/edit.js +2 -2
- package/build/social-links/edit.js.map +1 -1
- package/build/template-part/edit/index.js +1 -7
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/edit/utils/hooks.js +2 -2
- package/build/template-part/edit/utils/hooks.js.map +1 -1
- package/build/utils/interactivity/constants.js +9 -0
- package/build/utils/interactivity/constants.js.map +1 -0
- package/build/utils/interactivity/directives.js +236 -0
- package/build/utils/interactivity/directives.js.map +1 -0
- package/build/utils/interactivity/hooks.js +176 -0
- package/build/utils/interactivity/hooks.js.map +1 -0
- package/build/utils/interactivity/hydration.js +34 -0
- package/build/utils/interactivity/hydration.js.map +1 -0
- package/build/utils/interactivity/index.js +34 -0
- package/build/utils/interactivity/index.js.map +1 -0
- package/build/utils/interactivity/portals.js +108 -0
- package/build/utils/interactivity/portals.js.map +1 -0
- package/build/utils/interactivity/store.js +67 -0
- package/build/utils/interactivity/store.js.map +1 -0
- package/build/utils/interactivity/utils.js +87 -0
- package/build/utils/interactivity/utils.js.map +1 -0
- package/build/utils/interactivity/vdom.js +109 -0
- package/build/utils/interactivity/vdom.js.map +1 -0
- package/build-module/block/edit.native.js +7 -1
- package/build-module/block/edit.native.js.map +1 -1
- package/build-module/code/index.js +1 -0
- package/build-module/code/index.js.map +1 -1
- package/build-module/column/index.js +1 -1
- package/build-module/columns/transforms.js +1 -5
- package/build-module/columns/transforms.js.map +1 -1
- package/build-module/comment-author-name/edit.js +1 -1
- package/build-module/comment-author-name/edit.js.map +1 -1
- package/build-module/comment-edit-link/edit.js +1 -1
- package/build-module/comment-edit-link/edit.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +1 -1
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/cover/edit/resizable-cover-popover.js +3 -3
- package/build-module/cover/edit/resizable-cover-popover.js.map +1 -1
- package/build-module/cover/index.js +1 -1
- package/build-module/cover/variations.js +1 -1
- package/build-module/cover/variations.js.map +1 -1
- package/build-module/details/edit.js +20 -6
- package/build-module/details/edit.js.map +1 -1
- package/build-module/details/index.js +14 -10
- package/build-module/details/index.js.map +1 -1
- package/build-module/details/save.js +5 -2
- package/build-module/details/save.js.map +1 -1
- package/build-module/embed/variations.js +2 -2
- package/build-module/embed/variations.js.map +1 -1
- package/build-module/file/interactivity.js +15 -0
- package/build-module/file/interactivity.js.map +1 -0
- package/build-module/file/{utils.js → utils/index.js} +1 -1
- package/build-module/file/utils/index.js.map +1 -0
- package/build-module/file/view.js +1 -1
- package/build-module/file/view.js.map +1 -1
- package/build-module/freeform/modal.js +19 -18
- package/build-module/freeform/modal.js.map +1 -1
- package/build-module/gallery/edit.js +2 -8
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/v1/edit.js +1 -6
- package/build-module/gallery/v1/edit.js.map +1 -1
- package/build-module/gallery/v1/gallery-image.native.js +1 -2
- package/build-module/gallery/v1/gallery-image.native.js.map +1 -1
- package/build-module/group/transforms.js +0 -5
- package/build-module/group/transforms.js.map +1 -1
- package/build-module/image/deprecated.js +2 -3
- package/build-module/image/deprecated.js.map +1 -1
- package/build-module/image/edit.js +12 -11
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/image.js +7 -11
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/index.js +3 -0
- package/build-module/image/index.js.map +1 -1
- package/build-module/image/interactivity.js +99 -0
- package/build-module/image/interactivity.js.map +1 -0
- package/build-module/image/save.js +2 -3
- package/build-module/image/save.js.map +1 -1
- package/build-module/image/utils.js +10 -17
- package/build-module/image/utils.js.map +1 -1
- package/build-module/index.js +0 -4
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +1 -1
- package/build-module/index.native.js.map +1 -1
- package/build-module/latest-posts/edit.native.js +1 -2
- package/build-module/latest-posts/edit.native.js.map +1 -1
- package/build-module/list/edit.js +1 -1
- package/build-module/list/edit.js.map +1 -1
- package/build-module/list-item/edit.native.js +1 -1
- package/build-module/list-item/edit.native.js.map +1 -1
- package/build-module/list-item/transforms.js +5 -2
- package/build-module/list-item/transforms.js.map +1 -1
- package/build-module/list-item/utils.js +5 -1
- package/build-module/list-item/utils.js.map +1 -1
- package/build-module/loginout/index.js +11 -1
- package/build-module/loginout/index.js.map +1 -1
- package/build-module/media-text/deprecated.js +4 -5
- package/build-module/media-text/deprecated.js.map +1 -1
- package/build-module/media-text/edit.js +13 -12
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/media-text/media-container.js +3 -3
- package/build-module/media-text/media-container.js.map +1 -1
- package/build-module/media-text/save.js +1 -2
- package/build-module/media-text/save.js.map +1 -1
- package/build-module/navigation/constants.js +6 -0
- package/build-module/navigation/constants.js.map +1 -0
- package/build-module/navigation/edit/index.js +18 -27
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/inner-blocks.js +2 -4
- package/build-module/navigation/edit/inner-blocks.js.map +1 -1
- package/build-module/navigation/edit/leaf-more-menu.js +132 -0
- package/build-module/navigation/edit/leaf-more-menu.js.map +1 -0
- package/build-module/navigation/edit/menu-inspector-controls.js +52 -9
- package/build-module/navigation/edit/menu-inspector-controls.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-delete-control.js +7 -7
- package/build-module/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build-module/navigation/edit/unsaved-inner-blocks.js +9 -20
- 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 +1 -1
- package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
- package/build-module/navigation/interactivity.js +154 -0
- package/build-module/navigation/interactivity.js.map +1 -0
- package/build-module/navigation-link/edit.js +7 -5
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-link/update-attributes.js +4 -4
- package/build-module/navigation-link/update-attributes.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +7 -5
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/paragraph/index.js +5 -1
- package/build-module/paragraph/index.js.map +1 -1
- package/build-module/paragraph/transforms.js +5 -1
- package/build-module/paragraph/transforms.js.map +1 -1
- package/build-module/pattern/edit.js +42 -9
- package/build-module/pattern/edit.js.map +1 -1
- package/build-module/pattern/index.js +12 -3
- package/build-module/pattern/index.js.map +1 -1
- package/build-module/pattern/v1/edit.js +48 -0
- package/build-module/pattern/v1/edit.js.map +1 -0
- package/build-module/post-author-name/edit.js +1 -1
- package/build-module/post-author-name/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +1 -2
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-featured-image/overlay.js +5 -0
- package/build-module/post-featured-image/overlay.js.map +1 -1
- package/build-module/post-title/edit.js +23 -7
- package/build-module/post-title/edit.js.map +1 -1
- package/build-module/preformatted/edit.native.js +3 -2
- package/build-module/preformatted/edit.native.js.map +1 -1
- package/build-module/quote/transforms.js +23 -37
- package/build-module/quote/transforms.js.map +1 -1
- package/build-module/read-more/edit.js +1 -1
- package/build-module/read-more/edit.js.map +1 -1
- package/build-module/search/edit.js +9 -1
- package/build-module/search/edit.js.map +1 -1
- package/build-module/site-title/edit/index.js +1 -1
- package/build-module/site-title/edit/index.js.map +1 -1
- package/build-module/social-link/edit.js +20 -5
- package/build-module/social-link/edit.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/template-part/edit/index.js +1 -6
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/edit/utils/hooks.js +1 -1
- package/build-module/template-part/edit/utils/hooks.js.map +1 -1
- package/build-module/utils/interactivity/constants.js +2 -0
- package/build-module/utils/interactivity/constants.js.map +1 -0
- package/build-module/utils/interactivity/directives.js +220 -0
- package/build-module/utils/interactivity/directives.js.map +1 -0
- package/build-module/utils/interactivity/hooks.js +162 -0
- package/build-module/utils/interactivity/hooks.js.map +1 -0
- package/build-module/utils/interactivity/hydration.js +21 -0
- package/build-module/utils/interactivity/hydration.js.map +1 -0
- package/build-module/utils/interactivity/index.js +17 -0
- package/build-module/utils/interactivity/index.js.map +1 -0
- package/build-module/utils/interactivity/portals.js +100 -0
- package/build-module/utils/interactivity/portals.js.map +1 -0
- package/build-module/utils/interactivity/store.js +56 -0
- package/build-module/utils/interactivity/store.js.map +1 -0
- package/build-module/utils/interactivity/utils.js +75 -0
- package/build-module/utils/interactivity/utils.js.map +1 -0
- package/build-module/utils/interactivity/vdom.js +97 -0
- package/build-module/utils/interactivity/vdom.js.map +1 -0
- package/build-style/common-rtl.css +1 -1
- package/build-style/common.css +1 -1
- package/build-style/cover/style-rtl.css +3 -2
- package/build-style/cover/style.css +3 -2
- package/build-style/{details-summary → details}/editor-rtl.css +1 -1
- package/build-style/{details-summary → details}/editor.css +1 -1
- package/build-style/details/style-rtl.css +14 -0
- package/build-style/details/style.css +14 -0
- package/build-style/editor-rtl.css +71 -5
- package/build-style/editor.css +71 -5
- package/build-style/file/editor-rtl.css +3 -0
- package/build-style/file/editor.css +3 -0
- package/build-style/freeform/editor-rtl.css +29 -0
- package/build-style/freeform/editor.css +29 -0
- package/build-style/gallery/editor-rtl.css +0 -4
- package/build-style/gallery/editor.css +0 -4
- package/build-style/gallery/style-rtl.css +2 -4
- package/build-style/gallery/style.css +2 -4
- package/build-style/image/style-rtl.css +98 -0
- package/build-style/image/style.css +98 -0
- package/build-style/navigation/editor-rtl.css +36 -0
- package/build-style/navigation/editor.css +36 -0
- package/build-style/post-comments-form/style-rtl.css +1 -1
- package/build-style/post-comments-form/style.css +1 -1
- package/build-style/search/editor-rtl.css +1 -0
- package/build-style/search/editor.css +1 -0
- package/build-style/site-logo/editor-rtl.css +1 -0
- package/build-style/site-logo/editor.css +1 -0
- package/build-style/style-rtl.css +116 -10
- package/build-style/style.css +116 -10
- package/build-style/video/style-rtl.css +1 -2
- package/build-style/video/style.css +1 -2
- package/package.json +37 -33
- package/src/block/edit.native.js +18 -4
- package/src/buttons/test/edit.native.js +0 -9
- package/src/code/block.json +1 -0
- package/src/column/block.json +1 -1
- package/src/columns/test/__snapshots__/transforms.native.js.snap +1 -1
- package/src/columns/test/transforms.native.js +3 -5
- package/src/columns/transforms.js +2 -8
- package/src/comment-author-name/edit.js +1 -1
- package/src/comment-edit-link/edit.js +1 -1
- package/src/comment-template/index.php +8 -7
- package/src/comments/index.php +1 -6
- package/src/cover/block.json +1 -1
- package/src/cover/edit/inspector-controls.js +56 -54
- package/src/cover/edit/resizable-cover-popover.js +2 -1
- package/src/cover/style.scss +5 -0
- package/src/cover/test/edit.js +56 -2
- package/src/cover/variations.js +1 -3
- package/src/details/block.json +8 -6
- package/src/details/edit.js +27 -5
- package/src/details/editor.scss +3 -0
- package/src/details/index.js +10 -5
- package/src/details/save.js +5 -1
- package/src/details/style.scss +16 -0
- package/src/editor.scss +1 -1
- package/src/embed/variations.js +2 -2
- package/src/file/editor.scss +4 -0
- package/src/file/interactivity.js +15 -0
- package/src/file/view.js +4 -1
- package/src/freeform/editor.scss +45 -0
- package/src/freeform/modal.js +22 -19
- package/src/gallery/edit.js +5 -8
- package/src/gallery/editor.scss +0 -6
- package/src/gallery/test/index.native.js +48 -3
- package/src/gallery/v1/edit.js +1 -6
- package/src/gallery/v1/gallery-image.native.js +1 -2
- package/src/group/test/__snapshots__/transforms.native.js.snap +1 -1
- package/src/group/test/transforms.native.js +3 -5
- package/src/group/transforms.js +0 -7
- package/src/image/block.json +3 -0
- package/src/image/deprecated.js +2 -3
- package/src/image/edit.js +18 -18
- package/src/image/image.js +8 -11
- package/src/image/index.php +75 -2
- package/src/image/interactivity.js +113 -0
- package/src/image/save.js +4 -3
- package/src/image/style.scss +113 -0
- package/src/image/test/edit.native.js +38 -16
- package/src/image/utils.js +11 -18
- package/src/index.js +0 -4
- package/src/index.native.js +1 -0
- package/src/latest-posts/edit.native.js +1 -4
- package/src/list/edit.js +1 -1
- package/src/list/test/edit.native.js +80 -1
- package/src/list-item/edit.native.js +1 -1
- package/src/list-item/transforms.js +4 -2
- package/src/loginout/block.json +11 -1
- package/src/media-text/deprecated.js +4 -5
- package/src/media-text/edit.js +12 -10
- package/src/media-text/media-container.js +3 -3
- package/src/media-text/save.js +1 -2
- package/src/navigation/constants.js +21 -0
- package/src/navigation/edit/index.js +71 -83
- package/src/navigation/edit/inner-blocks.js +6 -16
- package/src/navigation/edit/leaf-more-menu.js +170 -0
- package/src/navigation/edit/menu-inspector-controls.js +78 -10
- package/src/navigation/edit/navigation-menu-delete-control.js +29 -29
- package/src/navigation/edit/unsaved-inner-blocks.js +12 -40
- package/src/navigation/edit/use-convert-classic-menu-to-block-menu.js +1 -1
- package/src/navigation/editor.scss +10 -0
- package/src/navigation/index.php +213 -204
- package/src/navigation/interactivity.js +151 -0
- package/src/navigation-link/edit.js +9 -3
- package/src/navigation-link/update-attributes.js +2 -2
- package/src/navigation-submenu/edit.js +9 -3
- package/src/paragraph/block.json +5 -1
- package/src/pattern/block.json +4 -0
- package/src/pattern/edit.js +53 -16
- package/src/pattern/index.js +5 -4
- package/src/pattern/index.php +14 -1
- package/src/pattern/v1/edit.js +57 -0
- package/src/post-author-name/edit.js +1 -1
- package/src/post-comments-form/style.scss +3 -1
- package/src/post-featured-image/edit.js +1 -1
- package/src/post-featured-image/index.php +1 -1
- package/src/post-featured-image/overlay.js +4 -0
- package/src/post-terms/index.php +2 -2
- package/src/post-title/edit.js +57 -44
- package/src/preformatted/edit.native.js +1 -3
- package/src/quote/test/__snapshots__/transforms.native.js.snap +1 -1
- package/src/quote/test/transforms.native.js +3 -5
- package/src/quote/transforms.js +9 -19
- package/src/read-more/edit.js +1 -1
- package/src/search/edit.js +9 -4
- package/src/search/editor.scss +1 -0
- package/src/site-logo/editor.scss +2 -1
- package/src/site-title/edit/index.js +1 -1
- package/src/social-link/edit.js +51 -26
- package/src/social-links/edit.js +33 -31
- package/src/style.scss +0 -1
- package/src/template-part/edit/index.js +4 -6
- package/src/template-part/edit/utils/hooks.js +1 -1
- package/src/template-part/index.php +22 -7
- package/src/utils/interactivity/constants.js +1 -0
- package/src/utils/interactivity/directives.js +200 -0
- package/src/utils/interactivity/hooks.js +145 -0
- package/src/utils/interactivity/hydration.js +22 -0
- package/src/utils/interactivity/index.js +17 -0
- package/src/utils/interactivity/portals.js +98 -0
- package/src/utils/interactivity/store.js +45 -0
- package/src/utils/interactivity/utils.js +66 -0
- package/src/utils/interactivity/vdom.js +94 -0
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/details-content/edit.js +0 -34
- package/build/details-content/edit.js.map +0 -1
- package/build/details-content/index.js +0 -94
- package/build/details-content/index.js.map +0 -1
- package/build/details-content/save.js +0 -20
- package/build/details-content/save.js.map +0 -1
- package/build/details-summary/edit.js +0 -42
- package/build/details-summary/edit.js.map +0 -1
- package/build/details-summary/index.js +0 -97
- package/build/details-summary/index.js.map +0 -1
- package/build/details-summary/save.js +0 -24
- package/build/details-summary/save.js.map +0 -1
- package/build/file/utils.js.map +0 -1
- package/build-module/details-content/edit.js +0 -23
- package/build-module/details-content/edit.js.map +0 -1
- package/build-module/details-content/index.js +0 -76
- package/build-module/details-content/index.js.map +0 -1
- package/build-module/details-content/save.js +0 -11
- package/build-module/details-content/save.js.map +0 -1
- package/build-module/details-summary/edit.js +0 -30
- package/build-module/details-summary/edit.js.map +0 -1
- package/build-module/details-summary/index.js +0 -79
- package/build-module/details-summary/index.js.map +0 -1
- package/build-module/details-summary/save.js +0 -16
- package/build-module/details-summary/save.js.map +0 -1
- package/build-module/file/utils.js.map +0 -1
- package/build-style/details-summary/style-rtl.css +0 -91
- package/build-style/details-summary/style.css +0 -91
- package/src/details-content/block.json +0 -50
- package/src/details-content/edit.js +0 -29
- package/src/details-content/index.js +0 -23
- package/src/details-content/save.js +0 -12
- package/src/details-summary/block.json +0 -53
- package/src/details-summary/edit.js +0 -27
- package/src/details-summary/editor.scss +0 -3
- package/src/details-summary/index.js +0 -23
- package/src/details-summary/save.js +0 -13
- package/src/details-summary/style.scss +0 -3
- /package/src/file/{utils.js → utils/index.js} +0 -0
package/src/details/index.js
CHANGED
|
@@ -18,13 +18,18 @@ export { metadata, name };
|
|
|
18
18
|
export const settings = {
|
|
19
19
|
icon,
|
|
20
20
|
example: {
|
|
21
|
+
attributes: {
|
|
22
|
+
summary: 'La Mancha',
|
|
23
|
+
showContent: true,
|
|
24
|
+
},
|
|
21
25
|
innerBlocks: [
|
|
22
26
|
{
|
|
23
|
-
name: 'core/
|
|
24
|
-
attributes: {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
name: 'core/paragraph',
|
|
28
|
+
attributes: {
|
|
29
|
+
content: __(
|
|
30
|
+
'In a village of La Mancha, the name of which I have no desire to call to mind, there lived not long since one of those gentlemen that keep a lance in the lance-rack, an old buckler, a lean hack, and a greyhound for coursing.'
|
|
31
|
+
),
|
|
32
|
+
},
|
|
28
33
|
},
|
|
29
34
|
],
|
|
30
35
|
},
|
package/src/details/save.js
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { useBlockProps, InnerBlocks } from '@wordpress/block-editor';
|
|
4
|
+
import { RichText, useBlockProps, InnerBlocks } from '@wordpress/block-editor';
|
|
5
5
|
|
|
6
6
|
export default function save( { attributes } ) {
|
|
7
7
|
const { showContent } = attributes;
|
|
8
|
+
const summary = attributes.summary ? attributes.summary : 'Details';
|
|
8
9
|
const blockProps = useBlockProps.save();
|
|
9
10
|
|
|
10
11
|
return (
|
|
11
12
|
<details { ...blockProps } open={ showContent }>
|
|
13
|
+
<summary>
|
|
14
|
+
<RichText.Content value={ summary } />
|
|
15
|
+
</summary>
|
|
12
16
|
<InnerBlocks.Content />
|
|
13
17
|
</details>
|
|
14
18
|
);
|
package/src/details/style.scss
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
1
|
.wp-block-details {
|
|
2
|
+
box-sizing: border-box;
|
|
2
3
|
overflow: hidden;
|
|
3
4
|
}
|
|
5
|
+
|
|
6
|
+
.wp-block-details summary {
|
|
7
|
+
cursor: pointer;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// Use block gap for block; falls back to browser default if not supported.
|
|
11
|
+
.wp-block-details > *:not(summary) {
|
|
12
|
+
margin-block-start: var(--wp--style--block-gap);
|
|
13
|
+
margin-block-end: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Remove excess margin from the last block.
|
|
17
|
+
.wp-block-details > *:last-child {
|
|
18
|
+
margin-bottom: 0;
|
|
19
|
+
}
|
package/src/editor.scss
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
@import "./comments-pagination-numbers/editor.scss";
|
|
14
14
|
@import "./comments-title/editor.scss";
|
|
15
15
|
@import "./cover/editor.scss";
|
|
16
|
-
@import "./details
|
|
16
|
+
@import "./details/editor.scss";
|
|
17
17
|
@import "./embed/editor.scss";
|
|
18
18
|
@import "./file/editor.scss";
|
|
19
19
|
@import "./freeform/editor.scss";
|
package/src/embed/variations.js
CHANGED
|
@@ -218,13 +218,13 @@ const variations = [
|
|
|
218
218
|
attributes: { providerNameSlug: 'mixcloud', responsive: true },
|
|
219
219
|
},
|
|
220
220
|
{
|
|
221
|
-
name: '
|
|
221
|
+
name: 'pocket-casts',
|
|
222
222
|
title: 'Pocket Casts',
|
|
223
223
|
icon: embedPocketCastsIcon,
|
|
224
224
|
keywords: [ __( 'podcast' ), __( 'audio' ) ],
|
|
225
225
|
description: __( 'Embed a podcast player from Pocket Casts.' ),
|
|
226
226
|
patterns: [ /^https:\/\/pca.st\/\w+/i ],
|
|
227
|
-
attributes: { providerNameSlug: '
|
|
227
|
+
attributes: { providerNameSlug: 'pocket-casts', responsive: true },
|
|
228
228
|
},
|
|
229
229
|
{
|
|
230
230
|
name: 'reddit',
|
package/src/file/editor.scss
CHANGED
package/src/file/view.js
CHANGED
package/src/freeform/editor.scss
CHANGED
|
@@ -374,3 +374,48 @@ div[data-type="core/freeform"] {
|
|
|
374
374
|
display: block;
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
|
+
|
|
378
|
+
.block-editor-freeform-modal {
|
|
379
|
+
.components-modal__frame {
|
|
380
|
+
// On large screens, make the TinyMCE edit area grow to take all the
|
|
381
|
+
// available height so that the Cancel/Save buttons are always into the
|
|
382
|
+
// view. On smaller screens, the modal content is scrollable.
|
|
383
|
+
@include break-large() {
|
|
384
|
+
// On medium and large screens, the modal component sets a max-height.
|
|
385
|
+
// We want the modal to be as tall as possible also when the content is short.
|
|
386
|
+
height: 9999rem;
|
|
387
|
+
|
|
388
|
+
.components-modal__header + div {
|
|
389
|
+
height: 100%;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.mce-tinymce {
|
|
393
|
+
height: calc(100% - #{$button-size} - #{$grid-unit-20});
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
.mce-container-body {
|
|
397
|
+
height: 100%;
|
|
398
|
+
display: flex;
|
|
399
|
+
flex-direction: column;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
.mce-edit-area {
|
|
403
|
+
flex-grow: 1;
|
|
404
|
+
display: flex;
|
|
405
|
+
flex-direction: column;
|
|
406
|
+
|
|
407
|
+
iframe {
|
|
408
|
+
flex-grow: 1;
|
|
409
|
+
// Override the height TinyMCE sets via JavaScript so that it
|
|
410
|
+
// can shrink to a smaller height. The actual height is
|
|
411
|
+
// determined by Flexbox.
|
|
412
|
+
height: 10px !important;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
&__actions {
|
|
419
|
+
margin-top: $grid-unit-20;
|
|
420
|
+
}
|
|
421
|
+
}
|
package/src/freeform/modal.js
CHANGED
|
@@ -7,6 +7,8 @@ import {
|
|
|
7
7
|
ToolbarButton,
|
|
8
8
|
Modal,
|
|
9
9
|
Button,
|
|
10
|
+
Flex,
|
|
11
|
+
FlexItem,
|
|
10
12
|
} from '@wordpress/components';
|
|
11
13
|
import { useEffect, useState, RawHTML } from '@wordpress/element';
|
|
12
14
|
import { __ } from '@wordpress/i18n';
|
|
@@ -27,7 +29,6 @@ function ClassicEdit( props ) {
|
|
|
27
29
|
window.wp.oldEditor.initialize( props.id, {
|
|
28
30
|
tinymce: {
|
|
29
31
|
...settings,
|
|
30
|
-
height: 500,
|
|
31
32
|
setup( editor ) {
|
|
32
33
|
editor.on( 'init', () => {
|
|
33
34
|
const doc = editor.getDoc();
|
|
@@ -58,35 +59,38 @@ export default function ModalEdit( props ) {
|
|
|
58
59
|
} = props;
|
|
59
60
|
const [ isOpen, setOpen ] = useState( false );
|
|
60
61
|
const id = `editor-${ clientId }`;
|
|
61
|
-
|
|
62
|
+
|
|
63
|
+
const onClose = () => ( content ? setOpen( false ) : onReplace( [] ) );
|
|
62
64
|
|
|
63
65
|
return (
|
|
64
66
|
<>
|
|
65
67
|
<BlockControls>
|
|
66
68
|
<ToolbarGroup>
|
|
67
69
|
<ToolbarButton onClick={ () => setOpen( true ) }>
|
|
68
|
-
{
|
|
70
|
+
{ __( 'Edit' ) }
|
|
69
71
|
</ToolbarButton>
|
|
70
72
|
</ToolbarGroup>
|
|
71
73
|
</BlockControls>
|
|
72
74
|
{ content && <RawHTML>{ content }</RawHTML> }
|
|
73
75
|
{ ( isOpen || ! content ) && (
|
|
74
|
-
<Modal
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
<Modal
|
|
77
|
+
title={ __( 'Classic Editor' ) }
|
|
78
|
+
onRequestClose={ onClose }
|
|
79
|
+
shouldCloseOnClickOutside={ false }
|
|
80
|
+
overlayClassName="block-editor-freeform-modal"
|
|
81
|
+
>
|
|
82
|
+
<ClassicEdit id={ id } defaultValue={ content } />
|
|
83
|
+
<Flex
|
|
84
|
+
className="block-editor-freeform-modal__actions"
|
|
85
|
+
justify="flex-end"
|
|
86
|
+
expanded={ false }
|
|
80
87
|
>
|
|
81
|
-
<
|
|
82
|
-
|
|
83
|
-
<Button
|
|
84
|
-
onClick={ () =>
|
|
85
|
-
content ? setOpen( false ) : onReplace( [] )
|
|
86
|
-
}
|
|
87
|
-
>
|
|
88
|
+
<FlexItem>
|
|
89
|
+
<Button variant="tertiary" onClick={ onClose }>
|
|
88
90
|
{ __( 'Cancel' ) }
|
|
89
91
|
</Button>
|
|
92
|
+
</FlexItem>
|
|
93
|
+
<FlexItem>
|
|
90
94
|
<Button
|
|
91
95
|
variant="primary"
|
|
92
96
|
onClick={ () => {
|
|
@@ -101,9 +105,8 @@ export default function ModalEdit( props ) {
|
|
|
101
105
|
>
|
|
102
106
|
{ __( 'Save' ) }
|
|
103
107
|
</Button>
|
|
104
|
-
</
|
|
105
|
-
</
|
|
106
|
-
<ClassicEdit id={ id } defaultValue={ content } />
|
|
108
|
+
</FlexItem>
|
|
109
|
+
</Flex>
|
|
107
110
|
</Modal>
|
|
108
111
|
) }
|
|
109
112
|
</>
|
package/src/gallery/edit.js
CHANGED
|
@@ -127,7 +127,6 @@ function GalleryEdit( props ) {
|
|
|
127
127
|
replaceInnerBlocks,
|
|
128
128
|
updateBlockAttributes,
|
|
129
129
|
selectBlock,
|
|
130
|
-
clearSelectedBlock,
|
|
131
130
|
} = useDispatch( blockEditorStore );
|
|
132
131
|
const { createSuccessNotice, createErrorNotice } =
|
|
133
132
|
useDispatch( noticesStore );
|
|
@@ -186,9 +185,6 @@ function GalleryEdit( props ) {
|
|
|
186
185
|
align: undefined,
|
|
187
186
|
} );
|
|
188
187
|
} );
|
|
189
|
-
if ( newImages?.length > 0 ) {
|
|
190
|
-
clearSelectedBlock();
|
|
191
|
-
}
|
|
192
188
|
}, [ newImages ] );
|
|
193
189
|
|
|
194
190
|
const imageSizeOptions = useImageSizes(
|
|
@@ -343,10 +339,6 @@ function GalleryEdit( props ) {
|
|
|
343
339
|
} );
|
|
344
340
|
} );
|
|
345
341
|
|
|
346
|
-
if ( newBlocks?.length > 0 ) {
|
|
347
|
-
selectBlock( newBlocks[ 0 ].clientId );
|
|
348
|
-
}
|
|
349
|
-
|
|
350
342
|
replaceInnerBlocks(
|
|
351
343
|
clientId,
|
|
352
344
|
existingImageBlocks
|
|
@@ -357,6 +349,11 @@ function GalleryEdit( props ) {
|
|
|
357
349
|
newOrderMap[ b.attributes.id ]
|
|
358
350
|
)
|
|
359
351
|
);
|
|
352
|
+
|
|
353
|
+
// Select the first block to scroll into view when new blocks are added.
|
|
354
|
+
if ( newBlocks?.length > 0 ) {
|
|
355
|
+
selectBlock( newBlocks[ 0 ].clientId );
|
|
356
|
+
}
|
|
360
357
|
}
|
|
361
358
|
|
|
362
359
|
function onUploadError( message ) {
|
package/src/gallery/editor.scss
CHANGED
|
@@ -4,12 +4,6 @@ figure.wp-block-gallery {
|
|
|
4
4
|
// See https://github.com/WordPress/gutenberg/pull/10358
|
|
5
5
|
|
|
6
6
|
display: block;
|
|
7
|
-
&.has-nested-images {
|
|
8
|
-
.components-drop-zone {
|
|
9
|
-
display: none;
|
|
10
|
-
pointer-events: none;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
7
|
|
|
14
8
|
> .blocks-gallery-caption {
|
|
15
9
|
flex: 0 0 100%;
|
|
@@ -14,7 +14,9 @@ import {
|
|
|
14
14
|
setupMediaUpload,
|
|
15
15
|
triggerBlockListLayout,
|
|
16
16
|
within,
|
|
17
|
+
setupPicker,
|
|
17
18
|
} from 'test/helpers';
|
|
19
|
+
import { ActionSheetIOS } from 'react-native';
|
|
18
20
|
|
|
19
21
|
/**
|
|
20
22
|
* WordPress dependencies
|
|
@@ -36,6 +38,12 @@ import {
|
|
|
36
38
|
generateGalleryBlock,
|
|
37
39
|
} from './helpers';
|
|
38
40
|
|
|
41
|
+
const MEDIA_OPTIONS = [
|
|
42
|
+
'Choose from device',
|
|
43
|
+
'Take a Photo',
|
|
44
|
+
'WordPress Media Library',
|
|
45
|
+
];
|
|
46
|
+
|
|
39
47
|
const media = [
|
|
40
48
|
{
|
|
41
49
|
localId: 1,
|
|
@@ -96,9 +104,44 @@ describe( 'Gallery block', () => {
|
|
|
96
104
|
expect( getByText( 'WordPress Media Library' ) ).toBeVisible();
|
|
97
105
|
} );
|
|
98
106
|
|
|
107
|
+
it( 'displays correct media options picker', async () => {
|
|
108
|
+
// Initialize with an empty gallery
|
|
109
|
+
const screen = await initializeEditor( {
|
|
110
|
+
initialHtml: generateGalleryBlock( 0 ),
|
|
111
|
+
} );
|
|
112
|
+
const { getByText } = screen;
|
|
113
|
+
|
|
114
|
+
// Tap on Gallery block
|
|
115
|
+
const block = await getBlock( screen, 'Gallery' );
|
|
116
|
+
fireEvent.press( block );
|
|
117
|
+
fireEvent.press( within( block ).getByText( 'ADD MEDIA' ) );
|
|
118
|
+
|
|
119
|
+
// Observe that media options picker is displayed
|
|
120
|
+
/* eslint-disable jest/no-conditional-expect */
|
|
121
|
+
if ( Platform.isIOS ) {
|
|
122
|
+
// On iOS the picker is rendered natively, so we have
|
|
123
|
+
// to check the arguments passed to `ActionSheetIOS`.
|
|
124
|
+
expect(
|
|
125
|
+
ActionSheetIOS.showActionSheetWithOptions
|
|
126
|
+
).toHaveBeenCalledWith(
|
|
127
|
+
expect.objectContaining( {
|
|
128
|
+
title: 'Choose images',
|
|
129
|
+
options: [ 'Cancel', ...MEDIA_OPTIONS ],
|
|
130
|
+
} ),
|
|
131
|
+
expect.any( Function )
|
|
132
|
+
);
|
|
133
|
+
} else {
|
|
134
|
+
expect( getByText( 'Choose images' ) ).toBeVisible();
|
|
135
|
+
MEDIA_OPTIONS.forEach( ( option ) =>
|
|
136
|
+
expect( getByText( option ) ).toBeVisible()
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
/* eslint-enable jest/no-conditional-expect */
|
|
140
|
+
} );
|
|
141
|
+
|
|
99
142
|
// This case is disabled until the issue (https://github.com/WordPress/gutenberg/issues/38444)
|
|
100
143
|
// is addressed.
|
|
101
|
-
it.skip( '
|
|
144
|
+
it.skip( 'block remains selected after dimissing the media options picker', async () => {
|
|
102
145
|
// Initialize with an empty gallery
|
|
103
146
|
const { getByLabelText, getByText, getByTestId } =
|
|
104
147
|
await initializeEditor( {
|
|
@@ -213,11 +256,13 @@ describe( 'Gallery block', () => {
|
|
|
213
256
|
setupMediaPicker();
|
|
214
257
|
|
|
215
258
|
// Initialize with an empty gallery
|
|
216
|
-
const
|
|
259
|
+
const screen = await initializeWithGalleryBlock();
|
|
260
|
+
const { galleryBlock, getByText } = screen;
|
|
261
|
+
const { selectOption } = setupPicker( screen, MEDIA_OPTIONS );
|
|
217
262
|
|
|
218
263
|
// Upload images from device
|
|
219
264
|
fireEvent.press( getByText( 'ADD MEDIA' ) );
|
|
220
|
-
|
|
265
|
+
selectOption( 'Choose from device' );
|
|
221
266
|
expectMediaPickerCall( 'DEVICE_MEDIA_LIBRARY', [ 'image' ], true );
|
|
222
267
|
|
|
223
268
|
// Return media items picked
|
package/src/gallery/v1/edit.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { isEmpty } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -385,7 +380,7 @@ function GalleryEdit( props ) {
|
|
|
385
380
|
}
|
|
386
381
|
|
|
387
382
|
const imageSizeOptions = getImagesSizeOptions();
|
|
388
|
-
const shouldShowSizeOptions = hasImages &&
|
|
383
|
+
const shouldShowSizeOptions = hasImages && imageSizeOptions.length > 0;
|
|
389
384
|
|
|
390
385
|
return (
|
|
391
386
|
<>
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
ScrollView,
|
|
8
8
|
TouchableWithoutFeedback,
|
|
9
9
|
} from 'react-native';
|
|
10
|
-
import { isEmpty } from 'lodash';
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* WordPress dependencies
|
|
@@ -334,7 +333,7 @@ class GalleryImage extends Component {
|
|
|
334
333
|
accessibilityLabelImageContainer() {
|
|
335
334
|
const { caption, 'aria-label': ariaLabel } = this.props;
|
|
336
335
|
|
|
337
|
-
return
|
|
336
|
+
return ! caption
|
|
338
337
|
? ariaLabel
|
|
339
338
|
: ariaLabel +
|
|
340
339
|
'. ' +
|
|
@@ -20,7 +20,7 @@ exports[`Group block transforms to Columns block 1`] = `
|
|
|
20
20
|
<!-- /wp:columns -->"
|
|
21
21
|
`;
|
|
22
22
|
|
|
23
|
-
exports[`Group block transforms
|
|
23
|
+
exports[`Group block transforms ungroups block 1`] = `
|
|
24
24
|
"<!-- wp:paragraph -->
|
|
25
25
|
<p>One.</p>
|
|
26
26
|
<!-- /wp:paragraph -->
|
|
@@ -44,14 +44,13 @@ describe( `${ block } block transforms`, () => {
|
|
|
44
44
|
expect( getEditorHtml() ).toMatchSnapshot();
|
|
45
45
|
} );
|
|
46
46
|
|
|
47
|
-
it( '
|
|
47
|
+
it( 'ungroups block', async () => {
|
|
48
48
|
const screen = await initializeEditor( { initialHtml } );
|
|
49
49
|
const { getByText } = screen;
|
|
50
50
|
fireEvent.press( getBlock( screen, block ) );
|
|
51
51
|
|
|
52
52
|
await openBlockActionsMenu( screen );
|
|
53
|
-
fireEvent.press( getByText( '
|
|
54
|
-
fireEvent.press( getByText( 'Unwrap' ) );
|
|
53
|
+
fireEvent.press( getByText( 'Ungroup' ) );
|
|
55
54
|
|
|
56
55
|
// The first block created is the content of the Paragraph block.
|
|
57
56
|
const paragraph = getBlock( screen, 'Paragraph', 0 );
|
|
@@ -67,8 +66,7 @@ describe( `${ block } block transforms`, () => {
|
|
|
67
66
|
const screen = await initializeEditor( { initialHtml } );
|
|
68
67
|
const transformOptions = await getBlockTransformOptions(
|
|
69
68
|
screen,
|
|
70
|
-
block
|
|
71
|
-
{ canUnwrap: true }
|
|
69
|
+
block
|
|
72
70
|
);
|
|
73
71
|
expect( transformOptions ).toHaveLength( blockTransforms.length );
|
|
74
72
|
} );
|
package/src/group/transforms.js
CHANGED
package/src/image/block.json
CHANGED
package/src/image/deprecated.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import classnames from 'classnames';
|
|
5
|
-
import { isEmpty } from 'lodash';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* WordPress dependencies
|
|
@@ -122,7 +121,7 @@ const deprecated = [
|
|
|
122
121
|
title,
|
|
123
122
|
} = attributes;
|
|
124
123
|
|
|
125
|
-
const newRel =
|
|
124
|
+
const newRel = ! rel ? undefined : rel;
|
|
126
125
|
|
|
127
126
|
const classes = classnames( {
|
|
128
127
|
[ `align${ align }` ]: align,
|
|
@@ -202,7 +201,7 @@ const deprecated = [
|
|
|
202
201
|
title,
|
|
203
202
|
} = attributes;
|
|
204
203
|
|
|
205
|
-
const newRel =
|
|
204
|
+
const newRel = ! rel ? undefined : rel;
|
|
206
205
|
|
|
207
206
|
const classes = classnames( {
|
|
208
207
|
[ `align${ align }` ]: align,
|
package/src/image/edit.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import classnames from 'classnames';
|
|
5
|
-
import { isEmpty } from 'lodash';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* WordPress dependencies
|
|
@@ -18,6 +17,7 @@ import {
|
|
|
18
17
|
useBlockProps,
|
|
19
18
|
store as blockEditorStore,
|
|
20
19
|
__experimentalUseBorderProps as useBorderProps,
|
|
20
|
+
privateApis as blockEditorPrivateApis,
|
|
21
21
|
} from '@wordpress/block-editor';
|
|
22
22
|
import { useEffect, useRef, useState } from '@wordpress/element';
|
|
23
23
|
import { __ } from '@wordpress/i18n';
|
|
@@ -28,6 +28,7 @@ import { store as noticesStore } from '@wordpress/notices';
|
|
|
28
28
|
* Internal dependencies
|
|
29
29
|
*/
|
|
30
30
|
import Image from './image';
|
|
31
|
+
import { unlock } from '../private-apis';
|
|
31
32
|
|
|
32
33
|
/**
|
|
33
34
|
* Module constants
|
|
@@ -40,6 +41,8 @@ import {
|
|
|
40
41
|
ALLOWED_MEDIA_TYPES,
|
|
41
42
|
} from './constants';
|
|
42
43
|
|
|
44
|
+
const { useBlockEditingMode } = unlock( blockEditorPrivateApis );
|
|
45
|
+
|
|
43
46
|
export const pickRelevantMediaFiles = ( image, size ) => {
|
|
44
47
|
const imageProps = Object.fromEntries(
|
|
45
48
|
Object.entries( image ?? {} ).filter( ( [ key ] ) =>
|
|
@@ -125,20 +128,15 @@ export function ImageEdit( {
|
|
|
125
128
|
}, [ caption ] );
|
|
126
129
|
|
|
127
130
|
const ref = useRef();
|
|
128
|
-
const { imageDefaultSize, mediaUpload
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
!! __unstableGetContentLockingParent( clientId ),
|
|
138
|
-
};
|
|
139
|
-
},
|
|
140
|
-
[]
|
|
141
|
-
);
|
|
131
|
+
const { imageDefaultSize, mediaUpload } = useSelect( ( select ) => {
|
|
132
|
+
const { getSettings } = select( blockEditorStore );
|
|
133
|
+
const settings = getSettings();
|
|
134
|
+
return {
|
|
135
|
+
imageDefaultSize: settings.imageDefaultSize,
|
|
136
|
+
mediaUpload: settings.mediaUpload,
|
|
137
|
+
};
|
|
138
|
+
}, [] );
|
|
139
|
+
const blockEditingMode = useBlockEditingMode();
|
|
142
140
|
|
|
143
141
|
const { createErrorNotice } = useDispatch( noticesStore );
|
|
144
142
|
function onUploadError( message ) {
|
|
@@ -320,7 +318,9 @@ export function ImageEdit( {
|
|
|
320
318
|
'is-resized': !! width || !! height,
|
|
321
319
|
[ `size-${ sizeSlug }` ]: sizeSlug,
|
|
322
320
|
'has-custom-border':
|
|
323
|
-
!! borderProps.className ||
|
|
321
|
+
!! borderProps.className ||
|
|
322
|
+
( borderProps.style &&
|
|
323
|
+
Object.keys( borderProps.style ).length > 0 ),
|
|
324
324
|
} );
|
|
325
325
|
|
|
326
326
|
const blockProps = useBlockProps( {
|
|
@@ -365,10 +365,10 @@ export function ImageEdit( {
|
|
|
365
365
|
containerRef={ ref }
|
|
366
366
|
context={ context }
|
|
367
367
|
clientId={ clientId }
|
|
368
|
-
|
|
368
|
+
blockEditingMode={ blockEditingMode }
|
|
369
369
|
/>
|
|
370
370
|
) }
|
|
371
|
-
{ ! url &&
|
|
371
|
+
{ ! url && blockEditingMode === 'default' && (
|
|
372
372
|
<BlockControls group="block">
|
|
373
373
|
<BlockAlignmentControl
|
|
374
374
|
value={ align }
|
package/src/image/image.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { isEmpty } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -79,7 +74,7 @@ export default function Image( {
|
|
|
79
74
|
containerRef,
|
|
80
75
|
context,
|
|
81
76
|
clientId,
|
|
82
|
-
|
|
77
|
+
blockEditingMode,
|
|
83
78
|
} ) {
|
|
84
79
|
const {
|
|
85
80
|
url = '',
|
|
@@ -122,7 +117,7 @@ export default function Image( {
|
|
|
122
117
|
),
|
|
123
118
|
};
|
|
124
119
|
},
|
|
125
|
-
[ id, isSelected
|
|
120
|
+
[ id, isSelected ]
|
|
126
121
|
);
|
|
127
122
|
const { canInsertCover, imageEditing, imageSizes, maxWidth, mediaUpload } =
|
|
128
123
|
useSelect(
|
|
@@ -161,9 +156,10 @@ export default function Image( {
|
|
|
161
156
|
const [ isEditingImage, setIsEditingImage ] = useState( false );
|
|
162
157
|
const [ externalBlob, setExternalBlob ] = useState();
|
|
163
158
|
const clientWidth = useClientWidth( containerRef, [ align ] );
|
|
159
|
+
const hasNonContentControls = blockEditingMode === 'default';
|
|
164
160
|
const isResizable =
|
|
165
161
|
allowResize &&
|
|
166
|
-
|
|
162
|
+
hasNonContentControls &&
|
|
167
163
|
! ( isWideAligned && isLargeViewport );
|
|
168
164
|
const imageSizeOptions = imageSizes
|
|
169
165
|
.filter(
|
|
@@ -332,13 +328,13 @@ export default function Image( {
|
|
|
332
328
|
const controls = (
|
|
333
329
|
<>
|
|
334
330
|
<BlockControls group="block">
|
|
335
|
-
{
|
|
331
|
+
{ hasNonContentControls && (
|
|
336
332
|
<BlockAlignmentControl
|
|
337
333
|
value={ align }
|
|
338
334
|
onChange={ updateAlignment }
|
|
339
335
|
/>
|
|
340
336
|
) }
|
|
341
|
-
{
|
|
337
|
+
{ hasNonContentControls && (
|
|
342
338
|
<ToolbarButton
|
|
343
339
|
onClick={ () => {
|
|
344
340
|
setShowCaption( ! showCaption );
|
|
@@ -480,7 +476,8 @@ export default function Image( {
|
|
|
480
476
|
const borderProps = useBorderProps( attributes );
|
|
481
477
|
const isRounded = attributes.className?.includes( 'is-style-rounded' );
|
|
482
478
|
const hasCustomBorder =
|
|
483
|
-
!! borderProps.className ||
|
|
479
|
+
!! borderProps.className ||
|
|
480
|
+
( borderProps.style && Object.keys( borderProps.style ).length > 0 );
|
|
484
481
|
|
|
485
482
|
let img = (
|
|
486
483
|
// Disable reason: Image itself is not meant to be interactive, but
|