@wordpress/block-library 9.39.1-next.v.202602091733.0 → 9.40.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/accordion/index.cjs +2 -2
- package/build/accordion/index.cjs.map +2 -2
- package/build/accordion-heading/index.cjs +2 -2
- package/build/accordion-heading/index.cjs.map +2 -2
- package/build/accordion-item/index.cjs +2 -2
- package/build/accordion-item/index.cjs.map +2 -2
- package/build/accordion-panel/index.cjs +2 -2
- package/build/accordion-panel/index.cjs.map +2 -2
- package/build/breadcrumbs/edit.cjs +32 -1
- package/build/breadcrumbs/edit.cjs.map +2 -2
- package/build/comment-author-name/edit.cjs.map +1 -1
- package/build/comment-date/edit.cjs.map +1 -1
- package/build/embed/wp-embed-preview.cjs.map +1 -1
- package/build/gallery/block.json +2 -1
- package/build/group/edit.cjs.map +1 -1
- package/build/group/placeholder.cjs.map +1 -1
- package/build/heading/index.cjs +5 -1
- package/build/heading/index.cjs.map +2 -2
- package/build/icon/block.json +71 -0
- package/build/icon/components/custom-inserter/icon-grid.cjs +73 -0
- package/build/icon/components/custom-inserter/icon-grid.cjs.map +7 -0
- package/build/icon/components/custom-inserter/index.cjs +98 -0
- package/build/icon/components/custom-inserter/index.cjs.map +7 -0
- package/build/icon/components/index.cjs +41 -0
- package/build/icon/components/index.cjs.map +7 -0
- package/build/icon/edit.cjs +209 -0
- package/build/icon/edit.cjs.map +7 -0
- package/build/icon/icon.cjs +35 -0
- package/build/icon/icon.cjs.map +7 -0
- package/build/icon/index.cjs +66 -0
- package/build/icon/index.cjs.map +7 -0
- package/build/image/edit.cjs +12 -1
- package/build/image/edit.cjs.map +3 -3
- package/build/image/image.cjs +3 -2
- package/build/image/image.cjs.map +2 -2
- package/build/index.cjs +7 -7
- package/build/index.cjs.map +2 -2
- package/build/navigation/block.json +2 -0
- package/build/navigation/edit/deleted-overlay-warning.cjs.map +1 -1
- package/build/navigation/edit/index.cjs +31 -7
- package/build/navigation/edit/index.cjs.map +2 -2
- package/build/navigation/edit/menu-inspector-controls.cjs +5 -1
- package/build/navigation/edit/menu-inspector-controls.cjs.map +2 -2
- package/build/navigation/edit/overlay-menu-preview-button.cjs.map +1 -1
- package/build/navigation/edit/overlay-menu-preview-controls.cjs.map +1 -1
- package/build/navigation/edit/overlay-panel.cjs +1 -0
- package/build/navigation/edit/overlay-panel.cjs.map +2 -2
- package/build/navigation/edit/overlay-preview.cjs.map +1 -1
- package/build/navigation/edit/overlay-template-part-selector.cjs +15 -5
- package/build/navigation/edit/overlay-template-part-selector.cjs.map +2 -2
- package/build/navigation/edit/overlay-visibility-control.cjs.map +1 -1
- package/build/navigation/edit/use-create-overlay.cjs +1 -1
- package/build/navigation/edit/use-create-overlay.cjs.map +2 -2
- package/build/navigation-link/edit.cjs +7 -2
- package/build/navigation-link/edit.cjs.map +2 -2
- package/build/navigation-link/index.cjs +14 -1
- package/build/navigation-link/index.cjs.map +2 -2
- package/build/navigation-link/link-ui/index.cjs +29 -5
- package/build/navigation-link/link-ui/index.cjs.map +2 -2
- package/build/navigation-link/link-ui/page-creator.cjs +3 -3
- package/build/navigation-link/link-ui/page-creator.cjs.map +2 -2
- package/build/navigation-link/shared/controls.cjs +102 -108
- package/build/navigation-link/shared/controls.cjs.map +3 -3
- package/build/navigation-link/shared/index.cjs +5 -2
- package/build/navigation-link/shared/index.cjs.map +2 -2
- package/build/navigation-link/shared/use-link-preview.cjs +60 -15
- package/build/navigation-link/shared/use-link-preview.cjs.map +3 -3
- package/build/navigation-submenu/block.json +1 -0
- package/build/navigation-submenu/edit.cjs +16 -6
- package/build/navigation-submenu/edit.cjs.map +2 -2
- package/build/page-list/block.json +2 -1
- package/build/page-list/edit.cjs +3 -1
- package/build/page-list/edit.cjs.map +2 -2
- package/build/page-list-item/block.json +2 -1
- package/build/page-list-item/edit.cjs +9 -4
- package/build/page-list-item/edit.cjs.map +2 -2
- package/build/post-comments-count/transforms.cjs +9 -2
- package/build/post-comments-count/transforms.cjs.map +2 -2
- package/build/post-comments-link/block.json +1 -5
- package/build/post-comments-link/deprecated.cjs +96 -0
- package/build/post-comments-link/deprecated.cjs.map +7 -0
- package/build/post-comments-link/edit.cjs +17 -34
- package/build/post-comments-link/edit.cjs.map +3 -3
- package/build/post-comments-link/index.cjs +3 -1
- package/build/post-comments-link/index.cjs.map +3 -3
- package/build/post-comments-link/transforms.cjs +9 -2
- package/build/post-comments-link/transforms.cjs.map +2 -2
- package/build/post-content/edit.cjs.map +1 -1
- package/build/post-excerpt/block.json +1 -0
- package/build/post-featured-image/dimension-controls.cjs +1 -1
- package/build/post-featured-image/dimension-controls.cjs.map +2 -2
- package/build/post-terms/block.json +1 -3
- package/build/post-terms/deprecated.cjs +114 -0
- package/build/post-terms/deprecated.cjs.map +7 -0
- package/build/post-terms/edit.cjs +2 -17
- package/build/post-terms/edit.cjs.map +3 -3
- package/build/post-terms/index.cjs +3 -1
- package/build/post-terms/index.cjs.map +3 -3
- package/build/post-terms/use-post-terms.cjs +1 -1
- package/build/post-terms/use-post-terms.cjs.map +2 -2
- package/build/post-time-to-read/block.json +1 -3
- package/build/post-time-to-read/deprecated.cjs +97 -0
- package/build/post-time-to-read/deprecated.cjs.map +7 -0
- package/build/post-time-to-read/edit.cjs +2 -26
- package/build/post-time-to-read/edit.cjs.map +3 -3
- package/build/post-time-to-read/index.cjs +3 -1
- package/build/post-time-to-read/index.cjs.map +3 -3
- package/build/query/edit/inspector-controls/taxonomy-controls.cjs.map +1 -1
- package/build/tab/add-tab-toolbar-control.cjs.map +1 -1
- package/build/tab/block.json +1 -8
- package/build/tab/controls.cjs +39 -37
- package/build/tab/controls.cjs.map +3 -3
- package/build/tab/edit.cjs +0 -3
- package/build/tab/edit.cjs.map +2 -2
- package/build/tab/index.cjs +2 -2
- package/build/tab/index.cjs.map +2 -2
- package/build/tab/remove-tab-toolbar-control.cjs.map +1 -1
- package/build/tab/save.cjs +3 -1
- package/build/tab/save.cjs.map +2 -2
- package/build/tab-panel/index.cjs +2 -2
- package/build/tab-panel/index.cjs.map +2 -2
- package/build/tabs/block.json +6 -51
- package/build/tabs/controls.cjs +2 -26
- package/build/tabs/controls.cjs.map +2 -2
- package/build/tabs/index.cjs +34 -2
- package/build/tabs/index.cjs.map +2 -2
- package/build/tabs/view.cjs +53 -28
- package/build/tabs/view.cjs.map +2 -2
- package/build/tabs-menu/index.cjs +2 -2
- package/build/tabs-menu/index.cjs.map +2 -2
- package/build/tabs-menu-item/block.json +1 -10
- package/build/tabs-menu-item/controls.cjs +32 -4
- package/build/tabs-menu-item/controls.cjs.map +2 -2
- package/build/tabs-menu-item/edit.cjs +6 -57
- package/build/tabs-menu-item/edit.cjs.map +2 -2
- package/build/tabs-menu-item/index.cjs +2 -2
- package/build/tabs-menu-item/index.cjs.map +2 -2
- package/build/tabs-menu-item/save.cjs +3 -3
- package/build/tabs-menu-item/save.cjs.map +2 -2
- package/build/template-part/edit/index.cjs +1 -1
- package/build/template-part/edit/index.cjs.map +2 -2
- package/build/template-part/edit/utils/get-template-part-icon.cjs +2 -5
- package/build/template-part/edit/utils/get-template-part-icon.cjs.map +3 -3
- package/build/term-description/block.json +1 -5
- package/build/term-description/deprecated.cjs +96 -0
- package/build/term-description/deprecated.cjs.map +7 -0
- package/build/term-description/edit.cjs +7 -38
- package/build/term-description/edit.cjs.map +3 -3
- package/build/term-description/index.cjs +3 -1
- package/build/term-description/index.cjs.map +3 -3
- package/build/utils/html-renderer.cjs.map +1 -1
- package/build/verse/block.json +2 -2
- package/build/verse/edit.cjs +2 -2
- package/build/verse/edit.cjs.map +2 -2
- package/build-module/accordion/index.mjs +1 -1
- package/build-module/accordion/index.mjs.map +2 -2
- package/build-module/accordion-heading/index.mjs +1 -1
- package/build-module/accordion-heading/index.mjs.map +2 -2
- package/build-module/accordion-item/index.mjs +1 -1
- package/build-module/accordion-item/index.mjs.map +2 -2
- package/build-module/accordion-panel/index.mjs +1 -1
- package/build-module/accordion-panel/index.mjs.map +2 -2
- package/build-module/breadcrumbs/edit.mjs +33 -2
- package/build-module/breadcrumbs/edit.mjs.map +2 -2
- package/build-module/comment-author-name/edit.mjs.map +1 -1
- package/build-module/comment-date/edit.mjs.map +1 -1
- package/build-module/embed/wp-embed-preview.mjs.map +1 -1
- package/build-module/gallery/block.json +2 -1
- package/build-module/group/edit.mjs.map +1 -1
- package/build-module/group/placeholder.mjs.map +1 -1
- package/build-module/heading/index.mjs +5 -1
- package/build-module/heading/index.mjs.map +2 -2
- package/build-module/icon/block.json +71 -0
- package/build-module/icon/components/custom-inserter/icon-grid.mjs +42 -0
- package/build-module/icon/components/custom-inserter/icon-grid.mjs.map +7 -0
- package/build-module/icon/components/custom-inserter/index.mjs +67 -0
- package/build-module/icon/components/custom-inserter/index.mjs.map +7 -0
- package/build-module/icon/components/index.mjs +6 -0
- package/build-module/icon/components/index.mjs.map +7 -0
- package/build-module/icon/edit.mjs +190 -0
- package/build-module/icon/edit.mjs.map +7 -0
- package/build-module/icon/icon.mjs +10 -0
- package/build-module/icon/icon.mjs.map +7 -0
- package/build-module/icon/index.mjs +28 -0
- package/build-module/icon/index.mjs.map +7 -0
- package/build-module/image/edit.mjs +12 -1
- package/build-module/image/edit.mjs.map +2 -2
- package/build-module/image/image.mjs +3 -2
- package/build-module/image/image.mjs.map +2 -2
- package/build-module/index.mjs +7 -7
- package/build-module/index.mjs.map +2 -2
- package/build-module/navigation/block.json +2 -0
- package/build-module/navigation/edit/deleted-overlay-warning.mjs.map +1 -1
- package/build-module/navigation/edit/index.mjs +31 -7
- package/build-module/navigation/edit/index.mjs.map +2 -2
- package/build-module/navigation/edit/menu-inspector-controls.mjs +5 -1
- package/build-module/navigation/edit/menu-inspector-controls.mjs.map +2 -2
- package/build-module/navigation/edit/overlay-menu-preview-button.mjs.map +1 -1
- package/build-module/navigation/edit/overlay-menu-preview-controls.mjs.map +1 -1
- package/build-module/navigation/edit/overlay-panel.mjs +1 -0
- package/build-module/navigation/edit/overlay-panel.mjs.map +2 -2
- package/build-module/navigation/edit/overlay-preview.mjs.map +1 -1
- package/build-module/navigation/edit/overlay-template-part-selector.mjs +15 -5
- package/build-module/navigation/edit/overlay-template-part-selector.mjs.map +2 -2
- package/build-module/navigation/edit/overlay-visibility-control.mjs.map +1 -1
- package/build-module/navigation/edit/use-create-overlay.mjs +1 -1
- package/build-module/navigation/edit/use-create-overlay.mjs.map +2 -2
- package/build-module/navigation-link/edit.mjs +7 -2
- package/build-module/navigation-link/edit.mjs.map +2 -2
- package/build-module/navigation-link/index.mjs +15 -2
- package/build-module/navigation-link/index.mjs.map +2 -2
- package/build-module/navigation-link/link-ui/index.mjs +28 -4
- package/build-module/navigation-link/link-ui/index.mjs.map +2 -2
- package/build-module/navigation-link/link-ui/page-creator.mjs +3 -3
- package/build-module/navigation-link/link-ui/page-creator.mjs.map +2 -2
- package/build-module/navigation-link/shared/controls.mjs +103 -109
- package/build-module/navigation-link/shared/controls.mjs.map +2 -2
- package/build-module/navigation-link/shared/index.mjs +3 -1
- package/build-module/navigation-link/shared/index.mjs.map +2 -2
- package/build-module/navigation-link/shared/use-link-preview.mjs +58 -15
- package/build-module/navigation-link/shared/use-link-preview.mjs.map +2 -2
- package/build-module/navigation-submenu/block.json +1 -0
- package/build-module/navigation-submenu/edit.mjs +17 -7
- package/build-module/navigation-submenu/edit.mjs.map +2 -2
- package/build-module/page-list/block.json +2 -1
- package/build-module/page-list/edit.mjs +3 -1
- package/build-module/page-list/edit.mjs.map +2 -2
- package/build-module/page-list-item/block.json +2 -1
- package/build-module/page-list-item/edit.mjs +9 -4
- package/build-module/page-list-item/edit.mjs.map +2 -2
- package/build-module/post-comments-count/transforms.mjs +9 -2
- package/build-module/post-comments-count/transforms.mjs.map +2 -2
- package/build-module/post-comments-link/block.json +1 -5
- package/build-module/post-comments-link/deprecated.mjs +65 -0
- package/build-module/post-comments-link/deprecated.mjs.map +7 -0
- package/build-module/post-comments-link/edit.mjs +19 -40
- package/build-module/post-comments-link/edit.mjs.map +2 -2
- package/build-module/post-comments-link/index.mjs +3 -1
- package/build-module/post-comments-link/index.mjs.map +2 -2
- package/build-module/post-comments-link/transforms.mjs +9 -2
- package/build-module/post-comments-link/transforms.mjs.map +2 -2
- package/build-module/post-content/edit.mjs.map +1 -1
- package/build-module/post-excerpt/block.json +1 -0
- package/build-module/post-featured-image/dimension-controls.mjs +1 -1
- package/build-module/post-featured-image/dimension-controls.mjs.map +2 -2
- package/build-module/post-terms/block.json +1 -3
- package/build-module/post-terms/deprecated.mjs +83 -0
- package/build-module/post-terms/deprecated.mjs.map +7 -0
- package/build-module/post-terms/edit.mjs +3 -21
- package/build-module/post-terms/edit.mjs.map +2 -2
- package/build-module/post-terms/index.mjs +3 -1
- package/build-module/post-terms/index.mjs.map +2 -2
- package/build-module/post-terms/use-post-terms.mjs +1 -1
- package/build-module/post-terms/use-post-terms.mjs.map +2 -2
- package/build-module/post-time-to-read/block.json +1 -3
- package/build-module/post-time-to-read/deprecated.mjs +66 -0
- package/build-module/post-time-to-read/deprecated.mjs.map +7 -0
- package/build-module/post-time-to-read/edit.mjs +3 -22
- package/build-module/post-time-to-read/edit.mjs.map +2 -2
- package/build-module/post-time-to-read/index.mjs +3 -1
- package/build-module/post-time-to-read/index.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/taxonomy-controls.mjs.map +1 -1
- package/build-module/tab/add-tab-toolbar-control.mjs.map +1 -1
- package/build-module/tab/block.json +1 -8
- package/build-module/tab/controls.mjs +44 -38
- package/build-module/tab/controls.mjs.map +2 -2
- package/build-module/tab/edit.mjs +0 -3
- package/build-module/tab/edit.mjs.map +2 -2
- package/build-module/tab/index.mjs +1 -1
- package/build-module/tab/index.mjs.map +2 -2
- package/build-module/tab/remove-tab-toolbar-control.mjs.map +1 -1
- package/build-module/tab/save.mjs +3 -1
- package/build-module/tab/save.mjs.map +2 -2
- package/build-module/tab-panel/index.mjs +1 -1
- package/build-module/tab-panel/index.mjs.map +2 -2
- package/build-module/tabs/block.json +6 -51
- package/build-module/tabs/controls.mjs +2 -26
- package/build-module/tabs/controls.mjs.map +2 -2
- package/build-module/tabs/index.mjs +33 -1
- package/build-module/tabs/index.mjs.map +2 -2
- package/build-module/tabs/view.mjs +53 -28
- package/build-module/tabs/view.mjs.map +2 -2
- package/build-module/tabs-menu/index.mjs +1 -1
- package/build-module/tabs-menu/index.mjs.map +2 -2
- package/build-module/tabs-menu-item/block.json +1 -10
- package/build-module/tabs-menu-item/controls.mjs +32 -4
- package/build-module/tabs-menu-item/controls.mjs.map +2 -2
- package/build-module/tabs-menu-item/edit.mjs +7 -65
- package/build-module/tabs-menu-item/edit.mjs.map +2 -2
- package/build-module/tabs-menu-item/index.mjs +1 -1
- package/build-module/tabs-menu-item/index.mjs.map +2 -2
- package/build-module/tabs-menu-item/save.mjs +3 -3
- package/build-module/tabs-menu-item/save.mjs.map +2 -2
- package/build-module/template-part/edit/index.mjs +1 -1
- package/build-module/template-part/edit/index.mjs.map +2 -2
- package/build-module/template-part/edit/utils/get-template-part-icon.mjs +3 -6
- package/build-module/template-part/edit/utils/get-template-part-icon.mjs.map +2 -2
- package/build-module/term-description/block.json +1 -5
- package/build-module/term-description/deprecated.mjs +65 -0
- package/build-module/term-description/deprecated.mjs.map +7 -0
- package/build-module/term-description/edit.mjs +9 -34
- package/build-module/term-description/edit.mjs.map +2 -2
- package/build-module/term-description/index.mjs +3 -1
- package/build-module/term-description/index.mjs.map +2 -2
- package/build-module/utils/html-renderer.mjs.map +1 -1
- package/build-module/verse/block.json +2 -2
- package/build-module/verse/edit.mjs +2 -2
- package/build-module/verse/edit.mjs.map +2 -2
- package/build-style/common-rtl.css +4 -0
- package/build-style/common.css +4 -0
- package/build-style/editor-rtl.css +48 -0
- package/build-style/editor.css +48 -0
- package/build-style/icon/editor-rtl.css +92 -0
- package/build-style/icon/editor.css +92 -0
- package/build-style/icon/style-rtl.css +20 -0
- package/build-style/icon/style.css +20 -0
- package/build-style/style-rtl.css +30 -3
- package/build-style/style.css +30 -3
- package/build-style/tab/style-rtl.css +0 -3
- package/build-style/tab/style.css +0 -3
- package/build-style/tabs-menu-item/style-rtl.css +5 -0
- package/build-style/tabs-menu-item/style.css +5 -0
- package/package.json +38 -37
- package/src/accordion/index.js +1 -1
- package/src/accordion-heading/index.js +5 -1
- package/src/accordion-item/index.js +5 -1
- package/src/accordion-panel/index.js +5 -1
- package/src/breadcrumbs/edit.js +38 -7
- package/src/comment-author-name/edit.js +1 -1
- package/src/comment-date/edit.js +1 -1
- package/src/common.scss +3 -0
- package/src/editor.scss +1 -0
- package/src/embed/wp-embed-preview.js +1 -1
- package/src/gallery/block.json +2 -1
- package/src/gallery/index.php +65 -78
- package/src/group/edit.js +1 -1
- package/src/group/placeholder.js +2 -2
- package/src/heading/index.js +5 -1
- package/src/icon/block.json +71 -0
- package/src/icon/components/custom-inserter/icon-grid.js +55 -0
- package/src/icon/components/custom-inserter/index.js +73 -0
- package/src/icon/components/index.js +1 -0
- package/src/icon/edit.js +215 -0
- package/src/icon/editor.scss +51 -0
- package/src/icon/icon.js +14 -0
- package/src/icon/index.js +26 -0
- package/src/icon/index.php +132 -0
- package/src/icon/style.scss +25 -0
- package/src/image/edit.js +14 -1
- package/src/image/image.js +5 -2
- package/src/index.js +7 -8
- package/src/media-text/index.php +2 -2
- package/src/navigation/block.json +2 -0
- package/src/navigation/edit/deleted-overlay-warning.js +1 -1
- package/src/navigation/edit/index.js +48 -14
- package/src/navigation/edit/menu-inspector-controls.js +5 -0
- package/src/navigation/edit/overlay-menu-preview-button.js +1 -1
- package/src/navigation/edit/overlay-menu-preview-controls.js +1 -1
- package/src/navigation/edit/overlay-panel.js +2 -1
- package/src/navigation/edit/overlay-preview.js +1 -1
- package/src/navigation/edit/overlay-template-part-selector.js +16 -5
- package/src/navigation/edit/overlay-visibility-control.js +1 -1
- package/src/navigation/edit/test/use-create-overlay.js +20 -20
- package/src/navigation/edit/use-create-overlay.js +1 -1
- package/src/navigation/index.php +20 -16
- package/src/navigation-link/edit.js +11 -5
- package/src/navigation-link/index.js +18 -2
- package/src/navigation-link/link-ui/index.js +46 -3
- package/src/navigation-link/link-ui/page-creator.js +3 -3
- package/src/navigation-link/shared/controls.js +116 -128
- package/src/navigation-link/shared/index.js +1 -0
- package/src/navigation-link/shared/test/controls.js +81 -0
- package/src/navigation-link/shared/test/use-link-preview.test.js +530 -0
- package/src/navigation-link/shared/use-link-preview.js +92 -21
- package/src/navigation-link/test/block-labelling.js +246 -0
- package/src/navigation-submenu/block.json +1 -0
- package/src/navigation-submenu/edit.js +16 -8
- package/src/navigation-submenu/index.php +26 -13
- package/src/page-list/block.json +2 -1
- package/src/page-list/edit.js +2 -0
- package/src/page-list/index.php +44 -8
- package/src/page-list-item/block.json +2 -1
- package/src/page-list-item/edit.js +22 -13
- package/src/paragraph/test/transforms.native.js +1 -1
- package/src/playlist/index.php +6 -6
- package/src/playlist-track/index.php +3 -3
- package/src/post-comments-count/transforms.js +9 -2
- package/src/post-comments-link/block.json +1 -5
- package/src/post-comments-link/deprecated.js +68 -0
- package/src/post-comments-link/edit.js +20 -45
- package/src/post-comments-link/index.js +2 -0
- package/src/post-comments-link/transforms.js +9 -2
- package/src/post-content/edit.js +1 -1
- package/src/post-excerpt/block.json +1 -0
- package/src/post-excerpt/index.php +0 -9
- package/src/post-featured-image/dimension-controls.js +1 -1
- package/src/post-template/index.php +2 -2
- package/src/post-terms/block.json +1 -3
- package/src/post-terms/deprecated.js +86 -0
- package/src/post-terms/edit.js +2 -25
- package/src/post-terms/index.js +2 -0
- package/src/post-terms/use-post-terms.js +1 -1
- package/src/post-time-to-read/block.json +1 -3
- package/src/post-time-to-read/deprecated.js +69 -0
- package/src/post-time-to-read/edit.js +3 -27
- package/src/post-time-to-read/index.js +2 -0
- package/src/preformatted/test/transforms.native.js +1 -1
- package/src/query/edit/inspector-controls/taxonomy-controls.js +1 -1
- package/src/query-pagination-next/index.php +3 -3
- package/src/query-pagination-numbers/index.php +2 -2
- package/src/query-pagination-previous/index.php +3 -3
- package/src/query-title/index.php +2 -2
- package/src/query-total/index.php +2 -2
- package/src/style.scss +1 -0
- package/src/tab/add-tab-toolbar-control.js +1 -1
- package/src/tab/block.json +1 -8
- package/src/tab/controls.js +34 -30
- package/src/tab/edit.js +0 -3
- package/src/tab/index.js +5 -1
- package/src/tab/index.php +4 -2
- package/src/tab/remove-tab-toolbar-control.js +1 -1
- package/src/tab/save.js +3 -1
- package/src/tab/style.scss +0 -3
- package/src/tab-panel/index.js +5 -2
- package/src/tabs/block.json +6 -51
- package/src/tabs/controls.js +1 -31
- package/src/tabs/index.js +37 -2
- package/src/tabs/index.php +9 -12
- package/src/tabs/view.js +63 -29
- package/src/tabs-menu/index.js +5 -2
- package/src/tabs-menu/index.php +4 -2
- package/src/tabs-menu-item/block.json +1 -10
- package/src/tabs-menu-item/controls.js +28 -0
- package/src/tabs-menu-item/edit.js +13 -91
- package/src/tabs-menu-item/index.js +5 -2
- package/src/tabs-menu-item/index.php +7 -7
- package/src/tabs-menu-item/save.js +5 -10
- package/src/tabs-menu-item/style.scss +7 -0
- package/src/template-part/edit/index.js +1 -1
- package/src/template-part/edit/utils/get-template-part-icon.js +5 -14
- package/src/template-part/index.php +9 -2
- package/src/term-description/block.json +1 -5
- package/src/term-description/deprecated.js +68 -0
- package/src/term-description/edit.js +2 -29
- package/src/term-description/index.js +2 -0
- package/src/utils/html-renderer.js +1 -1
- package/src/verse/block.json +2 -2
- package/src/verse/edit.js +2 -2
- package/src/verse/test/edit.native.js +6 -6
- package/src/verse/test/transforms.native.js +1 -1
- package/build/accordion/icon.cjs +0 -50
- package/build/accordion/icon.cjs.map +0 -7
- package/build/accordion-heading/icon.cjs +0 -40
- package/build/accordion-heading/icon.cjs.map +0 -7
- package/build/accordion-item/icon.cjs +0 -58
- package/build/accordion-item/icon.cjs.map +0 -7
- package/build/accordion-panel/icon.cjs +0 -37
- package/build/accordion-panel/icon.cjs.map +0 -7
- package/build/navigation/utils/get-submenu-visibility.cjs +0 -37
- package/build/navigation/utils/get-submenu-visibility.cjs.map +0 -7
- package/build/tab/icon.cjs +0 -45
- package/build/tab/icon.cjs.map +0 -7
- package/build/tab-panel/icon.cjs +0 -29
- package/build/tab-panel/icon.cjs.map +0 -7
- package/build/tabs/icon.cjs +0 -45
- package/build/tabs/icon.cjs.map +0 -7
- package/build/tabs-menu/icon.cjs +0 -29
- package/build/tabs-menu/icon.cjs.map +0 -7
- package/build/tabs-menu-item/icon.cjs +0 -29
- package/build/tabs-menu-item/icon.cjs.map +0 -7
- package/build-module/accordion/icon.mjs +0 -29
- package/build-module/accordion/icon.mjs.map +0 -7
- package/build-module/accordion-heading/icon.mjs +0 -19
- package/build-module/accordion-heading/icon.mjs.map +0 -7
- package/build-module/accordion-item/icon.mjs +0 -37
- package/build-module/accordion-item/icon.mjs.map +0 -7
- package/build-module/accordion-panel/icon.mjs +0 -16
- package/build-module/accordion-panel/icon.mjs.map +0 -7
- package/build-module/navigation/utils/get-submenu-visibility.mjs +0 -12
- package/build-module/navigation/utils/get-submenu-visibility.mjs.map +0 -7
- package/build-module/tab/icon.mjs +0 -24
- package/build-module/tab/icon.mjs.map +0 -7
- package/build-module/tab-panel/icon.mjs +0 -8
- package/build-module/tab-panel/icon.mjs.map +0 -7
- package/build-module/tabs/icon.mjs +0 -24
- package/build-module/tabs/icon.mjs.map +0 -7
- package/build-module/tabs-menu/icon.mjs +0 -8
- package/build-module/tabs-menu/icon.mjs.map +0 -7
- package/build-module/tabs-menu-item/icon.mjs +0 -8
- package/build-module/tabs-menu-item/icon.mjs.map +0 -7
- package/src/accordion/icon.js +0 -23
- package/src/accordion-heading/icon.js +0 -16
- package/src/accordion-item/icon.js +0 -28
- package/src/accordion-panel/icon.js +0 -15
- package/src/navigation/utils/get-submenu-visibility.js +0 -27
- package/src/navigation/utils/test/get-submenu-visibility.js +0 -47
- package/src/tab/icon.js +0 -19
- package/src/tab-panel/icon.js +0 -10
- package/src/tabs/icon.js +0 -19
- package/src/tabs-menu/icon.js +0 -10
- package/src/tabs-menu-item/icon.js +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -37,14 +37,14 @@ __export(accordion_exports, {
|
|
|
37
37
|
});
|
|
38
38
|
module.exports = __toCommonJS(accordion_exports);
|
|
39
39
|
var import_i18n = require("@wordpress/i18n");
|
|
40
|
+
var import_icons = require("@wordpress/icons");
|
|
40
41
|
var import_edit = __toESM(require("./edit.cjs"));
|
|
41
42
|
var import_save = __toESM(require("./save.cjs"));
|
|
42
43
|
var import_block = __toESM(require("./block.json"));
|
|
43
44
|
var import_init_block = __toESM(require("../utils/init-block.cjs"));
|
|
44
|
-
var import_icon = __toESM(require("./icon.cjs"));
|
|
45
45
|
var { name } = import_block.default;
|
|
46
46
|
var settings = {
|
|
47
|
-
icon:
|
|
47
|
+
icon: import_icons.accordion,
|
|
48
48
|
example: {
|
|
49
49
|
innerBlocks: [
|
|
50
50
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/accordion/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport edit from './edit';\nimport save from './save';\nimport metadata from './block.json';\nimport initBlock from '../utils/init-block';\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { accordion as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport edit from './edit';\nimport save from './save';\nimport metadata from './block.json';\nimport initBlock from '../utils/init-block';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/accordion-item',\n\t\t\t\tinnerBlocks: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'core/accordion-heading',\n\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\ttitle: __(\n\t\t\t\t\t\t\t\t'Lorem ipsum dolor sit amet, consectetur.'\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],\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/accordion-item',\n\t\t\t\tinnerBlocks: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'core/accordion-heading',\n\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\ttitle: __(\n\t\t\t\t\t\t\t\t'Suspendisse commodo lacus, interdum et.'\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],\n\t\t\t},\n\t\t],\n\t},\n\tedit,\n\tsave,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,mBAAkC;AAKlC,kBAAiB;AACjB,kBAAiB;AACjB,mBAAqB;AACrB,wBAAsB;AAEtB,IAAM,EAAE,KAAK,IAAI,aAAAA;AAIV,IAAM,WAAW;AAAA,EACvB,mBAAAC;AAAA,EACA,SAAS;AAAA,IACR,aAAa;AAAA,MACZ;AAAA,QACC,MAAM;AAAA,QACN,aAAa;AAAA,UACZ;AAAA,YACC,MAAM;AAAA,YACN,YAAY;AAAA,cACX,WAAO;AAAA,gBACN;AAAA,cACD;AAAA,YACD;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,aAAa;AAAA,UACZ;AAAA,YACC,MAAM;AAAA,YACN,YAAY;AAAA,cACX,WAAO;AAAA,gBACN;AAAA,cACD;AAAA,YACD;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAAA,EACA,kBAAAC;AAAA,EACA,kBAAAC;AACD;AAEO,IAAM,OAAO,UAAM,kBAAAC,SAAW,EAAE,MAAM,uBAAAC,SAAU,SAAS,CAAE;",
|
|
6
6
|
"names": ["metadata", "icon", "edit", "save", "initBlock", "metadata"]
|
|
7
7
|
}
|
|
@@ -36,15 +36,15 @@ __export(accordion_heading_exports, {
|
|
|
36
36
|
settings: () => settings
|
|
37
37
|
});
|
|
38
38
|
module.exports = __toCommonJS(accordion_heading_exports);
|
|
39
|
+
var import_icons = require("@wordpress/icons");
|
|
39
40
|
var import_edit = __toESM(require("./edit.cjs"));
|
|
40
41
|
var import_save = __toESM(require("./save.cjs"));
|
|
41
42
|
var import_block = __toESM(require("./block.json"));
|
|
42
43
|
var import_init_block = __toESM(require("../utils/init-block.cjs"));
|
|
43
|
-
var import_icon = __toESM(require("./icon.cjs"));
|
|
44
44
|
var import_deprecated = __toESM(require("./deprecated.cjs"));
|
|
45
45
|
var { name } = import_block.default;
|
|
46
46
|
var settings = {
|
|
47
|
-
icon:
|
|
47
|
+
icon: import_icons.accordionHeading,
|
|
48
48
|
edit: import_edit.default,
|
|
49
49
|
save: import_save.default,
|
|
50
50
|
deprecated: import_deprecated.default
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/accordion-heading/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport edit from './edit';\nimport save from './save';\nimport metadata from './block.json';\nimport initBlock from '../utils/init-block';\nimport
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AACjB,kBAAiB;AACjB,mBAAqB;AACrB,wBAAsB;AACtB,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { accordionHeading as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport edit from './edit';\nimport save from './save';\nimport metadata from './block.json';\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAGA,mBAAyC;AAKzC,kBAAiB;AACjB,kBAAiB;AACjB,mBAAqB;AACrB,wBAAsB;AACtB,wBAAuB;AAEvB,IAAM,EAAE,KAAK,IAAI,aAAAA;AAIV,IAAM,WAAW;AAAA,EACvB,mBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,8BAAAC;AACD;AAEO,IAAM,OAAO,UAAM,kBAAAC,SAAW,EAAE,MAAM,uBAAAC,SAAU,SAAS,CAAE;",
|
|
6
6
|
"names": ["metadata", "icon", "edit", "save", "deprecated", "initBlock", "metadata"]
|
|
7
7
|
}
|
|
@@ -36,14 +36,14 @@ __export(accordion_item_exports, {
|
|
|
36
36
|
settings: () => settings
|
|
37
37
|
});
|
|
38
38
|
module.exports = __toCommonJS(accordion_item_exports);
|
|
39
|
+
var import_icons = require("@wordpress/icons");
|
|
39
40
|
var import_edit = __toESM(require("./edit.cjs"));
|
|
40
41
|
var import_save = __toESM(require("./save.cjs"));
|
|
41
42
|
var import_block = __toESM(require("./block.json"));
|
|
42
43
|
var import_init_block = __toESM(require("../utils/init-block.cjs"));
|
|
43
|
-
var import_icon = __toESM(require("./icon.cjs"));
|
|
44
44
|
var { name } = import_block.default;
|
|
45
45
|
var settings = {
|
|
46
|
-
icon:
|
|
46
|
+
icon: import_icons.accordionItem,
|
|
47
47
|
edit: import_edit.default,
|
|
48
48
|
save: import_save.default
|
|
49
49
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/accordion-item/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport edit from './edit';\nimport save from './save';\nimport metadata from './block.json';\nimport initBlock from '../utils/init-block';\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AACjB,kBAAiB;AACjB,mBAAqB;AACrB,wBAAsB;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { accordionItem as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport edit from './edit';\nimport save from './save';\nimport metadata from './block.json';\nimport initBlock from '../utils/init-block';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAGA,mBAAsC;AAKtC,kBAAiB;AACjB,kBAAiB;AACjB,mBAAqB;AACrB,wBAAsB;AAEtB,IAAM,EAAE,KAAK,IAAI,aAAAA;AAIV,IAAM,WAAW;AAAA,EACvB,mBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,kBAAAC;AACD;AAEO,IAAM,OAAO,UAAM,kBAAAC,SAAW,EAAE,MAAM,uBAAAC,SAAU,SAAS,CAAE;",
|
|
6
6
|
"names": ["metadata", "icon", "edit", "save", "initBlock", "metadata"]
|
|
7
7
|
}
|
|
@@ -36,14 +36,14 @@ __export(accordion_panel_exports, {
|
|
|
36
36
|
settings: () => settings
|
|
37
37
|
});
|
|
38
38
|
module.exports = __toCommonJS(accordion_panel_exports);
|
|
39
|
+
var import_icons = require("@wordpress/icons");
|
|
39
40
|
var import_edit = __toESM(require("./edit.cjs"));
|
|
40
41
|
var import_save = __toESM(require("./save.cjs"));
|
|
41
42
|
var import_block = __toESM(require("./block.json"));
|
|
42
43
|
var import_init_block = __toESM(require("../utils/init-block.cjs"));
|
|
43
|
-
var import_icon = __toESM(require("./icon.cjs"));
|
|
44
44
|
var { name } = import_block.default;
|
|
45
45
|
var settings = {
|
|
46
|
-
icon:
|
|
46
|
+
icon: import_icons.contents,
|
|
47
47
|
edit: import_edit.default,
|
|
48
48
|
save: import_save.default
|
|
49
49
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/accordion-panel/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport edit from './edit';\nimport save from './save';\nimport metadata from './block.json';\nimport initBlock from '../utils/init-block';\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AACjB,kBAAiB;AACjB,mBAAqB;AACrB,wBAAsB;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { contents as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport edit from './edit';\nimport save from './save';\nimport metadata from './block.json';\nimport initBlock from '../utils/init-block';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAGA,mBAAiC;AAKjC,kBAAiB;AACjB,kBAAiB;AACjB,mBAAqB;AACrB,wBAAsB;AAEtB,IAAM,EAAE,KAAK,IAAI,aAAAA;AAIV,IAAM,WAAW;AAAA,EACvB,mBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,kBAAAC;AACD;AAEO,IAAM,OAAO,UAAM,kBAAAC,SAAW,EAAE,MAAM,uBAAAC,SAAU,SAAS,CAAE;",
|
|
6
6
|
"names": ["metadata", "icon", "edit", "save", "initBlock", "metadata"]
|
|
7
7
|
}
|
|
@@ -108,6 +108,25 @@ function BreadcrumbEdit({
|
|
|
108
108
|
block: name,
|
|
109
109
|
urlQueryArgs: { post_id: postId, invalidationKey }
|
|
110
110
|
});
|
|
111
|
+
const prevContentRef = (0, import_element.useRef)("");
|
|
112
|
+
(0, import_element.useEffect)(() => {
|
|
113
|
+
if (status === "success") {
|
|
114
|
+
prevContentRef.current = content;
|
|
115
|
+
}
|
|
116
|
+
}, [content, status]);
|
|
117
|
+
const [showLoader, setShowLoader] = (0, import_element.useState)(false);
|
|
118
|
+
(0, import_element.useEffect)(() => {
|
|
119
|
+
if (status !== "loading") {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const timeout = setTimeout(() => {
|
|
123
|
+
setShowLoader(true);
|
|
124
|
+
}, 400);
|
|
125
|
+
return () => {
|
|
126
|
+
clearTimeout(timeout);
|
|
127
|
+
setShowLoader(false);
|
|
128
|
+
};
|
|
129
|
+
}, [status]);
|
|
111
130
|
const disabledRef = (0, import_compose.useDisabled)();
|
|
112
131
|
const blockProps = (0, import_block_editor.useBlockProps)({ ref: disabledRef });
|
|
113
132
|
if (isLoading) {
|
|
@@ -260,7 +279,19 @@ function BreadcrumbEdit({
|
|
|
260
279
|
}
|
|
261
280
|
)
|
|
262
281
|
] }),
|
|
263
|
-
status === "loading" && !showPlaceholder &&
|
|
282
|
+
status === "loading" && !showPlaceholder && (prevContentRef.current ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
283
|
+
import_html_renderer.default,
|
|
284
|
+
{
|
|
285
|
+
wrapperProps: {
|
|
286
|
+
...blockProps,
|
|
287
|
+
style: {
|
|
288
|
+
...blockProps.style,
|
|
289
|
+
opacity: showLoader ? 0.3 : 1
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
html: prevContentRef.current
|
|
293
|
+
}
|
|
294
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ...blockProps, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Spinner, {}) })),
|
|
264
295
|
status === "error" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ...blockProps, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: (0, import_i18n.sprintf)(
|
|
265
296
|
/* translators: %s: error message returned when rendering the block. */
|
|
266
297
|
(0, import_i18n.__)("Error: %s"),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/breadcrumbs/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport {\n\tToggleControl,\n\tTextControl,\n\tCheckboxControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tSpinner,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useEffect, useState } from '@wordpress/element';\nimport { useServerSideRender } from '@wordpress/server-side-render';\nimport { useDisabled } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\nimport HtmlRenderer from '../utils/html-renderer';\n\nconst separatorDefaultValue = '/';\n\nexport default function BreadcrumbEdit( {\n\tattributes,\n\tsetAttributes,\n\tname,\n\tcontext: { postId, postType, templateSlug },\n} ) {\n\tconst {\n\t\tseparator,\n\t\tshowHomeItem,\n\t\tshowCurrentItem,\n\t\tprefersTaxonomy,\n\t\tshowOnHomePage,\n\t} = attributes;\n\tconst {\n\t\tpost,\n\t\tisPostTypeHierarchical,\n\t\tpostTypeHasTaxonomies,\n\t\thasTermsAssigned,\n\t\tisLoading,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! postType ) {\n\t\t\t\treturn {};\n\t\t\t}\n\t\t\tconst _post = select( coreStore ).getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t\tconst postTypeObject = select( coreStore ).getPostType( postType );\n\t\t\tconst _postTypeHasTaxonomies =\n\t\t\t\tpostTypeObject && postTypeObject.taxonomies.length;\n\t\t\tlet taxonomies;\n\t\t\tif ( _postTypeHasTaxonomies ) {\n\t\t\t\ttaxonomies = select( coreStore ).getTaxonomies( {\n\t\t\t\t\ttype: postType,\n\t\t\t\t\tper_page: -1,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tpost: _post,\n\t\t\t\tisPostTypeHierarchical: postTypeObject?.hierarchical,\n\t\t\t\tpostTypeHasTaxonomies: _postTypeHasTaxonomies,\n\t\t\t\thasTermsAssigned:\n\t\t\t\t\t_post &&\n\t\t\t\t\t( taxonomies || [] )\n\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t( { visibility } ) => visibility?.publicly_queryable\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.some( ( taxonomy ) => {\n\t\t\t\t\t\t\treturn !! _post[ taxonomy.rest_base ]?.length;\n\t\t\t\t\t\t} ),\n\t\t\t\tisLoading:\n\t\t\t\t\t( postId && ! _post ) ||\n\t\t\t\t\t! postTypeObject ||\n\t\t\t\t\t( _postTypeHasTaxonomies && ! taxonomies ),\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\t/**\n\t * Counter used to cache-bust `useServerSideRender`.\n\t *\n\t * This is a catch-all signal to re-render the block when a post's title,\n\t * parent ID, or terms change.\n\t *\n\t * This is fundamentally imperfect, because there are other entities which\n\t * could change in the meantime (the titles of ancestor posts, or the\n\t * labels of taxonomy terms), hence the choice to re-render systematically\n\t * upon saving.\n\t */\n\tconst [ invalidationKey, setInvalidationKey ] = useState( 0 );\n\tuseEffect( () => {\n\t\tsetInvalidationKey( ( c ) => c + 1 );\n\t}, [ post ] );\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst { content, status, error } = useServerSideRender( {\n\t\tattributes,\n\t\tskipBlockSupportAttributes: true,\n\t\tblock: name,\n\t\turlQueryArgs: { post_id: postId, invalidationKey },\n\t} );\n\n\tconst disabledRef = useDisabled();\n\tconst blockProps = useBlockProps( { ref: disabledRef } );\n\n\tif ( isLoading ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Spinner />\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Try to determine breadcrumb type for more accurate previews.\n\tlet _showTerms;\n\t// Some non-hierarchical post types (e.g., attachments) can have parents.\n\t// Use hierarchical breadcrumbs if a parent exists, otherwise use taxonomy breadcrumbs.\n\tif ( ! isPostTypeHierarchical && ! post?.parent ) {\n\t\t_showTerms = true;\n\t} else if ( ! postTypeHasTaxonomies ) {\n\t\t// Hierarchical post type without taxonomies can only use ancestors.\n\t\t_showTerms = false;\n\t} else {\n\t\t// For hierarchical post types with taxonomies, use the attribute.\n\t\t_showTerms = prefersTaxonomy;\n\t}\n\tlet placeholder = null;\n\t// This is fragile because this block is server side rendered and we'll have to\n\t// update the placeholder html if the server side rendering output changes.\n\tconst showPlaceholder =\n\t\t! postId ||\n\t\t! postType ||\n\t\t// When `templateSlug` is set only show placeholder if the post type is not.\n\t\t// This is needed because when we are showing the template in post editor we\n\t\t// want to show the real breadcrumbs if we have the post type.\n\t\t( templateSlug && ! postType ) ||\n\t\t( ! _showTerms && ! isPostTypeHierarchical ) ||\n\t\t( _showTerms && ! hasTermsAssigned );\n\tif ( showPlaceholder ) {\n\t\tconst placeholderItems = [];\n\t\tif ( showHomeItem ) {\n\t\t\tplaceholderItems.push( __( 'Home' ) );\n\t\t}\n\t\tif ( templateSlug && ! postId ) {\n\t\t\tplaceholderItems.push( __( 'Page' ) );\n\t\t} else if ( _showTerms ) {\n\t\t\tplaceholderItems.push( __( 'Category' ) );\n\t\t} else {\n\t\t\tplaceholderItems.push( __( 'Ancestor' ), __( 'Parent' ) );\n\t\t}\n\t\tplaceholder = (\n\t\t\t<nav\n\t\t\t\t{ ...blockProps }\n\t\t\t\tstyle={ {\n\t\t\t\t\t'--separator': `\"${ separator\n\t\t\t\t\t\t.replace( /\\\\/g, '\\\\\\\\' )\n\t\t\t\t\t\t.replace( /\"/g, '\\\\\"' ) }\"`,\n\t\t\t\t\t...blockProps.style,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<ol>\n\t\t\t\t\t{ placeholderItems.map( ( text, index ) => (\n\t\t\t\t\t\t<li key={ index }>\n\t\t\t\t\t\t\t<a href={ `#breadcrumbs-pseudo-link-${ index }` }>\n\t\t\t\t\t\t\t\t{ text }\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t) ) }\n\t\t\t\t\t{ showCurrentItem && (\n\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t<span aria-current=\"page\">{ __( 'Current' ) }</span>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t) }\n\t\t\t\t</ol>\n\t\t\t</nav>\n\t\t);\n\t}\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tseparator: separatorDefaultValue,\n\t\t\t\t\t\t\tshowHomeItem: true,\n\t\t\t\t\t\t\tshowCurrentItem: true,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Show home breadcrumb' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => ! showHomeItem }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowHomeItem: true,\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\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Show home breadcrumb' ) }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { showHomeItem: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchecked={ showHomeItem }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Show current breadcrumb' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => ! showCurrentItem }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowCurrentItem: true,\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\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Show current breadcrumb' ) }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { showCurrentItem: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchecked={ showCurrentItem }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Separator' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => separator !== separatorDefaultValue }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tseparator: separatorDefaultValue,\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\t<TextControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\t\tlabel={ __( 'Separator' ) }\n\t\t\t\t\t\t\tvalue={ separator }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { separator: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonBlur={ () => {\n\t\t\t\t\t\t\t\tif ( ! separator ) {\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tseparator: separatorDefaultValue,\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} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<CheckboxControl\n\t\t\t\t\tlabel={ __( 'Show on homepage' ) }\n\t\t\t\t\tchecked={ showOnHomePage }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { showOnHomePage: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'If this breadcrumbs block appears in a template or template part that\u2019s shown on the homepage, enable this option to display the breadcrumb trail. Otherwise, this setting has no effect.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t\t<CheckboxControl\n\t\t\t\t\tlabel={ __( 'Prefer taxonomy terms' ) }\n\t\t\t\t\tchecked={ prefersTaxonomy }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { prefersTaxonomy: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'The exact type of breadcrumbs shown will vary automatically depending on the page in which this block is displayed. In the specific case of a hierarchical post type with taxonomies, the breadcrumbs can either reflect its post hierarchy (default) or the hierarchy of its assigned taxonomy terms.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t{ status === 'loading' && ! showPlaceholder && (\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<Spinner />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ status === 'error' && (\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t/* translators: %s: error message returned when rendering the block. */\n\t\t\t\t\t\t\t__( 'Error: %s' ),\n\t\t\t\t\t\t\terror\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ showPlaceholder && placeholder }\n\t\t\t{ ! showPlaceholder && status === 'success' && (\n\t\t\t\t<HtmlRenderer wrapperProps={ blockProps } html={ content } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA4B;AAC5B,0BAAiD;AACjD,wBAOO;AACP,kBAA0B;AAC1B,uBAAmC;AACnC,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport {\n\tToggleControl,\n\tTextControl,\n\tCheckboxControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tSpinner,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { useServerSideRender } from '@wordpress/server-side-render';\nimport { useDisabled } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\nimport HtmlRenderer from '../utils/html-renderer';\n\nconst separatorDefaultValue = '/';\n\nexport default function BreadcrumbEdit( {\n\tattributes,\n\tsetAttributes,\n\tname,\n\tcontext: { postId, postType, templateSlug },\n} ) {\n\tconst {\n\t\tseparator,\n\t\tshowHomeItem,\n\t\tshowCurrentItem,\n\t\tprefersTaxonomy,\n\t\tshowOnHomePage,\n\t} = attributes;\n\tconst {\n\t\tpost,\n\t\tisPostTypeHierarchical,\n\t\tpostTypeHasTaxonomies,\n\t\thasTermsAssigned,\n\t\tisLoading,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! postType ) {\n\t\t\t\treturn {};\n\t\t\t}\n\t\t\tconst _post = select( coreStore ).getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t\tconst postTypeObject = select( coreStore ).getPostType( postType );\n\t\t\tconst _postTypeHasTaxonomies =\n\t\t\t\tpostTypeObject && postTypeObject.taxonomies.length;\n\t\t\tlet taxonomies;\n\t\t\tif ( _postTypeHasTaxonomies ) {\n\t\t\t\ttaxonomies = select( coreStore ).getTaxonomies( {\n\t\t\t\t\ttype: postType,\n\t\t\t\t\tper_page: -1,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tpost: _post,\n\t\t\t\tisPostTypeHierarchical: postTypeObject?.hierarchical,\n\t\t\t\tpostTypeHasTaxonomies: _postTypeHasTaxonomies,\n\t\t\t\thasTermsAssigned:\n\t\t\t\t\t_post &&\n\t\t\t\t\t( taxonomies || [] )\n\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t( { visibility } ) => visibility?.publicly_queryable\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.some( ( taxonomy ) => {\n\t\t\t\t\t\t\treturn !! _post[ taxonomy.rest_base ]?.length;\n\t\t\t\t\t\t} ),\n\t\t\t\tisLoading:\n\t\t\t\t\t( postId && ! _post ) ||\n\t\t\t\t\t! postTypeObject ||\n\t\t\t\t\t( _postTypeHasTaxonomies && ! taxonomies ),\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\t/**\n\t * Counter used to cache-bust `useServerSideRender`.\n\t *\n\t * This is a catch-all signal to re-render the block when a post's title,\n\t * parent ID, or terms change.\n\t *\n\t * This is fundamentally imperfect, because there are other entities which\n\t * could change in the meantime (the titles of ancestor posts, or the\n\t * labels of taxonomy terms), hence the choice to re-render systematically\n\t * upon saving.\n\t */\n\tconst [ invalidationKey, setInvalidationKey ] = useState( 0 );\n\tuseEffect( () => {\n\t\tsetInvalidationKey( ( c ) => c + 1 );\n\t}, [ post ] );\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst { content, status, error } = useServerSideRender( {\n\t\tattributes,\n\t\tskipBlockSupportAttributes: true,\n\t\tblock: name,\n\t\turlQueryArgs: { post_id: postId, invalidationKey },\n\t} );\n\tconst prevContentRef = useRef( '' );\n\tuseEffect( () => {\n\t\tif ( status === 'success' ) {\n\t\t\tprevContentRef.current = content;\n\t\t}\n\t}, [ content, status ] );\n\tconst [ showLoader, setShowLoader ] = useState( false );\n\tuseEffect( () => {\n\t\tif ( status !== 'loading' ) {\n\t\t\treturn;\n\t\t}\n\t\tconst timeout = setTimeout( () => {\n\t\t\tsetShowLoader( true );\n\t\t}, 400 );\n\t\treturn () => {\n\t\t\tclearTimeout( timeout );\n\t\t\tsetShowLoader( false );\n\t\t};\n\t}, [ status ] );\n\tconst disabledRef = useDisabled();\n\tconst blockProps = useBlockProps( { ref: disabledRef } );\n\n\tif ( isLoading ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Spinner />\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Try to determine breadcrumb type for more accurate previews.\n\tlet _showTerms;\n\t// Some non-hierarchical post types (e.g., attachments) can have parents.\n\t// Use hierarchical breadcrumbs if a parent exists, otherwise use taxonomy breadcrumbs.\n\tif ( ! isPostTypeHierarchical && ! post?.parent ) {\n\t\t_showTerms = true;\n\t} else if ( ! postTypeHasTaxonomies ) {\n\t\t// Hierarchical post type without taxonomies can only use ancestors.\n\t\t_showTerms = false;\n\t} else {\n\t\t// For hierarchical post types with taxonomies, use the attribute.\n\t\t_showTerms = prefersTaxonomy;\n\t}\n\tlet placeholder = null;\n\t// This is fragile because this block is server side rendered and we'll have to\n\t// update the placeholder html if the server side rendering output changes.\n\tconst showPlaceholder =\n\t\t! postId ||\n\t\t! postType ||\n\t\t// When `templateSlug` is set only show placeholder if the post type is not.\n\t\t// This is needed because when we are showing the template in post editor we\n\t\t// want to show the real breadcrumbs if we have the post type.\n\t\t( templateSlug && ! postType ) ||\n\t\t( ! _showTerms && ! isPostTypeHierarchical ) ||\n\t\t( _showTerms && ! hasTermsAssigned );\n\tif ( showPlaceholder ) {\n\t\tconst placeholderItems = [];\n\t\tif ( showHomeItem ) {\n\t\t\tplaceholderItems.push( __( 'Home' ) );\n\t\t}\n\t\tif ( templateSlug && ! postId ) {\n\t\t\tplaceholderItems.push( __( 'Page' ) );\n\t\t} else if ( _showTerms ) {\n\t\t\tplaceholderItems.push( __( 'Category' ) );\n\t\t} else {\n\t\t\tplaceholderItems.push( __( 'Ancestor' ), __( 'Parent' ) );\n\t\t}\n\t\tplaceholder = (\n\t\t\t<nav\n\t\t\t\t{ ...blockProps }\n\t\t\t\tstyle={ {\n\t\t\t\t\t'--separator': `\"${ separator\n\t\t\t\t\t\t.replace( /\\\\/g, '\\\\\\\\' )\n\t\t\t\t\t\t.replace( /\"/g, '\\\\\"' ) }\"`,\n\t\t\t\t\t...blockProps.style,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<ol>\n\t\t\t\t\t{ placeholderItems.map( ( text, index ) => (\n\t\t\t\t\t\t<li key={ index }>\n\t\t\t\t\t\t\t<a href={ `#breadcrumbs-pseudo-link-${ index }` }>\n\t\t\t\t\t\t\t\t{ text }\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t) ) }\n\t\t\t\t\t{ showCurrentItem && (\n\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t<span aria-current=\"page\">{ __( 'Current' ) }</span>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t) }\n\t\t\t\t</ol>\n\t\t\t</nav>\n\t\t);\n\t}\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tseparator: separatorDefaultValue,\n\t\t\t\t\t\t\tshowHomeItem: true,\n\t\t\t\t\t\t\tshowCurrentItem: true,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Show home breadcrumb' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => ! showHomeItem }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowHomeItem: true,\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\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Show home breadcrumb' ) }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { showHomeItem: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchecked={ showHomeItem }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Show current breadcrumb' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => ! showCurrentItem }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowCurrentItem: true,\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\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Show current breadcrumb' ) }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { showCurrentItem: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchecked={ showCurrentItem }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Separator' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => separator !== separatorDefaultValue }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tseparator: separatorDefaultValue,\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\t<TextControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\t\tlabel={ __( 'Separator' ) }\n\t\t\t\t\t\t\tvalue={ separator }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { separator: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonBlur={ () => {\n\t\t\t\t\t\t\t\tif ( ! separator ) {\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tseparator: separatorDefaultValue,\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} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<CheckboxControl\n\t\t\t\t\tlabel={ __( 'Show on homepage' ) }\n\t\t\t\t\tchecked={ showOnHomePage }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { showOnHomePage: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'If this breadcrumbs block appears in a template or template part that\u2019s shown on the homepage, enable this option to display the breadcrumb trail. Otherwise, this setting has no effect.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t\t<CheckboxControl\n\t\t\t\t\tlabel={ __( 'Prefer taxonomy terms' ) }\n\t\t\t\t\tchecked={ prefersTaxonomy }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { prefersTaxonomy: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'The exact type of breadcrumbs shown will vary automatically depending on the page in which this block is displayed. In the specific case of a hierarchical post type with taxonomies, the breadcrumbs can either reflect its post hierarchy (default) or the hierarchy of its assigned taxonomy terms.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t{ status === 'loading' &&\n\t\t\t\t! showPlaceholder &&\n\t\t\t\t( prevContentRef.current ? (\n\t\t\t\t\t<HtmlRenderer\n\t\t\t\t\t\twrapperProps={ {\n\t\t\t\t\t\t\t...blockProps,\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t...blockProps.style,\n\t\t\t\t\t\t\t\topacity: showLoader ? 0.3 : 1,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t} }\n\t\t\t\t\t\thtml={ prevContentRef.current }\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</div>\n\t\t\t\t) ) }\n\t\t\t{ status === 'error' && (\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t/* translators: %s: error message returned when rendering the block. */\n\t\t\t\t\t\t\t__( 'Error: %s' ),\n\t\t\t\t\t\t\terror\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ showPlaceholder && placeholder }\n\t\t\t{ ! showPlaceholder && status === 'success' && (\n\t\t\t\t<HtmlRenderer wrapperProps={ blockProps } html={ content } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA4B;AAC5B,0BAAiD;AACjD,wBAOO;AACP,kBAA0B;AAC1B,uBAAmC;AACnC,qBAA4C;AAC5C,gCAAoC;AACpC,qBAA4B;AAK5B,mBAA+C;AAC/C,2BAAyB;AAiHrB;AA/GJ,IAAM,wBAAwB;AAEf,SAAR,eAAiC;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS,EAAE,QAAQ,UAAU,aAAa;AAC3C,GAAI;AACH,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI;AACJ,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,QAAI;AAAA,IACH,CAAE,WAAY;AACb,UAAK,CAAE,UAAW;AACjB,eAAO,CAAC;AAAA,MACT;AACA,YAAM,QAAQ,OAAQ,iBAAAA,KAAU,EAAE;AAAA,QACjC;AAAA,QACA;AAAA,QACA;AAAA,MACD;AACA,YAAM,iBAAiB,OAAQ,iBAAAA,KAAU,EAAE,YAAa,QAAS;AACjE,YAAM,yBACL,kBAAkB,eAAe,WAAW;AAC7C,UAAI;AACJ,UAAK,wBAAyB;AAC7B,qBAAa,OAAQ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AAA,IACnB,CAAE,mBAAmB,WAAW,aACjC,4CAAC,qBAAAA,SAAA,EAAa,cAAe,YAAa,MAAO,SAAU;AAAA,KAE7D;AAEF;",
|
|
6
6
|
"names": ["coreStore", "ToolsPanel", "ToolsPanelItem", "HtmlRenderer"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/comment-author-name/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\nimport useDeprecatedTextAlign from '../utils/deprecated-text-align-attributes';\n\n/**\n * Renders the `core/comment-author-name` block on the editor.\n *\n * @param {Object} props React props.\n * @param {Object} props.setAttributes Callback for updating block attributes.\n * @param {Object} props.attributes Block attributes.\n * @param {string} props.attributes.isLink Whether the author name should be linked.\n * @param {string} props.attributes.linkTarget Target of the link.\n * @param {Object} props.context Inherited context.\n * @param {string} props.context.commentId The comment ID.\n *\n * @return {JSX.Element} React element.\n */\nexport default function Edit( props ) {\n\tconst {\n\t\tattributes: { isLink, linkTarget },\n\t\tcontext: { commentId },\n\t\tsetAttributes,\n\t} = props;\n\tuseDeprecatedTextAlign( props );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst blockProps = useBlockProps();\n\tlet displayName = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\n\t\t\tconst comment = getEntityRecord( 'root', 'comment', commentId );\n\t\t\tconst authorName = comment?.author_name;\n\n\t\t\tif ( comment && ! authorName ) {\n\t\t\t\tconst user = getEntityRecord( 'root', 'user', comment.author );\n\t\t\t\treturn user?.name ?? __( 'Anonymous' );\n\t\t\t}\n\t\t\treturn authorName ?? '';\n\t\t},\n\t\t[ commentId ]\n\t);\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\tresetAll={ () => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tisLink: true,\n\t\t\t\t\t\tlinkTarget: '_self',\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Link to authors URL' ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t\thasValue={ () => ! isLink }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tisLink: true,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Link to authors URL' ) }\n\t\t\t\t\t\tonChange={ () => setAttributes( { isLink: ! isLink } ) }\n\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t\t{ isLink && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => linkTarget !== '_self' }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tlinkTarget: '_self',\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\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tlinkTarget: value ? '_blank' : '_self',\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n\n\tif ( ! commentId || ! displayName ) {\n\t\tdisplayName = _x( 'Comment Author', 'block title' );\n\t}\n\n\tconst displayAuthor = isLink ? (\n\t\t<a\n\t\t\thref=\"#comment-author-pseudo-link\"\n\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t>\n\t\t\t{ displayName }\n\t\t</a>\n\t) : (\n\t\tdisplayName\n\t);\n\treturn (\n\t\t<>\n\t\t\t{ inspectorControls }\n\t\t\t<div { ...blockProps }>{ displayAuthor }</div>\n\t\t</>\n\t);\n}\n"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\nimport useDeprecatedTextAlign from '../utils/deprecated-text-align-attributes';\n\n/**\n * Renders the `core/comment-author-name` block on the editor.\n *\n * @param {Object} props React props.\n * @param {Object} props.setAttributes Callback for updating block attributes.\n * @param {Object} props.attributes Block attributes.\n * @param {string} props.attributes.isLink Whether the author name should be linked.\n * @param {string} props.attributes.linkTarget Target of the link.\n * @param {Object} props.context Inherited context.\n * @param {string} props.context.commentId The comment ID.\n *\n * @return {React.JSX.Element} React element.\n */\nexport default function Edit( props ) {\n\tconst {\n\t\tattributes: { isLink, linkTarget },\n\t\tcontext: { commentId },\n\t\tsetAttributes,\n\t} = props;\n\tuseDeprecatedTextAlign( props );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst blockProps = useBlockProps();\n\tlet displayName = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\n\t\t\tconst comment = getEntityRecord( 'root', 'comment', commentId );\n\t\t\tconst authorName = comment?.author_name;\n\n\t\t\tif ( comment && ! authorName ) {\n\t\t\t\tconst user = getEntityRecord( 'root', 'user', comment.author );\n\t\t\t\treturn user?.name ?? __( 'Anonymous' );\n\t\t\t}\n\t\t\treturn authorName ?? '';\n\t\t},\n\t\t[ commentId ]\n\t);\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\tresetAll={ () => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tisLink: true,\n\t\t\t\t\t\tlinkTarget: '_self',\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Link to authors URL' ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t\thasValue={ () => ! isLink }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tisLink: true,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Link to authors URL' ) }\n\t\t\t\t\t\tonChange={ () => setAttributes( { isLink: ! isLink } ) }\n\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t\t{ isLink && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => linkTarget !== '_self' }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tlinkTarget: '_self',\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\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tlinkTarget: value ? '_blank' : '_self',\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n\n\tif ( ! commentId || ! displayName ) {\n\t\tdisplayName = _x( 'Comment Author', 'block title' );\n\t}\n\n\tconst displayAuthor = isLink ? (\n\t\t<a\n\t\t\thref=\"#comment-author-pseudo-link\"\n\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t>\n\t\t\t{ displayName }\n\t\t</a>\n\t) : (\n\t\tdisplayName\n\t);\n\treturn (\n\t\t<>\n\t\t\t{ inspectorControls }\n\t\t\t<div { ...blockProps }>{ displayAuthor }</div>\n\t\t</>\n\t);\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAuB;AACvB,kBAA0B;AAC1B,0BAAiD;AACjD,uBAAmC;AACnC,wBAIO;AAKP,mBAA+C;AAC/C,8CAAmC;AA0ChC;AA3BY,SAAR,KAAuB,OAAQ;AACrC,QAAM;AAAA,IACL,YAAY,EAAE,QAAQ,WAAW;AAAA,IACjC,SAAS,EA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Z,cAAe;AAAA,cACd,YAAY;AAAA,YACb,CAAE;AAAA,YAGH;AAAA,cAAC;AAAA;AAAA,gBACA,WAAQ,gBAAI,iBAAkB;AAAA,gBAC9B,UAAW,CAAE,UACZ,cAAe;AAAA,kBACd,YAAY,QAAQ,WAAW;AAAA,gBAChC,CAAE;AAAA,gBAEH,SAAU,eAAe;AAAA;AAAA,YAC1B;AAAA;AAAA,QACD;AAAA;AAAA;AAAA,EAEF,GACD;AAGD,MAAK,CAAE,aAAa,CAAE,aAAc;AACnC,sBAAc,gBAAI,kBAAkB,aAAc;AAAA,EACnD;AAEA,QAAM,gBAAgB,SACrB;AAAA,IAAC;AAAA;AAAA,MACA,MAAK;AAAA,MACL,SAAU,CAAE,UAAW,MAAM,eAAe;AAAA,MAE1C;AAAA;AAAA,EACH,IAEA;AAED,SACC,4EACG;AAAA;AAAA,IACF,4CAAC,SAAM,GAAG,YAAe,yBAAe;AAAA,KACzC;AAEF;",
|
|
6
6
|
"names": ["useDeprecatedTextAlign", "coreStore", "ToolsPanel", "ToolsPanelItem"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/comment-date/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEntityProp } from '@wordpress/core-data';\nimport {\n\tdateI18n,\n\thumanTimeDiff,\n\tgetSettings as getDateSettings,\n} from '@wordpress/date';\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\t__experimentalDateFormatPicker as DateFormatPicker,\n} from '@wordpress/block-editor';\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tToggleControl,\n} from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\n/**\n * Renders the `core/comment-date` block on the editor.\n *\n * @param {Object} props React props.\n * @param {Object} props.setAttributes Callback for updating block attributes.\n * @param {Object} props.attributes Block attributes.\n * @param {string} props.attributes.format Format of the date.\n * @param {string} props.attributes.isLink Whether the author name should be linked.\n * @param {Object} props.context Inherited context.\n * @param {string} props.context.commentId The comment ID.\n *\n * @return {JSX.Element} React element.\n */\nexport default function Edit( {\n\tattributes: { format, isLink },\n\tcontext: { commentId },\n\tsetAttributes,\n} ) {\n\tconst blockProps = useBlockProps();\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tlet [ date ] = useEntityProp( 'root', 'comment', 'date', commentId );\n\tconst [ siteFormat = getDateSettings().formats.date ] = useEntityProp(\n\t\t'root',\n\t\t'site',\n\t\t'date_format'\n\t);\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\tresetAll={ () => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tformat: undefined,\n\t\t\t\t\t\tisLink: true,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Date format' ) }\n\t\t\t\t\thasValue={ () => format !== undefined }\n\t\t\t\t\tonDeselect={ () => setAttributes( { format: undefined } ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<DateFormatPicker\n\t\t\t\t\t\tformat={ format }\n\t\t\t\t\t\tdefaultFormat={ siteFormat }\n\t\t\t\t\t\tonChange={ ( nextFormat ) =>\n\t\t\t\t\t\t\tsetAttributes( { format: nextFormat } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Link to comment' ) }\n\t\t\t\t\thasValue={ () => ! isLink }\n\t\t\t\t\tonDeselect={ () => setAttributes( { isLink: true } ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Link to comment' ) }\n\t\t\t\t\t\tonChange={ () => setAttributes( { isLink: ! isLink } ) }\n\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n\n\tif ( ! commentId || ! date ) {\n\t\tdate = _x( 'Comment Date', 'block title' );\n\t}\n\n\tlet commentDate =\n\t\tdate instanceof Date ? (\n\t\t\t<time dateTime={ dateI18n( 'c', date ) }>\n\t\t\t\t{ format === 'human-diff'\n\t\t\t\t\t? humanTimeDiff( date )\n\t\t\t\t\t: dateI18n( format || siteFormat, date ) }\n\t\t\t</time>\n\t\t) : (\n\t\t\t<time>{ date }</time>\n\t\t);\n\n\tif ( isLink ) {\n\t\tcommentDate = (\n\t\t\t<a\n\t\t\t\thref=\"#comment-date-pseudo-link\"\n\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t>\n\t\t\t\t{ commentDate }\n\t\t\t</a>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ inspectorControls }\n\t\t\t<div { ...blockProps }>{ commentDate }</div>\n\t\t</>\n\t);\n}\n"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEntityProp } from '@wordpress/core-data';\nimport {\n\tdateI18n,\n\thumanTimeDiff,\n\tgetSettings as getDateSettings,\n} from '@wordpress/date';\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\t__experimentalDateFormatPicker as DateFormatPicker,\n} from '@wordpress/block-editor';\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tToggleControl,\n} from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\n/**\n * Renders the `core/comment-date` block on the editor.\n *\n * @param {Object} props React props.\n * @param {Object} props.setAttributes Callback for updating block attributes.\n * @param {Object} props.attributes Block attributes.\n * @param {string} props.attributes.format Format of the date.\n * @param {string} props.attributes.isLink Whether the author name should be linked.\n * @param {Object} props.context Inherited context.\n * @param {string} props.context.commentId The comment ID.\n *\n * @return {React.JSX.Element} React element.\n */\nexport default function Edit( {\n\tattributes: { format, isLink },\n\tcontext: { commentId },\n\tsetAttributes,\n} ) {\n\tconst blockProps = useBlockProps();\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tlet [ date ] = useEntityProp( 'root', 'comment', 'date', commentId );\n\tconst [ siteFormat = getDateSettings().formats.date ] = useEntityProp(\n\t\t'root',\n\t\t'site',\n\t\t'date_format'\n\t);\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\tresetAll={ () => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tformat: undefined,\n\t\t\t\t\t\tisLink: true,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Date format' ) }\n\t\t\t\t\thasValue={ () => format !== undefined }\n\t\t\t\t\tonDeselect={ () => setAttributes( { format: undefined } ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<DateFormatPicker\n\t\t\t\t\t\tformat={ format }\n\t\t\t\t\t\tdefaultFormat={ siteFormat }\n\t\t\t\t\t\tonChange={ ( nextFormat ) =>\n\t\t\t\t\t\t\tsetAttributes( { format: nextFormat } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Link to comment' ) }\n\t\t\t\t\thasValue={ () => ! isLink }\n\t\t\t\t\tonDeselect={ () => setAttributes( { isLink: true } ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Link to comment' ) }\n\t\t\t\t\t\tonChange={ () => setAttributes( { isLink: ! isLink } ) }\n\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n\n\tif ( ! commentId || ! date ) {\n\t\tdate = _x( 'Comment Date', 'block title' );\n\t}\n\n\tlet commentDate =\n\t\tdate instanceof Date ? (\n\t\t\t<time dateTime={ dateI18n( 'c', date ) }>\n\t\t\t\t{ format === 'human-diff'\n\t\t\t\t\t? humanTimeDiff( date )\n\t\t\t\t\t: dateI18n( format || siteFormat, date ) }\n\t\t\t</time>\n\t\t) : (\n\t\t\t<time>{ date }</time>\n\t\t);\n\n\tif ( isLink ) {\n\t\tcommentDate = (\n\t\t\t<a\n\t\t\t\thref=\"#comment-date-pseudo-link\"\n\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t>\n\t\t\t\t{ commentDate }\n\t\t\t</a>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ inspectorControls }\n\t\t\t<div { ...blockProps }>{ commentDate }</div>\n\t\t</>\n\t);\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAA8B;AAC9B,kBAIO;AACP,0BAIO;AACP,wBAIO;AACP,kBAAuB;AAKvB,mBAA+C;AAgC5C;AAjBY,SAAR,KAAuB;AAAA,EAC7B,YAAY,EAAE,QAAQ,OAAO;AAAA,EAC7B,SAAS,EAAE,UAAU;AAAA,EACrB;AACD,GAAI;AACH,QAAM,iBAAa,mCAAc;AACjC,QAAM,wBAAoB,6CAA+B;AAEzD,MAAI,CAAE,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OACf,4CAAC,UAAK,cAAW,sBAAU,KAAK,IAAK,GAClC,qBAAW,mBACV,2BAAe,IAAK,QACpB,sBAAU,UAAU,YAAY,IAAK,GACzC,IAEA,4CAAC,UAAO,gBAAM;AAGhB,MAAK,QAAS;AACb,kBACC;AAAA,MAAC;AAAA;AAAA,QACA,MAAK;AAAA,QACL,SAAU,CAAE,UAAW,MAAM,eAAe;AAAA,QAE1C;AAAA;AAAA,IACH;AAAA,EAEF;AAEA,SACC,4EACG;AAAA;AAAA,IACF,4CAAC,SAAM,GAAG,YAAe,uBAAa;AAAA,KACvC;AAEF;",
|
|
6
6
|
"names": ["getDateSettings", "ToolsPanel", "ToolsPanelItem", "DateFormatPicker"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/embed/wp-embed-preview.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useMergeRefs, useFocusableIframe } from '@wordpress/compose';\nimport { useRef, useEffect, useMemo } from '@wordpress/element';\n\n/** @typedef {
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useMergeRefs, useFocusableIframe } from '@wordpress/compose';\nimport { useRef, useEffect, useMemo } from '@wordpress/element';\n\n/** @typedef {React.SyntheticEvent} SyntheticEvent */\n\nconst attributeMap = {\n\tclass: 'className',\n\tframeborder: 'frameBorder',\n\tmarginheight: 'marginHeight',\n\tmarginwidth: 'marginWidth',\n};\n\nexport default function WpEmbedPreview( { html } ) {\n\tconst ref = useRef();\n\tconst props = useMemo( () => {\n\t\tconst doc = new window.DOMParser().parseFromString( html, 'text/html' );\n\t\tconst iframe = doc.querySelector( 'iframe' );\n\t\tconst iframeProps = {};\n\n\t\tif ( ! iframe ) {\n\t\t\treturn iframeProps;\n\t\t}\n\n\t\tArray.from( iframe.attributes ).forEach( ( { name, value } ) => {\n\t\t\tif ( name === 'style' ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tiframeProps[ attributeMap[ name ] || name ] = value;\n\t\t} );\n\n\t\treturn iframeProps;\n\t}, [ html ] );\n\n\tuseEffect( () => {\n\t\tconst { ownerDocument } = ref.current;\n\t\tconst { defaultView } = ownerDocument;\n\n\t\t/**\n\t\t * Checks for WordPress embed events signaling the height change when\n\t\t * iframe content loads or iframe's window is resized. The event is\n\t\t * sent from WordPress core via the window.postMessage API.\n\t\t *\n\t\t * References:\n\t\t * window.postMessage:\n\t\t * https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\n\t\t * WordPress core embed-template on load:\n\t\t * https://github.com/WordPress/WordPress/blob/HEAD/wp-includes/js/wp-embed-template.js#L143\n\t\t * WordPress core embed-template on resize:\n\t\t * https://github.com/WordPress/WordPress/blob/HEAD/wp-includes/js/wp-embed-template.js#L187\n\t\t *\n\t\t * @param {MessageEvent} event Message event.\n\t\t */\n\t\tfunction resizeWPembeds( { data: { secret, message, value } = {} } ) {\n\t\t\tif ( message !== 'height' || secret !== props[ 'data-secret' ] ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tref.current.height = value;\n\t\t}\n\n\t\tdefaultView.addEventListener( 'message', resizeWPembeds );\n\t\treturn () => {\n\t\t\tdefaultView.removeEventListener( 'message', resizeWPembeds );\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<div className=\"wp-block-embed__wrapper\">\n\t\t\t<iframe\n\t\t\t\tref={ useMergeRefs( [ ref, useFocusableIframe() ] ) }\n\t\t\t\ttitle={ props.title }\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAiD;AACjD,qBAA2C;AAmExC;AA/DH,IAAM,eAAe;AAAA,EACpB,OAAO;AAAA,EACP,aAAa;AAAA,EACb,cAAc;AAAA,EACd,aAAa;AACd;AAEe,SAAR,eAAiC,E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
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tInnerBlocks,\n\tuseBlockProps,\n\tInspectorControls,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { View } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport GroupPlaceHolder, { useShouldShowPlaceHolder } from './placeholder';\nimport { unlock } from '../lock-unlock';\n\nconst { HTMLElementControl } = unlock( blockEditorPrivateApis );\n\n/**\n * Render inspector controls for the Group block.\n *\n * @param {Object} props Component props.\n * @param {string} props.tagName The HTML tag name.\n * @param {Function} props.onSelectTagName onChange function for the SelectControl.\n * @param {string} props.clientId The client ID of the current block.\n *\n * @return {JSX.Element} The control group.\n */\nfunction GroupEditControls( { tagName, onSelectTagName, clientId } ) {\n\treturn (\n\t\t<InspectorControls group=\"advanced\">\n\t\t\t<HTMLElementControl\n\t\t\t\ttagName={ tagName }\n\t\t\t\tonChange={ onSelectTagName }\n\t\t\t\tclientId={ clientId }\n\t\t\t\toptions={ [\n\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t] }\n\t\t\t/>\n\t\t</InspectorControls>\n\t);\n}\n\nfunction GroupEdit( { attributes, name, setAttributes, clientId } ) {\n\tconst { hasInnerBlocks, themeSupportsLayout } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlock, getSettings } = select( blockEditorStore );\n\t\t\tconst block = getBlock( clientId );\n\t\t\treturn {\n\t\t\t\thasInnerBlocks: !! ( block && block.innerBlocks.length ),\n\t\t\t\tthemeSupportsLayout: getSettings()?.supportsLayout,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst {\n\t\ttagName: TagName = 'div',\n\t\ttemplateLock,\n\t\tallowedBlocks,\n\t\tlayout = {},\n\t} = attributes;\n\n\t// Layout settings.\n\tconst { type = 'default' } = layout;\n\tconst layoutSupportEnabled =\n\t\tthemeSupportsLayout || type === 'flex' || type === 'grid';\n\n\t// Hooks.\n\tconst ref = useRef();\n\tconst blockProps = useBlockProps( { ref } );\n\n\tconst [ showPlaceholder, setShowPlaceholder ] = useShouldShowPlaceHolder( {\n\t\tattributes,\n\t\tusedLayoutType: type,\n\t\thasInnerBlocks,\n\t} );\n\n\t// Default to the regular appender being rendered.\n\tlet renderAppender;\n\tif ( showPlaceholder ) {\n\t\t// In the placeholder state, ensure the appender is not rendered.\n\t\t// This is needed because `...innerBlocksProps` is used in the placeholder\n\t\t// state so that blocks can dragged onto the placeholder area\n\t\t// from both the list view and in the editor canvas.\n\t\trenderAppender = false;\n\t} else if ( ! hasInnerBlocks ) {\n\t\t// When there is no placeholder, but the block is also empty,\n\t\t// use the larger button appender.\n\t\trenderAppender = InnerBlocks.ButtonBlockAppender;\n\t}\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\tlayoutSupportEnabled\n\t\t\t? blockProps\n\t\t\t: { className: 'wp-block-group__inner-container' },\n\t\t{\n\t\t\tdropZoneElement: ref.current,\n\t\t\ttemplateLock,\n\t\t\tallowedBlocks,\n\t\t\trenderAppender,\n\t\t}\n\t);\n\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\n\tconst selectVariation = ( nextVariation ) => {\n\t\tsetAttributes( nextVariation.attributes );\n\t\tselectBlock( clientId, -1 );\n\t\tsetShowPlaceholder( false );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<GroupEditControls\n\t\t\t\ttagName={ TagName }\n\t\t\t\tonSelectTagName={ ( value ) =>\n\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t}\n\t\t\t\tclientId={ clientId }\n\t\t\t/>\n\t\t\t{ showPlaceholder && (\n\t\t\t\t<View>\n\t\t\t\t\t{ innerBlocksProps.children }\n\t\t\t\t\t<GroupPlaceHolder\n\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\tonSelect={ selectVariation }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t) }\n\t\t\t{ layoutSupportEnabled && ! showPlaceholder && (\n\t\t\t\t<TagName { ...innerBlocksProps } />\n\t\t\t) }\n\t\t\t{ /* Ideally this is not needed but it's there for backward compatibility reason\n\t\t\t\tto keep this div for themes that might rely on its presence */ }\n\t\t\t{ ! layoutSupportEnabled && ! showPlaceholder && (\n\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t\t</TagName>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default GroupEdit;\n"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tInnerBlocks,\n\tuseBlockProps,\n\tInspectorControls,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { View } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport GroupPlaceHolder, { useShouldShowPlaceHolder } from './placeholder';\nimport { unlock } from '../lock-unlock';\n\nconst { HTMLElementControl } = unlock( blockEditorPrivateApis );\n\n/**\n * Render inspector controls for the Group block.\n *\n * @param {Object} props Component props.\n * @param {string} props.tagName The HTML tag name.\n * @param {Function} props.onSelectTagName onChange function for the SelectControl.\n * @param {string} props.clientId The client ID of the current block.\n *\n * @return {React.JSX.Element} The control group.\n */\nfunction GroupEditControls( { tagName, onSelectTagName, clientId } ) {\n\treturn (\n\t\t<InspectorControls group=\"advanced\">\n\t\t\t<HTMLElementControl\n\t\t\t\ttagName={ tagName }\n\t\t\t\tonChange={ onSelectTagName }\n\t\t\t\tclientId={ clientId }\n\t\t\t\toptions={ [\n\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t] }\n\t\t\t/>\n\t\t</InspectorControls>\n\t);\n}\n\nfunction GroupEdit( { attributes, name, setAttributes, clientId } ) {\n\tconst { hasInnerBlocks, themeSupportsLayout } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlock, getSettings } = select( blockEditorStore );\n\t\t\tconst block = getBlock( clientId );\n\t\t\treturn {\n\t\t\t\thasInnerBlocks: !! ( block && block.innerBlocks.length ),\n\t\t\t\tthemeSupportsLayout: getSettings()?.supportsLayout,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst {\n\t\ttagName: TagName = 'div',\n\t\ttemplateLock,\n\t\tallowedBlocks,\n\t\tlayout = {},\n\t} = attributes;\n\n\t// Layout settings.\n\tconst { type = 'default' } = layout;\n\tconst layoutSupportEnabled =\n\t\tthemeSupportsLayout || type === 'flex' || type === 'grid';\n\n\t// Hooks.\n\tconst ref = useRef();\n\tconst blockProps = useBlockProps( { ref } );\n\n\tconst [ showPlaceholder, setShowPlaceholder ] = useShouldShowPlaceHolder( {\n\t\tattributes,\n\t\tusedLayoutType: type,\n\t\thasInnerBlocks,\n\t} );\n\n\t// Default to the regular appender being rendered.\n\tlet renderAppender;\n\tif ( showPlaceholder ) {\n\t\t// In the placeholder state, ensure the appender is not rendered.\n\t\t// This is needed because `...innerBlocksProps` is used in the placeholder\n\t\t// state so that blocks can dragged onto the placeholder area\n\t\t// from both the list view and in the editor canvas.\n\t\trenderAppender = false;\n\t} else if ( ! hasInnerBlocks ) {\n\t\t// When there is no placeholder, but the block is also empty,\n\t\t// use the larger button appender.\n\t\trenderAppender = InnerBlocks.ButtonBlockAppender;\n\t}\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\tlayoutSupportEnabled\n\t\t\t? blockProps\n\t\t\t: { className: 'wp-block-group__inner-container' },\n\t\t{\n\t\t\tdropZoneElement: ref.current,\n\t\t\ttemplateLock,\n\t\t\tallowedBlocks,\n\t\t\trenderAppender,\n\t\t}\n\t);\n\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\n\tconst selectVariation = ( nextVariation ) => {\n\t\tsetAttributes( nextVariation.attributes );\n\t\tselectBlock( clientId, -1 );\n\t\tsetShowPlaceholder( false );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<GroupEditControls\n\t\t\t\ttagName={ TagName }\n\t\t\t\tonSelectTagName={ ( value ) =>\n\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t}\n\t\t\t\tclientId={ clientId }\n\t\t\t/>\n\t\t\t{ showPlaceholder && (\n\t\t\t\t<View>\n\t\t\t\t\t{ innerBlocksProps.children }\n\t\t\t\t\t<GroupPlaceHolder\n\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\tonSelect={ selectVariation }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t) }\n\t\t\t{ layoutSupportEnabled && ! showPlaceholder && (\n\t\t\t\t<TagName { ...innerBlocksProps } />\n\t\t\t) }\n\t\t\t{ /* Ideally this is not needed but it's there for backward compatibility reason\n\t\t\t\tto keep this div for themes that might rely on its presence */ }\n\t\t\t{ ! layoutSupportEnabled && ! showPlaceholder && (\n\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t\t</TagName>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default Group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names": ["blockEditorPrivateApis", "blockEditorStore", "GroupPlaceHolder"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/group/placeholder.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { Path, SVG, Button, Placeholder } from '@wordpress/components';\nimport { useState, useEffect } from '@wordpress/element';\n\n/**\n * Returns a custom variation icon.\n *\n * @param {string} name The block variation name.\n *\n * @return {JSX.Element} The SVG element.\n */\nconst getGroupPlaceholderIcons = ( name = 'group' ) => {\n\tconst icons = {\n\t\tgroup: (\n\t\t\t<SVG\n\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\twidth=\"48\"\n\t\t\t\theight=\"48\"\n\t\t\t\tviewBox=\"0 0 48 48\"\n\t\t\t>\n\t\t\t\t<Path d=\"M0 10a2 2 0 0 1 2-2h44a2 2 0 0 1 2 2v28a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V10Z\" />\n\t\t\t</SVG>\n\t\t),\n\t\t'group-row': (\n\t\t\t<SVG\n\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\twidth=\"48\"\n\t\t\t\theight=\"48\"\n\t\t\t\tviewBox=\"0 0 48 48\"\n\t\t\t>\n\t\t\t\t<Path d=\"M0 10a2 2 0 0 1 2-2h19a2 2 0 0 1 2 2v28a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V10Zm25 0a2 2 0 0 1 2-2h19a2 2 0 0 1 2 2v28a2 2 0 0 1-2 2H27a2 2 0 0 1-2-2V10Z\" />\n\t\t\t</SVG>\n\t\t),\n\t\t'group-stack': (\n\t\t\t<SVG\n\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\twidth=\"48\"\n\t\t\t\theight=\"48\"\n\t\t\t\tviewBox=\"0 0 48 48\"\n\t\t\t>\n\t\t\t\t<Path d=\"M0 10a2 2 0 0 1 2-2h44a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V10Zm0 17a2 2 0 0 1 2-2h44a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V27Z\" />\n\t\t\t</SVG>\n\t\t),\n\t\t'group-grid': (\n\t\t\t<SVG\n\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\twidth=\"48\"\n\t\t\t\theight=\"48\"\n\t\t\t\tviewBox=\"0 0 48 48\"\n\t\t\t>\n\t\t\t\t<Path d=\"M0 10a2 2 0 0 1 2-2h19a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V10Zm25 0a2 2 0 0 1 2-2h19a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H27a2 2 0 0 1-2-2V10ZM0 27a2 2 0 0 1 2-2h19a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V27Zm25 0a2 2 0 0 1 2-2h19a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H27a2 2 0 0 1-2-2V27Z\" />\n\t\t\t</SVG>\n\t\t),\n\t};\n\treturn icons?.[ name ];\n};\n\n/**\n * A custom hook to tell the Group block whether to show the variation placeholder.\n *\n * @param {Object} props Arguments to pass to hook.\n * @param {Object} [props.attributes] The block's attributes.\n * @param {string} [props.usedLayoutType] The block's current layout type.\n * @param {boolean} [props.hasInnerBlocks] Whether the block has inner blocks.\n *\n * @return {[boolean, Function]} A state value and setter function.\n */\nexport function useShouldShowPlaceHolder( {\n\tattributes = {\n\t\tstyle: undefined,\n\t\tbackgroundColor: undefined,\n\t\ttextColor: undefined,\n\t\tfontSize: undefined,\n\t},\n\tusedLayoutType = '',\n\thasInnerBlocks = false,\n} ) {\n\tconst { style, backgroundColor, textColor, fontSize } = attributes;\n\t/*\n\t * Shows the placeholder when no known styles are set,\n\t * or when a non-default layout has been selected.\n\t * Should the Group block support more style presets in the\n\t * future, e.g., attributes.spacingSize, we can add them to the\n\t * condition.\n\t */\n\tconst [ showPlaceholder, setShowPlaceholder ] = useState(\n\t\t! hasInnerBlocks &&\n\t\t\t! backgroundColor &&\n\t\t\t! fontSize &&\n\t\t\t! textColor &&\n\t\t\t! style &&\n\t\t\tusedLayoutType !== 'flex' &&\n\t\t\tusedLayoutType !== 'grid'\n\t);\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\t!! hasInnerBlocks ||\n\t\t\t!! backgroundColor ||\n\t\t\t!! fontSize ||\n\t\t\t!! textColor ||\n\t\t\t!! style ||\n\t\t\tusedLayoutType === 'flex'\n\t\t) {\n\t\t\tsetShowPlaceholder( false );\n\t\t}\n\t}, [\n\t\tbackgroundColor,\n\t\tfontSize,\n\t\ttextColor,\n\t\tstyle,\n\t\tusedLayoutType,\n\t\thasInnerBlocks,\n\t] );\n\n\treturn [ showPlaceholder, setShowPlaceholder ];\n}\n\n/**\n * Display group variations if none is selected.\n *\n * @param {Object} props Component props.\n * @param {string} props.name The block's name.\n * @param {Function} props.onSelect Function to set block's attributes.\n *\n * @return {JSX.Element} The placeholder.\n */\nfunction GroupPlaceHolder( { name, onSelect } ) {\n\tconst variations = useSelect(\n\t\t( select ) => select( blocksStore ).getBlockVariations( name, 'block' ),\n\t\t[ name ]\n\t);\n\tconst blockProps = useBlockProps( {\n\t\tclassName: 'wp-block-group__placeholder',\n\t} );\n\n\tuseEffect( () => {\n\t\tif ( variations && variations.length === 1 ) {\n\t\t\tonSelect( variations[ 0 ] );\n\t\t}\n\t}, [ onSelect, variations ] );\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<Placeholder\n\t\t\t\tinstructions={ __( 'Group blocks together. Select a layout:' ) }\n\t\t\t>\n\t\t\t\t{ /*\n\t\t\t\t * Taken from BlockVariationPicker component.\n\t\t\t\t * Disable reason: The `list` ARIA role is redundant but\n\t\t\t\t * Safari+VoiceOver won't announce the list otherwise.\n\t\t\t\t */\n\t\t\t\t/* eslint-disable jsx-a11y/no-redundant-roles */ }\n\t\t\t\t<ul\n\t\t\t\t\trole=\"list\"\n\t\t\t\t\tclassName=\"wp-block-group-placeholder__variations\"\n\t\t\t\t\taria-label={ __( 'Block variations' ) }\n\t\t\t\t>\n\t\t\t\t\t{ variations.map( ( variation ) => (\n\t\t\t\t\t\t<li key={ variation.name }>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\ticon={ getGroupPlaceholderIcons(\n\t\t\t\t\t\t\t\t\tvariation.name\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ticonSize={ 48 }\n\t\t\t\t\t\t\t\tonClick={ () => onSelect( variation ) }\n\t\t\t\t\t\t\t\tclassName=\"wp-block-group-placeholder__variation-button\"\n\t\t\t\t\t\t\t\tlabel={ `${ variation.title }: ${ variation.description }` }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t) ) }\n\t\t\t\t</ul>\n\t\t\t\t{ /* eslint-enable jsx-a11y/no-redundant-roles */ }\n\t\t\t</Placeholder>\n\t\t</div>\n\t);\n}\n\nexport default GroupPlaceHolder;\n"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { Path, SVG, Button, Placeholder } from '@wordpress/components';\nimport { useState, useEffect } from '@wordpress/element';\n\n/**\n * Returns a custom variation icon.\n *\n * @param {string} name The block variation name.\n *\n * @return {React.JSX.Element} The SVG element.\n */\nconst getGroupPlaceholderIcons = ( name = 'group' ) => {\n\tconst icons = {\n\t\tgroup: (\n\t\t\t<SVG\n\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\twidth=\"48\"\n\t\t\t\theight=\"48\"\n\t\t\t\tviewBox=\"0 0 48 48\"\n\t\t\t>\n\t\t\t\t<Path d=\"M0 10a2 2 0 0 1 2-2h44a2 2 0 0 1 2 2v28a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V10Z\" />\n\t\t\t</SVG>\n\t\t),\n\t\t'group-row': (\n\t\t\t<SVG\n\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\twidth=\"48\"\n\t\t\t\theight=\"48\"\n\t\t\t\tviewBox=\"0 0 48 48\"\n\t\t\t>\n\t\t\t\t<Path d=\"M0 10a2 2 0 0 1 2-2h19a2 2 0 0 1 2 2v28a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V10Zm25 0a2 2 0 0 1 2-2h19a2 2 0 0 1 2 2v28a2 2 0 0 1-2 2H27a2 2 0 0 1-2-2V10Z\" />\n\t\t\t</SVG>\n\t\t),\n\t\t'group-stack': (\n\t\t\t<SVG\n\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\twidth=\"48\"\n\t\t\t\theight=\"48\"\n\t\t\t\tviewBox=\"0 0 48 48\"\n\t\t\t>\n\t\t\t\t<Path d=\"M0 10a2 2 0 0 1 2-2h44a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V10Zm0 17a2 2 0 0 1 2-2h44a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V27Z\" />\n\t\t\t</SVG>\n\t\t),\n\t\t'group-grid': (\n\t\t\t<SVG\n\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\twidth=\"48\"\n\t\t\t\theight=\"48\"\n\t\t\t\tviewBox=\"0 0 48 48\"\n\t\t\t>\n\t\t\t\t<Path d=\"M0 10a2 2 0 0 1 2-2h19a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V10Zm25 0a2 2 0 0 1 2-2h19a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H27a2 2 0 0 1-2-2V10ZM0 27a2 2 0 0 1 2-2h19a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V27Zm25 0a2 2 0 0 1 2-2h19a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H27a2 2 0 0 1-2-2V27Z\" />\n\t\t\t</SVG>\n\t\t),\n\t};\n\treturn icons?.[ name ];\n};\n\n/**\n * A custom hook to tell the Group block whether to show the variation placeholder.\n *\n * @param {Object} props Arguments to pass to hook.\n * @param {Object} [props.attributes] The block's attributes.\n * @param {string} [props.usedLayoutType] The block's current layout type.\n * @param {boolean} [props.hasInnerBlocks] Whether the block has inner blocks.\n *\n * @return {[boolean, Function]} A state value and setter function.\n */\nexport function useShouldShowPlaceHolder( {\n\tattributes = {\n\t\tstyle: undefined,\n\t\tbackgroundColor: undefined,\n\t\ttextColor: undefined,\n\t\tfontSize: undefined,\n\t},\n\tusedLayoutType = '',\n\thasInnerBlocks = false,\n} ) {\n\tconst { style, backgroundColor, textColor, fontSize } = attributes;\n\t/*\n\t * Shows the placeholder when no known styles are set,\n\t * or when a non-default layout has been selected.\n\t * Should the Group block support more style presets in the\n\t * future, e.g., attributes.spacingSize, we can add them to the\n\t * condition.\n\t */\n\tconst [ showPlaceholder, setShowPlaceholder ] = useState(\n\t\t! hasInnerBlocks &&\n\t\t\t! backgroundColor &&\n\t\t\t! fontSize &&\n\t\t\t! textColor &&\n\t\t\t! style &&\n\t\t\tusedLayoutType !== 'flex' &&\n\t\t\tusedLayoutType !== 'grid'\n\t);\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\t!! hasInnerBlocks ||\n\t\t\t!! backgroundColor ||\n\t\t\t!! fontSize ||\n\t\t\t!! textColor ||\n\t\t\t!! style ||\n\t\t\tusedLayoutType === 'flex'\n\t\t) {\n\t\t\tsetShowPlaceholder( false );\n\t\t}\n\t}, [\n\t\tbackgroundColor,\n\t\tfontSize,\n\t\ttextColor,\n\t\tstyle,\n\t\tusedLayoutType,\n\t\thasInnerBlocks,\n\t] );\n\n\treturn [ showPlaceholder, setShowPlaceholder ];\n}\n\n/**\n * Display group variations if none is selected.\n *\n * @param {Object} props Component props.\n * @param {string} props.name The block's name.\n * @param {Function} props.onSelect Function to set block's attributes.\n *\n * @return {React.JSX.Element} The placeholder.\n */\nfunction GroupPlaceHolder( { name, onSelect } ) {\n\tconst variations = useSelect(\n\t\t( select ) => select( blocksStore ).getBlockVariations( name, 'block' ),\n\t\t[ name ]\n\t);\n\tconst blockProps = useBlockProps( {\n\t\tclassName: 'wp-block-group__placeholder',\n\t} );\n\n\tuseEffect( () => {\n\t\tif ( variations && variations.length === 1 ) {\n\t\t\tonSelect( variations[ 0 ] );\n\t\t}\n\t}, [ onSelect, variations ] );\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<Placeholder\n\t\t\t\tinstructions={ __( 'Group blocks together. Select a layout:' ) }\n\t\t\t>\n\t\t\t\t{ /*\n\t\t\t\t * Taken from BlockVariationPicker component.\n\t\t\t\t * Disable reason: The `list` ARIA role is redundant but\n\t\t\t\t * Safari+VoiceOver won't announce the list otherwise.\n\t\t\t\t */\n\t\t\t\t/* eslint-disable jsx-a11y/no-redundant-roles */ }\n\t\t\t\t<ul\n\t\t\t\t\trole=\"list\"\n\t\t\t\t\tclassName=\"wp-block-group-placeholder__variations\"\n\t\t\t\t\taria-label={ __( 'Block variations' ) }\n\t\t\t\t>\n\t\t\t\t\t{ variations.map( ( variation ) => (\n\t\t\t\t\t\t<li key={ variation.name }>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\ticon={ getGroupPlaceholderIcons(\n\t\t\t\t\t\t\t\t\tvariation.name\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ticonSize={ 48 }\n\t\t\t\t\t\t\t\tonClick={ () => onSelect( variation ) }\n\t\t\t\t\t\t\t\tclassName=\"wp-block-group-placeholder__variation-button\"\n\t\t\t\t\t\t\t\tlabel={ `${ variation.title }: ${ variation.description }` }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t) ) }\n\t\t\t\t</ul>\n\t\t\t\t{ /* eslint-enable jsx-a11y/no-redundant-roles */ }\n\t\t\t</Placeholder>\n\t\t</div>\n\t);\n}\n\nexport default GroupPlaceHolder;\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA0B;AAC1B,0BAA8B;AAC9B,kBAAmB;AACnB,oBAAqC;AACrC,wBAA+C;AAC/C,qBAAoC;AAkBhC;AATJ,IAAM,2BAA2B,CAAE,OAAO,YAAa;AACtD,QAAM,QAAQ;AAAA,IACb,OACC;AAAA,MAAC;AAAA;AAAA,QACA,OAAM;AAAA,QACN,OAAM;AAAA,QACN,QAAO;AAAA,QACP,SAAQ;AAAA,QAER,sDAAC,0BAAK,GAAE,6EAA4E;AAAA;AAAA,IACrF;AAAA,IAED,aACC;AAAA,MAAC;AAAA;AAAA,QACA,OAAM;AAAA,QACN,OAAM;AAAA,QACN,QAAO;AAAA,QACP,SAAQ;AAAA,QAER,sDAAC,0BAAK,GAAE,uJAAsJ;AAAA;AAAA,IAC/J;AAAA,IAED,eACC;AAAA,MAAC;AAAA;AAAA,QACA,OAAM;AAAA,QACN,OAAM;AAAA,QACN,QAAO;AAAA,QACP,SAAQ;AAAA,QAER,sDAAC,0BAAK,GAAE,sJAAqJ;AAAA;AAAA,IAC9J;AAAA,IAED,cACC;AAAA,MAAC;AAAA;AAAA,QACA,OAAM;AAAA,QACN,OAAM;AAAA,QACN,QAAO;AAAA,QACP,SAAQ;AAAA,QAER,sDAAC,0BAAK,GAAE,0SAAyS;AA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ACA,MAAK;AAAA,UACL,WAAU;AAAA,UACV,kBAAa,gBAAI,kBAAmB;AAAA,UAElC,qBAAW,IAAK,CAAE,cACnB,4CAAC,QACA;AAAA,YAAC;AAAA;AAAA,cACA,uBAAqB;AAAA,cACrB,SAAQ;AAAA,cACR,MAAO;AAAA,gBACN,UAAU;AAAA,cACX;AAAA,cACA,UAAW;AAAA,cACX,SAAU,MAAM,SAAU,SAAU;AAAA,cACpC,WAAU;AAAA,cACV,OAAQ,GAAI,UAAU,KAAM,KAAM,UAAU,WAAY;AAAA;AAAA,UACzD,KAXS,UAAU,IAYpB,CACC;AAAA;AAAA,MACH;AAAA;AAAA,EAED,GACD;AAEF;AAEA,IAAO,sBAAQ;",
|
|
6
6
|
"names": ["blocksStore"]
|
|
7
7
|
}
|
package/build/heading/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/heading/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { heading as icon } from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tprivateApis as blocksPrivateApis,\n\tgetBlockType,\n\tunregisterBlockVariation,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport variations from './variations';\nimport { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tcontent: __( 'Code is Poetry' ),\n\t\t\tlevel: 2,\n\t\t\ttextAlign: 'center',\n\t\t},\n\t},\n\t__experimentalLabel( attributes, { context } ) {\n\t\tconst { content, level } = attributes;\n\n\t\tconst customName = attributes?.metadata?.name;\n\t\tconst hasContent = content?.trim().length > 0;\n\n\t\t// In the list view, use the block's content as the label.\n\t\t// If the content is empty, fall back to the default label.\n\t\tif ( context === 'list-view' && ( customName || hasContent ) ) {\n\t\t\treturn customName || content;\n\t\t}\n\n\t\tif ( context === 'breadcrumb' && customName ) {\n\t\t\treturn customName;\n\t\t}\n\n\t\tif ( context === 'accessibility' ) {\n\t\t\treturn ! hasContent\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: accessibility text. %s: heading level. */\n\t\t\t\t\t\t__( 'Level %s. Empty.' ),\n\t\t\t\t\t\tlevel\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: accessibility text. 1: heading level. 2: heading content. */\n\t\t\t\t\t\t__( 'Level %1$s. %2$s' ),\n\t\t\t\t\t\tlevel,\n\t\t\t\t\t\tcontent\n\t\t\t\t );\n\t\t}\n\t},\n\ttransforms,\n\tdeprecated,\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\tcontent:\n\t\t\t\t( attributes.content || '' ) +\n\t\t\t\t( attributesToMerge.content || '' ),\n\t\t};\n\t},\n\tedit,\n\tsave,\n\tvariations,\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'content',\n\t\t\tlabel: __( 'Content' ),\n\t\t\ttype: 'text',\n\t\t\tEdit: 'rich-text', // TODO: replace with custom component\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'content' ],\n\t};\n}\n\nexport const init = () => {\n\tconst block = initBlock( { name, metadata, settings } );\n\n\t// Unregister heading level variations based on `levelOptions` attribute.\n\t// This is for backwards compatibility, as extenders can now unregister the\n\t// variation directly: `wp.blocks.unregisterBlockVariation( 'core/heading', 'h1' )`.\n\tconst levelOptions =\n\t\tgetBlockType( name )?.attributes?.levelOptions?.default;\n\tif ( levelOptions ) {\n\t\t[ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {\n\t\t\tif ( ! levelOptions.includes( level ) ) {\n\t\t\t\tunregisterBlockVariation( name, `h${ level }` );\n\t\t\t}\n\t\t} );\n\t}\n\n\treturn block;\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAGA,mBAAgC;AAChC,kBAA4B;AAC5B,oBAIO;AAKP,wBAAsB;AACtB,wBAAuB;AACvB,kBAAiB;AACjB,mBAAqB;AACrB,kBAAiB;AACjB,wBAAuB;AACvB,wBAAuB;AACvB,yBAAuB;AAEvB,IAAM,EAAE,WAAW,QAAQ,QAAI,2BAAQ,cAAAC,WAAkB;AAEzD,IAAM,EAAE,KAAK,IAAI,aAAAD;AAIV,IAAM,WAAW;AAAA,EACvB,mBAAAE;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA,MACX,aAAS,gBAAI,gBAAiB;AAAA,MAC9B,OAAO;AAAA,MACP,WAAW;AAAA,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { heading as icon } from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tprivateApis as blocksPrivateApis,\n\tgetBlockType,\n\tunregisterBlockVariation,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport variations from './variations';\nimport { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tcontent: __( 'Code is Poetry' ),\n\t\t\tlevel: 2,\n\t\t\tstyle: {\n\t\t\t\ttypography: {\n\t\t\t\t\ttextAlign: 'center',\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\t__experimentalLabel( attributes, { context } ) {\n\t\tconst { content, level } = attributes;\n\n\t\tconst customName = attributes?.metadata?.name;\n\t\tconst hasContent = content?.trim().length > 0;\n\n\t\t// In the list view, use the block's content as the label.\n\t\t// If the content is empty, fall back to the default label.\n\t\tif ( context === 'list-view' && ( customName || hasContent ) ) {\n\t\t\treturn customName || content;\n\t\t}\n\n\t\tif ( context === 'breadcrumb' && customName ) {\n\t\t\treturn customName;\n\t\t}\n\n\t\tif ( context === 'accessibility' ) {\n\t\t\treturn ! hasContent\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: accessibility text. %s: heading level. */\n\t\t\t\t\t\t__( 'Level %s. Empty.' ),\n\t\t\t\t\t\tlevel\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: accessibility text. 1: heading level. 2: heading content. */\n\t\t\t\t\t\t__( 'Level %1$s. %2$s' ),\n\t\t\t\t\t\tlevel,\n\t\t\t\t\t\tcontent\n\t\t\t\t );\n\t\t}\n\t},\n\ttransforms,\n\tdeprecated,\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\tcontent:\n\t\t\t\t( attributes.content || '' ) +\n\t\t\t\t( attributesToMerge.content || '' ),\n\t\t};\n\t},\n\tedit,\n\tsave,\n\tvariations,\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'content',\n\t\t\tlabel: __( 'Content' ),\n\t\t\ttype: 'text',\n\t\t\tEdit: 'rich-text', // TODO: replace with custom component\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'content' ],\n\t};\n}\n\nexport const init = () => {\n\tconst block = initBlock( { name, metadata, settings } );\n\n\t// Unregister heading level variations based on `levelOptions` attribute.\n\t// This is for backwards compatibility, as extenders can now unregister the\n\t// variation directly: `wp.blocks.unregisterBlockVariation( 'core/heading', 'h1' )`.\n\tconst levelOptions =\n\t\tgetBlockType( name )?.attributes?.levelOptions?.default;\n\tif ( levelOptions ) {\n\t\t[ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {\n\t\t\tif ( ! levelOptions.includes( level ) ) {\n\t\t\t\tunregisterBlockVariation( name, `h${ level }` );\n\t\t\t}\n\t\t} );\n\t}\n\n\treturn block;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAGA,mBAAgC;AAChC,kBAA4B;AAC5B,oBAIO;AAKP,wBAAsB;AACtB,wBAAuB;AACvB,kBAAiB;AACjB,mBAAqB;AACrB,kBAAiB;AACjB,wBAAuB;AACvB,wBAAuB;AACvB,yBAAuB;AAEvB,IAAM,EAAE,WAAW,QAAQ,QAAI,2BAAQ,cAAAC,WAAkB;AAEzD,IAAM,EAAE,KAAK,IAAI,aAAAD;AAIV,IAAM,WAAW;AAAA,EACvB,mBAAAE;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA,MACX,aAAS,gBAAI,gBAAiB;AAAA,MAC9B,OAAO;AAAA,MACP,OAAO;AAAA,QACN,YAAY;AAAA,UACX,WAAW;AAAA,QACZ;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAAA,EACA,oBAAqB,YAAY,EAAE,QAAQ,GAAI;AAC9C,UAAM,EAAE,SAAS,MAAM,IAAI;AAE3B,UAAM,aAAa,YAAY,UAAU;AACzC,UAAM,aAAa,SAAS,KAAK,EAAE,SAAS;AAI5C,QAAK,YAAY,gBAAiB,cAAc,aAAe;AAC9D,aAAO,cAAc;AAAA,IACtB;AAEA,QAAK,YAAY,gBAAgB,YAAa;AAC7C,aAAO;AAAA,IACR;AAEA,QAAK,YAAY,iBAAkB;AAClC,aAAO,CAAE,iBACN;AAAA;AAAA,YAEA,gBAAI,kBAAmB;AAAA,QACvB;AAAA,MACA,QACA;AAAA;AAAA,YAEA,gBAAI,kBAAmB;AAAA,QACvB;AAAA,QACA;AAAA,MACA;AAAA,IACJ;AAAA,EACD;AAAA,EACA,8BAAAC;AAAA,EACA,8BAAAC;AAAA,EACA,MAAO,YAAY,mBAAoB;AACtC,WAAO;AAAA,MACN,UACG,WAAW,WAAW,OACtB,kBAAkB,WAAW;AAAA,IACjC;AAAA,EACD;AAAA,EACA,kBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,8BAAAC;AACD;AAEA,IAAK,OAAO,0CAA2C;AACtD,WAAU,SAAU,IAAI;AAAA,IACvB;AAAA,MACC,IAAI;AAAA,MACJ,WAAO,gBAAI,SAAU;AAAA,MACrB,MAAM;AAAA,MACN,MAAM;AAAA;AAAA,IACP;AAAA,EACD;AACA,WAAU,OAAQ,IAAI;AAAA,IACrB,QAAQ,CAAE,SAAU;AAAA,EACrB;AACD;AAEO,IAAM,OAAO,MAAM;AACzB,QAAM,YAAQ,kBAAAC,SAAW,EAAE,MAAM,uBAAAC,SAAU,SAAS,CAAE;AAKtD,QAAM,mBACL,4BAAc,IAAK,GAAG,YAAY,cAAc;AACjD,MAAK,cAAe;AACnB,KAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAE,EAAE,QAAS,CAAE,UAAW;AAC1C,UAAK,CAAE,aAAa,SAAU,KAAM,GAAI;AACvC,oDAA0B,MAAM,IAAK,KAAM,EAAG;AAAA,MAC/C;AAAA,IACD,CAAE;AAAA,EACH;AAEA,SAAO;AACR;",
|
|
6
6
|
"names": ["metadata", "blocksPrivateApis", "icon", "transforms", "deprecated", "edit", "save", "variations", "initBlock", "metadata"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"apiVersion": 3,
|
|
3
|
+
"$schema": "https://schemas.wp.org/trunk/block.json",
|
|
4
|
+
"name": "core/icon",
|
|
5
|
+
"title": "Icon",
|
|
6
|
+
"__experimental": true,
|
|
7
|
+
"category": "media",
|
|
8
|
+
"description": "Insert an SVG icon.",
|
|
9
|
+
"keywords": [ "icon", "svg" ],
|
|
10
|
+
"textdomain": "default",
|
|
11
|
+
"attributes": {
|
|
12
|
+
"icon": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"role": "content"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"supports": {
|
|
18
|
+
"anchor": true,
|
|
19
|
+
"ariaLabel": {
|
|
20
|
+
"__experimentalSkipSerialization": true
|
|
21
|
+
},
|
|
22
|
+
"align": [ "left", "center", "right" ],
|
|
23
|
+
"html": false,
|
|
24
|
+
"color": {
|
|
25
|
+
"background": true,
|
|
26
|
+
"text": true,
|
|
27
|
+
"__experimentalSkipSerialization": true
|
|
28
|
+
},
|
|
29
|
+
"interactivity": {
|
|
30
|
+
"clientNavigation": true
|
|
31
|
+
},
|
|
32
|
+
"__experimentalBorder": {
|
|
33
|
+
"color": true,
|
|
34
|
+
"radius": true,
|
|
35
|
+
"style": true,
|
|
36
|
+
"width": true,
|
|
37
|
+
"__experimentalSkipSerialization": true,
|
|
38
|
+
"__experimentalDefaultControls": {
|
|
39
|
+
"color": false,
|
|
40
|
+
"radius": false,
|
|
41
|
+
"style": false,
|
|
42
|
+
"width": false
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"spacing": {
|
|
46
|
+
"padding": true,
|
|
47
|
+
"margin": true,
|
|
48
|
+
"__experimentalSkipSerialization": [ "padding" ],
|
|
49
|
+
"__experimentalDefaultControls": {
|
|
50
|
+
"margin": false,
|
|
51
|
+
"padding": false
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"dimensions": {
|
|
55
|
+
"width": true,
|
|
56
|
+
"__experimentalSkipSerialization": [ "width" ],
|
|
57
|
+
"__experimentalDefaultControls": {
|
|
58
|
+
"width": true
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"selectors": {
|
|
63
|
+
"root": ".wp-block-icon",
|
|
64
|
+
"dimensions": {
|
|
65
|
+
"root": ".wp-block-icon svg",
|
|
66
|
+
"width": ".wp-block-icon svg"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"style": "wp-block-icon",
|
|
70
|
+
"editorStyle": "wp-block-icon-editor"
|
|
71
|
+
}
|