@wordpress/edit-site 5.4.0 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build/components/add-new-template/add-custom-template-modal.js +12 -3
- package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
- package/build/components/add-new-template/new-template-part.js +8 -7
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +19 -16
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/app/index.js +4 -2
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +2 -1
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/editor/index.js +5 -7
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +20 -159
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/context-menu.js +13 -11
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +41 -487
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/duotone-panel.js +78 -0
- package/build/components/global-styles/duotone-panel.js.map +1 -0
- package/build/components/global-styles/filter-utils.js +17 -0
- package/build/components/global-styles/filter-utils.js.map +1 -0
- package/build/components/global-styles/hooks.js +11 -26
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/preview.js +9 -5
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +6 -11
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-border.js +14 -6
- package/build/components/global-styles/screen-border.js.map +1 -1
- package/build/components/global-styles/screen-filters.js +46 -0
- package/build/components/global-styles/screen-filters.js.map +1 -0
- package/build/components/global-styles/screen-layout.js +13 -5
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-root.js +2 -1
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +2 -1
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/screen-variations.js +1 -1
- package/build/components/global-styles/screen-variations.js.map +1 -1
- package/build/components/global-styles/shadow-panel.js +6 -4
- package/build/components/global-styles/shadow-panel.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +2 -5
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/ui.js +7 -1
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +12 -0
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/keyboard-shortcuts/edit-mode.js +124 -0
- package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -0
- package/build/components/keyboard-shortcuts/global.js +48 -0
- package/build/components/keyboard-shortcuts/global.js.map +1 -0
- package/build/components/keyboard-shortcuts/index.js +67 -0
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/register.js +153 -0
- package/build/components/keyboard-shortcuts/register.js.map +1 -0
- package/build/components/layout/index.js +12 -1
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/added-by.js +127 -136
- package/build/components/list/added-by.js.map +1 -1
- package/build/components/list/index.js +2 -1
- package/build/components/list/index.js.map +1 -1
- package/build/components/list/table.js +9 -7
- package/build/components/list/table.js.map +1 -1
- package/build/components/routes/link.js +4 -1
- package/build/components/routes/link.js.map +1 -1
- package/build/components/save-hub/index.js +82 -0
- package/build/components/save-hub/index.js.map +1 -0
- package/build/components/save-panel/index.js +11 -1
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar/index.js +27 -17
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-button/index.js +30 -0
- package/build/components/sidebar-button/index.js.map +1 -0
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js +8 -2
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +14 -11
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +16 -16
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-item/index.js +22 -26
- package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +97 -14
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/loader.js +19 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +77 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
- package/build/components/sidebar-navigation-screen-template/index.js +66 -27
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +30 -17
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +14 -10
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/site-hub/index.js +3 -1
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/style-book/index.js +151 -21
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +36 -34
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +67 -18
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/template-details/index.js +5 -10
- package/build/components/template-details/index.js.map +1 -1
- package/build/components/template-part-converter/convert-to-regular.js +8 -12
- package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build/components/template-part-converter/convert-to-template-part.js +2 -2
- package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build/components/template-part-converter/index.js +19 -14
- package/build/components/template-part-converter/index.js.map +1 -1
- package/build/components/use-edited-entity-record/index.js +6 -6
- package/build/components/use-edited-entity-record/index.js.map +1 -1
- package/build/index.js +13 -22
- package/build/index.js.map +1 -1
- package/build/store/actions.js +2 -2
- package/build/store/actions.js.map +1 -1
- package/build/utils/get-is-list-page.js +1 -1
- package/build/utils/get-is-list-page.js.map +1 -1
- package/build/utils/history.js +8 -2
- package/build/utils/history.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-template-modal.js +13 -4
- package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +8 -7
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +21 -17
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/app/index.js +3 -2
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +2 -1
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/editor/index.js +5 -6
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +21 -157
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +14 -11
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +43 -480
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/duotone-panel.js +67 -0
- package/build-module/components/global-styles/duotone-panel.js.map +1 -0
- package/build-module/components/global-styles/filter-utils.js +9 -0
- package/build-module/components/global-styles/filter-utils.js.map +1 -0
- package/build-module/components/global-styles/hooks.js +11 -26
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/preview.js +10 -6
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +6 -8
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-border.js +12 -3
- package/build-module/components/global-styles/screen-border.js.map +1 -1
- package/build-module/components/global-styles/screen-filters.js +33 -0
- package/build-module/components/global-styles/screen-filters.js.map +1 -0
- package/build-module/components/global-styles/screen-layout.js +11 -2
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +2 -1
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +2 -1
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/screen-variations.js +1 -1
- package/build-module/components/global-styles/screen-variations.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel.js +6 -4
- package/build-module/components/global-styles/shadow-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +2 -5
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/ui.js +6 -1
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +12 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js +108 -0
- package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -0
- package/build-module/components/keyboard-shortcuts/global.js +37 -0
- package/build-module/components/keyboard-shortcuts/global.js.map +1 -0
- package/build-module/components/keyboard-shortcuts/index.js +65 -0
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/register.js +141 -0
- package/build-module/components/keyboard-shortcuts/register.js.map +1 -0
- package/build-module/components/layout/index.js +10 -1
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/added-by.js +126 -138
- package/build-module/components/list/added-by.js.map +1 -1
- package/build-module/components/list/index.js +2 -1
- package/build-module/components/list/index.js.map +1 -1
- package/build-module/components/list/table.js +9 -7
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/routes/link.js +5 -2
- package/build-module/components/routes/link.js.map +1 -1
- package/build-module/components/save-hub/index.js +68 -0
- package/build-module/components/save-hub/index.js.map +1 -0
- package/build-module/components/save-panel/index.js +8 -1
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +24 -19
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-button/index.js +18 -0
- package/build-module/components/sidebar-button/index.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +8 -2
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +12 -12
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +16 -16
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +24 -30
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +91 -14
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js +11 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +66 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-template/index.js +67 -30
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +28 -18
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +13 -10
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +3 -1
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/style-book/index.js +152 -25
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +36 -34
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +65 -18
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/template-details/index.js +5 -9
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-regular.js +9 -13
- package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +3 -3
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build-module/components/template-part-converter/index.js +20 -15
- package/build-module/components/template-part-converter/index.js.map +1 -1
- package/build-module/components/use-edited-entity-record/index.js +6 -6
- package/build-module/components/use-edited-entity-record/index.js.map +1 -1
- package/build-module/index.js +16 -23
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +2 -2
- package/build-module/store/actions.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +1 -1
- package/build-module/utils/get-is-list-page.js.map +1 -1
- package/build-module/utils/history.js +9 -3
- package/build-module/utils/history.js.map +1 -1
- package/build-style/style-rtl.css +203 -143
- package/build-style/style.css +203 -143
- package/package.json +31 -31
- package/src/components/add-new-template/add-custom-template-modal.js +14 -10
- package/src/components/add-new-template/new-template-part.js +7 -9
- package/src/components/add-new-template/new-template.js +60 -38
- package/src/components/add-new-template/style.scss +12 -6
- package/src/components/app/index.js +9 -6
- package/src/components/block-editor/editor-canvas.js +2 -1
- package/src/components/block-editor/style.scss +1 -1
- package/src/components/editor/index.js +62 -65
- package/src/components/editor/style.scss +0 -6
- package/src/components/global-styles/border-panel.js +24 -199
- package/src/components/global-styles/context-menu.js +18 -12
- package/src/components/global-styles/dimensions-panel.js +43 -577
- package/src/components/global-styles/duotone-panel.js +82 -0
- package/src/components/global-styles/filter-utils.js +9 -0
- package/src/components/global-styles/hooks.js +12 -36
- package/src/components/global-styles/preview.js +155 -140
- package/src/components/global-styles/screen-block-list.js +6 -11
- package/src/components/global-styles/screen-border.js +10 -3
- package/src/components/global-styles/screen-filters.js +27 -0
- package/src/components/global-styles/screen-layout.js +9 -2
- package/src/components/global-styles/screen-root.js +1 -1
- package/src/components/global-styles/screen-style-variations.js +5 -1
- package/src/components/global-styles/screen-variations.js +0 -1
- package/src/components/global-styles/shadow-panel.js +4 -3
- package/src/components/global-styles/style.scss +10 -0
- package/src/components/global-styles/typography-panel.js +5 -7
- package/src/components/global-styles/ui.js +6 -1
- package/src/components/keyboard-shortcut-help-modal/config.js +10 -0
- package/src/components/keyboard-shortcuts/edit-mode.js +116 -0
- package/src/components/keyboard-shortcuts/global.js +35 -0
- package/src/components/keyboard-shortcuts/index.js +70 -0
- package/src/components/keyboard-shortcuts/register.js +157 -0
- package/src/components/layout/index.js +19 -0
- package/src/components/layout/style.scss +9 -4
- package/src/components/list/added-by.js +152 -155
- package/src/components/list/index.js +3 -1
- package/src/components/list/style.scss +5 -13
- package/src/components/list/table.js +11 -9
- package/src/components/routes/link.js +9 -2
- package/src/components/save-hub/index.js +78 -0
- package/src/components/save-hub/style.scss +15 -0
- package/src/components/save-panel/index.js +8 -1
- package/src/components/sidebar/index.js +33 -16
- package/src/components/sidebar/style.scss +4 -3
- package/src/components/sidebar-button/index.js +21 -0
- package/src/components/sidebar-button/style.scss +24 -0
- package/src/components/sidebar-edit-mode/global-styles-sidebar.js +3 -7
- package/src/components/sidebar-edit-mode/style.scss +16 -0
- package/src/components/sidebar-navigation-item/style.scss +1 -23
- package/src/components/sidebar-navigation-screen/index.js +37 -38
- package/src/components/sidebar-navigation-screen/style.scss +16 -9
- package/src/components/sidebar-navigation-screen-main/index.js +24 -11
- package/src/components/sidebar-navigation-screen-navigation-item/index.js +39 -26
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +99 -12
- package/src/components/sidebar-navigation-screen-navigation-menus/loader.js +9 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +78 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +108 -1
- package/src/components/sidebar-navigation-screen-template/index.js +89 -30
- package/src/components/sidebar-navigation-screen-template/style.scss +25 -0
- package/src/components/sidebar-navigation-screen-templates/index.js +29 -14
- package/src/components/sidebar-navigation-screen-templates/style.scss +0 -5
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +12 -6
- package/src/components/site-hub/index.js +5 -1
- package/src/components/site-hub/style.scss +5 -1
- package/src/components/style-book/index.js +234 -55
- package/src/components/style-book/style.scss +1 -45
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +28 -23
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +38 -8
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +77 -17
- package/src/components/template-details/index.js +4 -8
- package/src/components/template-part-converter/convert-to-regular.js +10 -17
- package/src/components/template-part-converter/convert-to-template-part.js +9 -16
- package/src/components/template-part-converter/index.js +28 -12
- package/src/components/use-edited-entity-record/index.js +26 -18
- package/src/index.js +11 -22
- package/src/store/actions.js +2 -2
- package/src/store/test/actions.js +0 -2
- package/src/style.scss +3 -1
- package/src/utils/get-is-list-page.js +1 -1
- package/src/utils/history.js +13 -9
- package/build/components/navigation-inspector/index.js +0 -161
- package/build/components/navigation-inspector/index.js.map +0 -1
- package/build/components/navigation-inspector/navigation-menu.js +0 -62
- package/build/components/navigation-inspector/navigation-menu.js.map +0 -1
- package/build-module/components/navigation-inspector/index.js +0 -146
- package/build-module/components/navigation-inspector/index.js.map +0 -1
- package/build-module/components/navigation-inspector/navigation-menu.js +0 -52
- package/build-module/components/navigation-inspector/navigation-menu.js.map +0 -1
- package/src/components/navigation-inspector/index.js +0 -191
- package/src/components/navigation-inspector/navigation-menu.js +0 -66
- package/src/components/navigation-inspector/style.scss +0 -46
|
@@ -8,36 +8,83 @@ import { useEffect, useRef } from '@wordpress/element';
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { useLocation, useHistory } from '../routes';
|
|
11
|
+
export function getPathFromURL(urlParams) {
|
|
12
|
+
var _urlParams$path;
|
|
13
|
+
|
|
14
|
+
let path = (_urlParams$path = urlParams === null || urlParams === void 0 ? void 0 : urlParams.path) !== null && _urlParams$path !== void 0 ? _urlParams$path : '/'; // Compute the navigator path based on the URL params.
|
|
15
|
+
|
|
16
|
+
if (urlParams !== null && urlParams !== void 0 && urlParams.postType && urlParams !== null && urlParams !== void 0 && urlParams.postId) {
|
|
17
|
+
switch (urlParams.postType) {
|
|
18
|
+
case 'wp_template':
|
|
19
|
+
case 'wp_template_part':
|
|
20
|
+
path = `/${encodeURIComponent(urlParams.postType)}/${encodeURIComponent(urlParams.postId)}`;
|
|
21
|
+
break;
|
|
22
|
+
|
|
23
|
+
default:
|
|
24
|
+
path = `/navigation/${encodeURIComponent(urlParams.postType)}/${encodeURIComponent(urlParams.postId)}`;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return path;
|
|
29
|
+
}
|
|
11
30
|
export default function useSyncPathWithURL() {
|
|
12
31
|
const history = useHistory();
|
|
13
32
|
const {
|
|
14
|
-
params
|
|
33
|
+
params: urlParams
|
|
15
34
|
} = useLocation();
|
|
16
35
|
const {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const {
|
|
20
|
-
location,
|
|
36
|
+
location: navigatorLocation,
|
|
37
|
+
params: navigatorParams,
|
|
21
38
|
goTo
|
|
22
39
|
} = useNavigator();
|
|
23
|
-
const
|
|
24
|
-
const
|
|
40
|
+
const currentUrlParams = useRef(urlParams);
|
|
41
|
+
const currentPath = useRef(navigatorLocation.path);
|
|
42
|
+
const isMounting = useRef(true);
|
|
25
43
|
useEffect(() => {
|
|
26
|
-
|
|
44
|
+
// The navigatorParams are only initially filled properly when the
|
|
45
|
+
// navigator screens mount. so we ignore the first synchronisation.
|
|
46
|
+
if (isMounting.current) {
|
|
47
|
+
isMounting.current = false;
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
27
50
|
|
|
28
|
-
|
|
29
|
-
|
|
51
|
+
function updateUrlParams(newUrlParams) {
|
|
52
|
+
if (Object.entries(newUrlParams).every(_ref => {
|
|
53
|
+
let [key, value] = _ref;
|
|
54
|
+
return currentUrlParams.current[key] === value;
|
|
55
|
+
})) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const updatedParams = { ...currentUrlParams.current,
|
|
60
|
+
...newUrlParams
|
|
61
|
+
};
|
|
62
|
+
currentUrlParams.current = updatedParams;
|
|
63
|
+
history.push(updatedParams);
|
|
30
64
|
}
|
|
31
|
-
}, [path]);
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
currentNavigatorLocation.current = location.path;
|
|
34
65
|
|
|
35
|
-
if (
|
|
36
|
-
|
|
37
|
-
|
|
66
|
+
if (navigatorParams !== null && navigatorParams !== void 0 && navigatorParams.postType && navigatorParams !== null && navigatorParams !== void 0 && navigatorParams.postId) {
|
|
67
|
+
updateUrlParams({
|
|
68
|
+
postType: navigatorParams === null || navigatorParams === void 0 ? void 0 : navigatorParams.postType,
|
|
69
|
+
postId: navigatorParams === null || navigatorParams === void 0 ? void 0 : navigatorParams.postId,
|
|
70
|
+
path: undefined
|
|
71
|
+
});
|
|
72
|
+
} else {
|
|
73
|
+
updateUrlParams({
|
|
74
|
+
postType: undefined,
|
|
75
|
+
postId: undefined,
|
|
76
|
+
path: navigatorLocation.path === '/' ? undefined : navigatorLocation.path
|
|
38
77
|
});
|
|
39
78
|
}
|
|
40
|
-
}, [
|
|
41
|
-
|
|
79
|
+
}, [navigatorLocation === null || navigatorLocation === void 0 ? void 0 : navigatorLocation.path, navigatorParams, history]);
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
currentUrlParams.current = urlParams;
|
|
82
|
+
const path = getPathFromURL(urlParams);
|
|
83
|
+
|
|
84
|
+
if (currentPath.current !== path) {
|
|
85
|
+
currentPath.current = path;
|
|
86
|
+
goTo(path);
|
|
87
|
+
}
|
|
88
|
+
}, [urlParams, goTo]);
|
|
42
89
|
}
|
|
43
90
|
//# sourceMappingURL=use-sync-path-with-url.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sync-state-with-url/use-sync-path-with-url.js"],"names":["__experimentalUseNavigator","useNavigator","useEffect","useRef","useLocation","useHistory","useSyncPathWithURL","history","params","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sync-state-with-url/use-sync-path-with-url.js"],"names":["__experimentalUseNavigator","useNavigator","useEffect","useRef","useLocation","useHistory","getPathFromURL","urlParams","path","postType","postId","encodeURIComponent","useSyncPathWithURL","history","params","location","navigatorLocation","navigatorParams","goTo","currentUrlParams","currentPath","isMounting","current","updateUrlParams","newUrlParams","Object","entries","every","key","value","updatedParams","push","undefined"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,0BAA0B,IAAIC,YAAvC,QAA2D,uBAA3D;AACA,SAASC,SAAT,EAAoBC,MAApB,QAAkC,oBAAlC;AAEA;AACA;AACA;;AACA,SAASC,WAAT,EAAsBC,UAAtB,QAAwC,WAAxC;AAEA,OAAO,SAASC,cAAT,CAAyBC,SAAzB,EAAqC;AAAA;;AAC3C,MAAIC,IAAI,sBAAGD,SAAH,aAAGA,SAAH,uBAAGA,SAAS,CAAEC,IAAd,6DAAsB,GAA9B,CAD2C,CAG3C;;AACA,MAAKD,SAAS,SAAT,IAAAA,SAAS,WAAT,IAAAA,SAAS,CAAEE,QAAX,IAAuBF,SAAvB,aAAuBA,SAAvB,eAAuBA,SAAS,CAAEG,MAAvC,EAAgD;AAC/C,YAASH,SAAS,CAACE,QAAnB;AACC,WAAK,aAAL;AACA,WAAK,kBAAL;AACCD,QAA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'@wordpress/components';\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useLocation, useHistory } from '../routes';\n\nexport function getPathFromURL( urlParams ) {\n\tlet path = urlParams?.path ?? '/';\n\n\t// Compute the navigator path based on the URL params.\n\tif ( urlParams?.postType && urlParams?.postId ) {\n\t\tswitch ( urlParams.postType ) {\n\t\t\tcase 'wp_template':\n\t\t\tcase 'wp_template_part':\n\t\t\t\tpath = `/${ encodeURIComponent(\n\t\t\t\t\turlParams.postType\n\t\t\t\t) }/${ encodeURIComponent( urlParams.postId ) }`;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tpath = `/navigation/${ encodeURIComponent(\n\t\t\t\t\turlParams.postType\n\t\t\t\t) }/${ encodeURIComponent( urlParams.postId ) }`;\n\t\t}\n\t}\n\n\treturn path;\n}\n\nexport default function useSyncPathWithURL() {\n\tconst history = useHistory();\n\tconst { params: urlParams } = useLocation();\n\tconst {\n\t\tlocation: navigatorLocation,\n\t\tparams: navigatorParams,\n\t\tgoTo,\n\t} = useNavigator();\n\tconst currentUrlParams = useRef( urlParams );\n\tconst currentPath = useRef( navigatorLocation.path );\n\tconst isMounting = useRef( true );\n\n\tuseEffect( () => {\n\t\t// The navigatorParams are only initially filled properly when the\n\t\t// navigator screens mount. so we ignore the first synchronisation.\n\t\tif ( isMounting.current ) {\n\t\t\tisMounting.current = false;\n\t\t\treturn;\n\t\t}\n\n\t\tfunction updateUrlParams( newUrlParams ) {\n\t\t\tif (\n\t\t\t\tObject.entries( newUrlParams ).every( ( [ key, value ] ) => {\n\t\t\t\t\treturn currentUrlParams.current[ key ] === value;\n\t\t\t\t} )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst updatedParams = {\n\t\t\t\t...currentUrlParams.current,\n\t\t\t\t...newUrlParams,\n\t\t\t};\n\t\t\tcurrentUrlParams.current = updatedParams;\n\t\t\thistory.push( updatedParams );\n\t\t}\n\n\t\tif ( navigatorParams?.postType && navigatorParams?.postId ) {\n\t\t\tupdateUrlParams( {\n\t\t\t\tpostType: navigatorParams?.postType,\n\t\t\t\tpostId: navigatorParams?.postId,\n\t\t\t\tpath: undefined,\n\t\t\t} );\n\t\t} else {\n\t\t\tupdateUrlParams( {\n\t\t\t\tpostType: undefined,\n\t\t\t\tpostId: undefined,\n\t\t\t\tpath:\n\t\t\t\t\tnavigatorLocation.path === '/'\n\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t: navigatorLocation.path,\n\t\t\t} );\n\t\t}\n\t}, [ navigatorLocation?.path, navigatorParams, history ] );\n\n\tuseEffect( () => {\n\t\tcurrentUrlParams.current = urlParams;\n\t\tconst path = getPathFromURL( urlParams );\n\t\tif ( currentPath.current !== path ) {\n\t\t\tcurrentPath.current = path;\n\t\t\tgoTo( path );\n\t\t}\n\t}, [ urlParams, goTo ] );\n}\n"]}
|
|
@@ -15,7 +15,6 @@ import { decodeEntities } from '@wordpress/html-entities';
|
|
|
15
15
|
|
|
16
16
|
import isTemplateRevertable from '../../utils/is-template-revertable';
|
|
17
17
|
import { store as editSiteStore } from '../../store';
|
|
18
|
-
import TemplateAreas from './template-areas';
|
|
19
18
|
import EditTemplateTitle from './edit-template-title';
|
|
20
19
|
import { useLink } from '../routes/link';
|
|
21
20
|
import TemplatePartAreaSelector from './template-part-area-selector';
|
|
@@ -30,11 +29,10 @@ export default function TemplateDetails(_ref) {
|
|
|
30
29
|
} = useSelect(select => select(editorStore).__experimentalGetTemplateInfo(template), []);
|
|
31
30
|
const {
|
|
32
31
|
revertTemplate
|
|
33
|
-
} = useDispatch(editSiteStore);
|
|
32
|
+
} = useDispatch(editSiteStore); // TODO: We should update this to filter by template part's areas as well.
|
|
33
|
+
|
|
34
34
|
const browseAllLinkProps = useLink({
|
|
35
|
-
|
|
36
|
-
postType: template.type,
|
|
37
|
-
postId: undefined
|
|
35
|
+
path: '/' + template.type + '/all'
|
|
38
36
|
});
|
|
39
37
|
const isTemplatePart = template.type === 'wp_template_part'; // Only user-created and non-default templates can change the name.
|
|
40
38
|
// But any user-created template part can be renamed.
|
|
@@ -70,9 +68,7 @@ export default function TemplateDetails(_ref) {
|
|
|
70
68
|
className: "edit-site-template-details__group"
|
|
71
69
|
}, createElement(TemplatePartAreaSelector, {
|
|
72
70
|
id: template.id
|
|
73
|
-
})), createElement(
|
|
74
|
-
closeTemplateDetailsDropdown: onClose
|
|
75
|
-
}), isTemplateRevertable(template) && createElement(MenuGroup, {
|
|
71
|
+
})), isTemplateRevertable(template) && createElement(MenuGroup, {
|
|
76
72
|
className: "edit-site-template-details__group edit-site-template-details__revert"
|
|
77
73
|
}, createElement(MenuItem, {
|
|
78
74
|
className: "edit-site-template-details__revert-button",
|
|
@@ -80,6 +76,6 @@ export default function TemplateDetails(_ref) {
|
|
|
80
76
|
onClick: revert
|
|
81
77
|
}, __('Clear customizations'))), createElement(Button, _extends({
|
|
82
78
|
className: "edit-site-template-details__show-all-button"
|
|
83
|
-
}, browseAllLinkProps), (template === null || template === void 0 ? void 0 : template.type) === 'wp_template' ? __('
|
|
79
|
+
}, browseAllLinkProps), (template === null || template === void 0 ? void 0 : template.type) === 'wp_template' ? __('Manage all templates') : __('Manage all template parts')));
|
|
84
80
|
}
|
|
85
81
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/index.js"],"names":["__","Button","MenuGroup","MenuItem","__experimentalVStack","VStack","__experimentalText","Text","useDispatch","useSelect","store","editorStore","decodeEntities","isTemplateRevertable","editSiteStore","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/index.js"],"names":["__","Button","MenuGroup","MenuItem","__experimentalVStack","VStack","__experimentalText","Text","useDispatch","useSelect","store","editorStore","decodeEntities","isTemplateRevertable","editSiteStore","EditTemplateTitle","useLink","TemplatePartAreaSelector","TemplateDetails","template","onClose","title","description","select","__experimentalGetTemplateInfo","revertTemplate","browseAllLinkProps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AF,CADH,GAECA,EAAE,CAAE,2BAAF,CANN,CA9CD,CADD;AAyDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\tMenuGroup,\n\tMenuItem,\n\t__experimentalVStack as VStack,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport { store as editSiteStore } from '../../store';\nimport EditTemplateTitle from './edit-template-title';\nimport { useLink } from '../routes/link';\nimport TemplatePartAreaSelector from './template-part-area-selector';\n\nexport default function TemplateDetails( { template, onClose } ) {\n\tconst { title, description } = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetTemplateInfo( template ),\n\t\t[]\n\t);\n\tconst { revertTemplate } = useDispatch( editSiteStore );\n\n\t// TODO: We should update this to filter by template part's areas as well.\n\tconst browseAllLinkProps = useLink( {\n\t\tpath: '/' + template.type + '/all',\n\t} );\n\n\tconst isTemplatePart = template.type === 'wp_template_part';\n\n\t// Only user-created and non-default templates can change the name.\n\t// But any user-created template part can be renamed.\n\tconst canEditTitle = isTemplatePart\n\t\t? ! template.has_theme_file\n\t\t: template.is_custom && ! template.has_theme_file;\n\n\tif ( ! template ) {\n\t\treturn null;\n\t}\n\n\tconst revert = () => {\n\t\trevertTemplate( template );\n\t\tonClose();\n\t};\n\n\treturn (\n\t\t<div className=\"edit-site-template-details\">\n\t\t\t<VStack className=\"edit-site-template-details__group\" spacing={ 3 }>\n\t\t\t\t{ canEditTitle ? (\n\t\t\t\t\t<EditTemplateTitle template={ template } />\n\t\t\t\t) : (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tsize={ 16 }\n\t\t\t\t\t\tweight={ 600 }\n\t\t\t\t\t\tclassName=\"edit-site-template-details__title\"\n\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ decodeEntities( title ) }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\n\t\t\t\t{ description && (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tsize=\"body\"\n\t\t\t\t\t\tclassName=\"edit-site-template-details__description\"\n\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ decodeEntities( description ) }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\t\t\t</VStack>\n\n\t\t\t{ isTemplatePart && (\n\t\t\t\t<div className=\"edit-site-template-details__group\">\n\t\t\t\t\t<TemplatePartAreaSelector id={ template.id } />\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ isTemplateRevertable( template ) && (\n\t\t\t\t<MenuGroup className=\"edit-site-template-details__group edit-site-template-details__revert\">\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tclassName=\"edit-site-template-details__revert-button\"\n\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t'Use the template as supplied by the theme.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonClick={ revert }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Clear customizations' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-site-template-details__show-all-button\"\n\t\t\t\t{ ...browseAllLinkProps }\n\t\t\t>\n\t\t\t\t{ template?.type === 'wp_template'\n\t\t\t\t\t? __( 'Manage all templates' )\n\t\t\t\t\t: __( 'Manage all template parts' ) }\n\t\t\t</Button>\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -4,12 +4,13 @@ import { createElement } from "@wordpress/element";
|
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
6
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
7
|
-
import {
|
|
7
|
+
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
8
8
|
import { MenuItem } from '@wordpress/components';
|
|
9
9
|
import { __ } from '@wordpress/i18n';
|
|
10
10
|
export default function ConvertToRegularBlocks(_ref) {
|
|
11
11
|
let {
|
|
12
|
-
clientId
|
|
12
|
+
clientId,
|
|
13
|
+
onClose
|
|
13
14
|
} = _ref;
|
|
14
15
|
const {
|
|
15
16
|
getBlocks
|
|
@@ -23,16 +24,11 @@ export default function ConvertToRegularBlocks(_ref) {
|
|
|
23
24
|
return null;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
return createElement(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
replaceBlocks(clientId, getBlocks(clientId));
|
|
33
|
-
onClose();
|
|
34
|
-
}
|
|
35
|
-
}, __('Detach blocks from template part'));
|
|
36
|
-
});
|
|
27
|
+
return createElement(MenuItem, {
|
|
28
|
+
onClick: () => {
|
|
29
|
+
replaceBlocks(clientId, getBlocks(clientId));
|
|
30
|
+
onClose();
|
|
31
|
+
}
|
|
32
|
+
}, __('Detach blocks from template part'));
|
|
37
33
|
}
|
|
38
34
|
//# sourceMappingURL=convert-to-regular.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/template-part-converter/convert-to-regular.js"],"names":["useSelect","useDispatch","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/template-part-converter/convert-to-regular.js"],"names":["useSelect","useDispatch","store","blockEditorStore","MenuItem","__","ConvertToRegularBlocks","clientId","onClose","getBlocks","replaceBlocks","canRemove","select","canRemoveBlock"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AACA,SAASC,QAAT,QAAyB,uBAAzB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA,eAAe,SAASC,sBAAT,OAAyD;AAAA,MAAxB;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAwB;AACvE,QAAM;AAAEC,IAAAA;AAAF,MAAgBT,SAAS,CAAEG,gBAAF,CAA/B;AACA,QAAM;AAAEO,IAAAA;AAAF,MAAoBT,WAAW,CAAEE,gBAAF,CAArC;AAEA,QAAMQ,SAAS,GAAGX,SAAS,CACxBY,MAAF,IAAcA,MAAM,CAAET,gBAAF,CAAN,CAA2BU,cAA3B,CAA2CN,QAA3C,CADY,EAE1B,CAAEA,QAAF,CAF0B,CAA3B;;AAKA,MAAK,CAAEI,SAAP,EAAmB;AAClB,WAAO,IAAP;AACA;;AAED,SACC,cAAC,QAAD;AACC,IAAA,OAAO,EAAG,MAAM;AACfD,MAAAA,aAAa,CAAEH,QAAF,EAAYE,SAAS,CAAEF,QAAF,CAArB,CAAb;AACAC,MAAAA,OAAO;AACP;AAJF,KAMGH,EAAE,CAAE,kCAAF,CANL,CADD;AAUA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nexport default function ConvertToRegularBlocks( { clientId, onClose } ) {\n\tconst { getBlocks } = useSelect( blockEditorStore );\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\n\tconst canRemove = useSelect(\n\t\t( select ) => select( blockEditorStore ).canRemoveBlock( clientId ),\n\t\t[ clientId ]\n\t);\n\n\tif ( ! canRemove ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\treplaceBlocks( clientId, getBlocks( clientId ) );\n\t\t\t\tonClose();\n\t\t\t} }\n\t\t>\n\t\t\t{ __( 'Detach blocks from template part' ) }\n\t\t</MenuItem>\n\t);\n}\n"]}
|
|
@@ -4,7 +4,7 @@ import { createElement, Fragment } from "@wordpress/element";
|
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
6
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
7
|
-
import {
|
|
7
|
+
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
8
8
|
import { MenuItem } from '@wordpress/components';
|
|
9
9
|
import { createBlock, serialize } from '@wordpress/blocks';
|
|
10
10
|
import { __ } from '@wordpress/i18n';
|
|
@@ -73,12 +73,12 @@ export default function ConvertToTemplatePart(_ref) {
|
|
|
73
73
|
// so no need to call `closeModal` or `onClose`.
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
-
return createElement(Fragment, null, createElement(
|
|
76
|
+
return createElement(Fragment, null, createElement(MenuItem, {
|
|
77
77
|
icon: symbolFilled,
|
|
78
78
|
onClick: () => {
|
|
79
79
|
setIsModalOpen(true);
|
|
80
80
|
}
|
|
81
|
-
}, __('Create Template part'))
|
|
81
|
+
}, __('Create Template part')), isModalOpen && createElement(CreateTemplatePartModal, {
|
|
82
82
|
closeModal: () => {
|
|
83
83
|
setIsModalOpen(false);
|
|
84
84
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/template-part-converter/convert-to-template-part.js"],"names":["useDispatch","useSelect","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/template-part-converter/convert-to-template-part.js"],"names":["useDispatch","useSelect","store","blockEditorStore","MenuItem","createBlock","serialize","__","useState","coreStore","noticesStore","symbolFilled","CreateTemplatePartModal","editSiteStore","useExistingTemplateParts","getUniqueTemplatePartTitle","getCleanTemplatePartSlug","ConvertToTemplatePart","clientIds","blocks","isModalOpen","setIsModalOpen","replaceBlocks","saveEntityRecord","createSuccessNotice","existingTemplateParts","canCreate","select","supportsTemplatePartsMode","getSettings","onConvert","title","area","uniqueTitle","cleanSlug","templatePart","slug","content","theme","type"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,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T,KAAqB;AAC9C,UAAMC,WAAW,GAAGlB,0BAA0B,CAC7CgB,KAD6C,EAE7CN,qBAF6C,CAA9C;AAIA,UAAMS,SAAS,GAAGlB,wBAAwB,CAAEiB,WAAF,CAA1C;AAEA,UAAME,YAAY,GAAG,MAAMZ,gBAAgB,CAC1C,UAD0C,EAE1C,kBAF0C,EAG1C;AACCa,MAAAA,IAAI,EAAEF,SADP;AAECH,MAAAA,KAAK,EAAEE,WAFR;AAGCI,MAAAA,OAAO,EAAE/B,SAAS,CAAEa,MAAF,CAHnB;AAICa,MAAAA;AAJD,KAH0C,CAA3C;AAUAV,IAAAA,aAAa,CACZJ,SADY,EAEZb,WAAW,CAAE,oBAAF,EAAwB;AAClC+B,MAAAA,IAAI,EAAED,YAAY,CAACC,IADe;AAElCE,MAAAA,KAAK,EAAEH,YAAY,CAACG;AAFc,KAAxB,CAFC,CAAb;AAOAd,IAAAA,mBAAmB,CAAEjB,EAAE,CAAE,wBAAF,CAAJ,EAAkC;AACpDgC,MAAAA,IAAI,EAAE;AAD8C,KAAlC,CAAnB,CAxB8C,CA4B9C;AACA;AACA,GA9BD;;AAgCA,SACC,8BACC,cAAC,QAAD;AACC,IAAA,IAAI,EAAG5B,YADR;AAEC,IAAA,OAAO,EAAG,MAAM;AACfU,MAAAA,cAAc,CAAE,IAAF,CAAd;AACA;AAJF,KAMGd,EAAE,CAAE,sBAAF,CANL,CADD,EASGa,WAAW,IACZ,cAAC,uBAAD;AACC,IAAA,UAAU,EAAG,MAAM;AAClBC,MAAAA,cAAc,CAAE,KAAF,CAAd;AACA,KAHF;AAIC,IAAA,QAAQ,EAAGS;AAJZ,IAVF,CADD;AAoBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { MenuItem } from '@wordpress/components';\nimport { createBlock, serialize } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { symbolFilled } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport CreateTemplatePartModal from '../create-template-part-modal';\nimport { store as editSiteStore } from '../../store';\nimport {\n\tuseExistingTemplateParts,\n\tgetUniqueTemplatePartTitle,\n\tgetCleanTemplatePartSlug,\n} from '../../utils/template-part-create';\n\nexport default function ConvertToTemplatePart( { clientIds, blocks } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst existingTemplateParts = useExistingTemplateParts();\n\n\tconst { canCreate } = useSelect( ( select ) => {\n\t\tconst { supportsTemplatePartsMode } =\n\t\t\tselect( editSiteStore ).getSettings();\n\t\treturn {\n\t\t\tcanCreate: ! supportsTemplatePartsMode,\n\t\t};\n\t}, [] );\n\n\tif ( ! canCreate ) {\n\t\treturn null;\n\t}\n\n\tconst onConvert = async ( { title, area } ) => {\n\t\tconst uniqueTitle = getUniqueTemplatePartTitle(\n\t\t\ttitle,\n\t\t\texistingTemplateParts\n\t\t);\n\t\tconst cleanSlug = getCleanTemplatePartSlug( uniqueTitle );\n\n\t\tconst templatePart = await saveEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\t{\n\t\t\t\tslug: cleanSlug,\n\t\t\t\ttitle: uniqueTitle,\n\t\t\t\tcontent: serialize( blocks ),\n\t\t\t\tarea,\n\t\t\t}\n\t\t);\n\t\treplaceBlocks(\n\t\t\tclientIds,\n\t\t\tcreateBlock( 'core/template-part', {\n\t\t\t\tslug: templatePart.slug,\n\t\t\t\ttheme: templatePart.theme,\n\t\t\t} )\n\t\t);\n\t\tcreateSuccessNotice( __( 'Template part created.' ), {\n\t\t\ttype: 'snackbar',\n\t\t} );\n\n\t\t// The modal and this component will be unmounted because of `replaceBlocks` above,\n\t\t// so no need to call `closeModal` or `onClose`.\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<MenuItem\n\t\t\t\ticon={ symbolFilled }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetIsModalOpen( true );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ __( 'Create Template part' ) }\n\t\t\t</MenuItem>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<CreateTemplatePartModal\n\t\t\t\t\tcloseModal={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\tonCreate={ onConvert }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -4,7 +4,7 @@ import { createElement } from "@wordpress/element";
|
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
6
|
import { useSelect } from '@wordpress/data';
|
|
7
|
-
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
7
|
+
import { BlockSettingsMenuControls, store as blockEditorStore } from '@wordpress/block-editor';
|
|
8
8
|
/**
|
|
9
9
|
* Internal dependencies
|
|
10
10
|
*/
|
|
@@ -12,26 +12,31 @@ import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
|
12
12
|
import ConvertToRegularBlocks from './convert-to-regular';
|
|
13
13
|
import ConvertToTemplatePart from './convert-to-template-part';
|
|
14
14
|
export default function TemplatePartConverter() {
|
|
15
|
+
return createElement(BlockSettingsMenuControls, null, _ref => {
|
|
16
|
+
let {
|
|
17
|
+
selectedClientIds,
|
|
18
|
+
onClose
|
|
19
|
+
} = _ref;
|
|
20
|
+
return createElement(TemplatePartConverterMenuItem, {
|
|
21
|
+
clientIds: selectedClientIds,
|
|
22
|
+
onClose: onClose
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function TemplatePartConverterMenuItem(_ref2) {
|
|
15
28
|
var _blocks$;
|
|
16
29
|
|
|
17
|
-
|
|
30
|
+
let {
|
|
18
31
|
clientIds,
|
|
19
|
-
|
|
20
|
-
} =
|
|
21
|
-
|
|
22
|
-
getSelectedBlockClientIds,
|
|
23
|
-
getBlocksByClientId
|
|
24
|
-
} = select(blockEditorStore);
|
|
25
|
-
const selectedBlockClientIds = getSelectedBlockClientIds();
|
|
26
|
-
return {
|
|
27
|
-
clientIds: selectedBlockClientIds,
|
|
28
|
-
blocks: getBlocksByClientId(selectedBlockClientIds)
|
|
29
|
-
};
|
|
30
|
-
}, []); // Allow converting a single template part to standard blocks.
|
|
32
|
+
onClose
|
|
33
|
+
} = _ref2;
|
|
34
|
+
const blocks = useSelect(select => select(blockEditorStore).getBlocksByClientId(clientIds), [clientIds]); // Allow converting a single template part to standard blocks.
|
|
31
35
|
|
|
32
36
|
if (blocks.length === 1 && ((_blocks$ = blocks[0]) === null || _blocks$ === void 0 ? void 0 : _blocks$.name) === 'core/template-part') {
|
|
33
37
|
return createElement(ConvertToRegularBlocks, {
|
|
34
|
-
clientId: clientIds[0]
|
|
38
|
+
clientId: clientIds[0],
|
|
39
|
+
onClose: onClose
|
|
35
40
|
});
|
|
36
41
|
}
|
|
37
42
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/template-part-converter/index.js"],"names":["useSelect","store","blockEditorStore","ConvertToRegularBlocks","ConvertToTemplatePart","TemplatePartConverter","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/template-part-converter/index.js"],"names":["useSelect","BlockSettingsMenuControls","store","blockEditorStore","ConvertToRegularBlocks","ConvertToTemplatePart","TemplatePartConverter","selectedClientIds","onClose","TemplatePartConverterMenuItem","clientIds","blocks","select","getBlocksByClientId","length","name"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SACCC,yBADD,EAECC,KAAK,IAAIC,gBAFV,QAGO,yBAHP;AAKA;AACA;AACA;;AACA,OAAOC,sBAAP,MAAmC,sBAAnC;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AAEA,eAAe,SAASC,qBAAT,GAAiC;AAC/C,SACC,cAAC,yBAAD,QACG;AAAA,QAAE;AAAEC,MAAAA,iBAAF;AAAqBC,MAAAA;AAArB,KAAF;AAAA,WACD,cAAC,6BAAD;AACC,MAAA,SAAS,EAAGD,iBADb;AAEC,MAAA,OAAO,EAAGC;AAFX,MADC;AAAA,GADH,CADD;AAUA;;AAED,SAASC,6BAAT,QAAiE;AAAA;;AAAA,MAAzB;AAAEC,IAAAA,SAAF;AAAaF,IAAAA;AAAb,GAAyB;AAChE,QAAMG,MAAM,GAAGX,SAAS,CACrBY,MAAF,IACCA,MAAM,CAAET,gBAAF,CAAN,CAA2BU,mBAA3B,CAAgDH,SAAhD,CAFsB,EAGvB,CAAEA,SAAF,CAHuB,CAAxB,CADgE,CAOhE;;AACA,MAAKC,MAAM,CAACG,MAAP,KAAkB,CAAlB,IAAuB,aAAAH,MAAM,CAAE,CAAF,CAAN,sDAAaI,IAAb,MAAsB,oBAAlD,EAAyE;AACxE,WACC,cAAC,sBAAD;AACC,MAAA,QAAQ,EAAGL,SAAS,CAAE,CAAF,CADrB;AAEC,MAAA,OAAO,EAAGF;AAFX,MADD;AAMA;;AACD,SAAO,cAAC,qBAAD;AAAuB,IAAA,SAAS,EAAGE,SAAnC;AAA+C,IAAA,MAAM,EAAGC;AAAxD,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tBlockSettingsMenuControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ConvertToRegularBlocks from './convert-to-regular';\nimport ConvertToTemplatePart from './convert-to-template-part';\n\nexport default function TemplatePartConverter() {\n\treturn (\n\t\t<BlockSettingsMenuControls>\n\t\t\t{ ( { selectedClientIds, onClose } ) => (\n\t\t\t\t<TemplatePartConverterMenuItem\n\t\t\t\t\tclientIds={ selectedClientIds }\n\t\t\t\t\tonClose={ onClose }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</BlockSettingsMenuControls>\n\t);\n}\n\nfunction TemplatePartConverterMenuItem( { clientIds, onClose } ) {\n\tconst blocks = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlocksByClientId( clientIds ),\n\t\t[ clientIds ]\n\t);\n\n\t// Allow converting a single template part to standard blocks.\n\tif ( blocks.length === 1 && blocks[ 0 ]?.name === 'core/template-part' ) {\n\t\treturn (\n\t\t\t<ConvertToRegularBlocks\n\t\t\t\tclientId={ clientIds[ 0 ] }\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t);\n\t}\n\treturn <ConvertToTemplatePart clientIds={ clientIds } blocks={ blocks } />;\n}\n"]}
|
|
@@ -10,7 +10,7 @@ import { decodeEntities } from '@wordpress/html-entities';
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { store as editSiteStore } from '../../store';
|
|
13
|
-
export default function useEditedEntityRecord() {
|
|
13
|
+
export default function useEditedEntityRecord(postType, postId) {
|
|
14
14
|
const {
|
|
15
15
|
record,
|
|
16
16
|
title,
|
|
@@ -27,12 +27,12 @@ export default function useEditedEntityRecord() {
|
|
|
27
27
|
const {
|
|
28
28
|
__experimentalGetTemplateInfo: getTemplateInfo
|
|
29
29
|
} = select(editorStore);
|
|
30
|
-
const
|
|
31
|
-
const
|
|
30
|
+
const usedPostType = postType !== null && postType !== void 0 ? postType : getEditedPostType();
|
|
31
|
+
const usedPostId = postId !== null && postId !== void 0 ? postId : getEditedPostId();
|
|
32
32
|
|
|
33
|
-
const _record = getEditedEntityRecord('postType',
|
|
33
|
+
const _record = getEditedEntityRecord('postType', usedPostType, usedPostId);
|
|
34
34
|
|
|
35
|
-
const _isLoaded = !!
|
|
35
|
+
const _isLoaded = !!usedPostId;
|
|
36
36
|
|
|
37
37
|
const templateInfo = getTemplateInfo(_record);
|
|
38
38
|
return {
|
|
@@ -41,7 +41,7 @@ export default function useEditedEntityRecord() {
|
|
|
41
41
|
description: templateInfo.description,
|
|
42
42
|
isLoaded: _isLoaded
|
|
43
43
|
};
|
|
44
|
-
}, []);
|
|
44
|
+
}, [postType, postId]);
|
|
45
45
|
return {
|
|
46
46
|
isLoaded,
|
|
47
47
|
record,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/use-edited-entity-record/index.js"],"names":["useSelect","store","coreStore","editorStore","decodeEntities","editSiteStore","useEditedEntityRecord","record","title","description","isLoaded","select","getEditedPostType","getEditedPostId","getEditedEntityRecord","__experimentalGetTemplateInfo","getTemplateInfo","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/use-edited-entity-record/index.js"],"names":["useSelect","store","coreStore","editorStore","decodeEntities","editSiteStore","useEditedEntityRecord","postType","postId","record","title","description","isLoaded","select","getEditedPostType","getEditedPostId","getEditedEntityRecord","__experimentalGetTemplateInfo","getTemplateInfo","usedPostType","usedPostId","_record","_isLoaded","templateInfo","getTitle","getDescription"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,mBAArC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AAEA;AACA;AACA;;AACA,SAASH,KAAK,IAAII,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,qBAAT,CAAgCC,QAAhC,EAA0CC,MAA1C,EAAmD;AACjE,QAAM;AAAEC,IAAAA,MAAF;AAAUC,IAAAA,KAAV;AAAiBC,IAAAA,WAAjB;AAA8BC,IAAAA;AAA9B,MAA2CZ,SAAS,CACvDa,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,iBAAF;AAAqBC,MAAAA;AAArB,QACLF,MAAM,CAAER,aAAF,CADP;AAEA,UAAM;AAAEW,MAAAA;AAAF,QAA4BH,MAAM,CAAEX,SAAF,CAAxC;AACA,UAAM;AAAEe,MAAAA,6BAA6B,EAAEC;AAAjC,QACLL,MAAM,CAAEV,WAAF,CADP;AAEA,UAAMgB,YAAY,GAAGZ,QAAH,aAAGA,QAAH,cAAGA,QAAH,GAAeO,iBAAiB,EAAlD;AACA,UAAMM,UAAU,GAAGZ,MAAH,aAAGA,MAAH,cAAGA,MAAH,GAAaO,eAAe,EAA5C;;AACA,UAAMM,OAAO,GAAGL,qBAAqB,CACpC,UADoC,EAEpCG,YAFoC,EAGpCC,UAHoC,CAArC;;AAKA,UAAME,SAAS,GAAG,CAAC,CAAEF,UAArB;;AACA,UAAMG,YAAY,GAAGL,eAAe,CAAEG,OAAF,CAApC;AAEA,WAAO;AACNZ,MAAAA,MAAM,EAAEY,OADF;AAENX,MAAAA,KAAK,EAAEa,YAAY,CAACb,KAFd;AAGNC,MAAAA,WAAW,EAAEY,YAAY,CAACZ,WAHpB;AAINC,MAAAA,QAAQ,EAAEU;AAJJ,KAAP;AAMA,GAvBwD,EAwBzD,CAAEf,QAAF,EAAYC,MAAZ,CAxByD,CAA1D;AA2BA,SAAO;AACNI,IAAAA,QADM;AAENH,IAAAA,MAFM;AAGNe,IAAAA,QAAQ,EAAE,MAAQd,KAAK,GAAGN,cAAc,CAAEM,KAAF,CAAjB,GAA6B,IAH9C;AAINe,IAAAA,cAAc,EAAE,MACfd,WAAW,GAAGP,cAAc,CAAEO,WAAF,CAAjB,GAAmC;AALzC,GAAP;AAOA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nexport default function useEditedEntityRecord( postType, postId ) {\n\tconst { record, title, description, isLoaded } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostType, getEditedPostId } =\n\t\t\t\tselect( editSiteStore );\n\t\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\t\tconst { __experimentalGetTemplateInfo: getTemplateInfo } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst usedPostType = postType ?? getEditedPostType();\n\t\t\tconst usedPostId = postId ?? getEditedPostId();\n\t\t\tconst _record = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tusedPostType,\n\t\t\t\tusedPostId\n\t\t\t);\n\t\t\tconst _isLoaded = !! usedPostId;\n\t\t\tconst templateInfo = getTemplateInfo( _record );\n\n\t\t\treturn {\n\t\t\t\trecord: _record,\n\t\t\t\ttitle: templateInfo.title,\n\t\t\t\tdescription: templateInfo.description,\n\t\t\t\tisLoaded: _isLoaded,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\treturn {\n\t\tisLoaded,\n\t\trecord,\n\t\tgetTitle: () => ( title ? decodeEntities( title ) : null ),\n\t\tgetDescription: () =>\n\t\t\tdescription ? decodeEntities( description ) : null,\n\t};\n}\n"]}
|
package/build-module/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { createElement } from "@wordpress/element";
|
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
6
|
import { store as blocksStore } from '@wordpress/blocks';
|
|
7
|
-
import { registerCoreBlocks, __experimentalRegisterExperimentalCoreBlocks } from '@wordpress/block-library';
|
|
7
|
+
import { registerCoreBlocks, __experimentalGetCoreBlocks, __experimentalRegisterExperimentalCoreBlocks } from '@wordpress/block-library';
|
|
8
8
|
import { dispatch } from '@wordpress/data';
|
|
9
9
|
import deprecated from '@wordpress/deprecated';
|
|
10
10
|
import { createRoot } from '@wordpress/element';
|
|
@@ -12,8 +12,7 @@ import { __experimentalFetchLinkSuggestions as fetchLinkSuggestions, __experimen
|
|
|
12
12
|
import { store as editorStore } from '@wordpress/editor';
|
|
13
13
|
import { store as interfaceStore } from '@wordpress/interface';
|
|
14
14
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
15
|
-
import {
|
|
16
|
-
import { registerLegacyWidgetBlock } from '@wordpress/widgets';
|
|
15
|
+
import { registerLegacyWidgetBlock, registerWidgetGroupBlock } from '@wordpress/widgets';
|
|
17
16
|
/**
|
|
18
17
|
* Internal dependencies
|
|
19
18
|
*/
|
|
@@ -38,36 +37,30 @@ export function initializeEditor(id, settings) {
|
|
|
38
37
|
|
|
39
38
|
dispatch(blocksStore).__experimentalReapplyBlockTypeFilters();
|
|
40
39
|
|
|
41
|
-
|
|
40
|
+
const coreBlocks = __experimentalGetCoreBlocks().filter(_ref => {
|
|
41
|
+
let {
|
|
42
|
+
name
|
|
43
|
+
} = _ref;
|
|
44
|
+
return name !== 'core/freeform';
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
registerCoreBlocks(coreBlocks);
|
|
48
|
+
dispatch(blocksStore).setFreeformFallbackBlockName('core/html');
|
|
42
49
|
registerLegacyWidgetBlock({
|
|
43
50
|
inserter: false
|
|
44
51
|
});
|
|
52
|
+
registerWidgetGroupBlock({
|
|
53
|
+
inserter: false
|
|
54
|
+
});
|
|
45
55
|
|
|
46
56
|
if (process.env.IS_GUTENBERG_PLUGIN) {
|
|
47
57
|
__experimentalRegisterExperimentalCoreBlocks({
|
|
48
58
|
enableFSEBlocks: true
|
|
49
59
|
});
|
|
50
|
-
}
|
|
51
|
-
/*
|
|
52
|
-
* Prevent adding the Clasic block in the site editor.
|
|
53
|
-
* Only add the filter when the site editor is initialized, not imported.
|
|
54
|
-
* Also only add the filter(s) after registerCoreBlocks()
|
|
55
|
-
* so that common filters in the block library are not overwritten.
|
|
56
|
-
*
|
|
57
|
-
* This usage here is inspired by previous usage of the filter in the post editor:
|
|
58
|
-
* https://github.com/WordPress/gutenberg/pull/37157
|
|
59
|
-
*/
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
addFilter('blockEditor.__unstableCanInsertBlockType', 'removeClassicBlockFromInserter', (canInsert, blockType) => {
|
|
63
|
-
if (blockType.name === 'core/freeform') {
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return canInsert;
|
|
68
|
-
}); // We dispatch actions and update the store synchronously before rendering
|
|
60
|
+
} // We dispatch actions and update the store synchronously before rendering
|
|
69
61
|
// so that we won't trigger unnecessary re-renders with useEffect.
|
|
70
62
|
|
|
63
|
+
|
|
71
64
|
dispatch(preferencesStore).setDefaults('core/edit-site', {
|
|
72
65
|
editorMode: 'visual',
|
|
73
66
|
fixedToolbar: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["store","blocksStore","registerCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","dispatch","deprecated","createRoot","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","editorStore","interfaceStore","preferencesStore","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["store","blocksStore","registerCoreBlocks","__experimentalGetCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","dispatch","deprecated","createRoot","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","editorStore","interfaceStore","preferencesStore","registerLegacyWidgetBlock","registerWidgetGroupBlock","editSiteStore","App","initializeEditor","id","settings","target","document","getElementById","root","search","searchOptions","__experimentalFetchRichUrlData","__experimentalReapplyBlockTypeFilters","coreBlocks","filter","name","setFreeformFallbackBlockName","inserter","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","setDefaults","editorMode","fixedToolbar","focusMode","keepCaretInsideBlock","welcomeGuide","welcomeGuideStyles","showListViewByDefault","setDefaultComplementaryArea","updateSettings","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","window","addEventListener","e","preventDefault","render","reinitializeEditor","since","version","default","PluginSidebar","PluginSidebarMoreMenuItem","PluginMoreMenuItem"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA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B,MAAzB,EAAmCC,CAAF,IAASA,CAAC,CAACC,cAAF,EAA1C,EAA8D,KAA9D;AAEA9B,EAAAA,IAAI,CAAC+B,MAAL,CAAa,cAAC,GAAD,OAAb;AAEA,SAAO/B,IAAP;AACA;AAED,OAAO,SAASgC,kBAAT,GAA8B;AACpCnD,EAAAA,UAAU,CAAE,gCAAF,EAAoC;AAC7CoD,IAAAA,KAAK,EAAE,KADsC;AAE7CC,IAAAA,OAAO,EAAE;AAFoC,GAApC,CAAV;AAIA;AAED,SAASC,OAAO,IAAIC,aAApB,QAAyC,+CAAzC;AACA,SAASD,OAAO,IAAIE,yBAApB,QAAqD,6DAArD;AACA,SAASF,OAAO,IAAIG,kBAApB,QAA8C,qDAA9C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot } from '@wordpress/element';\nimport {\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport { store as editSiteStore } from './store';\nimport App from './components/app';\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tsettings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>\n\t\tfetchLinkSuggestions( search, searchOptions, settings );\n\tsettings.__experimentalFetchRichUrlData = fetchUrlData;\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter(\n\t\t( { name } ) => name !== 'core/freeform'\n\t);\n\tregisterCoreBlocks( coreBlocks );\n\tdispatch( blocksStore ).setFreeformFallbackBlockName( 'core/html' );\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfocusMode: false,\n\t\tkeepCaretInsideBlock: false,\n\t\twelcomeGuide: true,\n\t\twelcomeGuideStyles: true,\n\t\tshowListViewByDefault: false,\n\t} );\n\n\tdispatch( interfaceStore ).setDefaultComplementaryArea(\n\t\t'core/edit-site',\n\t\t'edit-site/template'\n\t);\n\n\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t// Keep the defaultTemplateTypes in the core/editor settings too,\n\t// so that they can be selected with core/editor selectors in any editor.\n\t// This is needed because edit-site doesn't initialize with EditorProvider,\n\t// which internally uses updateEditorSettings as well.\n\tdispatch( editorStore ).updateEditorSettings( {\n\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t} );\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render( <App /> );\n\n\treturn root;\n}\n\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editSite.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginSidebar } from './components/sidebar-edit-mode/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header-edit-mode/plugin-sidebar-more-menu-item';\nexport { default as PluginMoreMenuItem } from './components/header-edit-mode/plugin-more-menu-item';\n"]}
|
|
@@ -477,8 +477,8 @@ export const switchEditorMode = mode => _ref10 => {
|
|
|
477
477
|
|
|
478
478
|
if (mode === 'visual') {
|
|
479
479
|
speak(__('Visual editor selected'), 'assertive');
|
|
480
|
-
} else if (mode === '
|
|
481
|
-
speak(__('
|
|
480
|
+
} else if (mode === 'text') {
|
|
481
|
+
speak(__('Code editor selected'), 'assertive');
|
|
482
482
|
}
|
|
483
483
|
};
|
|
484
484
|
//# sourceMappingURL=actions.js.map
|