@wordpress/edit-site 5.24.1 → 5.25.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/add-custom-template-modal-content.js +2 -3
- package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +48 -23
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/site-editor-canvas.js +5 -54
- package/build/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build/components/block-editor/use-site-editor-settings.js +14 -5
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/editor/index.js +6 -17
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/collection-font-variant.js +8 -7
- package/build/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +1 -1
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/library-font-variant.js +8 -7
- package/build/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
- package/build/components/global-styles/screen-revisions/get-revision-changes.js +146 -0
- package/build/components/global-styles/screen-revisions/get-revision-changes.js.map +1 -0
- package/build/components/global-styles/screen-revisions/index.js +6 -10
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +63 -13
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/header-edit-mode/document-tools/index.js +17 -10
- package/build/components/header-edit-mode/document-tools/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +16 -38
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/index.js +11 -9
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build/components/layout/index.js +9 -8
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page/header.js +2 -1
- package/build/components/page/header.js.map +1 -1
- package/build/components/page-pages/index.js +31 -28
- package/build/components/page-pages/index.js.map +1 -1
- package/build/components/page-patterns/patterns-list.js +1 -2
- package/build/components/page-patterns/patterns-list.js.map +1 -1
- package/build/components/page-patterns/rename-menu-item.js +3 -0
- package/build/components/page-patterns/rename-menu-item.js.map +1 -1
- package/build/components/page-templates/dataviews-templates.js +18 -17
- package/build/components/page-templates/dataviews-templates.js.map +1 -1
- package/build/components/preferences-modal/index.js +36 -20
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/routes/use-title.js +3 -4
- package/build/components/routes/use-title.js.map +1 -1
- package/build/components/save-button/index.js +2 -1
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/sidebar/index.js +26 -12
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-dataviews/dataview-item.js +2 -10
- package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +2 -2
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/index.js +9 -3
- package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js +1 -2
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +3 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.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-template/home-template-details.js +3 -89
- package/build/components/sidebar-navigation-screen-template/home-template-details.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/index.js +2 -1
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/template-areas.js +117 -0
- package/build/components/sidebar-navigation-screen-template/template-areas.js.map +1 -0
- package/build/components/site-hub/index.js +6 -3
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/template-actions/rename-menu-item.js +3 -0
- package/build/components/template-actions/rename-menu-item.js.map +1 -1
- package/build/components/welcome-guide/styles.js +1 -1
- package/build/components/welcome-guide/styles.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +9 -1
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/hooks/navigation-menu-edit.js +1 -1
- package/build/hooks/navigation-menu-edit.js.map +1 -1
- package/build/hooks/template-part-edit.js +1 -1
- package/build/hooks/template-part-edit.js.map +1 -1
- package/build/store/actions.js +15 -8
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +0 -18
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +12 -6
- package/build/store/selectors.js.map +1 -1
- package/build/utils/constants.js +15 -1
- package/build/utils/constants.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-template-modal-content.js +1 -1
- package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +50 -25
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/site-editor-canvas.js +8 -56
- package/build-module/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +14 -5
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/editor/index.js +9 -20
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/collection-font-variant.js +9 -7
- package/build-module/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/library-font-variant.js +9 -7
- package/build-module/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/get-revision-changes.js +139 -0
- package/build-module/components/global-styles/screen-revisions/get-revision-changes.js.map +1 -0
- package/build-module/components/global-styles/screen-revisions/index.js +7 -11
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +64 -14
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/header-edit-mode/document-tools/index.js +17 -10
- package/build-module/components/header-edit-mode/document-tools/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +20 -42
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js +12 -10
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build-module/components/layout/index.js +9 -8
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page/header.js +2 -1
- package/build-module/components/page/header.js.map +1 -1
- package/build-module/components/page-pages/index.js +31 -28
- package/build-module/components/page-pages/index.js.map +1 -1
- package/build-module/components/page-patterns/patterns-list.js +1 -2
- package/build-module/components/page-patterns/patterns-list.js.map +1 -1
- package/build-module/components/page-patterns/rename-menu-item.js +3 -0
- package/build-module/components/page-patterns/rename-menu-item.js.map +1 -1
- package/build-module/components/page-templates/dataviews-templates.js +18 -17
- package/build-module/components/page-templates/dataviews-templates.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +37 -21
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/routes/use-title.js +3 -4
- package/build-module/components/routes/use-title.js.map +1 -1
- package/build-module/components/save-button/index.js +2 -1
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +26 -12
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/dataview-item.js +2 -10
- package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +2 -2
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/index.js +9 -3
- package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +2 -3
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +3 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.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-template/home-template-details.js +5 -90
- package/build-module/components/sidebar-navigation-screen-template/home-template-details.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js +2 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/template-areas.js +109 -0
- package/build-module/components/sidebar-navigation-screen-template/template-areas.js.map +1 -0
- package/build-module/components/site-hub/index.js +6 -3
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/template-actions/rename-menu-item.js +3 -0
- package/build-module/components/template-actions/rename-menu-item.js.map +1 -1
- package/build-module/components/welcome-guide/styles.js +1 -1
- package/build-module/components/welcome-guide/styles.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +9 -1
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/hooks/navigation-menu-edit.js +1 -1
- package/build-module/hooks/navigation-menu-edit.js.map +1 -1
- package/build-module/hooks/template-part-edit.js +1 -1
- package/build-module/hooks/template-part-edit.js.map +1 -1
- package/build-module/store/actions.js +13 -6
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +0 -17
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +10 -3
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/constants.js +8 -0
- package/build-module/utils/constants.js.map +1 -1
- package/build-style/style-rtl.css +302 -354
- package/build-style/style.css +302 -354
- package/package.json +42 -42
- package/src/components/add-new-template/add-custom-template-modal-content.js +1 -1
- package/src/components/block-editor/editor-canvas.js +63 -47
- package/src/components/block-editor/site-editor-canvas.js +32 -96
- package/src/components/block-editor/style.scss +6 -12
- package/src/components/block-editor/use-site-editor-settings.js +47 -36
- package/src/components/editor/index.js +10 -16
- package/src/components/global-styles/font-library-modal/collection-font-variant.js +12 -6
- package/src/components/global-styles/font-library-modal/context.js +1 -1
- package/src/components/global-styles/font-library-modal/library-font-variant.js +12 -6
- package/src/components/global-styles/screen-revisions/get-revision-changes.js +171 -0
- package/src/components/global-styles/screen-revisions/index.js +4 -11
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +86 -17
- package/src/components/global-styles/screen-revisions/style.scss +10 -2
- package/src/components/global-styles/screen-revisions/test/get-revision-changes.js +191 -0
- package/src/components/header-edit-mode/document-tools/index.js +13 -13
- package/src/components/header-edit-mode/index.js +29 -63
- package/src/components/header-edit-mode/more-menu/index.js +18 -22
- package/src/components/header-edit-mode/style.scss +58 -33
- package/src/components/layout/index.js +21 -20
- package/src/components/list/style.scss +5 -0
- package/src/components/page/header.js +2 -1
- package/src/components/page/style.scss +2 -2
- package/src/components/page-pages/index.js +59 -35
- package/src/components/page-pages/style.scss +3 -1
- package/src/components/page-patterns/patterns-list.js +5 -2
- package/src/components/page-patterns/rename-menu-item.js +7 -1
- package/src/components/page-templates/dataviews-templates.js +28 -13
- package/src/components/preferences-modal/index.js +59 -33
- package/src/components/routes/use-title.js +3 -10
- package/src/components/save-button/index.js +1 -0
- package/src/components/sidebar/index.js +41 -24
- package/src/components/sidebar/style.scss +10 -12
- package/src/components/sidebar-dataviews/dataview-item.js +3 -7
- package/src/components/sidebar-dataviews/default-views.js +2 -2
- package/src/components/sidebar-edit-mode/page-panels/index.js +39 -25
- package/src/components/sidebar-edit-mode/page-panels/page-summary.js +2 -2
- package/src/components/sidebar-edit-mode/page-panels/style.scss +1 -42
- package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +7 -1
- package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
- package/src/components/sidebar-navigation-screen-template/home-template-details.js +1 -96
- package/src/components/sidebar-navigation-screen-template/index.js +8 -2
- package/src/components/sidebar-navigation-screen-template/template-areas.js +135 -0
- package/src/components/site-hub/index.js +4 -5
- package/src/components/template-actions/rename-menu-item.js +7 -1
- package/src/components/welcome-guide/styles.js +1 -1
- package/src/hooks/commands/use-common-commands.js +10 -5
- package/src/hooks/navigation-menu-edit.js +1 -1
- package/src/hooks/template-part-edit.js +1 -1
- package/src/store/actions.js +15 -5
- package/src/store/reducer.js +0 -18
- package/src/store/selectors.js +15 -3
- package/src/style.scss +1 -2
- package/src/utils/constants.js +8 -0
- package/build/components/dataviews/add-filter.js +0 -91
- package/build/components/dataviews/add-filter.js.map +0 -1
- package/build/components/dataviews/constants.js +0 -14
- package/build/components/dataviews/constants.js.map +0 -1
- package/build/components/dataviews/dataviews.js +0 -99
- package/build/components/dataviews/dataviews.js.map +0 -1
- package/build/components/dataviews/filter-summary.js +0 -62
- package/build/components/dataviews/filter-summary.js.map +0 -1
- package/build/components/dataviews/filters.js +0 -63
- package/build/components/dataviews/filters.js.map +0 -1
- package/build/components/dataviews/index.js +0 -21
- package/build/components/dataviews/index.js.map +0 -1
- package/build/components/dataviews/item-actions.js +0 -184
- package/build/components/dataviews/item-actions.js.map +0 -1
- package/build/components/dataviews/pagination.js +0 -123
- package/build/components/dataviews/pagination.js.map +0 -1
- package/build/components/dataviews/reset-filters.js +0 -33
- package/build/components/dataviews/reset-filters.js.map +0 -1
- package/build/components/dataviews/search.js +0 -51
- package/build/components/dataviews/search.js.map +0 -1
- package/build/components/dataviews/view-actions.js +0 -244
- package/build/components/dataviews/view-actions.js.map +0 -1
- package/build/components/dataviews/view-grid.js +0 -82
- package/build/components/dataviews/view-grid.js.map +0 -1
- package/build/components/dataviews/view-list.js +0 -399
- package/build/components/dataviews/view-list.js.map +0 -1
- package/build/components/dataviews/view-side-by-side.js +0 -20
- package/build/components/dataviews/view-side-by-side.js.map +0 -1
- package/build/components/header-edit-mode/document-actions/index.js +0 -172
- package/build/components/header-edit-mode/document-actions/index.js.map +0 -1
- package/build/components/page-content-focus-notifications/back-to-page-notification.js +0 -61
- package/build/components/page-content-focus-notifications/back-to-page-notification.js.map +0 -1
- package/build/components/page-content-focus-notifications/edit-template-notification.js +0 -102
- package/build/components/page-content-focus-notifications/edit-template-notification.js.map +0 -1
- package/build/components/page-content-focus-notifications/index.js +0 -22
- package/build/components/page-content-focus-notifications/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/edit-template.js +0 -101
- package/build/components/sidebar-edit-mode/page-panels/edit-template.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/hooks.js +0 -79
- package/build/components/sidebar-edit-mode/page-panels/hooks.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/reset-default-template.js +0 -48
- package/build/components/sidebar-edit-mode/page-panels/reset-default-template.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/swap-template-button.js +0 -84
- package/build/components/sidebar-edit-mode/page-panels/swap-template-button.js.map +0 -1
- package/build/utils/use-debounced-input.js +0 -22
- package/build/utils/use-debounced-input.js.map +0 -1
- package/build-module/components/dataviews/add-filter.js +0 -84
- package/build-module/components/dataviews/add-filter.js.map +0 -1
- package/build-module/components/dataviews/constants.js +0 -6
- package/build-module/components/dataviews/constants.js.map +0 -1
- package/build-module/components/dataviews/dataviews.js +0 -90
- package/build-module/components/dataviews/dataviews.js.map +0 -1
- package/build-module/components/dataviews/filter-summary.js +0 -55
- package/build-module/components/dataviews/filter-summary.js.map +0 -1
- package/build-module/components/dataviews/filters.js +0 -55
- package/build-module/components/dataviews/filters.js.map +0 -1
- package/build-module/components/dataviews/index.js +0 -2
- package/build-module/components/dataviews/index.js.map +0 -1
- package/build-module/components/dataviews/item-actions.js +0 -177
- package/build-module/components/dataviews/item-actions.js.map +0 -1
- package/build-module/components/dataviews/pagination.js +0 -115
- package/build-module/components/dataviews/pagination.js.map +0 -1
- package/build-module/components/dataviews/reset-filters.js +0 -26
- package/build-module/components/dataviews/reset-filters.js.map +0 -1
- package/build-module/components/dataviews/search.js +0 -43
- package/build-module/components/dataviews/search.js.map +0 -1
- package/build-module/components/dataviews/view-actions.js +0 -237
- package/build-module/components/dataviews/view-actions.js.map +0 -1
- package/build-module/components/dataviews/view-grid.js +0 -74
- package/build-module/components/dataviews/view-grid.js.map +0 -1
- package/build-module/components/dataviews/view-list.js +0 -390
- package/build-module/components/dataviews/view-list.js.map +0 -1
- package/build-module/components/dataviews/view-side-by-side.js +0 -12
- package/build-module/components/dataviews/view-side-by-side.js.map +0 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +0 -164
- package/build-module/components/header-edit-mode/document-actions/index.js.map +0 -1
- package/build-module/components/page-content-focus-notifications/back-to-page-notification.js +0 -54
- package/build-module/components/page-content-focus-notifications/back-to-page-notification.js.map +0 -1
- package/build-module/components/page-content-focus-notifications/edit-template-notification.js +0 -96
- package/build-module/components/page-content-focus-notifications/edit-template-notification.js.map +0 -1
- package/build-module/components/page-content-focus-notifications/index.js +0 -14
- package/build-module/components/page-content-focus-notifications/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js +0 -93
- package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/hooks.js +0 -69
- package/build-module/components/sidebar-edit-mode/page-panels/hooks.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/reset-default-template.js +0 -41
- package/build-module/components/sidebar-edit-mode/page-panels/reset-default-template.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/swap-template-button.js +0 -77
- package/build-module/components/sidebar-edit-mode/page-panels/swap-template-button.js.map +0 -1
- package/build-module/utils/use-debounced-input.js +0 -15
- package/build-module/utils/use-debounced-input.js.map +0 -1
- package/src/components/dataviews/README.md +0 -191
- package/src/components/dataviews/add-filter.js +0 -108
- package/src/components/dataviews/constants.js +0 -5
- package/src/components/dataviews/dataviews.js +0 -99
- package/src/components/dataviews/filter-summary.js +0 -79
- package/src/components/dataviews/filters.js +0 -65
- package/src/components/dataviews/index.js +0 -1
- package/src/components/dataviews/item-actions.js +0 -208
- package/src/components/dataviews/pagination.js +0 -144
- package/src/components/dataviews/reset-filters.js +0 -26
- package/src/components/dataviews/search.js +0 -42
- package/src/components/dataviews/style.scss +0 -131
- package/src/components/dataviews/view-actions.js +0 -319
- package/src/components/dataviews/view-grid.js +0 -90
- package/src/components/dataviews/view-list.js +0 -512
- package/src/components/dataviews/view-side-by-side.js +0 -9
- package/src/components/header-edit-mode/document-actions/index.js +0 -204
- package/src/components/header-edit-mode/document-actions/style.scss +0 -145
- package/src/components/page-content-focus-notifications/back-to-page-notification.js +0 -58
- package/src/components/page-content-focus-notifications/edit-template-notification.js +0 -104
- package/src/components/page-content-focus-notifications/index.js +0 -14
- package/src/components/sidebar-edit-mode/page-panels/edit-template.js +0 -108
- package/src/components/sidebar-edit-mode/page-panels/hooks.js +0 -99
- package/src/components/sidebar-edit-mode/page-panels/reset-default-template.js +0 -45
- package/src/components/sidebar-edit-mode/page-panels/swap-template-button.js +0 -83
- package/src/utils/use-debounced-input.js +0 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["removeAccents","Icon","__experimentalHeading","Heading","__experimentalText","Text","__experimentalHStack","HStack","__experimentalVStack","VStack","VisuallyHidden","__","_x","useState","useMemo","useCallback","useEntityRecords","decodeEntities","parse","BlockPreview","privateApis","blockEditorPrivateApis","Page","Link","useAddedBy","AvatarImage","TEMPLATE_POST_TYPE","DataViews","ENUMERATION_TYPE","OPERATOR_IN","useResetTemplateAction","deleteTemplateAction","renameTemplateAction","usePatternSettings","unlock","ExperimentalBlockEditorProvider","useGlobalStyle","EMPTY_ARRAY","defaultConfigPerViewType","list","grid","mediaField","primaryField","DEFAULT_VIEW","type","search","page","perPage","hiddenFields","layout","filters","normalizeSearchInput","input","trim","toLowerCase","TemplateTitle","item","isCustomized","id","createElement","spacing","as","level","params","postId","postType","canvas","title","rendered","slug","className","AuthorField","text","icon","imageUrl","alignment","TemplatePreview","content","viewType","settings","backgroundColor","blocks","length","style","DataviewsTemplates","view","setView","records","allTemplates","isResolving","isLoadingData","per_page","authors","authorsSet","Set","forEach","template","add","author_text","Array","from","map","author","value","label","fields","header","render","raw","minWidth","maxWidth","enableSorting","getValue","enableHiding","description","Fragment","variant","elements","shownTemplates","paginationInfo","totalItems","totalPages","filteredTemplates","normalizedSearch","filter","includes","field","operator","sort","stringSortingFields","fieldId","fieldToSort","find","a","b","_fieldToSort$getValue","_fieldToSort$getValue2","valueA","valueB","direction","localeCompare","start","slice","Math","ceil","resetTemplateAction","actions","onChangeView","viewUpdater","updatedView","data","getItemId","isLoading","supportedLayouts"],"sources":["@wordpress/edit-site/src/components/page-templates/dataviews-templates.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\t__experimentalHeading as Heading,\n\t__experimentalText as Text,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport { useState, useMemo, useCallback } from '@wordpress/element';\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { parse } from '@wordpress/blocks';\nimport {\n\tBlockPreview,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport Page from '../page';\nimport Link from '../routes/link';\nimport { useAddedBy, AvatarImage } from '../list/added-by';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport { DataViews } from '../dataviews';\nimport { ENUMERATION_TYPE, OPERATOR_IN } from '../dataviews/constants';\nimport {\n\tuseResetTemplateAction,\n\tdeleteTemplateAction,\n\trenameTemplateAction,\n} from './template-actions';\nimport usePatternSettings from '../page-patterns/use-pattern-settings';\nimport { unlock } from '../../lock-unlock';\n\nconst { ExperimentalBlockEditorProvider, useGlobalStyle } = unlock(\n\tblockEditorPrivateApis\n);\n\nconst EMPTY_ARRAY = [];\n\nconst defaultConfigPerViewType = {\n\tlist: {},\n\tgrid: {\n\t\tmediaField: 'preview',\n\t\tprimaryField: 'title',\n\t},\n};\n\nconst DEFAULT_VIEW = {\n\ttype: 'list',\n\tsearch: '',\n\tpage: 1,\n\tperPage: 20,\n\t// All fields are visible by default, so it's\n\t// better to keep track of the hidden ones.\n\thiddenFields: [ 'preview' ],\n\tlayout: {},\n\tfilters: [],\n};\n\nfunction normalizeSearchInput( input = '' ) {\n\treturn removeAccents( input.trim().toLowerCase() );\n}\n\n// TODO: these are going to be reused in the template part list.\n// That's the reason for leaving the template parts code for now.\nfunction TemplateTitle( { item } ) {\n\tconst { isCustomized } = useAddedBy( item.type, item.id );\n\treturn (\n\t\t<VStack spacing={ 1 }>\n\t\t\t<Heading as=\"h3\" level={ 5 }>\n\t\t\t\t<Link\n\t\t\t\t\tparams={ {\n\t\t\t\t\t\tpostId: item.id,\n\t\t\t\t\t\tpostType: item.type,\n\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ decodeEntities( item.title?.rendered || item.slug ) ||\n\t\t\t\t\t\t__( '(no title)' ) }\n\t\t\t\t</Link>\n\t\t\t</Heading>\n\t\t\t{ isCustomized && (\n\t\t\t\t<span className=\"edit-site-list-added-by__customized-info\">\n\t\t\t\t\t{ item.type === TEMPLATE_POST_TYPE\n\t\t\t\t\t\t? _x( 'Customized', 'template' )\n\t\t\t\t\t\t: _x( 'Customized', 'template part' ) }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nfunction AuthorField( { item } ) {\n\tconst { text, icon, imageUrl } = useAddedBy( item.type, item.id );\n\treturn (\n\t\t<HStack alignment=\"left\" spacing={ 1 }>\n\t\t\t{ imageUrl ? (\n\t\t\t\t<AvatarImage imageUrl={ imageUrl } />\n\t\t\t) : (\n\t\t\t\t<div className=\"edit-site-list-added-by__icon\">\n\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<span>{ text }</span>\n\t\t</HStack>\n\t);\n}\n\nfunction TemplatePreview( { content, viewType } ) {\n\tconst settings = usePatternSettings();\n\tconst [ backgroundColor = 'white' ] = useGlobalStyle( 'color.background' );\n\tconst blocks = useMemo( () => {\n\t\treturn parse( content );\n\t}, [ content ] );\n\tif ( ! blocks?.length ) {\n\t\treturn null;\n\t}\n\t// Wrap everything in a block editor provider to ensure 'styles' that are needed\n\t// for the previews are synced between the site editor store and the block editor store.\n\t// Additionally we need to have the `__experimentalBlockPatterns` setting in order to\n\t// render patterns inside the previews.\n\t// TODO: Same approach is used in the patterns list and it becomes obvious that some of\n\t// the block editor settings are needed in context where we don't have the block editor.\n\t// Explore how we can solve this in a better way.\n\treturn (\n\t\t<ExperimentalBlockEditorProvider settings={ settings }>\n\t\t\t<div\n\t\t\t\tclassName={ `page-templates-preview-field is-viewtype-${ viewType }` }\n\t\t\t\tstyle={ { backgroundColor } }\n\t\t\t>\n\t\t\t\t<BlockPreview blocks={ blocks } />\n\t\t\t</div>\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n}\n\nexport default function DataviewsTemplates() {\n\tconst [ view, setView ] = useState( DEFAULT_VIEW );\n\tconst { records: allTemplates, isResolving: isLoadingData } =\n\t\tuseEntityRecords( 'postType', TEMPLATE_POST_TYPE, {\n\t\t\tper_page: -1,\n\t\t} );\n\n\tconst authors = useMemo( () => {\n\t\tif ( ! allTemplates ) {\n\t\t\treturn EMPTY_ARRAY;\n\t\t}\n\t\tconst authorsSet = new Set();\n\t\tallTemplates.forEach( ( template ) => {\n\t\t\tauthorsSet.add( template.author_text );\n\t\t} );\n\t\treturn Array.from( authorsSet ).map( ( author ) => ( {\n\t\t\tvalue: author,\n\t\t\tlabel: author,\n\t\t} ) );\n\t}, [ allTemplates ] );\n\n\tconst fields = useMemo(\n\t\t() => [\n\t\t\t{\n\t\t\t\theader: __( 'Preview' ),\n\t\t\t\tid: 'preview',\n\t\t\t\trender: ( { item, view: { type: viewType } } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<TemplatePreview\n\t\t\t\t\t\t\tcontent={ item.content.raw }\n\t\t\t\t\t\t\tviewType={ viewType }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tminWidth: 120,\n\t\t\t\tmaxWidth: 120,\n\t\t\t\tenableSorting: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\theader: __( 'Template' ),\n\t\t\t\tid: 'title',\n\t\t\t\tgetValue: ( { item } ) => item.title?.rendered || item.slug,\n\t\t\t\trender: ( { item } ) => <TemplateTitle item={ item } />,\n\t\t\t\tmaxWidth: 400,\n\t\t\t\tenableHiding: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\theader: __( 'Description' ),\n\t\t\t\tid: 'description',\n\t\t\t\tgetValue: ( { item } ) => item.description,\n\t\t\t\trender: ( { item } ) => {\n\t\t\t\t\treturn item.description ? (\n\t\t\t\t\t\tdecodeEntities( item.description )\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<Text variant=\"muted\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t—\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t<VisuallyHidden>\n\t\t\t\t\t\t\t\t{ __( 'No description.' ) }\n\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t</>\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tmaxWidth: 200,\n\t\t\t\tenableSorting: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\theader: __( 'Author' ),\n\t\t\t\tid: 'author',\n\t\t\t\tgetValue: ( { item } ) => item.author_text,\n\t\t\t\trender: ( { item } ) => {\n\t\t\t\t\treturn <AuthorField item={ item } />;\n\t\t\t\t},\n\t\t\t\tenableHiding: false,\n\t\t\t\ttype: ENUMERATION_TYPE,\n\t\t\t\telements: authors,\n\t\t\t},\n\t\t],\n\t\t[ authors ]\n\t);\n\n\tconst { shownTemplates, paginationInfo } = useMemo( () => {\n\t\tif ( ! allTemplates ) {\n\t\t\treturn {\n\t\t\t\tshownTemplates: EMPTY_ARRAY,\n\t\t\t\tpaginationInfo: { totalItems: 0, totalPages: 0 },\n\t\t\t};\n\t\t}\n\t\tlet filteredTemplates = [ ...allTemplates ];\n\t\t// Handle global search.\n\t\tif ( view.search ) {\n\t\t\tconst normalizedSearch = normalizeSearchInput( view.search );\n\t\t\tfilteredTemplates = filteredTemplates.filter( ( item ) => {\n\t\t\t\tconst title = item.title?.rendered || item.slug;\n\t\t\t\treturn (\n\t\t\t\t\tnormalizeSearchInput( title ).includes(\n\t\t\t\t\t\tnormalizedSearch\n\t\t\t\t\t) ||\n\t\t\t\t\tnormalizeSearchInput( item.description ).includes(\n\t\t\t\t\t\tnormalizedSearch\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t} );\n\t\t}\n\n\t\t// Handle filters.\n\t\tif ( view.filters.length > 0 ) {\n\t\t\tview.filters.forEach( ( filter ) => {\n\t\t\t\tif (\n\t\t\t\t\tfilter.field === 'author' &&\n\t\t\t\t\tfilter.operator === OPERATOR_IN &&\n\t\t\t\t\t!! filter.value\n\t\t\t\t) {\n\t\t\t\t\tfilteredTemplates = filteredTemplates.filter( ( item ) => {\n\t\t\t\t\t\treturn item.author_text === filter.value;\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\t// Handle sorting.\n\t\tif ( view.sort ) {\n\t\t\tconst stringSortingFields = [ 'title', 'author' ];\n\t\t\tconst fieldId = view.sort.field;\n\t\t\tif ( stringSortingFields.includes( fieldId ) ) {\n\t\t\t\tconst fieldToSort = fields.find( ( field ) => {\n\t\t\t\t\treturn field.id === fieldId;\n\t\t\t\t} );\n\t\t\t\tfilteredTemplates.sort( ( a, b ) => {\n\t\t\t\t\tconst valueA = fieldToSort.getValue( { item: a } ) ?? '';\n\t\t\t\t\tconst valueB = fieldToSort.getValue( { item: b } ) ?? '';\n\t\t\t\t\treturn view.sort.direction === 'asc'\n\t\t\t\t\t\t? valueA.localeCompare( valueB )\n\t\t\t\t\t\t: valueB.localeCompare( valueA );\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\n\t\t// Handle pagination.\n\t\tconst start = ( view.page - 1 ) * view.perPage;\n\t\tconst totalItems = filteredTemplates?.length || 0;\n\t\tfilteredTemplates = filteredTemplates?.slice(\n\t\t\tstart,\n\t\t\tstart + view.perPage\n\t\t);\n\t\treturn {\n\t\t\tshownTemplates: filteredTemplates,\n\t\t\tpaginationInfo: {\n\t\t\t\ttotalItems,\n\t\t\t\ttotalPages: Math.ceil( totalItems / view.perPage ),\n\t\t\t},\n\t\t};\n\t}, [ allTemplates, view, fields ] );\n\n\tconst resetTemplateAction = useResetTemplateAction();\n\tconst actions = useMemo(\n\t\t() => [\n\t\t\tresetTemplateAction,\n\t\t\tdeleteTemplateAction,\n\t\t\trenameTemplateAction,\n\t\t],\n\t\t[ resetTemplateAction ]\n\t);\n\tconst onChangeView = useCallback(\n\t\t( viewUpdater ) => {\n\t\t\tlet updatedView =\n\t\t\t\ttypeof viewUpdater === 'function'\n\t\t\t\t\t? viewUpdater( view )\n\t\t\t\t\t: viewUpdater;\n\t\t\tif ( updatedView.type !== view.type ) {\n\t\t\t\tupdatedView = {\n\t\t\t\t\t...updatedView,\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\t...defaultConfigPerViewType[ updatedView.type ],\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tsetView( updatedView );\n\t\t},\n\t\t[ view, setView ]\n\t);\n\treturn (\n\t\t<Page title={ __( 'Templates' ) }>\n\t\t\t<DataViews\n\t\t\t\tpaginationInfo={ paginationInfo }\n\t\t\t\tfields={ fields }\n\t\t\t\tactions={ actions }\n\t\t\t\tdata={ shownTemplates }\n\t\t\t\tgetItemId={ ( item ) => item.id }\n\t\t\t\tisLoading={ isLoadingData }\n\t\t\t\tview={ view }\n\t\t\t\tonChangeView={ onChangeView }\n\t\t\t\tsupportedLayouts={ [ 'list', 'grid' ] }\n\t\t\t/>\n\t\t</Page>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,aAAa,MAAM,gBAAgB;;AAE1C;AACA;AACA;AACA,SACCC,IAAI,EACJC,qBAAqB,IAAIC,OAAO,EAChCC,kBAAkB,IAAIC,IAAI,EAC1BC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,cAAc,QACR,uBAAuB;AAC9B,SAASC,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SAASC,QAAQ,EAAEC,OAAO,EAAEC,WAAW,QAAQ,oBAAoB;AACnE,SAASC,gBAAgB,QAAQ,sBAAsB;AACvD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,KAAK,QAAQ,mBAAmB;AACzC,SACCC,YAAY,EACZC,WAAW,IAAIC,sBAAsB,QAC/B,yBAAyB;;AAEhC;AACA;AACA;AACA,OAAOC,IAAI,MAAM,SAAS;AAC1B,OAAOC,IAAI,MAAM,gBAAgB;AACjC,SAASC,UAAU,EAAEC,WAAW,QAAQ,kBAAkB;AAC1D,SAASC,kBAAkB,QAAQ,uBAAuB;AAC1D,SAASC,SAAS,QAAQ,cAAc;AACxC,SAASC,gBAAgB,EAAEC,WAAW,QAAQ,wBAAwB;AACtE,SACCC,sBAAsB,EACtBC,oBAAoB,EACpBC,oBAAoB,QACd,oBAAoB;AAC3B,OAAOC,kBAAkB,MAAM,uCAAuC;AACtE,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC,+BAA+B;EAAEC;AAAe,CAAC,GAAGF,MAAM,CACjEb,sBACD,CAAC;AAED,MAAMgB,WAAW,GAAG,EAAE;AAEtB,MAAMC,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M,EAAE,MAAM;EAAI,CACvC,CACI,CAAC;AAET"}
|
|
1
|
+
{"version":3,"names":["removeAccents","Icon","__experimentalView","View","__experimentalText","Text","__experimentalHStack","HStack","__experimentalVStack","VStack","VisuallyHidden","__","_x","useState","useMemo","useCallback","useEntityRecords","decodeEntities","parse","BlockPreview","privateApis","blockEditorPrivateApis","DataViews","Page","Link","useAddedBy","AvatarImage","TEMPLATE_POST_TYPE","ENUMERATION_TYPE","OPERATOR_IN","OPERATOR_NOT_IN","LAYOUT_GRID","LAYOUT_TABLE","useResetTemplateAction","deleteTemplateAction","renameTemplateAction","usePatternSettings","unlock","ExperimentalBlockEditorProvider","useGlobalStyle","EMPTY_ARRAY","defaultConfigPerViewType","mediaField","primaryField","DEFAULT_VIEW","type","search","page","perPage","hiddenFields","layout","filters","normalizeSearchInput","input","trim","toLowerCase","TemplateTitle","item","isCustomized","id","createElement","spacing","as","className","params","postId","postType","canvas","title","rendered","slug","AuthorField","text","icon","imageUrl","alignment","TemplatePreview","content","viewType","settings","backgroundColor","blocks","length","style","DataviewsTemplates","view","setView","records","allTemplates","isResolving","isLoadingData","per_page","authors","authorsSet","Set","forEach","template","add","author_text","Array","from","map","author","value","label","fields","header","render","raw","minWidth","maxWidth","enableSorting","getValue","enableHiding","description","Fragment","variant","elements","shownTemplates","paginationInfo","totalItems","totalPages","filteredTemplates","normalizedSearch","filter","includes","field","operator","sort","stringSortingFields","fieldId","fieldToSort","find","a","b","_fieldToSort$getValue","_fieldToSort$getValue2","valueA","valueB","direction","localeCompare","start","slice","Math","ceil","resetTemplateAction","actions","onChangeView","viewUpdater","updatedView","data","getItemId","isLoading","supportedLayouts","deferredRendering"],"sources":["@wordpress/edit-site/src/components/page-templates/dataviews-templates.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\t__experimentalView as View,\n\t__experimentalText as Text,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport { useState, useMemo, useCallback } from '@wordpress/element';\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { parse } from '@wordpress/blocks';\nimport {\n\tBlockPreview,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { DataViews } from '@wordpress/dataviews';\n\n/**\n * Internal dependencies\n */\nimport Page from '../page';\nimport Link from '../routes/link';\nimport { useAddedBy, AvatarImage } from '../list/added-by';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tENUMERATION_TYPE,\n\tOPERATOR_IN,\n\tOPERATOR_NOT_IN,\n\tLAYOUT_GRID,\n\tLAYOUT_TABLE,\n} from '../../utils/constants';\nimport {\n\tuseResetTemplateAction,\n\tdeleteTemplateAction,\n\trenameTemplateAction,\n} from './template-actions';\nimport usePatternSettings from '../page-patterns/use-pattern-settings';\nimport { unlock } from '../../lock-unlock';\n\nconst { ExperimentalBlockEditorProvider, useGlobalStyle } = unlock(\n\tblockEditorPrivateApis\n);\n\nconst EMPTY_ARRAY = [];\n\nconst defaultConfigPerViewType = {\n\t[ LAYOUT_TABLE ]: {},\n\t[ LAYOUT_GRID ]: {\n\t\tmediaField: 'preview',\n\t\tprimaryField: 'title',\n\t},\n};\n\nconst DEFAULT_VIEW = {\n\ttype: LAYOUT_TABLE,\n\tsearch: '',\n\tpage: 1,\n\tperPage: 20,\n\t// All fields are visible by default, so it's\n\t// better to keep track of the hidden ones.\n\thiddenFields: [ 'preview' ],\n\tlayout: {},\n\tfilters: [],\n};\n\nfunction normalizeSearchInput( input = '' ) {\n\treturn removeAccents( input.trim().toLowerCase() );\n}\n\n// TODO: these are going to be reused in the template part list.\n// That's the reason for leaving the template parts code for now.\nfunction TemplateTitle( { item } ) {\n\tconst { isCustomized } = useAddedBy( item.type, item.id );\n\treturn (\n\t\t<VStack spacing={ 1 }>\n\t\t\t<View as=\"span\" className=\"edit-site-list-title__customized-info\">\n\t\t\t\t<Link\n\t\t\t\t\tparams={ {\n\t\t\t\t\t\tpostId: item.id,\n\t\t\t\t\t\tpostType: item.type,\n\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ decodeEntities( item.title?.rendered || item.slug ) ||\n\t\t\t\t\t\t__( '(no title)' ) }\n\t\t\t\t</Link>\n\t\t\t</View>\n\t\t\t{ isCustomized && (\n\t\t\t\t<span className=\"edit-site-list-added-by__customized-info\">\n\t\t\t\t\t{ item.type === TEMPLATE_POST_TYPE\n\t\t\t\t\t\t? _x( 'Customized', 'template' )\n\t\t\t\t\t\t: _x( 'Customized', 'template part' ) }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nfunction AuthorField( { item } ) {\n\tconst { text, icon, imageUrl } = useAddedBy( item.type, item.id );\n\treturn (\n\t\t<HStack alignment=\"left\" spacing={ 1 }>\n\t\t\t{ imageUrl ? (\n\t\t\t\t<AvatarImage imageUrl={ imageUrl } />\n\t\t\t) : (\n\t\t\t\t<div className=\"edit-site-list-added-by__icon\">\n\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<span>{ text }</span>\n\t\t</HStack>\n\t);\n}\n\nfunction TemplatePreview( { content, viewType } ) {\n\tconst settings = usePatternSettings();\n\tconst [ backgroundColor = 'white' ] = useGlobalStyle( 'color.background' );\n\tconst blocks = useMemo( () => {\n\t\treturn parse( content );\n\t}, [ content ] );\n\tif ( ! blocks?.length ) {\n\t\treturn null;\n\t}\n\t// Wrap everything in a block editor provider to ensure 'styles' that are needed\n\t// for the previews are synced between the site editor store and the block editor store.\n\t// Additionally we need to have the `__experimentalBlockPatterns` setting in order to\n\t// render patterns inside the previews.\n\t// TODO: Same approach is used in the patterns list and it becomes obvious that some of\n\t// the block editor settings are needed in context where we don't have the block editor.\n\t// Explore how we can solve this in a better way.\n\treturn (\n\t\t<ExperimentalBlockEditorProvider settings={ settings }>\n\t\t\t<div\n\t\t\t\tclassName={ `page-templates-preview-field is-viewtype-${ viewType }` }\n\t\t\t\tstyle={ { backgroundColor } }\n\t\t\t>\n\t\t\t\t<BlockPreview blocks={ blocks } />\n\t\t\t</div>\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n}\n\nexport default function DataviewsTemplates() {\n\tconst [ view, setView ] = useState( DEFAULT_VIEW );\n\tconst { records: allTemplates, isResolving: isLoadingData } =\n\t\tuseEntityRecords( 'postType', TEMPLATE_POST_TYPE, {\n\t\t\tper_page: -1,\n\t\t} );\n\n\tconst authors = useMemo( () => {\n\t\tif ( ! allTemplates ) {\n\t\t\treturn EMPTY_ARRAY;\n\t\t}\n\t\tconst authorsSet = new Set();\n\t\tallTemplates.forEach( ( template ) => {\n\t\t\tauthorsSet.add( template.author_text );\n\t\t} );\n\t\treturn Array.from( authorsSet ).map( ( author ) => ( {\n\t\t\tvalue: author,\n\t\t\tlabel: author,\n\t\t} ) );\n\t}, [ allTemplates ] );\n\n\tconst fields = useMemo(\n\t\t() => [\n\t\t\t{\n\t\t\t\theader: __( 'Preview' ),\n\t\t\t\tid: 'preview',\n\t\t\t\trender: ( { item } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<TemplatePreview\n\t\t\t\t\t\t\tcontent={ item.content.raw }\n\t\t\t\t\t\t\tviewType={ view.type }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tminWidth: 120,\n\t\t\t\tmaxWidth: 120,\n\t\t\t\tenableSorting: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\theader: __( 'Template' ),\n\t\t\t\tid: 'title',\n\t\t\t\tgetValue: ( { item } ) => item.title?.rendered || item.slug,\n\t\t\t\trender: ( { item } ) => <TemplateTitle item={ item } />,\n\t\t\t\tmaxWidth: 400,\n\t\t\t\tenableHiding: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\theader: __( 'Description' ),\n\t\t\t\tid: 'description',\n\t\t\t\tgetValue: ( { item } ) => item.description,\n\t\t\t\trender: ( { item } ) => {\n\t\t\t\t\treturn item.description ? (\n\t\t\t\t\t\tdecodeEntities( item.description )\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<Text variant=\"muted\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t—\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t<VisuallyHidden>\n\t\t\t\t\t\t\t\t{ __( 'No description.' ) }\n\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t</>\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tmaxWidth: 200,\n\t\t\t\tenableSorting: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\theader: __( 'Author' ),\n\t\t\t\tid: 'author',\n\t\t\t\tgetValue: ( { item } ) => item.author_text,\n\t\t\t\trender: ( { item } ) => {\n\t\t\t\t\treturn <AuthorField item={ item } />;\n\t\t\t\t},\n\t\t\t\tenableHiding: false,\n\t\t\t\ttype: ENUMERATION_TYPE,\n\t\t\t\telements: authors,\n\t\t\t},\n\t\t],\n\t\t[ authors, view ]\n\t);\n\n\tconst { shownTemplates, paginationInfo } = useMemo( () => {\n\t\tif ( ! allTemplates ) {\n\t\t\treturn {\n\t\t\t\tshownTemplates: EMPTY_ARRAY,\n\t\t\t\tpaginationInfo: { totalItems: 0, totalPages: 0 },\n\t\t\t};\n\t\t}\n\t\tlet filteredTemplates = [ ...allTemplates ];\n\t\t// Handle global search.\n\t\tif ( view.search ) {\n\t\t\tconst normalizedSearch = normalizeSearchInput( view.search );\n\t\t\tfilteredTemplates = filteredTemplates.filter( ( item ) => {\n\t\t\t\tconst title = item.title?.rendered || item.slug;\n\t\t\t\treturn (\n\t\t\t\t\tnormalizeSearchInput( title ).includes(\n\t\t\t\t\t\tnormalizedSearch\n\t\t\t\t\t) ||\n\t\t\t\t\tnormalizeSearchInput( item.description ).includes(\n\t\t\t\t\t\tnormalizedSearch\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t} );\n\t\t}\n\n\t\t// Handle filters.\n\t\tif ( view.filters.length > 0 ) {\n\t\t\tview.filters.forEach( ( filter ) => {\n\t\t\t\tif (\n\t\t\t\t\tfilter.field === 'author' &&\n\t\t\t\t\tfilter.operator === OPERATOR_IN &&\n\t\t\t\t\t!! filter.value\n\t\t\t\t) {\n\t\t\t\t\tfilteredTemplates = filteredTemplates.filter( ( item ) => {\n\t\t\t\t\t\treturn item.author_text === filter.value;\n\t\t\t\t\t} );\n\t\t\t\t} else if (\n\t\t\t\t\tfilter.field === 'author' &&\n\t\t\t\t\tfilter.operator === OPERATOR_NOT_IN &&\n\t\t\t\t\t!! filter.value\n\t\t\t\t) {\n\t\t\t\t\tfilteredTemplates = filteredTemplates.filter( ( item ) => {\n\t\t\t\t\t\treturn item.author_text !== filter.value;\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\t// Handle sorting.\n\t\tif ( view.sort ) {\n\t\t\tconst stringSortingFields = [ 'title', 'author' ];\n\t\t\tconst fieldId = view.sort.field;\n\t\t\tif ( stringSortingFields.includes( fieldId ) ) {\n\t\t\t\tconst fieldToSort = fields.find( ( field ) => {\n\t\t\t\t\treturn field.id === fieldId;\n\t\t\t\t} );\n\t\t\t\tfilteredTemplates.sort( ( a, b ) => {\n\t\t\t\t\tconst valueA = fieldToSort.getValue( { item: a } ) ?? '';\n\t\t\t\t\tconst valueB = fieldToSort.getValue( { item: b } ) ?? '';\n\t\t\t\t\treturn view.sort.direction === 'asc'\n\t\t\t\t\t\t? valueA.localeCompare( valueB )\n\t\t\t\t\t\t: valueB.localeCompare( valueA );\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\n\t\t// Handle pagination.\n\t\tconst start = ( view.page - 1 ) * view.perPage;\n\t\tconst totalItems = filteredTemplates?.length || 0;\n\t\tfilteredTemplates = filteredTemplates?.slice(\n\t\t\tstart,\n\t\t\tstart + view.perPage\n\t\t);\n\t\treturn {\n\t\t\tshownTemplates: filteredTemplates,\n\t\t\tpaginationInfo: {\n\t\t\t\ttotalItems,\n\t\t\t\ttotalPages: Math.ceil( totalItems / view.perPage ),\n\t\t\t},\n\t\t};\n\t}, [ allTemplates, view, fields ] );\n\n\tconst resetTemplateAction = useResetTemplateAction();\n\tconst actions = useMemo(\n\t\t() => [\n\t\t\tresetTemplateAction,\n\t\t\tdeleteTemplateAction,\n\t\t\trenameTemplateAction,\n\t\t],\n\t\t[ resetTemplateAction ]\n\t);\n\tconst onChangeView = useCallback(\n\t\t( viewUpdater ) => {\n\t\t\tlet updatedView =\n\t\t\t\ttypeof viewUpdater === 'function'\n\t\t\t\t\t? viewUpdater( view )\n\t\t\t\t\t: viewUpdater;\n\t\t\tif ( updatedView.type !== view.type ) {\n\t\t\t\tupdatedView = {\n\t\t\t\t\t...updatedView,\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\t...defaultConfigPerViewType[ updatedView.type ],\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tsetView( updatedView );\n\t\t},\n\t\t[ view, setView ]\n\t);\n\treturn (\n\t\t<Page title={ __( 'Templates' ) }>\n\t\t\t<DataViews\n\t\t\t\tpaginationInfo={ paginationInfo }\n\t\t\t\tfields={ fields }\n\t\t\t\tactions={ actions }\n\t\t\t\tdata={ shownTemplates }\n\t\t\t\tgetItemId={ ( item ) => item.id }\n\t\t\t\tisLoading={ isLoadingData }\n\t\t\t\tview={ view }\n\t\t\t\tonChangeView={ onChangeView }\n\t\t\t\tsupportedLayouts={ [ LAYOUT_TABLE, LAYOUT_GRID ] }\n\t\t\t\tdeferredRendering={ ! view.hiddenFields?.includes( 'preview' ) }\n\t\t\t/>\n\t\t</Page>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,aAAa,MAAM,gBAAgB;;AAE1C;AACA;AACA;AACA,SACCC,IAAI,E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2H,iBAAiB,EAAG,CAAErE,IAAI,CAACpC,YAAY,EAAE4E,QAAQ,CAAE,SAAU;EAAG,CAChE,CACI,CAAC;AAET"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
1
|
+
import { createElement, Fragment } from "react";
|
|
2
2
|
/**
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
@@ -38,13 +38,35 @@ export default function EditSitePreferencesModal() {
|
|
|
38
38
|
closeGeneralSidebar();
|
|
39
39
|
});
|
|
40
40
|
};
|
|
41
|
+
const turnOffDistractionFree = () => {
|
|
42
|
+
setPreference('core/edit-site', 'distractionFree', false);
|
|
43
|
+
};
|
|
41
44
|
const sections = useMemo(() => [{
|
|
42
45
|
name: 'general',
|
|
43
46
|
tabLabel: __('General'),
|
|
47
|
+
content: createElement(PreferencesModalSection, {
|
|
48
|
+
title: __('Interface')
|
|
49
|
+
}, createElement(EnableFeature, {
|
|
50
|
+
featureName: "showListViewByDefault",
|
|
51
|
+
help: __('Opens the block list view sidebar by default.'),
|
|
52
|
+
label: __('Always open list view')
|
|
53
|
+
}), createElement(EnableFeature, {
|
|
54
|
+
featureName: "showBlockBreadcrumbs",
|
|
55
|
+
help: __('Shows block breadcrumbs at the bottom of the editor.'),
|
|
56
|
+
label: __('Display block breadcrumbs')
|
|
57
|
+
}))
|
|
58
|
+
}, {
|
|
59
|
+
name: 'appearance',
|
|
60
|
+
tabLabel: __('Appearance'),
|
|
44
61
|
content: createElement(PreferencesModalSection, {
|
|
45
62
|
title: __('Appearance'),
|
|
46
|
-
description: __('Customize
|
|
63
|
+
description: __('Customize the editor interface to suit your needs.')
|
|
47
64
|
}, createElement(EnableFeature, {
|
|
65
|
+
featureName: "fixedToolbar",
|
|
66
|
+
onToggle: turnOffDistractionFree,
|
|
67
|
+
help: __('Access all block and document tools in a single place.'),
|
|
68
|
+
label: __('Top toolbar')
|
|
69
|
+
}), createElement(EnableFeature, {
|
|
48
70
|
featureName: "distractionFree",
|
|
49
71
|
onToggle: toggleDistractionFree,
|
|
50
72
|
help: __('Reduce visual distractions by hiding the toolbar and other elements to focus on writing.'),
|
|
@@ -53,30 +75,24 @@ export default function EditSitePreferencesModal() {
|
|
|
53
75
|
featureName: "focusMode",
|
|
54
76
|
help: __('Highlights the current block and fades other content.'),
|
|
55
77
|
label: __('Spotlight mode')
|
|
56
|
-
}), createElement(EnableFeature, {
|
|
57
|
-
featureName: "showIconLabels",
|
|
58
|
-
label: __('Show button text labels'),
|
|
59
|
-
help: __('Show text instead of icons on buttons.')
|
|
60
|
-
}), createElement(EnableFeature, {
|
|
61
|
-
featureName: "showListViewByDefault",
|
|
62
|
-
help: __('Opens the block list view sidebar by default.'),
|
|
63
|
-
label: __('Always open list view')
|
|
64
|
-
}), createElement(EnableFeature, {
|
|
65
|
-
featureName: "showBlockBreadcrumbs",
|
|
66
|
-
help: __('Shows block breadcrumbs at the bottom of the editor.'),
|
|
67
|
-
label: __('Display block breadcrumbs')
|
|
68
78
|
}))
|
|
69
79
|
}, {
|
|
70
|
-
name: '
|
|
71
|
-
tabLabel: __('
|
|
72
|
-
content: createElement(PreferencesModalSection, {
|
|
73
|
-
title: __('
|
|
74
|
-
description: __('
|
|
80
|
+
name: 'accessibility',
|
|
81
|
+
tabLabel: __('Accessibility'),
|
|
82
|
+
content: createElement(Fragment, null, createElement(PreferencesModalSection, {
|
|
83
|
+
title: __('Navigation'),
|
|
84
|
+
description: __('Optimize the editing experience for enhanced control.')
|
|
75
85
|
}, createElement(EnableFeature, {
|
|
76
86
|
featureName: "keepCaretInsideBlock",
|
|
77
|
-
help: __('
|
|
87
|
+
help: __('Keeps the text cursor within the block boundaries, aiding users with screen readers by preventing unintentional cursor movement outside the block.'),
|
|
78
88
|
label: __('Contain text cursor inside block')
|
|
79
|
-
}))
|
|
89
|
+
})), createElement(PreferencesModalSection, {
|
|
90
|
+
title: __('Interface')
|
|
91
|
+
}, createElement(EnableFeature, {
|
|
92
|
+
featureName: "showIconLabels",
|
|
93
|
+
label: __('Show button text labels'),
|
|
94
|
+
help: __('Show text instead of icons on buttons across the interface.')
|
|
95
|
+
})))
|
|
80
96
|
}]);
|
|
81
97
|
if (!isModalActive) {
|
|
82
98
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PreferencesModal","PreferencesModalTabs","PreferencesModalSection","store","interfaceStore","useMemo","__","useSelect","useDispatch","useRegistry","preferencesStore","EnableFeature","editSiteStore","PREFERENCES_MODAL_NAME","EditSitePreferencesModal","isModalActive","select","closeModal","openModal","toggleModal","registry","closeGeneralSidebar","setIsListViewOpened","setIsInserterOpened","set","setPreference","toggleDistractionFree","batch","sections","name","tabLabel","content","createElement","title","
|
|
1
|
+
{"version":3,"names":["PreferencesModal","PreferencesModalTabs","PreferencesModalSection","store","interfaceStore","useMemo","__","useSelect","useDispatch","useRegistry","preferencesStore","EnableFeature","editSiteStore","PREFERENCES_MODAL_NAME","EditSitePreferencesModal","isModalActive","select","closeModal","openModal","toggleModal","registry","closeGeneralSidebar","setIsListViewOpened","setIsInserterOpened","set","setPreference","toggleDistractionFree","batch","turnOffDistractionFree","sections","name","tabLabel","content","createElement","title","featureName","help","label","description","onToggle","Fragment"],"sources":["@wordpress/edit-site/src/components/preferences-modal/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tPreferencesModal,\n\tPreferencesModalTabs,\n\tPreferencesModalSection,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport { useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch, useRegistry } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport EnableFeature from './enable-feature';\nimport { store as editSiteStore } from '../../store';\n\nexport const PREFERENCES_MODAL_NAME = 'edit-site/preferences';\n\nexport default function EditSitePreferencesModal() {\n\tconst isModalActive = useSelect( ( select ) =>\n\t\tselect( interfaceStore ).isModalActive( PREFERENCES_MODAL_NAME )\n\t);\n\tconst { closeModal, openModal } = useDispatch( interfaceStore );\n\tconst toggleModal = () =>\n\t\tisModalActive ? closeModal() : openModal( PREFERENCES_MODAL_NAME );\n\tconst registry = useRegistry();\n\tconst { closeGeneralSidebar, setIsListViewOpened, setIsInserterOpened } =\n\t\tuseDispatch( editSiteStore );\n\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\tconst toggleDistractionFree = () => {\n\t\tregistry.batch( () => {\n\t\t\tsetPreference( 'core/edit-site', 'fixedToolbar', true );\n\t\t\tsetIsInserterOpened( false );\n\t\t\tsetIsListViewOpened( false );\n\t\t\tcloseGeneralSidebar();\n\t\t} );\n\t};\n\n\tconst turnOffDistractionFree = () => {\n\t\tsetPreference( 'core/edit-site', 'distractionFree', false );\n\t};\n\n\tconst sections = useMemo( () => [\n\t\t{\n\t\t\tname: 'general',\n\t\t\ttabLabel: __( 'General' ),\n\t\t\tcontent: (\n\t\t\t\t<PreferencesModalSection title={ __( 'Interface' ) }>\n\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\tfeatureName=\"showListViewByDefault\"\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Opens the block list view sidebar by default.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tlabel={ __( 'Always open list view' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\tfeatureName=\"showBlockBreadcrumbs\"\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Shows block breadcrumbs at the bottom of the editor.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tlabel={ __( 'Display block breadcrumbs' ) }\n\t\t\t\t\t/>\n\t\t\t\t</PreferencesModalSection>\n\t\t\t),\n\t\t},\n\t\t{\n\t\t\tname: 'appearance',\n\t\t\ttabLabel: __( 'Appearance' ),\n\t\t\tcontent: (\n\t\t\t\t<PreferencesModalSection\n\t\t\t\t\ttitle={ __( 'Appearance' ) }\n\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t'Customize the editor interface to suit your needs.'\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\tfeatureName=\"fixedToolbar\"\n\t\t\t\t\t\tonToggle={ turnOffDistractionFree }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Access all block and document tools in a single place.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tlabel={ __( 'Top toolbar' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\tfeatureName=\"distractionFree\"\n\t\t\t\t\t\tonToggle={ toggleDistractionFree }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Reduce visual distractions by hiding the toolbar and other elements to focus on writing.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tlabel={ __( 'Distraction free' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\tfeatureName=\"focusMode\"\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Highlights the current block and fades other content.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tlabel={ __( 'Spotlight mode' ) }\n\t\t\t\t\t/>\n\t\t\t\t</PreferencesModalSection>\n\t\t\t),\n\t\t},\n\t\t{\n\t\t\tname: 'accessibility',\n\t\t\ttabLabel: __( 'Accessibility' ),\n\t\t\tcontent: (\n\t\t\t\t<>\n\t\t\t\t\t<PreferencesModalSection\n\t\t\t\t\t\ttitle={ __( 'Navigation' ) }\n\t\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t\t'Optimize the editing experience for enhanced control.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\t\tfeatureName=\"keepCaretInsideBlock\"\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Keeps the text cursor within the block boundaries, aiding users with screen readers by preventing unintentional cursor movement outside the block.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tlabel={ __( 'Contain text cursor inside block' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t\t<PreferencesModalSection title={ __( 'Interface' ) }>\n\t\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\t\tfeatureName=\"showIconLabels\"\n\t\t\t\t\t\t\tlabel={ __( 'Show button text labels' ) }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Show text instead of icons on buttons across the interface.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t</>\n\t\t\t),\n\t\t},\n\t] );\n\tif ( ! isModalActive ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<PreferencesModal closeModal={ toggleModal }>\n\t\t\t<PreferencesModalTabs sections={ sections } />\n\t\t</PreferencesModal>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,gBAAgB,EAChBC,oBAAoB,EACpBC,uBAAuB,EACvBC,KAAK,IAAIC,cAAc,QACjB,sBAAsB;AAC7B,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,EAAEC,WAAW,EAAEC,WAAW,QAAQ,iBAAiB;AACrE,SAASN,KAAK,IAAIO,gBAAgB,QAAQ,wBAAwB;;AAElE;AACA;AACA;AACA,OAAOC,aAAa,MAAM,kBAAkB;AAC5C,SAASR,KAAK,IAAIS,aAAa,QAAQ,aAAa;AAEpD,OAAO,MAAMC,sBAAsB,GAAG,uBAAuB;AAE7D,eAAe,SAASC,wBAAwBA,CAAA,EAAG;EAClD,MAAMC,aAAa,GAAGR,SAAS,CAAIS,MAAM,IACxCA,MAAM,CAAEZ,cAAe,CAAC,CAACW,aAAa,CAAEF,sBAAuB,CAChE,CAAC;EACD,MAAM;IAAEI,UAAU;IAAEC;EAAU,CAAC,GAAGV,WA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,aAAA,CAAC/B,uBAAuB;MAACgC,KAAK,EAAG5B,EAAE,CAAE,WAAY;IAAG,GACnD2B,aAAA,CAACtB,aAAa;MACbwB,WAAW,EAAC,gBAAgB;MAC5BE,KAAK,EAAG/B,EAAE,CAAE,yBAA0B,CAAG;MACzC8B,IAAI,EAAG9B,EAAE,CACR,6DACD;IAAG,CACH,CACuB,CACxB;EAEJ,CAAC,CACA,CAAC;EACH,IAAK,CAAES,aAAa,EAAG;IACtB,OAAO,IAAI;EACZ;EACA,OACCkB,aAAA,CAACjC,gBAAgB;IAACiB,UAAU,EAAGE;EAAa,GAC3Cc,aAAA,CAAChC,oBAAoB;IAAC4B,QAAQ,EAAGA;EAAU,CAAE,CAC5B,CAAC;AAErB"}
|
|
@@ -30,13 +30,12 @@ export default function useTitle(title) {
|
|
|
30
30
|
}
|
|
31
31
|
if (title && siteTitle) {
|
|
32
32
|
// @see https://github.com/WordPress/wordpress-develop/blob/94849898192d271d533e09756007e176feb80697/src/wp-admin/admin-header.php#L67-L68
|
|
33
|
-
const formattedTitle = sprintf( /* translators: Admin
|
|
34
|
-
__('%1$s ‹ %2$s — WordPress'), decodeEntities(title), decodeEntities(siteTitle));
|
|
33
|
+
const formattedTitle = sprintf( /* translators: Admin document title. 1: Admin screen name, 2: Network or site name. */
|
|
34
|
+
__('%1$s ‹ %2$s ‹ Editor — WordPress'), decodeEntities(title), decodeEntities(siteTitle));
|
|
35
35
|
document.title = formattedTitle;
|
|
36
36
|
|
|
37
37
|
// Announce title on route change for screen readers.
|
|
38
|
-
speak(
|
|
39
|
-
__('Now displaying: %s'), document.title), 'assertive');
|
|
38
|
+
speak(title, 'assertive');
|
|
40
39
|
}
|
|
41
40
|
}, [title, siteTitle, location]);
|
|
42
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useRef","useSelect","store","coreStore","__","sprintf","speak","decodeEntities","privateApis","routerPrivateApis","unlock","useLocation","useTitle","title","location","siteTitle","select","getEntityRecord","isInitialLocationRef","current","formattedTitle","document"],"sources":["@wordpress/edit-site/src/components/routes/use-title.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { speak } from '@wordpress/a11y';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nexport default function useTitle( title ) {\n\tconst location = useLocation();\n\tconst siteTitle = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord( 'root', 'site' )?.title,\n\t\t[]\n\t);\n\tconst isInitialLocationRef = useRef( true );\n\n\tuseEffect( () => {\n\t\tisInitialLocationRef.current = false;\n\t}, [ location ] );\n\n\tuseEffect( () => {\n\t\t// Don't update or announce the title for initial page load.\n\t\tif ( isInitialLocationRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( title && siteTitle ) {\n\t\t\t// @see https://github.com/WordPress/wordpress-develop/blob/94849898192d271d533e09756007e176feb80697/src/wp-admin/admin-header.php#L67-L68\n\t\t\tconst formattedTitle = sprintf(\n\t\t\t\t/* translators: Admin
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","useSelect","store","coreStore","__","sprintf","speak","decodeEntities","privateApis","routerPrivateApis","unlock","useLocation","useTitle","title","location","siteTitle","select","getEntityRecord","isInitialLocationRef","current","formattedTitle","document"],"sources":["@wordpress/edit-site/src/components/routes/use-title.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { speak } from '@wordpress/a11y';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nexport default function useTitle( title ) {\n\tconst location = useLocation();\n\tconst siteTitle = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord( 'root', 'site' )?.title,\n\t\t[]\n\t);\n\tconst isInitialLocationRef = useRef( true );\n\n\tuseEffect( () => {\n\t\tisInitialLocationRef.current = false;\n\t}, [ location ] );\n\n\tuseEffect( () => {\n\t\t// Don't update or announce the title for initial page load.\n\t\tif ( isInitialLocationRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( title && siteTitle ) {\n\t\t\t// @see https://github.com/WordPress/wordpress-develop/blob/94849898192d271d533e09756007e176feb80697/src/wp-admin/admin-header.php#L67-L68\n\t\t\tconst formattedTitle = sprintf(\n\t\t\t\t/* translators: Admin document title. 1: Admin screen name, 2: Network or site name. */\n\t\t\t\t__( '%1$s ‹ %2$s ‹ Editor — WordPress' ),\n\t\t\t\tdecodeEntities( title ),\n\t\t\t\tdecodeEntities( siteTitle )\n\t\t\t);\n\n\t\t\tdocument.title = formattedTitle;\n\n\t\t\t// Announce title on route change for screen readers.\n\t\t\tspeak( title, 'assertive' );\n\t\t}\n\t}, [ title, siteTitle, location ] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,MAAM,QAAQ,oBAAoB;AACtD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,KAAK,QAAQ,iBAAiB;AACvC,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC;AAAY,CAAC,GAAGD,MAAM,CAAED,iBAAkB,CAAC;AAEnD,eAAe,SAASG,QAAQA,CAAEC,KAAK,EAAG;EACzC,MAAMC,QAAQ,GAAGH,WAAW,CAAC,CAAC;EAC9B,MAAMI,SAAS,GAAGd,SAAS,CACxBe,MAAM,IACPA,MAAM,CAAEb,SAAU,CAAC,CAACc,eAAe,CAAE,MAAM,EAAE,MAAO,CAAC,EAAEJ,KAAK,EAC7D,EACD,CAAC;EACD,MAAMK,oBAAoB,GAAGlB,MAAM,CAAE,IAAK,CAAC;EAE3CD,SAAS,CAAE,MAAM;IAChBmB,oBAAoB,CAACC,OAAO,GAAG,KAAK;EACrC,CAAC,EAAE,CAAEL,QAAQ,CAAG,CAAC;EAEjBf,SAAS,CAAE,MAAM;IAChB;IACA,IAAKmB,oBAAoB,CAACC,OAAO,EAAG;MACnC;IACD;IAEA,IAAKN,KAAK,IAAIE,SAAS,EAAG;MACzB;MACA,MAAMK,cAAc,GAAGf,OAAO,EAC7B;MACAD,EAAE,CAAE,kCAAmC,CAAC,EACxCG,cAAc,CAAEM,KAAM,CAAC,EACvBN,cAAc,CAAEQ,SAAU,CAC3B,CAAC;MAEDM,QAAQ,CAACR,KAAK,GAAGO,cAAc;;MAE/B;MACAd,KAAK,CAAEO,KAAK,EAAE,WAAY,CAAC;IAC5B;EACD,CAAC,EAAE,CAAEA,KAAK,EAAEE,SAAS,EAAED,QAAQ,CAAG,CAAC;AACpC"}
|
|
@@ -92,7 +92,8 @@ export default function SaveButton({
|
|
|
92
92
|
*/,
|
|
93
93
|
showTooltip: showTooltip,
|
|
94
94
|
icon: icon,
|
|
95
|
-
__next40pxDefaultSize: __next40pxDefaultSize
|
|
95
|
+
__next40pxDefaultSize: __next40pxDefaultSize,
|
|
96
|
+
size: "compact"
|
|
96
97
|
}, label);
|
|
97
98
|
}
|
|
98
99
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","useDispatch","Button","__","sprintf","store","coreStore","displayShortcut","editSiteStore","currentlyPreviewingTheme","isPreviewingTheme","SaveButton","className","variant","showTooltip","defaultLabel","icon","__next40pxDefaultSize","isDirty","isSaving","isSaveViewOpen","previewingThemeName","select","__experimentalGetDirtyEntityRecords","isSavingEntityRecord","isResolving","dirtyEntityRecords","isSaveViewOpened","isActivatingTheme","previewingTheme","getTheme","length","some","record","kind","name","key","rendered","setIsSaveViewOpened","activateSaveEnabled","disabled","getLabel","label","createElement","isBusy","onClick","undefined","shortcut","primary"],"sources":["@wordpress/edit-site/src/components/save-button/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { displayShortcut } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport {\n\tcurrentlyPreviewingTheme,\n\tisPreviewingTheme,\n} from '../../utils/is-previewing-theme';\n\nexport default function SaveButton( {\n\tclassName = 'edit-site-save-button__button',\n\tvariant = 'primary',\n\tshowTooltip = true,\n\tdefaultLabel,\n\ticon,\n\t__next40pxDefaultSize = false,\n} ) {\n\tconst { isDirty, isSaving, isSaveViewOpen, previewingThemeName } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst {\n\t\t\t\t__experimentalGetDirtyEntityRecords,\n\t\t\t\tisSavingEntityRecord,\n\t\t\t\tisResolving,\n\t\t\t} = select( coreStore );\n\t\t\tconst dirtyEntityRecords = __experimentalGetDirtyEntityRecords();\n\t\t\tconst { isSaveViewOpened } = select( editSiteStore );\n\t\t\tconst isActivatingTheme = isResolving( 'activateTheme' );\n\t\t\tconst previewingTheme = select( coreStore ).getTheme(\n\t\t\t\tcurrentlyPreviewingTheme()\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tisDirty: dirtyEntityRecords.length > 0,\n\t\t\t\tisSaving:\n\t\t\t\t\tdirtyEntityRecords.some( ( record ) =>\n\t\t\t\t\t\tisSavingEntityRecord(\n\t\t\t\t\t\t\trecord.kind,\n\t\t\t\t\t\t\trecord.name,\n\t\t\t\t\t\t\trecord.key\n\t\t\t\t\t\t)\n\t\t\t\t\t) || isActivatingTheme,\n\t\t\t\tisSaveViewOpen: isSaveViewOpened(),\n\t\t\t\tpreviewingThemeName: previewingTheme?.name?.rendered,\n\t\t\t};\n\t\t}, [] );\n\tconst { setIsSaveViewOpened } = useDispatch( editSiteStore );\n\n\tconst activateSaveEnabled = isPreviewingTheme() || isDirty;\n\tconst disabled = isSaving || ! activateSaveEnabled;\n\n\tconst getLabel = () => {\n\t\tif ( isPreviewingTheme() ) {\n\t\t\tif ( isSaving ) {\n\t\t\t\treturn sprintf( 'Activating %s', previewingThemeName );\n\t\t\t} else if ( disabled ) {\n\t\t\t\treturn __( 'Saved' );\n\t\t\t} else if ( isDirty ) {\n\t\t\t\treturn sprintf( 'Activate %s & Save', previewingThemeName );\n\t\t\t}\n\t\t\treturn sprintf( 'Activate %s', previewingThemeName );\n\t\t}\n\n\t\tif ( isSaving ) {\n\t\t\treturn __( 'Saving' );\n\t\t} else if ( disabled ) {\n\t\t\treturn __( 'Saved' );\n\t\t} else if ( defaultLabel ) {\n\t\t\treturn defaultLabel;\n\t\t}\n\t\treturn __( 'Save' );\n\t};\n\tconst label = getLabel();\n\n\treturn (\n\t\t<Button\n\t\t\tvariant={ variant }\n\t\t\tclassName={ className }\n\t\t\taria-disabled={ disabled }\n\t\t\taria-expanded={ isSaveViewOpen }\n\t\t\tisBusy={ isSaving }\n\t\t\tonClick={ disabled ? undefined : () => setIsSaveViewOpened( true ) }\n\t\t\tlabel={ label }\n\t\t\t/*\n\t\t\t * We want the tooltip to show the keyboard shortcut only when the\n\t\t\t * button does something, i.e. when it's not disabled.\n\t\t\t */\n\t\t\tshortcut={ disabled ? undefined : displayShortcut.primary( 's' ) }\n\t\t\t/*\n\t\t\t * Displaying the keyboard shortcut conditionally makes the tooltip\n\t\t\t * itself show conditionally. This would trigger a full-rerendering\n\t\t\t * of the button that we want to avoid. By setting `showTooltip`,\n\t\t\t * the tooltip is always rendered even when there's no keyboard shortcut.\n\t\t\t */\n\t\t\tshowTooltip={ showTooltip }\n\t\t\ticon={ icon }\n\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,eAAe,QAAQ,qBAAqB;;AAErD;AACA;AACA;AACA,SAASF,KAAK,IAAIG,aAAa,QAAQ,aAAa;AACpD,SACCC,wBAAwB,EACxBC,iBAAiB,QACX,iCAAiC;AAExC,eAAe,SAASC,UAAUA,CAAE;EACnCC,SAAS,GAAG,+BAA+B;EAC3CC,OAAO,GAAG,SAAS;EACnBC,WAAW,GAAG,IAAI;EAClBC,YAAY;EACZC,IAAI;EACJC,qBAAqB,GAAG;AACzB,CAAC,EAAG;EACH,MAAM;IAAEC,OAAO;IAAEC,QAAQ;IAAEC,cAAc;IAAEC;EAAoB,CAAC,GAC/DrB,SAAS,CAAIsB,MAAM,IAAM;IACxB,MAAM;MACLC,mCAAmC;MACnCC,oBAAoB;MACpBC;IACD,CAAC,GAAGH,MAAM,CAAEhB,SAAU,CAAC;IACvB,MAAMoB,kBAAkB,GAAGH,mCAAmC,CAAC,CAAC;IAChE,MAAM;MAAEI;IAAiB,CAAC,GAAGL,MAAM,CAAEd,aAAc,CAAC;IACpD,MAAMoB,iBAAiB,GAAGH,WAAW,CAAE,eAAgB,CAAC;IACxD,MAAMI,eAAe,GAAGP,MAAM,CAAEhB,SAAU,CAAC,CAACwB,QAAQ,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AO,CAAC;EACpB,CAAC;EACD,MAAMuC,KAAK,GAAGD,QAAQ,CAAC,CAAC;EAExB,OACCE,aAAA,CAACzC,MAAM;IACNW,OAAO,EAAGA,OAAS;IACnBD,SAAS,EAAGA,SAAW;IACvB,iBAAgB4B,QAAU;IAC1B,iBAAgBpB,cAAgB;IAChCwB,MAAM,EAAGzB,QAAU;IACnB0B,OAAO,EAAGL,QAAQ,GAAGM,SAAS,GAAG,MAAMR,mBAAmB,CAAE,IAAK,CAAG;IACpEI,KAAK,EAAGA;IACR;AACH;AACA;AACA,OAHG;IAIAK,QAAQ,EAAGP,QAAQ,GAAGM,SAAS,GAAGvC,eAAe,CAACyC,OAAO,CAAE,GAAI;IAC/D;AACH;AACA;AACA;AACA;AACA,OALG;IAMAlC,WAAW,EAAGA,WAAa;IAC3BE,IAAI,EAAGA,IAAM;IACbC,qBAAqB,EAAGA;
|
|
1
|
+
{"version":3,"names":["useSelect","useDispatch","Button","__","sprintf","store","coreStore","displayShortcut","editSiteStore","currentlyPreviewingTheme","isPreviewingTheme","SaveButton","className","variant","showTooltip","defaultLabel","icon","__next40pxDefaultSize","isDirty","isSaving","isSaveViewOpen","previewingThemeName","select","__experimentalGetDirtyEntityRecords","isSavingEntityRecord","isResolving","dirtyEntityRecords","isSaveViewOpened","isActivatingTheme","previewingTheme","getTheme","length","some","record","kind","name","key","rendered","setIsSaveViewOpened","activateSaveEnabled","disabled","getLabel","label","createElement","isBusy","onClick","undefined","shortcut","primary","size"],"sources":["@wordpress/edit-site/src/components/save-button/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { displayShortcut } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport {\n\tcurrentlyPreviewingTheme,\n\tisPreviewingTheme,\n} from '../../utils/is-previewing-theme';\n\nexport default function SaveButton( {\n\tclassName = 'edit-site-save-button__button',\n\tvariant = 'primary',\n\tshowTooltip = true,\n\tdefaultLabel,\n\ticon,\n\t__next40pxDefaultSize = false,\n} ) {\n\tconst { isDirty, isSaving, isSaveViewOpen, previewingThemeName } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst {\n\t\t\t\t__experimentalGetDirtyEntityRecords,\n\t\t\t\tisSavingEntityRecord,\n\t\t\t\tisResolving,\n\t\t\t} = select( coreStore );\n\t\t\tconst dirtyEntityRecords = __experimentalGetDirtyEntityRecords();\n\t\t\tconst { isSaveViewOpened } = select( editSiteStore );\n\t\t\tconst isActivatingTheme = isResolving( 'activateTheme' );\n\t\t\tconst previewingTheme = select( coreStore ).getTheme(\n\t\t\t\tcurrentlyPreviewingTheme()\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tisDirty: dirtyEntityRecords.length > 0,\n\t\t\t\tisSaving:\n\t\t\t\t\tdirtyEntityRecords.some( ( record ) =>\n\t\t\t\t\t\tisSavingEntityRecord(\n\t\t\t\t\t\t\trecord.kind,\n\t\t\t\t\t\t\trecord.name,\n\t\t\t\t\t\t\trecord.key\n\t\t\t\t\t\t)\n\t\t\t\t\t) || isActivatingTheme,\n\t\t\t\tisSaveViewOpen: isSaveViewOpened(),\n\t\t\t\tpreviewingThemeName: previewingTheme?.name?.rendered,\n\t\t\t};\n\t\t}, [] );\n\tconst { setIsSaveViewOpened } = useDispatch( editSiteStore );\n\n\tconst activateSaveEnabled = isPreviewingTheme() || isDirty;\n\tconst disabled = isSaving || ! activateSaveEnabled;\n\n\tconst getLabel = () => {\n\t\tif ( isPreviewingTheme() ) {\n\t\t\tif ( isSaving ) {\n\t\t\t\treturn sprintf( 'Activating %s', previewingThemeName );\n\t\t\t} else if ( disabled ) {\n\t\t\t\treturn __( 'Saved' );\n\t\t\t} else if ( isDirty ) {\n\t\t\t\treturn sprintf( 'Activate %s & Save', previewingThemeName );\n\t\t\t}\n\t\t\treturn sprintf( 'Activate %s', previewingThemeName );\n\t\t}\n\n\t\tif ( isSaving ) {\n\t\t\treturn __( 'Saving' );\n\t\t} else if ( disabled ) {\n\t\t\treturn __( 'Saved' );\n\t\t} else if ( defaultLabel ) {\n\t\t\treturn defaultLabel;\n\t\t}\n\t\treturn __( 'Save' );\n\t};\n\tconst label = getLabel();\n\n\treturn (\n\t\t<Button\n\t\t\tvariant={ variant }\n\t\t\tclassName={ className }\n\t\t\taria-disabled={ disabled }\n\t\t\taria-expanded={ isSaveViewOpen }\n\t\t\tisBusy={ isSaving }\n\t\t\tonClick={ disabled ? undefined : () => setIsSaveViewOpened( true ) }\n\t\t\tlabel={ label }\n\t\t\t/*\n\t\t\t * We want the tooltip to show the keyboard shortcut only when the\n\t\t\t * button does something, i.e. when it's not disabled.\n\t\t\t */\n\t\t\tshortcut={ disabled ? undefined : displayShortcut.primary( 's' ) }\n\t\t\t/*\n\t\t\t * Displaying the keyboard shortcut conditionally makes the tooltip\n\t\t\t * itself show conditionally. This would trigger a full-rerendering\n\t\t\t * of the button that we want to avoid. By setting `showTooltip`,\n\t\t\t * the tooltip is always rendered even when there's no keyboard shortcut.\n\t\t\t */\n\t\t\tshowTooltip={ showTooltip }\n\t\t\ticon={ icon }\n\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\tsize=\"compact\"\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,eAAe,QAAQ,qBAAqB;;AAErD;AACA;AACA;AACA,SAASF,KAAK,IAAIG,aAAa,QAAQ,aAAa;AACpD,SACCC,wBAAwB,EACxBC,iBAAiB,QACX,iCAAiC;AAEx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-1,4 +1,9 @@
|
|
|
1
1
|
import { createElement, Fragment } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* External dependencies
|
|
4
|
+
*/
|
|
5
|
+
import classNames from 'classnames';
|
|
6
|
+
|
|
2
7
|
/**
|
|
3
8
|
* WordPress dependencies
|
|
4
9
|
*/
|
|
@@ -29,35 +34,44 @@ import DataViewsSidebarContent from '../sidebar-dataviews';
|
|
|
29
34
|
const {
|
|
30
35
|
useLocation
|
|
31
36
|
} = unlock(routerPrivateApis);
|
|
37
|
+
function SidebarScreenWrapper({
|
|
38
|
+
className,
|
|
39
|
+
...props
|
|
40
|
+
}) {
|
|
41
|
+
return createElement(NavigatorScreen, {
|
|
42
|
+
className: classNames('edit-site-sidebar__screen-wrapper', className),
|
|
43
|
+
...props
|
|
44
|
+
});
|
|
45
|
+
}
|
|
32
46
|
function SidebarScreens() {
|
|
33
47
|
useSyncPathWithURL();
|
|
34
|
-
return createElement(Fragment, null, createElement(
|
|
48
|
+
return createElement(Fragment, null, createElement(SidebarScreenWrapper, {
|
|
35
49
|
path: "/"
|
|
36
|
-
}, createElement(SidebarNavigationScreenMain, null)), createElement(
|
|
50
|
+
}, createElement(SidebarNavigationScreenMain, null)), createElement(SidebarScreenWrapper, {
|
|
37
51
|
path: "/navigation"
|
|
38
|
-
}, createElement(SidebarNavigationScreenNavigationMenus, null)), createElement(
|
|
52
|
+
}, createElement(SidebarNavigationScreenNavigationMenus, null)), createElement(SidebarScreenWrapper, {
|
|
39
53
|
path: "/navigation/:postType/:postId"
|
|
40
|
-
}, createElement(SidebarNavigationScreenNavigationMenu, null)), createElement(
|
|
54
|
+
}, createElement(SidebarNavigationScreenNavigationMenu, null)), createElement(SidebarScreenWrapper, {
|
|
41
55
|
path: "/wp_global_styles"
|
|
42
|
-
}, createElement(SidebarNavigationScreenGlobalStyles, null)), createElement(
|
|
56
|
+
}, createElement(SidebarNavigationScreenGlobalStyles, null)), createElement(SidebarScreenWrapper, {
|
|
43
57
|
path: "/page"
|
|
44
|
-
}, createElement(SidebarNavigationScreenPages, null)), createElement(
|
|
58
|
+
}, createElement(SidebarNavigationScreenPages, null)), createElement(SidebarScreenWrapper, {
|
|
45
59
|
path: "/page/:postId"
|
|
46
|
-
}, createElement(SidebarNavigationScreenPage, null)), window?.__experimentalAdminViews && createElement(
|
|
60
|
+
}, createElement(SidebarNavigationScreenPage, null)), window?.__experimentalAdminViews && createElement(SidebarScreenWrapper, {
|
|
47
61
|
path: "/pages"
|
|
48
62
|
}, createElement(SidebarNavigationScreen, {
|
|
49
63
|
title: __('Pages'),
|
|
50
64
|
backPath: "/page",
|
|
51
65
|
content: createElement(DataViewsSidebarContent, null)
|
|
52
|
-
})), createElement(
|
|
66
|
+
})), createElement(SidebarScreenWrapper, {
|
|
53
67
|
path: "/:postType(wp_template)"
|
|
54
|
-
}, createElement(SidebarNavigationScreenTemplates, null)), createElement(
|
|
68
|
+
}, createElement(SidebarNavigationScreenTemplates, null)), createElement(SidebarScreenWrapper, {
|
|
55
69
|
path: "/patterns"
|
|
56
|
-
}, createElement(SidebarNavigationScreenPatterns, null)), createElement(
|
|
70
|
+
}, createElement(SidebarNavigationScreenPatterns, null)), createElement(SidebarScreenWrapper, {
|
|
57
71
|
path: "/:postType(wp_template|wp_template_part)/all"
|
|
58
|
-
}, createElement(SidebarNavigationScreenTemplatesBrowse, null)), createElement(
|
|
72
|
+
}, createElement(SidebarNavigationScreenTemplatesBrowse, null)), createElement(SidebarScreenWrapper, {
|
|
59
73
|
path: "/:postType(wp_template_part|wp_block)/:postId"
|
|
60
|
-
}, createElement(SidebarNavigationScreenPattern, null)), createElement(
|
|
74
|
+
}, createElement(SidebarNavigationScreenPattern, null)), createElement(SidebarScreenWrapper, {
|
|
61
75
|
path: "/:postType(wp_template)/:postId"
|
|
62
76
|
}, createElement(SidebarNavigationScreenTemplate, null)));
|
|
63
77
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["memo","useRef","__","__experimentalNavigatorProvider","NavigatorProvider","__experimentalNavigatorScreen","NavigatorScreen","privateApis","routerPrivateApis","SidebarNavigationScreenMain","SidebarNavigationScreenTemplates","SidebarNavigationScreenTemplate","SidebarNavigationScreenPatterns","SidebarNavigationScreenPattern","useSyncPathWithURL","getPathFromURL","SidebarNavigationScreenNavigationMenus","SidebarNavigationScreenNavigationMenu","SidebarNavigationScreenGlobalStyles","SidebarNavigationScreenTemplatesBrowse","SaveHub","unlock","SidebarNavigationScreenPages","SidebarNavigationScreenPage","SidebarNavigationScreen","DataViewsSidebarContent","useLocation","
|
|
1
|
+
{"version":3,"names":["classNames","memo","useRef","__","__experimentalNavigatorProvider","NavigatorProvider","__experimentalNavigatorScreen","NavigatorScreen","privateApis","routerPrivateApis","SidebarNavigationScreenMain","SidebarNavigationScreenTemplates","SidebarNavigationScreenTemplate","SidebarNavigationScreenPatterns","SidebarNavigationScreenPattern","useSyncPathWithURL","getPathFromURL","SidebarNavigationScreenNavigationMenus","SidebarNavigationScreenNavigationMenu","SidebarNavigationScreenGlobalStyles","SidebarNavigationScreenTemplatesBrowse","SaveHub","unlock","SidebarNavigationScreenPages","SidebarNavigationScreenPage","SidebarNavigationScreen","DataViewsSidebarContent","useLocation","SidebarScreenWrapper","className","props","createElement","SidebarScreens","Fragment","path","window","__experimentalAdminViews","title","backPath","content","Sidebar","params","urlParams","initialPath","current"],"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { memo, useRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__experimentalNavigatorProvider as NavigatorProvider,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n} from '@wordpress/components';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';\nimport SidebarNavigationScreenTemplates from '../sidebar-navigation-screen-templates';\nimport SidebarNavigationScreenTemplate from '../sidebar-navigation-screen-template';\nimport SidebarNavigationScreenPatterns from '../sidebar-navigation-screen-patterns';\nimport SidebarNavigationScreenPattern from '../sidebar-navigation-screen-pattern';\nimport useSyncPathWithURL, {\n\tgetPathFromURL,\n} from '../sync-state-with-url/use-sync-path-with-url';\nimport SidebarNavigationScreenNavigationMenus from '../sidebar-navigation-screen-navigation-menus';\nimport SidebarNavigationScreenNavigationMenu from '../sidebar-navigation-screen-navigation-menu';\nimport SidebarNavigationScreenGlobalStyles from '../sidebar-navigation-screen-global-styles';\nimport SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';\nimport SaveHub from '../save-hub';\nimport { unlock } from '../../lock-unlock';\nimport SidebarNavigationScreenPages from '../sidebar-navigation-screen-pages';\nimport SidebarNavigationScreenPage from '../sidebar-navigation-screen-page';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport DataViewsSidebarContent from '../sidebar-dataviews';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nfunction SidebarScreenWrapper( { className, ...props } ) {\n\treturn (\n\t\t<NavigatorScreen\n\t\t\tclassName={ classNames(\n\t\t\t\t'edit-site-sidebar__screen-wrapper',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nfunction SidebarScreens() {\n\tuseSyncPathWithURL();\n\n\treturn (\n\t\t<>\n\t\t\t<SidebarScreenWrapper path=\"/\">\n\t\t\t\t<SidebarNavigationScreenMain />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/navigation\">\n\t\t\t\t<SidebarNavigationScreenNavigationMenus />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/navigation/:postType/:postId\">\n\t\t\t\t<SidebarNavigationScreenNavigationMenu />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/wp_global_styles\">\n\t\t\t\t<SidebarNavigationScreenGlobalStyles />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/page\">\n\t\t\t\t<SidebarNavigationScreenPages />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/page/:postId\">\n\t\t\t\t<SidebarNavigationScreenPage />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t{ window?.__experimentalAdminViews && (\n\t\t\t\t<SidebarScreenWrapper path=\"/pages\">\n\t\t\t\t\t<SidebarNavigationScreen\n\t\t\t\t\t\ttitle={ __( 'Pages' ) }\n\t\t\t\t\t\tbackPath=\"/page\"\n\t\t\t\t\t\tcontent={ <DataViewsSidebarContent /> }\n\t\t\t\t\t/>\n\t\t\t\t</SidebarScreenWrapper>\n\t\t\t) }\n\t\t\t<SidebarScreenWrapper path=\"/:postType(wp_template)\">\n\t\t\t\t<SidebarNavigationScreenTemplates />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/patterns\">\n\t\t\t\t<SidebarNavigationScreenPatterns />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/:postType(wp_template|wp_template_part)/all\">\n\t\t\t\t<SidebarNavigationScreenTemplatesBrowse />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/:postType(wp_template_part|wp_block)/:postId\">\n\t\t\t\t<SidebarNavigationScreenPattern />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/:postType(wp_template)/:postId\">\n\t\t\t\t<SidebarNavigationScreenTemplate />\n\t\t\t</SidebarScreenWrapper>\n\t\t</>\n\t);\n}\n\nfunction Sidebar() {\n\tconst { params: urlParams } = useLocation();\n\tconst initialPath = useRef( getPathFromURL( urlParams ) );\n\n\treturn (\n\t\t<>\n\t\t\t<NavigatorProvider\n\t\t\t\tclassName=\"edit-site-sidebar__content\"\n\t\t\t\tinitialPath={ initialPath.current }\n\t\t\t>\n\t\t\t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AAsC,MAAE,CACpB,CAAC,EACvBW,aAAA,CAACH,oBAAoB;IAACM,IAAI,EAAC;EAA+C,GACzEH,aAAA,CAACjB,8BAA8B,MAAE,CACZ,CAAC,EACvBiB,aAAA,CAACH,oBAAoB;IAACM,IAAI,EAAC;EAAiC,GAC3DH,aAAA,CAACnB,+BAA+B,MAAE,CACb,CACrB,CAAC;AAEL;AAEA,SAAS4B,OAAOA,CAAA,EAAG;EAClB,MAAM;IAAEC,MAAM,EAAEC;EAAU,CAAC,GAAGf,WAAW,CAAC,CAAC;EAC3C,MAAMgB,WAAW,GAAGzC,MAAM,CAAEc,cAAc,CAAE0B,SAAU,CAAE,CAAC;EAEzD,OACCX,aAAA,CAAAE,QAAA,QACCF,aAAA,CAAC1B,iBAAiB;IACjBwB,SAAS,EAAC,4BAA4B;IACtCc,WAAW,EAAGA,WAAW,CAACC;EAAS,GAEnCb,aAAA,CAACC,cAAc,MAAE,CACC,CAAC,EACpBD,aAAA,CAACV,OAAO,MAAE,CACT,CAAC;AAEL;AAEA,eAAepB,IAAI,CAAEuC,OAAQ,CAAC"}
|
|
@@ -7,9 +7,9 @@ import classnames from 'classnames';
|
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
|
-
import { page, columns, pullRight } from '@wordpress/icons';
|
|
11
10
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
12
11
|
import { __experimentalHStack as HStack } from '@wordpress/components';
|
|
12
|
+
import { VIEW_LAYOUTS } from '@wordpress/dataviews';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Internal dependencies
|
|
@@ -20,14 +20,6 @@ import { unlock } from '../../lock-unlock';
|
|
|
20
20
|
const {
|
|
21
21
|
useLocation
|
|
22
22
|
} = unlock(routerPrivateApis);
|
|
23
|
-
function getDataViewIcon(type) {
|
|
24
|
-
const icons = {
|
|
25
|
-
list: page,
|
|
26
|
-
grid: columns,
|
|
27
|
-
'side-by-side': pullRight
|
|
28
|
-
};
|
|
29
|
-
return icons[type];
|
|
30
|
-
}
|
|
31
23
|
export default function DataViewItem({
|
|
32
24
|
title,
|
|
33
25
|
slug,
|
|
@@ -43,7 +35,7 @@ export default function DataViewItem({
|
|
|
43
35
|
path
|
|
44
36
|
}
|
|
45
37
|
} = useLocation();
|
|
46
|
-
const iconToUse = icon ||
|
|
38
|
+
const iconToUse = icon || VIEW_LAYOUTS.find(v => v.type === type).icon;
|
|
47
39
|
const linkInfo = useLink({
|
|
48
40
|
path,
|
|
49
41
|
activeView: isCustom === 'true' ? customViewId : slug,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","
|
|
1
|
+
{"version":3,"names":["classnames","privateApis","routerPrivateApis","__experimentalHStack","HStack","VIEW_LAYOUTS","useLink","SidebarNavigationItem","unlock","useLocation","DataViewItem","title","slug","customViewId","type","icon","isActive","isCustom","suffix","params","path","iconToUse","find","v","linkInfo","activeView","createElement","justify","className","undefined"],"sources":["@wordpress/edit-site/src/components/sidebar-dataviews/dataview-item.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { __experimentalHStack as HStack } from '@wordpress/components';\nimport { VIEW_LAYOUTS } from '@wordpress/dataviews';\n\n/**\n * Internal dependencies\n */\nimport { useLink } from '../routes/link';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { unlock } from '../../lock-unlock';\nconst { useLocation } = unlock( routerPrivateApis );\n\nexport default function DataViewItem( {\n\ttitle,\n\tslug,\n\tcustomViewId,\n\ttype,\n\ticon,\n\tisActive,\n\tisCustom,\n\tsuffix,\n} ) {\n\tconst {\n\t\tparams: { path },\n\t} = useLocation();\n\n\tconst iconToUse =\n\t\ticon || VIEW_LAYOUTS.find( ( v ) => v.type === type ).icon;\n\n\tconst linkInfo = useLink( {\n\t\tpath,\n\t\tactiveView: isCustom === 'true' ? customViewId : slug,\n\t\tisCustom,\n\t} );\n\treturn (\n\t\t<HStack\n\t\t\tjustify=\"flex-start\"\n\t\t\tclassName={ classnames(\n\t\t\t\t'edit-site-sidebar-dataviews-dataview-item',\n\t\t\t\t{\n\t\t\t\t\t'is-selected': isActive,\n\t\t\t\t}\n\t\t\t) }\n\t\t>\n\t\t\t<SidebarNavigationItem\n\t\t\t\ticon={ iconToUse }\n\t\t\t\t{ ...linkInfo }\n\t\t\t\taria-current={ isActive ? 'true' : undefined }\n\t\t\t>\n\t\t\t\t{ title }\n\t\t\t</SidebarNavigationItem>\n\t\t\t{ suffix }\n\t\t</HStack>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,oBAAoB,IAAIC,MAAM,QAAQ,uBAAuB;AACtE,SAASC,YAAY,QAAQ,sBAAsB;;AAEnD;AACA;AACA;AACA,SAASC,OAAO,QAAQ,gBAAgB;AACxC,OAAOC,qBAAqB,MAAM,4BAA4B;AAC9D,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,MAAM;EAAEC;AAAY,CAAC,GAAGD,MAAM,CAAEN,iBAAkB,CAAC;AAEnD,eAAe,SAASQ,YAAYA,CAAE;EACrCC,KAAK;EACLC,IAAI;EACJC,YAAY;EACZC,IAAI;EACJC,IAAI;EACJC,QAAQ;EACRC,QAAQ;EACRC;AACD,CAAC,EAAG;EACH,MAAM;IACLC,MAAM,EAAE;MAAEC;IAAK;EAChB,CAAC,GAAGX,WAAW,CAAC,CAAC;EAEjB,MAAMY,SAAS,GACdN,IAAI,IAAIV,YAAY,CAACiB,IAAI,CAAIC,CAAC,IAAMA,CAAC,CAACT,IAAI,KAAKA,IAAK,CAAC,CAACC,IAAI;EAE3D,MAAMS,QAAQ,GAAGlB,OAAO,CAAE;IACzBc,IAAI;IACJK,UAAU,EAAER,QAAQ,KAAK,MAAM,GAAGJ,YAAY,GAAGD,IAAI;IACrDK;EACD,CAAE,CAAC;EACH,OACCS,aAAA,CAACtB,MAAM;IACNuB,OAAO,EAAC,YAAY;IACpBC,SAAS,EAAG5B,UAAU,CACrB,2CAA2C,EAC3C;MACC,aAAa,EAAEgB;IAChB,CACD;EAAG,GAEHU,aAAA,CAACnB,qBAAqB;IACrBQ,IAAI,EAAGM,SAAW;IAAA,GACbG,QAAQ;IACb,gBAAeR,QAAQ,GAAG,MAAM,GAAGa;EAAW,GAE5ClB,KACoB,CAAC,EACtBO,MACK,CAAC;AAEX"}
|
|
@@ -7,9 +7,9 @@ import { trash } from '@wordpress/icons';
|
|
|
7
7
|
/**
|
|
8
8
|
* Internal dependencies
|
|
9
9
|
*/
|
|
10
|
-
import { OPERATOR_IN } from '
|
|
10
|
+
import { LAYOUT_TABLE, OPERATOR_IN } from '../../utils/constants';
|
|
11
11
|
const DEFAULT_PAGE_BASE = {
|
|
12
|
-
type:
|
|
12
|
+
type: LAYOUT_TABLE,
|
|
13
13
|
search: '',
|
|
14
14
|
filters: [],
|
|
15
15
|
page: 1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","trash","OPERATOR_IN","DEFAULT_PAGE_BASE","type","search","filters","page","perPage","sort","field","direction","hiddenFields","layout","DEFAULT_VIEWS","title","slug","view","operator","value","icon"],"sources":["@wordpress/edit-site/src/components/sidebar-dataviews/default-views.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { trash } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { OPERATOR_IN } from '
|
|
1
|
+
{"version":3,"names":["__","trash","LAYOUT_TABLE","OPERATOR_IN","DEFAULT_PAGE_BASE","type","search","filters","page","perPage","sort","field","direction","hiddenFields","layout","DEFAULT_VIEWS","title","slug","view","operator","value","icon"],"sources":["@wordpress/edit-site/src/components/sidebar-dataviews/default-views.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { trash } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { LAYOUT_TABLE, OPERATOR_IN } from '../../utils/constants';\n\nconst DEFAULT_PAGE_BASE = {\n\ttype: LAYOUT_TABLE,\n\tsearch: '',\n\tfilters: [],\n\tpage: 1,\n\tperPage: 20,\n\tsort: {\n\t\tfield: 'date',\n\t\tdirection: 'desc',\n\t},\n\t// All fields are visible by default, so it's\n\t// better to keep track of the hidden ones.\n\thiddenFields: [ 'date', 'featured-image' ],\n\tlayout: {},\n};\n\nconst DEFAULT_VIEWS = {\n\tpage: [\n\t\t{\n\t\t\ttitle: __( 'All' ),\n\t\t\tslug: 'all',\n\t\t\tview: DEFAULT_PAGE_BASE,\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Drafts' ),\n\t\t\tslug: 'drafts',\n\t\t\tview: {\n\t\t\t\t...DEFAULT_PAGE_BASE,\n\t\t\t\tfilters: [\n\t\t\t\t\t{ field: 'status', operator: OPERATOR_IN, value: 'draft' },\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Trash' ),\n\t\t\tslug: 'trash',\n\t\t\ticon: trash,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_PAGE_BASE,\n\t\t\t\tfilters: [\n\t\t\t\t\t{ field: 'status', operator: OPERATOR_IN, value: 'trash' },\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default DEFAULT_VIEWS;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,KAAK,QAAQ,kBAAkB;;AAExC;AACA;AACA;AACA,SAASC,YAAY,EAAEC,WAAW,QAAQ,uBAAuB;AAEjE,MAAMC,iBAAiB,GAAG;EACzBC,IAAI,EAAEH,YAAY;EAClBI,MAAM,EAAE,EAAE;EACVC,OAAO,EAAE,EAAE;EACXC,IAAI,EAAE,CAAC;EACPC,OAAO,EAAE,EAAE;EACXC,IAAI,EAAE;IACLC,KAAK,EAAE,MAAM;IACbC,SAAS,EAAE;EACZ,CAAC;EACD;EACA;EACAC,YAAY,EAAE,CAAE,MAAM,EAAE,gBAAgB,CAAE;EAC1CC,MAAM,EAAE,CAAC;AACV,CAAC;AAED,MAAMC,aAAa,GAAG;EACrBP,IAAI,EAAE,CACL;IACCQ,KAAK,EAAEhB,EAAE,CAAE,KAAM,CAAC;IAClBiB,IAAI,EAAE,KAAK;IACXC,IAAI,EAAEd;EACP,CAAC,EACD;IACCY,KAAK,EAAEhB,EAAE,CAAE,QAAS,CAAC;IACrBiB,IAAI,EAAE,QAAQ;IACdC,IAAI,EAAE;MACL,GAAGd,iBAAiB;MACpBG,OAAO,EAAE,CACR;QAAEI,KAAK,EAAE,QAAQ;QAAEQ,QAAQ,EAAEhB,WAAW;QAAEiB,KAAK,EAAE;MAAQ,CAAC;IAE5D;EACD,CAAC,EACD;IACCJ,KAAK,EAAEhB,EAAE,CAAE,OAAQ,CAAC;IACpBiB,IAAI,EAAE,OAAO;IACbI,IAAI,EAAEpB,KAAK;IACXiB,IAAI,EAAE;MACL,GAAGd,iBAAiB;MACpBG,OAAO,EAAE,CACR;QAAEI,KAAK,EAAE,QAAQ;QAAEQ,QAAQ,EAAEhB,WAAW;QAAEiB,KAAK,EAAE;MAAQ,CAAC;IAE5D;EACD,CAAC;AAEH,CAAC;AAED,eAAeL,aAAa"}
|
|
@@ -9,6 +9,7 @@ import { humanTimeDiff } from '@wordpress/date';
|
|
|
9
9
|
import { useSelect } from '@wordpress/data';
|
|
10
10
|
import { store as coreStore } from '@wordpress/core-data';
|
|
11
11
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
12
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Internal dependencies
|
|
@@ -26,7 +27,8 @@ export default function PagePanels() {
|
|
|
26
27
|
date,
|
|
27
28
|
password,
|
|
28
29
|
title,
|
|
29
|
-
modified
|
|
30
|
+
modified,
|
|
31
|
+
renderingMode
|
|
30
32
|
} = useSelect(select => {
|
|
31
33
|
const {
|
|
32
34
|
getEditedPostContext
|
|
@@ -35,6 +37,9 @@ export default function PagePanels() {
|
|
|
35
37
|
getEditedEntityRecord,
|
|
36
38
|
hasFinishedResolution
|
|
37
39
|
} = select(coreStore);
|
|
40
|
+
const {
|
|
41
|
+
getRenderingMode
|
|
42
|
+
} = select(editorStore);
|
|
38
43
|
const context = getEditedPostContext();
|
|
39
44
|
const queryArgs = ['postType', context.postType, context.postId];
|
|
40
45
|
const page = getEditedEntityRecord(...queryArgs);
|
|
@@ -46,7 +51,8 @@ export default function PagePanels() {
|
|
|
46
51
|
status: page?.status,
|
|
47
52
|
date: page?.date,
|
|
48
53
|
password: page?.password,
|
|
49
|
-
modified: page?.modified
|
|
54
|
+
modified: page?.modified,
|
|
55
|
+
renderingMode: getRenderingMode()
|
|
50
56
|
};
|
|
51
57
|
}, []);
|
|
52
58
|
if (!hasResolved) {
|
|
@@ -66,7 +72,7 @@ export default function PagePanels() {
|
|
|
66
72
|
password: password,
|
|
67
73
|
postId: id,
|
|
68
74
|
postType: type
|
|
69
|
-
})), createElement(PanelBody, {
|
|
75
|
+
})), renderingMode !== 'post-only' && createElement(PanelBody, {
|
|
70
76
|
title: __('Content')
|
|
71
77
|
}, createElement(PageContent, null)));
|
|
72
78
|
}
|