@wordpress/block-library 7.19.0 → 8.1.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 +8 -0
- package/build/audio/edit.native.js +1 -3
- package/build/audio/edit.native.js.map +1 -1
- package/build/audio/index.js +2 -1
- package/build/audio/index.js.map +1 -1
- package/build/avatar/edit.js +1 -0
- package/build/avatar/edit.js.map +1 -1
- package/build/avatar/user-control.js +1 -0
- package/build/avatar/user-control.js.map +1 -1
- package/build/block/edit.js +14 -2
- package/build/block/edit.js.map +1 -1
- package/build/block/edit.native.js +14 -6
- package/build/block/edit.native.js.map +1 -1
- package/build/block/index.js +1 -2
- package/build/block/index.js.map +1 -1
- package/build/button/edit.native.js.map +1 -1
- package/build/categories/edit.js +1 -1
- package/build/categories/edit.js.map +1 -1
- package/build/code/transforms.js +1 -1
- package/build/code/transforms.js.map +1 -1
- package/build/columns/edit.js +1 -0
- package/build/columns/edit.js.map +1 -1
- package/build/columns/edit.native.js +13 -30
- package/build/columns/edit.native.js.map +1 -1
- package/build/comment-author-avatar/edit.js +1 -0
- package/build/comment-author-avatar/edit.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +3 -1
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/cover/edit.native.js +24 -16
- package/build/cover/edit.native.js.map +1 -1
- package/build/embed/embed-controls.native.js +1 -0
- package/build/embed/embed-controls.native.js.map +1 -1
- package/build/embed/embed-preview.native.js +1 -3
- package/build/embed/embed-preview.native.js.map +1 -1
- package/build/file/inspector.js +1 -0
- package/build/file/inspector.js.map +1 -1
- package/build/freeform/edit.js +21 -6
- package/build/freeform/edit.js.map +1 -1
- package/build/freeform/modal.js +97 -0
- package/build/freeform/modal.js.map +1 -0
- package/build/gallery/edit.js +38 -15
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/gallery.js +2 -16
- package/build/gallery/gallery.js.map +1 -1
- package/build/gallery/gallery.native.js +1 -3
- package/build/gallery/gallery.native.js.map +1 -1
- package/build/gallery/shared.js +4 -10
- package/build/gallery/shared.js.map +1 -1
- package/build/gallery/transforms.js +1 -7
- package/build/gallery/transforms.js.map +1 -1
- package/build/gallery/use-get-media.js +1 -1
- package/build/gallery/use-get-media.js.map +1 -1
- package/build/gallery/use-get-media.native.js +3 -1
- package/build/gallery/use-get-media.native.js.map +1 -1
- package/build/gallery/v1/edit.js +22 -15
- package/build/gallery/v1/edit.js.map +1 -1
- package/build/gallery/v1/gallery.native.js +1 -3
- package/build/gallery/v1/gallery.native.js.map +1 -1
- package/build/gallery/v1/shared.js +4 -1
- package/build/gallery/v1/shared.js.map +1 -1
- package/build/group/edit.js +1 -2
- package/build/group/edit.js.map +1 -1
- package/build/group/index.js +3 -1
- package/build/group/index.js.map +1 -1
- package/build/group/placeholder.js +5 -26
- package/build/group/placeholder.js.map +1 -1
- package/build/heading/deprecated.js +152 -69
- package/build/heading/deprecated.js.map +1 -1
- package/build/heading/index.js +1 -2
- package/build/heading/index.js.map +1 -1
- package/build/heading/transforms.js +1 -2
- package/build/heading/transforms.js.map +1 -1
- package/build/html/index.js +1 -1
- package/build/image/edit.js +8 -5
- package/build/image/edit.js.map +1 -1
- package/build/image/edit.native.js +3 -2
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +13 -8
- package/build/image/image.js.map +1 -1
- package/build/index.js +3 -1
- package/build/index.js.map +1 -1
- package/build/latest-comments/edit.js +1 -0
- package/build/latest-comments/edit.js.map +1 -1
- package/build/latest-posts/edit.js +2 -0
- package/build/latest-posts/edit.js.map +1 -1
- package/build/list/transforms.js +1 -9
- package/build/list/transforms.js.map +1 -1
- package/build/list/utils.js +5 -2
- package/build/list/utils.js.map +1 -1
- package/build/list-item/index.js +4 -1
- package/build/list-item/index.js.map +1 -1
- package/build/list-item/transforms.js +22 -0
- package/build/list-item/transforms.js.map +1 -0
- package/build/list-item/utils.js +77 -1
- package/build/list-item/utils.js.map +1 -1
- package/build/media-text/edit.js +5 -2
- package/build/media-text/edit.js.map +1 -1
- package/build/missing/edit.native.js +2 -2
- package/build/missing/edit.native.js.map +1 -1
- package/build/navigation/edit/are-blocks-dirty.js +52 -0
- package/build/navigation/edit/are-blocks-dirty.js.map +1 -0
- package/build/navigation/edit/index.js +95 -117
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/menu-inspector-controls.js +94 -0
- package/build/navigation/edit/menu-inspector-controls.js.map +1 -0
- package/build/navigation/edit/navigation-menu-selector.js +2 -4
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build/navigation/edit/unsaved-inner-blocks.js +11 -7
- package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build/navigation/edit/utils.js +81 -0
- package/build/navigation/edit/utils.js.map +1 -1
- package/build/navigation/view-modal.js +6 -2
- package/build/navigation/view-modal.js.map +1 -1
- package/build/navigation-link/edit.js +46 -356
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-link/link-ui.js +222 -0
- package/build/navigation-link/link-ui.js.map +1 -0
- package/build/navigation-link/transforms.js +12 -0
- package/build/navigation-link/transforms.js.map +1 -1
- package/build/navigation-link/update-attributes.js +108 -0
- package/build/navigation-link/update-attributes.js.map +1 -0
- package/build/navigation-submenu/edit.js +49 -245
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/page-list/constants.js +15 -0
- package/build/page-list/constants.js.map +1 -0
- package/build/page-list/convert-to-links-modal.js +22 -86
- package/build/page-list/convert-to-links-modal.js.map +1 -1
- package/build/page-list/convert-to-navigation-links.js +76 -0
- package/build/page-list/convert-to-navigation-links.js.map +1 -0
- package/build/page-list/edit.js +143 -78
- package/build/page-list/edit.js.map +1 -1
- package/build/page-list/index.js +35 -3
- package/build/page-list/index.js.map +1 -1
- package/build/page-list-item/edit.js +91 -0
- package/build/page-list-item/edit.js.map +1 -0
- package/build/page-list-item/index.js +85 -0
- package/build/page-list-item/index.js.map +1 -0
- package/build/page-list-item/init.js +16 -0
- package/build/page-list-item/init.js.map +1 -0
- package/build/paragraph/index.js +1 -7
- package/build/paragraph/index.js.map +1 -1
- package/build/post-author/edit.js +3 -2
- package/build/post-author/edit.js.map +1 -1
- package/build/post-featured-image/overlay.js +1 -1
- package/build/post-featured-image/overlay.js.map +1 -1
- package/build/post-template/index.js +8 -0
- package/build/post-template/index.js.map +1 -1
- package/build/preformatted/transforms.js +3 -1
- package/build/preformatted/transforms.js.map +1 -1
- package/build/query/deprecated.js +192 -21
- package/build/query/deprecated.js.map +1 -1
- package/build/query/edit/index.js +2 -1
- package/build/query/edit/index.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +11 -5
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/inspector-controls/taxonomy-controls.js +101 -37
- package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build/query/edit/query-content.js +2 -3
- package/build/query/edit/query-content.js.map +1 -1
- package/build/query/edit/query-placeholder.js +16 -27
- package/build/query/edit/query-placeholder.js.map +1 -1
- package/build/query/index.js +0 -8
- package/build/query/index.js.map +1 -1
- package/build/query/utils.js +73 -9
- package/build/query/utils.js.map +1 -1
- package/build/rss/edit.js +3 -0
- package/build/rss/edit.js.map +1 -1
- package/build/search/edit.js +2 -2
- package/build/search/edit.js.map +1 -1
- package/build/search/edit.native.js +22 -22
- package/build/search/edit.native.js.map +1 -1
- package/build/search/index.js +9 -1
- package/build/search/index.js.map +1 -1
- package/build/site-logo/edit.js +17 -9
- package/build/site-logo/edit.js.map +1 -1
- package/build/site-logo/index.js +1 -0
- package/build/site-logo/index.js.map +1 -1
- package/build/site-title/index.js +1 -0
- package/build/site-title/index.js.map +1 -1
- package/build/social-link/edit.js.map +1 -1
- package/build/social-link/social-list.js +4 -12
- package/build/social-link/social-list.js.map +1 -1
- package/build/social-links/edit.js +0 -1
- package/build/social-links/edit.js.map +1 -1
- package/build/table/edit.js +3 -1
- package/build/table/edit.js.map +1 -1
- package/build/table/index.js +17 -1
- package/build/table/index.js.map +1 -1
- package/build/table/save.js +4 -2
- package/build/table/save.js.map +1 -1
- package/build/table/state.js +24 -12
- package/build/table/state.js.map +1 -1
- package/build/table/transforms.js +3 -2
- package/build/table/transforms.js.map +1 -1
- package/build/table-of-contents/edit.js +3 -3
- package/build/table-of-contents/edit.js.map +1 -1
- package/build/tag-cloud/edit.js +2 -1
- package/build/tag-cloud/edit.js.map +1 -1
- package/build/template-part/edit/advanced-controls.js +11 -1
- package/build/template-part/edit/advanced-controls.js.map +1 -1
- package/build/template-part/edit/import-controls.js +160 -0
- package/build/template-part/edit/import-controls.js.map +1 -0
- package/build/template-part/edit/index.js +2 -1
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/edit/selection-modal.js +5 -2
- package/build/template-part/edit/selection-modal.js.map +1 -1
- package/build/template-part/edit/utils/hooks.js +2 -6
- package/build/template-part/edit/utils/hooks.js.map +1 -1
- package/build/template-part/edit/utils/transformers.js +48 -0
- package/build/template-part/edit/utils/transformers.js.map +1 -0
- package/build/text-columns/edit.js +1 -0
- package/build/text-columns/edit.js.map +1 -1
- package/build/utils/transformation-categories.native.js +1 -1
- package/build/utils/transformation-categories.native.js.map +1 -1
- package/build/video/edit.js +1 -1
- package/build/video/edit.js.map +1 -1
- package/build/video/edit.native.js +1 -3
- package/build/video/edit.native.js.map +1 -1
- package/build-module/audio/edit.native.js +1 -2
- package/build-module/audio/edit.native.js.map +1 -1
- package/build-module/audio/index.js +2 -1
- package/build-module/audio/index.js.map +1 -1
- package/build-module/avatar/edit.js +1 -0
- package/build-module/avatar/edit.js.map +1 -1
- package/build-module/avatar/user-control.js +1 -0
- package/build-module/avatar/user-control.js.map +1 -1
- package/build-module/block/edit.js +14 -2
- package/build-module/block/edit.js.map +1 -1
- package/build-module/block/edit.native.js +14 -6
- package/build-module/block/edit.native.js.map +1 -1
- package/build-module/block/index.js +1 -2
- package/build-module/block/index.js.map +1 -1
- package/build-module/button/edit.native.js +2 -1
- package/build-module/button/edit.native.js.map +1 -1
- package/build-module/categories/edit.js +1 -1
- package/build-module/categories/edit.js.map +1 -1
- package/build-module/code/transforms.js +1 -1
- package/build-module/code/transforms.js.map +1 -1
- package/build-module/columns/edit.js +1 -0
- package/build-module/columns/edit.js.map +1 -1
- package/build-module/columns/edit.native.js +13 -29
- package/build-module/columns/edit.native.js.map +1 -1
- package/build-module/comment-author-avatar/edit.js +1 -0
- package/build-module/comment-author-avatar/edit.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +5 -3
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/cover/edit.native.js +22 -14
- package/build-module/cover/edit.native.js.map +1 -1
- package/build-module/embed/embed-controls.native.js +2 -1
- package/build-module/embed/embed-controls.native.js.map +1 -1
- package/build-module/embed/embed-preview.native.js +1 -2
- package/build-module/embed/embed-preview.native.js.map +1 -1
- package/build-module/file/inspector.js +1 -0
- package/build-module/file/inspector.js.map +1 -1
- package/build-module/freeform/edit.js +22 -8
- package/build-module/freeform/edit.js.map +1 -1
- package/build-module/freeform/modal.js +90 -0
- package/build-module/freeform/modal.js.map +1 -0
- package/build-module/gallery/edit.js +39 -15
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/gallery.js +3 -16
- package/build-module/gallery/gallery.js.map +1 -1
- package/build-module/gallery/gallery.native.js +1 -2
- package/build-module/gallery/gallery.native.js.map +1 -1
- package/build-module/gallery/shared.js +5 -11
- package/build-module/gallery/shared.js.map +1 -1
- package/build-module/gallery/transforms.js +1 -6
- package/build-module/gallery/transforms.js.map +1 -1
- package/build-module/gallery/use-get-media.js +1 -1
- package/build-module/gallery/use-get-media.js.map +1 -1
- package/build-module/gallery/use-get-media.native.js +3 -1
- package/build-module/gallery/use-get-media.native.js.map +1 -1
- package/build-module/gallery/v1/edit.js +23 -16
- package/build-module/gallery/v1/edit.js.map +1 -1
- package/build-module/gallery/v1/gallery.native.js +1 -2
- package/build-module/gallery/v1/gallery.native.js.map +1 -1
- package/build-module/gallery/v1/shared.js +5 -2
- package/build-module/gallery/v1/shared.js.map +1 -1
- package/build-module/group/edit.js +1 -3
- package/build-module/group/edit.js.map +1 -1
- package/build-module/group/index.js +3 -1
- package/build-module/group/index.js.map +1 -1
- package/build-module/group/placeholder.js +5 -26
- package/build-module/group/placeholder.js.map +1 -1
- package/build-module/heading/deprecated.js +152 -69
- package/build-module/heading/deprecated.js.map +1 -1
- package/build-module/heading/index.js +1 -2
- package/build-module/heading/index.js.map +1 -1
- package/build-module/heading/transforms.js +1 -2
- package/build-module/heading/transforms.js.map +1 -1
- package/build-module/html/index.js +1 -1
- package/build-module/image/edit.js +9 -6
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/edit.native.js +2 -1
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +14 -9
- package/build-module/image/image.js.map +1 -1
- package/build-module/index.js +2 -1
- package/build-module/index.js.map +1 -1
- package/build-module/latest-comments/edit.js +1 -0
- package/build-module/latest-comments/edit.js.map +1 -1
- package/build-module/latest-posts/edit.js +2 -0
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/list/transforms.js +1 -9
- package/build-module/list/transforms.js.map +1 -1
- package/build-module/list/utils.js +5 -2
- package/build-module/list/utils.js.map +1 -1
- package/build-module/list-item/index.js +3 -1
- package/build-module/list-item/index.js.map +1 -1
- package/build-module/list-item/transforms.js +13 -0
- package/build-module/list-item/transforms.js.map +1 -0
- package/build-module/list-item/utils.js +78 -1
- package/build-module/list-item/utils.js.map +1 -1
- package/build-module/media-text/edit.js +6 -3
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/missing/edit.native.js +2 -2
- package/build-module/missing/edit.native.js.map +1 -1
- package/build-module/navigation/edit/are-blocks-dirty.js +44 -0
- package/build-module/navigation/edit/are-blocks-dirty.js.map +1 -0
- package/build-module/navigation/edit/index.js +95 -118
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/menu-inspector-controls.js +80 -0
- package/build-module/navigation/edit/menu-inspector-controls.js.map +1 -0
- package/build-module/navigation/edit/navigation-menu-selector.js +2 -4
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/navigation/edit/unsaved-inner-blocks.js +9 -6
- package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build-module/navigation/edit/utils.js +75 -0
- package/build-module/navigation/edit/utils.js.map +1 -1
- package/build-module/navigation/view-modal.js +6 -2
- package/build-module/navigation/view-modal.js.map +1 -1
- package/build-module/navigation-link/edit.js +49 -357
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-link/link-ui.js +206 -0
- package/build-module/navigation-link/link-ui.js.map +1 -0
- package/build-module/navigation-link/transforms.js +12 -0
- package/build-module/navigation-link/transforms.js.map +1 -1
- package/build-module/navigation-link/update-attributes.js +97 -0
- package/build-module/navigation-link/update-attributes.js.map +1 -0
- package/build-module/navigation-submenu/edit.js +52 -246
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/page-list/constants.js +6 -0
- package/build-module/page-list/constants.js.map +1 -0
- package/build-module/page-list/convert-to-links-modal.js +20 -81
- package/build-module/page-list/convert-to-links-modal.js.map +1 -1
- package/build-module/page-list/convert-to-navigation-links.js +66 -0
- package/build-module/page-list/convert-to-navigation-links.js.map +1 -0
- package/build-module/page-list/edit.js +146 -82
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/page-list/index.js +36 -4
- package/build-module/page-list/index.js.map +1 -1
- package/build-module/page-list-item/edit.js +77 -0
- package/build-module/page-list-item/edit.js.map +1 -0
- package/build-module/page-list-item/index.js +68 -0
- package/build-module/page-list-item/index.js.map +1 -0
- package/build-module/page-list-item/init.js +6 -0
- package/build-module/page-list-item/init.js.map +1 -0
- package/build-module/paragraph/index.js +1 -7
- package/build-module/paragraph/index.js.map +1 -1
- package/build-module/post-author/edit.js +3 -2
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-featured-image/overlay.js +1 -1
- package/build-module/post-featured-image/overlay.js.map +1 -1
- package/build-module/post-template/index.js +8 -0
- package/build-module/post-template/index.js.map +1 -1
- package/build-module/preformatted/transforms.js +3 -1
- package/build-module/preformatted/transforms.js.map +1 -1
- package/build-module/query/deprecated.js +185 -21
- package/build-module/query/deprecated.js.map +1 -1
- package/build-module/query/edit/index.js +2 -1
- package/build-module/query/edit/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +11 -5
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js +99 -35
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build-module/query/edit/query-content.js +1 -1
- package/build-module/query/edit/query-content.js.map +1 -1
- package/build-module/query/edit/query-placeholder.js +15 -27
- package/build-module/query/edit/query-placeholder.js.map +1 -1
- package/build-module/query/index.js +0 -8
- package/build-module/query/index.js.map +1 -1
- package/build-module/query/utils.js +69 -8
- package/build-module/query/utils.js.map +1 -1
- package/build-module/rss/edit.js +3 -0
- package/build-module/rss/edit.js.map +1 -1
- package/build-module/search/edit.js +2 -2
- package/build-module/search/edit.js.map +1 -1
- package/build-module/search/edit.native.js +20 -20
- package/build-module/search/edit.native.js.map +1 -1
- package/build-module/search/index.js +8 -1
- package/build-module/search/index.js.map +1 -1
- package/build-module/site-logo/edit.js +17 -8
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/site-logo/index.js +1 -0
- package/build-module/site-logo/index.js.map +1 -1
- package/build-module/site-title/index.js +1 -0
- package/build-module/site-title/index.js.map +1 -1
- package/build-module/social-link/edit.js +2 -2
- package/build-module/social-link/edit.js.map +1 -1
- package/build-module/social-link/social-list.js +2 -11
- package/build-module/social-link/social-list.js.map +1 -1
- package/build-module/social-links/edit.js +0 -1
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/table/edit.js +3 -1
- package/build-module/table/edit.js.map +1 -1
- package/build-module/table/index.js +17 -1
- package/build-module/table/index.js.map +1 -1
- package/build-module/table/save.js +4 -2
- package/build-module/table/save.js.map +1 -1
- package/build-module/table/state.js +25 -13
- package/build-module/table/state.js.map +1 -1
- package/build-module/table/transforms.js +3 -2
- package/build-module/table/transforms.js.map +1 -1
- package/build-module/table-of-contents/edit.js +3 -3
- package/build-module/table-of-contents/edit.js.map +1 -1
- package/build-module/tag-cloud/edit.js +3 -2
- package/build-module/tag-cloud/edit.js.map +1 -1
- package/build-module/template-part/edit/advanced-controls.js +10 -1
- package/build-module/template-part/edit/advanced-controls.js.map +1 -1
- package/build-module/template-part/edit/import-controls.js +146 -0
- package/build-module/template-part/edit/import-controls.js.map +1 -0
- 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/selection-modal.js +6 -3
- package/build-module/template-part/edit/selection-modal.js.map +1 -1
- package/build-module/template-part/edit/utils/hooks.js +3 -7
- package/build-module/template-part/edit/utils/hooks.js.map +1 -1
- package/build-module/template-part/edit/utils/transformers.js +40 -0
- package/build-module/template-part/edit/utils/transformers.js.map +1 -0
- package/build-module/text-columns/edit.js +1 -0
- package/build-module/text-columns/edit.js.map +1 -1
- package/build-module/utils/transformation-categories.native.js +1 -1
- package/build-module/utils/transformation-categories.native.js.map +1 -1
- package/build-module/video/edit.js +1 -1
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/edit.native.js +1 -2
- package/build-module/video/edit.native.js.map +1 -1
- package/build-style/archives/editor-rtl.css +15 -3
- package/build-style/archives/editor.css +15 -3
- package/build-style/archives/style-rtl.css +15 -3
- package/build-style/archives/style.css +15 -3
- package/build-style/audio/editor-rtl.css +15 -3
- package/build-style/audio/editor.css +15 -3
- package/build-style/audio/style-rtl.css +15 -3
- package/build-style/audio/style.css +15 -3
- package/build-style/audio/theme-rtl.css +15 -3
- package/build-style/audio/theme.css +15 -3
- package/build-style/avatar/editor-rtl.css +15 -3
- package/build-style/avatar/editor.css +15 -3
- package/build-style/avatar/style-rtl.css +15 -3
- package/build-style/avatar/style.css +15 -3
- package/build-style/block/editor-rtl.css +25 -3
- package/build-style/block/editor.css +25 -3
- package/build-style/button/editor-rtl.css +15 -3
- package/build-style/button/editor.css +15 -3
- package/build-style/button/style-rtl.css +15 -3
- package/build-style/button/style.css +15 -3
- package/build-style/buttons/editor-rtl.css +15 -3
- package/build-style/buttons/editor.css +15 -3
- package/build-style/buttons/style-rtl.css +15 -3
- package/build-style/buttons/style.css +15 -3
- package/build-style/calendar/style-rtl.css +15 -3
- package/build-style/calendar/style.css +15 -3
- package/build-style/categories/editor-rtl.css +15 -3
- package/build-style/categories/editor.css +15 -3
- package/build-style/categories/style-rtl.css +15 -3
- package/build-style/categories/style.css +15 -3
- package/build-style/classic-rtl.css +15 -3
- package/build-style/classic.css +15 -3
- package/build-style/code/editor-rtl.css +15 -3
- package/build-style/code/editor.css +15 -3
- package/build-style/code/style-rtl.css +15 -3
- package/build-style/code/style.css +15 -3
- package/build-style/code/theme-rtl.css +15 -3
- package/build-style/code/theme.css +15 -3
- package/build-style/columns/editor-rtl.css +15 -3
- package/build-style/columns/editor.css +15 -3
- package/build-style/columns/style-rtl.css +15 -3
- package/build-style/columns/style.css +15 -3
- package/build-style/comment-author-avatar/editor-rtl.css +15 -3
- package/build-style/comment-author-avatar/editor.css +15 -3
- package/build-style/comment-content/style-rtl.css +15 -3
- package/build-style/comment-content/style.css +15 -3
- package/build-style/comment-template/style-rtl.css +15 -3
- package/build-style/comment-template/style.css +15 -3
- package/build-style/comments/editor-rtl.css +15 -3
- package/build-style/comments/editor.css +15 -3
- package/build-style/comments/style-rtl.css +15 -3
- package/build-style/comments/style.css +15 -3
- package/build-style/comments-pagination/editor-rtl.css +15 -3
- package/build-style/comments-pagination/editor.css +15 -3
- package/build-style/comments-pagination/style-rtl.css +15 -3
- package/build-style/comments-pagination/style.css +15 -3
- package/build-style/comments-pagination-numbers/editor-rtl.css +15 -3
- package/build-style/comments-pagination-numbers/editor.css +15 -3
- package/build-style/comments-title/editor-rtl.css +15 -3
- package/build-style/comments-title/editor.css +15 -3
- package/build-style/common-rtl.css +20 -4
- package/build-style/common.css +20 -4
- package/build-style/cover/editor-rtl.css +15 -3
- package/build-style/cover/editor.css +15 -3
- package/build-style/cover/style-rtl.css +17 -4
- package/build-style/cover/style.css +17 -4
- package/build-style/editor-elements-rtl.css +15 -3
- package/build-style/editor-elements.css +15 -3
- package/build-style/editor-rtl.css +46 -29
- package/build-style/editor.css +46 -29
- package/build-style/elements-rtl.css +15 -3
- package/build-style/elements.css +15 -3
- package/build-style/embed/editor-rtl.css +15 -3
- package/build-style/embed/editor.css +15 -3
- package/build-style/embed/style-rtl.css +15 -3
- package/build-style/embed/style.css +15 -3
- package/build-style/embed/theme-rtl.css +15 -3
- package/build-style/embed/theme.css +15 -3
- package/build-style/file/editor-rtl.css +15 -3
- package/build-style/file/editor.css +15 -3
- package/build-style/file/style-rtl.css +15 -3
- package/build-style/file/style.css +15 -3
- package/build-style/freeform/editor-rtl.css +15 -3
- package/build-style/freeform/editor.css +15 -3
- package/build-style/gallery/editor-rtl.css +16 -4
- package/build-style/gallery/editor.css +16 -4
- package/build-style/gallery/style-rtl.css +19 -5
- package/build-style/gallery/style.css +19 -5
- package/build-style/gallery/theme-rtl.css +15 -3
- package/build-style/gallery/theme.css +15 -3
- package/build-style/group/editor-rtl.css +15 -3
- package/build-style/group/editor.css +15 -3
- package/build-style/group/style-rtl.css +15 -3
- package/build-style/group/style.css +15 -3
- package/build-style/group/theme-rtl.css +15 -3
- package/build-style/group/theme.css +15 -3
- package/build-style/heading/style-rtl.css +15 -3
- package/build-style/heading/style.css +15 -3
- package/build-style/html/editor-rtl.css +15 -3
- package/build-style/html/editor.css +15 -3
- package/build-style/image/editor-rtl.css +15 -12
- package/build-style/image/editor.css +15 -12
- package/build-style/image/style-rtl.css +15 -3
- package/build-style/image/style.css +15 -3
- package/build-style/image/theme-rtl.css +15 -3
- package/build-style/image/theme.css +15 -3
- package/build-style/latest-comments/style-rtl.css +15 -3
- package/build-style/latest-comments/style.css +15 -3
- package/build-style/latest-posts/editor-rtl.css +15 -3
- package/build-style/latest-posts/editor.css +15 -3
- package/build-style/latest-posts/style-rtl.css +15 -3
- package/build-style/latest-posts/style.css +15 -3
- package/build-style/list/style-rtl.css +15 -3
- package/build-style/list/style.css +15 -3
- package/build-style/media-text/editor-rtl.css +15 -3
- package/build-style/media-text/editor.css +15 -3
- package/build-style/media-text/style-rtl.css +15 -3
- package/build-style/media-text/style.css +15 -3
- package/build-style/more/editor-rtl.css +15 -3
- package/build-style/more/editor.css +15 -3
- package/build-style/navigation/editor-rtl.css +15 -9
- package/build-style/navigation/editor.css +15 -9
- package/build-style/navigation/style-rtl.css +15 -4
- package/build-style/navigation/style.css +15 -4
- package/build-style/navigation-link/editor-rtl.css +15 -3
- package/build-style/navigation-link/editor.css +15 -3
- package/build-style/navigation-link/style-rtl.css +15 -3
- package/build-style/navigation-link/style.css +15 -3
- package/build-style/navigation-submenu/editor-rtl.css +15 -3
- package/build-style/navigation-submenu/editor.css +15 -3
- package/build-style/nextpage/editor-rtl.css +15 -3
- package/build-style/nextpage/editor.css +15 -3
- package/build-style/page-list/editor-rtl.css +19 -3
- package/build-style/page-list/editor.css +19 -3
- package/build-style/page-list/style-rtl.css +15 -3
- package/build-style/page-list/style.css +15 -3
- package/build-style/paragraph/editor-rtl.css +15 -3
- package/build-style/paragraph/editor.css +15 -3
- package/build-style/paragraph/style-rtl.css +15 -3
- package/build-style/paragraph/style.css +15 -3
- package/build-style/post-author/style-rtl.css +15 -3
- package/build-style/post-author/style.css +15 -3
- package/build-style/post-comments-form/editor-rtl.css +15 -3
- package/build-style/post-comments-form/editor.css +15 -3
- package/build-style/post-comments-form/style-rtl.css +15 -3
- package/build-style/post-comments-form/style.css +15 -3
- package/build-style/post-date/style-rtl.css +15 -3
- package/build-style/post-date/style.css +15 -3
- package/build-style/post-excerpt/editor-rtl.css +15 -3
- package/build-style/post-excerpt/editor.css +15 -3
- package/build-style/post-excerpt/style-rtl.css +15 -3
- package/build-style/post-excerpt/style.css +15 -3
- package/build-style/post-featured-image/editor-rtl.css +15 -3
- package/build-style/post-featured-image/editor.css +15 -3
- package/build-style/post-featured-image/style-rtl.css +15 -3
- package/build-style/post-featured-image/style.css +15 -3
- package/build-style/post-navigation-link/style-rtl.css +15 -3
- package/build-style/post-navigation-link/style.css +15 -3
- package/build-style/post-template/editor-rtl.css +15 -3
- package/build-style/post-template/editor.css +15 -3
- package/build-style/post-template/style-rtl.css +15 -3
- package/build-style/post-template/style.css +15 -3
- package/build-style/post-terms/style-rtl.css +15 -3
- package/build-style/post-terms/style.css +15 -3
- package/build-style/post-title/style-rtl.css +15 -3
- package/build-style/post-title/style.css +15 -3
- package/build-style/preformatted/style-rtl.css +15 -3
- package/build-style/preformatted/style.css +15 -3
- package/build-style/pullquote/editor-rtl.css +15 -3
- package/build-style/pullquote/editor.css +15 -3
- package/build-style/pullquote/style-rtl.css +15 -3
- package/build-style/pullquote/style.css +15 -3
- package/build-style/pullquote/theme-rtl.css +15 -3
- package/build-style/pullquote/theme.css +15 -3
- package/build-style/query/editor-rtl.css +15 -3
- package/build-style/query/editor.css +15 -3
- package/build-style/query-pagination/editor-rtl.css +15 -3
- package/build-style/query-pagination/editor.css +15 -3
- package/build-style/query-pagination/style-rtl.css +15 -3
- package/build-style/query-pagination/style.css +15 -3
- package/build-style/query-pagination-numbers/editor-rtl.css +15 -3
- package/build-style/query-pagination-numbers/editor.css +15 -3
- package/build-style/query-title/style-rtl.css +15 -3
- package/build-style/query-title/style.css +15 -3
- package/build-style/quote/style-rtl.css +15 -3
- package/build-style/quote/style.css +15 -3
- package/build-style/quote/theme-rtl.css +15 -3
- package/build-style/quote/theme.css +15 -3
- package/build-style/read-more/style-rtl.css +15 -3
- package/build-style/read-more/style.css +15 -3
- package/build-style/reset-rtl.css +15 -3
- package/build-style/reset.css +15 -3
- package/build-style/rss/editor-rtl.css +15 -3
- package/build-style/rss/editor.css +15 -3
- package/build-style/rss/style-rtl.css +15 -3
- package/build-style/rss/style.css +15 -3
- package/build-style/search/editor-rtl.css +15 -3
- package/build-style/search/editor.css +15 -3
- package/build-style/search/style-rtl.css +15 -3
- package/build-style/search/style.css +15 -3
- package/build-style/search/theme-rtl.css +15 -3
- package/build-style/search/theme.css +15 -3
- package/build-style/separator/editor-rtl.css +15 -3
- package/build-style/separator/editor.css +15 -3
- package/build-style/separator/style-rtl.css +15 -3
- package/build-style/separator/style.css +15 -3
- package/build-style/separator/theme-rtl.css +15 -3
- package/build-style/separator/theme.css +15 -3
- package/build-style/shortcode/editor-rtl.css +16 -4
- package/build-style/shortcode/editor.css +16 -4
- package/build-style/site-logo/editor-rtl.css +15 -3
- package/build-style/site-logo/editor.css +15 -3
- package/build-style/site-logo/style-rtl.css +15 -3
- package/build-style/site-logo/style.css +15 -3
- package/build-style/site-tagline/editor-rtl.css +15 -3
- package/build-style/site-tagline/editor.css +15 -3
- package/build-style/site-title/editor-rtl.css +15 -3
- package/build-style/site-title/editor.css +15 -3
- package/build-style/site-title/style-rtl.css +15 -3
- package/build-style/site-title/style.css +15 -3
- package/build-style/social-link/editor-rtl.css +15 -3
- package/build-style/social-link/editor.css +15 -3
- package/build-style/social-links/editor-rtl.css +15 -3
- package/build-style/social-links/editor.css +15 -3
- package/build-style/social-links/style-rtl.css +15 -3
- package/build-style/social-links/style.css +15 -3
- package/build-style/spacer/editor-rtl.css +15 -3
- package/build-style/spacer/editor.css +15 -3
- package/build-style/spacer/style-rtl.css +15 -3
- package/build-style/spacer/style.css +15 -3
- package/build-style/style-rtl.css +36 -10
- package/build-style/style.css +36 -10
- package/build-style/table/editor-rtl.css +15 -11
- package/build-style/table/editor.css +15 -11
- package/build-style/table/style-rtl.css +21 -3
- package/build-style/table/style.css +21 -3
- package/build-style/table/theme-rtl.css +15 -9
- package/build-style/table/theme.css +15 -9
- package/build-style/tag-cloud/style-rtl.css +15 -3
- package/build-style/tag-cloud/style.css +15 -3
- package/build-style/template-part/editor-rtl.css +30 -4
- package/build-style/template-part/editor.css +30 -4
- package/build-style/template-part/theme-rtl.css +15 -3
- package/build-style/template-part/theme.css +15 -3
- package/build-style/text-columns/editor-rtl.css +15 -3
- package/build-style/text-columns/editor.css +15 -3
- package/build-style/text-columns/style-rtl.css +15 -3
- package/build-style/text-columns/style.css +15 -3
- package/build-style/theme-rtl.css +15 -9
- package/build-style/theme.css +15 -9
- package/build-style/verse/style-rtl.css +19 -4
- package/build-style/verse/style.css +19 -4
- package/build-style/video/editor-rtl.css +15 -3
- package/build-style/video/editor.css +15 -3
- package/build-style/video/style-rtl.css +17 -4
- package/build-style/video/style.css +17 -4
- package/build-style/video/theme-rtl.css +15 -3
- package/build-style/video/theme.css +15 -3
- package/package.json +32 -30
- package/src/audio/edit.native.js +1 -2
- package/src/audio/index.js +1 -0
- package/src/avatar/edit.js +1 -0
- package/src/avatar/user-control.js +1 -0
- package/src/block/block.json +1 -2
- package/src/block/edit.js +14 -3
- package/src/block/edit.native.js +24 -12
- package/src/block/editor.scss +17 -0
- package/src/block/index.php +1 -2
- package/src/block/test/edit.native.js +28 -32
- package/src/button/edit.native.js +1 -0
- package/src/buttons/test/edit.native.js +40 -51
- package/src/categories/edit.js +1 -1
- package/src/code/transforms.js +3 -1
- package/src/columns/edit.js +1 -0
- package/src/columns/edit.native.js +18 -26
- package/src/comment-author-avatar/edit.js +1 -0
- package/src/comments/index.php +0 -1
- package/src/cover/edit/inspector-controls.js +6 -4
- package/src/cover/edit.native.js +32 -19
- package/src/cover/test/edit.native.js +73 -126
- package/src/embed/embed-controls.native.js +1 -0
- package/src/embed/embed-preview.native.js +1 -2
- package/src/embed/test/index.native.js +237 -231
- package/src/file/inspector.js +1 -0
- package/src/file/test/__snapshots__/edit.native.js.snap +2 -6
- package/src/freeform/edit.js +48 -29
- package/src/freeform/modal.js +111 -0
- package/src/gallery/edit.js +32 -7
- package/src/gallery/gallery.js +3 -13
- package/src/gallery/gallery.native.js +1 -2
- package/src/gallery/shared.js +7 -11
- package/src/gallery/transforms.js +1 -6
- package/src/gallery/use-get-media.js +1 -1
- package/src/gallery/use-get-media.native.js +2 -1
- package/src/gallery/v1/edit.js +8 -7
- package/src/gallery/v1/gallery.native.js +1 -2
- package/src/gallery/v1/shared.js +7 -2
- package/src/group/block.json +3 -1
- package/src/group/edit.js +2 -6
- package/src/group/placeholder.js +6 -25
- package/src/group/test/__snapshots__/edit.native.js.snap +1 -1
- package/src/heading/block.json +1 -2
- package/src/heading/deprecated.js +209 -136
- package/src/heading/index.php +52 -0
- package/src/heading/test/__snapshots__/index.native.js.snap +7 -0
- package/src/heading/test/index.native.js +44 -0
- package/src/home-link/index.php +1 -1
- package/src/html/block.json +1 -1
- package/src/image/edit.js +7 -2
- package/src/image/edit.native.js +2 -1
- package/src/image/editor.scss +0 -11
- package/src/image/image.js +14 -8
- package/src/image/test/edit.native.js +14 -10
- package/src/index.js +2 -0
- package/src/latest-comments/edit.js +1 -0
- package/src/latest-posts/edit.js +2 -0
- package/src/latest-posts/test/__snapshots__/edit.native.js.snap +3 -0
- package/src/latest-posts/test/edit.native.js +49 -0
- package/src/list/test/edit.native.js +53 -45
- package/src/list/transforms.js +0 -11
- package/src/list/utils.js +6 -2
- package/src/list-item/index.js +2 -0
- package/src/list-item/transforms.js +17 -0
- package/src/list-item/utils.js +10 -1
- package/src/media-text/edit.js +6 -3
- package/src/missing/edit.native.js +13 -6
- package/src/missing/test/edit-integration.native.js +10 -12
- package/src/more/test/__snapshots__/edit.native.js.snap +7 -0
- package/src/more/test/edit.native.js +41 -0
- package/src/navigation/edit/are-blocks-dirty.js +51 -0
- package/src/navigation/edit/index.js +229 -298
- package/src/navigation/edit/menu-inspector-controls.js +119 -0
- package/src/navigation/edit/navigation-menu-selector.js +6 -7
- package/src/navigation/edit/test/are-blocks-dirty.js +121 -0
- package/src/navigation/edit/unsaved-inner-blocks.js +12 -7
- package/src/navigation/edit/utils.js +82 -0
- package/src/navigation/editor.scss +0 -7
- package/src/navigation/index.php +89 -10
- package/src/navigation/style.scss +0 -1
- package/src/navigation/view-modal.js +11 -1
- package/src/navigation-link/edit.js +62 -386
- package/src/navigation-link/index.php +64 -0
- package/src/navigation-link/link-ui.js +213 -0
- package/src/navigation-link/test/edit.js +23 -82
- package/src/navigation-link/transforms.js +14 -0
- package/src/navigation-link/update-attributes.js +99 -0
- package/src/navigation-submenu/edit.js +85 -276
- package/src/navigation-submenu/index.php +72 -0
- package/src/page-list/block.json +24 -2
- package/src/page-list/constants.js +8 -0
- package/src/page-list/convert-to-links-modal.js +19 -76
- package/src/page-list/convert-to-navigation-links.js +60 -0
- package/src/page-list/edit.js +187 -118
- package/src/page-list/editor.scss +4 -0
- package/src/page-list/index.js +8 -2
- package/src/page-list/index.php +18 -10
- package/src/page-list/test/convert-to-links-modal.js +28 -34
- package/src/page-list-item/block.json +51 -0
- package/src/page-list-item/edit.js +102 -0
- package/src/page-list-item/index.js +24 -0
- package/src/page-list-item/init.js +6 -0
- package/src/paragraph/index.js +0 -6
- package/src/post-author/edit.js +3 -2
- package/src/post-content/index.php +1 -2
- package/src/post-featured-image/index.php +7 -2
- package/src/post-featured-image/overlay.js +1 -1
- package/src/post-template/block.json +8 -0
- package/src/preformatted/transforms.js +4 -1
- package/src/query/block.json +0 -8
- package/src/query/deprecated.js +257 -86
- package/src/query/edit/index.js +1 -0
- package/src/query/edit/inspector-controls/index.js +50 -38
- package/src/query/edit/inspector-controls/taxonomy-controls.js +102 -38
- package/src/query/edit/query-content.js +2 -1
- package/src/query/edit/query-placeholder.js +14 -25
- package/src/query/utils.js +59 -1
- package/src/rss/edit.js +3 -0
- package/src/search/edit.js +2 -2
- package/src/search/edit.native.js +31 -27
- package/src/search/index.js +5 -1
- package/src/separator/test/__snapshots__/edit.native.js.snap +7 -0
- package/src/separator/test/edit.native.js +41 -0
- package/src/shortcode/test/edit.native.js +15 -18
- package/src/site-logo/edit.js +13 -5
- package/src/site-logo/index.js +1 -0
- package/src/site-title/index.js +1 -0
- package/src/social-link/edit.js +3 -3
- package/src/social-link/social-list.js +2 -7
- package/src/social-link/test/index.native.js +10 -16
- package/src/social-links/edit.js +0 -1
- package/src/social-links/test/edit.native.js +4 -3
- package/src/spacer/test/index.native.js +39 -36
- package/src/table/block.json +15 -0
- package/src/table/edit.js +2 -1
- package/src/table/editor.scss +0 -4
- package/src/table/index.js +1 -0
- package/src/table/save.js +5 -1
- package/src/table/state.js +22 -7
- package/src/table/style.scss +8 -0
- package/src/table/theme.scss +0 -8
- package/src/table/transforms.js +2 -1
- package/src/table-of-contents/edit.js +3 -3
- package/src/tag-cloud/edit.js +3 -2
- package/src/template-part/edit/advanced-controls.js +12 -0
- package/src/template-part/edit/import-controls.js +180 -0
- package/src/template-part/edit/index.js +1 -0
- package/src/template-part/edit/selection-modal.js +4 -3
- package/src/template-part/edit/utils/hooks.js +7 -3
- package/src/template-part/edit/utils/transformers.js +37 -0
- package/src/template-part/editor.scss +20 -2
- package/src/template-part/index.php +1 -2
- package/src/text-columns/edit.js +1 -0
- package/src/utils/transformation-categories.native.js +1 -0
- package/src/verse/style.scss +4 -1
- package/src/verse/test/__snapshots__/edit.native.js.snap +13 -0
- package/src/verse/test/edit.native.js +40 -33
- package/src/video/edit.js +1 -1
- package/src/video/edit.native.js +1 -2
- package/test/babel-plugin.js +35 -35
- package/tsconfig.tsbuildinfo +1 -1
- package/build/query/constants.js +0 -16
- package/build/query/constants.js.map +0 -1
- package/build-module/query/constants.js +0 -7
- package/build-module/query/constants.js.map +0 -1
- package/src/query/constants.js +0 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/navigation-link/update-attributes.js"],"names":["updateAttributes","updatedValue","setAttributes","blockAttributes","label","originalLabel","kind","originalKind","type","originalType","title","newLabel","url","newUrl","opensInNewTab","id","newKind","newType","newLabelWithoutHttp","replace","newUrlWithoutHttp","useNewLabel","isBuiltInType","indexOf","isCustomLink","encodeURI","undefined","Number","isInteger"],"mappings":";;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;;AAIA;AACA;AACA;;AACA;AACA;AACA;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Aa,GAClB,CAAE,MAAF,EAAU,MAAV,EAAkB,KAAlB,EAAyB,UAAzB,EAAsCC,OAAtC,CAA+Cf,IAA/C,IAAwD,CAAC,CAD1D;AAGA,QAAMgB,YAAY,GACf,CAAER,OAAF,IAAa,CAAEM,aAAjB,IAAoCN,OAAO,KAAK,QADjD;AAEA,QAAMV,IAAI,GAAGkB,YAAY,GAAG,QAAH,GAAcR,OAAvC;AAEAd,EAAAA,aAAa,CAAE,EACd;AACA,QAAKW,MAAM,IAAI;AAAED,MAAAA,GAAG,EAAEa,SAAS,CAAE,wBAAeZ,MAAf,CAAF;AAAhB,KAAf,CAFc;AAGd,QAAKT,KAAK,IAAI;AAAEA,MAAAA;AAAF,KAAd,CAHc;AAId,QAAKsB,SAAS,KAAKZ,aAAd,IAA+B;AAAEA,MAAAA;AAAF,KAApC,CAJc;AAKd,QAAKC,EAAE,IAAIY,MAAM,CAACC,SAAP,CAAkBb,EAAlB,CAAN,IAAgC;AAAEA,MAAAA;AAAF,KAArC,CALc;AAMd,QAAKT,IAAI,IAAI;AAAEA,MAAAA;AAAF,KAAb,CANc;AAOd,QAAKE,IAAI,IAAIA,IAAI,KAAK,KAAjB,IAA0B;AAAEA,MAAAA;AAAF,KAA/B;AAPc,GAAF,CAAb;AASA,CAlEM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { safeDecodeURI } from '@wordpress/url';\nimport { escapeHTML } from '@wordpress/escape-html';\n\n/**\n * @typedef {'post-type'|'custom'|'taxonomy'|'post-type-archive'} WPNavigationLinkKind\n */\n/**\n * Navigation Link Block Attributes\n *\n * @typedef {Object} WPNavigationLinkBlockAttributes\n *\n * @property {string} [label] Link text.\n * @property {WPNavigationLinkKind} [kind] Kind is used to differentiate between term and post ids to check post draft status.\n * @property {string} [type] The type such as post, page, tag, category and other custom types.\n * @property {string} [rel] The relationship of the linked URL.\n * @property {number} [id] A post or term id.\n * @property {boolean} [opensInNewTab] Sets link target to _blank when true.\n * @property {string} [url] Link href.\n * @property {string} [title] Link title attribute.\n */\n/**\n * Link Control onChange handler that updates block attributes when a setting is changed.\n *\n * @param {Object} updatedValue New block attributes to update.\n * @param {Function} setAttributes Block attribute update function.\n * @param {WPNavigationLinkBlockAttributes} blockAttributes Current block attributes.\n *\n */\n\nexport const updateAttributes = (\n\tupdatedValue = {},\n\tsetAttributes,\n\tblockAttributes = {}\n) => {\n\tconst {\n\t\tlabel: originalLabel = '',\n\t\tkind: originalKind = '',\n\t\ttype: originalType = '',\n\t} = blockAttributes;\n\n\tconst {\n\t\ttitle: newLabel = '', // the title of any provided Post.\n\t\turl: newUrl = '',\n\t\topensInNewTab,\n\t\tid,\n\t\tkind: newKind = originalKind,\n\t\ttype: newType = originalType,\n\t} = updatedValue;\n\n\tconst newLabelWithoutHttp = newLabel.replace( /http(s?):\\/\\//gi, '' );\n\tconst newUrlWithoutHttp = newUrl.replace( /http(s?):\\/\\//gi, '' );\n\n\tconst useNewLabel =\n\t\tnewLabel &&\n\t\tnewLabel !== originalLabel &&\n\t\t// LinkControl without the title field relies\n\t\t// on the check below. Specifically, it assumes that\n\t\t// the URL is the same as a title.\n\t\t// This logic a) looks suspicious and b) should really\n\t\t// live in the LinkControl and not here. It's a great\n\t\t// candidate for future refactoring.\n\t\tnewLabelWithoutHttp !== newUrlWithoutHttp;\n\n\t// Unfortunately this causes the escaping model to be inverted.\n\t// The escaped content is stored in the block attributes (and ultimately in the database),\n\t// and then the raw data is \"recovered\" when outputting into the DOM.\n\t// It would be preferable to store the **raw** data in the block attributes and escape it in JS.\n\t// Why? Because there isn't one way to escape data. Depending on the context, you need to do\n\t// different transforms. It doesn't make sense to me to choose one of them for the purposes of storage.\n\t// See also:\n\t// - https://github.com/WordPress/gutenberg/pull/41063\n\t// - https://github.com/WordPress/gutenberg/pull/18617.\n\tconst label = useNewLabel\n\t\t? escapeHTML( newLabel )\n\t\t: originalLabel || escapeHTML( newUrlWithoutHttp );\n\n\t// In https://github.com/WordPress/gutenberg/pull/24670 we decided to use \"tag\" in favor of \"post_tag\"\n\tconst type = newType === 'post_tag' ? 'tag' : newType.replace( '-', '_' );\n\n\tconst isBuiltInType =\n\t\t[ 'post', 'page', 'tag', 'category' ].indexOf( type ) > -1;\n\n\tconst isCustomLink =\n\t\t( ! newKind && ! isBuiltInType ) || newKind === 'custom';\n\tconst kind = isCustomLink ? 'custom' : newKind;\n\n\tsetAttributes( {\n\t\t// Passed `url` may already be encoded. To prevent double encoding, decodeURI is executed to revert to the original string.\n\t\t...( newUrl && { url: encodeURI( safeDecodeURI( newUrl ) ) } ),\n\t\t...( label && { label } ),\n\t\t...( undefined !== opensInNewTab && { opensInNewTab } ),\n\t\t...( id && Number.isInteger( id ) && { id } ),\n\t\t...( kind && { kind } ),\n\t\t...( type && type !== 'URL' && { type } ),\n\t} );\n};\n"]}
|
|
@@ -6,14 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = NavigationSubmenuEdit;
|
|
9
|
-
exports.updateNavigationLinkBlockAttributes = void 0;
|
|
10
9
|
|
|
11
10
|
var _element = require("@wordpress/element");
|
|
12
11
|
|
|
13
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
14
13
|
|
|
15
|
-
var _escapeHtml = _interopRequireDefault(require("escape-html"));
|
|
16
|
-
|
|
17
14
|
var _data = require("@wordpress/data");
|
|
18
15
|
|
|
19
16
|
var _components = require("@wordpress/components");
|
|
@@ -40,6 +37,12 @@ var _compose = require("@wordpress/compose");
|
|
|
40
37
|
|
|
41
38
|
var _icons2 = require("./icons");
|
|
42
39
|
|
|
40
|
+
var _linkUi = require("../navigation-link/link-ui");
|
|
41
|
+
|
|
42
|
+
var _updateAttributes = require("../navigation-link/update-attributes");
|
|
43
|
+
|
|
44
|
+
var _utils = require("../navigation/edit/utils");
|
|
45
|
+
|
|
43
46
|
/**
|
|
44
47
|
* External dependencies
|
|
45
48
|
*/
|
|
@@ -103,7 +106,7 @@ const {
|
|
|
103
106
|
editorStyle: "wp-block-navigation-submenu-editor",
|
|
104
107
|
style: "wp-block-navigation-submenu"
|
|
105
108
|
};
|
|
106
|
-
const ALLOWED_BLOCKS = ['core/navigation-link', 'core/navigation-submenu'];
|
|
109
|
+
const ALLOWED_BLOCKS = ['core/navigation-link', 'core/navigation-submenu', 'core/page-list'];
|
|
107
110
|
const DEFAULT_BLOCK = {
|
|
108
111
|
name: 'core/navigation-link'
|
|
109
112
|
};
|
|
@@ -157,117 +160,6 @@ const useIsDraggingWithin = elementRef => {
|
|
|
157
160
|
}, []);
|
|
158
161
|
return isDraggingWithin;
|
|
159
162
|
};
|
|
160
|
-
/**
|
|
161
|
-
* Given the Link block's type attribute, return the query params to give to
|
|
162
|
-
* /wp/v2/search.
|
|
163
|
-
*
|
|
164
|
-
* @param {string} type Link block's type attribute.
|
|
165
|
-
* @param {string} kind Link block's entity of kind (post-type|taxonomy)
|
|
166
|
-
* @return {{ type?: string, subtype?: string }} Search query params.
|
|
167
|
-
*/
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
function getSuggestionsQuery(type, kind) {
|
|
171
|
-
switch (type) {
|
|
172
|
-
case 'post':
|
|
173
|
-
case 'page':
|
|
174
|
-
return {
|
|
175
|
-
type: 'post',
|
|
176
|
-
subtype: type
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
case 'category':
|
|
180
|
-
return {
|
|
181
|
-
type: 'term',
|
|
182
|
-
subtype: 'category'
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
case 'tag':
|
|
186
|
-
return {
|
|
187
|
-
type: 'term',
|
|
188
|
-
subtype: 'post_tag'
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
case 'post_format':
|
|
192
|
-
return {
|
|
193
|
-
type: 'post-format'
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
default:
|
|
197
|
-
if (kind === 'taxonomy') {
|
|
198
|
-
return {
|
|
199
|
-
type: 'term',
|
|
200
|
-
subtype: type
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
if (kind === 'post-type') {
|
|
205
|
-
return {
|
|
206
|
-
type: 'post',
|
|
207
|
-
subtype: type
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
return {};
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* Determine the colors for a menu.
|
|
216
|
-
*
|
|
217
|
-
* Order of priority is:
|
|
218
|
-
* 1: Overlay custom colors (if submenu)
|
|
219
|
-
* 2: Overlay theme colors (if submenu)
|
|
220
|
-
* 3: Custom colors
|
|
221
|
-
* 4: Theme colors
|
|
222
|
-
* 5: Global styles
|
|
223
|
-
*
|
|
224
|
-
* @param {Object} context
|
|
225
|
-
* @param {boolean} isSubMenu
|
|
226
|
-
*/
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
function getColors(context, isSubMenu) {
|
|
230
|
-
var _style$color, _style$color2;
|
|
231
|
-
|
|
232
|
-
const {
|
|
233
|
-
textColor,
|
|
234
|
-
customTextColor,
|
|
235
|
-
backgroundColor,
|
|
236
|
-
customBackgroundColor,
|
|
237
|
-
overlayTextColor,
|
|
238
|
-
customOverlayTextColor,
|
|
239
|
-
overlayBackgroundColor,
|
|
240
|
-
customOverlayBackgroundColor,
|
|
241
|
-
style
|
|
242
|
-
} = context;
|
|
243
|
-
const colors = {};
|
|
244
|
-
|
|
245
|
-
if (isSubMenu && !!customOverlayTextColor) {
|
|
246
|
-
colors.customTextColor = customOverlayTextColor;
|
|
247
|
-
} else if (isSubMenu && !!overlayTextColor) {
|
|
248
|
-
colors.textColor = overlayTextColor;
|
|
249
|
-
} else if (!!customTextColor) {
|
|
250
|
-
colors.customTextColor = customTextColor;
|
|
251
|
-
} else if (!!textColor) {
|
|
252
|
-
colors.textColor = textColor;
|
|
253
|
-
} else if (!!(style !== null && style !== void 0 && (_style$color = style.color) !== null && _style$color !== void 0 && _style$color.text)) {
|
|
254
|
-
colors.customTextColor = style.color.text;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
if (isSubMenu && !!customOverlayBackgroundColor) {
|
|
258
|
-
colors.customBackgroundColor = customOverlayBackgroundColor;
|
|
259
|
-
} else if (isSubMenu && !!overlayBackgroundColor) {
|
|
260
|
-
colors.backgroundColor = overlayBackgroundColor;
|
|
261
|
-
} else if (!!customBackgroundColor) {
|
|
262
|
-
colors.customBackgroundColor = customBackgroundColor;
|
|
263
|
-
} else if (!!backgroundColor) {
|
|
264
|
-
colors.backgroundColor = backgroundColor;
|
|
265
|
-
} else if (!!(style !== null && style !== void 0 && (_style$color2 = style.color) !== null && _style$color2 !== void 0 && _style$color2.background)) {
|
|
266
|
-
colors.customTextColor = style.color.background;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
return colors;
|
|
270
|
-
}
|
|
271
163
|
/**
|
|
272
164
|
* @typedef {'post-type'|'custom'|'taxonomy'|'post-type-archive'} WPNavigationLinkKind
|
|
273
165
|
*/
|
|
@@ -287,65 +179,6 @@ function getColors(context, isSubMenu) {
|
|
|
287
179
|
* @property {string} [title] Link title attribute.
|
|
288
180
|
*/
|
|
289
181
|
|
|
290
|
-
/**
|
|
291
|
-
* Link Control onChange handler that updates block attributes when a setting is changed.
|
|
292
|
-
*
|
|
293
|
-
* @param {Object} updatedValue New block attributes to update.
|
|
294
|
-
* @param {Function} setAttributes Block attribute update function.
|
|
295
|
-
* @param {WPNavigationLinkBlockAttributes} blockAttributes Current block attributes.
|
|
296
|
-
*
|
|
297
|
-
*/
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
const updateNavigationLinkBlockAttributes = function () {
|
|
301
|
-
let updatedValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
302
|
-
let setAttributes = arguments.length > 1 ? arguments[1] : undefined;
|
|
303
|
-
let blockAttributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
304
|
-
const {
|
|
305
|
-
label: originalLabel = '',
|
|
306
|
-
kind: originalKind = '',
|
|
307
|
-
type: originalType = ''
|
|
308
|
-
} = blockAttributes;
|
|
309
|
-
const {
|
|
310
|
-
title = '',
|
|
311
|
-
url = '',
|
|
312
|
-
opensInNewTab,
|
|
313
|
-
id,
|
|
314
|
-
kind: newKind = originalKind,
|
|
315
|
-
type: newType = originalType
|
|
316
|
-
} = updatedValue;
|
|
317
|
-
const normalizedTitle = title.replace(/http(s?):\/\//gi, '');
|
|
318
|
-
const normalizedURL = url.replace(/http(s?):\/\//gi, '');
|
|
319
|
-
const escapeTitle = title !== '' && normalizedTitle !== normalizedURL && originalLabel !== title;
|
|
320
|
-
const label = escapeTitle ? (0, _escapeHtml.default)(title) : originalLabel || (0, _escapeHtml.default)(normalizedURL); // In https://github.com/WordPress/gutenberg/pull/24670 we decided to use "tag" in favor of "post_tag"
|
|
321
|
-
|
|
322
|
-
const type = newType === 'post_tag' ? 'tag' : newType.replace('-', '_');
|
|
323
|
-
const isBuiltInType = ['post', 'page', 'tag', 'category'].indexOf(type) > -1;
|
|
324
|
-
const isCustomLink = !newKind && !isBuiltInType || newKind === 'custom';
|
|
325
|
-
const kind = isCustomLink ? 'custom' : newKind;
|
|
326
|
-
setAttributes({ // Passed `url` may already be encoded. To prevent double encoding, decodeURI is executed to revert to the original string.
|
|
327
|
-
...(url && {
|
|
328
|
-
url: encodeURI((0, _url.safeDecodeURI)(url))
|
|
329
|
-
}),
|
|
330
|
-
...(label && {
|
|
331
|
-
label
|
|
332
|
-
}),
|
|
333
|
-
...(undefined !== opensInNewTab && {
|
|
334
|
-
opensInNewTab
|
|
335
|
-
}),
|
|
336
|
-
...(id && Number.isInteger(id) && {
|
|
337
|
-
id
|
|
338
|
-
}),
|
|
339
|
-
...(kind && {
|
|
340
|
-
kind
|
|
341
|
-
}),
|
|
342
|
-
...(type && type !== 'URL' && {
|
|
343
|
-
type
|
|
344
|
-
})
|
|
345
|
-
});
|
|
346
|
-
};
|
|
347
|
-
|
|
348
|
-
exports.updateNavigationLinkBlockAttributes = updateNavigationLinkBlockAttributes;
|
|
349
182
|
|
|
350
183
|
function NavigationSubmenuEdit(_ref) {
|
|
351
184
|
let {
|
|
@@ -360,25 +193,16 @@ function NavigationSubmenuEdit(_ref) {
|
|
|
360
193
|
const {
|
|
361
194
|
label,
|
|
362
195
|
type,
|
|
363
|
-
opensInNewTab,
|
|
364
196
|
url,
|
|
365
197
|
description,
|
|
366
198
|
rel,
|
|
367
|
-
title
|
|
368
|
-
kind
|
|
199
|
+
title
|
|
369
200
|
} = attributes;
|
|
370
|
-
const link = {
|
|
371
|
-
url,
|
|
372
|
-
opensInNewTab
|
|
373
|
-
};
|
|
374
201
|
const {
|
|
375
202
|
showSubmenuIcon,
|
|
376
203
|
maxNestingLevel,
|
|
377
204
|
openSubmenusOnClick
|
|
378
205
|
} = context;
|
|
379
|
-
const {
|
|
380
|
-
saveEntityRecord
|
|
381
|
-
} = (0, _data.useDispatch)(_coreData.store);
|
|
382
206
|
const {
|
|
383
207
|
__unstableMarkNextChangeAsNotPersistent,
|
|
384
208
|
replaceBlock
|
|
@@ -434,7 +258,8 @@ function NavigationSubmenuEdit(_ref) {
|
|
|
434
258
|
selectedBlockHasChildren: !!(selectedBlockChildren !== null && selectedBlockChildren !== void 0 && selectedBlockChildren.length),
|
|
435
259
|
onlyDescendantIsEmptyLink: _onlyDescendantIsEmptyLink
|
|
436
260
|
};
|
|
437
|
-
}, [clientId]);
|
|
261
|
+
}, [clientId]);
|
|
262
|
+
const prevHasChildren = (0, _compose.usePrevious)(hasChildren); // Show the LinkControl on mount if the URL is empty
|
|
438
263
|
// ( When adding a new menu item)
|
|
439
264
|
// This can't be done in the useState call because it conflicts
|
|
440
265
|
// with the autofocus behavior of the BlockListBlock component.
|
|
@@ -507,27 +332,12 @@ function NavigationSubmenuEdit(_ref) {
|
|
|
507
332
|
userCanCreate = postsPermissions.canCreate;
|
|
508
333
|
}
|
|
509
334
|
|
|
510
|
-
async function handleCreate(pageTitle) {
|
|
511
|
-
const postType = type || 'page';
|
|
512
|
-
const page = await saveEntityRecord('postType', postType, {
|
|
513
|
-
title: pageTitle,
|
|
514
|
-
status: 'draft'
|
|
515
|
-
});
|
|
516
|
-
return {
|
|
517
|
-
id: page.id,
|
|
518
|
-
type: postType,
|
|
519
|
-
title: page.title.rendered,
|
|
520
|
-
url: page.link,
|
|
521
|
-
kind: 'post-type'
|
|
522
|
-
};
|
|
523
|
-
}
|
|
524
|
-
|
|
525
335
|
const {
|
|
526
336
|
textColor,
|
|
527
337
|
customTextColor,
|
|
528
338
|
backgroundColor,
|
|
529
339
|
customBackgroundColor
|
|
530
|
-
} = getColors(context, !isTopLevelItem);
|
|
340
|
+
} = (0, _utils.getColors)(context, !isTopLevelItem);
|
|
531
341
|
|
|
532
342
|
function onKeyDown(event) {
|
|
533
343
|
if (_keycodes.isKeyboardEvent.primary(event, 'k')) {
|
|
@@ -555,21 +365,10 @@ function NavigationSubmenuEdit(_ref) {
|
|
|
555
365
|
onKeyDown
|
|
556
366
|
}); // Always use overlay colors for submenus.
|
|
557
367
|
|
|
558
|
-
const innerBlocksColors = getColors(context, true);
|
|
368
|
+
const innerBlocksColors = (0, _utils.getColors)(context, true);
|
|
559
369
|
const allowedBlocks = isAtMaxNesting ? ALLOWED_BLOCKS.filter(blockName => blockName !== 'core/navigation-submenu') : ALLOWED_BLOCKS;
|
|
560
|
-
const
|
|
561
|
-
|
|
562
|
-
'is-parent-of-selected-block': isParentOfSelectedBlock,
|
|
563
|
-
'has-text-color': !!(innerBlocksColors.textColor || innerBlocksColors.customTextColor),
|
|
564
|
-
[`has-${innerBlocksColors.textColor}-color`]: !!innerBlocksColors.textColor,
|
|
565
|
-
'has-background': !!(innerBlocksColors.backgroundColor || innerBlocksColors.customBackgroundColor),
|
|
566
|
-
[`has-${innerBlocksColors.backgroundColor}-background-color`]: !!innerBlocksColors.backgroundColor
|
|
567
|
-
}),
|
|
568
|
-
style: {
|
|
569
|
-
color: innerBlocksColors.customTextColor,
|
|
570
|
-
backgroundColor: innerBlocksColors.customBackgroundColor
|
|
571
|
-
}
|
|
572
|
-
}, {
|
|
370
|
+
const navigationChildBlockProps = (0, _utils.getNavigationChildBlockProps)(innerBlocksColors);
|
|
371
|
+
const innerBlocksProps = (0, _blockEditor.useInnerBlocksProps)(navigationChildBlockProps, {
|
|
573
372
|
allowedBlocks,
|
|
574
373
|
__experimentalDefaultBlock: DEFAULT_BLOCK,
|
|
575
374
|
__experimentalDirectInsert: true,
|
|
@@ -587,6 +386,12 @@ function NavigationSubmenuEdit(_ref) {
|
|
|
587
386
|
replaceBlock(clientId, newLinkBlock);
|
|
588
387
|
}
|
|
589
388
|
|
|
389
|
+
(0, _element.useEffect)(() => {
|
|
390
|
+
// If block becomes empty, transform to Navigation Link.
|
|
391
|
+
if (!hasChildren && prevHasChildren) {
|
|
392
|
+
transformToLink();
|
|
393
|
+
}
|
|
394
|
+
}, [hasChildren, prevHasChildren]);
|
|
590
395
|
const canConvertToLink = !selectedBlockHasChildren || onlyDescendantIsEmptyLink;
|
|
591
396
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_blockEditor.BlockControls, null, (0, _element.createElement)(_components.ToolbarGroup, null, !openSubmenusOnClick && (0, _element.createElement)(_components.ToolbarButton, {
|
|
592
397
|
name: "link",
|
|
@@ -603,7 +408,26 @@ function NavigationSubmenuEdit(_ref) {
|
|
|
603
408
|
isDisabled: !canConvertToLink
|
|
604
409
|
}))), (0, _element.createElement)(_blockEditor.InspectorControls, null, (0, _element.createElement)(_components.PanelBody, {
|
|
605
410
|
title: (0, _i18n.__)('Link settings')
|
|
606
|
-
}, (0, _element.createElement)(_components.
|
|
411
|
+
}, (0, _element.createElement)(_components.TextControl, {
|
|
412
|
+
value: label || '',
|
|
413
|
+
onChange: labelValue => {
|
|
414
|
+
setAttributes({
|
|
415
|
+
label: labelValue
|
|
416
|
+
});
|
|
417
|
+
},
|
|
418
|
+
label: (0, _i18n.__)('Label'),
|
|
419
|
+
autoComplete: "off"
|
|
420
|
+
}), (0, _element.createElement)(_components.TextControl, {
|
|
421
|
+
value: url || '',
|
|
422
|
+
onChange: urlValue => {
|
|
423
|
+
setAttributes({
|
|
424
|
+
url: urlValue
|
|
425
|
+
});
|
|
426
|
+
},
|
|
427
|
+
label: (0, _i18n.__)('URL'),
|
|
428
|
+
autoComplete: "off"
|
|
429
|
+
}), (0, _element.createElement)(_components.TextareaControl, {
|
|
430
|
+
__nextHasNoMarginBottom: true,
|
|
607
431
|
value: description || '',
|
|
608
432
|
onChange: descriptionValue => {
|
|
609
433
|
setAttributes({
|
|
@@ -651,43 +475,23 @@ function NavigationSubmenuEdit(_ref) {
|
|
|
651
475
|
setIsLinkOpen(true);
|
|
652
476
|
}
|
|
653
477
|
}
|
|
654
|
-
}), !openSubmenusOnClick && isLinkOpen && (0, _element.createElement)(
|
|
655
|
-
|
|
478
|
+
}), !openSubmenusOnClick && isLinkOpen && (0, _element.createElement)(_linkUi.LinkUI, {
|
|
479
|
+
className: "wp-block-navigation-link__inline-link-input",
|
|
480
|
+
clientId: clientId,
|
|
481
|
+
link: attributes,
|
|
656
482
|
onClose: () => setIsLinkOpen(false),
|
|
657
483
|
anchor: popoverAnchor,
|
|
658
|
-
|
|
659
|
-
}, (0, _element.createElement)(_blockEditor.__experimentalLinkControl, {
|
|
660
|
-
className: "wp-block-navigation-link__inline-link-input",
|
|
661
|
-
value: link,
|
|
662
|
-
showInitialSuggestions: true,
|
|
663
|
-
withCreateSuggestion: userCanCreate,
|
|
664
|
-
createSuggestion: handleCreate,
|
|
665
|
-
createSuggestionButtonText: searchTerm => {
|
|
666
|
-
let format;
|
|
667
|
-
|
|
668
|
-
if (type === 'post') {
|
|
669
|
-
/* translators: %s: search term. */
|
|
670
|
-
format = (0, _i18n.__)('Create draft post: <mark>%s</mark>');
|
|
671
|
-
} else {
|
|
672
|
-
/* translators: %s: search term. */
|
|
673
|
-
format = (0, _i18n.__)('Create draft page: <mark>%s</mark>');
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
return (0, _element.createInterpolateElement)((0, _i18n.sprintf)(format, searchTerm), {
|
|
677
|
-
mark: (0, _element.createElement)("mark", null)
|
|
678
|
-
});
|
|
679
|
-
},
|
|
680
|
-
noDirectEntry: !!type,
|
|
681
|
-
noURLSuggestion: !!type,
|
|
682
|
-
suggestionsQuery: getSuggestionsQuery(type, kind),
|
|
683
|
-
onChange: updatedValue => updateNavigationLinkBlockAttributes(updatedValue, setAttributes, attributes),
|
|
484
|
+
hasCreateSuggestion: userCanCreate,
|
|
684
485
|
onRemove: () => {
|
|
685
486
|
setAttributes({
|
|
686
487
|
url: ''
|
|
687
488
|
});
|
|
688
489
|
(0, _a11y.speak)((0, _i18n.__)('Link removed.'), 'assertive');
|
|
490
|
+
},
|
|
491
|
+
onChange: updatedValue => {
|
|
492
|
+
(0, _updateAttributes.updateAttributes)(updatedValue, setAttributes, attributes);
|
|
689
493
|
}
|
|
690
|
-
}))
|
|
494
|
+
})), (showSubmenuIcon || openSubmenusOnClick) && (0, _element.createElement)("span", {
|
|
691
495
|
className: "wp-block-navigation__submenu-icon"
|
|
692
496
|
}, (0, _element.createElement)(_icons2.ItemSubmenuIcon, null)), (0, _element.createElement)("div", innerBlocksProps)));
|
|
693
497
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/navigation-submenu/edit.js"],"names":["ALLOWED_BLOCKS","DEFAULT_BLOCK","name","useIsDraggingWithin","elementRef","isDraggingWithin","setIsDraggingWithin","ownerDocument","current","handleDragStart","event","handleDragEnter","handleDragEnd","contains","target","addEventListener","removeEventListener","getSuggestionsQuery","type","kind","subtype","getColors","context","isSubMenu","textColor","customTextColor","backgroundColor","customBackgroundColor","overlayTextColor","customOverlayTextColor","overlayBackgroundColor","customOverlayBackgroundColor","style","colors","color","text","background","updateNavigationLinkBlockAttributes","updatedValue","setAttributes","blockAttributes","label","originalLabel","originalKind","originalType","title","url","opensInNewTab","id","newKind","newType","normalizedTitle","replace","normalizedURL","escapeTitle","isBuiltInType","indexOf","isCustomLink","encodeURI","undefined","Number","isInteger","NavigationSubmenuEdit","attributes","isSelected","mergeBlocks","onReplace","clientId","description","rel","link","showSubmenuIcon","maxNestingLevel","openSubmenusOnClick","saveEntityRecord","coreStore","__unstableMarkNextChangeAsNotPersistent","replaceBlock","blockEditorStore","isLinkOpen","setIsLinkOpen","popoverAnchor","setPopoverAnchor","listItemRef","itemLabelPlaceholder","ref","pagesPermissions","postsPermissions","isAtMaxNesting","isTopLevelItem","isParentOfSelectedBlock","isImmediateParentOfSelectedBlock","hasChildren","selectedBlockHasChildren","onlyDescendantIsEmptyLink","select","hasSelectedInnerBlock","getSelectedBlockClientId","getBlockParentsByBlockName","getBlock","getBlockCount","getBlockOrder","_onlyDescendantIsEmptyLink","selectedBlockId","selectedBlockChildren","length","singleBlock","test","selectLabelText","focus","defaultView","selection","getSelection","range","createRange","selectNodeContents","removeAllRanges","addRange","userCanCreate","canCreate","handleCreate","pageTitle","postType","page","status","rendered","onKeyDown","isKeyboardEvent","primary","blockProps","className","innerBlocksColors","allowedBlocks","filter","blockName","innerBlocksProps","__experimentalDefaultBlock","__experimentalDirectInsert","__experimentalCaptureToolbars","renderAppender","InnerBlocks","ButtonBlockAppender","ParentElement","transformToLink","newLinkBlock","canConvertToLink","linkIcon","displayShortcut","removeSubmenu","descriptionValue","titleValue","relValue","labelValue","searchTerm","format","mark"],"mappings":";;;;;;;;;;AAgCA;;AA7BA;;AACA;;AAKA;;AACA;;AAQA;;AACA;;AACA;;AAWA;;AAQA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AAKA;;AApDA;AACA;AACA;;AAIA;AACA;AACA;;AAyCA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,MAAMA,cAAc,GAAG,CAAE,sBAAF,EAA0B,yBAA1B,CAAvB;AAEA,MAAMC,aAAa,GAAG;AACrBC,EAAAA,IAAI,EA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Aa,CAAE;AAAEO,QAAAA,GAAG,EAAE;AAAP,OAAF,CAAb;AACA,uBAAO,cAAI,eAAJ,CAAP,EAA8B,WAA9B;AACA;AAxCF,IAND,CA9BF,CAFD,EAmFG,CAAEyB,eAAe,IAAIE,mBAArB,KACD;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC,4BAAC,uBAAD,OADD,CApFF,EAwFC,mCAAU8D,gBAAV,CAxFD,CAvDD,CADD;AAoJA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport escapeHtml from 'escape-html';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tPanelBody,\n\tPopover,\n\tTextControl,\n\tTextareaControl,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { displayShortcut, isKeyboardEvent } from '@wordpress/keycodes';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tInnerBlocks,\n\tuseInnerBlocksProps,\n\tInspectorControls,\n\tRichText,\n\t__experimentalLinkControl as LinkControl,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tgetColorClassName,\n} from '@wordpress/block-editor';\nimport { isURL, prependHTTP, safeDecodeURI } from '@wordpress/url';\nimport {\n\tFragment,\n\tuseState,\n\tuseEffect,\n\tuseRef,\n\tcreateInterpolateElement,\n} from '@wordpress/element';\nimport { placeCaretAtHorizontalEdge } from '@wordpress/dom';\nimport { link as linkIcon, removeSubmenu } from '@wordpress/icons';\nimport {\n\tuseResourcePermissions,\n\tstore as coreStore,\n} from '@wordpress/core-data';\nimport { speak } from '@wordpress/a11y';\nimport { createBlock } from '@wordpress/blocks';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { ItemSubmenuIcon } from './icons';\nimport { name } from './block.json';\n\nconst ALLOWED_BLOCKS = [ 'core/navigation-link', 'core/navigation-submenu' ];\n\nconst DEFAULT_BLOCK = {\n\tname: 'core/navigation-link',\n};\n\n/**\n * A React hook to determine if it's dragging within the target element.\n *\n * @typedef {import('@wordpress/element').RefObject} RefObject\n *\n * @param {RefObject<HTMLElement>} elementRef The target elementRef object.\n *\n * @return {boolean} Is dragging within the target element.\n */\nconst useIsDraggingWithin = ( elementRef ) => {\n\tconst [ isDraggingWithin, setIsDraggingWithin ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst { ownerDocument } = elementRef.current;\n\n\t\tfunction handleDragStart( event ) {\n\t\t\t// Check the first time when the dragging starts.\n\t\t\thandleDragEnter( event );\n\t\t}\n\n\t\t// Set to false whenever the user cancel the drag event by either releasing the mouse or press Escape.\n\t\tfunction handleDragEnd() {\n\t\t\tsetIsDraggingWithin( false );\n\t\t}\n\n\t\tfunction handleDragEnter( event ) {\n\t\t\t// Check if the current target is inside the item element.\n\t\t\tif ( elementRef.current.contains( event.target ) ) {\n\t\t\t\tsetIsDraggingWithin( true );\n\t\t\t} else {\n\t\t\t\tsetIsDraggingWithin( false );\n\t\t\t}\n\t\t}\n\n\t\t// Bind these events to the document to catch all drag events.\n\t\t// Ideally, we can also use `event.relatedTarget`, but sadly that\n\t\t// doesn't work in Safari.\n\t\townerDocument.addEventListener( 'dragstart', handleDragStart );\n\t\townerDocument.addEventListener( 'dragend', handleDragEnd );\n\t\townerDocument.addEventListener( 'dragenter', handleDragEnter );\n\n\t\treturn () => {\n\t\t\townerDocument.removeEventListener( 'dragstart', handleDragStart );\n\t\t\townerDocument.removeEventListener( 'dragend', handleDragEnd );\n\t\t\townerDocument.removeEventListener( 'dragenter', handleDragEnter );\n\t\t};\n\t}, [] );\n\n\treturn isDraggingWithin;\n};\n\n/**\n * Given the Link block's type attribute, return the query params to give to\n * /wp/v2/search.\n *\n * @param {string} type Link block's type attribute.\n * @param {string} kind Link block's entity of kind (post-type|taxonomy)\n * @return {{ type?: string, subtype?: string }} Search query params.\n */\nfunction getSuggestionsQuery( type, kind ) {\n\tswitch ( type ) {\n\t\tcase 'post':\n\t\tcase 'page':\n\t\t\treturn { type: 'post', subtype: type };\n\t\tcase 'category':\n\t\t\treturn { type: 'term', subtype: 'category' };\n\t\tcase 'tag':\n\t\t\treturn { type: 'term', subtype: 'post_tag' };\n\t\tcase 'post_format':\n\t\t\treturn { type: 'post-format' };\n\t\tdefault:\n\t\t\tif ( kind === 'taxonomy' ) {\n\t\t\t\treturn { type: 'term', subtype: type };\n\t\t\t}\n\t\t\tif ( kind === 'post-type' ) {\n\t\t\t\treturn { type: 'post', subtype: type };\n\t\t\t}\n\t\t\treturn {};\n\t}\n}\n\n/**\n * Determine the colors for a menu.\n *\n * Order of priority is:\n * 1: Overlay custom colors (if submenu)\n * 2: Overlay theme colors (if submenu)\n * 3: Custom colors\n * 4: Theme colors\n * 5: Global styles\n *\n * @param {Object} context\n * @param {boolean} isSubMenu\n */\nfunction getColors( context, isSubMenu ) {\n\tconst {\n\t\ttextColor,\n\t\tcustomTextColor,\n\t\tbackgroundColor,\n\t\tcustomBackgroundColor,\n\t\toverlayTextColor,\n\t\tcustomOverlayTextColor,\n\t\toverlayBackgroundColor,\n\t\tcustomOverlayBackgroundColor,\n\t\tstyle,\n\t} = context;\n\n\tconst colors = {};\n\n\tif ( isSubMenu && !! customOverlayTextColor ) {\n\t\tcolors.customTextColor = customOverlayTextColor;\n\t} else if ( isSubMenu && !! overlayTextColor ) {\n\t\tcolors.textColor = overlayTextColor;\n\t} else if ( !! customTextColor ) {\n\t\tcolors.customTextColor = customTextColor;\n\t} else if ( !! textColor ) {\n\t\tcolors.textColor = textColor;\n\t} else if ( !! style?.color?.text ) {\n\t\tcolors.customTextColor = style.color.text;\n\t}\n\n\tif ( isSubMenu && !! customOverlayBackgroundColor ) {\n\t\tcolors.customBackgroundColor = customOverlayBackgroundColor;\n\t} else if ( isSubMenu && !! overlayBackgroundColor ) {\n\t\tcolors.backgroundColor = overlayBackgroundColor;\n\t} else if ( !! customBackgroundColor ) {\n\t\tcolors.customBackgroundColor = customBackgroundColor;\n\t} else if ( !! backgroundColor ) {\n\t\tcolors.backgroundColor = backgroundColor;\n\t} else if ( !! style?.color?.background ) {\n\t\tcolors.customTextColor = style.color.background;\n\t}\n\n\treturn colors;\n}\n\n/**\n * @typedef {'post-type'|'custom'|'taxonomy'|'post-type-archive'} WPNavigationLinkKind\n */\n\n/**\n * Navigation Link Block Attributes\n *\n * @typedef {Object} WPNavigationLinkBlockAttributes\n *\n * @property {string} [label] Link text.\n * @property {WPNavigationLinkKind} [kind] Kind is used to differentiate between term and post ids to check post draft status.\n * @property {string} [type] The type such as post, page, tag, category and other custom types.\n * @property {string} [rel] The relationship of the linked URL.\n * @property {number} [id] A post or term id.\n * @property {boolean} [opensInNewTab] Sets link target to _blank when true.\n * @property {string} [url] Link href.\n * @property {string} [title] Link title attribute.\n */\n\n/**\n * Link Control onChange handler that updates block attributes when a setting is changed.\n *\n * @param {Object} updatedValue New block attributes to update.\n * @param {Function} setAttributes Block attribute update function.\n * @param {WPNavigationLinkBlockAttributes} blockAttributes Current block attributes.\n *\n */\nexport const updateNavigationLinkBlockAttributes = (\n\tupdatedValue = {},\n\tsetAttributes,\n\tblockAttributes = {}\n) => {\n\tconst {\n\t\tlabel: originalLabel = '',\n\t\tkind: originalKind = '',\n\t\ttype: originalType = '',\n\t} = blockAttributes;\n\tconst {\n\t\ttitle = '',\n\t\turl = '',\n\t\topensInNewTab,\n\t\tid,\n\t\tkind: newKind = originalKind,\n\t\ttype: newType = originalType,\n\t} = updatedValue;\n\n\tconst normalizedTitle = title.replace( /http(s?):\\/\\//gi, '' );\n\tconst normalizedURL = url.replace( /http(s?):\\/\\//gi, '' );\n\tconst escapeTitle =\n\t\ttitle !== '' &&\n\t\tnormalizedTitle !== normalizedURL &&\n\t\toriginalLabel !== title;\n\tconst label = escapeTitle\n\t\t? escapeHtml( title )\n\t\t: originalLabel || escapeHtml( normalizedURL );\n\n\t// In https://github.com/WordPress/gutenberg/pull/24670 we decided to use \"tag\" in favor of \"post_tag\"\n\tconst type = newType === 'post_tag' ? 'tag' : newType.replace( '-', '_' );\n\n\tconst isBuiltInType =\n\t\t[ 'post', 'page', 'tag', 'category' ].indexOf( type ) > -1;\n\n\tconst isCustomLink =\n\t\t( ! newKind && ! isBuiltInType ) || newKind === 'custom';\n\tconst kind = isCustomLink ? 'custom' : newKind;\n\n\tsetAttributes( {\n\t\t// Passed `url` may already be encoded. To prevent double encoding, decodeURI is executed to revert to the original string.\n\t\t...( url && { url: encodeURI( safeDecodeURI( url ) ) } ),\n\t\t...( label && { label } ),\n\t\t...( undefined !== opensInNewTab && { opensInNewTab } ),\n\t\t...( id && Number.isInteger( id ) && { id } ),\n\t\t...( kind && { kind } ),\n\t\t...( type && type !== 'URL' && { type } ),\n\t} );\n};\n\nexport default function NavigationSubmenuEdit( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\n\tmergeBlocks,\n\tonReplace,\n\tcontext,\n\tclientId,\n} ) {\n\tconst { label, type, opensInNewTab, url, description, rel, title, kind } =\n\t\tattributes;\n\tconst link = {\n\t\turl,\n\t\topensInNewTab,\n\t};\n\tconst { showSubmenuIcon, maxNestingLevel, openSubmenusOnClick } = context;\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent, replaceBlock } =\n\t\tuseDispatch( blockEditorStore );\n\tconst [ isLinkOpen, setIsLinkOpen ] = useState( false );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst listItemRef = useRef( null );\n\tconst isDraggingWithin = useIsDraggingWithin( listItemRef );\n\tconst itemLabelPlaceholder = __( 'Add text…' );\n\tconst ref = useRef();\n\n\tconst pagesPermissions = useResourcePermissions( 'pages' );\n\tconst postsPermissions = useResourcePermissions( 'posts' );\n\n\tconst {\n\t\tisAtMaxNesting,\n\t\tisTopLevelItem,\n\t\tisParentOfSelectedBlock,\n\t\tisImmediateParentOfSelectedBlock,\n\t\thasChildren,\n\t\tselectedBlockHasChildren,\n\t\tonlyDescendantIsEmptyLink,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\tgetBlockParentsByBlockName,\n\t\t\t\tgetBlock,\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockOrder,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tlet _onlyDescendantIsEmptyLink;\n\n\t\t\tconst selectedBlockId = getSelectedBlockClientId();\n\n\t\t\tconst selectedBlockChildren = getBlockOrder( selectedBlockId );\n\n\t\t\t// Check for a single descendant in the submenu. If that block\n\t\t\t// is a link block in a \"placeholder\" state with no label then\n\t\t\t// we can consider as an \"empty\" link.\n\t\t\tif ( selectedBlockChildren?.length === 1 ) {\n\t\t\t\tconst singleBlock = getBlock( selectedBlockChildren[ 0 ] );\n\n\t\t\t\t_onlyDescendantIsEmptyLink =\n\t\t\t\t\tsingleBlock?.name === 'core/navigation-link' &&\n\t\t\t\t\t! singleBlock?.attributes?.label;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tisAtMaxNesting:\n\t\t\t\t\tgetBlockParentsByBlockName( clientId, name ).length >=\n\t\t\t\t\tmaxNestingLevel,\n\t\t\t\tisTopLevelItem:\n\t\t\t\t\tgetBlockParentsByBlockName( clientId, name ).length === 0,\n\t\t\t\tisParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\ttrue\n\t\t\t\t),\n\t\t\t\tisImmediateParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\tfalse\n\t\t\t\t),\n\t\t\t\thasChildren: !! getBlockCount( clientId ),\n\t\t\t\tselectedBlockHasChildren: !! selectedBlockChildren?.length,\n\t\t\t\tonlyDescendantIsEmptyLink: _onlyDescendantIsEmptyLink,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\t// Show the LinkControl on mount if the URL is empty\n\t// ( When adding a new menu item)\n\t// This can't be done in the useState call because it conflicts\n\t// with the autofocus behavior of the BlockListBlock component.\n\tuseEffect( () => {\n\t\tif ( ! openSubmenusOnClick && ! url ) {\n\t\t\tsetIsLinkOpen( true );\n\t\t}\n\t}, [] );\n\n\t// Store the colors from context as attributes for rendering.\n\tuseEffect( () => {\n\t\t// This side-effect should not create an undo level as those should\n\t\t// only be created via user interactions. Mark this change as\n\t\t// not persistent to avoid undo level creation.\n\t\t// See https://github.com/WordPress/gutenberg/issues/34564.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tsetAttributes( { isTopLevelItem } );\n\t}, [ isTopLevelItem ] );\n\n\t/**\n\t * The hook shouldn't be necessary but due to a focus loss happening\n\t * when selecting a suggestion in the link popover, we force close on block unselection.\n\t */\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsLinkOpen( false );\n\t\t}\n\t}, [ isSelected ] );\n\n\t// If the LinkControl popover is open and the URL has changed, close the LinkControl and focus the label text.\n\tuseEffect( () => {\n\t\tif ( isLinkOpen && url ) {\n\t\t\t// Does this look like a URL and have something TLD-ish?\n\t\t\tif (\n\t\t\t\tisURL( prependHTTP( label ) ) &&\n\t\t\t\t/^.+\\.[a-z]+/.test( label )\n\t\t\t) {\n\t\t\t\t// Focus and select the label text.\n\t\t\t\tselectLabelText();\n\t\t\t} else {\n\t\t\t\t// Focus it (but do not select).\n\t\t\t\tplaceCaretAtHorizontalEdge( ref.current, true );\n\t\t\t}\n\t\t}\n\t}, [ url ] );\n\n\t/**\n\t * Focus the Link label text and select it.\n\t */\n\tfunction selectLabelText() {\n\t\tref.current.focus();\n\t\tconst { ownerDocument } = ref.current;\n\t\tconst { defaultView } = ownerDocument;\n\t\tconst selection = defaultView.getSelection();\n\t\tconst range = ownerDocument.createRange();\n\t\t// Get the range of the current ref contents so we can add this range to the selection.\n\t\trange.selectNodeContents( ref.current );\n\t\tselection.removeAllRanges();\n\t\tselection.addRange( range );\n\t}\n\n\tlet userCanCreate = false;\n\tif ( ! type || type === 'page' ) {\n\t\tuserCanCreate = pagesPermissions.canCreate;\n\t} else if ( type === 'post' ) {\n\t\tuserCanCreate = postsPermissions.canCreate;\n\t}\n\n\tasync function handleCreate( pageTitle ) {\n\t\tconst postType = type || 'page';\n\n\t\tconst page = await saveEntityRecord( 'postType', postType, {\n\t\t\ttitle: pageTitle,\n\t\t\tstatus: 'draft',\n\t\t} );\n\n\t\treturn {\n\t\t\tid: page.id,\n\t\t\ttype: postType,\n\t\t\ttitle: page.title.rendered,\n\t\t\turl: page.link,\n\t\t\tkind: 'post-type',\n\t\t};\n\t}\n\n\tconst {\n\t\ttextColor,\n\t\tcustomTextColor,\n\t\tbackgroundColor,\n\t\tcustomBackgroundColor,\n\t} = getColors( context, ! isTopLevelItem );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( isKeyboardEvent.primary( event, 'k' ) ) {\n\t\t\tsetIsLinkOpen( true );\n\t\t}\n\t}\n\n\tconst blockProps = useBlockProps( {\n\t\tref: useMergeRefs( [ setPopoverAnchor, listItemRef ] ),\n\t\tclassName: classnames( 'wp-block-navigation-item', {\n\t\t\t'is-editing': isSelected || isParentOfSelectedBlock,\n\t\t\t'is-dragging-within': isDraggingWithin,\n\t\t\t'has-link': !! url,\n\t\t\t'has-child': hasChildren,\n\t\t\t'has-text-color': !! textColor || !! customTextColor,\n\t\t\t[ getColorClassName( 'color', textColor ) ]: !! textColor,\n\t\t\t'has-background': !! backgroundColor || customBackgroundColor,\n\t\t\t[ getColorClassName( 'background-color', backgroundColor ) ]:\n\t\t\t\t!! backgroundColor,\n\t\t\t'open-on-click': openSubmenusOnClick,\n\t\t} ),\n\t\tstyle: {\n\t\t\tcolor: ! textColor && customTextColor,\n\t\t\tbackgroundColor: ! backgroundColor && customBackgroundColor,\n\t\t},\n\t\tonKeyDown,\n\t} );\n\n\t// Always use overlay colors for submenus.\n\tconst innerBlocksColors = getColors( context, true );\n\n\tconst allowedBlocks = isAtMaxNesting\n\t\t? ALLOWED_BLOCKS.filter(\n\t\t\t\t( blockName ) => blockName !== 'core/navigation-submenu'\n\t\t )\n\t\t: ALLOWED_BLOCKS;\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{\n\t\t\tclassName: classnames( 'wp-block-navigation__submenu-container', {\n\t\t\t\t'is-parent-of-selected-block': isParentOfSelectedBlock,\n\t\t\t\t'has-text-color': !! (\n\t\t\t\t\tinnerBlocksColors.textColor ||\n\t\t\t\t\tinnerBlocksColors.customTextColor\n\t\t\t\t),\n\t\t\t\t[ `has-${ innerBlocksColors.textColor }-color` ]:\n\t\t\t\t\t!! innerBlocksColors.textColor,\n\t\t\t\t'has-background': !! (\n\t\t\t\t\tinnerBlocksColors.backgroundColor ||\n\t\t\t\t\tinnerBlocksColors.customBackgroundColor\n\t\t\t\t),\n\t\t\t\t[ `has-${ innerBlocksColors.backgroundColor }-background-color` ]:\n\t\t\t\t\t!! innerBlocksColors.backgroundColor,\n\t\t\t} ),\n\t\t\tstyle: {\n\t\t\t\tcolor: innerBlocksColors.customTextColor,\n\t\t\t\tbackgroundColor: innerBlocksColors.customBackgroundColor,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tallowedBlocks,\n\t\t\t__experimentalDefaultBlock: DEFAULT_BLOCK,\n\t\t\t__experimentalDirectInsert: true,\n\n\t\t\t// Ensure block toolbar is not too far removed from item\n\t\t\t// being edited.\n\t\t\t// see: https://github.com/WordPress/gutenberg/pull/34615.\n\t\t\t__experimentalCaptureToolbars: true,\n\n\t\t\trenderAppender:\n\t\t\t\tisSelected ||\n\t\t\t\t( isImmediateParentOfSelectedBlock &&\n\t\t\t\t\t! selectedBlockHasChildren ) ||\n\t\t\t\t// Show the appender while dragging to allow inserting element between item and the appender.\n\t\t\t\thasChildren\n\t\t\t\t\t? InnerBlocks.ButtonBlockAppender\n\t\t\t\t\t: false,\n\t\t}\n\t);\n\n\tconst ParentElement = openSubmenusOnClick ? 'button' : 'a';\n\n\tfunction transformToLink() {\n\t\tconst newLinkBlock = createBlock( 'core/navigation-link', attributes );\n\t\treplaceBlock( clientId, newLinkBlock );\n\t}\n\n\tconst canConvertToLink =\n\t\t! selectedBlockHasChildren || onlyDescendantIsEmptyLink;\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t{ ! openSubmenusOnClick && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tname=\"link\"\n\t\t\t\t\t\t\ticon={ linkIcon }\n\t\t\t\t\t\t\ttitle={ __( 'Link' ) }\n\t\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t\t\tonClick={ () => setIsLinkOpen( true ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tname=\"revert\"\n\t\t\t\t\t\ticon={ removeSubmenu }\n\t\t\t\t\t\ttitle={ __( 'Convert to Link' ) }\n\t\t\t\t\t\tonClick={ transformToLink }\n\t\t\t\t\t\tclassName=\"wp-block-navigation__submenu__revert\"\n\t\t\t\t\t\tisDisabled={ ! canConvertToLink }\n\t\t\t\t\t/>\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Link settings' ) }>\n\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\tvalue={ description || '' }\n\t\t\t\t\t\tonChange={ ( descriptionValue ) => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tdescription: descriptionValue,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'The description will be displayed in the menu if the current theme supports it.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tvalue={ title || '' }\n\t\t\t\t\t\tonChange={ ( titleValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { title: titleValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Link title' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\t\tonChange={ ( relValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { rel: relValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ /* eslint-disable jsx-a11y/anchor-is-valid */ }\n\t\t\t\t<ParentElement className=\"wp-block-navigation-item__content\">\n\t\t\t\t\t{ /* eslint-enable */ }\n\t\t\t\t\t{\n\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\t\t\tclassName=\"wp-block-navigation-item__label\"\n\t\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\t\tonChange={ ( labelValue ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { label: labelValue } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonMerge={ mergeBlocks }\n\t\t\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\t\t\taria-label={ __( 'Navigation link text' ) }\n\t\t\t\t\t\t\tplaceholder={ itemLabelPlaceholder }\n\t\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\t\tallowedFormats={ [\n\t\t\t\t\t\t\t\t'core/bold',\n\t\t\t\t\t\t\t\t'core/italic',\n\t\t\t\t\t\t\t\t'core/image',\n\t\t\t\t\t\t\t\t'core/strikethrough',\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tif ( ! openSubmenusOnClick && ! url ) {\n\t\t\t\t\t\t\t\t\tsetIsLinkOpen( true );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t\t{ ! openSubmenusOnClick && isLinkOpen && (\n\t\t\t\t\t\t<Popover\n\t\t\t\t\t\t\tplacement=\"bottom\"\n\t\t\t\t\t\t\tonClose={ () => setIsLinkOpen( false ) }\n\t\t\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\t\t\tshift\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<LinkControl\n\t\t\t\t\t\t\t\tclassName=\"wp-block-navigation-link__inline-link-input\"\n\t\t\t\t\t\t\t\tvalue={ link }\n\t\t\t\t\t\t\t\tshowInitialSuggestions={ true }\n\t\t\t\t\t\t\t\twithCreateSuggestion={ userCanCreate }\n\t\t\t\t\t\t\t\tcreateSuggestion={ handleCreate }\n\t\t\t\t\t\t\t\tcreateSuggestionButtonText={ ( searchTerm ) => {\n\t\t\t\t\t\t\t\t\tlet format;\n\t\t\t\t\t\t\t\t\tif ( type === 'post' ) {\n\t\t\t\t\t\t\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t\t\t\t\t\t\tformat = __(\n\t\t\t\t\t\t\t\t\t\t\t'Create draft post: <mark>%s</mark>'\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t\t\t\t\t\t\tformat = __(\n\t\t\t\t\t\t\t\t\t\t\t'Create draft page: <mark>%s</mark>'\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn createInterpolateElement(\n\t\t\t\t\t\t\t\t\t\tsprintf( format, searchTerm ),\n\t\t\t\t\t\t\t\t\t\t{ mark: <mark /> }\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tnoDirectEntry={ !! type }\n\t\t\t\t\t\t\t\tnoURLSuggestion={ !! type }\n\t\t\t\t\t\t\t\tsuggestionsQuery={ getSuggestionsQuery(\n\t\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\t\tkind\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tonChange={ ( updatedValue ) =>\n\t\t\t\t\t\t\t\t\tupdateNavigationLinkBlockAttributes(\n\t\t\t\t\t\t\t\t\t\tupdatedValue,\n\t\t\t\t\t\t\t\t\t\tsetAttributes,\n\t\t\t\t\t\t\t\t\t\tattributes\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\t\t\tsetAttributes( { url: '' } );\n\t\t\t\t\t\t\t\t\tspeak( __( 'Link removed.' ), 'assertive' );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Popover>\n\t\t\t\t\t) }\n\t\t\t\t</ParentElement>\n\t\t\t\t{ ( showSubmenuIcon || openSubmenusOnClick ) && (\n\t\t\t\t\t<span className=\"wp-block-navigation__submenu-icon\">\n\t\t\t\t\t\t<ItemSubmenuIcon />\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t</div>\n\t\t</Fragment>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/navigation-submenu/edit.js"],"names":["ALLOWED_BLOCKS","DEFAULT_BLOCK","name","useIsDraggingWithin","elementRef","isDraggingWithin","setIsDraggingWithin","ownerDocument","current","handleDragStart","event","handleDragEnter","handleDragEnd","contains","target","addEventListener","removeEventListener","NavigationSubmenuEdit","attributes","isSelected","setAttributes","mergeBlocks","onReplace","context","clientId","label","type","url","description","rel","title","showSubmenuIcon","maxNestingLevel","openSubmenusOnClick","__unstableMarkNextChangeAsNotPersistent","replaceBlock","blockEditorStore","isLinkOpen","setIsLinkOpen","popoverAnchor","setPopoverAnchor","listItemRef","itemLabelPlaceholder","ref","pagesPermissions","postsPermissions","isAtMaxNesting","isTopLevelItem","isParentOfSelectedBlock","isImmediateParentOfSelectedBlock","hasChildren","selectedBlockHasChildren","onlyDescendantIsEmptyLink","select","hasSelectedInnerBlock","getSelectedBlockClientId","getBlockParentsByBlockName","getBlock","getBlockCount","getBlockOrder","_onlyDescendantIsEmptyLink","selectedBlockId","selectedBlockChildren","length","singleBlock","prevHasChildren","test","selectLabelText","focus","defaultView","selection","getSelection","range","createRange","selectNodeContents","removeAllRanges","addRange","userCanCreate","canCreate","textColor","customTextColor","backgroundColor","customBackgroundColor","onKeyDown","isKeyboardEvent","primary","blockProps","className","style","color","innerBlocksColors","allowedBlocks","filter","blockName","navigationChildBlockProps","innerBlocksProps","__experimentalDefaultBlock","__experimentalDirectInsert","__experimentalCaptureToolbars","renderAppender","InnerBlocks","ButtonBlockAppender","ParentElement","transformToLink","newLinkBlock","canConvertToLink","linkIcon","displayShortcut","removeSubmenu","labelValue","urlValue","descriptionValue","titleValue","relValue","updatedValue"],"mappings":";;;;;;;;;AA6BA;;AA1BA;;AAKA;;AACA;;AAOA;;AACA;;AACA;;AAUA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAEA;;AACA;;AACA;;AA5CA;AACA;AACA;;AAGA;AACA;AACA;;AA8BA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,MAAMA,cAAc,GAAG,CACtB,sBADsB,EAEtB,yBAFsB,EAGtB,gBAHsB,CAAvB;AAMA,MAAMC,aAAa,GAAG;AACrBC,EAAAA,IAAI,EAAE;AADe,CAAtB;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,mBAAmB,GAAKC,UAAF,IAA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;AAaC,IAAA,cAAc,EAAG,CAChB,WADgB,EAEhB,aAFgB,EAGhB,YAHgB,EAIhB,oBAJgB,CAblB;AAmBC,IAAA,OAAO,EAAG,MAAM;AACf,UAAK,CAAET,mBAAF,IAAyB,CAAEN,GAAhC,EAAsC;AACrCW,QAAAA,aAAa,CAAE,IAAF,CAAb;AACA;AACD;AAvBF,IAHF,EA6BG,CAAEL,mBAAF,IAAyBI,UAAzB,IACD,4BAAC,cAAD;AACC,IAAA,SAAS,EAAC,6CADX;AAEC,IAAA,QAAQ,EAAGb,QAFZ;AAGC,IAAA,IAAI,EAAGN,UAHR;AAIC,IAAA,OAAO,EAAG,MAAMoB,aAAa,CAAE,KAAF,CAJ9B;AAKC,IAAA,MAAM,EAAGC,aALV;AAMC,IAAA,mBAAmB,EAAGsC,aANvB;AAOC,IAAA,QAAQ,EAAG,MAAM;AAChBzD,MAAAA,aAAa,CAAE;AAAEO,QAAAA,GAAG,EAAE;AAAP,OAAF,CAAb;AACA,uBAAO,cAAI,eAAJ,CAAP,EAA8B,WAA9B;AACA,KAVF;AAWC,IAAA,QAAQ,EAAKuF,YAAF,IAAoB;AAC9B,8CACCA,YADD,EAEC9F,aAFD,EAGCF,UAHD;AAKA;AAjBF,IA9BF,CAFD,EAqDG,CAAEa,eAAe,IAAIE,mBAArB,KACD;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC,4BAAC,uBAAD,OADD,CAtDF,EA0DC,mCAAU8D,gBAAV,CA1DD,CAzED,CADD;AAwIA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tPanelBody,\n\tTextControl,\n\tTextareaControl,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { displayShortcut, isKeyboardEvent } from '@wordpress/keycodes';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tInnerBlocks,\n\tuseInnerBlocksProps,\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tgetColorClassName,\n} from '@wordpress/block-editor';\nimport { isURL, prependHTTP } from '@wordpress/url';\nimport { useState, useEffect, useRef } from '@wordpress/element';\nimport { placeCaretAtHorizontalEdge } from '@wordpress/dom';\nimport { link as linkIcon, removeSubmenu } from '@wordpress/icons';\nimport { useResourcePermissions } from '@wordpress/core-data';\nimport { speak } from '@wordpress/a11y';\nimport { createBlock } from '@wordpress/blocks';\nimport { useMergeRefs, usePrevious } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { ItemSubmenuIcon } from './icons';\nimport { name } from './block.json';\nimport { LinkUI } from '../navigation-link/link-ui';\nimport { updateAttributes } from '../navigation-link/update-attributes';\nimport {\n\tgetColors,\n\tgetNavigationChildBlockProps,\n} from '../navigation/edit/utils';\n\nconst ALLOWED_BLOCKS = [\n\t'core/navigation-link',\n\t'core/navigation-submenu',\n\t'core/page-list',\n];\n\nconst DEFAULT_BLOCK = {\n\tname: 'core/navigation-link',\n};\n\n/**\n * A React hook to determine if it's dragging within the target element.\n *\n * @typedef {import('@wordpress/element').RefObject} RefObject\n *\n * @param {RefObject<HTMLElement>} elementRef The target elementRef object.\n *\n * @return {boolean} Is dragging within the target element.\n */\nconst useIsDraggingWithin = ( elementRef ) => {\n\tconst [ isDraggingWithin, setIsDraggingWithin ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst { ownerDocument } = elementRef.current;\n\n\t\tfunction handleDragStart( event ) {\n\t\t\t// Check the first time when the dragging starts.\n\t\t\thandleDragEnter( event );\n\t\t}\n\n\t\t// Set to false whenever the user cancel the drag event by either releasing the mouse or press Escape.\n\t\tfunction handleDragEnd() {\n\t\t\tsetIsDraggingWithin( false );\n\t\t}\n\n\t\tfunction handleDragEnter( event ) {\n\t\t\t// Check if the current target is inside the item element.\n\t\t\tif ( elementRef.current.contains( event.target ) ) {\n\t\t\t\tsetIsDraggingWithin( true );\n\t\t\t} else {\n\t\t\t\tsetIsDraggingWithin( false );\n\t\t\t}\n\t\t}\n\n\t\t// Bind these events to the document to catch all drag events.\n\t\t// Ideally, we can also use `event.relatedTarget`, but sadly that\n\t\t// doesn't work in Safari.\n\t\townerDocument.addEventListener( 'dragstart', handleDragStart );\n\t\townerDocument.addEventListener( 'dragend', handleDragEnd );\n\t\townerDocument.addEventListener( 'dragenter', handleDragEnter );\n\n\t\treturn () => {\n\t\t\townerDocument.removeEventListener( 'dragstart', handleDragStart );\n\t\t\townerDocument.removeEventListener( 'dragend', handleDragEnd );\n\t\t\townerDocument.removeEventListener( 'dragenter', handleDragEnter );\n\t\t};\n\t}, [] );\n\n\treturn isDraggingWithin;\n};\n\n/**\n * @typedef {'post-type'|'custom'|'taxonomy'|'post-type-archive'} WPNavigationLinkKind\n */\n\n/**\n * Navigation Link Block Attributes\n *\n * @typedef {Object} WPNavigationLinkBlockAttributes\n *\n * @property {string} [label] Link text.\n * @property {WPNavigationLinkKind} [kind] Kind is used to differentiate between term and post ids to check post draft status.\n * @property {string} [type] The type such as post, page, tag, category and other custom types.\n * @property {string} [rel] The relationship of the linked URL.\n * @property {number} [id] A post or term id.\n * @property {boolean} [opensInNewTab] Sets link target to _blank when true.\n * @property {string} [url] Link href.\n * @property {string} [title] Link title attribute.\n */\n\nexport default function NavigationSubmenuEdit( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\n\tmergeBlocks,\n\tonReplace,\n\tcontext,\n\tclientId,\n} ) {\n\tconst { label, type, url, description, rel, title } = attributes;\n\n\tconst { showSubmenuIcon, maxNestingLevel, openSubmenusOnClick } = context;\n\n\tconst { __unstableMarkNextChangeAsNotPersistent, replaceBlock } =\n\t\tuseDispatch( blockEditorStore );\n\tconst [ isLinkOpen, setIsLinkOpen ] = useState( false );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst listItemRef = useRef( null );\n\tconst isDraggingWithin = useIsDraggingWithin( listItemRef );\n\tconst itemLabelPlaceholder = __( 'Add text…' );\n\tconst ref = useRef();\n\n\tconst pagesPermissions = useResourcePermissions( 'pages' );\n\tconst postsPermissions = useResourcePermissions( 'posts' );\n\n\tconst {\n\t\tisAtMaxNesting,\n\t\tisTopLevelItem,\n\t\tisParentOfSelectedBlock,\n\t\tisImmediateParentOfSelectedBlock,\n\t\thasChildren,\n\t\tselectedBlockHasChildren,\n\t\tonlyDescendantIsEmptyLink,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\tgetBlockParentsByBlockName,\n\t\t\t\tgetBlock,\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockOrder,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tlet _onlyDescendantIsEmptyLink;\n\n\t\t\tconst selectedBlockId = getSelectedBlockClientId();\n\n\t\t\tconst selectedBlockChildren = getBlockOrder( selectedBlockId );\n\n\t\t\t// Check for a single descendant in the submenu. If that block\n\t\t\t// is a link block in a \"placeholder\" state with no label then\n\t\t\t// we can consider as an \"empty\" link.\n\t\t\tif ( selectedBlockChildren?.length === 1 ) {\n\t\t\t\tconst singleBlock = getBlock( selectedBlockChildren[ 0 ] );\n\n\t\t\t\t_onlyDescendantIsEmptyLink =\n\t\t\t\t\tsingleBlock?.name === 'core/navigation-link' &&\n\t\t\t\t\t! singleBlock?.attributes?.label;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tisAtMaxNesting:\n\t\t\t\t\tgetBlockParentsByBlockName( clientId, name ).length >=\n\t\t\t\t\tmaxNestingLevel,\n\t\t\t\tisTopLevelItem:\n\t\t\t\t\tgetBlockParentsByBlockName( clientId, name ).length === 0,\n\t\t\t\tisParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\ttrue\n\t\t\t\t),\n\t\t\t\tisImmediateParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\tfalse\n\t\t\t\t),\n\t\t\t\thasChildren: !! getBlockCount( clientId ),\n\t\t\t\tselectedBlockHasChildren: !! selectedBlockChildren?.length,\n\t\t\t\tonlyDescendantIsEmptyLink: _onlyDescendantIsEmptyLink,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst prevHasChildren = usePrevious( hasChildren );\n\n\t// Show the LinkControl on mount if the URL is empty\n\t// ( When adding a new menu item)\n\t// This can't be done in the useState call because it conflicts\n\t// with the autofocus behavior of the BlockListBlock component.\n\tuseEffect( () => {\n\t\tif ( ! openSubmenusOnClick && ! url ) {\n\t\t\tsetIsLinkOpen( true );\n\t\t}\n\t}, [] );\n\n\t// Store the colors from context as attributes for rendering.\n\tuseEffect( () => {\n\t\t// This side-effect should not create an undo level as those should\n\t\t// only be created via user interactions. Mark this change as\n\t\t// not persistent to avoid undo level creation.\n\t\t// See https://github.com/WordPress/gutenberg/issues/34564.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tsetAttributes( { isTopLevelItem } );\n\t}, [ isTopLevelItem ] );\n\n\t/**\n\t * The hook shouldn't be necessary but due to a focus loss happening\n\t * when selecting a suggestion in the link popover, we force close on block unselection.\n\t */\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsLinkOpen( false );\n\t\t}\n\t}, [ isSelected ] );\n\n\t// If the LinkControl popover is open and the URL has changed, close the LinkControl and focus the label text.\n\tuseEffect( () => {\n\t\tif ( isLinkOpen && url ) {\n\t\t\t// Does this look like a URL and have something TLD-ish?\n\t\t\tif (\n\t\t\t\tisURL( prependHTTP( label ) ) &&\n\t\t\t\t/^.+\\.[a-z]+/.test( label )\n\t\t\t) {\n\t\t\t\t// Focus and select the label text.\n\t\t\t\tselectLabelText();\n\t\t\t} else {\n\t\t\t\t// Focus it (but do not select).\n\t\t\t\tplaceCaretAtHorizontalEdge( ref.current, true );\n\t\t\t}\n\t\t}\n\t}, [ url ] );\n\n\t/**\n\t * Focus the Link label text and select it.\n\t */\n\tfunction selectLabelText() {\n\t\tref.current.focus();\n\t\tconst { ownerDocument } = ref.current;\n\t\tconst { defaultView } = ownerDocument;\n\t\tconst selection = defaultView.getSelection();\n\t\tconst range = ownerDocument.createRange();\n\t\t// Get the range of the current ref contents so we can add this range to the selection.\n\t\trange.selectNodeContents( ref.current );\n\t\tselection.removeAllRanges();\n\t\tselection.addRange( range );\n\t}\n\n\tlet userCanCreate = false;\n\tif ( ! type || type === 'page' ) {\n\t\tuserCanCreate = pagesPermissions.canCreate;\n\t} else if ( type === 'post' ) {\n\t\tuserCanCreate = postsPermissions.canCreate;\n\t}\n\n\tconst {\n\t\ttextColor,\n\t\tcustomTextColor,\n\t\tbackgroundColor,\n\t\tcustomBackgroundColor,\n\t} = getColors( context, ! isTopLevelItem );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( isKeyboardEvent.primary( event, 'k' ) ) {\n\t\t\tsetIsLinkOpen( true );\n\t\t}\n\t}\n\n\tconst blockProps = useBlockProps( {\n\t\tref: useMergeRefs( [ setPopoverAnchor, listItemRef ] ),\n\t\tclassName: classnames( 'wp-block-navigation-item', {\n\t\t\t'is-editing': isSelected || isParentOfSelectedBlock,\n\t\t\t'is-dragging-within': isDraggingWithin,\n\t\t\t'has-link': !! url,\n\t\t\t'has-child': hasChildren,\n\t\t\t'has-text-color': !! textColor || !! customTextColor,\n\t\t\t[ getColorClassName( 'color', textColor ) ]: !! textColor,\n\t\t\t'has-background': !! backgroundColor || customBackgroundColor,\n\t\t\t[ getColorClassName( 'background-color', backgroundColor ) ]:\n\t\t\t\t!! backgroundColor,\n\t\t\t'open-on-click': openSubmenusOnClick,\n\t\t} ),\n\t\tstyle: {\n\t\t\tcolor: ! textColor && customTextColor,\n\t\t\tbackgroundColor: ! backgroundColor && customBackgroundColor,\n\t\t},\n\t\tonKeyDown,\n\t} );\n\n\t// Always use overlay colors for submenus.\n\tconst innerBlocksColors = getColors( context, true );\n\n\tconst allowedBlocks = isAtMaxNesting\n\t\t? ALLOWED_BLOCKS.filter(\n\t\t\t\t( blockName ) => blockName !== 'core/navigation-submenu'\n\t\t )\n\t\t: ALLOWED_BLOCKS;\n\n\tconst navigationChildBlockProps =\n\t\tgetNavigationChildBlockProps( innerBlocksColors );\n\tconst innerBlocksProps = useInnerBlocksProps( navigationChildBlockProps, {\n\t\tallowedBlocks,\n\t\t__experimentalDefaultBlock: DEFAULT_BLOCK,\n\t\t__experimentalDirectInsert: true,\n\n\t\t// Ensure block toolbar is not too far removed from item\n\t\t// being edited.\n\t\t// see: https://github.com/WordPress/gutenberg/pull/34615.\n\t\t__experimentalCaptureToolbars: true,\n\n\t\trenderAppender:\n\t\t\tisSelected ||\n\t\t\t( isImmediateParentOfSelectedBlock &&\n\t\t\t\t! selectedBlockHasChildren ) ||\n\t\t\t// Show the appender while dragging to allow inserting element between item and the appender.\n\t\t\thasChildren\n\t\t\t\t? InnerBlocks.ButtonBlockAppender\n\t\t\t\t: false,\n\t} );\n\n\tconst ParentElement = openSubmenusOnClick ? 'button' : 'a';\n\n\tfunction transformToLink() {\n\t\tconst newLinkBlock = createBlock( 'core/navigation-link', attributes );\n\t\treplaceBlock( clientId, newLinkBlock );\n\t}\n\n\tuseEffect( () => {\n\t\t// If block becomes empty, transform to Navigation Link.\n\t\tif ( ! hasChildren && prevHasChildren ) {\n\t\t\ttransformToLink();\n\t\t}\n\t}, [ hasChildren, prevHasChildren ] );\n\n\tconst canConvertToLink =\n\t\t! selectedBlockHasChildren || onlyDescendantIsEmptyLink;\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t{ ! openSubmenusOnClick && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tname=\"link\"\n\t\t\t\t\t\t\ticon={ linkIcon }\n\t\t\t\t\t\t\ttitle={ __( 'Link' ) }\n\t\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t\t\tonClick={ () => setIsLinkOpen( true ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tname=\"revert\"\n\t\t\t\t\t\ticon={ removeSubmenu }\n\t\t\t\t\t\ttitle={ __( 'Convert to Link' ) }\n\t\t\t\t\t\tonClick={ transformToLink }\n\t\t\t\t\t\tclassName=\"wp-block-navigation__submenu__revert\"\n\t\t\t\t\t\tisDisabled={ ! canConvertToLink }\n\t\t\t\t\t/>\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t{ /* Warning, this duplicated in packages/block-library/src/navigation-link/edit.js */ }\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Link settings' ) }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tvalue={ label || '' }\n\t\t\t\t\t\tonChange={ ( labelValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { label: labelValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Label' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tvalue={ url || '' }\n\t\t\t\t\t\tonChange={ ( urlValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { url: urlValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'URL' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tvalue={ description || '' }\n\t\t\t\t\t\tonChange={ ( descriptionValue ) => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tdescription: descriptionValue,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'The description will be displayed in the menu if the current theme supports it.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tvalue={ title || '' }\n\t\t\t\t\t\tonChange={ ( titleValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { title: titleValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Link title' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\t\tonChange={ ( relValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { rel: relValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ /* eslint-disable jsx-a11y/anchor-is-valid */ }\n\t\t\t\t<ParentElement className=\"wp-block-navigation-item__content\">\n\t\t\t\t\t{ /* eslint-enable */ }\n\t\t\t\t\t{\n\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\t\t\tclassName=\"wp-block-navigation-item__label\"\n\t\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\t\tonChange={ ( labelValue ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { label: labelValue } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonMerge={ mergeBlocks }\n\t\t\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\t\t\taria-label={ __( 'Navigation link text' ) }\n\t\t\t\t\t\t\tplaceholder={ itemLabelPlaceholder }\n\t\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\t\tallowedFormats={ [\n\t\t\t\t\t\t\t\t'core/bold',\n\t\t\t\t\t\t\t\t'core/italic',\n\t\t\t\t\t\t\t\t'core/image',\n\t\t\t\t\t\t\t\t'core/strikethrough',\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tif ( ! openSubmenusOnClick && ! url ) {\n\t\t\t\t\t\t\t\t\tsetIsLinkOpen( true );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t\t{ ! openSubmenusOnClick && isLinkOpen && (\n\t\t\t\t\t\t<LinkUI\n\t\t\t\t\t\t\tclassName=\"wp-block-navigation-link__inline-link-input\"\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tlink={ attributes }\n\t\t\t\t\t\t\tonClose={ () => setIsLinkOpen( false ) }\n\t\t\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\t\t\thasCreateSuggestion={ userCanCreate }\n\t\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( { url: '' } );\n\t\t\t\t\t\t\t\tspeak( __( 'Link removed.' ), 'assertive' );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonChange={ ( updatedValue ) => {\n\t\t\t\t\t\t\t\tupdateAttributes(\n\t\t\t\t\t\t\t\t\tupdatedValue,\n\t\t\t\t\t\t\t\t\tsetAttributes,\n\t\t\t\t\t\t\t\t\tattributes\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ParentElement>\n\t\t\t\t{ ( showSubmenuIcon || openSubmenusOnClick ) && (\n\t\t\t\t\t<span className=\"wp-block-navigation__submenu-icon\">\n\t\t\t\t\t\t<ItemSubmenuIcon />\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.convertDescription = void 0;
|
|
7
|
+
|
|
8
|
+
var _i18n = require("@wordpress/i18n");
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* WordPress dependencies
|
|
12
|
+
*/
|
|
13
|
+
const convertDescription = (0, _i18n.__)('This menu is automatically kept in sync with pages on your site. You can manage the menu yourself by clicking customize below.');
|
|
14
|
+
exports.convertDescription = convertDescription;
|
|
15
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/page-list/constants.js"],"names":["convertDescription"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAGO,MAAMA,kBAAkB,GAAG,cACjC,gIADiC,CAA3B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nexport const convertDescription = __(\n\t'This menu is automatically kept in sync with pages on your site. You can manage the menu yourself by clicking customize below.'\n);\n"]}
|