@wordpress/edit-site 5.25.0 → 5.25.1-next.79a6196f.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/LICENSE.md +1 -1
- package/build/components/block-editor/back-button.js +3 -2
- package/build/components/block-editor/back-button.js.map +1 -1
- package/build/components/block-editor/resizable-editor.js +2 -2
- package/build/components/block-editor/resizable-editor.js.map +1 -1
- package/build/components/block-editor/use-post-link-props.js +27 -0
- package/build/components/block-editor/use-post-link-props.js.map +1 -0
- package/build/components/block-editor/use-site-editor-settings.js +7 -24
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +15 -7
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/editor/index.js +15 -16
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-canvas-container/index.js +9 -7
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/collection-font-variant.js +5 -2
- package/build/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
- package/build/components/global-styles/font-library-modal/confirm-delete-dialog.js +3 -3
- package/build/components/global-styles/font-library-modal/confirm-delete-dialog.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +5 -5
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +8 -4
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/font-library-modal/index.js +38 -21
- package/build/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +2 -2
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/library-font-variant.js +5 -2
- package/build/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
- package/build/components/global-styles/font-library-modal/local-fonts.js +26 -10
- package/build/components/global-styles/font-library-modal/local-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/resolvers.js +6 -6
- package/build/components/global-styles/font-library-modal/resolvers.js.map +1 -1
- package/build/components/global-styles/font-library-modal/{tab-layout.js → tab-panel-layout.js} +4 -4
- package/build/components/global-styles/font-library-modal/tab-panel-layout.js.map +1 -0
- package/build/components/global-styles/font-library-modal/utils/index.js +35 -38
- package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build/components/global-styles/preview.js +43 -1
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-color-palette.js +16 -12
- package/build/components/global-styles/screen-color-palette.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +52 -52
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +26 -35
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +40 -22
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build/components/global-styles/ui.js +13 -62
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/header-edit-mode/document-tools/index.js +8 -106
- package/build/components/header-edit-mode/document-tools/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +7 -11
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/header-edit-mode/mode-switcher/index.js +0 -2
- package/build/components/header-edit-mode/mode-switcher/index.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/index.js +10 -7
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/edit-mode.js +0 -23
- package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build/components/keyboard-shortcuts/register.js +0 -36
- package/build/components/keyboard-shortcuts/register.js.map +1 -1
- package/build/components/layout/index.js +6 -13
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page-main/index.js +4 -4
- package/build/components/page-main/index.js.map +1 -1
- package/build/components/page-pages/index.js +84 -37
- package/build/components/page-pages/index.js.map +1 -1
- package/build/components/page-patterns/dataviews-pattern-actions.js +305 -0
- package/build/components/page-patterns/dataviews-pattern-actions.js.map +1 -0
- package/build/components/page-patterns/dataviews-patterns.js +307 -0
- package/build/components/page-patterns/dataviews-patterns.js.map +1 -0
- package/build/components/page-patterns/duplicate-menu-item.js +1 -1
- package/build/components/page-patterns/duplicate-menu-item.js.map +1 -1
- package/build/components/page-patterns/grid-item.js +4 -3
- package/build/components/page-patterns/grid-item.js.map +1 -1
- package/build/components/page-patterns/patterns-list.js +2 -1
- package/build/components/page-patterns/patterns-list.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +23 -13
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-templates/index.js +312 -36
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/{page-patterns/pagination.js → pagination/index.js} +25 -12
- package/build/components/pagination/index.js.map +1 -0
- package/build/components/{page-pages/side-editor.js → post-preview/index.js} +8 -4
- package/build/components/post-preview/index.js.map +1 -0
- package/build/components/preferences-modal/enable-feature.js +3 -2
- package/build/components/preferences-modal/enable-feature.js.map +1 -1
- package/build/components/preferences-modal/enable-panel-option.js +33 -0
- package/build/components/preferences-modal/enable-panel-option.js.map +1 -0
- package/build/components/preferences-modal/index.js +57 -9
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/revisions/index.js +3 -7
- package/build/components/revisions/index.js.map +1 -1
- package/build/components/routes/link.js +6 -2
- package/build/components/routes/link.js.map +1 -1
- package/build/components/save-button/index.js +6 -3
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/sidebar/index.js +3 -11
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-dataviews/add-new-view.js +2 -2
- package/build/components/sidebar-dataviews/add-new-view.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +18 -5
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-dataviews/index.js +3 -3
- package/build/components/sidebar-dataviews/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/default-sidebar.js +1 -5
- package/build/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js +62 -10
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/index.js +1 -1
- package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/plugin-sidebar/index.js +0 -4
- package/build/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-panel/index.js +4 -13
- package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-details-footer/index.js +1 -1
- package/build/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +5 -2
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/index.js +4 -1
- package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pages-dataviews/index.js +69 -0
- package/build/components/sidebar-navigation-screen-pages-dataviews/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-templates/index.js +63 -8
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/style-book/index.js +38 -8
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +11 -6
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/index.js +12 -7
- package/build/index.js.map +1 -1
- package/build/store/actions.js +39 -44
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +6 -2
- package/build/store/private-actions.js.map +1 -1
- package/build/store/reducer.js +0 -46
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +32 -41
- package/build/store/selectors.js.map +1 -1
- package/build/utils/get-is-list-page.js +1 -1
- package/build/utils/get-is-list-page.js.map +1 -1
- package/build-module/components/block-editor/back-button.js +4 -3
- package/build-module/components/block-editor/back-button.js.map +1 -1
- package/build-module/components/block-editor/resizable-editor.js +2 -2
- package/build-module/components/block-editor/resizable-editor.js.map +1 -1
- package/build-module/components/block-editor/use-post-link-props.js +20 -0
- package/build-module/components/block-editor/use-post-link-props.js.map +1 -0
- package/build-module/components/block-editor/use-site-editor-settings.js +8 -25
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +14 -7
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/editor/index.js +16 -17
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-canvas-container/index.js +9 -7
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/collection-font-variant.js +5 -2
- 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/confirm-delete-dialog.js +3 -3
- package/build-module/components/global-styles/font-library-modal/confirm-delete-dialog.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +7 -7
- package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js +8 -4
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/index.js +39 -22
- package/build-module/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +2 -2
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/library-font-variant.js +5 -2
- package/build-module/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/local-fonts.js +27 -11
- package/build-module/components/global-styles/font-library-modal/local-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/resolvers.js +5 -5
- package/build-module/components/global-styles/font-library-modal/resolvers.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/{tab-layout.js → tab-panel-layout.js} +4 -4
- package/build-module/components/global-styles/font-library-modal/tab-panel-layout.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/utils/index.js +34 -36
- package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build-module/components/global-styles/preview.js +45 -3
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-color-palette.js +17 -13
- package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +53 -53
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +27 -36
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +40 -22
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build-module/components/global-styles/ui.js +15 -64
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/header-edit-mode/document-tools/index.js +13 -110
- package/build-module/components/header-edit-mode/document-tools/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +7 -11
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/header-edit-mode/mode-switcher/index.js +0 -2
- package/build-module/components/header-edit-mode/mode-switcher/index.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js +10 -7
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js +0 -23
- package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/register.js +0 -36
- package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
- package/build-module/components/layout/index.js +6 -13
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page-main/index.js +4 -4
- package/build-module/components/page-main/index.js.map +1 -1
- package/build-module/components/page-pages/index.js +83 -36
- package/build-module/components/page-pages/index.js.map +1 -1
- package/build-module/components/page-patterns/dataviews-pattern-actions.js +292 -0
- package/build-module/components/page-patterns/dataviews-pattern-actions.js.map +1 -0
- package/build-module/components/page-patterns/dataviews-patterns.js +299 -0
- package/build-module/components/page-patterns/dataviews-patterns.js.map +1 -0
- package/build-module/components/page-patterns/duplicate-menu-item.js +1 -1
- package/build-module/components/page-patterns/duplicate-menu-item.js.map +1 -1
- package/build-module/components/page-patterns/grid-item.js +4 -3
- package/build-module/components/page-patterns/grid-item.js.map +1 -1
- package/build-module/components/page-patterns/patterns-list.js +2 -1
- package/build-module/components/page-patterns/patterns-list.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +23 -13
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-templates/index.js +314 -38
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/{page-patterns/pagination.js → pagination/index.js} +24 -12
- package/build-module/components/pagination/index.js.map +1 -0
- package/build-module/components/{page-pages/side-editor.js → post-preview/index.js} +7 -3
- package/build-module/components/post-preview/index.js.map +1 -0
- package/build-module/components/preferences-modal/enable-feature.js +3 -2
- package/build-module/components/preferences-modal/enable-feature.js.map +1 -1
- package/build-module/components/preferences-modal/enable-panel-option.js +26 -0
- package/build-module/components/preferences-modal/enable-panel-option.js.map +1 -0
- package/build-module/components/preferences-modal/index.js +57 -9
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/revisions/index.js +4 -8
- package/build-module/components/revisions/index.js.map +1 -1
- package/build-module/components/routes/link.js +5 -2
- package/build-module/components/routes/link.js.map +1 -1
- package/build-module/components/save-button/index.js +6 -3
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +3 -11
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/add-new-view.js +1 -1
- package/build-module/components/sidebar-dataviews/add-new-view.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +17 -5
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-dataviews/index.js +2 -2
- package/build-module/components/sidebar-dataviews/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/default-sidebar.js +1 -5
- package/build-module/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +64 -12
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/index.js +2 -2
- package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js +0 -4
- package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/index.js +6 -15
- package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js +1 -1
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +5 -2
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/index.js +4 -1
- package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pages-dataviews/index.js +61 -0
- package/build-module/components/sidebar-navigation-screen-pages-dataviews/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-templates/index.js +64 -9
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/style-book/index.js +40 -10
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +11 -6
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/index.js +12 -7
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +36 -41
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +6 -2
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/reducer.js +0 -44
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +30 -38
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +1 -1
- package/build-module/utils/get-is-list-page.js.map +1 -1
- package/build-style/style-rtl.css +366 -268
- package/build-style/style.css +366 -268
- package/package.json +42 -42
- package/src/components/add-new-template/style.scss +2 -1
- package/src/components/block-editor/back-button.js +4 -2
- package/src/components/block-editor/resizable-editor.js +1 -1
- package/src/components/block-editor/style.scss +1 -2
- package/src/components/block-editor/use-post-link-props.js +20 -0
- package/src/components/block-editor/use-site-editor-settings.js +10 -41
- package/src/components/code-editor/style.scss +0 -4
- package/src/components/create-template-part-modal/index.js +83 -82
- package/src/components/editor/index.js +24 -31
- package/src/components/editor-canvas-container/index.js +8 -6
- package/src/components/global-styles/font-library-modal/collection-font-variant.js +7 -2
- package/src/components/global-styles/font-library-modal/confirm-delete-dialog.js +3 -3
- package/src/components/global-styles/font-library-modal/context.js +7 -7
- package/src/components/global-styles/font-library-modal/font-collection.js +10 -5
- package/src/components/global-styles/font-library-modal/index.js +44 -24
- package/src/components/global-styles/font-library-modal/installed-fonts.js +3 -3
- package/src/components/global-styles/font-library-modal/library-font-variant.js +7 -2
- package/src/components/global-styles/font-library-modal/local-fonts.js +53 -26
- package/src/components/global-styles/font-library-modal/resolvers.js +5 -5
- package/src/components/global-styles/font-library-modal/style.scss +5 -2
- package/src/components/global-styles/font-library-modal/{tab-layout.js → tab-panel-layout.js} +9 -3
- package/src/components/global-styles/font-library-modal/utils/index.js +21 -23
- package/src/components/global-styles/font-library-modal/utils/test/makeFormDataFromFontFamily.spec.js +58 -0
- package/src/components/global-styles/preview.js +55 -3
- package/src/components/global-styles/screen-color-palette.js +16 -26
- package/src/components/global-styles/screen-revisions/index.js +91 -92
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +37 -38
- package/src/components/global-styles/screen-revisions/style.scss +77 -20
- package/src/components/global-styles/screen-revisions/test/use-global-styles-revisions.js +67 -0
- package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +73 -46
- package/src/components/global-styles/ui.js +13 -74
- package/src/components/header-edit-mode/document-tools/index.js +33 -165
- package/src/components/header-edit-mode/index.js +6 -17
- package/src/components/header-edit-mode/mode-switcher/index.js +0 -4
- package/src/components/header-edit-mode/more-menu/index.js +9 -7
- package/src/components/header-edit-mode/style.scss +0 -47
- package/src/components/keyboard-shortcuts/edit-mode.js +1 -26
- package/src/components/keyboard-shortcuts/register.js +0 -43
- package/src/components/layout/index.js +8 -27
- package/src/components/layout/style.scss +10 -3
- package/src/components/list/style.scss +0 -5
- package/src/components/page/style.scss +1 -1
- package/src/components/page-main/index.js +8 -8
- package/src/components/page-pages/index.js +112 -41
- package/src/components/page-pages/style.scss +3 -2
- package/src/components/page-patterns/dataviews-pattern-actions.js +329 -0
- package/src/components/page-patterns/dataviews-patterns.js +380 -0
- package/src/components/page-patterns/duplicate-menu-item.js +1 -1
- package/src/components/page-patterns/grid-item.js +3 -2
- package/src/components/page-patterns/patterns-list.js +2 -1
- package/src/components/page-patterns/style.scss +89 -26
- package/src/components/page-patterns/use-patterns.js +24 -15
- package/src/components/page-templates/index.js +399 -64
- package/src/components/{page-patterns/pagination.js → pagination/index.js} +21 -10
- package/src/components/pagination/style.scss +5 -0
- package/src/components/post-preview/index.js +16 -0
- package/src/components/preferences-modal/enable-feature.js +9 -5
- package/src/components/preferences-modal/enable-panel-option.js +23 -0
- package/src/components/preferences-modal/index.js +107 -22
- package/src/components/revisions/index.js +8 -15
- package/src/components/routes/link.js +11 -3
- package/src/components/save-button/index.js +16 -3
- package/src/components/sidebar/index.js +6 -13
- package/src/components/sidebar-dataviews/add-new-view.js +1 -1
- package/src/components/sidebar-dataviews/default-views.js +23 -6
- package/src/components/sidebar-dataviews/index.js +2 -2
- package/src/components/sidebar-edit-mode/default-sidebar.js +0 -12
- package/src/components/sidebar-edit-mode/global-styles-sidebar.js +85 -14
- package/src/components/sidebar-edit-mode/page-panels/index.js +15 -1
- package/src/components/sidebar-edit-mode/plugin-sidebar/index.js +0 -12
- package/src/components/sidebar-edit-mode/style.scss +0 -10
- package/src/components/sidebar-edit-mode/template-panel/index.js +44 -40
- package/src/components/sidebar-edit-mode/template-panel/style.scss +0 -4
- package/src/components/sidebar-navigation-screen-details-footer/index.js +1 -1
- package/src/components/sidebar-navigation-screen-global-styles/index.js +3 -2
- package/src/components/sidebar-navigation-screen-page/index.js +2 -1
- package/src/components/sidebar-navigation-screen-pages-dataviews/index.js +77 -0
- package/src/components/sidebar-navigation-screen-templates/index.js +85 -28
- package/src/components/sidebar-navigation-screen-templates/style.scss +9 -0
- package/src/components/site-hub/style.scss +5 -2
- package/src/components/style-book/index.js +65 -21
- package/src/components/style-book/style.scss +3 -3
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +4 -1
- package/src/hooks/commands/use-edit-mode-commands.js +8 -12
- package/src/index.js +11 -5
- package/src/store/actions.js +35 -45
- package/src/store/private-actions.js +7 -3
- package/src/store/reducer.js +0 -44
- package/src/store/selectors.js +32 -38
- package/src/store/test/actions.js +11 -39
- package/src/store/test/reducer.js +1 -82
- package/src/store/test/selectors.js +0 -24
- package/src/style.scss +2 -1
- package/src/utils/get-is-list-page.js +2 -3
- package/build/components/global-styles/font-library-modal/tab-layout.js.map +0 -1
- package/build/components/global-styles/screen-revisions/get-revision-changes.js +0 -146
- package/build/components/global-styles/screen-revisions/get-revision-changes.js.map +0 -1
- package/build/components/header-edit-mode/undo-redo/redo.js +0 -41
- package/build/components/header-edit-mode/undo-redo/redo.js.map +0 -1
- package/build/components/header-edit-mode/undo-redo/undo.js +0 -40
- package/build/components/header-edit-mode/undo-redo/undo.js.map +0 -1
- package/build/components/page-pages/side-editor.js.map +0 -1
- package/build/components/page-patterns/pagination.js.map +0 -1
- package/build/components/page-templates/dataviews-templates.js +0 -317
- package/build/components/page-templates/dataviews-templates.js.map +0 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js +0 -60
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +0 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +0 -109
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +0 -1
- package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js +0 -35
- package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-panel/last-revision.js +0 -73
- package/build/components/sidebar-edit-mode/template-panel/last-revision.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-panel/pattern-categories.js +0 -219
- package/build/components/sidebar-edit-mode/template-panel/pattern-categories.js.map +0 -1
- package/build-module/components/global-styles/font-library-modal/tab-layout.js.map +0 -1
- package/build-module/components/global-styles/screen-revisions/get-revision-changes.js +0 -139
- package/build-module/components/global-styles/screen-revisions/get-revision-changes.js.map +0 -1
- package/build-module/components/header-edit-mode/undo-redo/redo.js +0 -33
- package/build-module/components/header-edit-mode/undo-redo/redo.js.map +0 -1
- package/build-module/components/header-edit-mode/undo-redo/undo.js +0 -32
- package/build-module/components/header-edit-mode/undo-redo/undo.js.map +0 -1
- package/build-module/components/page-pages/side-editor.js.map +0 -1
- package/build-module/components/page-patterns/pagination.js.map +0 -1
- package/build-module/components/page-templates/dataviews-templates.js +0 -309
- package/build-module/components/page-templates/dataviews-templates.js.map +0 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +0 -53
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +0 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +0 -102
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js +0 -27
- package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-panel/last-revision.js +0 -65
- package/build-module/components/sidebar-edit-mode/template-panel/last-revision.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-panel/pattern-categories.js +0 -209
- package/build-module/components/sidebar-edit-mode/template-panel/pattern-categories.js.map +0 -1
- package/src/components/global-styles/font-library-modal/utils/test/makeFormDataFromFontFamilies.spec.js +0 -62
- package/src/components/global-styles/font-library-modal/utils/test/wpKebabCase.spec.js +0 -28
- package/src/components/global-styles/screen-revisions/get-revision-changes.js +0 -171
- package/src/components/global-styles/screen-revisions/test/get-revision-changes.js +0 -191
- package/src/components/header-edit-mode/undo-redo/redo.js +0 -38
- package/src/components/header-edit-mode/undo-redo/undo.js +0 -34
- package/src/components/page-pages/side-editor.js +0 -14
- package/src/components/page-templates/dataviews-templates.js +0 -360
- package/src/components/secondary-sidebar/inserter-sidebar.js +0 -66
- package/src/components/secondary-sidebar/list-view-sidebar.js +0 -123
- package/src/components/secondary-sidebar/style.scss +0 -65
- package/src/components/sidebar-edit-mode/sidebar-fixed-bottom.js +0 -26
- package/src/components/sidebar-edit-mode/template-panel/last-revision.js +0 -82
- package/src/components/sidebar-edit-mode/template-panel/pattern-categories.js +0 -279
|
@@ -2,7 +2,7 @@ import { createElement, Fragment } from "react";
|
|
|
2
2
|
/**
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { __experimentalView as View, __experimentalVStack as VStack, Button } from '@wordpress/components';
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
7
|
import { useEntityRecords, store as coreStore } from '@wordpress/core-data';
|
|
8
8
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
@@ -11,33 +11,25 @@ import { dateI18n, getDate, getSettings } from '@wordpress/date';
|
|
|
11
11
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
12
12
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
13
13
|
import { DataViews } from '@wordpress/dataviews';
|
|
14
|
+
import { ENTER, SPACE } from '@wordpress/keycodes';
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Internal dependencies
|
|
17
18
|
*/
|
|
18
19
|
import Page from '../page';
|
|
19
20
|
import Link from '../routes/link';
|
|
20
|
-
import {
|
|
21
|
+
import { DEFAULT_VIEWS, DEFAULT_CONFIG_PER_VIEW_TYPE } from '../sidebar-dataviews/default-views';
|
|
21
22
|
import { ENUMERATION_TYPE, LAYOUT_GRID, LAYOUT_TABLE, LAYOUT_LIST, OPERATOR_IN, OPERATOR_NOT_IN } from '../../utils/constants';
|
|
22
23
|
import { trashPostAction, usePermanentlyDeletePostAction, useRestorePostAction, postRevisionsAction, viewPostAction, useEditPostAction } from '../actions';
|
|
23
|
-
import
|
|
24
|
+
import PostPreview from '../post-preview';
|
|
25
|
+
import AddNewPageModal from '../add-new-page';
|
|
24
26
|
import Media from '../media';
|
|
25
27
|
import { unlock } from '../../lock-unlock';
|
|
26
28
|
const {
|
|
27
|
-
useLocation
|
|
29
|
+
useLocation,
|
|
30
|
+
useHistory
|
|
28
31
|
} = unlock(routerPrivateApis);
|
|
29
32
|
const EMPTY_ARRAY = [];
|
|
30
|
-
const defaultConfigPerViewType = {
|
|
31
|
-
[LAYOUT_TABLE]: {},
|
|
32
|
-
[LAYOUT_GRID]: {
|
|
33
|
-
mediaField: 'featured-image',
|
|
34
|
-
primaryField: 'title'
|
|
35
|
-
},
|
|
36
|
-
[LAYOUT_LIST]: {
|
|
37
|
-
primaryField: 'title',
|
|
38
|
-
mediaField: 'featured-image'
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
33
|
function useView(type) {
|
|
42
34
|
const {
|
|
43
35
|
params: {
|
|
@@ -111,7 +103,16 @@ export default function PagePages() {
|
|
|
111
103
|
const postType = 'page';
|
|
112
104
|
const [view, setView] = useView(postType);
|
|
113
105
|
const [pageId, setPageId] = useState(null);
|
|
114
|
-
const
|
|
106
|
+
const history = useHistory();
|
|
107
|
+
const onSelectionChange = useCallback(items => setPageId(items?.length === 1 ? items[0].id : null), [setPageId]);
|
|
108
|
+
const onDetailsChange = useCallback(items => {
|
|
109
|
+
if (!!postType && items?.length === 1) {
|
|
110
|
+
history.push({
|
|
111
|
+
postId: items[0].id,
|
|
112
|
+
postType
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}, [history, postType]);
|
|
115
116
|
const queryArgs = useMemo(() => {
|
|
116
117
|
const filters = {};
|
|
117
118
|
view.filters.forEach(filter => {
|
|
@@ -172,23 +173,22 @@ export default function PagePages() {
|
|
|
172
173
|
id: 'title',
|
|
173
174
|
getValue: ({
|
|
174
175
|
item
|
|
175
|
-
}) => item.title?.rendered
|
|
176
|
+
}) => item.title?.rendered,
|
|
176
177
|
render: ({
|
|
177
178
|
item
|
|
178
179
|
}) => {
|
|
179
180
|
return createElement(VStack, {
|
|
180
181
|
spacing: 1
|
|
181
|
-
}, createElement(
|
|
182
|
-
as: "
|
|
183
|
-
|
|
184
|
-
weight: 500
|
|
182
|
+
}, createElement(View, {
|
|
183
|
+
as: "span",
|
|
184
|
+
className: "dataviews-view-grid__title-field"
|
|
185
185
|
}, [LAYOUT_TABLE, LAYOUT_GRID].includes(view.type) ? createElement(Link, {
|
|
186
186
|
params: {
|
|
187
187
|
postId: item.id,
|
|
188
188
|
postType: item.type,
|
|
189
189
|
canvas: 'edit'
|
|
190
190
|
}
|
|
191
|
-
}, decodeEntities(item.title?.rendered
|
|
191
|
+
}, decodeEntities(item.title?.rendered) || __('(no title)')) : decodeEntities(item.title?.rendered) || __('(no title)')));
|
|
192
192
|
},
|
|
193
193
|
maxWidth: 400,
|
|
194
194
|
enableHiding: false
|
|
@@ -235,41 +235,88 @@ export default function PagePages() {
|
|
|
235
235
|
const formattedDate = dateI18n(getSettings().formats.datetimeAbbreviated, getDate(item.date));
|
|
236
236
|
return createElement("time", null, formattedDate);
|
|
237
237
|
}
|
|
238
|
-
}], [authors, view]);
|
|
238
|
+
}], [authors, view.type]);
|
|
239
239
|
const permanentlyDeletePostAction = usePermanentlyDeletePostAction();
|
|
240
240
|
const restorePostAction = useRestorePostAction();
|
|
241
241
|
const editPostAction = useEditPostAction();
|
|
242
242
|
const actions = useMemo(() => [viewPostAction, trashPostAction, restorePostAction, permanentlyDeletePostAction, editPostAction, postRevisionsAction], [permanentlyDeletePostAction, restorePostAction, editPostAction]);
|
|
243
|
-
const onChangeView = useCallback(
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
...updatedView,
|
|
243
|
+
const onChangeView = useCallback(newView => {
|
|
244
|
+
if (newView.type !== view.type) {
|
|
245
|
+
newView = {
|
|
246
|
+
...newView,
|
|
248
247
|
layout: {
|
|
249
|
-
...
|
|
248
|
+
...DEFAULT_CONFIG_PER_VIEW_TYPE[newView.type]
|
|
250
249
|
}
|
|
251
250
|
};
|
|
252
251
|
}
|
|
253
|
-
setView(
|
|
254
|
-
}, [view, setView]);
|
|
252
|
+
setView(newView);
|
|
253
|
+
}, [view.type, setView]);
|
|
254
|
+
const [showAddPageModal, setShowAddPageModal] = useState(false);
|
|
255
|
+
const openModal = useCallback(() => {
|
|
256
|
+
if (!showAddPageModal) {
|
|
257
|
+
setShowAddPageModal(true);
|
|
258
|
+
}
|
|
259
|
+
}, [showAddPageModal]);
|
|
260
|
+
const closeModal = useCallback(() => {
|
|
261
|
+
if (showAddPageModal) {
|
|
262
|
+
setShowAddPageModal(false);
|
|
263
|
+
}
|
|
264
|
+
}, [showAddPageModal]);
|
|
265
|
+
const handleNewPage = useCallback(({
|
|
266
|
+
type,
|
|
267
|
+
id
|
|
268
|
+
}) => {
|
|
269
|
+
history.push({
|
|
270
|
+
postId: id,
|
|
271
|
+
postType: type,
|
|
272
|
+
canvas: 'edit'
|
|
273
|
+
});
|
|
274
|
+
closeModal();
|
|
275
|
+
}, [history]);
|
|
255
276
|
|
|
256
277
|
// TODO: we need to handle properly `data={ data || EMPTY_ARRAY }` for when `isLoading`.
|
|
257
278
|
return createElement(Fragment, null, createElement(Page, {
|
|
258
|
-
|
|
279
|
+
className: view.type === LAYOUT_LIST ? 'edit-site-page-pages-list-view' : null,
|
|
280
|
+
title: __('Pages'),
|
|
281
|
+
actions: createElement(Fragment, null, createElement(Button, {
|
|
282
|
+
variant: "primary",
|
|
283
|
+
onClick: openModal
|
|
284
|
+
}, __('Add new page')), showAddPageModal && createElement(AddNewPageModal, {
|
|
285
|
+
onSave: handleNewPage,
|
|
286
|
+
onClose: closeModal
|
|
287
|
+
}))
|
|
259
288
|
}, createElement(DataViews, {
|
|
260
289
|
paginationInfo: paginationInfo,
|
|
261
290
|
fields: fields,
|
|
262
291
|
actions: actions,
|
|
263
292
|
data: pages || EMPTY_ARRAY,
|
|
264
|
-
getItemId: item => item.id,
|
|
265
293
|
isLoading: isLoadingPages || isLoadingAuthors,
|
|
266
294
|
view: view,
|
|
267
295
|
onChangeView: onChangeView,
|
|
268
296
|
onSelectionChange: onSelectionChange,
|
|
269
|
-
|
|
297
|
+
onDetailsChange: onDetailsChange
|
|
270
298
|
})), view.type === LAYOUT_LIST && createElement(Page, null, createElement("div", {
|
|
271
|
-
className: "edit-site-page-pages-preview"
|
|
272
|
-
|
|
299
|
+
className: "edit-site-page-pages-preview",
|
|
300
|
+
tabIndex: 0,
|
|
301
|
+
role: "button",
|
|
302
|
+
onKeyDown: event => {
|
|
303
|
+
const {
|
|
304
|
+
keyCode
|
|
305
|
+
} = event;
|
|
306
|
+
if (keyCode === ENTER || keyCode === SPACE) {
|
|
307
|
+
history.push({
|
|
308
|
+
postId: pageId,
|
|
309
|
+
postType,
|
|
310
|
+
canvas: 'edit'
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
onClick: () => history.push({
|
|
315
|
+
postId: pageId,
|
|
316
|
+
postType,
|
|
317
|
+
canvas: 'edit'
|
|
318
|
+
})
|
|
319
|
+
}, pageId !== null ? createElement(PostPreview, {
|
|
273
320
|
postId: pageId,
|
|
274
321
|
postType: postType
|
|
275
322
|
}) : createElement("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__experimentalHeading","Heading","__experimentalVStack","VStack","__","useEntityRecords","store","coreStore","decodeEntities","useState","useMemo","useCallback","useEffect","dateI18n","getDate","getSettings","privateApis","routerPrivateApis","useSelect","useDispatch","DataViews","Page","Link","default","DEFAULT_VIEWS","ENUMERATION_TYPE","LAYOUT_GRID","LAYOUT_TABLE","LAYOUT_LIST","OPERATOR_IN","OPERATOR_NOT_IN","trashPostAction","usePermanentlyDeletePostAction","useRestorePostAction","postRevisionsAction","viewPostAction","useEditPostAction","SideEditor","Media","unlock","useLocation","EMPTY_ARRAY","defaultConfigPerViewType","mediaField","primaryField","useView","type","params","activeView","isCustom","selectedDefaultView","find","slug","view","setView","editedViewRecord","select","getEditedEntityRecord","dataviewRecord","Number","editEntityRecord","customView","content","JSON","parse","setCustomView","viewToSet","id","stringify","STATUSES","value","label","DEFAULT_STATUSES","PagePages","postType","pageId","setPageId","onSelectionChange","items","length","queryArgs","filters","forEach","filter","field","operator","status","author","author_exclude","per_page","perPage","page","_embed","order","sort","direction","orderby","search","records","pages","isResolving","isLoadingPages","totalItems","totalPages","authors","isLoadingAuthors","paginationInfo","fields","header","getValue","item","featured_media","render","createElement","className","size","enableSorting","title","rendered","spacing","as","level","weight","includes","postId","canvas","maxWidth","enableHiding","_embedded","name","elements","map","_STATUSES$find$label","filterBy","operators","date","formattedDate","formats","datetimeAbbreviated","permanentlyDeletePostAction","restorePostAction","editPostAction","actions","onChangeView","viewUpdater","updatedView","layout","Fragment","data","getItemId","isLoading","deferredRendering","style","display","flexDirection","justifyContent","textAlign","height"],"sources":["@wordpress/edit-site/src/components/page-pages/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHeading as Heading,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useState, useMemo, useCallback, useEffect } from '@wordpress/element';\nimport { dateI18n, getDate, getSettings } from '@wordpress/date';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { DataViews } from '@wordpress/dataviews';\n\n/**\n * Internal dependencies\n */\nimport Page from '../page';\nimport Link from '../routes/link';\nimport { default as DEFAULT_VIEWS } from '../sidebar-dataviews/default-views';\nimport {\n\tENUMERATION_TYPE,\n\tLAYOUT_GRID,\n\tLAYOUT_TABLE,\n\tLAYOUT_LIST,\n\tOPERATOR_IN,\n\tOPERATOR_NOT_IN,\n} from '../../utils/constants';\n\nimport {\n\ttrashPostAction,\n\tusePermanentlyDeletePostAction,\n\tuseRestorePostAction,\n\tpostRevisionsAction,\n\tviewPostAction,\n\tuseEditPostAction,\n} from '../actions';\nimport SideEditor from './side-editor';\nimport Media from '../media';\nimport { unlock } from '../../lock-unlock';\nconst { useLocation } = unlock( routerPrivateApis );\n\nconst EMPTY_ARRAY = [];\nconst defaultConfigPerViewType = {\n\t[ LAYOUT_TABLE ]: {},\n\t[ LAYOUT_GRID ]: {\n\t\tmediaField: 'featured-image',\n\t\tprimaryField: 'title',\n\t},\n\t[ LAYOUT_LIST ]: {\n\t\tprimaryField: 'title',\n\t\tmediaField: 'featured-image',\n\t},\n};\n\nfunction useView( type ) {\n\tconst {\n\t\tparams: { activeView = 'all', isCustom = 'false' },\n\t} = useLocation();\n\tconst selectedDefaultView =\n\t\tisCustom === 'false' &&\n\t\tDEFAULT_VIEWS[ type ].find( ( { slug } ) => slug === activeView )?.view;\n\tconst [ view, setView ] = useState( selectedDefaultView );\n\n\tuseEffect( () => {\n\t\tif ( selectedDefaultView ) {\n\t\t\tsetView( selectedDefaultView );\n\t\t}\n\t}, [ selectedDefaultView ] );\n\tconst editedViewRecord = useSelect(\n\t\t( select ) => {\n\t\t\tif ( isCustom !== 'true' ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\t\tconst dataviewRecord = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_dataviews',\n\t\t\t\tNumber( activeView )\n\t\t\t);\n\t\t\treturn dataviewRecord;\n\t\t},\n\t\t[ activeView, isCustom ]\n\t);\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\n\tconst customView = useMemo( () => {\n\t\treturn (\n\t\t\teditedViewRecord?.content && JSON.parse( editedViewRecord?.content )\n\t\t);\n\t}, [ editedViewRecord?.content ] );\n\tconst setCustomView = useCallback(\n\t\t( viewToSet ) => {\n\t\t\teditEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_dataviews',\n\t\t\t\teditedViewRecord?.id,\n\t\t\t\t{\n\t\t\t\t\tcontent: JSON.stringify( viewToSet ),\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t\t[ editEntityRecord, editedViewRecord?.id ]\n\t);\n\n\tif ( isCustom === 'false' ) {\n\t\treturn [ view, setView ];\n\t} else if ( isCustom === 'true' && customView ) {\n\t\treturn [ customView, setCustomView ];\n\t}\n\t// Loading state where no the view was not found on custom views or default views.\n\treturn [ DEFAULT_VIEWS[ type ][ 0 ].view, setView ];\n}\n\n// See https://github.com/WordPress/gutenberg/issues/55886\n// We do not support custom statutes at the moment.\nconst STATUSES = [\n\t{ value: 'draft', label: __( 'Draft' ) },\n\t{ value: 'future', label: __( 'Scheduled' ) },\n\t{ value: 'pending', label: __( 'Pending Review' ) },\n\t{ value: 'private', label: __( 'Private' ) },\n\t{ value: 'publish', label: __( 'Published' ) },\n\t{ value: 'trash', label: __( 'Trash' ) },\n];\nconst DEFAULT_STATUSES = 'draft,future,pending,private,publish'; // All but 'trash'.\n\nexport default function PagePages() {\n\tconst postType = 'page';\n\tconst [ view, setView ] = useView( postType );\n\tconst [ pageId, setPageId ] = useState( null );\n\n\tconst onSelectionChange = ( items ) =>\n\t\tsetPageId( items?.length === 1 ? items[ 0 ].id : null );\n\n\tconst queryArgs = useMemo( () => {\n\t\tconst filters = {};\n\t\tview.filters.forEach( ( filter ) => {\n\t\t\tif (\n\t\t\t\tfilter.field === 'status' &&\n\t\t\t\tfilter.operator === OPERATOR_IN\n\t\t\t) {\n\t\t\t\tfilters.status = filter.value;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tfilter.field === 'author' &&\n\t\t\t\tfilter.operator === OPERATOR_IN\n\t\t\t) {\n\t\t\t\tfilters.author = filter.value;\n\t\t\t} else if (\n\t\t\t\tfilter.field === 'author' &&\n\t\t\t\tfilter.operator === OPERATOR_NOT_IN\n\t\t\t) {\n\t\t\t\tfilters.author_exclude = filter.value;\n\t\t\t}\n\t\t} );\n\t\t// We want to provide a different default item for the status filter\n\t\t// than the REST API provides.\n\t\tif ( ! filters.status || filters.status === '' ) {\n\t\t\tfilters.status = DEFAULT_STATUSES;\n\t\t}\n\n\t\treturn {\n\t\t\tper_page: view.perPage,\n\t\t\tpage: view.page,\n\t\t\t_embed: 'author',\n\t\t\torder: view.sort?.direction,\n\t\t\torderby: view.sort?.field,\n\t\t\tsearch: view.search,\n\t\t\t...filters,\n\t\t};\n\t}, [ view ] );\n\tconst {\n\t\trecords: pages,\n\t\tisResolving: isLoadingPages,\n\t\ttotalItems,\n\t\ttotalPages,\n\t} = useEntityRecords( 'postType', postType, queryArgs );\n\n\tconst { records: authors, isResolving: isLoadingAuthors } =\n\t\tuseEntityRecords( 'root', 'user' );\n\n\tconst paginationInfo = useMemo(\n\t\t() => ( {\n\t\t\ttotalItems,\n\t\t\ttotalPages,\n\t\t} ),\n\t\t[ totalItems, totalPages ]\n\t);\n\n\tconst fields = useMemo(\n\t\t() => [\n\t\t\t{\n\t\t\t\tid: 'featured-image',\n\t\t\t\theader: __( 'Featured Image' ),\n\t\t\t\tgetValue: ( { item } ) => item.featured_media,\n\t\t\t\trender: ( { item } ) =>\n\t\t\t\t\t!! item.featured_media ? (\n\t\t\t\t\t\t<Media\n\t\t\t\t\t\t\tclassName=\"edit-site-page-pages__featured-image\"\n\t\t\t\t\t\t\tid={ item.featured_media }\n\t\t\t\t\t\t\tsize={\n\t\t\t\t\t\t\t\tview.type === LAYOUT_GRID\n\t\t\t\t\t\t\t\t\t? [ 'large', 'full', 'medium', 'thumbnail' ]\n\t\t\t\t\t\t\t\t\t: [ 'thumbnail', 'medium', 'large', 'full' ]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : null,\n\t\t\t\tenableSorting: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\theader: __( 'Title' ),\n\t\t\t\tid: 'title',\n\t\t\t\tgetValue: ( { item } ) => item.title?.rendered || item.slug,\n\t\t\t\trender: ( { item } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t\t\t\t<Heading as=\"h3\" level={ 5 } weight={ 500 }>\n\t\t\t\t\t\t\t\t{ [ LAYOUT_TABLE, LAYOUT_GRID ].includes(\n\t\t\t\t\t\t\t\t\tview.type\n\t\t\t\t\t\t\t\t) ? (\n\t\t\t\t\t\t\t\t\t<Link\n\t\t\t\t\t\t\t\t\t\tparams={ {\n\t\t\t\t\t\t\t\t\t\t\tpostId: item.id,\n\t\t\t\t\t\t\t\t\t\t\tpostType: item.type,\n\t\t\t\t\t\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\t\titem.title?.rendered || item.slug\n\t\t\t\t\t\t\t\t\t\t) || __( '(no title)' ) }\n\t\t\t\t\t\t\t\t\t</Link>\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\tdecodeEntities(\n\t\t\t\t\t\t\t\t\t\titem.title?.rendered || item.slug\n\t\t\t\t\t\t\t\t\t) || __( '(no title)' )\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</Heading>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t);\n\t\t\t\t},\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: __( 'Author' ),\n\t\t\t\tid: 'author',\n\t\t\t\tgetValue: ( { item } ) => item._embedded?.author[ 0 ]?.name,\n\t\t\t\ttype: ENUMERATION_TYPE,\n\t\t\t\telements:\n\t\t\t\t\tauthors?.map( ( { id, name } ) => ( {\n\t\t\t\t\t\tvalue: id,\n\t\t\t\t\t\tlabel: name,\n\t\t\t\t\t} ) ) || [],\n\t\t\t},\n\t\t\t{\n\t\t\t\theader: __( 'Status' ),\n\t\t\t\tid: 'status',\n\t\t\t\tgetValue: ( { item } ) =>\n\t\t\t\t\tSTATUSES.find( ( { value } ) => value === item.status )\n\t\t\t\t\t\t?.label ?? item.status,\n\t\t\t\ttype: ENUMERATION_TYPE,\n\t\t\t\telements: STATUSES,\n\t\t\t\tenableSorting: false,\n\t\t\t\tfilterBy: {\n\t\t\t\t\toperators: [ OPERATOR_IN ],\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\theader: __( 'Date' ),\n\t\t\t\tid: 'date',\n\t\t\t\tgetValue: ( { item } ) => item.date,\n\t\t\t\trender: ( { item } ) => {\n\t\t\t\t\tconst formattedDate = dateI18n(\n\t\t\t\t\t\tgetSettings().formats.datetimeAbbreviated,\n\t\t\t\t\t\tgetDate( item.date )\n\t\t\t\t\t);\n\t\t\t\t\treturn <time>{ formattedDate }</time>;\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\t[ authors, view ]\n\t);\n\n\tconst permanentlyDeletePostAction = usePermanentlyDeletePostAction();\n\tconst restorePostAction = useRestorePostAction();\n\tconst editPostAction = useEditPostAction();\n\tconst actions = useMemo(\n\t\t() => [\n\t\t\tviewPostAction,\n\t\t\ttrashPostAction,\n\t\t\trestorePostAction,\n\t\t\tpermanentlyDeletePostAction,\n\t\t\teditPostAction,\n\t\t\tpostRevisionsAction,\n\t\t],\n\t\t[ permanentlyDeletePostAction, restorePostAction, editPostAction ]\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\n\t// TODO: we need to handle properly `data={ data || EMPTY_ARRAY }` for when `isLoading`.\n\treturn (\n\t\t<>\n\t\t\t<Page title={ __( 'Pages' ) }>\n\t\t\t\t<DataViews\n\t\t\t\t\tpaginationInfo={ paginationInfo }\n\t\t\t\t\tfields={ fields }\n\t\t\t\t\tactions={ actions }\n\t\t\t\t\tdata={ pages || EMPTY_ARRAY }\n\t\t\t\t\tgetItemId={ ( item ) => item.id }\n\t\t\t\t\tisLoading={ isLoadingPages || isLoadingAuthors }\n\t\t\t\t\tview={ view }\n\t\t\t\t\tonChangeView={ onChangeView }\n\t\t\t\t\tonSelectionChange={ onSelectionChange }\n\t\t\t\t\tdeferredRendering={ false }\n\t\t\t\t/>\n\t\t\t</Page>\n\t\t\t{ view.type === LAYOUT_LIST && (\n\t\t\t\t<Page>\n\t\t\t\t\t<div className=\"edit-site-page-pages-preview\">\n\t\t\t\t\t\t{ pageId !== null ? (\n\t\t\t\t\t\t\t<SideEditor\n\t\t\t\t\t\t\t\tpostId={ pageId }\n\t\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\t\tflexDirection: 'column',\n\t\t\t\t\t\t\t\t\tjustifyContent: 'center',\n\t\t\t\t\t\t\t\t\ttextAlign: 'center',\n\t\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<p>{ __( 'Select a page to preview' ) }</p>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t</Page>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,qBAAqB,IAAIC,OAAO,EAChCC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,gBAAgB,EAAEC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AAC3E,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,QAAQ,EAAEC,OAAO,EAAEC,WAAW,EAAEC,SAAS,QAAQ,oBAAoB;AAC9E,SAASC,QAAQ,EAAEC,OAAO,EAAEC,WAAW,QAAQ,iBAAiB;AAChE,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,SAAS,QAAQ,sBAAsB;;AAEhD;AACA;AACA;AACA,OAAOC,IAAI,MAAM,SAAS;AAC1B,OAAOC,IAAI,MAAM,gBAAgB;AACjC,SAASC,OAAO,IAAIC,aAAa,QAAQ,oCAAoC;AAC7E,SACCC,gBAAgB,EAChBC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,WAAW,EACXC,eAAe,QACT,uBAAuB;AAE9B,SACCC,eAAe,EACfC,8BAA8B,EAC9BC,oBAAoB,EACpBC,mBAAmB,EACnBC,cAAc,EACdC,iBAAiB,QACX,YAAY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OAAO,EAAGA,OAAS;IACnBM,IAAI,EAAGjD,KAAK,IAAI1D,WAAa;IAC7B4G,SAAS,EAAKvC,IAAI,IAAMA,IAAI,CAAC3C,EAAI;IACjCmF,SAAS,EAAGjD,cAAc,IAAII,gBAAkB;IAChDpD,IAAI,EAAGA,IAAM;IACb0F,YAAY,EAAGA,YAAc;IAC7BlE,iBAAiB,EAAGA,iBAAmB;IACvC0E,iBAAiB,EAAG;EAAO,CAC3B,CACI,CAAC,EACLlG,IAAI,CAACP,IAAI,KAAKlB,WAAW,IAC1BqF,aAAA,CAAC5F,IAAI,QACJ4F,aAAA;IAAKC,SAAS,EAAC;EAA8B,GAC1CvC,MAAM,KAAK,IAAI,GAChBsC,aAAA,CAAC5E,UAAU;IACVuF,MAAM,EAAGjD,MAAQ;IACjBD,QAAQ,EAAGA;EAAU,CACrB,CAAC,GAEFuC,aAAA;IACCuC,KAAK,EAAG;MACPC,OAAO,EAAE,MAAM;MACfC,aAAa,EAAE,QAAQ;MACvBC,cAAc,EAAE,QAAQ;MACxBC,SAAS,EAAE,QAAQ;MACnBC,MAAM,EAAE;IACT;EAAG,GAEH5C,aAAA,YAAK7G,EAAE,CAAE,0BAA2B,CAAM,CACtC,CAEF,CACA,CAEN,CAAC;AAEL"}
|
|
1
|
+
{"version":3,"names":["__experimentalView","View","__experimentalVStack","VStack","Button","__","useEntityRecords","store","coreStore","decodeEntities","useState","useMemo","useCallback","useEffect","dateI18n","getDate","getSettings","privateApis","routerPrivateApis","useSelect","useDispatch","DataViews","ENTER","SPACE","Page","Link","DEFAULT_VIEWS","DEFAULT_CONFIG_PER_VIEW_TYPE","ENUMERATION_TYPE","LAYOUT_GRID","LAYOUT_TABLE","LAYOUT_LIST","OPERATOR_IN","OPERATOR_NOT_IN","trashPostAction","usePermanentlyDeletePostAction","useRestorePostAction","postRevisionsAction","viewPostAction","useEditPostAction","PostPreview","AddNewPageModal","Media","unlock","useLocation","useHistory","EMPTY_ARRAY","useView","type","params","activeView","isCustom","selectedDefaultView","find","slug","view","setView","editedViewRecord","select","getEditedEntityRecord","dataviewRecord","Number","editEntityRecord","customView","content","JSON","parse","setCustomView","viewToSet","id","stringify","STATUSES","value","label","DEFAULT_STATUSES","PagePages","postType","pageId","setPageId","history","onSelectionChange","items","length","onDetailsChange","push","postId","queryArgs","filters","forEach","filter","field","operator","status","author","author_exclude","per_page","perPage","page","_embed","order","sort","direction","orderby","search","records","pages","isResolving","isLoadingPages","totalItems","totalPages","authors","isLoadingAuthors","paginationInfo","fields","header","getValue","item","featured_media","render","createElement","className","size","enableSorting","title","rendered","spacing","as","includes","canvas","maxWidth","enableHiding","_embedded","name","elements","map","_STATUSES$find$label","filterBy","operators","date","formattedDate","formats","datetimeAbbreviated","permanentlyDeletePostAction","restorePostAction","editPostAction","actions","onChangeView","newView","layout","showAddPageModal","setShowAddPageModal","openModal","closeModal","handleNewPage","Fragment","variant","onClick","onSave","onClose","data","isLoading","tabIndex","role","onKeyDown","event","keyCode","style","display","flexDirection","justifyContent","textAlign","height"],"sources":["@wordpress/edit-site/src/components/page-pages/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalView as View,\n\t__experimentalVStack as VStack,\n\tButton,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useState, useMemo, useCallback, useEffect } from '@wordpress/element';\nimport { dateI18n, getDate, getSettings } from '@wordpress/date';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { DataViews } from '@wordpress/dataviews';\nimport { ENTER, SPACE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport Page from '../page';\nimport Link from '../routes/link';\nimport {\n\tDEFAULT_VIEWS,\n\tDEFAULT_CONFIG_PER_VIEW_TYPE,\n} from '../sidebar-dataviews/default-views';\nimport {\n\tENUMERATION_TYPE,\n\tLAYOUT_GRID,\n\tLAYOUT_TABLE,\n\tLAYOUT_LIST,\n\tOPERATOR_IN,\n\tOPERATOR_NOT_IN,\n} from '../../utils/constants';\n\nimport {\n\ttrashPostAction,\n\tusePermanentlyDeletePostAction,\n\tuseRestorePostAction,\n\tpostRevisionsAction,\n\tviewPostAction,\n\tuseEditPostAction,\n} from '../actions';\nimport PostPreview from '../post-preview';\nimport AddNewPageModal from '../add-new-page';\nimport Media from '../media';\nimport { unlock } from '../../lock-unlock';\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nconst EMPTY_ARRAY = [];\n\nfunction useView( type ) {\n\tconst {\n\t\tparams: { activeView = 'all', isCustom = 'false' },\n\t} = useLocation();\n\tconst selectedDefaultView =\n\t\tisCustom === 'false' &&\n\t\tDEFAULT_VIEWS[ type ].find( ( { slug } ) => slug === activeView )?.view;\n\tconst [ view, setView ] = useState( selectedDefaultView );\n\n\tuseEffect( () => {\n\t\tif ( selectedDefaultView ) {\n\t\t\tsetView( selectedDefaultView );\n\t\t}\n\t}, [ selectedDefaultView ] );\n\tconst editedViewRecord = useSelect(\n\t\t( select ) => {\n\t\t\tif ( isCustom !== 'true' ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\t\tconst dataviewRecord = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_dataviews',\n\t\t\t\tNumber( activeView )\n\t\t\t);\n\t\t\treturn dataviewRecord;\n\t\t},\n\t\t[ activeView, isCustom ]\n\t);\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\n\tconst customView = useMemo( () => {\n\t\treturn (\n\t\t\teditedViewRecord?.content && JSON.parse( editedViewRecord?.content )\n\t\t);\n\t}, [ editedViewRecord?.content ] );\n\tconst setCustomView = useCallback(\n\t\t( viewToSet ) => {\n\t\t\teditEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_dataviews',\n\t\t\t\teditedViewRecord?.id,\n\t\t\t\t{\n\t\t\t\t\tcontent: JSON.stringify( viewToSet ),\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t\t[ editEntityRecord, editedViewRecord?.id ]\n\t);\n\n\tif ( isCustom === 'false' ) {\n\t\treturn [ view, setView ];\n\t} else if ( isCustom === 'true' && customView ) {\n\t\treturn [ customView, setCustomView ];\n\t}\n\t// Loading state where no the view was not found on custom views or default views.\n\treturn [ DEFAULT_VIEWS[ type ][ 0 ].view, setView ];\n}\n\n// See https://github.com/WordPress/gutenberg/issues/55886\n// We do not support custom statutes at the moment.\nconst STATUSES = [\n\t{ value: 'draft', label: __( 'Draft' ) },\n\t{ value: 'future', label: __( 'Scheduled' ) },\n\t{ value: 'pending', label: __( 'Pending Review' ) },\n\t{ value: 'private', label: __( 'Private' ) },\n\t{ value: 'publish', label: __( 'Published' ) },\n\t{ value: 'trash', label: __( 'Trash' ) },\n];\nconst DEFAULT_STATUSES = 'draft,future,pending,private,publish'; // All but 'trash'.\n\nexport default function PagePages() {\n\tconst postType = 'page';\n\tconst [ view, setView ] = useView( postType );\n\tconst [ pageId, setPageId ] = useState( null );\n\tconst history = useHistory();\n\n\tconst onSelectionChange = useCallback(\n\t\t( items ) => setPageId( items?.length === 1 ? items[ 0 ].id : null ),\n\t\t[ setPageId ]\n\t);\n\n\tconst onDetailsChange = useCallback(\n\t\t( items ) => {\n\t\t\tif ( !! postType && items?.length === 1 ) {\n\t\t\t\thistory.push( {\n\t\t\t\t\tpostId: items[ 0 ].id,\n\t\t\t\t\tpostType,\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ history, postType ]\n\t);\n\n\tconst queryArgs = useMemo( () => {\n\t\tconst filters = {};\n\t\tview.filters.forEach( ( filter ) => {\n\t\t\tif (\n\t\t\t\tfilter.field === 'status' &&\n\t\t\t\tfilter.operator === OPERATOR_IN\n\t\t\t) {\n\t\t\t\tfilters.status = filter.value;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tfilter.field === 'author' &&\n\t\t\t\tfilter.operator === OPERATOR_IN\n\t\t\t) {\n\t\t\t\tfilters.author = filter.value;\n\t\t\t} else if (\n\t\t\t\tfilter.field === 'author' &&\n\t\t\t\tfilter.operator === OPERATOR_NOT_IN\n\t\t\t) {\n\t\t\t\tfilters.author_exclude = filter.value;\n\t\t\t}\n\t\t} );\n\t\t// We want to provide a different default item for the status filter\n\t\t// than the REST API provides.\n\t\tif ( ! filters.status || filters.status === '' ) {\n\t\t\tfilters.status = DEFAULT_STATUSES;\n\t\t}\n\n\t\treturn {\n\t\t\tper_page: view.perPage,\n\t\t\tpage: view.page,\n\t\t\t_embed: 'author',\n\t\t\torder: view.sort?.direction,\n\t\t\torderby: view.sort?.field,\n\t\t\tsearch: view.search,\n\t\t\t...filters,\n\t\t};\n\t}, [ view ] );\n\tconst {\n\t\trecords: pages,\n\t\tisResolving: isLoadingPages,\n\t\ttotalItems,\n\t\ttotalPages,\n\t} = useEntityRecords( 'postType', postType, queryArgs );\n\n\tconst { records: authors, isResolving: isLoadingAuthors } =\n\t\tuseEntityRecords( 'root', 'user' );\n\n\tconst paginationInfo = useMemo(\n\t\t() => ( {\n\t\t\ttotalItems,\n\t\t\ttotalPages,\n\t\t} ),\n\t\t[ totalItems, totalPages ]\n\t);\n\n\tconst fields = useMemo(\n\t\t() => [\n\t\t\t{\n\t\t\t\tid: 'featured-image',\n\t\t\t\theader: __( 'Featured Image' ),\n\t\t\t\tgetValue: ( { item } ) => item.featured_media,\n\t\t\t\trender: ( { item } ) =>\n\t\t\t\t\t!! item.featured_media ? (\n\t\t\t\t\t\t<Media\n\t\t\t\t\t\t\tclassName=\"edit-site-page-pages__featured-image\"\n\t\t\t\t\t\t\tid={ item.featured_media }\n\t\t\t\t\t\t\tsize={\n\t\t\t\t\t\t\t\tview.type === LAYOUT_GRID\n\t\t\t\t\t\t\t\t\t? [ 'large', 'full', 'medium', 'thumbnail' ]\n\t\t\t\t\t\t\t\t\t: [ 'thumbnail', 'medium', 'large', 'full' ]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : null,\n\t\t\t\tenableSorting: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\theader: __( 'Title' ),\n\t\t\t\tid: 'title',\n\t\t\t\tgetValue: ( { item } ) => item.title?.rendered,\n\t\t\t\trender: ( { item } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t\t\t\t<View\n\t\t\t\t\t\t\t\tas=\"span\"\n\t\t\t\t\t\t\t\tclassName=\"dataviews-view-grid__title-field\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ [ LAYOUT_TABLE, LAYOUT_GRID ].includes(\n\t\t\t\t\t\t\t\t\tview.type\n\t\t\t\t\t\t\t\t) ? (\n\t\t\t\t\t\t\t\t\t<Link\n\t\t\t\t\t\t\t\t\t\tparams={ {\n\t\t\t\t\t\t\t\t\t\t\tpostId: item.id,\n\t\t\t\t\t\t\t\t\t\t\tpostType: item.type,\n\t\t\t\t\t\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\t\titem.title?.rendered\n\t\t\t\t\t\t\t\t\t\t) || __( '(no title)' ) }\n\t\t\t\t\t\t\t\t\t</Link>\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\tdecodeEntities( item.title?.rendered ) ||\n\t\t\t\t\t\t\t\t\t__( '(no title)' )\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</View>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t);\n\t\t\t\t},\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: __( 'Author' ),\n\t\t\t\tid: 'author',\n\t\t\t\tgetValue: ( { item } ) => item._embedded?.author[ 0 ]?.name,\n\t\t\t\ttype: ENUMERATION_TYPE,\n\t\t\t\telements:\n\t\t\t\t\tauthors?.map( ( { id, name } ) => ( {\n\t\t\t\t\t\tvalue: id,\n\t\t\t\t\t\tlabel: name,\n\t\t\t\t\t} ) ) || [],\n\t\t\t},\n\t\t\t{\n\t\t\t\theader: __( 'Status' ),\n\t\t\t\tid: 'status',\n\t\t\t\tgetValue: ( { item } ) =>\n\t\t\t\t\tSTATUSES.find( ( { value } ) => value === item.status )\n\t\t\t\t\t\t?.label ?? item.status,\n\t\t\t\ttype: ENUMERATION_TYPE,\n\t\t\t\telements: STATUSES,\n\t\t\t\tenableSorting: false,\n\t\t\t\tfilterBy: {\n\t\t\t\t\toperators: [ OPERATOR_IN ],\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\theader: __( 'Date' ),\n\t\t\t\tid: 'date',\n\t\t\t\tgetValue: ( { item } ) => item.date,\n\t\t\t\trender: ( { item } ) => {\n\t\t\t\t\tconst formattedDate = dateI18n(\n\t\t\t\t\t\tgetSettings().formats.datetimeAbbreviated,\n\t\t\t\t\t\tgetDate( item.date )\n\t\t\t\t\t);\n\t\t\t\t\treturn <time>{ formattedDate }</time>;\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\t[ authors, view.type ]\n\t);\n\n\tconst permanentlyDeletePostAction = usePermanentlyDeletePostAction();\n\tconst restorePostAction = useRestorePostAction();\n\tconst editPostAction = useEditPostAction();\n\tconst actions = useMemo(\n\t\t() => [\n\t\t\tviewPostAction,\n\t\t\ttrashPostAction,\n\t\t\trestorePostAction,\n\t\t\tpermanentlyDeletePostAction,\n\t\t\teditPostAction,\n\t\t\tpostRevisionsAction,\n\t\t],\n\t\t[ permanentlyDeletePostAction, restorePostAction, editPostAction ]\n\t);\n\tconst onChangeView = useCallback(\n\t\t( newView ) => {\n\t\t\tif ( newView.type !== view.type ) {\n\t\t\t\tnewView = {\n\t\t\t\t\t...newView,\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\t...DEFAULT_CONFIG_PER_VIEW_TYPE[ newView.type ],\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tsetView( newView );\n\t\t},\n\t\t[ view.type, setView ]\n\t);\n\n\tconst [ showAddPageModal, setShowAddPageModal ] = useState( false );\n\tconst openModal = useCallback( () => {\n\t\tif ( ! showAddPageModal ) {\n\t\t\tsetShowAddPageModal( true );\n\t\t}\n\t}, [ showAddPageModal ] );\n\tconst closeModal = useCallback( () => {\n\t\tif ( showAddPageModal ) {\n\t\t\tsetShowAddPageModal( false );\n\t\t}\n\t}, [ showAddPageModal ] );\n\tconst handleNewPage = useCallback(\n\t\t( { type, id } ) => {\n\t\t\thistory.push( {\n\t\t\t\tpostId: id,\n\t\t\t\tpostType: type,\n\t\t\t\tcanvas: 'edit',\n\t\t\t} );\n\t\t\tcloseModal();\n\t\t},\n\t\t[ history ]\n\t);\n\n\t// TODO: we need to handle properly `data={ data || EMPTY_ARRAY }` for when `isLoading`.\n\treturn (\n\t\t<>\n\t\t\t<Page\n\t\t\t\tclassName={\n\t\t\t\t\tview.type === LAYOUT_LIST\n\t\t\t\t\t\t? 'edit-site-page-pages-list-view'\n\t\t\t\t\t\t: null\n\t\t\t\t}\n\t\t\t\ttitle={ __( 'Pages' ) }\n\t\t\t\tactions={\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Button variant=\"primary\" onClick={ openModal }>\n\t\t\t\t\t\t\t{ __( 'Add new page' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t{ showAddPageModal && (\n\t\t\t\t\t\t\t<AddNewPageModal\n\t\t\t\t\t\t\t\tonSave={ handleNewPage }\n\t\t\t\t\t\t\t\tonClose={ closeModal }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t<DataViews\n\t\t\t\t\tpaginationInfo={ paginationInfo }\n\t\t\t\t\tfields={ fields }\n\t\t\t\t\tactions={ actions }\n\t\t\t\t\tdata={ pages || EMPTY_ARRAY }\n\t\t\t\t\tisLoading={ isLoadingPages || isLoadingAuthors }\n\t\t\t\t\tview={ view }\n\t\t\t\t\tonChangeView={ onChangeView }\n\t\t\t\t\tonSelectionChange={ onSelectionChange }\n\t\t\t\t\tonDetailsChange={ onDetailsChange }\n\t\t\t\t/>\n\t\t\t</Page>\n\t\t\t{ view.type === LAYOUT_LIST && (\n\t\t\t\t<Page>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"edit-site-page-pages-preview\"\n\t\t\t\t\t\ttabIndex={ 0 }\n\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\t\t\tconst { keyCode } = event;\n\t\t\t\t\t\t\tif ( keyCode === ENTER || keyCode === SPACE ) {\n\t\t\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\t\t\tpostId: pageId,\n\t\t\t\t\t\t\t\t\tpostType,\n\t\t\t\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\t\tpostId: pageId,\n\t\t\t\t\t\t\t\tpostType,\n\t\t\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ pageId !== null ? (\n\t\t\t\t\t\t\t<PostPreview\n\t\t\t\t\t\t\t\tpostId={ pageId }\n\t\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\t\tflexDirection: 'column',\n\t\t\t\t\t\t\t\t\tjustifyContent: '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AAiB,CACnC,CACI,CAAC,EACL5B,IAAI,CAACP,IAAI,KAAKjB,WAAW,IAC1BwF,aAAA,CAAC/F,IAAI,QACJ+F,aAAA;IACCC,SAAS,EAAC,8BAA8B;IACxCyC,QAAQ,EAAG,CAAG;IACdC,IAAI,EAAC,QAAQ;IACbC,SAAS,EAAKC,KAAK,IAAM;MACxB,MAAM;QAAEC;MAAQ,CAAC,GAAGD,KAAK;MACzB,IAAKC,OAAO,KAAK/I,KAAK,IAAI+I,OAAO,KAAK9I,KAAK,EAAG;QAC7CwD,OAAO,CAACK,IAAI,CAAE;UACbC,MAAM,EAAER,MAAM;UACdD,QAAQ;UACRoD,MAAM,EAAE;QACT,CAAE,CAAC;MACJ;IACD,CAAG;IACH4B,OAAO,EAAGA,CAAA,KACT7E,OAAO,CAACK,IAAI,CAAE;MACbC,MAAM,EAAER,MAAM;MACdD,QAAQ;MACRoD,MAAM,EAAE;IACT,CAAE;EACF,GAECnD,MAAM,KAAK,IAAI,GAChB0C,aAAA,CAAC/E,WAAW;IACX6C,MAAM,EAAGR,MAAQ;IACjBD,QAAQ,EAAGA;EAAU,CACrB,CAAC,GAEF2C,aAAA;IACC+C,KAAK,EAAG;MACPC,OAAO,EAAE,MAAM;MACfC,aAAa,EAAE,QAAQ;MACvBC,cAAc,EAAE,QAAQ;MACxBC,SAAS,EAAE,QAAQ;MACnBC,MAAM,EAAE;IACT;EAAG,GAEHpD,aAAA,YAAKlH,EAAE,CAAE,0BAA2B,CAAM,CACtC,CAEF,CACA,CAEN,CAAC;AAEL"}
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* External dependencies
|
|
4
|
+
*/
|
|
5
|
+
import { paramCase as kebabCase } from 'change-case';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* WordPress dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { getQueryArgs } from '@wordpress/url';
|
|
11
|
+
import { downloadBlob } from '@wordpress/blob';
|
|
12
|
+
import { __, _x, sprintf } from '@wordpress/i18n';
|
|
13
|
+
import { Button, TextControl, __experimentalHStack as HStack, __experimentalVStack as VStack, __experimentalText as Text } from '@wordpress/components';
|
|
14
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
15
|
+
import { useDispatch } from '@wordpress/data';
|
|
16
|
+
import { useState } from '@wordpress/element';
|
|
17
|
+
import { store as noticesStore } from '@wordpress/notices';
|
|
18
|
+
import { decodeEntities } from '@wordpress/html-entities';
|
|
19
|
+
import { store as reusableBlocksStore } from '@wordpress/reusable-blocks';
|
|
20
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
21
|
+
import { privateApis as patternsPrivateApis } from '@wordpress/patterns';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Internal dependencies
|
|
25
|
+
*/
|
|
26
|
+
import { unlock } from '../../lock-unlock';
|
|
27
|
+
import { store as editSiteStore } from '../../store';
|
|
28
|
+
import { PATTERN_TYPES, TEMPLATE_PART_POST_TYPE, PATTERN_DEFAULT_CATEGORY } from '../../utils/constants';
|
|
29
|
+
import { CreateTemplatePartModalContents } from '../create-template-part-modal';
|
|
30
|
+
const {
|
|
31
|
+
useHistory
|
|
32
|
+
} = unlock(routerPrivateApis);
|
|
33
|
+
const {
|
|
34
|
+
CreatePatternModalContents,
|
|
35
|
+
useDuplicatePatternProps
|
|
36
|
+
} = unlock(patternsPrivateApis);
|
|
37
|
+
export const exportJSONaction = {
|
|
38
|
+
id: 'export-pattern',
|
|
39
|
+
label: __('Export as JSON'),
|
|
40
|
+
isEligible: item => item.type === PATTERN_TYPES.user,
|
|
41
|
+
callback: item => {
|
|
42
|
+
const json = {
|
|
43
|
+
__file: item.type,
|
|
44
|
+
title: item.title || item.name,
|
|
45
|
+
content: item.patternPost.content.raw,
|
|
46
|
+
syncStatus: item.patternPost.wp_pattern_sync_status
|
|
47
|
+
};
|
|
48
|
+
return downloadBlob(`${kebabCase(item.title || item.name)}.json`, JSON.stringify(json, null, 2), 'application/json');
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
export const renameAction = {
|
|
52
|
+
id: 'rename-pattern',
|
|
53
|
+
label: __('Rename'),
|
|
54
|
+
isEligible: item => {
|
|
55
|
+
const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;
|
|
56
|
+
const isUserPattern = item.type === PATTERN_TYPES.user;
|
|
57
|
+
const isCustomPattern = isUserPattern || isTemplatePart && item.isCustom;
|
|
58
|
+
const hasThemeFile = isTemplatePart && item.templatePart.has_theme_file;
|
|
59
|
+
return isCustomPattern && !hasThemeFile;
|
|
60
|
+
},
|
|
61
|
+
RenderModal: ({
|
|
62
|
+
item,
|
|
63
|
+
closeModal
|
|
64
|
+
}) => {
|
|
65
|
+
const [title, setTitle] = useState(() => item.title);
|
|
66
|
+
const {
|
|
67
|
+
editEntityRecord,
|
|
68
|
+
saveEditedEntityRecord
|
|
69
|
+
} = useDispatch(coreStore);
|
|
70
|
+
const {
|
|
71
|
+
createSuccessNotice,
|
|
72
|
+
createErrorNotice
|
|
73
|
+
} = useDispatch(noticesStore);
|
|
74
|
+
async function onRename(event) {
|
|
75
|
+
event.preventDefault();
|
|
76
|
+
try {
|
|
77
|
+
await editEntityRecord('postType', item.type, item.id, {
|
|
78
|
+
title
|
|
79
|
+
});
|
|
80
|
+
// Update state before saving rerenders the list.
|
|
81
|
+
setTitle('');
|
|
82
|
+
closeModal();
|
|
83
|
+
// Persist edited entity.
|
|
84
|
+
await saveEditedEntityRecord('postType', item.type, item.id, {
|
|
85
|
+
throwOnError: true
|
|
86
|
+
});
|
|
87
|
+
createSuccessNotice(item.type === TEMPLATE_PART_POST_TYPE ? __('Template part renamed.') : __('Pattern renamed.'), {
|
|
88
|
+
type: 'snackbar'
|
|
89
|
+
});
|
|
90
|
+
} catch (error) {
|
|
91
|
+
const fallbackErrorMessage = item.type === TEMPLATE_PART_POST_TYPE ? __('An error occurred while renaming the template part.') : __('An error occurred while renaming the pattern.');
|
|
92
|
+
const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : fallbackErrorMessage;
|
|
93
|
+
createErrorNotice(errorMessage, {
|
|
94
|
+
type: 'snackbar'
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return createElement("form", {
|
|
99
|
+
onSubmit: onRename
|
|
100
|
+
}, createElement(VStack, {
|
|
101
|
+
spacing: "5"
|
|
102
|
+
}, createElement(TextControl, {
|
|
103
|
+
__nextHasNoMarginBottom: true,
|
|
104
|
+
__next40pxDefaultSize: true,
|
|
105
|
+
label: __('Name'),
|
|
106
|
+
value: title,
|
|
107
|
+
onChange: setTitle,
|
|
108
|
+
required: true
|
|
109
|
+
}), createElement(HStack, {
|
|
110
|
+
justify: "right"
|
|
111
|
+
}, createElement(Button, {
|
|
112
|
+
__next40pxDefaultSize: true,
|
|
113
|
+
variant: "tertiary",
|
|
114
|
+
onClick: () => {
|
|
115
|
+
closeModal();
|
|
116
|
+
}
|
|
117
|
+
}, __('Cancel')), createElement(Button, {
|
|
118
|
+
__next40pxDefaultSize: true,
|
|
119
|
+
variant: "primary",
|
|
120
|
+
type: "submit"
|
|
121
|
+
}, __('Save')))));
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
const canDeleteOrReset = item => {
|
|
125
|
+
const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;
|
|
126
|
+
const isUserPattern = item.type === PATTERN_TYPES.user;
|
|
127
|
+
return isUserPattern || isTemplatePart && item.isCustom;
|
|
128
|
+
};
|
|
129
|
+
export const deleteAction = {
|
|
130
|
+
id: 'delete-pattern',
|
|
131
|
+
label: __('Delete'),
|
|
132
|
+
isEligible: item => {
|
|
133
|
+
const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;
|
|
134
|
+
const hasThemeFile = isTemplatePart && item.templatePart.has_theme_file;
|
|
135
|
+
return canDeleteOrReset(item) && !hasThemeFile;
|
|
136
|
+
},
|
|
137
|
+
hideModalHeader: true,
|
|
138
|
+
RenderModal: ({
|
|
139
|
+
item,
|
|
140
|
+
closeModal
|
|
141
|
+
}) => {
|
|
142
|
+
const {
|
|
143
|
+
__experimentalDeleteReusableBlock
|
|
144
|
+
} = useDispatch(reusableBlocksStore);
|
|
145
|
+
const {
|
|
146
|
+
createErrorNotice,
|
|
147
|
+
createSuccessNotice
|
|
148
|
+
} = useDispatch(noticesStore);
|
|
149
|
+
const {
|
|
150
|
+
removeTemplate
|
|
151
|
+
} = useDispatch(editSiteStore);
|
|
152
|
+
const deletePattern = async () => {
|
|
153
|
+
try {
|
|
154
|
+
await __experimentalDeleteReusableBlock(item.id);
|
|
155
|
+
createSuccessNotice(sprintf(
|
|
156
|
+
// translators: %s: The pattern's title e.g. 'Call to action'.
|
|
157
|
+
__('"%s" deleted.'), item.title), {
|
|
158
|
+
type: 'snackbar',
|
|
159
|
+
id: 'edit-site-patterns-success'
|
|
160
|
+
});
|
|
161
|
+
} catch (error) {
|
|
162
|
+
const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : __('An error occurred while deleting the pattern.');
|
|
163
|
+
createErrorNotice(errorMessage, {
|
|
164
|
+
type: 'snackbar',
|
|
165
|
+
id: 'edit-site-patterns-error'
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
const deleteItem = () => item.type === TEMPLATE_PART_POST_TYPE ? removeTemplate(item) : deletePattern();
|
|
170
|
+
return createElement(VStack, {
|
|
171
|
+
spacing: "5"
|
|
172
|
+
}, createElement(Text, null, sprintf(
|
|
173
|
+
// translators: %s: The pattern or template part's title e.g. 'Call to action'.
|
|
174
|
+
__('Are you sure you want to delete "%s"?'), decodeEntities(item.title || item.name))), createElement(HStack, {
|
|
175
|
+
justify: "right"
|
|
176
|
+
}, createElement(Button, {
|
|
177
|
+
variant: "tertiary",
|
|
178
|
+
onClick: closeModal
|
|
179
|
+
}, __('Cancel')), createElement(Button, {
|
|
180
|
+
variant: "primary",
|
|
181
|
+
onClick: deleteItem
|
|
182
|
+
}, __('Delete'))));
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
export const resetAction = {
|
|
186
|
+
id: 'reset-action',
|
|
187
|
+
label: __('Clear customizations'),
|
|
188
|
+
isEligible: item => {
|
|
189
|
+
const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;
|
|
190
|
+
const hasThemeFile = isTemplatePart && item.templatePart.has_theme_file;
|
|
191
|
+
return canDeleteOrReset(item) && hasThemeFile;
|
|
192
|
+
},
|
|
193
|
+
hideModalHeader: true,
|
|
194
|
+
RenderModal: ({
|
|
195
|
+
item,
|
|
196
|
+
closeModal
|
|
197
|
+
}) => {
|
|
198
|
+
const {
|
|
199
|
+
removeTemplate
|
|
200
|
+
} = useDispatch(editSiteStore);
|
|
201
|
+
return createElement(VStack, {
|
|
202
|
+
spacing: "5"
|
|
203
|
+
}, createElement(Text, null, __('Are you sure you want to clear these customizations?')), createElement(HStack, {
|
|
204
|
+
justify: "right"
|
|
205
|
+
}, createElement(Button, {
|
|
206
|
+
variant: "tertiary",
|
|
207
|
+
onClick: closeModal
|
|
208
|
+
}, __('Cancel')), createElement(Button, {
|
|
209
|
+
variant: "primary",
|
|
210
|
+
onClick: () => removeTemplate(item)
|
|
211
|
+
}, __('Clear'))));
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
export const duplicatePatternAction = {
|
|
215
|
+
id: 'duplicate-pattern',
|
|
216
|
+
label: _x('Duplicate', 'action label'),
|
|
217
|
+
isEligible: item => item.type !== TEMPLATE_PART_POST_TYPE,
|
|
218
|
+
modalHeader: _x('Duplicate pattern', 'action label'),
|
|
219
|
+
RenderModal: ({
|
|
220
|
+
item,
|
|
221
|
+
closeModal
|
|
222
|
+
}) => {
|
|
223
|
+
const {
|
|
224
|
+
categoryId = PATTERN_DEFAULT_CATEGORY
|
|
225
|
+
} = getQueryArgs(window.location.href);
|
|
226
|
+
const isThemePattern = item.type === PATTERN_TYPES.theme;
|
|
227
|
+
const history = useHistory();
|
|
228
|
+
function onPatternSuccess({
|
|
229
|
+
pattern
|
|
230
|
+
}) {
|
|
231
|
+
history.push({
|
|
232
|
+
categoryType: PATTERN_TYPES.theme,
|
|
233
|
+
categoryId,
|
|
234
|
+
postType: PATTERN_TYPES.user,
|
|
235
|
+
postId: pattern.id
|
|
236
|
+
});
|
|
237
|
+
closeModal();
|
|
238
|
+
}
|
|
239
|
+
const duplicatedProps = useDuplicatePatternProps({
|
|
240
|
+
pattern: isThemePattern ? item : item.patternPost,
|
|
241
|
+
onSuccess: onPatternSuccess
|
|
242
|
+
});
|
|
243
|
+
return createElement(CreatePatternModalContents, {
|
|
244
|
+
onClose: closeModal,
|
|
245
|
+
confirmLabel: _x('Duplicate', 'action label'),
|
|
246
|
+
...duplicatedProps
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
export const duplicateTemplatePartAction = {
|
|
251
|
+
id: 'duplicate-template-part',
|
|
252
|
+
label: _x('Duplicate', 'action label'),
|
|
253
|
+
isEligible: item => item.type === TEMPLATE_PART_POST_TYPE,
|
|
254
|
+
modalHeader: _x('Duplicate template part', 'action label'),
|
|
255
|
+
RenderModal: ({
|
|
256
|
+
item,
|
|
257
|
+
closeModal
|
|
258
|
+
}) => {
|
|
259
|
+
const {
|
|
260
|
+
createSuccessNotice
|
|
261
|
+
} = useDispatch(noticesStore);
|
|
262
|
+
const {
|
|
263
|
+
categoryId = PATTERN_DEFAULT_CATEGORY
|
|
264
|
+
} = getQueryArgs(window.location.href);
|
|
265
|
+
const history = useHistory();
|
|
266
|
+
async function onTemplatePartSuccess(templatePart) {
|
|
267
|
+
createSuccessNotice(sprintf(
|
|
268
|
+
// translators: %s: The new template part's title e.g. 'Call to action (copy)'.
|
|
269
|
+
__('"%s" duplicated.'), item.title), {
|
|
270
|
+
type: 'snackbar',
|
|
271
|
+
id: 'edit-site-patterns-success'
|
|
272
|
+
});
|
|
273
|
+
history.push({
|
|
274
|
+
postType: TEMPLATE_PART_POST_TYPE,
|
|
275
|
+
postId: templatePart?.id,
|
|
276
|
+
categoryType: TEMPLATE_PART_POST_TYPE,
|
|
277
|
+
categoryId
|
|
278
|
+
});
|
|
279
|
+
closeModal();
|
|
280
|
+
}
|
|
281
|
+
return createElement(CreateTemplatePartModalContents, {
|
|
282
|
+
blocks: item.blocks,
|
|
283
|
+
defaultArea: item.templatePart.area,
|
|
284
|
+
defaultTitle: sprintf( /* translators: %s: Existing template part title */
|
|
285
|
+
__('%s (Copy)'), item.title),
|
|
286
|
+
onCreate: onTemplatePartSuccess,
|
|
287
|
+
onError: closeModal,
|
|
288
|
+
confirmLabel: _x('Duplicate', 'action label')
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
//# sourceMappingURL=dataviews-pattern-actions.js.map
|