@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
|
@@ -62,6 +62,114 @@ function getColorExamples( colors: MultiOriginPalettes ): BlockExample[] {
|
|
|
62
62
|
return examples;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
/**
|
|
66
|
+
* Returns examples for the overview page.
|
|
67
|
+
*
|
|
68
|
+
* @param {MultiOriginPalettes} colors Global Styles color palettes per origin.
|
|
69
|
+
* @return {BlockExample[]} An array of block examples.
|
|
70
|
+
*/
|
|
71
|
+
function getOverviewBlockExamples(
|
|
72
|
+
colors: MultiOriginPalettes
|
|
73
|
+
): BlockExample[] {
|
|
74
|
+
const examples: BlockExample[] = [];
|
|
75
|
+
|
|
76
|
+
// Get theme palette from colors.
|
|
77
|
+
const themePalette = colors.colors.find(
|
|
78
|
+
( origin: ColorOrigin ) => origin.slug === 'theme'
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
if ( themePalette ) {
|
|
82
|
+
const themeColorexample: BlockExample = {
|
|
83
|
+
name: 'theme-colors',
|
|
84
|
+
title: __( 'Colors' ),
|
|
85
|
+
category: 'overview',
|
|
86
|
+
content: (
|
|
87
|
+
<ColorExamples colors={ themePalette.colors } type={ colors } />
|
|
88
|
+
),
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
examples.push( themeColorexample );
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const headingBlock = createBlock( 'core/heading', {
|
|
95
|
+
content: __(
|
|
96
|
+
`AaBbCcDdEeFfGgHhiiJjKkLIMmNnOoPpQakRrssTtUuVVWwXxxYyZzOl23356789X{(…)},2!*&:/A@HELFO™`
|
|
97
|
+
),
|
|
98
|
+
level: 1,
|
|
99
|
+
} );
|
|
100
|
+
const firstParagraphBlock = createBlock( 'core/paragraph', {
|
|
101
|
+
content: __(
|
|
102
|
+
`A paragraph in a website refers to a distinct block of text that is used to present and organize information. It is a fundamental unit of content in web design and is typically composed of a group of related sentences or thoughts focused on a particular topic or idea. Paragraphs play a crucial role in improving the readability and user experience of a website. They break down the text into smaller, manageable chunks, allowing readers to scan the content more easily.`
|
|
103
|
+
),
|
|
104
|
+
} );
|
|
105
|
+
const secondParagraphBlock = createBlock( 'core/paragraph', {
|
|
106
|
+
content: __(
|
|
107
|
+
`Additionally, paragraphs help structure the flow of information and provide logical breaks between different concepts or pieces of information. In terms of formatting, paragraphs in websites are commonly denoted by a vertical gap or indentation between each block of text. This visual separation helps visually distinguish one paragraph from another, creating a clear and organized layout that guides the reader through the content smoothly.`
|
|
108
|
+
),
|
|
109
|
+
} );
|
|
110
|
+
|
|
111
|
+
const textExample = {
|
|
112
|
+
name: 'typography',
|
|
113
|
+
title: __( 'Typography' ),
|
|
114
|
+
category: 'overview',
|
|
115
|
+
blocks: [
|
|
116
|
+
headingBlock,
|
|
117
|
+
createBlock(
|
|
118
|
+
'core/group',
|
|
119
|
+
{
|
|
120
|
+
layout: {
|
|
121
|
+
type: 'grid',
|
|
122
|
+
columnCount: 2,
|
|
123
|
+
minimumColumnWidth: '12rem',
|
|
124
|
+
},
|
|
125
|
+
style: {
|
|
126
|
+
spacing: {
|
|
127
|
+
blockGap: '1.5rem',
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
[ firstParagraphBlock, secondParagraphBlock ]
|
|
132
|
+
),
|
|
133
|
+
],
|
|
134
|
+
};
|
|
135
|
+
examples.push( textExample );
|
|
136
|
+
|
|
137
|
+
const otherBlockExamples = [
|
|
138
|
+
'core/image',
|
|
139
|
+
'core/separator',
|
|
140
|
+
'core/buttons',
|
|
141
|
+
'core/pullquote',
|
|
142
|
+
'core/search',
|
|
143
|
+
];
|
|
144
|
+
|
|
145
|
+
// Get examples for other blocks and put them in order of above array.
|
|
146
|
+
otherBlockExamples.forEach( ( blockName ) => {
|
|
147
|
+
const blockType = getBlockType( blockName );
|
|
148
|
+
if ( blockType && blockType.example ) {
|
|
149
|
+
const blockExample: BlockExample = {
|
|
150
|
+
name: blockName,
|
|
151
|
+
title: blockType.title,
|
|
152
|
+
category: 'overview',
|
|
153
|
+
/*
|
|
154
|
+
* CSS generated from style attributes will take precedence over global styles CSS,
|
|
155
|
+
* so remove the style attribute from the example to ensure the example
|
|
156
|
+
* demonstrates changes to global styles.
|
|
157
|
+
*/
|
|
158
|
+
blocks: getBlockFromExample( blockName, {
|
|
159
|
+
...blockType.example,
|
|
160
|
+
attributes: {
|
|
161
|
+
...blockType.example.attributes,
|
|
162
|
+
style: undefined,
|
|
163
|
+
},
|
|
164
|
+
} ),
|
|
165
|
+
};
|
|
166
|
+
examples.push( blockExample );
|
|
167
|
+
}
|
|
168
|
+
} );
|
|
169
|
+
|
|
170
|
+
return examples;
|
|
171
|
+
}
|
|
172
|
+
|
|
65
173
|
/**
|
|
66
174
|
* Returns a list of examples for registered block types.
|
|
67
175
|
*
|
|
@@ -82,7 +190,18 @@ export function getExamples( colors: MultiOriginPalettes ): BlockExample[] {
|
|
|
82
190
|
name: blockType.name,
|
|
83
191
|
title: blockType.title,
|
|
84
192
|
category: blockType.category,
|
|
85
|
-
|
|
193
|
+
/*
|
|
194
|
+
* CSS generated from style attributes will take precedence over global styles CSS,
|
|
195
|
+
* so remove the style attribute from the example to ensure the example
|
|
196
|
+
* demonstrates changes to global styles.
|
|
197
|
+
*/
|
|
198
|
+
blocks: getBlockFromExample( blockType.name, {
|
|
199
|
+
...blockType.example,
|
|
200
|
+
attributes: {
|
|
201
|
+
...blockType.example.attributes,
|
|
202
|
+
style: undefined,
|
|
203
|
+
},
|
|
204
|
+
} ),
|
|
86
205
|
} ) );
|
|
87
206
|
const isHeadingBlockRegistered = !! getBlockType( 'core/heading' );
|
|
88
207
|
|
|
@@ -109,5 +228,12 @@ export function getExamples( colors: MultiOriginPalettes ): BlockExample[] {
|
|
|
109
228
|
};
|
|
110
229
|
const colorExamples = getColorExamples( colors );
|
|
111
230
|
|
|
112
|
-
|
|
231
|
+
const overviewBlockExamples = getOverviewBlockExamples( colors );
|
|
232
|
+
|
|
233
|
+
return [
|
|
234
|
+
headingsExample,
|
|
235
|
+
...colorExamples,
|
|
236
|
+
...nonHeadingBlockExamples,
|
|
237
|
+
...overviewBlockExamples,
|
|
238
|
+
];
|
|
113
239
|
}
|
|
@@ -24,7 +24,14 @@ import {
|
|
|
24
24
|
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
25
25
|
import { useSelect } from '@wordpress/data';
|
|
26
26
|
import { useResizeObserver } from '@wordpress/compose';
|
|
27
|
-
import {
|
|
27
|
+
import {
|
|
28
|
+
useMemo,
|
|
29
|
+
useState,
|
|
30
|
+
memo,
|
|
31
|
+
useContext,
|
|
32
|
+
useRef,
|
|
33
|
+
useLayoutEffect,
|
|
34
|
+
} from '@wordpress/element';
|
|
28
35
|
import { ENTER, SPACE } from '@wordpress/keycodes';
|
|
29
36
|
|
|
30
37
|
/**
|
|
@@ -53,6 +60,48 @@ function isObjectEmpty( object ) {
|
|
|
53
60
|
return ! object || Object.keys( object ).length === 0;
|
|
54
61
|
}
|
|
55
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Scrolls to a section within an iframe.
|
|
65
|
+
*
|
|
66
|
+
* @param {string} anchorId The id of the element to scroll to.
|
|
67
|
+
* @param {HTMLIFrameElement} iframe The target iframe.
|
|
68
|
+
*/
|
|
69
|
+
const scrollToSection = ( anchorId, iframe ) => {
|
|
70
|
+
if ( ! iframe || ! iframe?.contentDocument ) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const element = iframe.contentDocument.getElementById( anchorId );
|
|
75
|
+
if ( element ) {
|
|
76
|
+
element.scrollIntoView( {
|
|
77
|
+
behavior: 'smooth',
|
|
78
|
+
} );
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Parses a Block Editor navigation path to extract the block name and
|
|
84
|
+
* build a style book navigation path. The object can be extended to include a category,
|
|
85
|
+
* representing a style book tab/section.
|
|
86
|
+
*
|
|
87
|
+
* @param {string} path An internal Block Editor navigation path.
|
|
88
|
+
* @return {null|{block: string}} An object containing the example to navigate to.
|
|
89
|
+
*/
|
|
90
|
+
const getStyleBookNavigationFromPath = ( path ) => {
|
|
91
|
+
if ( path && typeof path === 'string' ) {
|
|
92
|
+
let block = path.includes( '/blocks/' )
|
|
93
|
+
? decodeURIComponent( path.split( '/blocks/' )[ 1 ] )
|
|
94
|
+
: null;
|
|
95
|
+
// Default to theme-colors if the path ends with /colors.
|
|
96
|
+
block = path.endsWith( '/colors' ) ? 'theme-colors' : block;
|
|
97
|
+
|
|
98
|
+
return {
|
|
99
|
+
block,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
return null;
|
|
103
|
+
};
|
|
104
|
+
|
|
56
105
|
/**
|
|
57
106
|
* Retrieves colors, gradients, and duotone filters from Global Styles.
|
|
58
107
|
* The inclusion of default (Core) palettes is controlled by the relevant
|
|
@@ -137,6 +186,7 @@ function StyleBook( {
|
|
|
137
186
|
onClose,
|
|
138
187
|
showTabs = true,
|
|
139
188
|
userConfig = {},
|
|
189
|
+
path = '',
|
|
140
190
|
} ) {
|
|
141
191
|
const [ resizeObserver, sizes ] = useResizeObserver();
|
|
142
192
|
const [ textColor ] = useGlobalStyle( 'color.text' );
|
|
@@ -153,7 +203,24 @@ function StyleBook( {
|
|
|
153
203
|
[ examples ]
|
|
154
204
|
);
|
|
155
205
|
|
|
206
|
+
const examplesForSinglePageUse = [];
|
|
207
|
+
const overviewCategoryExamples = getExamplesByCategory(
|
|
208
|
+
{ slug: 'overview' },
|
|
209
|
+
examples
|
|
210
|
+
);
|
|
211
|
+
examplesForSinglePageUse.push( ...overviewCategoryExamples.examples );
|
|
212
|
+
const otherExamples = examples.filter( ( example ) => {
|
|
213
|
+
return (
|
|
214
|
+
example.category !== 'overview' &&
|
|
215
|
+
! overviewCategoryExamples.examples.find(
|
|
216
|
+
( overviewExample ) => overviewExample.name === example.name
|
|
217
|
+
)
|
|
218
|
+
);
|
|
219
|
+
} );
|
|
220
|
+
examplesForSinglePageUse.push( ...otherExamples );
|
|
221
|
+
|
|
156
222
|
const { base: baseConfig } = useContext( GlobalStylesContext );
|
|
223
|
+
const goTo = getStyleBookNavigationFromPath( path );
|
|
157
224
|
|
|
158
225
|
const mergedConfig = useMemo( () => {
|
|
159
226
|
if ( ! isObjectEmpty( userConfig ) && ! isObjectEmpty( baseConfig ) ) {
|
|
@@ -228,18 +295,20 @@ function StyleBook( {
|
|
|
228
295
|
settings={ settings }
|
|
229
296
|
sizes={ sizes }
|
|
230
297
|
title={ tab.title }
|
|
298
|
+
goTo={ goTo }
|
|
231
299
|
/>
|
|
232
300
|
</Tabs.TabPanel>
|
|
233
301
|
) ) }
|
|
234
302
|
</Tabs>
|
|
235
303
|
) : (
|
|
236
304
|
<StyleBookBody
|
|
237
|
-
examples={
|
|
305
|
+
examples={ examplesForSinglePageUse }
|
|
238
306
|
isSelected={ isSelected }
|
|
239
307
|
onClick={ onClick }
|
|
240
308
|
onSelect={ onSelect }
|
|
241
309
|
settings={ settings }
|
|
242
310
|
sizes={ sizes }
|
|
311
|
+
goTo={ goTo }
|
|
243
312
|
/>
|
|
244
313
|
) }
|
|
245
314
|
</div>
|
|
@@ -256,9 +325,11 @@ const StyleBookBody = ( {
|
|
|
256
325
|
settings,
|
|
257
326
|
sizes,
|
|
258
327
|
title,
|
|
328
|
+
goTo,
|
|
259
329
|
} ) => {
|
|
260
330
|
const [ isFocused, setIsFocused ] = useState( false );
|
|
261
|
-
|
|
331
|
+
const [ hasIframeLoaded, setHasIframeLoaded ] = useState( false );
|
|
332
|
+
const iframeRef = useRef( null );
|
|
262
333
|
// The presence of an `onClick` prop indicates that the Style Book is being used as a button.
|
|
263
334
|
// In this case, add additional props to the iframe to make it behave like a button.
|
|
264
335
|
const buttonModeProps = {
|
|
@@ -287,8 +358,17 @@ const StyleBookBody = ( {
|
|
|
287
358
|
readonly: true,
|
|
288
359
|
};
|
|
289
360
|
|
|
361
|
+
const handleLoad = () => setHasIframeLoaded( true );
|
|
362
|
+
useLayoutEffect( () => {
|
|
363
|
+
if ( goTo?.block && hasIframeLoaded && iframeRef?.current ) {
|
|
364
|
+
scrollToSection( `example-${ goTo?.block }`, iframeRef?.current );
|
|
365
|
+
}
|
|
366
|
+
}, [ iframeRef?.current, goTo?.block, scrollToSection, hasIframeLoaded ] );
|
|
367
|
+
|
|
290
368
|
return (
|
|
291
369
|
<Iframe
|
|
370
|
+
onLoad={ handleLoad }
|
|
371
|
+
ref={ iframeRef }
|
|
292
372
|
className={ clsx( 'edit-site-style-book__iframe', {
|
|
293
373
|
'is-focused': isFocused && !! onClick,
|
|
294
374
|
'is-button': !! onClick,
|
|
@@ -353,10 +433,8 @@ const Examples = memo(
|
|
|
353
433
|
title={ example.title }
|
|
354
434
|
content={ example.content }
|
|
355
435
|
blocks={ example.blocks }
|
|
356
|
-
isSelected={ isSelected( example.name ) }
|
|
357
|
-
onClick={ () =>
|
|
358
|
-
onSelect?.( example.name );
|
|
359
|
-
} }
|
|
436
|
+
isSelected={ isSelected?.( example.name ) }
|
|
437
|
+
onClick={ () => onSelect?.( example.name ) }
|
|
360
438
|
/>
|
|
361
439
|
) ) }
|
|
362
440
|
{ !! filteredExamples?.subcategories?.length &&
|
|
@@ -392,7 +470,7 @@ const Subcategory = ( { examples, isSelected, onSelect } ) => {
|
|
|
392
470
|
title={ example.title }
|
|
393
471
|
content={ example.content }
|
|
394
472
|
blocks={ example.blocks }
|
|
395
|
-
isSelected={ isSelected( example.name ) }
|
|
473
|
+
isSelected={ isSelected?.( example.name ) }
|
|
396
474
|
onClick={ () => {
|
|
397
475
|
onSelect?.( example.name );
|
|
398
476
|
} }
|
|
@@ -6,13 +6,13 @@ import WelcomeGuideStyles from './styles';
|
|
|
6
6
|
import WelcomeGuidePage from './page';
|
|
7
7
|
import WelcomeGuideTemplate from './template';
|
|
8
8
|
|
|
9
|
-
export default function WelcomeGuide() {
|
|
9
|
+
export default function WelcomeGuide( { postType } ) {
|
|
10
10
|
return (
|
|
11
11
|
<>
|
|
12
12
|
<WelcomeGuideEditor />
|
|
13
13
|
<WelcomeGuideStyles />
|
|
14
|
-
<WelcomeGuidePage />
|
|
15
|
-
<WelcomeGuideTemplate />
|
|
14
|
+
{ postType === 'page' && <WelcomeGuidePage /> }
|
|
15
|
+
{ postType === 'wp_template' && <WelcomeGuideTemplate /> }
|
|
16
16
|
</>
|
|
17
17
|
);
|
|
18
18
|
}
|
|
@@ -6,11 +6,6 @@ import { Guide } from '@wordpress/components';
|
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
7
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
* Internal dependencies
|
|
11
|
-
*/
|
|
12
|
-
import { store as editSiteStore } from '../../store';
|
|
13
|
-
|
|
14
9
|
export default function WelcomeGuidePage() {
|
|
15
10
|
const { toggle } = useDispatch( preferencesStore );
|
|
16
11
|
|
|
@@ -23,8 +18,7 @@ export default function WelcomeGuidePage() {
|
|
|
23
18
|
'core/edit-site',
|
|
24
19
|
'welcomeGuide'
|
|
25
20
|
);
|
|
26
|
-
|
|
27
|
-
return isPageActive && ! isEditorActive && isPage();
|
|
21
|
+
return isPageActive && ! isEditorActive;
|
|
28
22
|
}, [] );
|
|
29
23
|
|
|
30
24
|
if ( ! isVisible ) {
|
|
@@ -7,16 +7,9 @@ import { __ } from '@wordpress/i18n';
|
|
|
7
7
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
8
8
|
import { store as editorStore } from '@wordpress/editor';
|
|
9
9
|
|
|
10
|
-
/**
|
|
11
|
-
* Internal dependencies
|
|
12
|
-
*/
|
|
13
|
-
import useEditedEntityRecord from '../use-edited-entity-record';
|
|
14
|
-
|
|
15
10
|
export default function WelcomeGuideTemplate() {
|
|
16
11
|
const { toggle } = useDispatch( preferencesStore );
|
|
17
12
|
|
|
18
|
-
const { isLoaded, record } = useEditedEntityRecord();
|
|
19
|
-
const isPostTypeTemplate = isLoaded && record.type === 'wp_template';
|
|
20
13
|
const { isActive, hasPreviousEntity } = useSelect( ( select ) => {
|
|
21
14
|
const { getEditorSettings } = select( editorStore );
|
|
22
15
|
const { get } = select( preferencesStore );
|
|
@@ -26,7 +19,7 @@ export default function WelcomeGuideTemplate() {
|
|
|
26
19
|
!! getEditorSettings().onNavigateToPreviousEntityRecord,
|
|
27
20
|
};
|
|
28
21
|
}, [] );
|
|
29
|
-
const isVisible = isActive &&
|
|
22
|
+
const isVisible = isActive && hasPreviousEntity;
|
|
30
23
|
|
|
31
24
|
if ( ! isVisible ) {
|
|
32
25
|
return null;
|