@wordpress/edit-site 5.14.0 → 5.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build/components/add-new-page/index.js +1 -6
- package/build/components/add-new-page/index.js.map +1 -1
- package/build/components/add-new-pattern/index.js +22 -7
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/add-new-template/utils.js +10 -8
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/block-editor/constants.js +1 -1
- package/build/components/block-editor/constants.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +1 -1
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/index.js +0 -4
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/use-site-editor-settings.js +114 -13
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/code-editor/index.js +60 -28
- package/build/components/code-editor/index.js.map +1 -1
- package/build/components/create-pattern-modal/index.js +7 -3
- package/build/components/create-pattern-modal/index.js.map +1 -1
- package/build/components/editor/index.js +5 -5
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/global-styles-provider.js +12 -7
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/screen-block.js +16 -0
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +12 -5
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +10 -22
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +32 -25
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +5 -3
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/header-edit-mode/document-actions/index.js +4 -2
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +13 -9
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/edit-mode.js +7 -5
- package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build/components/layout/index.js +17 -5
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page/index.js +3 -3
- package/build/components/page/index.js.map +1 -1
- package/build/components/page-actions/index.js +2 -2
- package/build/components/page-actions/index.js.map +1 -1
- package/build/components/page-actions/{delete-page-menu-item.js → trash-page-menu-item.js} +8 -16
- package/build/components/page-actions/trash-page-menu-item.js.map +1 -0
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js +5 -5
- 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 +163 -0
- package/build/components/page-patterns/duplicate-menu-item.js.map +1 -0
- package/build/components/page-patterns/grid-item.js +83 -58
- package/build/components/page-patterns/grid-item.js.map +1 -1
- package/build/components/page-patterns/grid.js +5 -18
- package/build/components/page-patterns/grid.js.map +1 -1
- package/build/components/page-patterns/header.js +69 -0
- package/build/components/page-patterns/header.js.map +1 -0
- package/build/components/page-patterns/index.js +3 -1
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/pagination.js +63 -0
- package/build/components/page-patterns/pagination.js.map +1 -0
- package/build/components/page-patterns/patterns-list.js +110 -31
- package/build/components/page-patterns/patterns-list.js.map +1 -1
- package/build/components/page-patterns/rename-menu-item.js +109 -0
- package/build/components/page-patterns/rename-menu-item.js.map +1 -0
- package/build/components/page-patterns/use-patterns.js +116 -118
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-template-parts/add-new-template-part.js +74 -0
- package/build/components/page-template-parts/add-new-template-part.js.map +1 -0
- package/build/components/page-template-parts/index.js +3 -25
- package/build/components/page-template-parts/index.js.map +1 -1
- package/build/components/page-templates/index.js +1 -16
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/resizable-frame/index.js +85 -51
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/save-button/index.js +4 -2
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-hub/index.js +10 -4
- package/build/components/save-hub/index.js.map +1 -1
- package/build/components/save-panel/index.js +5 -5
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-content.js +4 -3
- package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-status.js +3 -8
- package/build/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-panel/index.js +15 -8
- package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +31 -15
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +34 -40
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +4 -2
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/template-part-hint.js +45 -0
- package/build/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js +4 -4
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -3
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +5 -4
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/constants.js +2 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +4 -4
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +8 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/index.js +2 -3
- package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/status-label.js +1 -34
- package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pages/index.js +35 -25
- package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/index.js +9 -7
- package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +4 -3
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -2
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +19 -4
- 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 +55 -28
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/category-item.js +0 -5
- package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +72 -60
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js +9 -5
- package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +11 -1
- 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 +20 -9
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +1 -10
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +9 -0
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/site-hub/index.js +29 -13
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +10 -5
- 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-canvas-mode-with-url.js +1 -1
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +15 -12
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/template-actions/index.js +3 -1
- package/build/components/template-actions/index.js.map +1 -1
- package/build/components/template-actions/rename-menu-item.js +12 -8
- package/build/components/template-actions/rename-menu-item.js.map +1 -1
- package/build/components/use-edited-entity-record/index.js +6 -1
- package/build/components/use-edited-entity-record/index.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +120 -32
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +65 -7
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +138 -57
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/store/private-actions.js +9 -2
- package/build/store/private-actions.js.map +1 -1
- package/build/utils/normalize-record-key.js +19 -0
- package/build/utils/normalize-record-key.js.map +1 -0
- package/build/utils/use-activate-theme.js +1 -1
- package/build/utils/use-activate-theme.js.map +1 -1
- package/build/utils/use-debounced-input.js +5 -7
- package/build/utils/use-debounced-input.js.map +1 -1
- package/build-module/components/add-new-page/index.js +1 -6
- package/build-module/components/add-new-page/index.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +20 -7
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +9 -6
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/block-editor/constants.js +1 -1
- package/build-module/components/block-editor/constants.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +1 -1
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/index.js +0 -4
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +116 -14
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/code-editor/index.js +62 -30
- package/build-module/components/code-editor/index.js.map +1 -1
- package/build-module/components/create-pattern-modal/index.js +6 -3
- package/build-module/components/create-pattern-modal/index.js.map +1 -1
- package/build-module/components/editor/index.js +5 -5
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/global-styles-provider.js +12 -7
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +16 -0
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +13 -6
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +10 -22
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +28 -21
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +5 -3
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +6 -4
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +13 -9
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js +7 -5
- package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build-module/components/layout/index.js +17 -5
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page/index.js +3 -3
- package/build-module/components/page/index.js.map +1 -1
- package/build-module/components/page-actions/index.js +2 -2
- package/build-module/components/page-actions/index.js.map +1 -1
- package/build-module/components/page-actions/{delete-page-menu-item.js → trash-page-menu-item.js} +8 -17
- package/build-module/components/page-actions/trash-page-menu-item.js.map +1 -0
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js +5 -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 +147 -0
- package/build-module/components/page-patterns/duplicate-menu-item.js.map +1 -0
- package/build-module/components/page-patterns/grid-item.js +84 -64
- package/build-module/components/page-patterns/grid-item.js.map +1 -1
- package/build-module/components/page-patterns/grid.js +5 -17
- package/build-module/components/page-patterns/grid.js.map +1 -1
- package/build-module/components/page-patterns/header.js +54 -0
- package/build-module/components/page-patterns/header.js.map +1 -0
- package/build-module/components/page-patterns/index.js +3 -1
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/pagination.js +54 -0
- package/build-module/components/page-patterns/pagination.js.map +1 -0
- package/build-module/components/page-patterns/patterns-list.js +111 -34
- package/build-module/components/page-patterns/patterns-list.js.map +1 -1
- package/build-module/components/page-patterns/rename-menu-item.js +97 -0
- package/build-module/components/page-patterns/rename-menu-item.js.map +1 -0
- package/build-module/components/page-patterns/use-patterns.js +116 -119
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-template-parts/add-new-template-part.js +58 -0
- package/build-module/components/page-template-parts/add-new-template-part.js.map +1 -0
- package/build-module/components/page-template-parts/index.js +4 -24
- package/build-module/components/page-template-parts/index.js.map +1 -1
- package/build-module/components/page-templates/index.js +2 -15
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +87 -55
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/save-button/index.js +4 -2
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-hub/index.js +10 -4
- package/build-module/components/save-hub/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +5 -5
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +5 -2
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js +3 -8
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/index.js +15 -9
- package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +29 -16
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +34 -40
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +4 -3
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js +33 -0
- package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +4 -4
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -3
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +5 -4
- 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/constants.js +2 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +4 -4
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +7 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +2 -2
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/index.js +2 -3
- package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/status-label.js +1 -32
- package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pages/index.js +35 -25
- package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/index.js +8 -7
- 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.js +4 -3
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -2
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +18 -4
- 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 +53 -28
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +0 -5
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +76 -60
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js +9 -5
- package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +10 -1
- 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 +18 -9
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +1 -8
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +7 -0
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +28 -13
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +7 -5
- 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-canvas-mode-with-url.js +1 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +16 -12
- 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 +11 -8
- package/build-module/components/template-actions/rename-menu-item.js.map +1 -1
- package/build-module/components/use-edited-entity-record/index.js +3 -1
- package/build-module/components/use-edited-entity-record/index.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +116 -32
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +65 -9
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +139 -57
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/store/private-actions.js +9 -2
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/utils/normalize-record-key.js +12 -0
- package/build-module/utils/normalize-record-key.js.map +1 -0
- package/build-module/utils/use-activate-theme.js +1 -1
- package/build-module/utils/use-activate-theme.js.map +1 -1
- package/build-module/utils/use-debounced-input.js +5 -7
- package/build-module/utils/use-debounced-input.js.map +1 -1
- package/build-style/style-rtl.css +281 -103
- package/build-style/style.css +281 -103
- package/package.json +39 -40
- package/src/components/add-new-page/index.js +0 -3
- package/src/components/add-new-pattern/index.js +25 -12
- package/src/components/add-new-template/utils.js +9 -6
- package/src/components/block-editor/constants.js +5 -1
- package/src/components/block-editor/editor-canvas.js +1 -1
- package/src/components/block-editor/index.js +0 -4
- package/src/components/block-editor/use-site-editor-settings.js +119 -20
- package/src/components/canvas-spinner/style.scss +14 -0
- package/src/components/code-editor/index.js +51 -33
- package/src/components/create-pattern-modal/index.js +5 -2
- package/src/components/editor/index.js +5 -5
- package/src/components/global-styles/global-styles-provider.js +7 -2
- package/src/components/global-styles/screen-block.js +15 -0
- package/src/components/global-styles/screen-revisions/index.js +64 -58
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +17 -31
- package/src/components/global-styles/screen-revisions/test/use-global-styles-revisions.js +14 -1
- package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +64 -48
- package/src/components/global-styles/style-variations-container.js +2 -0
- package/src/components/header-edit-mode/document-actions/index.js +8 -4
- package/src/components/header-edit-mode/document-actions/style.scss +45 -28
- package/src/components/header-edit-mode/index.js +29 -22
- package/src/components/keyboard-shortcuts/edit-mode.js +4 -5
- package/src/components/layout/index.js +49 -22
- package/src/components/layout/style.scss +4 -3
- package/src/components/page/index.js +8 -8
- package/src/components/page/style.scss +8 -5
- package/src/components/page-actions/index.js +2 -2
- package/src/components/page-actions/{delete-page-menu-item.js → trash-page-menu-item.js} +9 -22
- package/src/components/page-content-focus-manager/disable-non-page-content-blocks.js +12 -3
- package/src/components/page-patterns/duplicate-menu-item.js +196 -0
- package/src/components/page-patterns/grid-item.js +189 -133
- package/src/components/page-patterns/grid.js +3 -20
- package/src/components/page-patterns/header.js +69 -0
- package/src/components/page-patterns/index.js +6 -1
- package/src/components/page-patterns/pagination.js +80 -0
- package/src/components/page-patterns/patterns-list.js +172 -71
- package/src/components/page-patterns/rename-menu-item.js +115 -0
- package/src/components/page-patterns/style.scss +141 -30
- package/src/components/page-patterns/use-patterns.js +115 -169
- package/src/components/page-template-parts/add-new-template-part.js +57 -0
- package/src/components/page-template-parts/index.js +3 -23
- package/src/components/page-templates/index.js +6 -19
- package/src/components/resizable-frame/index.js +104 -51
- package/src/components/resizable-frame/style.scss +9 -9
- package/src/components/save-button/index.js +2 -0
- package/src/components/save-hub/index.js +6 -1
- package/src/components/save-hub/style.scss +1 -1
- package/src/components/save-panel/index.js +10 -4
- package/src/components/sidebar-edit-mode/page-panels/page-content.js +7 -5
- package/src/components/sidebar-edit-mode/page-panels/page-status.js +2 -5
- package/src/components/sidebar-edit-mode/template-panel/index.js +15 -11
- package/src/components/sidebar-navigation-item/style.scss +5 -12
- package/src/components/sidebar-navigation-screen/index.js +30 -15
- package/src/components/sidebar-navigation-screen/style.scss +18 -0
- package/src/components/sidebar-navigation-screen-details-panel/style.scss +1 -0
- package/src/components/sidebar-navigation-screen-global-styles/index.js +48 -44
- package/src/components/sidebar-navigation-screen-main/index.js +44 -40
- package/src/components/sidebar-navigation-screen-main/template-part-hint.js +34 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/index.js +4 -3
- package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +1 -1
- package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +16 -7
- package/src/components/sidebar-navigation-screen-navigation-menus/constants.js +2 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +4 -4
- package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +27 -15
- package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +1 -4
- package/src/components/sidebar-navigation-screen-page/index.js +3 -3
- package/src/components/sidebar-navigation-screen-page/status-label.js +1 -35
- package/src/components/sidebar-navigation-screen-pages/index.js +48 -33
- package/src/components/sidebar-navigation-screen-pattern/index.js +5 -2
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +3 -2
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +2 -1
- package/src/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +23 -3
- package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +74 -43
- package/src/components/sidebar-navigation-screen-patterns/category-item.js +5 -13
- package/src/components/sidebar-navigation-screen-patterns/index.js +103 -106
- package/src/components/sidebar-navigation-screen-patterns/style.scss +20 -0
- package/src/components/sidebar-navigation-screen-patterns/use-my-patterns.js +7 -6
- package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +9 -0
- package/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +31 -9
- package/src/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +2 -1
- package/src/components/sidebar-navigation-screen-templates/index.js +1 -9
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +10 -0
- package/src/components/site-hub/index.js +48 -29
- package/src/components/site-hub/style.scss +14 -2
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +8 -2
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -4
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +73 -66
- package/src/components/table/style.scss +1 -0
- package/src/components/template-actions/index.js +2 -1
- package/src/components/template-actions/rename-menu-item.js +17 -10
- package/src/components/use-edited-entity-record/index.js +6 -1
- package/src/hooks/commands/use-common-commands.js +105 -32
- package/src/hooks/commands/use-edit-mode-commands.js +94 -23
- package/src/hooks/push-changes-to-global-styles/index.js +141 -50
- package/src/store/private-actions.js +10 -2
- package/src/style.scss +10 -12
- package/src/utils/normalize-record-key.js +11 -0
- package/src/utils/use-activate-theme.js +1 -1
- package/src/utils/use-debounced-input.js +8 -7
- package/build/components/code-editor/code-editor-text-area.js +0 -96
- package/build/components/code-editor/code-editor-text-area.js.map +0 -1
- package/build/components/keyboard-shortcuts/index.js +0 -148
- package/build/components/keyboard-shortcuts/index.js.map +0 -1
- package/build/components/page-actions/delete-page-menu-item.js.map +0 -1
- package/build/components/page-content-focus-manager/constants.js +0 -9
- package/build/components/page-content-focus-manager/constants.js.map +0 -1
- package/build-module/components/code-editor/code-editor-text-area.js +0 -84
- package/build-module/components/code-editor/code-editor-text-area.js.map +0 -1
- package/build-module/components/keyboard-shortcuts/index.js +0 -132
- package/build-module/components/keyboard-shortcuts/index.js.map +0 -1
- package/build-module/components/page-actions/delete-page-menu-item.js.map +0 -1
- package/build-module/components/page-content-focus-manager/constants.js +0 -2
- package/build-module/components/page-content-focus-manager/constants.js.map +0 -1
- package/src/components/code-editor/code-editor-text-area.js +0 -84
- package/src/components/keyboard-shortcuts/index.js +0 -137
- package/src/components/page-content-focus-manager/constants.js +0 -5
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
import { parse } from '@wordpress/blocks';
|
|
5
5
|
import { useSelect } from '@wordpress/data';
|
|
6
6
|
import { store as coreStore } from '@wordpress/core-data';
|
|
7
|
-
import {
|
|
7
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
8
|
+
import { decodeEntities } from '@wordpress/html-entities';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Internal dependencies
|
|
@@ -15,7 +16,6 @@ import {
|
|
|
15
16
|
SYNC_TYPES,
|
|
16
17
|
TEMPLATE_PARTS,
|
|
17
18
|
USER_PATTERNS,
|
|
18
|
-
USER_PATTERN_CATEGORY,
|
|
19
19
|
filterOutDuplicatesByName,
|
|
20
20
|
} from './utils';
|
|
21
21
|
import { unlock } from '../../lock-unlock';
|
|
@@ -31,122 +31,98 @@ const templatePartToPattern = ( templatePart ) => ( {
|
|
|
31
31
|
blocks: parse( templatePart.content.raw ),
|
|
32
32
|
categories: [ templatePart.area ],
|
|
33
33
|
description: templatePart.description || '',
|
|
34
|
+
isCustom: templatePart.source === 'custom',
|
|
34
35
|
keywords: templatePart.keywords || [],
|
|
36
|
+
id: createTemplatePartId( templatePart.theme, templatePart.slug ),
|
|
35
37
|
name: createTemplatePartId( templatePart.theme, templatePart.slug ),
|
|
36
|
-
title: templatePart.title.rendered,
|
|
38
|
+
title: decodeEntities( templatePart.title.rendered ),
|
|
37
39
|
type: templatePart.type,
|
|
38
40
|
templatePart,
|
|
39
41
|
} );
|
|
40
42
|
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return ! templatePartCategories.includes( item.templatePart.area );
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return item.templatePart.area === category;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const useTemplatePartsAsPatterns = (
|
|
51
|
-
categoryId,
|
|
52
|
-
postType = TEMPLATE_PARTS,
|
|
53
|
-
filterValue = ''
|
|
43
|
+
const selectTemplatePartsAsPatterns = (
|
|
44
|
+
select,
|
|
45
|
+
{ categoryId, search = '' } = {}
|
|
54
46
|
) => {
|
|
55
|
-
const {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const { getEntityRecords, isResolving: _isResolving } =
|
|
65
|
-
select( coreStore );
|
|
66
|
-
const query = { per_page: -1 };
|
|
67
|
-
const rawTemplateParts = getEntityRecords(
|
|
68
|
-
'postType',
|
|
69
|
-
postType,
|
|
70
|
-
query
|
|
71
|
-
);
|
|
72
|
-
const partsAsPatterns = rawTemplateParts?.map( ( templatePart ) =>
|
|
73
|
-
templatePartToPattern( templatePart )
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
return {
|
|
77
|
-
templateParts: partsAsPatterns,
|
|
78
|
-
isResolving: _isResolving( 'getEntityRecords', [
|
|
79
|
-
'postType',
|
|
80
|
-
'wp_template_part',
|
|
81
|
-
query,
|
|
82
|
-
] ),
|
|
83
|
-
};
|
|
84
|
-
},
|
|
85
|
-
[ postType ]
|
|
47
|
+
const { getEntityRecords, getIsResolving } = select( coreStore );
|
|
48
|
+
const { __experimentalGetDefaultTemplatePartAreas } = select( editorStore );
|
|
49
|
+
const query = { per_page: -1 };
|
|
50
|
+
const rawTemplateParts =
|
|
51
|
+
getEntityRecords( 'postType', TEMPLATE_PARTS, query ) ??
|
|
52
|
+
EMPTY_PATTERN_LIST;
|
|
53
|
+
const templateParts = rawTemplateParts.map( ( templatePart ) =>
|
|
54
|
+
templatePartToPattern( templatePart )
|
|
86
55
|
);
|
|
87
56
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
57
|
+
// In the case where a custom template part area has been removed we need
|
|
58
|
+
// the current list of areas to cross check against so orphaned template
|
|
59
|
+
// parts can be treated as uncategorized.
|
|
60
|
+
const knownAreas = __experimentalGetDefaultTemplatePartAreas() || [];
|
|
61
|
+
const templatePartAreas = knownAreas.map( ( area ) => area.area );
|
|
92
62
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
}, [ templateParts, filterValue, categoryId ] );
|
|
98
|
-
|
|
99
|
-
return { templateParts: filteredTemplateParts, isResolving };
|
|
100
|
-
};
|
|
63
|
+
const templatePartHasCategory = ( item, category ) => {
|
|
64
|
+
if ( category !== 'uncategorized' ) {
|
|
65
|
+
return item.templatePart.area === category;
|
|
66
|
+
}
|
|
101
67
|
|
|
102
|
-
const useThemePatterns = (
|
|
103
|
-
categoryId,
|
|
104
|
-
postType = PATTERNS,
|
|
105
|
-
filterValue = ''
|
|
106
|
-
) => {
|
|
107
|
-
const blockPatterns = useSelect( ( select ) => {
|
|
108
|
-
const { getSettings } = unlock( select( editSiteStore ) );
|
|
109
|
-
const settings = getSettings();
|
|
110
68
|
return (
|
|
111
|
-
|
|
112
|
-
|
|
69
|
+
item.templatePart.area === category ||
|
|
70
|
+
! templatePartAreas.includes( item.templatePart.area )
|
|
113
71
|
);
|
|
114
|
-
}
|
|
72
|
+
};
|
|
115
73
|
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
74
|
+
const isResolving = getIsResolving( 'getEntityRecords', [
|
|
75
|
+
'postType',
|
|
76
|
+
'wp_template_part',
|
|
77
|
+
query,
|
|
78
|
+
] );
|
|
119
79
|
|
|
120
|
-
const patterns =
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
( pattern ) =>
|
|
125
|
-
! CORE_PATTERN_SOURCES.includes( pattern.source )
|
|
126
|
-
)
|
|
127
|
-
.filter( filterOutDuplicatesByName )
|
|
128
|
-
.map( ( pattern ) => ( {
|
|
129
|
-
...pattern,
|
|
130
|
-
keywords: pattern.keywords || [],
|
|
131
|
-
type: 'pattern',
|
|
132
|
-
blocks: parse( pattern.content ),
|
|
133
|
-
} ) ),
|
|
134
|
-
[ blockPatterns, restBlockPatterns ]
|
|
135
|
-
);
|
|
80
|
+
const patterns = searchItems( templateParts, search, {
|
|
81
|
+
categoryId,
|
|
82
|
+
hasCategory: templatePartHasCategory,
|
|
83
|
+
} );
|
|
136
84
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
return EMPTY_PATTERN_LIST;
|
|
140
|
-
}
|
|
85
|
+
return { patterns, isResolving };
|
|
86
|
+
};
|
|
141
87
|
|
|
142
|
-
|
|
88
|
+
const selectThemePatterns = ( select, { categoryId, search = '' } = {} ) => {
|
|
89
|
+
const { getSettings } = unlock( select( editSiteStore ) );
|
|
90
|
+
const settings = getSettings();
|
|
91
|
+
const blockPatterns =
|
|
92
|
+
settings.__experimentalAdditionalBlockPatterns ??
|
|
93
|
+
settings.__experimentalBlockPatterns;
|
|
94
|
+
|
|
95
|
+
const restBlockPatterns = select( coreStore ).getBlockPatterns();
|
|
96
|
+
|
|
97
|
+
let patterns = [
|
|
98
|
+
...( blockPatterns || [] ),
|
|
99
|
+
...( restBlockPatterns || [] ),
|
|
100
|
+
]
|
|
101
|
+
.filter(
|
|
102
|
+
( pattern ) => ! CORE_PATTERN_SOURCES.includes( pattern.source )
|
|
103
|
+
)
|
|
104
|
+
.filter( filterOutDuplicatesByName )
|
|
105
|
+
.filter( ( pattern ) => pattern.inserter !== false )
|
|
106
|
+
.map( ( pattern ) => ( {
|
|
107
|
+
...pattern,
|
|
108
|
+
keywords: pattern.keywords || [],
|
|
109
|
+
type: 'pattern',
|
|
110
|
+
blocks: parse( pattern.content ),
|
|
111
|
+
} ) );
|
|
112
|
+
|
|
113
|
+
if ( categoryId ) {
|
|
114
|
+
patterns = searchItems( patterns, search, {
|
|
143
115
|
categoryId,
|
|
144
116
|
hasCategory: ( item, currentCategory ) =>
|
|
145
117
|
item.categories?.includes( currentCategory ),
|
|
146
118
|
} );
|
|
147
|
-
}
|
|
119
|
+
} else {
|
|
120
|
+
patterns = searchItems( patterns, search, {
|
|
121
|
+
hasCategory: ( item ) => ! item.hasOwnProperty( 'categories' ),
|
|
122
|
+
} );
|
|
123
|
+
}
|
|
148
124
|
|
|
149
|
-
return
|
|
125
|
+
return { patterns, isResolving: false };
|
|
150
126
|
};
|
|
151
127
|
|
|
152
128
|
const reusableBlockToPattern = ( reusableBlock ) => ( {
|
|
@@ -160,88 +136,58 @@ const reusableBlockToPattern = ( reusableBlock ) => ( {
|
|
|
160
136
|
reusableBlock,
|
|
161
137
|
} );
|
|
162
138
|
|
|
163
|
-
const
|
|
164
|
-
|
|
165
|
-
categoryType = PATTERNS,
|
|
166
|
-
filterValue = ''
|
|
167
|
-
) => {
|
|
168
|
-
const postType = categoryType === PATTERNS ? USER_PATTERNS : categoryType;
|
|
169
|
-
const unfilteredPatterns = useSelect(
|
|
170
|
-
( select ) => {
|
|
171
|
-
if (
|
|
172
|
-
postType !== USER_PATTERNS ||
|
|
173
|
-
categoryId !== USER_PATTERN_CATEGORY
|
|
174
|
-
) {
|
|
175
|
-
return EMPTY_PATTERN_LIST;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
const { getEntityRecords } = select( coreStore );
|
|
179
|
-
const records = getEntityRecords( 'postType', postType, {
|
|
180
|
-
per_page: -1,
|
|
181
|
-
} );
|
|
182
|
-
|
|
183
|
-
if ( ! records ) {
|
|
184
|
-
return EMPTY_PATTERN_LIST;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
return records.map( ( record ) =>
|
|
188
|
-
reusableBlockToPattern( record )
|
|
189
|
-
);
|
|
190
|
-
},
|
|
191
|
-
[ postType, categoryId ]
|
|
192
|
-
);
|
|
139
|
+
const selectUserPatterns = ( select, { search = '', syncStatus } = {} ) => {
|
|
140
|
+
const { getEntityRecords, getIsResolving } = select( coreStore );
|
|
193
141
|
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
return EMPTY_PATTERN_LIST;
|
|
197
|
-
}
|
|
142
|
+
const query = { per_page: -1 };
|
|
143
|
+
const records = getEntityRecords( 'postType', USER_PATTERNS, query );
|
|
198
144
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
145
|
+
let patterns = records
|
|
146
|
+
? records.map( ( record ) => reusableBlockToPattern( record ) )
|
|
147
|
+
: EMPTY_PATTERN_LIST;
|
|
148
|
+
const isResolving = getIsResolving( 'getEntityRecords', [
|
|
149
|
+
'postType',
|
|
150
|
+
USER_PATTERNS,
|
|
151
|
+
query,
|
|
152
|
+
] );
|
|
206
153
|
|
|
207
|
-
|
|
154
|
+
if ( syncStatus ) {
|
|
155
|
+
patterns = patterns.filter(
|
|
156
|
+
( pattern ) => pattern.syncStatus === syncStatus
|
|
157
|
+
);
|
|
158
|
+
}
|
|
208
159
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
160
|
+
patterns = searchItems( patterns, search, {
|
|
161
|
+
// We exit user pattern retrieval early if we aren't in the
|
|
162
|
+
// catch-all category for user created patterns, so it has
|
|
163
|
+
// to be in the category.
|
|
164
|
+
hasCategory: () => true,
|
|
215
165
|
} );
|
|
216
166
|
|
|
217
|
-
return patterns;
|
|
167
|
+
return { patterns, isResolving };
|
|
218
168
|
};
|
|
219
169
|
|
|
220
|
-
export const usePatterns = (
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
170
|
+
export const usePatterns = (
|
|
171
|
+
categoryType,
|
|
172
|
+
categoryId,
|
|
173
|
+
{ search = '', syncStatus }
|
|
174
|
+
) => {
|
|
175
|
+
return useSelect(
|
|
176
|
+
( select ) => {
|
|
177
|
+
if ( categoryType === TEMPLATE_PARTS ) {
|
|
178
|
+
return selectTemplatePartsAsPatterns( select, {
|
|
179
|
+
categoryId,
|
|
180
|
+
search,
|
|
181
|
+
} );
|
|
182
|
+
} else if ( categoryType === PATTERNS ) {
|
|
183
|
+
return selectThemePatterns( select, { categoryId, search } );
|
|
184
|
+
} else if ( categoryType === USER_PATTERNS ) {
|
|
185
|
+
return selectUserPatterns( select, { search, syncStatus } );
|
|
186
|
+
}
|
|
187
|
+
return { patterns: EMPTY_PATTERN_LIST, isResolving: false };
|
|
188
|
+
},
|
|
189
|
+
[ categoryId, categoryType, search, syncStatus ]
|
|
237
190
|
);
|
|
238
|
-
|
|
239
|
-
const patterns = {
|
|
240
|
-
syncedPatterns: [ ...templateParts, ...syncedPatterns ],
|
|
241
|
-
unsyncedPatterns: [ ...blockPatterns, ...unsyncedPatterns ],
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
return [ patterns, isResolving ];
|
|
245
191
|
};
|
|
246
192
|
|
|
247
193
|
export default usePatterns;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
7
|
+
import { useState } from '@wordpress/element';
|
|
8
|
+
import { Button } from '@wordpress/components';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
import { unlock } from '../../lock-unlock';
|
|
14
|
+
import { store as editSiteStore } from '../../store';
|
|
15
|
+
import CreateTemplatePartModal from '../create-template-part-modal';
|
|
16
|
+
|
|
17
|
+
const { useHistory } = unlock( routerPrivateApis );
|
|
18
|
+
|
|
19
|
+
export default function AddNewTemplatePart() {
|
|
20
|
+
const { canCreate, postType } = useSelect( ( select ) => {
|
|
21
|
+
const { supportsTemplatePartsMode } =
|
|
22
|
+
select( editSiteStore ).getSettings();
|
|
23
|
+
return {
|
|
24
|
+
canCreate: ! supportsTemplatePartsMode,
|
|
25
|
+
postType: select( coreStore ).getPostType( 'wp_template_part' ),
|
|
26
|
+
};
|
|
27
|
+
}, [] );
|
|
28
|
+
const [ isModalOpen, setIsModalOpen ] = useState( false );
|
|
29
|
+
const history = useHistory();
|
|
30
|
+
|
|
31
|
+
if ( ! canCreate || ! postType ) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<>
|
|
37
|
+
<Button variant="primary" onClick={ () => setIsModalOpen( true ) }>
|
|
38
|
+
{ postType.labels.add_new_item }
|
|
39
|
+
</Button>
|
|
40
|
+
{ isModalOpen && (
|
|
41
|
+
<CreateTemplatePartModal
|
|
42
|
+
closeModal={ () => setIsModalOpen( false ) }
|
|
43
|
+
blocks={ [] }
|
|
44
|
+
onCreate={ ( templatePart ) => {
|
|
45
|
+
setIsModalOpen( false );
|
|
46
|
+
history.push( {
|
|
47
|
+
postId: templatePart.id,
|
|
48
|
+
postType: 'wp_template_part',
|
|
49
|
+
canvas: 'edit',
|
|
50
|
+
} );
|
|
51
|
+
} }
|
|
52
|
+
onError={ () => setIsModalOpen( false ) }
|
|
53
|
+
/>
|
|
54
|
+
) }
|
|
55
|
+
</>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
@@ -7,8 +7,7 @@ import {
|
|
|
7
7
|
__experimentalVStack as VStack,
|
|
8
8
|
} from '@wordpress/components';
|
|
9
9
|
import { __ } from '@wordpress/i18n';
|
|
10
|
-
import {
|
|
11
|
-
import { store as coreStore, useEntityRecords } from '@wordpress/core-data';
|
|
10
|
+
import { useEntityRecords } from '@wordpress/core-data';
|
|
12
11
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
13
12
|
|
|
14
13
|
/**
|
|
@@ -19,8 +18,7 @@ import Table from '../table';
|
|
|
19
18
|
import Link from '../routes/link';
|
|
20
19
|
import AddedBy from '../list/added-by';
|
|
21
20
|
import TemplateActions from '../template-actions';
|
|
22
|
-
import
|
|
23
|
-
import { store as editSiteStore } from '../../store';
|
|
21
|
+
import AddNewTemplatePart from './add-new-template-part';
|
|
24
22
|
|
|
25
23
|
export default function PageTemplateParts() {
|
|
26
24
|
const { records: templateParts } = useEntityRecords(
|
|
@@ -31,15 +29,6 @@ export default function PageTemplateParts() {
|
|
|
31
29
|
}
|
|
32
30
|
);
|
|
33
31
|
|
|
34
|
-
const { canCreate } = useSelect( ( select ) => {
|
|
35
|
-
const { supportsTemplatePartsMode } =
|
|
36
|
-
select( editSiteStore ).getSettings();
|
|
37
|
-
return {
|
|
38
|
-
postType: select( coreStore ).getPostType( 'wp_template_part' ),
|
|
39
|
-
canCreate: ! supportsTemplatePartsMode,
|
|
40
|
-
};
|
|
41
|
-
} );
|
|
42
|
-
|
|
43
32
|
const columns = [
|
|
44
33
|
{
|
|
45
34
|
header: __( 'Template Part' ),
|
|
@@ -50,7 +39,6 @@ export default function PageTemplateParts() {
|
|
|
50
39
|
params={ {
|
|
51
40
|
postId: templatePart.id,
|
|
52
41
|
postType: templatePart.type,
|
|
53
|
-
canvas: 'view',
|
|
54
42
|
} }
|
|
55
43
|
state={ { backPath: '/wp_template_part/all' } }
|
|
56
44
|
>
|
|
@@ -87,15 +75,7 @@ export default function PageTemplateParts() {
|
|
|
87
75
|
return (
|
|
88
76
|
<Page
|
|
89
77
|
title={ __( 'Template Parts' ) }
|
|
90
|
-
actions={
|
|
91
|
-
canCreate && (
|
|
92
|
-
<AddNewTemplate
|
|
93
|
-
templateType={ 'wp_template_part' }
|
|
94
|
-
showIcon={ false }
|
|
95
|
-
toggleProps={ { variant: 'primary' } }
|
|
96
|
-
/>
|
|
97
|
-
)
|
|
98
|
-
}
|
|
78
|
+
actions={ <AddNewTemplatePart /> }
|
|
99
79
|
>
|
|
100
80
|
{ templateParts && (
|
|
101
81
|
<Table data={ templateParts } columns={ columns } />
|
|
@@ -8,8 +8,7 @@ import {
|
|
|
8
8
|
__experimentalVStack as VStack,
|
|
9
9
|
} from '@wordpress/components';
|
|
10
10
|
import { __ } from '@wordpress/i18n';
|
|
11
|
-
import {
|
|
12
|
-
import { store as coreStore, useEntityRecords } from '@wordpress/core-data';
|
|
11
|
+
import { useEntityRecords } from '@wordpress/core-data';
|
|
13
12
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
14
13
|
|
|
15
14
|
/**
|
|
@@ -21,7 +20,6 @@ import Link from '../routes/link';
|
|
|
21
20
|
import AddedBy from '../list/added-by';
|
|
22
21
|
import TemplateActions from '../template-actions';
|
|
23
22
|
import AddNewTemplate from '../add-new-template';
|
|
24
|
-
import { store as editSiteStore } from '../../store';
|
|
25
23
|
|
|
26
24
|
export default function PageTemplates() {
|
|
27
25
|
const { records: templates } = useEntityRecords(
|
|
@@ -32,15 +30,6 @@ export default function PageTemplates() {
|
|
|
32
30
|
}
|
|
33
31
|
);
|
|
34
32
|
|
|
35
|
-
const { canCreate } = useSelect( ( select ) => {
|
|
36
|
-
const { supportsTemplatePartsMode } =
|
|
37
|
-
select( editSiteStore ).getSettings();
|
|
38
|
-
return {
|
|
39
|
-
postType: select( coreStore ).getPostType( 'wp_template' ),
|
|
40
|
-
canCreate: ! supportsTemplatePartsMode,
|
|
41
|
-
};
|
|
42
|
-
} );
|
|
43
|
-
|
|
44
33
|
const columns = [
|
|
45
34
|
{
|
|
46
35
|
header: __( 'Template' ),
|
|
@@ -89,13 +78,11 @@ export default function PageTemplates() {
|
|
|
89
78
|
<Page
|
|
90
79
|
title={ __( 'Templates' ) }
|
|
91
80
|
actions={
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
/>
|
|
98
|
-
)
|
|
81
|
+
<AddNewTemplate
|
|
82
|
+
templateType={ 'wp_template' }
|
|
83
|
+
showIcon={ false }
|
|
84
|
+
toggleProps={ { variant: 'primary' } }
|
|
85
|
+
/>
|
|
99
86
|
}
|
|
100
87
|
>
|
|
101
88
|
{ templates && <Table data={ templates } columns={ columns } /> }
|