@wordpress/edit-site 5.18.0 → 5.19.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-pattern/index.js +62 -1
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/add-new-template/index.js +3 -2
- package/build/components/add-new-template/index.js.map +1 -1
- package/build/components/add-new-template/new-template.js +6 -1
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/add-new-template/utils.js +6 -1
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/app/index.js +2 -7
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/back-button.js +3 -2
- package/build/components/block-editor/back-button.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +20 -16
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/site-editor-canvas.js +1 -3
- package/build/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build/components/block-editor/use-site-editor-settings.js +8 -4
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/canvas-loader/index.js +18 -1
- package/build/components/canvas-loader/index.js.map +1 -1
- package/build/components/editor/index.js +3 -8
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +5 -4
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/font-families.js +68 -0
- package/build/components/global-styles/font-families.js.map +1 -0
- package/build/components/global-styles/font-family-item.js +47 -0
- package/build/components/global-styles/font-family-item.js.map +1 -0
- package/build/components/global-styles/font-library-modal/confirm-delete-dialog.js +31 -0
- package/build/components/global-styles/font-library-modal/confirm-delete-dialog.js.map +1 -0
- package/build/components/global-styles/font-library-modal/context.js +285 -0
- package/build/components/global-styles/font-library-modal/context.js.map +1 -0
- package/build/components/global-styles/font-library-modal/font-card.js +58 -0
- package/build/components/global-styles/font-library-modal/font-card.js.map +1 -0
- package/build/components/global-styles/font-library-modal/font-demo.js +69 -0
- package/build/components/global-styles/font-library-modal/font-demo.js.map +1 -0
- package/build/components/global-styles/font-library-modal/font-variant.js +51 -0
- package/build/components/global-styles/font-library-modal/font-variant.js.map +1 -0
- package/build/components/global-styles/font-library-modal/fonts-grid.js +54 -0
- package/build/components/global-styles/font-library-modal/fonts-grid.js.map +1 -0
- package/build/components/global-styles/font-library-modal/index.js +47 -0
- package/build/components/global-styles/font-library-modal/index.js.map +1 -0
- package/build/components/global-styles/font-library-modal/installed-fonts.js +128 -0
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -0
- package/build/components/global-styles/font-library-modal/library-font-card.js +44 -0
- package/build/components/global-styles/font-library-modal/library-font-card.js.map +1 -0
- package/build/components/global-styles/font-library-modal/library-font-details.js +43 -0
- package/build/components/global-styles/font-library-modal/library-font-details.js.map +1 -0
- package/build/components/global-styles/font-library-modal/library-font-variant.js +59 -0
- package/build/components/global-styles/font-library-modal/library-font-variant.js.map +1 -0
- package/build/components/global-styles/font-library-modal/local-fonts.js +143 -0
- package/build/components/global-styles/font-library-modal/local-fonts.js.map +1 -0
- package/build/components/global-styles/font-library-modal/resolvers.js +37 -0
- package/build/components/global-styles/font-library-modal/resolvers.js.map +1 -0
- package/build/components/global-styles/font-library-modal/tab-layout.js +45 -0
- package/build/components/global-styles/font-library-modal/tab-layout.js.map +1 -0
- package/build/components/global-styles/font-library-modal/utils/constants.js +37 -0
- package/build/components/global-styles/font-library-modal/utils/constants.js.map +1 -0
- package/build/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js +58 -0
- package/build/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js.map +1 -0
- package/build/components/global-styles/font-library-modal/utils/index.js +205 -0
- package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -0
- package/build/components/global-styles/font-library-modal/utils/make-families-from-faces.js +22 -0
- package/build/components/global-styles/font-library-modal/utils/make-families-from-faces.js.map +1 -0
- package/build/components/global-styles/font-library-modal/utils/toggleFont.js +92 -0
- package/build/components/global-styles/font-library-modal/utils/toggleFont.js.map +1 -0
- package/build/components/global-styles/global-styles-provider.js +7 -12
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/screen-block.js +34 -21
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +1 -3
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +0 -1
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +4 -72
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +3 -5
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/global-styles/typogrphy-elements.js +96 -0
- package/build/components/global-styles/typogrphy-elements.js.map +1 -0
- package/build/components/page-patterns/duplicate-menu-item.js +52 -16
- package/build/components/page-patterns/duplicate-menu-item.js.map +1 -1
- package/build/components/page-patterns/grid-item.js +46 -20
- package/build/components/page-patterns/grid-item.js.map +1 -1
- package/build/components/page-patterns/header.js +3 -7
- package/build/components/page-patterns/header.js.map +1 -1
- package/build/components/page-patterns/index.js +3 -3
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/patterns-list.js +7 -7
- package/build/components/page-patterns/patterns-list.js.map +1 -1
- package/build/components/page-patterns/rename-menu-item.js +6 -5
- package/build/components/page-patterns/rename-menu-item.js.map +1 -1
- package/build/components/page-patterns/search-items.js +8 -2
- package/build/components/page-patterns/search-items.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +53 -27
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-patterns/utils.js +1 -20
- package/build/components/page-patterns/utils.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/edit-template.js +33 -24
- package/build/components/sidebar-edit-mode/page-panels/edit-template.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/hooks.js +64 -0
- package/build/components/sidebar-edit-mode/page-panels/hooks.js.map +1 -0
- package/build/components/sidebar-edit-mode/page-panels/index.js +1 -4
- package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js +2 -1
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/reset-default-template.js +56 -0
- package/build/components/sidebar-edit-mode/page-panels/reset-default-template.js.map +1 -0
- package/build/components/sidebar-edit-mode/page-panels/swap-template-button.js +91 -0
- package/build/components/sidebar-edit-mode/page-panels/swap-template-button.js.map +1 -0
- package/build/components/sidebar-edit-mode/template-panel/index.js +11 -9
- package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-panel/last-revision.js +6 -4
- package/build/components/sidebar-edit-mode/template-panel/last-revision.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-panel/pattern-categories.js +211 -0
- package/build/components/sidebar-edit-mode/template-panel/pattern-categories.js.map +1 -0
- package/build/components/sidebar-navigation-screen/index.js +6 -4
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-details-footer/index.js +32 -4
- package/build/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +4 -2
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +4 -31
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/index.js +3 -3
- package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/index.js +18 -8
- package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +34 -5
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +7 -35
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +38 -4
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +2 -1
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/index.js +2 -2
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +1 -1
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/template-actions/index.js +7 -4
- package/build/components/template-actions/index.js.map +1 -1
- package/build/components/template-actions/rename-menu-item.js +3 -2
- package/build/components/template-actions/rename-menu-item.js.map +1 -1
- package/build/components/welcome-guide/styles.js +2 -2
- package/build/components/welcome-guide/styles.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +5 -37
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/store/actions.js +29 -6
- package/build/store/actions.js.map +1 -1
- package/build/utils/constants.js +45 -2
- package/build/utils/constants.js.map +1 -1
- package/build/utils/is-template-removable.js +6 -1
- package/build/utils/is-template-removable.js.map +1 -1
- package/build/utils/is-template-revertable.js +6 -1
- package/build/utils/is-template-revertable.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +66 -5
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/add-new-template/index.js +3 -2
- package/build-module/components/add-new-template/index.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +6 -1
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +6 -1
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/app/index.js +2 -7
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/back-button.js +3 -2
- package/build-module/components/block-editor/back-button.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +21 -17
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/site-editor-canvas.js +3 -5
- package/build-module/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +8 -4
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/canvas-loader/index.js +18 -1
- package/build-module/components/canvas-loader/index.js.map +1 -1
- package/build-module/components/editor/index.js +3 -8
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +5 -4
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/font-families.js +58 -0
- package/build-module/components/global-styles/font-families.js.map +1 -0
- package/build-module/components/global-styles/font-family-item.js +40 -0
- package/build-module/components/global-styles/font-family-item.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/confirm-delete-dialog.js +23 -0
- package/build-module/components/global-styles/font-library-modal/confirm-delete-dialog.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/context.js +276 -0
- package/build-module/components/global-styles/font-library-modal/context.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/font-card.js +49 -0
- package/build-module/components/global-styles/font-library-modal/font-card.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/font-demo.js +62 -0
- package/build-module/components/global-styles/font-library-modal/font-demo.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/font-variant.js +42 -0
- package/build-module/components/global-styles/font-library-modal/font-variant.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/fonts-grid.js +47 -0
- package/build-module/components/global-styles/font-library-modal/fonts-grid.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/index.js +38 -0
- package/build-module/components/global-styles/font-library-modal/index.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +120 -0
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/library-font-card.js +36 -0
- package/build-module/components/global-styles/font-library-modal/library-font-card.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/library-font-details.js +34 -0
- package/build-module/components/global-styles/font-library-modal/library-font-details.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/library-font-variant.js +50 -0
- package/build-module/components/global-styles/font-library-modal/library-font-variant.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/local-fonts.js +135 -0
- package/build-module/components/global-styles/font-library-modal/local-fonts.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/resolvers.js +28 -0
- package/build-module/components/global-styles/font-library-modal/resolvers.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/tab-layout.js +37 -0
- package/build-module/components/global-styles/font-library-modal/tab-layout.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/utils/constants.js +26 -0
- package/build-module/components/global-styles/font-library-modal/utils/constants.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js +52 -0
- package/build-module/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/utils/index.js +190 -0
- package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/utils/make-families-from-faces.js +16 -0
- package/build-module/components/global-styles/font-library-modal/utils/make-families-from-faces.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/utils/toggleFont.js +86 -0
- package/build-module/components/global-styles/font-library-modal/utils/toggleFont.js.map +1 -0
- package/build-module/components/global-styles/global-styles-provider.js +7 -12
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +34 -21
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +1 -3
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +0 -1
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +6 -74
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +3 -5
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/global-styles/typogrphy-elements.js +87 -0
- package/build-module/components/global-styles/typogrphy-elements.js.map +1 -0
- package/build-module/components/page-patterns/duplicate-menu-item.js +51 -16
- package/build-module/components/page-patterns/duplicate-menu-item.js.map +1 -1
- package/build-module/components/page-patterns/grid-item.js +47 -21
- package/build-module/components/page-patterns/grid-item.js.map +1 -1
- package/build-module/components/page-patterns/header.js +3 -7
- package/build-module/components/page-patterns/header.js.map +1 -1
- package/build-module/components/page-patterns/index.js +3 -3
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/patterns-list.js +7 -7
- package/build-module/components/page-patterns/patterns-list.js.map +1 -1
- package/build-module/components/page-patterns/rename-menu-item.js +6 -5
- package/build-module/components/page-patterns/rename-menu-item.js.map +1 -1
- package/build-module/components/page-patterns/search-items.js +8 -2
- package/build-module/components/page-patterns/search-items.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +54 -28
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-patterns/utils.js +0 -11
- package/build-module/components/page-patterns/utils.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js +34 -27
- package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/hooks.js +54 -0
- package/build-module/components/sidebar-edit-mode/page-panels/hooks.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/page-panels/index.js +1 -4
- package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +2 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/reset-default-template.js +49 -0
- package/build-module/components/sidebar-edit-mode/page-panels/reset-default-template.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/page-panels/swap-template-button.js +85 -0
- package/build-module/components/sidebar-edit-mode/page-panels/swap-template-button.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/template-panel/index.js +12 -10
- package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/last-revision.js +8 -6
- package/build-module/components/sidebar-edit-mode/template-panel/last-revision.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/pattern-categories.js +202 -0
- package/build-module/components/sidebar-edit-mode/template-panel/pattern-categories.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen/index.js +6 -4
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js +32 -5
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +4 -2
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +6 -33
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/index.js +3 -3
- package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/index.js +19 -9
- package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +34 -5
- 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 +10 -38
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +38 -4
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +3 -2
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js +2 -2
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +1 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/template-actions/index.js +7 -4
- package/build-module/components/template-actions/index.js.map +1 -1
- package/build-module/components/template-actions/rename-menu-item.js +3 -2
- package/build-module/components/template-actions/rename-menu-item.js.map +1 -1
- package/build-module/components/welcome-guide/styles.js +2 -2
- package/build-module/components/welcome-guide/styles.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +5 -37
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/store/actions.js +30 -7
- package/build-module/store/actions.js.map +1 -1
- package/build-module/utils/constants.js +35 -1
- package/build-module/utils/constants.js.map +1 -1
- package/build-module/utils/is-template-removable.js +6 -1
- package/build-module/utils/is-template-removable.js.map +1 -1
- package/build-module/utils/is-template-revertable.js +6 -1
- package/build-module/utils/is-template-revertable.js.map +1 -1
- package/build-style/style-rtl.css +244 -37
- package/build-style/style.css +244 -37
- package/lib/inflate.js +4082 -0
- package/lib/lib-font.browser.js +3831 -0
- package/lib/unbrotli.js +2679 -0
- package/package.json +40 -40
- package/src/components/add-new-pattern/index.js +83 -5
- package/src/components/add-new-template/index.js +3 -2
- package/src/components/add-new-template/new-template.js +6 -1
- package/src/components/add-new-template/utils.js +12 -3
- package/src/components/app/index.js +9 -12
- package/src/components/block-editor/back-button.js +6 -2
- package/src/components/block-editor/editor-canvas.js +31 -19
- package/src/components/block-editor/site-editor-canvas.js +2 -10
- package/src/components/block-editor/style.scss +88 -1
- package/src/components/block-editor/use-site-editor-settings.js +26 -19
- package/src/components/canvas-loader/index.js +12 -1
- package/src/components/canvas-loader/style.scss +1 -1
- package/src/components/editor/index.js +3 -8
- package/src/components/global-styles/dimensions-panel.js +8 -4
- package/src/components/global-styles/font-families.js +71 -0
- package/src/components/global-styles/font-family-item.js +44 -0
- package/src/components/global-styles/font-library-modal/confirm-delete-dialog.js +33 -0
- package/src/components/global-styles/font-library-modal/context.js +347 -0
- package/src/components/global-styles/font-library-modal/font-card.js +70 -0
- package/src/components/global-styles/font-library-modal/font-demo.js +57 -0
- package/src/components/global-styles/font-library-modal/font-variant.js +53 -0
- package/src/components/global-styles/font-library-modal/fonts-grid.js +55 -0
- package/src/components/global-styles/font-library-modal/index.js +42 -0
- package/src/components/global-styles/font-library-modal/installed-fonts.js +174 -0
- package/src/components/global-styles/font-library-modal/library-font-card.js +40 -0
- package/src/components/global-styles/font-library-modal/library-font-details.js +46 -0
- package/src/components/global-styles/font-library-modal/library-font-variant.js +54 -0
- package/src/components/global-styles/font-library-modal/local-fonts.js +160 -0
- package/src/components/global-styles/font-library-modal/resolvers.js +29 -0
- package/src/components/global-styles/font-library-modal/style.scss +113 -0
- package/src/components/global-styles/font-library-modal/tab-layout.js +50 -0
- package/src/components/global-styles/font-library-modal/utils/constants.js +31 -0
- package/src/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js +58 -0
- package/src/components/global-styles/font-library-modal/utils/index.js +213 -0
- package/src/components/global-styles/font-library-modal/utils/make-families-from-faces.js +15 -0
- package/src/components/global-styles/font-library-modal/utils/test/getDisplaySrcFromFontFace.spec.js +53 -0
- package/src/components/global-styles/font-library-modal/utils/test/getFontFaceVariantName.spec.js +30 -0
- package/src/components/global-styles/font-library-modal/utils/test/getIntersectingFontFaces.spec.js +240 -0
- package/src/components/global-styles/font-library-modal/utils/test/getPreviewStyle.spec.js +121 -0
- package/src/components/global-styles/font-library-modal/utils/test/isUrlEncoded.spec.js +31 -0
- package/src/components/global-styles/font-library-modal/utils/test/makeFamiliesFromFaces.spec.js +57 -0
- package/src/components/global-styles/font-library-modal/utils/test/makeFormDataFromFontFamilies.spec.js +62 -0
- package/src/components/global-styles/font-library-modal/utils/test/mergeFontFaces.spec.js +56 -0
- package/src/components/global-styles/font-library-modal/utils/test/mergeFontFamilies.spec.js +108 -0
- package/src/components/global-styles/font-library-modal/utils/test/setUIValuesNeeded.spec.js +41 -0
- package/src/components/global-styles/font-library-modal/utils/test/toggleFont.spec.js +141 -0
- package/src/components/global-styles/font-library-modal/utils/toggleFont.js +90 -0
- package/src/components/global-styles/global-styles-provider.js +2 -7
- package/src/components/global-styles/screen-block.js +42 -20
- package/src/components/global-styles/screen-revisions/index.js +0 -2
- package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +0 -1
- package/src/components/global-styles/screen-typography.js +7 -95
- package/src/components/global-styles/style-variations-container.js +0 -2
- package/src/components/global-styles/typogrphy-elements.js +110 -0
- package/src/components/list/style.scss +2 -0
- package/src/components/page-patterns/duplicate-menu-item.js +63 -20
- package/src/components/page-patterns/grid-item.js +77 -30
- package/src/components/page-patterns/header.js +3 -12
- package/src/components/page-patterns/index.js +3 -3
- package/src/components/page-patterns/patterns-list.js +7 -7
- package/src/components/page-patterns/rename-menu-item.js +18 -7
- package/src/components/page-patterns/search-items.js +14 -2
- package/src/components/page-patterns/style.scss +1 -5
- package/src/components/page-patterns/use-patterns.js +67 -33
- package/src/components/page-patterns/utils.js +0 -19
- package/src/components/sidebar-edit-mode/page-panels/edit-template.js +47 -33
- package/src/components/sidebar-edit-mode/page-panels/hooks.js +83 -0
- package/src/components/sidebar-edit-mode/page-panels/index.js +0 -4
- package/src/components/sidebar-edit-mode/page-panels/page-summary.js +2 -0
- package/src/components/sidebar-edit-mode/page-panels/reset-default-template.js +44 -0
- package/src/components/sidebar-edit-mode/page-panels/style.scss +41 -10
- package/src/components/sidebar-edit-mode/page-panels/swap-template-button.js +82 -0
- package/src/components/sidebar-edit-mode/template-panel/index.js +28 -24
- package/src/components/sidebar-edit-mode/template-panel/last-revision.js +19 -15
- package/src/components/sidebar-edit-mode/template-panel/pattern-categories.js +270 -0
- package/src/components/sidebar-navigation-screen/index.js +4 -9
- package/src/components/sidebar-navigation-screen/style.scss +7 -1
- package/src/components/sidebar-navigation-screen-details-footer/index.js +38 -10
- package/src/components/sidebar-navigation-screen-details-footer/style.scss +10 -3
- package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +2 -0
- package/src/components/sidebar-navigation-screen-global-styles/index.js +6 -44
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +0 -4
- package/src/components/sidebar-navigation-screen-page/index.js +3 -3
- package/src/components/sidebar-navigation-screen-pattern/index.js +20 -7
- package/src/components/sidebar-navigation-screen-pattern/style.scss +0 -3
- package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +46 -13
- package/src/components/sidebar-navigation-screen-patterns/index.js +14 -49
- package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +48 -6
- package/src/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +3 -5
- package/src/components/sidebar-navigation-screen-template/index.js +2 -4
- package/src/components/sidebar-navigation-screen-templates/index.js +1 -1
- package/src/components/template-actions/index.js +14 -8
- package/src/components/template-actions/rename-menu-item.js +15 -4
- package/src/components/welcome-guide/styles.js +2 -2
- package/src/hooks/push-changes-to-global-styles/index.js +6 -49
- package/src/store/actions.js +39 -13
- package/src/store/test/actions.js +0 -1
- package/src/store/test/reducer.js +0 -1
- package/src/style.scss +1 -1
- package/src/utils/constants.js +38 -3
- package/src/utils/is-template-removable.js +8 -1
- package/src/utils/is-template-revertable.js +8 -1
- package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js +0 -30
- package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js +0 -23
- package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +0 -1
- package/src/components/sidebar-navigation-screen-global-styles/style.scss +0 -12
- package/src/components/sidebar-navigation-screen-patterns/use-my-patterns.js +0 -24
|
@@ -21,9 +21,7 @@ var _lockUnlock = require("../../lock-unlock");
|
|
|
21
21
|
|
|
22
22
|
const {
|
|
23
23
|
cleanEmptyObject,
|
|
24
|
-
GlobalStylesContext
|
|
25
|
-
__experimentalUseGlobalBehaviors: useGlobalBehaviors,
|
|
26
|
-
__experimentalUseHasBehaviorsPanel: useHasBehaviorsPanel
|
|
24
|
+
GlobalStylesContext
|
|
27
25
|
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
28
26
|
|
|
29
27
|
// Block Gap is a special case and isn't defined within the blocks
|
|
@@ -265,9 +263,6 @@ function PushChangesToGlobalStylesControl({
|
|
|
265
263
|
attributes,
|
|
266
264
|
setAttributes
|
|
267
265
|
}) {
|
|
268
|
-
const hasBehaviorsPanel = useHasBehaviorsPanel(attributes, name, {
|
|
269
|
-
blockSupportOnly: true
|
|
270
|
-
});
|
|
271
266
|
const {
|
|
272
267
|
user: userConfig,
|
|
273
268
|
setUserConfig
|
|
@@ -279,13 +274,8 @@ function PushChangesToGlobalStylesControl({
|
|
|
279
274
|
const {
|
|
280
275
|
createSuccessNotice
|
|
281
276
|
} = (0, _data.useDispatch)(_notices.store);
|
|
282
|
-
const {
|
|
283
|
-
inheritedBehaviors,
|
|
284
|
-
setBehavior
|
|
285
|
-
} = useGlobalBehaviors(name);
|
|
286
|
-
const userHasEditedBehaviors = attributes.hasOwnProperty('behaviors') && hasBehaviorsPanel;
|
|
287
277
|
const pushChanges = (0, _element.useCallback)(() => {
|
|
288
|
-
if (changes.length === 0
|
|
278
|
+
if (changes.length === 0) {
|
|
289
279
|
return;
|
|
290
280
|
}
|
|
291
281
|
if (changes.length > 0) {
|
|
@@ -336,37 +326,15 @@ function PushChangesToGlobalStylesControl({
|
|
|
336
326
|
}]
|
|
337
327
|
});
|
|
338
328
|
}
|
|
339
|
-
|
|
340
|
-
__unstableMarkNextChangeAsNotPersistent();
|
|
341
|
-
setAttributes({
|
|
342
|
-
behaviors: undefined
|
|
343
|
-
});
|
|
344
|
-
setBehavior(attributes.behaviors);
|
|
345
|
-
createSuccessNotice((0, _i18n.sprintf)(
|
|
346
|
-
// translators: %s: Title of the block e.g. 'Heading'.
|
|
347
|
-
(0, _i18n.__)('%s behaviors applied.'), (0, _blocks.getBlockType)(name).title), {
|
|
348
|
-
type: 'snackbar',
|
|
349
|
-
actions: [{
|
|
350
|
-
label: (0, _i18n.__)('Undo'),
|
|
351
|
-
onClick() {
|
|
352
|
-
__unstableMarkNextChangeAsNotPersistent();
|
|
353
|
-
setBehavior(inheritedBehaviors);
|
|
354
|
-
setUserConfig(() => userConfig, {
|
|
355
|
-
undoIgnore: true
|
|
356
|
-
});
|
|
357
|
-
}
|
|
358
|
-
}]
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
}, [__unstableMarkNextChangeAsNotPersistent, attributes, changes, createSuccessNotice, inheritedBehaviors, name, setAttributes, setBehavior, setUserConfig, userConfig, userHasEditedBehaviors]);
|
|
329
|
+
}, [__unstableMarkNextChangeAsNotPersistent, attributes, changes, createSuccessNotice, name, setAttributes, setUserConfig, userConfig]);
|
|
362
330
|
return (0, _element.createElement)(_components.BaseControl, {
|
|
363
331
|
className: "edit-site-push-changes-to-global-styles-control",
|
|
364
332
|
help: (0, _i18n.sprintf)(
|
|
365
333
|
// translators: %s: Title of the block e.g. 'Heading'.
|
|
366
|
-
(0, _i18n.__)('Apply this block’s typography, spacing, dimensions, color styles
|
|
334
|
+
(0, _i18n.__)('Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks.'), (0, _blocks.getBlockType)(name).title)
|
|
367
335
|
}, (0, _element.createElement)(_components.BaseControl.VisualLabel, null, (0, _i18n.__)('Styles')), (0, _element.createElement)(_components.Button, {
|
|
368
336
|
variant: "primary",
|
|
369
|
-
disabled: changes.length === 0
|
|
337
|
+
disabled: changes.length === 0,
|
|
370
338
|
onClick: pushChanges
|
|
371
339
|
}, (0, _i18n.__)('Apply globally')));
|
|
372
340
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_hooks","_compose","_blockEditor","_components","_i18n","_blocks","_data","_notices","_hooks2","_lockUnlock","cleanEmptyObject","GlobalStylesContext","__experimentalUseGlobalBehaviors","useGlobalBehaviors","__experimentalUseHasBehaviorsPanel","useHasBehaviorsPanel","unlock","blockEditorPrivateApis","STYLE_PROPERTY","__EXPERIMENTAL_STYLE_PROPERTY","blockGap","value","STYLE_PATH_TO_CSS_VAR_INFIX","STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE","SUPPORTED_STYLES","getValueFromObjectPath","object","path","forEach","fieldName","flatBorderProperties","sides","getBorderStyleChanges","border","presetColor","userStyle","changes","getFallbackBorderStyleChange","color","customColor","style","width","hasColorOrWidth","side","push","globalBorderStyle","useChangesToPush","name","attributes","userConfig","supports","useSupportedStyles","blockUserConfig","styles","blocks","useMemo","flatMap","key","presetAttributeKey","join","presetAttributeValue","linkChanges","hoverPath","hoverValue","includes","borderChanges","currentPath","splice","borderColor","change","setNestedValue","reduce","acc","idx","undefined","Number","isInteger","length","cloneDeep","JSON","parse","stringify","PushChangesToGlobalStylesControl","setAttributes","hasBehaviorsPanel","blockSupportOnly","user","setUserConfig","useContext","__unstableMarkNextChangeAsNotPersistent","useDispatch","blockEditorStore","createSuccessNotice","noticesStore","inheritedBehaviors","setBehavior","userHasEditedBehaviors","hasOwnProperty","pushChanges","useCallback","blockStyles","newBlockStyles","newUserConfig","newBlockAttributes","backgroundColor","textColor","gradient","fontSize","fontFamily","undoIgnore","sprintf","__","getBlockType","title","type","actions","label","onClick","behaviors","createElement","BaseControl","className","help","VisualLabel","Button","variant","disabled","withPushChangesToGlobalStyles","createHigherOrderComponent","BlockEdit","props","blockEditingMode","useBlockEditingMode","supportsStyles","some","feature","hasBlockSupport","Fragment","InspectorAdvancedControls","addFilter"],"sources":["@wordpress/edit-site/src/hooks/push-changes-to-global-styles/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport {\n\tInspectorAdvancedControls,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport { BaseControl, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useContext, useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { useSupportedStyles } from '../../components/global-styles/hooks';\nimport { unlock } from '../../lock-unlock';\n\nconst {\n\tcleanEmptyObject,\n\tGlobalStylesContext,\n\t__experimentalUseGlobalBehaviors: useGlobalBehaviors,\n\t__experimentalUseHasBehaviorsPanel: useHasBehaviorsPanel,\n} = unlock( blockEditorPrivateApis );\n\n// Block Gap is a special case and isn't defined within the blocks\n// style properties config. We'll add it here to allow it to be pushed\n// to global styles as well.\nconst STYLE_PROPERTY = {\n\t...__EXPERIMENTAL_STYLE_PROPERTY,\n\tblockGap: { value: [ 'spacing', 'blockGap' ] },\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'border.color': 'color',\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'elements.link.color.text': 'color',\n\t'elements.link.:hover.color.text': 'color',\n\t'elements.link.typography.fontFamily': 'font-family',\n\t'elements.link.typography.fontSize': 'font-size',\n\t'elements.button.color.text': 'color',\n\t'elements.button.color.background': 'color',\n\t'elements.button.typography.fontFamily': 'font-family',\n\t'elements.button.typography.fontSize': 'font-size',\n\t'elements.caption.color.text': 'color',\n\t'elements.heading.color': 'color',\n\t'elements.heading.color.background': 'color',\n\t'elements.heading.typography.fontFamily': 'font-family',\n\t'elements.heading.gradient': 'gradient',\n\t'elements.heading.color.gradient': 'gradient',\n\t'elements.h1.color': 'color',\n\t'elements.h1.color.background': 'color',\n\t'elements.h1.typography.fontFamily': 'font-family',\n\t'elements.h1.color.gradient': 'gradient',\n\t'elements.h2.color': 'color',\n\t'elements.h2.color.background': 'color',\n\t'elements.h2.typography.fontFamily': 'font-family',\n\t'elements.h2.color.gradient': 'gradient',\n\t'elements.h3.color': 'color',\n\t'elements.h3.color.background': 'color',\n\t'elements.h3.typography.fontFamily': 'font-family',\n\t'elements.h3.color.gradient': 'gradient',\n\t'elements.h4.color': 'color',\n\t'elements.h4.color.background': 'color',\n\t'elements.h4.typography.fontFamily': 'font-family',\n\t'elements.h4.color.gradient': 'gradient',\n\t'elements.h5.color': 'color',\n\t'elements.h5.color.background': 'color',\n\t'elements.h5.typography.fontFamily': 'font-family',\n\t'elements.h5.color.gradient': 'gradient',\n\t'elements.h6.color': 'color',\n\t'elements.h6.color.background': 'color',\n\t'elements.h6.typography.fontFamily': 'font-family',\n\t'elements.h6.color.gradient': 'gradient',\n\t'color.gradient': 'gradient',\n\tblockGap: 'spacing',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {\n\t'border.color': 'borderColor',\n\t'color.background': 'backgroundColor',\n\t'color.text': 'textColor',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'fontSize',\n\t'typography.fontFamily': 'fontFamily',\n};\n\nconst SUPPORTED_STYLES = [ 'border', 'color', 'spacing', 'typography' ];\n\nconst getValueFromObjectPath = ( object, path ) => {\n\tlet value = object;\n\tpath.forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value;\n};\n\nconst flatBorderProperties = [ 'borderColor', 'borderWidth', 'borderStyle' ];\nconst sides = [ 'top', 'right', 'bottom', 'left' ];\n\nfunction getBorderStyleChanges( border, presetColor, userStyle ) {\n\tif ( ! border && ! presetColor ) {\n\t\treturn [];\n\t}\n\n\tconst changes = [\n\t\t...getFallbackBorderStyleChange( 'top', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'right', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'bottom', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'left', border, userStyle ),\n\t];\n\n\t// Handle a flat border i.e. all sides the same, CSS shorthand.\n\tconst { color: customColor, style, width } = border || {};\n\tconst hasColorOrWidth = presetColor || customColor || width;\n\n\tif ( hasColorOrWidth && ! style ) {\n\t\t// Global Styles need individual side configurations to overcome\n\t\t// theme.json configurations which are per side as well.\n\t\tsides.forEach( ( side ) => {\n\t\t\t// Only add fallback border-style if global styles don't already\n\t\t\t// have something set.\n\t\t\tif ( ! userStyle?.[ side ]?.style ) {\n\t\t\t\tchanges.push( {\n\t\t\t\t\tpath: [ 'border', side, 'style' ],\n\t\t\t\t\tvalue: 'solid',\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t}\n\n\treturn changes;\n}\n\nfunction getFallbackBorderStyleChange( side, border, globalBorderStyle ) {\n\tif ( ! border?.[ side ] || globalBorderStyle?.[ side ]?.style ) {\n\t\treturn [];\n\t}\n\n\tconst { color, style, width } = border[ side ];\n\tconst hasColorOrWidth = color || width;\n\n\tif ( ! hasColorOrWidth || style ) {\n\t\treturn [];\n\t}\n\n\treturn [ { path: [ 'border', side, 'style' ], value: 'solid' } ];\n}\n\nfunction useChangesToPush( name, attributes, userConfig ) {\n\tconst supports = useSupportedStyles( name );\n\tconst blockUserConfig = userConfig?.styles?.blocks?.[ name ];\n\n\treturn useMemo( () => {\n\t\tconst changes = supports.flatMap( ( key ) => {\n\t\t\tif ( ! STYLE_PROPERTY[ key ] ) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\tconst { value: path } = STYLE_PROPERTY[ key ];\n\t\t\tconst presetAttributeKey = path.join( '.' );\n\t\t\tconst presetAttributeValue =\n\t\t\t\tattributes[\n\t\t\t\t\tSTYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[ presetAttributeKey ]\n\t\t\t\t];\n\t\t\tconst value = presetAttributeValue\n\t\t\t\t? `var:preset|${ STYLE_PATH_TO_CSS_VAR_INFIX[ presetAttributeKey ] }|${ presetAttributeValue }`\n\t\t\t\t: getValueFromObjectPath( attributes.style, path );\n\n\t\t\t// Links only have a single support entry but have two element\n\t\t\t// style properties, color and hover color. The following check\n\t\t\t// will add the hover color to the changes if required.\n\t\t\tif ( key === 'linkColor' ) {\n\t\t\t\tconst linkChanges = value ? [ { path, value } ] : [];\n\t\t\t\tconst hoverPath = [\n\t\t\t\t\t'elements',\n\t\t\t\t\t'link',\n\t\t\t\t\t':hover',\n\t\t\t\t\t'color',\n\t\t\t\t\t'text',\n\t\t\t\t];\n\t\t\t\tconst hoverValue = getValueFromObjectPath(\n\t\t\t\t\tattributes.style,\n\t\t\t\t\thoverPath\n\t\t\t\t);\n\n\t\t\t\tif ( hoverValue ) {\n\t\t\t\t\tlinkChanges.push( { path: hoverPath, value: hoverValue } );\n\t\t\t\t}\n\n\t\t\t\treturn linkChanges;\n\t\t\t}\n\n\t\t\t// The shorthand border styles can't be mapped directly as global\n\t\t\t// styles requires longhand config.\n\t\t\tif ( flatBorderProperties.includes( key ) && value ) {\n\t\t\t\t// The shorthand config path is included to clear the block attribute.\n\t\t\t\tconst borderChanges = [ { path, value } ];\n\t\t\t\tsides.forEach( ( side ) => {\n\t\t\t\t\tconst currentPath = [ ...path ];\n\t\t\t\t\tcurrentPath.splice( -1, 0, side );\n\t\t\t\t\tborderChanges.push( { path: currentPath, value } );\n\t\t\t\t} );\n\t\t\t\treturn borderChanges;\n\t\t\t}\n\n\t\t\treturn value ? [ { path, value } ] : [];\n\t\t} );\n\n\t\t// To ensure display of a visible border, global styles require a\n\t\t// default border style if a border color or width is present.\n\t\tgetBorderStyleChanges(\n\t\t\tattributes.style?.border,\n\t\t\tattributes.borderColor,\n\t\t\tblockUserConfig?.border\n\t\t).forEach( ( change ) => changes.push( change ) );\n\n\t\treturn changes;\n\t}, [ supports, attributes, blockUserConfig ] );\n}\n\n/**\n * Sets the value at path of object.\n * If a portion of path doesn’t exist, it’s created.\n * Arrays are created for missing index properties while objects are created\n * for all other missing properties.\n *\n * This function intentionally mutates the input object.\n *\n * Inspired by _.set().\n *\n * @see https://lodash.com/docs/4.17.15#set\n *\n * @todo Needs to be deduplicated with its copy in `@wordpress/core-data`.\n *\n * @param {Object} object Object to modify\n * @param {Array} path Path of the property to set.\n * @param {*} value Value to set.\n */\nfunction setNestedValue( object, path, value ) {\n\tif ( ! object || typeof object !== 'object' ) {\n\t\treturn object;\n\t}\n\n\tpath.reduce( ( acc, key, idx ) => {\n\t\tif ( acc[ key ] === undefined ) {\n\t\t\tif ( Number.isInteger( path[ idx + 1 ] ) ) {\n\t\t\t\tacc[ key ] = [];\n\t\t\t} else {\n\t\t\t\tacc[ key ] = {};\n\t\t\t}\n\t\t}\n\t\tif ( idx === path.length - 1 ) {\n\t\t\tacc[ key ] = value;\n\t\t}\n\t\treturn acc[ key ];\n\t}, object );\n\n\treturn object;\n}\n\nfunction cloneDeep( object ) {\n\treturn ! object ? {} : JSON.parse( JSON.stringify( object ) );\n}\n\nfunction PushChangesToGlobalStylesControl( {\n\tname,\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst hasBehaviorsPanel = useHasBehaviorsPanel( attributes, name, {\n\t\tblockSupportOnly: true,\n\t} );\n\n\tconst { user: userConfig, setUserConfig } =\n\t\tuseContext( GlobalStylesContext );\n\n\tconst changes = useChangesToPush( name, attributes, userConfig );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst { inheritedBehaviors, setBehavior } = useGlobalBehaviors( name );\n\n\tconst userHasEditedBehaviors =\n\t\tattributes.hasOwnProperty( 'behaviors' ) && hasBehaviorsPanel;\n\n\tconst pushChanges = useCallback( () => {\n\t\tif ( changes.length === 0 && ! userHasEditedBehaviors ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( changes.length > 0 ) {\n\t\t\tconst { style: blockStyles } = attributes;\n\n\t\t\tconst newBlockStyles = cloneDeep( blockStyles );\n\t\t\tconst newUserConfig = cloneDeep( userConfig );\n\n\t\t\tfor ( const { path, value } of changes ) {\n\t\t\t\tsetNestedValue( newBlockStyles, path, undefined );\n\t\t\t\tsetNestedValue(\n\t\t\t\t\tnewUserConfig,\n\t\t\t\t\t[ 'styles', 'blocks', name, ...path ],\n\t\t\t\t\tvalue\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst newBlockAttributes = {\n\t\t\t\tborderColor: undefined,\n\t\t\t\tbackgroundColor: undefined,\n\t\t\t\ttextColor: undefined,\n\t\t\t\tgradient: undefined,\n\t\t\t\tfontSize: undefined,\n\t\t\t\tfontFamily: undefined,\n\t\t\t\tstyle: cleanEmptyObject( newBlockStyles ),\n\t\t\t};\n\n\t\t\t// @wordpress/core-data doesn't support editing multiple entity types in\n\t\t\t// a single undo level. So for now, we disable @wordpress/core-data undo\n\t\t\t// tracking and implement our own Undo button in the snackbar\n\t\t\t// notification.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( newBlockAttributes );\n\t\t\tsetUserConfig( () => newUserConfig, { undoIgnore: true } );\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t\t__( '%s styles applied.' ),\n\t\t\t\t\tgetBlockType( name ).title\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\t\tsetAttributes( attributes );\n\t\t\t\t\t\t\t\tsetUserConfig( () => userConfig, {\n\t\t\t\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tif ( userHasEditedBehaviors ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { behaviors: undefined } );\n\t\t\tsetBehavior( attributes.behaviors );\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t\t__( '%s behaviors applied.' ),\n\t\t\t\t\tgetBlockType( name ).title\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\t\tsetBehavior( inheritedBehaviors );\n\t\t\t\t\t\t\t\tsetUserConfig( () => userConfig, {\n\t\t\t\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}, [\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tattributes,\n\t\tchanges,\n\t\tcreateSuccessNotice,\n\t\tinheritedBehaviors,\n\t\tname,\n\t\tsetAttributes,\n\t\tsetBehavior,\n\t\tsetUserConfig,\n\t\tuserConfig,\n\t\tuserHasEditedBehaviors,\n\t] );\n\n\treturn (\n\t\t<BaseControl\n\t\t\tclassName=\"edit-site-push-changes-to-global-styles-control\"\n\t\t\thelp={ sprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__(\n\t\t\t\t\t'Apply this block’s typography, spacing, dimensions, color styles, and behaviors to all %s blocks.'\n\t\t\t\t),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t) }\n\t\t>\n\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t{ __( 'Styles' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tdisabled={ changes.length === 0 && ! userHasEditedBehaviors }\n\t\t\t\tonClick={ pushChanges }\n\t\t\t>\n\t\t\t\t{ __( 'Apply globally' ) }\n\t\t\t</Button>\n\t\t</BaseControl>\n\t);\n}\n\nconst withPushChangesToGlobalStyles = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst blockEditingMode = useBlockEditingMode();\n\t\tconst supportsStyles = SUPPORTED_STYLES.some( ( feature ) =>\n\t\t\thasBlockSupport( props.name, feature )\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ blockEditingMode === 'default' && supportsStyles && (\n\t\t\t\t\t<InspectorAdvancedControls>\n\t\t\t\t\t\t<PushChangesToGlobalStylesControl { ...props } />\n\t\t\t\t\t</InspectorAdvancedControls>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/push-changes-to-global-styles',\n\twithPushChangesToGlobalStyles\n);\n"],"mappings":";;AAkBA,IAAAA,QAAA,GAAAC,OAAA;AAfA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAMA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAA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AAAvI,QAAA,CAAAyH,aAAA,EAACrH,YAAA,CAAAwI,yBAAyB,QACzB,IAAA5I,QAAA,CAAAyH,aAAA,EAACrC,gCAAgC;IAAA,GAAMgD;EAAK,CAAI,CACtB,CAE3B,CAAC;AAEL,CACD,CAAC;AAED,IAAAS,gBAAS,EACR,kBAAkB,EAClB,8CAA8C,EAC9CZ,6BACD,CAAC"}
|
|
1
|
+
{"version":3,"names":["_element","require","_hooks","_compose","_blockEditor","_components","_i18n","_blocks","_data","_notices","_hooks2","_lockUnlock","cleanEmptyObject","GlobalStylesContext","unlock","blockEditorPrivateApis","STYLE_PROPERTY","__EXPERIMENTAL_STYLE_PROPERTY","blockGap","value","STYLE_PATH_TO_CSS_VAR_INFIX","STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE","SUPPORTED_STYLES","getValueFromObjectPath","object","path","forEach","fieldName","flatBorderProperties","sides","getBorderStyleChanges","border","presetColor","userStyle","changes","getFallbackBorderStyleChange","color","customColor","style","width","hasColorOrWidth","side","push","globalBorderStyle","useChangesToPush","name","attributes","userConfig","supports","useSupportedStyles","blockUserConfig","styles","blocks","useMemo","flatMap","key","presetAttributeKey","join","presetAttributeValue","linkChanges","hoverPath","hoverValue","includes","borderChanges","currentPath","splice","borderColor","change","setNestedValue","reduce","acc","idx","undefined","Number","isInteger","length","cloneDeep","JSON","parse","stringify","PushChangesToGlobalStylesControl","setAttributes","user","setUserConfig","useContext","__unstableMarkNextChangeAsNotPersistent","useDispatch","blockEditorStore","createSuccessNotice","noticesStore","pushChanges","useCallback","blockStyles","newBlockStyles","newUserConfig","newBlockAttributes","backgroundColor","textColor","gradient","fontSize","fontFamily","undoIgnore","sprintf","__","getBlockType","title","type","actions","label","onClick","createElement","BaseControl","className","help","VisualLabel","Button","variant","disabled","withPushChangesToGlobalStyles","createHigherOrderComponent","BlockEdit","props","blockEditingMode","useBlockEditingMode","supportsStyles","some","feature","hasBlockSupport","Fragment","InspectorAdvancedControls","addFilter"],"sources":["@wordpress/edit-site/src/hooks/push-changes-to-global-styles/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport {\n\tInspectorAdvancedControls,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport { BaseControl, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useContext, useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { useSupportedStyles } from '../../components/global-styles/hooks';\nimport { unlock } from '../../lock-unlock';\n\nconst { cleanEmptyObject, GlobalStylesContext } = unlock(\n\tblockEditorPrivateApis\n);\n\n// Block Gap is a special case and isn't defined within the blocks\n// style properties config. We'll add it here to allow it to be pushed\n// to global styles as well.\nconst STYLE_PROPERTY = {\n\t...__EXPERIMENTAL_STYLE_PROPERTY,\n\tblockGap: { value: [ 'spacing', 'blockGap' ] },\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'border.color': 'color',\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'elements.link.color.text': 'color',\n\t'elements.link.:hover.color.text': 'color',\n\t'elements.link.typography.fontFamily': 'font-family',\n\t'elements.link.typography.fontSize': 'font-size',\n\t'elements.button.color.text': 'color',\n\t'elements.button.color.background': 'color',\n\t'elements.button.typography.fontFamily': 'font-family',\n\t'elements.button.typography.fontSize': 'font-size',\n\t'elements.caption.color.text': 'color',\n\t'elements.heading.color': 'color',\n\t'elements.heading.color.background': 'color',\n\t'elements.heading.typography.fontFamily': 'font-family',\n\t'elements.heading.gradient': 'gradient',\n\t'elements.heading.color.gradient': 'gradient',\n\t'elements.h1.color': 'color',\n\t'elements.h1.color.background': 'color',\n\t'elements.h1.typography.fontFamily': 'font-family',\n\t'elements.h1.color.gradient': 'gradient',\n\t'elements.h2.color': 'color',\n\t'elements.h2.color.background': 'color',\n\t'elements.h2.typography.fontFamily': 'font-family',\n\t'elements.h2.color.gradient': 'gradient',\n\t'elements.h3.color': 'color',\n\t'elements.h3.color.background': 'color',\n\t'elements.h3.typography.fontFamily': 'font-family',\n\t'elements.h3.color.gradient': 'gradient',\n\t'elements.h4.color': 'color',\n\t'elements.h4.color.background': 'color',\n\t'elements.h4.typography.fontFamily': 'font-family',\n\t'elements.h4.color.gradient': 'gradient',\n\t'elements.h5.color': 'color',\n\t'elements.h5.color.background': 'color',\n\t'elements.h5.typography.fontFamily': 'font-family',\n\t'elements.h5.color.gradient': 'gradient',\n\t'elements.h6.color': 'color',\n\t'elements.h6.color.background': 'color',\n\t'elements.h6.typography.fontFamily': 'font-family',\n\t'elements.h6.color.gradient': 'gradient',\n\t'color.gradient': 'gradient',\n\tblockGap: 'spacing',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {\n\t'border.color': 'borderColor',\n\t'color.background': 'backgroundColor',\n\t'color.text': 'textColor',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'fontSize',\n\t'typography.fontFamily': 'fontFamily',\n};\n\nconst SUPPORTED_STYLES = [ 'border', 'color', 'spacing', 'typography' ];\n\nconst getValueFromObjectPath = ( object, path ) => {\n\tlet value = object;\n\tpath.forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value;\n};\n\nconst flatBorderProperties = [ 'borderColor', 'borderWidth', 'borderStyle' ];\nconst sides = [ 'top', 'right', 'bottom', 'left' ];\n\nfunction getBorderStyleChanges( border, presetColor, userStyle ) {\n\tif ( ! border && ! presetColor ) {\n\t\treturn [];\n\t}\n\n\tconst changes = [\n\t\t...getFallbackBorderStyleChange( 'top', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'right', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'bottom', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'left', border, userStyle ),\n\t];\n\n\t// Handle a flat border i.e. all sides the same, CSS shorthand.\n\tconst { color: customColor, style, width } = border || {};\n\tconst hasColorOrWidth = presetColor || customColor || width;\n\n\tif ( hasColorOrWidth && ! style ) {\n\t\t// Global Styles need individual side configurations to overcome\n\t\t// theme.json configurations which are per side as well.\n\t\tsides.forEach( ( side ) => {\n\t\t\t// Only add fallback border-style if global styles don't already\n\t\t\t// have something set.\n\t\t\tif ( ! userStyle?.[ side ]?.style ) {\n\t\t\t\tchanges.push( {\n\t\t\t\t\tpath: [ 'border', side, 'style' ],\n\t\t\t\t\tvalue: 'solid',\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t}\n\n\treturn changes;\n}\n\nfunction getFallbackBorderStyleChange( side, border, globalBorderStyle ) {\n\tif ( ! border?.[ side ] || globalBorderStyle?.[ side ]?.style ) {\n\t\treturn [];\n\t}\n\n\tconst { color, style, width } = border[ side ];\n\tconst hasColorOrWidth = color || width;\n\n\tif ( ! hasColorOrWidth || style ) {\n\t\treturn [];\n\t}\n\n\treturn [ { path: [ 'border', side, 'style' ], value: 'solid' } ];\n}\n\nfunction useChangesToPush( name, attributes, userConfig ) {\n\tconst supports = useSupportedStyles( name );\n\tconst blockUserConfig = userConfig?.styles?.blocks?.[ name ];\n\n\treturn useMemo( () => {\n\t\tconst changes = supports.flatMap( ( key ) => {\n\t\t\tif ( ! STYLE_PROPERTY[ key ] ) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\tconst { value: path } = STYLE_PROPERTY[ key ];\n\t\t\tconst presetAttributeKey = path.join( '.' );\n\t\t\tconst presetAttributeValue =\n\t\t\t\tattributes[\n\t\t\t\t\tSTYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[ presetAttributeKey ]\n\t\t\t\t];\n\t\t\tconst value = presetAttributeValue\n\t\t\t\t? `var:preset|${ STYLE_PATH_TO_CSS_VAR_INFIX[ presetAttributeKey ] }|${ presetAttributeValue }`\n\t\t\t\t: getValueFromObjectPath( attributes.style, path );\n\n\t\t\t// Links only have a single support entry but have two element\n\t\t\t// style properties, color and hover color. The following check\n\t\t\t// will add the hover color to the changes if required.\n\t\t\tif ( key === 'linkColor' ) {\n\t\t\t\tconst linkChanges = value ? [ { path, value } ] : [];\n\t\t\t\tconst hoverPath = [\n\t\t\t\t\t'elements',\n\t\t\t\t\t'link',\n\t\t\t\t\t':hover',\n\t\t\t\t\t'color',\n\t\t\t\t\t'text',\n\t\t\t\t];\n\t\t\t\tconst hoverValue = getValueFromObjectPath(\n\t\t\t\t\tattributes.style,\n\t\t\t\t\thoverPath\n\t\t\t\t);\n\n\t\t\t\tif ( hoverValue ) {\n\t\t\t\t\tlinkChanges.push( { path: hoverPath, value: hoverValue } );\n\t\t\t\t}\n\n\t\t\t\treturn linkChanges;\n\t\t\t}\n\n\t\t\t// The shorthand border styles can't be mapped directly as global\n\t\t\t// styles requires longhand config.\n\t\t\tif ( flatBorderProperties.includes( key ) && value ) {\n\t\t\t\t// The shorthand config path is included to clear the block attribute.\n\t\t\t\tconst borderChanges = [ { path, value } ];\n\t\t\t\tsides.forEach( ( side ) => {\n\t\t\t\t\tconst currentPath = [ ...path ];\n\t\t\t\t\tcurrentPath.splice( -1, 0, side );\n\t\t\t\t\tborderChanges.push( { path: currentPath, value } );\n\t\t\t\t} );\n\t\t\t\treturn borderChanges;\n\t\t\t}\n\n\t\t\treturn value ? [ { path, value } ] : [];\n\t\t} );\n\n\t\t// To ensure display of a visible border, global styles require a\n\t\t// default border style if a border color or width is present.\n\t\tgetBorderStyleChanges(\n\t\t\tattributes.style?.border,\n\t\t\tattributes.borderColor,\n\t\t\tblockUserConfig?.border\n\t\t).forEach( ( change ) => changes.push( change ) );\n\n\t\treturn changes;\n\t}, [ supports, attributes, blockUserConfig ] );\n}\n\n/**\n * Sets the value at path of object.\n * If a portion of path doesn’t exist, it’s created.\n * Arrays are created for missing index properties while objects are created\n * for all other missing properties.\n *\n * This function intentionally mutates the input object.\n *\n * Inspired by _.set().\n *\n * @see https://lodash.com/docs/4.17.15#set\n *\n * @todo Needs to be deduplicated with its copy in `@wordpress/core-data`.\n *\n * @param {Object} object Object to modify\n * @param {Array} path Path of the property to set.\n * @param {*} value Value to set.\n */\nfunction setNestedValue( object, path, value ) {\n\tif ( ! object || typeof object !== 'object' ) {\n\t\treturn object;\n\t}\n\n\tpath.reduce( ( acc, key, idx ) => {\n\t\tif ( acc[ key ] === undefined ) {\n\t\t\tif ( Number.isInteger( path[ idx + 1 ] ) ) {\n\t\t\t\tacc[ key ] = [];\n\t\t\t} else {\n\t\t\t\tacc[ key ] = {};\n\t\t\t}\n\t\t}\n\t\tif ( idx === path.length - 1 ) {\n\t\t\tacc[ key ] = value;\n\t\t}\n\t\treturn acc[ key ];\n\t}, object );\n\n\treturn object;\n}\n\nfunction cloneDeep( object ) {\n\treturn ! object ? {} : JSON.parse( JSON.stringify( object ) );\n}\n\nfunction PushChangesToGlobalStylesControl( {\n\tname,\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst { user: userConfig, setUserConfig } =\n\t\tuseContext( GlobalStylesContext );\n\n\tconst changes = useChangesToPush( name, attributes, userConfig );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst pushChanges = useCallback( () => {\n\t\tif ( changes.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( changes.length > 0 ) {\n\t\t\tconst { style: blockStyles } = attributes;\n\n\t\t\tconst newBlockStyles = cloneDeep( blockStyles );\n\t\t\tconst newUserConfig = cloneDeep( userConfig );\n\n\t\t\tfor ( const { path, value } of changes ) {\n\t\t\t\tsetNestedValue( newBlockStyles, path, undefined );\n\t\t\t\tsetNestedValue(\n\t\t\t\t\tnewUserConfig,\n\t\t\t\t\t[ 'styles', 'blocks', name, ...path ],\n\t\t\t\t\tvalue\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst newBlockAttributes = {\n\t\t\t\tborderColor: undefined,\n\t\t\t\tbackgroundColor: undefined,\n\t\t\t\ttextColor: undefined,\n\t\t\t\tgradient: undefined,\n\t\t\t\tfontSize: undefined,\n\t\t\t\tfontFamily: undefined,\n\t\t\t\tstyle: cleanEmptyObject( newBlockStyles ),\n\t\t\t};\n\n\t\t\t// @wordpress/core-data doesn't support editing multiple entity types in\n\t\t\t// a single undo level. So for now, we disable @wordpress/core-data undo\n\t\t\t// tracking and implement our own Undo button in the snackbar\n\t\t\t// notification.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( newBlockAttributes );\n\t\t\tsetUserConfig( () => newUserConfig, { undoIgnore: true } );\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t\t__( '%s styles applied.' ),\n\t\t\t\t\tgetBlockType( name ).title\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\t\tsetAttributes( attributes );\n\t\t\t\t\t\t\t\tsetUserConfig( () => userConfig, {\n\t\t\t\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}, [\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tattributes,\n\t\tchanges,\n\t\tcreateSuccessNotice,\n\t\tname,\n\t\tsetAttributes,\n\t\tsetUserConfig,\n\t\tuserConfig,\n\t] );\n\n\treturn (\n\t\t<BaseControl\n\t\t\tclassName=\"edit-site-push-changes-to-global-styles-control\"\n\t\t\thelp={ sprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__(\n\t\t\t\t\t'Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks.'\n\t\t\t\t),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t) }\n\t\t>\n\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t{ __( 'Styles' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tdisabled={ changes.length === 0 }\n\t\t\t\tonClick={ pushChanges }\n\t\t\t>\n\t\t\t\t{ __( 'Apply globally' ) }\n\t\t\t</Button>\n\t\t</BaseControl>\n\t);\n}\n\nconst withPushChangesToGlobalStyles = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst blockEditingMode = useBlockEditingMode();\n\t\tconst supportsStyles = SUPPORTED_STYLES.some( ( feature ) =>\n\t\t\thasBlockSupport( props.name, feature )\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ blockEditingMode === 'default' && supportsStyles && (\n\t\t\t\t\t<InspectorAdvancedControls>\n\t\t\t\t\t\t<PushChangesToGlobalStylesControl { ...props } />\n\t\t\t\t\t</InspectorAdvancedControls>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/push-changes-to-global-styles',\n\twithPushChangesToGlobalStyles\n);\n"],"mappings":";;A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IAAM;EAC7B,MAAMC,gBAAgB,GAAG,IAAAC,gCAAmB,EAAC,CAAC;EAC9C,MAAMC,cAAc,GAAGtG,gBAAgB,CAACuG,IAAI,CAAIC,OAAO,IACtD,IAAAC,uBAAe,EAAEN,KAAK,CAAC5E,IAAI,EAAEiF,OAAQ,CACtC,CAAC;EAED,OACC,IAAA9H,QAAA,CAAA8G,aAAA,EAAA9G,QAAA,CAAAgI,QAAA,QACC,IAAAhI,QAAA,CAAA8G,aAAA,EAACU,SAAS;IAAA,GAAMC;EAAK,CAAI,CAAC,EACxBC,gBAAgB,KAAK,SAAS,IAAIE,cAAc,IACjD,IAAA5H,QAAA,CAAA8G,aAAA,EAAC1G,YAAA,CAAA6H,yBAAyB,QACzB,IAAAjI,QAAA,CAAA8G,aAAA,EAAC9B,gCAAgC;IAAA,GAAMyC;EAAK,CAAI,CACtB,CAE3B,CAAC;AAEL,CACD,CAAC;AAED,IAAAS,gBAAS,EACR,kBAAkB,EAClB,8CAA8C,EAC9CZ,6BACD,CAAC"}
|
package/build/store/actions.js
CHANGED
|
@@ -232,7 +232,7 @@ function setHomeTemplateId() {
|
|
|
232
232
|
*
|
|
233
233
|
* @param {Object} context The context object.
|
|
234
234
|
*
|
|
235
|
-
* @return {
|
|
235
|
+
* @return {Object} Action object.
|
|
236
236
|
*/
|
|
237
237
|
function setEditedPostContext(context) {
|
|
238
238
|
return {
|
|
@@ -257,12 +257,35 @@ const setPage = page => async ({
|
|
|
257
257
|
dispatch,
|
|
258
258
|
registry
|
|
259
259
|
}) => {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
260
|
+
let template;
|
|
261
|
+
const getDefaultTemplate = async slug => (0, _apiFetch.default)({
|
|
262
|
+
path: (0, _url.addQueryArgs)('/wp/v2/templates/lookup', {
|
|
263
|
+
slug: `page-${slug}`
|
|
264
|
+
})
|
|
265
|
+
});
|
|
266
|
+
if (page.path) {
|
|
267
|
+
template = await registry.resolveSelect(_coreData.store).__experimentalGetTemplateForLink(page.path);
|
|
268
|
+
} else {
|
|
269
|
+
const editedEntity = await registry.resolveSelect(_coreData.store).getEditedEntityRecord('postType', page.context?.postType || 'post', page.context?.postId);
|
|
270
|
+
const currentTemplateSlug = editedEntity?.template;
|
|
271
|
+
if (currentTemplateSlug) {
|
|
272
|
+
const currentTemplate = (await registry.resolveSelect(_coreData.store).getEntityRecords('postType', 'wp_template', {
|
|
273
|
+
per_page: -1
|
|
274
|
+
}))?.find(({
|
|
275
|
+
slug
|
|
276
|
+
}) => slug === currentTemplateSlug);
|
|
277
|
+
if (currentTemplate) {
|
|
278
|
+
template = currentTemplate;
|
|
279
|
+
} else {
|
|
280
|
+
// If a page has a `template` set and is not included in the list
|
|
281
|
+
// of the current theme's templates, query for current theme's default template.
|
|
282
|
+
template = await getDefaultTemplate(editedEntity?.slug);
|
|
283
|
+
}
|
|
284
|
+
} else {
|
|
285
|
+
// Page's `template` is empty, that indicates we need to use the default template for the page.
|
|
286
|
+
template = await getDefaultTemplate(editedEntity?.slug);
|
|
287
|
+
}
|
|
264
288
|
}
|
|
265
|
-
const template = await registry.resolveSelect(_coreData.store).__experimentalGetTemplateForLink(page.path);
|
|
266
289
|
if (!template) {
|
|
267
290
|
return;
|
|
268
291
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_apiFetch","_interopRequireDefault","require","_blocks","_deprecated","_url","_i18n","_notices","_coreData","_interface","_blockEditor","_a11y","_preferences","_htmlEntities","_constants","_isTemplateRevertable","toggleFeature","featureName","registry","deprecated","since","alternative","dispatch","preferencesStore","toggle","__experimentalSetPreviewDeviceType","deviceType","type","setTemplate","templateId","templateSlug","template","resolveSelect","coreStore","getEntityRecord","slug","error","postType","id","context","exports","addTemplate","newTemplate","saveEntityRecord","content","editEntityRecord","blocks","parse","undoIgnore","removeTemplate","deleteEntityRecord","force","lastError","select","getLastEntityDeleteError","templateTitle","title","rendered","noticesStore","createSuccessNotice","sprintf","__","decodeEntities","errorMessage","message","code","createErrorNotice","setTemplatePart","templatePartId","setNavigationMenu","navigationMenuId","setEditedEntity","postId","setHomeTemplateId","version","setEditedPostContext","setPage","page","path","entity","getPathAndQueryString","link","__experimentalGetTemplateForLink","setNavigationPanelActiveMenu","openNavigationPanelToMenu","setIsNavigationPanelOpened","setIsInserterOpened","value","updateSettings","settings","setIsListViewOpened","isOpen","isDistractionFree","get","toggleDistractionFree","setIsSaveViewOpened","revertTemplate","allowUndo","noticeId","removeNotice","isTemplateRevertable","templateEntityConfig","getEntityConfig","fileTemplatePath","addQueryArgs","baseURL","source","fileTemplate","apiFetch","serializeBlocks","blocksForSerialization","__unstableSerializeAndClean","edited","getEditedEntityRecord","raw","undoRevert","actions","label","onClick","openGeneralSidebar","name","interfaceStore","enableComplementaryArea","editSiteStoreName","closeGeneralSidebar","disableComplementaryArea","switchEditorMode","mode","set","blockEditorStore","clearSelectedBlock","speak","setHasPageContentFocus","hasPageContentFocus","batch","createInfoNotice"],"sources":["@wordpress/edit-site/src/store/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { parse, __unstableSerializeAndClean } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\nimport { addQueryArgs, getPathAndQueryString } from '@wordpress/url';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { speak } from '@wordpress/a11y';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME as editSiteStoreName } from './constants';\nimport isTemplateRevertable from '../utils/is-template-revertable';\n\n/**\n * Dispatches an action that toggles a feature flag.\n *\n * @param {string} featureName Feature name.\n */\nexport function toggleFeature( featureName ) {\n\treturn function ( { registry } ) {\n\t\tdeprecated( \"select( 'core/edit-site' ).toggleFeature( featureName )\", {\n\t\t\tsince: '6.0',\n\t\t\talternative:\n\t\t\t\t\"select( 'core/preferences').toggle( 'core/edit-site', featureName )\",\n\t\t} );\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.toggle( 'core/edit-site', featureName );\n\t};\n}\n\n/**\n * Action that changes the width of the editing canvas.\n *\n * @param {string} deviceType\n *\n * @return {Object} Action object.\n */\nexport function __experimentalSetPreviewDeviceType( deviceType ) {\n\treturn {\n\t\ttype: 'SET_PREVIEW_DEVICE_TYPE',\n\t\tdeviceType,\n\t};\n}\n\n/**\n * Action that sets a template, optionally fetching it from REST API.\n *\n * @param {number} templateId The template ID.\n * @param {string} templateSlug The template slug.\n * @return {Object} Action object.\n */\nexport const setTemplate =\n\t( templateId, templateSlug ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tif ( ! templateSlug ) {\n\t\t\ttry {\n\t\t\t\tconst template = await registry\n\t\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t\t.getEntityRecord( 'postType', 'wp_template', templateId );\n\t\t\t\ttemplateSlug = template?.slug;\n\t\t\t} catch ( error ) {}\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: templateId,\n\t\t\tcontext: { templateSlug },\n\t\t} );\n\t};\n\n/**\n * Action that adds a new template and sets it as the current template.\n *\n * @param {Object} template The template.\n *\n * @return {Object} Action object used to set the current template.\n */\nexport const addTemplate =\n\t( template ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tconst newTemplate = await registry\n\t\t\t.dispatch( coreStore )\n\t\t\t.saveEntityRecord( 'postType', 'wp_template', template );\n\n\t\tif ( template.content ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_template',\n\t\t\t\t\tnewTemplate.id,\n\t\t\t\t\t{ blocks: parse( template.content ) },\n\t\t\t\t\t{ undoIgnore: true }\n\t\t\t\t);\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: newTemplate.id,\n\t\t\tcontext: { templateSlug: newTemplate.slug },\n\t\t} );\n\t};\n\n/**\n * Action that removes a template.\n *\n * @param {Object} template The template object.\n */\nexport const removeTemplate =\n\t( template ) =>\n\tasync ( { registry } ) => {\n\t\ttry {\n\t\t\tawait registry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.deleteEntityRecord( 'postType', template.type, template.id, {\n\t\t\t\t\tforce: true,\n\t\t\t\t} );\n\n\t\t\tconst lastError = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getLastEntityDeleteError(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id\n\t\t\t\t);\n\n\t\t\tif ( lastError ) {\n\t\t\t\tthrow lastError;\n\t\t\t}\n\n\t\t\t// Depending on how the entity was retrieved it's title might be\n\t\t\t// an object or simple string.\n\t\t\tconst templateTitle =\n\t\t\t\ttypeof template.title === 'string'\n\t\t\t\t\t? template.title\n\t\t\t\t\t: template.title?.rendered;\n\n\t\t\tregistry.dispatch( noticesStore ).createSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: The template/part's name. */\n\t\t\t\t\t__( '\"%s\" deleted.' ),\n\t\t\t\t\tdecodeEntities( templateTitle )\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar', id: 'site-editor-template-deleted-success' }\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while deleting the template.' );\n\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n\n/**\n * Action that sets a template part.\n *\n * @param {string} templatePartId The template part ID.\n *\n * @return {Object} Action object.\n */\nexport function setTemplatePart( templatePartId ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType: 'wp_template_part',\n\t\tid: templatePartId,\n\t};\n}\n\n/**\n * Action that sets a navigation menu.\n *\n * @param {string} navigationMenuId The Navigation Menu Post ID.\n *\n * @return {Object} Action object.\n */\nexport function setNavigationMenu( navigationMenuId ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType: 'wp_navigation',\n\t\tid: navigationMenuId,\n\t};\n}\n\n/**\n * Action that sets an edited entity.\n *\n * @param {string} postType The entity's post type.\n * @param {string} postId The entity's ID.\n *\n * @return {Object} Action object.\n */\nexport function setEditedEntity( postType, postId ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType,\n\t\tid: postId,\n\t};\n}\n\n/**\n * @deprecated\n */\nexport function setHomeTemplateId() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn {\n\t\ttype: 'NOTHING',\n\t};\n}\n\n/**\n * Set's the current block editor context.\n *\n * @param {Object} context The context object.\n *\n * @return {number} The resolved template ID for the page route.\n */\nexport function setEditedPostContext( context ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST_CONTEXT',\n\t\tcontext,\n\t};\n}\n\n/**\n * Resolves the template for a page and displays both. If no path is given, attempts\n * to use the postId to generate a path like `?p=${ postId }`.\n *\n * @param {Object} page The page object.\n * @param {string} page.type The page type.\n * @param {string} page.slug The page slug.\n * @param {string} page.path The page path.\n * @param {Object} page.context The page context.\n *\n * @return {number} The resolved template ID for the page route.\n */\nexport const setPage =\n\t( page ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tif ( ! page.path && page.context?.postId ) {\n\t\t\tconst entity = await registry\n\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t.getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpage.context.postType || 'post',\n\t\t\t\t\tpage.context.postId\n\t\t\t\t);\n\t\t\t// If the entity is undefined for some reason, path will resolve to \"/\"\n\t\t\tpage.path = getPathAndQueryString( entity?.link );\n\t\t}\n\n\t\tconst template = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.__experimentalGetTemplateForLink( page.path );\n\n\t\tif ( ! template ) {\n\t\t\treturn;\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: template.id,\n\t\t\tcontext: {\n\t\t\t\t...page.context,\n\t\t\t\ttemplateSlug: template.slug,\n\t\t\t},\n\t\t} );\n\n\t\treturn template.id;\n\t};\n\n/**\n * Action that sets the active navigation panel menu.\n *\n * @deprecated\n *\n * @return {Object} Action object.\n */\nexport function setNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Opens the navigation panel and sets its active menu at the same time.\n *\n * @deprecated\n */\nexport function openNavigationPanelToMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).openNavigationPanelToMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Sets whether the navigation panel should be open.\n *\n * @deprecated\n */\nexport function setIsNavigationPanelOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setIsNavigationPanelOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Opens or closes the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\n\n/**\n * Returns an action object used to update the settings.\n *\n * @param {Object} settings New settings.\n *\n * @return {Object} Action object.\n */\nexport function updateSettings( settings ) {\n\treturn {\n\t\ttype: 'UPDATE_SETTINGS',\n\t\tsettings,\n\t};\n}\n\n/**\n * Sets whether the list view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the list view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport const setIsListViewOpened =\n\t( isOpen ) =>\n\t( { dispatch, registry } ) => {\n\t\tconst isDistractionFree = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-site', 'distractionFree' );\n\t\tif ( isDistractionFree && isOpen ) {\n\t\t\tdispatch.toggleDistractionFree();\n\t\t}\n\t\tdispatch( {\n\t\t\ttype: 'SET_IS_LIST_VIEW_OPENED',\n\t\t\tisOpen,\n\t\t} );\n\t};\n\n/**\n * Sets whether the save view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the save view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsSaveViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_SAVE_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Reverts a template to its original theme-provided file.\n *\n * @param {Object} template The template to revert.\n * @param {Object} [options]\n * @param {boolean} [options.allowUndo] Whether to allow the user to undo\n * reverting the template. Default true.\n */\nexport const revertTemplate =\n\t( template, { allowUndo = true } = {} ) =>\n\tasync ( { registry } ) => {\n\t\tconst noticeId = 'edit-site-template-reverted';\n\t\tregistry.dispatch( noticesStore ).removeNotice( noticeId );\n\t\tif ( ! isTemplateRevertable( template ) ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( __( 'This template is not revertable.' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tconst templateEntityConfig = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEntityConfig( 'postType', template.type );\n\n\t\t\tif ( ! templateEntityConfig ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst fileTemplatePath = addQueryArgs(\n\t\t\t\t`${ templateEntityConfig.baseURL }/${ template.id }`,\n\t\t\t\t{ context: 'edit', source: 'theme' }\n\t\t\t);\n\n\t\t\tconst fileTemplate = await apiFetch( { path: fileTemplatePath } );\n\t\t\tif ( ! fileTemplate ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst serializeBlocks = ( {\n\t\t\t\tblocks: blocksForSerialization = [],\n\t\t\t} ) => __unstableSerializeAndClean( blocksForSerialization );\n\n\t\t\tconst edited = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id\n\t\t\t\t);\n\n\t\t\t// We are fixing up the undo level here to make sure we can undo\n\t\t\t// the revert in the header toolbar correctly.\n\t\t\tregistry.dispatch( coreStore ).editEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\ttemplate.type,\n\t\t\t\ttemplate.id,\n\t\t\t\t{\n\t\t\t\t\tcontent: serializeBlocks, // Required to make the `undo` behave correctly.\n\t\t\t\t\tblocks: edited.blocks, // Required to revert the blocks in the editor.\n\t\t\t\t\tsource: 'custom', // required to avoid turning the editor into a dirty state\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tundoIgnore: true, // Required to merge this edit with the last undo level.\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tconst blocks = parse( fileTemplate?.content?.raw );\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord( 'postType', template.type, fileTemplate.id, {\n\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\tblocks,\n\t\t\t\t\tsource: 'theme',\n\t\t\t\t} );\n\n\t\t\tif ( allowUndo ) {\n\t\t\t\tconst undoRevert = () => {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t\t.editEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\ttemplate.type,\n\t\t\t\t\t\t\tedited.id,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\t\t\t\tblocks: edited.blocks,\n\t\t\t\t\t\t\t\tsource: 'custom',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t};\n\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createSuccessNotice( __( 'Template reverted.' ), {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: noticeId,\n\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\t\tonClick: undoRevert,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t} );\n\t\t\t}\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'Template revert failed. Please reload.' );\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n/**\n * Action that opens an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n */\nexport const openGeneralSidebar =\n\t( name ) =>\n\t( { dispatch, registry } ) => {\n\t\tconst isDistractionFree = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-site', 'distractionFree' );\n\t\tif ( isDistractionFree ) {\n\t\t\tdispatch.toggleDistractionFree();\n\t\t}\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.enableComplementaryArea( editSiteStoreName, name );\n\t};\n\n/**\n * Action that closes the sidebar.\n */\nexport const closeGeneralSidebar =\n\t() =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.disableComplementaryArea( editSiteStoreName );\n\t};\n\nexport const switchEditorMode =\n\t( mode ) =>\n\t( { dispatch, registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( 'core/preferences' )\n\t\t\t.set( 'core/edit-site', 'editorMode', mode );\n\n\t\t// Unselect blocks when we switch to a non visual mode.\n\t\tif ( mode !== 'visual' ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\n\t\tif ( mode === 'visual' ) {\n\t\t\tspeak( __( 'Visual editor selected' ), 'assertive' );\n\t\t} else if ( mode === 'text' ) {\n\t\t\tconst isDistractionFree = registry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-site', 'distractionFree' );\n\t\t\tif ( isDistractionFree ) {\n\t\t\t\tdispatch.toggleDistractionFree();\n\t\t\t}\n\t\t\tspeak( __( 'Code editor selected' ), 'assertive' );\n\t\t}\n\t};\n\n/**\n * Sets whether or not the editor allows only page content to be edited.\n *\n * @param {boolean} hasPageContentFocus True to allow only page content to be\n * edited, false to allow template to be\n * edited.\n */\nexport const setHasPageContentFocus =\n\t( hasPageContentFocus ) =>\n\t( { dispatch, registry } ) => {\n\t\tif ( hasPageContentFocus ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\t\tdispatch( {\n\t\t\ttype: 'SET_HAS_PAGE_CONTENT_FOCUS',\n\t\t\thasPageContentFocus,\n\t\t} );\n\t};\n\n/**\n * Action that toggles Distraction free mode.\n * Distraction free mode expects there are no sidebars, as due to the\n * z-index values set, you can't close sidebars.\n */\nexport const toggleDistractionFree =\n\t() =>\n\t( { dispatch, registry } ) => {\n\t\tconst isDistractionFree = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-site', 'distractionFree' );\n\t\tif ( ! isDistractionFree ) {\n\t\t\tregistry.batch( () => {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t\t.set( 'core/edit-site', 'fixedToolbar', false );\n\t\t\t\tdispatch.setIsInserterOpened( false );\n\t\t\t\tdispatch.setIsListViewOpened( false );\n\t\t\t\tdispatch.closeGeneralSidebar();\n\t\t\t} );\n\t\t}\n\t\tregistry.batch( () => {\n\t\t\tregistry\n\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t.set(\n\t\t\t\t\t'core/edit-site',\n\t\t\t\t\t'distractionFree',\n\t\t\t\t\t! isDistractionFree\n\t\t\t\t);\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createInfoNotice(\n\t\t\t\t\tisDistractionFree\n\t\t\t\t\t\t? __( 'Distraction free off.' )\n\t\t\t\t\t\t: __( 'Distraction free on.' ),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'core/edit-site/distraction-free-mode/notice',\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t} );\n\t};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA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AiB,GAAG1E,QAAQ,CAChCmC,MAAM,CAAE9B,kBAAiB,CAAC,CAC1BsE,GAAG,CAAE,gBAAgB,EAAE,iBAAkB,CAAC;EAC5C,IAAK,CAAED,iBAAiB,EAAG;IAC1B1E,QAAQ,CAACoH,KAAK,CAAE,MAAM;MACrBpH,QAAQ,CACNI,QAAQ,CAAEC,kBAAiB,CAAC,CAC5ByG,GAAG,CAAE,gBAAgB,EAAE,cAAc,EAAE,KAAM,CAAC;MAChD1G,QAAQ,CAACgE,mBAAmB,CAAE,KAAM,CAAC;MACrChE,QAAQ,CAACoE,mBAAmB,CAAE,KAAM,CAAC;MACrCpE,QAAQ,CAACsG,mBAAmB,CAAC,CAAC;IAC/B,CAAE,CAAC;EACJ;EACA1G,QAAQ,CAACoH,KAAK,CAAE,MAAM;IACrBpH,QAAQ,CACNI,QAAQ,CAAEC,kBAAiB,CAAC,CAC5ByG,GAAG,CACH,gBAAgB,EAChB,iBAAiB,EACjB,CAAEpC,iBACH,CAAC;IACF1E,QAAQ,CACNI,QAAQ,CAAEoC,cAAa,CAAC,CACxB6E,gBAAgB,CAChB3C,iBAAiB,GACd,IAAA/B,QAAE,EAAE,uBAAwB,CAAC,GAC7B,IAAAA,QAAE,EAAE,sBAAuB,CAAC,EAC/B;MACCvB,EAAE,EAAE,6CAA6C;MACjDX,IAAI,EAAE;IACP,CACD,CAAC;EACH,CAAE,CAAC;AACJ,CAAC;AAACa,OAAA,CAAAsD,qBAAA,GAAAA,qBAAA"}
|
|
1
|
+
{"version":3,"names":["_apiFetch","_interopRequireDefault","require","_blocks","_deprecated","_url","_i18n","_notices","_coreData","_interface","_blockEditor","_a11y","_preferences","_htmlEntities","_constants","_isTemplateRevertable","toggleFeature","featureName","registry","deprecated","since","alternative","dispatch","preferencesStore","toggle","__experimentalSetPreviewDeviceType","deviceType","type","setTemplate","templateId","templateSlug","template","resolveSelect","coreStore","getEntityRecord","slug","error","postType","id","context","exports","addTemplate","newTemplate","saveEntityRecord","content","editEntityRecord","blocks","parse","undoIgnore","removeTemplate","deleteEntityRecord","force","lastError","select","getLastEntityDeleteError","templateTitle","title","rendered","noticesStore","createSuccessNotice","sprintf","__","decodeEntities","errorMessage","message","code","createErrorNotice","setTemplatePart","templatePartId","setNavigationMenu","navigationMenuId","setEditedEntity","postId","setHomeTemplateId","version","setEditedPostContext","setPage","page","getDefaultTemplate","apiFetch","path","addQueryArgs","__experimentalGetTemplateForLink","editedEntity","getEditedEntityRecord","currentTemplateSlug","currentTemplate","getEntityRecords","per_page","find","setNavigationPanelActiveMenu","openNavigationPanelToMenu","setIsNavigationPanelOpened","setIsInserterOpened","value","updateSettings","settings","setIsListViewOpened","isOpen","isDistractionFree","get","toggleDistractionFree","setIsSaveViewOpened","revertTemplate","allowUndo","noticeId","removeNotice","isTemplateRevertable","templateEntityConfig","getEntityConfig","fileTemplatePath","baseURL","source","fileTemplate","serializeBlocks","blocksForSerialization","__unstableSerializeAndClean","edited","raw","undoRevert","actions","label","onClick","openGeneralSidebar","name","interfaceStore","enableComplementaryArea","editSiteStoreName","closeGeneralSidebar","disableComplementaryArea","switchEditorMode","mode","set","blockEditorStore","clearSelectedBlock","speak","setHasPageContentFocus","hasPageContentFocus","batch","createInfoNotice"],"sources":["@wordpress/edit-site/src/store/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { parse, __unstableSerializeAndClean } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\nimport { addQueryArgs } from '@wordpress/url';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { speak } from '@wordpress/a11y';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME as editSiteStoreName } from './constants';\nimport isTemplateRevertable from '../utils/is-template-revertable';\n\n/**\n * Dispatches an action that toggles a feature flag.\n *\n * @param {string} featureName Feature name.\n */\nexport function toggleFeature( featureName ) {\n\treturn function ( { registry } ) {\n\t\tdeprecated( \"select( 'core/edit-site' ).toggleFeature( featureName )\", {\n\t\t\tsince: '6.0',\n\t\t\talternative:\n\t\t\t\t\"select( 'core/preferences').toggle( 'core/edit-site', featureName )\",\n\t\t} );\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.toggle( 'core/edit-site', featureName );\n\t};\n}\n\n/**\n * Action that changes the width of the editing canvas.\n *\n * @param {string} deviceType\n *\n * @return {Object} Action object.\n */\nexport function __experimentalSetPreviewDeviceType( deviceType ) {\n\treturn {\n\t\ttype: 'SET_PREVIEW_DEVICE_TYPE',\n\t\tdeviceType,\n\t};\n}\n\n/**\n * Action that sets a template, optionally fetching it from REST API.\n *\n * @param {number} templateId The template ID.\n * @param {string} templateSlug The template slug.\n * @return {Object} Action object.\n */\nexport const setTemplate =\n\t( templateId, templateSlug ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tif ( ! templateSlug ) {\n\t\t\ttry {\n\t\t\t\tconst template = await registry\n\t\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t\t.getEntityRecord( 'postType', 'wp_template', templateId );\n\t\t\t\ttemplateSlug = template?.slug;\n\t\t\t} catch ( error ) {}\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: templateId,\n\t\t\tcontext: { templateSlug },\n\t\t} );\n\t};\n\n/**\n * Action that adds a new template and sets it as the current template.\n *\n * @param {Object} template The template.\n *\n * @return {Object} Action object used to set the current template.\n */\nexport const addTemplate =\n\t( template ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tconst newTemplate = await registry\n\t\t\t.dispatch( coreStore )\n\t\t\t.saveEntityRecord( 'postType', 'wp_template', template );\n\n\t\tif ( template.content ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_template',\n\t\t\t\t\tnewTemplate.id,\n\t\t\t\t\t{ blocks: parse( template.content ) },\n\t\t\t\t\t{ undoIgnore: true }\n\t\t\t\t);\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: newTemplate.id,\n\t\t\tcontext: { templateSlug: newTemplate.slug },\n\t\t} );\n\t};\n\n/**\n * Action that removes a template.\n *\n * @param {Object} template The template object.\n */\nexport const removeTemplate =\n\t( template ) =>\n\tasync ( { registry } ) => {\n\t\ttry {\n\t\t\tawait registry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.deleteEntityRecord( 'postType', template.type, template.id, {\n\t\t\t\t\tforce: true,\n\t\t\t\t} );\n\n\t\t\tconst lastError = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getLastEntityDeleteError(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id\n\t\t\t\t);\n\n\t\t\tif ( lastError ) {\n\t\t\t\tthrow lastError;\n\t\t\t}\n\n\t\t\t// Depending on how the entity was retrieved it's title might be\n\t\t\t// an object or simple string.\n\t\t\tconst templateTitle =\n\t\t\t\ttypeof template.title === 'string'\n\t\t\t\t\t? template.title\n\t\t\t\t\t: template.title?.rendered;\n\n\t\t\tregistry.dispatch( noticesStore ).createSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: The template/part's name. */\n\t\t\t\t\t__( '\"%s\" deleted.' ),\n\t\t\t\t\tdecodeEntities( templateTitle )\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar', id: 'site-editor-template-deleted-success' }\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while deleting the template.' );\n\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n\n/**\n * Action that sets a template part.\n *\n * @param {string} templatePartId The template part ID.\n *\n * @return {Object} Action object.\n */\nexport function setTemplatePart( templatePartId ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType: 'wp_template_part',\n\t\tid: templatePartId,\n\t};\n}\n\n/**\n * Action that sets a navigation menu.\n *\n * @param {string} navigationMenuId The Navigation Menu Post ID.\n *\n * @return {Object} Action object.\n */\nexport function setNavigationMenu( navigationMenuId ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType: 'wp_navigation',\n\t\tid: navigationMenuId,\n\t};\n}\n\n/**\n * Action that sets an edited entity.\n *\n * @param {string} postType The entity's post type.\n * @param {string} postId The entity's ID.\n *\n * @return {Object} Action object.\n */\nexport function setEditedEntity( postType, postId ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType,\n\t\tid: postId,\n\t};\n}\n\n/**\n * @deprecated\n */\nexport function setHomeTemplateId() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn {\n\t\ttype: 'NOTHING',\n\t};\n}\n\n/**\n * Set's the current block editor context.\n *\n * @param {Object} context The context object.\n *\n * @return {Object} Action object.\n */\nexport function setEditedPostContext( context ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST_CONTEXT',\n\t\tcontext,\n\t};\n}\n\n/**\n * Resolves the template for a page and displays both. If no path is given, attempts\n * to use the postId to generate a path like `?p=${ postId }`.\n *\n * @param {Object} page The page object.\n * @param {string} page.type The page type.\n * @param {string} page.slug The page slug.\n * @param {string} page.path The page path.\n * @param {Object} page.context The page context.\n *\n * @return {number} The resolved template ID for the page route.\n */\nexport const setPage =\n\t( page ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tlet template;\n\t\tconst getDefaultTemplate = async ( slug ) =>\n\t\t\tapiFetch( {\n\t\t\t\tpath: addQueryArgs( '/wp/v2/templates/lookup', {\n\t\t\t\t\tslug: `page-${ slug }`,\n\t\t\t\t} ),\n\t\t\t} );\n\n\t\tif ( page.path ) {\n\t\t\ttemplate = await registry\n\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t.__experimentalGetTemplateForLink( page.path );\n\t\t} else {\n\t\t\tconst editedEntity = await registry\n\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t.getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpage.context?.postType || 'post',\n\t\t\t\t\tpage.context?.postId\n\t\t\t\t);\n\t\t\tconst currentTemplateSlug = editedEntity?.template;\n\t\t\tif ( currentTemplateSlug ) {\n\t\t\t\tconst currentTemplate = (\n\t\t\t\t\tawait registry\n\t\t\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t\t\t.getEntityRecords( 'postType', 'wp_template', {\n\t\t\t\t\t\t\tper_page: -1,\n\t\t\t\t\t\t} )\n\t\t\t\t)?.find( ( { slug } ) => slug === currentTemplateSlug );\n\t\t\t\tif ( currentTemplate ) {\n\t\t\t\t\ttemplate = currentTemplate;\n\t\t\t\t} else {\n\t\t\t\t\t// If a page has a `template` set and is not included in the list\n\t\t\t\t\t// of the current theme's templates, query for current theme's default template.\n\t\t\t\t\ttemplate = await getDefaultTemplate( editedEntity?.slug );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Page's `template` is empty, that indicates we need to use the default template for the page.\n\t\t\t\ttemplate = await getDefaultTemplate( editedEntity?.slug );\n\t\t\t}\n\t\t}\n\n\t\tif ( ! template ) {\n\t\t\treturn;\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: template.id,\n\t\t\tcontext: {\n\t\t\t\t...page.context,\n\t\t\t\ttemplateSlug: template.slug,\n\t\t\t},\n\t\t} );\n\n\t\treturn template.id;\n\t};\n\n/**\n * Action that sets the active navigation panel menu.\n *\n * @deprecated\n *\n * @return {Object} Action object.\n */\nexport function setNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Opens the navigation panel and sets its active menu at the same time.\n *\n * @deprecated\n */\nexport function openNavigationPanelToMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).openNavigationPanelToMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Sets whether the navigation panel should be open.\n *\n * @deprecated\n */\nexport function setIsNavigationPanelOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setIsNavigationPanelOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Opens or closes the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\n\n/**\n * Returns an action object used to update the settings.\n *\n * @param {Object} settings New settings.\n *\n * @return {Object} Action object.\n */\nexport function updateSettings( settings ) {\n\treturn {\n\t\ttype: 'UPDATE_SETTINGS',\n\t\tsettings,\n\t};\n}\n\n/**\n * Sets whether the list view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the list view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport const setIsListViewOpened =\n\t( isOpen ) =>\n\t( { dispatch, registry } ) => {\n\t\tconst isDistractionFree = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-site', 'distractionFree' );\n\t\tif ( isDistractionFree && isOpen ) {\n\t\t\tdispatch.toggleDistractionFree();\n\t\t}\n\t\tdispatch( {\n\t\t\ttype: 'SET_IS_LIST_VIEW_OPENED',\n\t\t\tisOpen,\n\t\t} );\n\t};\n\n/**\n * Sets whether the save view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the save view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsSaveViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_SAVE_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Reverts a template to its original theme-provided file.\n *\n * @param {Object} template The template to revert.\n * @param {Object} [options]\n * @param {boolean} [options.allowUndo] Whether to allow the user to undo\n * reverting the template. Default true.\n */\nexport const revertTemplate =\n\t( template, { allowUndo = true } = {} ) =>\n\tasync ( { registry } ) => {\n\t\tconst noticeId = 'edit-site-template-reverted';\n\t\tregistry.dispatch( noticesStore ).removeNotice( noticeId );\n\t\tif ( ! isTemplateRevertable( template ) ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( __( 'This template is not revertable.' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tconst templateEntityConfig = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEntityConfig( 'postType', template.type );\n\n\t\t\tif ( ! templateEntityConfig ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst fileTemplatePath = addQueryArgs(\n\t\t\t\t`${ templateEntityConfig.baseURL }/${ template.id }`,\n\t\t\t\t{ context: 'edit', source: 'theme' }\n\t\t\t);\n\n\t\t\tconst fileTemplate = await apiFetch( { path: fileTemplatePath } );\n\t\t\tif ( ! fileTemplate ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst serializeBlocks = ( {\n\t\t\t\tblocks: blocksForSerialization = [],\n\t\t\t} ) => __unstableSerializeAndClean( blocksForSerialization );\n\n\t\t\tconst edited = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id\n\t\t\t\t);\n\n\t\t\t// We are fixing up the undo level here to make sure we can undo\n\t\t\t// the revert in the header toolbar correctly.\n\t\t\tregistry.dispatch( coreStore ).editEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\ttemplate.type,\n\t\t\t\ttemplate.id,\n\t\t\t\t{\n\t\t\t\t\tcontent: serializeBlocks, // Required to make the `undo` behave correctly.\n\t\t\t\t\tblocks: edited.blocks, // Required to revert the blocks in the editor.\n\t\t\t\t\tsource: 'custom', // required to avoid turning the editor into a dirty state\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tundoIgnore: true, // Required to merge this edit with the last undo level.\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tconst blocks = parse( fileTemplate?.content?.raw );\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord( 'postType', template.type, fileTemplate.id, {\n\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\tblocks,\n\t\t\t\t\tsource: 'theme',\n\t\t\t\t} );\n\n\t\t\tif ( allowUndo ) {\n\t\t\t\tconst undoRevert = () => {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t\t.editEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\ttemplate.type,\n\t\t\t\t\t\t\tedited.id,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\t\t\t\tblocks: edited.blocks,\n\t\t\t\t\t\t\t\tsource: 'custom',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t};\n\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createSuccessNotice( __( 'Template reverted.' ), {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: noticeId,\n\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\t\tonClick: undoRevert,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t} );\n\t\t\t}\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'Template revert failed. Please reload.' );\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n/**\n * Action that opens an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n */\nexport const openGeneralSidebar =\n\t( name ) =>\n\t( { dispatch, registry } ) => {\n\t\tconst isDistractionFree = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-site', 'distractionFree' );\n\t\tif ( isDistractionFree ) {\n\t\t\tdispatch.toggleDistractionFree();\n\t\t}\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.enableComplementaryArea( editSiteStoreName, name );\n\t};\n\n/**\n * Action that closes the sidebar.\n */\nexport const closeGeneralSidebar =\n\t() =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.disableComplementaryArea( editSiteStoreName );\n\t};\n\nexport const switchEditorMode =\n\t( mode ) =>\n\t( { dispatch, registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( 'core/preferences' )\n\t\t\t.set( 'core/edit-site', 'editorMode', mode );\n\n\t\t// Unselect blocks when we switch to a non visual mode.\n\t\tif ( mode !== 'visual' ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\n\t\tif ( mode === 'visual' ) {\n\t\t\tspeak( __( 'Visual editor selected' ), 'assertive' );\n\t\t} else if ( mode === 'text' ) {\n\t\t\tconst isDistractionFree = registry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-site', 'distractionFree' );\n\t\t\tif ( isDistractionFree ) {\n\t\t\t\tdispatch.toggleDistractionFree();\n\t\t\t}\n\t\t\tspeak( __( 'Code editor selected' ), 'assertive' );\n\t\t}\n\t};\n\n/**\n * Sets whether or not the editor allows only page content to be edited.\n *\n * @param {boolean} hasPageContentFocus True to allow only page content to be\n * edited, false to allow template to be\n * edited.\n */\nexport const setHasPageContentFocus =\n\t( hasPageContentFocus ) =>\n\t( { dispatch, registry } ) => {\n\t\tif ( hasPageContentFocus ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\t\tdispatch( {\n\t\t\ttype: 'SET_HAS_PAGE_CONTENT_FOCUS',\n\t\t\thasPageContentFocus,\n\t\t} );\n\t};\n\n/**\n * Action that toggles Distraction free mode.\n * Distraction free mode expects there are no sidebars, as due to the\n * z-index values set, you can't close sidebars.\n */\nexport const toggleDistractionFree =\n\t() =>\n\t( { dispatch, registry } ) => {\n\t\tconst isDistractionFree = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-site', 'distractionFree' );\n\t\tif ( ! isDistractionFree ) {\n\t\t\tregistry.batch( () => {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t\t.set( 'core/edit-site', 'fixedToolbar', false );\n\t\t\t\tdispatch.setIsInserterOpened( false );\n\t\t\t\tdispatch.setIsListViewOpened( false );\n\t\t\t\tdispatch.closeGeneralSidebar();\n\t\t\t} );\n\t\t}\n\t\tregistry.batch( () => {\n\t\t\tregistry\n\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t.set(\n\t\t\t\t\t'core/edit-site',\n\t\t\t\t\t'distractionFree',\n\t\t\t\t\t! isDistractionFree\n\t\t\t\t);\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createInfoNotice(\n\t\t\t\t\tisDistractionFree\n\t\t\t\t\t\t? __( 'Distraction free off.' )\n\t\t\t\t\t\t: __( 'Distraction free on.' ),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'core/edit-site/distraction-free-mode/notice',\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t} );\n\t};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,KAAA,GAAAT,OAAA;AACA,IAAAU,YAAA,GAAAV,OAAA;AACA,IAAAW,aAAA,GAAAX,OAAA;AAKA,IAAAY,UAAA,GAAAZ,OAAA;AACA,IAAA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
CHANGED
|
@@ -3,7 +3,50 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.FOCUSABLE_ENTITIES = void 0;
|
|
7
|
-
|
|
6
|
+
exports.TEMPLATE_POST_TYPE = exports.TEMPLATE_PART_POST_TYPE = exports.TEMPLATE_CUSTOM_SOURCE = exports.POST_TYPE_LABELS = exports.PATTERN_TYPES = exports.PATTERN_SYNC_TYPES = exports.PATTERN_DEFAULT_CATEGORY = exports.PATTERN_CORE_SOURCES = exports.NAVIGATION_POST_TYPE = exports.FOCUSABLE_ENTITIES = void 0;
|
|
7
|
+
var _i18n = require("@wordpress/i18n");
|
|
8
|
+
var _patterns = require("@wordpress/patterns");
|
|
9
|
+
var _lockUnlock = require("../lock-unlock");
|
|
10
|
+
/**
|
|
11
|
+
* WordPress dependencies
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Internal dependencies
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
// Navigation
|
|
19
|
+
const NAVIGATION_POST_TYPE = 'wp_navigation';
|
|
20
|
+
|
|
21
|
+
// Templates.
|
|
22
|
+
exports.NAVIGATION_POST_TYPE = NAVIGATION_POST_TYPE;
|
|
23
|
+
const TEMPLATE_POST_TYPE = 'wp_template';
|
|
24
|
+
exports.TEMPLATE_POST_TYPE = TEMPLATE_POST_TYPE;
|
|
25
|
+
const TEMPLATE_PART_POST_TYPE = 'wp_template_part';
|
|
26
|
+
exports.TEMPLATE_PART_POST_TYPE = TEMPLATE_PART_POST_TYPE;
|
|
27
|
+
const TEMPLATE_CUSTOM_SOURCE = 'custom';
|
|
28
|
+
|
|
29
|
+
// Patterns.
|
|
30
|
+
exports.TEMPLATE_CUSTOM_SOURCE = TEMPLATE_CUSTOM_SOURCE;
|
|
31
|
+
const {
|
|
32
|
+
PATTERN_TYPES,
|
|
33
|
+
PATTERN_DEFAULT_CATEGORY,
|
|
34
|
+
PATTERN_CORE_SOURCES,
|
|
35
|
+
PATTERN_SYNC_TYPES
|
|
36
|
+
} = (0, _lockUnlock.unlock)(_patterns.privateApis);
|
|
37
|
+
|
|
38
|
+
// Entities that are editable in focus mode.
|
|
39
|
+
exports.PATTERN_SYNC_TYPES = PATTERN_SYNC_TYPES;
|
|
40
|
+
exports.PATTERN_CORE_SOURCES = PATTERN_CORE_SOURCES;
|
|
41
|
+
exports.PATTERN_DEFAULT_CATEGORY = PATTERN_DEFAULT_CATEGORY;
|
|
42
|
+
exports.PATTERN_TYPES = PATTERN_TYPES;
|
|
43
|
+
const FOCUSABLE_ENTITIES = [TEMPLATE_PART_POST_TYPE, NAVIGATION_POST_TYPE, PATTERN_TYPES.user];
|
|
8
44
|
exports.FOCUSABLE_ENTITIES = FOCUSABLE_ENTITIES;
|
|
45
|
+
const POST_TYPE_LABELS = {
|
|
46
|
+
[TEMPLATE_POST_TYPE]: (0, _i18n.__)('Template'),
|
|
47
|
+
[TEMPLATE_PART_POST_TYPE]: (0, _i18n.__)('Template Part'),
|
|
48
|
+
[PATTERN_TYPES.user]: (0, _i18n.__)('Pattern'),
|
|
49
|
+
[NAVIGATION_POST_TYPE]: (0, _i18n.__)('Navigation')
|
|
50
|
+
};
|
|
51
|
+
exports.POST_TYPE_LABELS = POST_TYPE_LABELS;
|
|
9
52
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_i18n","require","_patterns","_lockUnlock","NAVIGATION_POST_TYPE","exports","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","TEMPLATE_CUSTOM_SOURCE","PATTERN_TYPES","PATTERN_DEFAULT_CATEGORY","PATTERN_CORE_SOURCES","PATTERN_SYNC_TYPES","unlock","patternPrivateApis","FOCUSABLE_ENTITIES","user","POST_TYPE_LABELS","__"],"sources":["@wordpress/edit-site/src/utils/constants.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as patternPrivateApis } from '@wordpress/patterns';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\n// Navigation\nexport const NAVIGATION_POST_TYPE = 'wp_navigation';\n\n// Templates.\nexport const TEMPLATE_POST_TYPE = 'wp_template';\nexport const TEMPLATE_PART_POST_TYPE = 'wp_template_part';\nexport const TEMPLATE_CUSTOM_SOURCE = 'custom';\n\n// Patterns.\nexport const {\n\tPATTERN_TYPES,\n\tPATTERN_DEFAULT_CATEGORY,\n\tPATTERN_CORE_SOURCES,\n\tPATTERN_SYNC_TYPES,\n} = unlock( patternPrivateApis );\n\n// Entities that are editable in focus mode.\nexport const FOCUSABLE_ENTITIES = [\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES.user,\n];\n\nexport const POST_TYPE_LABELS = {\n\t[ TEMPLATE_POST_TYPE ]: __( 'Template' ),\n\t[ TEMPLATE_PART_POST_TYPE ]: __( 'Template Part' ),\n\t[ PATTERN_TYPES.user ]: __( 'Pattern' ),\n\t[ NAVIGATION_POST_TYPE ]: __( 'Navigation' ),\n};\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAKA,IAAAE,WAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACO,MAAMG,oBAAoB,GAAG,eAAe;;AAEnD;AAAAC,OAAA,CAAAD,oBAAA,GAAAA,oBAAA;AACO,MAAME,kBAAkB,GAAG,aAAa;AAACD,OAAA,CAAAC,kBAAA,GAAAA,kBAAA;AACzC,MAAMC,uBAAuB,GAAG,kBAAkB;AAACF,OAAA,CAAAE,uBAAA,GAAAA,uBAAA;AACnD,MAAMC,sBAAsB,GAAG,QAAQ;;AAE9C;AAAAH,OAAA,CAAAG,sBAAA,GAAAA,sBAAA;AACO,MAAM;EACZC,aAAa;EACbC,wBAAwB;EACxBC,oBAAoB;EACpBC;AACD,CAAC,GAAG,IAAAC,kBAAM,EAAEC,qBAAmB,CAAC;;AAEhC;AAAAT,OAAA,CAAAO,kBAAA,GAAAA,kBAAA;AAAAP,OAAA,CAAAM,oBAAA,GAAAA,oBAAA;AAAAN,OAAA,CAAAK,wBAAA,GAAAA,wBAAA;AAAAL,OAAA,CAAAI,aAAA,GAAAA,aAAA;AACO,MAAMM,kBAAkB,GAAG,CACjCR,uBAAuB,EACvBH,oBAAoB,EACpBK,aAAa,CAACO,IAAI,CAClB;AAACX,OAAA,CAAAU,kBAAA,GAAAA,kBAAA;AAEK,MAAME,gBAAgB,GAAG;EAC/B,CAAEX,kBAAkB,GAAI,IAAAY,QAAE,EAAE,UAAW,CAAC;EACxC,CAAEX,uBAAuB,GAAI,IAAAW,QAAE,EAAE,eAAgB,CAAC;EAClD,CAAET,aAAa,CAACO,IAAI,GAAI,IAAAE,QAAE,EAAE,SAAU,CAAC;EACvC,CAAEd,oBAAoB,GAAI,IAAAc,QAAE,EAAE,YAAa;AAC5C,CAAC;AAACb,OAAA,CAAAY,gBAAA,GAAAA,gBAAA"}
|
|
@@ -4,6 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = isTemplateRemovable;
|
|
7
|
+
var _constants = require("./constants");
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
|
|
7
12
|
/**
|
|
8
13
|
* Check if a template is removable.
|
|
9
14
|
*
|
|
@@ -14,6 +19,6 @@ function isTemplateRemovable(template) {
|
|
|
14
19
|
if (!template) {
|
|
15
20
|
return false;
|
|
16
21
|
}
|
|
17
|
-
return template.source ===
|
|
22
|
+
return template.source === _constants.TEMPLATE_CUSTOM_SOURCE && !template.has_theme_file;
|
|
18
23
|
}
|
|
19
24
|
//# sourceMappingURL=is-template-removable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["isTemplateRemovable","template","source","has_theme_file"],"sources":["@wordpress/edit-site/src/utils/is-template-removable.js"],"sourcesContent":["/**\n * Check if a template is removable.\n *\n * @param {Object} template The template entity to check.\n * @return {boolean} Whether the template is revertable.\n */\nexport default function isTemplateRemovable( template ) {\n\tif ( ! template ) {\n\t\treturn false;\n\t}\n\n\treturn
|
|
1
|
+
{"version":3,"names":["_constants","require","isTemplateRemovable","template","source","TEMPLATE_CUSTOM_SOURCE","has_theme_file"],"sources":["@wordpress/edit-site/src/utils/is-template-removable.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { TEMPLATE_CUSTOM_SOURCE } from './constants';\n\n/**\n * Check if a template is removable.\n *\n * @param {Object} template The template entity to check.\n * @return {boolean} Whether the template is revertable.\n */\nexport default function isTemplateRemovable( template ) {\n\tif ( ! template ) {\n\t\treturn false;\n\t}\n\n\treturn (\n\t\ttemplate.source === TEMPLATE_CUSTOM_SOURCE && ! template.has_theme_file\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,UAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,mBAAmBA,CAAEC,QAAQ,EAAG;EACvD,IAAK,CAAEA,QAAQ,EAAG;IACjB,OAAO,KAAK;EACb;EAEA,OACCA,QAAQ,CAACC,MAAM,KAAKC,iCAAsB,IAAI,CAAEF,QAAQ,CAACG,cAAc;AAEzE"}
|
|
@@ -4,6 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = isTemplateRevertable;
|
|
7
|
+
var _constants = require("./constants");
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
|
|
7
12
|
/**
|
|
8
13
|
* Check if a template is revertable to its original theme-provided template file.
|
|
9
14
|
*
|
|
@@ -15,7 +20,7 @@ function isTemplateRevertable(template) {
|
|
|
15
20
|
return false;
|
|
16
21
|
}
|
|
17
22
|
/* eslint-disable camelcase */
|
|
18
|
-
return template?.source ===
|
|
23
|
+
return template?.source === _constants.TEMPLATE_CUSTOM_SOURCE && template?.has_theme_file;
|
|
19
24
|
/* eslint-enable camelcase */
|
|
20
25
|
}
|
|
21
26
|
//# sourceMappingURL=is-template-revertable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["isTemplateRevertable","template","source","has_theme_file"],"sources":["@wordpress/edit-site/src/utils/is-template-revertable.js"],"sourcesContent":["/**\n * Check if a template is revertable to its original theme-provided template file.\n *\n * @param {Object} template The template entity to check.\n * @return {boolean} Whether the template is revertable.\n */\nexport default function isTemplateRevertable( template ) {\n\tif ( ! template ) {\n\t\treturn false;\n\t}\n\t/* eslint-disable camelcase */\n\treturn
|
|
1
|
+
{"version":3,"names":["_constants","require","isTemplateRevertable","template","source","TEMPLATE_CUSTOM_SOURCE","has_theme_file"],"sources":["@wordpress/edit-site/src/utils/is-template-revertable.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { TEMPLATE_CUSTOM_SOURCE } from './constants';\n\n/**\n * Check if a template is revertable to its original theme-provided template file.\n *\n * @param {Object} template The template entity to check.\n * @return {boolean} Whether the template is revertable.\n */\nexport default function isTemplateRevertable( template ) {\n\tif ( ! template ) {\n\t\treturn false;\n\t}\n\t/* eslint-disable camelcase */\n\treturn (\n\t\ttemplate?.source === TEMPLATE_CUSTOM_SOURCE && template?.has_theme_file\n\t);\n\t/* eslint-enable camelcase */\n}\n"],"mappings":";;;;;;AAGA,IAAAA,UAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,oBAAoBA,CAAEC,QAAQ,EAAG;EACxD,IAAK,CAAEA,QAAQ,EAAG;IACjB,OAAO,KAAK;EACb;EACA;EACA,OACCA,QAAQ,EAAEC,MAAM,KAAKC,iCAAsB,IAAIF,QAAQ,EAAEG,cAAc;EAExE;AACD"}
|