@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
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import PostList from '../post-list';
|
|
10
|
+
import DataViewsSidebarContent from '../sidebar-dataviews';
|
|
11
|
+
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
12
|
+
import Editor from '../editor';
|
|
13
|
+
|
|
14
|
+
export const postsEditRoute = {
|
|
15
|
+
name: 'posts-edit',
|
|
16
|
+
match: ( params ) => {
|
|
17
|
+
return params.postType === 'post' && params.canvas === 'edit';
|
|
18
|
+
},
|
|
19
|
+
areas: {
|
|
20
|
+
sidebar: (
|
|
21
|
+
<SidebarNavigationScreen
|
|
22
|
+
title={ __( 'Posts' ) }
|
|
23
|
+
isRoot
|
|
24
|
+
content={ <DataViewsSidebarContent /> }
|
|
25
|
+
/>
|
|
26
|
+
),
|
|
27
|
+
content: <PostList postType="post" />,
|
|
28
|
+
mobile: <Editor isPostsList />,
|
|
29
|
+
preview: <Editor isPostsList />,
|
|
30
|
+
},
|
|
31
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import PostList from '../post-list';
|
|
11
|
+
import DataViewsSidebarContent from '../sidebar-dataviews';
|
|
12
|
+
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
13
|
+
import { unlock } from '../../lock-unlock';
|
|
14
|
+
import { PostEdit } from '../post-edit';
|
|
15
|
+
import Editor from '../editor';
|
|
16
|
+
|
|
17
|
+
const { useLocation } = unlock( routerPrivateApis );
|
|
18
|
+
|
|
19
|
+
function PostQuickEdit() {
|
|
20
|
+
const { params } = useLocation();
|
|
21
|
+
return <PostEdit postType="post" postId={ params.postId } />;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const postsListViewQuickEditRoute = {
|
|
25
|
+
name: 'posts-list-view-quick-edit',
|
|
26
|
+
match: ( params ) => {
|
|
27
|
+
return (
|
|
28
|
+
params.isCustom !== 'true' &&
|
|
29
|
+
( params.layout ?? 'list' ) === 'list' &&
|
|
30
|
+
!! params.quickEdit &&
|
|
31
|
+
params.postType === 'post' &&
|
|
32
|
+
params.canvas !== 'edit'
|
|
33
|
+
);
|
|
34
|
+
},
|
|
35
|
+
areas: {
|
|
36
|
+
sidebar: (
|
|
37
|
+
<SidebarNavigationScreen
|
|
38
|
+
title={ __( 'Posts' ) }
|
|
39
|
+
isRoot
|
|
40
|
+
content={ <DataViewsSidebarContent /> }
|
|
41
|
+
/>
|
|
42
|
+
),
|
|
43
|
+
content: <PostList postType="post" />,
|
|
44
|
+
mobile: <PostList postType="post" />,
|
|
45
|
+
preview: <Editor />,
|
|
46
|
+
edit: <PostQuickEdit />,
|
|
47
|
+
},
|
|
48
|
+
widths: {
|
|
49
|
+
content: 380,
|
|
50
|
+
edit: 380,
|
|
51
|
+
},
|
|
52
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import PostList from '../post-list';
|
|
10
|
+
import DataViewsSidebarContent from '../sidebar-dataviews';
|
|
11
|
+
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
12
|
+
import Editor from '../editor';
|
|
13
|
+
|
|
14
|
+
export const postsListViewRoute = {
|
|
15
|
+
name: 'posts-list-view',
|
|
16
|
+
match: ( params ) => {
|
|
17
|
+
return (
|
|
18
|
+
params.isCustom !== 'true' &&
|
|
19
|
+
( params.layout ?? 'list' ) === 'list' &&
|
|
20
|
+
! params.quickEdit &&
|
|
21
|
+
params.postType === 'post' &&
|
|
22
|
+
params.canvas !== 'edit'
|
|
23
|
+
);
|
|
24
|
+
},
|
|
25
|
+
areas: {
|
|
26
|
+
sidebar: (
|
|
27
|
+
<SidebarNavigationScreen
|
|
28
|
+
title={ __( 'Posts' ) }
|
|
29
|
+
isRoot
|
|
30
|
+
content={ <DataViewsSidebarContent /> }
|
|
31
|
+
/>
|
|
32
|
+
),
|
|
33
|
+
content: <PostList postType="post" />,
|
|
34
|
+
preview: <Editor isPostsList />,
|
|
35
|
+
mobile: <PostList postType="post" />,
|
|
36
|
+
},
|
|
37
|
+
widths: {
|
|
38
|
+
content: 380,
|
|
39
|
+
},
|
|
40
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import PostList from '../post-list';
|
|
11
|
+
import DataViewsSidebarContent from '../sidebar-dataviews';
|
|
12
|
+
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
13
|
+
import { unlock } from '../../lock-unlock';
|
|
14
|
+
import { PostEdit } from '../post-edit';
|
|
15
|
+
|
|
16
|
+
const { useLocation } = unlock( routerPrivateApis );
|
|
17
|
+
|
|
18
|
+
function PostQuickEdit() {
|
|
19
|
+
const { params } = useLocation();
|
|
20
|
+
return <PostEdit postType="post" postId={ params.postId } />;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const postsViewQuickEditRoute = {
|
|
24
|
+
name: 'posts-view-quick-edit',
|
|
25
|
+
match: ( params ) => {
|
|
26
|
+
return (
|
|
27
|
+
( params.isCustom === 'true' ||
|
|
28
|
+
( params.layout ?? 'list' ) !== 'list' ) &&
|
|
29
|
+
!! params.quickEdit &&
|
|
30
|
+
params.postType === 'post' &&
|
|
31
|
+
params.canvas !== 'edit'
|
|
32
|
+
);
|
|
33
|
+
},
|
|
34
|
+
areas: {
|
|
35
|
+
sidebar: (
|
|
36
|
+
<SidebarNavigationScreen
|
|
37
|
+
title={ __( 'Posts' ) }
|
|
38
|
+
isRoot
|
|
39
|
+
content={ <DataViewsSidebarContent /> }
|
|
40
|
+
/>
|
|
41
|
+
),
|
|
42
|
+
content: <PostList postType="post" />,
|
|
43
|
+
mobile: <PostList postType="post" />,
|
|
44
|
+
edit: <PostQuickEdit />,
|
|
45
|
+
},
|
|
46
|
+
widths: {
|
|
47
|
+
edit: 380,
|
|
48
|
+
},
|
|
49
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import PostList from '../post-list';
|
|
10
|
+
import DataViewsSidebarContent from '../sidebar-dataviews';
|
|
11
|
+
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
12
|
+
|
|
13
|
+
export const postsViewRoute = {
|
|
14
|
+
name: 'posts-view',
|
|
15
|
+
match: ( params ) => {
|
|
16
|
+
return (
|
|
17
|
+
( params.isCustom === 'true' ||
|
|
18
|
+
( params.layout ?? 'list' ) !== 'list' ) &&
|
|
19
|
+
! params.quickEdit &&
|
|
20
|
+
params.postType === 'post' &&
|
|
21
|
+
params.canvas !== 'edit'
|
|
22
|
+
);
|
|
23
|
+
},
|
|
24
|
+
areas: {
|
|
25
|
+
sidebar: (
|
|
26
|
+
<SidebarNavigationScreen
|
|
27
|
+
title={ __( 'Posts' ) }
|
|
28
|
+
isRoot
|
|
29
|
+
content={ <DataViewsSidebarContent /> }
|
|
30
|
+
/>
|
|
31
|
+
),
|
|
32
|
+
content: <PostList postType="post" />,
|
|
33
|
+
mobile: <PostList postType="post" />,
|
|
34
|
+
},
|
|
35
|
+
};
|
|
@@ -55,7 +55,7 @@ function createNavState() {
|
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
function SidebarContentWrapper( { children } ) {
|
|
58
|
+
function SidebarContentWrapper( { children, shouldAnimate } ) {
|
|
59
59
|
const navState = useContext( SidebarNavigationContext );
|
|
60
60
|
const wrapperRef = useRef();
|
|
61
61
|
const [ navAnimation, setNavAnimation ] = useState( null );
|
|
@@ -66,10 +66,19 @@ function SidebarContentWrapper( { children } ) {
|
|
|
66
66
|
setNavAnimation( direction );
|
|
67
67
|
}, [ navState ] );
|
|
68
68
|
|
|
69
|
-
const wrapperCls = clsx(
|
|
70
|
-
'
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
const wrapperCls = clsx(
|
|
70
|
+
'edit-site-sidebar__screen-wrapper',
|
|
71
|
+
/*
|
|
72
|
+
* Some panes do not have sub-panes and therefore
|
|
73
|
+
* should not animate when clicked on.
|
|
74
|
+
*/
|
|
75
|
+
shouldAnimate
|
|
76
|
+
? {
|
|
77
|
+
'slide-from-left': navAnimation === 'back',
|
|
78
|
+
'slide-from-right': navAnimation === 'forward',
|
|
79
|
+
}
|
|
80
|
+
: {}
|
|
81
|
+
);
|
|
73
82
|
|
|
74
83
|
return (
|
|
75
84
|
<div ref={ wrapperRef } className={ wrapperCls }>
|
|
@@ -78,13 +87,20 @@ function SidebarContentWrapper( { children } ) {
|
|
|
78
87
|
);
|
|
79
88
|
}
|
|
80
89
|
|
|
81
|
-
export default function SidebarContent( {
|
|
90
|
+
export default function SidebarContent( {
|
|
91
|
+
routeKey,
|
|
92
|
+
shouldAnimate,
|
|
93
|
+
children,
|
|
94
|
+
} ) {
|
|
82
95
|
const [ navState ] = useState( createNavState );
|
|
83
96
|
|
|
84
97
|
return (
|
|
85
98
|
<SidebarNavigationContext.Provider value={ navState }>
|
|
86
99
|
<div className="edit-site-sidebar__content">
|
|
87
|
-
<SidebarContentWrapper
|
|
100
|
+
<SidebarContentWrapper
|
|
101
|
+
shouldAnimate={ shouldAnimate }
|
|
102
|
+
key={ routeKey }
|
|
103
|
+
>
|
|
88
104
|
{ children }
|
|
89
105
|
</SidebarContentWrapper>
|
|
90
106
|
</div>
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { useMemo, useState } from '@wordpress/element';
|
|
6
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
7
|
+
import { useViewportMatch } from '@wordpress/compose';
|
|
8
|
+
import {
|
|
9
|
+
Button,
|
|
10
|
+
privateApis as componentsPrivateApis,
|
|
11
|
+
} from '@wordpress/components';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Internal dependencies
|
|
15
|
+
*/
|
|
16
|
+
import GlobalStylesUI from '../global-styles/ui';
|
|
17
|
+
import Page from '../page';
|
|
18
|
+
import { unlock } from '../../lock-unlock';
|
|
19
|
+
import StyleBook from '../style-book';
|
|
20
|
+
import { STYLE_BOOK_COLOR_GROUPS } from '../style-book/constants';
|
|
21
|
+
|
|
22
|
+
const { useLocation, useHistory } = unlock( routerPrivateApis );
|
|
23
|
+
const { Menu } = unlock( componentsPrivateApis );
|
|
24
|
+
const GLOBAL_STYLES_PATH_PREFIX = '/wp_global_styles';
|
|
25
|
+
|
|
26
|
+
const GlobalStylesPageActions = ( {
|
|
27
|
+
isStyleBookOpened,
|
|
28
|
+
setIsStyleBookOpened,
|
|
29
|
+
} ) => {
|
|
30
|
+
return (
|
|
31
|
+
<Menu
|
|
32
|
+
trigger={
|
|
33
|
+
<Button __next40pxDefaultSize variant="tertiary" size="compact">
|
|
34
|
+
{ __( 'Preview' ) }
|
|
35
|
+
</Button>
|
|
36
|
+
}
|
|
37
|
+
>
|
|
38
|
+
<Menu.RadioItem
|
|
39
|
+
value
|
|
40
|
+
checked={ isStyleBookOpened }
|
|
41
|
+
name="styles-preview-actions"
|
|
42
|
+
onChange={ () => setIsStyleBookOpened( true ) }
|
|
43
|
+
defaultChecked
|
|
44
|
+
>
|
|
45
|
+
<Menu.ItemLabel>{ __( 'Style book' ) }</Menu.ItemLabel>
|
|
46
|
+
<Menu.ItemHelpText>
|
|
47
|
+
{ __( 'Preview blocks and styles.' ) }
|
|
48
|
+
</Menu.ItemHelpText>
|
|
49
|
+
</Menu.RadioItem>
|
|
50
|
+
<Menu.RadioItem
|
|
51
|
+
value={ false }
|
|
52
|
+
checked={ ! isStyleBookOpened }
|
|
53
|
+
name="styles-preview-actions"
|
|
54
|
+
onChange={ () => setIsStyleBookOpened( false ) }
|
|
55
|
+
>
|
|
56
|
+
<Menu.ItemLabel>{ __( 'Site' ) }</Menu.ItemLabel>
|
|
57
|
+
<Menu.ItemHelpText>
|
|
58
|
+
{ __( 'Preview your site.' ) }
|
|
59
|
+
</Menu.ItemHelpText>
|
|
60
|
+
</Menu.RadioItem>
|
|
61
|
+
</Menu>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export default function GlobalStylesUIWrapper() {
|
|
66
|
+
const { params } = useLocation();
|
|
67
|
+
const history = useHistory();
|
|
68
|
+
const { canvas = 'view' } = params;
|
|
69
|
+
const [ isStyleBookOpened, setIsStyleBookOpened ] = useState( false );
|
|
70
|
+
const isMobileViewport = useViewportMatch( 'medium', '<' );
|
|
71
|
+
const pathWithPrefix = params.path;
|
|
72
|
+
const [ path, onPathChange ] = useMemo( () => {
|
|
73
|
+
const processedPath = pathWithPrefix.substring(
|
|
74
|
+
GLOBAL_STYLES_PATH_PREFIX.length
|
|
75
|
+
);
|
|
76
|
+
return [
|
|
77
|
+
processedPath ? processedPath : '/',
|
|
78
|
+
( newPath ) => {
|
|
79
|
+
history.push( {
|
|
80
|
+
path:
|
|
81
|
+
! newPath || newPath === '/'
|
|
82
|
+
? GLOBAL_STYLES_PATH_PREFIX
|
|
83
|
+
: `${ GLOBAL_STYLES_PATH_PREFIX }${ newPath }`,
|
|
84
|
+
} );
|
|
85
|
+
},
|
|
86
|
+
];
|
|
87
|
+
}, [ pathWithPrefix, history ] );
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<>
|
|
91
|
+
<Page
|
|
92
|
+
actions={
|
|
93
|
+
! isMobileViewport ? (
|
|
94
|
+
<GlobalStylesPageActions
|
|
95
|
+
isStyleBookOpened={ isStyleBookOpened }
|
|
96
|
+
setIsStyleBookOpened={ setIsStyleBookOpened }
|
|
97
|
+
/>
|
|
98
|
+
) : null
|
|
99
|
+
}
|
|
100
|
+
className="edit-site-styles"
|
|
101
|
+
title={ __( 'Styles' ) }
|
|
102
|
+
>
|
|
103
|
+
<GlobalStylesUI path={ path } onPathChange={ onPathChange } />
|
|
104
|
+
</Page>
|
|
105
|
+
{ canvas === 'view' && isStyleBookOpened && (
|
|
106
|
+
<StyleBook
|
|
107
|
+
enableResizing={ false }
|
|
108
|
+
showCloseButton={ false }
|
|
109
|
+
showTabs={ false }
|
|
110
|
+
isSelected={ ( blockName ) =>
|
|
111
|
+
// Match '/blocks/core%2Fbutton' and
|
|
112
|
+
// '/blocks/core%2Fbutton/typography', but not
|
|
113
|
+
// '/blocks/core%2Fbuttons'.
|
|
114
|
+
path ===
|
|
115
|
+
`/wp_global_styles/blocks/${ encodeURIComponent(
|
|
116
|
+
blockName
|
|
117
|
+
) }` ||
|
|
118
|
+
path.startsWith(
|
|
119
|
+
`/wp_global_styles/blocks/${ encodeURIComponent(
|
|
120
|
+
blockName
|
|
121
|
+
) }/`
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
path={ path }
|
|
125
|
+
onSelect={ ( blockName ) => {
|
|
126
|
+
if (
|
|
127
|
+
STYLE_BOOK_COLOR_GROUPS.find(
|
|
128
|
+
( group ) => group.slug === blockName
|
|
129
|
+
)
|
|
130
|
+
) {
|
|
131
|
+
// Go to color palettes Global Styles.
|
|
132
|
+
onPathChange( '/colors/palette' );
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if ( blockName === 'typography' ) {
|
|
136
|
+
// Go to typography Global Styles.
|
|
137
|
+
onPathChange( '/typography' );
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Now go to the selected block.
|
|
142
|
+
onPathChange(
|
|
143
|
+
`/blocks/${ encodeURIComponent( blockName ) }`
|
|
144
|
+
);
|
|
145
|
+
} }
|
|
146
|
+
/>
|
|
147
|
+
) }
|
|
148
|
+
</>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
.edit-site-styles .edit-site-page-content {
|
|
2
|
+
.edit-site-global-styles-screen-root {
|
|
3
|
+
box-shadow: none;
|
|
4
|
+
& > div > hr {
|
|
5
|
+
display: none;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
.edit-site-global-styles-sidebar__navigator-provider {
|
|
9
|
+
.components-tools-panel {
|
|
10
|
+
border-top: none;
|
|
11
|
+
}
|
|
12
|
+
overflow-y: auto;
|
|
13
|
+
padding-left: 0;
|
|
14
|
+
padding-right: 0;
|
|
15
|
+
|
|
16
|
+
.edit-site-global-styles-sidebar__navigator-screen {
|
|
17
|
+
padding-top: $grid-unit-15;
|
|
18
|
+
padding-left: $grid-unit-15;
|
|
19
|
+
padding-right: $grid-unit-15;
|
|
20
|
+
padding-bottom: $grid-unit-15;
|
|
21
|
+
outline: none;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
.edit-site-page-header {
|
|
25
|
+
padding-left: $grid-unit-60;
|
|
26
|
+
padding-right: $grid-unit-60;
|
|
27
|
+
@container (max-width: 430px) {
|
|
28
|
+
padding-left: $grid-unit-30;
|
|
29
|
+
padding-right: $grid-unit-30;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
.edit-site-sidebar-button {
|
|
33
|
+
color: $gray-900;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
&:hover,
|
|
9
9
|
&:focus,
|
|
10
|
-
&[aria-current] {
|
|
10
|
+
&[aria-current="true"] {
|
|
11
11
|
color: $gray-200;
|
|
12
12
|
background: $gray-800;
|
|
13
13
|
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
&[aria-current] {
|
|
19
|
+
&[aria-current="true"] {
|
|
20
20
|
background: var(--wp-admin-theme-color);
|
|
21
21
|
color: $white;
|
|
22
22
|
}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
.edit-site-sidebar-navigation-screen__content {
|
|
19
19
|
padding: 0 $grid-unit-20;
|
|
20
20
|
|
|
21
|
-
.
|
|
21
|
+
.edit-site-sidebar-navigation-screen-details-footer {
|
|
22
22
|
margin-left: -$grid-unit-20;
|
|
23
23
|
margin-right: -$grid-unit-20;
|
|
24
24
|
}
|
|
@@ -127,9 +127,14 @@
|
|
|
127
127
|
bottom: 0;
|
|
128
128
|
background-color: $gray-900;
|
|
129
129
|
gap: 0;
|
|
130
|
-
padding: $grid-unit-20
|
|
130
|
+
padding: $grid-unit-10 $grid-unit-20;
|
|
131
131
|
margin: $grid-unit-20 0 0;
|
|
132
132
|
border-top: 1px solid $gray-800;
|
|
133
|
+
|
|
134
|
+
.components-item-group {
|
|
135
|
+
margin-left: -$grid-unit-20;
|
|
136
|
+
margin-right: -$grid-unit-20;
|
|
137
|
+
}
|
|
133
138
|
}
|
|
134
139
|
|
|
135
140
|
/* In general style overrides are discouraged.
|
|
@@ -1,28 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
import { humanTimeDiff } from '@wordpress/date';
|
|
6
|
-
import { createInterpolateElement } from '@wordpress/element';
|
|
4
|
+
import { _n, sprintf } from '@wordpress/i18n';
|
|
7
5
|
import { addQueryArgs } from '@wordpress/url';
|
|
8
|
-
import {
|
|
9
|
-
Icon,
|
|
10
|
-
__experimentalItemGroup as ItemGroup,
|
|
11
|
-
} from '@wordpress/components';
|
|
6
|
+
import { __experimentalItemGroup as ItemGroup } from '@wordpress/components';
|
|
12
7
|
import { backup } from '@wordpress/icons';
|
|
13
8
|
|
|
14
9
|
/**
|
|
15
10
|
* Internal dependencies
|
|
16
11
|
*/
|
|
17
|
-
import {
|
|
18
|
-
SidebarNavigationScreenDetailsPanelRow,
|
|
19
|
-
SidebarNavigationScreenDetailsPanelLabel,
|
|
20
|
-
SidebarNavigationScreenDetailsPanelValue,
|
|
21
|
-
} from '../sidebar-navigation-screen-details-panel';
|
|
22
12
|
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
23
13
|
|
|
24
14
|
export default function SidebarNavigationScreenDetailsFooter( {
|
|
25
15
|
record,
|
|
16
|
+
revisionsCount,
|
|
26
17
|
...otherProps
|
|
27
18
|
} ) {
|
|
28
19
|
/*
|
|
@@ -34,9 +25,20 @@ export default function SidebarNavigationScreenDetailsFooter( {
|
|
|
34
25
|
const hrefProps = {};
|
|
35
26
|
const lastRevisionId =
|
|
36
27
|
record?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id ?? null;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
28
|
+
|
|
29
|
+
// Use incoming prop first, then the record's version history, if available.
|
|
30
|
+
revisionsCount =
|
|
31
|
+
revisionsCount ||
|
|
32
|
+
record?._links?.[ 'version-history' ]?.[ 0 ]?.count ||
|
|
33
|
+
0;
|
|
34
|
+
|
|
35
|
+
/*
|
|
36
|
+
* Enable the revisions link if there is a last revision and there is more than one revision.
|
|
37
|
+
* This link is used for theme assets, e.g., templates, which have no database record until they're edited.
|
|
38
|
+
* For these files there's only a "revision" after they're edited twice,
|
|
39
|
+
* which means the revision.php page won't display a proper diff.
|
|
40
|
+
* See: https://github.com/WordPress/gutenberg/issues/49164.
|
|
41
|
+
*/
|
|
40
42
|
if ( lastRevisionId && revisionsCount > 1 ) {
|
|
41
43
|
hrefProps.href = addQueryArgs( 'revision.php', {
|
|
42
44
|
revision: record?._links[ 'predecessor-version' ][ 0 ].id,
|
|
@@ -44,33 +46,20 @@ export default function SidebarNavigationScreenDetailsFooter( {
|
|
|
44
46
|
hrefProps.as = 'a';
|
|
45
47
|
}
|
|
46
48
|
return (
|
|
47
|
-
<ItemGroup
|
|
49
|
+
<ItemGroup
|
|
50
|
+
size="large"
|
|
51
|
+
className="edit-site-sidebar-navigation-screen-details-footer"
|
|
52
|
+
>
|
|
48
53
|
<SidebarNavigationItem
|
|
49
|
-
|
|
54
|
+
icon={ backup }
|
|
50
55
|
{ ...hrefProps }
|
|
51
56
|
{ ...otherProps }
|
|
52
57
|
>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
{ createInterpolateElement(
|
|
59
|
-
sprintf(
|
|
60
|
-
/* translators: %s: is the relative time when the post was last modified. */
|
|
61
|
-
__( '<time>%s</time>' ),
|
|
62
|
-
humanTimeDiff( record.modified )
|
|
63
|
-
),
|
|
64
|
-
{
|
|
65
|
-
time: <time dateTime={ record.modified } />,
|
|
66
|
-
}
|
|
67
|
-
) }
|
|
68
|
-
</SidebarNavigationScreenDetailsPanelValue>
|
|
69
|
-
<Icon
|
|
70
|
-
className="edit-site-sidebar-navigation-screen-details-footer__icon"
|
|
71
|
-
icon={ backup }
|
|
72
|
-
/>
|
|
73
|
-
</SidebarNavigationScreenDetailsPanelRow>
|
|
58
|
+
{ sprintf(
|
|
59
|
+
/* translators: %d: Number of Styles revisions. */
|
|
60
|
+
_n( '%d Revision', '%d Revisions', revisionsCount ),
|
|
61
|
+
revisionsCount
|
|
62
|
+
) }
|
|
74
63
|
</SidebarNavigationItem>
|
|
75
64
|
</ItemGroup>
|
|
76
65
|
);
|