@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
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
getEditorHtml,
|
|
9
9
|
render,
|
|
10
10
|
waitFor,
|
|
11
|
+
setupApiFetch,
|
|
11
12
|
} from 'test/helpers';
|
|
12
13
|
import { Image } from 'react-native';
|
|
13
14
|
import Clipboard from '@react-native-clipboard/clipboard';
|
|
@@ -22,9 +23,10 @@ import {
|
|
|
22
23
|
sendMediaUpload,
|
|
23
24
|
subscribeMediaUpload,
|
|
24
25
|
} from '@wordpress/react-native-bridge';
|
|
25
|
-
import { select } from '@wordpress/data';
|
|
26
|
+
import { select, dispatch } from '@wordpress/data';
|
|
26
27
|
import { store as editorStore } from '@wordpress/editor';
|
|
27
28
|
import { store as coreStore } from '@wordpress/core-data';
|
|
29
|
+
import apiFetch from '@wordpress/api-fetch';
|
|
28
30
|
import '@wordpress/jest-console';
|
|
29
31
|
|
|
30
32
|
/**
|
|
@@ -45,7 +47,15 @@ function mockGetMedia( media ) {
|
|
|
45
47
|
jest.spyOn( select( coreStore ), 'getMedia' ).mockReturnValue( media );
|
|
46
48
|
}
|
|
47
49
|
|
|
48
|
-
const
|
|
50
|
+
const FETCH_MEDIA = {
|
|
51
|
+
request: {
|
|
52
|
+
path: `/wp/v2/media/1?context=edit`,
|
|
53
|
+
},
|
|
54
|
+
response: {
|
|
55
|
+
source_url: 'https://cldup.com/cXyG__fTLN.jpg',
|
|
56
|
+
id: 1,
|
|
57
|
+
},
|
|
58
|
+
};
|
|
49
59
|
|
|
50
60
|
const clipboardPromise = Promise.resolve( '' );
|
|
51
61
|
Clipboard.getString.mockImplementation( () => clipboardPromise );
|
|
@@ -58,6 +68,18 @@ beforeAll( () => {
|
|
|
58
68
|
getSizeSpy.mockImplementation( ( _url, callback ) => callback( 300, 200 ) );
|
|
59
69
|
} );
|
|
60
70
|
|
|
71
|
+
beforeEach( () => {
|
|
72
|
+
// Mock media fetch requests
|
|
73
|
+
setupApiFetch( [ FETCH_MEDIA ] );
|
|
74
|
+
|
|
75
|
+
// Invalidate `getMedia` resolutions to allow requesting to the API the same media id
|
|
76
|
+
dispatch( coreStore ).invalidateResolutionForStoreSelector( 'getMedia' );
|
|
77
|
+
} );
|
|
78
|
+
|
|
79
|
+
afterEach( () => {
|
|
80
|
+
apiFetch.mockReset();
|
|
81
|
+
} );
|
|
82
|
+
|
|
61
83
|
afterAll( () => {
|
|
62
84
|
getBlockTypes().forEach( ( { name } ) => {
|
|
63
85
|
unregisterBlockType( name );
|
|
@@ -78,8 +100,8 @@ describe( 'Image Block', () => {
|
|
|
78
100
|
<figcaption class="wp-element-caption">Mountain</figcaption></figure>
|
|
79
101
|
<!-- /wp:image -->`;
|
|
80
102
|
const screen = await initializeEditor( { initialHtml } );
|
|
81
|
-
//
|
|
82
|
-
|
|
103
|
+
// Check that image is fetched via `getMedia`
|
|
104
|
+
expect( apiFetch ).toHaveBeenCalledWith( FETCH_MEDIA.request );
|
|
83
105
|
|
|
84
106
|
const [ imageBlock ] = screen.getAllByLabelText( /Image Block/ );
|
|
85
107
|
fireEvent.press( imageBlock );
|
|
@@ -105,8 +127,8 @@ describe( 'Image Block', () => {
|
|
|
105
127
|
<figcaption class="wp-element-caption">Mountain</figcaption></figure>
|
|
106
128
|
<!-- /wp:image -->`;
|
|
107
129
|
const screen = await initializeEditor( { initialHtml } );
|
|
108
|
-
//
|
|
109
|
-
|
|
130
|
+
// Check that image is fetched via `getMedia`
|
|
131
|
+
expect( apiFetch ).toHaveBeenCalledWith( FETCH_MEDIA.request );
|
|
110
132
|
|
|
111
133
|
const [ imageBlock ] = screen.getAllByLabelText( /Image Block/ );
|
|
112
134
|
fireEvent.press( imageBlock );
|
|
@@ -132,8 +154,8 @@ describe( 'Image Block', () => {
|
|
|
132
154
|
<figcaption class="wp-element-caption">Mountain</figcaption></figure>
|
|
133
155
|
<!-- /wp:image -->`;
|
|
134
156
|
const screen = await initializeEditor( { initialHtml } );
|
|
135
|
-
//
|
|
136
|
-
|
|
157
|
+
// Check that image is fetched via `getMedia`
|
|
158
|
+
expect( apiFetch ).toHaveBeenCalledWith( FETCH_MEDIA.request );
|
|
137
159
|
|
|
138
160
|
const [ imageBlock ] = screen.getAllByLabelText( /Image Block/ );
|
|
139
161
|
fireEvent.press( imageBlock );
|
|
@@ -169,8 +191,8 @@ describe( 'Image Block', () => {
|
|
|
169
191
|
<figcaption class="wp-element-caption">Mountain</figcaption></figure>
|
|
170
192
|
<!-- /wp:image -->`;
|
|
171
193
|
const screen = await initializeEditor( { initialHtml } );
|
|
172
|
-
//
|
|
173
|
-
|
|
194
|
+
// Check that image is fetched via `getMedia`
|
|
195
|
+
expect( apiFetch ).toHaveBeenCalledWith( FETCH_MEDIA.request );
|
|
174
196
|
|
|
175
197
|
const [ imageBlock ] = screen.getAllByLabelText( /Image Block/ );
|
|
176
198
|
fireEvent.press( imageBlock );
|
|
@@ -211,8 +233,8 @@ describe( 'Image Block', () => {
|
|
|
211
233
|
<figcaption class="wp-element-caption">Mountain</figcaption></figure>
|
|
212
234
|
<!-- /wp:image -->`;
|
|
213
235
|
const screen = await initializeEditor( { initialHtml } );
|
|
214
|
-
//
|
|
215
|
-
|
|
236
|
+
// Check that image is not fetched via `getMedia` due to the presence of query parameters in the URL.
|
|
237
|
+
expect( apiFetch ).not.toHaveBeenCalledWith( FETCH_MEDIA.request );
|
|
216
238
|
|
|
217
239
|
const [ imageBlock ] = screen.getAllByLabelText( /Image Block/ );
|
|
218
240
|
fireEvent.press( imageBlock );
|
|
@@ -236,8 +258,8 @@ describe( 'Image Block', () => {
|
|
|
236
258
|
<figcaption class="wp-element-caption">Mountain</figcaption></figure>
|
|
237
259
|
<!-- /wp:image -->`;
|
|
238
260
|
const screen = await initializeEditor( { initialHtml } );
|
|
239
|
-
//
|
|
240
|
-
|
|
261
|
+
// Check that image is fetched via `getMedia`
|
|
262
|
+
expect( apiFetch ).toHaveBeenCalledWith( FETCH_MEDIA.request );
|
|
241
263
|
|
|
242
264
|
const [ imageBlock ] = screen.getAllByLabelText( /Image Block/ );
|
|
243
265
|
fireEvent.press( imageBlock );
|
|
@@ -267,8 +289,8 @@ describe( 'Image Block', () => {
|
|
|
267
289
|
</figure>
|
|
268
290
|
<!-- /wp:image -->`;
|
|
269
291
|
const screen = await initializeEditor( { initialHtml } );
|
|
270
|
-
//
|
|
271
|
-
|
|
292
|
+
// Check that image is fetched via `getMedia`
|
|
293
|
+
expect( apiFetch ).toHaveBeenCalledWith( FETCH_MEDIA.request );
|
|
272
294
|
|
|
273
295
|
const [ imageBlock ] = screen.getAllByLabelText( /Image Block/ );
|
|
274
296
|
fireEvent.press( imageBlock );
|
package/src/index.js
CHANGED
|
@@ -46,8 +46,6 @@ import * as commentsPaginationNumbers from './comments-pagination-numbers';
|
|
|
46
46
|
import * as commentsTitle from './comments-title';
|
|
47
47
|
import * as cover from './cover';
|
|
48
48
|
import * as details from './details';
|
|
49
|
-
import * as detailsContent from './details-content';
|
|
50
|
-
import * as detailsSummary from './details-summary';
|
|
51
49
|
import * as embed from './embed';
|
|
52
50
|
import * as file from './file';
|
|
53
51
|
import * as gallery from './gallery';
|
|
@@ -230,8 +228,6 @@ const getAllBlocks = () => {
|
|
|
230
228
|
];
|
|
231
229
|
if ( window?.__experimentalEnableDetailsBlocks ) {
|
|
232
230
|
blocks.push( details );
|
|
233
|
-
blocks.push( detailsContent );
|
|
234
|
-
blocks.push( detailsSummary );
|
|
235
231
|
}
|
|
236
232
|
return blocks.filter( Boolean );
|
|
237
233
|
};
|
package/src/index.native.js
CHANGED
|
@@ -88,6 +88,7 @@ export const coreBlocks = [
|
|
|
88
88
|
column,
|
|
89
89
|
cover,
|
|
90
90
|
embed,
|
|
91
|
+
group,
|
|
91
92
|
file,
|
|
92
93
|
html,
|
|
93
94
|
mediaText,
|
|
@@ -261,10 +262,14 @@ export const registerCoreBlocks = () => {
|
|
|
261
262
|
* than 0, a "new" badge is displayed on the block type within the block
|
|
262
263
|
* inserter.
|
|
263
264
|
*
|
|
265
|
+
* With the below example, the Audio block will be displayed as "new" until its
|
|
266
|
+
* impression count reaches 0, which occurs by various actions decrementing
|
|
267
|
+
* the impression count.
|
|
268
|
+
*
|
|
269
|
+
* {
|
|
270
|
+
* [ audio.name ]: 40
|
|
271
|
+
* }
|
|
272
|
+
*
|
|
264
273
|
* @constant {{ string, number }}
|
|
265
274
|
*/
|
|
266
|
-
export const NEW_BLOCK_TYPES = {
|
|
267
|
-
[ embed.name ]: 40,
|
|
268
|
-
[ search.name ]: 40,
|
|
269
|
-
[ audio.name ]: 40,
|
|
270
|
-
};
|
|
275
|
+
export const NEW_BLOCK_TYPES = {};
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
selectRangeInRichText,
|
|
6
|
+
typeInRichText,
|
|
7
7
|
fireEvent,
|
|
8
8
|
getEditorHtml,
|
|
9
9
|
initializeEditor,
|
|
@@ -79,7 +79,7 @@ describe( 'List block', () => {
|
|
|
79
79
|
|
|
80
80
|
const listItemField =
|
|
81
81
|
within( listBlock ).getByPlaceholderText( 'List' );
|
|
82
|
-
|
|
82
|
+
typeInRichText( listItemField, 'First list item' );
|
|
83
83
|
|
|
84
84
|
expect( getEditorHtml() ).toMatchSnapshot();
|
|
85
85
|
} );
|
|
@@ -347,7 +347,7 @@ describe( 'List block', () => {
|
|
|
347
347
|
// backward delete
|
|
348
348
|
const listItemField =
|
|
349
349
|
within( listItemBlock ).getByLabelText( /Text input. .*Two.*/ );
|
|
350
|
-
|
|
350
|
+
selectRangeInRichText( listItemField, 0 );
|
|
351
351
|
fireEvent( listItemField, 'onKeyDown', {
|
|
352
352
|
nativeEvent: {},
|
|
353
353
|
preventDefault() {},
|
|
@@ -395,7 +395,7 @@ describe( 'List block', () => {
|
|
|
395
395
|
// backward delete
|
|
396
396
|
const listItemField =
|
|
397
397
|
within( listItemBlock ).getByLabelText( /Text input. .*One.*/ );
|
|
398
|
-
|
|
398
|
+
selectRangeInRichText( listItemField, 0 );
|
|
399
399
|
fireEvent( listItemField, 'onKeyDown', {
|
|
400
400
|
nativeEvent: {},
|
|
401
401
|
preventDefault() {},
|
|
@@ -406,11 +406,11 @@ describe( 'List block', () => {
|
|
|
406
406
|
"<!-- wp:paragraph -->
|
|
407
407
|
<p>A quick brown fox.</p>
|
|
408
408
|
<!-- /wp:paragraph -->
|
|
409
|
-
|
|
409
|
+
|
|
410
410
|
<!-- wp:paragraph -->
|
|
411
411
|
<p>One</p>
|
|
412
412
|
<!-- /wp:paragraph -->
|
|
413
|
-
|
|
413
|
+
|
|
414
414
|
<!-- wp:list -->
|
|
415
415
|
<ul><!-- wp:list-item -->
|
|
416
416
|
<li>Two</li>
|
package/src/loginout/block.json
CHANGED
|
@@ -21,7 +21,17 @@
|
|
|
21
21
|
"anchor": true,
|
|
22
22
|
"className": true,
|
|
23
23
|
"typography": {
|
|
24
|
-
"fontSize":
|
|
24
|
+
"fontSize": true,
|
|
25
|
+
"lineHeight": true,
|
|
26
|
+
"__experimentalFontFamily": true,
|
|
27
|
+
"__experimentalFontWeight": true,
|
|
28
|
+
"__experimentalFontStyle": true,
|
|
29
|
+
"__experimentalTextTransform": true,
|
|
30
|
+
"__experimentalTextDecoration": true,
|
|
31
|
+
"__experimentalLetterSpacing": true,
|
|
32
|
+
"__experimentalDefaultControls": {
|
|
33
|
+
"fontSize": true
|
|
34
|
+
}
|
|
25
35
|
}
|
|
26
36
|
}
|
|
27
37
|
}
|
package/src/media-text/edit.js
CHANGED
|
@@ -143,6 +143,7 @@ function MediaTextEdit( { attributes, isSelected, setAttributes, clientId } ) {
|
|
|
143
143
|
mediaWidth,
|
|
144
144
|
rel,
|
|
145
145
|
verticalAlignment,
|
|
146
|
+
allowedBlocks,
|
|
146
147
|
} = attributes;
|
|
147
148
|
const mediaSizeSlug = attributes.mediaSizeSlug || DEFAULT_MEDIA_SIZE_SLUG;
|
|
148
149
|
|
|
@@ -315,7 +316,7 @@ function MediaTextEdit( { attributes, isSelected, setAttributes, clientId } ) {
|
|
|
315
316
|
|
|
316
317
|
const innerBlocksProps = useInnerBlocksProps(
|
|
317
318
|
{ className: 'wp-block-media-text__content' },
|
|
318
|
-
{ template: TEMPLATE }
|
|
319
|
+
{ template: TEMPLATE, allowedBlocks }
|
|
319
320
|
);
|
|
320
321
|
|
|
321
322
|
return (
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const DEFAULT_BLOCK = {
|
|
2
|
+
name: 'core/navigation-link',
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
export const ALLOWED_BLOCKS = [
|
|
6
|
+
'core/navigation-link',
|
|
7
|
+
'core/search',
|
|
8
|
+
'core/social-links',
|
|
9
|
+
'core/page-list',
|
|
10
|
+
'core/spacer',
|
|
11
|
+
'core/home-link',
|
|
12
|
+
'core/site-title',
|
|
13
|
+
'core/site-logo',
|
|
14
|
+
'core/navigation-submenu',
|
|
15
|
+
'core/loginout',
|
|
16
|
+
];
|
|
@@ -27,9 +27,9 @@ import {
|
|
|
27
27
|
__experimentalUseBlockOverlayActive as useBlockOverlayActive,
|
|
28
28
|
__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,
|
|
29
29
|
} from '@wordpress/block-editor';
|
|
30
|
-
import { EntityProvider } from '@wordpress/core-data';
|
|
30
|
+
import { EntityProvider, store as coreStore } from '@wordpress/core-data';
|
|
31
31
|
|
|
32
|
-
import { useDispatch } from '@wordpress/data';
|
|
32
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
33
33
|
import {
|
|
34
34
|
PanelBody,
|
|
35
35
|
ToggleControl,
|
|
@@ -40,7 +40,6 @@ import {
|
|
|
40
40
|
} from '@wordpress/components';
|
|
41
41
|
import { __, sprintf } from '@wordpress/i18n';
|
|
42
42
|
import { speak } from '@wordpress/a11y';
|
|
43
|
-
import { createBlock } from '@wordpress/blocks';
|
|
44
43
|
import { close, Icon } from '@wordpress/icons';
|
|
45
44
|
|
|
46
45
|
/**
|
|
@@ -87,7 +86,6 @@ function Navigation( {
|
|
|
87
86
|
// These props are used by the navigation editor to override specific
|
|
88
87
|
// navigation block settings.
|
|
89
88
|
hasSubmenuIndicatorSetting = true,
|
|
90
|
-
hasColorSettings = true,
|
|
91
89
|
customPlaceholder: CustomPlaceholder = null,
|
|
92
90
|
} ) {
|
|
93
91
|
const {
|
|
@@ -118,8 +116,7 @@ function Navigation( {
|
|
|
118
116
|
|
|
119
117
|
// Preload classic menus, so that they don't suddenly pop-in when viewing
|
|
120
118
|
// the Select Menu dropdown.
|
|
121
|
-
const { menus: classicMenus
|
|
122
|
-
useNavigationEntities();
|
|
119
|
+
const { menus: classicMenus } = useNavigationEntities();
|
|
123
120
|
|
|
124
121
|
const [ showNavigationMenuStatusNotice, hideNavigationMenuStatusNotice ] =
|
|
125
122
|
useNavigationNotice( {
|
|
@@ -178,7 +175,6 @@ function Navigation( {
|
|
|
178
175
|
hasResolvedNavigationMenus,
|
|
179
176
|
isNavigationMenuResolved,
|
|
180
177
|
isNavigationMenuMissing,
|
|
181
|
-
navigationMenus,
|
|
182
178
|
canUserUpdateNavigationMenu,
|
|
183
179
|
hasResolvedCanUserUpdateNavigationMenu,
|
|
184
180
|
canUserDeleteNavigationMenu,
|
|
@@ -200,12 +196,6 @@ function Navigation( {
|
|
|
200
196
|
const isConvertingClassicMenu =
|
|
201
197
|
classicMenuConversionStatus === CLASSIC_MENU_CONVERSION_PENDING;
|
|
202
198
|
|
|
203
|
-
// Only auto-fallback to the latest published menu.
|
|
204
|
-
// The REST API already returns items sorted by publishing date.
|
|
205
|
-
const fallbackNavigationMenuId = navigationMenus?.find(
|
|
206
|
-
( menu ) => menu.status === 'publish'
|
|
207
|
-
)?.id;
|
|
208
|
-
|
|
209
199
|
const handleUpdateMenu = useCallback(
|
|
210
200
|
( menuId, options = { focusNavigationBlock: false } ) => {
|
|
211
201
|
const { focusNavigationBlock } = options;
|
|
@@ -217,41 +207,6 @@ function Navigation( {
|
|
|
217
207
|
[ selectBlock, clientId, setRef ]
|
|
218
208
|
);
|
|
219
209
|
|
|
220
|
-
// Attempt to retrieve and prioritize any existing navigation menu unless:
|
|
221
|
-
// - the are uncontrolled inner blocks already present in the block.
|
|
222
|
-
// - the user is creating a new menu.
|
|
223
|
-
// - there are no menus to choose from.
|
|
224
|
-
// This attempts to pick the first menu if there is a single Navigation Post. If more
|
|
225
|
-
// than 1 exists then use the most recent.
|
|
226
|
-
// The aim is for the block to "just work" from a user perspective using existing data.
|
|
227
|
-
useEffect( () => {
|
|
228
|
-
if (
|
|
229
|
-
hasUncontrolledInnerBlocks ||
|
|
230
|
-
isCreatingNavigationMenu ||
|
|
231
|
-
ref ||
|
|
232
|
-
! fallbackNavigationMenuId
|
|
233
|
-
) {
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* This fallback displays (both in editor and on front)
|
|
239
|
-
* a list of pages only if no menu (user assigned or
|
|
240
|
-
* automatically picked) is available.
|
|
241
|
-
* The fallback should not request a save (entity dirty state)
|
|
242
|
-
* nor to be undoable, hence why it is marked as non persistent
|
|
243
|
-
*/
|
|
244
|
-
__unstableMarkNextChangeAsNotPersistent();
|
|
245
|
-
setRef( fallbackNavigationMenuId );
|
|
246
|
-
}, [
|
|
247
|
-
ref,
|
|
248
|
-
setRef,
|
|
249
|
-
isCreatingNavigationMenu,
|
|
250
|
-
fallbackNavigationMenuId,
|
|
251
|
-
hasUncontrolledInnerBlocks,
|
|
252
|
-
__unstableMarkNextChangeAsNotPersistent,
|
|
253
|
-
] );
|
|
254
|
-
|
|
255
210
|
const isEntityAvailable =
|
|
256
211
|
! isNavigationMenuMissing && isNavigationMenuResolved;
|
|
257
212
|
|
|
@@ -263,55 +218,35 @@ function Navigation( {
|
|
|
263
218
|
// that automatically saves the menu as an entity when changes are made to the inner blocks.
|
|
264
219
|
const hasUnsavedBlocks = hasUncontrolledInnerBlocks && ! isEntityAvailable;
|
|
265
220
|
|
|
221
|
+
const { getNavigationFallbackId } = useSelect( coreStore );
|
|
222
|
+
|
|
223
|
+
const navigationFallbackId = ! ( ref || hasUnsavedBlocks )
|
|
224
|
+
? getNavigationFallbackId()
|
|
225
|
+
: null;
|
|
226
|
+
|
|
266
227
|
useEffect( () => {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
fallbackNavigationMenuId ||
|
|
273
|
-
hasUnsavedBlocks ||
|
|
274
|
-
! classicMenus?.length
|
|
275
|
-
) {
|
|
228
|
+
// If:
|
|
229
|
+
// - there is an existing menu, OR
|
|
230
|
+
// - there are existing (uncontrolled) inner blocks
|
|
231
|
+
// ...then don't request a fallback menu.
|
|
232
|
+
if ( ref || hasUnsavedBlocks || ! navigationFallbackId ) {
|
|
276
233
|
return;
|
|
277
234
|
}
|
|
278
235
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
( classicMenu ) =>
|
|
285
|
-
classicMenu.locations.includes( 'primary' ) ||
|
|
286
|
-
classicMenu.slug === 'primary'
|
|
287
|
-
);
|
|
236
|
+
/**
|
|
237
|
+
* This fallback displays (both in editor and on front)
|
|
238
|
+
* The fallback should not request a save (entity dirty state)
|
|
239
|
+
* nor to be undoable, hence why it is marked as non persistent
|
|
240
|
+
*/
|
|
288
241
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
primaryMenus[ 0 ].id,
|
|
292
|
-
primaryMenus[ 0 ].name,
|
|
293
|
-
'publish'
|
|
294
|
-
);
|
|
295
|
-
} else {
|
|
296
|
-
classicMenus.sort( ( a, b ) => {
|
|
297
|
-
return b.id - a.id;
|
|
298
|
-
} );
|
|
299
|
-
convertClassicMenu(
|
|
300
|
-
classicMenus[ 0 ].id,
|
|
301
|
-
classicMenus[ 0 ].name,
|
|
302
|
-
'publish'
|
|
303
|
-
);
|
|
304
|
-
}
|
|
242
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
243
|
+
setRef( navigationFallbackId );
|
|
305
244
|
}, [
|
|
306
|
-
hasResolvedClassicMenus,
|
|
307
|
-
hasResolvedNavigationMenus,
|
|
308
|
-
hasUnsavedBlocks,
|
|
309
|
-
classicMenus,
|
|
310
|
-
convertClassicMenu,
|
|
311
|
-
createNavigationMenu,
|
|
312
|
-
fallbackNavigationMenuId,
|
|
313
|
-
isConvertingClassicMenu,
|
|
314
245
|
ref,
|
|
246
|
+
setRef,
|
|
247
|
+
hasUnsavedBlocks,
|
|
248
|
+
navigationFallbackId,
|
|
249
|
+
__unstableMarkNextChangeAsNotPersistent,
|
|
315
250
|
] );
|
|
316
251
|
|
|
317
252
|
const navRef = useRef();
|
|
@@ -332,25 +267,6 @@ function Navigation( {
|
|
|
332
267
|
classicMenus?.length === 0 &&
|
|
333
268
|
! hasUncontrolledInnerBlocks;
|
|
334
269
|
|
|
335
|
-
useEffect( () => {
|
|
336
|
-
if ( isPlaceholder ) {
|
|
337
|
-
/**
|
|
338
|
-
* this fallback only displays (both in editor and on front)
|
|
339
|
-
* the list of pages block if no menu is available as a fallback.
|
|
340
|
-
* We don't want the fallback to request a save,
|
|
341
|
-
* nor to be undoable, hence we mark it non persistent.
|
|
342
|
-
*/
|
|
343
|
-
__unstableMarkNextChangeAsNotPersistent();
|
|
344
|
-
replaceInnerBlocks( clientId, [ createBlock( 'core/page-list' ) ] );
|
|
345
|
-
}
|
|
346
|
-
}, [
|
|
347
|
-
clientId,
|
|
348
|
-
isPlaceholder,
|
|
349
|
-
ref,
|
|
350
|
-
__unstableMarkNextChangeAsNotPersistent,
|
|
351
|
-
replaceInnerBlocks,
|
|
352
|
-
] );
|
|
353
|
-
|
|
354
270
|
// "loading" state:
|
|
355
271
|
// - there is a menu creation process in progress.
|
|
356
272
|
// - there is a classic menu conversion process in progress.
|
|
@@ -662,60 +578,58 @@ function Navigation( {
|
|
|
662
578
|
</PanelBody>
|
|
663
579
|
) }
|
|
664
580
|
</InspectorControls>
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
) }
|
|
718
|
-
</InspectorControls>
|
|
581
|
+
{ colorGradientSettings.hasColorsOrGradients && (
|
|
582
|
+
<InspectorControls group="color">
|
|
583
|
+
<ColorGradientSettingsDropdown
|
|
584
|
+
__experimentalIsRenderedInSidebar
|
|
585
|
+
settings={ [
|
|
586
|
+
{
|
|
587
|
+
colorValue: textColor.color,
|
|
588
|
+
label: __( 'Text' ),
|
|
589
|
+
onColorChange: setTextColor,
|
|
590
|
+
resetAllFilter: () => setTextColor(),
|
|
591
|
+
},
|
|
592
|
+
{
|
|
593
|
+
colorValue: backgroundColor.color,
|
|
594
|
+
label: __( 'Background' ),
|
|
595
|
+
onColorChange: setBackgroundColor,
|
|
596
|
+
resetAllFilter: () => setBackgroundColor(),
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
colorValue: overlayTextColor.color,
|
|
600
|
+
label: __( 'Submenu & overlay text' ),
|
|
601
|
+
onColorChange: setOverlayTextColor,
|
|
602
|
+
resetAllFilter: () => setOverlayTextColor(),
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
colorValue: overlayBackgroundColor.color,
|
|
606
|
+
label: __( 'Submenu & overlay background' ),
|
|
607
|
+
onColorChange: setOverlayBackgroundColor,
|
|
608
|
+
resetAllFilter: () =>
|
|
609
|
+
setOverlayBackgroundColor(),
|
|
610
|
+
},
|
|
611
|
+
] }
|
|
612
|
+
panelId={ clientId }
|
|
613
|
+
{ ...colorGradientSettings }
|
|
614
|
+
gradients={ [] }
|
|
615
|
+
disableCustomGradients={ true }
|
|
616
|
+
/>
|
|
617
|
+
{ enableContrastChecking && (
|
|
618
|
+
<>
|
|
619
|
+
<ContrastChecker
|
|
620
|
+
backgroundColor={ detectedBackgroundColor }
|
|
621
|
+
textColor={ detectedColor }
|
|
622
|
+
/>
|
|
623
|
+
<ContrastChecker
|
|
624
|
+
backgroundColor={
|
|
625
|
+
detectedOverlayBackgroundColor
|
|
626
|
+
}
|
|
627
|
+
textColor={ detectedOverlayColor }
|
|
628
|
+
/>
|
|
629
|
+
</>
|
|
630
|
+
) }
|
|
631
|
+
</InspectorControls>
|
|
632
|
+
) }
|
|
719
633
|
</>
|
|
720
634
|
);
|
|
721
635
|
|
|
@@ -14,22 +14,7 @@ import { useMemo } from '@wordpress/element';
|
|
|
14
14
|
* Internal dependencies
|
|
15
15
|
*/
|
|
16
16
|
import PlaceholderPreview from './placeholder/placeholder-preview';
|
|
17
|
-
|
|
18
|
-
const ALLOWED_BLOCKS = [
|
|
19
|
-
'core/navigation-link',
|
|
20
|
-
'core/search',
|
|
21
|
-
'core/social-links',
|
|
22
|
-
'core/page-list',
|
|
23
|
-
'core/spacer',
|
|
24
|
-
'core/home-link',
|
|
25
|
-
'core/site-title',
|
|
26
|
-
'core/site-logo',
|
|
27
|
-
'core/navigation-submenu',
|
|
28
|
-
];
|
|
29
|
-
|
|
30
|
-
const DEFAULT_BLOCK = {
|
|
31
|
-
name: 'core/navigation-link',
|
|
32
|
-
};
|
|
17
|
+
import { DEFAULT_BLOCK, ALLOWED_BLOCKS } from '../constants';
|
|
33
18
|
|
|
34
19
|
export default function NavigationInnerBlocks( {
|
|
35
20
|
clientId,
|
|
@@ -12,6 +12,7 @@ import { useContext, useEffect, useRef, useMemo } from '@wordpress/element';
|
|
|
12
12
|
*/
|
|
13
13
|
import useNavigationMenu from '../use-navigation-menu';
|
|
14
14
|
import { areBlocksDirty } from './are-blocks-dirty';
|
|
15
|
+
import { DEFAULT_BLOCK, ALLOWED_BLOCKS } from '../constants';
|
|
15
16
|
|
|
16
17
|
const EMPTY_OBJECT = {};
|
|
17
18
|
const DRAFT_MENU_PARAMS = [
|
|
@@ -20,22 +21,6 @@ const DRAFT_MENU_PARAMS = [
|
|
|
20
21
|
{ status: 'draft', per_page: -1 },
|
|
21
22
|
];
|
|
22
23
|
|
|
23
|
-
const DEFAULT_BLOCK = {
|
|
24
|
-
name: 'core/navigation-link',
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const ALLOWED_BLOCKS = [
|
|
28
|
-
'core/navigation-link',
|
|
29
|
-
'core/search',
|
|
30
|
-
'core/social-links',
|
|
31
|
-
'core/page-list',
|
|
32
|
-
'core/spacer',
|
|
33
|
-
'core/home-link',
|
|
34
|
-
'core/site-title',
|
|
35
|
-
'core/site-logo',
|
|
36
|
-
'core/navigation-submenu',
|
|
37
|
-
];
|
|
38
|
-
|
|
39
24
|
export default function UnsavedInnerBlocks( {
|
|
40
25
|
blocks,
|
|
41
26
|
createNavigationMenu,
|