@wordpress/edit-site 5.25.0 → 5.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/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/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/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 +357 -268
- package/build-style/style.css +357 -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/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 +1 -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
|
@@ -13,6 +13,7 @@ import { useDispatch, useSelect } from '@wordpress/data';
|
|
|
13
13
|
import { closeSmall } from '@wordpress/icons';
|
|
14
14
|
import { useFocusOnMount, useFocusReturn } from '@wordpress/compose';
|
|
15
15
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
16
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Internal dependencies
|
|
@@ -33,6 +34,7 @@ function getEditorCanvasContainerTitle( view ) {
|
|
|
33
34
|
case 'style-book':
|
|
34
35
|
return __( 'Style Book' );
|
|
35
36
|
case 'global-styles-revisions':
|
|
37
|
+
case 'global-styles-revisions:style-book':
|
|
36
38
|
return __( 'Global styles revisions' );
|
|
37
39
|
default:
|
|
38
40
|
return '';
|
|
@@ -61,7 +63,7 @@ function EditorCanvasContainer( {
|
|
|
61
63
|
).getEditorCanvasContainerView();
|
|
62
64
|
|
|
63
65
|
const _showListViewByDefault = select( preferencesStore ).get(
|
|
64
|
-
'core
|
|
66
|
+
'core',
|
|
65
67
|
'showListViewByDefault'
|
|
66
68
|
);
|
|
67
69
|
|
|
@@ -76,6 +78,8 @@ function EditorCanvasContainer( {
|
|
|
76
78
|
const { setEditorCanvasContainerView } = unlock(
|
|
77
79
|
useDispatch( editSiteStore )
|
|
78
80
|
);
|
|
81
|
+
const { setIsListViewOpened } = useDispatch( editorStore );
|
|
82
|
+
|
|
79
83
|
const focusOnMountRef = useFocusOnMount( 'firstElement' );
|
|
80
84
|
const sectionFocusReturnRef = useFocusReturn();
|
|
81
85
|
const title = useMemo(
|
|
@@ -83,15 +87,13 @@ function EditorCanvasContainer( {
|
|
|
83
87
|
[ editorCanvasContainerView ]
|
|
84
88
|
);
|
|
85
89
|
|
|
86
|
-
const { setIsListViewOpened } = useDispatch( editSiteStore );
|
|
87
|
-
|
|
88
90
|
function onCloseContainer() {
|
|
89
|
-
if ( typeof onClose === 'function' ) {
|
|
90
|
-
onClose();
|
|
91
|
-
}
|
|
92
91
|
setIsListViewOpened( showListViewByDefault );
|
|
93
92
|
setEditorCanvasContainerView( undefined );
|
|
94
93
|
setIsClosed( true );
|
|
94
|
+
if ( typeof onClose === 'function' ) {
|
|
95
|
+
onClose();
|
|
96
|
+
}
|
|
95
97
|
}
|
|
96
98
|
|
|
97
99
|
function closeOnEscape( event ) {
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
CheckboxControl,
|
|
6
|
+
Flex,
|
|
7
|
+
privateApis as componentsPrivateApis,
|
|
8
|
+
} from '@wordpress/components';
|
|
5
9
|
|
|
6
10
|
/**
|
|
7
11
|
* Internal dependencies
|
|
8
12
|
*/
|
|
9
13
|
import { getFontFaceVariantName } from './utils';
|
|
10
14
|
import FontFaceDemo from './font-demo';
|
|
11
|
-
import {
|
|
15
|
+
import { unlock } from '../../../lock-unlock';
|
|
12
16
|
|
|
13
17
|
function CollectionFontVariant( {
|
|
14
18
|
face,
|
|
@@ -25,6 +29,7 @@ function CollectionFontVariant( {
|
|
|
25
29
|
};
|
|
26
30
|
|
|
27
31
|
const displayName = font.name + ' ' + getFontFaceVariantName( face );
|
|
32
|
+
const { kebabCase } = unlock( componentsPrivateApis );
|
|
28
33
|
const checkboxId = kebabCase(
|
|
29
34
|
`${ font.slug }-${ getFontFaceVariantName( face ) }`
|
|
30
35
|
);
|
|
@@ -13,8 +13,8 @@ function ConfirmDeleteDialog( {
|
|
|
13
13
|
return (
|
|
14
14
|
<ConfirmDialog
|
|
15
15
|
isOpen={ isConfirmDeleteOpen }
|
|
16
|
-
cancelButtonText={ __( '
|
|
17
|
-
confirmButtonText={ __( '
|
|
16
|
+
cancelButtonText={ __( 'Cancel' ) }
|
|
17
|
+
confirmButtonText={ __( 'Delete' ) }
|
|
18
18
|
onCancel={ handleCancelUninstall }
|
|
19
19
|
onConfirm={ handleConfirmUninstall }
|
|
20
20
|
>
|
|
@@ -22,7 +22,7 @@ function ConfirmDeleteDialog( {
|
|
|
22
22
|
sprintf(
|
|
23
23
|
/* translators: %s: Name of the font. */
|
|
24
24
|
__(
|
|
25
|
-
'
|
|
25
|
+
'Are you sure you want to delete "%s" font and all its variants and assets?'
|
|
26
26
|
),
|
|
27
27
|
font.name
|
|
28
28
|
) }
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
* Internal dependencies
|
|
15
15
|
*/
|
|
16
16
|
import {
|
|
17
|
-
|
|
17
|
+
fetchInstallFont,
|
|
18
18
|
fetchUninstallFonts,
|
|
19
19
|
fetchFontCollections,
|
|
20
20
|
fetchFontCollection,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
mergeFontFamilies,
|
|
27
27
|
loadFontFaceInBrowser,
|
|
28
28
|
getDisplaySrcFromFontFace,
|
|
29
|
-
|
|
29
|
+
makeFormDataFromFontFamily,
|
|
30
30
|
} from './utils';
|
|
31
31
|
import { toggleFont } from './utils/toggleFont';
|
|
32
32
|
import getIntersectingFontFaces from './utils/get-intersecting-font-faces';
|
|
@@ -192,19 +192,19 @@ function FontLibraryProvider( { children } ) {
|
|
|
192
192
|
return getActivatedFontsOutline( source )[ slug ] || [];
|
|
193
193
|
};
|
|
194
194
|
|
|
195
|
-
async function
|
|
195
|
+
async function installFont( font ) {
|
|
196
196
|
setIsInstalling( true );
|
|
197
197
|
try {
|
|
198
198
|
// Prepare formData to install.
|
|
199
|
-
const formData =
|
|
199
|
+
const formData = makeFormDataFromFontFamily( font );
|
|
200
200
|
// Install the fonts (upload the font files to the server and create the post in the database).
|
|
201
|
-
const response = await
|
|
201
|
+
const response = await fetchInstallFont( formData );
|
|
202
202
|
const fontsInstalled = response?.successes || [];
|
|
203
203
|
// Get intersecting font faces between the fonts we tried to installed and the fonts that were installed
|
|
204
204
|
// (to avoid activating a non installed font).
|
|
205
205
|
const fontToBeActivated = getIntersectingFontFaces(
|
|
206
206
|
fontsInstalled,
|
|
207
|
-
|
|
207
|
+
[ font ]
|
|
208
208
|
);
|
|
209
209
|
// Activate the font families (add the font families to the global styles).
|
|
210
210
|
activateCustomFontFamilies( fontToBeActivated );
|
|
@@ -358,7 +358,7 @@ function FontLibraryProvider( { children } ) {
|
|
|
358
358
|
isFontActivated,
|
|
359
359
|
getFontFacesActivated,
|
|
360
360
|
loadFontFaceAsset,
|
|
361
|
-
|
|
361
|
+
installFont,
|
|
362
362
|
uninstallFont,
|
|
363
363
|
toggleActivateFont,
|
|
364
364
|
getAvailableFontsOutline,
|
|
@@ -21,7 +21,7 @@ import { search, closeSmall } from '@wordpress/icons';
|
|
|
21
21
|
/**
|
|
22
22
|
* Internal dependencies
|
|
23
23
|
*/
|
|
24
|
-
import
|
|
24
|
+
import TabPanelLayout from './tab-panel-layout';
|
|
25
25
|
import { FontLibraryContext } from './context';
|
|
26
26
|
import FontsGrid from './fonts-grid';
|
|
27
27
|
import FontCard from './font-card';
|
|
@@ -54,7 +54,7 @@ function FontCollection( { id } ) {
|
|
|
54
54
|
const [ renderConfirmDialog, setRenderConfirmDialog ] = useState(
|
|
55
55
|
requiresPermission && ! getGoogleFontsPermissionFromStorage()
|
|
56
56
|
);
|
|
57
|
-
const { collections, getFontCollection,
|
|
57
|
+
const { collections, getFontCollection, installFont } =
|
|
58
58
|
useContext( FontLibraryContext );
|
|
59
59
|
const selectedCollection = collections.find(
|
|
60
60
|
( collection ) => collection.id === id
|
|
@@ -92,6 +92,11 @@ function FontCollection( { id } ) {
|
|
|
92
92
|
setNotice( null );
|
|
93
93
|
}, [ id ] );
|
|
94
94
|
|
|
95
|
+
useEffect( () => {
|
|
96
|
+
// If the selected fonts change, reset the selected fonts to install
|
|
97
|
+
setFontsToInstall( [] );
|
|
98
|
+
}, [ selectedFont ] );
|
|
99
|
+
|
|
95
100
|
// Reset notice after 5 seconds
|
|
96
101
|
useEffect( () => {
|
|
97
102
|
if ( notice && notice?.duration !== 0 ) {
|
|
@@ -149,14 +154,14 @@ function FontCollection( { id } ) {
|
|
|
149
154
|
};
|
|
150
155
|
|
|
151
156
|
const handleInstall = async () => {
|
|
152
|
-
const response = await
|
|
157
|
+
const response = await installFont( fontsToInstall[ 0 ] );
|
|
153
158
|
const installNotice = getNoticeFromInstallResponse( response );
|
|
154
159
|
setNotice( installNotice );
|
|
155
160
|
resetFontsToInstall();
|
|
156
161
|
};
|
|
157
162
|
|
|
158
163
|
return (
|
|
159
|
-
<
|
|
164
|
+
<TabPanelLayout
|
|
160
165
|
title={
|
|
161
166
|
! selectedFont ? selectedCollection.name : selectedFont.name
|
|
162
167
|
}
|
|
@@ -270,7 +275,7 @@ function FontCollection( { id } ) {
|
|
|
270
275
|
) ) }
|
|
271
276
|
</FontsGrid>
|
|
272
277
|
) }
|
|
273
|
-
</
|
|
278
|
+
</TabPanelLayout>
|
|
274
279
|
);
|
|
275
280
|
}
|
|
276
281
|
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
Modal,
|
|
7
|
+
privateApis as componentsPrivateApis,
|
|
8
|
+
} from '@wordpress/components';
|
|
6
9
|
import { useContext } from '@wordpress/element';
|
|
7
10
|
|
|
8
11
|
/**
|
|
@@ -12,33 +15,33 @@ import InstalledFonts from './installed-fonts';
|
|
|
12
15
|
import FontCollection from './font-collection';
|
|
13
16
|
import UploadFonts from './upload-fonts';
|
|
14
17
|
import { FontLibraryContext } from './context';
|
|
18
|
+
import { unlock } from '../../../lock-unlock';
|
|
19
|
+
|
|
20
|
+
const { Tabs } = unlock( componentsPrivateApis );
|
|
15
21
|
|
|
16
22
|
const DEFAULT_TABS = [
|
|
17
23
|
{
|
|
18
|
-
|
|
24
|
+
id: 'installed-fonts',
|
|
19
25
|
title: __( 'Library' ),
|
|
20
|
-
className: 'installed-fonts',
|
|
21
26
|
},
|
|
22
27
|
{
|
|
23
|
-
|
|
28
|
+
id: 'upload-fonts',
|
|
24
29
|
title: __( 'Upload' ),
|
|
25
|
-
className: 'upload-fonts',
|
|
26
30
|
},
|
|
27
31
|
];
|
|
28
32
|
|
|
29
33
|
const tabsFromCollections = ( collections ) =>
|
|
30
34
|
collections.map( ( { id, name } ) => ( {
|
|
31
|
-
|
|
35
|
+
id,
|
|
32
36
|
title:
|
|
33
37
|
collections.length === 1 && id === 'default-font-collection'
|
|
34
38
|
? __( 'Install Fonts' )
|
|
35
39
|
: name,
|
|
36
|
-
className: 'collection',
|
|
37
40
|
} ) );
|
|
38
41
|
|
|
39
42
|
function FontLibraryModal( {
|
|
40
43
|
onRequestClose,
|
|
41
|
-
|
|
44
|
+
initialTabId = 'installed-fonts',
|
|
42
45
|
} ) {
|
|
43
46
|
const { collections } = useContext( FontLibraryContext );
|
|
44
47
|
|
|
@@ -54,22 +57,39 @@ function FontLibraryModal( {
|
|
|
54
57
|
isFullScreen
|
|
55
58
|
className="font-library-modal"
|
|
56
59
|
>
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
60
|
+
<div className="font-library-modal__tabs">
|
|
61
|
+
<Tabs initialTabId={ initialTabId }>
|
|
62
|
+
<Tabs.TabList>
|
|
63
|
+
{ tabs.map( ( { id, title } ) => (
|
|
64
|
+
<Tabs.Tab key={ id } tabId={ id }>
|
|
65
|
+
{ title }
|
|
66
|
+
</Tabs.Tab>
|
|
67
|
+
) ) }
|
|
68
|
+
</Tabs.TabList>
|
|
69
|
+
{ tabs.map( ( { id } ) => {
|
|
70
|
+
let contents;
|
|
71
|
+
switch ( id ) {
|
|
72
|
+
case 'upload-fonts':
|
|
73
|
+
contents = <UploadFonts />;
|
|
74
|
+
break;
|
|
75
|
+
case 'installed-fonts':
|
|
76
|
+
contents = <InstalledFonts />;
|
|
77
|
+
break;
|
|
78
|
+
default:
|
|
79
|
+
contents = <FontCollection id={ id } />;
|
|
80
|
+
}
|
|
81
|
+
return (
|
|
82
|
+
<Tabs.TabPanel
|
|
83
|
+
key={ id }
|
|
84
|
+
tabId={ id }
|
|
85
|
+
focusable={ false }
|
|
86
|
+
>
|
|
87
|
+
{ contents }
|
|
88
|
+
</Tabs.TabPanel>
|
|
89
|
+
);
|
|
90
|
+
} ) }
|
|
91
|
+
</Tabs>
|
|
92
|
+
</div>
|
|
73
93
|
</Modal>
|
|
74
94
|
);
|
|
75
95
|
}
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
/**
|
|
17
17
|
* Internal dependencies
|
|
18
18
|
*/
|
|
19
|
-
import
|
|
19
|
+
import TabPanelLayout from './tab-panel-layout';
|
|
20
20
|
import { FontLibraryContext } from './context';
|
|
21
21
|
import FontsGrid from './fonts-grid';
|
|
22
22
|
import LibraryFontDetails from './library-font-details';
|
|
@@ -92,7 +92,7 @@ function InstalledFonts() {
|
|
|
92
92
|
}, [ notice ] );
|
|
93
93
|
|
|
94
94
|
return (
|
|
95
|
-
<
|
|
95
|
+
<TabPanelLayout
|
|
96
96
|
title={ libraryFontSelected?.name || '' }
|
|
97
97
|
description={ tabDescription }
|
|
98
98
|
handleBack={ !! libraryFontSelected && handleUnselectFont }
|
|
@@ -173,7 +173,7 @@ function InstalledFonts() {
|
|
|
173
173
|
handleCancelUninstall={ handleCancelUninstall }
|
|
174
174
|
/>
|
|
175
175
|
) }
|
|
176
|
-
</
|
|
176
|
+
</TabPanelLayout>
|
|
177
177
|
);
|
|
178
178
|
}
|
|
179
179
|
|
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { useContext } from '@wordpress/element';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
CheckboxControl,
|
|
7
|
+
Flex,
|
|
8
|
+
privateApis as componentsPrivateApis,
|
|
9
|
+
} from '@wordpress/components';
|
|
6
10
|
|
|
7
11
|
/**
|
|
8
12
|
* Internal dependencies
|
|
@@ -10,7 +14,7 @@ import { CheckboxControl, Flex } from '@wordpress/components';
|
|
|
10
14
|
import { getFontFaceVariantName } from './utils';
|
|
11
15
|
import { FontLibraryContext } from './context';
|
|
12
16
|
import FontFaceDemo from './font-demo';
|
|
13
|
-
import {
|
|
17
|
+
import { unlock } from '../../../lock-unlock';
|
|
14
18
|
|
|
15
19
|
function LibraryFontVariant( { face, font } ) {
|
|
16
20
|
const { isFontActivated, toggleActivateFont } =
|
|
@@ -34,6 +38,7 @@ function LibraryFontVariant( { face, font } ) {
|
|
|
34
38
|
};
|
|
35
39
|
|
|
36
40
|
const displayName = font.name + ' ' + getFontFaceVariantName( face );
|
|
41
|
+
const { kebabCase } = unlock( componentsPrivateApis );
|
|
37
42
|
const checkboxId = kebabCase(
|
|
38
43
|
`${ font.slug }-${ getFontFaceVariantName( face ) }`
|
|
39
44
|
);
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
FormFileUpload,
|
|
12
12
|
Notice,
|
|
13
13
|
FlexItem,
|
|
14
|
+
privateApis as componentsPrivateApis,
|
|
14
15
|
} from '@wordpress/components';
|
|
15
16
|
import { useContext, useState, useEffect } from '@wordpress/element';
|
|
16
17
|
|
|
@@ -23,10 +24,14 @@ import { Font } from '../../../../lib/lib-font.browser';
|
|
|
23
24
|
import makeFamiliesFromFaces from './utils/make-families-from-faces';
|
|
24
25
|
import { loadFontFaceInBrowser } from './utils';
|
|
25
26
|
import { getNoticeFromInstallResponse } from './utils/get-notice-from-response';
|
|
27
|
+
import { unlock } from '../../../lock-unlock';
|
|
28
|
+
|
|
29
|
+
const { ProgressBar } = unlock( componentsPrivateApis );
|
|
26
30
|
|
|
27
31
|
function LocalFonts() {
|
|
28
|
-
const {
|
|
32
|
+
const { installFont } = useContext( FontLibraryContext );
|
|
29
33
|
const [ notice, setNotice ] = useState( null );
|
|
34
|
+
const [ isUploading, setIsUploading ] = useState( false );
|
|
30
35
|
const supportedFormats =
|
|
31
36
|
ALLOWED_FILE_EXTENSIONS.slice( 0, -1 )
|
|
32
37
|
.map( ( extension ) => `.${ extension }` )
|
|
@@ -58,6 +63,7 @@ function LocalFonts() {
|
|
|
58
63
|
*/
|
|
59
64
|
const handleFilesUpload = ( files ) => {
|
|
60
65
|
setNotice( null );
|
|
66
|
+
setIsUploading( true );
|
|
61
67
|
const uniqueFilenames = new Set();
|
|
62
68
|
const selectedFiles = [ ...files ];
|
|
63
69
|
const allowedFiles = selectedFiles.filter( ( file ) => {
|
|
@@ -147,9 +153,21 @@ function LocalFonts() {
|
|
|
147
153
|
*/
|
|
148
154
|
const handleInstall = async ( fontFaces ) => {
|
|
149
155
|
const fontFamilies = makeFamiliesFromFaces( fontFaces );
|
|
150
|
-
|
|
156
|
+
|
|
157
|
+
if ( fontFamilies.length > 1 ) {
|
|
158
|
+
setNotice( {
|
|
159
|
+
type: 'error',
|
|
160
|
+
message: __(
|
|
161
|
+
'Variants from only one font family can be uploaded at a time.'
|
|
162
|
+
),
|
|
163
|
+
} );
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const response = await installFont( fontFamilies[ 0 ] );
|
|
151
168
|
const installNotice = getNoticeFromInstallResponse( response );
|
|
152
169
|
setNotice( installNotice );
|
|
170
|
+
setIsUploading( false );
|
|
153
171
|
};
|
|
154
172
|
|
|
155
173
|
return (
|
|
@@ -157,31 +175,28 @@ function LocalFonts() {
|
|
|
157
175
|
<Spacer margin={ 16 } />
|
|
158
176
|
<DropZone onFilesDrop={ handleDropZone } />
|
|
159
177
|
<VStack className="font-library-modal__local-fonts">
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
178
|
+
{ ! isUploading && (
|
|
179
|
+
<FormFileUpload
|
|
180
|
+
accept={ ALLOWED_FILE_EXTENSIONS.map(
|
|
181
|
+
( ext ) => `.${ ext }`
|
|
182
|
+
).join( ',' ) }
|
|
183
|
+
multiple={ true }
|
|
184
|
+
onChange={ onFilesUpload }
|
|
185
|
+
render={ ( { openFileDialog } ) => (
|
|
186
|
+
<Button
|
|
187
|
+
className="font-library-modal__upload-area"
|
|
188
|
+
onClick={ openFileDialog }
|
|
189
|
+
>
|
|
190
|
+
<span>{ __( 'Upload font' ) }</span>
|
|
191
|
+
</Button>
|
|
192
|
+
) }
|
|
193
|
+
/>
|
|
194
|
+
) }
|
|
195
|
+
{ isUploading && (
|
|
176
196
|
<FlexItem>
|
|
177
|
-
<
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
status={ notice.type }
|
|
181
|
-
className="font-library-modal__upload-area__notice"
|
|
182
|
-
>
|
|
183
|
-
{ notice.message }
|
|
184
|
-
</Notice>
|
|
197
|
+
<div className="font-library-modal__upload-area">
|
|
198
|
+
<ProgressBar />
|
|
199
|
+
</div>
|
|
185
200
|
</FlexItem>
|
|
186
201
|
) }
|
|
187
202
|
<Spacer margin={ 2 } />
|
|
@@ -194,6 +209,18 @@ function LocalFonts() {
|
|
|
194
209
|
supportedFormats
|
|
195
210
|
) }
|
|
196
211
|
</Text>
|
|
212
|
+
{ ! isUploading && notice && (
|
|
213
|
+
<FlexItem>
|
|
214
|
+
<Spacer margin={ 2 } />
|
|
215
|
+
<Notice
|
|
216
|
+
isDismissible={ false }
|
|
217
|
+
status={ notice.type }
|
|
218
|
+
className="font-library-modal__upload-area__notice"
|
|
219
|
+
>
|
|
220
|
+
{ notice.message }
|
|
221
|
+
</Notice>
|
|
222
|
+
</FlexItem>
|
|
223
|
+
) }
|
|
197
224
|
</VStack>
|
|
198
225
|
</>
|
|
199
226
|
);
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import apiFetch from '@wordpress/api-fetch';
|
|
9
9
|
|
|
10
|
-
export async function
|
|
10
|
+
export async function fetchInstallFont( data ) {
|
|
11
11
|
const config = {
|
|
12
|
-
path: '/wp/v2/
|
|
12
|
+
path: '/wp/v2/font-families',
|
|
13
13
|
method: 'POST',
|
|
14
14
|
body: data,
|
|
15
15
|
};
|
|
@@ -21,7 +21,7 @@ export async function fetchUninstallFonts( fonts ) {
|
|
|
21
21
|
font_families: fonts,
|
|
22
22
|
};
|
|
23
23
|
const config = {
|
|
24
|
-
path: '/wp/v2/
|
|
24
|
+
path: '/wp/v2/font-families',
|
|
25
25
|
method: 'DELETE',
|
|
26
26
|
data,
|
|
27
27
|
};
|
|
@@ -30,7 +30,7 @@ export async function fetchUninstallFonts( fonts ) {
|
|
|
30
30
|
|
|
31
31
|
export async function fetchFontCollections() {
|
|
32
32
|
const config = {
|
|
33
|
-
path: '/wp/v2/
|
|
33
|
+
path: '/wp/v2/font-collections',
|
|
34
34
|
method: 'GET',
|
|
35
35
|
};
|
|
36
36
|
return apiFetch( config );
|
|
@@ -38,7 +38,7 @@ export async function fetchFontCollections() {
|
|
|
38
38
|
|
|
39
39
|
export async function fetchFontCollection( id ) {
|
|
40
40
|
const config = {
|
|
41
|
-
path: `/wp/v2/
|
|
41
|
+
path: `/wp/v2/font-collections/${ id }`,
|
|
42
42
|
method: 'GET',
|
|
43
43
|
};
|
|
44
44
|
return apiFetch( config );
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
.font-library-
|
|
27
|
+
.font-library-modal__tabpanel-layout {
|
|
28
28
|
|
|
29
29
|
main {
|
|
30
30
|
padding-bottom: 4rem;
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
padding-bottom: 1rem;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
.font-library-
|
|
78
|
+
.font-library-modal__tabs {
|
|
79
79
|
[role="tablist"] {
|
|
80
80
|
position: sticky;
|
|
81
81
|
top: 0;
|
|
@@ -94,6 +94,9 @@
|
|
|
94
94
|
justify-content: center;
|
|
95
95
|
height: 250px;
|
|
96
96
|
width: 100%;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
button.font-library-modal__upload-area {
|
|
97
100
|
background-color: #f0f0f0;
|
|
98
101
|
}
|
|
99
102
|
|
package/src/components/global-styles/font-library-modal/{tab-layout.js → tab-panel-layout.js}
RENAMED
|
@@ -11,9 +11,15 @@ import {
|
|
|
11
11
|
} from '@wordpress/components';
|
|
12
12
|
import { chevronLeft } from '@wordpress/icons';
|
|
13
13
|
|
|
14
|
-
function
|
|
14
|
+
function TabPanelLayout( {
|
|
15
|
+
title,
|
|
16
|
+
description,
|
|
17
|
+
handleBack,
|
|
18
|
+
children,
|
|
19
|
+
footer,
|
|
20
|
+
} ) {
|
|
15
21
|
return (
|
|
16
|
-
<div className="font-library-
|
|
22
|
+
<div className="font-library-modal__tabpanel-layout">
|
|
17
23
|
<Spacer margin={ 4 } />
|
|
18
24
|
<VStack spacing={ 4 } justify="space-between">
|
|
19
25
|
<header>
|
|
@@ -47,4 +53,4 @@ function TabLayout( { title, description, handleBack, children, footer } ) {
|
|
|
47
53
|
);
|
|
48
54
|
}
|
|
49
55
|
|
|
50
|
-
export default
|
|
56
|
+
export default TabPanelLayout;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { privateApis as componentsPrivateApis } from '@wordpress/components';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { FONT_WEIGHTS, FONT_STYLES } from './constants';
|
|
10
|
+
import { unlock } from '../../../../lock-unlock';
|
|
10
11
|
|
|
11
12
|
export function setUIValuesNeeded( font, extraValues = {} ) {
|
|
12
13
|
if ( ! font.name && ( font.fontFamily || font.slug ) ) {
|
|
@@ -129,25 +130,21 @@ export function getDisplaySrcFromFontFace( input, urlPrefix ) {
|
|
|
129
130
|
return src;
|
|
130
131
|
}
|
|
131
132
|
|
|
132
|
-
|
|
133
|
-
// Additional context: https://github.com/WordPress/gutenberg/issues/53695
|
|
134
|
-
export function wpKebabCase( str ) {
|
|
135
|
-
// If a string contains a digit followed by a number, insert a dash between them.
|
|
136
|
-
return kebabCase( str ).replace(
|
|
137
|
-
/([a-zA-Z])(\d)|(\d)([a-zA-Z])/g,
|
|
138
|
-
'$1$3-$2$4'
|
|
139
|
-
);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
export function makeFormDataFromFontFamilies( fontFamilies ) {
|
|
133
|
+
export function makeFormDataFromFontFamily( fontFamily ) {
|
|
143
134
|
const formData = new FormData();
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
135
|
+
const { kebabCase } = unlock( componentsPrivateApis );
|
|
136
|
+
|
|
137
|
+
const newFontFamily = {
|
|
138
|
+
...fontFamily,
|
|
139
|
+
slug: kebabCase( fontFamily.slug ),
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
if ( newFontFamily?.fontFace ) {
|
|
143
|
+
const newFontFaces = newFontFamily.fontFace.map(
|
|
144
|
+
( face, faceIndex ) => {
|
|
148
145
|
if ( face.file ) {
|
|
149
146
|
// Slugified file name because the it might contain spaces or characters treated differently on the server.
|
|
150
|
-
const fileId = `file-${
|
|
147
|
+
const fileId = `file-${ faceIndex }`;
|
|
151
148
|
// Add the files to the formData
|
|
152
149
|
formData.append( fileId, face.file, face.file.name );
|
|
153
150
|
// remove the file object from the face object the file is referenced by the uploadedFile key
|
|
@@ -159,10 +156,11 @@ export function makeFormDataFromFontFamilies( fontFamilies ) {
|
|
|
159
156
|
return newFace;
|
|
160
157
|
}
|
|
161
158
|
return face;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
166
|
-
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
newFontFamily.fontFace = newFontFaces;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
formData.append( 'font_family_settings', JSON.stringify( newFontFamily ) );
|
|
167
165
|
return formData;
|
|
168
166
|
}
|