@wordpress/edit-site 5.27.2 → 5.28.1
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/actions/index.js +3 -6
- package/build/components/actions/index.js.map +1 -1
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js +1 -2
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
- package/build/components/add-new-template/add-custom-template-modal-content.js +1 -2
- package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +1 -2
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/inserter-media-categories.js +1 -2
- package/build/components/block-editor/inserter-media-categories.js.map +1 -1
- package/build/components/block-editor/resizable-editor.js +1 -2
- package/build/components/block-editor/resizable-editor.js.map +1 -1
- package/build/components/block-editor/site-editor-canvas.js +4 -3
- package/build/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build/components/block-editor/{use-post-link-props.js → use-navigate-to-entity-record.js} +9 -8
- package/build/components/block-editor/use-navigate-to-entity-record.js.map +1 -0
- package/build/components/block-editor/use-site-editor-settings.js +31 -5
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/editor/index.js +6 -3
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-canvas-container/index.js +1 -2
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/global-styles/block-preview-panel.js +1 -2
- package/build/components/global-styles/block-preview-panel.js.map +1 -1
- package/build/components/global-styles/color-indicator-wrapper.js +1 -2
- package/build/components/global-styles/color-indicator-wrapper.js.map +1 -1
- package/build/components/global-styles/font-families.js +9 -5
- package/build/components/global-styles/font-families.js.map +1 -1
- package/build/components/global-styles/font-family-item.js +1 -2
- package/build/components/global-styles/font-family-item.js.map +1 -1
- package/build/components/global-styles/font-library-modal/collection-font-details.js +1 -2
- package/build/components/global-styles/font-library-modal/collection-font-details.js.map +1 -1
- package/build/components/global-styles/font-library-modal/collection-font-variant.js +13 -13
- package/build/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
- package/build/components/global-styles/font-library-modal/confirm-delete-dialog.js +1 -2
- package/build/components/global-styles/font-library-modal/confirm-delete-dialog.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +2 -13
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-card.js +3 -3
- package/build/components/global-styles/font-library-modal/font-card.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +9 -7
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-demo.js +5 -11
- package/build/components/global-styles/font-library-modal/font-demo.js.map +1 -1
- package/build/components/global-styles/font-library-modal/fonts-grid.js +1 -2
- package/build/components/global-styles/font-library-modal/fonts-grid.js.map +1 -1
- package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +2 -3
- package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
- package/build/components/global-styles/font-library-modal/index.js +1 -2
- package/build/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +6 -5
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/library-font-card.js +2 -3
- package/build/components/global-styles/font-library-modal/library-font-card.js.map +1 -1
- package/build/components/global-styles/font-library-modal/library-font-details.js +1 -2
- package/build/components/global-styles/font-library-modal/library-font-details.js.map +1 -1
- package/build/components/global-styles/font-library-modal/library-font-variant.js +13 -13
- package/build/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
- package/build/components/global-styles/font-library-modal/tab-panel-layout.js +14 -4
- package/build/components/global-styles/font-library-modal/tab-panel-layout.js.map +1 -1
- package/build/components/global-styles/font-library-modal/upload-fonts.js +9 -8
- package/build/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/constants.js +3 -6
- package/build/components/global-styles/font-library-modal/utils/constants.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/index.js +4 -1
- package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build/components/global-styles/header.js +1 -2
- package/build/components/global-styles/header.js.map +1 -1
- package/build/components/global-styles/palette.js +1 -2
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/preview.js +1 -2
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/root-menu.js +1 -2
- package/build/components/global-styles/root-menu.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +1 -2
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-block.js +1 -11
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-color-palette.js +1 -2
- package/build/components/global-styles/screen-color-palette.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +1 -2
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-css.js +1 -2
- package/build/components/global-styles/screen-css.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +1 -2
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +1 -2
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +2 -3
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/screen-root.js +1 -2
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +1 -2
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/screen-typography-element.js +3 -6
- package/build/components/global-styles/screen-typography-element.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +1 -2
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/subtitle.js +1 -2
- package/build/components/global-styles/subtitle.js.map +1 -1
- package/build/components/global-styles/typogrphy-elements.js +1 -2
- package/build/components/global-styles/typogrphy-elements.js.map +1 -1
- package/build/components/global-styles/ui.js +3 -4
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/header-edit-mode/mode-switcher/index.js +1 -2
- package/build/components/header-edit-mode/mode-switcher/index.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/index.js +12 -21
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build/components/header-edit-mode/plugin-more-menu-item/index.js +1 -2
- package/build/components/header-edit-mode/plugin-more-menu-item/index.js.map +1 -1
- package/build/components/header-edit-mode/tools-more-menu-group/index.js +1 -2
- package/build/components/header-edit-mode/tools-more-menu-group/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +1 -2
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +1 -3
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/edit-mode.js +1 -2
- package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build/components/keyboard-shortcuts/global.js +1 -2
- package/build/components/keyboard-shortcuts/global.js.map +1 -1
- package/build/components/keyboard-shortcuts/register.js +1 -2
- package/build/components/keyboard-shortcuts/register.js.map +1 -1
- package/build/components/layout/index.js +0 -2
- package/build/components/layout/index.js.map +1 -1
- package/build/components/media/index.js +1 -2
- package/build/components/media/index.js.map +1 -1
- package/build/components/page-pages/index.js +27 -15
- package/build/components/page-pages/index.js.map +1 -1
- package/build/components/page-patterns/dataviews-pattern-actions.js +87 -32
- package/build/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
- package/build/components/page-patterns/grid-item.js +2 -6
- package/build/components/page-patterns/grid-item.js.map +1 -1
- package/build/components/page-patterns/index.js +2 -1
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/search-items.js +0 -1
- package/build/components/page-patterns/search-items.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +1 -2
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-templates-template-parts/actions.js +2 -4
- package/build/components/page-templates-template-parts/actions.js.map +1 -1
- package/build/components/page-templates-template-parts/index.js +8 -5
- package/build/components/page-templates-template-parts/index.js.map +1 -1
- package/build/components/pattern-modal/index.js +1 -2
- package/build/components/pattern-modal/index.js.map +1 -1
- package/build/components/plugin-template-setting-panel/index.js +1 -2
- package/build/components/plugin-template-setting-panel/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +1 -2
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/resizable-frame/index.js +1 -2
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/revisions/index.js +1 -2
- package/build/components/revisions/index.js.map +1 -1
- package/build/components/routes/link.js +2 -6
- package/build/components/routes/link.js.map +1 -1
- package/build/components/sidebar/index.js +3 -4
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +4 -6
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-edit-mode/constants.js +2 -4
- package/build/components/sidebar-edit-mode/constants.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +97 -18
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/settings-header/index.js +21 -43
- package/build/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js +1 -2
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/constants.js +1 -2
- package/build/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build/components/site-hub/index.js +1 -2
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/site-icon/index.js +3 -4
- package/build/components/site-icon/index.js.map +1 -1
- package/build/components/start-template-options/index.js +3 -5
- package/build/components/start-template-options/index.js.map +1 -1
- package/build/components/style-book/index.js +1 -2
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/template-part-converter/convert-to-template-part.js +0 -1
- package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build/hooks/navigation-menu-edit.js +1 -2
- package/build/hooks/navigation-menu-edit.js.map +1 -1
- package/build/hooks/template-part-edit.js +1 -2
- package/build/hooks/template-part-edit.js.map +1 -1
- package/build/store/actions.js +7 -2
- package/build/store/actions.js.map +1 -1
- package/build/store/constants.js +1 -2
- package/build/store/constants.js.map +1 -1
- package/build/store/index.js +4 -6
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +1 -2
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +9 -18
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +1 -2
- package/build/store/utils.js.map +1 -1
- package/build/utils/constants.js +13 -26
- package/build/utils/constants.js.map +1 -1
- package/build-module/components/block-editor/site-editor-canvas.js +5 -4
- package/build-module/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/{use-post-link-props.js → use-navigate-to-entity-record.js} +8 -7
- package/build-module/components/block-editor/use-navigate-to-entity-record.js.map +1 -0
- package/build-module/components/block-editor/use-site-editor-settings.js +30 -5
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/editor/index.js +6 -3
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/font-families.js +8 -4
- package/build-module/components/global-styles/font-families.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/collection-font-variant.js +12 -11
- package/build-module/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +0 -9
- package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-card.js +3 -2
- package/build-module/components/global-styles/font-library-modal/font-card.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js +9 -6
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-demo.js +4 -9
- package/build-module/components/global-styles/font-library-modal/font-demo.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +1 -1
- package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +5 -3
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/library-font-card.js +1 -1
- package/build-module/components/global-styles/font-library-modal/library-font-card.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/library-font-variant.js +12 -11
- package/build-module/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/tab-panel-layout.js +13 -2
- package/build-module/components/global-styles/font-library-modal/tab-panel-layout.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/upload-fonts.js +9 -7
- package/build-module/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/index.js +4 -1
- package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +0 -9
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/screen-typography-element.js +3 -5
- package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js +12 -21
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +0 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/layout/index.js +0 -2
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page-pages/index.js +25 -13
- package/build-module/components/page-pages/index.js.map +1 -1
- package/build-module/components/page-patterns/dataviews-pattern-actions.js +81 -20
- package/build-module/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
- package/build-module/components/page-patterns/grid-item.js +1 -4
- package/build-module/components/page-patterns/grid-item.js.map +1 -1
- package/build-module/components/page-patterns/index.js +2 -1
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/search-items.js +0 -1
- package/build-module/components/page-patterns/search-items.js.map +1 -1
- package/build-module/components/page-templates-template-parts/index.js +6 -3
- package/build-module/components/page-templates-template-parts/index.js.map +1 -1
- package/build-module/components/routes/link.js +2 -5
- package/build-module/components/routes/link.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +3 -3
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +98 -18
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/settings-header/index.js +23 -43
- package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +2 -2
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build-module/components/site-icon/index.js +2 -2
- package/build-module/components/site-icon/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +4 -6
- package/build-module/components/start-template-options/index.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +0 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build-module/store/actions.js +7 -2
- package/build-module/store/actions.js.map +1 -1
- package/build-style/style-rtl.css +389 -218
- package/build-style/style.css +389 -218
- package/package.json +42 -42
- package/src/components/add-new-template/style.scss +0 -12
- package/src/components/block-editor/site-editor-canvas.js +4 -3
- package/src/components/block-editor/style.scss +2 -20
- package/src/components/block-editor/use-navigate-to-entity-record.js +25 -0
- package/src/components/block-editor/use-site-editor-settings.js +38 -5
- package/src/components/editor/index.js +7 -1
- package/src/components/global-styles/font-families.js +13 -4
- package/src/components/global-styles/font-library-modal/collection-font-variant.js +10 -8
- package/src/components/global-styles/font-library-modal/context.js +0 -9
- package/src/components/global-styles/font-library-modal/font-card.js +10 -4
- package/src/components/global-styles/font-library-modal/font-collection.js +9 -7
- package/src/components/global-styles/font-library-modal/font-demo.js +8 -9
- package/src/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +1 -1
- package/src/components/global-styles/font-library-modal/installed-fonts.js +8 -3
- package/src/components/global-styles/font-library-modal/library-font-card.js +1 -1
- package/src/components/global-styles/font-library-modal/library-font-variant.js +10 -8
- package/src/components/global-styles/font-library-modal/style.scss +13 -17
- package/src/components/global-styles/font-library-modal/tab-panel-layout.js +11 -1
- package/src/components/global-styles/font-library-modal/upload-fonts.js +10 -13
- package/src/components/global-styles/font-library-modal/utils/index.js +2 -1
- package/src/components/global-styles/screen-block.js +0 -12
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/src/components/global-styles/screen-revisions/style.scss +21 -15
- package/src/components/global-styles/screen-typography-element.js +2 -4
- package/src/components/global-styles/style.scss +4 -0
- package/src/components/header-edit-mode/more-menu/index.js +10 -18
- package/src/components/header-edit-mode/style.scss +54 -6
- package/src/components/layout/style.scss +2 -7
- package/src/components/page/style.scss +0 -1
- package/src/components/page-pages/index.js +32 -23
- package/src/components/page-pages/style.scss +28 -27
- package/src/components/page-patterns/dataviews-pattern-actions.js +106 -30
- package/src/components/page-patterns/grid-item.js +0 -2
- package/src/components/page-patterns/index.js +1 -0
- package/src/components/page-patterns/style.scss +4 -9
- package/src/components/page-templates-template-parts/index.js +23 -16
- package/src/components/page-templates-template-parts/style.scss +16 -0
- package/src/components/routes/link.js +2 -11
- package/src/components/sidebar-dataviews/default-views.js +3 -3
- package/src/components/sidebar-edit-mode/index.js +121 -25
- package/src/components/sidebar-edit-mode/settings-header/index.js +25 -63
- package/src/components/sidebar-edit-mode/settings-header/style.scss +0 -87
- package/src/components/sidebar-edit-mode/sidebar-card/style.scss +3 -0
- package/src/components/sidebar-edit-mode/style.scss +4 -0
- package/src/components/sidebar-navigation-screen/style.scss +2 -1
- package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +9 -3
- package/src/components/site-hub/style.scss +0 -1
- package/src/components/site-icon/index.js +1 -1
- package/src/components/site-icon/style.scss +9 -1
- package/src/components/start-template-options/index.js +3 -7
- package/src/store/actions.js +20 -3
- package/build/components/block-editor/back-button.js +0 -46
- package/build/components/block-editor/back-button.js.map +0 -1
- package/build/components/block-editor/use-post-link-props.js.map +0 -1
- package/build/components/global-styles/font-library-modal/font-variant.js +0 -51
- package/build/components/global-styles/font-library-modal/font-variant.js.map +0 -1
- package/build-module/components/block-editor/back-button.js +0 -38
- package/build-module/components/block-editor/back-button.js.map +0 -1
- package/build-module/components/block-editor/use-post-link-props.js.map +0 -1
- package/build-module/components/global-styles/font-library-modal/font-variant.js +0 -42
- package/build-module/components/global-styles/font-library-modal/font-variant.js.map +0 -1
- package/src/components/block-editor/back-button.js +0 -51
- package/src/components/block-editor/use-post-link-props.js +0 -24
- package/src/components/global-styles/font-library-modal/font-variant.js +0 -53
package/build/store/index.js
CHANGED
|
@@ -13,8 +13,8 @@ var selectors = _interopRequireWildcard(require("./selectors"));
|
|
|
13
13
|
var privateSelectors = _interopRequireWildcard(require("./private-selectors"));
|
|
14
14
|
var _constants = require("./constants");
|
|
15
15
|
var _lockUnlock = require("../lock-unlock");
|
|
16
|
-
function _getRequireWildcardCache(
|
|
17
|
-
function _interopRequireWildcard(
|
|
16
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
17
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
18
|
/**
|
|
19
19
|
* WordPress dependencies
|
|
20
20
|
*/
|
|
@@ -23,14 +23,12 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
23
23
|
* Internal dependencies
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
const storeConfig = {
|
|
26
|
+
const storeConfig = exports.storeConfig = {
|
|
27
27
|
reducer: _reducer.default,
|
|
28
28
|
actions,
|
|
29
29
|
selectors
|
|
30
30
|
};
|
|
31
|
-
exports.
|
|
32
|
-
const store = (0, _data.createReduxStore)(_constants.STORE_NAME, storeConfig);
|
|
33
|
-
exports.store = store;
|
|
31
|
+
const store = exports.store = (0, _data.createReduxStore)(_constants.STORE_NAME, storeConfig);
|
|
34
32
|
(0, _data.register)(store);
|
|
35
33
|
(0, _lockUnlock.unlock)(store).registerPrivateSelectors(privateSelectors);
|
|
36
34
|
(0, _lockUnlock.unlock)(store).registerPrivateActions(privateActions);
|
package/build/store/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_reducer","_interopRequireDefault","actions","_interopRequireWildcard","privateActions","selectors","privateSelectors","_constants","_lockUnlock","_getRequireWildcardCache","
|
|
1
|
+
{"version":3,"names":["_data","require","_reducer","_interopRequireDefault","actions","_interopRequireWildcard","privateActions","selectors","privateSelectors","_constants","_lockUnlock","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","storeConfig","exports","reducer","store","createReduxStore","STORE_NAME","register","unlock","registerPrivateSelectors","registerPrivateActions"],"sources":["@wordpress/edit-site/src/store/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as actions from './actions';\nimport * as privateActions from './private-actions';\nimport * as selectors from './selectors';\nimport * as privateSelectors from './private-selectors';\nimport { STORE_NAME } from './constants';\nimport { unlock } from '../lock-unlock';\n\nexport const storeConfig = {\n\treducer,\n\tactions,\n\tselectors,\n};\n\nexport const store = createReduxStore( STORE_NAME, storeConfig );\nregister( store );\nunlock( store ).registerPrivateSelectors( privateSelectors );\nunlock( store ).registerPrivateActions( privateActions );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAC,uBAAA,CAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAD,uBAAA,CAAAJ,OAAA;AACA,IAAAM,SAAA,GAAAF,uBAAA,CAAAJ,OAAA;AACA,IAAAO,gBAAA,GAAAH,uBAAA,CAAAJ,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AAAwC,SAAAU,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAP,wBAAAO,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,KAAAA,CAAA,CAAAX,GAAA,IAAAW,CAAA,CAAAC,GAAA,IAAAR,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAI,CAAA,IAAAV,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAgB,GAAA,CAAAnB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAdxC;AACA;AACA;;AAGA;AACA;AACA;;AASO,MAAMY,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG;EAC1BE,OAAO,EAAPA,gBAAO;EACP9B,OAAO;EACPG;AACD,CAAC;AAEM,MAAM4B,KAAK,GAAAF,OAAA,CAAAE,KAAA,GAAG,IAAAC,sBAAgB,EAAEC,qBAAU,EAAEL,WAAY,CAAC;AAChE,IAAAM,cAAQ,EAAEH,KAAM,CAAC;AACjB,IAAAI,kBAAM,EAAEJ,KAAM,CAAC,CAACK,wBAAwB,CAAEhC,gBAAiB,CAAC;AAC5D,IAAA+B,kBAAM,EAAEJ,KAAM,CAAC,CAACM,sBAAsB,CAAEnC,cAAe,CAAC"}
|
package/build/store/reducer.js
CHANGED
|
@@ -102,12 +102,11 @@ function editorCanvasContainerView(state = undefined, action) {
|
|
|
102
102
|
}
|
|
103
103
|
return state;
|
|
104
104
|
}
|
|
105
|
-
var _default = (0, _data.combineReducers)({
|
|
105
|
+
var _default = exports.default = (0, _data.combineReducers)({
|
|
106
106
|
settings,
|
|
107
107
|
editedPost,
|
|
108
108
|
saveViewPanel,
|
|
109
109
|
canvasMode,
|
|
110
110
|
editorCanvasContainerView
|
|
111
111
|
});
|
|
112
|
-
exports.default = _default;
|
|
113
112
|
//# sourceMappingURL=reducer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","settings","state","action","type","editedPost","postType","id","context","saveViewPanel","isOpen","canvasMode","mode","editorCanvasContainerView","undefined","view","_default","
|
|
1
|
+
{"version":3,"names":["_data","require","settings","state","action","type","editedPost","postType","id","context","saveViewPanel","isOpen","canvasMode","mode","editorCanvasContainerView","undefined","view","_default","exports","default","combineReducers"],"sources":["@wordpress/edit-site/src/store/reducer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer returning the settings.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function settings( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'UPDATE_SETTINGS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t...action.settings,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer keeping track of the currently edited Post Type,\n * Post Id and the context provided to fill the content of the block editor.\n *\n * @param {Object} state Current edited post.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function editedPost( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_EDITED_POST':\n\t\t\treturn {\n\t\t\t\tpostType: action.postType,\n\t\t\t\tid: action.id,\n\t\t\t\tcontext: action.context,\n\t\t\t};\n\t\tcase 'SET_EDITED_POST_CONTEXT':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tcontext: action.context,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer to set the save view panel open or closed.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function saveViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_SAVE_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t\tcase 'SET_CANVAS_MODE':\n\t\t\treturn false;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer used to track the site editor canvas mode (edit or view).\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nfunction canvasMode( state = 'init', action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_CANVAS_MODE':\n\t\t\treturn action.mode;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer used to track the site editor canvas container view.\n * Default is `undefined`, denoting the default, visual block editor.\n * This could be, for example, `'style-book'` (the style book).\n *\n * @param {string|undefined} state Current state.\n * @param {Object} action Dispatched action.\n */\nfunction editorCanvasContainerView( state = undefined, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_EDITOR_CANVAS_CONTAINER_VIEW':\n\t\t\treturn action.view;\n\t}\n\n\treturn state;\n}\n\nexport default combineReducers( {\n\tsettings,\n\teditedPost,\n\tsaveViewPanel,\n\tcanvasMode,\n\teditorCanvasContainerView,\n} );\n"],"mappings":";;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,QAAQA,CAAEC,KAAK,GAAG,CAAC,CAAC,EAAEC,MAAM,EAAG;EAC9C,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,iBAAiB;MACrB,OAAO;QACN,GAAGF,KAAK;QACR,GAAGC,MAAM,CAACF;MACX,CAAC;EACH;EAEA,OAAOC,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,UAAUA,CAAEH,KAAK,GAAG,CAAC,CAAC,EAAEC,MAAM,EAAG;EAChD,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,iBAAiB;MACrB,OAAO;QACNE,QAAQ,EAAEH,MAAM,CAACG,QAAQ;QACzBC,EAAE,EAAEJ,MAAM,CAACI,EAAE;QACbC,OAAO,EAAEL,MAAM,CAACK;MACjB,CAAC;IACF,KAAK,yBAAyB;MAC7B,OAAO;QACN,GAAGN,KAAK;QACRM,OAAO,EAAEL,MAAM,CAACK;MACjB,CAAC;EACH;EAEA,OAAON,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASO,aAAaA,CAAEP,KAAK,GAAG,KAAK,EAAEC,MAAM,EAAG;EACtD,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,yBAAyB;MAC7B,OAAOD,MAAM,CAACO,MAAM;IACrB,KAAK,iBAAiB;MACrB,OAAO,KAAK;EACd;EACA,OAAOR,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAASS,UAAUA,CAAET,KAAK,GAAG,MAAM,EAAEC,MAAM,EAAG;EAC7C,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,iBAAiB;MACrB,OAAOD,MAAM,CAACS,IAAI;EACpB;EAEA,OAAOV,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASW,yBAAyBA,CAAEX,KAAK,GAAGY,SAAS,EAAEX,MAAM,EAAG;EAC/D,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,kCAAkC;MACtC,OAAOD,MAAM,CAACY,IAAI;EACpB;EAEA,OAAOb,KAAK;AACb;AAAC,IAAAc,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc,IAAAC,qBAAe,EAAE;EAC/BlB,QAAQ;EACRI,UAAU;EACVI,aAAa;EACbE,UAAU;EACVE;AACD,CAAE,CAAC"}
|
package/build/store/selectors.js
CHANGED
|
@@ -52,7 +52,7 @@ var _lockUnlock = require("../lock-unlock");
|
|
|
52
52
|
*
|
|
53
53
|
* @return {boolean} Is active.
|
|
54
54
|
*/
|
|
55
|
-
const isFeatureActive = (0, _data.createRegistrySelector)(select => (_, featureName) => {
|
|
55
|
+
const isFeatureActive = exports.isFeatureActive = (0, _data.createRegistrySelector)(select => (_, featureName) => {
|
|
56
56
|
(0, _deprecated.default)(`select( 'core/edit-site' ).isFeatureActive`, {
|
|
57
57
|
since: '6.0',
|
|
58
58
|
alternative: `select( 'core/preferences' ).get`
|
|
@@ -69,8 +69,7 @@ const isFeatureActive = (0, _data.createRegistrySelector)(select => (_, featureN
|
|
|
69
69
|
*
|
|
70
70
|
* @return {string} Device type.
|
|
71
71
|
*/
|
|
72
|
-
exports.
|
|
73
|
-
const __experimentalGetPreviewDeviceType = (0, _data.createRegistrySelector)(select => () => {
|
|
72
|
+
const __experimentalGetPreviewDeviceType = exports.__experimentalGetPreviewDeviceType = (0, _data.createRegistrySelector)(select => () => {
|
|
74
73
|
(0, _deprecated.default)(`select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`, {
|
|
75
74
|
since: '6.5',
|
|
76
75
|
version: '6.7',
|
|
@@ -86,8 +85,7 @@ const __experimentalGetPreviewDeviceType = (0, _data.createRegistrySelector)(sel
|
|
|
86
85
|
*
|
|
87
86
|
* @return {Object} Whether the current user can create media or not.
|
|
88
87
|
*/
|
|
89
|
-
exports.
|
|
90
|
-
const getCanUserCreateMedia = (0, _data.createRegistrySelector)(select => () => select(_coreData.store).canUser('create', 'media'));
|
|
88
|
+
const getCanUserCreateMedia = exports.getCanUserCreateMedia = (0, _data.createRegistrySelector)(select => () => select(_coreData.store).canUser('create', 'media'));
|
|
91
89
|
|
|
92
90
|
/**
|
|
93
91
|
* Returns any available Reusable blocks.
|
|
@@ -96,8 +94,7 @@ const getCanUserCreateMedia = (0, _data.createRegistrySelector)(select => () =>
|
|
|
96
94
|
*
|
|
97
95
|
* @return {Array} The available reusable blocks.
|
|
98
96
|
*/
|
|
99
|
-
exports.
|
|
100
|
-
const getReusableBlocks = (0, _data.createRegistrySelector)(select => () => {
|
|
97
|
+
const getReusableBlocks = exports.getReusableBlocks = (0, _data.createRegistrySelector)(select => () => {
|
|
101
98
|
(0, _deprecated.default)("select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )", {
|
|
102
99
|
since: '6.5',
|
|
103
100
|
version: '6.8'
|
|
@@ -115,7 +112,6 @@ const getReusableBlocks = (0, _data.createRegistrySelector)(select => () => {
|
|
|
115
112
|
*
|
|
116
113
|
* @return {Object} Settings.
|
|
117
114
|
*/
|
|
118
|
-
exports.getReusableBlocks = getReusableBlocks;
|
|
119
115
|
function getSettings(state) {
|
|
120
116
|
// It is important that we don't inject anything into these settings locally.
|
|
121
117
|
// The reason for this is that we have an effect in place that calls setSettings based on the previous value of getSettings.
|
|
@@ -190,7 +186,7 @@ function getPage(state) {
|
|
|
190
186
|
*
|
|
191
187
|
* @return {boolean} Whether the inserter is opened.
|
|
192
188
|
*/
|
|
193
|
-
const isInserterOpened = (0, _data.createRegistrySelector)(select => () => {
|
|
189
|
+
const isInserterOpened = exports.isInserterOpened = (0, _data.createRegistrySelector)(select => () => {
|
|
194
190
|
(0, _deprecated.default)(`select( 'core/edit-site' ).isInserterOpened`, {
|
|
195
191
|
since: '6.5',
|
|
196
192
|
alternative: `select( 'core/editor' ).isInserterOpened`
|
|
@@ -207,8 +203,7 @@ const isInserterOpened = (0, _data.createRegistrySelector)(select => () => {
|
|
|
207
203
|
*
|
|
208
204
|
* @return {Object} The root client ID, index to insert at and starting filter value.
|
|
209
205
|
*/
|
|
210
|
-
exports.
|
|
211
|
-
const __experimentalGetInsertionPoint = (0, _data.createRegistrySelector)(select => () => {
|
|
206
|
+
const __experimentalGetInsertionPoint = exports.__experimentalGetInsertionPoint = (0, _data.createRegistrySelector)(select => () => {
|
|
212
207
|
(0, _deprecated.default)(`select( 'core/edit-site' ).__experimentalGetInsertionPoint`, {
|
|
213
208
|
since: '6.5',
|
|
214
209
|
version: '6.7'
|
|
@@ -223,8 +218,7 @@ const __experimentalGetInsertionPoint = (0, _data.createRegistrySelector)(select
|
|
|
223
218
|
*
|
|
224
219
|
* @return {boolean} Whether the list view is opened.
|
|
225
220
|
*/
|
|
226
|
-
exports.
|
|
227
|
-
const isListViewOpened = (0, _data.createRegistrySelector)(select => () => {
|
|
221
|
+
const isListViewOpened = exports.isListViewOpened = (0, _data.createRegistrySelector)(select => () => {
|
|
228
222
|
(0, _deprecated.default)(`select( 'core/edit-site' ).isListViewOpened`, {
|
|
229
223
|
since: '6.5',
|
|
230
224
|
alternative: `select( 'core/editor' ).isListViewOpened`
|
|
@@ -239,7 +233,6 @@ const isListViewOpened = (0, _data.createRegistrySelector)(select => () => {
|
|
|
239
233
|
*
|
|
240
234
|
* @return {boolean} True if the save panel should be open; false if closed.
|
|
241
235
|
*/
|
|
242
|
-
exports.isListViewOpened = isListViewOpened;
|
|
243
236
|
function isSaveViewOpened(state) {
|
|
244
237
|
return state.saveViewPanel;
|
|
245
238
|
}
|
|
@@ -250,7 +243,7 @@ function isSaveViewOpened(state) {
|
|
|
250
243
|
* @param {Object} state Global application state.
|
|
251
244
|
* @return {Array} Template parts and their blocks in an array.
|
|
252
245
|
*/
|
|
253
|
-
const getCurrentTemplateTemplateParts = (0, _data.createRegistrySelector)(select => () => {
|
|
246
|
+
const getCurrentTemplateTemplateParts = exports.getCurrentTemplateTemplateParts = (0, _data.createRegistrySelector)(select => () => {
|
|
254
247
|
const templateParts = select(_coreData.store).getEntityRecords('postType', _constants.TEMPLATE_PART_POST_TYPE, {
|
|
255
248
|
per_page: -1
|
|
256
249
|
});
|
|
@@ -266,15 +259,13 @@ const getCurrentTemplateTemplateParts = (0, _data.createRegistrySelector)(select
|
|
|
266
259
|
*
|
|
267
260
|
* @return {string} Editing mode.
|
|
268
261
|
*/
|
|
269
|
-
exports.
|
|
270
|
-
const getEditorMode = (0, _data.createRegistrySelector)(select => () => {
|
|
262
|
+
const getEditorMode = exports.getEditorMode = (0, _data.createRegistrySelector)(select => () => {
|
|
271
263
|
return select(_preferences.store).get('core', 'editorMode');
|
|
272
264
|
});
|
|
273
265
|
|
|
274
266
|
/**
|
|
275
267
|
* @deprecated
|
|
276
268
|
*/
|
|
277
|
-
exports.getEditorMode = getEditorMode;
|
|
278
269
|
function getCurrentTemplateNavigationPanelSubMenu() {
|
|
279
270
|
(0, _deprecated.default)("dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu", {
|
|
280
271
|
since: '6.2',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_coreData","require","_data","_deprecated","_interopRequireDefault","_element","_preferences","_blockEditor","_editor","_utils","_constants","_lockUnlock","isFeatureActive","createRegistrySelector","select","_","featureName","deprecated","since","alternative","preferencesStore","get","exports","__experimentalGetPreviewDeviceType","version","editorStore","getDeviceType","getCanUserCreateMedia","coreDataStore","canUser","getReusableBlocks","isWeb","Platform","OS","getEntityRecords","per_page","getSettings","state","settings","getHomeTemplateId","getEditedPostType","editedPost","postType","getEditedPostId","id","getEditedPostContext","context","getPage","isInserterOpened","__experimentalGetInsertionPoint","unlock","getInsertionPoint","isListViewOpened","isSaveViewOpened","saveViewPanel","getCurrentTemplateTemplateParts","templateParts","TEMPLATE_PART_POST_TYPE","clientIds","blockEditorStore","getBlocksByName","blocks","getBlocksByClientId","getFilteredTemplatePartBlocks","getEditorMode","getCurrentTemplateNavigationPanelSubMenu","getNavigationPanelActiveMenu","isNavigationOpened","isPage","postId","hasPageContentFocus"],"sources":["@wordpress/edit-site/src/store/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { Platform } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { getFilteredTemplatePartBlocks } from './utils';\nimport { TEMPLATE_PART_POST_TYPE } from '../utils/constants';\nimport { unlock } from '../lock-unlock';\n\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @deprecated\n * @param {Object} state Global application state.\n * @param {string} featureName Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport const isFeatureActive = createRegistrySelector(\n\t( select ) => ( _, featureName ) => {\n\t\tdeprecated( `select( 'core/edit-site' ).isFeatureActive`, {\n\t\t\tsince: '6.0',\n\t\t\talternative: `select( 'core/preferences' ).get`,\n\t\t} );\n\n\t\treturn !! select( preferencesStore ).get(\n\t\t\t'core/edit-site',\n\t\t\tfeatureName\n\t\t);\n\t}\n);\n\n/**\n * Returns the current editing canvas device type.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport const __experimentalGetPreviewDeviceType = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t\talternative: `select( 'core/editor' ).getDeviceType`,\n\t\t\t}\n\t\t);\n\t\treturn select( editorStore ).getDeviceType();\n\t}\n);\n\n/**\n * Returns whether the current user can create media or not.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Whether the current user can create media or not.\n */\nexport const getCanUserCreateMedia = createRegistrySelector(\n\t( select ) => () => select( coreDataStore ).canUser( 'create', 'media' )\n);\n\n/**\n * Returns any available Reusable blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} The available reusable blocks.\n */\nexport const getReusableBlocks = createRegistrySelector( ( select ) => () => {\n\tdeprecated(\n\t\t\"select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )\",\n\t\t{\n\t\t\tsince: '6.5',\n\t\t\tversion: '6.8',\n\t\t}\n\t);\n\tconst isWeb = Platform.OS === 'web';\n\treturn isWeb\n\t\t? select( coreDataStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\tper_page: -1,\n\t\t } )\n\t\t: [];\n} );\n\n/**\n * Returns the site editor settings.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Settings.\n */\nexport function getSettings( state ) {\n\t// It is important that we don't inject anything into these settings locally.\n\t// The reason for this is that we have an effect in place that calls setSettings based on the previous value of getSettings.\n\t// If we add computed settings here, we'll be adding these computed settings to the state which is very unexpected.\n\treturn state.settings;\n}\n\n/**\n * @deprecated\n */\nexport function getHomeTemplateId() {\n\tdeprecated( \"select( 'core/edit-site' ).getHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Returns the current edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getEditedPostType( state ) {\n\treturn state.editedPost.postType;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getEditedPostId( state ) {\n\treturn state.editedPost.id;\n}\n\n/**\n * Returns the edited post's context object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getEditedPostContext( state ) {\n\treturn state.editedPost.context;\n}\n\n/**\n * Returns the current page object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\treturn { context: state.editedPost.context };\n}\n\n/**\n * Returns true if the inserter is opened.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport const isInserterOpened = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).isInserterOpened`, {\n\t\tsince: '6.5',\n\t\talternative: `select( 'core/editor' ).isInserterOpened`,\n\t} );\n\treturn select( editorStore ).isInserterOpened();\n} );\n\n/**\n * Get the insertion point for the inserter.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport const __experimentalGetInsertionPoint = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`select( 'core/edit-site' ).__experimentalGetInsertionPoint`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t}\n\t\t);\n\t\treturn unlock( select( editorStore ) ).getInsertionPoint();\n\t}\n);\n\n/**\n * Returns true if the list view is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the list view is opened.\n */\nexport const isListViewOpened = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).isListViewOpened`, {\n\t\tsince: '6.5',\n\t\talternative: `select( 'core/editor' ).isListViewOpened`,\n\t} );\n\treturn select( editorStore ).isListViewOpened();\n} );\n\n/**\n * Returns the current opened/closed state of the save panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the save panel should be open; false if closed.\n */\nexport function isSaveViewOpened( state ) {\n\treturn state.saveViewPanel;\n}\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @param {Object} state Global application state.\n * @return {Array} Template parts and their blocks in an array.\n */\nexport const getCurrentTemplateTemplateParts = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst templateParts = select( coreDataStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t{ per_page: -1 }\n\t\t);\n\n\t\tconst clientIds =\n\t\t\tselect( blockEditorStore ).getBlocksByName( 'core/template-part' );\n\t\tconst blocks =\n\t\t\tselect( blockEditorStore ).getBlocksByClientId( clientIds );\n\n\t\treturn getFilteredTemplatePartBlocks( blocks, templateParts );\n\t}\n);\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport const getEditorMode = createRegistrySelector( ( select ) => () => {\n\treturn select( preferencesStore ).get( 'core', 'editorMode' );\n} );\n\n/**\n * @deprecated\n */\nexport function getCurrentTemplateNavigationPanelSubMenu() {\n\tdeprecated(\n\t\t\"dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu\",\n\t\t{\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t}\n\t);\n}\n\n/**\n * @deprecated\n */\nexport function getNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * @deprecated\n */\nexport function isNavigationOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).isNavigationOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Whether or not the editor has a page loaded into it.\n *\n * @see setPage\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether or not the editor has a page loaded into it.\n */\nexport function isPage( state ) {\n\treturn !! state.editedPost.context?.postId;\n}\n\n/**\n * Whether or not the editor allows only page content to be edited.\n *\n * @deprecated\n *\n * @return {boolean} Whether or not focus is on editing page content.\n */\nexport function hasPageContentFocus() {\n\tdeprecated( `select( 'core/edit-site' ).hasPageContentFocus`, {\n\t\tsince: '6.5',\n\t} );\n\n\treturn false;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAKA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,UAAA,GAAAT,OAAA;AACA,IAAAU,WAAA,GAAAV,OAAA;AAhBA;AACA;AACA;;AASA;AACA;AACA;;AAKA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMW,eAAe,GAAG,IAAAC,4BAAsB,EAClDC,MAAM,IAAM,CA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
|
1
|
+
{"version":3,"names":["_coreData","require","_data","_deprecated","_interopRequireDefault","_element","_preferences","_blockEditor","_editor","_utils","_constants","_lockUnlock","isFeatureActive","exports","createRegistrySelector","select","_","featureName","deprecated","since","alternative","preferencesStore","get","__experimentalGetPreviewDeviceType","version","editorStore","getDeviceType","getCanUserCreateMedia","coreDataStore","canUser","getReusableBlocks","isWeb","Platform","OS","getEntityRecords","per_page","getSettings","state","settings","getHomeTemplateId","getEditedPostType","editedPost","postType","getEditedPostId","id","getEditedPostContext","context","getPage","isInserterOpened","__experimentalGetInsertionPoint","unlock","getInsertionPoint","isListViewOpened","isSaveViewOpened","saveViewPanel","getCurrentTemplateTemplateParts","templateParts","TEMPLATE_PART_POST_TYPE","clientIds","blockEditorStore","getBlocksByName","blocks","getBlocksByClientId","getFilteredTemplatePartBlocks","getEditorMode","getCurrentTemplateNavigationPanelSubMenu","getNavigationPanelActiveMenu","isNavigationOpened","isPage","postId","hasPageContentFocus"],"sources":["@wordpress/edit-site/src/store/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { Platform } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { getFilteredTemplatePartBlocks } from './utils';\nimport { TEMPLATE_PART_POST_TYPE } from '../utils/constants';\nimport { unlock } from '../lock-unlock';\n\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @deprecated\n * @param {Object} state Global application state.\n * @param {string} featureName Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport const isFeatureActive = createRegistrySelector(\n\t( select ) => ( _, featureName ) => {\n\t\tdeprecated( `select( 'core/edit-site' ).isFeatureActive`, {\n\t\t\tsince: '6.0',\n\t\t\talternative: `select( 'core/preferences' ).get`,\n\t\t} );\n\n\t\treturn !! select( preferencesStore ).get(\n\t\t\t'core/edit-site',\n\t\t\tfeatureName\n\t\t);\n\t}\n);\n\n/**\n * Returns the current editing canvas device type.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport const __experimentalGetPreviewDeviceType = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t\talternative: `select( 'core/editor' ).getDeviceType`,\n\t\t\t}\n\t\t);\n\t\treturn select( editorStore ).getDeviceType();\n\t}\n);\n\n/**\n * Returns whether the current user can create media or not.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Whether the current user can create media or not.\n */\nexport const getCanUserCreateMedia = createRegistrySelector(\n\t( select ) => () => select( coreDataStore ).canUser( 'create', 'media' )\n);\n\n/**\n * Returns any available Reusable blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} The available reusable blocks.\n */\nexport const getReusableBlocks = createRegistrySelector( ( select ) => () => {\n\tdeprecated(\n\t\t\"select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )\",\n\t\t{\n\t\t\tsince: '6.5',\n\t\t\tversion: '6.8',\n\t\t}\n\t);\n\tconst isWeb = Platform.OS === 'web';\n\treturn isWeb\n\t\t? select( coreDataStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\tper_page: -1,\n\t\t } )\n\t\t: [];\n} );\n\n/**\n * Returns the site editor settings.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Settings.\n */\nexport function getSettings( state ) {\n\t// It is important that we don't inject anything into these settings locally.\n\t// The reason for this is that we have an effect in place that calls setSettings based on the previous value of getSettings.\n\t// If we add computed settings here, we'll be adding these computed settings to the state which is very unexpected.\n\treturn state.settings;\n}\n\n/**\n * @deprecated\n */\nexport function getHomeTemplateId() {\n\tdeprecated( \"select( 'core/edit-site' ).getHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Returns the current edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getEditedPostType( state ) {\n\treturn state.editedPost.postType;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getEditedPostId( state ) {\n\treturn state.editedPost.id;\n}\n\n/**\n * Returns the edited post's context object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getEditedPostContext( state ) {\n\treturn state.editedPost.context;\n}\n\n/**\n * Returns the current page object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\treturn { context: state.editedPost.context };\n}\n\n/**\n * Returns true if the inserter is opened.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport const isInserterOpened = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).isInserterOpened`, {\n\t\tsince: '6.5',\n\t\talternative: `select( 'core/editor' ).isInserterOpened`,\n\t} );\n\treturn select( editorStore ).isInserterOpened();\n} );\n\n/**\n * Get the insertion point for the inserter.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport const __experimentalGetInsertionPoint = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`select( 'core/edit-site' ).__experimentalGetInsertionPoint`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t}\n\t\t);\n\t\treturn unlock( select( editorStore ) ).getInsertionPoint();\n\t}\n);\n\n/**\n * Returns true if the list view is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the list view is opened.\n */\nexport const isListViewOpened = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).isListViewOpened`, {\n\t\tsince: '6.5',\n\t\talternative: `select( 'core/editor' ).isListViewOpened`,\n\t} );\n\treturn select( editorStore ).isListViewOpened();\n} );\n\n/**\n * Returns the current opened/closed state of the save panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the save panel should be open; false if closed.\n */\nexport function isSaveViewOpened( state ) {\n\treturn state.saveViewPanel;\n}\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @param {Object} state Global application state.\n * @return {Array} Template parts and their blocks in an array.\n */\nexport const getCurrentTemplateTemplateParts = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst templateParts = select( coreDataStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t{ per_page: -1 }\n\t\t);\n\n\t\tconst clientIds =\n\t\t\tselect( blockEditorStore ).getBlocksByName( 'core/template-part' );\n\t\tconst blocks =\n\t\t\tselect( blockEditorStore ).getBlocksByClientId( clientIds );\n\n\t\treturn getFilteredTemplatePartBlocks( blocks, templateParts );\n\t}\n);\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport const getEditorMode = createRegistrySelector( ( select ) => () => {\n\treturn select( preferencesStore ).get( 'core', 'editorMode' );\n} );\n\n/**\n * @deprecated\n */\nexport function getCurrentTemplateNavigationPanelSubMenu() {\n\tdeprecated(\n\t\t\"dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu\",\n\t\t{\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t}\n\t);\n}\n\n/**\n * @deprecated\n */\nexport function getNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * @deprecated\n */\nexport function isNavigationOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).isNavigationOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Whether or not the editor has a page loaded into it.\n *\n * @see setPage\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether or not the editor has a page loaded into it.\n */\nexport function isPage( state ) {\n\treturn !! state.editedPost.context?.postId;\n}\n\n/**\n * Whether or not the editor allows only page content to be edited.\n *\n * @deprecated\n *\n * @return {boolean} Whether or not focus is on editing page content.\n */\nexport function hasPageContentFocus() {\n\tdeprecated( `select( 'core/edit-site' ).hasPageContentFocus`, {\n\t\tsince: '6.5',\n\t} );\n\n\treturn false;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAKA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,UAAA,GAAAT,OAAA;AACA,IAAAU,WAAA,GAAAV,OAAA;AAhBA;AACA;AACA;;AASA;AACA;AACA;;AAKA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMW,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG,IAAAE,4BAAsB,EAClDC,MAAM,IAAM,CAAEC,CAAC,EAAEC,WAAW,KAAM;EACnC,IAAAC,mBAAU,EAAG,4CAA2C,EAAE;IACzDC,KAAK,EAAE,KAAK;IACZC,WAAW,EAAG;EACf,CAAE,CAAC;EAEH,OAAO,CAAC,CAAEL,MAAM,CAAEM,kBAAiB,CAAC,CAACC,GAA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AiB,CAAC,CAACC,GAAG,CAAE,MAAM,EAAE,YAAa,CAAC;AAC9D,CAAE,CAAC;;AAEH;AACA;AACA;AACO,SAAS2C,wCAAwCA,CAAA,EAAG;EAC1D,IAAA/C,mBAAU,EACT,uEAAuE,EACvE;IACCC,KAAK,EAAE,KAAK;IACZK,OAAO,EAAE;EACV,CACD,CAAC;AACF;;AAEA;AACA;AACA;AACO,SAAS0C,4BAA4BA,CAAA,EAAG;EAC9C,IAAAhD,mBAAU,EAAE,2DAA2D,EAAE;IACxEC,KAAK,EAAE,KAAK;IACZK,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACO,SAAS2C,kBAAkBA,CAAA,EAAG;EACpC,IAAAjD,mBAAU,EAAE,iDAAiD,EAAE;IAC9DC,KAAK,EAAE,KAAK;IACZK,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS4C,MAAMA,CAAE/B,KAAK,EAAG;EAC/B,OAAO,CAAC,CAAEA,KAAK,CAACI,UAAU,CAACK,OAAO,EAAEuB,MAAM;AAC3C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,mBAAmBA,CAAA,EAAG;EACrC,IAAApD,mBAAU,EAAG,gDAA+C,EAAE;IAC7DC,KAAK,EAAE;EACR,CAAE,CAAC;EAEH,OAAO,KAAK;AACb"}
|
package/build/store/utils.js
CHANGED
|
@@ -67,6 +67,5 @@ function getFilteredTemplatePartBlocks(blocks = EMPTY_ARRAY, templateParts) {
|
|
|
67
67
|
}
|
|
68
68
|
return result;
|
|
69
69
|
}
|
|
70
|
-
const memoizedGetFilteredTemplatePartBlocks = (0, _memize.default)(getFilteredTemplatePartBlocks);
|
|
71
|
-
exports.getFilteredTemplatePartBlocks = memoizedGetFilteredTemplatePartBlocks;
|
|
70
|
+
const memoizedGetFilteredTemplatePartBlocks = exports.getFilteredTemplatePartBlocks = (0, _memize.default)(getFilteredTemplatePartBlocks);
|
|
72
71
|
//# sourceMappingURL=utils.js.map
|
package/build/store/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_memize","_interopRequireDefault","require","_blocks","EMPTY_ARRAY","getFilteredTemplatePartBlocks","blocks","templateParts","templatePartsById","reduce","newTemplateParts","part","id","result","stack","length","innerBlocks","block","shift","unshift","isTemplatePart","attributes","theme","slug","templatePartId","templatePart","push","memoizedGetFilteredTemplatePartBlocks","
|
|
1
|
+
{"version":3,"names":["_memize","_interopRequireDefault","require","_blocks","EMPTY_ARRAY","getFilteredTemplatePartBlocks","blocks","templateParts","templatePartsById","reduce","newTemplateParts","part","id","result","stack","length","innerBlocks","block","shift","unshift","isTemplatePart","attributes","theme","slug","templatePartId","templatePart","push","memoizedGetFilteredTemplatePartBlocks","exports","memoize"],"sources":["@wordpress/edit-site/src/store/utils.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport memoize from 'memize';\n\n/**\n * WordPress dependencies\n */\nimport { isTemplatePart } from '@wordpress/blocks';\n\nconst EMPTY_ARRAY = [];\n\n/**\n * Get a flattened and filtered list of template parts and the matching block for that template part.\n *\n * Takes a list of blocks defined within a template, and a list of template parts, and returns a\n * flattened list of template parts and the matching block for that template part.\n *\n * @param {Array} blocks Blocks to flatten.\n * @param {?Array} templateParts Available template parts.\n * @return {Array} An array of template parts and their blocks.\n */\nfunction getFilteredTemplatePartBlocks( blocks = EMPTY_ARRAY, templateParts ) {\n\tconst templatePartsById = templateParts\n\t\t? // Key template parts by their ID.\n\t\t templateParts.reduce(\n\t\t\t\t( newTemplateParts, part ) => ( {\n\t\t\t\t\t...newTemplateParts,\n\t\t\t\t\t[ part.id ]: part,\n\t\t\t\t} ),\n\t\t\t\t{}\n\t\t )\n\t\t: {};\n\n\tconst result = [];\n\n\t// Iterate over all blocks, recursing into inner blocks.\n\t// Output will be based on a depth-first traversal.\n\tconst stack = [ ...blocks ];\n\twhile ( stack.length ) {\n\t\tconst { innerBlocks, ...block } = stack.shift();\n\t\t// Place inner blocks at the beginning of the stack to preserve order.\n\t\tstack.unshift( ...innerBlocks );\n\n\t\tif ( isTemplatePart( block ) ) {\n\t\t\tconst {\n\t\t\t\tattributes: { theme, slug },\n\t\t\t} = block;\n\t\t\tconst templatePartId = `${ theme }//${ slug }`;\n\t\t\tconst templatePart = templatePartsById[ templatePartId ];\n\n\t\t\t// Only add to output if the found template part block is in the list of available template parts.\n\t\t\tif ( templatePart ) {\n\t\t\t\tresult.push( {\n\t\t\t\t\ttemplatePart,\n\t\t\t\t\tblock,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result;\n}\n\nconst memoizedGetFilteredTemplatePartBlocks = memoize(\n\tgetFilteredTemplatePartBlocks\n);\n\nexport { memoizedGetFilteredTemplatePartBlocks as getFilteredTemplatePartBlocks };\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,OAAA,GAAAD,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA,MAAME,WAAW,GAAG,EAAE;;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,6BAA6BA,CAAEC,MAAM,GAAGF,WAAW,EAAEG,aAAa,EAAG;EAC7E,MAAMC,iBAAiB,GAAGD,aAAa;EACpC;EACAA,aAAa,CAACE,MAAM,CACpB,CAAEC,gBAAgB,EAAEC,IAAI,MAAQ;IAC/B,GAAGD,gBAAgB;IACnB,CAAEC,IAAI,CAACC,EAAE,GAAID;EACd,CAAC,CAAE,EACH,CAAC,CACD,CAAC,GACD,CAAC,CAAC;EAEL,MAAME,MAAM,GAAG,EAAE;;EAEjB;EACA;EACA,MAAMC,KAAK,GAAG,CAAE,GAAGR,MAAM,CAAE;EAC3B,OAAQQ,KAAK,CAACC,MAAM,EAAG;IACtB,MAAM;MAAEC,WAAW;MAAE,GAAGC;IAAM,CAAC,GAAGH,KAAK,CAACI,KAAK,CAAC,CAAC;IAC/C;IACAJ,KAAK,CAACK,OAAO,CAAE,GAAGH,WAAY,CAAC;IAE/B,IAAK,IAAAI,sBAAc,EAAEH,KAAM,CAAC,EAAG;MAC9B,MAAM;QACLI,UAAU,EAAE;UAAEC,KAAK;UAAEC;QAAK;MAC3B,CAAC,GAAGN,KAAK;MACT,MAAMO,cAAc,GAAI,GAAGF,KAAO,KAAKC,IAAM,EAAC;MAC9C,MAAME,YAAY,GAAGjB,iBAAiB,CAAEgB,cAAc,CAAE;;MAExD;MACA,IAAKC,YAAY,EAAG;QACnBZ,MAAM,CAACa,IAAI,CAAE;UACZD,YAAY;UACZR;QACD,CAAE,CAAC;MACJ;IACD;EACD;EAEA,OAAOJ,MAAM;AACd;AAEA,MAAMc,qCAAqC,GAAAC,OAAA,CAAAvB,6BAAA,GAAG,IAAAwB,eAAO,EACpDxB,6BACD,CAAC"}
|
package/build/utils/constants.js
CHANGED
|
@@ -16,24 +16,19 @@ var _lockUnlock = require("../lock-unlock");
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
// Navigation
|
|
19
|
-
const NAVIGATION_POST_TYPE = 'wp_navigation';
|
|
19
|
+
const NAVIGATION_POST_TYPE = exports.NAVIGATION_POST_TYPE = 'wp_navigation';
|
|
20
20
|
|
|
21
21
|
// Templates.
|
|
22
|
-
exports.
|
|
23
|
-
const
|
|
24
|
-
exports.
|
|
25
|
-
const TEMPLATE_PART_POST_TYPE = 'wp_template_part';
|
|
26
|
-
exports.TEMPLATE_PART_POST_TYPE = TEMPLATE_PART_POST_TYPE;
|
|
27
|
-
const TEMPLATE_ORIGINS = {
|
|
22
|
+
const TEMPLATE_POST_TYPE = exports.TEMPLATE_POST_TYPE = 'wp_template';
|
|
23
|
+
const TEMPLATE_PART_POST_TYPE = exports.TEMPLATE_PART_POST_TYPE = 'wp_template_part';
|
|
24
|
+
const TEMPLATE_ORIGINS = exports.TEMPLATE_ORIGINS = {
|
|
28
25
|
custom: 'custom',
|
|
29
26
|
theme: 'theme',
|
|
30
27
|
plugin: 'plugin'
|
|
31
28
|
};
|
|
32
|
-
exports.
|
|
33
|
-
const TEMPLATE_PART_AREA_DEFAULT_CATEGORY = 'uncategorized';
|
|
29
|
+
const TEMPLATE_PART_AREA_DEFAULT_CATEGORY = exports.TEMPLATE_PART_AREA_DEFAULT_CATEGORY = 'uncategorized';
|
|
34
30
|
|
|
35
31
|
// Patterns.
|
|
36
|
-
exports.TEMPLATE_PART_AREA_DEFAULT_CATEGORY = TEMPLATE_PART_AREA_DEFAULT_CATEGORY;
|
|
37
32
|
const {
|
|
38
33
|
PATTERN_TYPES,
|
|
39
34
|
PATTERN_DEFAULT_CATEGORY,
|
|
@@ -48,9 +43,8 @@ exports.EXCLUDED_PATTERN_SOURCES = EXCLUDED_PATTERN_SOURCES;
|
|
|
48
43
|
exports.PATTERN_USER_CATEGORY = PATTERN_USER_CATEGORY;
|
|
49
44
|
exports.PATTERN_DEFAULT_CATEGORY = PATTERN_DEFAULT_CATEGORY;
|
|
50
45
|
exports.PATTERN_TYPES = PATTERN_TYPES;
|
|
51
|
-
const FOCUSABLE_ENTITIES = [TEMPLATE_PART_POST_TYPE, NAVIGATION_POST_TYPE, PATTERN_TYPES.user];
|
|
52
|
-
exports.
|
|
53
|
-
const POST_TYPE_LABELS = {
|
|
46
|
+
const FOCUSABLE_ENTITIES = exports.FOCUSABLE_ENTITIES = [TEMPLATE_PART_POST_TYPE, NAVIGATION_POST_TYPE, PATTERN_TYPES.user];
|
|
47
|
+
const POST_TYPE_LABELS = exports.POST_TYPE_LABELS = {
|
|
54
48
|
[TEMPLATE_POST_TYPE]: (0, _i18n.__)('Template'),
|
|
55
49
|
[TEMPLATE_PART_POST_TYPE]: (0, _i18n.__)('Template part'),
|
|
56
50
|
[PATTERN_TYPES.user]: (0, _i18n.__)('Pattern'),
|
|
@@ -58,17 +52,10 @@ const POST_TYPE_LABELS = {
|
|
|
58
52
|
};
|
|
59
53
|
|
|
60
54
|
// DataViews constants
|
|
61
|
-
exports.
|
|
62
|
-
const
|
|
63
|
-
exports.
|
|
64
|
-
const
|
|
65
|
-
exports.
|
|
66
|
-
const
|
|
67
|
-
exports.LAYOUT_LIST = LAYOUT_LIST;
|
|
68
|
-
const ENUMERATION_TYPE = 'enumeration';
|
|
69
|
-
exports.ENUMERATION_TYPE = ENUMERATION_TYPE;
|
|
70
|
-
const OPERATOR_IN = 'in';
|
|
71
|
-
exports.OPERATOR_IN = OPERATOR_IN;
|
|
72
|
-
const OPERATOR_NOT_IN = 'notIn';
|
|
73
|
-
exports.OPERATOR_NOT_IN = OPERATOR_NOT_IN;
|
|
55
|
+
const LAYOUT_GRID = exports.LAYOUT_GRID = 'grid';
|
|
56
|
+
const LAYOUT_TABLE = exports.LAYOUT_TABLE = 'table';
|
|
57
|
+
const LAYOUT_LIST = exports.LAYOUT_LIST = 'list';
|
|
58
|
+
const ENUMERATION_TYPE = exports.ENUMERATION_TYPE = 'enumeration';
|
|
59
|
+
const OPERATOR_IN = exports.OPERATOR_IN = 'in';
|
|
60
|
+
const OPERATOR_NOT_IN = exports.OPERATOR_NOT_IN = 'notIn';
|
|
74
61
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_patterns","_lockUnlock","NAVIGATION_POST_TYPE","exports","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","TEMPLATE_ORIGINS","custom","theme","plugin","TEMPLATE_PART_AREA_DEFAULT_CATEGORY","PATTERN_TYPES","PATTERN_DEFAULT_CATEGORY","PATTERN_USER_CATEGORY","EXCLUDED_PATTERN_SOURCES","PATTERN_SYNC_TYPES","unlock","patternPrivateApis","FOCUSABLE_ENTITIES","user","POST_TYPE_LABELS","__","LAYOUT_GRID","LAYOUT_TABLE","LAYOUT_LIST","ENUMERATION_TYPE","OPERATOR_IN","OPERATOR_NOT_IN"],"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_ORIGINS = {\n\tcustom: 'custom',\n\ttheme: 'theme',\n\tplugin: 'plugin',\n};\nexport const TEMPLATE_PART_AREA_DEFAULT_CATEGORY = 'uncategorized';\n\n// Patterns.\nexport const {\n\tPATTERN_TYPES,\n\tPATTERN_DEFAULT_CATEGORY,\n\tPATTERN_USER_CATEGORY,\n\tEXCLUDED_PATTERN_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\n// DataViews constants\nexport const LAYOUT_GRID = 'grid';\nexport const LAYOUT_TABLE = 'table';\nexport const LAYOUT_LIST = 'list';\nexport const ENUMERATION_TYPE = 'enumeration';\nexport const OPERATOR_IN = 'in';\nexport const OPERATOR_NOT_IN = 'notIn';\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,
|
|
1
|
+
{"version":3,"names":["_i18n","require","_patterns","_lockUnlock","NAVIGATION_POST_TYPE","exports","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","TEMPLATE_ORIGINS","custom","theme","plugin","TEMPLATE_PART_AREA_DEFAULT_CATEGORY","PATTERN_TYPES","PATTERN_DEFAULT_CATEGORY","PATTERN_USER_CATEGORY","EXCLUDED_PATTERN_SOURCES","PATTERN_SYNC_TYPES","unlock","patternPrivateApis","FOCUSABLE_ENTITIES","user","POST_TYPE_LABELS","__","LAYOUT_GRID","LAYOUT_TABLE","LAYOUT_LIST","ENUMERATION_TYPE","OPERATOR_IN","OPERATOR_NOT_IN"],"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_ORIGINS = {\n\tcustom: 'custom',\n\ttheme: 'theme',\n\tplugin: 'plugin',\n};\nexport const TEMPLATE_PART_AREA_DEFAULT_CATEGORY = 'uncategorized';\n\n// Patterns.\nexport const {\n\tPATTERN_TYPES,\n\tPATTERN_DEFAULT_CATEGORY,\n\tPATTERN_USER_CATEGORY,\n\tEXCLUDED_PATTERN_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\n// DataViews constants\nexport const LAYOUT_GRID = 'grid';\nexport const LAYOUT_TABLE = 'table';\nexport const LAYOUT_LIST = 'list';\nexport const ENUMERATION_TYPE = 'enumeration';\nexport const OPERATOR_IN = 'in';\nexport const OPERATOR_NOT_IN = 'notIn';\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,GAAAC,OAAA,CAAAD,oBAAA,GAAG,eAAe;;AAEnD;AACO,MAAME,kBAAkB,GAAAD,OAAA,CAAAC,kBAAA,GAAG,aAAa;AACxC,MAAMC,uBAAuB,GAAAF,OAAA,CAAAE,uBAAA,GAAG,kBAAkB;AAClD,MAAMC,gBAAgB,GAAAH,OAAA,CAAAG,gBAAA,GAAG;EAC/BC,MAAM,EAAE,QAAQ;EAChBC,KAAK,EAAE,OAAO;EACdC,MAAM,EAAE;AACT,CAAC;AACM,MAAMC,mCAAmC,GAAAP,OAAA,CAAAO,mCAAA,GAAG,eAAe;;AAElE;AACO,MAAM;EACZC,aAAa;EACbC,wBAAwB;EACxBC,qBAAqB;EACrBC,wBAAwB;EACxBC;AACD,CAAC,GAAG,IAAAC,kBAAM,EAAEC,qBAAmB,CAAC;;AAEhC;AAAAd,OAAA,CAAAY,kBAAA,GAAAA,kBAAA;AAAAZ,OAAA,CAAAW,wBAAA,GAAAA,wBAAA;AAAAX,OAAA,CAAAU,qBAAA,GAAAA,qBAAA;AAAAV,OAAA,CAAAS,wBAAA,GAAAA,wBAAA;AAAAT,OAAA,CAAAQ,aAAA,GAAAA,aAAA;AACO,MAAMO,kBAAkB,GAAAf,OAAA,CAAAe,kBAAA,GAAG,CACjCb,uBAAuB,EACvBH,oBAAoB,EACpBS,aAAa,CAACQ,IAAI,CAClB;AAEM,MAAMC,gBAAgB,GAAAjB,OAAA,CAAAiB,gBAAA,GAAG;EAC/B,CAAEhB,kBAAkB,GAAI,IAAAiB,QAAE,EAAE,UAAW,CAAC;EACxC,CAAEhB,uBAAuB,GAAI,IAAAgB,QAAE,EAAE,eAAgB,CAAC;EAClD,CAAEV,aAAa,CAACQ,IAAI,GAAI,IAAAE,QAAE,EAAE,SAAU,CAAC;EACvC,CAAEnB,oBAAoB,GAAI,IAAAmB,QAAE,EAAE,YAAa;AAC5C,CAAC;;AAED;AACO,MAAMC,WAAW,GAAAnB,OAAA,CAAAmB,WAAA,GAAG,MAAM;AAC1B,MAAMC,YAAY,GAAApB,OAAA,CAAAoB,YAAA,GAAG,OAAO;AAC5B,MAAMC,WAAW,GAAArB,OAAA,CAAAqB,WAAA,GAAG,MAAM;AAC1B,MAAMC,gBAAgB,GAAAtB,OAAA,CAAAsB,gBAAA,GAAG,aAAa;AACtC,MAAMC,WAAW,GAAAvB,OAAA,CAAAuB,WAAA,GAAG,IAAI;AACxB,MAAMC,eAAe,GAAAxB,OAAA,CAAAwB,eAAA,GAAG,OAAO"}
|
|
@@ -12,13 +12,12 @@ import { useViewportMatch, useResizeObserver } from '@wordpress/compose';
|
|
|
12
12
|
/**
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
15
|
-
import BackButton from './back-button';
|
|
16
15
|
import ResizableEditor from './resizable-editor';
|
|
17
16
|
import EditorCanvas from './editor-canvas';
|
|
18
17
|
import EditorCanvasContainer from '../editor-canvas-container';
|
|
19
18
|
import useSiteEditorSettings from './use-site-editor-settings';
|
|
20
19
|
import { store as editSiteStore } from '../../store';
|
|
21
|
-
import { FOCUSABLE_ENTITIES, NAVIGATION_POST_TYPE } from '../../utils/constants';
|
|
20
|
+
import { FOCUSABLE_ENTITIES, NAVIGATION_POST_TYPE, TEMPLATE_POST_TYPE } from '../../utils/constants';
|
|
22
21
|
import { unlock } from '../../lock-unlock';
|
|
23
22
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
24
23
|
const {
|
|
@@ -48,7 +47,9 @@ export default function SiteEditorCanvas() {
|
|
|
48
47
|
const isMobileViewport = useViewportMatch('small', '<');
|
|
49
48
|
const enableResizing = isFocusMode && !isViewMode &&
|
|
50
49
|
// Disable resizing in mobile viewport.
|
|
51
|
-
!isMobileViewport
|
|
50
|
+
!isMobileViewport &&
|
|
51
|
+
// Disable resizing when editing a template in focus mode.
|
|
52
|
+
templateType !== TEMPLATE_POST_TYPE;
|
|
52
53
|
const isTemplateTypeNavigation = templateType === NAVIGATION_POST_TYPE;
|
|
53
54
|
const isNavigationFocusMode = isTemplateTypeNavigation && isFocusMode;
|
|
54
55
|
const forceFullHeight = isNavigationFocusMode;
|
|
@@ -59,7 +60,7 @@ export default function SiteEditorCanvas() {
|
|
|
59
60
|
'is-focus-mode': isFocusMode || !!editorCanvasView,
|
|
60
61
|
'is-view-mode': isViewMode
|
|
61
62
|
})
|
|
62
|
-
}, createElement(
|
|
63
|
+
}, createElement(ResizableEditor, {
|
|
63
64
|
enableResizing: enableResizing,
|
|
64
65
|
height: sizes.height && !forceFullHeight ? sizes.height : '100%'
|
|
65
66
|
}, createElement(EditorCanvas, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","useSelect","useViewportMatch","useResizeObserver","
|
|
1
|
+
{"version":3,"names":["classnames","useSelect","useViewportMatch","useResizeObserver","ResizableEditor","EditorCanvas","EditorCanvasContainer","useSiteEditorSettings","store","editSiteStore","FOCUSABLE_ENTITIES","NAVIGATION_POST_TYPE","TEMPLATE_POST_TYPE","unlock","privateApis","routerPrivateApis","useLocation","SiteEditorCanvas","location","templateType","isFocusableEntity","isViewMode","select","getEditedPostType","getCanvasMode","_templateType","includes","isFocusMode","params","focusMode","resizeObserver","sizes","settings","isMobileViewport","enableResizing","isTemplateTypeNavigation","isNavigationFocusMode","forceFullHeight","createElement","Slot","editorCanvasView","className","height"],"sources":["@wordpress/edit-site/src/components/block-editor/site-editor-canvas.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useViewportMatch, useResizeObserver } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport ResizableEditor from './resizable-editor';\nimport EditorCanvas from './editor-canvas';\nimport EditorCanvasContainer from '../editor-canvas-container';\nimport useSiteEditorSettings from './use-site-editor-settings';\nimport { store as editSiteStore } from '../../store';\nimport {\n\tFOCUSABLE_ENTITIES,\n\tNAVIGATION_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n} from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nexport default function SiteEditorCanvas() {\n\tconst location = useLocation();\n\tconst { templateType, isFocusableEntity, isViewMode } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostType, getCanvasMode } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\n\t\t\tconst _templateType = getEditedPostType();\n\n\t\t\treturn {\n\t\t\t\ttemplateType: _templateType,\n\t\t\t\tisFocusableEntity: FOCUSABLE_ENTITIES.includes( _templateType ),\n\t\t\t\tisViewMode: getCanvasMode() === 'view',\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst isFocusMode = location.params.focusMode || isFocusableEntity;\n\tconst [ resizeObserver, sizes ] = useResizeObserver();\n\n\tconst settings = useSiteEditorSettings();\n\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst enableResizing =\n\t\tisFocusMode &&\n\t\t! isViewMode &&\n\t\t// Disable resizing in mobile viewport.\n\t\t! isMobileViewport &&\n\t\t// Disable resizing when editing a template in focus mode.\n\t\ttemplateType !== TEMPLATE_POST_TYPE;\n\n\tconst isTemplateTypeNavigation = templateType === NAVIGATION_POST_TYPE;\n\tconst isNavigationFocusMode = isTemplateTypeNavigation && isFocusMode;\n\tconst forceFullHeight = isNavigationFocusMode;\n\n\treturn (\n\t\t<EditorCanvasContainer.Slot>\n\t\t\t{ ( [ editorCanvasView ] ) =>\n\t\t\t\teditorCanvasView ? (\n\t\t\t\t\t<div className=\"edit-site-visual-editor is-focus-mode\">\n\t\t\t\t\t\t{ editorCanvasView }\n\t\t\t\t\t</div>\n\t\t\t\t) : (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ classnames( 'edit-site-visual-editor', {\n\t\t\t\t\t\t\t'is-focus-mode': isFocusMode || !! editorCanvasView,\n\t\t\t\t\t\t\t'is-view-mode': isViewMode,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ResizableEditor\n\t\t\t\t\t\t\tenableResizing={ enableResizing }\n\t\t\t\t\t\t\theight={\n\t\t\t\t\t\t\t\tsizes.height && ! forceFullHeight\n\t\t\t\t\t\t\t\t\t? sizes.height\n\t\t\t\t\t\t\t\t\t: '100%'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<EditorCanvas\n\t\t\t\t\t\t\t\tenableResizing={ enableResizing }\n\t\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ resizeObserver }\n\t\t\t\t\t\t\t</EditorCanvas>\n\t\t\t\t\t\t</ResizableEditor>\n\t\t\t\t\t</div>\n\t\t\t\t)\n\t\t\t}\n\t\t</EditorCanvasContainer.Slot>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;AACnC;AACA;AACA;AACA,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,oBAAoB;;AAExE;AACA;AACA;AACA,OAAOC,eAAe,MAAM,oBAAoB;AAChD,OAAOC,YAAY,MAAM,iBAAiB;AAC1C,OAAOC,qBAAqB,MA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wB,GAAGhB,YAAY,KAAKR,oBAAoB;EACtE,MAAMyB,qBAAqB,GAAGD,wBAAwB,IAAIR,WAAW;EACrE,MAAMU,eAAe,GAAGD,qBAAqB;EAE7C,OACCE,aAAA,CAAChC,qBAAqB,CAACiC,IAAI,QACxB,CAAE,CAAEC,gBAAgB,CAAE,KACvBA,gBAAgB,GACfF,aAAA;IAAKG,SAAS,EAAC;EAAuC,GACnDD,gBACE,CAAC,GAENF,aAAA;IACCG,SAAS,EAAGzC,UAAU,CAAE,yBAAyB,EAAE;MAClD,eAAe,EAAE2B,WAAW,IAAI,CAAC,CAAEa,gBAAgB;MACnD,cAAc,EAAEnB;IACjB,CAAE;EAAG,GAELiB,aAAA,CAAClC,eAAe;IACf8B,cAAc,EAAGA,cAAgB;IACjCQ,MAAM,EACLX,KAAK,CAACW,MAAM,IAAI,CAAEL,eAAe,GAC9BN,KAAK,CAACW,MAAM,GACZ;EACH,GAEDJ,aAAA,CAACjC,YAAY;IACZ6B,cAAc,EAAGA,cAAgB;IACjCF,QAAQ,EAAGA;EAAU,GAEnBF,cACW,CACE,CACb,CAGoB,CAAC;AAE/B"}
|
|
@@ -2,23 +2,24 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
5
|
+
import { useCallback } from '@wordpress/element';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Internal dependencies
|
|
8
9
|
*/
|
|
9
10
|
import { unlock } from '../../lock-unlock';
|
|
10
|
-
import { getPostLinkProps } from '../routes/link';
|
|
11
11
|
const {
|
|
12
12
|
useHistory
|
|
13
13
|
} = unlock(routerPrivateApis);
|
|
14
|
-
export function
|
|
14
|
+
export default function useNavigateToEntityRecord() {
|
|
15
15
|
const history = useHistory();
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const onNavigateToEntityRecord = useCallback(params => {
|
|
17
|
+
history.push({
|
|
18
18
|
...params,
|
|
19
19
|
focusMode: true,
|
|
20
20
|
canvas: 'edit'
|
|
21
|
-
}
|
|
22
|
-
};
|
|
21
|
+
});
|
|
22
|
+
}, [history]);
|
|
23
|
+
return onNavigateToEntityRecord;
|
|
23
24
|
}
|
|
24
|
-
//# sourceMappingURL=use-
|
|
25
|
+
//# sourceMappingURL=use-navigate-to-entity-record.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["privateApis","routerPrivateApis","useCallback","unlock","useHistory","useNavigateToEntityRecord","history","onNavigateToEntityRecord","params","push","focusMode","canvas"],"sources":["@wordpress/edit-site/src/components/block-editor/use-navigate-to-entity-record.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nexport default function useNavigateToEntityRecord() {\n\tconst history = useHistory();\n\n\tconst onNavigateToEntityRecord = useCallback(\n\t\t( params ) => {\n\t\t\thistory.push( { ...params, focusMode: true, canvas: 'edit' } );\n\t\t},\n\t\t[ history ]\n\t);\n\n\treturn onNavigateToEntityRecord;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,WAAW,QAAQ,oBAAoB;;AAEhD;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC;AAAW,CAAC,GAAGD,MAAM,CAAEF,iBAAkB,CAAC;AAElD,eAAe,SAASI,yBAAyBA,CAAA,EAAG;EACnD,MAAMC,OAAO,GAAGF,UAAU,CAAC,CAAC;EAE5B,MAAMG,wBAAwB,GAAGL,WAAW,CACzCM,MAAM,IAAM;IACbF,OAAO,CAACG,IAAI,CAAE;MAAE,GAAGD,MAAM;MAAEE,SAAS,EAAE,IAAI;MAAEC,MAAM,EAAE;IAAO,CAAE,CAAC;EAC/D,CAAC,EACD,CAAEL,OAAO,CACV,CAAC;EAED,OAAOC,wBAAwB;AAChC"}
|
|
@@ -5,16 +5,23 @@ import { useSelect } from '@wordpress/data';
|
|
|
5
5
|
import { useMemo } from '@wordpress/element';
|
|
6
6
|
import { store as coreStore } from '@wordpress/core-data';
|
|
7
7
|
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
8
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
9
|
+
import { usePrevious } from '@wordpress/compose';
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* Internal dependencies
|
|
11
13
|
*/
|
|
12
14
|
import { store as editSiteStore } from '../../store';
|
|
13
15
|
import { unlock } from '../../lock-unlock';
|
|
14
|
-
import
|
|
16
|
+
import useNavigateToEntityRecord from './use-navigate-to-entity-record';
|
|
17
|
+
import { FOCUSABLE_ENTITIES } from '../../utils/constants';
|
|
15
18
|
const {
|
|
16
19
|
useBlockEditorSettings
|
|
17
20
|
} = unlock(editorPrivateApis);
|
|
21
|
+
const {
|
|
22
|
+
useLocation,
|
|
23
|
+
useHistory
|
|
24
|
+
} = unlock(routerPrivateApis);
|
|
18
25
|
function useArchiveLabel(templateSlug) {
|
|
19
26
|
const taxonomyMatches = templateSlug?.match(/^(category|tag|taxonomy-([^-]+))$|^(((category|tag)|taxonomy-([^-]+))-(.+))$/);
|
|
20
27
|
let taxonomy;
|
|
@@ -81,8 +88,24 @@ function useArchiveLabel(templateSlug) {
|
|
|
81
88
|
};
|
|
82
89
|
}, [authorSlug, isAuthor, taxonomy, term]);
|
|
83
90
|
}
|
|
91
|
+
function useNavigateToPreviousEntityRecord() {
|
|
92
|
+
const location = useLocation();
|
|
93
|
+
const previousLocation = usePrevious(location);
|
|
94
|
+
const history = useHistory();
|
|
95
|
+
const goBack = useMemo(() => {
|
|
96
|
+
const isFocusMode = location.params.focusMode || location.params.postId && FOCUSABLE_ENTITIES.includes(location.params.postType);
|
|
97
|
+
const didComeFromEditorCanvas = previousLocation?.params.postId && previousLocation?.params.postType && previousLocation?.params.canvas === 'edit';
|
|
98
|
+
const showBackButton = isFocusMode && didComeFromEditorCanvas;
|
|
99
|
+
return showBackButton ? () => history.back() : undefined;
|
|
100
|
+
// Disable reason: previousLocation changes when the component updates for any reason, not
|
|
101
|
+
// just when location changes. Until this is fixed we can't add it to deps. See
|
|
102
|
+
// https://github.com/WordPress/gutenberg/pull/58710#discussion_r1479219465.
|
|
103
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
104
|
+
}, [location, history]);
|
|
105
|
+
return goBack;
|
|
106
|
+
}
|
|
84
107
|
export function useSpecificEditorSettings() {
|
|
85
|
-
const
|
|
108
|
+
const onNavigateToEntityRecord = useNavigateToEntityRecord();
|
|
86
109
|
const {
|
|
87
110
|
templateSlug,
|
|
88
111
|
canvasMode,
|
|
@@ -111,7 +134,8 @@ export function useSpecificEditorSettings() {
|
|
|
111
134
|
};
|
|
112
135
|
}, []);
|
|
113
136
|
const archiveLabels = useArchiveLabel(templateSlug);
|
|
114
|
-
const defaultRenderingMode = postWithTemplate ? 'template-locked' : '
|
|
137
|
+
const defaultRenderingMode = postWithTemplate ? 'template-locked' : 'post-only';
|
|
138
|
+
const onNavigateToPreviousEntityRecord = useNavigateToPreviousEntityRecord();
|
|
115
139
|
const defaultEditorSettings = useMemo(() => {
|
|
116
140
|
return {
|
|
117
141
|
...settings,
|
|
@@ -119,12 +143,13 @@ export function useSpecificEditorSettings() {
|
|
|
119
143
|
supportsTemplateMode: true,
|
|
120
144
|
focusMode: canvasMode !== 'view',
|
|
121
145
|
defaultRenderingMode,
|
|
122
|
-
|
|
146
|
+
onNavigateToEntityRecord,
|
|
147
|
+
onNavigateToPreviousEntityRecord,
|
|
123
148
|
// I wonder if they should be set in the post editor too
|
|
124
149
|
__experimentalArchiveTitleTypeLabel: archiveLabels.archiveTypeLabel,
|
|
125
150
|
__experimentalArchiveTitleNameLabel: archiveLabels.archiveNameLabel
|
|
126
151
|
};
|
|
127
|
-
}, [settings, canvasMode, defaultRenderingMode,
|
|
152
|
+
}, [settings, canvasMode, defaultRenderingMode, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord, archiveLabels.archiveTypeLabel, archiveLabels.archiveNameLabel]);
|
|
128
153
|
return defaultEditorSettings;
|
|
129
154
|
}
|
|
130
155
|
export default function useSiteEditorSettings() {
|