@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
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = SidebarNavigationScreenDetailsPanelLabel;
|
|
7
|
-
var _components = require("@wordpress/components");
|
|
8
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
-
/**
|
|
10
|
-
* WordPress dependencies
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
function SidebarNavigationScreenDetailsPanelLabel({
|
|
14
|
-
children
|
|
15
|
-
}) {
|
|
16
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalText, {
|
|
17
|
-
className: "edit-site-sidebar-navigation-details-screen-panel__label",
|
|
18
|
-
children: children
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=sidebar-navigation-screen-details-panel-label.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_jsxRuntime","SidebarNavigationScreenDetailsPanelLabel","children","jsx","__experimentalText","className"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalText as Text } from '@wordpress/components';\n\nexport default function SidebarNavigationScreenDetailsPanelLabel( {\n\tchildren,\n} ) {\n\treturn (\n\t\t<Text className=\"edit-site-sidebar-navigation-details-screen-panel__label\">\n\t\t\t{ children }\n\t\t</Text>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAAmE,IAAAC,WAAA,GAAAD,OAAA;AAHnE;AACA;AACA;;AAGe,SAASE,wCAAwCA,CAAE;EACjEC;AACD,CAAC,EAAG;EACH,oBACC,IAAAF,WAAA,CAAAG,GAAA,EAACL,WAAA,CAAAM,kBAAI;IAACC,SAAS,EAAC,0DAA0D;IAAAH,QAAA,EACvEA;EAAQ,CACL,CAAC;AAET","ignoreList":[]}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = SidebarNavigationScreenDetailsPanelRow;
|
|
8
|
-
var _clsx = _interopRequireDefault(require("clsx"));
|
|
9
|
-
var _components = require("@wordpress/components");
|
|
10
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
/**
|
|
12
|
-
* External dependencies
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* WordPress dependencies
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
function SidebarNavigationScreenDetailsPanelRow({
|
|
20
|
-
label,
|
|
21
|
-
children,
|
|
22
|
-
className,
|
|
23
|
-
...extraProps
|
|
24
|
-
}) {
|
|
25
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalHStack, {
|
|
26
|
-
spacing: 5,
|
|
27
|
-
alignment: "left",
|
|
28
|
-
className: (0, _clsx.default)('edit-site-sidebar-navigation-details-screen-panel__row', className),
|
|
29
|
-
...extraProps,
|
|
30
|
-
children: children
|
|
31
|
-
}, label);
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=sidebar-navigation-screen-details-panel-row.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_jsxRuntime","SidebarNavigationScreenDetailsPanelRow","label","children","className","extraProps","jsx","__experimentalHStack","spacing","alignment","clsx"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __experimentalHStack as HStack } from '@wordpress/components';\n\nexport default function SidebarNavigationScreenDetailsPanelRow( {\n\tlabel,\n\tchildren,\n\tclassName,\n\t...extraProps\n} ) {\n\treturn (\n\t\t<HStack\n\t\t\tkey={ label }\n\t\t\tspacing={ 5 }\n\t\t\talignment=\"left\"\n\t\t\tclassName={ clsx(\n\t\t\t\t'edit-site-sidebar-navigation-details-screen-panel__row',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\t{ ...extraProps }\n\t\t>\n\t\t\t{ children }\n\t\t</HStack>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AAAuE,IAAAE,WAAA,GAAAF,OAAA;AARvE;AACA;AACA;;AAGA;AACA;AACA;;AAGe,SAASG,sCAAsCA,CAAE;EAC/DC,KAAK;EACLC,QAAQ;EACRC,SAAS;EACT,GAAGC;AACJ,CAAC,EAAG;EACH,oBACC,IAAAL,WAAA,CAAAM,GAAA,EAACP,WAAA,CAAAQ,oBAAM;IAENC,OAAO,EAAG,CAAG;IACbC,SAAS,EAAC,MAAM;IAChBL,SAAS,EAAG,IAAAM,aAAI,EACf,wDAAwD,EACxDN,SACD,CAAG;IAAA,GACEC,UAAU;IAAAF,QAAA,EAEbA;EAAQ,GATJD,KAUC,CAAC;AAEX","ignoreList":[]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = SidebarNavigationScreenDetailsPanelValue;
|
|
7
|
-
var _components = require("@wordpress/components");
|
|
8
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
-
/**
|
|
10
|
-
* WordPress dependencies
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
function SidebarNavigationScreenDetailsPanelValue({
|
|
14
|
-
children
|
|
15
|
-
}) {
|
|
16
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalText, {
|
|
17
|
-
className: "edit-site-sidebar-navigation-details-screen-panel__value",
|
|
18
|
-
children: children
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=sidebar-navigation-screen-details-panel-value.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_jsxRuntime","SidebarNavigationScreenDetailsPanelValue","children","jsx","__experimentalText","className"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalText as Text } from '@wordpress/components';\n\nexport default function SidebarNavigationScreenDetailsPanelValue( {\n\tchildren,\n} ) {\n\treturn (\n\t\t<Text className=\"edit-site-sidebar-navigation-details-screen-panel__value\">\n\t\t\t{ children }\n\t\t</Text>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAAmE,IAAAC,WAAA,GAAAD,OAAA;AAHnE;AACA;AACA;;AAGe,SAASE,wCAAwCA,CAAE;EACjEC;AACD,CAAC,EAAG;EACH,oBACC,IAAAF,WAAA,CAAAG,GAAA,EAACL,WAAA,CAAAM,kBAAI;IAACC,SAAS,EAAC,0DAA0D;IAAAH,QAAA,EACvEA;EAAQ,CACL,CAAC;AAET","ignoreList":[]}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.stylesEditRoute = void 0;
|
|
8
|
-
var _editor = _interopRequireDefault(require("../editor"));
|
|
9
|
-
var _sidebarNavigationScreenGlobalStyles = _interopRequireDefault(require("../sidebar-navigation-screen-global-styles"));
|
|
10
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
const stylesEditRoute = exports.stylesEditRoute = {
|
|
16
|
-
name: 'styles-edit',
|
|
17
|
-
match: params => {
|
|
18
|
-
return params.path === '/wp_global_styles' && params.canvas === 'edit';
|
|
19
|
-
},
|
|
20
|
-
areas: {
|
|
21
|
-
sidebar: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sidebarNavigationScreenGlobalStyles.default, {
|
|
22
|
-
backPath: {}
|
|
23
|
-
}),
|
|
24
|
-
preview: /*#__PURE__*/(0, _jsxRuntime.jsx)(_editor.default, {}),
|
|
25
|
-
mobile: /*#__PURE__*/(0, _jsxRuntime.jsx)(_editor.default, {})
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=styles-edit.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_editor","_interopRequireDefault","require","_sidebarNavigationScreenGlobalStyles","_jsxRuntime","stylesEditRoute","exports","name","match","params","path","canvas","areas","sidebar","jsx","default","backPath","preview","mobile"],"sources":["@wordpress/edit-site/src/components/site-editor-routes/styles-edit.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport Editor from '../editor';\nimport SidebarNavigationScreenGlobalStyles from '../sidebar-navigation-screen-global-styles';\n\nexport const stylesEditRoute = {\n\tname: 'styles-edit',\n\tmatch: ( params ) => {\n\t\treturn params.path === '/wp_global_styles' && params.canvas === 'edit';\n\t},\n\tareas: {\n\t\tsidebar: <SidebarNavigationScreenGlobalStyles backPath={ {} } />,\n\t\tpreview: <Editor />,\n\t\tmobile: <Editor />,\n\t},\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,oCAAA,GAAAF,sBAAA,CAAAC,OAAA;AAA6F,IAAAE,WAAA,GAAAF,OAAA;AAJ7F;AACA;AACA;;AAIO,MAAMG,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG;EAC9BE,IAAI,EAAE,aAAa;EACnBC,KAAK,EAAIC,MAAM,IAAM;IACpB,OAAOA,MAAM,CAACC,IAAI,KAAK,mBAAmB,IAAID,MAAM,CAACE,MAAM,KAAK,MAAM;EACvE,CAAC;EACDC,KAAK,EAAE;IACNC,OAAO,eAAE,IAAAT,WAAA,CAAAU,GAAA,EAACX,oCAAA,CAAAY,OAAmC;MAACC,QAAQ,EAAG,CAAC;IAAG,CAAE,CAAC;IAChEC,OAAO,eAAE,IAAAb,WAAA,CAAAU,GAAA,EAACd,OAAA,CAAAe,OAAM,IAAE,CAAC;IACnBG,MAAM,eAAE,IAAAd,WAAA,CAAAU,GAAA,EAACd,OAAA,CAAAe,OAAM,IAAE;EAClB;AACD,CAAC","ignoreList":[]}
|
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = useInitEditedEntityFromURL;
|
|
7
|
-
var _element = require("@wordpress/element");
|
|
8
|
-
var _data = require("@wordpress/data");
|
|
9
|
-
var _coreData = require("@wordpress/core-data");
|
|
10
|
-
var _router = require("@wordpress/router");
|
|
11
|
-
var _blockEditor = require("@wordpress/block-editor");
|
|
12
|
-
var _store = require("../../store");
|
|
13
|
-
var _lockUnlock = require("../../lock-unlock");
|
|
14
|
-
var _constants = require("../../utils/constants");
|
|
15
|
-
/**
|
|
16
|
-
* WordPress dependencies
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Internal dependencies
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
const {
|
|
24
|
-
useLocation
|
|
25
|
-
} = (0, _lockUnlock.unlock)(_router.privateApis);
|
|
26
|
-
const postTypesWithoutParentTemplate = [_constants.TEMPLATE_POST_TYPE, _constants.TEMPLATE_PART_POST_TYPE, _constants.NAVIGATION_POST_TYPE, _constants.PATTERN_TYPES.user];
|
|
27
|
-
const authorizedPostTypes = ['page', 'post'];
|
|
28
|
-
function useResolveEditedEntityAndContext({
|
|
29
|
-
postId,
|
|
30
|
-
postType
|
|
31
|
-
}) {
|
|
32
|
-
const {
|
|
33
|
-
hasLoadedAllDependencies,
|
|
34
|
-
homepageId,
|
|
35
|
-
postsPageId,
|
|
36
|
-
url,
|
|
37
|
-
frontPageTemplateId
|
|
38
|
-
} = (0, _data.useSelect)(select => {
|
|
39
|
-
const {
|
|
40
|
-
getEntityRecord,
|
|
41
|
-
getEntityRecords
|
|
42
|
-
} = select(_coreData.store);
|
|
43
|
-
const siteData = getEntityRecord('root', 'site');
|
|
44
|
-
const base = getEntityRecord('root', '__unstableBase');
|
|
45
|
-
const templates = getEntityRecords('postType', _constants.TEMPLATE_POST_TYPE, {
|
|
46
|
-
per_page: -1
|
|
47
|
-
});
|
|
48
|
-
const _homepageId = siteData?.show_on_front === 'page' && ['number', 'string'].includes(typeof siteData.page_on_front) && !!+siteData.page_on_front // We also need to check if it's not zero(`0`).
|
|
49
|
-
? siteData.page_on_front.toString() : null;
|
|
50
|
-
const _postsPageId = siteData?.show_on_front === 'page' && ['number', 'string'].includes(typeof siteData.page_for_posts) ? siteData.page_for_posts.toString() : null;
|
|
51
|
-
let _frontPageTemplateId;
|
|
52
|
-
if (templates) {
|
|
53
|
-
const frontPageTemplate = templates.find(t => t.slug === 'front-page');
|
|
54
|
-
_frontPageTemplateId = frontPageTemplate ? frontPageTemplate.id : false;
|
|
55
|
-
}
|
|
56
|
-
return {
|
|
57
|
-
hasLoadedAllDependencies: !!base && !!siteData,
|
|
58
|
-
homepageId: _homepageId,
|
|
59
|
-
postsPageId: _postsPageId,
|
|
60
|
-
url: base?.home,
|
|
61
|
-
frontPageTemplateId: _frontPageTemplateId
|
|
62
|
-
};
|
|
63
|
-
}, []);
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* This is a hook that recreates the logic to resolve a template for a given WordPress postID postTypeId
|
|
67
|
-
* in order to match the frontend as closely as possible in the site editor.
|
|
68
|
-
*
|
|
69
|
-
* It is not possible to rely on the server logic because there maybe unsaved changes that impact the template resolution.
|
|
70
|
-
*/
|
|
71
|
-
const resolvedTemplateId = (0, _data.useSelect)(select => {
|
|
72
|
-
// If we're rendering a post type that doesn't have a template
|
|
73
|
-
// no need to resolve its template.
|
|
74
|
-
if (postTypesWithoutParentTemplate.includes(postType) && postId) {
|
|
75
|
-
return undefined;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// Don't trigger resolution for multi-selected posts.
|
|
79
|
-
if (postId && postId.includes(',')) {
|
|
80
|
-
return undefined;
|
|
81
|
-
}
|
|
82
|
-
const {
|
|
83
|
-
getEditedEntityRecord,
|
|
84
|
-
getEntityRecords,
|
|
85
|
-
getDefaultTemplateId,
|
|
86
|
-
__experimentalGetTemplateForLink
|
|
87
|
-
} = select(_coreData.store);
|
|
88
|
-
function resolveTemplateForPostTypeAndId(postTypeToResolve, postIdToResolve) {
|
|
89
|
-
// For the front page, we always use the front page template if existing.
|
|
90
|
-
if (postTypeToResolve === 'page' && homepageId === postIdToResolve) {
|
|
91
|
-
// We're still checking whether the front page template exists.
|
|
92
|
-
// Don't resolve the template yet.
|
|
93
|
-
if (frontPageTemplateId === undefined) {
|
|
94
|
-
return undefined;
|
|
95
|
-
}
|
|
96
|
-
if (!!frontPageTemplateId) {
|
|
97
|
-
return frontPageTemplateId;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
const editedEntity = getEditedEntityRecord('postType', postTypeToResolve, postIdToResolve);
|
|
101
|
-
if (!editedEntity) {
|
|
102
|
-
return undefined;
|
|
103
|
-
}
|
|
104
|
-
// Check if the current page is the posts page.
|
|
105
|
-
if (postTypeToResolve === 'page' && postsPageId === postIdToResolve) {
|
|
106
|
-
return __experimentalGetTemplateForLink(editedEntity.link)?.id;
|
|
107
|
-
}
|
|
108
|
-
// First see if the post/page has an assigned template and fetch it.
|
|
109
|
-
const currentTemplateSlug = editedEntity.template;
|
|
110
|
-
if (currentTemplateSlug) {
|
|
111
|
-
const currentTemplate = getEntityRecords('postType', _constants.TEMPLATE_POST_TYPE, {
|
|
112
|
-
per_page: -1
|
|
113
|
-
})?.find(({
|
|
114
|
-
slug
|
|
115
|
-
}) => slug === currentTemplateSlug);
|
|
116
|
-
if (currentTemplate) {
|
|
117
|
-
return currentTemplate.id;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
// If no template is assigned, use the default template.
|
|
121
|
-
let slugToCheck;
|
|
122
|
-
// In `draft` status we might not have a slug available, so we use the `single`
|
|
123
|
-
// post type templates slug(ex page, single-post, single-product etc..).
|
|
124
|
-
// Pages do not need the `single` prefix in the slug to be prioritized
|
|
125
|
-
// through template hierarchy.
|
|
126
|
-
if (editedEntity.slug) {
|
|
127
|
-
slugToCheck = postTypeToResolve === 'page' ? `${postTypeToResolve}-${editedEntity.slug}` : `single-${postTypeToResolve}-${editedEntity.slug}`;
|
|
128
|
-
} else {
|
|
129
|
-
slugToCheck = postTypeToResolve === 'page' ? 'page' : `single-${postTypeToResolve}`;
|
|
130
|
-
}
|
|
131
|
-
return getDefaultTemplateId({
|
|
132
|
-
slug: slugToCheck
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
if (!hasLoadedAllDependencies) {
|
|
136
|
-
return undefined;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// If we're rendering a specific page, we need to resolve its template.
|
|
140
|
-
// The site editor only supports pages for now, not other CPTs.
|
|
141
|
-
if (postType && postId && authorizedPostTypes.includes(postType)) {
|
|
142
|
-
return resolveTemplateForPostTypeAndId(postType, postId);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// If we're rendering the home page, and we have a static home page, resolve its template.
|
|
146
|
-
if (homepageId) {
|
|
147
|
-
return resolveTemplateForPostTypeAndId('page', homepageId);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// If we're not rendering a specific page, use the front page template.
|
|
151
|
-
if (url) {
|
|
152
|
-
const template = __experimentalGetTemplateForLink(url);
|
|
153
|
-
return template?.id;
|
|
154
|
-
}
|
|
155
|
-
}, [homepageId, postsPageId, hasLoadedAllDependencies, url, postId, postType, frontPageTemplateId]);
|
|
156
|
-
const context = (0, _element.useMemo)(() => {
|
|
157
|
-
if (postTypesWithoutParentTemplate.includes(postType) && postId) {
|
|
158
|
-
return {};
|
|
159
|
-
}
|
|
160
|
-
if (postType && postId && authorizedPostTypes.includes(postType)) {
|
|
161
|
-
return {
|
|
162
|
-
postType,
|
|
163
|
-
postId
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
// TODO: for post types lists we should probably not render the front page, but maybe a placeholder
|
|
167
|
-
// with a message like "Select a page" or something similar.
|
|
168
|
-
if (homepageId) {
|
|
169
|
-
return {
|
|
170
|
-
postType: 'page',
|
|
171
|
-
postId: homepageId
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
return {};
|
|
175
|
-
}, [homepageId, postType, postId]);
|
|
176
|
-
if (postTypesWithoutParentTemplate.includes(postType) && postId) {
|
|
177
|
-
return {
|
|
178
|
-
isReady: true,
|
|
179
|
-
postType,
|
|
180
|
-
postId,
|
|
181
|
-
context
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
if (hasLoadedAllDependencies) {
|
|
185
|
-
return {
|
|
186
|
-
isReady: resolvedTemplateId !== undefined,
|
|
187
|
-
postType: _constants.TEMPLATE_POST_TYPE,
|
|
188
|
-
postId: resolvedTemplateId,
|
|
189
|
-
context
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
return {
|
|
193
|
-
isReady: false
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
function useInitEditedEntityFromURL() {
|
|
197
|
-
const {
|
|
198
|
-
params = {}
|
|
199
|
-
} = useLocation();
|
|
200
|
-
const {
|
|
201
|
-
postType,
|
|
202
|
-
postId,
|
|
203
|
-
context,
|
|
204
|
-
isReady
|
|
205
|
-
} = useResolveEditedEntityAndContext(params);
|
|
206
|
-
const {
|
|
207
|
-
setEditedEntity
|
|
208
|
-
} = (0, _data.useDispatch)(_store.store);
|
|
209
|
-
const {
|
|
210
|
-
resetZoomLevel
|
|
211
|
-
} = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_blockEditor.store));
|
|
212
|
-
(0, _element.useEffect)(() => {
|
|
213
|
-
if (isReady) {
|
|
214
|
-
resetZoomLevel();
|
|
215
|
-
setEditedEntity(postType, postId, context);
|
|
216
|
-
}
|
|
217
|
-
}, [isReady, postType, postId, context, setEditedEntity, resetZoomLevel]);
|
|
218
|
-
}
|
|
219
|
-
//# sourceMappingURL=use-init-edited-entity-from-url.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_data","_coreData","_router","_blockEditor","_store","_lockUnlock","_constants","useLocation","unlock","routerPrivateApis","postTypesWithoutParentTemplate","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","NAVIGATION_POST_TYPE","PATTERN_TYPES","user","authorizedPostTypes","useResolveEditedEntityAndContext","postId","postType","hasLoadedAllDependencies","homepageId","postsPageId","url","frontPageTemplateId","useSelect","select","getEntityRecord","getEntityRecords","coreDataStore","siteData","base","templates","per_page","_homepageId","show_on_front","includes","page_on_front","toString","_postsPageId","page_for_posts","_frontPageTemplateId","frontPageTemplate","find","t","slug","id","home","resolvedTemplateId","undefined","getEditedEntityRecord","getDefaultTemplateId","__experimentalGetTemplateForLink","resolveTemplateForPostTypeAndId","postTypeToResolve","postIdToResolve","editedEntity","link","currentTemplateSlug","template","currentTemplate","slugToCheck","context","useMemo","isReady","useInitEditedEntityFromURL","params","setEditedEntity","useDispatch","editSiteStore","resetZoomLevel","blockEditorStore","useEffect"],"sources":["@wordpress/edit-site/src/components/sync-state-with-url/use-init-edited-entity-from-url.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES,\n} from '../../utils/constants';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nconst postTypesWithoutParentTemplate = [\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES.user,\n];\n\nconst authorizedPostTypes = [ 'page', 'post' ];\n\nfunction useResolveEditedEntityAndContext( { postId, postType } ) {\n\tconst {\n\t\thasLoadedAllDependencies,\n\t\thomepageId,\n\t\tpostsPageId,\n\t\turl,\n\t\tfrontPageTemplateId,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, getEntityRecords } = select( coreDataStore );\n\t\tconst siteData = getEntityRecord( 'root', 'site' );\n\t\tconst base = getEntityRecord( 'root', '__unstableBase' );\n\t\tconst templates = getEntityRecords( 'postType', TEMPLATE_POST_TYPE, {\n\t\t\tper_page: -1,\n\t\t} );\n\t\tconst _homepageId =\n\t\t\tsiteData?.show_on_front === 'page' &&\n\t\t\t[ 'number', 'string' ].includes( typeof siteData.page_on_front ) &&\n\t\t\t!! +siteData.page_on_front // We also need to check if it's not zero(`0`).\n\t\t\t\t? siteData.page_on_front.toString()\n\t\t\t\t: null;\n\t\tconst _postsPageId =\n\t\t\tsiteData?.show_on_front === 'page' &&\n\t\t\t[ 'number', 'string' ].includes( typeof siteData.page_for_posts )\n\t\t\t\t? siteData.page_for_posts.toString()\n\t\t\t\t: null;\n\t\tlet _frontPageTemplateId;\n\t\tif ( templates ) {\n\t\t\tconst frontPageTemplate = templates.find(\n\t\t\t\t( t ) => t.slug === 'front-page'\n\t\t\t);\n\t\t\t_frontPageTemplateId = frontPageTemplate\n\t\t\t\t? frontPageTemplate.id\n\t\t\t\t: false;\n\t\t}\n\t\treturn {\n\t\t\thasLoadedAllDependencies: !! base && !! siteData,\n\t\t\thomepageId: _homepageId,\n\t\t\tpostsPageId: _postsPageId,\n\t\t\turl: base?.home,\n\t\t\tfrontPageTemplateId: _frontPageTemplateId,\n\t\t};\n\t}, [] );\n\n\t/**\n\t * This is a hook that recreates the logic to resolve a template for a given WordPress postID postTypeId\n\t * in order to match the frontend as closely as possible in the site editor.\n\t *\n\t * It is not possible to rely on the server logic because there maybe unsaved changes that impact the template resolution.\n\t */\n\tconst resolvedTemplateId = useSelect(\n\t\t( select ) => {\n\t\t\t// If we're rendering a post type that doesn't have a template\n\t\t\t// no need to resolve its template.\n\t\t\tif (\n\t\t\t\tpostTypesWithoutParentTemplate.includes( postType ) &&\n\t\t\t\tpostId\n\t\t\t) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\t// Don't trigger resolution for multi-selected posts.\n\t\t\tif ( postId && postId.includes( ',' ) ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst {\n\t\t\t\tgetEditedEntityRecord,\n\t\t\t\tgetEntityRecords,\n\t\t\t\tgetDefaultTemplateId,\n\t\t\t\t__experimentalGetTemplateForLink,\n\t\t\t} = select( coreDataStore );\n\n\t\t\tfunction resolveTemplateForPostTypeAndId(\n\t\t\t\tpostTypeToResolve,\n\t\t\t\tpostIdToResolve\n\t\t\t) {\n\t\t\t\t// For the front page, we always use the front page template if existing.\n\t\t\t\tif (\n\t\t\t\t\tpostTypeToResolve === 'page' &&\n\t\t\t\t\thomepageId === postIdToResolve\n\t\t\t\t) {\n\t\t\t\t\t// We're still checking whether the front page template exists.\n\t\t\t\t\t// Don't resolve the template yet.\n\t\t\t\t\tif ( frontPageTemplateId === undefined ) {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( !! frontPageTemplateId ) {\n\t\t\t\t\t\treturn frontPageTemplateId;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst editedEntity = getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostTypeToResolve,\n\t\t\t\t\tpostIdToResolve\n\t\t\t\t);\n\t\t\t\tif ( ! editedEntity ) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\t// Check if the current page is the posts page.\n\t\t\t\tif (\n\t\t\t\t\tpostTypeToResolve === 'page' &&\n\t\t\t\t\tpostsPageId === postIdToResolve\n\t\t\t\t) {\n\t\t\t\t\treturn __experimentalGetTemplateForLink( editedEntity.link )\n\t\t\t\t\t\t?.id;\n\t\t\t\t}\n\t\t\t\t// First see if the post/page has an assigned template and fetch it.\n\t\t\t\tconst currentTemplateSlug = editedEntity.template;\n\t\t\t\tif ( currentTemplateSlug ) {\n\t\t\t\t\tconst currentTemplate = getEntityRecords(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tper_page: -1,\n\t\t\t\t\t\t}\n\t\t\t\t\t)?.find( ( { slug } ) => slug === currentTemplateSlug );\n\t\t\t\t\tif ( currentTemplate ) {\n\t\t\t\t\t\treturn currentTemplate.id;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// If no template is assigned, use the default template.\n\t\t\t\tlet slugToCheck;\n\t\t\t\t// In `draft` status we might not have a slug available, so we use the `single`\n\t\t\t\t// post type templates slug(ex page, single-post, single-product etc..).\n\t\t\t\t// Pages do not need the `single` prefix in the slug to be prioritized\n\t\t\t\t// through template hierarchy.\n\t\t\t\tif ( editedEntity.slug ) {\n\t\t\t\t\tslugToCheck =\n\t\t\t\t\t\tpostTypeToResolve === 'page'\n\t\t\t\t\t\t\t? `${ postTypeToResolve }-${ editedEntity.slug }`\n\t\t\t\t\t\t\t: `single-${ postTypeToResolve }-${ editedEntity.slug }`;\n\t\t\t\t} else {\n\t\t\t\t\tslugToCheck =\n\t\t\t\t\t\tpostTypeToResolve === 'page'\n\t\t\t\t\t\t\t? 'page'\n\t\t\t\t\t\t\t: `single-${ postTypeToResolve }`;\n\t\t\t\t}\n\t\t\t\treturn getDefaultTemplateId( {\n\t\t\t\t\tslug: slugToCheck,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tif ( ! hasLoadedAllDependencies ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\t// If we're rendering a specific page, we need to resolve its template.\n\t\t\t// The site editor only supports pages for now, not other CPTs.\n\t\t\tif (\n\t\t\t\tpostType &&\n\t\t\t\tpostId &&\n\t\t\t\tauthorizedPostTypes.includes( postType )\n\t\t\t) {\n\t\t\t\treturn resolveTemplateForPostTypeAndId( postType, postId );\n\t\t\t}\n\n\t\t\t// If we're rendering the home page, and we have a static home page, resolve its template.\n\t\t\tif ( homepageId ) {\n\t\t\t\treturn resolveTemplateForPostTypeAndId( 'page', homepageId );\n\t\t\t}\n\n\t\t\t// If we're not rendering a specific page, use the front page template.\n\t\t\tif ( url ) {\n\t\t\t\tconst template = __experimentalGetTemplateForLink( url );\n\t\t\t\treturn template?.id;\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\thomepageId,\n\t\t\tpostsPageId,\n\t\t\thasLoadedAllDependencies,\n\t\t\turl,\n\t\t\tpostId,\n\t\t\tpostType,\n\t\t\tfrontPageTemplateId,\n\t\t]\n\t);\n\n\tconst context = useMemo( () => {\n\t\tif ( postTypesWithoutParentTemplate.includes( postType ) && postId ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tif ( postType && postId && authorizedPostTypes.includes( postType ) ) {\n\t\t\treturn { postType, postId };\n\t\t}\n\t\t// TODO: for post types lists we should probably not render the front page, but maybe a placeholder\n\t\t// with a message like \"Select a page\" or something similar.\n\t\tif ( homepageId ) {\n\t\t\treturn { postType: 'page', postId: homepageId };\n\t\t}\n\n\t\treturn {};\n\t}, [ homepageId, postType, postId ] );\n\n\tif ( postTypesWithoutParentTemplate.includes( postType ) && postId ) {\n\t\treturn { isReady: true, postType, postId, context };\n\t}\n\n\tif ( hasLoadedAllDependencies ) {\n\t\treturn {\n\t\t\tisReady: resolvedTemplateId !== undefined,\n\t\t\tpostType: TEMPLATE_POST_TYPE,\n\t\t\tpostId: resolvedTemplateId,\n\t\t\tcontext,\n\t\t};\n\t}\n\n\treturn { isReady: false };\n}\n\nexport default function useInitEditedEntityFromURL() {\n\tconst { params = {} } = useLocation();\n\tconst { postType, postId, context, isReady } =\n\t\tuseResolveEditedEntityAndContext( params );\n\n\tconst { setEditedEntity } = useDispatch( editSiteStore );\n\tconst { resetZoomLevel } = unlock( useDispatch( blockEditorStore ) );\n\n\tuseEffect( () => {\n\t\tif ( isReady ) {\n\t\t\tresetZoomLevel();\n\t\t\tsetEditedEntity( postType, postId, context );\n\t\t}\n\t}, [\n\t\tisReady,\n\t\tpostType,\n\t\tpostId,\n\t\tcontext,\n\t\tsetEditedEntity,\n\t\tresetZoomLevel,\n\t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MAAM;MAAE4C;IAAQ,CAAC;EACpD;EAEA,IAAK1C,wBAAwB,EAAG;IAC/B,OAAO;MACN4C,OAAO,EAAEhB,kBAAkB,KAAKC,SAAS;MACzC9B,QAAQ,EAAER,6BAAkB;MAC5BO,MAAM,EAAE8B,kBAAkB;MAC1Bc;IACD,CAAC;EACF;EAEA,OAAO;IAAEE,OAAO,EAAE;EAAM,CAAC;AAC1B;AAEe,SAASC,0BAA0BA,CAAA,EAAG;EACpD,MAAM;IAAEC,MAAM,GAAG,CAAC;EAAE,CAAC,GAAG3D,WAAW,CAAC,CAAC;EACrC,MAAM;IAAEY,QAAQ;IAAED,MAAM;IAAE4C,OAAO;IAAEE;EAAQ,CAAC,GAC3C/C,gCAAgC,CAAEiD,MAAO,CAAC;EAE3C,MAAM;IAAEC;EAAgB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAc,CAAC;EACxD,MAAM;IAAEC;EAAe,CAAC,GAAG,IAAA9D,kBAAM,EAAE,IAAA4D,iBAAW,EAAEG,kBAAiB,CAAE,CAAC;EAEpE,IAAAC,kBAAS,EAAE,MAAM;IAChB,IAAKR,OAAO,EAAG;MACdM,cAAc,CAAC,CAAC;MAChBH,eAAe,CAAEhD,QAAQ,EAAED,MAAM,EAAE4C,OAAQ,CAAC;IAC7C;EACD,CAAC,EAAE,CACFE,OAAO,EACP7C,QAAQ,EACRD,MAAM,EACN4C,OAAO,EACPK,eAAe,EACfG,cAAc,CACb,CAAC;AACJ","ignoreList":[]}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = useEditedEntityRecord;
|
|
7
|
-
var _data = require("@wordpress/data");
|
|
8
|
-
var _coreData = require("@wordpress/core-data");
|
|
9
|
-
var _editor = require("@wordpress/editor");
|
|
10
|
-
var _htmlEntities = require("@wordpress/html-entities");
|
|
11
|
-
var _store = require("../../store");
|
|
12
|
-
/**
|
|
13
|
-
* WordPress dependencies
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Internal dependencies
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
function useEditedEntityRecord(postType, postId) {
|
|
21
|
-
const {
|
|
22
|
-
record,
|
|
23
|
-
title,
|
|
24
|
-
description,
|
|
25
|
-
isLoaded,
|
|
26
|
-
icon
|
|
27
|
-
} = (0, _data.useSelect)(select => {
|
|
28
|
-
const {
|
|
29
|
-
getEditedPostType,
|
|
30
|
-
getEditedPostId
|
|
31
|
-
} = select(_store.store);
|
|
32
|
-
const {
|
|
33
|
-
getEditedEntityRecord,
|
|
34
|
-
hasFinishedResolution
|
|
35
|
-
} = select(_coreData.store);
|
|
36
|
-
const {
|
|
37
|
-
__experimentalGetTemplateInfo: getTemplateInfo
|
|
38
|
-
} = select(_editor.store);
|
|
39
|
-
const usedPostType = postType !== null && postType !== void 0 ? postType : getEditedPostType();
|
|
40
|
-
const usedPostId = postId !== null && postId !== void 0 ? postId : getEditedPostId();
|
|
41
|
-
const _record = getEditedEntityRecord('postType', usedPostType, usedPostId);
|
|
42
|
-
const _isLoaded = usedPostId && hasFinishedResolution('getEditedEntityRecord', ['postType', usedPostType, usedPostId]);
|
|
43
|
-
const templateInfo = getTemplateInfo(_record);
|
|
44
|
-
return {
|
|
45
|
-
record: _record,
|
|
46
|
-
title: templateInfo.title,
|
|
47
|
-
description: templateInfo.description,
|
|
48
|
-
isLoaded: _isLoaded,
|
|
49
|
-
icon: templateInfo.icon
|
|
50
|
-
};
|
|
51
|
-
}, [postType, postId]);
|
|
52
|
-
return {
|
|
53
|
-
isLoaded,
|
|
54
|
-
icon,
|
|
55
|
-
record,
|
|
56
|
-
getTitle: () => title ? (0, _htmlEntities.decodeEntities)(title) : null,
|
|
57
|
-
getDescription: () => description ? (0, _htmlEntities.decodeEntities)(description) : null
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_coreData","_editor","_htmlEntities","_store","useEditedEntityRecord","postType","postId","record","title","description","isLoaded","icon","useSelect","select","getEditedPostType","getEditedPostId","editSiteStore","getEditedEntityRecord","hasFinishedResolution","coreStore","__experimentalGetTemplateInfo","getTemplateInfo","editorStore","usedPostType","usedPostId","_record","_isLoaded","templateInfo","getTitle","decodeEntities","getDescription"],"sources":["@wordpress/edit-site/src/components/use-edited-entity-record/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nexport default function useEditedEntityRecord( postType, postId ) {\n\tconst { record, title, description, isLoaded, icon } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostType, getEditedPostId } =\n\t\t\t\tselect( editSiteStore );\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { __experimentalGetTemplateInfo: getTemplateInfo } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst usedPostType = postType ?? getEditedPostType();\n\t\t\tconst usedPostId = postId ?? getEditedPostId();\n\t\t\tconst _record = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tusedPostType,\n\t\t\t\tusedPostId\n\t\t\t);\n\t\t\tconst _isLoaded =\n\t\t\t\tusedPostId &&\n\t\t\t\thasFinishedResolution( 'getEditedEntityRecord', [\n\t\t\t\t\t'postType',\n\t\t\t\t\tusedPostType,\n\t\t\t\t\tusedPostId,\n\t\t\t\t] );\n\t\t\tconst templateInfo = getTemplateInfo( _record );\n\n\t\t\treturn {\n\t\t\t\trecord: _record,\n\t\t\t\ttitle: templateInfo.title,\n\t\t\t\tdescription: templateInfo.description,\n\t\t\t\tisLoaded: _isLoaded,\n\t\t\t\ticon: templateInfo.icon,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\treturn {\n\t\tisLoaded,\n\t\ticon,\n\t\trecord,\n\t\tgetTitle: () => ( title ? decodeEntities( title ) : null ),\n\t\tgetDescription: () =>\n\t\t\tdescription ? decodeEntities( description ) : null,\n\t};\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAXA;AACA;AACA;;AAMA;AACA;AACA;;AAGe,SAASK,qBAAqBA,CAAEC,QAAQ,EAAEC,MAAM,EAAG;EACjE,MAAM;IAAEC,MAAM;IAAEC,KAAK;IAAEC,WAAW;IAAEC,QAAQ;IAAEC;EAAK,CAAC,GAAG,IAAAC,eAAS,EAC7DC,MAAM,IAAM;IACb,MAAM;MAAEC,iBAAiB;MAAEC;IAAgB,CAAC,GAC3CF,MAAM,CAAEG,YAAc,CAAC;IACxB,MAAM;MAAEC,qBAAqB;MAAEC;IAAsB,CAAC,GACrDL,MAAM,CAAEM,eAAU,CAAC;IACpB,MAAM;MAAEC,6BAA6B,EAAEC;IAAgB,CAAC,GACvDR,MAAM,CAAES,aAAY,CAAC;IACtB,MAAMC,YAAY,GAAGlB,QAAQ,aAARA,QAAQ,cAARA,QAAQ,GAAIS,iBAAiB,CAAC,CAAC;IACpD,MAAMU,UAAU,GAAGlB,MAAM,aAANA,MAAM,cAANA,MAAM,GAAIS,eAAe,CAAC,CAAC;IAC9C,MAAMU,OAAO,GAAGR,qBAAqB,CACpC,UAAU,EACVM,YAAY,EACZC,UACD,CAAC;IACD,MAAME,SAAS,GACdF,UAAU,IACVN,qBAAqB,CAAE,uBAAuB,EAAE,CAC/C,UAAU,EACVK,YAAY,EACZC,UAAU,CACT,CAAC;IACJ,MAAMG,YAAY,GAAGN,eAAe,CAAEI,OAAQ,CAAC;IAE/C,OAAO;MACNlB,MAAM,EAAEkB,OAAO;MACfjB,KAAK,EAAEmB,YAAY,CAACnB,KAAK;MACzBC,WAAW,EAAEkB,YAAY,CAAClB,WAAW;MACrCC,QAAQ,EAAEgB,SAAS;MACnBf,IAAI,EAAEgB,YAAY,CAAChB;IACpB,CAAC;EACF,CAAC,EACD,CAAEN,QAAQ,EAAEC,MAAM,CACnB,CAAC;EAED,OAAO;IACNI,QAAQ;IACRC,IAAI;IACJJ,MAAM;IACNqB,QAAQ,EAAEA,CAAA,KAAQpB,KAAK,GAAG,IAAAqB,4BAAc,EAAErB,KAAM,CAAC,GAAG,IAAM;IAC1DsB,cAAc,EAAEA,CAAA,KACfrB,WAAW,GAAG,IAAAoB,4BAAc,EAAEpB,WAAY,CAAC,GAAG;EAChD,CAAC;AACF","ignoreList":[]}
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.useEditModeCommands = useEditModeCommands;
|
|
8
|
-
var _data = require("@wordpress/data");
|
|
9
|
-
var _i18n = require("@wordpress/i18n");
|
|
10
|
-
var _icons = require("@wordpress/icons");
|
|
11
|
-
var _commands = require("@wordpress/commands");
|
|
12
|
-
var _htmlEntities = require("@wordpress/html-entities");
|
|
13
|
-
var _router = require("@wordpress/router");
|
|
14
|
-
var _editor = require("@wordpress/editor");
|
|
15
|
-
var _store = require("../../store");
|
|
16
|
-
var _useEditedEntityRecord = _interopRequireDefault(require("../../components/use-edited-entity-record"));
|
|
17
|
-
var _isTemplateRemovable = _interopRequireDefault(require("../../utils/is-template-removable"));
|
|
18
|
-
var _isTemplateRevertable = _interopRequireDefault(require("../../utils/is-template-revertable"));
|
|
19
|
-
var _lockUnlock = require("../../lock-unlock");
|
|
20
|
-
var _constants = require("../../utils/constants");
|
|
21
|
-
var _link = require("../../components/routes/link");
|
|
22
|
-
/**
|
|
23
|
-
* WordPress dependencies
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Internal dependencies
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
const {
|
|
31
|
-
useHistory,
|
|
32
|
-
useLocation
|
|
33
|
-
} = (0, _lockUnlock.unlock)(_router.privateApis);
|
|
34
|
-
function usePageContentFocusCommands() {
|
|
35
|
-
const {
|
|
36
|
-
record: template
|
|
37
|
-
} = (0, _useEditedEntityRecord.default)();
|
|
38
|
-
const {
|
|
39
|
-
params
|
|
40
|
-
} = useLocation();
|
|
41
|
-
const {
|
|
42
|
-
canvas = 'view'
|
|
43
|
-
} = params;
|
|
44
|
-
const {
|
|
45
|
-
isPage,
|
|
46
|
-
templateId,
|
|
47
|
-
currentPostType
|
|
48
|
-
} = (0, _data.useSelect)(select => {
|
|
49
|
-
const {
|
|
50
|
-
isPage: _isPage
|
|
51
|
-
} = (0, _lockUnlock.unlock)(select(_store.store));
|
|
52
|
-
const {
|
|
53
|
-
getCurrentPostType,
|
|
54
|
-
getCurrentTemplateId
|
|
55
|
-
} = select(_editor.store);
|
|
56
|
-
return {
|
|
57
|
-
isPage: _isPage(),
|
|
58
|
-
templateId: getCurrentTemplateId(),
|
|
59
|
-
currentPostType: getCurrentPostType()
|
|
60
|
-
};
|
|
61
|
-
}, []);
|
|
62
|
-
const {
|
|
63
|
-
onClick: editTemplate
|
|
64
|
-
} = (0, _link.useLink)({
|
|
65
|
-
postType: 'wp_template',
|
|
66
|
-
postId: templateId
|
|
67
|
-
});
|
|
68
|
-
const {
|
|
69
|
-
setRenderingMode
|
|
70
|
-
} = (0, _data.useDispatch)(_editor.store);
|
|
71
|
-
if (!isPage || canvas !== 'edit') {
|
|
72
|
-
return {
|
|
73
|
-
isLoading: false,
|
|
74
|
-
commands: []
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
const commands = [];
|
|
78
|
-
if (currentPostType !== 'wp_template') {
|
|
79
|
-
commands.push({
|
|
80
|
-
name: 'core/switch-to-template-focus',
|
|
81
|
-
label: (0, _i18n.sprintf)(/* translators: %s: template title */
|
|
82
|
-
(0, _i18n.__)('Edit template: %s'), (0, _htmlEntities.decodeEntities)(template.title)),
|
|
83
|
-
icon: _icons.layout,
|
|
84
|
-
callback: ({
|
|
85
|
-
close
|
|
86
|
-
}) => {
|
|
87
|
-
editTemplate();
|
|
88
|
-
close();
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
} else {
|
|
92
|
-
commands.push({
|
|
93
|
-
name: 'core/switch-to-page-focus',
|
|
94
|
-
label: (0, _i18n.__)('Back to page'),
|
|
95
|
-
icon: _icons.page,
|
|
96
|
-
callback: ({
|
|
97
|
-
close
|
|
98
|
-
}) => {
|
|
99
|
-
setRenderingMode('template-locked');
|
|
100
|
-
close();
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
return {
|
|
105
|
-
isLoading: false,
|
|
106
|
-
commands
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
function useManipulateDocumentCommands() {
|
|
110
|
-
const {
|
|
111
|
-
isLoaded,
|
|
112
|
-
record: template
|
|
113
|
-
} = (0, _useEditedEntityRecord.default)();
|
|
114
|
-
const {
|
|
115
|
-
removeTemplate,
|
|
116
|
-
revertTemplate
|
|
117
|
-
} = (0, _data.useDispatch)(_store.store);
|
|
118
|
-
const history = useHistory();
|
|
119
|
-
const isEditingPage = (0, _data.useSelect)(select => select(_store.store).isPage() && select(_editor.store).getCurrentPostType() !== 'wp_template', []);
|
|
120
|
-
if (!isLoaded) {
|
|
121
|
-
return {
|
|
122
|
-
isLoading: true,
|
|
123
|
-
commands: []
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
const commands = [];
|
|
127
|
-
if ((0, _isTemplateRevertable.default)(template) && !isEditingPage) {
|
|
128
|
-
const label = template.type === _constants.TEMPLATE_POST_TYPE ? (0, _i18n.sprintf)(/* translators: %s: template title */
|
|
129
|
-
(0, _i18n.__)('Reset template: %s'), (0, _htmlEntities.decodeEntities)(template.title)) : (0, _i18n.sprintf)(/* translators: %s: template part title */
|
|
130
|
-
(0, _i18n.__)('Reset template part: %s'), (0, _htmlEntities.decodeEntities)(template.title));
|
|
131
|
-
commands.push({
|
|
132
|
-
name: 'core/reset-template',
|
|
133
|
-
label,
|
|
134
|
-
icon: (0, _i18n.isRTL)() ? _icons.rotateRight : _icons.rotateLeft,
|
|
135
|
-
callback: ({
|
|
136
|
-
close
|
|
137
|
-
}) => {
|
|
138
|
-
revertTemplate(template);
|
|
139
|
-
close();
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
if ((0, _isTemplateRemovable.default)(template) && !isEditingPage) {
|
|
144
|
-
const label = template.type === _constants.TEMPLATE_POST_TYPE ? (0, _i18n.sprintf)(/* translators: %s: template title */
|
|
145
|
-
(0, _i18n.__)('Delete template: %s'), (0, _htmlEntities.decodeEntities)(template.title)) : (0, _i18n.sprintf)(/* translators: %s: template part title */
|
|
146
|
-
(0, _i18n.__)('Delete template part: %s'), (0, _htmlEntities.decodeEntities)(template.title));
|
|
147
|
-
commands.push({
|
|
148
|
-
name: 'core/remove-template',
|
|
149
|
-
label,
|
|
150
|
-
icon: _icons.trash,
|
|
151
|
-
callback: ({
|
|
152
|
-
close
|
|
153
|
-
}) => {
|
|
154
|
-
removeTemplate(template);
|
|
155
|
-
// Navigate to the template list
|
|
156
|
-
history.push({
|
|
157
|
-
postType: template.type
|
|
158
|
-
});
|
|
159
|
-
close();
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
return {
|
|
164
|
-
isLoading: !isLoaded,
|
|
165
|
-
commands
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
function useEditModeCommands() {
|
|
169
|
-
(0, _commands.useCommandLoader)({
|
|
170
|
-
name: 'core/edit-site/page-content-focus',
|
|
171
|
-
hook: usePageContentFocusCommands,
|
|
172
|
-
context: 'entity-edit'
|
|
173
|
-
});
|
|
174
|
-
(0, _commands.useCommandLoader)({
|
|
175
|
-
name: 'core/edit-site/manipulate-document',
|
|
176
|
-
hook: useManipulateDocumentCommands
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
//# sourceMappingURL=use-edit-mode-commands.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_i18n","_icons","_commands","_htmlEntities","_router","_editor","_store","_useEditedEntityRecord","_interopRequireDefault","_isTemplateRemovable","_isTemplateRevertable","_lockUnlock","_constants","_link","useHistory","useLocation","unlock","routerPrivateApis","usePageContentFocusCommands","record","template","useEditedEntityRecord","params","canvas","isPage","templateId","currentPostType","useSelect","select","_isPage","editSiteStore","getCurrentPostType","getCurrentTemplateId","editorStore","onClick","editTemplate","useLink","postType","postId","setRenderingMode","useDispatch","isLoading","commands","push","name","label","sprintf","__","decodeEntities","title","icon","layout","callback","close","page","useManipulateDocumentCommands","isLoaded","removeTemplate","revertTemplate","history","isEditingPage","isTemplateRevertable","type","TEMPLATE_POST_TYPE","isRTL","rotateRight","rotateLeft","isTemplateRemovable","trash","useEditModeCommands","useCommandLoader","hook","context"],"sources":["@wordpress/edit-site/src/hooks/commands/use-edit-mode-commands.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, sprintf, isRTL } from '@wordpress/i18n';\nimport { trash, rotateLeft, rotateRight, layout, page } from '@wordpress/icons';\nimport { useCommandLoader } from '@wordpress/commands';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport useEditedEntityRecord from '../../components/use-edited-entity-record';\nimport isTemplateRemovable from '../../utils/is-template-removable';\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport { unlock } from '../../lock-unlock';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport { useLink } from '../../components/routes/link';\n\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\n\nfunction usePageContentFocusCommands() {\n\tconst { record: template } = useEditedEntityRecord();\n\tconst { params } = useLocation();\n\tconst { canvas = 'view' } = params;\n\tconst { isPage, templateId, currentPostType } = useSelect( ( select ) => {\n\t\tconst { isPage: _isPage } = unlock( select( editSiteStore ) );\n\t\tconst { getCurrentPostType, getCurrentTemplateId } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tisPage: _isPage(),\n\t\t\ttemplateId: getCurrentTemplateId(),\n\t\t\tcurrentPostType: getCurrentPostType(),\n\t\t};\n\t}, [] );\n\n\tconst { onClick: editTemplate } = useLink( {\n\t\tpostType: 'wp_template',\n\t\tpostId: templateId,\n\t} );\n\n\tconst { setRenderingMode } = useDispatch( editorStore );\n\n\tif ( ! isPage || canvas !== 'edit' ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( currentPostType !== 'wp_template' ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/switch-to-template-focus',\n\t\t\tlabel: sprintf(\n\t\t\t\t/* translators: %s: template title */\n\t\t\t\t__( 'Edit template: %s' ),\n\t\t\t\tdecodeEntities( template.title )\n\t\t\t),\n\t\t\ticon: layout,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\teditTemplate();\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t} else {\n\t\tcommands.push( {\n\t\t\tname: 'core/switch-to-page-focus',\n\t\t\tlabel: __( 'Back to page' ),\n\t\t\ticon: page,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tsetRenderingMode( 'template-locked' );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn { isLoading: false, commands };\n}\n\nfunction useManipulateDocumentCommands() {\n\tconst { isLoaded, record: template } = useEditedEntityRecord();\n\tconst { removeTemplate, revertTemplate } = useDispatch( editSiteStore );\n\tconst history = useHistory();\n\tconst isEditingPage = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editSiteStore ).isPage() &&\n\t\t\tselect( editorStore ).getCurrentPostType() !== 'wp_template',\n\t\t[]\n\t);\n\n\tif ( ! isLoaded ) {\n\t\treturn { isLoading: true, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( isTemplateRevertable( template ) && ! isEditingPage ) {\n\t\tconst label =\n\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: %s: template title */\n\t\t\t\t\t\t__( 'Reset template: %s' ),\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: %s: template part title */\n\t\t\t\t\t\t__( 'Reset template part: %s' ),\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t );\n\t\tcommands.push( {\n\t\t\tname: 'core/reset-template',\n\t\t\tlabel,\n\t\t\ticon: isRTL() ? rotateRight : rotateLeft,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\trevertTemplate( template );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\tif ( isTemplateRemovable( template ) && ! isEditingPage ) {\n\t\tconst label =\n\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: %s: template title */\n\t\t\t\t\t\t__( 'Delete template: %s' ),\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: %s: template part title */\n\t\t\t\t\t\t__( 'Delete template part: %s' ),\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t );\n\t\tcommands.push( {\n\t\t\tname: 'core/remove-template',\n\t\t\tlabel,\n\t\t\ticon: trash,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tremoveTemplate( template );\n\t\t\t\t// Navigate to the template list\n\t\t\t\thistory.push( {\n\t\t\t\t\tpostType: template.type,\n\t\t\t\t} );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn {\n\t\tisLoading: ! isLoaded,\n\t\tcommands,\n\t};\n}\n\nexport function useEditModeCommands() {\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/page-content-focus',\n\t\thook: usePageContentFocusCommands,\n\t\tcontext: 'entity-edit',\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/manipulate-document',\n\t\thook: useManipulateDocumentCommands,\n\t} );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAKA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,sBAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,oBAAA,GAAAD,sBAAA,CAAAT,OAAA;AACA,IAAAW,qBAAA,GAAAF,sBAAA,CAAAT,OAAA;AACA,IAAAY,WAAA,GAAAZ,OAAA;AACA,IAAAa,UAAA,GAAAb,OAAA;AACA,IAAAc,KAAA,GAAAd,OAAA;AApBA;AACA;AACA;;AASA;AACA;AACA;;AASA,MAAM;EAAEe,UAAU;EAAEC;AAAY,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAE/D,SAASC,2BAA2BA,CAAA,EAAG;EACtC,MAAM;IAAEC,MAAM,EAAEC;EAAS,CAAC,GAAG,IAAAC,8BAAqB,EAAC,CAAC;EACpD,MAAM;IA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