@wordpress/block-library 8.8.0 → 8.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 +4 -0
- 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/index.js +1 -1
- package/build/cover/transforms.js +10 -7
- package/build/cover/transforms.js.map +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/view.js +1 -1
- package/build/file/view.js.map +1 -1
- package/build/gallery/edit.js +2 -8
- package/build/gallery/edit.js.map +1 -1
- package/build/group/edit.js +3 -1
- package/build/group/edit.js.map +1 -1
- package/build/group/index.js +3 -0
- package/build/group/index.js.map +1 -1
- package/build/image/edit.js +16 -13
- package/build/image/edit.js.map +1 -1
- package/build/image/index.js +1 -1
- package/build/index.js +0 -6
- package/build/index.js.map +1 -1
- package/build/index.native.js +10 -6
- package/build/index.native.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/edit.js +4 -2
- package/build/media-text/edit.js.map +1 -1
- package/build/media-text/index.js +3 -0
- package/build/media-text/index.js.map +1 -1
- package/build/navigation/constants.js +13 -0
- package/build/navigation/constants.js.map +1 -0
- package/build/navigation/edit/index.js +26 -68
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/inner-blocks.js +4 -7
- package/build/navigation/edit/inner-blocks.js.map +1 -1
- package/build/navigation/edit/unsaved-inner-blocks.js +4 -6
- 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 +139 -0
- package/build/navigation/interactivity.js.map +1 -0
- package/build/navigation-link/edit.js +1 -1
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-submenu/edit.js +1 -1
- 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/post-author-name/edit.js +1 -1
- package/build/post-author-name/edit.js.map +1 -1
- package/build/post-date/edit.js +4 -2
- package/build/post-date/edit.js.map +1 -1
- package/build/post-excerpt/edit.js +2 -2
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +6 -4
- 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 +14 -4
- 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/query/deprecated.js +8 -6
- package/build/query/deprecated.js.map +1 -1
- package/build/query/edit/inspector-controls/create-new-post-link.js +41 -0
- package/build/query/edit/inspector-controls/create-new-post-link.js.map +1 -0
- package/build/query/edit/inspector-controls/index.js +14 -6
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/pattern-selection-modal.js +2 -1
- package/build/query/edit/pattern-selection-modal.js.map +1 -1
- package/build/query/index.js +5 -12
- package/build/query/index.js.map +1 -1
- package/build/quote/transforms.js +16 -27
- 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-logo/edit.js +114 -16
- package/build/site-logo/edit.js.map +1 -1
- package/build/site-logo/index.js +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/icons/chain.js +1 -1
- package/build/social-link/icons/chain.js.map +1 -1
- package/build/social-link/icons/mail.js +1 -1
- package/build/social-link/icons/mail.js.map +1 -1
- package/build/social-links/edit.js +2 -2
- package/build/social-links/edit.js.map +1 -1
- package/build/spacer/edit.js +117 -11
- package/build/spacer/edit.js.map +1 -1
- package/build/template-part/edit/index.js +2 -1
- 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 +208 -0
- package/build/utils/interactivity/directives.js.map +1 -0
- package/build/utils/interactivity/hooks.js +112 -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/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/utils/migrate-font-family.js +12 -5
- package/build/utils/migrate-font-family.js.map +1 -1
- package/build/video/edit.native.js +4 -3
- package/build/video/edit.native.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/index.js +1 -1
- package/build-module/cover/transforms.js +5 -1
- package/build-module/cover/transforms.js.map +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/view.js +1 -1
- package/build-module/file/view.js.map +1 -1
- package/build-module/gallery/edit.js +2 -8
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/group/edit.js +3 -1
- package/build-module/group/edit.js.map +1 -1
- package/build-module/group/index.js +3 -0
- package/build-module/group/index.js.map +1 -1
- package/build-module/image/edit.js +16 -13
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/index.js +1 -1
- package/build-module/index.js +0 -4
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +10 -6
- package/build-module/index.native.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/edit.js +4 -2
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/media-text/index.js +3 -0
- package/build-module/media-text/index.js.map +1 -1
- package/build-module/navigation/constants.js +5 -0
- package/build-module/navigation/constants.js.map +1 -0
- package/build-module/navigation/edit/index.js +28 -69
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/inner-blocks.js +1 -4
- package/build-module/navigation/edit/inner-blocks.js.map +1 -1
- package/build-module/navigation/edit/unsaved-inner-blocks.js +1 -4
- 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 +136 -0
- package/build-module/navigation/interactivity.js.map +1 -0
- package/build-module/navigation-link/edit.js +1 -1
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +1 -1
- 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/post-author-name/edit.js +1 -1
- package/build-module/post-author-name/edit.js.map +1 -1
- package/build-module/post-date/edit.js +4 -2
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-excerpt/edit.js +2 -2
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +6 -4
- 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 +13 -4
- 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/query/deprecated.js +5 -2
- package/build-module/query/deprecated.js.map +1 -1
- package/build-module/query/edit/inspector-controls/create-new-post-link.js +33 -0
- package/build-module/query/edit/inspector-controls/create-new-post-link.js.map +1 -0
- package/build-module/query/edit/inspector-controls/index.js +12 -7
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/pattern-selection-modal.js +2 -1
- package/build-module/query/edit/pattern-selection-modal.js.map +1 -1
- package/build-module/query/index.js +5 -10
- package/build-module/query/index.js.map +1 -1
- package/build-module/quote/transforms.js +16 -27
- 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-logo/edit.js +115 -18
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/site-logo/index.js +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/icons/chain.js +1 -1
- package/build-module/social-link/icons/chain.js.map +1 -1
- package/build-module/social-link/icons/mail.js +1 -1
- package/build-module/social-link/icons/mail.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/spacer/edit.js +118 -12
- package/build-module/spacer/edit.js.map +1 -1
- package/build-module/template-part/edit/index.js +2 -1
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/edit/utils/hooks.js +2 -2
- 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 +193 -0
- package/build-module/utils/interactivity/directives.js.map +1 -0
- package/build-module/utils/interactivity/hooks.js +98 -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/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-module/utils/migrate-font-family.js +9 -1
- package/build-module/utils/migrate-font-family.js.map +1 -1
- package/build-module/video/edit.native.js +4 -3
- package/build-module/video/edit.native.js.map +1 -1
- package/build-style/cover/editor-rtl.css +3 -3
- package/build-style/cover/editor.css +3 -3
- package/build-style/cover/style-rtl.css +2 -1
- package/build-style/cover/style.css +2 -1
- 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 +74 -39
- package/build-style/editor.css +74 -39
- package/build-style/gallery/editor-rtl.css +0 -4
- package/build-style/gallery/editor.css +0 -4
- package/build-style/html/editor-rtl.css +2 -2
- package/build-style/html/editor.css +2 -2
- package/build-style/image/editor-rtl.css +1 -1
- package/build-style/image/editor.css +1 -1
- package/build-style/query/editor-rtl.css +8 -12
- package/build-style/query/editor.css +8 -12
- package/build-style/search/editor-rtl.css +1 -0
- package/build-style/search/editor.css +1 -0
- package/build-style/search/style-rtl.css +2 -0
- package/build-style/search/style.css +2 -0
- package/build-style/shortcode/editor-rtl.css +3 -4
- package/build-style/shortcode/editor.css +3 -4
- package/build-style/site-logo/editor-rtl.css +47 -0
- package/build-style/site-logo/editor.css +47 -0
- package/build-style/style-rtl.css +15 -2
- package/build-style/style.css +15 -2
- package/build-style/template-part/editor-rtl.css +8 -12
- package/build-style/template-part/editor.css +8 -12
- package/package.json +36 -32
- package/src/buttons/test/__snapshots__/edit.native.js.snap +18 -0
- package/src/buttons/test/edit.native.js +123 -2
- 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/cover/block.json +1 -1
- package/src/cover/edit/inspector-controls.js +56 -54
- package/src/cover/editor.scss +1 -1
- package/src/cover/style.scss +4 -0
- package/src/cover/test/edit.js +56 -2
- package/src/cover/transforms.js +4 -1
- 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/view.js +4 -1
- package/src/gallery/edit.js +5 -8
- package/src/gallery/editor.scss +0 -6
- package/src/gallery/test/index.native.js +52 -7
- package/src/group/block.json +3 -0
- package/src/group/edit.js +8 -2
- package/src/heading/test/__snapshots__/index.native.js.snap +12 -0
- package/src/heading/test/index.native.js +71 -0
- package/src/html/editor.scss +2 -21
- package/src/image/block.json +1 -1
- package/src/image/edit.js +21 -17
- package/src/image/editor.scss +1 -1
- package/src/image/test/edit.native.js +38 -16
- package/src/index.js +0 -4
- package/src/index.native.js +10 -5
- package/src/list/test/edit.native.js +7 -7
- package/src/loginout/block.json +11 -1
- package/src/media-text/block.json +3 -0
- package/src/media-text/edit.js +2 -1
- package/src/navigation/constants.js +16 -0
- package/src/navigation/edit/index.js +77 -163
- package/src/navigation/edit/inner-blocks.js +1 -16
- package/src/navigation/edit/unsaved-inner-blocks.js +1 -16
- package/src/navigation/edit/use-convert-classic-menu-to-block-menu.js +1 -1
- package/src/navigation/index.php +210 -197
- package/src/navigation/interactivity.js +144 -0
- package/src/navigation-link/edit.js +1 -1
- package/src/navigation-submenu/edit.js +1 -1
- package/src/paragraph/block.json +5 -1
- package/src/paragraph/test/edit.native.js +288 -28
- package/src/post-author-name/edit.js +1 -1
- package/src/post-date/edit.js +4 -0
- package/src/post-date/index.php +17 -8
- package/src/post-excerpt/edit.js +1 -1
- package/src/post-featured-image/edit.js +5 -4
- package/src/post-featured-image/overlay.js +4 -0
- package/src/post-terms/index.php +2 -2
- package/src/post-title/edit.js +8 -1
- package/src/preformatted/edit.native.js +1 -3
- package/src/preformatted/test/edit.native.js +6 -9
- package/src/pullquote/test/edit.native.js +7 -12
- package/src/query/deprecated.js +4 -1
- package/src/query/edit/inspector-controls/create-new-post-link.js +26 -0
- package/src/query/edit/inspector-controls/index.js +13 -6
- package/src/query/edit/pattern-selection-modal.js +1 -0
- package/src/query/editor.scss +8 -11
- package/src/query/index.js +1 -7
- package/src/quote/test/edit.native.js +6 -10
- package/src/quote/transforms.js +0 -6
- package/src/read-more/edit.js +1 -1
- package/src/search/edit.js +9 -4
- package/src/search/editor.scss +1 -0
- package/src/search/style.scss +3 -0
- package/src/shortcode/editor.scss +1 -21
- package/src/site-logo/block.json +1 -1
- package/src/site-logo/edit.js +123 -9
- package/src/site-logo/editor.scss +58 -0
- package/src/site-title/edit/index.js +1 -1
- package/src/social-link/icons/chain.js +1 -1
- package/src/social-link/icons/mail.js +1 -1
- package/src/social-link/index.php +2 -2
- package/src/social-links/edit.js +33 -31
- package/src/spacer/edit.js +157 -18
- package/src/style.scss +0 -1
- package/src/template-part/edit/index.js +1 -0
- package/src/template-part/edit/utils/hooks.js +2 -2
- package/src/template-part/editor.scss +9 -11
- package/src/template-part/index.php +20 -5
- package/src/utils/interactivity/constants.js +1 -0
- package/src/utils/interactivity/directives.js +179 -0
- package/src/utils/interactivity/hooks.js +76 -0
- package/src/utils/interactivity/hydration.js +22 -0
- package/src/utils/interactivity/index.js +17 -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/src/utils/migrate-font-family.js +8 -1
- package/src/verse/test/edit.native.js +4 -9
- package/src/video/edit.native.js +2 -2
- package/tsconfig.json +2 -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/query/hooks.js +0 -72
- package/build/query/hooks.js.map +0 -1
- package/build/utils/clean-empty-object.js +0 -37
- package/build/utils/clean-empty-object.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/query/hooks.js +0 -59
- package/build-module/query/hooks.js.map +0 -1
- package/build-module/utils/clean-empty-object.js +0 -28
- package/build-module/utils/clean-empty-object.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/query/hooks.js +0 -53
- package/src/utils/clean-empty-object.js +0 -28
package/src/details/edit.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
|
+
RichText,
|
|
5
6
|
useBlockProps,
|
|
6
7
|
useInnerBlocksProps,
|
|
7
8
|
store as blockEditorStore,
|
|
@@ -11,15 +12,21 @@ import { useSelect } from '@wordpress/data';
|
|
|
11
12
|
import { PanelBody, ToggleControl } from '@wordpress/components';
|
|
12
13
|
import { __ } from '@wordpress/i18n';
|
|
13
14
|
|
|
14
|
-
const TEMPLATE = [
|
|
15
|
+
const TEMPLATE = [
|
|
16
|
+
[
|
|
17
|
+
'core/paragraph',
|
|
18
|
+
{
|
|
19
|
+
placeholder: __( 'Type / to add a hidden block' ),
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
];
|
|
15
23
|
|
|
16
24
|
function DetailsEdit( { attributes, setAttributes, clientId } ) {
|
|
17
|
-
const { showContent } = attributes;
|
|
25
|
+
const { showContent, summary } = attributes;
|
|
18
26
|
const blockProps = useBlockProps();
|
|
19
27
|
const innerBlocksProps = useInnerBlocksProps( blockProps, {
|
|
20
|
-
allowedBlocks: TEMPLATE,
|
|
21
28
|
template: TEMPLATE,
|
|
22
|
-
|
|
29
|
+
__experimentalCaptureToolbars: true,
|
|
23
30
|
} );
|
|
24
31
|
|
|
25
32
|
// Check if either the block or the inner blocks are selected.
|
|
@@ -51,7 +58,22 @@ function DetailsEdit( { attributes, setAttributes, clientId } ) {
|
|
|
51
58
|
<details
|
|
52
59
|
{ ...innerBlocksProps }
|
|
53
60
|
open={ hasSelection || showContent }
|
|
54
|
-
|
|
61
|
+
>
|
|
62
|
+
<summary onClick={ ( event ) => event.preventDefault() }>
|
|
63
|
+
<RichText
|
|
64
|
+
aria-label={ __( 'Write summary' ) }
|
|
65
|
+
placeholder={ __( 'Write summary…' ) }
|
|
66
|
+
allowedFormats={ [] }
|
|
67
|
+
withoutInteractiveFormatting
|
|
68
|
+
value={ summary }
|
|
69
|
+
onChange={ ( newSummary ) =>
|
|
70
|
+
setAttributes( { summary: newSummary } )
|
|
71
|
+
}
|
|
72
|
+
multiline={ false }
|
|
73
|
+
/>
|
|
74
|
+
</summary>
|
|
75
|
+
{ innerBlocksProps.children }
|
|
76
|
+
</details>
|
|
55
77
|
</>
|
|
56
78
|
);
|
|
57
79
|
}
|
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/view.js
CHANGED
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%;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
5
|
act,
|
|
6
|
-
|
|
6
|
+
typeInRichText,
|
|
7
7
|
fireEvent,
|
|
8
8
|
getBlock,
|
|
9
9
|
getEditorHtml,
|
|
@@ -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( {
|
|
@@ -173,7 +216,7 @@ describe( 'Gallery block', () => {
|
|
|
173
216
|
const captionField = within(
|
|
174
217
|
getByLabelText( /Gallery caption. Empty/ )
|
|
175
218
|
).getByPlaceholderText( 'Add caption' );
|
|
176
|
-
|
|
219
|
+
typeInRichText(
|
|
177
220
|
captionField,
|
|
178
221
|
'<strong>Bold</strong> <em>italic</em> <s>strikethrough</s> gallery caption'
|
|
179
222
|
);
|
|
@@ -197,7 +240,7 @@ describe( 'Gallery block', () => {
|
|
|
197
240
|
// Set gallery item caption
|
|
198
241
|
const captionField =
|
|
199
242
|
within( galleryItem ).getByPlaceholderText( 'Add caption' );
|
|
200
|
-
|
|
243
|
+
typeInRichText(
|
|
201
244
|
captionField,
|
|
202
245
|
'<strong>Bold</strong> <em>italic</em> <s>strikethrough</s> image caption'
|
|
203
246
|
);
|
|
@@ -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
|
|
@@ -537,7 +582,7 @@ describe( 'Gallery block', () => {
|
|
|
537
582
|
<figure class="wp-block-gallery has-nested-images columns-default is-cropped"><!-- wp:image {"id":${ media[ 0 ].localId }} -->
|
|
538
583
|
<figure class="wp-block-image"><img src="${ media[ 0 ].localUrl }" alt="" class="wp-image-${ media[ 0 ].localId }"/></figure>
|
|
539
584
|
<!-- /wp:image -->
|
|
540
|
-
|
|
585
|
+
|
|
541
586
|
<!-- wp:image {"id":${ media[ 1 ].localId },"linkDestination":"attachment"} -->
|
|
542
587
|
<figure class="wp-block-image"><img src="${ media[ 1 ].localUrl }" alt="" class="wp-image-${ media[ 1 ].localId }"/></figure>
|
|
543
588
|
<!-- /wp:image --></figure>
|
package/src/group/block.json
CHANGED
package/src/group/edit.js
CHANGED
|
@@ -90,7 +90,12 @@ function GroupEdit( {
|
|
|
90
90
|
[ clientId ]
|
|
91
91
|
);
|
|
92
92
|
|
|
93
|
-
const {
|
|
93
|
+
const {
|
|
94
|
+
tagName: TagName = 'div',
|
|
95
|
+
templateLock,
|
|
96
|
+
allowedBlocks,
|
|
97
|
+
layout = {},
|
|
98
|
+
} = attributes;
|
|
94
99
|
|
|
95
100
|
// Layout settings.
|
|
96
101
|
const defaultLayout = useSetting( 'layout' ) || {};
|
|
@@ -131,6 +136,7 @@ function GroupEdit( {
|
|
|
131
136
|
: { className: 'wp-block-group__inner-container' },
|
|
132
137
|
{
|
|
133
138
|
templateLock,
|
|
139
|
+
allowedBlocks,
|
|
134
140
|
renderAppender,
|
|
135
141
|
__unstableDisableLayoutClassNames: ! layoutSupportEnabled,
|
|
136
142
|
}
|
|
@@ -153,7 +159,7 @@ function GroupEdit( {
|
|
|
153
159
|
}
|
|
154
160
|
/>
|
|
155
161
|
{ showPlaceholder && (
|
|
156
|
-
<View
|
|
162
|
+
<View>
|
|
157
163
|
{ innerBlocksProps.children }
|
|
158
164
|
<GroupPlaceHolder
|
|
159
165
|
clientId={ clientId }
|
|
@@ -5,3 +5,15 @@ exports[`Heading block inserts block 1`] = `
|
|
|
5
5
|
<h2 class="wp-block-heading"></h2>
|
|
6
6
|
<!-- /wp:heading -->"
|
|
7
7
|
`;
|
|
8
|
+
|
|
9
|
+
exports[`Heading block should set a background color 1`] = `
|
|
10
|
+
"<!-- wp:heading {"backgroundColor":"luminous-vivid-orange"} -->
|
|
11
|
+
<h2 class="wp-block-heading has-luminous-vivid-orange-background-color has-background">A quick brown fox jumps over the lazy dog.</h2>
|
|
12
|
+
<!-- /wp:heading -->"
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
exports[`Heading block should set a text color 1`] = `
|
|
16
|
+
"<!-- wp:heading {"textColor":"pale-pink"} -->
|
|
17
|
+
<h2 class="wp-block-heading has-pale-pink-color has-text-color">A quick brown fox jumps over the lazy dog.</h2>
|
|
18
|
+
<!-- /wp:heading -->"
|
|
19
|
+
`;
|
|
@@ -7,6 +7,9 @@ import {
|
|
|
7
7
|
initializeEditor,
|
|
8
8
|
addBlock,
|
|
9
9
|
getBlock,
|
|
10
|
+
typeInRichText,
|
|
11
|
+
waitFor,
|
|
12
|
+
within,
|
|
10
13
|
} from 'test/helpers';
|
|
11
14
|
|
|
12
15
|
/**
|
|
@@ -41,4 +44,72 @@ describe( 'Heading block', () => {
|
|
|
41
44
|
|
|
42
45
|
expect( getEditorHtml() ).toMatchSnapshot();
|
|
43
46
|
} );
|
|
47
|
+
|
|
48
|
+
it( 'should set a text color', async () => {
|
|
49
|
+
// Arrange
|
|
50
|
+
const screen = await initializeEditor();
|
|
51
|
+
await addBlock( screen, 'Heading' );
|
|
52
|
+
|
|
53
|
+
// Act
|
|
54
|
+
const headingBlock = getBlock( screen, 'Heading' );
|
|
55
|
+
fireEvent.press( headingBlock );
|
|
56
|
+
const headingTextInput =
|
|
57
|
+
within( headingBlock ).getByPlaceholderText( 'Heading' );
|
|
58
|
+
typeInRichText(
|
|
59
|
+
headingTextInput,
|
|
60
|
+
'A quick brown fox jumps over the lazy dog.'
|
|
61
|
+
);
|
|
62
|
+
// Open Block Settings.
|
|
63
|
+
fireEvent.press( screen.getByLabelText( 'Open Settings' ) );
|
|
64
|
+
|
|
65
|
+
// Wait for Block Settings to be visible.
|
|
66
|
+
const blockSettingsModal = screen.getByTestId( 'block-settings-modal' );
|
|
67
|
+
await waitFor( () => blockSettingsModal.props.isVisible );
|
|
68
|
+
|
|
69
|
+
// Open Text color settings
|
|
70
|
+
fireEvent.press( screen.getByLabelText( 'Text, Default' ) );
|
|
71
|
+
|
|
72
|
+
// Tap one color
|
|
73
|
+
fireEvent.press( screen.getByLabelText( 'Pale pink' ) );
|
|
74
|
+
|
|
75
|
+
// Dismiss the Block Settings modal.
|
|
76
|
+
fireEvent( blockSettingsModal, 'backdropPress' );
|
|
77
|
+
|
|
78
|
+
// Assert
|
|
79
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
80
|
+
} );
|
|
81
|
+
|
|
82
|
+
it( 'should set a background color', async () => {
|
|
83
|
+
// Arrange
|
|
84
|
+
const screen = await initializeEditor();
|
|
85
|
+
await addBlock( screen, 'Heading' );
|
|
86
|
+
|
|
87
|
+
// Act
|
|
88
|
+
const headingBlock = getBlock( screen, 'Heading' );
|
|
89
|
+
fireEvent.press( headingBlock );
|
|
90
|
+
const headingTextInput =
|
|
91
|
+
within( headingBlock ).getByPlaceholderText( 'Heading' );
|
|
92
|
+
typeInRichText(
|
|
93
|
+
headingTextInput,
|
|
94
|
+
'A quick brown fox jumps over the lazy dog.'
|
|
95
|
+
);
|
|
96
|
+
// Open Block Settings.
|
|
97
|
+
fireEvent.press( screen.getByLabelText( 'Open Settings' ) );
|
|
98
|
+
|
|
99
|
+
// Wait for Block Settings to be visible.
|
|
100
|
+
const blockSettingsModal = screen.getByTestId( 'block-settings-modal' );
|
|
101
|
+
await waitFor( () => blockSettingsModal.props.isVisible );
|
|
102
|
+
|
|
103
|
+
// Open Background color settings
|
|
104
|
+
fireEvent.press( screen.getByLabelText( 'Background, Default' ) );
|
|
105
|
+
|
|
106
|
+
// Tap one color
|
|
107
|
+
fireEvent.press( screen.getByLabelText( 'Luminous vivid orange' ) );
|
|
108
|
+
|
|
109
|
+
// Dismiss the Block Settings modal.
|
|
110
|
+
fireEvent( blockSettingsModal, 'backdropPress' );
|
|
111
|
+
|
|
112
|
+
// Assert
|
|
113
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
114
|
+
} );
|
|
44
115
|
} );
|
package/src/html/editor.scss
CHANGED
|
@@ -10,27 +10,8 @@
|
|
|
10
10
|
// The editing view for the HTML block is equivalent to block UI.
|
|
11
11
|
// Therefore we increase specificity to avoid theme styles bleeding in.
|
|
12
12
|
.block-editor-plain-text {
|
|
13
|
-
|
|
14
|
-
color: $gray-900 !important;
|
|
15
|
-
background: $white !important;
|
|
16
|
-
padding: $grid-unit-15 !important;
|
|
17
|
-
border: $border-width solid $gray-900 !important;
|
|
18
|
-
box-shadow: none !important;
|
|
19
|
-
border-radius: $radius-block-ui !important;
|
|
13
|
+
box-sizing: border-box;
|
|
20
14
|
max-height: 250px;
|
|
21
|
-
|
|
22
|
-
/* Fonts smaller than 16px causes mobile safari to zoom. */
|
|
23
|
-
font-size: $mobile-text-min-font-size !important;
|
|
24
|
-
@include break-small {
|
|
25
|
-
font-size: $default-font-size !important;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
&:focus {
|
|
29
|
-
border-color: var(--wp-admin-theme-color) !important;
|
|
30
|
-
box-shadow: 0 0 0 ($border-width-focus - $border-width) var(--wp-admin-theme-color) !important;
|
|
31
|
-
|
|
32
|
-
// Windows High Contrast mode will show this outline, but not the box-shadow.
|
|
33
|
-
outline: 2px solid transparent !important;
|
|
34
|
-
}
|
|
15
|
+
@include editor-input-reset();
|
|
35
16
|
}
|
|
36
17
|
}
|
package/src/image/block.json
CHANGED
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
106
|
"selectors": {
|
|
107
|
-
"border": ".wp-block-image img, .wp-block-image .wp-block-image__crop-area",
|
|
107
|
+
"border": ".wp-block-image img, .wp-block-image .wp-block-image__crop-area, .wp-block-image .components-placeholder",
|
|
108
108
|
"filter": {
|
|
109
109
|
"duotone": ".wp-block-image img, .wp-block-image .components-placeholder"
|
|
110
110
|
}
|
package/src/image/edit.js
CHANGED
|
@@ -29,23 +29,6 @@ import { store as noticesStore } from '@wordpress/notices';
|
|
|
29
29
|
*/
|
|
30
30
|
import Image from './image';
|
|
31
31
|
|
|
32
|
-
// Much of this description is duplicated from MediaPlaceholder.
|
|
33
|
-
const placeholder = ( content ) => {
|
|
34
|
-
return (
|
|
35
|
-
<Placeholder
|
|
36
|
-
className="block-editor-media-placeholder"
|
|
37
|
-
withIllustration={ true }
|
|
38
|
-
icon={ icon }
|
|
39
|
-
label={ __( 'Image' ) }
|
|
40
|
-
instructions={ __(
|
|
41
|
-
'Upload an image file, pick one from your media library, or add one with a URL.'
|
|
42
|
-
) }
|
|
43
|
-
>
|
|
44
|
-
{ content }
|
|
45
|
-
</Placeholder>
|
|
46
|
-
);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
32
|
/**
|
|
50
33
|
* Module constants
|
|
51
34
|
*/
|
|
@@ -345,6 +328,27 @@ export function ImageEdit( {
|
|
|
345
328
|
className: classes,
|
|
346
329
|
} );
|
|
347
330
|
|
|
331
|
+
// Much of this description is duplicated from MediaPlaceholder.
|
|
332
|
+
const placeholder = ( content ) => {
|
|
333
|
+
return (
|
|
334
|
+
<Placeholder
|
|
335
|
+
className={ classnames( 'block-editor-media-placeholder', {
|
|
336
|
+
[ borderProps.className ]:
|
|
337
|
+
!! borderProps.className && ! isSelected,
|
|
338
|
+
} ) }
|
|
339
|
+
withIllustration={ true }
|
|
340
|
+
icon={ icon }
|
|
341
|
+
label={ __( 'Image' ) }
|
|
342
|
+
instructions={ __(
|
|
343
|
+
'Upload an image file, pick one from your media library, or add one with a URL.'
|
|
344
|
+
) }
|
|
345
|
+
style={ isSelected ? undefined : borderProps.style }
|
|
346
|
+
>
|
|
347
|
+
{ content }
|
|
348
|
+
</Placeholder>
|
|
349
|
+
);
|
|
350
|
+
};
|
|
351
|
+
|
|
348
352
|
return (
|
|
349
353
|
<figure { ...blockProps }>
|
|
350
354
|
{ ( temporaryURL || url ) && (
|
package/src/image/editor.scss
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
border: none;
|
|
11
11
|
|
|
12
12
|
// Disable any duotone filter applied in the selected state.
|
|
13
|
-
filter: none;
|
|
13
|
+
filter: none !important;
|
|
14
14
|
|
|
15
15
|
// @todo: this should eventually be overridden by a custom border-radius set in the inspector.
|
|
16
16
|
border-radius: $radius-block-ui;
|