@wordpress/edit-site 5.27.2 → 5.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/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 +30 -4
- 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 -4
- 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 +4 -3
- 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 +3 -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/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 +29 -4
- 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/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 +3 -1
- 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 +3 -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/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 +394 -218
- package/build-style/style.css +394 -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 +35 -4
- 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/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 +2 -0
- package/src/components/global-styles/font-library-modal/upload-fonts.js +4 -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/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/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,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,GAAG,CACvC,gBAAgB,EAChBL,WACD,CAAC;AACF,CACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARAM,OAAA,CAAAV,eAAA,GAAAA,eAAA;AASO,MAAMW,kCAAkC,GAAG,IAAAV,4BAAsB,EACrEC,MAAM,IAAM,MAAM;EACnB,IAAAG,mBAAU,EACR,+DAA8D,EAC/D;IACCC,KAAK,EAAE,KAAK;IACZM,OAAO,EAAE,KAAK;IACdL,WAAW,EAAG;EACf,CACD,CAAC;EACD,OAAOL,MAAM,CAAEW,aAAY,CAAC,CAACC,aAAa,CAAC,CAAC;AA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A;AACA;AACO,SAAS0C,4BAA4BA,CAAA,EAAG;EAC9C,IAAAjD,mBAAU,EAAE,2DAA2D,EAAE;IACxEC,KAAK,EAAE,KAAK;IACZM,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACO,SAAS2C,kBAAkBA,CAAA,EAAG;EACpC,IAAAlD,mBAAU,EAAE,iDAAiD,EAAE;IAC9DC,KAAK,EAAE,KAAK;IACZM,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,IAAArD,mBAAU,EAAG,gDAA+C,EAAE;IAC7DC,KAAK,EAAE;EACR,CAAE,CAAC;EAEH,OAAO,KAAK;AACb"}
|
|
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,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;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,G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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,u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A,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,MAAM,4BAA4B;AAC9D,OAAOC,qBAAqB,MAAM,4BAA4B;AAC9D,SAASC,KAAK,IAAIC,aAAa,QAAQ,aAAa;AACpD,SACCC,kBAAkB,EAClBC,oBAAoB,EACpBC,kBAAkB,QACZ,uBAAuB;AAC9B,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AAEpE,MAAM;EAAEC;AAAY,CAAC,GAAGH,MAAM,CAAEE,iBAAkB,CAAC;AAEnD,eAAe,SAASE,gBAAgBA,CAAA,EAAG;EAC1C,MAAMC,QAAQ,GAAGF,WAAW,CAAC,CAAC;EAC9B,MAAM;IAAEG,YAAY;IAAEC,iBAAiB;IAAEC;EAAW,CAAC,GAAGpB,SAAS,CAC9DqB,MAAM,IAAM;IACb,MAAM;MAAEC,iBAAiB;MAAEC;IAAc,CAAC,GAAGX,MAAM,CAClDS,MAAM,CAAEb,aA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J,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,
|
|
@@ -112,6 +135,7 @@ export function useSpecificEditorSettings() {
|
|
|
112
135
|
}, []);
|
|
113
136
|
const archiveLabels = useArchiveLabel(templateSlug);
|
|
114
137
|
const defaultRenderingMode = postWithTemplate ? 'template-locked' : 'all';
|
|
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() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","useMemo","store","coreStore","privateApis","editorPrivateApis","editSiteStore","unlock","usePostLinkProps","useBlockEditorSettings","useArchiveLabel","templateSlug","taxonomyMatches","match","taxonomy","term","isAuthor","authorSlug","authorMatches","select","getEntityRecords","getTaxonomy","getAuthors","archiveTypeLabel","archiveNameLabel","labels","singular_name","records","slug","per_page","name","authorRecords","useSpecificEditorSettings","getPostLinkProps","canvasMode","settings","postWithTemplate","getEditedPostType","getEditedPostId","getEditedPostContext","getCanvasMode","getSettings","getEditedEntityRecord","usedPostType","usedPostId","_record","_context","postId","archiveLabels","defaultRenderingMode","defaultEditorSettings","richEditingEnabled","supportsTemplateMode","focusMode","__experimentalArchiveTitleTypeLabel","__experimentalArchiveTitleNameLabel","useSiteEditorSettings","postType"],"sources":["@wordpress/edit-site/src/components/block-editor/use-site-editor-settings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { usePostLinkProps } from './use-post-link-props';\n\nconst { useBlockEditorSettings } = unlock( editorPrivateApis );\n\nfunction useArchiveLabel( templateSlug ) {\n\tconst taxonomyMatches = templateSlug?.match(\n\t\t/^(category|tag|taxonomy-([^-]+))$|^(((category|tag)|taxonomy-([^-]+))-(.+))$/\n\t);\n\tlet taxonomy;\n\tlet term;\n\tlet isAuthor = false;\n\tlet authorSlug;\n\tif ( taxonomyMatches ) {\n\t\t// If is for a all taxonomies of a type\n\t\tif ( taxonomyMatches[ 1 ] ) {\n\t\t\ttaxonomy = taxonomyMatches[ 2 ]\n\t\t\t\t? taxonomyMatches[ 2 ]\n\t\t\t\t: taxonomyMatches[ 1 ];\n\t\t}\n\t\t// If is for a all taxonomies of a type\n\t\telse if ( taxonomyMatches[ 3 ] ) {\n\t\t\ttaxonomy = taxonomyMatches[ 6 ]\n\t\t\t\t? taxonomyMatches[ 6 ]\n\t\t\t\t: taxonomyMatches[ 4 ];\n\t\t\tterm = taxonomyMatches[ 7 ];\n\t\t}\n\t\ttaxonomy = taxonomy === 'tag' ? 'post_tag' : taxonomy;\n\n\t\t//getTaxonomy( 'category' );\n\t\t//wp.data.select('core').getEntityRecords( 'taxonomy', 'category', {slug: 'newcat'} );\n\t} else {\n\t\tconst authorMatches = templateSlug?.match( /^(author)$|^author-(.+)$/ );\n\t\tif ( authorMatches ) {\n\t\t\tisAuthor = true;\n\t\t\tif ( authorMatches[ 2 ] ) {\n\t\t\t\tauthorSlug = authorMatches[ 2 ];\n\t\t\t}\n\t\t}\n\t}\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, getTaxonomy, getAuthors } =\n\t\t\t\tselect( coreStore );\n\t\t\tlet archiveTypeLabel;\n\t\t\tlet archiveNameLabel;\n\t\t\tif ( taxonomy ) {\n\t\t\t\tarchiveTypeLabel =\n\t\t\t\t\tgetTaxonomy( taxonomy )?.labels?.singular_name;\n\t\t\t}\n\t\t\tif ( term ) {\n\t\t\t\tconst records = getEntityRecords( 'taxonomy', taxonomy, {\n\t\t\t\t\tslug: term,\n\t\t\t\t\tper_page: 1,\n\t\t\t\t} );\n\t\t\t\tif ( records && records[ 0 ] ) {\n\t\t\t\t\tarchiveNameLabel = records[ 0 ].name;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( isAuthor ) {\n\t\t\t\tarchiveTypeLabel = 'Author';\n\t\t\t\tif ( authorSlug ) {\n\t\t\t\t\tconst authorRecords = getAuthors( { slug: authorSlug } );\n\t\t\t\t\tif ( authorRecords && authorRecords[ 0 ] ) {\n\t\t\t\t\t\tarchiveNameLabel = authorRecords[ 0 ].name;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tarchiveTypeLabel,\n\t\t\t\tarchiveNameLabel,\n\t\t\t};\n\t\t},\n\t\t[ authorSlug, isAuthor, taxonomy, term ]\n\t);\n}\n\nexport function useSpecificEditorSettings() {\n\tconst getPostLinkProps = usePostLinkProps();\n\tconst { templateSlug, canvasMode, settings, postWithTemplate } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedPostType,\n\t\t\t\tgetEditedPostId,\n\t\t\t\tgetEditedPostContext,\n\t\t\t\tgetCanvasMode,\n\t\t\t\tgetSettings,\n\t\t\t} = unlock( select( editSiteStore ) );\n\t\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\t\tconst usedPostType = getEditedPostType();\n\t\t\tconst usedPostId = 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 _context = getEditedPostContext();\n\t\t\treturn {\n\t\t\t\ttemplateSlug: _record.slug,\n\t\t\t\tcanvasMode: getCanvasMode(),\n\t\t\t\tsettings: getSettings(),\n\t\t\t\tpostWithTemplate: _context?.postId,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst archiveLabels = useArchiveLabel( templateSlug );\n\tconst defaultRenderingMode = postWithTemplate ? 'template-locked' : 'all';\n\tconst defaultEditorSettings = useMemo( () => {\n\t\treturn {\n\t\t\t...settings,\n\n\t\t\trichEditingEnabled: true,\n\t\t\tsupportsTemplateMode: true,\n\t\t\tfocusMode: canvasMode !== 'view',\n\t\t\tdefaultRenderingMode,\n\t\t\tgetPostLinkProps,\n\t\t\t// I wonder if they should be set in the post editor too\n\t\t\t__experimentalArchiveTitleTypeLabel: archiveLabels.archiveTypeLabel,\n\t\t\t__experimentalArchiveTitleNameLabel: archiveLabels.archiveNameLabel,\n\t\t};\n\t}, [\n\t\tsettings,\n\t\tcanvasMode,\n\t\tdefaultRenderingMode,\n\t\tgetPostLinkProps,\n\t\tarchiveLabels.archiveTypeLabel,\n\t\tarchiveLabels.archiveNameLabel,\n\t] );\n\n\treturn defaultEditorSettings;\n}\n\nexport default function useSiteEditorSettings() {\n\tconst defaultEditorSettings = useSpecificEditorSettings();\n\tconst { postType, postId } = useSelect( ( select ) => {\n\t\tconst { getEditedPostType, getEditedPostId } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\tconst usedPostType = getEditedPostType();\n\t\tconst usedPostId = getEditedPostId();\n\t\treturn {\n\t\t\tpostType: usedPostType,\n\t\t\tpostId: usedPostId,\n\t\t};\n\t}, [] );\n\treturn useBlockEditorSettings( defaultEditorSettings, postType, postId );\n}\n"],"mappings":"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AqB;AAC7B;AAEA,eAAe,SAASM,qBAAqBA,CAAA,EAAG;EAC/C,MAAMN,qBAAqB,GAAGlB,yBAAyB,CAAC,CAAC;EACzD,MAAM;IAAEyB,QAAQ;IAAEV;EAAO,CAAC,GAAG/C,SAAS,CAAImB,MAAM,IAAM;IACrD,MAAM;MAAEkB,iBAAiB;MAAEC;IAAgB,CAAC,GAAG/B,MAAM,CACpDY,MAAM,CAAEb,aAAc,CACvB,CAAC;IACD,MAAMqC,YAAY,GAAGN,iBAAiB,CAAC,CAAC;IACxC,MAAMO,UAAU,GAAGN,eAAe,CAAC,CAAC;IACpC,OAAO;MACNmB,QAAQ,EAAEd,YAAY;MACtBI,MAAM,EAAEH;IACT,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,OAAOnC,sBAAsB,CAAEyC,qBAAqB,EAAEO,QAAQ,EAAEV,MAAO,CAAC;AACzE"}
|
|
1
|
+
{"version":3,"names":["useSelect","useMemo","store","coreStore","privateApis","editorPrivateApis","routerPrivateApis","usePrevious","editSiteStore","unlock","useNavigateToEntityRecord","FOCUSABLE_ENTITIES","useBlockEditorSettings","useLocation","useHistory","useArchiveLabel","templateSlug","taxonomyMatches","match","taxonomy","term","isAuthor","authorSlug","authorMatches","select","getEntityRecords","getTaxonomy","getAuthors","archiveTypeLabel","archiveNameLabel","labels","singular_name","records","slug","per_page","name","authorRecords","useNavigateToPreviousEntityRecord","location","previousLocation","history","goBack","isFocusMode","params","focusMode","postId","includes","postType","didComeFromEditorCanvas","canvas","showBackButton","back","undefined","useSpecificEditorSettings","onNavigateToEntityRecord","canvasMode","settings","postWithTemplate","getEditedPostType","getEditedPostId","getEditedPostContext","getCanvasMode","getSettings","getEditedEntityRecord","usedPostType","usedPostId","_record","_context","archiveLabels","defaultRenderingMode","onNavigateToPreviousEntityRecord","defaultEditorSettings","richEditingEnabled","supportsTemplateMode","__experimentalArchiveTitleTypeLabel","__experimentalArchiveTitleNameLabel","useSiteEditorSettings"],"sources":["@wordpress/edit-site/src/components/block-editor/use-site-editor-settings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { usePrevious } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport useNavigateToEntityRecord from './use-navigate-to-entity-record';\nimport { FOCUSABLE_ENTITIES } from '../../utils/constants';\n\nconst { useBlockEditorSettings } = unlock( editorPrivateApis );\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nfunction useArchiveLabel( templateSlug ) {\n\tconst taxonomyMatches = templateSlug?.match(\n\t\t/^(category|tag|taxonomy-([^-]+))$|^(((category|tag)|taxonomy-([^-]+))-(.+))$/\n\t);\n\tlet taxonomy;\n\tlet term;\n\tlet isAuthor = false;\n\tlet authorSlug;\n\tif ( taxonomyMatches ) {\n\t\t// If is for a all taxonomies of a type\n\t\tif ( taxonomyMatches[ 1 ] ) {\n\t\t\ttaxonomy = taxonomyMatches[ 2 ]\n\t\t\t\t? taxonomyMatches[ 2 ]\n\t\t\t\t: taxonomyMatches[ 1 ];\n\t\t}\n\t\t// If is for a all taxonomies of a type\n\t\telse if ( taxonomyMatches[ 3 ] ) {\n\t\t\ttaxonomy = taxonomyMatches[ 6 ]\n\t\t\t\t? taxonomyMatches[ 6 ]\n\t\t\t\t: taxonomyMatches[ 4 ];\n\t\t\tterm = taxonomyMatches[ 7 ];\n\t\t}\n\t\ttaxonomy = taxonomy === 'tag' ? 'post_tag' : taxonomy;\n\n\t\t//getTaxonomy( 'category' );\n\t\t//wp.data.select('core').getEntityRecords( 'taxonomy', 'category', {slug: 'newcat'} );\n\t} else {\n\t\tconst authorMatches = templateSlug?.match( /^(author)$|^author-(.+)$/ );\n\t\tif ( authorMatches ) {\n\t\t\tisAuthor = true;\n\t\t\tif ( authorMatches[ 2 ] ) {\n\t\t\t\tauthorSlug = authorMatches[ 2 ];\n\t\t\t}\n\t\t}\n\t}\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, getTaxonomy, getAuthors } =\n\t\t\t\tselect( coreStore );\n\t\t\tlet archiveTypeLabel;\n\t\t\tlet archiveNameLabel;\n\t\t\tif ( taxonomy ) {\n\t\t\t\tarchiveTypeLabel =\n\t\t\t\t\tgetTaxonomy( taxonomy )?.labels?.singular_name;\n\t\t\t}\n\t\t\tif ( term ) {\n\t\t\t\tconst records = getEntityRecords( 'taxonomy', taxonomy, {\n\t\t\t\t\tslug: term,\n\t\t\t\t\tper_page: 1,\n\t\t\t\t} );\n\t\t\t\tif ( records && records[ 0 ] ) {\n\t\t\t\t\tarchiveNameLabel = records[ 0 ].name;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( isAuthor ) {\n\t\t\t\tarchiveTypeLabel = 'Author';\n\t\t\t\tif ( authorSlug ) {\n\t\t\t\t\tconst authorRecords = getAuthors( { slug: authorSlug } );\n\t\t\t\t\tif ( authorRecords && authorRecords[ 0 ] ) {\n\t\t\t\t\t\tarchiveNameLabel = authorRecords[ 0 ].name;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tarchiveTypeLabel,\n\t\t\t\tarchiveNameLabel,\n\t\t\t};\n\t\t},\n\t\t[ authorSlug, isAuthor, taxonomy, term ]\n\t);\n}\n\nfunction useNavigateToPreviousEntityRecord() {\n\tconst location = useLocation();\n\tconst previousLocation = usePrevious( location );\n\tconst history = useHistory();\n\tconst goBack = useMemo( () => {\n\t\tconst isFocusMode =\n\t\t\tlocation.params.focusMode ||\n\t\t\t( location.params.postId &&\n\t\t\t\tFOCUSABLE_ENTITIES.includes( location.params.postType ) );\n\t\tconst didComeFromEditorCanvas =\n\t\t\tpreviousLocation?.params.postId &&\n\t\t\tpreviousLocation?.params.postType &&\n\t\t\tpreviousLocation?.params.canvas === 'edit';\n\t\tconst showBackButton = isFocusMode && didComeFromEditorCanvas;\n\t\treturn showBackButton ? () => history.back() : undefined;\n\t\t// Disable reason: previousLocation changes when the component updates for any reason, not\n\t\t// just when location changes. Until this is fixed we can't add it to deps. See\n\t\t// https://github.com/WordPress/gutenberg/pull/58710#discussion_r1479219465.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ location, history ] );\n\treturn goBack;\n}\n\nexport function useSpecificEditorSettings() {\n\tconst onNavigateToEntityRecord = useNavigateToEntityRecord();\n\tconst { templateSlug, canvasMode, settings, postWithTemplate } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedPostType,\n\t\t\t\tgetEditedPostId,\n\t\t\t\tgetEditedPostContext,\n\t\t\t\tgetCanvasMode,\n\t\t\t\tgetSettings,\n\t\t\t} = unlock( select( editSiteStore ) );\n\t\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\t\tconst usedPostType = getEditedPostType();\n\t\t\tconst usedPostId = 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 _context = getEditedPostContext();\n\t\t\treturn {\n\t\t\t\ttemplateSlug: _record.slug,\n\t\t\t\tcanvasMode: getCanvasMode(),\n\t\t\t\tsettings: getSettings(),\n\t\t\t\tpostWithTemplate: _context?.postId,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst archiveLabels = useArchiveLabel( templateSlug );\n\tconst defaultRenderingMode = postWithTemplate ? 'template-locked' : 'all';\n\tconst onNavigateToPreviousEntityRecord =\n\t\tuseNavigateToPreviousEntityRecord();\n\tconst defaultEditorSettings = useMemo( () => {\n\t\treturn {\n\t\t\t...settings,\n\n\t\t\trichEditingEnabled: true,\n\t\t\tsupportsTemplateMode: true,\n\t\t\tfocusMode: canvasMode !== 'view',\n\t\t\tdefaultRenderingMode,\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t\t// I wonder if they should be set in the post editor too\n\t\t\t__experimentalArchiveTitleTypeLabel: archiveLabels.archiveTypeLabel,\n\t\t\t__experimentalArchiveTitleNameLabel: archiveLabels.archiveNameLabel,\n\t\t};\n\t}, [\n\t\tsettings,\n\t\tcanvasMode,\n\t\tdefaultRenderingMode,\n\t\tonNavigateToEntityRecord,\n\t\tonNavigateToPreviousEntityRecord,\n\t\tarchiveLabels.archiveTypeLabel,\n\t\tarchiveLabels.archiveNameLabel,\n\t] );\n\n\treturn defaultEditorSettings;\n}\n\nexport default function useSiteEditorSettings() {\n\tconst defaultEditorSettings = useSpecificEditorSettings();\n\tconst { postType, postId } = useSelect( ( select ) => {\n\t\tconst { getEditedPostType, getEditedPostId } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\tconst usedPostType = getEditedPostType();\n\t\tconst usedPostId = getEditedPostId();\n\t\treturn {\n\t\t\tpostType: usedPostType,\n\t\t\tpostId: usedPostId,\n\t\t};\n\t}, [] );\n\treturn useBlockEditorSettings( defaultEditorSettings, postType, postId );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SAASD,WAAW,IAAIE,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,WAAW,QAAQ,oBAAoB;;AAEhD;AACA;AACA;AACA,SAASL,KAAK,IAAIM,aAAa,QAAQ,aAAa;AACpD,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,yBAAyB,MAAM,iCAAiC;AACvE,SAASC,kBAAkB,QAAQ,uBAAuB;AAE1D,MAAM;EAAEC;AAAuB,CAAC,GAAGH,MAAM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alRules = {
|
|
61
61
|
'core/query': __('Query Loop displays a list of posts or pages.'),
|
|
62
62
|
'core/post-content': __('Post Content displays the content of a post or page.'),
|
|
63
|
-
'core/post-template': __('Post Template displays each post or page in a Query Loop.')
|
|
63
|
+
'core/post-template': __('Post Template displays each post or page in a Query Loop.'),
|
|
64
|
+
'bindings/core/pattern-overrides': __('Blocks from synced patterns that can have overriden content.')
|
|
64
65
|
};
|
|
65
66
|
export default function Editor({
|
|
66
67
|
isLoading
|
|
@@ -83,6 +84,7 @@ export default function Editor({
|
|
|
83
84
|
isRightSidebarOpen,
|
|
84
85
|
isInserterOpen,
|
|
85
86
|
isListViewOpen,
|
|
87
|
+
isDistractionFree,
|
|
86
88
|
showIconLabels,
|
|
87
89
|
showBlockBreadcrumbs,
|
|
88
90
|
postTypeLabel
|
|
@@ -122,6 +124,7 @@ export default function Editor({
|
|
|
122
124
|
isInserterOpen: isInserterOpened(),
|
|
123
125
|
isListViewOpen: isListViewOpened(),
|
|
124
126
|
isRightSidebarOpen: getActiveComplementaryArea(editSiteStore.name),
|
|
127
|
+
isDistractionFree: get('core', 'distractionFree'),
|
|
125
128
|
showBlockBreadcrumbs: get('core', 'showBlockBreadcrumbs'),
|
|
126
129
|
showIconLabels: get('core', 'showIconLabels'),
|
|
127
130
|
postTypeLabel: getPostTypeLabel()
|
|
@@ -130,7 +133,7 @@ export default function Editor({
|
|
|
130
133
|
const isViewMode = canvasMode === 'view';
|
|
131
134
|
const isEditMode = canvasMode === 'edit';
|
|
132
135
|
const showVisualEditor = isViewMode || editorMode === 'visual';
|
|
133
|
-
const shouldShowBlockBreadcrumbs = showBlockBreadcrumbs && isEditMode && showVisualEditor && blockEditorMode !== 'zoom-out';
|
|
136
|
+
const shouldShowBlockBreadcrumbs = !isDistractionFree && showBlockBreadcrumbs && isEditMode && showVisualEditor && blockEditorMode !== 'zoom-out';
|
|
134
137
|
const shouldShowInserter = isEditMode && showVisualEditor && isInserterOpen;
|
|
135
138
|
const shouldShowListView = isEditMode && showVisualEditor && isListViewOpen;
|
|
136
139
|
const secondarySidebarLabel = isListViewOpen ? __('List View') : __('Block Library');
|
|
@@ -160,7 +163,7 @@ export default function Editor({
|
|
|
160
163
|
settings: settings,
|
|
161
164
|
useSubRegistry: false
|
|
162
165
|
}, createElement(SidebarComplementaryAreaFills, null), isEditMode && createElement(StartTemplateOptions, null), createElement(InterfaceSkeleton, {
|
|
163
|
-
isDistractionFree:
|
|
166
|
+
isDistractionFree: isDistractionFree,
|
|
164
167
|
enableRegionNavigation: false,
|
|
165
168
|
className: classnames('edit-site-editor__interface-skeleton', {
|
|
166
169
|
'show-icon-labels': showIconLabels
|