@wordpress/edit-site 5.14.0 → 5.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/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 +21 -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 +87 -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 +1 -1
- package/build/components/editor/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/layout/index.js +8 -3
- package/build/components/layout/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 +95 -30
- 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 +102 -121
- 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 +2 -23
- package/build/components/page-template-parts/index.js.map +1 -1
- package/build/components/resizable-frame/index.js +78 -36
- package/build/components/resizable-frame/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-navigation-screen/index.js +14 -8
- package/build/components/sidebar-navigation-screen/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 +4 -3
- 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-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 +33 -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 +3 -2
- 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 +11 -3
- 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 +5 -2
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +72 -51
- 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/site-hub/index.js +24 -11
- 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-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 +78 -20
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +56 -10
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/store/private-actions.js +7 -1
- 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-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 +19 -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 +89 -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 +1 -1
- package/build-module/components/editor/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/layout/index.js +8 -3
- package/build-module/components/layout/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 +96 -33
- 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 +103 -122
- 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 +3 -22
- package/build-module/components/page-template-parts/index.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +79 -39
- package/build-module/components/resizable-frame/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-navigation-screen/index.js +15 -9
- package/build-module/components/sidebar-navigation-screen/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 +4 -3
- 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-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 +33 -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 +3 -2
- 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 +11 -3
- 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 +4 -2
- 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 +76 -53
- 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/site-hub/index.js +24 -11
- 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-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 +74 -20
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +57 -10
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/store/private-actions.js +7 -1
- 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-style/style-rtl.css +221 -63
- package/build-style/style.css +221 -63
- package/package.json +39 -40
- package/src/components/add-new-page/index.js +0 -3
- package/src/components/add-new-pattern/index.js +23 -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 +99 -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 +2 -2
- package/src/components/header-edit-mode/document-actions/style.scss +4 -0
- package/src/components/header-edit-mode/index.js +29 -22
- package/src/components/layout/index.js +16 -2
- package/src/components/layout/style.scss +2 -1
- 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 +160 -72
- package/src/components/page-patterns/rename-menu-item.js +115 -0
- package/src/components/page-patterns/style.scss +140 -30
- package/src/components/page-patterns/use-patterns.js +102 -172
- package/src/components/page-template-parts/add-new-template-part.js +57 -0
- package/src/components/page-template-parts/index.js +3 -22
- package/src/components/resizable-frame/index.js +102 -34
- package/src/components/resizable-frame/style.scss +9 -9
- 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-navigation-item/style.scss +5 -12
- package/src/components/sidebar-navigation-screen/index.js +14 -7
- package/src/components/sidebar-navigation-screen/style.scss +14 -0
- 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 +15 -5
- package/src/components/sidebar-navigation-screen-navigation-menus/constants.js +2 -0
- 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 +39 -29
- package/src/components/sidebar-navigation-screen-pattern/index.js +5 -2
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +2 -1
- 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 +12 -2
- package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +5 -2
- package/src/components/sidebar-navigation-screen-patterns/index.js +103 -98
- 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/site-hub/index.js +45 -28
- package/src/components/site-hub/style.scss +13 -0
- 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-path-with-url.js +73 -66
- 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 +56 -23
- package/src/hooks/push-changes-to-global-styles/index.js +63 -9
- package/src/store/private-actions.js +5 -1
- 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/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
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
.edit-site-patterns {
|
|
2
|
-
|
|
2
|
+
border-left: 1px solid $gray-800;
|
|
3
|
+
background: none;
|
|
3
4
|
margin: $header-height 0 0;
|
|
5
|
+
border-radius: 0;
|
|
6
|
+
padding: 0;
|
|
7
|
+
overflow-x: auto;
|
|
8
|
+
|
|
9
|
+
.edit-site-page-content {
|
|
10
|
+
height: 100%;
|
|
11
|
+
position: relative;
|
|
12
|
+
padding: 0;
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-flow: column;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.components-base-control {
|
|
18
|
+
width: 100%;
|
|
19
|
+
@include break-medium {
|
|
20
|
+
width: auto;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
4
24
|
.components-text {
|
|
5
25
|
color: $gray-600;
|
|
6
26
|
}
|
|
@@ -12,33 +32,118 @@
|
|
|
12
32
|
@include break-medium {
|
|
13
33
|
margin: 0;
|
|
14
34
|
}
|
|
15
|
-
}
|
|
16
35
|
|
|
17
|
-
.edit-site-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
column-count: 2;
|
|
36
|
+
.edit-site-patterns__search-block {
|
|
37
|
+
min-width: fit-content;
|
|
38
|
+
flex-grow: 1;
|
|
21
39
|
}
|
|
22
40
|
|
|
23
|
-
//
|
|
24
|
-
//
|
|
25
|
-
|
|
26
|
-
|
|
41
|
+
// The increased specificity here is to overcome component styles
|
|
42
|
+
// without relying on internal component class names.
|
|
43
|
+
.edit-site-patterns__search {
|
|
44
|
+
input[type="search"] {
|
|
45
|
+
height: $button-size-next-default-40px;
|
|
46
|
+
background: $gray-800;
|
|
47
|
+
color: $gray-200;
|
|
27
48
|
|
|
49
|
+
&:focus {
|
|
50
|
+
background: $gray-800;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
svg {
|
|
55
|
+
fill: $gray-600;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.edit-site-patterns__sync-status-filter {
|
|
60
|
+
background: $gray-800;
|
|
61
|
+
border: none;
|
|
62
|
+
height: $button-size-next-default-40px;
|
|
63
|
+
min-width: max-content;
|
|
64
|
+
width: 100%;
|
|
65
|
+
max-width: 100%;
|
|
66
|
+
|
|
67
|
+
@include break-medium {
|
|
68
|
+
width: 300px;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
.edit-site-patterns__sync-status-filter-option:active {
|
|
72
|
+
background: $gray-700;
|
|
73
|
+
color: $gray-100;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.edit-site-patterns__grid-pagination {
|
|
77
|
+
border-top: 1px solid $gray-800;
|
|
78
|
+
background: $gray-900;
|
|
79
|
+
padding: $grid-unit-30 $grid-unit-40;
|
|
80
|
+
position: sticky;
|
|
81
|
+
bottom: 0;
|
|
82
|
+
z-index: z-index(".edit-site-patterns__grid-pagination");
|
|
83
|
+
|
|
84
|
+
.components-button.is-tertiary {
|
|
85
|
+
width: $button-size-compact;
|
|
86
|
+
height: $button-size-compact;
|
|
87
|
+
color: $gray-100;
|
|
88
|
+
background-color: $gray-800;
|
|
89
|
+
justify-content: center;
|
|
90
|
+
|
|
91
|
+
&:disabled {
|
|
92
|
+
color: $gray-600;
|
|
93
|
+
background: none;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&:hover:not(:disabled) {
|
|
97
|
+
background-color: $gray-700;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.edit-site-patterns__header {
|
|
104
|
+
position: sticky;
|
|
105
|
+
top: 0;
|
|
106
|
+
background: $gray-900;
|
|
107
|
+
padding: $grid-unit-40 $grid-unit-40 $grid-unit-20;
|
|
108
|
+
z-index: z-index(".edit-site-patterns__header");
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.edit-site-patterns__section {
|
|
112
|
+
padding: $grid-unit-30 $grid-unit-40;
|
|
113
|
+
flex: 1;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.edit-site-patterns__section-header {
|
|
117
|
+
.screen-reader-shortcut:focus {
|
|
118
|
+
top: 0;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.edit-site-patterns__grid {
|
|
123
|
+
display: grid;
|
|
124
|
+
grid-template-columns: 1fr;
|
|
125
|
+
gap: $grid-unit-40;
|
|
126
|
+
margin-top: 0;
|
|
127
|
+
margin-bottom: 0;
|
|
128
|
+
@include break-large {
|
|
129
|
+
grid-template-columns: 1fr 1fr;
|
|
130
|
+
}
|
|
28
131
|
.edit-site-patterns__pattern {
|
|
29
132
|
break-inside: avoid-column;
|
|
30
133
|
display: flex;
|
|
31
134
|
flex-direction: column;
|
|
32
|
-
margin-bottom: $grid-unit-60;
|
|
33
|
-
|
|
34
135
|
.edit-site-patterns__preview {
|
|
35
|
-
|
|
136
|
+
box-shadow: none;
|
|
137
|
+
border: none;
|
|
138
|
+
padding: 0;
|
|
139
|
+
background-color: unset;
|
|
140
|
+
box-sizing: border-box;
|
|
141
|
+
border-radius: 4px;
|
|
36
142
|
cursor: pointer;
|
|
37
143
|
overflow: hidden;
|
|
38
144
|
|
|
39
145
|
&:focus {
|
|
40
|
-
box-shadow: inset 0 0 0
|
|
41
|
-
|
|
146
|
+
box-shadow: inset 0 0 0 0 $white, 0 0 0 2px var(--wp-admin-theme-color);
|
|
42
147
|
// Windows High Contrast mode will show this outline, but not the box-shadow.
|
|
43
148
|
outline: 2px solid transparent;
|
|
44
149
|
}
|
|
@@ -46,6 +151,10 @@
|
|
|
46
151
|
&.is-inactive {
|
|
47
152
|
cursor: default;
|
|
48
153
|
}
|
|
154
|
+
&.is-inactive:focus {
|
|
155
|
+
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) $gray-800;
|
|
156
|
+
opacity: 0.8;
|
|
157
|
+
}
|
|
49
158
|
}
|
|
50
159
|
|
|
51
160
|
.edit-site-patterns__footer,
|
|
@@ -68,31 +177,28 @@
|
|
|
68
177
|
}
|
|
69
178
|
|
|
70
179
|
.edit-site-patterns__preview {
|
|
71
|
-
flex: 1;
|
|
180
|
+
flex: 0 1 auto;
|
|
72
181
|
margin-bottom: $grid-unit-20;
|
|
73
182
|
}
|
|
74
183
|
}
|
|
75
184
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
185
|
+
.edit-site-patterns__load-more {
|
|
186
|
+
align-self: center;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.edit-site-patterns__pattern-title {
|
|
190
|
+
color: $gray-200;
|
|
191
|
+
|
|
192
|
+
.is-link {
|
|
193
|
+
text-decoration: none;
|
|
81
194
|
color: $gray-200;
|
|
82
195
|
|
|
196
|
+
&:hover,
|
|
83
197
|
&:focus {
|
|
84
|
-
|
|
198
|
+
color: $white;
|
|
85
199
|
}
|
|
86
200
|
}
|
|
87
201
|
|
|
88
|
-
svg {
|
|
89
|
-
fill: $gray-600;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.edit-site-patterns__pattern-title {
|
|
94
|
-
color: $gray-200;
|
|
95
|
-
|
|
96
202
|
.edit-site-patterns__pattern-icon {
|
|
97
203
|
border-radius: $grid-unit-05;
|
|
98
204
|
background: var(--wp-block-synced-color);
|
|
@@ -101,6 +207,10 @@
|
|
|
101
207
|
|
|
102
208
|
.edit-site-patterns__pattern-lock-icon {
|
|
103
209
|
display: inline-flex;
|
|
210
|
+
|
|
211
|
+
svg {
|
|
212
|
+
fill: currentcolor;
|
|
213
|
+
}
|
|
104
214
|
}
|
|
105
215
|
}
|
|
106
216
|
|
|
@@ -4,7 +4,7 @@
|
|
|
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 { decodeEntities } from '@wordpress/html-entities';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Internal dependencies
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
SYNC_TYPES,
|
|
16
16
|
TEMPLATE_PARTS,
|
|
17
17
|
USER_PATTERNS,
|
|
18
|
-
USER_PATTERN_CATEGORY,
|
|
19
18
|
filterOutDuplicatesByName,
|
|
20
19
|
} from './utils';
|
|
21
20
|
import { unlock } from '../../lock-unlock';
|
|
@@ -31,122 +30,83 @@ const templatePartToPattern = ( templatePart ) => ( {
|
|
|
31
30
|
blocks: parse( templatePart.content.raw ),
|
|
32
31
|
categories: [ templatePart.area ],
|
|
33
32
|
description: templatePart.description || '',
|
|
33
|
+
isCustom: templatePart.source === 'custom',
|
|
34
34
|
keywords: templatePart.keywords || [],
|
|
35
|
+
id: createTemplatePartId( templatePart.theme, templatePart.slug ),
|
|
35
36
|
name: createTemplatePartId( templatePart.theme, templatePart.slug ),
|
|
36
|
-
title: templatePart.title.rendered,
|
|
37
|
+
title: decodeEntities( templatePart.title.rendered ),
|
|
37
38
|
type: templatePart.type,
|
|
38
39
|
templatePart,
|
|
39
40
|
} );
|
|
40
41
|
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
if ( category === 'uncategorized' ) {
|
|
44
|
-
return ! templatePartCategories.includes( item.templatePart.area );
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return item.templatePart.area === category;
|
|
48
|
-
};
|
|
42
|
+
const templatePartHasCategory = ( item, category ) =>
|
|
43
|
+
item.templatePart.area === category;
|
|
49
44
|
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
filterValue = ''
|
|
45
|
+
const selectTemplatePartsAsPatterns = (
|
|
46
|
+
select,
|
|
47
|
+
{ categoryId, search = '' } = {}
|
|
54
48
|
) => {
|
|
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 ]
|
|
49
|
+
const { getEntityRecords, getIsResolving } = select( coreStore );
|
|
50
|
+
const query = { per_page: -1 };
|
|
51
|
+
const rawTemplateParts =
|
|
52
|
+
getEntityRecords( 'postType', TEMPLATE_PARTS, query ) ??
|
|
53
|
+
EMPTY_PATTERN_LIST;
|
|
54
|
+
const templateParts = rawTemplateParts.map( ( templatePart ) =>
|
|
55
|
+
templatePartToPattern( templatePart )
|
|
86
56
|
);
|
|
87
57
|
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
return searchItems( templateParts, filterValue, {
|
|
94
|
-
categoryId,
|
|
95
|
-
hasCategory: templatePartHasCategory,
|
|
96
|
-
} );
|
|
97
|
-
}, [ templateParts, filterValue, categoryId ] );
|
|
98
|
-
|
|
99
|
-
return { templateParts: filteredTemplateParts, isResolving };
|
|
100
|
-
};
|
|
58
|
+
const isResolving = getIsResolving( 'getEntityRecords', [
|
|
59
|
+
'postType',
|
|
60
|
+
'wp_template_part',
|
|
61
|
+
query,
|
|
62
|
+
] );
|
|
101
63
|
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
filterValue = ''
|
|
106
|
-
) => {
|
|
107
|
-
const blockPatterns = useSelect( ( select ) => {
|
|
108
|
-
const { getSettings } = unlock( select( editSiteStore ) );
|
|
109
|
-
const settings = getSettings();
|
|
110
|
-
return (
|
|
111
|
-
settings.__experimentalAdditionalBlockPatterns ??
|
|
112
|
-
settings.__experimentalBlockPatterns
|
|
113
|
-
);
|
|
64
|
+
const patterns = searchItems( templateParts, search, {
|
|
65
|
+
categoryId,
|
|
66
|
+
hasCategory: templatePartHasCategory,
|
|
114
67
|
} );
|
|
115
68
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
);
|
|
119
|
-
|
|
120
|
-
const patterns = useMemo(
|
|
121
|
-
() =>
|
|
122
|
-
[ ...( blockPatterns || [] ), ...( restBlockPatterns || [] ) ]
|
|
123
|
-
.filter(
|
|
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
|
-
);
|
|
136
|
-
|
|
137
|
-
const filteredPatterns = useMemo( () => {
|
|
138
|
-
if ( postType !== PATTERNS ) {
|
|
139
|
-
return EMPTY_PATTERN_LIST;
|
|
140
|
-
}
|
|
69
|
+
return { patterns, isResolving };
|
|
70
|
+
};
|
|
141
71
|
|
|
142
|
-
|
|
72
|
+
const selectThemePatterns = ( select, { categoryId, search = '' } = {} ) => {
|
|
73
|
+
const { getSettings } = unlock( select( editSiteStore ) );
|
|
74
|
+
const settings = getSettings();
|
|
75
|
+
const blockPatterns =
|
|
76
|
+
settings.__experimentalAdditionalBlockPatterns ??
|
|
77
|
+
settings.__experimentalBlockPatterns;
|
|
78
|
+
|
|
79
|
+
const restBlockPatterns = select( coreStore ).getBlockPatterns();
|
|
80
|
+
|
|
81
|
+
let patterns = [
|
|
82
|
+
...( blockPatterns || [] ),
|
|
83
|
+
...( restBlockPatterns || [] ),
|
|
84
|
+
]
|
|
85
|
+
.filter(
|
|
86
|
+
( pattern ) => ! CORE_PATTERN_SOURCES.includes( pattern.source )
|
|
87
|
+
)
|
|
88
|
+
.filter( filterOutDuplicatesByName )
|
|
89
|
+
.filter( ( pattern ) => pattern.inserter !== false )
|
|
90
|
+
.map( ( pattern ) => ( {
|
|
91
|
+
...pattern,
|
|
92
|
+
keywords: pattern.keywords || [],
|
|
93
|
+
type: 'pattern',
|
|
94
|
+
blocks: parse( pattern.content ),
|
|
95
|
+
} ) );
|
|
96
|
+
|
|
97
|
+
if ( categoryId ) {
|
|
98
|
+
patterns = searchItems( patterns, search, {
|
|
143
99
|
categoryId,
|
|
144
100
|
hasCategory: ( item, currentCategory ) =>
|
|
145
101
|
item.categories?.includes( currentCategory ),
|
|
146
102
|
} );
|
|
147
|
-
}
|
|
103
|
+
} else {
|
|
104
|
+
patterns = searchItems( patterns, search, {
|
|
105
|
+
hasCategory: ( item ) => ! item.hasOwnProperty( 'categories' ),
|
|
106
|
+
} );
|
|
107
|
+
}
|
|
148
108
|
|
|
149
|
-
return
|
|
109
|
+
return { patterns, isResolving: false };
|
|
150
110
|
};
|
|
151
111
|
|
|
152
112
|
const reusableBlockToPattern = ( reusableBlock ) => ( {
|
|
@@ -160,88 +120,58 @@ const reusableBlockToPattern = ( reusableBlock ) => ( {
|
|
|
160
120
|
reusableBlock,
|
|
161
121
|
} );
|
|
162
122
|
|
|
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
|
-
}
|
|
123
|
+
const selectUserPatterns = ( select, { search = '', syncStatus } = {} ) => {
|
|
124
|
+
const { getEntityRecords, getIsResolving } = select( coreStore );
|
|
177
125
|
|
|
178
|
-
|
|
179
|
-
|
|
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
|
-
);
|
|
126
|
+
const query = { per_page: -1 };
|
|
127
|
+
const records = getEntityRecords( 'postType', USER_PATTERNS, query );
|
|
193
128
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
129
|
+
let patterns = records
|
|
130
|
+
? records.map( ( record ) => reusableBlockToPattern( record ) )
|
|
131
|
+
: EMPTY_PATTERN_LIST;
|
|
132
|
+
const isResolving = getIsResolving( 'getEntityRecords', [
|
|
133
|
+
'postType',
|
|
134
|
+
USER_PATTERNS,
|
|
135
|
+
query,
|
|
136
|
+
] );
|
|
198
137
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
} );
|
|
205
|
-
}, [ unfilteredPatterns, filterValue ] );
|
|
206
|
-
|
|
207
|
-
const patterns = { syncedPatterns: [], unsyncedPatterns: [] };
|
|
138
|
+
if ( syncStatus ) {
|
|
139
|
+
patterns = patterns.filter(
|
|
140
|
+
( pattern ) => pattern.syncStatus === syncStatus
|
|
141
|
+
);
|
|
142
|
+
}
|
|
208
143
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
144
|
+
patterns = searchItems( patterns, search, {
|
|
145
|
+
// We exit user pattern retrieval early if we aren't in the
|
|
146
|
+
// catch-all category for user created patterns, so it has
|
|
147
|
+
// to be in the category.
|
|
148
|
+
hasCategory: () => true,
|
|
215
149
|
} );
|
|
216
150
|
|
|
217
|
-
return patterns;
|
|
151
|
+
return { patterns, isResolving };
|
|
218
152
|
};
|
|
219
153
|
|
|
220
|
-
export const usePatterns = (
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
154
|
+
export const usePatterns = (
|
|
155
|
+
categoryType,
|
|
156
|
+
categoryId,
|
|
157
|
+
{ search = '', syncStatus }
|
|
158
|
+
) => {
|
|
159
|
+
return useSelect(
|
|
160
|
+
( select ) => {
|
|
161
|
+
if ( categoryType === TEMPLATE_PARTS ) {
|
|
162
|
+
return selectTemplatePartsAsPatterns( select, {
|
|
163
|
+
categoryId,
|
|
164
|
+
search,
|
|
165
|
+
} );
|
|
166
|
+
} else if ( categoryType === PATTERNS ) {
|
|
167
|
+
return selectThemePatterns( select, { categoryId, search } );
|
|
168
|
+
} else if ( categoryType === USER_PATTERNS ) {
|
|
169
|
+
return selectUserPatterns( select, { search, syncStatus } );
|
|
170
|
+
}
|
|
171
|
+
return { patterns: EMPTY_PATTERN_LIST, isResolving: false };
|
|
172
|
+
},
|
|
173
|
+
[ categoryId, categoryType, search, syncStatus ]
|
|
237
174
|
);
|
|
238
|
-
|
|
239
|
-
const patterns = {
|
|
240
|
-
syncedPatterns: [ ...templateParts, ...syncedPatterns ],
|
|
241
|
-
unsyncedPatterns: [ ...blockPatterns, ...unsyncedPatterns ],
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
return [ patterns, isResolving ];
|
|
245
175
|
};
|
|
246
176
|
|
|
247
177
|
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' ),
|
|
@@ -87,15 +76,7 @@ export default function PageTemplateParts() {
|
|
|
87
76
|
return (
|
|
88
77
|
<Page
|
|
89
78
|
title={ __( 'Template Parts' ) }
|
|
90
|
-
actions={
|
|
91
|
-
canCreate && (
|
|
92
|
-
<AddNewTemplate
|
|
93
|
-
templateType={ 'wp_template_part' }
|
|
94
|
-
showIcon={ false }
|
|
95
|
-
toggleProps={ { variant: 'primary' } }
|
|
96
|
-
/>
|
|
97
|
-
)
|
|
98
|
-
}
|
|
79
|
+
actions={ <AddNewTemplatePart /> }
|
|
99
80
|
>
|
|
100
81
|
{ templateParts && (
|
|
101
82
|
<Table data={ templateParts } columns={ columns } />
|