@wordpress/block-library 9.38.0 → 9.39.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 +2 -0
- package/build/block/block.json +2 -1
- package/build/breadcrumbs/edit.cjs +15 -5
- package/build/breadcrumbs/edit.cjs.map +2 -2
- package/build/breadcrumbs/index.cjs +1 -0
- package/build/breadcrumbs/index.cjs.map +2 -2
- package/build/button/index.cjs +3 -0
- package/build/button/index.cjs.map +2 -2
- package/build/comment-date/block.json +1 -0
- package/build/comment-edit-link/block.json +1 -3
- package/build/comment-edit-link/deprecated.cjs +91 -0
- package/build/comment-edit-link/deprecated.cjs.map +7 -0
- package/build/comment-edit-link/edit.cjs +6 -18
- package/build/comment-edit-link/edit.cjs.map +3 -3
- package/build/comment-edit-link/index.cjs +2 -0
- package/build/comment-edit-link/index.cjs.map +3 -3
- package/build/comment-reply-link/block.json +1 -5
- package/build/comment-reply-link/deprecated.cjs +84 -0
- package/build/comment-reply-link/deprecated.cjs.map +7 -0
- package/build/comment-reply-link/edit.cjs +10 -23
- package/build/comment-reply-link/edit.cjs.map +3 -3
- package/build/comment-reply-link/index.cjs +2 -0
- package/build/comment-reply-link/index.cjs.map +3 -3
- package/build/comments-title/block.json +1 -3
- package/build/comments-title/deprecated.cjs +148 -24
- package/build/comments-title/deprecated.cjs.map +3 -3
- package/build/comments-title/edit.cjs +17 -31
- package/build/comments-title/edit.cjs.map +3 -3
- package/build/cover/edit/block-controls.cjs +10 -2
- package/build/cover/edit/block-controls.cjs.map +2 -2
- package/build/cover/edit/embed-video-url-input.cjs +6 -2
- package/build/cover/edit/embed-video-url-input.cjs.map +2 -2
- package/build/cover/edit/inspector-controls.cjs +1 -1
- package/build/cover/edit/inspector-controls.cjs.map +2 -2
- package/build/details/index.cjs +3 -0
- package/build/details/index.cjs.map +2 -2
- package/build/embed/util.cjs +9 -0
- package/build/embed/util.cjs.map +2 -2
- package/build/freeform/block.json +2 -1
- package/build/heading/index.cjs +3 -0
- package/build/heading/index.cjs.map +2 -2
- package/build/html/block.json +2 -1
- package/build/image/image.cjs +43 -9
- package/build/image/image.cjs.map +2 -2
- package/build/image/index.cjs +1 -1
- package/build/image/index.cjs.map +2 -2
- package/build/index.cjs +6 -0
- package/build/index.cjs.map +2 -2
- package/build/list-item/index.cjs +12 -1
- package/build/list-item/index.cjs.map +2 -2
- package/build/missing/block.json +2 -1
- package/build/more/block.json +2 -1
- package/build/more/index.cjs +1 -1
- package/build/more/index.cjs.map +2 -2
- package/build/navigation/block.json +5 -4
- package/build/navigation/deprecated.cjs +133 -5
- package/build/navigation/deprecated.cjs.map +2 -2
- package/build/navigation/edit/deleted-overlay-warning.cjs +70 -0
- package/build/navigation/edit/deleted-overlay-warning.cjs.map +7 -0
- package/build/navigation/edit/index.cjs +143 -65
- package/build/navigation/edit/index.cjs.map +3 -3
- package/build/navigation/edit/overlay-panel.cjs +10 -1
- package/build/navigation/edit/overlay-panel.cjs.map +3 -3
- package/build/navigation/edit/overlay-preview.cjs +120 -0
- package/build/navigation/edit/overlay-preview.cjs.map +7 -0
- package/build/navigation/edit/overlay-template-part-selector.cjs +59 -24
- package/build/navigation/edit/overlay-template-part-selector.cjs.map +3 -3
- package/build/navigation/edit/responsive-wrapper.cjs +12 -1
- package/build/navigation/edit/responsive-wrapper.cjs.map +3 -3
- package/build/navigation/edit/use-create-overlay.cjs +19 -2
- package/build/navigation/edit/use-create-overlay.cjs.map +3 -3
- package/build/navigation/utils/get-submenu-visibility.cjs +37 -0
- package/build/navigation/utils/get-submenu-visibility.cjs.map +7 -0
- package/build/navigation-link/edit.cjs +2 -40
- package/build/navigation-link/edit.cjs.map +2 -2
- package/build/navigation-link/shared/index.cjs +6 -0
- package/build/navigation-link/shared/index.cjs.map +2 -2
- package/build/navigation-link/shared/select-label-text.cjs +40 -0
- package/build/navigation-link/shared/select-label-text.cjs.map +7 -0
- package/build/navigation-link/shared/use-is-dragging-within.cjs +59 -0
- package/build/navigation-link/shared/use-is-dragging-within.cjs.map +7 -0
- package/build/navigation-submenu/block.json +1 -1
- package/build/navigation-submenu/edit.cjs +8 -47
- package/build/navigation-submenu/edit.cjs.map +2 -2
- package/build/navigation-submenu/index.cjs +2 -2
- package/build/navigation-submenu/index.cjs.map +2 -2
- package/build/nextpage/block.json +2 -1
- package/build/paragraph/block.json +1 -0
- package/build/paragraph/index.cjs +1 -1
- package/build/paragraph/index.cjs.map +2 -2
- package/build/post-excerpt/edit.cjs +1 -1
- package/build/post-excerpt/edit.cjs.map +2 -2
- package/build/shortcode/block.json +2 -1
- package/build/tab/add-tab-toolbar-control.cjs +31 -9
- package/build/tab/add-tab-toolbar-control.cjs.map +2 -2
- package/build/tab/block.json +18 -4
- package/build/tab/controls.cjs +4 -8
- package/build/tab/controls.cjs.map +3 -3
- package/build/tab/edit.cjs +46 -118
- package/build/tab/edit.cjs.map +3 -3
- package/build/tab/remove-tab-toolbar-control.cjs +91 -0
- package/build/tab/remove-tab-toolbar-control.cjs.map +7 -0
- package/build/tab/save.cjs +2 -2
- package/build/tab/save.cjs.map +2 -2
- package/build/tab-panels/block.json +70 -0
- package/build/tab-panels/edit.cjs +63 -0
- package/build/tab-panels/edit.cjs.map +7 -0
- package/build/tab-panels/icon.cjs +29 -0
- package/build/tab-panels/icon.cjs.map +7 -0
- package/build/tab-panels/index.cjs +58 -0
- package/build/tab-panels/index.cjs.map +7 -0
- package/build/tab-panels/save.cjs +33 -0
- package/build/tab-panels/save.cjs.map +7 -0
- package/build/tabs/block.json +61 -90
- package/build/tabs/controls.cjs +19 -221
- package/build/tabs/controls.cjs.map +3 -3
- package/build/tabs/deprecated.cjs +179 -0
- package/build/tabs/deprecated.cjs.map +7 -0
- package/build/tabs/edit.cjs +84 -62
- package/build/tabs/edit.cjs.map +3 -3
- package/build/tabs/index.cjs +3 -1
- package/build/tabs/index.cjs.map +3 -3
- package/build/tabs/save.cjs +6 -9
- package/build/tabs/save.cjs.map +2 -2
- package/build/tabs-menu/block.json +77 -0
- package/build/tabs-menu/edit.cjs +204 -0
- package/build/tabs-menu/edit.cjs.map +7 -0
- package/build/tabs-menu/icon.cjs +29 -0
- package/build/tabs-menu/icon.cjs.map +7 -0
- package/build/tabs-menu/index.cjs +58 -0
- package/build/tabs-menu/index.cjs.map +7 -0
- package/build/tabs-menu/save.cjs +35 -0
- package/build/tabs-menu/save.cjs.map +7 -0
- package/build/tabs-menu-item/block.json +98 -0
- package/build/tabs-menu-item/controls.cjs +247 -0
- package/build/tabs-menu-item/controls.cjs.map +7 -0
- package/build/tabs-menu-item/edit.cjs +272 -0
- package/build/tabs-menu-item/edit.cjs.map +7 -0
- package/build/tabs-menu-item/icon.cjs +29 -0
- package/build/tabs-menu-item/icon.cjs.map +7 -0
- package/build/tabs-menu-item/index.cjs +58 -0
- package/build/tabs-menu-item/index.cjs.map +7 -0
- package/build/tabs-menu-item/save.cjs +50 -0
- package/build/tabs-menu-item/save.cjs.map +7 -0
- package/build/template-part/edit/index.cjs +2 -2
- package/build/template-part/edit/index.cjs.map +2 -2
- package/build/utils/caption.cjs +4 -6
- package/build/utils/caption.cjs.map +3 -3
- package/build/verse/block.json +1 -3
- package/build/verse/deprecated.cjs +74 -5
- package/build/verse/deprecated.cjs.map +3 -3
- package/build/verse/edit.cjs +33 -48
- package/build/verse/edit.cjs.map +3 -3
- package/build/verse/save.cjs +2 -16
- package/build/verse/save.cjs.map +3 -3
- package/build/video/edit.cjs +4 -2
- package/build/video/edit.cjs.map +2 -2
- package/build-module/block/block.json +2 -1
- package/build-module/breadcrumbs/edit.mjs +15 -5
- package/build-module/breadcrumbs/edit.mjs.map +2 -2
- package/build-module/breadcrumbs/index.mjs +1 -0
- package/build-module/breadcrumbs/index.mjs.map +2 -2
- package/build-module/button/index.mjs +3 -0
- package/build-module/button/index.mjs.map +2 -2
- package/build-module/comment-date/block.json +1 -0
- package/build-module/comment-edit-link/block.json +1 -3
- package/build-module/comment-edit-link/deprecated.mjs +60 -0
- package/build-module/comment-edit-link/deprecated.mjs.map +7 -0
- package/build-module/comment-edit-link/edit.mjs +7 -24
- package/build-module/comment-edit-link/edit.mjs.map +2 -2
- package/build-module/comment-edit-link/index.mjs +2 -0
- package/build-module/comment-edit-link/index.mjs.map +2 -2
- package/build-module/comment-reply-link/block.json +1 -5
- package/build-module/comment-reply-link/deprecated.mjs +53 -0
- package/build-module/comment-reply-link/deprecated.mjs.map +7 -0
- package/build-module/comment-reply-link/edit.mjs +12 -29
- package/build-module/comment-reply-link/edit.mjs.map +2 -2
- package/build-module/comment-reply-link/index.mjs +2 -0
- package/build-module/comment-reply-link/index.mjs.map +2 -2
- package/build-module/comments-title/block.json +1 -3
- package/build-module/comments-title/deprecated.mjs +148 -24
- package/build-module/comments-title/deprecated.mjs.map +2 -2
- package/build-module/comments-title/edit.mjs +17 -32
- package/build-module/comments-title/edit.mjs.map +2 -2
- package/build-module/cover/edit/block-controls.mjs +11 -3
- package/build-module/cover/edit/block-controls.mjs.map +2 -2
- package/build-module/cover/edit/embed-video-url-input.mjs +6 -2
- package/build-module/cover/edit/embed-video-url-input.mjs.map +2 -2
- package/build-module/cover/edit/inspector-controls.mjs +1 -1
- package/build-module/cover/edit/inspector-controls.mjs.map +2 -2
- package/build-module/details/index.mjs +3 -0
- package/build-module/details/index.mjs.map +2 -2
- package/build-module/embed/util.mjs +8 -0
- package/build-module/embed/util.mjs.map +2 -2
- package/build-module/freeform/block.json +2 -1
- package/build-module/heading/index.mjs +3 -0
- package/build-module/heading/index.mjs.map +2 -2
- package/build-module/html/block.json +2 -1
- package/build-module/image/image.mjs +43 -9
- package/build-module/image/image.mjs.map +2 -2
- package/build-module/image/index.mjs +1 -1
- package/build-module/image/index.mjs.map +2 -2
- package/build-module/index.mjs +6 -0
- package/build-module/index.mjs.map +2 -2
- package/build-module/list-item/index.mjs +12 -1
- package/build-module/list-item/index.mjs.map +2 -2
- package/build-module/missing/block.json +2 -1
- package/build-module/more/block.json +2 -1
- package/build-module/more/index.mjs +1 -1
- package/build-module/more/index.mjs.map +2 -2
- package/build-module/navigation/block.json +5 -4
- package/build-module/navigation/deprecated.mjs +133 -5
- package/build-module/navigation/deprecated.mjs.map +2 -2
- package/build-module/navigation/edit/deleted-overlay-warning.mjs +49 -0
- package/build-module/navigation/edit/deleted-overlay-warning.mjs.map +7 -0
- package/build-module/navigation/edit/index.mjs +145 -65
- package/build-module/navigation/edit/index.mjs.map +2 -2
- package/build-module/navigation/edit/overlay-panel.mjs +10 -1
- package/build-module/navigation/edit/overlay-panel.mjs.map +2 -2
- package/build-module/navigation/edit/overlay-preview.mjs +99 -0
- package/build-module/navigation/edit/overlay-preview.mjs.map +7 -0
- package/build-module/navigation/edit/overlay-template-part-selector.mjs +61 -26
- package/build-module/navigation/edit/overlay-template-part-selector.mjs.map +2 -2
- package/build-module/navigation/edit/responsive-wrapper.mjs +12 -1
- package/build-module/navigation/edit/responsive-wrapper.mjs.map +2 -2
- package/build-module/navigation/edit/use-create-overlay.mjs +21 -4
- package/build-module/navigation/edit/use-create-overlay.mjs.map +2 -2
- package/build-module/navigation/utils/get-submenu-visibility.mjs +12 -0
- package/build-module/navigation/utils/get-submenu-visibility.mjs.map +7 -0
- package/build-module/navigation-link/edit.mjs +4 -40
- package/build-module/navigation-link/edit.mjs.map +2 -2
- package/build-module/navigation-link/shared/index.mjs +4 -0
- package/build-module/navigation-link/shared/index.mjs.map +2 -2
- package/build-module/navigation-link/shared/select-label-text.mjs +15 -0
- package/build-module/navigation-link/shared/select-label-text.mjs.map +7 -0
- package/build-module/navigation-link/shared/use-is-dragging-within.mjs +34 -0
- package/build-module/navigation-link/shared/use-is-dragging-within.mjs.map +7 -0
- package/build-module/navigation-submenu/block.json +1 -1
- package/build-module/navigation-submenu/edit.mjs +10 -47
- package/build-module/navigation-submenu/edit.mjs.map +2 -2
- package/build-module/navigation-submenu/index.mjs +2 -2
- package/build-module/navigation-submenu/index.mjs.map +2 -2
- package/build-module/nextpage/block.json +2 -1
- package/build-module/paragraph/block.json +1 -0
- package/build-module/paragraph/index.mjs +1 -1
- package/build-module/paragraph/index.mjs.map +2 -2
- package/build-module/post-excerpt/edit.mjs +1 -1
- package/build-module/post-excerpt/edit.mjs.map +2 -2
- package/build-module/shortcode/block.json +2 -1
- package/build-module/tab/add-tab-toolbar-control.mjs +32 -10
- package/build-module/tab/add-tab-toolbar-control.mjs.map +2 -2
- package/build-module/tab/block.json +18 -4
- package/build-module/tab/controls.mjs +4 -8
- package/build-module/tab/controls.mjs.map +2 -2
- package/build-module/tab/edit.mjs +48 -128
- package/build-module/tab/edit.mjs.map +2 -2
- package/build-module/tab/remove-tab-toolbar-control.mjs +73 -0
- package/build-module/tab/remove-tab-toolbar-control.mjs.map +7 -0
- package/build-module/tab/save.mjs +2 -2
- package/build-module/tab/save.mjs.map +2 -2
- package/build-module/tab-panels/block.json +70 -0
- package/build-module/tab-panels/edit.mjs +36 -0
- package/build-module/tab-panels/edit.mjs.map +7 -0
- package/build-module/tab-panels/icon.mjs +8 -0
- package/build-module/tab-panels/icon.mjs.map +7 -0
- package/build-module/tab-panels/index.mjs +20 -0
- package/build-module/tab-panels/index.mjs.map +7 -0
- package/build-module/tab-panels/save.mjs +12 -0
- package/build-module/tab-panels/save.mjs.map +7 -0
- package/build-module/tabs/block.json +61 -90
- package/build-module/tabs/controls.mjs +21 -228
- package/build-module/tabs/controls.mjs.map +2 -2
- package/build-module/tabs/deprecated.mjs +158 -0
- package/build-module/tabs/deprecated.mjs.map +7 -0
- package/build-module/tabs/edit.mjs +87 -64
- package/build-module/tabs/edit.mjs.map +2 -2
- package/build-module/tabs/index.mjs +3 -1
- package/build-module/tabs/index.mjs.map +2 -2
- package/build-module/tabs/save.mjs +7 -10
- package/build-module/tabs/save.mjs.map +2 -2
- package/build-module/tabs-menu/block.json +77 -0
- package/build-module/tabs-menu/edit.mjs +186 -0
- package/build-module/tabs-menu/edit.mjs.map +7 -0
- package/build-module/tabs-menu/icon.mjs +8 -0
- package/build-module/tabs-menu/icon.mjs.map +7 -0
- package/build-module/tabs-menu/index.mjs +20 -0
- package/build-module/tabs-menu/index.mjs.map +7 -0
- package/build-module/tabs-menu/save.mjs +14 -0
- package/build-module/tabs-menu/save.mjs.map +7 -0
- package/build-module/tabs-menu-item/block.json +98 -0
- package/build-module/tabs-menu-item/controls.mjs +227 -0
- package/build-module/tabs-menu-item/controls.mjs.map +7 -0
- package/build-module/tabs-menu-item/edit.mjs +253 -0
- package/build-module/tabs-menu-item/edit.mjs.map +7 -0
- package/build-module/tabs-menu-item/icon.mjs +8 -0
- package/build-module/tabs-menu-item/icon.mjs.map +7 -0
- package/build-module/tabs-menu-item/index.mjs +20 -0
- package/build-module/tabs-menu-item/index.mjs.map +7 -0
- package/build-module/tabs-menu-item/save.mjs +29 -0
- package/build-module/tabs-menu-item/save.mjs.map +7 -0
- package/build-module/template-part/edit/index.mjs +2 -2
- package/build-module/template-part/edit/index.mjs.map +2 -2
- package/build-module/utils/caption.mjs +1 -3
- package/build-module/utils/caption.mjs.map +2 -2
- package/build-module/verse/block.json +1 -3
- package/build-module/verse/deprecated.mjs +74 -5
- package/build-module/verse/deprecated.mjs.map +2 -2
- package/build-module/verse/edit.mjs +35 -55
- package/build-module/verse/edit.mjs.map +2 -2
- package/build-module/verse/save.mjs +2 -6
- package/build-module/verse/save.mjs.map +2 -2
- package/build-module/video/edit.mjs +4 -2
- package/build-module/video/edit.mjs.map +2 -2
- package/build-style/editor-rtl.css +64 -21
- package/build-style/editor.css +64 -21
- package/build-style/gallery/style-rtl.css +1 -1
- package/build-style/gallery/style.css +1 -1
- package/build-style/media-text/style-rtl.css +2 -0
- package/build-style/media-text/style.css +2 -0
- package/build-style/navigation/editor-rtl.css +48 -0
- package/build-style/navigation/editor.css +48 -0
- package/build-style/navigation/style-rtl.css +64 -18
- package/build-style/navigation/style.css +64 -18
- package/build-style/style-rtl.css +109 -171
- package/build-style/style.css +109 -171
- package/build-style/tab/style-rtl.css +7 -1
- package/build-style/tab/style.css +7 -1
- package/build-style/tab-panels/style-rtl.css +4 -0
- package/build-style/tab-panels/style.css +4 -0
- package/build-style/tabs/style-rtl.css +1 -167
- package/build-style/tabs/style.css +1 -167
- package/build-style/tabs-menu/editor-rtl.css +4 -0
- package/build-style/tabs-menu/editor.css +4 -0
- package/build-style/tabs-menu/style-rtl.css +8 -0
- package/build-style/tabs-menu/style.css +8 -0
- package/build-style/tabs-menu-item/editor-rtl.css +16 -0
- package/build-style/tabs-menu-item/editor.css +16 -0
- package/build-style/tabs-menu-item/style-rtl.css +34 -0
- package/build-style/tabs-menu-item/style.css +34 -0
- package/build-style/verse/style-rtl.css +1 -0
- package/build-style/verse/style.css +1 -0
- package/package.json +37 -37
- package/src/block/block.json +2 -1
- package/src/breadcrumbs/edit.js +10 -2
- package/src/breadcrumbs/index.js +1 -0
- package/src/button/index.js +4 -0
- package/src/categories/index.php +5 -1
- package/src/comment-date/block.json +1 -0
- package/src/comment-edit-link/block.json +1 -3
- package/src/comment-edit-link/deprecated.js +63 -0
- package/src/comment-edit-link/edit.js +7 -31
- package/src/comment-edit-link/index.js +2 -0
- package/src/comment-reply-link/block.json +1 -5
- package/src/comment-reply-link/deprecated.js +56 -0
- package/src/comment-reply-link/edit.js +6 -35
- package/src/comment-reply-link/index.js +2 -0
- package/src/comments-title/block.json +1 -3
- package/src/comments-title/deprecated.js +153 -23
- package/src/comments-title/edit.js +9 -25
- package/src/cover/edit/block-controls.js +14 -3
- package/src/cover/edit/embed-video-url-input.js +6 -2
- package/src/cover/edit/inspector-controls.js +1 -3
- package/src/details/index.js +4 -0
- package/src/editor.scss +2 -1
- package/src/embed/test/index.js +49 -0
- package/src/embed/util.js +21 -0
- package/src/freeform/block.json +2 -1
- package/src/gallery/style.scss +1 -1
- package/src/heading/index.js +4 -0
- package/src/html/block.json +2 -1
- package/src/image/image.js +63 -11
- package/src/image/index.js +4 -1
- package/src/index.js +6 -0
- package/src/list-item/index.js +16 -0
- package/src/media-text/style.scss +2 -0
- package/src/missing/block.json +2 -1
- package/src/more/block.json +2 -1
- package/src/more/index.js +4 -1
- package/src/navigation/block.json +5 -4
- package/src/navigation/deprecated.js +144 -5
- package/src/navigation/edit/deleted-overlay-warning.js +56 -0
- package/src/navigation/edit/index.js +181 -70
- package/src/navigation/edit/overlay-panel.js +10 -0
- package/src/navigation/edit/overlay-preview.js +133 -0
- package/src/navigation/edit/overlay-template-part-selector.js +76 -26
- package/src/navigation/edit/responsive-wrapper.js +14 -1
- package/src/navigation/edit/test/overlay-template-part-selector.js +24 -16
- package/src/navigation/edit/test/responsive-wrapper.js +179 -0
- package/src/navigation/edit/test/use-create-overlay.js +129 -2
- package/src/navigation/edit/use-create-overlay.js +26 -4
- package/src/navigation/editor.scss +51 -0
- package/src/navigation/index.php +59 -11
- package/src/navigation/style.scss +140 -76
- package/src/navigation/utils/get-submenu-visibility.js +27 -0
- package/src/navigation/utils/test/get-submenu-visibility.js +47 -0
- package/src/navigation-link/edit.js +3 -67
- package/src/navigation-link/shared/index.js +2 -0
- package/src/navigation-link/shared/select-label-text.js +16 -0
- package/src/navigation-link/shared/use-is-dragging-within.js +55 -0
- package/src/navigation-submenu/block.json +1 -1
- package/src/navigation-submenu/edit.js +10 -73
- package/src/navigation-submenu/index.js +6 -3
- package/src/navigation-submenu/index.php +36 -5
- package/src/nextpage/block.json +2 -1
- package/src/paragraph/block.json +1 -0
- package/src/paragraph/index.js +4 -1
- package/src/post-excerpt/edit.js +1 -1
- package/src/post-excerpt/index.php +39 -16
- package/src/shortcode/block.json +2 -1
- package/src/style.scss +3 -0
- package/src/tab/add-tab-toolbar-control.js +36 -11
- package/src/tab/block.json +18 -4
- package/src/tab/controls.js +4 -5
- package/src/tab/edit.js +75 -150
- package/src/tab/index.php +5 -63
- package/src/tab/remove-tab-toolbar-control.js +103 -0
- package/src/tab/save.js +1 -3
- package/src/tab/style.scss +8 -1
- package/src/tab-panels/block.json +70 -0
- package/src/tab-panels/edit.js +44 -0
- package/src/tab-panels/icon.js +10 -0
- package/src/tab-panels/index.js +21 -0
- package/src/tab-panels/save.js +11 -0
- package/src/tab-panels/style.scss +4 -0
- package/src/tabs/block.json +61 -90
- package/src/tabs/controls.js +7 -221
- package/src/tabs/deprecated.js +214 -0
- package/src/tabs/edit.js +108 -68
- package/src/tabs/index.js +2 -0
- package/src/tabs/index.php +86 -191
- package/src/tabs/save.js +6 -13
- package/src/tabs/style.scss +1 -187
- package/src/tabs-menu/block.json +77 -0
- package/src/tabs-menu/edit.js +251 -0
- package/src/tabs-menu/editor.scss +6 -0
- package/src/tabs-menu/icon.js +10 -0
- package/src/tabs-menu/index.js +21 -0
- package/src/tabs-menu/index.php +74 -0
- package/src/tabs-menu/save.js +18 -0
- package/src/tabs-menu/style.scss +8 -0
- package/src/tabs-menu-item/block.json +98 -0
- package/src/tabs-menu-item/controls.js +262 -0
- package/src/tabs-menu-item/edit.js +322 -0
- package/src/tabs-menu-item/editor.scss +20 -0
- package/src/tabs-menu-item/icon.js +10 -0
- package/src/tabs-menu-item/index.js +21 -0
- package/src/tabs-menu-item/index.php +82 -0
- package/src/tabs-menu-item/save.js +44 -0
- package/src/tabs-menu-item/style.scss +42 -0
- package/src/template-part/edit/index.js +2 -4
- package/src/utils/caption.js +1 -7
- package/src/verse/block.json +1 -3
- package/src/verse/deprecated.js +83 -4
- package/src/verse/edit.js +37 -56
- package/src/verse/save.js +2 -11
- package/src/verse/style.scss +1 -0
- package/src/video/edit.js +4 -2
- package/build/tab/tabs-list.cjs +0 -132
- package/build/tab/tabs-list.cjs.map +0 -7
- package/build/tabs/style-engine.cjs +0 -119
- package/build/tabs/style-engine.cjs.map +0 -7
- package/build-module/tab/tabs-list.mjs +0 -101
- package/build-module/tab/tabs-list.mjs.map +0 -7
- package/build-module/tabs/style-engine.mjs +0 -101
- package/build-module/tabs/style-engine.mjs.map +0 -7
- package/build-style/tabs/editor-rtl.css +0 -26
- package/build-style/tabs/editor.css +0 -26
- package/src/tab/tabs-list.js +0 -122
- package/src/tabs/editor.scss +0 -30
- package/src/tabs/style-engine.js +0 -164
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the submenu visibility value with backward compatibility
|
|
3
|
+
* for the deprecated openSubmenusOnClick attribute.
|
|
4
|
+
*
|
|
5
|
+
* This function centralizes the migration logic from the boolean
|
|
6
|
+
* openSubmenusOnClick to the new submenuVisibility enum.
|
|
7
|
+
*
|
|
8
|
+
* NOTE: Keep this function in sync with block_core_navigation_get_submenu_visibility
|
|
9
|
+
* in packages/block-library/src/navigation/index.php
|
|
10
|
+
*
|
|
11
|
+
* @param {Object} attributes Block attributes containing submenuVisibility and/or openSubmenusOnClick.
|
|
12
|
+
* @return {string} The visibility mode: 'hover', 'click', or 'always'.
|
|
13
|
+
*/
|
|
14
|
+
export function getSubmenuVisibility( attributes ) {
|
|
15
|
+
const { submenuVisibility, openSubmenusOnClick } = attributes;
|
|
16
|
+
|
|
17
|
+
// If new attribute is set, use it
|
|
18
|
+
if ( submenuVisibility ) {
|
|
19
|
+
return submenuVisibility;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Fall back to old attribute for backward compatibility
|
|
23
|
+
// openSubmenusOnClick: true -> 'click'
|
|
24
|
+
// openSubmenusOnClick: false -> 'hover'
|
|
25
|
+
// openSubmenusOnClick: undefined -> 'hover' (default)
|
|
26
|
+
return openSubmenusOnClick ? 'click' : 'hover';
|
|
27
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { getSubmenuVisibility } from '../get-submenu-visibility';
|
|
5
|
+
|
|
6
|
+
describe( 'getSubmenuVisibility', () => {
|
|
7
|
+
it( 'should return submenuVisibility when it is set', () => {
|
|
8
|
+
expect(
|
|
9
|
+
getSubmenuVisibility( {
|
|
10
|
+
submenuVisibility: 'click',
|
|
11
|
+
openSubmenusOnClick: false,
|
|
12
|
+
} )
|
|
13
|
+
).toBe( 'click' );
|
|
14
|
+
expect(
|
|
15
|
+
getSubmenuVisibility( {
|
|
16
|
+
submenuVisibility: 'hover',
|
|
17
|
+
openSubmenusOnClick: true,
|
|
18
|
+
} )
|
|
19
|
+
).toBe( 'hover' );
|
|
20
|
+
expect(
|
|
21
|
+
getSubmenuVisibility( {
|
|
22
|
+
submenuVisibility: 'always',
|
|
23
|
+
openSubmenusOnClick: false,
|
|
24
|
+
} )
|
|
25
|
+
).toBe( 'always' );
|
|
26
|
+
} );
|
|
27
|
+
|
|
28
|
+
it( 'should fall back to "click" when submenuVisibility is undefined and openSubmenusOnClick is true', () => {
|
|
29
|
+
expect( getSubmenuVisibility( { openSubmenusOnClick: true } ) ).toBe(
|
|
30
|
+
'click'
|
|
31
|
+
);
|
|
32
|
+
} );
|
|
33
|
+
|
|
34
|
+
it( 'should fall back to "hover" when submenuVisibility is undefined and openSubmenusOnClick is false', () => {
|
|
35
|
+
expect( getSubmenuVisibility( { openSubmenusOnClick: false } ) ).toBe(
|
|
36
|
+
'hover'
|
|
37
|
+
);
|
|
38
|
+
} );
|
|
39
|
+
|
|
40
|
+
it( 'should fall back to "hover" when both submenuVisibility and openSubmenusOnClick are undefined', () => {
|
|
41
|
+
expect( getSubmenuVisibility( {} ) ).toBe( 'hover' );
|
|
42
|
+
} );
|
|
43
|
+
|
|
44
|
+
it( 'should handle empty attributes object', () => {
|
|
45
|
+
expect( getSubmenuVisibility( {} ) ).toBe( 'hover' );
|
|
46
|
+
} );
|
|
47
|
+
} );
|
|
@@ -42,6 +42,8 @@ import {
|
|
|
42
42
|
useIsInvalidLink,
|
|
43
43
|
InvalidDraftDisplay,
|
|
44
44
|
useEnableLinkStatusValidation,
|
|
45
|
+
useIsDraggingWithin,
|
|
46
|
+
selectLabelText,
|
|
45
47
|
} from './shared';
|
|
46
48
|
|
|
47
49
|
const DEFAULT_BLOCK = { name: 'core/navigation-link' };
|
|
@@ -50,57 +52,6 @@ const NESTING_BLOCK_NAMES = [
|
|
|
50
52
|
'core/navigation-submenu',
|
|
51
53
|
];
|
|
52
54
|
|
|
53
|
-
/**
|
|
54
|
-
* A React hook to determine if it's dragging within the target element.
|
|
55
|
-
*
|
|
56
|
-
* @typedef {import('@wordpress/element').RefObject} RefObject
|
|
57
|
-
*
|
|
58
|
-
* @param {RefObject<HTMLElement>} elementRef The target elementRef object.
|
|
59
|
-
*
|
|
60
|
-
* @return {boolean} Is dragging within the target element.
|
|
61
|
-
*/
|
|
62
|
-
const useIsDraggingWithin = ( elementRef ) => {
|
|
63
|
-
const [ isDraggingWithin, setIsDraggingWithin ] = useState( false );
|
|
64
|
-
|
|
65
|
-
useEffect( () => {
|
|
66
|
-
const { ownerDocument } = elementRef.current;
|
|
67
|
-
|
|
68
|
-
function handleDragStart( event ) {
|
|
69
|
-
// Check the first time when the dragging starts.
|
|
70
|
-
handleDragEnter( event );
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// Set to false whenever the user cancel the drag event by either releasing the mouse or press Escape.
|
|
74
|
-
function handleDragEnd() {
|
|
75
|
-
setIsDraggingWithin( false );
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function handleDragEnter( event ) {
|
|
79
|
-
// Check if the current target is inside the item element.
|
|
80
|
-
if ( elementRef.current.contains( event.target ) ) {
|
|
81
|
-
setIsDraggingWithin( true );
|
|
82
|
-
} else {
|
|
83
|
-
setIsDraggingWithin( false );
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// Bind these events to the document to catch all drag events.
|
|
88
|
-
// Ideally, we can also use `event.relatedTarget`, but sadly that
|
|
89
|
-
// doesn't work in Safari.
|
|
90
|
-
ownerDocument.addEventListener( 'dragstart', handleDragStart );
|
|
91
|
-
ownerDocument.addEventListener( 'dragend', handleDragEnd );
|
|
92
|
-
ownerDocument.addEventListener( 'dragenter', handleDragEnter );
|
|
93
|
-
|
|
94
|
-
return () => {
|
|
95
|
-
ownerDocument.removeEventListener( 'dragstart', handleDragStart );
|
|
96
|
-
ownerDocument.removeEventListener( 'dragend', handleDragEnd );
|
|
97
|
-
ownerDocument.removeEventListener( 'dragenter', handleDragEnter );
|
|
98
|
-
};
|
|
99
|
-
}, [ elementRef ] );
|
|
100
|
-
|
|
101
|
-
return isDraggingWithin;
|
|
102
|
-
};
|
|
103
|
-
|
|
104
55
|
function getMissingText( type ) {
|
|
105
56
|
let missingText = '';
|
|
106
57
|
|
|
@@ -293,7 +244,7 @@ export default function NavigationLinkEdit( {
|
|
|
293
244
|
// If the label looks like a URL, focus and select the label text.
|
|
294
245
|
if ( isURL( prependHTTP( label ) ) && /^.+\.[a-z]+/.test( label ) ) {
|
|
295
246
|
// Focus and select the label text.
|
|
296
|
-
selectLabelText();
|
|
247
|
+
selectLabelText( ref );
|
|
297
248
|
} else {
|
|
298
249
|
// If the link was just created, we want to select the block so the inspector controls
|
|
299
250
|
// are accurate.
|
|
@@ -317,21 +268,6 @@ export default function NavigationLinkEdit( {
|
|
|
317
268
|
}
|
|
318
269
|
}, [ url, isLinkOpen, isNewLink, label ] );
|
|
319
270
|
|
|
320
|
-
/**
|
|
321
|
-
* Focus the Link label text and select it.
|
|
322
|
-
*/
|
|
323
|
-
function selectLabelText() {
|
|
324
|
-
ref.current.focus();
|
|
325
|
-
const { ownerDocument } = ref.current;
|
|
326
|
-
const { defaultView } = ownerDocument;
|
|
327
|
-
const selection = defaultView.getSelection();
|
|
328
|
-
const range = ownerDocument.createRange();
|
|
329
|
-
// Get the range of the current ref contents so we can add this range to the selection.
|
|
330
|
-
range.selectNodeContents( ref.current );
|
|
331
|
-
selection.removeAllRanges();
|
|
332
|
-
selection.addRange( range );
|
|
333
|
-
}
|
|
334
|
-
|
|
335
271
|
/**
|
|
336
272
|
* Removes the current link if set.
|
|
337
273
|
*/
|
|
@@ -16,3 +16,5 @@ export { useHandleLinkChange } from './use-handle-link-change';
|
|
|
16
16
|
export { useIsInvalidLink } from './use-is-invalid-link';
|
|
17
17
|
export { InvalidDraftDisplay } from './invalid-draft-display';
|
|
18
18
|
export { useEnableLinkStatusValidation } from './use-enable-link-status-validation';
|
|
19
|
+
export { useIsDraggingWithin } from './use-is-dragging-within';
|
|
20
|
+
export { selectLabelText } from './select-label-text';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Focus the Link label text and select it.
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} ref React ref object pointing to the label element.
|
|
5
|
+
*/
|
|
6
|
+
export function selectLabelText( ref ) {
|
|
7
|
+
ref.current.focus();
|
|
8
|
+
const { ownerDocument } = ref.current;
|
|
9
|
+
const { defaultView } = ownerDocument;
|
|
10
|
+
const selection = defaultView.getSelection();
|
|
11
|
+
const range = ownerDocument.createRange();
|
|
12
|
+
// Get the range of the current ref contents so we can add this range to the selection.
|
|
13
|
+
range.selectNodeContents( ref.current );
|
|
14
|
+
selection.removeAllRanges();
|
|
15
|
+
selection.addRange( range );
|
|
16
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useState, useEffect } from '@wordpress/element';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A React hook to determine if it's dragging within the target element.
|
|
8
|
+
*
|
|
9
|
+
* @typedef {import('@wordpress/element').RefObject} RefObject
|
|
10
|
+
*
|
|
11
|
+
* @param {RefObject<HTMLElement>} elementRef The target elementRef object.
|
|
12
|
+
*
|
|
13
|
+
* @return {boolean} Is dragging within the target element.
|
|
14
|
+
*/
|
|
15
|
+
export const useIsDraggingWithin = ( elementRef ) => {
|
|
16
|
+
const [ isDraggingWithin, setIsDraggingWithin ] = useState( false );
|
|
17
|
+
|
|
18
|
+
useEffect( () => {
|
|
19
|
+
const { ownerDocument } = elementRef.current;
|
|
20
|
+
|
|
21
|
+
function handleDragStart( event ) {
|
|
22
|
+
// Check the first time when the dragging starts.
|
|
23
|
+
handleDragEnter( event );
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Set to false whenever the user cancel the drag event by either releasing the mouse or press Escape.
|
|
27
|
+
function handleDragEnd() {
|
|
28
|
+
setIsDraggingWithin( false );
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function handleDragEnter( event ) {
|
|
32
|
+
// Check if the current target is inside the item element.
|
|
33
|
+
if ( elementRef.current.contains( event.target ) ) {
|
|
34
|
+
setIsDraggingWithin( true );
|
|
35
|
+
} else {
|
|
36
|
+
setIsDraggingWithin( false );
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Bind these events to the document to catch all drag events.
|
|
41
|
+
// Ideally, we can also use `event.relatedTarget`, but sadly that
|
|
42
|
+
// doesn't work in Safari.
|
|
43
|
+
ownerDocument.addEventListener( 'dragstart', handleDragStart );
|
|
44
|
+
ownerDocument.addEventListener( 'dragend', handleDragEnd );
|
|
45
|
+
ownerDocument.addEventListener( 'dragenter', handleDragEnter );
|
|
46
|
+
|
|
47
|
+
return () => {
|
|
48
|
+
ownerDocument.removeEventListener( 'dragstart', handleDragStart );
|
|
49
|
+
ownerDocument.removeEventListener( 'dragend', handleDragEnd );
|
|
50
|
+
ownerDocument.removeEventListener( 'dragenter', handleDragEnter );
|
|
51
|
+
};
|
|
52
|
+
}, [ elementRef ] );
|
|
53
|
+
|
|
54
|
+
return isDraggingWithin;
|
|
55
|
+
};
|
|
@@ -40,12 +40,15 @@ import {
|
|
|
40
40
|
useIsInvalidLink,
|
|
41
41
|
InvalidDraftDisplay,
|
|
42
42
|
useEnableLinkStatusValidation,
|
|
43
|
+
useIsDraggingWithin,
|
|
44
|
+
selectLabelText,
|
|
43
45
|
} from '../navigation-link/shared';
|
|
44
46
|
import {
|
|
45
47
|
getColors,
|
|
46
48
|
getNavigationChildBlockProps,
|
|
47
49
|
} from '../navigation/edit/utils';
|
|
48
50
|
import { DEFAULT_BLOCK } from '../navigation/constants';
|
|
51
|
+
import { getSubmenuVisibility } from '../navigation/utils/get-submenu-visibility';
|
|
49
52
|
|
|
50
53
|
const ALLOWED_BLOCKS = [
|
|
51
54
|
'core/navigation-link',
|
|
@@ -53,57 +56,6 @@ const ALLOWED_BLOCKS = [
|
|
|
53
56
|
'core/page-list',
|
|
54
57
|
];
|
|
55
58
|
|
|
56
|
-
/**
|
|
57
|
-
* A React hook to determine if it's dragging within the target element.
|
|
58
|
-
*
|
|
59
|
-
* @typedef {import('@wordpress/element').RefObject} RefObject
|
|
60
|
-
*
|
|
61
|
-
* @param {RefObject<HTMLElement>} elementRef The target elementRef object.
|
|
62
|
-
*
|
|
63
|
-
* @return {boolean} Is dragging within the target element.
|
|
64
|
-
*/
|
|
65
|
-
const useIsDraggingWithin = ( elementRef ) => {
|
|
66
|
-
const [ isDraggingWithin, setIsDraggingWithin ] = useState( false );
|
|
67
|
-
|
|
68
|
-
useEffect( () => {
|
|
69
|
-
const { ownerDocument } = elementRef.current;
|
|
70
|
-
|
|
71
|
-
function handleDragStart( event ) {
|
|
72
|
-
// Check the first time when the dragging starts.
|
|
73
|
-
handleDragEnter( event );
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Set to false whenever the user cancel the drag event by either releasing the mouse or press Escape.
|
|
77
|
-
function handleDragEnd() {
|
|
78
|
-
setIsDraggingWithin( false );
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function handleDragEnter( event ) {
|
|
82
|
-
// Check if the current target is inside the item element.
|
|
83
|
-
if ( elementRef.current.contains( event.target ) ) {
|
|
84
|
-
setIsDraggingWithin( true );
|
|
85
|
-
} else {
|
|
86
|
-
setIsDraggingWithin( false );
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// Bind these events to the document to catch all drag events.
|
|
91
|
-
// Ideally, we can also use `event.relatedTarget`, but sadly that
|
|
92
|
-
// doesn't work in Safari.
|
|
93
|
-
ownerDocument.addEventListener( 'dragstart', handleDragStart );
|
|
94
|
-
ownerDocument.addEventListener( 'dragend', handleDragEnd );
|
|
95
|
-
ownerDocument.addEventListener( 'dragenter', handleDragEnter );
|
|
96
|
-
|
|
97
|
-
return () => {
|
|
98
|
-
ownerDocument.removeEventListener( 'dragstart', handleDragStart );
|
|
99
|
-
ownerDocument.removeEventListener( 'dragend', handleDragEnd );
|
|
100
|
-
ownerDocument.removeEventListener( 'dragenter', handleDragEnter );
|
|
101
|
-
};
|
|
102
|
-
}, [] );
|
|
103
|
-
|
|
104
|
-
return isDraggingWithin;
|
|
105
|
-
};
|
|
106
|
-
|
|
107
59
|
/**
|
|
108
60
|
* @typedef {'post-type'|'custom'|'taxonomy'|'post-type-archive'} WPNavigationLinkKind
|
|
109
61
|
*/
|
|
@@ -133,16 +85,15 @@ export default function NavigationSubmenuEdit( {
|
|
|
133
85
|
} ) {
|
|
134
86
|
const { label, url, description, kind, type, id } = attributes;
|
|
135
87
|
|
|
136
|
-
const {
|
|
137
|
-
showSubmenuIcon,
|
|
138
|
-
maxNestingLevel,
|
|
139
|
-
openSubmenusOnClick: contextOpenSubmenusOnClick,
|
|
140
|
-
} = context;
|
|
88
|
+
const { showSubmenuIcon, maxNestingLevel } = context;
|
|
141
89
|
const blockEditingMode = useBlockEditingMode();
|
|
142
90
|
|
|
91
|
+
// Determine effective submenu visibility with backward compatibility
|
|
92
|
+
const submenuVisibility = getSubmenuVisibility( context );
|
|
93
|
+
|
|
143
94
|
// Force click-only behavior in contentOnly mode to prevent hover dropdowns
|
|
144
95
|
const openSubmenusOnClick =
|
|
145
|
-
blockEditingMode !== 'default' ? true :
|
|
96
|
+
blockEditingMode !== 'default' ? true : submenuVisibility === 'click';
|
|
146
97
|
|
|
147
98
|
// URL binding logic
|
|
148
99
|
const { clearBinding, createBinding } = useEntityBinding( {
|
|
@@ -258,26 +209,11 @@ export default function NavigationSubmenuEdit( {
|
|
|
258
209
|
/^.+\.[a-z]+/.test( label )
|
|
259
210
|
) {
|
|
260
211
|
// Focus and select the label text.
|
|
261
|
-
selectLabelText();
|
|
212
|
+
selectLabelText( ref );
|
|
262
213
|
}
|
|
263
214
|
}
|
|
264
215
|
}, [ url ] );
|
|
265
216
|
|
|
266
|
-
/**
|
|
267
|
-
* Focus the Link label text and select it.
|
|
268
|
-
*/
|
|
269
|
-
function selectLabelText() {
|
|
270
|
-
ref.current.focus();
|
|
271
|
-
const { ownerDocument } = ref.current;
|
|
272
|
-
const { defaultView } = ownerDocument;
|
|
273
|
-
const selection = defaultView.getSelection();
|
|
274
|
-
const range = ownerDocument.createRange();
|
|
275
|
-
// Get the range of the current ref contents so we can add this range to the selection.
|
|
276
|
-
range.selectNodeContents( ref.current );
|
|
277
|
-
selection.removeAllRanges();
|
|
278
|
-
selection.addRange( range );
|
|
279
|
-
}
|
|
280
|
-
|
|
281
217
|
const {
|
|
282
218
|
textColor,
|
|
283
219
|
customTextColor,
|
|
@@ -310,6 +246,7 @@ export default function NavigationSubmenuEdit( {
|
|
|
310
246
|
[ getColorClassName( 'background-color', backgroundColor ) ]:
|
|
311
247
|
!! backgroundColor,
|
|
312
248
|
'open-on-click': openSubmenusOnClick,
|
|
249
|
+
'open-always': submenuVisibility === 'always',
|
|
313
250
|
} ),
|
|
314
251
|
style: {
|
|
315
252
|
color: ! textColor && customTextColor,
|
|
@@ -33,10 +33,13 @@ export const settings = {
|
|
|
33
33
|
|
|
34
34
|
const customName = attributes?.metadata?.name;
|
|
35
35
|
|
|
36
|
-
// In the list view, use the block's menu label as the label.
|
|
36
|
+
// In the list view and breadcrumb, use the block's menu label as the label.
|
|
37
37
|
// If the menu label is empty, fall back to the default label.
|
|
38
|
-
if (
|
|
39
|
-
|
|
38
|
+
if (
|
|
39
|
+
( context === 'list-view' || context === 'breadcrumb' ) &&
|
|
40
|
+
customName
|
|
41
|
+
) {
|
|
42
|
+
return customName;
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
return label;
|
|
@@ -5,6 +5,34 @@
|
|
|
5
5
|
* @package WordPress
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Returns the submenu visibility value with backward compatibility
|
|
10
|
+
* for the deprecated openSubmenusOnClick attribute.
|
|
11
|
+
*
|
|
12
|
+
* This function centralizes the migration logic from the boolean
|
|
13
|
+
* openSubmenusOnClick to the new submenuVisibility enum.
|
|
14
|
+
*
|
|
15
|
+
* @since 6.9.0
|
|
16
|
+
*
|
|
17
|
+
* @param array $attributes Block attributes containing submenuVisibility and/or openSubmenusOnClick.
|
|
18
|
+
* @return string The visibility mode: 'hover', 'click', or 'always'.
|
|
19
|
+
*/
|
|
20
|
+
function block_core_navigation_submenu_get_submenu_visibility( $attributes ) {
|
|
21
|
+
$submenu_visibility = isset( $attributes['submenuVisibility'] ) ? $attributes['submenuVisibility'] : null;
|
|
22
|
+
$open_submenus_on_click = isset( $attributes['openSubmenusOnClick'] ) ? $attributes['openSubmenusOnClick'] : null;
|
|
23
|
+
|
|
24
|
+
// If new attribute is set, use it.
|
|
25
|
+
if ( null !== $submenu_visibility ) {
|
|
26
|
+
return $submenu_visibility;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Fall back to old attribute for backward compatibility.
|
|
30
|
+
// openSubmenusOnClick: true -> 'click'
|
|
31
|
+
// openSubmenusOnClick: false -> 'hover'
|
|
32
|
+
// openSubmenusOnClick: null -> 'hover' (default)
|
|
33
|
+
return ! empty( $open_submenus_on_click ) ? 'click' : 'hover';
|
|
34
|
+
}
|
|
35
|
+
|
|
8
36
|
// Path differs between source and build: '../navigation-link/shared/helpers.php' in source, './navigation-link/shared/helpers.php' in build.
|
|
9
37
|
if ( file_exists( __DIR__ . '/../navigation-link/shared/helpers.php' ) ) {
|
|
10
38
|
require_once __DIR__ . '/../navigation-link/shared/helpers.php';
|
|
@@ -105,9 +133,10 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) {
|
|
|
105
133
|
}
|
|
106
134
|
|
|
107
135
|
$show_submenu_indicators = isset( $block->context['showSubmenuIcon'] ) && $block->context['showSubmenuIcon'];
|
|
108
|
-
$
|
|
109
|
-
$
|
|
110
|
-
|
|
136
|
+
$computed_visibility = block_core_navigation_submenu_get_submenu_visibility( $block->context );
|
|
137
|
+
$open_on_click = 'click' === $computed_visibility;
|
|
138
|
+
$open_on_hover = 'hover' === $computed_visibility;
|
|
139
|
+
$open_on_hover_and_click = $open_on_hover && $show_submenu_indicators;
|
|
111
140
|
|
|
112
141
|
$classes = array(
|
|
113
142
|
'wp-block-navigation-item',
|
|
@@ -125,6 +154,9 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) {
|
|
|
125
154
|
if ( $open_on_hover_and_click ) {
|
|
126
155
|
$classes[] = 'open-on-hover-click';
|
|
127
156
|
}
|
|
157
|
+
if ( 'always' === $computed_visibility ) {
|
|
158
|
+
$classes[] = 'open-always';
|
|
159
|
+
}
|
|
128
160
|
if ( $is_active ) {
|
|
129
161
|
$classes[] = 'current-menu-item';
|
|
130
162
|
}
|
|
@@ -150,7 +182,7 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) {
|
|
|
150
182
|
|
|
151
183
|
$html = '<li ' . $wrapper_attributes . '>';
|
|
152
184
|
|
|
153
|
-
// If Submenus open on hover, we render an anchor tag with attributes.
|
|
185
|
+
// If Submenus open on hover or are always open, we render an anchor tag with attributes.
|
|
154
186
|
// If submenu icons are set to show, we also render a submenu button, so the submenu can be opened on click.
|
|
155
187
|
if ( ! $open_on_click ) {
|
|
156
188
|
$item_url = $attributes['url'] ?? '';
|
|
@@ -207,7 +239,6 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) {
|
|
|
207
239
|
$html .= '<button aria-label="' . esc_attr( $aria_label ) . '" class="wp-block-navigation__submenu-icon wp-block-navigation-submenu__toggle" aria-expanded="false">' . block_core_navigation_submenu_render_submenu_icon() . '</button>';
|
|
208
240
|
}
|
|
209
241
|
} else {
|
|
210
|
-
// If menus open on click, we render the parent as a button.
|
|
211
242
|
$html .= '<button aria-label="' . esc_attr( $aria_label ) . '" class="wp-block-navigation-item__content wp-block-navigation-submenu__toggle" aria-expanded="false">';
|
|
212
243
|
|
|
213
244
|
// Wrap title with span to isolate it from submenu icon.
|
package/src/nextpage/block.json
CHANGED
package/src/paragraph/block.json
CHANGED
package/src/paragraph/index.js
CHANGED
|
@@ -34,7 +34,10 @@ export const settings = {
|
|
|
34
34
|
__experimentalLabel( attributes, { context } ) {
|
|
35
35
|
const customName = attributes?.metadata?.name;
|
|
36
36
|
|
|
37
|
-
if (
|
|
37
|
+
if (
|
|
38
|
+
( context === 'list-view' || context === 'breadcrumb' ) &&
|
|
39
|
+
customName
|
|
40
|
+
) {
|
|
38
41
|
return customName;
|
|
39
42
|
}
|
|
40
43
|
|
package/src/post-excerpt/edit.js
CHANGED
|
@@ -169,7 +169,7 @@ export default function PostExcerptEditor( {
|
|
|
169
169
|
let trimmedExcerpt = '';
|
|
170
170
|
if ( wordCountType === 'words' ) {
|
|
171
171
|
trimmedExcerpt = rawOrRenderedExcerpt
|
|
172
|
-
.split(
|
|
172
|
+
.split( /\s+/, excerptLength )
|
|
173
173
|
.join( ' ' );
|
|
174
174
|
} else if ( wordCountType === 'characters_excluding_spaces' ) {
|
|
175
175
|
/*
|
|
@@ -39,13 +39,23 @@ function render_block_core_post_excerpt( $attributes, $content, $block ) {
|
|
|
39
39
|
add_filter( 'excerpt_more', $filter_excerpt_more );
|
|
40
40
|
|
|
41
41
|
/*
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
* The purpose of the excerpt length setting is to limit the length of both
|
|
43
|
+
* automatically generated and user-created excerpts.
|
|
44
|
+
* Because the excerpt_length filter only applies to auto generated excerpts,
|
|
45
|
+
* wp_trim_words is used instead.
|
|
46
|
+
*
|
|
47
|
+
* To ensure the block's excerptLength setting works correctly for auto-generated
|
|
48
|
+
* excerpts, we temporarily override excerpt_length to 101 (the max block setting)
|
|
49
|
+
* so that wp_trim_excerpt doesn't pre-trim the content before wp_trim_words can
|
|
50
|
+
* apply the user's desired length.
|
|
51
|
+
*/
|
|
47
52
|
$excerpt_length = $attributes['excerptLength'];
|
|
48
|
-
|
|
53
|
+
add_filter( 'excerpt_length', 'block_core_post_excerpt_excerpt_length', PHP_INT_MAX );
|
|
54
|
+
|
|
55
|
+
$excerpt = get_the_excerpt( $block->context['postId'] );
|
|
56
|
+
|
|
57
|
+
remove_filter( 'excerpt_length', 'block_core_post_excerpt_excerpt_length', PHP_INT_MAX );
|
|
58
|
+
|
|
49
59
|
if ( isset( $excerpt_length ) ) {
|
|
50
60
|
$excerpt = wp_trim_words( $excerpt, $excerpt_length );
|
|
51
61
|
}
|
|
@@ -86,18 +96,31 @@ function register_block_core_post_excerpt() {
|
|
|
86
96
|
add_action( 'init', 'register_block_core_post_excerpt' );
|
|
87
97
|
|
|
88
98
|
/**
|
|
99
|
+
* Callback for the excerpt_length filter to override the excerpt length.
|
|
100
|
+
*
|
|
89
101
|
* If themes or plugins filter the excerpt_length, we need to
|
|
90
102
|
* override the filter in the editor, otherwise
|
|
91
103
|
* the excerpt length block setting has no effect.
|
|
92
|
-
* Returns
|
|
104
|
+
* Returns 101 (one more than the max block setting of 100) to ensure
|
|
105
|
+
* wp_trim_words can detect when trimming is needed and add the ellipsis.
|
|
106
|
+
*
|
|
107
|
+
* For REST API requests, the filter is added on 'rest_api_init'
|
|
108
|
+
* because REST_REQUEST is not defined until 'parse_request'.
|
|
109
|
+
*
|
|
110
|
+
* @since 7.0.0
|
|
111
|
+
*
|
|
112
|
+
* @return int The excerpt length.
|
|
93
113
|
*/
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
add_filter(
|
|
97
|
-
'excerpt_length',
|
|
98
|
-
static function () {
|
|
99
|
-
return 100;
|
|
100
|
-
},
|
|
101
|
-
PHP_INT_MAX
|
|
102
|
-
);
|
|
114
|
+
function block_core_post_excerpt_excerpt_length() {
|
|
115
|
+
return 101;
|
|
103
116
|
}
|
|
117
|
+
|
|
118
|
+
if ( is_admin() ) {
|
|
119
|
+
add_filter( 'excerpt_length', 'block_core_post_excerpt_excerpt_length', PHP_INT_MAX );
|
|
120
|
+
}
|
|
121
|
+
add_action(
|
|
122
|
+
'rest_api_init',
|
|
123
|
+
static function () {
|
|
124
|
+
add_filter( 'excerpt_length', 'block_core_post_excerpt_excerpt_length', PHP_INT_MAX );
|
|
125
|
+
}
|
|
126
|
+
);
|
package/src/shortcode/block.json
CHANGED
package/src/style.scss
CHANGED
|
@@ -72,9 +72,12 @@
|
|
|
72
72
|
@use "./spacer/style.scss" as *;
|
|
73
73
|
@use "./tag-cloud/style.scss" as *;
|
|
74
74
|
@use "./tab/style.scss" as *;
|
|
75
|
+
@use "./tab-panels/style.scss" as *;
|
|
75
76
|
@use "./table/style.scss" as *;
|
|
76
77
|
@use "./table-of-contents/style.scss" as *;
|
|
77
78
|
@use "./tabs/style.scss" as *;
|
|
79
|
+
@use "./tabs-menu/style.scss" as *;
|
|
80
|
+
@use "./tabs-menu-item/style.scss" as *;
|
|
78
81
|
@use "./term-count/style.scss" as *;
|
|
79
82
|
@use "./term-description/style.scss" as *;
|
|
80
83
|
@use "./term-name/style.scss" as *;
|