@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
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { makeFormDataFromFontFamily } from '../index';
|
|
5
|
+
|
|
6
|
+
/* global File */
|
|
7
|
+
|
|
8
|
+
describe( 'makeFormDataFromFontFamily', () => {
|
|
9
|
+
it( 'should process fontFamilies and return FormData', () => {
|
|
10
|
+
const mockFontFamily = {
|
|
11
|
+
slug: 'bebas',
|
|
12
|
+
name: 'Bebas',
|
|
13
|
+
fontFamily: 'Bebas',
|
|
14
|
+
fontFace: [
|
|
15
|
+
{
|
|
16
|
+
file: new File( [ 'content' ], 'test-font1.woff2' ),
|
|
17
|
+
fontWeight: '500',
|
|
18
|
+
fontStyle: 'normal',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
file: new File( [ 'content' ], 'test-font2.woff2' ),
|
|
22
|
+
fontWeight: '400',
|
|
23
|
+
fontStyle: 'normal',
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const formData = makeFormDataFromFontFamily( mockFontFamily );
|
|
29
|
+
|
|
30
|
+
expect( formData instanceof FormData ).toBeTruthy();
|
|
31
|
+
|
|
32
|
+
// Check if files are added correctly
|
|
33
|
+
expect( formData.get( 'file-0' ).name ).toBe( 'test-font1.woff2' );
|
|
34
|
+
expect( formData.get( 'file-1' ).name ).toBe( 'test-font2.woff2' );
|
|
35
|
+
|
|
36
|
+
// Check if 'fontFamilies' key in FormData is correct
|
|
37
|
+
const expectedFontFamily = {
|
|
38
|
+
fontFace: [
|
|
39
|
+
{
|
|
40
|
+
fontWeight: '500',
|
|
41
|
+
fontStyle: 'normal',
|
|
42
|
+
uploadedFile: 'file-0',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
fontWeight: '400',
|
|
46
|
+
fontStyle: 'normal',
|
|
47
|
+
uploadedFile: 'file-1',
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
slug: 'bebas',
|
|
51
|
+
name: 'Bebas',
|
|
52
|
+
fontFamily: 'Bebas',
|
|
53
|
+
};
|
|
54
|
+
expect( JSON.parse( formData.get( 'font_family_settings' ) ) ).toEqual(
|
|
55
|
+
expectedFontFamily
|
|
56
|
+
);
|
|
57
|
+
} );
|
|
58
|
+
} );
|
|
@@ -11,8 +11,12 @@ import {
|
|
|
11
11
|
__experimentalHStack as HStack,
|
|
12
12
|
__experimentalVStack as VStack,
|
|
13
13
|
} from '@wordpress/components';
|
|
14
|
-
import {
|
|
15
|
-
|
|
14
|
+
import {
|
|
15
|
+
useThrottle,
|
|
16
|
+
useReducedMotion,
|
|
17
|
+
useResizeObserver,
|
|
18
|
+
} from '@wordpress/compose';
|
|
19
|
+
import { useLayoutEffect, useState, useMemo } from '@wordpress/element';
|
|
16
20
|
|
|
17
21
|
/**
|
|
18
22
|
* Internal dependencies
|
|
@@ -60,6 +64,13 @@ const normalizedHeight = 152;
|
|
|
60
64
|
|
|
61
65
|
const normalizedColorSwatchSize = 32;
|
|
62
66
|
|
|
67
|
+
// Throttle options for useThrottle. Must be defined outside of the component,
|
|
68
|
+
// so that the object reference is the same on each render.
|
|
69
|
+
const THROTTLE_OPTIONS = {
|
|
70
|
+
leading: true,
|
|
71
|
+
trailing: true,
|
|
72
|
+
};
|
|
73
|
+
|
|
63
74
|
const StylesPreview = ( { label, isFocused, withHoverView } ) => {
|
|
64
75
|
const [ fontWeight ] = useGlobalStyle( 'typography.fontWeight' );
|
|
65
76
|
const [ fontFamily = 'serif' ] = useGlobalStyle( 'typography.fontFamily' );
|
|
@@ -79,7 +90,47 @@ const StylesPreview = ( { label, isFocused, withHoverView } ) => {
|
|
|
79
90
|
const disableMotion = useReducedMotion();
|
|
80
91
|
const [ isHovered, setIsHovered ] = useState( false );
|
|
81
92
|
const [ containerResizeListener, { width } ] = useResizeObserver();
|
|
82
|
-
const
|
|
93
|
+
const [ throttledWidth, setThrottledWidthState ] = useState( width );
|
|
94
|
+
const [ ratioState, setRatioState ] = useState();
|
|
95
|
+
|
|
96
|
+
const setThrottledWidth = useThrottle(
|
|
97
|
+
setThrottledWidthState,
|
|
98
|
+
250,
|
|
99
|
+
THROTTLE_OPTIONS
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
// Must use useLayoutEffect to avoid a flash of the iframe at the wrong
|
|
103
|
+
// size before the width is set.
|
|
104
|
+
useLayoutEffect( () => {
|
|
105
|
+
if ( width ) {
|
|
106
|
+
setThrottledWidth( width );
|
|
107
|
+
}
|
|
108
|
+
}, [ width, setThrottledWidth ] );
|
|
109
|
+
|
|
110
|
+
// Must use useLayoutEffect to avoid a flash of the iframe at the wrong
|
|
111
|
+
// size before the width is set.
|
|
112
|
+
useLayoutEffect( () => {
|
|
113
|
+
const newRatio = throttledWidth ? throttledWidth / normalizedWidth : 1;
|
|
114
|
+
const ratioDiff = newRatio - ( ratioState || 0 );
|
|
115
|
+
|
|
116
|
+
// Only update the ratio state if the difference is big enough
|
|
117
|
+
// or if the ratio state is not yet set. This is to avoid an
|
|
118
|
+
// endless loop of updates at particular viewport heights when the
|
|
119
|
+
// presence of a scrollbar causes the width to change slightly.
|
|
120
|
+
const isRatioDiffBigEnough = Math.abs( ratioDiff ) > 0.1;
|
|
121
|
+
|
|
122
|
+
if ( isRatioDiffBigEnough || ! ratioState ) {
|
|
123
|
+
setRatioState( newRatio );
|
|
124
|
+
}
|
|
125
|
+
}, [ throttledWidth, ratioState ] );
|
|
126
|
+
|
|
127
|
+
// Set a fallbackRatio to use before the throttled ratio has been set.
|
|
128
|
+
const fallbackRatio = width ? width / normalizedWidth : 1;
|
|
129
|
+
// Use the throttled ratio if it has been calculated, otherwise
|
|
130
|
+
// use the fallback ratio. The throttled ratio is used to avoid
|
|
131
|
+
// an endless loop of updates at particular viewport heights.
|
|
132
|
+
// See: https://github.com/WordPress/gutenberg/issues/55112
|
|
133
|
+
const ratio = ratioState ? ratioState : fallbackRatio;
|
|
83
134
|
|
|
84
135
|
const { paletteColors, highlightedColors } = useStylesPreviewColors();
|
|
85
136
|
|
|
@@ -108,6 +159,7 @@ const StylesPreview = ( { label, isFocused, withHoverView } ) => {
|
|
|
108
159
|
<Iframe
|
|
109
160
|
className="edit-site-global-styles-preview__iframe"
|
|
110
161
|
style={ {
|
|
162
|
+
width: '100%',
|
|
111
163
|
height: normalizedHeight * ratio,
|
|
112
164
|
} }
|
|
113
165
|
onMouseEnter={ () => setIsHovered( true ) }
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import {
|
|
5
|
+
import { privateApis as componentsPrivateApis } from '@wordpress/components';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Internal dependencies
|
|
@@ -10,6 +10,9 @@ import { TabPanel } from '@wordpress/components';
|
|
|
10
10
|
import ColorPalettePanel from './color-palette-panel';
|
|
11
11
|
import GradientPalettePanel from './gradients-palette-panel';
|
|
12
12
|
import ScreenHeader from './header';
|
|
13
|
+
import { unlock } from '../../lock-unlock';
|
|
14
|
+
|
|
15
|
+
const { Tabs } = unlock( componentsPrivateApis );
|
|
13
16
|
|
|
14
17
|
function ScreenColorPalette( { name } ) {
|
|
15
18
|
return (
|
|
@@ -20,31 +23,18 @@ function ScreenColorPalette( { name } ) {
|
|
|
20
23
|
'Palettes are used to provide default color options for blocks and various design tools. Here you can edit the colors with their labels.'
|
|
21
24
|
) }
|
|
22
25
|
/>
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
] }
|
|
36
|
-
>
|
|
37
|
-
{ ( tab ) => (
|
|
38
|
-
<>
|
|
39
|
-
{ tab.value === 'solid' && (
|
|
40
|
-
<ColorPalettePanel name={ name } />
|
|
41
|
-
) }
|
|
42
|
-
{ tab.value === 'gradient' && (
|
|
43
|
-
<GradientPalettePanel name={ name } />
|
|
44
|
-
) }
|
|
45
|
-
</>
|
|
46
|
-
) }
|
|
47
|
-
</TabPanel>
|
|
26
|
+
<Tabs>
|
|
27
|
+
<Tabs.TabList>
|
|
28
|
+
<Tabs.Tab tabId="solid">Solid</Tabs.Tab>
|
|
29
|
+
<Tabs.Tab tabId="gradient">Gradient</Tabs.Tab>
|
|
30
|
+
</Tabs.TabList>
|
|
31
|
+
<Tabs.TabPanel tabId="solid" focusable={ false }>
|
|
32
|
+
<ColorPalettePanel name={ name } />
|
|
33
|
+
</Tabs.TabPanel>
|
|
34
|
+
<Tabs.TabPanel tabId="gradient" focusable={ false }>
|
|
35
|
+
<GradientPalettePanel name={ name } />
|
|
36
|
+
</Tabs.TabPanel>
|
|
37
|
+
</Tabs>
|
|
48
38
|
</>
|
|
49
39
|
);
|
|
50
40
|
}
|
|
@@ -3,13 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __, sprintf } from '@wordpress/i18n';
|
|
5
5
|
import {
|
|
6
|
-
Button,
|
|
7
6
|
__experimentalUseNavigator as useNavigator,
|
|
8
7
|
__experimentalConfirmDialog as ConfirmDialog,
|
|
9
8
|
Spinner,
|
|
10
9
|
} from '@wordpress/components';
|
|
11
10
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
12
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
13
11
|
import { useContext, useState, useEffect } from '@wordpress/element';
|
|
14
12
|
import {
|
|
15
13
|
privateApis as blockEditorPrivateApis,
|
|
@@ -22,51 +20,43 @@ import {
|
|
|
22
20
|
import ScreenHeader from '../header';
|
|
23
21
|
import { unlock } from '../../../lock-unlock';
|
|
24
22
|
import Revisions from '../../revisions';
|
|
25
|
-
import SidebarFixedBottom from '../../sidebar-edit-mode/sidebar-fixed-bottom';
|
|
26
23
|
import { store as editSiteStore } from '../../../store';
|
|
27
24
|
import useGlobalStylesRevisions from './use-global-styles-revisions';
|
|
28
25
|
import RevisionsButtons from './revisions-buttons';
|
|
26
|
+
import StyleBook from '../../style-book';
|
|
27
|
+
import Pagination from '../../pagination';
|
|
29
28
|
|
|
30
29
|
const { GlobalStylesContext, areGlobalStyleConfigsEqual } = unlock(
|
|
31
30
|
blockEditorPrivateApis
|
|
32
31
|
);
|
|
33
32
|
|
|
33
|
+
const PAGE_SIZE = 10;
|
|
34
|
+
|
|
34
35
|
function ScreenRevisions() {
|
|
35
36
|
const { goTo } = useNavigator();
|
|
36
37
|
const { user: currentEditorGlobalStyles, setUserConfig } =
|
|
37
38
|
useContext( GlobalStylesContext );
|
|
38
|
-
const { blocks, editorCanvasContainerView
|
|
39
|
-
( select ) => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const isDirty = __experimentalGetDirtyEntityRecords().length > 0;
|
|
46
|
-
const globalStylesId = __experimentalGetCurrentGlobalStylesId();
|
|
47
|
-
const globalStyles = globalStylesId
|
|
48
|
-
? getEntityRecord( 'root', 'globalStyles', globalStylesId )
|
|
49
|
-
: undefined;
|
|
50
|
-
let _revisionsCount =
|
|
51
|
-
globalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count || 0;
|
|
52
|
-
// one for the reset item.
|
|
53
|
-
_revisionsCount++;
|
|
54
|
-
// one for any dirty changes (unsaved).
|
|
55
|
-
if ( isDirty ) {
|
|
56
|
-
_revisionsCount++;
|
|
57
|
-
}
|
|
58
|
-
return {
|
|
59
|
-
editorCanvasContainerView: unlock(
|
|
60
|
-
select( editSiteStore )
|
|
61
|
-
).getEditorCanvasContainerView(),
|
|
62
|
-
blocks: select( blockEditorStore ).getBlocks(),
|
|
63
|
-
revisionsCount: _revisionsCount,
|
|
64
|
-
};
|
|
65
|
-
},
|
|
39
|
+
const { blocks, editorCanvasContainerView } = useSelect(
|
|
40
|
+
( select ) => ( {
|
|
41
|
+
editorCanvasContainerView: unlock(
|
|
42
|
+
select( editSiteStore )
|
|
43
|
+
).getEditorCanvasContainerView(),
|
|
44
|
+
blocks: select( blockEditorStore ).getBlocks(),
|
|
45
|
+
} ),
|
|
66
46
|
[]
|
|
67
47
|
);
|
|
68
|
-
const
|
|
69
|
-
|
|
48
|
+
const [ currentPage, setCurrentPage ] = useState( 1 );
|
|
49
|
+
const [ currentRevisions, setCurrentRevisions ] = useState( [] );
|
|
50
|
+
const { revisions, isLoading, hasUnsavedChanges, revisionsCount } =
|
|
51
|
+
useGlobalStylesRevisions( {
|
|
52
|
+
query: {
|
|
53
|
+
per_page: PAGE_SIZE,
|
|
54
|
+
page: currentPage,
|
|
55
|
+
},
|
|
56
|
+
} );
|
|
57
|
+
|
|
58
|
+
const numPages = Math.ceil( revisionsCount / PAGE_SIZE );
|
|
59
|
+
|
|
70
60
|
const [ currentlySelectedRevision, setCurrentlySelectedRevision ] =
|
|
71
61
|
useState( currentEditorGlobalStyles );
|
|
72
62
|
const [
|
|
@@ -104,12 +94,21 @@ function ScreenRevisions() {
|
|
|
104
94
|
};
|
|
105
95
|
|
|
106
96
|
useEffect( () => {
|
|
107
|
-
if (
|
|
97
|
+
if (
|
|
98
|
+
! editorCanvasContainerView ||
|
|
99
|
+
! editorCanvasContainerView.startsWith( 'global-styles-revisions' )
|
|
100
|
+
) {
|
|
108
101
|
goTo( '/' ); // Return to global styles main panel.
|
|
109
102
|
setEditorCanvasContainerView( editorCanvasContainerView );
|
|
110
103
|
}
|
|
111
104
|
}, [ editorCanvasContainerView ] );
|
|
112
105
|
|
|
106
|
+
useEffect( () => {
|
|
107
|
+
if ( ! isLoading && revisions.length ) {
|
|
108
|
+
setCurrentRevisions( revisions );
|
|
109
|
+
}
|
|
110
|
+
}, [ revisions, isLoading ] );
|
|
111
|
+
|
|
113
112
|
const firstRevision = revisions[ 0 ];
|
|
114
113
|
const currentlySelectedRevisionId = currentlySelectedRevision?.id;
|
|
115
114
|
const shouldSelectFirstItem =
|
|
@@ -137,8 +136,10 @@ function ScreenRevisions() {
|
|
|
137
136
|
// Only display load button if there is a revision to load,
|
|
138
137
|
// and it is different from the current editor styles.
|
|
139
138
|
const isLoadButtonEnabled =
|
|
140
|
-
!! currentlySelectedRevisionId &&
|
|
141
|
-
|
|
139
|
+
!! currentlySelectedRevisionId &&
|
|
140
|
+
currentlySelectedRevisionId !== 'unsaved' &&
|
|
141
|
+
! selectedRevisionMatchesEditorStyles;
|
|
142
|
+
const hasRevisions = !! currentRevisions.length;
|
|
142
143
|
|
|
143
144
|
return (
|
|
144
145
|
<>
|
|
@@ -153,69 +154,67 @@ function ScreenRevisions() {
|
|
|
153
154
|
) }
|
|
154
155
|
onBack={ onCloseRevisions }
|
|
155
156
|
/>
|
|
156
|
-
{
|
|
157
|
+
{ ! hasRevisions && (
|
|
157
158
|
<Spinner className="edit-site-global-styles-screen-revisions__loading" />
|
|
158
159
|
) }
|
|
159
|
-
{
|
|
160
|
-
|
|
160
|
+
{ hasRevisions &&
|
|
161
|
+
( editorCanvasContainerView ===
|
|
162
|
+
'global-styles-revisions:style-book' ? (
|
|
163
|
+
<StyleBook
|
|
164
|
+
userConfig={ currentlySelectedRevision }
|
|
165
|
+
isSelected={ () => {} }
|
|
166
|
+
onClose={ () => {
|
|
167
|
+
setEditorCanvasContainerView(
|
|
168
|
+
'global-styles-revisions'
|
|
169
|
+
);
|
|
170
|
+
} }
|
|
171
|
+
/>
|
|
172
|
+
) : (
|
|
161
173
|
<Revisions
|
|
162
174
|
blocks={ blocks }
|
|
163
175
|
userConfig={ currentlySelectedRevision }
|
|
164
|
-
|
|
176
|
+
closeButtonLabel={ __( 'Close revisions' ) }
|
|
177
|
+
/>
|
|
178
|
+
) ) }
|
|
179
|
+
<RevisionsButtons
|
|
180
|
+
onChange={ selectRevision }
|
|
181
|
+
selectedRevisionId={ currentlySelectedRevisionId }
|
|
182
|
+
userRevisions={ currentRevisions }
|
|
183
|
+
canApplyRevision={ isLoadButtonEnabled }
|
|
184
|
+
onApplyRevision={ () =>
|
|
185
|
+
hasUnsavedChanges
|
|
186
|
+
? setIsLoadingRevisionWithUnsavedChanges( true )
|
|
187
|
+
: restoreRevision( currentlySelectedRevision )
|
|
188
|
+
}
|
|
189
|
+
/>
|
|
190
|
+
{ numPages > 1 && (
|
|
191
|
+
<div className="edit-site-global-styles-screen-revisions__footer">
|
|
192
|
+
<Pagination
|
|
193
|
+
className="edit-site-global-styles-screen-revisions__pagination"
|
|
194
|
+
currentPage={ currentPage }
|
|
195
|
+
numPages={ numPages }
|
|
196
|
+
changePage={ setCurrentPage }
|
|
197
|
+
totalItems={ revisionsCount }
|
|
198
|
+
disabled={ isLoading }
|
|
199
|
+
label={ __( 'Global Styles pagination navigation' ) }
|
|
165
200
|
/>
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
'unsaved'
|
|
182
|
-
}
|
|
183
|
-
onClick={ () => {
|
|
184
|
-
if ( hasUnsavedChanges ) {
|
|
185
|
-
setIsLoadingRevisionWithUnsavedChanges(
|
|
186
|
-
true
|
|
187
|
-
);
|
|
188
|
-
} else {
|
|
189
|
-
restoreRevision(
|
|
190
|
-
currentlySelectedRevision
|
|
191
|
-
);
|
|
192
|
-
}
|
|
193
|
-
} }
|
|
194
|
-
>
|
|
195
|
-
{ currentlySelectedRevisionId === 'parent'
|
|
196
|
-
? __( 'Reset to defaults' )
|
|
197
|
-
: __( 'Apply' ) }
|
|
198
|
-
</Button>
|
|
199
|
-
</SidebarFixedBottom>
|
|
200
|
-
) }
|
|
201
|
-
</div>
|
|
202
|
-
{ isLoadingRevisionWithUnsavedChanges && (
|
|
203
|
-
<ConfirmDialog
|
|
204
|
-
isOpen={ isLoadingRevisionWithUnsavedChanges }
|
|
205
|
-
confirmButtonText={ __( 'Apply' ) }
|
|
206
|
-
onConfirm={ () =>
|
|
207
|
-
restoreRevision( currentlySelectedRevision )
|
|
208
|
-
}
|
|
209
|
-
onCancel={ () =>
|
|
210
|
-
setIsLoadingRevisionWithUnsavedChanges( false )
|
|
211
|
-
}
|
|
212
|
-
>
|
|
213
|
-
{ __(
|
|
214
|
-
'Any unsaved changes will be lost when you apply this revision.'
|
|
215
|
-
) }
|
|
216
|
-
</ConfirmDialog>
|
|
201
|
+
</div>
|
|
202
|
+
) }
|
|
203
|
+
{ isLoadingRevisionWithUnsavedChanges && (
|
|
204
|
+
<ConfirmDialog
|
|
205
|
+
isOpen={ isLoadingRevisionWithUnsavedChanges }
|
|
206
|
+
confirmButtonText={ __( 'Apply' ) }
|
|
207
|
+
onConfirm={ () =>
|
|
208
|
+
restoreRevision( currentlySelectedRevision )
|
|
209
|
+
}
|
|
210
|
+
onCancel={ () =>
|
|
211
|
+
setIsLoadingRevisionWithUnsavedChanges( false )
|
|
212
|
+
}
|
|
213
|
+
>
|
|
214
|
+
{ __(
|
|
215
|
+
'Any unsaved changes will be lost when you apply this revision.'
|
|
217
216
|
) }
|
|
218
|
-
|
|
217
|
+
</ConfirmDialog>
|
|
219
218
|
) }
|
|
220
219
|
</>
|
|
221
220
|
);
|
|
@@ -6,45 +6,31 @@ import classnames from 'classnames';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { __,
|
|
9
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
10
10
|
import { Button } from '@wordpress/components';
|
|
11
11
|
import { dateI18n, getDate, humanTimeDiff, getSettings } from '@wordpress/date';
|
|
12
12
|
import { store as coreStore } from '@wordpress/core-data';
|
|
13
13
|
import { useSelect } from '@wordpress/data';
|
|
14
|
-
import {
|
|
15
|
-
import { getBlockTypes } from '@wordpress/blocks';
|
|
14
|
+
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
16
15
|
|
|
17
16
|
/**
|
|
18
17
|
* Internal dependencies
|
|
19
18
|
*/
|
|
20
|
-
import
|
|
19
|
+
import { unlock } from '../../../lock-unlock';
|
|
21
20
|
|
|
22
21
|
const DAY_IN_MILLISECONDS = 60 * 60 * 1000 * 24;
|
|
23
|
-
const
|
|
22
|
+
const { getGlobalStylesChanges } = unlock( blockEditorPrivateApis );
|
|
24
23
|
|
|
25
|
-
function ChangesSummary( { revision, previousRevision
|
|
26
|
-
const changes =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
blockNames
|
|
30
|
-
);
|
|
24
|
+
function ChangesSummary( { revision, previousRevision } ) {
|
|
25
|
+
const changes = getGlobalStylesChanges( revision, previousRevision, {
|
|
26
|
+
maxResults: 7,
|
|
27
|
+
} );
|
|
31
28
|
const changesLength = changes.length;
|
|
32
29
|
|
|
33
30
|
if ( ! changesLength ) {
|
|
34
31
|
return null;
|
|
35
32
|
}
|
|
36
33
|
|
|
37
|
-
// Truncate to `n` results if necessary.
|
|
38
|
-
if ( changesLength > MAX_CHANGES ) {
|
|
39
|
-
const deleteCount = changesLength - MAX_CHANGES;
|
|
40
|
-
const andMoreText = sprintf(
|
|
41
|
-
// translators: %d: number of global styles changes that are not displayed in the UI.
|
|
42
|
-
_n( '…and %d more change.', '…and %d more changes.', deleteCount ),
|
|
43
|
-
deleteCount
|
|
44
|
-
);
|
|
45
|
-
changes.splice( MAX_CHANGES, deleteCount, andMoreText );
|
|
46
|
-
}
|
|
47
|
-
|
|
48
34
|
return (
|
|
49
35
|
<span
|
|
50
36
|
data-testid="global-styles-revision-changes"
|
|
@@ -115,6 +101,7 @@ function RevisionsButtons( {
|
|
|
115
101
|
selectedRevisionId,
|
|
116
102
|
onChange,
|
|
117
103
|
canApplyRevision,
|
|
104
|
+
onApplyRevision,
|
|
118
105
|
} ) {
|
|
119
106
|
const { currentThemeName, currentUser } = useSelect( ( select ) => {
|
|
120
107
|
const { getCurrentTheme, getCurrentUser } = select( coreStore );
|
|
@@ -125,20 +112,13 @@ function RevisionsButtons( {
|
|
|
125
112
|
currentUser: getCurrentUser(),
|
|
126
113
|
};
|
|
127
114
|
}, [] );
|
|
128
|
-
const blockNames = useMemo( () => {
|
|
129
|
-
const blockTypes = getBlockTypes();
|
|
130
|
-
return blockTypes.reduce( ( accumulator, { name, title } ) => {
|
|
131
|
-
accumulator[ name ] = title;
|
|
132
|
-
return accumulator;
|
|
133
|
-
}, {} );
|
|
134
|
-
}, [] );
|
|
135
115
|
const dateNowInMs = getDate().getTime();
|
|
136
116
|
const { datetimeAbbreviated } = getSettings().formats;
|
|
137
117
|
|
|
138
118
|
return (
|
|
139
119
|
<ol
|
|
140
120
|
className="edit-site-global-styles-screen-revisions__revisions-list"
|
|
141
|
-
aria-label={ __( 'Global styles revisions' ) }
|
|
121
|
+
aria-label={ __( 'Global styles revisions list' ) }
|
|
142
122
|
role="group"
|
|
143
123
|
>
|
|
144
124
|
{ userRevisions.map( ( revision, index ) => {
|
|
@@ -178,6 +158,7 @@ function RevisionsButtons( {
|
|
|
178
158
|
}
|
|
179
159
|
) }
|
|
180
160
|
key={ id }
|
|
161
|
+
aria-current={ isSelected }
|
|
181
162
|
>
|
|
182
163
|
<Button
|
|
183
164
|
className="edit-site-global-styles-screen-revisions__revision-button"
|
|
@@ -208,9 +189,15 @@ function RevisionsButtons( {
|
|
|
208
189
|
{ displayDate }
|
|
209
190
|
</time>
|
|
210
191
|
) }
|
|
192
|
+
<span className="edit-site-global-styles-screen-revisions__meta">
|
|
193
|
+
<img
|
|
194
|
+
alt={ authorDisplayName }
|
|
195
|
+
src={ authorAvatar }
|
|
196
|
+
/>
|
|
197
|
+
{ authorDisplayName }
|
|
198
|
+
</span>
|
|
211
199
|
{ isSelected && (
|
|
212
200
|
<ChangesSummary
|
|
213
|
-
blockNames={ blockNames }
|
|
214
201
|
revision={ revision }
|
|
215
202
|
previousRevision={
|
|
216
203
|
index < userRevisions.length
|
|
@@ -219,16 +206,28 @@ function RevisionsButtons( {
|
|
|
219
206
|
}
|
|
220
207
|
/>
|
|
221
208
|
) }
|
|
222
|
-
<span className="edit-site-global-styles-screen-revisions__meta">
|
|
223
|
-
<img
|
|
224
|
-
alt={ authorDisplayName }
|
|
225
|
-
src={ authorAvatar }
|
|
226
|
-
/>
|
|
227
|
-
{ authorDisplayName }
|
|
228
|
-
</span>
|
|
229
209
|
</span>
|
|
230
210
|
) }
|
|
231
211
|
</Button>
|
|
212
|
+
{ isSelected &&
|
|
213
|
+
( areStylesEqual ? (
|
|
214
|
+
<p className="edit-site-global-styles-screen-revisions__applied-text">
|
|
215
|
+
{ __(
|
|
216
|
+
'These styles are already applied to your site.'
|
|
217
|
+
) }
|
|
218
|
+
</p>
|
|
219
|
+
) : (
|
|
220
|
+
<Button
|
|
221
|
+
disabled={ areStylesEqual }
|
|
222
|
+
variant="primary"
|
|
223
|
+
className="edit-site-global-styles-screen-revisions__apply-button"
|
|
224
|
+
onClick={ onApplyRevision }
|
|
225
|
+
>
|
|
226
|
+
{ isReset
|
|
227
|
+
? __( 'Reset to defaults' )
|
|
228
|
+
: __( 'Apply' ) }
|
|
229
|
+
</Button>
|
|
230
|
+
) ) }
|
|
232
231
|
</li>
|
|
233
232
|
);
|
|
234
233
|
} ) }
|