@wordpress/edit-site 5.19.0 → 5.19.2
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/build/components/add-new-pattern/index.js +3 -3
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/block-editor/block-editor-provider/default-block-editor-provider.js +73 -0
- package/build/components/block-editor/block-editor-provider/default-block-editor-provider.js.map +1 -0
- package/build/components/block-editor/block-editor-provider/index.js +31 -0
- package/build/components/block-editor/block-editor-provider/index.js.map +1 -0
- package/build/components/block-editor/{providers → block-editor-provider}/navigation-block-editor-provider.js +2 -1
- package/build/components/block-editor/block-editor-provider/navigation-block-editor-provider.js.map +1 -0
- package/build/components/block-editor/block-editor-provider/use-page-content-blocks.js +76 -0
- package/build/components/block-editor/block-editor-provider/use-page-content-blocks.js.map +1 -0
- package/build/components/block-editor/index.js +2 -9
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/site-editor-canvas.js +1 -1
- package/build/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +8 -12
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/editor/index.js +4 -1
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/font-families.js +2 -1
- package/build/components/global-styles/font-families.js.map +1 -1
- package/build/components/global-styles/font-family-item.js +2 -2
- package/build/components/global-styles/font-family-item.js.map +1 -1
- package/build/components/global-styles/font-library-modal/collection-font-details.js +49 -0
- package/build/components/global-styles/font-library-modal/collection-font-details.js.map +1 -0
- package/build/components/global-styles/font-library-modal/collection-font-variant.js +55 -0
- package/build/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -0
- package/build/components/global-styles/font-library-modal/context.js +26 -2
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-card.js +7 -4
- package/build/components/global-styles/font-library-modal/font-card.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +172 -0
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -0
- package/build/components/global-styles/font-library-modal/font-demo.js +30 -13
- package/build/components/global-styles/font-library-modal/font-demo.js.map +1 -1
- package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +41 -0
- package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -0
- package/build/components/global-styles/font-library-modal/index.js +25 -7
- 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-card.js +0 -5
- package/build/components/global-styles/font-library-modal/library-font-card.js.map +1 -1
- package/build/components/global-styles/font-library-modal/library-font-details.js +2 -1
- package/build/components/global-styles/font-library-modal/library-font-details.js.map +1 -1
- package/build/components/global-styles/font-library-modal/resolvers.js +16 -0
- package/build/components/global-styles/font-library-modal/resolvers.js.map +1 -1
- package/build/components/global-styles/font-library-modal/tab-layout.js +2 -2
- package/build/components/global-styles/font-library-modal/tab-layout.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/constants.js +1 -7
- package/build/components/global-styles/font-library-modal/utils/constants.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/filter-fonts.js +21 -0
- package/build/components/global-styles/font-library-modal/utils/filter-fonts.js.map +1 -0
- package/build/components/global-styles/font-library-modal/utils/fonts-outline.js +20 -0
- package/build/components/global-styles/font-library-modal/utils/fonts-outline.js.map +1 -0
- package/build/components/global-styles/font-library-modal/utils/index.js +2 -52
- package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/preview-styles.js +76 -0
- package/build/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -0
- package/build/components/global-styles/font-library-modal/utils/sort-font-faces.js +36 -0
- package/build/components/global-styles/font-library-modal/utils/sort-font-faces.js.map +1 -0
- package/build/components/global-styles/screen-typography.js +1 -1
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/header-edit-mode/document-actions/index.js +9 -8
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +4 -1
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/layout/index.js +5 -1
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/added-by.js +13 -8
- package/build/components/list/added-by.js.map +1 -1
- package/build/components/list/index.js +2 -1
- package/build/components/list/index.js.map +1 -1
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js +2 -3
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
- package/build/components/page-patterns/duplicate-menu-item.js +5 -5
- package/build/components/page-patterns/duplicate-menu-item.js.map +1 -1
- package/build/components/page-patterns/grid-item.js +5 -5
- package/build/components/page-patterns/grid-item.js.map +1 -1
- package/build/components/page-patterns/index.js +1 -1
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/search-items.js +1 -1
- package/build/components/page-patterns/search-items.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +28 -34
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-template-parts/add-new-template-part.js +3 -2
- package/build/components/page-template-parts/add-new-template-part.js.map +1 -1
- package/build/components/page-template-parts/index.js +2 -1
- package/build/components/page-template-parts/index.js.map +1 -1
- package/build/components/page-templates/index.js +3 -2
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/save-hub/index.js +2 -1
- package/build/components/save-hub/index.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +24 -17
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/edit-template.js +21 -3
- package/build/components/sidebar-edit-mode/page-panels/edit-template.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/hooks.js +2 -1
- package/build/components/sidebar-edit-mode/page-panels/hooks.js.map +1 -1
- package/build/components/sidebar-edit-mode/settings-header/index.js +2 -6
- package/build/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-panel/pattern-categories.js +9 -2
- package/build/components/sidebar-edit-mode/template-panel/pattern-categories.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js +2 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +2 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +3 -2
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/page-details.js +2 -1
- package/build/components/sidebar-navigation-screen-page/page-details.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pages/index.js +5 -4
- package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/index.js +2 -1
- package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js +3 -2
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +2 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +2 -1
- package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +8 -7
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +3 -3
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +7 -2
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +7 -2
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/home-template-details.js +2 -1
- package/build/components/sidebar-navigation-screen-template/home-template-details.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +4 -3
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +3 -2
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/start-template-options/index.js +20 -2
- package/build/components/start-template-options/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +5 -4
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +4 -3
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/template-actions/index.js +2 -1
- package/build/components/template-actions/index.js.map +1 -1
- package/build/components/template-actions/rename-menu-item.js +8 -3
- package/build/components/template-actions/rename-menu-item.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +4 -3
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/hooks/navigation-menu-edit.js +2 -1
- package/build/hooks/navigation-menu-edit.js.map +1 -1
- package/build/hooks/template-part-edit.js +2 -1
- package/build/hooks/template-part-edit.js.map +1 -1
- package/build/store/actions.js +10 -9
- package/build/store/actions.js.map +1 -1
- package/build/store/constants.js +1 -9
- package/build/store/constants.js.map +1 -1
- package/build/store/private-actions.js +21 -1
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +23 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +19 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +3 -2
- package/build/store/selectors.js.map +1 -1
- package/build/utils/constants.js +22 -3
- package/build/utils/constants.js.map +1 -1
- package/build/utils/is-template-removable.js +1 -1
- package/build/utils/is-template-removable.js.map +1 -1
- package/build/utils/is-template-revertable.js +1 -1
- package/build/utils/is-template-revertable.js.map +1 -1
- package/build/utils/template-part-create.js +6 -1
- package/build/utils/template-part-create.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +3 -3
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/block-editor/block-editor-provider/default-block-editor-provider.js +65 -0
- package/build-module/components/block-editor/block-editor-provider/default-block-editor-provider.js.map +1 -0
- package/build-module/components/block-editor/block-editor-provider/index.js +23 -0
- package/build-module/components/block-editor/block-editor-provider/index.js.map +1 -0
- package/build-module/components/block-editor/{providers → block-editor-provider}/navigation-block-editor-provider.js +2 -1
- package/build-module/components/block-editor/block-editor-provider/navigation-block-editor-provider.js.map +1 -0
- package/build-module/components/block-editor/block-editor-provider/use-page-content-blocks.js +70 -0
- package/build-module/components/block-editor/block-editor-provider/use-page-content-blocks.js.map +1 -0
- package/build-module/components/block-editor/index.js +1 -8
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/site-editor-canvas.js +2 -2
- package/build-module/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +8 -12
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/editor/index.js +4 -1
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/font-families.js +3 -2
- package/build-module/components/global-styles/font-families.js.map +1 -1
- package/build-module/components/global-styles/font-family-item.js +2 -2
- package/build-module/components/global-styles/font-family-item.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/collection-font-details.js +40 -0
- package/build-module/components/global-styles/font-library-modal/collection-font-details.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/collection-font-variant.js +45 -0
- package/build-module/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/context.js +27 -3
- package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-card.js +8 -5
- package/build-module/components/global-styles/font-library-modal/font-card.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js +164 -0
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/font-demo.js +30 -13
- package/build-module/components/global-styles/font-library-modal/font-demo.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +33 -0
- package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/index.js +26 -7
- 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-card.js +0 -5
- package/build-module/components/global-styles/font-library-modal/library-font-card.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/library-font-details.js +2 -1
- package/build-module/components/global-styles/font-library-modal/library-font-details.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/resolvers.js +14 -0
- 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 +2 -2
- package/build-module/components/global-styles/font-library-modal/tab-layout.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/constants.js +1 -6
- package/build-module/components/global-styles/font-library-modal/utils/constants.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/filter-fonts.js +15 -0
- package/build-module/components/global-styles/font-library-modal/utils/filter-fonts.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/utils/fonts-outline.js +13 -0
- package/build-module/components/global-styles/font-library-modal/utils/fonts-outline.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/utils/index.js +2 -51
- package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js +68 -0
- package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/utils/sort-font-faces.js +30 -0
- package/build-module/components/global-styles/font-library-modal/utils/sort-font-faces.js.map +1 -0
- package/build-module/components/global-styles/screen-typography.js +1 -1
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +9 -8
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +4 -1
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/layout/index.js +5 -1
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/added-by.js +13 -8
- package/build-module/components/list/added-by.js.map +1 -1
- package/build-module/components/list/index.js +2 -1
- package/build-module/components/list/index.js.map +1 -1
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js +2 -3
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
- package/build-module/components/page-patterns/duplicate-menu-item.js +5 -5
- package/build-module/components/page-patterns/duplicate-menu-item.js.map +1 -1
- package/build-module/components/page-patterns/grid-item.js +5 -5
- package/build-module/components/page-patterns/grid-item.js.map +1 -1
- package/build-module/components/page-patterns/index.js +1 -1
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/search-items.js +2 -2
- package/build-module/components/page-patterns/search-items.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +28 -35
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-template-parts/add-new-template-part.js +3 -2
- package/build-module/components/page-template-parts/add-new-template-part.js.map +1 -1
- package/build-module/components/page-template-parts/index.js +2 -1
- package/build-module/components/page-template-parts/index.js.map +1 -1
- package/build-module/components/page-templates/index.js +3 -2
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/save-hub/index.js +2 -1
- package/build-module/components/save-hub/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +26 -19
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js +21 -3
- package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/hooks.js +2 -1
- package/build-module/components/sidebar-edit-mode/page-panels/hooks.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/settings-header/index.js +2 -6
- package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/pattern-categories.js +9 -2
- package/build-module/components/sidebar-edit-mode/template-panel/pattern-categories.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js +2 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +3 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +3 -2
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/page-details.js +2 -1
- package/build-module/components/sidebar-navigation-screen-page/page-details.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pages/index.js +5 -4
- package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/index.js +2 -1
- package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js +3 -2
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +2 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +2 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +8 -7
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +4 -4
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +8 -3
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +7 -2
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/home-template-details.js +2 -1
- package/build-module/components/sidebar-navigation-screen-template/home-template-details.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +4 -3
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +3 -2
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +20 -2
- package/build-module/components/start-template-options/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +5 -4
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +4 -3
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/template-actions/index.js +2 -1
- package/build-module/components/template-actions/index.js.map +1 -1
- package/build-module/components/template-actions/rename-menu-item.js +8 -3
- package/build-module/components/template-actions/rename-menu-item.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +4 -3
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/hooks/navigation-menu-edit.js +2 -1
- package/build-module/hooks/navigation-menu-edit.js.map +1 -1
- package/build-module/hooks/template-part-edit.js +2 -1
- package/build-module/hooks/template-part-edit.js.map +1 -1
- package/build-module/store/actions.js +10 -10
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/constants.js +0 -4
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/private-actions.js +19 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +22 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +18 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +3 -3
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/constants.js +17 -1
- package/build-module/utils/constants.js.map +1 -1
- package/build-module/utils/is-template-removable.js +2 -2
- package/build-module/utils/is-template-removable.js.map +1 -1
- package/build-module/utils/is-template-revertable.js +2 -2
- package/build-module/utils/is-template-revertable.js.map +1 -1
- package/build-module/utils/template-part-create.js +6 -1
- package/build-module/utils/template-part-create.js.map +1 -1
- package/build-style/style-rtl.css +23 -0
- package/build-style/style.css +23 -0
- package/package.json +40 -40
- package/src/components/add-new-pattern/index.js +3 -3
- package/src/components/block-editor/block-editor-provider/default-block-editor-provider.js +70 -0
- package/src/components/block-editor/block-editor-provider/index.js +29 -0
- package/src/components/block-editor/{providers → block-editor-provider}/navigation-block-editor-provider.js +2 -1
- package/src/components/block-editor/block-editor-provider/test/use-page-content-blocks.js +87 -0
- package/src/components/block-editor/block-editor-provider/use-page-content-blocks.js +77 -0
- package/src/components/block-editor/index.js +1 -14
- package/src/components/block-editor/site-editor-canvas.js +5 -2
- package/src/components/create-template-part-modal/index.js +11 -12
- package/src/components/editor/index.js +6 -2
- package/src/components/global-styles/font-families.js +5 -1
- package/src/components/global-styles/font-family-item.js +2 -2
- package/src/components/global-styles/font-library-modal/collection-font-details.js +56 -0
- package/src/components/global-styles/font-library-modal/collection-font-variant.js +45 -0
- package/src/components/global-styles/font-library-modal/context.js +33 -2
- package/src/components/global-styles/font-library-modal/font-card.js +9 -4
- package/src/components/global-styles/font-library-modal/font-collection.js +257 -0
- package/src/components/global-styles/font-library-modal/font-demo.js +36 -10
- package/src/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +50 -0
- package/src/components/global-styles/font-library-modal/index.js +30 -5
- package/src/components/global-styles/font-library-modal/installed-fonts.js +1 -1
- package/src/components/global-styles/font-library-modal/library-font-card.js +1 -8
- package/src/components/global-styles/font-library-modal/library-font-details.js +2 -3
- package/src/components/global-styles/font-library-modal/resolvers.js +16 -0
- package/src/components/global-styles/font-library-modal/style.scss +26 -0
- package/src/components/global-styles/font-library-modal/tab-layout.js +2 -2
- package/src/components/global-styles/font-library-modal/utils/constants.js +1 -9
- package/src/components/global-styles/font-library-modal/utils/filter-fonts.js +18 -0
- package/src/components/global-styles/font-library-modal/utils/fonts-outline.js +21 -0
- package/src/components/global-styles/font-library-modal/utils/index.js +9 -69
- package/src/components/global-styles/font-library-modal/utils/preview-styles.js +86 -0
- package/src/components/global-styles/font-library-modal/utils/sort-font-faces.js +33 -0
- package/src/components/global-styles/font-library-modal/utils/test/filter-fonts.spec.js +69 -0
- package/src/components/global-styles/font-library-modal/utils/test/fonts-outline.spec.js +109 -0
- package/src/components/global-styles/font-library-modal/utils/test/{getPreviewStyle.spec.js → preview-styles.spec.js} +49 -9
- package/src/components/global-styles/font-library-modal/utils/test/sort-font-faces.js +74 -0
- package/src/components/global-styles/screen-typography.js +4 -1
- package/src/components/header-edit-mode/document-actions/index.js +17 -8
- package/src/components/header-edit-mode/index.js +2 -1
- package/src/components/layout/index.js +10 -1
- package/src/components/list/added-by.js +29 -11
- package/src/components/list/index.js +7 -1
- package/src/components/page-content-focus-manager/disable-non-page-content-blocks.js +2 -8
- package/src/components/page-patterns/duplicate-menu-item.js +5 -5
- package/src/components/page-patterns/grid-item.js +5 -5
- package/src/components/page-patterns/index.js +1 -1
- package/src/components/page-patterns/search-items.js +7 -1
- package/src/components/page-patterns/use-patterns.js +190 -134
- package/src/components/page-template-parts/add-new-template-part.js +5 -2
- package/src/components/page-template-parts/index.js +2 -1
- package/src/components/page-templates/index.js +3 -2
- package/src/components/save-hub/index.js +2 -1
- package/src/components/secondary-sidebar/list-view-sidebar.js +31 -26
- package/src/components/sidebar-edit-mode/page-panels/edit-template.js +48 -20
- package/src/components/sidebar-edit-mode/page-panels/hooks.js +9 -4
- package/src/components/sidebar-edit-mode/page-panels/style.scss +6 -0
- package/src/components/sidebar-edit-mode/settings-header/index.js +4 -7
- package/src/components/sidebar-edit-mode/template-panel/pattern-categories.js +9 -2
- package/src/components/sidebar-navigation-screen-navigation-menu/edit-button.js +2 -1
- package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +3 -1
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +3 -2
- package/src/components/sidebar-navigation-screen-page/page-details.js +2 -1
- package/src/components/sidebar-navigation-screen-pages/index.js +5 -4
- package/src/components/sidebar-navigation-screen-pattern/index.js +2 -1
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js +8 -2
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +7 -1
- package/src/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +2 -1
- package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +18 -8
- package/src/components/sidebar-navigation-screen-patterns/index.js +8 -4
- package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +16 -3
- package/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +12 -2
- package/src/components/sidebar-navigation-screen-template/home-template-details.js +2 -1
- package/src/components/sidebar-navigation-screen-templates/index.js +4 -3
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +6 -2
- package/src/components/start-template-options/index.js +39 -2
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +10 -4
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +8 -3
- package/src/components/template-actions/index.js +2 -1
- package/src/components/template-actions/rename-menu-item.js +8 -3
- package/src/hooks/commands/use-edit-mode-commands.js +4 -3
- package/src/hooks/navigation-menu-edit.js +2 -1
- package/src/hooks/template-part-edit.js +2 -1
- package/src/store/actions.js +18 -10
- package/src/store/constants.js +0 -5
- package/src/store/private-actions.js +19 -0
- package/src/store/private-selectors.js +22 -0
- package/src/store/reducer.js +18 -0
- package/src/store/selectors.js +6 -3
- package/src/store/test/reducer.js +18 -0
- package/src/utils/constants.js +17 -1
- package/src/utils/is-template-removable.js +2 -2
- package/src/utils/is-template-revertable.js +2 -2
- package/src/utils/template-part-create.js +6 -1
- package/build/components/block-editor/get-block-editor-provider.js +0 -35
- package/build/components/block-editor/get-block-editor-provider.js.map +0 -1
- package/build/components/block-editor/providers/default-block-editor-provider.js +0 -49
- package/build/components/block-editor/providers/default-block-editor-provider.js.map +0 -1
- package/build/components/block-editor/providers/navigation-block-editor-provider.js.map +0 -1
- package/build-module/components/block-editor/get-block-editor-provider.js +0 -28
- package/build-module/components/block-editor/get-block-editor-provider.js.map +0 -1
- package/build-module/components/block-editor/providers/default-block-editor-provider.js +0 -41
- package/build-module/components/block-editor/providers/default-block-editor-provider.js.map +0 -1
- package/build-module/components/block-editor/providers/navigation-block-editor-provider.js.map +0 -1
- package/src/components/block-editor/get-block-editor-provider.js +0 -29
- package/src/components/block-editor/providers/default-block-editor-provider.js +0 -44
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_constants","require","isTemplateRevertable","template","source","
|
|
1
|
+
{"version":3,"names":["_constants","require","isTemplateRevertable","template","source","TEMPLATE_ORIGINS","custom","has_theme_file"],"sources":["@wordpress/edit-site/src/utils/is-template-revertable.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { TEMPLATE_ORIGINS } from './constants';\n\n/**\n * Check if a template is revertable to its original theme-provided template file.\n *\n * @param {Object} template The template entity to check.\n * @return {boolean} Whether the template is revertable.\n */\nexport default function isTemplateRevertable( template ) {\n\tif ( ! template ) {\n\t\treturn false;\n\t}\n\t/* eslint-disable camelcase */\n\treturn (\n\t\ttemplate?.source === TEMPLATE_ORIGINS.custom && template?.has_theme_file\n\t);\n\t/* eslint-enable camelcase */\n}\n"],"mappings":";;;;;;AAGA,IAAAA,UAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,oBAAoBA,CAAEC,QAAQ,EAAG;EACxD,IAAK,CAAEA,QAAQ,EAAG;IACjB,OAAO,KAAK;EACb;EACA;EACA,OACCA,QAAQ,EAAEC,MAAM,KAAKC,2BAAgB,CAACC,MAAM,IAAIH,QAAQ,EAAEI,cAAc;EAEzE;AACD"}
|
|
@@ -7,6 +7,7 @@ exports.useExistingTemplateParts = exports.getUniqueTemplatePartTitle = exports.
|
|
|
7
7
|
var _changeCase = require("change-case");
|
|
8
8
|
var _data = require("@wordpress/data");
|
|
9
9
|
var _coreData = require("@wordpress/core-data");
|
|
10
|
+
var _constants = require("./constants");
|
|
10
11
|
/**
|
|
11
12
|
* External dependencies
|
|
12
13
|
*/
|
|
@@ -15,8 +16,12 @@ var _coreData = require("@wordpress/core-data");
|
|
|
15
16
|
* WordPress dependencies
|
|
16
17
|
*/
|
|
17
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Internal dependencies
|
|
21
|
+
*/
|
|
22
|
+
|
|
18
23
|
const useExistingTemplateParts = () => {
|
|
19
|
-
return (0, _data.useSelect)(select => select(_coreData.store).getEntityRecords('postType',
|
|
24
|
+
return (0, _data.useSelect)(select => select(_coreData.store).getEntityRecords('postType', _constants.TEMPLATE_PART_POST_TYPE, {
|
|
20
25
|
per_page: -1
|
|
21
26
|
}), []);
|
|
22
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_changeCase","require","_data","_coreData","useExistingTemplateParts","useSelect","select","coreStore","getEntityRecords","per_page","exports","getUniqueTemplatePartTitle","title","templateParts","lowercaseTitle","toLowerCase","existingTitles","map","templatePart","rendered","includes","suffix","getCleanTemplatePartSlug","kebabCase","replace"],"sources":["@wordpress/edit-site/src/utils/template-part-create.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { paramCase as kebabCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\nexport const useExistingTemplateParts = () => {\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\
|
|
1
|
+
{"version":3,"names":["_changeCase","require","_data","_coreData","_constants","useExistingTemplateParts","useSelect","select","coreStore","getEntityRecords","TEMPLATE_PART_POST_TYPE","per_page","exports","getUniqueTemplatePartTitle","title","templateParts","lowercaseTitle","toLowerCase","existingTitles","map","templatePart","rendered","includes","suffix","getCleanTemplatePartSlug","kebabCase","replace"],"sources":["@wordpress/edit-site/src/utils/template-part-create.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { paramCase as kebabCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_PART_POST_TYPE } from './constants';\n\nexport const useExistingTemplateParts = () => {\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t\t{\n\t\t\t\t\tper_page: -1,\n\t\t\t\t}\n\t\t\t),\n\t\t[]\n\t);\n};\n\n/**\n * Return a unique template part title based on\n * the given title and existing template parts.\n *\n * @param {string} title The original template part title.\n * @param {Object} templateParts The array of template part entities.\n * @return {string} A unique template part title.\n */\nexport const getUniqueTemplatePartTitle = ( title, templateParts ) => {\n\tconst lowercaseTitle = title.toLowerCase();\n\tconst existingTitles = templateParts.map( ( templatePart ) =>\n\t\ttemplatePart.title.rendered.toLowerCase()\n\t);\n\n\tif ( ! existingTitles.includes( lowercaseTitle ) ) {\n\t\treturn title;\n\t}\n\n\tlet suffix = 2;\n\twhile ( existingTitles.includes( `${ lowercaseTitle } ${ suffix }` ) ) {\n\t\tsuffix++;\n\t}\n\n\treturn `${ title } ${ suffix }`;\n};\n\n/**\n * Get a valid slug for a template part.\n * Currently template parts only allow latin chars.\n * The fallback slug will receive suffix by default.\n *\n * @param {string} title The template part title.\n * @return {string} A valid template part slug.\n */\nexport const getCleanTemplatePartSlug = ( title ) => {\n\treturn kebabCase( title ).replace( /[^\\w-]+/g, '' ) || 'wp-custom-part';\n};\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAKA,IAAAG,UAAA,GAAAH,OAAA;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;;AAGO,MAAMI,wBAAwB,GAAGA,CAAA,KAAM;EAC7C,OAAO,IAAAC,eAAS,EACbC,MAAM,IACPA,MAAM,CAAEC,eAAU,CAAC,CAACC,gBAAgB,CACnC,UAAU,EACVC,kCAAuB,EACvB;IACCC,QAAQ,EAAE,CAAC;EACZ,CACD,CAAC,EACF,EACD,CAAC;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPAC,OAAA,CAAAP,wBAAA,GAAAA,wBAAA;AAQO,MAAMQ,0BAA0B,GAAGA,CAAEC,KAAK,EAAEC,aAAa,KAAM;EACrE,MAAMC,cAAc,GAAGF,KAAK,CAACG,WAAW,CAAC,CAAC;EAC1C,MAAMC,cAAc,GAAGH,aAAa,CAACI,GAAG,CAAIC,YAAY,IACvDA,YAAY,CAACN,KAAK,CAACO,QAAQ,CAACJ,WAAW,CAAC,CACzC,CAAC;EAED,IAAK,CAAEC,cAAc,CAACI,QAAQ,CAAEN,cAAe,CAAC,EAAG;IAClD,OAAOF,KAAK;EACb;EAEA,IAAIS,MAAM,GAAG,CAAC;EACd,OAAQL,cAAc,CAACI,QAAQ,CAAG,GAAGN,cAAgB,IAAIO,MAAQ,EAAE,CAAC,EAAG;IACtEA,MAAM,EAAE;EACT;EAEA,OAAQ,GAAGT,KAAO,IAAIS,MAAQ,EAAC;AAChC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPAX,OAAA,CAAAC,0BAAA,GAAAA,0BAAA;AAQO,MAAMW,wBAAwB,GAAKV,KAAK,IAAM;EACpD,OAAO,IAAAW,qBAAS,EAAEX,KAAM,CAAC,CAACY,OAAO,CAAE,UAAU,EAAE,EAAG,CAAC,IAAI,gBAAgB;AACxE,CAAC;AAACd,OAAA,CAAAY,wBAAA,GAAAA,wBAAA"}
|
|
@@ -56,8 +56,8 @@ export default function AddNewPattern() {
|
|
|
56
56
|
setShowPatternModal(false);
|
|
57
57
|
history.push({
|
|
58
58
|
postId: pattern.id,
|
|
59
|
-
postType:
|
|
60
|
-
categoryType:
|
|
59
|
+
postType: PATTERN_TYPES.user,
|
|
60
|
+
categoryType: PATTERN_TYPES.user,
|
|
61
61
|
categoryId,
|
|
62
62
|
canvas: 'edit'
|
|
63
63
|
});
|
|
@@ -68,7 +68,7 @@ export default function AddNewPattern() {
|
|
|
68
68
|
// Navigate to the created template part editor.
|
|
69
69
|
history.push({
|
|
70
70
|
postId: templatePart.id,
|
|
71
|
-
postType:
|
|
71
|
+
postType: TEMPLATE_PART_POST_TYPE,
|
|
72
72
|
canvas: 'edit'
|
|
73
73
|
});
|
|
74
74
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DropdownMenu","useState","useRef","__","sprintf","plus","symbol","symbolFilled","useSelect","useDispatch","privateApis","routerPrivateApis","editPatternsPrivateApis","store","patternsStore","noticesStore","CreateTemplatePartModal","SidebarButton","unlock","editSiteStore","PATTERN_TYPES","PATTERN_DEFAULT_CATEGORY","TEMPLATE_PART_POST_TYPE","usePatternCategories","useHistory","useLocation","CreatePatternModal","AddNewPattern","history","params","showPatternModal","setShowPatternModal","showTemplatePartModal","setShowTemplatePartModal","isTemplatePartsMode","select","settings","getSettings","supportsTemplatePartsMode","createPatternFromFile","createSuccessNotice","createErrorNotice","patternUploadInputRef","patternCategories","handleCreatePattern","pattern","categoryId","push","postId","id","postType","categoryType","canvas","handleCreateTemplatePart","templatePart","handleError","controls","icon","onClick","title","current","click","createElement","Fragment","toggleProps","as","label","onClose","onSuccess","onError","closeModal","blocks","onCreate","type","accept","hidden","ref","onChange","event","file","target","files","currentCategoryId","find","category","name","undefined","path","theme","raw","err","message","value"],"sources":["@wordpress/edit-site/src/components/add-new-pattern/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { DropdownMenu } from '@wordpress/components';\nimport { useState, useRef } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { plus, symbol, symbolFilled } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport {\n\tprivateApis as editPatternsPrivateApis,\n\tstore as patternsStore,\n} from '@wordpress/patterns';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport CreateTemplatePartModal from '../create-template-part-modal';\nimport SidebarButton from '../sidebar-button';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport {\n\tPATTERN_TYPES,\n\tPATTERN_DEFAULT_CATEGORY,\n\tTEMPLATE_PART_POST_TYPE,\n} from '../../utils/constants';\nimport usePatternCategories from '../sidebar-navigation-screen-patterns/use-pattern-categories';\n\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\nconst { CreatePatternModal } = unlock( editPatternsPrivateApis );\n\nexport default function AddNewPattern() {\n\tconst history = useHistory();\n\tconst { params } = useLocation();\n\tconst [ showPatternModal, setShowPatternModal ] = useState( false );\n\tconst [ showTemplatePartModal, setShowTemplatePartModal ] =\n\t\tuseState( false );\n\tconst isTemplatePartsMode = useSelect( ( select ) => {\n\t\tconst settings = select( editSiteStore ).getSettings();\n\t\treturn !! settings.supportsTemplatePartsMode;\n\t}, [] );\n\tconst { createPatternFromFile } = unlock( useDispatch( patternsStore ) );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst patternUploadInputRef = useRef();\n\tconst { patternCategories } = usePatternCategories();\n\n\tfunction handleCreatePattern( { pattern, categoryId } ) {\n\t\tsetShowPatternModal( false );\n\n\t\thistory.push( {\n\t\t\tpostId: pattern.id,\n\t\t\tpostType: 'wp_block',\n\t\t\tcategoryType: 'wp_block',\n\t\t\tcategoryId,\n\t\t\tcanvas: 'edit',\n\t\t} );\n\t}\n\n\tfunction handleCreateTemplatePart( templatePart ) {\n\t\tsetShowTemplatePartModal( false );\n\n\t\t// Navigate to the created template part editor.\n\t\thistory.push( {\n\t\t\tpostId: templatePart.id,\n\t\t\tpostType: 'wp_template_part',\n\t\t\tcanvas: 'edit',\n\t\t} );\n\t}\n\n\tfunction handleError() {\n\t\tsetShowPatternModal( false );\n\t\tsetShowTemplatePartModal( false );\n\t}\n\n\tconst controls = [\n\t\t{\n\t\t\ticon: symbol,\n\t\t\tonClick: () => setShowPatternModal( true ),\n\t\t\ttitle: __( 'Create pattern' ),\n\t\t},\n\t];\n\n\t// Remove condition when command palette issues are resolved.\n\t// See: https://github.com/WordPress/gutenberg/issues/52154.\n\tif ( ! isTemplatePartsMode ) {\n\t\tcontrols.push( {\n\t\t\ticon: symbolFilled,\n\t\t\tonClick: () => setShowTemplatePartModal( true ),\n\t\t\ttitle: __( 'Create template part' ),\n\t\t} );\n\t}\n\n\tcontrols.push( {\n\t\ticon: symbol,\n\t\tonClick: () => {\n\t\t\tpatternUploadInputRef.current.click();\n\t\t},\n\t\ttitle: __( 'Import pattern from JSON' ),\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<DropdownMenu\n\t\t\t\tcontrols={ controls }\n\t\t\t\ttoggleProps={ {\n\t\t\t\t\tas: SidebarButton,\n\t\t\t\t} }\n\t\t\t\ticon={ plus }\n\t\t\t\tlabel={ __( 'Create pattern' ) }\n\t\t\t/>\n\t\t\t{ showPatternModal && (\n\t\t\t\t<CreatePatternModal\n\t\t\t\t\tonClose={ () => setShowPatternModal( false ) }\n\t\t\t\t\tonSuccess={ handleCreatePattern }\n\t\t\t\t\tonError={ handleError }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ showTemplatePartModal && (\n\t\t\t\t<CreateTemplatePartModal\n\t\t\t\t\tcloseModal={ () => setShowTemplatePartModal( false ) }\n\t\t\t\t\tblocks={ [] }\n\t\t\t\t\tonCreate={ handleCreateTemplatePart }\n\t\t\t\t\tonError={ handleError }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t<input\n\t\t\t\ttype=\"file\"\n\t\t\t\taccept=\".json\"\n\t\t\t\thidden\n\t\t\t\tref={ patternUploadInputRef }\n\t\t\t\tonChange={ async ( event ) => {\n\t\t\t\t\tconst file = event.target.files?.[ 0 ];\n\t\t\t\t\tif ( ! file ) return;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst currentCategoryId =\n\t\t\t\t\t\t\tparams.categoryType !== TEMPLATE_PART_POST_TYPE &&\n\t\t\t\t\t\t\tpatternCategories.find(\n\t\t\t\t\t\t\t\t( category ) =>\n\t\t\t\t\t\t\t\t\tcategory.name === params.categoryId\n\t\t\t\t\t\t\t)?.id;\n\t\t\t\t\t\tconst pattern = await createPatternFromFile(\n\t\t\t\t\t\t\tfile,\n\t\t\t\t\t\t\tcurrentCategoryId\n\t\t\t\t\t\t\t\t? [ currentCategoryId ]\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t// Navigate to the All patterns category for the newly created pattern\n\t\t\t\t\t\t// if we're not on that page already.\n\t\t\t\t\t\tif ( ! currentCategoryId ) {\n\t\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\t\tpath: `/patterns`,\n\t\t\t\t\t\t\t\tcategoryType: PATTERN_TYPES.theme,\n\t\t\t\t\t\t\t\tcategoryId: PATTERN_DEFAULT_CATEGORY,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// translators: %s: The imported pattern's title.\n\t\t\t\t\t\t\t\t__( 'Imported \"%s\" from JSON.' ),\n\t\t\t\t\t\t\t\tpattern.title.raw\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'import-pattern-success',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t} catch ( err ) {\n\t\t\t\t\t\tcreateErrorNotice( err.message, {\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\tid: 'import-pattern-error',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tevent.target.value = '';\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,uBAAuB;AACpD,SAASC,QAAQ,EAAEC,MAAM,QAAQ,oBAAoB;AACrD,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,IAAI,EAAEC,MAAM,EAAEC,YAAY,QAAQ,kBAAkB;AAC7D,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SACCD,WAAW,IAAIE,uBAAuB,EACtCC,KAAK,IAAIC,aAAa,QAChB,qBAAqB;AAC5B,SAASD,KAAK,IAAIE,YAAY,QAAQ,oBAAoB;;AAE1D;AACA;AACA;AACA,OAAOC,uBAAuB,MAAM,+BAA+B;AACnE,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASL,KAAK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B,mBAAmB,CAClBpC,OAAO;QACN;QACAD,EAAE,CAAE,0BAA2B,CAAC,EAChC0C,OAAO,CAACc,KAAK,CAAC8B,GACf,CAAC,EACD;UACChB,IAAI,EAAE,UAAU;UAChBxB,EAAE,EAAE;QACL,CACD,CAAC;MACF,CAAC,CAAC,OAAQyC,GAAG,EAAG;QACfjD,iBAAiB,CAAEiD,GAAG,CAACC,OAAO,EAAE;UAC/BlB,IAAI,EAAE,UAAU;UAChBxB,EAAE,EAAE;QACL,CAAE,CAAC;MACJ,CAAC,SAAS;QACT6B,KAAK,CAACE,MAAM,CAACY,KAAK,GAAG,EAAE;MACxB;IACD;EAAG,CACH,CACA,CAAC;AAEL"}
|
|
1
|
+
{"version":3,"names":["DropdownMenu","useState","useRef","__","sprintf","plus","symbol","symbolFilled","useSelect","useDispatch","privateApis","routerPrivateApis","editPatternsPrivateApis","store","patternsStore","noticesStore","CreateTemplatePartModal","SidebarButton","unlock","editSiteStore","PATTERN_TYPES","PATTERN_DEFAULT_CATEGORY","TEMPLATE_PART_POST_TYPE","usePatternCategories","useHistory","useLocation","CreatePatternModal","AddNewPattern","history","params","showPatternModal","setShowPatternModal","showTemplatePartModal","setShowTemplatePartModal","isTemplatePartsMode","select","settings","getSettings","supportsTemplatePartsMode","createPatternFromFile","createSuccessNotice","createErrorNotice","patternUploadInputRef","patternCategories","handleCreatePattern","pattern","categoryId","push","postId","id","postType","user","categoryType","canvas","handleCreateTemplatePart","templatePart","handleError","controls","icon","onClick","title","current","click","createElement","Fragment","toggleProps","as","label","onClose","onSuccess","onError","closeModal","blocks","onCreate","type","accept","hidden","ref","onChange","event","file","target","files","currentCategoryId","find","category","name","undefined","path","theme","raw","err","message","value"],"sources":["@wordpress/edit-site/src/components/add-new-pattern/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { DropdownMenu } from '@wordpress/components';\nimport { useState, useRef } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { plus, symbol, symbolFilled } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport {\n\tprivateApis as editPatternsPrivateApis,\n\tstore as patternsStore,\n} from '@wordpress/patterns';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport CreateTemplatePartModal from '../create-template-part-modal';\nimport SidebarButton from '../sidebar-button';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport {\n\tPATTERN_TYPES,\n\tPATTERN_DEFAULT_CATEGORY,\n\tTEMPLATE_PART_POST_TYPE,\n} from '../../utils/constants';\nimport usePatternCategories from '../sidebar-navigation-screen-patterns/use-pattern-categories';\n\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\nconst { CreatePatternModal } = unlock( editPatternsPrivateApis );\n\nexport default function AddNewPattern() {\n\tconst history = useHistory();\n\tconst { params } = useLocation();\n\tconst [ showPatternModal, setShowPatternModal ] = useState( false );\n\tconst [ showTemplatePartModal, setShowTemplatePartModal ] =\n\t\tuseState( false );\n\tconst isTemplatePartsMode = useSelect( ( select ) => {\n\t\tconst settings = select( editSiteStore ).getSettings();\n\t\treturn !! settings.supportsTemplatePartsMode;\n\t}, [] );\n\tconst { createPatternFromFile } = unlock( useDispatch( patternsStore ) );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst patternUploadInputRef = useRef();\n\tconst { patternCategories } = usePatternCategories();\n\n\tfunction handleCreatePattern( { pattern, categoryId } ) {\n\t\tsetShowPatternModal( false );\n\n\t\thistory.push( {\n\t\t\tpostId: pattern.id,\n\t\t\tpostType: PATTERN_TYPES.user,\n\t\t\tcategoryType: PATTERN_TYPES.user,\n\t\t\tcategoryId,\n\t\t\tcanvas: 'edit',\n\t\t} );\n\t}\n\n\tfunction handleCreateTemplatePart( templatePart ) {\n\t\tsetShowTemplatePartModal( false );\n\n\t\t// Navigate to the created template part editor.\n\t\thistory.push( {\n\t\t\tpostId: templatePart.id,\n\t\t\tpostType: TEMPLATE_PART_POST_TYPE,\n\t\t\tcanvas: 'edit',\n\t\t} );\n\t}\n\n\tfunction handleError() {\n\t\tsetShowPatternModal( false );\n\t\tsetShowTemplatePartModal( false );\n\t}\n\n\tconst controls = [\n\t\t{\n\t\t\ticon: symbol,\n\t\t\tonClick: () => setShowPatternModal( true ),\n\t\t\ttitle: __( 'Create pattern' ),\n\t\t},\n\t];\n\n\t// Remove condition when command palette issues are resolved.\n\t// See: https://github.com/WordPress/gutenberg/issues/52154.\n\tif ( ! isTemplatePartsMode ) {\n\t\tcontrols.push( {\n\t\t\ticon: symbolFilled,\n\t\t\tonClick: () => setShowTemplatePartModal( true ),\n\t\t\ttitle: __( 'Create template part' ),\n\t\t} );\n\t}\n\n\tcontrols.push( {\n\t\ticon: symbol,\n\t\tonClick: () => {\n\t\t\tpatternUploadInputRef.current.click();\n\t\t},\n\t\ttitle: __( 'Import pattern from JSON' ),\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<DropdownMenu\n\t\t\t\tcontrols={ controls }\n\t\t\t\ttoggleProps={ {\n\t\t\t\t\tas: SidebarButton,\n\t\t\t\t} }\n\t\t\t\ticon={ plus }\n\t\t\t\tlabel={ __( 'Create pattern' ) }\n\t\t\t/>\n\t\t\t{ showPatternModal && (\n\t\t\t\t<CreatePatternModal\n\t\t\t\t\tonClose={ () => setShowPatternModal( false ) }\n\t\t\t\t\tonSuccess={ handleCreatePattern }\n\t\t\t\t\tonError={ handleError }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ showTemplatePartModal && (\n\t\t\t\t<CreateTemplatePartModal\n\t\t\t\t\tcloseModal={ () => setShowTemplatePartModal( false ) }\n\t\t\t\t\tblocks={ [] }\n\t\t\t\t\tonCreate={ handleCreateTemplatePart }\n\t\t\t\t\tonError={ handleError }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t<input\n\t\t\t\ttype=\"file\"\n\t\t\t\taccept=\".json\"\n\t\t\t\thidden\n\t\t\t\tref={ patternUploadInputRef }\n\t\t\t\tonChange={ async ( event ) => {\n\t\t\t\t\tconst file = event.target.files?.[ 0 ];\n\t\t\t\t\tif ( ! file ) return;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst currentCategoryId =\n\t\t\t\t\t\t\tparams.categoryType !== TEMPLATE_PART_POST_TYPE &&\n\t\t\t\t\t\t\tpatternCategories.find(\n\t\t\t\t\t\t\t\t( category ) =>\n\t\t\t\t\t\t\t\t\tcategory.name === params.categoryId\n\t\t\t\t\t\t\t)?.id;\n\t\t\t\t\t\tconst pattern = await createPatternFromFile(\n\t\t\t\t\t\t\tfile,\n\t\t\t\t\t\t\tcurrentCategoryId\n\t\t\t\t\t\t\t\t? [ currentCategoryId ]\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t// Navigate to the All patterns category for the newly created pattern\n\t\t\t\t\t\t// if we're not on that page already.\n\t\t\t\t\t\tif ( ! currentCategoryId ) {\n\t\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\t\tpath: `/patterns`,\n\t\t\t\t\t\t\t\tcategoryType: PATTERN_TYPES.theme,\n\t\t\t\t\t\t\t\tcategoryId: PATTERN_DEFAULT_CATEGORY,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// translators: %s: The imported pattern's title.\n\t\t\t\t\t\t\t\t__( 'Imported \"%s\" from JSON.' ),\n\t\t\t\t\t\t\t\tpattern.title.raw\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'import-pattern-success',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t} catch ( err ) {\n\t\t\t\t\t\tcreateErrorNotice( err.message, {\n\t\t\t\t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|
package/build-module/components/block-editor/block-editor-provider/default-block-editor-provider.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
/**
|
|
3
|
+
* WordPress dependencies
|
|
4
|
+
*/
|
|
5
|
+
import { useEntityBlockEditor } from '@wordpress/core-data';
|
|
6
|
+
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
7
|
+
import { useSelect } from '@wordpress/data';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
import { store as editSiteStore } from '../../../store';
|
|
13
|
+
import { unlock } from '../../../lock-unlock';
|
|
14
|
+
import useSiteEditorSettings from '../use-site-editor-settings';
|
|
15
|
+
import usePageContentBlocks from './use-page-content-blocks';
|
|
16
|
+
const {
|
|
17
|
+
ExperimentalBlockEditorProvider
|
|
18
|
+
} = unlock(blockEditorPrivateApis);
|
|
19
|
+
const noop = () => {};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The default block editor provider for the site editor. Typically used when
|
|
23
|
+
* the post type is `'wp_template_part'` or `'wp_template'` and allows editing
|
|
24
|
+
* of the template and its nested entities.
|
|
25
|
+
*
|
|
26
|
+
* If the page content focus type is `'hideTemplate'`, the provider will provide
|
|
27
|
+
* a set of page content blocks wrapped in a container that, together,
|
|
28
|
+
* mimic the look and feel of the post editor and
|
|
29
|
+
* allow editing of the page content only.
|
|
30
|
+
*
|
|
31
|
+
* @param {Object} props
|
|
32
|
+
* @param {WPElement} props.children
|
|
33
|
+
*/
|
|
34
|
+
export default function DefaultBlockEditorProvider({
|
|
35
|
+
children
|
|
36
|
+
}) {
|
|
37
|
+
const settings = useSiteEditorSettings();
|
|
38
|
+
const {
|
|
39
|
+
templateType,
|
|
40
|
+
isTemplateHidden
|
|
41
|
+
} = useSelect(select => {
|
|
42
|
+
const {
|
|
43
|
+
getEditedPostType
|
|
44
|
+
} = select(editSiteStore);
|
|
45
|
+
const {
|
|
46
|
+
getPageContentFocusType,
|
|
47
|
+
getCanvasMode
|
|
48
|
+
} = unlock(select(editSiteStore));
|
|
49
|
+
return {
|
|
50
|
+
templateType: getEditedPostType(),
|
|
51
|
+
isTemplateHidden: getCanvasMode() === 'edit' && getPageContentFocusType() === 'hideTemplate',
|
|
52
|
+
canvasMode: unlock(select(editSiteStore)).getCanvasMode()
|
|
53
|
+
};
|
|
54
|
+
}, []);
|
|
55
|
+
const [blocks, onInput, onChange] = useEntityBlockEditor('postType', templateType);
|
|
56
|
+
const pageContentBlock = usePageContentBlocks(blocks, isTemplateHidden);
|
|
57
|
+
return createElement(ExperimentalBlockEditorProvider, {
|
|
58
|
+
settings: settings,
|
|
59
|
+
value: isTemplateHidden && pageContentBlock.length ? pageContentBlock : blocks,
|
|
60
|
+
onInput: isTemplateHidden ? noop : onInput,
|
|
61
|
+
onChange: isTemplateHidden ? noop : onChange,
|
|
62
|
+
useSubRegistry: false
|
|
63
|
+
}, children);
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=default-block-editor-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEntityBlockEditor","privateApis","blockEditorPrivateApis","useSelect","store","editSiteStore","unlock","useSiteEditorSettings","usePageContentBlocks","ExperimentalBlockEditorProvider","noop","DefaultBlockEditorProvider","children","settings","templateType","isTemplateHidden","select","getEditedPostType","getPageContentFocusType","getCanvasMode","canvasMode","blocks","onInput","onChange","pageContentBlock","createElement","value","length","useSubRegistry"],"sources":["@wordpress/edit-site/src/components/block-editor/block-editor-provider/default-block-editor-provider.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityBlockEditor } from '@wordpress/core-data';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\nimport useSiteEditorSettings from '../use-site-editor-settings';\nimport usePageContentBlocks from './use-page-content-blocks';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\n\nconst noop = () => {};\n\n/**\n * The default block editor provider for the site editor. Typically used when\n * the post type is `'wp_template_part'` or `'wp_template'` and allows editing\n * of the template and its nested entities.\n *\n * If the page content focus type is `'hideTemplate'`, the provider will provide\n * a set of page content blocks wrapped in a container that, together,\n * mimic the look and feel of the post editor and\n * allow editing of the page content only.\n *\n * @param {Object} props\n * @param {WPElement} props.children\n */\nexport default function DefaultBlockEditorProvider( { children } ) {\n\tconst settings = useSiteEditorSettings();\n\n\tconst { templateType, isTemplateHidden } = useSelect( ( select ) => {\n\t\tconst { getEditedPostType } = select( editSiteStore );\n\t\tconst { getPageContentFocusType, getCanvasMode } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\treturn {\n\t\t\ttemplateType: getEditedPostType(),\n\t\t\tisTemplateHidden:\n\t\t\t\tgetCanvasMode() === 'edit' &&\n\t\t\t\tgetPageContentFocusType() === 'hideTemplate',\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t};\n\t}, [] );\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\ttemplateType\n\t);\n\tconst pageContentBlock = usePageContentBlocks( blocks, isTemplateHidden );\n\treturn (\n\t\t<ExperimentalBlockEditorProvider\n\t\t\tsettings={ settings }\n\t\t\tvalue={\n\t\t\t\tisTemplateHidden && pageContentBlock.length\n\t\t\t\t\t? pageContentBlock\n\t\t\t\t\t: blocks\n\t\t\t}\n\t\t\tonInput={ isTemplateHidden ? noop : onInput }\n\t\t\tonChange={ isTemplateHidden ? noop : onChange }\n\t\t\tuseSubRegistry={ false }\n\t\t>\n\t\t\t{ children }\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,oBAAoB,QAAQ,sBAAsB;AAC3D,SAASC,WAAW,IA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AAA,CAAChB,+BAA+B;IAC/BI,QAAQ,EAAGA,QAAU;IACrBa,KAAK,EACJX,gBAAgB,IAAIS,gBAAgB,CAACG,MAAM,GACxCH,gBAAgB,GAChBH,MACH;IACDC,OAAO,EAAGP,gBAAgB,GAAGL,IAAI,GAAGY,OAAS;IAC7CC,QAAQ,EAAGR,gBAAgB,GAAGL,IAAI,GAAGa,QAAU;IAC/CK,cAAc,EAAG;EAAO,GAEtBhB,QAC8B,CAAC;AAEpC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
/**
|
|
3
|
+
* WordPress dependencies
|
|
4
|
+
*/
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { store as editSiteStore } from '../../../store';
|
|
11
|
+
import DefaultBlockEditorProvider from './default-block-editor-provider';
|
|
12
|
+
import NavigationBlockEditorProvider from './navigation-block-editor-provider';
|
|
13
|
+
import { NAVIGATION_POST_TYPE } from '../../../utils/constants';
|
|
14
|
+
export default function BlockEditorProvider({
|
|
15
|
+
children
|
|
16
|
+
}) {
|
|
17
|
+
const entityType = useSelect(select => select(editSiteStore).getEditedPostType(), []);
|
|
18
|
+
if (entityType === NAVIGATION_POST_TYPE) {
|
|
19
|
+
return createElement(NavigationBlockEditorProvider, null, children);
|
|
20
|
+
}
|
|
21
|
+
return createElement(DefaultBlockEditorProvider, null, children);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useSelect","store","editSiteStore","DefaultBlockEditorProvider","NavigationBlockEditorProvider","NAVIGATION_POST_TYPE","BlockEditorProvider","children","entityType","select","getEditedPostType","createElement"],"sources":["@wordpress/edit-site/src/components/block-editor/block-editor-provider/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\nimport DefaultBlockEditorProvider from './default-block-editor-provider';\nimport NavigationBlockEditorProvider from './navigation-block-editor-provider';\nimport { NAVIGATION_POST_TYPE } from '../../../utils/constants';\n\nexport default function BlockEditorProvider( { children } ) {\n\tconst entityType = useSelect(\n\t\t( select ) => select( editSiteStore ).getEditedPostType(),\n\t\t[]\n\t);\n\tif ( entityType === NAVIGATION_POST_TYPE ) {\n\t\treturn (\n\t\t\t<NavigationBlockEditorProvider>\n\t\t\t\t{ children }\n\t\t\t</NavigationBlockEditorProvider>\n\t\t);\n\t}\n\treturn (\n\t\t<DefaultBlockEditorProvider>{ children }</DefaultBlockEditorProvider>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,aAAa,QAAQ,gBAAgB;AACvD,OAAOC,0BAA0B,MAAM,iCAAiC;AACxE,OAAOC,6BAA6B,MAAM,oCAAoC;AAC9E,SAASC,oBAAoB,QAAQ,0BAA0B;AAE/D,eAAe,SAASC,mBAAmBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EAC3D,MAAMC,UAAU,GAAGR,SAAS,CACzBS,MAAM,IAAMA,MAAM,CAAEP,aAAc,CAAC,CAACQ,iBAAiB,CAAC,CAAC,EACzD,EACD,CAAC;EACD,IAAKF,UAAU,KAAKH,oBAAoB,EAAG;IAC1C,OACCM,aAAA,CAACP,6BAA6B,QAC3BG,QAC4B,CAAC;EAElC;EACA,OACCI,aAAA,CAACR,0BAA0B,QAAGI,QAAsC,CAAC;AAEvE"}
|
|
@@ -14,6 +14,7 @@ import { createBlock } from '@wordpress/blocks';
|
|
|
14
14
|
import { unlock } from '../../../lock-unlock';
|
|
15
15
|
import useSiteEditorSettings from '../use-site-editor-settings';
|
|
16
16
|
import { store as editSiteStore } from '../../../store';
|
|
17
|
+
import { NAVIGATION_POST_TYPE } from '../../../utils/constants';
|
|
17
18
|
const {
|
|
18
19
|
ExperimentalBlockEditorProvider
|
|
19
20
|
} = unlock(blockEditorPrivateApis);
|
|
@@ -36,7 +37,7 @@ export default function NavigationBlockEditorProvider({
|
|
|
36
37
|
children
|
|
37
38
|
}) {
|
|
38
39
|
const defaultSettings = useSiteEditorSettings();
|
|
39
|
-
const navigationMenuId = useEntityId('postType',
|
|
40
|
+
const navigationMenuId = useEntityId('postType', NAVIGATION_POST_TYPE);
|
|
40
41
|
const blocks = useMemo(() => {
|
|
41
42
|
return [createBlock('core/navigation', {
|
|
42
43
|
ref: navigationMenuId,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useSelect","useDispatch","useMemo","useEffect","useEntityId","store","blockEditorStore","privateApis","blockEditorPrivateApis","createBlock","unlock","useSiteEditorSettings","editSiteStore","NAVIGATION_POST_TYPE","ExperimentalBlockEditorProvider","noop","NavigationBlockEditorProvider","children","defaultSettings","navigationMenuId","blocks","ref","templateLock","isEditMode","select","getCanvasMode","selectBlock","setBlockEditingMode","unsetBlockEditingMode","navigationBlockClientId","clientId","settings","template","createElement","value","onInput","onChange","useSubRegistry"],"sources":["@wordpress/edit-site/src/components/block-editor/block-editor-provider/navigation-block-editor-provider.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo, useEffect } from '@wordpress/element';\nimport { useEntityId } from '@wordpress/core-data';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../../lock-unlock';\nimport useSiteEditorSettings from '../use-site-editor-settings';\nimport { store as editSiteStore } from '../../../store';\nimport { NAVIGATION_POST_TYPE } from '../../../utils/constants';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\n\nconst noop = () => {};\n\n/**\n * Block editor component for editing navigation menus.\n *\n * Note: Navigation entities require a wrapping Navigation block to provide\n * them with some basic layout and styling. Therefore we create a \"ghost\" block\n * and provide it will a reference to the navigation entity ID being edited.\n *\n * In this scenario it is the **block** that handles syncing the entity content\n * whereas for other entities this is handled by entity block editor.\n *\n * @param {number} navigationMenuId the navigation menu ID\n * @return {[WPBlock[], Function, Function]} The block array and setters.\n */\nexport default function NavigationBlockEditorProvider( { children } ) {\n\tconst defaultSettings = useSiteEditorSettings();\n\n\tconst navigationMenuId = useEntityId( 'postType', NAVIGATION_POST_TYPE );\n\n\tconst blocks = useMemo( () => {\n\t\treturn [\n\t\t\tcreateBlock( 'core/navigation', {\n\t\t\t\tref: navigationMenuId,\n\t\t\t\t// As the parent editor is locked with `templateLock`, the template locking\n\t\t\t\t// must be explicitly \"unset\" on the block itself to allow the user to modify\n\t\t\t\t// the block's content.\n\t\t\t\ttemplateLock: false,\n\t\t\t} ),\n\t\t];\n\t}, [ navigationMenuId ] );\n\n\tconst { isEditMode } = useSelect( ( select ) => {\n\t\tconst { getCanvasMode } = unlock( select( editSiteStore ) );\n\n\t\treturn {\n\t\t\tisEditMode: getCanvasMode() === 'edit',\n\t\t};\n\t}, [] );\n\n\tconst { selectBlock, setBlockEditingMode, unsetBlockEditingMode } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst navigationBlockClientId = blocks && blocks[ 0 ]?.clientId;\n\n\tconst settings = useMemo( () => {\n\t\treturn {\n\t\t\t...defaultSettings,\n\t\t\t// Lock the editor to allow the root (\"ghost\") Navigation block only.\n\t\t\ttemplateLock: 'insert',\n\t\t\ttemplate: [ [ 'core/navigation', {}, [] ] ],\n\t\t};\n\t}, [ defaultSettings ] );\n\n\t// Auto-select the Navigation block when entering Navigation focus mode.\n\tuseEffect( () => {\n\t\tif ( navigationBlockClientId && isEditMode ) {\n\t\t\tselectBlock( navigationBlockClientId );\n\t\t}\n\t}, [ navigationBlockClientId, isEditMode, selectBlock ] );\n\n\t// Set block editing mode to contentOnly when entering Navigation focus mode.\n\t// This ensures that non-content controls on the block will be hidden and thus\n\t// the user can focus on editing the Navigation Menu content only.\n\tuseEffect( () => {\n\t\tif ( ! navigationBlockClientId ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetBlockEditingMode( navigationBlockClientId, 'contentOnly' );\n\n\t\treturn () => {\n\t\t\tunsetBlockEditingMode( navigationBlockClientId );\n\t\t};\n\t}, [\n\t\tnavigationBlockClientId,\n\t\tunsetBlockEditingMode,\n\t\tsetBlockEditingMode,\n\t] );\n\n\treturn (\n\t\t<ExperimentalBlockEditorProvider\n\t\t\tsettings={ settings }\n\t\t\tvalue={ blocks }\n\t\t\tonInput={ noop }\n\t\t\tonChange={ noop }\n\t\t\tuseSubRegistry={ false }\n\t\t>\n\t\t\t{ children }\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,OAAO,EAAEC,SAAS,QAAQ,oBAAoB;AACvD,SAASC,WAAW,QAAQ,sBAAsB;AAClD,SACCC,KAAK,IAAIC,gBAAgB,EACzBC,WAAW,IAAIC,sBAAsB,QAC/B,yBAAyB;AAChC,SAASC,WAAW,QAAQ,mBAAmB;;AAE/C;AACA;AACA;AACA,SAASC,MAAM,QAAQ,sBAAsB;AAC7C,OAAOC,qBAAqB,MAAM,6BAA6B;AAC/D,SAASN,KAAK,IAAIO,aAAa,QAAQ,gBAAgB;AACvD,SAASC,oBAAoB,QAAQ,0BAA0B;AAE/D,MAAM;EAAEC;AAAgC,CAAC,GAAGJ,MAAM,CAAEF,sBAAuB,CAAC;AAE5E,MAAMO,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,6BAA6BA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACrE,MAAMC,eAAe,G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K,CAAE0B,uBAAuB,EAAG;MAChC;IACD;IAEAF,mBAAmB,CAAEE,uBAAuB,EAAE,aAAc,CAAC;IAE7D,OAAO,MAAM;MACZD,qBAAqB,CAAEC,uBAAwB,CAAC;IACjD,CAAC;EACF,CAAC,EAAE,CACFA,uBAAuB,EACvBD,qBAAqB,EACrBD,mBAAmB,CAClB,CAAC;EAEH,OACCM,aAAA,CAACnB,+BAA+B;IAC/BiB,QAAQ,EAAGA,QAAU;IACrBG,KAAK,EAAGd,MAAQ;IAChBe,OAAO,EAAGpB,IAAM;IAChBqB,QAAQ,EAAGrB,IAAM;IACjBsB,cAAc,EAAG;EAAO,GAEtBpB,QAC8B,CAAC;AAEpC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useMemo } from '@wordpress/element';
|
|
5
|
+
import { createBlock } from '@wordpress/blocks';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { PAGE_CONTENT_BLOCK_TYPES } from '../../../utils/constants';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Helper method to iterate through all blocks, recursing into allowed inner blocks.
|
|
14
|
+
* Returns a flattened object of transformed blocks.
|
|
15
|
+
*
|
|
16
|
+
* @param {Array} blocks Blocks to flatten.
|
|
17
|
+
* @param {Function} transform Transforming function to be applied to each block. If transform returns `undefined`, the block is skipped.
|
|
18
|
+
*
|
|
19
|
+
* @return {Array} Flattened object.
|
|
20
|
+
*/
|
|
21
|
+
function flattenBlocks(blocks, transform) {
|
|
22
|
+
const result = [];
|
|
23
|
+
for (let i = 0; i < blocks.length; i++) {
|
|
24
|
+
// Since the Query Block could contain PAGE_CONTENT_BLOCK_TYPES block types,
|
|
25
|
+
// we skip it because we only want to render stand-alone page content blocks in the block list.
|
|
26
|
+
if (['core/query'].includes(blocks[i].name)) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
const transformedBlock = transform(blocks[i]);
|
|
30
|
+
if (transformedBlock) {
|
|
31
|
+
result.push(transformedBlock);
|
|
32
|
+
}
|
|
33
|
+
result.push(...flattenBlocks(blocks[i].innerBlocks, transform));
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Returns a memoized array of blocks that contain only page content blocks,
|
|
40
|
+
* surrounded by a group block to mimic the post editor.
|
|
41
|
+
*
|
|
42
|
+
* @param {Array} blocks Block list.
|
|
43
|
+
* @param {boolean} isPageContentFocused Whether the page content has focus. If `true` return page content blocks. Default `false`.
|
|
44
|
+
*
|
|
45
|
+
* @return {Array} Page content blocks.
|
|
46
|
+
*/
|
|
47
|
+
export default function usePageContentBlocks(blocks, isPageContentFocused = false) {
|
|
48
|
+
return useMemo(() => {
|
|
49
|
+
if (!isPageContentFocused || !blocks || !blocks.length) {
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
return [createBlock('core/group', {
|
|
53
|
+
layout: {
|
|
54
|
+
type: 'constrained'
|
|
55
|
+
},
|
|
56
|
+
style: {
|
|
57
|
+
spacing: {
|
|
58
|
+
margin: {
|
|
59
|
+
top: '4em' // Mimics the post editor.
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}, flattenBlocks(blocks, block => {
|
|
64
|
+
if (PAGE_CONTENT_BLOCK_TYPES[block.name]) {
|
|
65
|
+
return createBlock(block.name);
|
|
66
|
+
}
|
|
67
|
+
}))];
|
|
68
|
+
}, [blocks, isPageContentFocused]);
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=use-page-content-blocks.js.map
|
package/build-module/components/block-editor/block-editor-provider/use-page-content-blocks.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useMemo","createBlock","PAGE_CONTENT_BLOCK_TYPES","flattenBlocks","blocks","transform","result","i","length","includes","name","transformedBlock","push","innerBlocks","usePageContentBlocks","isPageContentFocused","layout","type","style","spacing","margin","top","block"],"sources":["@wordpress/edit-site/src/components/block-editor/block-editor-provider/use-page-content-blocks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { PAGE_CONTENT_BLOCK_TYPES } from '../../../utils/constants';\n\n/**\n * Helper method to iterate through all blocks, recursing into allowed inner blocks.\n * Returns a flattened object of transformed blocks.\n *\n * @param {Array} blocks Blocks to flatten.\n * @param {Function} transform Transforming function to be applied to each block. If transform returns `undefined`, the block is skipped.\n *\n * @return {Array} Flattened object.\n */\nfunction flattenBlocks( blocks, transform ) {\n\tconst result = [];\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\t// Since the Query Block could contain PAGE_CONTENT_BLOCK_TYPES block types,\n\t\t// we skip it because we only want to render stand-alone page content blocks in the block list.\n\t\tif ( [ 'core/query' ].includes( blocks[ i ].name ) ) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst transformedBlock = transform( blocks[ i ] );\n\t\tif ( transformedBlock ) {\n\t\t\tresult.push( transformedBlock );\n\t\t}\n\t\tresult.push( ...flattenBlocks( blocks[ i ].innerBlocks, transform ) );\n\t}\n\n\treturn result;\n}\n\n/**\n * Returns a memoized array of blocks that contain only page content blocks,\n * surrounded by a group block to mimic the post editor.\n *\n * @param {Array} blocks Block list.\n * @param {boolean} isPageContentFocused Whether the page content has focus. If `true` return page content blocks. Default `false`.\n *\n * @return {Array} Page content blocks.\n */\nexport default function usePageContentBlocks(\n\tblocks,\n\tisPageContentFocused = false\n) {\n\treturn useMemo( () => {\n\t\tif ( ! isPageContentFocused || ! blocks || ! blocks.length ) {\n\t\t\treturn [];\n\t\t}\n\t\treturn [\n\t\t\tcreateBlock(\n\t\t\t\t'core/group',\n\t\t\t\t{\n\t\t\t\t\tlayout: { type: 'constrained' },\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\tspacing: {\n\t\t\t\t\t\t\tmargin: {\n\t\t\t\t\t\t\t\ttop: '4em', // Mimics the post editor.\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tflattenBlocks( blocks, ( block ) => {\n\t\t\t\t\tif ( PAGE_CONTENT_BLOCK_TYPES[ block.name ] ) {\n\t\t\t\t\t\treturn createBlock( block.name );\n\t\t\t\t\t}\n\t\t\t\t} )\n\t\t\t),\n\t\t];\n\t}, [ blocks, isPageContentFocused ] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,WAAW,QAAQ,mBAAmB;;AAE/C;AACA;AACA;AACA,SAASC,wBAAwB,QAAQ,0BAA0B;;AAEnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,aAAaA,CAAEC,MAAM,EAAEC,SAAS,EAAG;EAC3C,MAAMC,MAAM,GAAG,EAAE;EACjB,KAAM,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,MAAM,CAACI,MAAM,EAAED,CAAC,EAAE,EAAG;IACzC;IACA;IACA,IAAK,CAAE,YAAY,CAAE,CAACE,QAAQ,CAAEL,MAAM,CAAEG,CAAC,CAAE,CAACG,IAAK,CAAC,EAAG;MACpD;IACD;IACA,MAAMC,gBAAgB,GAAGN,SAAS,CAAED,MAAM,CAAEG,CAAC,CAAG,CAAC;IACjD,IAAKI,gBAAgB,EAAG;MACvBL,MAAM,CAACM,IAAI,CAAED,gBAAiB,CAAC;IAChC;IACAL,MAAM,CAACM,IAAI,CAAE,GAAGT,aAAa,CAAEC,MAAM,CAAEG,CAAC,CAAE,CAACM,WAAW,EAAER,SAAU,CAAE,CAAC;EACtE;EAEA,OAAOC,MAAM;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASQ,oBAAoBA,CAC3CV,MAAM,EACNW,oBAAoB,GAAG,KAAK,EAC3B;EACD,OAAOf,OAAO,CAAE,MAAM;IACrB,IAAK,CAAEe,oBAAoB,IAAI,CAAEX,MAAM,IAAI,CAAEA,MAAM,CAACI,MAAM,EAAG;MAC5D,OAAO,EAAE;IACV;IACA,OAAO,CACNP,WAAW,CACV,YAAY,EACZ;MACCe,MAAM,EAAE;QAAEC,IAAI,EAAE;MAAc,CAAC;MAC/BC,KAAK,EAAE;QACNC,OAAO,EAAE;UACRC,MAAM,EAAE;YACPC,GAAG,EAAE,KAAK,CAAE;UACb;QACD;MACD;IACD,CAAC,EACDlB,aAAa,CAAEC,MAAM,EAAIkB,KAAK,IAAM;MACnC,IAAKpB,wBAAwB,CAAEoB,KAAK,CAACZ,IAAI,CAAE,EAAG;QAC7C,OAAOT,WAAW,CAAEqB,KAAK,CAACZ,IAAK,CAAC;MACjC;IACD,CAAE,CACH,CAAC,CACD;EACF,CAAC,EAAE,CAAEN,MAAM,EAAEW,oBAAoB,CAAG,CAAC;AACtC"}
|
|
@@ -2,7 +2,6 @@ import { createElement } from "@wordpress/element";
|
|
|
2
2
|
/**
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
5
|
-
import { useSelect } from '@wordpress/data';
|
|
6
5
|
import { BlockInspector } from '@wordpress/block-editor';
|
|
7
6
|
import { privateApis as editPatternsPrivateApis } from '@wordpress/patterns';
|
|
8
7
|
|
|
@@ -11,19 +10,13 @@ import { privateApis as editPatternsPrivateApis } from '@wordpress/patterns';
|
|
|
11
10
|
*/
|
|
12
11
|
import TemplatePartConverter from '../template-part-converter';
|
|
13
12
|
import { SidebarInspectorFill } from '../sidebar-edit-mode';
|
|
14
|
-
import { store as editSiteStore } from '../../store';
|
|
15
13
|
import SiteEditorCanvas from './site-editor-canvas';
|
|
16
|
-
import
|
|
14
|
+
import BlockEditorProvider from './block-editor-provider';
|
|
17
15
|
import { unlock } from '../../lock-unlock';
|
|
18
16
|
const {
|
|
19
17
|
PatternsMenuItems
|
|
20
18
|
} = unlock(editPatternsPrivateApis);
|
|
21
19
|
export default function BlockEditor() {
|
|
22
|
-
const entityType = useSelect(select => select(editSiteStore).getEditedPostType(), []);
|
|
23
|
-
|
|
24
|
-
// Choose the provider based on the entity type currently
|
|
25
|
-
// being edited.
|
|
26
|
-
const BlockEditorProvider = getBlockEditorProvider(entityType);
|
|
27
20
|
return createElement(BlockEditorProvider, null, createElement(TemplatePartConverter, null), createElement(SidebarInspectorFill, null, createElement(BlockInspector, null)), createElement(SiteEditorCanvas, null), createElement(PatternsMenuItems, null));
|
|
28
21
|
}
|
|
29
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["BlockInspector","privateApis","editPatternsPrivateApis","TemplatePartConverter","SidebarInspectorFill","SiteEditorCanvas","BlockEditorProvider","unlock","PatternsMenuItems","BlockEditor","createElement"],"sources":["@wordpress/edit-site/src/components/block-editor/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockInspector } from '@wordpress/block-editor';\nimport { privateApis as editPatternsPrivateApis } from '@wordpress/patterns';\n\n/**\n * Internal dependencies\n */\nimport TemplatePartConverter from '../template-part-converter';\nimport { SidebarInspectorFill } from '../sidebar-edit-mode';\nimport SiteEditorCanvas from './site-editor-canvas';\nimport BlockEditorProvider from './block-editor-provider';\n\nimport { unlock } from '../../lock-unlock';\nconst { PatternsMenuItems } = unlock( editPatternsPrivateApis );\nexport default function BlockEditor() {\n\treturn (\n\t\t<BlockEditorProvider>\n\t\t\t<TemplatePartConverter />\n\t\t\t<SidebarInspectorFill>\n\t\t\t\t<BlockInspector />\n\t\t\t</SidebarInspectorFill>\n\t\t\t<SiteEditorCanvas />\n\t\t\t<PatternsMenuItems />\n\t\t</BlockEditorProvider>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,cAAc,QAAQ,yBAAyB;AACxD,SAASC,WAAW,IAAIC,uBAAuB,QAAQ,qBAAqB;;AAE5E;AACA;AACA;AACA,OAAOC,qBAAqB,MAAM,4BAA4B;AAC9D,SAASC,oBAAoB,QAAQ,sBAAsB;AAC3D,OAAOC,gBAAgB,MAAM,sBAAsB;AACnD,OAAOC,mBAAmB,MAAM,yBAAyB;AAEzD,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,MAAM;EAAEC;AAAkB,CAAC,GAAGD,MAAM,CAAEL,uBAAwB,CAAC;AAC/D,eAAe,SAASO,WAAWA,CAAA,EAAG;EACrC,OACCC,aAAA,CAACJ,mBAAmB,QACnBI,aAAA,CAACP,qBAAqB,MAAE,CAAC,EACzBO,aAAA,CAACN,oBAAoB,QACpBM,aAAA,CAACV,cAAc,MAAE,CACI,CAAC,EACvBU,aAAA,CAACL,gBAAgB,MAAE,CAAC,EACpBK,aAAA,CAACF,iBAAiB,MAAE,CACA,CAAC;AAExB"}
|
|
@@ -19,7 +19,7 @@ import EditorCanvas from './editor-canvas';
|
|
|
19
19
|
import EditorCanvasContainer from '../editor-canvas-container';
|
|
20
20
|
import useSiteEditorSettings from './use-site-editor-settings';
|
|
21
21
|
import { store as editSiteStore } from '../../store';
|
|
22
|
-
import { FOCUSABLE_ENTITIES } from '../../utils/constants';
|
|
22
|
+
import { FOCUSABLE_ENTITIES, NAVIGATION_POST_TYPE } from '../../utils/constants';
|
|
23
23
|
import { unlock } from '../../lock-unlock';
|
|
24
24
|
import PageContentFocusManager from '../page-content-focus-manager';
|
|
25
25
|
const LAYOUT = {
|
|
@@ -65,7 +65,7 @@ export default function SiteEditorCanvas() {
|
|
|
65
65
|
// Disable resizing in mobile viewport.
|
|
66
66
|
!isMobileViewport;
|
|
67
67
|
const contentRef = useRef();
|
|
68
|
-
const isTemplateTypeNavigation = templateType ===
|
|
68
|
+
const isTemplateTypeNavigation = templateType === NAVIGATION_POST_TYPE;
|
|
69
69
|
const isNavigationFocusMode = isTemplateTypeNavigation && isFocusMode;
|
|
70
70
|
|
|
71
71
|
// Hide the appender when:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","useSelect","useDispatch","useRef","BlockList","BlockTools","store","blockEditorStore","useViewportMatch","useResizeObserver","BackButton","ResizableEditor","EditorCanvas","EditorCanvasContainer","useSiteEditorSettings","editSiteStore","FOCUSABLE_ENTITIES","unlock","PageContentFocusManager","LAYOUT","type","alignments","SiteEditorCanvas","clearSelectedBlock","templateType","isFocusMode","isViewMode","select","getEditedPostType","getCanvasMode","_templateType","includes","resizeObserver","sizes","settings","hasBlocks","getBlockCount","blocks","isMobileViewport","enableResizing","contentRef","isTemplateTypeNavigation","isNavigationFocusMode","showBlockAppender","undefined","forceFullHeight","createElement","Fragment","Slot","editorCanvasView","className","__unstableContentRef","onClick","event","target","currentTarget","height","layout","renderAppender"],"sources":["@wordpress/edit-site/src/components/block-editor/site-editor-canvas.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRef } from '@wordpress/element';\nimport {\n\tBlockList,\n\tBlockTools,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useViewportMatch, useResizeObserver } from '@wordpress/compose';\n/**\n * Internal dependencies\n */\nimport BackButton from './back-button';\nimport ResizableEditor from './resizable-editor';\nimport EditorCanvas from './editor-canvas';\nimport EditorCanvasContainer from '../editor-canvas-container';\nimport useSiteEditorSettings from './use-site-editor-settings';\nimport { store as editSiteStore } from '../../store';\nimport {
|
|
1
|
+
{"version":3,"names":["classnames","useSelect","useDispatch","useRef","BlockList","BlockTools","store","blockEditorStore","useViewportMatch","useResizeObserver","BackButton","ResizableEditor","EditorCanvas","EditorCanvasContainer","useSiteEditorSettings","editSiteStore","FOCUSABLE_ENTITIES","NAVIGATION_POST_TYPE","unlock","PageContentFocusManager","LAYOUT","type","alignments","SiteEditorCanvas","clearSelectedBlock","templateType","isFocusMode","isViewMode","select","getEditedPostType","getCanvasMode","_templateType","includes","resizeObserver","sizes","settings","hasBlocks","getBlockCount","blocks","isMobileViewport","enableResizing","contentRef","isTemplateTypeNavigation","isNavigationFocusMode","showBlockAppender","undefined","forceFullHeight","createElement","Fragment","Slot","editorCanvasView","className","__unstableContentRef","onClick","event","target","currentTarget","height","layout","renderAppender"],"sources":["@wordpress/edit-site/src/components/block-editor/site-editor-canvas.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRef } from '@wordpress/element';\nimport {\n\tBlockList,\n\tBlockTools,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useViewportMatch, useResizeObserver } from '@wordpress/compose';\n/**\n * Internal dependencies\n */\nimport BackButton from './back-button';\nimport ResizableEditor from './resizable-editor';\nimport EditorCanvas from './editor-canvas';\nimport EditorCanvasContainer from '../editor-canvas-container';\nimport useSiteEditorSettings from './use-site-editor-settings';\nimport { store as editSiteStore } from '../../store';\nimport {\n\tFOCUSABLE_ENTITIES,\n\tNAVIGATION_POST_TYPE,\n} from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\nimport PageContentFocusManager from '../page-content-focus-manager';\n\nconst LAYOUT = {\n\ttype: 'default',\n\t// At the root level of the site editor, no alignments should be allowed.\n\talignments: [],\n};\n\nexport default function SiteEditorCanvas() {\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\n\tconst { templateType, isFocusMode, isViewMode } = useSelect( ( select ) => {\n\t\tconst { getEditedPostType, getCanvasMode } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\n\t\tconst _templateType = getEditedPostType();\n\n\t\treturn {\n\t\t\ttemplateType: _templateType,\n\t\t\tisFocusMode: FOCUSABLE_ENTITIES.includes( _templateType ),\n\t\t\tisViewMode: getCanvasMode() === 'view',\n\t\t};\n\t}, [] );\n\n\tconst [ resizeObserver, sizes ] = useResizeObserver();\n\n\tconst settings = useSiteEditorSettings();\n\n\tconst { hasBlocks } = useSelect( ( select ) => {\n\t\tconst { getBlockCount } = select( blockEditorStore );\n\n\t\tconst blocks = getBlockCount();\n\n\t\treturn {\n\t\t\thasBlocks: !! blocks,\n\t\t};\n\t}, [] );\n\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst enableResizing =\n\t\tisFocusMode &&\n\t\t! isViewMode &&\n\t\t// Disable resizing in mobile viewport.\n\t\t! isMobileViewport;\n\n\tconst contentRef = useRef();\n\tconst isTemplateTypeNavigation = templateType === NAVIGATION_POST_TYPE;\n\n\tconst isNavigationFocusMode = isTemplateTypeNavigation && isFocusMode;\n\n\t// Hide the appender when:\n\t// - In navigation focus mode (should only allow the root Nav block).\n\t// - In view mode (i.e. not editing).\n\tconst showBlockAppender =\n\t\t( isNavigationFocusMode && hasBlocks ) || isViewMode\n\t\t\t? false\n\t\t\t: undefined;\n\n\tconst forceFullHeight = isNavigationFocusMode;\n\n\treturn (\n\t\t<>\n\t\t\t<EditorCanvasContainer.Slot>\n\t\t\t\t{ ( [ editorCanvasView ] ) =>\n\t\t\t\t\teditorCanvasView ? (\n\t\t\t\t\t\t<div className=\"edit-site-visual-editor is-focus-mode\">\n\t\t\t\t\t\t\t{ editorCanvasView }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<BlockTools\n\t\t\t\t\t\t\tclassName={ classnames( 'edit-site-visual-editor', {\n\t\t\t\t\t\t\t\t'is-focus-mode':\n\t\t\t\t\t\t\t\t\tisFocusMode || !! editorCanvasView,\n\t\t\t\t\t\t\t\t'is-view-mode': isViewMode,\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t__unstableContentRef={ contentRef }\n\t\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\t\t// Clear selected block when clicking on the gray background.\n\t\t\t\t\t\t\t\tif ( event.target === event.currentTarget ) {\n\t\t\t\t\t\t\t\t\tclearSelectedBlock();\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\t\t<BackButton />\n\t\t\t\t\t\t\t<ResizableEditor\n\t\t\t\t\t\t\t\tenableResizing={ enableResizing }\n\t\t\t\t\t\t\t\theight={\n\t\t\t\t\t\t\t\t\tsizes.height && ! forceFullHeight\n\t\t\t\t\t\t\t\t\t\t? sizes.height\n\t\t\t\t\t\t\t\t\t\t: '100%'\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<EditorCanvas\n\t\t\t\t\t\t\t\t\tenableResizing={ enableResizing }\n\t\t\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ resizeObserver }\n\t\t\t\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t\t\t'edit-site-block-editor__block-list wp-site-blocks',\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t'is-navigation-block':\n\t\t\t\t\t\t\t\t\t\t\t\t\tisTemplateTypeNavigation,\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tlayout={ LAYOUT }\n\t\t\t\t\t\t\t\t\t\trenderAppender={ showBlockAppender }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</EditorCanvas>\n\t\t\t\t\t\t\t</ResizableEditor>\n\t\t\t\t\t\t</BlockTools>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t</EditorCanvasContainer.Slot>\n\t\t\t<PageContentFocusManager contentRef={ contentRef } />\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;AACnC;AACA;AACA;AACA,SAAS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AACE,aAAa,EAAG;QAC3ChC,kBAAkB,CAAC,CAAC;MACrB;IACD;EAAG,GAEHuB,aAAA,CAACrC,UAAU,MAAE,CAAC,EACdqC,aAAA,CAACpC,eAAe;IACf6B,cAAc,EAAGA,cAAgB;IACjCiB,MAAM,EACLvB,KAAK,CAACuB,MAAM,IAAI,CAAEX,eAAe,GAC9BZ,KAAK,CAACuB,MAAM,GACZ;EACH,GAEDV,aAAA,CAACnC,YAAY;IACZ4B,cAAc,EAAGA,cAAgB;IACjCL,QAAQ,EAAGA,QAAU;IACrBM,UAAU,EAAGA;EAAY,GAEvBR,cAAc,EAChBc,aAAA,CAAC3C,SAAS;IACT+C,SAAS,EAAGnD,UAAU,CACrB,mDAAmD,EACnD;MACC,qBAAqB,EACpB0C;IACF,CACD,CAAG;IACHgB,MAAM,EAAGtC,MAAQ;IACjBuC,cAAc,EAAGf;EAAmB,CACpC,CACY,CACE,CACN,CAGa,CAAC,EAC7BG,aAAA,CAAC5B,uBAAuB;IAACsB,UAAU,EAAGA;EAAY,CAAE,CACnD,CAAC;AAEL"}
|
|
@@ -16,7 +16,7 @@ import { serialize } from '@wordpress/blocks';
|
|
|
16
16
|
/**
|
|
17
17
|
* Internal dependencies
|
|
18
18
|
*/
|
|
19
|
-
import {
|
|
19
|
+
import { TEMPLATE_PART_POST_TYPE, TEMPLATE_PART_AREA_DEFAULT_CATEGORY } from '../../utils/constants';
|
|
20
20
|
import { useExistingTemplateParts, getUniqueTemplatePartTitle, getCleanTemplatePartSlug } from '../../utils/template-part-create';
|
|
21
21
|
export default function CreateTemplatePartModal({
|
|
22
22
|
closeModal,
|
|
@@ -32,21 +32,19 @@ export default function CreateTemplatePartModal({
|
|
|
32
32
|
} = useDispatch(coreStore);
|
|
33
33
|
const existingTemplateParts = useExistingTemplateParts();
|
|
34
34
|
const [title, setTitle] = useState('');
|
|
35
|
-
const [area, setArea] = useState(
|
|
35
|
+
const [area, setArea] = useState(TEMPLATE_PART_AREA_DEFAULT_CATEGORY);
|
|
36
36
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
37
37
|
const instanceId = useInstanceId(CreateTemplatePartModal);
|
|
38
38
|
const templatePartAreas = useSelect(select => select(editorStore).__experimentalGetDefaultTemplatePartAreas(), []);
|
|
39
39
|
async function createTemplatePart() {
|
|
40
|
-
if (!title) {
|
|
41
|
-
createErrorNotice(__('Please enter a title.'), {
|
|
42
|
-
type: 'snackbar'
|
|
43
|
-
});
|
|
40
|
+
if (!title || isSubmitting) {
|
|
44
41
|
return;
|
|
45
42
|
}
|
|
46
43
|
try {
|
|
44
|
+
setIsSubmitting(true);
|
|
47
45
|
const uniqueTitle = getUniqueTemplatePartTitle(title, existingTemplateParts);
|
|
48
46
|
const cleanSlug = getCleanTemplatePartSlug(uniqueTitle);
|
|
49
|
-
const templatePart = await saveEntityRecord('postType',
|
|
47
|
+
const templatePart = await saveEntityRecord('postType', TEMPLATE_PART_POST_TYPE, {
|
|
50
48
|
slug: cleanSlug,
|
|
51
49
|
title: uniqueTitle,
|
|
52
50
|
content: serialize(blocks),
|
|
@@ -63,6 +61,8 @@ export default function CreateTemplatePartModal({
|
|
|
63
61
|
type: 'snackbar'
|
|
64
62
|
});
|
|
65
63
|
onError?.();
|
|
64
|
+
} finally {
|
|
65
|
+
setIsSubmitting(false);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
return createElement(Modal, {
|
|
@@ -72,10 +72,6 @@ export default function CreateTemplatePartModal({
|
|
|
72
72
|
}, createElement("form", {
|
|
73
73
|
onSubmit: async event => {
|
|
74
74
|
event.preventDefault();
|
|
75
|
-
if (!title) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
setIsSubmitting(true);
|
|
79
75
|
await createTemplatePart();
|
|
80
76
|
}
|
|
81
77
|
}, createElement(VStack, {
|
|
@@ -126,7 +122,7 @@ export default function CreateTemplatePartModal({
|
|
|
126
122
|
}, __('Cancel')), createElement(Button, {
|
|
127
123
|
variant: "primary",
|
|
128
124
|
type: "submit",
|
|
129
|
-
disabled: !title,
|
|
125
|
+
"aria-disabled": !title || isSubmitting,
|
|
130
126
|
isBusy: isSubmitting
|
|
131
127
|
}, __('Create'))))));
|
|
132
128
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","useDispatch","Icon","BaseControl","TextControl","Flex","FlexItem","FlexBlock","Button","Modal","__experimentalRadioGroup","RadioGroup","__experimentalRadio","Radio","__experimentalHStack","HStack","__experimentalVStack","VStack","__","useState","useInstanceId","store","editorStore","noticesStore","coreStore","check","serialize","TEMPLATE_PART_AREA_GENERAL","useExistingTemplateParts","getUniqueTemplatePartTitle","getCleanTemplatePartSlug","CreateTemplatePartModal","closeModal","blocks","onCreate","onError","createErrorNotice","saveEntityRecord","existingTemplateParts","title","setTitle","area","setArea","isSubmitting","setIsSubmitting","instanceId","templatePartAreas","select","__experimentalGetDefaultTemplatePartAreas","createTemplatePart","type","uniqueTitle","cleanSlug","templatePart","slug","content","throwOnError","error","errorMessage","message","code","createElement","onRequestClose","overlayClassName","onSubmit","event","preventDefault","spacing","__nextHasNoMarginBottom","label","value","onChange","required","id","className","checked","map","icon","description","key","align","justify","variant","onClick","disabled","isBusy"],"sources":["@wordpress/edit-site/src/components/create-template-part-modal/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tIcon,\n\tBaseControl,\n\tTextControl,\n\tFlex,\n\tFlexItem,\n\tFlexBlock,\n\tButton,\n\tModal,\n\t__experimentalRadioGroup as RadioGroup,\n\t__experimentalRadio as Radio,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { check } from '@wordpress/icons';\nimport { serialize } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_PART_AREA_GENERAL } from '../../store/constants';\nimport {\n\tuseExistingTemplateParts,\n\tgetUniqueTemplatePartTitle,\n\tgetCleanTemplatePartSlug,\n} from '../../utils/template-part-create';\n\nexport default function CreateTemplatePartModal( {\n\tcloseModal,\n\tblocks = [],\n\tonCreate,\n\tonError,\n} ) {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst existingTemplateParts = useExistingTemplateParts();\n\n\tconst [ title, setTitle ] = useState( '' );\n\tconst [ area, setArea ] = useState( TEMPLATE_PART_AREA_GENERAL );\n\tconst [ isSubmitting, setIsSubmitting ] = useState( false );\n\tconst instanceId = useInstanceId( CreateTemplatePartModal );\n\n\tconst templatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetDefaultTemplatePartAreas(),\n\t\t[]\n\t);\n\n\tasync function createTemplatePart() {\n\t\tif ( ! title ) {\n\t\t\tcreateErrorNotice( __( 'Please enter a title.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tconst uniqueTitle = getUniqueTemplatePartTitle(\n\t\t\t\ttitle,\n\t\t\t\texistingTemplateParts\n\t\t\t);\n\t\t\tconst cleanSlug = getCleanTemplatePartSlug( uniqueTitle );\n\n\t\t\tconst templatePart = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\t{\n\t\t\t\t\tslug: cleanSlug,\n\t\t\t\t\ttitle: uniqueTitle,\n\t\t\t\t\tcontent: serialize( blocks ),\n\t\t\t\t\tarea,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\t\t\tawait onCreate( templatePart );\n\n\t\t\t// TODO: Add a success notice?\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'An error occurred while creating the template part.'\n\t\t\t\t\t );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\n\t\t\tonError?.();\n\t\t}\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Create template part' ) }\n\t\t\tonRequestClose={ closeModal }\n\t\t\toverlayClassName=\"edit-site-create-template-part-modal\"\n\t\t>\n\t\t\t<form\n\t\t\t\tonSubmit={ async ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tif ( ! title ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tsetIsSubmitting( true );\n\t\t\t\t\tawait createTemplatePart();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<VStack spacing=\"4\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\trequired\n\t\t\t\t\t/>\n\t\t\t\t\t<BaseControl\n\t\t\t\t\t\tlabel={ __( 'Area' ) }\n\t\t\t\t\t\tid={ `edit-site-create-template-part-modal__area-selection-${ instanceId }` }\n\t\t\t\t\t\tclassName=\"edit-site-create-template-part-modal__area-base-control\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<RadioGroup\n\t\t\t\t\t\t\tlabel={ __( 'Area' ) }\n\t\t\t\t\t\t\tclassName=\"edit-site-create-template-part-modal__area-radio-group\"\n\t\t\t\t\t\t\tid={ `edit-site-create-template-part-modal__area-selection-${ instanceId }` }\n\t\t\t\t\t\t\tonChange={ setArea }\n\t\t\t\t\t\t\tchecked={ area }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ templatePartAreas.map(\n\t\t\t\t\t\t\t\t( {\n\t\t\t\t\t\t\t\t\ticon,\n\t\t\t\t\t\t\t\t\tlabel,\n\t\t\t\t\t\t\t\t\tarea: value,\n\t\t\t\t\t\t\t\t\tdescription,\n\t\t\t\t\t\t\t\t} ) => (\n\t\t\t\t\t\t\t\t\t<Radio\n\t\t\t\t\t\t\t\t\t\tkey={ label }\n\t\t\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-create-template-part-modal__area-radio\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Flex align=\"start\" justify=\"start\">\n\t\t\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t<FlexBlock className=\"edit-site-create-template-part-modal__option-label\">\n\t\t\t\t\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t\t\t\t\t\t<div>{ description }</div>\n\t\t\t\t\t\t\t\t\t\t\t</FlexBlock>\n\n\t\t\t\t\t\t\t\t\t\t\t<FlexItem className=\"edit-site-create-template-part-modal__checkbox\">\n\t\t\t\t\t\t\t\t\t\t\t\t{ area === value && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Icon icon={ check } />\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t\t</Flex>\n\t\t\t\t\t\t\t\t\t</Radio>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</RadioGroup>\n\t\t\t\t\t</BaseControl>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tdisabled={ ! title }\n\t\t\t\t\t\t\tisBusy={ isSubmitting }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SACCC,IAAI,EACJC,WAAW,EACXC,WAAW,EACXC,IAAI,EACJC,QAAQ,EACRC,SAAS,EACTC,MAAM,EACNC,KAAK,EACLC,wBAAwB,IAAIC,UAAU,EACtCC,mBAAmB,IAAIC,KAAK,EAC5BC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASD,KAAK,IAAIE,YAAY,QAAQ,oBAAoB;AAC1D,SAASF,KAAK,IAAIG,SAAS,QAAQ,sBAAsB;AACzD,SAASC,KAAK,QAAQ,kBAAkB;AACxC,SAASC,SAAS,QAAQ,mBAAmB;;AAE7C;AACA;AACA;AACA,SAASC,0BAA0B,QAAQ,uBAAuB;AAClE,SACCC,wBAAwB,EACxBC,0BAA0B,EAC1BC,wBAAwB,QAClB,kCAAkC;AAEzC,eAAe,SAASC,uBAAuBA,CAAE;EAChDC,UAAU;EACVC,MAAM,GAAG,EAAE;EACXC,QAAQ;EACRC;AACD,CAAC,EAAG;EACH,MAAM;IAAEC;EAAkB,CAAC,GAAGnC,WA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K;IACXQ;EACD,CAAC,KACAjB,aAAA,CAAChD,KAAK;IACLkE,GAAG,EAAGV,KAAO;IACbC,KAAK,EAAGA,KAAO;IACfI,SAAS,EAAC;EAAkD,GAE5Db,aAAA,CAACxD,IAAI;IAAC2E,KAAK,EAAC,OAAO;IAACC,OAAO,EAAC;EAAO,GAClCpB,aAAA,CAACvD,QAAQ,QACRuD,aAAA,CAAC3D,IAAI;IAAC2E,IAAI,EAAGA;EAAM,CAAE,CACZ,CAAC,EACXhB,aAAA,CAACtD,SAAS;IAACmE,SAAS,EAAC;EAAoD,GACtEL,KAAK,EACPR,aAAA,cAAOiB,WAAkB,CACf,CAAC,EAEZjB,aAAA,CAACvD,QAAQ;IAACoE,SAAS,EAAC;EAAgD,GACjEjC,IAAI,KAAK6B,KAAK,IACfT,aAAA,CAAC3D,IAAI;IAAC2E,IAAI,EAAGpD;EAAO,CAAE,CAEd,CACL,CACA,CAET,CACW,CACA,CAAC,EACdoC,aAAA,CAAC9C,MAAM;IAACkE,OAAO,EAAC;EAAO,GACtBpB,aAAA,CAACrD,MAAM;IACN0E,OAAO,EAAC,UAAU;IAClBC,OAAO,EAAGA,CAAA,KAAM;MACfnD,UAAU,CAAC,CAAC;IACb;EAAG,GAEDd,EAAE,CAAE,QAAS,CACR,CAAC,EACT2C,aAAA,CAACrD,MAAM;IACN0E,OAAO,EAAC,SAAS;IACjBhC,IAAI,EAAC,QAAQ;IACbkC,QAAQ,EAAG,CAAE7C,KAAO;IACpB8C,MAAM,EAAG1C;EAAc,GAErBzB,EAAE,CAAE,QAAS,CACR,CACD,CACD,CACH,CACA,CAAC;AAEV"}
|
|
1
|
+
{"version":3,"names":["useSelect","useDispatch","Icon","BaseControl","TextControl","Flex","FlexItem","FlexBlock","Button","Modal","__experimentalRadioGroup","RadioGroup","__experimentalRadio","Radio","__experimentalHStack","HStack","__experimentalVStack","VStack","__","useState","useInstanceId","store","editorStore","noticesStore","coreStore","check","serialize","TEMPLATE_PART_POST_TYPE","TEMPLATE_PART_AREA_DEFAULT_CATEGORY","useExistingTemplateParts","getUniqueTemplatePartTitle","getCleanTemplatePartSlug","CreateTemplatePartModal","closeModal","blocks","onCreate","onError","createErrorNotice","saveEntityRecord","existingTemplateParts","title","setTitle","area","setArea","isSubmitting","setIsSubmitting","instanceId","templatePartAreas","select","__experimentalGetDefaultTemplatePartAreas","createTemplatePart","uniqueTitle","cleanSlug","templatePart","slug","content","throwOnError","error","errorMessage","message","code","type","createElement","onRequestClose","overlayClassName","onSubmit","event","preventDefault","spacing","__nextHasNoMarginBottom","label","value","onChange","required","id","className","checked","map","icon","description","key","align","justify","variant","onClick","isBusy"],"sources":["@wordpress/edit-site/src/components/create-template-part-modal/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tIcon,\n\tBaseControl,\n\tTextControl,\n\tFlex,\n\tFlexItem,\n\tFlexBlock,\n\tButton,\n\tModal,\n\t__experimentalRadioGroup as RadioGroup,\n\t__experimentalRadio as Radio,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { check } from '@wordpress/icons';\nimport { serialize } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport {\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_PART_AREA_DEFAULT_CATEGORY,\n} from '../../utils/constants';\nimport {\n\tuseExistingTemplateParts,\n\tgetUniqueTemplatePartTitle,\n\tgetCleanTemplatePartSlug,\n} from '../../utils/template-part-create';\n\nexport default function CreateTemplatePartModal( {\n\tcloseModal,\n\tblocks = [],\n\tonCreate,\n\tonError,\n} ) {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst existingTemplateParts = useExistingTemplateParts();\n\n\tconst [ title, setTitle ] = useState( '' );\n\tconst [ area, setArea ] = useState( TEMPLATE_PART_AREA_DEFAULT_CATEGORY );\n\tconst [ isSubmitting, setIsSubmitting ] = useState( false );\n\tconst instanceId = useInstanceId( CreateTemplatePartModal );\n\n\tconst templatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetDefaultTemplatePartAreas(),\n\t\t[]\n\t);\n\n\tasync function createTemplatePart() {\n\t\tif ( ! title || isSubmitting ) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tsetIsSubmitting( true );\n\t\t\tconst uniqueTitle = getUniqueTemplatePartTitle(\n\t\t\t\ttitle,\n\t\t\t\texistingTemplateParts\n\t\t\t);\n\t\t\tconst cleanSlug = getCleanTemplatePartSlug( uniqueTitle );\n\n\t\t\tconst templatePart = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t\t{\n\t\t\t\t\tslug: cleanSlug,\n\t\t\t\t\ttitle: uniqueTitle,\n\t\t\t\t\tcontent: serialize( blocks ),\n\t\t\t\t\tarea,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\t\t\tawait onCreate( templatePart );\n\n\t\t\t// TODO: Add a success notice?\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'An error occurred while creating the template part.'\n\t\t\t\t\t );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\n\t\t\tonError?.();\n\t\t} finally {\n\t\t\tsetIsSubmitting( false );\n\t\t}\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Create template part' ) }\n\t\t\tonRequestClose={ closeModal }\n\t\t\toverlayClassName=\"edit-site-create-template-part-modal\"\n\t\t>\n\t\t\t<form\n\t\t\t\tonSubmit={ async ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tawait createTemplatePart();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<VStack spacing=\"4\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\trequired\n\t\t\t\t\t/>\n\t\t\t\t\t<BaseControl\n\t\t\t\t\t\tlabel={ __( 'Area' ) }\n\t\t\t\t\t\tid={ `edit-site-create-template-part-modal__area-selection-${ instanceId }` }\n\t\t\t\t\t\tclassName=\"edit-site-create-template-part-modal__area-base-control\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<RadioGroup\n\t\t\t\t\t\t\tlabel={ __( 'Area' ) }\n\t\t\t\t\t\t\tclassName=\"edit-site-create-template-part-modal__area-radio-group\"\n\t\t\t\t\t\t\tid={ `edit-site-create-template-part-modal__area-selection-${ instanceId }` }\n\t\t\t\t\t\t\tonChange={ setArea }\n\t\t\t\t\t\t\tchecked={ area }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ templatePartAreas.map(\n\t\t\t\t\t\t\t\t( {\n\t\t\t\t\t\t\t\t\ticon,\n\t\t\t\t\t\t\t\t\tlabel,\n\t\t\t\t\t\t\t\t\tarea: value,\n\t\t\t\t\t\t\t\t\tdescription,\n\t\t\t\t\t\t\t\t} ) => (\n\t\t\t\t\t\t\t\t\t<Radio\n\t\t\t\t\t\t\t\t\t\tkey={ label }\n\t\t\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-create-template-part-modal__area-radio\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Flex align=\"start\" justify=\"start\">\n\t\t\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t<FlexBlock className=\"edit-site-create-template-part-modal__option-label\">\n\t\t\t\t\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t\t\t\t\t\t<div>{ description }</div>\n\t\t\t\t\t\t\t\t\t\t\t</FlexBlock>\n\n\t\t\t\t\t\t\t\t\t\t\t<FlexItem className=\"edit-site-create-template-part-modal__checkbox\">\n\t\t\t\t\t\t\t\t\t\t\t\t{ area === value && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Icon icon={ check } />\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t\t</Flex>\n\t\t\t\t\t\t\t\t\t</Radio>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</RadioGroup>\n\t\t\t\t\t</BaseControl>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\taria-disabled={ ! title || isSubmitting }\n\t\t\t\t\t\t\tisBusy={ isSubmitting }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA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