@wordpress/edit-site 5.24.1 → 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/CHANGELOG.md +2 -0
- package/LICENSE.md +1 -1
- package/build/components/add-new-template/add-custom-template-modal-content.js +2 -3
- package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build/components/block-editor/back-button.js +3 -2
- package/build/components/block-editor/back-button.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +48 -23
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/resizable-editor.js +2 -2
- package/build/components/block-editor/resizable-editor.js.map +1 -1
- package/build/components/block-editor/site-editor-canvas.js +5 -54
- package/build/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build/components/block-editor/use-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 +15 -23
- 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 +21 -33
- 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 +11 -7
- 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 +6 -6
- 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 +11 -7
- 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 +54 -58
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +56 -15
- 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 +15 -106
- package/build/components/header-edit-mode/document-tools/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +21 -47
- 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 +19 -14
- 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 +15 -21
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page/header.js +2 -1
- package/build/components/page/header.js.map +1 -1
- package/build/components/page-main/index.js +4 -4
- package/build/components/page-main/index.js.map +1 -1
- package/build/components/page-pages/index.js +102 -52
- 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 +3 -3
- package/build/components/page-patterns/patterns-list.js.map +1 -1
- package/build/components/page-patterns/rename-menu-item.js +3 -0
- package/build/components/page-patterns/rename-menu-item.js.map +1 -1
- package/build/components/page-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 +89 -25
- 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/routes/use-title.js +3 -4
- package/build/components/routes/use-title.js.map +1 -1
- package/build/components/save-button/index.js +8 -4
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/sidebar/index.js +26 -20
- 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/dataview-item.js +2 -10
- package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +19 -6
- 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 +10 -4
- package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js +1 -2
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build/components/sidebar-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-navigation-menu/rename-modal.js +3 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build/components/sidebar-navigation-screen-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-patterns/use-pattern-categories.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/home-template-details.js +3 -89
- package/build/components/sidebar-navigation-screen-template/home-template-details.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/index.js +2 -1
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/template-areas.js +117 -0
- package/build/components/sidebar-navigation-screen-template/template-areas.js.map +1 -0
- package/build/components/sidebar-navigation-screen-templates/index.js +63 -8
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/site-hub/index.js +6 -3
- package/build/components/site-hub/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/components/template-actions/rename-menu-item.js +3 -0
- package/build/components/template-actions/rename-menu-item.js.map +1 -1
- package/build/components/welcome-guide/styles.js +1 -1
- package/build/components/welcome-guide/styles.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +9 -1
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +11 -6
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/hooks/navigation-menu-edit.js +1 -1
- package/build/hooks/navigation-menu-edit.js.map +1 -1
- package/build/hooks/template-part-edit.js +1 -1
- package/build/hooks/template-part-edit.js.map +1 -1
- package/build/index.js +12 -7
- package/build/index.js.map +1 -1
- package/build/store/actions.js +54 -52
- 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 -64
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +44 -47
- package/build/store/selectors.js.map +1 -1
- package/build/utils/constants.js +15 -1
- package/build/utils/constants.js.map +1 -1
- package/build/utils/get-is-list-page.js +1 -1
- package/build/utils/get-is-list-page.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-template-modal-content.js +1 -1
- package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build-module/components/block-editor/back-button.js +4 -3
- package/build-module/components/block-editor/back-button.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +50 -25
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/resizable-editor.js +2 -2
- package/build-module/components/block-editor/resizable-editor.js.map +1 -1
- package/build-module/components/block-editor/site-editor-canvas.js +8 -56
- package/build-module/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/use-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 +16 -24
- 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 +25 -37
- 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 +13 -8
- 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 +8 -8
- 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 +13 -8
- 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 +55 -59
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +56 -15
- 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 +19 -109
- package/build-module/components/header-edit-mode/document-tools/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +25 -51
- 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 +20 -15
- 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 +15 -21
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page/header.js +2 -1
- package/build-module/components/page/header.js.map +1 -1
- package/build-module/components/page-main/index.js +4 -4
- package/build-module/components/page-main/index.js.map +1 -1
- package/build-module/components/page-pages/index.js +101 -51
- 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 +3 -3
- package/build-module/components/page-patterns/patterns-list.js.map +1 -1
- package/build-module/components/page-patterns/rename-menu-item.js +3 -0
- package/build-module/components/page-patterns/rename-menu-item.js.map +1 -1
- package/build-module/components/page-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 +90 -26
- 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/routes/use-title.js +3 -4
- package/build-module/components/routes/use-title.js.map +1 -1
- package/build-module/components/save-button/index.js +8 -4
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +26 -20
- 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/dataview-item.js +2 -10
- package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +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 +10 -4
- package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +2 -3
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build-module/components/sidebar-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-navigation-menu/rename-modal.js +3 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-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-patterns/use-pattern-categories.js +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/home-template-details.js +5 -90
- package/build-module/components/sidebar-navigation-screen-template/home-template-details.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js +2 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/template-areas.js +109 -0
- package/build-module/components/sidebar-navigation-screen-template/template-areas.js.map +1 -0
- package/build-module/components/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/site-hub/index.js +6 -3
- package/build-module/components/site-hub/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/components/template-actions/rename-menu-item.js +3 -0
- package/build-module/components/template-actions/rename-menu-item.js.map +1 -1
- package/build-module/components/welcome-guide/styles.js +1 -1
- package/build-module/components/welcome-guide/styles.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +9 -1
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +11 -6
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/hooks/navigation-menu-edit.js +1 -1
- package/build-module/hooks/navigation-menu-edit.js.map +1 -1
- package/build-module/hooks/template-part-edit.js +1 -1
- package/build-module/hooks/template-part-edit.js.map +1 -1
- package/build-module/index.js +12 -7
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +49 -47
- 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 -61
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +40 -41
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/constants.js +8 -0
- package/build-module/utils/constants.js.map +1 -1
- package/build-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 +607 -561
- package/build-style/style.css +607 -561
- package/package.json +42 -42
- package/src/components/add-new-template/add-custom-template-modal-content.js +1 -1
- 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/editor-canvas.js +63 -47
- package/src/components/block-editor/resizable-editor.js +1 -1
- package/src/components/block-editor/site-editor-canvas.js +32 -96
- package/src/components/block-editor/style.scss +7 -14
- package/src/components/block-editor/use-post-link-props.js +20 -0
- package/src/components/block-editor/use-site-editor-settings.js +38 -58
- 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 +34 -47
- package/src/components/editor-canvas-container/index.js +8 -6
- package/src/components/global-styles/font-library-modal/collection-font-variant.js +18 -7
- package/src/components/global-styles/font-library-modal/confirm-delete-dialog.js +3 -3
- package/src/components/global-styles/font-library-modal/context.js +8 -8
- 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 +18 -7
- 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 +93 -101
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +85 -17
- package/src/components/global-styles/screen-revisions/style.scss +86 -21
- 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 +35 -167
- package/src/components/header-edit-mode/index.js +33 -78
- package/src/components/header-edit-mode/mode-switcher/index.js +0 -4
- package/src/components/header-edit-mode/more-menu/index.js +25 -27
- package/src/components/header-edit-mode/style.scss +46 -68
- 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 +29 -47
- package/src/components/layout/style.scss +10 -3
- package/src/components/page/header.js +2 -1
- package/src/components/page/style.scss +3 -3
- package/src/components/page-main/index.js +8 -8
- package/src/components/page-pages/index.js +157 -62
- package/src/components/page-pages/style.scss +4 -1
- 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 +7 -3
- package/src/components/page-patterns/rename-menu-item.js +7 -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 +151 -40
- package/src/components/revisions/index.js +8 -15
- package/src/components/routes/link.js +11 -3
- package/src/components/routes/use-title.js +3 -10
- package/src/components/save-button/index.js +17 -3
- package/src/components/sidebar/index.js +45 -35
- package/src/components/sidebar/style.scss +10 -12
- package/src/components/sidebar-dataviews/add-new-view.js +1 -1
- package/src/components/sidebar-dataviews/dataview-item.js +3 -7
- 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 +53 -25
- package/src/components/sidebar-edit-mode/page-panels/page-summary.js +2 -2
- package/src/components/sidebar-edit-mode/page-panels/style.scss +1 -42
- package/src/components/sidebar-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-navigation-menu/rename-modal.js +7 -1
- 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-patterns/use-pattern-categories.js +1 -1
- package/src/components/sidebar-navigation-screen-template/home-template-details.js +1 -96
- package/src/components/sidebar-navigation-screen-template/index.js +8 -2
- package/src/components/sidebar-navigation-screen-template/template-areas.js +135 -0
- package/src/components/sidebar-navigation-screen-templates/index.js +85 -28
- package/src/components/sidebar-navigation-screen-templates/style.scss +9 -0
- package/src/components/site-hub/index.js +4 -5
- 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/components/template-actions/rename-menu-item.js +7 -1
- package/src/components/welcome-guide/styles.js +1 -1
- package/src/hooks/commands/use-common-commands.js +10 -5
- package/src/hooks/commands/use-edit-mode-commands.js +8 -12
- package/src/hooks/navigation-menu-edit.js +1 -1
- package/src/hooks/template-part-edit.js +1 -1
- package/src/index.js +11 -5
- package/src/store/actions.js +50 -50
- package/src/store/private-actions.js +7 -3
- package/src/store/reducer.js +0 -62
- package/src/store/selectors.js +47 -41
- 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 +3 -3
- package/src/utils/constants.js +8 -0
- package/src/utils/get-is-list-page.js +2 -3
- package/build/components/dataviews/add-filter.js +0 -91
- package/build/components/dataviews/add-filter.js.map +0 -1
- package/build/components/dataviews/constants.js +0 -14
- package/build/components/dataviews/constants.js.map +0 -1
- package/build/components/dataviews/dataviews.js +0 -99
- package/build/components/dataviews/dataviews.js.map +0 -1
- package/build/components/dataviews/filter-summary.js +0 -62
- package/build/components/dataviews/filter-summary.js.map +0 -1
- package/build/components/dataviews/filters.js +0 -63
- package/build/components/dataviews/filters.js.map +0 -1
- package/build/components/dataviews/index.js +0 -21
- package/build/components/dataviews/index.js.map +0 -1
- package/build/components/dataviews/item-actions.js +0 -184
- package/build/components/dataviews/item-actions.js.map +0 -1
- package/build/components/dataviews/pagination.js +0 -123
- package/build/components/dataviews/pagination.js.map +0 -1
- package/build/components/dataviews/reset-filters.js +0 -33
- package/build/components/dataviews/reset-filters.js.map +0 -1
- package/build/components/dataviews/search.js +0 -51
- package/build/components/dataviews/search.js.map +0 -1
- package/build/components/dataviews/view-actions.js +0 -244
- package/build/components/dataviews/view-actions.js.map +0 -1
- package/build/components/dataviews/view-grid.js +0 -82
- package/build/components/dataviews/view-grid.js.map +0 -1
- package/build/components/dataviews/view-list.js +0 -399
- package/build/components/dataviews/view-list.js.map +0 -1
- package/build/components/dataviews/view-side-by-side.js +0 -20
- package/build/components/dataviews/view-side-by-side.js.map +0 -1
- package/build/components/global-styles/font-library-modal/tab-layout.js.map +0 -1
- package/build/components/header-edit-mode/document-actions/index.js +0 -172
- package/build/components/header-edit-mode/document-actions/index.js.map +0 -1
- package/build/components/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-content-focus-notifications/back-to-page-notification.js +0 -61
- package/build/components/page-content-focus-notifications/back-to-page-notification.js.map +0 -1
- package/build/components/page-content-focus-notifications/edit-template-notification.js +0 -102
- package/build/components/page-content-focus-notifications/edit-template-notification.js.map +0 -1
- package/build/components/page-content-focus-notifications/index.js +0 -22
- package/build/components/page-content-focus-notifications/index.js.map +0 -1
- package/build/components/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 -316
- 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/page-panels/edit-template.js +0 -101
- package/build/components/sidebar-edit-mode/page-panels/edit-template.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/hooks.js +0 -79
- package/build/components/sidebar-edit-mode/page-panels/hooks.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/reset-default-template.js +0 -48
- package/build/components/sidebar-edit-mode/page-panels/reset-default-template.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/swap-template-button.js +0 -84
- package/build/components/sidebar-edit-mode/page-panels/swap-template-button.js.map +0 -1
- package/build/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/utils/use-debounced-input.js +0 -22
- package/build/utils/use-debounced-input.js.map +0 -1
- package/build-module/components/dataviews/add-filter.js +0 -84
- package/build-module/components/dataviews/add-filter.js.map +0 -1
- package/build-module/components/dataviews/constants.js +0 -6
- package/build-module/components/dataviews/constants.js.map +0 -1
- package/build-module/components/dataviews/dataviews.js +0 -90
- package/build-module/components/dataviews/dataviews.js.map +0 -1
- package/build-module/components/dataviews/filter-summary.js +0 -55
- package/build-module/components/dataviews/filter-summary.js.map +0 -1
- package/build-module/components/dataviews/filters.js +0 -55
- package/build-module/components/dataviews/filters.js.map +0 -1
- package/build-module/components/dataviews/index.js +0 -2
- package/build-module/components/dataviews/index.js.map +0 -1
- package/build-module/components/dataviews/item-actions.js +0 -177
- package/build-module/components/dataviews/item-actions.js.map +0 -1
- package/build-module/components/dataviews/pagination.js +0 -115
- package/build-module/components/dataviews/pagination.js.map +0 -1
- package/build-module/components/dataviews/reset-filters.js +0 -26
- package/build-module/components/dataviews/reset-filters.js.map +0 -1
- package/build-module/components/dataviews/search.js +0 -43
- package/build-module/components/dataviews/search.js.map +0 -1
- package/build-module/components/dataviews/view-actions.js +0 -237
- package/build-module/components/dataviews/view-actions.js.map +0 -1
- package/build-module/components/dataviews/view-grid.js +0 -74
- package/build-module/components/dataviews/view-grid.js.map +0 -1
- package/build-module/components/dataviews/view-list.js +0 -390
- package/build-module/components/dataviews/view-list.js.map +0 -1
- package/build-module/components/dataviews/view-side-by-side.js +0 -12
- package/build-module/components/dataviews/view-side-by-side.js.map +0 -1
- package/build-module/components/global-styles/font-library-modal/tab-layout.js.map +0 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +0 -164
- package/build-module/components/header-edit-mode/document-actions/index.js.map +0 -1
- package/build-module/components/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-content-focus-notifications/back-to-page-notification.js +0 -54
- package/build-module/components/page-content-focus-notifications/back-to-page-notification.js.map +0 -1
- package/build-module/components/page-content-focus-notifications/edit-template-notification.js +0 -96
- package/build-module/components/page-content-focus-notifications/edit-template-notification.js.map +0 -1
- package/build-module/components/page-content-focus-notifications/index.js +0 -14
- package/build-module/components/page-content-focus-notifications/index.js.map +0 -1
- package/build-module/components/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 -308
- 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/page-panels/edit-template.js +0 -93
- package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/hooks.js +0 -69
- package/build-module/components/sidebar-edit-mode/page-panels/hooks.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/reset-default-template.js +0 -41
- package/build-module/components/sidebar-edit-mode/page-panels/reset-default-template.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/swap-template-button.js +0 -77
- package/build-module/components/sidebar-edit-mode/page-panels/swap-template-button.js.map +0 -1
- package/build-module/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/build-module/utils/use-debounced-input.js +0 -15
- package/build-module/utils/use-debounced-input.js.map +0 -1
- package/src/components/dataviews/README.md +0 -191
- package/src/components/dataviews/add-filter.js +0 -108
- package/src/components/dataviews/constants.js +0 -5
- package/src/components/dataviews/dataviews.js +0 -99
- package/src/components/dataviews/filter-summary.js +0 -79
- package/src/components/dataviews/filters.js +0 -65
- package/src/components/dataviews/index.js +0 -1
- package/src/components/dataviews/item-actions.js +0 -208
- package/src/components/dataviews/pagination.js +0 -144
- package/src/components/dataviews/reset-filters.js +0 -26
- package/src/components/dataviews/search.js +0 -42
- package/src/components/dataviews/style.scss +0 -131
- package/src/components/dataviews/view-actions.js +0 -319
- package/src/components/dataviews/view-grid.js +0 -90
- package/src/components/dataviews/view-list.js +0 -512
- package/src/components/dataviews/view-side-by-side.js +0 -9
- package/src/components/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/header-edit-mode/document-actions/index.js +0 -204
- package/src/components/header-edit-mode/document-actions/style.scss +0 -145
- 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-content-focus-notifications/back-to-page-notification.js +0 -58
- package/src/components/page-content-focus-notifications/edit-template-notification.js +0 -104
- package/src/components/page-content-focus-notifications/index.js +0 -14
- package/src/components/page-pages/side-editor.js +0 -14
- package/src/components/page-templates/dataviews-templates.js +0 -345
- 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/page-panels/edit-template.js +0 -108
- package/src/components/sidebar-edit-mode/page-panels/hooks.js +0 -99
- package/src/components/sidebar-edit-mode/page-panels/reset-default-template.js +0 -45
- package/src/components/sidebar-edit-mode/page-panels/swap-template-button.js +0 -83
- package/src/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
- package/src/utils/use-debounced-input.js +0 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","useSelect","useDispatch","Notice","useInstanceId","store","preferencesStore","BlockBreadcrumb","blockEditorStore","privateApis","blockEditorPrivateApis","BlockInspector","InterfaceSkeleton","ComplementaryArea","interfaceStore","EditorNotices","EditorSnackbars","editorPrivateApis","editorStore","__","sprintf","coreDataStore","useEffect","SidebarComplementaryAreaFills","SidebarInspectorFill","CodeEditor","KeyboardShortcutsEditMode","InserterSidebar","ListViewSidebar","WelcomeGuide","StartTemplateOptions","editSiteStore","GlobalStylesRenderer","useTitle","CanvasLoader","unlock","useEditedEntityRecord","SidebarFixedBottomSlot","PatternModal","POST_TYPE_LABELS","TEMPLATE_POST_TYPE","SiteEditorCanvas","TemplatePartConverter","useSpecificEditorSettings","BlockRemovalWarningModal","ExperimentalEditorProvider","EditorProvider","interfaceLabels","body","sidebar","actions","footer","blockRemovalRules","Editor","listViewToggleElement","isLoading","record","editedPost","getTitle","isLoaded","hasLoadedPost","type","editedPostType","context","contextPost","editorMode","canvasMode","renderingMode","blockEditorMode","isRightSidebarOpen","isInserterOpen","isListViewOpen","showIconLabels","showBlockBreadcrumbs","select","getEditedPostContext","getEditorMode","getCanvasMode","isInserterOpened","isListViewOpened","__unstableGetEditorMode","getActiveComplementaryArea","getEntityRecord","getRenderingMode","_context","postId","postType","undefined","name","get","setRenderingMode","isViewMode","isEditMode","showVisualEditor","shouldShowBlockBreadcrumbs","shouldShowInserter","shouldShowListView","secondarySidebarLabel","postWithTemplate","title","_POST_TYPE_LABELS$edi","loadingProgressId","settings","isReady","createElement","Fragment","id","status","isDismissible","post","__unstableTemplate","useSubRegistry","isDistractionFree","enableRegionNavigation","className","notices","content","rules","secondarySidebar","Slot","scope","rootLabelText","labels"],"sources":["@wordpress/edit-site/src/components/editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Notice } from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tBlockBreadcrumb,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n\tBlockInspector,\n} from '@wordpress/block-editor';\nimport {\n\tInterfaceSkeleton,\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport {\n\tEditorNotices,\n\tEditorSnackbars,\n\tprivateApis as editorPrivateApis,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tSidebarComplementaryAreaFills,\n\tSidebarInspectorFill,\n} from '../sidebar-edit-mode';\nimport CodeEditor from '../code-editor';\nimport KeyboardShortcutsEditMode from '../keyboard-shortcuts/edit-mode';\nimport InserterSidebar from '../secondary-sidebar/inserter-sidebar';\nimport ListViewSidebar from '../secondary-sidebar/list-view-sidebar';\nimport WelcomeGuide from '../welcome-guide';\nimport StartTemplateOptions from '../start-template-options';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesRenderer } from '../global-styles-renderer';\nimport useTitle from '../routes/use-title';\nimport CanvasLoader from '../canvas-loader';\nimport { unlock } from '../../lock-unlock';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport { SidebarFixedBottomSlot } from '../sidebar-edit-mode/sidebar-fixed-bottom';\nimport PatternModal from '../pattern-modal';\nimport { POST_TYPE_LABELS, TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport SiteEditorCanvas from '../block-editor/site-editor-canvas';\nimport TemplatePartConverter from '../template-part-converter';\nimport { useSpecificEditorSettings } from '../block-editor/use-site-editor-settings';\n\nconst { BlockRemovalWarningModal } = unlock( blockEditorPrivateApis );\nconst { ExperimentalEditorProvider: EditorProvider } =\n\tunlock( editorPrivateApis );\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the editor content landmark region. */\n\tbody: __( 'Editor content' ),\n\t/* translators: accessibility text for the editor settings landmark region. */\n\tsidebar: __( 'Editor settings' ),\n\t/* translators: accessibility text for the editor publish landmark region. */\n\tactions: __( 'Editor publish' ),\n\t/* translators: accessibility text for the editor footer landmark region. */\n\tfooter: __( 'Editor footer' ),\n};\n\n// Prevent accidental removal of certain blocks, asking the user for\n// confirmation.\nconst blockRemovalRules = {\n\t'core/query': __( 'Query Loop displays a list of posts or pages.' ),\n\t'core/post-content': __(\n\t\t'Post Content displays the content of a post or page.'\n\t),\n\t'core/post-template': __(\n\t\t'Post Template displays each post or page in a Query Loop.'\n\t),\n};\n\nexport default function Editor( { listViewToggleElement, isLoading } ) {\n\tconst {\n\t\trecord: editedPost,\n\t\tgetTitle,\n\t\tisLoaded: hasLoadedPost,\n\t} = useEditedEntityRecord();\n\n\tconst { type: editedPostType } = editedPost;\n\n\tconst {\n\t\tcontext,\n\t\tcontextPost,\n\t\teditorMode,\n\t\tcanvasMode,\n\t\trenderingMode,\n\t\tblockEditorMode,\n\t\tisRightSidebarOpen,\n\t\tisInserterOpen,\n\t\tisListViewOpen,\n\t\tshowIconLabels,\n\t\tshowBlockBreadcrumbs,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetEditedPostContext,\n\t\t\tgetEditorMode,\n\t\t\tgetCanvasMode,\n\t\t\tisInserterOpened,\n\t\t\tisListViewOpened,\n\t\t} = unlock( select( editSiteStore ) );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\t\tconst { getEntityRecord } = select( coreDataStore );\n\t\tconst { getRenderingMode } = select( editorStore );\n\t\tconst _context = getEditedPostContext();\n\n\t\t// The currently selected entity to display.\n\t\t// Typically template or template part in the site editor.\n\t\treturn {\n\t\t\tcontext: _context,\n\t\t\tcontextPost: _context?.postId\n\t\t\t\t? getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t_context.postType,\n\t\t\t\t\t\t_context.postId\n\t\t\t\t )\n\t\t\t\t: undefined,\n\t\t\teditorMode: getEditorMode(),\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t\trenderingMode: getRenderingMode(),\n\t\t\tblockEditorMode: __unstableGetEditorMode(),\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tisRightSidebarOpen: getActiveComplementaryArea(\n\t\t\t\teditSiteStore.name\n\t\t\t),\n\t\t\tshowIconLabels: select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t\tshowBlockBreadcrumbs: select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showBlockBreadcrumbs'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst { setRenderingMode } = useDispatch( editorStore );\n\n\tconst isViewMode = canvasMode === 'view';\n\tconst isEditMode = canvasMode === 'edit';\n\tconst showVisualEditor = isViewMode || editorMode === 'visual';\n\tconst shouldShowBlockBreadcrumbs =\n\t\tshowBlockBreadcrumbs &&\n\t\tisEditMode &&\n\t\tshowVisualEditor &&\n\t\tblockEditorMode !== 'zoom-out';\n\tconst shouldShowInserter = isEditMode && showVisualEditor && isInserterOpen;\n\tconst shouldShowListView = isEditMode && showVisualEditor && isListViewOpen;\n\tconst secondarySidebarLabel = isListViewOpen\n\t\t? __( 'List View' )\n\t\t: __( 'Block Library' );\n\tconst postWithTemplate = !! context?.postId;\n\n\tlet title;\n\tif ( hasLoadedPost ) {\n\t\ttitle = sprintf(\n\t\t\t// translators: A breadcrumb trail in browser tab. %1$s: title of template being edited, %2$s: type of template (Template or Template Part).\n\t\t\t__( '%1$s ‹ %2$s ‹ Editor' ),\n\t\t\tgetTitle(),\n\t\t\tPOST_TYPE_LABELS[ editedPostType ] ??\n\t\t\t\tPOST_TYPE_LABELS[ TEMPLATE_POST_TYPE ]\n\t\t);\n\t}\n\n\t// Only announce the title once the editor is ready to prevent \"Replace\"\n\t// action in <URLQueryController> from double-announcing.\n\tuseTitle( hasLoadedPost && title );\n\n\tconst loadingProgressId = useInstanceId(\n\t\tCanvasLoader,\n\t\t'edit-site-editor__loading-progress'\n\t);\n\n\tconst settings = useSpecificEditorSettings();\n\tconst isReady =\n\t\t! isLoading &&\n\t\t( ( postWithTemplate && !! contextPost && !! editedPost ) ||\n\t\t\t( ! postWithTemplate && !! editedPost ) );\n\n\t// This is the only reliable way I've found to reinitialize the rendering mode\n\t// when the canvas mode or the edited entity changes.\n\tuseEffect( () => {\n\t\tif ( canvasMode === 'edit' && postWithTemplate ) {\n\t\t\tsetRenderingMode( 'template-locked' );\n\t\t} else {\n\t\t\tsetRenderingMode( 'all' );\n\t\t}\n\t}, [ canvasMode, postWithTemplate, setRenderingMode ] );\n\n\treturn (\n\t\t<>\n\t\t\t{ ! isReady ? <CanvasLoader id={ loadingProgressId } /> : null }\n\t\t\t{ isEditMode && <WelcomeGuide /> }\n\t\t\t{ hasLoadedPost && ! editedPost && (\n\t\t\t\t<Notice status=\"warning\" isDismissible={ false }>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t\"You attempted to edit an item that doesn't exist. Perhaps it was deleted?\"\n\t\t\t\t\t) }\n\t\t\t\t</Notice>\n\t\t\t) }\n\t\t\t{ isReady && (\n\t\t\t\t<EditorProvider\n\t\t\t\t\tpost={ postWithTemplate ? contextPost : editedPost }\n\t\t\t\t\t__unstableTemplate={\n\t\t\t\t\t\tpostWithTemplate ? editedPost : undefined\n\t\t\t\t\t}\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t>\n\t\t\t\t\t<SidebarComplementaryAreaFills />\n\t\t\t\t\t{ isEditMode && <StartTemplateOptions /> }\n\t\t\t\t\t<InterfaceSkeleton\n\t\t\t\t\t\tisDistractionFree={ true }\n\t\t\t\t\t\tenableRegionNavigation={ false }\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'edit-site-editor__interface-skeleton',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'show-icon-labels': showIconLabels,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tnotices={ <EditorSnackbars /> }\n\t\t\t\t\t\tcontent={\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<GlobalStylesRenderer />\n\t\t\t\t\t\t\t\t{ isEditMode && <EditorNotices /> }\n\t\t\t\t\t\t\t\t{ showVisualEditor && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<TemplatePartConverter />\n\t\t\t\t\t\t\t\t\t\t<SidebarInspectorFill>\n\t\t\t\t\t\t\t\t\t\t\t<BlockInspector />\n\t\t\t\t\t\t\t\t\t\t</SidebarInspectorFill>\n\t\t\t\t\t\t\t\t\t\t<SiteEditorCanvas />\n\t\t\t\t\t\t\t\t\t\t<BlockRemovalWarningModal\n\t\t\t\t\t\t\t\t\t\t\trules={ blockRemovalRules }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<PatternModal />\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ editorMode === 'text' && isEditMode && (\n\t\t\t\t\t\t\t\t\t<CodeEditor />\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ isEditMode && <KeyboardShortcutsEditMode /> }\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsecondarySidebar={\n\t\t\t\t\t\t\tisEditMode &&\n\t\t\t\t\t\t\t( ( shouldShowInserter && <InserterSidebar /> ) ||\n\t\t\t\t\t\t\t\t( shouldShowListView && (\n\t\t\t\t\t\t\t\t\t<ListViewSidebar\n\t\t\t\t\t\t\t\t\t\tlistViewToggleElement={\n\t\t\t\t\t\t\t\t\t\t\tlistViewToggleElement\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) ) )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsidebar={\n\t\t\t\t\t\t\tisEditMode &&\n\t\t\t\t\t\t\tisRightSidebarOpen && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-site\" />\n\t\t\t\t\t\t\t\t\t<SidebarFixedBottomSlot />\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfooter={\n\t\t\t\t\t\t\tshouldShowBlockBreadcrumbs && (\n\t\t\t\t\t\t\t\t<BlockBreadcrumb\n\t\t\t\t\t\t\t\t\trootLabelText={\n\t\t\t\t\t\t\t\t\t\tpostWithTemplate &&\n\t\t\t\t\t\t\t\t\t\trenderingMode !== 'template-only'\n\t\t\t\t\t\t\t\t\t\t\t? __( 'Page' )\n\t\t\t\t\t\t\t\t\t\t\t: __( 'Template' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlabels={ {\n\t\t\t\t\t\t\t...interfaceLabels,\n\t\t\t\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</EditorProvider>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;AAClE,SACCC,eAAe,EACfF,KAAK,IAAIG,gBAAgB,EACzBC,WAAW,IAAIC,sBAAsB,EACrCC,cAAc,QACR,yBAAyB;AAChC,SACCC,iBAAiB,EACjBC,iBAAiB,EACjBR,KAAK,IAAIS,cAAc,QACjB,sBAAsB;AAC7B,SACCC,aAAa,EACbC,eAAe,EACfP,WAAW,IAAIQ,iBAAiB,EAChCZ,KAAK,IAAIa,WAAW,QACd,mBAAmB;AAC1B,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASf,KAAK,IAAIgB,aAAa,QAAQ,sBAAsB;AAC7D,SAASC,SAAS,QAAQ,oBAAoB;;AAE9C;AACA;AACA;AACA,SACCC,6BAA6B,EAC7BC,oBAAoB,QACd,sBAAsB;AAC7B,OAAOC,UAAU,MAAM,gBAAgB;AACvC,OAAO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sBAAsB,MAAE,CACxB,CAEH;IACDc,MAAM,EACL2C,0BAA0B,IACzBU,aAAA,CAACjG,eAAe;MACfkH,aAAa,EACZvB,gBAAgB,IAChB/B,aAAa,KAAK,eAAe,GAC9BhD,EAAE,CAAE,MAAO,CAAC,GACZA,EAAE,CAAE,UAAW;IAClB,CACD,CAEF;IACDuG,MAAM,EAAG;MACR,GAAG3E,eAAe;MAClBuE,gBAAgB,EAAErB;IACnB;EAAG,CACH,CACc,CAEhB,CAAC;AAEL"}
|
|
1
|
+
{"version":3,"names":["classnames","useSelect","Notice","useInstanceId","useViewportMatch","store","preferencesStore","BlockBreadcrumb","BlockToolbar","blockEditorStore","privateApis","blockEditorPrivateApis","BlockInspector","InterfaceSkeleton","ComplementaryArea","interfaceStore","EditorKeyboardShortcutsRegister","EditorKeyboardShortcuts","EditorNotices","EditorSnackbars","editorPrivateApis","editorStore","__","sprintf","coreDataStore","SidebarComplementaryAreaFills","SidebarInspectorFill","CodeEditor","KeyboardShortcutsEditMode","WelcomeGuide","StartTemplateOptions","editSiteStore","GlobalStylesRenderer","useTitle","CanvasLoader","unlock","useEditedEntityRecord","PatternModal","POST_TYPE_LABELS","TEMPLATE_POST_TYPE","SiteEditorCanvas","TemplatePartConverter","useSpecificEditorSettings","BlockRemovalWarningModal","ExperimentalEditorProvider","EditorProvider","InserterSidebar","ListViewSidebar","interfaceLabels","body","sidebar","actions","footer","blockRemovalRules","Editor","isLoading","record","editedPost","getTitle","isLoaded","hasLoadedPost","type","editedPostType","isLargeViewport","context","contextPost","editorMode","canvasMode","renderingMode","blockEditorMode","isRightSidebarOpen","isInserterOpen","isListViewOpen","showIconLabels","showBlockBreadcrumbs","select","get","getEditedPostContext","getEditorMode","getCanvasMode","__unstableGetEditorMode","getActiveComplementaryArea","getEntityRecord","getRenderingMode","isInserterOpened","isListViewOpened","_context","postId","postType","undefined","name","isViewMode","isEditMode","showVisualEditor","shouldShowBlockBreadcrumbs","shouldShowInserter","shouldShowListView","secondarySidebarLabel","postWithTemplate","title","_POST_TYPE_LABELS$edi","loadingProgressId","settings","isReady","createElement","Fragment","id","status","isDismissible","post","__unstableTemplate","useSubRegistry","isDistractionFree","enableRegionNavigation","className","notices","content","hideDragHandle","rules","secondarySidebar","Slot","scope","rootLabelText","labels"],"sources":["@wordpress/edit-site/src/components/editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { Notice } from '@wordpress/components';\nimport { useInstanceId, useViewportMatch } from '@wordpress/compose';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tBlockBreadcrumb,\n\tBlockToolbar,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n\tBlockInspector,\n} from '@wordpress/block-editor';\nimport {\n\tInterfaceSkeleton,\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport {\n\tEditorKeyboardShortcutsRegister,\n\tEditorKeyboardShortcuts,\n\tEditorNotices,\n\tEditorSnackbars,\n\tprivateApis as editorPrivateApis,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreDataStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tSidebarComplementaryAreaFills,\n\tSidebarInspectorFill,\n} from '../sidebar-edit-mode';\nimport CodeEditor from '../code-editor';\nimport KeyboardShortcutsEditMode from '../keyboard-shortcuts/edit-mode';\nimport WelcomeGuide from '../welcome-guide';\nimport StartTemplateOptions from '../start-template-options';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesRenderer } from '../global-styles-renderer';\nimport useTitle from '../routes/use-title';\nimport CanvasLoader from '../canvas-loader';\nimport { unlock } from '../../lock-unlock';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport PatternModal from '../pattern-modal';\nimport { POST_TYPE_LABELS, TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport SiteEditorCanvas from '../block-editor/site-editor-canvas';\nimport TemplatePartConverter from '../template-part-converter';\nimport { useSpecificEditorSettings } from '../block-editor/use-site-editor-settings';\n\nconst { BlockRemovalWarningModal } = unlock( blockEditorPrivateApis );\nconst {\n\tExperimentalEditorProvider: EditorProvider,\n\tInserterSidebar,\n\tListViewSidebar,\n} = unlock( editorPrivateApis );\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the editor content landmark region. */\n\tbody: __( 'Editor content' ),\n\t/* translators: accessibility text for the editor settings landmark region. */\n\tsidebar: __( 'Editor settings' ),\n\t/* translators: accessibility text for the editor publish landmark region. */\n\tactions: __( 'Editor publish' ),\n\t/* translators: accessibility text for the editor footer landmark region. */\n\tfooter: __( 'Editor footer' ),\n};\n\n// Prevent accidental removal of certain blocks, asking the user for\n// confirmation.\nconst blockRemovalRules = {\n\t'core/query': __( 'Query Loop displays a list of posts or pages.' ),\n\t'core/post-content': __(\n\t\t'Post Content displays the content of a post or page.'\n\t),\n\t'core/post-template': __(\n\t\t'Post Template displays each post or page in a Query Loop.'\n\t),\n};\n\nexport default function Editor( { isLoading } ) {\n\tconst {\n\t\trecord: editedPost,\n\t\tgetTitle,\n\t\tisLoaded: hasLoadedPost,\n\t} = useEditedEntityRecord();\n\n\tconst { type: editedPostType } = editedPost;\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\n\tconst {\n\t\tcontext,\n\t\tcontextPost,\n\t\teditorMode,\n\t\tcanvasMode,\n\t\trenderingMode,\n\t\tblockEditorMode,\n\t\tisRightSidebarOpen,\n\t\tisInserterOpen,\n\t\tisListViewOpen,\n\t\tshowIconLabels,\n\t\tshowBlockBreadcrumbs,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { getEditedPostContext, getEditorMode, getCanvasMode } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\t\tconst { getEntityRecord } = select( coreDataStore );\n\t\tconst { getRenderingMode, isInserterOpened, isListViewOpened } =\n\t\t\tselect( editorStore );\n\t\tconst _context = getEditedPostContext();\n\n\t\t// The currently selected entity to display.\n\t\t// Typically template or template part in the site editor.\n\t\treturn {\n\t\t\tcontext: _context,\n\t\t\tcontextPost: _context?.postId\n\t\t\t\t? getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t_context.postType,\n\t\t\t\t\t\t_context.postId\n\t\t\t\t )\n\t\t\t\t: undefined,\n\t\t\teditorMode: getEditorMode(),\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t\trenderingMode: getRenderingMode(),\n\t\t\tblockEditorMode: __unstableGetEditorMode(),\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tisRightSidebarOpen: getActiveComplementaryArea(\n\t\t\t\teditSiteStore.name\n\t\t\t),\n\t\t\tshowBlockBreadcrumbs: get( 'core', 'showBlockBreadcrumbs' ),\n\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t};\n\t}, [] );\n\n\tconst isViewMode = canvasMode === 'view';\n\tconst isEditMode = canvasMode === 'edit';\n\tconst showVisualEditor = isViewMode || editorMode === 'visual';\n\tconst shouldShowBlockBreadcrumbs =\n\t\tshowBlockBreadcrumbs &&\n\t\tisEditMode &&\n\t\tshowVisualEditor &&\n\t\tblockEditorMode !== 'zoom-out';\n\tconst shouldShowInserter = isEditMode && showVisualEditor && isInserterOpen;\n\tconst shouldShowListView = isEditMode && showVisualEditor && isListViewOpen;\n\tconst secondarySidebarLabel = isListViewOpen\n\t\t? __( 'List View' )\n\t\t: __( 'Block Library' );\n\tconst postWithTemplate = !! context?.postId;\n\n\tlet title;\n\tif ( hasLoadedPost ) {\n\t\ttitle = sprintf(\n\t\t\t// translators: A breadcrumb trail for the Admin document title. %1$s: title of template being edited, %2$s: type of template (Template or Template Part).\n\t\t\t__( '%1$s ‹ %2$s' ),\n\t\t\tgetTitle(),\n\t\t\tPOST_TYPE_LABELS[ editedPostType ] ??\n\t\t\t\tPOST_TYPE_LABELS[ TEMPLATE_POST_TYPE ]\n\t\t);\n\t}\n\n\t// Only announce the title once the editor is ready to prevent \"Replace\"\n\t// action in <URLQueryController> from double-announcing.\n\tuseTitle( hasLoadedPost && title );\n\n\tconst loadingProgressId = useInstanceId(\n\t\tCanvasLoader,\n\t\t'edit-site-editor__loading-progress'\n\t);\n\n\tconst settings = useSpecificEditorSettings();\n\tconst isReady =\n\t\t! isLoading &&\n\t\t( ( postWithTemplate && !! contextPost && !! editedPost ) ||\n\t\t\t( ! postWithTemplate && !! editedPost ) );\n\n\treturn (\n\t\t<>\n\t\t\t{ ! isReady ? <CanvasLoader id={ loadingProgressId } /> : null }\n\t\t\t{ isEditMode && <WelcomeGuide /> }\n\t\t\t{ hasLoadedPost && ! editedPost && (\n\t\t\t\t<Notice status=\"warning\" isDismissible={ false }>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t\"You attempted to edit an item that doesn't exist. Perhaps it was deleted?\"\n\t\t\t\t\t) }\n\t\t\t\t</Notice>\n\t\t\t) }\n\t\t\t{ isReady && (\n\t\t\t\t<EditorProvider\n\t\t\t\t\tpost={ postWithTemplate ? contextPost : editedPost }\n\t\t\t\t\t__unstableTemplate={\n\t\t\t\t\t\tpostWithTemplate ? editedPost : undefined\n\t\t\t\t\t}\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t>\n\t\t\t\t\t<SidebarComplementaryAreaFills />\n\t\t\t\t\t{ isEditMode && <StartTemplateOptions /> }\n\t\t\t\t\t<InterfaceSkeleton\n\t\t\t\t\t\tisDistractionFree={ true }\n\t\t\t\t\t\tenableRegionNavigation={ false }\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'edit-site-editor__interface-skeleton',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'show-icon-labels': showIconLabels,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tnotices={ <EditorSnackbars /> }\n\t\t\t\t\t\tcontent={\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<GlobalStylesRenderer />\n\t\t\t\t\t\t\t\t{ isEditMode && <EditorNotices /> }\n\t\t\t\t\t\t\t\t{ showVisualEditor && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<TemplatePartConverter />\n\t\t\t\t\t\t\t\t\t\t<SidebarInspectorFill>\n\t\t\t\t\t\t\t\t\t\t\t<BlockInspector />\n\t\t\t\t\t\t\t\t\t\t</SidebarInspectorFill>\n\t\t\t\t\t\t\t\t\t\t{ ! isLargeViewport && (\n\t\t\t\t\t\t\t\t\t\t\t<BlockToolbar hideDragHandle />\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t<SiteEditorCanvas />\n\t\t\t\t\t\t\t\t\t\t<BlockRemovalWarningModal\n\t\t\t\t\t\t\t\t\t\t\trules={ blockRemovalRules }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<PatternModal />\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ editorMode === 'text' && isEditMode && (\n\t\t\t\t\t\t\t\t\t<CodeEditor />\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ isEditMode && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<KeyboardShortcutsEditMode />\n\t\t\t\t\t\t\t\t\t\t<EditorKeyboardShortcutsRegister />\n\t\t\t\t\t\t\t\t\t\t<EditorKeyboardShortcuts />\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsecondarySidebar={\n\t\t\t\t\t\t\tisEditMode &&\n\t\t\t\t\t\t\t( ( shouldShowInserter && <InserterSidebar /> ) ||\n\t\t\t\t\t\t\t\t( shouldShowListView && <ListViewSidebar /> ) )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsidebar={\n\t\t\t\t\t\t\tisEditMode &&\n\t\t\t\t\t\t\tisRightSidebarOpen && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-site\" />\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfooter={\n\t\t\t\t\t\t\tshouldShowBlockBreadcrumbs && (\n\t\t\t\t\t\t\t\t<BlockBreadcrumb\n\t\t\t\t\t\t\t\t\trootLabelText={\n\t\t\t\t\t\t\t\t\t\tpostWithTemplate &&\n\t\t\t\t\t\t\t\t\t\trenderingMode !== 'template-only'\n\t\t\t\t\t\t\t\t\t\t\t? __( 'Page' )\n\t\t\t\t\t\t\t\t\t\t\t: __( 'Template' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlabels={ {\n\t\t\t\t\t\t\t...interfaceLabels,\n\t\t\t\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</EditorProvider>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,aAAa,EAAEC,gBAAgB,QAAQ,oBAAoB;AACpE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;AAClE,SACCC,eAAe,EACfC,YAAY,EACZH,KAAK,IAAII,gBAAgB,EACzBC,WAAW,IAA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CAAC1D,eAAe,MAAE,CAAC,IAC1CkD,kBAAkB,IAAIQ,aAAA,CAACzD,eAAe,MAAE,CAAG,CAC9C;IACDG,OAAO,EACN0C,UAAU,IACVtB,kBAAkB,IACjBkC,aAAA,CAAAC,QAAA,QACCD,aAAA,CAAC1F,iBAAiB,CAAC0G,IAAI;MAACC,KAAK,EAAC;IAAgB,CAAE,CAC/C,CAEH;IACDrE,MAAM,EACL0C,0BAA0B,IACzBU,aAAA,CAACjG,eAAe;MACfmH,aAAa,EACZxB,gBAAgB,IAChB9B,aAAa,KAAK,eAAe,GAC9B9C,EAAE,CAAE,MAAO,CAAC,GACZA,EAAE,CAAE,UAAW;IAClB,CACD,CAEF;IACDqG,MAAM,EAAG;MACR,GAAG3E,eAAe;MAClBuE,gBAAgB,EAAEtB;IACnB;EAAG,CACH,CACc,CAEhB,CAAC;AAEL"}
|
|
@@ -10,6 +10,7 @@ import { useDispatch, useSelect } from '@wordpress/data';
|
|
|
10
10
|
import { closeSmall } from '@wordpress/icons';
|
|
11
11
|
import { useFocusOnMount, useFocusReturn } from '@wordpress/compose';
|
|
12
12
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
13
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Internal dependencies
|
|
@@ -30,6 +31,7 @@ function getEditorCanvasContainerTitle(view) {
|
|
|
30
31
|
case 'style-book':
|
|
31
32
|
return __('Style Book');
|
|
32
33
|
case 'global-styles-revisions':
|
|
34
|
+
case 'global-styles-revisions:style-book':
|
|
33
35
|
return __('Global styles revisions');
|
|
34
36
|
default:
|
|
35
37
|
return '';
|
|
@@ -57,7 +59,7 @@ function EditorCanvasContainer({
|
|
|
57
59
|
showListViewByDefault
|
|
58
60
|
} = useSelect(select => {
|
|
59
61
|
const _editorCanvasContainerView = unlock(select(editSiteStore)).getEditorCanvasContainerView();
|
|
60
|
-
const _showListViewByDefault = select(preferencesStore).get('core
|
|
62
|
+
const _showListViewByDefault = select(preferencesStore).get('core', 'showListViewByDefault');
|
|
61
63
|
return {
|
|
62
64
|
editorCanvasContainerView: _editorCanvasContainerView,
|
|
63
65
|
showListViewByDefault: _showListViewByDefault
|
|
@@ -67,19 +69,19 @@ function EditorCanvasContainer({
|
|
|
67
69
|
const {
|
|
68
70
|
setEditorCanvasContainerView
|
|
69
71
|
} = unlock(useDispatch(editSiteStore));
|
|
72
|
+
const {
|
|
73
|
+
setIsListViewOpened
|
|
74
|
+
} = useDispatch(editorStore);
|
|
70
75
|
const focusOnMountRef = useFocusOnMount('firstElement');
|
|
71
76
|
const sectionFocusReturnRef = useFocusReturn();
|
|
72
77
|
const title = useMemo(() => getEditorCanvasContainerTitle(editorCanvasContainerView), [editorCanvasContainerView]);
|
|
73
|
-
const {
|
|
74
|
-
setIsListViewOpened
|
|
75
|
-
} = useDispatch(editSiteStore);
|
|
76
78
|
function onCloseContainer() {
|
|
77
|
-
if (typeof onClose === 'function') {
|
|
78
|
-
onClose();
|
|
79
|
-
}
|
|
80
79
|
setIsListViewOpened(showListViewByDefault);
|
|
81
80
|
setEditorCanvasContainerView(undefined);
|
|
82
81
|
setIsClosed(true);
|
|
82
|
+
if (typeof onClose === 'function') {
|
|
83
|
+
onClose();
|
|
84
|
+
}
|
|
83
85
|
}
|
|
84
86
|
function closeOnEscape(event) {
|
|
85
87
|
if (event.keyCode === ESCAPE && !event.defaultPrevented) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Children","cloneElement","useState","useMemo","Button","privateApis","componentsPrivateApis","__experimentalUseSlotFills","useSlotFills","ESCAPE","__","useDispatch","useSelect","closeSmall","useFocusOnMount","useFocusReturn","store","preferencesStore","unlock","editSiteStore","ResizableEditor","getEditorCanvasContainerTitle","view","createPrivateSlotFill","SLOT_FILL_NAME","privateKey","Slot","EditorCanvasContainerSlot","Fill","EditorCanvasContainerFill","EditorCanvasContainer","children","closeButtonLabel","onClose","enableResizing","editorCanvasContainerView","showListViewByDefault","select","_editorCanvasContainerView","getEditorCanvasContainerView","_showListViewByDefault","get","isClosed","setIsClosed","setEditorCanvasContainerView","focusOnMountRef","sectionFocusReturnRef","title","
|
|
1
|
+
{"version":3,"names":["Children","cloneElement","useState","useMemo","Button","privateApis","componentsPrivateApis","__experimentalUseSlotFills","useSlotFills","ESCAPE","__","useDispatch","useSelect","closeSmall","useFocusOnMount","useFocusReturn","store","preferencesStore","editorStore","unlock","editSiteStore","ResizableEditor","getEditorCanvasContainerTitle","view","createPrivateSlotFill","SLOT_FILL_NAME","privateKey","Slot","EditorCanvasContainerSlot","Fill","EditorCanvasContainerFill","EditorCanvasContainer","children","closeButtonLabel","onClose","enableResizing","editorCanvasContainerView","showListViewByDefault","select","_editorCanvasContainerView","getEditorCanvasContainerView","_showListViewByDefault","get","isClosed","setIsClosed","setEditorCanvasContainerView","setIsListViewOpened","focusOnMountRef","sectionFocusReturnRef","title","onCloseContainer","undefined","closeOnEscape","event","keyCode","defaultPrevented","preventDefault","childrenWithProps","Array","isArray","map","child","index","ref","shouldShowCloseButton","createElement","className","onKeyDown","icon","label","onClick","showTooltip","useHasEditorCanvasContainer","fills","length"],"sources":["@wordpress/edit-site/src/components/editor-canvas-container/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Children, cloneElement, useState, useMemo } from '@wordpress/element';\nimport {\n\tButton,\n\tprivateApis as componentsPrivateApis,\n\t__experimentalUseSlotFills as useSlotFills,\n} from '@wordpress/components';\nimport { ESCAPE } from '@wordpress/keycodes';\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { closeSmall } from '@wordpress/icons';\nimport { useFocusOnMount, useFocusReturn } from '@wordpress/compose';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport ResizableEditor from '../block-editor/resizable-editor';\n\n/**\n * Returns a translated string for the title of the editor canvas container.\n *\n * @param {string} view Editor canvas container view.\n *\n * @return {string} Translated string corresponding to value of view. Default is ''.\n */\nfunction getEditorCanvasContainerTitle( view ) {\n\tswitch ( view ) {\n\t\tcase 'style-book':\n\t\t\treturn __( 'Style Book' );\n\t\tcase 'global-styles-revisions':\n\t\tcase 'global-styles-revisions:style-book':\n\t\t\treturn __( 'Global styles revisions' );\n\t\tdefault:\n\t\t\treturn '';\n\t}\n}\n\n// Creates a private slot fill.\nconst { createPrivateSlotFill } = unlock( componentsPrivateApis );\nconst SLOT_FILL_NAME = 'EditSiteEditorCanvasContainerSlot';\nconst {\n\tprivateKey,\n\tSlot: EditorCanvasContainerSlot,\n\tFill: EditorCanvasContainerFill,\n} = createPrivateSlotFill( SLOT_FILL_NAME );\n\nfunction EditorCanvasContainer( {\n\tchildren,\n\tcloseButtonLabel,\n\tonClose,\n\tenableResizing = false,\n} ) {\n\tconst { editorCanvasContainerView, showListViewByDefault } = useSelect(\n\t\t( select ) => {\n\t\t\tconst _editorCanvasContainerView = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t).getEditorCanvasContainerView();\n\n\t\t\tconst _showListViewByDefault = select( preferencesStore ).get(\n\t\t\t\t'core',\n\t\t\t\t'showListViewByDefault'\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\teditorCanvasContainerView: _editorCanvasContainerView,\n\t\t\t\tshowListViewByDefault: _showListViewByDefault,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst [ isClosed, setIsClosed ] = useState( false );\n\tconst { setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst { setIsListViewOpened } = useDispatch( editorStore );\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\tconst sectionFocusReturnRef = useFocusReturn();\n\tconst title = useMemo(\n\t\t() => getEditorCanvasContainerTitle( editorCanvasContainerView ),\n\t\t[ editorCanvasContainerView ]\n\t);\n\n\tfunction onCloseContainer() {\n\t\tsetIsListViewOpened( showListViewByDefault );\n\t\tsetEditorCanvasContainerView( undefined );\n\t\tsetIsClosed( true );\n\t\tif ( typeof onClose === 'function' ) {\n\t\t\tonClose();\n\t\t}\n\t}\n\n\tfunction closeOnEscape( event ) {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tevent.preventDefault();\n\t\t\tonCloseContainer();\n\t\t}\n\t}\n\n\tconst childrenWithProps = Array.isArray( children )\n\t\t? Children.map( children, ( child, index ) =>\n\t\t\t\tindex === 0\n\t\t\t\t\t? cloneElement( child, {\n\t\t\t\t\t\t\tref: sectionFocusReturnRef,\n\t\t\t\t\t } )\n\t\t\t\t\t: child\n\t\t )\n\t\t: cloneElement( children, {\n\t\t\t\tref: sectionFocusReturnRef,\n\t\t } );\n\n\tif ( isClosed ) {\n\t\treturn null;\n\t}\n\n\tconst shouldShowCloseButton = onClose || closeButtonLabel;\n\n\treturn (\n\t\t<EditorCanvasContainerFill>\n\t\t\t<ResizableEditor enableResizing={ enableResizing }>\n\t\t\t\t{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }\n\t\t\t\t<section\n\t\t\t\t\tclassName=\"edit-site-editor-canvas-container\"\n\t\t\t\t\tref={ shouldShowCloseButton ? focusOnMountRef : null }\n\t\t\t\t\tonKeyDown={ closeOnEscape }\n\t\t\t\t\taria-label={ title }\n\t\t\t\t>\n\t\t\t\t\t{ shouldShowCloseButton && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"edit-site-editor-canvas-container__close-button\"\n\t\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\t\tlabel={ closeButtonLabel || __( 'Close' ) }\n\t\t\t\t\t\t\tonClick={ onCloseContainer }\n\t\t\t\t\t\t\tshowTooltip={ false }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ childrenWithProps }\n\t\t\t\t</section>\n\t\t\t</ResizableEditor>\n\t\t</EditorCanvasContainerFill>\n\t);\n}\nfunction useHasEditorCanvasContainer() {\n\tconst fills = useSlotFills( privateKey );\n\treturn !! fills?.length;\n}\n\nEditorCanvasContainer.Slot = EditorCanvasContainerSlot;\nexport default EditorCanvasContainer;\nexport { useHasEditorCanvasContainer, getEditorCanvasContainerTitle };\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,YAAY,EAAEC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AAC9E,SACCC,MAAM,EACNC,WAAW,IAAIC,qBAAqB,EACpCC,0BAA0B,IAAIC,YAAY,QACpC,uBAAuB;AAC9B,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SAASC,eAAe,EAAEC,cAAc,QAAQ,oBAAoB;AACpE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;AAClE,SAASD,KAAK,IAAIE,WAAW,QAAQ,mBAAmB;;AAExD;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASH,KAAK,IAAII,aAAa,QAAQ,aAAa;AACpD,OAAOC,eAAe,MAAM,kCAAkC;;AAE9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,6BAA6BA,CAAEC,IAAI,EAAG;EAC9C,QAASA,IAAI;IACZ,KAAK,YAAY;MAChB,OAAOb,EAAE,CAAE,YAAa,CAAC;IAC1B,KAAK,yBAAyB;IAC9B,KAAK,oCAAoC;MACxC,OAAOA,EAAE,CAAE,yBAA0B,CAAC;IACvC;MACC,OAAO,EAAE;EACX;AACD;;AAEA;AACA,MAAM;EAAEc;AAAsB,CAAC,GAAGL,MAAM,CAAEb,qBAAsB,CAAC;AACjE,MAAMmB,cAAc,GAAG,mCAAmC;AAC1D,MAAM;EACLC,UAAU;EACVC,IAAI,EAAEC,yBAA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CAAC;EACxC,OAAO,CAAC,CAAE+C,KAAK,EAAEC,MAAM;AACxB;AAEA3C,qBAAqB,CAACJ,IAAI,GAAGC,yBAAyB;AACtD,eAAeG,qBAAqB;AACpC,SAASyC,2BAA2B,EAAElD,6BAA6B"}
|
|
@@ -2,16 +2,14 @@ import { createElement } from "react";
|
|
|
2
2
|
/**
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
5
|
-
import { CheckboxControl, Flex } from '@wordpress/components';
|
|
6
|
-
/**
|
|
7
|
-
* Internal dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { getFontFaceVariantName } from './utils';
|
|
5
|
+
import { CheckboxControl, Flex, privateApis as componentsPrivateApis } from '@wordpress/components';
|
|
10
6
|
|
|
11
7
|
/**
|
|
12
8
|
* Internal dependencies
|
|
13
9
|
*/
|
|
10
|
+
import { getFontFaceVariantName } from './utils';
|
|
14
11
|
import FontFaceDemo from './font-demo';
|
|
12
|
+
import { unlock } from '../../../lock-unlock';
|
|
15
13
|
function CollectionFontVariant({
|
|
16
14
|
face,
|
|
17
15
|
font,
|
|
@@ -26,8 +24,13 @@ function CollectionFontVariant({
|
|
|
26
24
|
handleToggleVariant(font);
|
|
27
25
|
};
|
|
28
26
|
const displayName = font.name + ' ' + getFontFaceVariantName(face);
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
const {
|
|
28
|
+
kebabCase
|
|
29
|
+
} = unlock(componentsPrivateApis);
|
|
30
|
+
const checkboxId = kebabCase(`${font.slug}-${getFontFaceVariantName(face)}`);
|
|
31
|
+
return createElement("label", {
|
|
32
|
+
className: "font-library-modal__library-font-variant",
|
|
33
|
+
htmlFor: checkboxId
|
|
31
34
|
}, createElement(Flex, {
|
|
32
35
|
justify: "space-between",
|
|
33
36
|
align: "center",
|
|
@@ -38,7 +41,9 @@ function CollectionFontVariant({
|
|
|
38
41
|
}), createElement(CheckboxControl, {
|
|
39
42
|
checked: selected,
|
|
40
43
|
onChange: handleToggleActivation,
|
|
41
|
-
__nextHasNoMarginBottom: true
|
|
44
|
+
__nextHasNoMarginBottom: true,
|
|
45
|
+
id: checkboxId,
|
|
46
|
+
label: false
|
|
42
47
|
})));
|
|
43
48
|
}
|
|
44
49
|
export default CollectionFontVariant;
|
package/build-module/components/global-styles/font-library-modal/collection-font-variant.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CheckboxControl","Flex","getFontFaceVariantName","FontFaceDemo","CollectionFontVariant","face","font","handleToggleVariant","selected","handleToggleActivation","fontFace","displayName","name","createElement","className","justify","align","gap","text","checked","onChange","__nextHasNoMarginBottom"],"sources":["@wordpress/edit-site/src/components/global-styles/font-library-modal/collection-font-variant.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {
|
|
1
|
+
{"version":3,"names":["CheckboxControl","Flex","privateApis","componentsPrivateApis","getFontFaceVariantName","FontFaceDemo","unlock","CollectionFontVariant","face","font","handleToggleVariant","selected","handleToggleActivation","fontFace","displayName","name","kebabCase","checkboxId","slug","createElement","className","htmlFor","justify","align","gap","text","checked","onChange","__nextHasNoMarginBottom","id","label"],"sources":["@wordpress/edit-site/src/components/global-styles/font-library-modal/collection-font-variant.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tCheckboxControl,\n\tFlex,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { getFontFaceVariantName } from './utils';\nimport FontFaceDemo from './font-demo';\nimport { unlock } from '../../../lock-unlock';\n\nfunction CollectionFontVariant( {\n\tface,\n\tfont,\n\thandleToggleVariant,\n\tselected,\n} ) {\n\tconst handleToggleActivation = () => {\n\t\tif ( font?.fontFace ) {\n\t\t\thandleToggleVariant( font, face );\n\t\t\treturn;\n\t\t}\n\t\thandleToggleVariant( font );\n\t};\n\n\tconst displayName = font.name + ' ' + getFontFaceVariantName( face );\n\tconst { kebabCase } = unlock( componentsPrivateApis );\n\tconst checkboxId = kebabCase(\n\t\t`${ font.slug }-${ getFontFaceVariantName( face ) }`\n\t);\n\n\treturn (\n\t\t<label\n\t\t\tclassName=\"font-library-modal__library-font-variant\"\n\t\t\thtmlFor={ checkboxId }\n\t\t>\n\t\t\t<Flex justify=\"space-between\" align=\"center\" gap=\"1rem\">\n\t\t\t\t<FontFaceDemo fontFace={ face } text={ displayName } />\n\t\t\t\t<CheckboxControl\n\t\t\t\t\tchecked={ selected }\n\t\t\t\t\tonChange={ handleToggleActivation }\n\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\tid={ checkboxId }\n\t\t\t\t\tlabel={ false }\n\t\t\t\t/>\n\t\t\t</Flex>\n\t\t</label>\n\t);\n}\n\nexport default CollectionFontVariant;\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,eAAe,EACfC,IAAI,EACJC,WAAW,IAAIC,qBAAqB,QAC9B,uBAAuB;;AAE9B;AACA;AACA;AACA,SAASC,sBAAsB,QAAQ,SAAS;AAChD,OAAOC,YAAY,MAAM,aAAa;AACtC,SAASC,MAAM,QAAQ,sBAAsB;AAE7C,SAASC,qBAAqBA,CAAE;EAC/BC,IAAI;EACJC,IAAI;EACJC,mBAAmB;EACnBC;AACD,CAAC,EAAG;EACH,MAAMC,sBAAsB,GAAGA,CAAA,KAAM;IACpC,IAAKH,IAAI,EAAEI,QAAQ,EAAG;MACrBH,mBAAmB,CAAED,IAAI,EAAED,IAAK,CAAC;MACjC;IACD;IACAE,mBAAmB,CAAED,IAAK,CAAC;EAC5B,CAAC;EAED,MAAMK,WAAW,GAAGL,IAAI,CAACM,IAAI,GAAG,GAAG,GAAGX,sBAAsB,CAAEI,IAAK,CAAC;EACpE,MAAM;IAAEQ;EAAU,CAAC,GAAGV,MAAM,CAAEH,qBAAsB,CAAC;EACrD,MAAMc,UAAU,GAAGD,SAAS,CAC1B,GAAGP,IAAI,CAACS,IAAM,IAAId,sBAAsB,CAAEI,IAAK,CAAG,EACpD,CAAC;EAED,OACCW,aAAA;IACCC,SAAS,EAAC,0CAA0C;IACpDC,OAAO,EAAGJ;EAAY,GAEtBE,aAAA,CAAClB,IAAI;IAACqB,OAAO,EAAC,eAAe;IAACC,KAAK,EAAC,QAAQ;IAACC,GAAG,EAAC;EAAM,GACtDL,aAAA,CAACd,YAAY;IAACQ,QAAQ,EAAGL,IAAM;IAACiB,IAAI,EAAGX;EAAa,CAAE,CAAC,EACvDK,aAAA,CAACnB,eAAe;IACf0B,OAAO,EAAGf,QAAU;IACpBgB,QAAQ,EAAGf,sBAAwB;IACnCgB,uBAAuB,EAAG,IAAM;IAChCC,EAAE,EAAGZ,UAAY;IACjBa,KAAK,EAAG;EAAO,CACf,CACI,CACA,CAAC;AAEV;AAEA,eAAevB,qBAAqB"}
|
|
@@ -12,12 +12,12 @@ function ConfirmDeleteDialog({
|
|
|
12
12
|
}) {
|
|
13
13
|
return createElement(ConfirmDialog, {
|
|
14
14
|
isOpen: isConfirmDeleteOpen,
|
|
15
|
-
cancelButtonText: __('
|
|
16
|
-
confirmButtonText: __('
|
|
15
|
+
cancelButtonText: __('Cancel'),
|
|
16
|
+
confirmButtonText: __('Delete'),
|
|
17
17
|
onCancel: handleCancelUninstall,
|
|
18
18
|
onConfirm: handleConfirmUninstall
|
|
19
19
|
}, font && sprintf( /* translators: %s: Name of the font. */
|
|
20
|
-
__('
|
|
20
|
+
__('Are you sure you want to delete "%s" font and all its variants and assets?'), font.name));
|
|
21
21
|
}
|
|
22
22
|
export default ConfirmDeleteDialog;
|
|
23
23
|
//# sourceMappingURL=confirm-delete-dialog.js.map
|
package/build-module/components/global-styles/font-library-modal/confirm-delete-dialog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","sprintf","__experimentalConfirmDialog","ConfirmDialog","ConfirmDeleteDialog","font","isConfirmDeleteOpen","handleConfirmUninstall","handleCancelUninstall","createElement","isOpen","cancelButtonText","confirmButtonText","onCancel","onConfirm","name"],"sources":["@wordpress/edit-site/src/components/global-styles/font-library-modal/confirm-delete-dialog.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';\n\nfunction ConfirmDeleteDialog( {\n\tfont,\n\tisConfirmDeleteOpen,\n\thandleConfirmUninstall,\n\thandleCancelUninstall,\n} ) {\n\treturn (\n\t\t<ConfirmDialog\n\t\t\tisOpen={ isConfirmDeleteOpen }\n\t\t\tcancelButtonText={ __( '
|
|
1
|
+
{"version":3,"names":["__","sprintf","__experimentalConfirmDialog","ConfirmDialog","ConfirmDeleteDialog","font","isConfirmDeleteOpen","handleConfirmUninstall","handleCancelUninstall","createElement","isOpen","cancelButtonText","confirmButtonText","onCancel","onConfirm","name"],"sources":["@wordpress/edit-site/src/components/global-styles/font-library-modal/confirm-delete-dialog.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';\n\nfunction ConfirmDeleteDialog( {\n\tfont,\n\tisConfirmDeleteOpen,\n\thandleConfirmUninstall,\n\thandleCancelUninstall,\n} ) {\n\treturn (\n\t\t<ConfirmDialog\n\t\t\tisOpen={ isConfirmDeleteOpen }\n\t\t\tcancelButtonText={ __( 'Cancel' ) }\n\t\t\tconfirmButtonText={ __( 'Delete' ) }\n\t\t\tonCancel={ handleCancelUninstall }\n\t\t\tonConfirm={ handleConfirmUninstall }\n\t\t>\n\t\t\t{ font &&\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: Name of the font. */\n\t\t\t\t\t__(\n\t\t\t\t\t\t'Are you sure you want to delete \"%s\" font and all its variants and assets?'\n\t\t\t\t\t),\n\t\t\t\t\tfont.name\n\t\t\t\t) }\n\t\t</ConfirmDialog>\n\t);\n}\n\nexport default ConfirmDeleteDialog;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,2BAA2B,IAAIC,aAAa,QAAQ,uBAAuB;AAEpF,SAASC,mBAAmBA,CAAE;EAC7BC,IAAI;EACJC,mBAAmB;EACnBC,sBAAsB;EACtBC;AACD,CAAC,EAAG;EACH,OACCC,aAAA,CAACN,aAAa;IACbO,MAAM,EAAGJ,mBAAqB;IAC9BK,gBAAgB,EAAGX,EAAE,CAAE,QAAS,CAAG;IACnCY,iBAAiB,EAAGZ,EAAE,CAAE,QAAS,CAAG;IACpCa,QAAQ,EAAGL,qBAAuB;IAClCM,SAAS,EAAGP;EAAwB,GAElCF,IAAI,IACLJ,OAAO,EACN;EACAD,EAAE,CACD,4EACD,CAAC,EACDK,IAAI,CAACU,IACN,CACa,CAAC;AAElB;AAEA,eAAeX,mBAAmB"}
|
|
@@ -10,12 +10,12 @@ import { useEntityRecord, useEntityRecords, store as coreStore } from '@wordpres
|
|
|
10
10
|
/**
|
|
11
11
|
* Internal dependencies
|
|
12
12
|
*/
|
|
13
|
-
import {
|
|
13
|
+
import { fetchInstallFont, fetchUninstallFonts, fetchFontCollections, fetchFontCollection } from './resolvers';
|
|
14
14
|
import { unlock } from '../../../lock-unlock';
|
|
15
15
|
const {
|
|
16
16
|
useGlobalSetting
|
|
17
17
|
} = unlock(blockEditorPrivateApis);
|
|
18
|
-
import { setUIValuesNeeded, mergeFontFamilies, loadFontFaceInBrowser, getDisplaySrcFromFontFace,
|
|
18
|
+
import { setUIValuesNeeded, mergeFontFamilies, loadFontFaceInBrowser, getDisplaySrcFromFontFace, makeFormDataFromFontFamily } from './utils';
|
|
19
19
|
import { toggleFont } from './utils/toggleFont';
|
|
20
20
|
import getIntersectingFontFaces from './utils/get-intersecting-font-faces';
|
|
21
21
|
export const FontLibraryContext = createContext({});
|
|
@@ -142,17 +142,17 @@ function FontLibraryProvider({
|
|
|
142
142
|
const getFontFacesActivated = (slug, source) => {
|
|
143
143
|
return getActivatedFontsOutline(source)[slug] || [];
|
|
144
144
|
};
|
|
145
|
-
async function
|
|
145
|
+
async function installFont(font) {
|
|
146
146
|
setIsInstalling(true);
|
|
147
147
|
try {
|
|
148
148
|
// Prepare formData to install.
|
|
149
|
-
const formData =
|
|
149
|
+
const formData = makeFormDataFromFontFamily(font);
|
|
150
150
|
// Install the fonts (upload the font files to the server and create the post in the database).
|
|
151
|
-
const response = await
|
|
151
|
+
const response = await fetchInstallFont(formData);
|
|
152
152
|
const fontsInstalled = response?.successes || [];
|
|
153
153
|
// Get intersecting font faces between the fonts we tried to installed and the fonts that were installed
|
|
154
154
|
// (to avoid activating a non installed font).
|
|
155
|
-
const fontToBeActivated = getIntersectingFontFaces(fontsInstalled,
|
|
155
|
+
const fontToBeActivated = getIntersectingFontFaces(fontsInstalled, [font]);
|
|
156
156
|
// Activate the font families (add the font families to the global styles).
|
|
157
157
|
activateCustomFontFamilies(fontToBeActivated);
|
|
158
158
|
// Save the global styles to the database.
|
|
@@ -172,7 +172,7 @@ function FontLibraryProvider({
|
|
|
172
172
|
// Uninstall the font (remove the font files from the server and the post from the database).
|
|
173
173
|
const response = await fetchUninstallFonts([font]);
|
|
174
174
|
// Deactivate the font family (remove the font family from the global styles).
|
|
175
|
-
if (
|
|
175
|
+
if (0 === response.errors.length) {
|
|
176
176
|
deactivateFontFamily(font);
|
|
177
177
|
// Save the global styles to the database.
|
|
178
178
|
await saveSpecifiedEntityEdits('root', 'globalStyles', globalStylesId, ['settings.typography.fontFamilies']);
|
|
@@ -281,7 +281,7 @@ function FontLibraryProvider({
|
|
|
281
281
|
isFontActivated,
|
|
282
282
|
getFontFacesActivated,
|
|
283
283
|
loadFontFaceAsset,
|
|
284
|
-
|
|
284
|
+
installFont,
|
|
285
285
|
uninstallFont,
|
|
286
286
|
toggleActivateFont,
|
|
287
287
|
getAvailableFontsOutline,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createContext","useState","useEffect","privateApis","blockEditorPrivateApis","useSelect","useDispatch","useEntityRecord","useEntityRecords","store","coreStore","fetchInstallFonts","fetchUninstallFonts","fetchFontCollections","fetchFontCollection","unlock","useGlobalSetting","setUIValuesNeeded","mergeFontFamilies","loadFontFaceInBrowser","getDisplaySrcFromFontFace","makeFormDataFromFontFamilies","toggleFont","getIntersectingFontFaces","FontLibraryContext","FontLibraryProvider","children","__experimentalSaveSpecifiedEntityEdits","saveSpecifiedEntityEdits","globalStylesId","select","__experimentalGetCurrentGlobalStylesId","globalStyles","fontFamiliesHasChanges","edits","settings","typography","fontFamilies","isInstalling","setIsInstalling","refreshKey","setRefreshKey","refreshLibrary","Date","now","records","libraryPosts","isResolving","isResolvingLibrary","hasResolved","hasResolvedLibrary","libraryFonts","map","post","JSON","parse","content","raw","setFontFamilies","baseFontFamilies","undefined","saveFontFamilies","modalTabOpen","setModalTabOpen","libraryFontSelected","setLibraryFontSelected","baseThemeFonts","theme","f","source","sort","a","b","name","localeCompare","themeFonts","customFonts","custom","baseCustomFonts","handleSetLibraryFontSelected","font","fonts","fontSelected","find","slug","toggleModal","tabName","loadedFontUrls","Set","site","currentTheme","getSite","getCurrentTheme","themeUrl","url","stylesheet","getAvailableFontsOutline","availableFontFamilies","outline","reduce","acc","availableFontFaces","Array","isArray","fontFace","face","fontStyle","fontWeight","getActivatedFontsOutline","isFontActivated","style","weight","includes","getFontFacesActivated","installFonts","formData","response","fontsInstalled","successes","fontToBeActivated","activateCustomFontFamilies","error","errors","uninstallFont","deactivateFontFamily","console","_fontFamilies$font$so","initialCustomFonts","newCustomFonts","filter","fontsToAdd","forEach","src","toggleActivateFont","_fontFamilies$font$so2","initialFonts","newFonts","loadFontFaceAsset","has","add","collections","setFontCollections","getFontCollections","getFontCollection","id","hasData","collection","data","updatedCollections","e","createElement","Provider","value"],"sources":["@wordpress/edit-site/src/components/global-styles/font-library-modal/context.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useState, useEffect } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tuseEntityRecord,\n\tuseEntityRecords,\n\tstore as coreStore,\n} from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tfetchInstallFonts,\n\tfetchUninstallFonts,\n\tfetchFontCollections,\n\tfetchFontCollection,\n} from './resolvers';\nimport { unlock } from '../../../lock-unlock';\nconst { useGlobalSetting } = unlock( blockEditorPrivateApis );\nimport {\n\tsetUIValuesNeeded,\n\tmergeFontFamilies,\n\tloadFontFaceInBrowser,\n\tgetDisplaySrcFromFontFace,\n\tmakeFormDataFromFontFamilies,\n} from './utils';\nimport { toggleFont } from './utils/toggleFont';\nimport getIntersectingFontFaces from './utils/get-intersecting-font-faces';\n\nexport const FontLibraryContext = createContext( {} );\n\nfunction FontLibraryProvider( { children } ) {\n\tconst { __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits } =\n\t\tuseDispatch( coreStore );\n\tconst { globalStylesId } = useSelect( ( select ) => {\n\t\tconst { __experimentalGetCurrentGlobalStylesId } = select( coreStore );\n\t\treturn { globalStylesId: __experimentalGetCurrentGlobalStylesId() };\n\t} );\n\n\tconst globalStyles = useEntityRecord(\n\t\t'root',\n\t\t'globalStyles',\n\t\tglobalStylesId\n\t);\n\tconst fontFamiliesHasChanges =\n\t\t!! globalStyles?.edits?.settings?.typography?.fontFamilies;\n\n\tconst [ isInstalling, setIsInstalling ] = useState( false );\n\tconst [ refreshKey, setRefreshKey ] = useState( 0 );\n\n\tconst refreshLibrary = () => {\n\t\tsetRefreshKey( Date.now() );\n\t};\n\n\tconst {\n\t\trecords: libraryPosts = [],\n\t\tisResolving: isResolvingLibrary,\n\t\thasResolved: hasResolvedLibrary,\n\t} = useEntityRecords( 'postType', 'wp_font_family', { refreshKey } );\n\n\tconst libraryFonts =\n\t\t( libraryPosts || [] ).map( ( post ) =>\n\t\t\tJSON.parse( post.content.raw )\n\t\t) || [];\n\n\t// Global Styles (settings) font families\n\tconst [ fontFamilies, setFontFamilies ] = useGlobalSetting(\n\t\t'typography.fontFamilies'\n\t);\n\t// theme.json file font families\n\tconst [ baseFontFamilies ] = useGlobalSetting(\n\t\t'typography.fontFamilies',\n\t\tundefined,\n\t\t'base'\n\t);\n\n\t// Save font families to the global styles post in the database.\n\tconst saveFontFamilies = () => {\n\t\tsaveSpecifiedEntityEdits( 'root', 'globalStyles', globalStylesId, [\n\t\t\t'settings.typography.fontFamilies',\n\t\t] );\n\t};\n\n\t// Library Fonts\n\tconst [ modalTabOpen, setModalTabOpen ] = useState( false );\n\tconst [ libraryFontSelected, setLibraryFontSelected ] = useState( null );\n\n\tconst baseThemeFonts = baseFontFamilies?.theme\n\t\t? baseFontFamilies.theme\n\t\t\t\t.map( ( f ) => setUIValuesNeeded( f, { source: 'theme' } ) )\n\t\t\t\t.sort( ( a, b ) => a.name.localeCompare( b.name ) )\n\t\t: [];\n\n\tconst themeFonts = fontFamilies?.theme\n\t\t? fontFamilies.theme\n\t\t\t\t.map( ( f ) => setUIValuesNeeded( f, { source: 'theme' } ) )\n\t\t\t\t.sort( ( a, b ) => a.name.localeCompare( b.name ) )\n\t\t: [];\n\n\tconst customFonts = fontFamilies?.custom\n\t\t? fontFamilies.custom\n\t\t\t\t.map( ( f ) => setUIValuesNeeded( f, { source: 'custom' } ) )\n\t\t\t\t.sort( ( a, b ) => a.name.localeCompare( b.name ) )\n\t\t: [];\n\n\tconst baseCustomFonts = libraryFonts\n\t\t? libraryFonts\n\t\t\t\t.map( ( f ) => setUIValuesNeeded( f, { source: 'custom' } ) )\n\t\t\t\t.sort( ( a, b ) => a.name.localeCompare( b.name ) )\n\t\t: [];\n\n\tuseEffect( () => {\n\t\tif ( ! modalTabOpen ) {\n\t\t\tsetLibraryFontSelected( null );\n\t\t}\n\t}, [ modalTabOpen ] );\n\n\tconst handleSetLibraryFontSelected = ( font ) => {\n\t\t// If font is null, reset the selected font\n\t\tif ( ! font ) {\n\t\t\tsetLibraryFontSelected( null );\n\t\t\treturn;\n\t\t}\n\n\t\tconst fonts =\n\t\t\tfont.source === 'theme' ? baseThemeFonts : baseCustomFonts;\n\n\t\t// Tries to find the font in the installed fonts\n\t\tconst fontSelected = fonts.find( ( f ) => f.slug === font.slug );\n\t\t// If the font is not found (it is only defined in custom styles), use the font from custom styles\n\t\tsetLibraryFontSelected( {\n\t\t\t...( fontSelected || font ),\n\t\t\tsource: font.source,\n\t\t} );\n\t};\n\n\tconst toggleModal = ( tabName ) => {\n\t\tsetModalTabOpen( tabName || null );\n\t};\n\n\t// Demo\n\tconst [ loadedFontUrls ] = useState( new Set() );\n\n\t// Theme data\n\tconst { site, currentTheme } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tsite: select( coreStore ).getSite(),\n\t\t\tcurrentTheme: select( coreStore ).getCurrentTheme(),\n\t\t};\n\t} );\n\tconst themeUrl =\n\t\tsite?.url + '/wp-content/themes/' + currentTheme?.stylesheet;\n\n\tconst getAvailableFontsOutline = ( availableFontFamilies ) => {\n\t\tconst outline = availableFontFamilies.reduce( ( acc, font ) => {\n\t\t\tconst availableFontFaces = Array.isArray( font?.fontFace )\n\t\t\t\t? font?.fontFace.map(\n\t\t\t\t\t\t( face ) => `${ face.fontStyle + face.fontWeight }`\n\t\t\t\t )\n\t\t\t\t: [ 'normal400' ]; // If the font doesn't have fontFace, we assume it is a system font and we add the defaults: normal 400\n\n\t\t\tacc[ font.slug ] = availableFontFaces;\n\t\t\treturn acc;\n\t\t}, {} );\n\t\treturn outline;\n\t};\n\n\tconst getActivatedFontsOutline = ( source ) => {\n\t\tswitch ( source ) {\n\t\t\tcase 'theme':\n\t\t\t\treturn getAvailableFontsOutline( themeFonts );\n\t\t\tcase 'custom':\n\t\t\tdefault:\n\t\t\t\treturn getAvailableFontsOutline( customFonts );\n\t\t}\n\t};\n\n\tconst isFontActivated = ( slug, style, weight, source ) => {\n\t\tif ( ! style && ! weight ) {\n\t\t\treturn !! getActivatedFontsOutline( source )[ slug ];\n\t\t}\n\t\treturn !! getActivatedFontsOutline( source )[ slug ]?.includes(\n\t\t\tstyle + weight\n\t\t);\n\t};\n\n\tconst getFontFacesActivated = ( slug, source ) => {\n\t\treturn getActivatedFontsOutline( source )[ slug ] || [];\n\t};\n\n\tasync function installFonts( fonts ) {\n\t\tsetIsInstalling( true );\n\t\ttry {\n\t\t\t// Prepare formData to install.\n\t\t\tconst formData = makeFormDataFromFontFamilies( fonts );\n\t\t\t// Install the fonts (upload the font files to the server and create the post in the database).\n\t\t\tconst response = await fetchInstallFonts( formData );\n\t\t\tconst fontsInstalled = response?.successes || [];\n\t\t\t// Get intersecting font faces between the fonts we tried to installed and the fonts that were installed\n\t\t\t// (to avoid activating a non installed font).\n\t\t\tconst fontToBeActivated = getIntersectingFontFaces(\n\t\t\t\tfontsInstalled,\n\t\t\t\tfonts\n\t\t\t);\n\t\t\t// Activate the font families (add the font families to the global styles).\n\t\t\tactivateCustomFontFamilies( fontToBeActivated );\n\t\t\t// Save the global styles to the database.\n\t\t\tsaveSpecifiedEntityEdits( 'root', 'globalStyles', globalStylesId, [\n\t\t\t\t'settings.typography.fontFamilies',\n\t\t\t] );\n\t\t\trefreshLibrary();\n\t\t\tsetIsInstalling( false );\n\n\t\t\treturn response;\n\t\t} catch ( error ) {\n\t\t\tsetIsInstalling( false );\n\t\t\treturn {\n\t\t\t\terrors: [ error ],\n\t\t\t};\n\t\t}\n\t}\n\n\tasync function uninstallFont( font ) {\n\t\ttry {\n\t\t\t// Uninstall the font (remove the font files from the server and the post from the database).\n\t\t\tconst response = await fetchUninstallFonts( [ font ] );\n\t\t\t// Deactivate the font family (remove the font family from the global styles).\n\t\t\tif ( ! response.errors ) {\n\t\t\t\tdeactivateFontFamily( font );\n\t\t\t\t// Save the global styles to the database.\n\t\t\t\tawait saveSpecifiedEntityEdits(\n\t\t\t\t\t'root',\n\t\t\t\t\t'globalStyles',\n\t\t\t\t\tglobalStylesId,\n\t\t\t\t\t[ 'settings.typography.fontFamilies' ]\n\t\t\t\t);\n\t\t\t}\n\t\t\t// Refresh the library (the the library font families from database).\n\t\t\trefreshLibrary();\n\t\t\treturn response;\n\t\t} catch ( error ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error( error );\n\t\t\treturn {\n\t\t\t\terrors: [ error ],\n\t\t\t};\n\t\t}\n\t}\n\n\tconst deactivateFontFamily = ( font ) => {\n\t\t// If the user doesn't have custom fonts defined, include as custom fonts all the theme fonts\n\t\t// We want to save as active all the theme fonts at the beginning\n\t\tconst initialCustomFonts = fontFamilies?.[ font.source ] ?? [];\n\t\tconst newCustomFonts = initialCustomFonts.filter(\n\t\t\t( f ) => f.slug !== font.slug\n\t\t);\n\t\tsetFontFamilies( {\n\t\t\t...fontFamilies,\n\t\t\t[ font.source ]: newCustomFonts,\n\t\t} );\n\t};\n\n\tconst activateCustomFontFamilies = ( fontsToAdd ) => {\n\t\t// Merge the existing custom fonts with the new fonts.\n\t\tconst newCustomFonts = mergeFontFamilies(\n\t\t\tfontFamilies?.custom,\n\t\t\tfontsToAdd\n\t\t);\n\t\t// Activate the fonts by set the new custom fonts array.\n\t\tsetFontFamilies( {\n\t\t\t...fontFamilies,\n\t\t\tcustom: newCustomFonts,\n\t\t} );\n\t\t// Add custom fonts to the browser.\n\t\tfontsToAdd.forEach( ( font ) => {\n\t\t\tif ( font.fontFace ) {\n\t\t\t\tfont.fontFace.forEach( ( face ) => {\n\t\t\t\t\t// Load font faces just in the iframe because they already are in the document.\n\t\t\t\t\tloadFontFaceInBrowser(\n\t\t\t\t\t\tface,\n\t\t\t\t\t\tgetDisplaySrcFromFontFace( face.src ),\n\t\t\t\t\t\t'iframe'\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t};\n\n\tconst toggleActivateFont = ( font, face ) => {\n\t\t// If the user doesn't have custom fonts defined, include as custom fonts all the theme fonts\n\t\t// We want to save as active all the theme fonts at the beginning\n\t\tconst initialFonts = fontFamilies?.[ font.source ] ?? [];\n\t\t// Toggles the received font family or font face\n\t\tconst newFonts = toggleFont( font, face, initialFonts );\n\t\t// Updates the font families activated in global settings:\n\t\tsetFontFamilies( {\n\t\t\t...fontFamilies,\n\t\t\t[ font.source ]: newFonts,\n\t\t} );\n\t};\n\n\tconst loadFontFaceAsset = async ( fontFace ) => {\n\t\t// If the font doesn't have a src, don't load it.\n\t\tif ( ! fontFace.src ) return;\n\t\t// Get the src of the font.\n\t\tconst src = getDisplaySrcFromFontFace( fontFace.src, themeUrl );\n\t\t// If the font is already loaded, don't load it again.\n\t\tif ( ! src || loadedFontUrls.has( src ) ) return;\n\t\t// Load the font in the browser.\n\t\tloadFontFaceInBrowser( fontFace, src, 'document' );\n\t\t// Add the font to the loaded fonts list.\n\t\tloadedFontUrls.add( src );\n\t};\n\n\t// Font Collections\n\tconst [ collections, setFontCollections ] = useState( [] );\n\tconst getFontCollections = async () => {\n\t\tconst response = await fetchFontCollections();\n\t\tsetFontCollections( response );\n\t};\n\tconst getFontCollection = async ( id ) => {\n\t\ttry {\n\t\t\tconst hasData = !! collections.find(\n\t\t\t\t( collection ) => collection.id === id\n\t\t\t)?.data;\n\t\t\tif ( hasData ) return;\n\t\t\tconst response = await fetchFontCollection( id );\n\t\t\tconst updatedCollections = collections.map( ( collection ) =>\n\t\t\t\tcollection.id === id\n\t\t\t\t\t? { ...collection, data: { ...response?.data } }\n\t\t\t\t\t: collection\n\t\t\t);\n\t\t\tsetFontCollections( updatedCollections );\n\t\t} catch ( e ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error( e );\n\t\t\tthrow e;\n\t\t}\n\t};\n\n\tuseEffect( () => {\n\t\tgetFontCollections();\n\t}, [] );\n\n\treturn (\n\t\t<FontLibraryContext.Provider\n\t\t\tvalue={ {\n\t\t\t\tlibraryFontSelected,\n\t\t\t\thandleSetLibraryFontSelected,\n\t\t\t\tthemeFonts,\n\t\t\t\tbaseThemeFonts,\n\t\t\t\tcustomFonts,\n\t\t\t\tbaseCustomFonts,\n\t\t\t\tisFontActivated,\n\t\t\t\tgetFontFacesActivated,\n\t\t\t\tloadFontFaceAsset,\n\t\t\t\tinstallFonts,\n\t\t\t\tuninstallFont,\n\t\t\t\ttoggleActivateFont,\n\t\t\t\tgetAvailableFontsOutline,\n\t\t\t\tmodalTabOpen,\n\t\t\t\ttoggleModal,\n\t\t\t\trefreshLibrary,\n\t\t\t\tsaveFontFamilies,\n\t\t\t\tfontFamiliesHasChanges,\n\t\t\t\tisResolvingLibrary,\n\t\t\t\thasResolvedLibrary,\n\t\t\t\tisInstalling,\n\t\t\t\tcollections,\n\t\t\t\tgetFontCollection,\n\t\t\t} }\n\t\t>\n\t\t\t{ children }\n\t\t</FontLibraryContext.Provider>\n\t);\n}\n\nexport default FontLibraryProvider;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,aAAa,EAAEC,QAAQ,EAAEC,SAAS,QAAQ,oBAAoB;AACvE,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;AAC/E,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SACCC,eAAe,EACfC,gBAAgB,EAChBC,KAAK,IAAIC,SAAS,QACZ,sBAAsB;;AAE7B;AACA;AACA;AACA,SACCC,iBAAiB,EACjBC,mBAAmB,EACnBC,oBAAoB,EACpBC,mBAAmB,QACb,aAAa;AACpB,SAASC,MAAM,QAAQ,sBAAsB;AAC7C,MAAM;EAAEC;AAAiB,CAAC,GAAGD,MAAM,CAAEX,sBAAuB,CAAC;AAC7D,SACCa,iBAAiB,EACjBC,iBAAiB,EACjBC,qBAAqB,EACrBC,yBAAyB,EACzBC,4BAA4B,QACtB,SAAS;AAChB,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,OAAOC,wBAAwB,MAAM,qCAAqC;AAE1E,OAAO,MAAMC,kBAAkB,GAAGxB,aAAa,CAAE,CAAC,CAAE,CAAC;AAErD,SAASyB,mBAAmBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EAC5C,MAAM;IAAEC,sCAAsC,EAAEC;EAAyB,CAAC,G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O,EAAG;MACf,MAAM7B,QAAQ,GAAG,MAAMtG,mBAAmB,CAAEkI,EAAG,CAAC;MAChD,MAAMI,kBAAkB,GAAGR,WAAW,CAACxF,GAAG,CAAI8F,UAAU,IACvDA,UAAU,CAACF,EAAE,KAAKA,EAAE,GACjB;QAAE,GAAGE,UAAU;QAAEC,IAAI,EAAE;UAAE,GAAG/B,QAAQ,EAAE+B;QAAK;MAAE,CAAC,GAC9CD,UACJ,CAAC;MACDL,kBAAkB,CAAEO,kBAAmB,CAAC;IACzC,CAAC,CAAC,OAAQC,CAAC,EAAG;MACb;MACAxB,OAAO,CAACJ,KAAK,CAAE4B,CAAE,CAAC;MAClB,MAAMA,CAAC;IACR;EACD,CAAC;EAEDnJ,SAAS,CAAE,MAAM;IAChB4I,kBAAkB,CAAC,CAAC;EACrB,CAAC,EAAE,EAAG,CAAC;EAEP,OACCQ,aAAA,CAAC9H,kBAAkB,CAAC+H,QAAQ;IAC3BC,KAAK,EAAG;MACPxF,mBAAmB;MACnBe,4BAA4B;MAC5BJ,UAAU;MACVT,cAAc;MACdU,WAAW;MACXE,eAAe;MACf+B,eAAe;MACfI,qBAAqB;MACrBwB,iBAAiB;MACjBvB,YAAY;MACZS,aAAa;MACbU,kBAAkB;MAClBrC,wBAAwB;MACxBlC,YAAY;MACZuB,WAAW;MACX3C,cAAc;MACdmB,gBAAgB;MAChB5B,sBAAsB;MACtBe,kBAAkB;MAClBE,kBAAkB;MAClBZ,YAAY;MACZsG,WAAW;MACXG;IACD;EAAG,GAEDrH,QAC0B,CAAC;AAEhC;AAEA,eAAeD,mBAAmB"}
|
|
1
|
+
{"version":3,"names":["createContext","useState","useEffect","privateApis","blockEditorPrivateApis","useSelect","useDispatch","useEntityRecord","useEntityRecords","store","coreStore","fetchInstallFont","fetchUninstallFonts","fetchFontCollections","fetchFontCollection","unlock","useGlobalSetting","setUIValuesNeeded","mergeFontFamilies","loadFontFaceInBrowser","getDisplaySrcFromFontFace","makeFormDataFromFontFamily","toggleFont","getIntersectingFontFaces","FontLibraryContext","FontLibraryProvider","children","__experimentalSaveSpecifiedEntityEdits","saveSpecifiedEntityEdits","globalStylesId","select","__experimentalGetCurrentGlobalStylesId","globalStyles","fontFamiliesHasChanges","edits","settings","typography","fontFamilies","isInstalling","setIsInstalling","refreshKey","setRefreshKey","refreshLibrary","Date","now","records","libraryPosts","isResolving","isResolvingLibrary","hasResolved","hasResolvedLibrary","libraryFonts","map","post","JSON","parse","content","raw","setFontFamilies","baseFontFamilies","undefined","saveFontFamilies","modalTabOpen","setModalTabOpen","libraryFontSelected","setLibraryFontSelected","baseThemeFonts","theme","f","source","sort","a","b","name","localeCompare","themeFonts","customFonts","custom","baseCustomFonts","handleSetLibraryFontSelected","font","fonts","fontSelected","find","slug","toggleModal","tabName","loadedFontUrls","Set","site","currentTheme","getSite","getCurrentTheme","themeUrl","url","stylesheet","getAvailableFontsOutline","availableFontFamilies","outline","reduce","acc","availableFontFaces","Array","isArray","fontFace","face","fontStyle","fontWeight","getActivatedFontsOutline","isFontActivated","style","weight","includes","getFontFacesActivated","installFont","formData","response","fontsInstalled","successes","fontToBeActivated","activateCustomFontFamilies","error","errors","uninstallFont","length","deactivateFontFamily","console","_fontFamilies$font$so","initialCustomFonts","newCustomFonts","filter","fontsToAdd","forEach","src","toggleActivateFont","_fontFamilies$font$so2","initialFonts","newFonts","loadFontFaceAsset","has","add","collections","setFontCollections","getFontCollections","getFontCollection","id","hasData","collection","data","updatedCollections","e","createElement","Provider","value"],"sources":["@wordpress/edit-site/src/components/global-styles/font-library-modal/context.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useState, useEffect } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tuseEntityRecord,\n\tuseEntityRecords,\n\tstore as coreStore,\n} from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tfetchInstallFont,\n\tfetchUninstallFonts,\n\tfetchFontCollections,\n\tfetchFontCollection,\n} from './resolvers';\nimport { unlock } from '../../../lock-unlock';\nconst { useGlobalSetting } = unlock( blockEditorPrivateApis );\nimport {\n\tsetUIValuesNeeded,\n\tmergeFontFamilies,\n\tloadFontFaceInBrowser,\n\tgetDisplaySrcFromFontFace,\n\tmakeFormDataFromFontFamily,\n} from './utils';\nimport { toggleFont } from './utils/toggleFont';\nimport getIntersectingFontFaces from './utils/get-intersecting-font-faces';\n\nexport const FontLibraryContext = createContext( {} );\n\nfunction FontLibraryProvider( { children } ) {\n\tconst { __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits } =\n\t\tuseDispatch( coreStore );\n\tconst { globalStylesId } = useSelect( ( select ) => {\n\t\tconst { __experimentalGetCurrentGlobalStylesId } = select( coreStore );\n\t\treturn { globalStylesId: __experimentalGetCurrentGlobalStylesId() };\n\t} );\n\n\tconst globalStyles = useEntityRecord(\n\t\t'root',\n\t\t'globalStyles',\n\t\tglobalStylesId\n\t);\n\tconst fontFamiliesHasChanges =\n\t\t!! globalStyles?.edits?.settings?.typography?.fontFamilies;\n\n\tconst [ isInstalling, setIsInstalling ] = useState( false );\n\tconst [ refreshKey, setRefreshKey ] = useState( 0 );\n\n\tconst refreshLibrary = () => {\n\t\tsetRefreshKey( Date.now() );\n\t};\n\n\tconst {\n\t\trecords: libraryPosts = [],\n\t\tisResolving: isResolvingLibrary,\n\t\thasResolved: hasResolvedLibrary,\n\t} = useEntityRecords( 'postType', 'wp_font_family', { refreshKey } );\n\n\tconst libraryFonts =\n\t\t( libraryPosts || [] ).map( ( post ) =>\n\t\t\tJSON.parse( post.content.raw )\n\t\t) || [];\n\n\t// Global Styles (settings) font families\n\tconst [ fontFamilies, setFontFamilies ] = useGlobalSetting(\n\t\t'typography.fontFamilies'\n\t);\n\t// theme.json file font families\n\tconst [ baseFontFamilies ] = useGlobalSetting(\n\t\t'typography.fontFamilies',\n\t\tundefined,\n\t\t'base'\n\t);\n\n\t// Save font families to the global styles post in the database.\n\tconst saveFontFamilies = () => {\n\t\tsaveSpecifiedEntityEdits( 'root', 'globalStyles', globalStylesId, [\n\t\t\t'settings.typography.fontFamilies',\n\t\t] );\n\t};\n\n\t// Library Fonts\n\tconst [ modalTabOpen, setModalTabOpen ] = useState( false );\n\tconst [ libraryFontSelected, setLibraryFontSelected ] = useState( null );\n\n\tconst baseThemeFonts = baseFontFamilies?.theme\n\t\t? baseFontFamilies.theme\n\t\t\t\t.map( ( f ) => setUIValuesNeeded( f, { source: 'theme' } ) )\n\t\t\t\t.sort( ( a, b ) => a.name.localeCompare( b.name ) )\n\t\t: [];\n\n\tconst themeFonts = fontFamilies?.theme\n\t\t? fontFamilies.theme\n\t\t\t\t.map( ( f ) => setUIValuesNeeded( f, { source: 'theme' } ) )\n\t\t\t\t.sort( ( a, b ) => a.name.localeCompare( b.name ) )\n\t\t: [];\n\n\tconst customFonts = fontFamilies?.custom\n\t\t? fontFamilies.custom\n\t\t\t\t.map( ( f ) => setUIValuesNeeded( f, { source: 'custom' } ) )\n\t\t\t\t.sort( ( a, b ) => a.name.localeCompare( b.name ) )\n\t\t: [];\n\n\tconst baseCustomFonts = libraryFonts\n\t\t? libraryFonts\n\t\t\t\t.map( ( f ) => setUIValuesNeeded( f, { source: 'custom' } ) )\n\t\t\t\t.sort( ( a, b ) => a.name.localeCompare( b.name ) )\n\t\t: [];\n\n\tuseEffect( () => {\n\t\tif ( ! modalTabOpen ) {\n\t\t\tsetLibraryFontSelected( null );\n\t\t}\n\t}, [ modalTabOpen ] );\n\n\tconst handleSetLibraryFontSelected = ( font ) => {\n\t\t// If font is null, reset the selected font\n\t\tif ( ! font ) {\n\t\t\tsetLibraryFontSelected( null );\n\t\t\treturn;\n\t\t}\n\n\t\tconst fonts =\n\t\t\tfont.source === 'theme' ? baseThemeFonts : baseCustomFonts;\n\n\t\t// Tries to find the font in the installed fonts\n\t\tconst fontSelected = fonts.find( ( f ) => f.slug === font.slug );\n\t\t// If the font is not found (it is only defined in custom styles), use the font from custom styles\n\t\tsetLibraryFontSelected( {\n\t\t\t...( fontSelected || font ),\n\t\t\tsource: font.source,\n\t\t} );\n\t};\n\n\tconst toggleModal = ( tabName ) => {\n\t\tsetModalTabOpen( tabName || null );\n\t};\n\n\t// Demo\n\tconst [ loadedFontUrls ] = useState( new Set() );\n\n\t// Theme data\n\tconst { site, currentTheme } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tsite: select( coreStore ).getSite(),\n\t\t\tcurrentTheme: select( coreStore ).getCurrentTheme(),\n\t\t};\n\t} );\n\tconst themeUrl =\n\t\tsite?.url + '/wp-content/themes/' + currentTheme?.stylesheet;\n\n\tconst getAvailableFontsOutline = ( availableFontFamilies ) => {\n\t\tconst outline = availableFontFamilies.reduce( ( acc, font ) => {\n\t\t\tconst availableFontFaces = Array.isArray( font?.fontFace )\n\t\t\t\t? font?.fontFace.map(\n\t\t\t\t\t\t( face ) => `${ face.fontStyle + face.fontWeight }`\n\t\t\t\t )\n\t\t\t\t: [ 'normal400' ]; // If the font doesn't have fontFace, we assume it is a system font and we add the defaults: normal 400\n\n\t\t\tacc[ font.slug ] = availableFontFaces;\n\t\t\treturn acc;\n\t\t}, {} );\n\t\treturn outline;\n\t};\n\n\tconst getActivatedFontsOutline = ( source ) => {\n\t\tswitch ( source ) {\n\t\t\tcase 'theme':\n\t\t\t\treturn getAvailableFontsOutline( themeFonts );\n\t\t\tcase 'custom':\n\t\t\tdefault:\n\t\t\t\treturn getAvailableFontsOutline( customFonts );\n\t\t}\n\t};\n\n\tconst isFontActivated = ( slug, style, weight, source ) => {\n\t\tif ( ! style && ! weight ) {\n\t\t\treturn !! getActivatedFontsOutline( source )[ slug ];\n\t\t}\n\t\treturn !! getActivatedFontsOutline( source )[ slug ]?.includes(\n\t\t\tstyle + weight\n\t\t);\n\t};\n\n\tconst getFontFacesActivated = ( slug, source ) => {\n\t\treturn getActivatedFontsOutline( source )[ slug ] || [];\n\t};\n\n\tasync function installFont( font ) {\n\t\tsetIsInstalling( true );\n\t\ttry {\n\t\t\t// Prepare formData to install.\n\t\t\tconst formData = makeFormDataFromFontFamily( font );\n\t\t\t// Install the fonts (upload the font files to the server and create the post in the database).\n\t\t\tconst response = await fetchInstallFont( formData );\n\t\t\tconst fontsInstalled = response?.successes || [];\n\t\t\t// Get intersecting font faces between the fonts we tried to installed and the fonts that were installed\n\t\t\t// (to avoid activating a non installed font).\n\t\t\tconst fontToBeActivated = getIntersectingFontFaces(\n\t\t\t\tfontsInstalled,\n\t\t\t\t[ font ]\n\t\t\t);\n\t\t\t// Activate the font families (add the font families to the global styles).\n\t\t\tactivateCustomFontFamilies( fontToBeActivated );\n\t\t\t// Save the global styles to the database.\n\t\t\tsaveSpecifiedEntityEdits( 'root', 'globalStyles', globalStylesId, [\n\t\t\t\t'settings.typography.fontFamilies',\n\t\t\t] );\n\t\t\trefreshLibrary();\n\t\t\tsetIsInstalling( false );\n\n\t\t\treturn response;\n\t\t} catch ( error ) {\n\t\t\tsetIsInstalling( false );\n\t\t\treturn {\n\t\t\t\terrors: [ error ],\n\t\t\t};\n\t\t}\n\t}\n\n\tasync function uninstallFont( font ) {\n\t\ttry {\n\t\t\t// Uninstall the font (remove the font files from the server and the post from the database).\n\t\t\tconst response = await fetchUninstallFonts( [ font ] );\n\t\t\t// Deactivate the font family (remove the font family from the global styles).\n\t\t\tif ( 0 === response.errors.length ) {\n\t\t\t\tdeactivateFontFamily( font );\n\t\t\t\t// Save the global styles to the database.\n\t\t\t\tawait saveSpecifiedEntityEdits(\n\t\t\t\t\t'root',\n\t\t\t\t\t'globalStyles',\n\t\t\t\t\tglobalStylesId,\n\t\t\t\t\t[ 'settings.typography.fontFamilies' ]\n\t\t\t\t);\n\t\t\t}\n\t\t\t// Refresh the library (the the library font families from database).\n\t\t\trefreshLibrary();\n\t\t\treturn response;\n\t\t} catch ( error ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error( error );\n\t\t\treturn {\n\t\t\t\terrors: [ error ],\n\t\t\t};\n\t\t}\n\t}\n\n\tconst deactivateFontFamily = ( font ) => {\n\t\t// If the user doesn't have custom fonts defined, include as custom fonts all the theme fonts\n\t\t// We want to save as active all the theme fonts at the beginning\n\t\tconst initialCustomFonts = fontFamilies?.[ font.source ] ?? [];\n\t\tconst newCustomFonts = initialCustomFonts.filter(\n\t\t\t( f ) => f.slug !== font.slug\n\t\t);\n\t\tsetFontFamilies( {\n\t\t\t...fontFamilies,\n\t\t\t[ font.source ]: newCustomFonts,\n\t\t} );\n\t};\n\n\tconst activateCustomFontFamilies = ( fontsToAdd ) => {\n\t\t// Merge the existing custom fonts with the new fonts.\n\t\tconst newCustomFonts = mergeFontFamilies(\n\t\t\tfontFamilies?.custom,\n\t\t\tfontsToAdd\n\t\t);\n\t\t// Activate the fonts by set the new custom fonts array.\n\t\tsetFontFamilies( {\n\t\t\t...fontFamilies,\n\t\t\tcustom: newCustomFonts,\n\t\t} );\n\t\t// Add custom fonts to the browser.\n\t\tfontsToAdd.forEach( ( font ) => {\n\t\t\tif ( font.fontFace ) {\n\t\t\t\tfont.fontFace.forEach( ( face ) => {\n\t\t\t\t\t// Load font faces just in the iframe because they already are in the document.\n\t\t\t\t\tloadFontFaceInBrowser(\n\t\t\t\t\t\tface,\n\t\t\t\t\t\tgetDisplaySrcFromFontFace( face.src ),\n\t\t\t\t\t\t'iframe'\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t};\n\n\tconst toggleActivateFont = ( font, face ) => {\n\t\t// If the user doesn't have custom fonts defined, include as custom fonts all the theme fonts\n\t\t// We want to save as active all the theme fonts at the beginning\n\t\tconst initialFonts = fontFamilies?.[ font.source ] ?? [];\n\t\t// Toggles the received font family or font face\n\t\tconst newFonts = toggleFont( font, face, initialFonts );\n\t\t// Updates the font families activated in global settings:\n\t\tsetFontFamilies( {\n\t\t\t...fontFamilies,\n\t\t\t[ font.source ]: newFonts,\n\t\t} );\n\t};\n\n\tconst loadFontFaceAsset = async ( fontFace ) => {\n\t\t// If the font doesn't have a src, don't load it.\n\t\tif ( ! fontFace.src ) return;\n\t\t// Get the src of the font.\n\t\tconst src = getDisplaySrcFromFontFace( fontFace.src, themeUrl );\n\t\t// If the font is already loaded, don't load it again.\n\t\tif ( ! src || loadedFontUrls.has( src ) ) return;\n\t\t// Load the font in the browser.\n\t\tloadFontFaceInBrowser( fontFace, src, 'document' );\n\t\t// Add the font to the loaded fonts list.\n\t\tloadedFontUrls.add( src );\n\t};\n\n\t// Font Collections\n\tconst [ collections, setFontCollections ] = useState( [] );\n\tconst getFontCollections = async () => {\n\t\tconst response = await fetchFontCollections();\n\t\tsetFontCollections( response );\n\t};\n\tconst getFontCollection = async ( id ) => {\n\t\ttry {\n\t\t\tconst hasData = !! collections.find(\n\t\t\t\t( collection ) => collection.id === id\n\t\t\t)?.data;\n\t\t\tif ( hasData ) return;\n\t\t\tconst response = await fetchFontCollection( id );\n\t\t\tconst updatedCollections = collections.map( ( collection ) =>\n\t\t\t\tcollection.id === id\n\t\t\t\t\t? { ...collection, data: { ...response?.data } }\n\t\t\t\t\t: collection\n\t\t\t);\n\t\t\tsetFontCollections( updatedCollections );\n\t\t} catch ( e ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error( e );\n\t\t\tthrow e;\n\t\t}\n\t};\n\n\tuseEffect( () => {\n\t\tgetFontCollections();\n\t}, [] );\n\n\treturn (\n\t\t<FontLibraryContext.Provider\n\t\t\tvalue={ {\n\t\t\t\tlibraryFontSelected,\n\t\t\t\thandleSetLibraryFontSelected,\n\t\t\t\tthemeFonts,\n\t\t\t\tbaseThemeFonts,\n\t\t\t\tcustomFonts,\n\t\t\t\tbaseCustomFonts,\n\t\t\t\tisFontActivated,\n\t\t\t\tgetFontFacesActivated,\n\t\t\t\tloadFontFaceAsset,\n\t\t\t\tinstallFont,\n\t\t\t\tuninstallFont,\n\t\t\t\ttoggleActivateFont,\n\t\t\t\tgetAvailableFontsOutline,\n\t\t\t\tmodalTabOpen,\n\t\t\t\ttoggleModal,\n\t\t\t\trefreshLibrary,\n\t\t\t\tsaveFontFamilies,\n\t\t\t\tfontFamiliesHasChanges,\n\t\t\t\tisResolvingLibrary,\n\t\t\t\thasResolvedLibrary,\n\t\t\t\tisInstalling,\n\t\t\t\tcollections,\n\t\t\t\tgetFontCollection,\n\t\t\t} }\n\t\t>\n\t\t\t{ children }\n\t\t</FontLibraryContext.Provider>\n\t);\n}\n\nexport default FontLibraryProvider;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,aAAa,EAAEC,QAAQ,EAAEC,SAAS,QAAQ,oBAAoB;AACvE,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;AAC/E,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SACCC,eAAe,EACfC,gBAAgB,EAChBC,KAAK,IAAIC,SAAS,QACZ,sBAAsB;;AAE7B;AACA;AACA;AACA,SACCC,gBAAgB,EAChBC,mBAAmB,EACnBC,oBAAoB,EACpBC,mBAAmB,QACb,aAAa;AACpB,SAASC,MAAM,QAAQ,sBAAsB;AAC7C,MAAM;EAAEC;AAAiB,CAAC,GAAGD,MAAM,CAAEX,sBAAuB,CAAC;AAC7D,SACCa,iBAAiB,EACjBC,iBAAiB,EACjBC,qBAAqB,EACrBC,yBAAyB,EACzBC,0BAA0B,QACpB,SAAS;AAChB,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,OAAOC,wBAAwB,MAAM,qCAAqC;AAE1E,OAAO,MAAMC,kBAAkB,GAAGxB,aAAa,CAAE,CAAC,CAAE,CAAC;AAErD,SAASyB,mBAAmBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EAC5C,MAAM;IAAEC,sCAAsC,EAAEC;EAAyB,CAAC,GACzEtB,WAAW,CAAEI,SAAU,CAAC;EACzB,MAAM;IAAEmB;EAAe,CAAC,GAAGxB,SAAS,CAAIyB,MAAM,IAAM;IACnD,MAAM;MAAEC;IAAuC,CAAC,G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AW,CAACzF,GAAG,CAAI+F,UAAU,IACvDA,UAAU,CAACF,EAAE,KAAKA,EAAE,GACjB;QAAE,GAAGE,UAAU;QAAEC,IAAI,EAAE;UAAE,GAAGhC,QAAQ,EAAEgC;QAAK;MAAE,CAAC,GAC9CD,UACJ,CAAC;MACDL,kBAAkB,CAAEO,kBAAmB,CAAC;IACzC,CAAC,CAAC,OAAQC,CAAC,EAAG;MACb;MACAxB,OAAO,CAACL,KAAK,CAAE6B,CAAE,CAAC;MAClB,MAAMA,CAAC;IACR;EACD,CAAC;EAEDpJ,SAAS,CAAE,MAAM;IAChB6I,kBAAkB,CAAC,CAAC;EACrB,CAAC,EAAE,EAAG,CAAC;EAEP,OACCQ,aAAA,CAAC/H,kBAAkB,CAACgI,QAAQ;IAC3BC,KAAK,EAAG;MACPzF,mBAAmB;MACnBe,4BAA4B;MAC5BJ,UAAU;MACVT,cAAc;MACdU,WAAW;MACXE,eAAe;MACf+B,eAAe;MACfI,qBAAqB;MACrByB,iBAAiB;MACjBxB,WAAW;MACXS,aAAa;MACbW,kBAAkB;MAClBtC,wBAAwB;MACxBlC,YAAY;MACZuB,WAAW;MACX3C,cAAc;MACdmB,gBAAgB;MAChB5B,sBAAsB;MACtBe,kBAAkB;MAClBE,kBAAkB;MAClBZ,YAAY;MACZuG,WAAW;MACXG;IACD;EAAG,GAEDtH,QAC0B,CAAC;AAEhC;AAEA,eAAeD,mBAAmB"}
|
|
@@ -11,7 +11,7 @@ import { search, closeSmall } from '@wordpress/icons';
|
|
|
11
11
|
/**
|
|
12
12
|
* Internal dependencies
|
|
13
13
|
*/
|
|
14
|
-
import
|
|
14
|
+
import TabPanelLayout from './tab-panel-layout';
|
|
15
15
|
import { FontLibraryContext } from './context';
|
|
16
16
|
import FontsGrid from './fonts-grid';
|
|
17
17
|
import FontCard from './font-card';
|
|
@@ -41,7 +41,7 @@ function FontCollection({
|
|
|
41
41
|
const {
|
|
42
42
|
collections,
|
|
43
43
|
getFontCollection,
|
|
44
|
-
|
|
44
|
+
installFont
|
|
45
45
|
} = useContext(FontLibraryContext);
|
|
46
46
|
const selectedCollection = collections.find(collection => collection.id === id);
|
|
47
47
|
useEffect(() => {
|
|
@@ -72,6 +72,10 @@ function FontCollection({
|
|
|
72
72
|
setSelectedFont(null);
|
|
73
73
|
setNotice(null);
|
|
74
74
|
}, [id]);
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
// If the selected fonts change, reset the selected fonts to install
|
|
77
|
+
setFontsToInstall([]);
|
|
78
|
+
}, [selectedFont]);
|
|
75
79
|
|
|
76
80
|
// Reset notice after 5 seconds
|
|
77
81
|
useEffect(() => {
|
|
@@ -124,12 +128,12 @@ function FontCollection({
|
|
|
124
128
|
setFontsToInstall([]);
|
|
125
129
|
};
|
|
126
130
|
const handleInstall = async () => {
|
|
127
|
-
const response = await
|
|
131
|
+
const response = await installFont(fontsToInstall[0]);
|
|
128
132
|
const installNotice = getNoticeFromInstallResponse(response);
|
|
129
133
|
setNotice(installNotice);
|
|
130
134
|
resetFontsToInstall();
|
|
131
135
|
};
|
|
132
|
-
return createElement(
|
|
136
|
+
return createElement(TabPanelLayout, {
|
|
133
137
|
title: !selectedFont ? selectedCollection.name : selectedFont.name,
|
|
134
138
|
description: !selectedFont ? selectedCollection.description : __('Select font variants to install.'),
|
|
135
139
|
handleBack: !!selectedFont && handleUnselectFont,
|