@wordpress/edit-site 6.11.0 → 6.12.1-next.082ed6819.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/components/add-new-template/utils.js +1 -2
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/app/index.js +0 -5
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/use-editor-iframe-props.js +6 -8
- package/build/components/block-editor/use-editor-iframe-props.js.map +1 -1
- package/build/components/block-editor/use-site-editor-settings.js +4 -12
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/editor/index.js +23 -27
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor/use-editor-title.js +37 -12
- package/build/components/editor/use-editor-title.js.map +1 -1
- package/build/components/editor/use-resolve-edited-entity.js +133 -0
- package/build/components/editor/use-resolve-edited-entity.js.map +1 -0
- package/build/components/editor-canvas-container/index.js +1 -1
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/global-styles/block-preview-panel.js +8 -10
- package/build/components/global-styles/block-preview-panel.js.map +1 -1
- package/build/components/global-styles/screen-block.js +18 -5
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +24 -22
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +11 -5
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/shadows-edit-panel.js +2 -3
- package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build/components/global-styles/ui.js +42 -2
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles-renderer/index.js +6 -8
- package/build/components/global-styles-renderer/index.js.map +1 -1
- package/build/components/global-styles-sidebar/index.js +17 -1
- package/build/components/global-styles-sidebar/index.js.map +1 -1
- package/build/components/layout/hooks.js +1 -10
- package/build/components/layout/hooks.js.map +1 -1
- package/build/components/layout/index.js +1 -0
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page-patterns/fields.js +3 -7
- package/build/components/page-patterns/fields.js.map +1 -1
- package/build/components/page-patterns/header.js +2 -2
- package/build/components/page-patterns/header.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +4 -8
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-templates/fields.js +1 -2
- package/build/components/page-templates/fields.js.map +1 -1
- package/build/components/post-edit/index.js +15 -11
- package/build/components/post-edit/index.js.map +1 -1
- package/build/components/post-list/index.js +13 -3
- package/build/components/post-list/index.js.map +1 -1
- package/build/components/posts-app/index.js +3 -4
- package/build/components/posts-app/index.js.map +1 -1
- package/build/components/posts-app-routes/home.js +48 -0
- package/build/components/posts-app-routes/home.js.map +1 -0
- package/build/components/posts-app-routes/index.js +37 -0
- package/build/components/posts-app-routes/index.js.map +1 -0
- package/build/components/posts-app-routes/posts-edit.js +44 -0
- package/build/components/posts-app-routes/posts-edit.js.map +1 -0
- package/build/components/posts-app-routes/posts-list-view-quick-edit.js +63 -0
- package/build/components/posts-app-routes/posts-list-view-quick-edit.js.map +1 -0
- package/build/components/posts-app-routes/posts-list-view.js +48 -0
- package/build/components/posts-app-routes/posts-list-view.js.map +1 -0
- package/build/components/posts-app-routes/posts-view-quick-edit.js +60 -0
- package/build/components/posts-app-routes/posts-view-quick-edit.js.map +1 -0
- package/build/components/posts-app-routes/posts-view.js +41 -0
- package/build/components/posts-app-routes/posts-view.js.map +1 -0
- package/build/components/sidebar/index.js +11 -3
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-global-styles-wrapper/index.js +129 -0
- package/build/components/sidebar-global-styles-wrapper/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-details-footer/index.js +17 -23
- package/build/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +18 -90
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +43 -42
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +2 -3
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build/components/site-editor-routes/index.js +1 -2
- package/build/components/site-editor-routes/index.js.map +1 -1
- package/build/components/site-editor-routes/styles-view.js +8 -2
- package/build/components/site-editor-routes/styles-view.js.map +1 -1
- package/build/components/site-hub/index.js +19 -6
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/style-book/constants.js +10 -3
- package/build/components/style-book/constants.js.map +1 -1
- package/build/components/style-book/examples.js +94 -2
- package/build/components/style-book/examples.js.map +1 -1
- package/build/components/style-book/index.js +70 -11
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/welcome-guide/index.js +4 -2
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/welcome-guide/page.js +1 -9
- package/build/components/welcome-guide/page.js.map +1 -1
- package/build/components/welcome-guide/template.js +1 -12
- package/build/components/welcome-guide/template.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +15 -15
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/index.js +1 -9
- package/build/index.js.map +1 -1
- package/build/posts.js +1 -0
- package/build/posts.js.map +1 -1
- package/build/store/actions.js +13 -0
- package/build/store/actions.js.map +1 -1
- package/build/store/selectors.js +21 -1
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +1 -2
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/app/index.js +0 -5
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/use-editor-iframe-props.js +6 -8
- package/build-module/components/block-editor/use-editor-iframe-props.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +4 -12
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/editor/index.js +23 -27
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor/use-editor-title.js +37 -12
- package/build-module/components/editor/use-editor-title.js.map +1 -1
- package/build-module/components/editor/use-resolve-edited-entity.js +125 -0
- package/build-module/components/editor/use-resolve-edited-entity.js.map +1 -0
- package/build-module/components/editor-canvas-container/index.js +1 -1
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/global-styles/block-preview-panel.js +8 -10
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +18 -5
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +25 -23
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +11 -5
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/shadows-edit-panel.js +2 -3
- package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build-module/components/global-styles/ui.js +42 -2
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles-renderer/index.js +6 -8
- package/build-module/components/global-styles-renderer/index.js.map +1 -1
- package/build-module/components/global-styles-sidebar/index.js +18 -2
- package/build-module/components/global-styles-sidebar/index.js.map +1 -1
- package/build-module/components/layout/hooks.js +1 -9
- package/build-module/components/layout/hooks.js.map +1 -1
- package/build-module/components/layout/index.js +1 -0
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page-patterns/fields.js +4 -8
- package/build-module/components/page-patterns/fields.js.map +1 -1
- package/build-module/components/page-patterns/header.js +2 -2
- package/build-module/components/page-patterns/header.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +4 -8
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-templates/fields.js +1 -2
- package/build-module/components/page-templates/fields.js.map +1 -1
- package/build-module/components/post-edit/index.js +14 -10
- package/build-module/components/post-edit/index.js.map +1 -1
- package/build-module/components/post-list/index.js +13 -3
- package/build-module/components/post-list/index.js.map +1 -1
- package/build-module/components/posts-app/index.js +3 -4
- package/build-module/components/posts-app/index.js.map +1 -1
- package/build-module/components/posts-app-routes/home.js +40 -0
- package/build-module/components/posts-app-routes/home.js.map +1 -0
- package/build-module/components/posts-app-routes/index.js +30 -0
- package/build-module/components/posts-app-routes/index.js.map +1 -0
- package/build-module/components/posts-app-routes/posts-edit.js +36 -0
- package/build-module/components/posts-app-routes/posts-edit.js.map +1 -0
- package/build-module/components/posts-app-routes/posts-list-view-quick-edit.js +55 -0
- package/build-module/components/posts-app-routes/posts-list-view-quick-edit.js.map +1 -0
- package/build-module/components/posts-app-routes/posts-list-view.js +40 -0
- package/build-module/components/posts-app-routes/posts-list-view.js.map +1 -0
- package/build-module/components/posts-app-routes/posts-view-quick-edit.js +52 -0
- package/build-module/components/posts-app-routes/posts-view-quick-edit.js.map +1 -0
- package/build-module/components/posts-app-routes/posts-view.js +33 -0
- package/build-module/components/posts-app-routes/posts-view.js.map +1 -0
- package/build-module/components/sidebar/index.js +11 -3
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-global-styles-wrapper/index.js +121 -0
- package/build-module/components/sidebar-global-styles-wrapper/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js +20 -26
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +19 -91
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +43 -43
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +3 -4
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build-module/components/site-editor-routes/index.js +1 -2
- package/build-module/components/site-editor-routes/index.js.map +1 -1
- package/build-module/components/site-editor-routes/styles-view.js +8 -2
- package/build-module/components/site-editor-routes/styles-view.js.map +1 -1
- package/build-module/components/site-hub/index.js +19 -6
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/style-book/constants.js +10 -3
- package/build-module/components/style-book/constants.js.map +1 -1
- package/build-module/components/style-book/examples.js +94 -2
- package/build-module/components/style-book/examples.js.map +1 -1
- package/build-module/components/style-book/index.js +71 -12
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +4 -2
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/welcome-guide/page.js +1 -9
- package/build-module/components/welcome-guide/page.js.map +1 -1
- package/build-module/components/welcome-guide/template.js +1 -11
- package/build-module/components/welcome-guide/template.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +15 -15
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/index.js +2 -10
- package/build-module/index.js.map +1 -1
- package/build-module/posts.js +1 -0
- package/build-module/posts.js.map +1 -1
- package/build-module/store/actions.js +13 -0
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/selectors.js +21 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/posts-rtl.css +106 -16
- package/build-style/posts.css +106 -16
- package/build-style/style-rtl.css +176 -78
- package/build-style/style.css +176 -78
- package/package.json +39 -40
- package/src/components/add-new-template/utils.js +2 -2
- package/src/components/app/index.js +0 -5
- package/src/components/block-editor/use-editor-iframe-props.js +2 -3
- package/src/components/block-editor/use-site-editor-settings.js +7 -21
- package/src/components/editor/index.js +31 -30
- package/src/components/editor/use-editor-title.js +50 -13
- package/src/components/editor/use-resolve-edited-entity.js +132 -0
- package/src/components/editor-canvas-container/index.js +1 -1
- package/src/components/editor-canvas-container/style.scss +0 -1
- package/src/components/global-styles/block-preview-panel.js +10 -10
- package/src/components/global-styles/screen-block.js +26 -8
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +28 -31
- package/src/components/global-styles/screen-revisions/style.scss +11 -17
- package/src/components/global-styles/screen-style-variations.js +14 -5
- package/src/components/global-styles/shadows-edit-panel.js +4 -2
- package/src/components/global-styles/ui.js +41 -1
- package/src/components/global-styles-renderer/index.js +4 -10
- package/src/components/global-styles-sidebar/index.js +16 -2
- package/src/components/layout/hooks.js +1 -7
- package/src/components/layout/index.js +6 -1
- package/src/components/page-patterns/fields.js +6 -12
- package/src/components/page-patterns/header.js +3 -2
- package/src/components/page-patterns/style.scss +0 -5
- package/src/components/page-patterns/use-patterns.js +9 -7
- package/src/components/page-templates/fields.js +2 -3
- package/src/components/page-templates/style.scss +1 -0
- package/src/components/post-edit/index.js +37 -32
- package/src/components/post-edit/style.scss +7 -0
- package/src/components/post-list/index.js +10 -5
- package/src/components/post-list/style.scss +29 -3
- package/src/components/posts-app/index.js +3 -4
- package/src/components/posts-app-routes/home.js +36 -0
- package/src/components/posts-app-routes/index.js +36 -0
- package/src/components/posts-app-routes/posts-edit.js +31 -0
- package/src/components/posts-app-routes/posts-list-view-quick-edit.js +52 -0
- package/src/components/posts-app-routes/posts-list-view.js +40 -0
- package/src/components/posts-app-routes/posts-view-quick-edit.js +49 -0
- package/src/components/posts-app-routes/posts-view.js +35 -0
- package/src/components/sidebar/index.js +23 -7
- package/src/components/sidebar-global-styles-wrapper/index.js +150 -0
- package/src/components/sidebar-global-styles-wrapper/style.scss +35 -0
- package/src/components/sidebar-navigation-item/style.scss +2 -2
- package/src/components/sidebar-navigation-screen/style.scss +7 -2
- package/src/components/sidebar-navigation-screen-details-footer/index.js +27 -38
- package/src/components/sidebar-navigation-screen-details-footer/style.scss +0 -4
- package/src/components/sidebar-navigation-screen-global-styles/index.js +19 -103
- package/src/components/sidebar-navigation-screen-main/index.js +46 -45
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +8 -0
- package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
- package/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +4 -4
- package/src/components/site-editor-routes/README.md +2 -2
- package/src/components/site-editor-routes/index.js +0 -2
- package/src/components/site-editor-routes/styles-view.js +11 -1
- package/src/components/site-hub/index.js +33 -16
- package/src/components/site-hub/style.scss +1 -1
- package/src/components/site-icon/style.scss +16 -0
- package/src/components/style-book/constants.ts +11 -3
- package/src/components/style-book/examples.tsx +128 -2
- package/src/components/style-book/index.js +86 -8
- package/src/components/welcome-guide/index.js +3 -3
- package/src/components/welcome-guide/page.js +1 -7
- package/src/components/welcome-guide/template.js +1 -8
- package/src/hooks/commands/use-common-commands.js +253 -246
- package/src/index.js +2 -13
- package/src/posts.js +1 -0
- package/src/store/actions.js +15 -0
- package/src/store/selectors.js +24 -1
- package/src/style.scss +2 -5
- package/build/components/async/index.js +0 -51
- package/build/components/async/index.js.map +0 -1
- package/build/components/post-fields/index.js +0 -290
- package/build/components/post-fields/index.js.map +0 -1
- package/build/components/posts-app/router.js +0 -85
- package/build/components/posts-app/router.js.map +0 -1
- package/build/components/sidebar-navigation-screen-details-panel/index.js +0 -54
- package/build/components/sidebar-navigation-screen-details-panel/index.js.map +0 -1
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +0 -21
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +0 -1
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +0 -33
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +0 -1
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +0 -21
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +0 -1
- package/build/components/site-editor-routes/styles-edit.js +0 -28
- package/build/components/site-editor-routes/styles-edit.js.map +0 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -219
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +0 -1
- package/build/components/use-edited-entity-record/index.js +0 -60
- package/build/components/use-edited-entity-record/index.js.map +0 -1
- package/build/hooks/commands/use-edit-mode-commands.js +0 -179
- package/build/hooks/commands/use-edit-mode-commands.js.map +0 -1
- package/build-module/components/async/index.js +0 -44
- package/build-module/components/async/index.js.map +0 -1
- package/build-module/components/post-fields/index.js +0 -283
- package/build-module/components/post-fields/index.js.map +0 -1
- package/build-module/components/posts-app/router.js +0 -77
- package/build-module/components/posts-app/router.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-details-panel/index.js +0 -29
- package/build-module/components/sidebar-navigation-screen-details-panel/index.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +0 -14
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +0 -25
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +0 -14
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +0 -1
- package/build-module/components/site-editor-routes/styles-edit.js +0 -20
- package/build-module/components/site-editor-routes/styles-edit.js.map +0 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -212
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +0 -1
- package/build-module/components/use-edited-entity-record/index.js +0 -53
- package/build-module/components/use-edited-entity-record/index.js.map +0 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +0 -171
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +0 -1
- package/src/components/async/index.js +0 -43
- package/src/components/post-fields/index.js +0 -361
- package/src/components/post-fields/style.scss +0 -3
- package/src/components/posts-app/router.js +0 -69
- package/src/components/sidebar-navigation-screen-details-panel/index.js +0 -40
- package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +0 -14
- package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +0 -31
- package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +0 -14
- package/src/components/sidebar-navigation-screen-details-panel/style.scss +0 -26
- package/src/components/site-editor-routes/styles-edit.js +0 -17
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -267
- package/src/components/use-edited-entity-record/index.js +0 -58
- package/src/hooks/commands/use-edit-mode-commands.js +0 -168
- package/src/store/test/actions.js +0 -83
- package/src/store/test/reducer.js +0 -69
- package/src/store/test/selectors.js +0 -41
|
@@ -48,6 +48,44 @@ function isObjectEmpty(object) {
|
|
|
48
48
|
return !object || Object.keys(object).length === 0;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
/**
|
|
52
|
+
* Scrolls to a section within an iframe.
|
|
53
|
+
*
|
|
54
|
+
* @param {string} anchorId The id of the element to scroll to.
|
|
55
|
+
* @param {HTMLIFrameElement} iframe The target iframe.
|
|
56
|
+
*/
|
|
57
|
+
const scrollToSection = (anchorId, iframe) => {
|
|
58
|
+
if (!iframe || !iframe?.contentDocument) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const element = iframe.contentDocument.getElementById(anchorId);
|
|
62
|
+
if (element) {
|
|
63
|
+
element.scrollIntoView({
|
|
64
|
+
behavior: 'smooth'
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Parses a Block Editor navigation path to extract the block name and
|
|
71
|
+
* build a style book navigation path. The object can be extended to include a category,
|
|
72
|
+
* representing a style book tab/section.
|
|
73
|
+
*
|
|
74
|
+
* @param {string} path An internal Block Editor navigation path.
|
|
75
|
+
* @return {null|{block: string}} An object containing the example to navigate to.
|
|
76
|
+
*/
|
|
77
|
+
const getStyleBookNavigationFromPath = path => {
|
|
78
|
+
if (path && typeof path === 'string') {
|
|
79
|
+
let block = path.includes('/blocks/') ? decodeURIComponent(path.split('/blocks/')[1]) : null;
|
|
80
|
+
// Default to theme-colors if the path ends with /colors.
|
|
81
|
+
block = path.endsWith('/colors') ? 'theme-colors' : block;
|
|
82
|
+
return {
|
|
83
|
+
block
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
return null;
|
|
87
|
+
};
|
|
88
|
+
|
|
51
89
|
/**
|
|
52
90
|
* Retrieves colors, gradients, and duotone filters from Global Styles.
|
|
53
91
|
* The inclusion of default (Core) palettes is controlled by the relevant
|
|
@@ -102,7 +140,8 @@ function StyleBook({
|
|
|
102
140
|
showCloseButton = true,
|
|
103
141
|
onClose,
|
|
104
142
|
showTabs = true,
|
|
105
|
-
userConfig = {}
|
|
143
|
+
userConfig = {},
|
|
144
|
+
path = ''
|
|
106
145
|
}) {
|
|
107
146
|
const [resizeObserver, sizes] = (0, _compose.useResizeObserver)();
|
|
108
147
|
const [textColor] = useGlobalStyle('color.text');
|
|
@@ -110,9 +149,19 @@ function StyleBook({
|
|
|
110
149
|
const colors = useMultiOriginPalettes();
|
|
111
150
|
const examples = (0, _element.useMemo)(() => (0, _examples.getExamples)(colors), [colors]);
|
|
112
151
|
const tabs = (0, _element.useMemo)(() => (0, _categories.getTopLevelStyleBookCategories)().filter(category => examples.some(example => example.category === category.slug)), [examples]);
|
|
152
|
+
const examplesForSinglePageUse = [];
|
|
153
|
+
const overviewCategoryExamples = (0, _categories.getExamplesByCategory)({
|
|
154
|
+
slug: 'overview'
|
|
155
|
+
}, examples);
|
|
156
|
+
examplesForSinglePageUse.push(...overviewCategoryExamples.examples);
|
|
157
|
+
const otherExamples = examples.filter(example => {
|
|
158
|
+
return example.category !== 'overview' && !overviewCategoryExamples.examples.find(overviewExample => overviewExample.name === example.name);
|
|
159
|
+
});
|
|
160
|
+
examplesForSinglePageUse.push(...otherExamples);
|
|
113
161
|
const {
|
|
114
162
|
base: baseConfig
|
|
115
163
|
} = (0, _element.useContext)(GlobalStylesContext);
|
|
164
|
+
const goTo = getStyleBookNavigationFromPath(path);
|
|
116
165
|
const mergedConfig = (0, _element.useMemo)(() => {
|
|
117
166
|
if (!isObjectEmpty(userConfig) && !isObjectEmpty(baseConfig)) {
|
|
118
167
|
return mergeBaseAndUserConfigs(baseConfig, userConfig);
|
|
@@ -162,16 +211,18 @@ function StyleBook({
|
|
|
162
211
|
onSelect: onSelect,
|
|
163
212
|
settings: settings,
|
|
164
213
|
sizes: sizes,
|
|
165
|
-
title: tab.title
|
|
214
|
+
title: tab.title,
|
|
215
|
+
goTo: goTo
|
|
166
216
|
})
|
|
167
217
|
}, tab.slug))]
|
|
168
218
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(StyleBookBody, {
|
|
169
|
-
examples:
|
|
219
|
+
examples: examplesForSinglePageUse,
|
|
170
220
|
isSelected: isSelected,
|
|
171
221
|
onClick: onClick,
|
|
172
222
|
onSelect: onSelect,
|
|
173
223
|
settings: settings,
|
|
174
|
-
sizes: sizes
|
|
224
|
+
sizes: sizes,
|
|
225
|
+
goTo: goTo
|
|
175
226
|
})]
|
|
176
227
|
})
|
|
177
228
|
});
|
|
@@ -184,10 +235,12 @@ const StyleBookBody = ({
|
|
|
184
235
|
onSelect,
|
|
185
236
|
settings,
|
|
186
237
|
sizes,
|
|
187
|
-
title
|
|
238
|
+
title,
|
|
239
|
+
goTo
|
|
188
240
|
}) => {
|
|
189
241
|
const [isFocused, setIsFocused] = (0, _element.useState)(false);
|
|
190
|
-
|
|
242
|
+
const [hasIframeLoaded, setHasIframeLoaded] = (0, _element.useState)(false);
|
|
243
|
+
const iframeRef = (0, _element.useRef)(null);
|
|
191
244
|
// The presence of an `onClick` prop indicates that the Style Book is being used as a button.
|
|
192
245
|
// In this case, add additional props to the iframe to make it behave like a button.
|
|
193
246
|
const buttonModeProps = {
|
|
@@ -217,7 +270,15 @@ const StyleBookBody = ({
|
|
|
217
270
|
},
|
|
218
271
|
readonly: true
|
|
219
272
|
};
|
|
273
|
+
const handleLoad = () => setHasIframeLoaded(true);
|
|
274
|
+
(0, _element.useLayoutEffect)(() => {
|
|
275
|
+
if (goTo?.block && hasIframeLoaded && iframeRef?.current) {
|
|
276
|
+
scrollToSection(`example-${goTo?.block}`, iframeRef?.current);
|
|
277
|
+
}
|
|
278
|
+
}, [iframeRef?.current, goTo?.block, scrollToSection, hasIframeLoaded]);
|
|
220
279
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_blockEditor.__unstableIframe, {
|
|
280
|
+
onLoad: handleLoad,
|
|
281
|
+
ref: iframeRef,
|
|
221
282
|
className: (0, _clsx.default)('edit-site-style-book__iframe', {
|
|
222
283
|
'is-focused': isFocused && !!onClick,
|
|
223
284
|
'is-button': !!onClick
|
|
@@ -265,10 +326,8 @@ const Examples = (0, _element.memo)(({
|
|
|
265
326
|
title: example.title,
|
|
266
327
|
content: example.content,
|
|
267
328
|
blocks: example.blocks,
|
|
268
|
-
isSelected: isSelected(example.name),
|
|
269
|
-
onClick: () =>
|
|
270
|
-
onSelect?.(example.name);
|
|
271
|
-
}
|
|
329
|
+
isSelected: isSelected?.(example.name),
|
|
330
|
+
onClick: () => onSelect?.(example.name)
|
|
272
331
|
}, example.name)), !!filteredExamples?.subcategories?.length && filteredExamples.subcategories.map(subcategory => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Composite.Group, {
|
|
273
332
|
className: "edit-site-style-book__subcategory",
|
|
274
333
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Composite.GroupLabel, {
|
|
@@ -294,7 +353,7 @@ const Subcategory = ({
|
|
|
294
353
|
title: example.title,
|
|
295
354
|
content: example.content,
|
|
296
355
|
blocks: example.blocks,
|
|
297
|
-
isSelected: isSelected(example.name),
|
|
356
|
+
isSelected: isSelected?.(example.name),
|
|
298
357
|
onClick: () => {
|
|
299
358
|
onSelect?.(example.name);
|
|
300
359
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_i18n","_blockEditor","_editor","_data","_compose","_element","_keycodes","_lockUnlock","_editorCanvasContainer","_constants","_categories","_examples","_jsxRuntime","ExperimentalBlockEditorProvider","useGlobalStyle","GlobalStylesContext","useGlobalStylesOutputWithConfig","unlock","blockEditorPrivateApis","mergeBaseAndUserConfigs","editorPrivateApis","Tabs","componentsPrivateApis","isObjectEmpty","object","Object","keys","length","useMultiOriginPalettes","colors","gradients","useMultipleOriginColorsAndGradients","shouldDisplayDefaultDuotones","customDuotones","themeDuotones","defaultDuotones","useSettings","palettes","useMemo","result","duotones","push","name","_x","slug","StyleBook","enableResizing","isSelected","onClick","onSelect","showCloseButton","onClose","showTabs","userConfig","resizeObserver","sizes","useResizeObserver","textColor","backgroundColor","examples","getExamples","tabs","getTopLevelStyleBookCategories","filter","category","some","example","base","baseConfig","useContext","mergedConfig","originalSettings","useSelect","select","blockEditorStore","getSettings","globalStyles","settings","styles","isPreviewMode","jsx","default","closeButtonLabel","__","children","jsxs","className","clsx","width","style","color","background","TabList","map","tab","Tab","tabId","title","TabPanel","focusable","StyleBookBody","isFocused","setIsFocused","useState","buttonModeProps","role","onFocus","onBlur","onKeyDown","event","defaultPrevented","keyCode","ENTER","SPACE","preventDefault","readonly","__unstableIframe","tabIndex","__unstableEditorStyles","STYLE_BOOK_IFRAME_STYLES","Examples","label","sprintf","memo","categoryDefinition","find","_category","filteredExamples","getExamplesByCategory","Composite","orientation","Example","id","content","blocks","subcategories","subcategory","Group","GroupLabel","Subcategory","disabledExamples","focusMode","renderedBlocks","Array","isArray","disabledProps","includes","disabled","accessibleWhenDisabled","Item","render","Disabled","value","BlockList","renderAppender","_default","exports"],"sources":["@wordpress/edit-site/src/components/style-book/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tDisabled,\n\tComposite,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport {\n\tBlockList,\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n\tuseSettings,\n\t__unstableEditorStyles as EditorStyles,\n\t__unstableIframe as Iframe,\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n} from '@wordpress/block-editor';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\nimport { useResizeObserver } from '@wordpress/compose';\nimport { useMemo, useState, memo, useContext } from '@wordpress/element';\nimport { ENTER, SPACE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport EditorCanvasContainer from '../editor-canvas-container';\nimport { STYLE_BOOK_IFRAME_STYLES } from './constants';\nimport {\n\tgetExamplesByCategory,\n\tgetTopLevelStyleBookCategories,\n} from './categories';\nimport { getExamples } from './examples';\n\nconst {\n\tExperimentalBlockEditorProvider,\n\tuseGlobalStyle,\n\tGlobalStylesContext,\n\tuseGlobalStylesOutputWithConfig,\n} = unlock( blockEditorPrivateApis );\nconst { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nfunction isObjectEmpty( object ) {\n\treturn ! object || Object.keys( object ).length === 0;\n}\n\n/**\n * Retrieves colors, gradients, and duotone filters from Global Styles.\n * The inclusion of default (Core) palettes is controlled by the relevant\n * theme.json property e.g. defaultPalette, defaultGradients, defaultDuotone.\n *\n * @return {Object} Object containing properties for each type of palette.\n */\nfunction useMultiOriginPalettes() {\n\tconst { colors, gradients } = useMultipleOriginColorsAndGradients();\n\n\t// Add duotone filters to the palettes data.\n\tconst [\n\t\tshouldDisplayDefaultDuotones,\n\t\tcustomDuotones,\n\t\tthemeDuotones,\n\t\tdefaultDuotones,\n\t] = useSettings(\n\t\t'color.defaultDuotone',\n\t\t'color.duotone.custom',\n\t\t'color.duotone.theme',\n\t\t'color.duotone.default'\n\t);\n\n\tconst palettes = useMemo( () => {\n\t\tconst result = { colors, gradients, duotones: [] };\n\n\t\tif ( themeDuotones && themeDuotones.length ) {\n\t\t\tresult.duotones.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Theme',\n\t\t\t\t\t'Indicates these duotone filters come from the theme.'\n\t\t\t\t),\n\t\t\t\tslug: 'theme',\n\t\t\t\tduotones: themeDuotones,\n\t\t\t} );\n\t\t}\n\n\t\tif (\n\t\t\tshouldDisplayDefaultDuotones &&\n\t\t\tdefaultDuotones &&\n\t\t\tdefaultDuotones.length\n\t\t) {\n\t\t\tresult.duotones.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Default',\n\t\t\t\t\t'Indicates these duotone filters come from WordPress.'\n\t\t\t\t),\n\t\t\t\tslug: 'default',\n\t\t\t\tduotones: defaultDuotones,\n\t\t\t} );\n\t\t}\n\t\tif ( customDuotones && customDuotones.length ) {\n\t\t\tresult.duotones.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Custom',\n\t\t\t\t\t'Indicates these doutone filters are created by the user.'\n\t\t\t\t),\n\t\t\t\tslug: 'custom',\n\t\t\t\tduotones: customDuotones,\n\t\t\t} );\n\t\t}\n\n\t\treturn result;\n\t}, [\n\t\tcolors,\n\t\tgradients,\n\t\tcustomDuotones,\n\t\tthemeDuotones,\n\t\tdefaultDuotones,\n\t\tshouldDisplayDefaultDuotones,\n\t] );\n\n\treturn palettes;\n}\n\nfunction StyleBook( {\n\tenableResizing = true,\n\tisSelected,\n\tonClick,\n\tonSelect,\n\tshowCloseButton = true,\n\tonClose,\n\tshowTabs = true,\n\tuserConfig = {},\n} ) {\n\tconst [ resizeObserver, sizes ] = useResizeObserver();\n\tconst [ textColor ] = useGlobalStyle( 'color.text' );\n\tconst [ backgroundColor ] = useGlobalStyle( 'color.background' );\n\tconst colors = useMultiOriginPalettes();\n\tconst examples = useMemo( () => getExamples( colors ), [ colors ] );\n\tconst tabs = useMemo(\n\t\t() =>\n\t\t\tgetTopLevelStyleBookCategories().filter( ( category ) =>\n\t\t\t\texamples.some(\n\t\t\t\t\t( example ) => example.category === category.slug\n\t\t\t\t)\n\t\t\t),\n\t\t[ examples ]\n\t);\n\n\tconst { base: baseConfig } = useContext( GlobalStylesContext );\n\n\tconst mergedConfig = useMemo( () => {\n\t\tif ( ! isObjectEmpty( userConfig ) && ! isObjectEmpty( baseConfig ) ) {\n\t\t\treturn mergeBaseAndUserConfigs( baseConfig, userConfig );\n\t\t}\n\t\treturn {};\n\t}, [ baseConfig, userConfig ] );\n\n\t// Copied from packages/edit-site/src/components/revisions/index.js\n\t// could we create a shared hook?\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst [ globalStyles ] = useGlobalStylesOutputWithConfig( mergedConfig );\n\n\tconst settings = useMemo(\n\t\t() => ( {\n\t\t\t...originalSettings,\n\t\t\tstyles:\n\t\t\t\t! isObjectEmpty( globalStyles ) && ! isObjectEmpty( userConfig )\n\t\t\t\t\t? globalStyles\n\t\t\t\t\t: originalSettings.styles,\n\t\t\tisPreviewMode: true,\n\t\t} ),\n\t\t[ globalStyles, originalSettings, userConfig ]\n\t);\n\n\treturn (\n\t\t<EditorCanvasContainer\n\t\t\tonClose={ onClose }\n\t\t\tenableResizing={ enableResizing }\n\t\t\tcloseButtonLabel={ showCloseButton ? __( 'Close' ) : null }\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName={ clsx( 'edit-site-style-book', {\n\t\t\t\t\t'is-wide': sizes.width > 600,\n\t\t\t\t\t'is-button': !! onClick,\n\t\t\t\t} ) }\n\t\t\t\tstyle={ {\n\t\t\t\t\tcolor: textColor,\n\t\t\t\t\tbackground: backgroundColor,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ resizeObserver }\n\t\t\t\t{ showTabs ? (\n\t\t\t\t\t<Tabs>\n\t\t\t\t\t\t<div className=\"edit-site-style-book__tablist-container\">\n\t\t\t\t\t\t\t<Tabs.TabList>\n\t\t\t\t\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t\t\t\t\t<Tabs.Tab\n\t\t\t\t\t\t\t\t\t\ttabId={ tab.slug }\n\t\t\t\t\t\t\t\t\t\tkey={ tab.slug }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t</Tabs.TabList>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\t\t\tkey={ tab.slug }\n\t\t\t\t\t\t\t\ttabId={ tab.slug }\n\t\t\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t\t\t\tclassName=\"edit-site-style-book__tabpanel\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<StyleBookBody\n\t\t\t\t\t\t\t\t\tcategory={ tab.slug }\n\t\t\t\t\t\t\t\t\texamples={ examples }\n\t\t\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\t\t\tsizes={ sizes }\n\t\t\t\t\t\t\t\t\ttitle={ tab.title }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</Tabs>\n\t\t\t\t) : (\n\t\t\t\t\t<StyleBookBody\n\t\t\t\t\t\texamples={ examples }\n\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\tsizes={ sizes }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</EditorCanvasContainer>\n\t);\n}\n\nconst StyleBookBody = ( {\n\tcategory,\n\texamples,\n\tisSelected,\n\tonClick,\n\tonSelect,\n\tsettings,\n\tsizes,\n\ttitle,\n} ) => {\n\tconst [ isFocused, setIsFocused ] = useState( false );\n\n\t// The presence of an `onClick` prop indicates that the Style Book is being used as a button.\n\t// In this case, add additional props to the iframe to make it behave like a button.\n\tconst buttonModeProps = {\n\t\trole: 'button',\n\t\tonFocus: () => setIsFocused( true ),\n\t\tonBlur: () => setIsFocused( false ),\n\t\tonKeyDown: ( event ) => {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst { keyCode } = event;\n\t\t\tif ( onClick && ( keyCode === ENTER || keyCode === SPACE ) ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tonClick( event );\n\t\t\t}\n\t\t},\n\t\tonClick: ( event ) => {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( onClick ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tonClick( event );\n\t\t\t}\n\t\t},\n\t\treadonly: true,\n\t};\n\n\treturn (\n\t\t<Iframe\n\t\t\tclassName={ clsx( 'edit-site-style-book__iframe', {\n\t\t\t\t'is-focused': isFocused && !! onClick,\n\t\t\t\t'is-button': !! onClick,\n\t\t\t} ) }\n\t\t\tname=\"style-book-canvas\"\n\t\t\ttabIndex={ 0 }\n\t\t\t{ ...( onClick ? buttonModeProps : {} ) }\n\t\t>\n\t\t\t<EditorStyles styles={ settings.styles } />\n\t\t\t<style>\n\t\t\t\t{ STYLE_BOOK_IFRAME_STYLES }\n\t\t\t\t{ !! onClick &&\n\t\t\t\t\t'body { cursor: pointer; } body * { pointer-events: none; }' }\n\t\t\t</style>\n\t\t\t<Examples\n\t\t\t\tclassName={ clsx( 'edit-site-style-book__examples', {\n\t\t\t\t\t'is-wide': sizes.width > 600,\n\t\t\t\t} ) }\n\t\t\t\texamples={ examples }\n\t\t\t\tcategory={ category }\n\t\t\t\tlabel={\n\t\t\t\t\ttitle\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Category of blocks, e.g. Text.\n\t\t\t\t\t\t\t\t__( 'Examples of blocks in the %s category' ),\n\t\t\t\t\t\t\t\ttitle\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: __( 'Examples of blocks' )\n\t\t\t\t}\n\t\t\t\tisSelected={ isSelected }\n\t\t\t\tonSelect={ onSelect }\n\t\t\t\tkey={ category }\n\t\t\t/>\n\t\t</Iframe>\n\t);\n};\n\nconst Examples = memo(\n\t( { className, examples, category, label, isSelected, onSelect } ) => {\n\t\tconst categoryDefinition = category\n\t\t\t? getTopLevelStyleBookCategories().find(\n\t\t\t\t\t( _category ) => _category.slug === category\n\t\t\t )\n\t\t\t: null;\n\n\t\tconst filteredExamples = categoryDefinition\n\t\t\t? getExamplesByCategory( categoryDefinition, examples )\n\t\t\t: { examples };\n\n\t\treturn (\n\t\t\t<Composite\n\t\t\t\torientation=\"vertical\"\n\t\t\t\tclassName={ className }\n\t\t\t\taria-label={ label }\n\t\t\t\trole=\"grid\"\n\t\t\t>\n\t\t\t\t{ !! filteredExamples?.examples?.length &&\n\t\t\t\t\tfilteredExamples.examples.map( ( example ) => (\n\t\t\t\t\t\t<Example\n\t\t\t\t\t\t\tkey={ example.name }\n\t\t\t\t\t\t\tid={ `example-${ example.name }` }\n\t\t\t\t\t\t\ttitle={ example.title }\n\t\t\t\t\t\t\tcontent={ example.content }\n\t\t\t\t\t\t\tblocks={ example.blocks }\n\t\t\t\t\t\t\tisSelected={ isSelected( example.name ) }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tonSelect?.( example.name );\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{ !! filteredExamples?.subcategories?.length &&\n\t\t\t\t\tfilteredExamples.subcategories.map( ( subcategory ) => (\n\t\t\t\t\t\t<Composite.Group\n\t\t\t\t\t\t\tclassName=\"edit-site-style-book__subcategory\"\n\t\t\t\t\t\t\tkey={ `subcategory-${ subcategory.slug }` }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Composite.GroupLabel>\n\t\t\t\t\t\t\t\t<h2 className=\"edit-site-style-book__subcategory-title\">\n\t\t\t\t\t\t\t\t\t{ subcategory.title }\n\t\t\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t\t</Composite.GroupLabel>\n\t\t\t\t\t\t\t<Subcategory\n\t\t\t\t\t\t\t\texamples={ subcategory.examples }\n\t\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Composite.Group>\n\t\t\t\t\t) ) }\n\t\t\t</Composite>\n\t\t);\n\t}\n);\n\nconst Subcategory = ( { examples, isSelected, onSelect } ) => {\n\treturn (\n\t\t!! examples?.length &&\n\t\texamples.map( ( example ) => (\n\t\t\t<Example\n\t\t\t\tkey={ example.name }\n\t\t\t\tid={ `example-${ example.name }` }\n\t\t\t\ttitle={ example.title }\n\t\t\t\tcontent={ example.content }\n\t\t\t\tblocks={ example.blocks }\n\t\t\t\tisSelected={ isSelected( example.name ) }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tonSelect?.( example.name );\n\t\t\t\t} }\n\t\t\t/>\n\t\t) )\n\t);\n};\n\nconst disabledExamples = [ 'example-duotones' ];\n\nconst Example = ( { id, title, blocks, isSelected, onClick, content } ) => {\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst settings = useMemo(\n\t\t() => ( {\n\t\t\t...originalSettings,\n\t\t\tfocusMode: false, // Disable \"Spotlight mode\".\n\t\t\tisPreviewMode: true,\n\t\t} ),\n\t\t[ originalSettings ]\n\t);\n\n\t// Cache the list of blocks to avoid additional processing when the component is re-rendered.\n\tconst renderedBlocks = useMemo(\n\t\t() => ( Array.isArray( blocks ) ? blocks : [ blocks ] ),\n\t\t[ blocks ]\n\t);\n\n\tconst disabledProps = disabledExamples.includes( id )\n\t\t? {\n\t\t\t\tdisabled: true,\n\t\t\t\taccessibleWhenDisabled: true,\n\t\t }\n\t\t: {};\n\n\treturn (\n\t\t<div role=\"row\">\n\t\t\t<div role=\"gridcell\">\n\t\t\t\t<Composite.Item\n\t\t\t\t\tclassName={ clsx( 'edit-site-style-book__example', {\n\t\t\t\t\t\t'is-selected': isSelected,\n\t\t\t\t\t\t'is-disabled-example': !! disabledProps?.disabled,\n\t\t\t\t\t} ) }\n\t\t\t\t\tid={ id }\n\t\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t\t// translators: %s: Title of a block, e.g. Heading.\n\t\t\t\t\t\t__( 'Open %s styles in Styles panel' ),\n\t\t\t\t\t\ttitle\n\t\t\t\t\t) }\n\t\t\t\t\trender={ <div /> }\n\t\t\t\t\trole=\"button\"\n\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\t{ ...disabledProps }\n\t\t\t\t>\n\t\t\t\t\t<span className=\"edit-site-style-book__example-title\">\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</span>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"edit-site-style-book__example-preview\"\n\t\t\t\t\t\taria-hidden\n\t\t\t\t\t>\n\t\t\t\t\t\t<Disabled className=\"edit-site-style-book__example-preview__content\">\n\t\t\t\t\t\t\t{ content ? (\n\t\t\t\t\t\t\t\tcontent\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<ExperimentalBlockEditorProvider\n\t\t\t\t\t\t\t\t\tvalue={ renderedBlocks }\n\t\t\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<EditorStyles />\n\t\t\t\t\t\t\t\t\t<BlockList renderAppender={ false } />\n\t\t\t\t\t\t\t\t</ExperimentalBlockEditorProvider>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Disabled>\n\t\t\t\t\t</div>\n\t\t\t\t</Composite.Item>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nexport default StyleBook;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AAKA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AASA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AAKA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,sBAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,UAAA,GAAAX,OAAA;AACA,IAAAY,WAAA,GAAAZ,OAAA;AAIA,IAAAa,SAAA,GAAAb,OAAA;AAAyC,IAAAc,WAAA,GAAAd,OAAA;AAvCzC;AACA;AACA;;AAGA;AACA;AACA;;AAsBA;AACA;AACA;;AAUA,MAAM;EACLe,+BAA+B;EAC/BC,cAAc;EACdC,mBAAmB;EACnBC;AACD,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AACpC,MAAM;EAAEC;AAAwB,CAAC,GAAG,IAAAF,kBAAM,EAAEG,mBAAkB,CAAC;AAE/D,MAAM;EAAEC;AAAK,CAAC,GAAG,IAAAJ,kBAAM,EAAEK,uBAAsB,CAAC;AAEhD,SAASC,aAAaA,CAAEC,MAAM,EAAG;EAChC,OAAO,CAAEA,MAAM,IAAIC,MAAM,CAACC,IAAI,CAAEF,MAAO,CAAC,CAACG,MAAM,KAAK,CAAC;AACtD;;AAEA;AACA;AACA;AAC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AAQ,EAAGA,QAAU;cAAAO,QAAA,gBAErB,IAAAxE,WAAA,CAAAoE,GAAA,EAAC/E,YAAA,CAAAqH,sBAAY,IAAE,CAAC,eAChB,IAAA1G,WAAA,CAAAoE,GAAA,EAAC/E,YAAA,CAAAwJ,SAAS;gBAACC,cAAc,EAAG;cAAO,CAAE,CAAC;YAAA,CACN;UACjC,CACQ;QAAC,CACP,CAAC;MAAA,CACS;IAAC,CACb;EAAC,CACF,CAAC;AAER,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA3E,OAAA,GAEapC,SAAS","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_i18n","_blockEditor","_editor","_data","_compose","_element","_keycodes","_lockUnlock","_editorCanvasContainer","_constants","_categories","_examples","_jsxRuntime","ExperimentalBlockEditorProvider","useGlobalStyle","GlobalStylesContext","useGlobalStylesOutputWithConfig","unlock","blockEditorPrivateApis","mergeBaseAndUserConfigs","editorPrivateApis","Tabs","componentsPrivateApis","isObjectEmpty","object","Object","keys","length","scrollToSection","anchorId","iframe","contentDocument","element","getElementById","scrollIntoView","behavior","getStyleBookNavigationFromPath","path","block","includes","decodeURIComponent","split","endsWith","useMultiOriginPalettes","colors","gradients","useMultipleOriginColorsAndGradients","shouldDisplayDefaultDuotones","customDuotones","themeDuotones","defaultDuotones","useSettings","palettes","useMemo","result","duotones","push","name","_x","slug","StyleBook","enableResizing","isSelected","onClick","onSelect","showCloseButton","onClose","showTabs","userConfig","resizeObserver","sizes","useResizeObserver","textColor","backgroundColor","examples","getExamples","tabs","getTopLevelStyleBookCategories","filter","category","some","example","examplesForSinglePageUse","overviewCategoryExamples","getExamplesByCategory","otherExamples","find","overviewExample","base","baseConfig","useContext","goTo","mergedConfig","originalSettings","useSelect","select","blockEditorStore","getSettings","globalStyles","settings","styles","isPreviewMode","jsx","default","closeButtonLabel","__","children","jsxs","className","clsx","width","style","color","background","TabList","map","tab","Tab","tabId","title","TabPanel","focusable","StyleBookBody","isFocused","setIsFocused","useState","hasIframeLoaded","setHasIframeLoaded","iframeRef","useRef","buttonModeProps","role","onFocus","onBlur","onKeyDown","event","defaultPrevented","keyCode","ENTER","SPACE","preventDefault","readonly","handleLoad","useLayoutEffect","current","__unstableIframe","onLoad","ref","tabIndex","__unstableEditorStyles","STYLE_BOOK_IFRAME_STYLES","Examples","label","sprintf","memo","categoryDefinition","_category","filteredExamples","Composite","orientation","Example","id","content","blocks","subcategories","subcategory","Group","GroupLabel","Subcategory","disabledExamples","focusMode","renderedBlocks","Array","isArray","disabledProps","disabled","accessibleWhenDisabled","Item","render","Disabled","value","BlockList","renderAppender","_default","exports"],"sources":["@wordpress/edit-site/src/components/style-book/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tDisabled,\n\tComposite,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport {\n\tBlockList,\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n\tuseSettings,\n\t__unstableEditorStyles as EditorStyles,\n\t__unstableIframe as Iframe,\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n} from '@wordpress/block-editor';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\nimport { useResizeObserver } from '@wordpress/compose';\nimport {\n\tuseMemo,\n\tuseState,\n\tmemo,\n\tuseContext,\n\tuseRef,\n\tuseLayoutEffect,\n} from '@wordpress/element';\nimport { ENTER, SPACE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport EditorCanvasContainer from '../editor-canvas-container';\nimport { STYLE_BOOK_IFRAME_STYLES } from './constants';\nimport {\n\tgetExamplesByCategory,\n\tgetTopLevelStyleBookCategories,\n} from './categories';\nimport { getExamples } from './examples';\n\nconst {\n\tExperimentalBlockEditorProvider,\n\tuseGlobalStyle,\n\tGlobalStylesContext,\n\tuseGlobalStylesOutputWithConfig,\n} = unlock( blockEditorPrivateApis );\nconst { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nfunction isObjectEmpty( object ) {\n\treturn ! object || Object.keys( object ).length === 0;\n}\n\n/**\n * Scrolls to a section within an iframe.\n *\n * @param {string} anchorId The id of the element to scroll to.\n * @param {HTMLIFrameElement} iframe The target iframe.\n */\nconst scrollToSection = ( anchorId, iframe ) => {\n\tif ( ! iframe || ! iframe?.contentDocument ) {\n\t\treturn;\n\t}\n\n\tconst element = iframe.contentDocument.getElementById( anchorId );\n\tif ( element ) {\n\t\telement.scrollIntoView( {\n\t\t\tbehavior: 'smooth',\n\t\t} );\n\t}\n};\n\n/**\n * Parses a Block Editor navigation path to extract the block name and\n * build a style book navigation path. The object can be extended to include a category,\n * representing a style book tab/section.\n *\n * @param {string} path An internal Block Editor navigation path.\n * @return {null|{block: string}} An object containing the example to navigate to.\n */\nconst getStyleBookNavigationFromPath = ( path ) => {\n\tif ( path && typeof path === 'string' ) {\n\t\tlet block = path.includes( '/blocks/' )\n\t\t\t? decodeURIComponent( path.split( '/blocks/' )[ 1 ] )\n\t\t\t: null;\n\t\t// Default to theme-colors if the path ends with /colors.\n\t\tblock = path.endsWith( '/colors' ) ? 'theme-colors' : block;\n\n\t\treturn {\n\t\t\tblock,\n\t\t};\n\t}\n\treturn null;\n};\n\n/**\n * Retrieves colors, gradients, and duotone filters from Global Styles.\n * The inclusion of default (Core) palettes is controlled by the relevant\n * theme.json property e.g. defaultPalette, defaultGradients, defaultDuotone.\n *\n * @return {Object} Object containing properties for each type of palette.\n */\nfunction useMultiOriginPalettes() {\n\tconst { colors, gradients } = useMultipleOriginColorsAndGradients();\n\n\t// Add duotone filters to the palettes data.\n\tconst [\n\t\tshouldDisplayDefaultDuotones,\n\t\tcustomDuotones,\n\t\tthemeDuotones,\n\t\tdefaultDuotones,\n\t] = useSettings(\n\t\t'color.defaultDuotone',\n\t\t'color.duotone.custom',\n\t\t'color.duotone.theme',\n\t\t'color.duotone.default'\n\t);\n\n\tconst palettes = useMemo( () => {\n\t\tconst result = { colors, gradients, duotones: [] };\n\n\t\tif ( themeDuotones && themeDuotones.length ) {\n\t\t\tresult.duotones.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Theme',\n\t\t\t\t\t'Indicates these duotone filters come from the theme.'\n\t\t\t\t),\n\t\t\t\tslug: 'theme',\n\t\t\t\tduotones: themeDuotones,\n\t\t\t} );\n\t\t}\n\n\t\tif (\n\t\t\tshouldDisplayDefaultDuotones &&\n\t\t\tdefaultDuotones &&\n\t\t\tdefaultDuotones.length\n\t\t) {\n\t\t\tresult.duotones.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Default',\n\t\t\t\t\t'Indicates these duotone filters come from WordPress.'\n\t\t\t\t),\n\t\t\t\tslug: 'default',\n\t\t\t\tduotones: defaultDuotones,\n\t\t\t} );\n\t\t}\n\t\tif ( customDuotones && customDuotones.length ) {\n\t\t\tresult.duotones.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Custom',\n\t\t\t\t\t'Indicates these doutone filters are created by the user.'\n\t\t\t\t),\n\t\t\t\tslug: 'custom',\n\t\t\t\tduotones: customDuotones,\n\t\t\t} );\n\t\t}\n\n\t\treturn result;\n\t}, [\n\t\tcolors,\n\t\tgradients,\n\t\tcustomDuotones,\n\t\tthemeDuotones,\n\t\tdefaultDuotones,\n\t\tshouldDisplayDefaultDuotones,\n\t] );\n\n\treturn palettes;\n}\n\nfunction StyleBook( {\n\tenableResizing = true,\n\tisSelected,\n\tonClick,\n\tonSelect,\n\tshowCloseButton = true,\n\tonClose,\n\tshowTabs = true,\n\tuserConfig = {},\n\tpath = '',\n} ) {\n\tconst [ resizeObserver, sizes ] = useResizeObserver();\n\tconst [ textColor ] = useGlobalStyle( 'color.text' );\n\tconst [ backgroundColor ] = useGlobalStyle( 'color.background' );\n\tconst colors = useMultiOriginPalettes();\n\tconst examples = useMemo( () => getExamples( colors ), [ colors ] );\n\tconst tabs = useMemo(\n\t\t() =>\n\t\t\tgetTopLevelStyleBookCategories().filter( ( category ) =>\n\t\t\t\texamples.some(\n\t\t\t\t\t( example ) => example.category === category.slug\n\t\t\t\t)\n\t\t\t),\n\t\t[ examples ]\n\t);\n\n\tconst examplesForSinglePageUse = [];\n\tconst overviewCategoryExamples = getExamplesByCategory(\n\t\t{ slug: 'overview' },\n\t\texamples\n\t);\n\texamplesForSinglePageUse.push( ...overviewCategoryExamples.examples );\n\tconst otherExamples = examples.filter( ( example ) => {\n\t\treturn (\n\t\t\texample.category !== 'overview' &&\n\t\t\t! overviewCategoryExamples.examples.find(\n\t\t\t\t( overviewExample ) => overviewExample.name === example.name\n\t\t\t)\n\t\t);\n\t} );\n\texamplesForSinglePageUse.push( ...otherExamples );\n\n\tconst { base: baseConfig } = useContext( GlobalStylesContext );\n\tconst goTo = getStyleBookNavigationFromPath( path );\n\n\tconst mergedConfig = useMemo( () => {\n\t\tif ( ! isObjectEmpty( userConfig ) && ! isObjectEmpty( baseConfig ) ) {\n\t\t\treturn mergeBaseAndUserConfigs( baseConfig, userConfig );\n\t\t}\n\t\treturn {};\n\t}, [ baseConfig, userConfig ] );\n\n\t// Copied from packages/edit-site/src/components/revisions/index.js\n\t// could we create a shared hook?\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst [ globalStyles ] = useGlobalStylesOutputWithConfig( mergedConfig );\n\n\tconst settings = useMemo(\n\t\t() => ( {\n\t\t\t...originalSettings,\n\t\t\tstyles:\n\t\t\t\t! isObjectEmpty( globalStyles ) && ! isObjectEmpty( userConfig )\n\t\t\t\t\t? globalStyles\n\t\t\t\t\t: originalSettings.styles,\n\t\t\tisPreviewMode: true,\n\t\t} ),\n\t\t[ globalStyles, originalSettings, userConfig ]\n\t);\n\n\treturn (\n\t\t<EditorCanvasContainer\n\t\t\tonClose={ onClose }\n\t\t\tenableResizing={ enableResizing }\n\t\t\tcloseButtonLabel={ showCloseButton ? __( 'Close' ) : null }\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName={ clsx( 'edit-site-style-book', {\n\t\t\t\t\t'is-wide': sizes.width > 600,\n\t\t\t\t\t'is-button': !! onClick,\n\t\t\t\t} ) }\n\t\t\t\tstyle={ {\n\t\t\t\t\tcolor: textColor,\n\t\t\t\t\tbackground: backgroundColor,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ resizeObserver }\n\t\t\t\t{ showTabs ? (\n\t\t\t\t\t<Tabs>\n\t\t\t\t\t\t<div className=\"edit-site-style-book__tablist-container\">\n\t\t\t\t\t\t\t<Tabs.TabList>\n\t\t\t\t\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t\t\t\t\t<Tabs.Tab\n\t\t\t\t\t\t\t\t\t\ttabId={ tab.slug }\n\t\t\t\t\t\t\t\t\t\tkey={ tab.slug }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t</Tabs.TabList>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\t\t\tkey={ tab.slug }\n\t\t\t\t\t\t\t\ttabId={ tab.slug }\n\t\t\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t\t\t\tclassName=\"edit-site-style-book__tabpanel\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<StyleBookBody\n\t\t\t\t\t\t\t\t\tcategory={ tab.slug }\n\t\t\t\t\t\t\t\t\texamples={ examples }\n\t\t\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\t\t\tsizes={ sizes }\n\t\t\t\t\t\t\t\t\ttitle={ tab.title }\n\t\t\t\t\t\t\t\t\tgoTo={ goTo }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</Tabs>\n\t\t\t\t) : (\n\t\t\t\t\t<StyleBookBody\n\t\t\t\t\t\texamples={ examplesForSinglePageUse }\n\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\tsizes={ sizes }\n\t\t\t\t\t\tgoTo={ goTo }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</EditorCanvasContainer>\n\t);\n}\n\nconst StyleBookBody = ( {\n\tcategory,\n\texamples,\n\tisSelected,\n\tonClick,\n\tonSelect,\n\tsettings,\n\tsizes,\n\ttitle,\n\tgoTo,\n} ) => {\n\tconst [ isFocused, setIsFocused ] = useState( false );\n\tconst [ hasIframeLoaded, setHasIframeLoaded ] = useState( false );\n\tconst iframeRef = useRef( null );\n\t// The presence of an `onClick` prop indicates that the Style Book is being used as a button.\n\t// In this case, add additional props to the iframe to make it behave like a button.\n\tconst buttonModeProps = {\n\t\trole: 'button',\n\t\tonFocus: () => setIsFocused( true ),\n\t\tonBlur: () => setIsFocused( false ),\n\t\tonKeyDown: ( event ) => {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst { keyCode } = event;\n\t\t\tif ( onClick && ( keyCode === ENTER || keyCode === SPACE ) ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tonClick( event );\n\t\t\t}\n\t\t},\n\t\tonClick: ( event ) => {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( onClick ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tonClick( event );\n\t\t\t}\n\t\t},\n\t\treadonly: true,\n\t};\n\n\tconst handleLoad = () => setHasIframeLoaded( true );\n\tuseLayoutEffect( () => {\n\t\tif ( goTo?.block && hasIframeLoaded && iframeRef?.current ) {\n\t\t\tscrollToSection( `example-${ goTo?.block }`, iframeRef?.current );\n\t\t}\n\t}, [ iframeRef?.current, goTo?.block, scrollToSection, hasIframeLoaded ] );\n\n\treturn (\n\t\t<Iframe\n\t\t\tonLoad={ handleLoad }\n\t\t\tref={ iframeRef }\n\t\t\tclassName={ clsx( 'edit-site-style-book__iframe', {\n\t\t\t\t'is-focused': isFocused && !! onClick,\n\t\t\t\t'is-button': !! onClick,\n\t\t\t} ) }\n\t\t\tname=\"style-book-canvas\"\n\t\t\ttabIndex={ 0 }\n\t\t\t{ ...( onClick ? buttonModeProps : {} ) }\n\t\t>\n\t\t\t<EditorStyles styles={ settings.styles } />\n\t\t\t<style>\n\t\t\t\t{ STYLE_BOOK_IFRAME_STYLES }\n\t\t\t\t{ !! onClick &&\n\t\t\t\t\t'body { cursor: pointer; } body * { pointer-events: none; }' }\n\t\t\t</style>\n\t\t\t<Examples\n\t\t\t\tclassName={ clsx( 'edit-site-style-book__examples', {\n\t\t\t\t\t'is-wide': sizes.width > 600,\n\t\t\t\t} ) }\n\t\t\t\texamples={ examples }\n\t\t\t\tcategory={ category }\n\t\t\t\tlabel={\n\t\t\t\t\ttitle\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Category of blocks, e.g. Text.\n\t\t\t\t\t\t\t\t__( 'Examples of blocks in the %s category' ),\n\t\t\t\t\t\t\t\ttitle\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: __( 'Examples of blocks' )\n\t\t\t\t}\n\t\t\t\tisSelected={ isSelected }\n\t\t\t\tonSelect={ onSelect }\n\t\t\t\tkey={ category }\n\t\t\t/>\n\t\t</Iframe>\n\t);\n};\n\nconst Examples = memo(\n\t( { className, examples, category, label, isSelected, onSelect } ) => {\n\t\tconst categoryDefinition = category\n\t\t\t? getTopLevelStyleBookCategories().find(\n\t\t\t\t\t( _category ) => _category.slug === category\n\t\t\t )\n\t\t\t: null;\n\n\t\tconst filteredExamples = categoryDefinition\n\t\t\t? getExamplesByCategory( categoryDefinition, examples )\n\t\t\t: { examples };\n\n\t\treturn (\n\t\t\t<Composite\n\t\t\t\torientation=\"vertical\"\n\t\t\t\tclassName={ className }\n\t\t\t\taria-label={ label }\n\t\t\t\trole=\"grid\"\n\t\t\t>\n\t\t\t\t{ !! filteredExamples?.examples?.length &&\n\t\t\t\t\tfilteredExamples.examples.map( ( example ) => (\n\t\t\t\t\t\t<Example\n\t\t\t\t\t\t\tkey={ example.name }\n\t\t\t\t\t\t\tid={ `example-${ example.name }` }\n\t\t\t\t\t\t\ttitle={ example.title }\n\t\t\t\t\t\t\tcontent={ example.content }\n\t\t\t\t\t\t\tblocks={ example.blocks }\n\t\t\t\t\t\t\tisSelected={ isSelected?.( example.name ) }\n\t\t\t\t\t\t\tonClick={ () => onSelect?.( example.name ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t\t{ !! filteredExamples?.subcategories?.length &&\n\t\t\t\t\tfilteredExamples.subcategories.map( ( subcategory ) => (\n\t\t\t\t\t\t<Composite.Group\n\t\t\t\t\t\t\tclassName=\"edit-site-style-book__subcategory\"\n\t\t\t\t\t\t\tkey={ `subcategory-${ subcategory.slug }` }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Composite.GroupLabel>\n\t\t\t\t\t\t\t\t<h2 className=\"edit-site-style-book__subcategory-title\">\n\t\t\t\t\t\t\t\t\t{ subcategory.title }\n\t\t\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t\t</Composite.GroupLabel>\n\t\t\t\t\t\t\t<Subcategory\n\t\t\t\t\t\t\t\texamples={ subcategory.examples }\n\t\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Composite.Group>\n\t\t\t\t\t) ) }\n\t\t\t</Composite>\n\t\t);\n\t}\n);\n\nconst Subcategory = ( { examples, isSelected, onSelect } ) => {\n\treturn (\n\t\t!! examples?.length &&\n\t\texamples.map( ( example ) => (\n\t\t\t<Example\n\t\t\t\tkey={ example.name }\n\t\t\t\tid={ `example-${ example.name }` }\n\t\t\t\ttitle={ example.title }\n\t\t\t\tcontent={ example.content }\n\t\t\t\tblocks={ example.blocks }\n\t\t\t\tisSelected={ isSelected?.( example.name ) }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tonSelect?.( example.name );\n\t\t\t\t} }\n\t\t\t/>\n\t\t) )\n\t);\n};\n\nconst disabledExamples = [ 'example-duotones' ];\n\nconst Example = ( { id, title, blocks, isSelected, onClick, content } ) => {\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst settings = useMemo(\n\t\t() => ( {\n\t\t\t...originalSettings,\n\t\t\tfocusMode: false, // Disable \"Spotlight mode\".\n\t\t\tisPreviewMode: true,\n\t\t} ),\n\t\t[ originalSettings ]\n\t);\n\n\t// Cache the list of blocks to avoid additional processing when the component is re-rendered.\n\tconst renderedBlocks = useMemo(\n\t\t() => ( Array.isArray( blocks ) ? blocks : [ blocks ] ),\n\t\t[ blocks ]\n\t);\n\n\tconst disabledProps = disabledExamples.includes( id )\n\t\t? {\n\t\t\t\tdisabled: true,\n\t\t\t\taccessibleWhenDisabled: true,\n\t\t }\n\t\t: {};\n\n\treturn (\n\t\t<div role=\"row\">\n\t\t\t<div role=\"gridcell\">\n\t\t\t\t<Composite.Item\n\t\t\t\t\tclassName={ clsx( 'edit-site-style-book__example', {\n\t\t\t\t\t\t'is-selected': isSelected,\n\t\t\t\t\t\t'is-disabled-example': !! disabledProps?.disabled,\n\t\t\t\t\t} ) }\n\t\t\t\t\tid={ id }\n\t\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t\t// translators: %s: Title of a block, e.g. Heading.\n\t\t\t\t\t\t__( 'Open %s styles in Styles panel' ),\n\t\t\t\t\t\ttitle\n\t\t\t\t\t) }\n\t\t\t\t\trender={ <div /> }\n\t\t\t\t\trole=\"button\"\n\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\t{ ...disabledProps }\n\t\t\t\t>\n\t\t\t\t\t<span className=\"edit-site-style-book__example-title\">\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</span>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"edit-site-style-book__example-preview\"\n\t\t\t\t\t\taria-hidden\n\t\t\t\t\t>\n\t\t\t\t\t\t<Disabled className=\"edit-site-style-book__example-preview__content\">\n\t\t\t\t\t\t\t{ content ? (\n\t\t\t\t\t\t\t\tcontent\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<ExperimentalBlockEditorProvider\n\t\t\t\t\t\t\t\t\tvalue={ renderedBlocks }\n\t\t\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<EditorStyles />\n\t\t\t\t\t\t\t\t\t<BlockList renderAppender={ false } />\n\t\t\t\t\t\t\t\t</ExperimentalBlockEditorProvider>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Disabled>\n\t\t\t\t\t</div>\n\t\t\t\t</Composite.Item>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nexport default StyleBook;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AAKA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AASA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAA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a;QAAK,CACF,CAAC,eACP,IAAA3G,WAAA,CAAA0F,GAAA;UACCM,SAAS,EAAC,uCAAuC;UACjD,mBAAW;UAAAF,QAAA,eAEX,IAAA9F,WAAA,CAAA0F,GAAA,EAACvG,WAAA,CAAAoL,QAAQ;YAACvE,SAAS,EAAC,gDAAgD;YAAAF,QAAA,EACjEwD,OAAO,GACRA,OAAO,gBAEP,IAAAtJ,WAAA,CAAA+F,IAAA,EAAC9F,+BAA+B;cAC/BuK,KAAK,EAAGT,cAAgB;cACxBxE,QAAQ,EAAGA,QAAU;cAAAO,QAAA,gBAErB,IAAA9F,WAAA,CAAA0F,GAAA,EAACrG,YAAA,CAAAoJ,sBAAY,IAAE,CAAC,eAChB,IAAAzI,WAAA,CAAA0F,GAAA,EAACrG,YAAA,CAAAoL,SAAS;gBAACC,cAAc,EAAG;cAAO,CAAE,CAAC;YAAA,CACN;UACjC,CACQ;QAAC,CACP,CAAC;MAAA,CACS;IAAC,CACb;EAAC,CACF,CAAC;AAER,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAjF,OAAA,GAEa3C,SAAS","ignoreList":[]}
|
|
@@ -14,9 +14,11 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
14
14
|
* Internal dependencies
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
function WelcomeGuide(
|
|
17
|
+
function WelcomeGuide({
|
|
18
|
+
postType
|
|
19
|
+
}) {
|
|
18
20
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
19
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_editor.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_page.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_template.default, {})]
|
|
21
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_editor.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.default, {}), postType === 'page' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_page.default, {}), postType === 'wp_template' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_template.default, {})]
|
|
20
22
|
});
|
|
21
23
|
}
|
|
22
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_editor","_interopRequireDefault","require","_styles","_page","_template","_jsxRuntime","WelcomeGuide","jsxs","Fragment","children","jsx","default"],"sources":["@wordpress/edit-site/src/components/welcome-guide/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport WelcomeGuideEditor from './editor';\nimport WelcomeGuideStyles from './styles';\nimport WelcomeGuidePage from './page';\nimport WelcomeGuideTemplate from './template';\n\nexport default function WelcomeGuide() {\n\treturn (\n\t\t<>\n\t\t\t<WelcomeGuideEditor />\n\t\t\t<WelcomeGuideStyles />\n\t\t\t<WelcomeGuidePage
|
|
1
|
+
{"version":3,"names":["_editor","_interopRequireDefault","require","_styles","_page","_template","_jsxRuntime","WelcomeGuide","postType","jsxs","Fragment","children","jsx","default"],"sources":["@wordpress/edit-site/src/components/welcome-guide/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport WelcomeGuideEditor from './editor';\nimport WelcomeGuideStyles from './styles';\nimport WelcomeGuidePage from './page';\nimport WelcomeGuideTemplate from './template';\n\nexport default function WelcomeGuide( { postType } ) {\n\treturn (\n\t\t<>\n\t\t\t<WelcomeGuideEditor />\n\t\t\t<WelcomeGuideStyles />\n\t\t\t{ postType === 'page' && <WelcomeGuidePage /> }\n\t\t\t{ postType === 'wp_template' && <WelcomeGuideTemplate /> }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,KAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,SAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAA8C,IAAAI,WAAA,GAAAJ,OAAA;AAN9C;AACA;AACA;;AAMe,SAASK,YAAYA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACpD,oBACC,IAAAF,WAAA,CAAAG,IAAA,EAAAH,WAAA,CAAAI,QAAA;IAAAC,QAAA,gBACC,IAAAL,WAAA,CAAAM,GAAA,EAACZ,OAAA,CAAAa,OAAkB,IAAE,CAAC,eACtB,IAAAP,WAAA,CAAAM,GAAA,EAACT,OAAA,CAAAU,OAAkB,IAAE,CAAC,EACpBL,QAAQ,KAAK,MAAM,iBAAI,IAAAF,WAAA,CAAAM,GAAA,EAACR,KAAA,CAAAS,OAAgB,IAAE,CAAC,EAC3CL,QAAQ,KAAK,aAAa,iBAAI,IAAAF,WAAA,CAAAM,GAAA,EAACP,SAAA,CAAAQ,OAAoB,IAAE,CAAC;EAAA,CACvD,CAAC;AAEL","ignoreList":[]}
|
|
@@ -8,16 +8,11 @@ var _data = require("@wordpress/data");
|
|
|
8
8
|
var _components = require("@wordpress/components");
|
|
9
9
|
var _i18n = require("@wordpress/i18n");
|
|
10
10
|
var _preferences = require("@wordpress/preferences");
|
|
11
|
-
var _store = require("../../store");
|
|
12
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
12
|
/**
|
|
14
13
|
* WordPress dependencies
|
|
15
14
|
*/
|
|
16
15
|
|
|
17
|
-
/**
|
|
18
|
-
* Internal dependencies
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
16
|
function WelcomeGuidePage() {
|
|
22
17
|
const {
|
|
23
18
|
toggle
|
|
@@ -25,10 +20,7 @@ function WelcomeGuidePage() {
|
|
|
25
20
|
const isVisible = (0, _data.useSelect)(select => {
|
|
26
21
|
const isPageActive = !!select(_preferences.store).get('core/edit-site', 'welcomeGuidePage');
|
|
27
22
|
const isEditorActive = !!select(_preferences.store).get('core/edit-site', 'welcomeGuide');
|
|
28
|
-
|
|
29
|
-
isPage
|
|
30
|
-
} = select(_store.store);
|
|
31
|
-
return isPageActive && !isEditorActive && isPage();
|
|
23
|
+
return isPageActive && !isEditorActive;
|
|
32
24
|
}, []);
|
|
33
25
|
if (!isVisible) {
|
|
34
26
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_components","_i18n","_preferences","
|
|
1
|
+
{"version":3,"names":["_data","require","_components","_i18n","_preferences","_jsxRuntime","WelcomeGuidePage","toggle","useDispatch","preferencesStore","isVisible","useSelect","select","isPageActive","get","isEditorActive","heading","__","jsx","Guide","className","contentLabel","finishButtonText","onFinish","pages","image","autoPlay","loop","muted","width","height","children","src","type","content","jsxs","Fragment"],"sources":["@wordpress/edit-site/src/components/welcome-guide/page.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Guide } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\nexport default function WelcomeGuidePage() {\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\tconst isVisible = useSelect( ( select ) => {\n\t\tconst isPageActive = !! select( preferencesStore ).get(\n\t\t\t'core/edit-site',\n\t\t\t'welcomeGuidePage'\n\t\t);\n\t\tconst isEditorActive = !! select( preferencesStore ).get(\n\t\t\t'core/edit-site',\n\t\t\t'welcomeGuide'\n\t\t);\n\t\treturn isPageActive && ! isEditorActive;\n\t}, [] );\n\n\tif ( ! isVisible ) {\n\t\treturn null;\n\t}\n\n\tconst heading = __( 'Editing a page' );\n\n\treturn (\n\t\t<Guide\n\t\t\tclassName=\"edit-site-welcome-guide guide-page\"\n\t\t\tcontentLabel={ heading }\n\t\t\tfinishButtonText={ __( 'Continue' ) }\n\t\t\tonFinish={ () => toggle( 'core/edit-site', 'welcomeGuidePage' ) }\n\t\t\tpages={ [\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<video\n\t\t\t\t\t\t\tclassName=\"edit-site-welcome-guide__video\"\n\t\t\t\t\t\t\tautoPlay\n\t\t\t\t\t\t\tloop\n\t\t\t\t\t\t\tmuted\n\t\t\t\t\t\t\twidth=\"312\"\n\t\t\t\t\t\t\theight=\"240\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<source\n\t\t\t\t\t\t\t\tsrc=\"https://s.w.org/images/block-editor/editing-your-page.mp4\"\n\t\t\t\t\t\t\t\ttype=\"video/mp4\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</video>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-site-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ heading }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-site-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'It’s now possible to edit page content in the site editor. To customise other parts of the page like the header and footer switch to editing the template using the settings sidebar.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\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}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAAmE,IAAAI,WAAA,GAAAJ,OAAA;AANnE;AACA;AACA;;AAMe,SAASK,gBAAgBA,CAAA,EAAG;EAC1C,MAAM;IAAEC;EAAO,CAAC,GAAG,IAAAC,iBAAW,EAAEC,kBAAiB,CAAC;EAElD,MAAMC,SAAS,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC1C,MAAMC,YAAY,GAAG,CAAC,CAAED,MAAM,CAAEH,kBAAiB,CAAC,CAACK,GAAG,CACrD,gBAAgB,EAChB,kBACD,CAAC;IACD,MAAMC,cAAc,GAAG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"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -10,25 +9,15 @@ var _components = require("@wordpress/components");
|
|
|
10
9
|
var _i18n = require("@wordpress/i18n");
|
|
11
10
|
var _preferences = require("@wordpress/preferences");
|
|
12
11
|
var _editor = require("@wordpress/editor");
|
|
13
|
-
var _useEditedEntityRecord = _interopRequireDefault(require("../use-edited-entity-record"));
|
|
14
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
13
|
/**
|
|
16
14
|
* WordPress dependencies
|
|
17
15
|
*/
|
|
18
16
|
|
|
19
|
-
/**
|
|
20
|
-
* Internal dependencies
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
17
|
function WelcomeGuideTemplate() {
|
|
24
18
|
const {
|
|
25
19
|
toggle
|
|
26
20
|
} = (0, _data.useDispatch)(_preferences.store);
|
|
27
|
-
const {
|
|
28
|
-
isLoaded,
|
|
29
|
-
record
|
|
30
|
-
} = (0, _useEditedEntityRecord.default)();
|
|
31
|
-
const isPostTypeTemplate = isLoaded && record.type === 'wp_template';
|
|
32
21
|
const {
|
|
33
22
|
isActive,
|
|
34
23
|
hasPreviousEntity
|
|
@@ -44,7 +33,7 @@ function WelcomeGuideTemplate() {
|
|
|
44
33
|
hasPreviousEntity: !!getEditorSettings().onNavigateToPreviousEntityRecord
|
|
45
34
|
};
|
|
46
35
|
}, []);
|
|
47
|
-
const isVisible = isActive &&
|
|
36
|
+
const isVisible = isActive && hasPreviousEntity;
|
|
48
37
|
if (!isVisible) {
|
|
49
38
|
return null;
|
|
50
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_components","_i18n","_preferences","_editor","
|
|
1
|
+
{"version":3,"names":["_data","require","_components","_i18n","_preferences","_editor","_jsxRuntime","WelcomeGuideTemplate","toggle","useDispatch","preferencesStore","isActive","hasPreviousEntity","useSelect","select","getEditorSettings","editorStore","get","onNavigateToPreviousEntityRecord","isVisible","heading","__","jsx","Guide","className","contentLabel","finishButtonText","onFinish","pages","image","autoPlay","loop","muted","width","height","children","src","type","content","jsxs","Fragment"],"sources":["@wordpress/edit-site/src/components/welcome-guide/template.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Guide } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\n\nexport default function WelcomeGuideTemplate() {\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\tconst { isActive, hasPreviousEntity } = useSelect( ( select ) => {\n\t\tconst { getEditorSettings } = select( editorStore );\n\t\tconst { get } = select( preferencesStore );\n\t\treturn {\n\t\t\tisActive: get( 'core/edit-site', 'welcomeGuideTemplate' ),\n\t\t\thasPreviousEntity:\n\t\t\t\t!! getEditorSettings().onNavigateToPreviousEntityRecord,\n\t\t};\n\t}, [] );\n\tconst isVisible = isActive && hasPreviousEntity;\n\n\tif ( ! isVisible ) {\n\t\treturn null;\n\t}\n\n\tconst heading = __( 'Editing a template' );\n\n\treturn (\n\t\t<Guide\n\t\t\tclassName=\"edit-site-welcome-guide guide-template\"\n\t\t\tcontentLabel={ heading }\n\t\t\tfinishButtonText={ __( 'Continue' ) }\n\t\t\tonFinish={ () =>\n\t\t\t\ttoggle( 'core/edit-site', 'welcomeGuideTemplate' )\n\t\t\t}\n\t\t\tpages={ [\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<video\n\t\t\t\t\t\t\tclassName=\"edit-site-welcome-guide__video\"\n\t\t\t\t\t\t\tautoPlay\n\t\t\t\t\t\t\tloop\n\t\t\t\t\t\t\tmuted\n\t\t\t\t\t\t\twidth=\"312\"\n\t\t\t\t\t\t\theight=\"240\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<source\n\t\t\t\t\t\t\t\tsrc=\"https://s.w.org/images/block-editor/editing-your-template.mp4\"\n\t\t\t\t\t\t\t\ttype=\"video/mp4\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</video>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-site-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ heading }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-site-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'Note that the same template can be used by multiple pages, so any changes made here may affect other pages on the site. To switch back to editing the page content click the ‘Back’ button in the toolbar.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\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}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAAyD,IAAAK,WAAA,GAAAL,OAAA;AAPzD;AACA;AACA;;AAOe,SAASM,oBAAoBA,CAAA,EAAG;EAC9C,MAAM;IAAEC;EAAO,CAAC,GAAG,IAAAC,iBAAW,EAAEC,kBAAiB,CAAC;EAElD,MAAM;IAAEC,QAAQ;IAAEC;EAAkB,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAChE,MAAM;MAAEC;IAAkB,CAAC,GAAGD,MAAM,CAAEE,aAAY,CAAC;IACnD,MAAM;MAAEC;IAAI,CAAC,GAAGH,MAAM,CAAEJ,kBAAiB,CAAC;IAC1C,OAAO;MACNC,QAAQ,EAAEM,GAAG,CAAE,gBAAgB,EAAE,sBAAuB,CAAC;MACzDL,i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,
|
|
31
31
|
useLocation
|
|
32
32
|
} = (0, _lockUnlock.unlock)(_router.privateApis);
|
|
33
|
-
function useGlobalStylesOpenStylesCommands() {
|
|
33
|
+
const getGlobalStylesOpenStylesCommands = () => function useGlobalStylesOpenStylesCommands() {
|
|
34
34
|
const {
|
|
35
35
|
openGeneralSidebar
|
|
36
36
|
} = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_store.store));
|
|
@@ -78,8 +78,8 @@ function useGlobalStylesOpenStylesCommands() {
|
|
|
78
78
|
isLoading: false,
|
|
79
79
|
commands
|
|
80
80
|
};
|
|
81
|
-
}
|
|
82
|
-
function useGlobalStylesToggleWelcomeGuideCommands() {
|
|
81
|
+
};
|
|
82
|
+
const getGlobalStylesToggleWelcomeGuideCommands = () => function useGlobalStylesToggleWelcomeGuideCommands() {
|
|
83
83
|
const {
|
|
84
84
|
openGeneralSidebar
|
|
85
85
|
} = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_store.store));
|
|
@@ -136,8 +136,8 @@ function useGlobalStylesToggleWelcomeGuideCommands() {
|
|
|
136
136
|
isLoading: false,
|
|
137
137
|
commands
|
|
138
138
|
};
|
|
139
|
-
}
|
|
140
|
-
function useGlobalStylesResetCommands() {
|
|
139
|
+
};
|
|
140
|
+
const getGlobalStylesResetCommands = () => function useGlobalStylesResetCommands() {
|
|
141
141
|
const [canReset, onReset] = useGlobalStylesReset();
|
|
142
142
|
const commands = (0, _element.useMemo)(() => {
|
|
143
143
|
if (!canReset) {
|
|
@@ -159,8 +159,8 @@ function useGlobalStylesResetCommands() {
|
|
|
159
159
|
isLoading: false,
|
|
160
160
|
commands
|
|
161
161
|
};
|
|
162
|
-
}
|
|
163
|
-
function useGlobalStylesOpenCssCommands() {
|
|
162
|
+
};
|
|
163
|
+
const getGlobalStylesOpenCssCommands = () => function useGlobalStylesOpenCssCommands() {
|
|
164
164
|
const {
|
|
165
165
|
openGeneralSidebar,
|
|
166
166
|
setEditorCanvasContainerView
|
|
@@ -220,8 +220,8 @@ function useGlobalStylesOpenCssCommands() {
|
|
|
220
220
|
isLoading: false,
|
|
221
221
|
commands
|
|
222
222
|
};
|
|
223
|
-
}
|
|
224
|
-
function useGlobalStylesOpenRevisionsCommands() {
|
|
223
|
+
};
|
|
224
|
+
const getGlobalStylesOpenRevisionsCommands = () => function useGlobalStylesOpenRevisionsCommands() {
|
|
225
225
|
const {
|
|
226
226
|
openGeneralSidebar,
|
|
227
227
|
setEditorCanvasContainerView
|
|
@@ -277,7 +277,7 @@ function useGlobalStylesOpenRevisionsCommands() {
|
|
|
277
277
|
isLoading: false,
|
|
278
278
|
commands
|
|
279
279
|
};
|
|
280
|
-
}
|
|
280
|
+
};
|
|
281
281
|
function useCommonCommands() {
|
|
282
282
|
const homeUrl = (0, _data.useSelect)(select => {
|
|
283
283
|
// Site index.
|
|
@@ -296,23 +296,23 @@ function useCommonCommands() {
|
|
|
296
296
|
});
|
|
297
297
|
(0, _commands.useCommandLoader)({
|
|
298
298
|
name: 'core/edit-site/open-styles',
|
|
299
|
-
hook:
|
|
299
|
+
hook: getGlobalStylesOpenStylesCommands()
|
|
300
300
|
});
|
|
301
301
|
(0, _commands.useCommandLoader)({
|
|
302
302
|
name: 'core/edit-site/toggle-styles-welcome-guide',
|
|
303
|
-
hook:
|
|
303
|
+
hook: getGlobalStylesToggleWelcomeGuideCommands()
|
|
304
304
|
});
|
|
305
305
|
(0, _commands.useCommandLoader)({
|
|
306
306
|
name: 'core/edit-site/reset-global-styles',
|
|
307
|
-
hook:
|
|
307
|
+
hook: getGlobalStylesResetCommands()
|
|
308
308
|
});
|
|
309
309
|
(0, _commands.useCommandLoader)({
|
|
310
310
|
name: 'core/edit-site/open-styles-css',
|
|
311
|
-
hook:
|
|
311
|
+
hook: getGlobalStylesOpenCssCommands()
|
|
312
312
|
});
|
|
313
313
|
(0, _commands.useCommandLoader)({
|
|
314
314
|
name: 'core/edit-site/open-styles-revisions',
|
|
315
|
-
hook:
|
|
315
|
+
hook: getGlobalStylesOpenRevisionsCommands()
|
|
316
316
|
});
|
|
317
317
|
}
|
|
318
318
|
//# sourceMappingURL=use-common-commands.js.map
|