@wordpress/edit-site 5.31.0 → 5.32.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/block-editor/editor-canvas.js +8 -1
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/site-editor-canvas.js +15 -4
- package/build/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build/components/editor/index.js +12 -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/background-panel.js +38 -0
- package/build/components/global-styles/background-panel.js.map +1 -0
- package/build/components/global-styles/font-families.js +1 -1
- package/build/components/global-styles/font-families.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +38 -9
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/index.js +20 -2
- package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build/components/global-styles/palette.js +3 -1
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/preview-colors.js +2 -2
- package/build/components/global-styles/preview-colors.js.map +1 -1
- package/build/components/global-styles/root-menu.js +8 -2
- package/build/components/global-styles/root-menu.js.map +1 -1
- package/build/components/global-styles/screen-background.js +34 -0
- package/build/components/global-styles/screen-background.js.map +1 -0
- package/build/components/global-styles/screen-color-palette.js +2 -2
- package/build/components/global-styles/screen-color-palette.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +6 -4
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +3 -37
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +6 -6
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +5 -2
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/global-styles/ui.js +4 -1
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/variations/variations-color.js +10 -3
- package/build/components/global-styles/variations/variations-color.js.map +1 -1
- package/build/components/global-styles/variations/variations-typography.js +9 -2
- package/build/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +3 -0
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/layout/animation.js +129 -0
- package/build/components/layout/animation.js.map +1 -0
- package/build/components/layout/index.js +9 -17
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/router.js +21 -18
- package/build/components/layout/router.js.map +1 -1
- package/build/components/page-pages/index.js +19 -17
- package/build/components/page-pages/index.js.map +1 -1
- package/build/components/page-patterns/index.js +18 -28
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/search-items.js +16 -58
- package/build/components/page-patterns/search-items.js.map +1 -1
- package/build/components/page-templates-template-parts/actions.js +54 -41
- package/build/components/page-templates-template-parts/actions.js.map +1 -1
- package/build/components/page-templates-template-parts/index.js +26 -59
- package/build/components/page-templates-template-parts/index.js.map +1 -1
- package/build/components/plugin-template-setting-panel/index.js +12 -1
- package/build/components/plugin-template-setting-panel/index.js.map +1 -1
- package/build/components/save-button/index.js +45 -16
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-hub/index.js +8 -112
- package/build/components/save-hub/index.js.map +1 -1
- package/build/components/sidebar/index.js +1 -5
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +1 -1
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-dataviews/index.js +1 -1
- package/build/components/sidebar-dataviews/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +1 -2
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/index.js +5 -15
- package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-content.js +7 -5
- package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-panel/index.js +10 -16
- package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-details-footer/index.js +5 -1
- package/build/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +10 -5
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +1 -5
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/style-book/index.js +1 -1
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +2 -2
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/hooks/index.js +0 -1
- package/build/hooks/index.js.map +1 -1
- package/build/store/selectors.js +1 -9
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +8 -1
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/site-editor-canvas.js +15 -4
- package/build-module/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build-module/components/editor/index.js +13 -4
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-canvas-container/index.js +1 -2
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +31 -0
- package/build-module/components/global-styles/background-panel.js.map +1 -0
- package/build-module/components/global-styles/font-families.js +1 -1
- package/build-module/components/global-styles/font-families.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +38 -9
- package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/index.js +20 -2
- package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build-module/components/global-styles/palette.js +3 -1
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/preview-colors.js +2 -2
- package/build-module/components/global-styles/preview-colors.js.map +1 -1
- package/build-module/components/global-styles/root-menu.js +9 -3
- package/build-module/components/global-styles/root-menu.js.map +1 -1
- package/build-module/components/global-styles/screen-background.js +26 -0
- package/build-module/components/global-styles/screen-background.js.map +1 -0
- package/build-module/components/global-styles/screen-color-palette.js +2 -2
- package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +6 -4
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +4 -38
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +6 -6
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +5 -2
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/global-styles/ui.js +4 -1
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-color.js +10 -3
- package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-typography.js +9 -2
- package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +3 -0
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/layout/animation.js +122 -0
- package/build-module/components/layout/animation.js.map +1 -0
- package/build-module/components/layout/index.js +9 -17
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/router.js +21 -18
- package/build-module/components/layout/router.js.map +1 -1
- package/build-module/components/page-pages/index.js +19 -17
- package/build-module/components/page-pages/index.js.map +1 -1
- package/build-module/components/page-patterns/index.js +20 -30
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/search-items.js +14 -55
- package/build-module/components/page-patterns/search-items.js.map +1 -1
- package/build-module/components/page-templates-template-parts/actions.js +54 -40
- package/build-module/components/page-templates-template-parts/actions.js.map +1 -1
- package/build-module/components/page-templates-template-parts/index.js +29 -62
- package/build-module/components/page-templates-template-parts/index.js.map +1 -1
- package/build-module/components/plugin-template-setting-panel/index.js +12 -1
- package/build-module/components/plugin-template-setting-panel/index.js.map +1 -1
- package/build-module/components/save-button/index.js +46 -17
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-hub/index.js +10 -114
- package/build-module/components/save-hub/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +1 -5
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-dataviews/index.js +1 -1
- package/build-module/components/sidebar-dataviews/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +1 -2
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/index.js +8 -18
- package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +7 -5
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/index.js +11 -17
- package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js +5 -1
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +10 -5
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +1 -5
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/style-book/index.js +1 -1
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +2 -2
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/hooks/index.js +0 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/store/selectors.js +1 -9
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +116 -104
- package/build-style/style.css +116 -104
- package/package.json +44 -44
- package/src/components/block-editor/editor-canvas.js +14 -2
- package/src/components/block-editor/site-editor-canvas.js +10 -7
- package/src/components/editor/index.js +11 -4
- package/src/components/editor-canvas-container/index.js +0 -1
- package/src/components/global-styles/background-panel.js +34 -0
- package/src/components/global-styles/font-families.js +1 -1
- package/src/components/global-styles/font-library-modal/context.js +43 -14
- package/src/components/global-styles/font-library-modal/style.scss +1 -1
- package/src/components/global-styles/font-library-modal/utils/index.js +17 -4
- package/src/components/global-styles/palette.js +3 -1
- package/src/components/global-styles/preview-colors.js +2 -2
- package/src/components/global-styles/root-menu.js +12 -1
- package/src/components/global-styles/screen-background.js +29 -0
- package/src/components/global-styles/screen-color-palette.js +2 -2
- package/src/components/global-styles/screen-colors.js +4 -4
- package/src/components/global-styles/screen-style-variations.js +4 -36
- package/src/components/global-styles/screen-typography.js +6 -9
- package/src/components/global-styles/style-variations-container.js +2 -1
- package/src/components/global-styles/style.scss +14 -12
- package/src/components/global-styles/ui.js +5 -0
- package/src/components/global-styles/variations/style.scss +32 -17
- package/src/components/global-styles/variations/variations-color.js +4 -2
- package/src/components/global-styles/variations/variations-typography.js +4 -1
- package/src/components/header-edit-mode/style.scss +28 -17
- package/src/components/keyboard-shortcut-help-modal/index.js +4 -0
- package/src/components/layout/animation.js +122 -0
- package/src/components/layout/index.js +12 -27
- package/src/components/layout/router.js +25 -19
- package/src/components/layout/style.scss +2 -0
- package/src/components/page-pages/index.js +27 -43
- package/src/components/page-patterns/index.js +20 -28
- package/src/components/page-patterns/search-items.js +13 -58
- package/src/components/page-templates-template-parts/actions.js +106 -91
- package/src/components/page-templates-template-parts/index.js +34 -78
- package/src/components/page-templates-template-parts/style.scss +5 -0
- package/src/components/plugin-template-setting-panel/index.js +14 -1
- package/src/components/save-button/index.js +55 -26
- package/src/components/save-hub/index.js +20 -164
- package/src/components/sidebar/index.js +0 -5
- package/src/components/sidebar-dataviews/default-views.js +1 -1
- package/src/components/sidebar-dataviews/index.js +1 -1
- package/src/components/sidebar-edit-mode/index.js +0 -2
- package/src/components/sidebar-edit-mode/page-panels/index.js +29 -60
- package/src/components/sidebar-edit-mode/page-panels/page-content.js +10 -10
- package/src/components/sidebar-edit-mode/template-panel/index.js +23 -33
- package/src/components/sidebar-edit-mode/template-panel/style.scss +1 -29
- package/src/components/sidebar-navigation-screen/style.scss +12 -9
- package/src/components/sidebar-navigation-screen-details-footer/index.js +6 -2
- package/src/components/sidebar-navigation-screen-global-styles/index.js +7 -13
- package/src/components/sidebar-navigation-screen-patterns/index.js +0 -7
- package/src/components/style-book/index.js +1 -3
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +2 -2
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +1 -1
- package/src/hooks/index.js +0 -1
- package/src/store/selectors.js +3 -15
- package/src/style.scss +0 -1
- package/build/components/actions/index.js +0 -319
- package/build/components/actions/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/sidebar-card/index.js +0 -48
- package/build/components/sidebar-edit-mode/sidebar-card/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-panel/template-areas.js +0 -70
- package/build/components/sidebar-edit-mode/template-panel/template-areas.js.map +0 -1
- package/build/components/sidebar-navigation-screen-pages/index.js +0 -175
- package/build/components/sidebar-navigation-screen-pages/index.js.map +0 -1
- package/build/hooks/template-part-edit.js +0 -82
- package/build/hooks/template-part-edit.js.map +0 -1
- package/build/store/utils.js +0 -71
- package/build/store/utils.js.map +0 -1
- package/build-module/components/actions/index.js +0 -308
- package/build-module/components/actions/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/sidebar-card/index.js +0 -40
- package/build-module/components/sidebar-edit-mode/sidebar-card/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-panel/template-areas.js +0 -63
- package/build-module/components/sidebar-edit-mode/template-panel/template-areas.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-pages/index.js +0 -167
- package/build-module/components/sidebar-navigation-screen-pages/index.js.map +0 -1
- package/build-module/hooks/template-part-edit.js +0 -75
- package/build-module/hooks/template-part-edit.js.map +0 -1
- package/build-module/store/utils.js +0 -64
- package/build-module/store/utils.js.map +0 -1
- package/src/components/actions/index.js +0 -409
- package/src/components/sidebar-edit-mode/sidebar-card/index.js +0 -53
- package/src/components/sidebar-edit-mode/sidebar-card/style.scss +0 -36
- package/src/components/sidebar-edit-mode/template-panel/template-areas.js +0 -86
- package/src/components/sidebar-navigation-screen-pages/index.js +0 -238
- package/src/hooks/template-part-edit.js +0 -89
- package/src/store/test/utils.js +0 -191
- package/src/store/utils.js +0 -69
|
@@ -8,16 +8,10 @@ exports.default = SaveHub;
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _data = require("@wordpress/data");
|
|
10
10
|
var _components = require("@wordpress/components");
|
|
11
|
-
var _i18n = require("@wordpress/i18n");
|
|
12
11
|
var _coreData = require("@wordpress/core-data");
|
|
13
|
-
var _blockEditor = require("@wordpress/block-editor");
|
|
14
12
|
var _icons = require("@wordpress/icons");
|
|
15
|
-
var _router = require("@wordpress/router");
|
|
16
|
-
var _notices = require("@wordpress/notices");
|
|
17
13
|
var _saveButton = _interopRequireDefault(require("../save-button"));
|
|
18
14
|
var _isPreviewingTheme = require("../../utils/is-previewing-theme");
|
|
19
|
-
var _lockUnlock = require("../../lock-unlock");
|
|
20
|
-
var _constants = require("../../utils/constants");
|
|
21
15
|
/**
|
|
22
16
|
* WordPress dependencies
|
|
23
17
|
*/
|
|
@@ -26,30 +20,9 @@ var _constants = require("../../utils/constants");
|
|
|
26
20
|
* Internal dependencies
|
|
27
21
|
*/
|
|
28
22
|
|
|
29
|
-
const {
|
|
30
|
-
useLocation
|
|
31
|
-
} = (0, _lockUnlock.unlock)(_router.privateApis);
|
|
32
|
-
const PUBLISH_ON_SAVE_ENTITIES = [{
|
|
33
|
-
kind: 'postType',
|
|
34
|
-
name: _constants.NAVIGATION_POST_TYPE
|
|
35
|
-
}];
|
|
36
23
|
function SaveHub() {
|
|
37
|
-
const saveNoticeId = 'site-edit-save-notice';
|
|
38
24
|
const {
|
|
39
|
-
|
|
40
|
-
} = useLocation();
|
|
41
|
-
const {
|
|
42
|
-
__unstableMarkLastChangeAsPersistent
|
|
43
|
-
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
44
|
-
const {
|
|
45
|
-
createSuccessNotice,
|
|
46
|
-
createErrorNotice,
|
|
47
|
-
removeNotice
|
|
48
|
-
} = (0, _data.useDispatch)(_notices.store);
|
|
49
|
-
const {
|
|
50
|
-
dirtyCurrentEntity,
|
|
51
|
-
countUnsavedChanges,
|
|
52
|
-
isDirty,
|
|
25
|
+
isDisabled,
|
|
53
26
|
isSaving
|
|
54
27
|
} = (0, _data.useSelect)(select => {
|
|
55
28
|
const {
|
|
@@ -57,99 +30,22 @@ function SaveHub() {
|
|
|
57
30
|
isSavingEntityRecord
|
|
58
31
|
} = select(_coreData.store);
|
|
59
32
|
const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
|
|
60
|
-
|
|
61
|
-
if (dirtyEntityRecords.length === 1) {
|
|
62
|
-
// if we are on global styles
|
|
63
|
-
if (params.path?.includes('wp_global_styles')) {
|
|
64
|
-
calcDirtyCurrentEntity = dirtyEntityRecords.find(record => record.name === 'globalStyles');
|
|
65
|
-
}
|
|
66
|
-
// if we are on pages
|
|
67
|
-
else if (params.postId) {
|
|
68
|
-
calcDirtyCurrentEntity = dirtyEntityRecords.find(record => record.name === params.postType && String(record.key) === params.postId);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return {
|
|
72
|
-
dirtyCurrentEntity: calcDirtyCurrentEntity,
|
|
73
|
-
isDirty: dirtyEntityRecords.length > 0,
|
|
74
|
-
isSaving: dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key)),
|
|
75
|
-
countUnsavedChanges: dirtyEntityRecords.length
|
|
76
|
-
};
|
|
77
|
-
}, [params.path, params.postType, params.postId]);
|
|
78
|
-
const {
|
|
79
|
-
editEntityRecord,
|
|
80
|
-
saveEditedEntityRecord,
|
|
81
|
-
__experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits
|
|
82
|
-
} = (0, _data.useDispatch)(_coreData.store);
|
|
83
|
-
const disabled = isSaving || !isDirty && !(0, _isPreviewingTheme.isPreviewingTheme)();
|
|
84
|
-
|
|
85
|
-
// if we have only one unsaved change and it matches current context, we can show a more specific label
|
|
86
|
-
let label = dirtyCurrentEntity ? (0, _i18n.__)('Save') : (0, _i18n.sprintf)(
|
|
87
|
-
// translators: %d: number of unsaved changes (number).
|
|
88
|
-
(0, _i18n._n)('Review %d change…', 'Review %d changes…', countUnsavedChanges), countUnsavedChanges);
|
|
89
|
-
if (isSaving) {
|
|
90
|
-
label = (0, _i18n.__)('Saving');
|
|
91
|
-
}
|
|
92
|
-
const {
|
|
93
|
-
homeUrl
|
|
94
|
-
} = (0, _data.useSelect)(select => {
|
|
95
|
-
const {
|
|
96
|
-
getUnstableBase // Site index.
|
|
97
|
-
} = select(_coreData.store);
|
|
33
|
+
const _isSaving = dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key));
|
|
98
34
|
return {
|
|
99
|
-
|
|
35
|
+
isSaving: _isSaving,
|
|
36
|
+
isDisabled: _isSaving || !dirtyEntityRecords.length && !(0, _isPreviewingTheme.isPreviewingTheme)()
|
|
100
37
|
};
|
|
101
38
|
}, []);
|
|
102
|
-
const saveCurrentEntity = async () => {
|
|
103
|
-
if (!dirtyCurrentEntity) return;
|
|
104
|
-
removeNotice(saveNoticeId);
|
|
105
|
-
const {
|
|
106
|
-
kind,
|
|
107
|
-
name,
|
|
108
|
-
key,
|
|
109
|
-
property
|
|
110
|
-
} = dirtyCurrentEntity;
|
|
111
|
-
try {
|
|
112
|
-
if ('root' === dirtyCurrentEntity.kind && 'site' === name) {
|
|
113
|
-
await saveSpecifiedEntityEdits('root', 'site', undefined, [property]);
|
|
114
|
-
} else {
|
|
115
|
-
if (PUBLISH_ON_SAVE_ENTITIES.some(typeToPublish => typeToPublish.kind === kind && typeToPublish.name === name)) {
|
|
116
|
-
editEntityRecord(kind, name, key, {
|
|
117
|
-
status: 'publish'
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
await saveEditedEntityRecord(kind, name, key);
|
|
121
|
-
}
|
|
122
|
-
__unstableMarkLastChangeAsPersistent();
|
|
123
|
-
createSuccessNotice((0, _i18n.__)('Site updated.'), {
|
|
124
|
-
type: 'snackbar',
|
|
125
|
-
actions: [{
|
|
126
|
-
label: (0, _i18n.__)('View site'),
|
|
127
|
-
url: homeUrl
|
|
128
|
-
}],
|
|
129
|
-
id: saveNoticeId
|
|
130
|
-
});
|
|
131
|
-
} catch (error) {
|
|
132
|
-
createErrorNotice(`${(0, _i18n.__)('Saving failed.')} ${error}`);
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
39
|
return (0, _react.createElement)(_components.__experimentalHStack, {
|
|
136
40
|
className: "edit-site-save-hub",
|
|
137
41
|
alignment: "right",
|
|
138
42
|
spacing: 4
|
|
139
|
-
},
|
|
140
|
-
variant: "primary",
|
|
141
|
-
onClick: saveCurrentEntity,
|
|
142
|
-
isBusy: isSaving,
|
|
143
|
-
disabled: isSaving,
|
|
144
|
-
"aria-disabled": isSaving,
|
|
145
|
-
className: "edit-site-save-hub__button",
|
|
146
|
-
__next40pxDefaultSize: true
|
|
147
|
-
}, label) : (0, _react.createElement)(_saveButton.default, {
|
|
43
|
+
}, (0, _react.createElement)(_saveButton.default, {
|
|
148
44
|
className: "edit-site-save-hub__button",
|
|
149
|
-
variant:
|
|
45
|
+
variant: isDisabled ? null : 'primary',
|
|
150
46
|
showTooltip: false,
|
|
151
|
-
icon:
|
|
152
|
-
|
|
47
|
+
icon: isDisabled && !isSaving ? _icons.check : null,
|
|
48
|
+
showReviewMessage: true,
|
|
153
49
|
__next40pxDefaultSize: true
|
|
154
50
|
}));
|
|
155
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_components","_i18n","_coreData","_blockEditor","_icons","_router","_notices","_saveButton","_interopRequireDefault","_isPreviewingTheme","_lockUnlock","_constants","useLocation","unlock","routerPrivateApis","PUBLISH_ON_SAVE_ENTITIES","kind","name","NAVIGATION_POST_TYPE","SaveHub","saveNoticeId","params","__unstableMarkLastChangeAsPersistent","useDispatch","blockEditorStore","createSuccessNotice","createErrorNotice","removeNotice","noticesStore","dirtyCurrentEntity","countUnsavedChanges","isDirty","isSaving","useSelect","select","__experimentalGetDirtyEntityRecords","isSavingEntityRecord","coreStore","dirtyEntityRecords","calcDirtyCurrentEntity","length","path","includes","find","record","postId","postType","String","key","some","editEntityRecord","saveEditedEntityRecord","__experimentalSaveSpecifiedEntityEdits","saveSpecifiedEntityEdits","disabled","isPreviewingTheme","label","__","sprintf","_n","homeUrl","getUnstableBase","home","saveCurrentEntity","property","undefined","typeToPublish","status","type","actions","url","id","error","_react","createElement","__experimentalHStack","className","alignment","spacing","Button","variant","onClick","isBusy","__next40pxDefaultSize","default","showTooltip","icon","check","defaultLabel"],"sources":["@wordpress/edit-site/src/components/save-hub/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button, __experimentalHStack as HStack } from '@wordpress/components';\nimport { __, sprintf, _n } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { check } from '@wordpress/icons';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport SaveButton from '../save-button';\nimport { isPreviewingTheme } from '../../utils/is-previewing-theme';\nimport { unlock } from '../../lock-unlock';\nimport { NAVIGATION_POST_TYPE } from '../../utils/constants';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nconst PUBLISH_ON_SAVE_ENTITIES = [\n\t{\n\t\tkind: 'postType',\n\t\tname: NAVIGATION_POST_TYPE,\n\t},\n];\n\nexport default function SaveHub() {\n\tconst saveNoticeId = 'site-edit-save-notice';\n\tconst { params } = useLocation();\n\n\tconst { __unstableMarkLastChangeAsPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst { createSuccessNotice, createErrorNotice, removeNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst { dirtyCurrentEntity, countUnsavedChanges, isDirty, isSaving } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\t__experimentalGetDirtyEntityRecords,\n\t\t\t\t\tisSavingEntityRecord,\n\t\t\t\t} = select( coreStore );\n\t\t\t\tconst dirtyEntityRecords =\n\t\t\t\t\t__experimentalGetDirtyEntityRecords();\n\t\t\t\tlet calcDirtyCurrentEntity = null;\n\n\t\t\t\tif ( dirtyEntityRecords.length === 1 ) {\n\t\t\t\t\t// if we are on global styles\n\t\t\t\t\tif ( params.path?.includes( 'wp_global_styles' ) ) {\n\t\t\t\t\t\tcalcDirtyCurrentEntity = dirtyEntityRecords.find(\n\t\t\t\t\t\t\t( record ) => record.name === 'globalStyles'\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\t// if we are on pages\n\t\t\t\t\telse if ( params.postId ) {\n\t\t\t\t\t\tcalcDirtyCurrentEntity = dirtyEntityRecords.find(\n\t\t\t\t\t\t\t( record ) =>\n\t\t\t\t\t\t\t\trecord.name === params.postType &&\n\t\t\t\t\t\t\t\tString( record.key ) === params.postId\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tdirtyCurrentEntity: calcDirtyCurrentEntity,\n\t\t\t\t\tisDirty: dirtyEntityRecords.length > 0,\n\t\t\t\t\tisSaving: dirtyEntityRecords.some( ( record ) =>\n\t\t\t\t\t\tisSavingEntityRecord(\n\t\t\t\t\t\t\trecord.kind,\n\t\t\t\t\t\t\trecord.name,\n\t\t\t\t\t\t\trecord.key\n\t\t\t\t\t\t)\n\t\t\t\t\t),\n\t\t\t\t\tcountUnsavedChanges: dirtyEntityRecords.length,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ params.path, params.postType, params.postId ]\n\t\t);\n\n\tconst {\n\t\teditEntityRecord,\n\t\tsaveEditedEntityRecord,\n\t\t__experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits,\n\t} = useDispatch( coreStore );\n\n\tconst disabled = isSaving || ( ! isDirty && ! isPreviewingTheme() );\n\n\t// if we have only one unsaved change and it matches current context, we can show a more specific label\n\tlet label = dirtyCurrentEntity\n\t\t? __( 'Save' )\n\t\t: sprintf(\n\t\t\t\t// translators: %d: number of unsaved changes (number).\n\t\t\t\t_n(\n\t\t\t\t\t'Review %d change…',\n\t\t\t\t\t'Review %d changes…',\n\t\t\t\t\tcountUnsavedChanges\n\t\t\t\t),\n\t\t\t\tcountUnsavedChanges\n\t\t );\n\n\tif ( isSaving ) {\n\t\tlabel = __( 'Saving' );\n\t}\n\n\tconst { homeUrl } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetUnstableBase, // Site index.\n\t\t} = select( coreStore );\n\t\treturn {\n\t\t\thomeUrl: getUnstableBase()?.home,\n\t\t};\n\t}, [] );\n\n\tconst saveCurrentEntity = async () => {\n\t\tif ( ! dirtyCurrentEntity ) return;\n\n\t\tremoveNotice( saveNoticeId );\n\t\tconst { kind, name, key, property } = dirtyCurrentEntity;\n\n\t\ttry {\n\t\t\tif ( 'root' === dirtyCurrentEntity.kind && 'site' === name ) {\n\t\t\t\tawait saveSpecifiedEntityEdits( 'root', 'site', undefined, [\n\t\t\t\t\tproperty,\n\t\t\t\t] );\n\t\t\t} else {\n\t\t\t\tif (\n\t\t\t\t\tPUBLISH_ON_SAVE_ENTITIES.some(\n\t\t\t\t\t\t( typeToPublish ) =>\n\t\t\t\t\t\t\ttypeToPublish.kind === kind &&\n\t\t\t\t\t\t\ttypeToPublish.name === name\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\teditEntityRecord( kind, name, key, { status: 'publish' } );\n\t\t\t\t}\n\n\t\t\t\tawait saveEditedEntityRecord( kind, name, key );\n\t\t\t}\n\n\t\t\t__unstableMarkLastChangeAsPersistent();\n\n\t\t\tcreateSuccessNotice( __( 'Site updated.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tactions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: __( 'View site' ),\n\t\t\t\t\t\turl: homeUrl,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tid: saveNoticeId,\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\tcreateErrorNotice( `${ __( 'Saving failed.' ) } ${ error }` );\n\t\t}\n\t};\n\n\treturn (\n\t\t<HStack className=\"edit-site-save-hub\" alignment=\"right\" spacing={ 4 }>\n\t\t\t{ dirtyCurrentEntity ? (\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tonClick={ saveCurrentEntity }\n\t\t\t\t\tisBusy={ isSaving }\n\t\t\t\t\tdisabled={ isSaving }\n\t\t\t\t\taria-disabled={ isSaving }\n\t\t\t\t\tclassName=\"edit-site-save-hub__button\"\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t>\n\t\t\t\t\t{ label }\n\t\t\t\t</Button>\n\t\t\t) : (\n\t\t\t\t<SaveButton\n\t\t\t\t\tclassName=\"edit-site-save-hub__button\"\n\t\t\t\t\tvariant={ disabled ? null : 'primary' }\n\t\t\t\t\tshowTooltip={ false }\n\t\t\t\t\ticon={ disabled && ! isSaving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viewingTheme","SaveHub","isDisabled","isSaving","useSelect","select","__experimentalGetDirtyEntityRecords","isSavingEntityRecord","coreStore","dirtyEntityRecords","_isSaving","some","record","kind","name","key","length","isPreviewingTheme","_react","createElement","__experimentalHStack","className","alignment","spacing","default","variant","showTooltip","icon","check","showReviewMessage","__next40pxDefaultSize"],"sources":["@wordpress/edit-site/src/components/save-hub/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __experimentalHStack as HStack } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { check } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport SaveButton from '../save-button';\nimport { isPreviewingTheme } from '../../utils/is-previewing-theme';\n\nexport default function SaveHub() {\n\tconst { isDisabled, isSaving } = useSelect( ( select ) => {\n\t\tconst { __experimentalGetDirtyEntityRecords, isSavingEntityRecord } =\n\t\t\tselect( coreStore );\n\t\tconst dirtyEntityRecords = __experimentalGetDirtyEntityRecords();\n\t\tconst _isSaving = dirtyEntityRecords.some( ( record ) =>\n\t\t\tisSavingEntityRecord( record.kind, record.name, record.key )\n\t\t);\n\t\treturn {\n\t\t\tisSaving: _isSaving,\n\t\t\tisDisabled:\n\t\t\t\t_isSaving ||\n\t\t\t\t( ! dirtyEntityRecords.length && ! isPreviewingTheme() ),\n\t\t};\n\t}, [] );\n\treturn (\n\t\t<HStack className=\"edit-site-save-hub\" alignment=\"right\" spacing={ 4 }>\n\t\t\t<SaveButton\n\t\t\t\tclassName=\"edit-site-save-hub__button\"\n\t\t\t\tvariant={ isDisabled ? null : 'primary' }\n\t\t\t\tshowTooltip={ false }\n\t\t\t\ticon={ isDisabled && ! isSaving ? check : null }\n\t\t\t\tshowReviewMessage\n\t\t\t\t__next40pxDefaultSize\n\t\t\t/>\n\t\t</HStack>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,I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obalStyles = _interopRequireDefault(require("../si
|
|
|
23
23
|
var _sidebarNavigationScreenTemplatesBrowse = _interopRequireDefault(require("../sidebar-navigation-screen-templates-browse"));
|
|
24
24
|
var _saveHub = _interopRequireDefault(require("../save-hub"));
|
|
25
25
|
var _lockUnlock = require("../../lock-unlock");
|
|
26
|
-
var _sidebarNavigationScreenPages = _interopRequireDefault(require("../sidebar-navigation-screen-pages"));
|
|
27
26
|
var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-navigation-screen"));
|
|
28
27
|
var _sidebarDataviews = _interopRequireDefault(require("../sidebar-dataviews"));
|
|
29
28
|
var _sidebarNavigationScreenPage = _interopRequireDefault(require("../sidebar-navigation-screen-page"));
|
|
@@ -66,12 +65,9 @@ function SidebarScreens() {
|
|
|
66
65
|
path: "/wp_global_styles"
|
|
67
66
|
}, (0, _react.createElement)(_sidebarNavigationScreenGlobalStyles.default, null)), (0, _react.createElement)(SidebarScreenWrapper, {
|
|
68
67
|
path: "/page"
|
|
69
|
-
}, (0, _react.createElement)(_sidebarNavigationScreenPages.default, null)), (0, _react.createElement)(SidebarScreenWrapper, {
|
|
70
|
-
path: "/pages"
|
|
71
68
|
}, (0, _react.createElement)(_sidebarNavigationScreen.default, {
|
|
72
69
|
title: (0, _i18n.__)('Manage pages'),
|
|
73
|
-
content: (0, _react.createElement)(_sidebarDataviews.default, null)
|
|
74
|
-
backPath: "/page"
|
|
70
|
+
content: (0, _react.createElement)(_sidebarDataviews.default, null)
|
|
75
71
|
})), (0, _react.createElement)(SidebarScreenWrapper, {
|
|
76
72
|
path: "/page/:postId"
|
|
77
73
|
}, (0, _react.createElement)(_sidebarNavigationScreenPage.default, null)), (0, _react.createElement)(SidebarScreenWrapper, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_element","_components","_router","_compose","_i18n","_sidebarNavigationScreenMain","_sidebarNavigationScreenTemplate","_sidebarNavigationScreenPatterns","_sidebarNavigationScreenPattern","_useSyncPathWithUrl","_interopRequireWildcard","_sidebarNavigationScreenNavigationMenus","_sidebarNavigationScreenNavigationMenu","_sidebarNavigationScreenGlobalStyles","_sidebarNavigationScreenTemplatesBrowse","_saveHub","_lockUnlock","_sidebarNavigationScreenPages","_sidebarNavigationScreen","_sidebarDataviews","_sidebarNavigationScreenPage","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","useLocation","unlock","routerPrivateApis","SidebarScreenWrapper","className","props","_react","createElement","__experimentalNavigatorScreen","classNames","SidebarScreens","useSyncPathWithURL","isMobileViewport","useViewportMatch","Fragment","path","title","__","content","backPath","Sidebar","params","urlParams","initialPath","useRef","getPathFromURL","__experimentalNavigatorProvider","current","_default","exports","memo"],"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { memo, useRef } from '@wordpress/element';\nimport {\n\t__experimentalNavigatorProvider as NavigatorProvider,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n} from '@wordpress/components';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';\nimport SidebarNavigationScreenTemplate from '../sidebar-navigation-screen-template';\nimport SidebarNavigationScreenPatterns from '../sidebar-navigation-screen-patterns';\nimport SidebarNavigationScreenPattern from '../sidebar-navigation-screen-pattern';\nimport useSyncPathWithURL, {\n\tgetPathFromURL,\n} from '../sync-state-with-url/use-sync-path-with-url';\nimport SidebarNavigationScreenNavigationMenus from '../sidebar-navigation-screen-navigation-menus';\nimport SidebarNavigationScreenNavigationMenu from '../sidebar-navigation-screen-navigation-menu';\nimport SidebarNavigationScreenGlobalStyles from '../sidebar-navigation-screen-global-styles';\nimport SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';\nimport SaveHub from '../save-hub';\nimport { unlock } from '../../lock-unlock';\nimport SidebarNavigationScreenPages from '../sidebar-navigation-screen-pages';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport DataViewsSidebarContent from '../sidebar-dataviews';\nimport SidebarNavigationScreenPage from '../sidebar-navigation-screen-page';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nfunction SidebarScreenWrapper( { className, ...props } ) {\n\treturn (\n\t\t<NavigatorScreen\n\t\t\tclassName={ classNames(\n\t\t\t\t'edit-site-sidebar__screen-wrapper',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nfunction SidebarScreens() {\n\tuseSyncPathWithURL();\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\n\treturn (\n\t\t<>\n\t\t\t<SidebarScreenWrapper path=\"/\">\n\t\t\t\t<SidebarNavigationScreenMain />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/navigation\">\n\t\t\t\t<SidebarNavigationScreenNavigationMenus />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/navigation/:postType/:postId\">\n\t\t\t\t<SidebarNavigationScreenNavigationMenu />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/wp_global_styles\">\n\t\t\t\t<SidebarNavigationScreenGlobalStyles />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/page\">\n\t\t\t\t<SidebarNavigationScreenPages />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/pages\">\n\t\t\t\t<SidebarNavigationScreen\n\t\t\t\t\ttitle={ __( 'Manage pages' ) }\n\t\t\t\t\tcontent={ <DataViewsSidebarContent /> }\n\t\t\t\t\tbackPath=\"/page\"\n\t\t\t\t/>\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/page/:postId\">\n\t\t\t\t<SidebarNavigationScreenPage />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/:postType(wp_template)\">\n\t\t\t\t<SidebarNavigationScreenTemplatesBrowse />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t{ ! isMobileViewport && (\n\t\t\t\t<SidebarScreenWrapper path=\"/patterns\">\n\t\t\t\t\t<SidebarNavigationScreenPatterns />\n\t\t\t\t</SidebarScreenWrapper>\n\t\t\t) }\n\t\t\t<SidebarScreenWrapper path=\"/:postType(wp_template_part)/all\">\n\t\t\t\t<SidebarNavigationScreenTemplatesBrowse />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/:postType(wp_template_part|wp_block)/:postId\">\n\t\t\t\t<SidebarNavigationScreenPattern />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/:postType(wp_template)/:postId\">\n\t\t\t\t<SidebarNavigationScreenTemplate />\n\t\t\t</SidebarScreenWrapper>\n\t\t</>\n\t);\n}\n\nfunction Sidebar() {\n\tconst { params: urlParams } = useLocation();\n\tconst initialPath = useRef( getPathFromURL( urlParams ) );\n\n\treturn (\n\t\t<>\n\t\t\t<NavigatorProvider\n\t\t\t\tclassName=\"edit-site-sidebar__content\"\n\t\t\t\tinitialPath={ initialPath.current }\n\t\t\t>\n\t\t\t\t<SidebarScreens />\n\t\t\t</NavigatorProvider>\n\t\t\t<SaveHub />\n\t\t</>\n\t);\n}\n\nexport default memo( Sidebar );\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAIA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OA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C,QAAA,CAAAY,OAAO,MAAE,CACT,CAAC;AAEL;AAAC,IAAA2C,QAAA,GAAAC,OAAA,CAAA5C,OAAA,GAEc,IAAA6C,aAAI,EAAEV,OAAQ,CAAC"}
|
|
1
|
+
{"version":3,"names":["_classnames","_interopRequireDefault","require","_element","_components","_router","_compose","_i18n","_sidebarNavigationScreenMain","_sidebarNavigationScreenTemplate","_sidebarNavigationScreenPatterns","_sidebarNavigationScreenPattern","_useSyncPathWithUrl","_interopRequireWildcard","_sidebarNavigationScreenNavigationMenus","_sidebarNavigationScreenNavigationMenu","_sidebarNavigationScreenGlobalStyles","_sidebarNavigationScreenTemplatesBrowse","_saveHub","_lockUnlock","_sidebarNavigationScreen","_sidebarDataviews","_sidebarNavigationScreenPage","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","useLocation","unlock","routerPrivateApis","SidebarScreenWrapper","className","props","_react","createElement","__experimentalNavigatorScreen","classNames","SidebarScreens","useSyncPathWithURL","isMobileViewport","useViewportMatch","Fragment","path","title","__","content","Sidebar","params","urlParams","initialPath","useRef","getPathFromURL","__experimentalNavigatorProvider","current","_default","exports","memo"],"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { memo, useRef } from '@wordpress/element';\nimport {\n\t__experimentalNavigatorProvider as NavigatorProvider,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n} from '@wordpress/components';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';\nimport SidebarNavigationScreenTemplate from '../sidebar-navigation-screen-template';\nimport SidebarNavigationScreenPatterns from '../sidebar-navigation-screen-patterns';\nimport SidebarNavigationScreenPattern from '../sidebar-navigation-screen-pattern';\nimport useSyncPathWithURL, {\n\tgetPathFromURL,\n} from '../sync-state-with-url/use-sync-path-with-url';\nimport SidebarNavigationScreenNavigationMenus from '../sidebar-navigation-screen-navigation-menus';\nimport SidebarNavigationScreenNavigationMenu from '../sidebar-navigation-screen-navigation-menu';\nimport SidebarNavigationScreenGlobalStyles from '../sidebar-navigation-screen-global-styles';\nimport SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';\nimport SaveHub from '../save-hub';\nimport { unlock } from '../../lock-unlock';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport DataViewsSidebarContent from '../sidebar-dataviews';\nimport SidebarNavigationScreenPage from '../sidebar-navigation-screen-page';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nfunction SidebarScreenWrapper( { className, ...props } ) {\n\treturn (\n\t\t<NavigatorScreen\n\t\t\tclassName={ classNames(\n\t\t\t\t'edit-site-sidebar__screen-wrapper',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nfunction SidebarScreens() {\n\tuseSyncPathWithURL();\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\n\treturn (\n\t\t<>\n\t\t\t<SidebarScreenWrapper path=\"/\">\n\t\t\t\t<SidebarNavigationScreenMain />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/navigation\">\n\t\t\t\t<SidebarNavigationScreenNavigationMenus />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/navigation/:postType/:postId\">\n\t\t\t\t<SidebarNavigationScreenNavigationMenu />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/wp_global_styles\">\n\t\t\t\t<SidebarNavigationScreenGlobalStyles />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/page\">\n\t\t\t\t<SidebarNavigationScreen\n\t\t\t\t\ttitle={ __( 'Manage pages' ) }\n\t\t\t\t\tcontent={ <DataViewsSidebarContent /> }\n\t\t\t\t/>\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/page/:postId\">\n\t\t\t\t<SidebarNavigationScreenPage />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/:postType(wp_template)\">\n\t\t\t\t<SidebarNavigationScreenTemplatesBrowse />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t{ ! isMobileViewport && (\n\t\t\t\t<SidebarScreenWrapper path=\"/patterns\">\n\t\t\t\t\t<SidebarNavigationScreenPatterns />\n\t\t\t\t</SidebarScreenWrapper>\n\t\t\t) }\n\t\t\t<SidebarScreenWrapper path=\"/:postType(wp_template_part)/all\">\n\t\t\t\t<SidebarNavigationScreenTemplatesBrowse />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/:postType(wp_template_part|wp_block)/:postId\">\n\t\t\t\t<SidebarNavigationScreenPattern />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/:postType(wp_template)/:postId\">\n\t\t\t\t<SidebarNavigationScreenTemplate />\n\t\t\t</SidebarScreenWrapper>\n\t\t</>\n\t);\n}\n\nfunction Sidebar() {\n\tconst { params: urlParams } = useLocation();\n\tconst initialPath = useRef( getPathFromURL( urlParams ) );\n\n\treturn (\n\t\t<>\n\t\t\t<NavigatorProvider\n\t\t\t\tclassName=\"edit-site-sidebar__content\"\n\t\t\t\tinitialPath={ initialPath.current }\n\t\t\t>\n\t\t\t\t<SidebarScreens />\n\t\t\t</NavigatorProvider>\n\t\t\t<SaveHub />\n\t\t</>\n\t);\n}\n\nexport default memo( Sidebar );\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA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|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_icons","_constants","DEFAULT_CONFIG_PER_VIEW_TYPE","exports","LAYOUT_TABLE","primaryField","LAYOUT_GRID","mediaField","LAYOUT_LIST","DEFAULT_PAGE_BASE","type","search","filters","page","perPage","sort","field","direction","hiddenFields","layout","DEFAULT_VIEWS","title","__","slug","icon","pages","view","drafts","operator","OPERATOR_IS_ANY","value","trash"],"sources":["@wordpress/edit-site/src/components/sidebar-dataviews/default-views.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { trash, pages, drafts } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport {\n\tLAYOUT_LIST,\n\tLAYOUT_TABLE,\n\tLAYOUT_GRID,\n\tOPERATOR_IS_ANY,\n} from '../../utils/constants';\n\nexport const DEFAULT_CONFIG_PER_VIEW_TYPE = {\n\t[ LAYOUT_TABLE ]: {\n\t\tprimaryField: 'title',\n\t},\n\t[ LAYOUT_GRID ]: {\n\t\tmediaField: 'featured-image',\n\t\tprimaryField: 'title',\n\t},\n\t[ LAYOUT_LIST ]: {\n\t\tprimaryField: 'title',\n\t\tmediaField: 'featured-image',\n\t},\n};\n\nconst DEFAULT_PAGE_BASE = {\n\ttype:
|
|
1
|
+
{"version":3,"names":["_i18n","require","_icons","_constants","DEFAULT_CONFIG_PER_VIEW_TYPE","exports","LAYOUT_TABLE","primaryField","LAYOUT_GRID","mediaField","LAYOUT_LIST","DEFAULT_PAGE_BASE","type","search","filters","page","perPage","sort","field","direction","hiddenFields","layout","DEFAULT_VIEWS","title","__","slug","icon","pages","view","drafts","operator","OPERATOR_IS_ANY","value","trash"],"sources":["@wordpress/edit-site/src/components/sidebar-dataviews/default-views.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { trash, pages, drafts } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport {\n\tLAYOUT_LIST,\n\tLAYOUT_TABLE,\n\tLAYOUT_GRID,\n\tOPERATOR_IS_ANY,\n} from '../../utils/constants';\n\nexport const DEFAULT_CONFIG_PER_VIEW_TYPE = {\n\t[ LAYOUT_TABLE ]: {\n\t\tprimaryField: 'title',\n\t},\n\t[ LAYOUT_GRID ]: {\n\t\tmediaField: 'featured-image',\n\t\tprimaryField: 'title',\n\t},\n\t[ LAYOUT_LIST ]: {\n\t\tprimaryField: 'title',\n\t\tmediaField: 'featured-image',\n\t},\n};\n\nconst DEFAULT_PAGE_BASE = {\n\ttype: LAYOUT_LIST,\n\tsearch: '',\n\tfilters: [],\n\tpage: 1,\n\tperPage: 20,\n\tsort: {\n\t\tfield: 'date',\n\t\tdirection: 'desc',\n\t},\n\t// All fields are visible by default, so it's\n\t// better to keep track of the hidden ones.\n\thiddenFields: [ 'date', 'featured-image' ],\n\tlayout: {\n\t\t...DEFAULT_CONFIG_PER_VIEW_TYPE[ LAYOUT_TABLE ],\n\t},\n};\n\nexport const DEFAULT_VIEWS = {\n\tpage: [\n\t\t{\n\t\t\ttitle: __( 'All pages' ),\n\t\t\tslug: 'all',\n\t\t\ticon: pages,\n\t\t\tview: DEFAULT_PAGE_BASE,\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Drafts' ),\n\t\t\tslug: 'drafts',\n\t\t\ticon: drafts,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_PAGE_BASE,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'draft',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Trash' ),\n\t\t\tslug: 'trash',\n\t\t\ticon: trash,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_PAGE_BASE,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\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;MACL,GAAGjB,iBAAiB;MACpBG,OAAO,EAAE,CACR;QACCI,KAAK,EAAE,QAAQ;QACfY,QAAQ,EAAEC,0BAAe;QACzBC,KAAK,EAAE;MACR,CAAC;IAEH;EACD,CAAC,EACD;IACCT,KAAK,EAAE,IAAAC,QAAE,EAAE,OAAQ,CAAC;IACpBC,IAAI,EAAE,OAAO;IACbC,IAAI,EAAEO,YAAK;IACXL,IAAI,EAAE;MACL,GAAGjB,iBAAiB;MACpBG,OAAO,EAAE,CACR;QACCI,KAAK,EAAE,QAAQ;QACfY,QAAQ,EAAEC,0BAAe;QACzBC,KAAK,EAAE;MACR,CAAC;IAEH;EACD,CAAC;AAEH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_router","_defaultViews","_lockUnlock","_dataviewItem","_interopRequireDefault","_customDataviewsList","useLocation","unlock","routerPrivateApis","PATH_TO_TYPE","DataViewsSidebarContent","params","path","activeView","isCustom","isCustomBoolean","type","_react","createElement","Fragment","__experimentalItemGroup","DEFAULT_VIEWS","map","dataview","default","key","slug","title","icon","view","isActive","window","__experimentalAdminViews"],"sources":["@wordpress/edit-site/src/components/sidebar-dataviews/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\n\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n/**\n * Internal dependencies\n */\n\nimport { DEFAULT_VIEWS } from './default-views';\nimport { unlock } from '../../lock-unlock';\nconst { useLocation } = unlock( routerPrivateApis );\nimport DataViewItem from './dataview-item';\nimport CustomDataViewsList from './custom-dataviews-list';\n\nconst PATH_TO_TYPE = {\n\t'/
|
|
1
|
+
{"version":3,"names":["_components","require","_router","_defaultViews","_lockUnlock","_dataviewItem","_interopRequireDefault","_customDataviewsList","useLocation","unlock","routerPrivateApis","PATH_TO_TYPE","DataViewsSidebarContent","params","path","activeView","isCustom","isCustomBoolean","type","_react","createElement","Fragment","__experimentalItemGroup","DEFAULT_VIEWS","map","dataview","default","key","slug","title","icon","view","isActive","window","__experimentalAdminViews"],"sources":["@wordpress/edit-site/src/components/sidebar-dataviews/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\n\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n/**\n * Internal dependencies\n */\n\nimport { DEFAULT_VIEWS } from './default-views';\nimport { unlock } from '../../lock-unlock';\nconst { useLocation } = unlock( routerPrivateApis );\nimport DataViewItem from './dataview-item';\nimport CustomDataViewsList from './custom-dataviews-list';\n\nconst PATH_TO_TYPE = {\n\t'/page': 'page',\n};\n\nexport default function DataViewsSidebarContent() {\n\tconst {\n\t\tparams: { path, activeView = 'all', isCustom = 'false' },\n\t} = useLocation();\n\tif ( ! path || ! PATH_TO_TYPE[ path ] ) {\n\t\treturn null;\n\t}\n\tconst isCustomBoolean = isCustom === 'true';\n\tconst type = PATH_TO_TYPE[ path ];\n\n\treturn (\n\t\t<>\n\t\t\t<ItemGroup>\n\t\t\t\t{ DEFAULT_VIEWS[ type ].map( ( dataview ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<DataViewItem\n\t\t\t\t\t\t\tkey={ dataview.slug }\n\t\t\t\t\t\t\tslug={ dataview.slug }\n\t\t\t\t\t\t\ttitle={ dataview.title }\n\t\t\t\t\t\t\ticon={ dataview.icon }\n\t\t\t\t\t\t\ttype={ dataview.view.type }\n\t\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\t\t! isCustomBoolean &&\n\t\t\t\t\t\t\t\tdataview.slug === activeView\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisCustom={ false }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</ItemGroup>\n\t\t\t{ window?.__experimentalAdminViews && (\n\t\t\t\t<CustomDataViewsList\n\t\t\t\t\tactiveView={ activeView }\n\t\t\t\t\ttype={ type }\n\t\t\t\t\tis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,IAAI,EAAGO,QAAQ,CAACM,IAAI,CAACb,IAAM;MAC3Bc,QAAQ,EACP,CAAEf,eAAe,IACjBQ,QAAQ,CAACG,IAAI,KAAKb,UAClB;MACDC,QAAQ,EAAG;IAAO,CAClB,CAAC;EAEJ,CAAE,CACQ,CAAC,EACViB,MAAM,EAAEC,wBAAwB,IACjC,IAAAf,MAAA,CAAAC,aAAA,EAACb,oBAAA,CAAAmB,OAAmB;IACnBX,UAAU,EAAGA,UAAY;IACzBG,IAAI,EAAGA,IAAM;IACbF,QAAQ;EAAA,CACR,CAED,CAAC;AAEL"}
|
|
@@ -21,7 +21,6 @@ var _constants = require("../../store/constants");
|
|
|
21
21
|
var _settingsHeader = _interopRequireDefault(require("./settings-header"));
|
|
22
22
|
var _pagePanels = _interopRequireDefault(require("./page-panels"));
|
|
23
23
|
var _templatePanel = _interopRequireDefault(require("./template-panel"));
|
|
24
|
-
var _pluginTemplateSettingPanel = _interopRequireDefault(require("../plugin-template-setting-panel"));
|
|
25
24
|
var _constants2 = require("./constants");
|
|
26
25
|
var _store = require("../../store");
|
|
27
26
|
var _lockUnlock = require("../../lock-unlock");
|
|
@@ -92,7 +91,7 @@ const FillContents = ({
|
|
|
92
91
|
}, (0, _react.createElement)(Tabs.TabPanel, {
|
|
93
92
|
tabId: _constants2.SIDEBAR_TEMPLATE,
|
|
94
93
|
focusable: false
|
|
95
|
-
}, isEditingPage ? (0, _react.createElement)(_pagePanels.default, null) : (0, _react.createElement)(_templatePanel.default, null)
|
|
94
|
+
}, isEditingPage ? (0, _react.createElement)(_pagePanels.default, null) : (0, _react.createElement)(_templatePanel.default, null)), (0, _react.createElement)(Tabs.TabPanel, {
|
|
96
95
|
tabId: _constants2.SIDEBAR_BLOCK,
|
|
97
96
|
focusable: false
|
|
98
97
|
}, (0, _react.createElement)(InspectorSlot, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_i18n","_icons","_element","_data","_interface","_blockEditor","_coreData","_defaultSidebar","_interopRequireDefault","_globalStylesSidebar","_constants","_settingsHeader","_pagePanels","_templatePanel","_pluginTemplateSettingPanel","_constants2","_store","_lockUnlock","Tabs","unlock","componentsPrivateApis","Slot","InspectorSlot","Fill","InspectorFill","createSlotFill","SidebarInspectorFill","exports","FillContents","sidebarName","isEditingPage","supportsGlobalStyles","tabListRef","useRef","tabsContextValue","useContext","Context","useEffect","tabsElements","Array","from","current","querySelectorAll","selectedTabElement","find","element","getAttribute","activeElement","ownerDocument","tabsHasFocus","some","id","focus","_react","createElement","Fragment","default","identifier","title","__","icon","isRTL","drawerLeft","drawerRight","closeLabel","header","Provider","value","ref","headerClassName","className","TabPanel","tabId","SIDEBAR_TEMPLATE","focusable","SIDEBAR_BLOCK","bubblesVirtually","SidebarComplementaryAreaFills","sidebar","isEditorSidebarOpened","hasBlockSelection","isEditorOpen","useSelect","select","_sidebar","interfaceStore","getActiveComplementaryArea","STORE_NAME","_isEditorSidebarOpened","includes","getCanvasMode","editSiteStore","blockEditorStore","getBlockSelectionStart","coreStore","getCurrentTheme","is_block_theme","isPage","enableComplementaryArea","useDispatch","onTabSelect","useCallback","newSelectedTabId","selectedTabId","onSelect","selectOnMove"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateSlotFill,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { useCallback, useContext, useEffect, useRef } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport DefaultSidebar from './default-sidebar';\nimport GlobalStylesSidebar from './global-styles-sidebar';\nimport { STORE_NAME } from '../../store/constants';\nimport SettingsHeader from './settings-header';\nimport PagePanels from './page-panels';\nimport TemplatePanel from './template-panel';\nimport PluginTemplateSettingPanel from '../plugin-template-setting-panel';\nimport { SIDEBAR_BLOCK, SIDEBAR_TEMPLATE } from './constants';\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nconst { Slot: InspectorSlot, Fill: InspectorFill } = createSlotFill(\n\t'EditSiteSidebarInspector'\n);\nexport const SidebarInspectorFill = InspectorFill;\n\nconst FillContents = ( {\n\tsidebarName,\n\tisEditingPage,\n\tsupportsGlobalStyles,\n} ) => {\n\tconst tabListRef = useRef( null );\n\t// Because `DefaultSidebar` renders a `ComplementaryArea`, we\n\t// need to forward the `Tabs` context so it can be passed through the\n\t// underlying slot/fill.\n\tconst tabsContextValue = useContext( Tabs.Context );\n\n\t// This effect addresses a race condition caused by tabbing from the last\n\t// block in the editor into the settings sidebar. Without this effect, the\n\t// selected tab and browser focus can become separated in an unexpected way.\n\t// (e.g the \"block\" tab is focused, but the \"post\" tab is selected).\n\tuseEffect( () => {\n\t\tconst tabsElements = Array.from(\n\t\t\ttabListRef.current?.querySelectorAll( '[role=\"tab\"]' ) || []\n\t\t);\n\t\tconst selectedTabElement = tabsElements.find(\n\t\t\t// We are purposefully using a custom `data-tab-id` attribute here\n\t\t\t// because we don't want rely on any assumptions about `Tabs`\n\t\t\t// component internals.\n\t\t\t( element ) => element.getAttribute( 'data-tab-id' ) === sidebarName\n\t\t);\n\t\tconst activeElement = selectedTabElement?.ownerDocument.activeElement;\n\t\tconst tabsHasFocus = tabsElements.some( ( element ) => {\n\t\t\treturn activeElement && activeElement.id === element.id;\n\t\t} );\n\t\tif (\n\t\t\ttabsHasFocus &&\n\t\t\tselectedTabElement &&\n\t\t\tselectedTabElement.id !== activeElement?.id\n\t\t) {\n\t\t\tselectedTabElement?.focus();\n\t\t}\n\t}, [ sidebarName ] );\n\n\treturn (\n\t\t<>\n\t\t\t<DefaultSidebar\n\t\t\t\tidentifier={ sidebarName }\n\t\t\t\ttitle={ __( 'Settings' ) }\n\t\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\t\theader={\n\t\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t\t<SettingsHeader ref={ tabListRef } />\n\t\t\t\t\t</Tabs.Context.Provider>\n\t\t\t\t}\n\t\t\t\theaderClassName=\"edit-site-sidebar-edit-mode__panel-tabs\"\n\t\t\t\t// This classname is added so we can apply a corrective negative\n\t\t\t\t// margin to the panel.\n\t\t\t\t// see https://github.com/WordPress/gutenberg/pull/55360#pullrequestreview-1737671049\n\t\t\t\tclassName=\"edit-site-sidebar__panel\"\n\t\t\t>\n\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\ttabId={ SIDEBAR_TEMPLATE }\n\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isEditingPage ? <PagePanels /> : <TemplatePanel /> }\n\t\t\t\t\t\t<PluginTemplateSettingPanel.Slot />\n\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t\t<Tabs.TabPanel tabId={ SIDEBAR_BLOCK } focusable={ false }>\n\t\t\t\t\t\t<InspectorSlot bubblesVirtually />\n\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t</Tabs.Context.Provider>\n\t\t\t</DefaultSidebar>\n\t\t\t{ supportsGlobalStyles && <GlobalStylesSidebar /> }\n\t\t</>\n\t);\n};\n\nexport function SidebarComplementaryAreaFills() {\n\tconst {\n\t\tsidebar,\n\t\tisEditorSidebarOpened,\n\t\thasBlockSelection,\n\t\tsupportsGlobalStyles,\n\t\tisEditingPage,\n\t\tisEditorOpen,\n\t} = useSelect( ( select ) => {\n\t\tconst _sidebar =\n\t\t\tselect( interfaceStore ).getActiveComplementaryArea( STORE_NAME );\n\n\t\tconst _isEditorSidebarOpened = [\n\t\t\tSIDEBAR_BLOCK,\n\t\t\tSIDEBAR_TEMPLATE,\n\t\t].includes( _sidebar );\n\t\tconst { getCanvasMode } = unlock( select( editSiteStore ) );\n\n\t\treturn {\n\t\t\tsidebar: _sidebar,\n\t\t\tisEditorSidebarOpened: _isEditorSidebarOpened,\n\t\t\thasBlockSelection:\n\t\t\t\t!! select( blockEditorStore ).getBlockSelectionStart(),\n\t\t\tsupportsGlobalStyles:\n\t\t\t\tselect( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t\tisEditingPage: select( editSiteStore ).isPage(),\n\t\t\tisEditorOpen: getCanvasMode() === 'edit',\n\t\t};\n\t}, [] );\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tuseEffect( () => {\n\t\t// Don't automatically switch tab when the sidebar is closed or when we\n\t\t// are focused on page content.\n\t\tif ( ! isEditorSidebarOpened ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( hasBlockSelection ) {\n\t\t\tif ( ! isEditingPage ) {\n\t\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_BLOCK );\n\t\t\t}\n\t\t} else {\n\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_TEMPLATE );\n\t\t}\n\t}, [\n\t\thasBlockSelection,\n\t\tisEditorSidebarOpened,\n\t\tisEditingPage,\n\t\tenableComplementaryArea,\n\t] );\n\n\tlet sidebarName = sidebar;\n\tif ( ! isEditorSidebarOpened ) {\n\t\tsidebarName = hasBlockSelection ? SIDEBAR_BLOCK : SIDEBAR_TEMPLATE;\n\t}\n\n\t// `newSelectedTabId` could technically be falsey if no tab is selected (i.e.\n\t// the initial render) or when we don't want a tab displayed (i.e. the\n\t// sidebar is closed). These cases should both be covered by the `!!` check\n\t// below, so we shouldn't need any additional falsey handling.\n\tconst onTabSelect = useCallback(\n\t\t( newSelectedTabId ) => {\n\t\t\tif ( !! newSelectedTabId ) {\n\t\t\t\tenableComplementaryArea( STORE_NAME, newSelectedTabId );\n\t\t\t}\n\t\t},\n\t\t[ enableComplementaryArea ]\n\t);\n\n\treturn (\n\t\t<Tabs\n\t\t\t// Due to how this component is controlled (via a value from the\n\t\t\t// edit-site store), when the sidebar closes the currently selected\n\t\t\t// tab can't be found. This causes the component to continuously reset\n\t\t\t// the selection to `null` in an infinite loop. Proactively setting\n\t\t\t// the selected tab to `null` avoids that.\n\t\t\tselectedTabId={\n\t\t\t\tisEditorOpen && isEditorSidebarOpened ? sidebarName : null\n\t\t\t}\n\t\t\tonSelect={ onTabSelect }\n\t\t\tselectOnMove={ false }\n\t\t>\n\t\t\t<FillContents\n\t\t\t\tsidebarName={ sidebarName }\n\t\t\t\tisEditingPage={ isEditingPage }\n\t\t\t\tsupportsGlobalStyles={ supportsGlobalStyles }\n\t\t\t/>\n\t\t</Tabs>\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AAKA,IAAAQ,eAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,oBAAA,GAAAD,sBAAA,CAAAT,OAAA;AACA,IAAAW,UAAA,GAAAX,OAAA;AACA,IAAAY,eAAA,GAAAH,sBAAA,CAAAT,OAAA;AACA,IAAAa,WAAA,GAAAJ,sBAAA,CAAAT,OAAA;AACA,IAAAc,cAAA,GAAAL,sBAAA,CAAAT,OAAA;AACA,IAAAe,2BAAA,GAAAN,sBAAA,CAAAT,OAAA;AACA,IAAAgB,WAAA,GAAAhB,OAAA;AACA,IAAAiB,MAAA,GAAAjB,OAAA;AACA,IAAAkB,WAAA,GAAAlB,OAAA;AA3BA;AACA;AACA;;AAaA;AACA;AACA;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ACtBoE,uBAAuB,CAAEX,qBAAU,EAAEZ,yBAAc,CAAC;MACrD;IACD,CAAC,MAAM;MACNuB,uBAAuB,CAAEX,qBAAU,EAAEd,4BAAiB,CAAC;IACxD;EACD,CAAC,EAAE,CACFO,iBAAiB,EACjBD,qBAAqB,EACrBjD,aAAa,EACboE,uBAAuB,CACtB,CAAC;EAEH,IAAIrE,WAAW,GAAGiD,OAAO;EACzB,IAAK,CAAEC,qBAAqB,EAAG;IAC9BlD,WAAW,GAAGmD,iBAAiB,GAAGL,yBAAa,GAAGF,4BAAgB;EACnE;;EAEA;EACA;EACA;EACA;EACA,MAAM2B,WAAW,GAAG,IAAAC,oBAAW,EAC5BC,gBAAgB,IAAM;IACvB,IAAK,CAAC,CAAEA,gBAAgB,EAAG;MAC1BJ,uBAAuB,CAAEX,qBAAU,EAAEe,gBAAiB,CAAC;IACxD;EACD,CAAC,EACD,CAAEJ,uBAAuB,CAC1B,CAAC;EAED,OACC,IAAA7C,MAAA,CAAAC,aAAA,EAACpC;EACA;EACA;EACA;EACA;EACA;EAAA;IACAqF,aAAa,EACZtB,YAAY,IAAIF,qBAAqB,GAAGlD,WAAW,GAAG,IACtD;IACD2E,QAAQ,EAAGJ,WAAa;IACxBK,YAAY,EAAG;EAAO,GAEtB,IAAApD,MAAA,CAAAC,aAAA,EAAC1B,YAAY;IACZC,WAAW,EAAGA,WAAa;IAC3BC,aAAa,EAAGA,aAAe;IAC/BC,oBAAoB,EAAGA;EAAsB,CAC7C,CACI,CAAC;AAET"}
|
|
1
|
+
{"version":3,"names":["_components","require","_i18n","_icons","_element","_data","_interface","_blockEditor","_coreData","_defaultSidebar","_interopRequireDefault","_globalStylesSidebar","_constants","_settingsHeader","_pagePanels","_templatePanel","_constants2","_store","_lockUnlock","Tabs","unlock","componentsPrivateApis","Slot","InspectorSlot","Fill","InspectorFill","createSlotFill","SidebarInspectorFill","exports","FillContents","sidebarName","isEditingPage","supportsGlobalStyles","tabListRef","useRef","tabsContextValue","useContext","Context","useEffect","tabsElements","Array","from","current","querySelectorAll","selectedTabElement","find","element","getAttribute","activeElement","ownerDocument","tabsHasFocus","some","id","focus","_react","createElement","Fragment","default","identifier","title","__","icon","isRTL","drawerLeft","drawerRight","closeLabel","header","Provider","value","ref","headerClassName","className","TabPanel","tabId","SIDEBAR_TEMPLATE","focusable","SIDEBAR_BLOCK","bubblesVirtually","SidebarComplementaryAreaFills","sidebar","isEditorSidebarOpened","hasBlockSelection","isEditorOpen","useSelect","select","_sidebar","interfaceStore","getActiveComplementaryArea","STORE_NAME","_isEditorSidebarOpened","includes","getCanvasMode","editSiteStore","blockEditorStore","getBlockSelectionStart","coreStore","getCurrentTheme","is_block_theme","isPage","enableComplementaryArea","useDispatch","onTabSelect","useCallback","newSelectedTabId","selectedTabId","onSelect","selectOnMove"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateSlotFill,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { useCallback, useContext, useEffect, useRef } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport DefaultSidebar from './default-sidebar';\nimport GlobalStylesSidebar from './global-styles-sidebar';\nimport { STORE_NAME } from '../../store/constants';\nimport SettingsHeader from './settings-header';\nimport PagePanels from './page-panels';\nimport TemplatePanel from './template-panel';\nimport { SIDEBAR_BLOCK, SIDEBAR_TEMPLATE } from './constants';\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nconst { Slot: InspectorSlot, Fill: InspectorFill } = createSlotFill(\n\t'EditSiteSidebarInspector'\n);\nexport const SidebarInspectorFill = InspectorFill;\n\nconst FillContents = ( {\n\tsidebarName,\n\tisEditingPage,\n\tsupportsGlobalStyles,\n} ) => {\n\tconst tabListRef = useRef( null );\n\t// Because `DefaultSidebar` renders a `ComplementaryArea`, we\n\t// need to forward the `Tabs` context so it can be passed through the\n\t// underlying slot/fill.\n\tconst tabsContextValue = useContext( Tabs.Context );\n\n\t// This effect addresses a race condition caused by tabbing from the last\n\t// block in the editor into the settings sidebar. Without this effect, the\n\t// selected tab and browser focus can become separated in an unexpected way.\n\t// (e.g the \"block\" tab is focused, but the \"post\" tab is selected).\n\tuseEffect( () => {\n\t\tconst tabsElements = Array.from(\n\t\t\ttabListRef.current?.querySelectorAll( '[role=\"tab\"]' ) || []\n\t\t);\n\t\tconst selectedTabElement = tabsElements.find(\n\t\t\t// We are purposefully using a custom `data-tab-id` attribute here\n\t\t\t// because we don't want rely on any assumptions about `Tabs`\n\t\t\t// component internals.\n\t\t\t( element ) => element.getAttribute( 'data-tab-id' ) === sidebarName\n\t\t);\n\t\tconst activeElement = selectedTabElement?.ownerDocument.activeElement;\n\t\tconst tabsHasFocus = tabsElements.some( ( element ) => {\n\t\t\treturn activeElement && activeElement.id === element.id;\n\t\t} );\n\t\tif (\n\t\t\ttabsHasFocus &&\n\t\t\tselectedTabElement &&\n\t\t\tselectedTabElement.id !== activeElement?.id\n\t\t) {\n\t\t\tselectedTabElement?.focus();\n\t\t}\n\t}, [ sidebarName ] );\n\n\treturn (\n\t\t<>\n\t\t\t<DefaultSidebar\n\t\t\t\tidentifier={ sidebarName }\n\t\t\t\ttitle={ __( 'Settings' ) }\n\t\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\t\theader={\n\t\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t\t<SettingsHeader ref={ tabListRef } />\n\t\t\t\t\t</Tabs.Context.Provider>\n\t\t\t\t}\n\t\t\t\theaderClassName=\"edit-site-sidebar-edit-mode__panel-tabs\"\n\t\t\t\t// This classname is added so we can apply a corrective negative\n\t\t\t\t// margin to the panel.\n\t\t\t\t// see https://github.com/WordPress/gutenberg/pull/55360#pullrequestreview-1737671049\n\t\t\t\tclassName=\"edit-site-sidebar__panel\"\n\t\t\t>\n\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\ttabId={ SIDEBAR_TEMPLATE }\n\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isEditingPage ? <PagePanels /> : <TemplatePanel /> }\n\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t\t<Tabs.TabPanel tabId={ SIDEBAR_BLOCK } focusable={ false }>\n\t\t\t\t\t\t<InspectorSlot bubblesVirtually />\n\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t</Tabs.Context.Provider>\n\t\t\t</DefaultSidebar>\n\t\t\t{ supportsGlobalStyles && <GlobalStylesSidebar /> }\n\t\t</>\n\t);\n};\n\nexport function SidebarComplementaryAreaFills() {\n\tconst {\n\t\tsidebar,\n\t\tisEditorSidebarOpened,\n\t\thasBlockSelection,\n\t\tsupportsGlobalStyles,\n\t\tisEditingPage,\n\t\tisEditorOpen,\n\t} = useSelect( ( select ) => {\n\t\tconst _sidebar =\n\t\t\tselect( interfaceStore ).getActiveComplementaryArea( STORE_NAME );\n\n\t\tconst _isEditorSidebarOpened = [\n\t\t\tSIDEBAR_BLOCK,\n\t\t\tSIDEBAR_TEMPLATE,\n\t\t].includes( _sidebar );\n\t\tconst { getCanvasMode } = unlock( select( editSiteStore ) );\n\n\t\treturn {\n\t\t\tsidebar: _sidebar,\n\t\t\tisEditorSidebarOpened: _isEditorSidebarOpened,\n\t\t\thasBlockSelection:\n\t\t\t\t!! select( blockEditorStore ).getBlockSelectionStart(),\n\t\t\tsupportsGlobalStyles:\n\t\t\t\tselect( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t\tisEditingPage: select( editSiteStore ).isPage(),\n\t\t\tisEditorOpen: getCanvasMode() === 'edit',\n\t\t};\n\t}, [] );\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tuseEffect( () => {\n\t\t// Don't automatically switch tab when the sidebar is closed or when we\n\t\t// are focused on page content.\n\t\tif ( ! isEditorSidebarOpened ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( hasBlockSelection ) {\n\t\t\tif ( ! isEditingPage ) {\n\t\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_BLOCK );\n\t\t\t}\n\t\t} else {\n\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_TEMPLATE );\n\t\t}\n\t}, [\n\t\thasBlockSelection,\n\t\tisEditorSidebarOpened,\n\t\tisEditingPage,\n\t\tenableComplementaryArea,\n\t] );\n\n\tlet sidebarName = sidebar;\n\tif ( ! isEditorSidebarOpened ) {\n\t\tsidebarName = hasBlockSelection ? SIDEBAR_BLOCK : SIDEBAR_TEMPLATE;\n\t}\n\n\t// `newSelectedTabId` could technically be falsey if no tab is selected (i.e.\n\t// the initial render) or when we don't want a tab displayed (i.e. the\n\t// sidebar is closed). These cases should both be covered by the `!!` check\n\t// below, so we shouldn't need any additional falsey handling.\n\tconst onTabSelect = useCallback(\n\t\t( newSelectedTabId ) => {\n\t\t\tif ( !! newSelectedTabId ) {\n\t\t\t\tenableComplementaryArea( STORE_NAME, newSelectedTabId );\n\t\t\t}\n\t\t},\n\t\t[ enableComplementaryArea ]\n\t);\n\n\treturn (\n\t\t<Tabs\n\t\t\t// Due to how this component is controlled (via a value from the\n\t\t\t// edit-site store), when the sidebar closes the currently selected\n\t\t\t// tab can't be found. This causes the component to continuously reset\n\t\t\t// the selection to `null` in an infinite loop. Proactively setting\n\t\t\t// the selected tab to `null` avoids that.\n\t\t\tselectedTabId={\n\t\t\t\tisEditorOpen && isEditorSidebarOpened ? sidebarName : null\n\t\t\t}\n\t\t\tonSelect={ onTabSelect }\n\t\t\tselectOnMove={ false }\n\t\t>\n\t\t\t<FillContents\n\t\t\t\tsidebarName={ sidebarName }\n\t\t\t\tisEditingPage={ isEditingPage }\n\t\t\t\tsupportsGlobalStyles={ supportsGlobalStyles }\n\t\t\t/>\n\t\t</Tabs>\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AAKA,IAAAQ,eAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,oBAAA,GAAAD,sBAAA,CAAAT,OAAA;AACA,IAAAW,UAAA,GAAAX,OAAA;AACA,IAAAY,eAAA,GAAAH,sBAAA,CAAAT,OAAA;AACA,IAAAa,WAAA,GAAAJ,sBAAA,CAAAT,OAAA;AACA,IAAAc,cAAA,GAAAL,sBAAA,CAAAT,OAAA;AACA,IAAAe,WAAA,GAAAf,OAAA;AACA,IAAAgB,MAAA,GAAAhB,OAAA;AACA,IAAAiB,WAAA,GAAAjB,OAAA;AA1BA;AACA;AACA;;AAaA;AACA;AACA;;AAWA,MAAM;EAAEkB;AAAK,CAAC,GAAG,IAAAC,kBAAM,EAAEC,uBAAsB,CAAC;AAEhD,MAAM;EAAEC,IAAI,EAAEC,aAAa;EAAEC,IAAI,EAAEC;AAAc,CAAC,GAAG,IAAAC,0BAAc,EAClE,0BACD,CAAC;AACM,MAAMC,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,GAAGF,aAAa;AAEjD,MAAMI,YAAY,GAAGA,CAAE;EACtBC,WAAW;EACXC,aAAa;EACbC;AACD,CAAC,KAAM;EACN,MAAMC,UAAU,GAAG,IAAAC,eA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CAAC,CAAEA,gBAAgB,EAAG;MAC1BJ,uBAAuB,CAAEX,qBAAU,EAAEe,gBAAiB,CAAC;IACxD;EACD,CAAC,EACD,CAAEJ,uBAAuB,CAC1B,CAAC;EAED,OACC,IAAA7C,MAAA,CAAAC,aAAA,EAACpC;EACA;EACA;EACA;EACA;EACA;EAAA;IACAqF,aAAa,EACZtB,YAAY,IAAIF,qBAAqB,GAAGlD,WAAW,GAAG,IACtD;IACD2E,QAAQ,EAAGJ,WAAa;IACxBK,YAAY,EAAG;EAAO,GAEtB,IAAApD,MAAA,CAAAC,aAAA,EAAC1B,YAAY;IACZC,WAAW,EAAGA,WAAa;IAC3BC,aAAa,EAAGA,aAAe;IAC/BC,oBAAoB,EAAGA;EAAsB,CAC7C,CACI,CAAC;AAET"}
|
|
@@ -7,17 +7,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = PagePanels;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _components = require("@wordpress/components");
|
|
10
|
-
var _icons = require("@wordpress/icons");
|
|
11
10
|
var _i18n = require("@wordpress/i18n");
|
|
12
|
-
var _date = require("@wordpress/date");
|
|
13
11
|
var _data = require("@wordpress/data");
|
|
14
12
|
var _coreData = require("@wordpress/core-data");
|
|
15
|
-
var _htmlEntities = require("@wordpress/html-entities");
|
|
16
13
|
var _editor = require("@wordpress/editor");
|
|
17
14
|
var _store = require("../../../store");
|
|
18
|
-
var _sidebarCard = _interopRequireDefault(require("../sidebar-card"));
|
|
19
15
|
var _pageContent = _interopRequireDefault(require("./page-content"));
|
|
20
16
|
var _pageSummary = _interopRequireDefault(require("./page-summary"));
|
|
17
|
+
var _lockUnlock = require("../../../lock-unlock");
|
|
21
18
|
/**
|
|
22
19
|
* WordPress dependencies
|
|
23
20
|
*/
|
|
@@ -26,6 +23,9 @@ var _pageSummary = _interopRequireDefault(require("./page-summary"));
|
|
|
26
23
|
* Internal dependencies
|
|
27
24
|
*/
|
|
28
25
|
|
|
26
|
+
const {
|
|
27
|
+
PostCardPanel
|
|
28
|
+
} = (0, _lockUnlock.unlock)(_editor.privateApis);
|
|
29
29
|
function PagePanels() {
|
|
30
30
|
const {
|
|
31
31
|
id,
|
|
@@ -34,8 +34,6 @@ function PagePanels() {
|
|
|
34
34
|
status,
|
|
35
35
|
date,
|
|
36
36
|
password,
|
|
37
|
-
title,
|
|
38
|
-
modified,
|
|
39
37
|
renderingMode
|
|
40
38
|
} = (0, _data.useSelect)(select => {
|
|
41
39
|
const {
|
|
@@ -53,26 +51,18 @@ function PagePanels() {
|
|
|
53
51
|
const page = getEditedEntityRecord(...queryArgs);
|
|
54
52
|
return {
|
|
55
53
|
hasResolved: hasFinishedResolution('getEditedEntityRecord', queryArgs),
|
|
56
|
-
title: page?.title,
|
|
57
54
|
id: page?.id,
|
|
58
55
|
type: page?.type,
|
|
59
56
|
status: page?.status,
|
|
60
57
|
date: page?.date,
|
|
61
58
|
password: page?.password,
|
|
62
|
-
modified: page?.modified,
|
|
63
59
|
renderingMode: getRenderingMode()
|
|
64
60
|
};
|
|
65
61
|
}, []);
|
|
66
62
|
if (!hasResolved) {
|
|
67
63
|
return null;
|
|
68
64
|
}
|
|
69
|
-
return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(
|
|
70
|
-
title: (0, _htmlEntities.decodeEntities)(title),
|
|
71
|
-
icon: _icons.page,
|
|
72
|
-
description: (0, _react.createElement)(_components.__experimentalVStack, null, (0, _react.createElement)(_components.__experimentalText, null, (0, _i18n.sprintf)(
|
|
73
|
-
// translators: %s: Human-readable time difference, e.g. "2 days ago".
|
|
74
|
-
(0, _i18n.__)('Last edited %s'), (0, _date.humanTimeDiff)(modified))))
|
|
75
|
-
})), (0, _react.createElement)(_components.PanelBody, {
|
|
65
|
+
return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(PostCardPanel, null), (0, _react.createElement)(_components.PanelBody, {
|
|
76
66
|
title: (0, _i18n.__)('Summary')
|
|
77
67
|
}, (0, _react.createElement)(_pageSummary.default, {
|
|
78
68
|
status: status,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","
|
|
1
|
+
{"version":3,"names":["_components","require","_i18n","_data","_coreData","_editor","_store","_pageContent","_interopRequireDefault","_pageSummary","_lockUnlock","PostCardPanel","unlock","editorPrivateApis","PagePanels","id","type","hasResolved","status","date","password","renderingMode","useSelect","select","getEditedPostContext","editSiteStore","getEditedEntityRecord","hasFinishedResolution","coreStore","getRenderingMode","editorStore","context","queryArgs","postType","postId","page","_react","createElement","Fragment","PanelBody","title","__","default","PluginDocumentSettingPanel","Slot","PostLastRevisionPanel","PostTaxonomiesPanel","PostExcerptPanel","PostDiscussionPanel","PageAttributesPanel"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/page-panels/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { PanelBody } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tPageAttributesPanel,\n\tPluginDocumentSettingPanel,\n\tPostDiscussionPanel,\n\tPostExcerptPanel,\n\tPostLastRevisionPanel,\n\tPostTaxonomiesPanel,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\nimport PageContent from './page-content';\nimport PageSummary from './page-summary';\nimport { unlock } from '../../../lock-unlock';\n\nconst { PostCardPanel } = unlock( editorPrivateApis );\n\nexport default function PagePanels() {\n\tconst { id, type, hasResolved, status, date, password, renderingMode } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getEditedPostContext } = select( editSiteStore );\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getRenderingMode } = select( editorStore );\n\t\t\tconst context = getEditedPostContext();\n\t\t\tconst queryArgs = [ 'postType', context.postType, context.postId ];\n\t\t\tconst page = getEditedEntityRecord( ...queryArgs );\n\t\t\treturn {\n\t\t\t\thasResolved: hasFinishedResolution(\n\t\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t\tqueryArgs\n\t\t\t\t),\n\t\t\t\tid: page?.id,\n\t\t\t\ttype: page?.type,\n\t\t\t\tstatus: page?.status,\n\t\t\t\tdate: page?.date,\n\t\t\t\tpassword: page?.password,\n\t\t\t\trenderingMode: getRenderingMode(),\n\t\t\t};\n\t\t}, [] );\n\n\tif ( ! hasResolved ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<PostCardPanel />\n\t\t\t<PanelBody title={ __( 'Summary' ) }>\n\t\t\t\t<PageSummary\n\t\t\t\t\tstatus={ status }\n\t\t\t\t\tdate={ date }\n\t\t\t\t\tpassword={ password }\n\t\t\t\t\tpostId={ id }\n\t\t\t\t\tpostType={ type }\n\t\t\t\t/>\n\t\t\t</PanelBody>\n\t\t\t<PluginDocumentSettingPanel.Slot />\n\t\t\t{ renderingMode !== 'post-only' && (\n\t\t\t\t<PanelBody title={ __( 'Content' ) }>\n\t\t\t\t\t<PageContent />\n\t\t\t\t</PanelBody>\n\t\t\t) }\n\t\t\t<PostLastRevisionPanel />\n\t\t\t<PostTaxonomiesPanel />\n\t\t\t<PostExcerptPanel />\n\t\t\t<PostDiscussionPanel />\n\t\t\t<PageAttributesPanel />\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAcA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAD,sBAAA,CAAAP,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AAxBA;AACA;AACA;;AA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AyB,MAAA,CAAAC,aAAA,EAACrC,WAAA,CAAAuC,SAAS;IAACC,KAAK,EAAG,IAAAC,QAAE,EAAE,SAAU;EAAG,GACnC,IAAAL,MAAA,CAAAC,aAAA,EAAC5B,YAAA,CAAAiC,OAAW;IACXxB,MAAM,EAAGA,MAAQ;IACjBC,IAAI,EAAGA,IAAM;IACbC,QAAQ,EAAGA,QAAU;IACrBc,MAAM,EAAGnB,EAAI;IACbkB,QAAQ,EAAGjB;EAAM,CACjB,CACS,CAAC,EACZ,IAAAoB,MAAA,CAAAC,aAAA,EAAChC,OAAA,CAAAsC,0BAA0B,CAACC,IAAI,MAAE,CAAC,EACjCvB,aAAa,KAAK,WAAW,IAC9B,IAAAe,MAAA,CAAAC,aAAA,EAACrC,WAAA,CAAAuC,SAAS;IAACC,KAAK,EAAG,IAAAC,QAAE,EAAE,SAAU;EAAG,GACnC,IAAAL,MAAA,CAAAC,aAAA,EAAC9B,YAAA,CAAAmC,OAAW,MAAE,CACJ,CACX,EACD,IAAAN,MAAA,CAAAC,aAAA,EAAChC,OAAA,CAAAwC,qBAAqB,MAAE,CAAC,EACzB,IAAAT,MAAA,CAAAC,aAAA,EAAChC,OAAA,CAAAyC,mBAAmB,MAAE,CAAC,EACvB,IAAAV,MAAA,CAAAC,aAAA,EAAChC,OAAA,CAAA0C,gBAAgB,MAAE,CAAC,EACpB,IAAAX,MAAA,CAAAC,aAAA,EAAChC,OAAA,CAAA2C,mBAAmB,MAAE,CAAC,EACvB,IAAAZ,MAAA,CAAAC,aAAA,EAAChC,OAAA,CAAA4C,mBAAmB,MAAE,CACrB,CAAC;AAEL"}
|
|
@@ -7,7 +7,6 @@ exports.default = PageContent;
|
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _data = require("@wordpress/data");
|
|
9
9
|
var _blockEditor = require("@wordpress/block-editor");
|
|
10
|
-
var _element = require("@wordpress/element");
|
|
11
10
|
var _lockUnlock = require("../../../lock-unlock");
|
|
12
11
|
/**
|
|
13
12
|
* WordPress dependencies
|
|
@@ -20,11 +19,14 @@ var _lockUnlock = require("../../../lock-unlock");
|
|
|
20
19
|
const {
|
|
21
20
|
BlockQuickNavigation
|
|
22
21
|
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
22
|
+
const PAGE_CONTENT_BLOCKS = ['core/post-content', 'core/post-featured-image', 'core/post-title'];
|
|
23
23
|
function PageContent() {
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
const clientIds = (0, _data.useSelect)(select => {
|
|
25
|
+
const {
|
|
26
|
+
getBlocksByName
|
|
27
|
+
} = select(_blockEditor.store);
|
|
28
|
+
return getBlocksByName(PAGE_CONTENT_BLOCKS);
|
|
29
|
+
}, []);
|
|
28
30
|
return (0, _react.createElement)(BlockQuickNavigation, {
|
|
29
31
|
clientIds: clientIds
|
|
30
32
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_blockEditor","
|
|
1
|
+
{"version":3,"names":["_data","require","_blockEditor","_lockUnlock","BlockQuickNavigation","unlock","blockEditorPrivateApis","PAGE_CONTENT_BLOCKS","PageContent","clientIds","useSelect","select","getBlocksByName","blockEditorStore","_react","createElement"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/page-panels/page-content.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../../lock-unlock';\n\nconst { BlockQuickNavigation } = unlock( blockEditorPrivateApis );\n\nconst PAGE_CONTENT_BLOCKS = [\n\t'core/post-content',\n\t'core/post-featured-image',\n\t'core/post-title',\n];\n\nexport default function PageContent() {\n\tconst clientIds = useSelect( ( select ) => {\n\t\tconst { getBlocksByName } = select( blockEditorStore );\n\t\treturn getBlocksByName( PAGE_CONTENT_BLOCKS );\n\t}, [] );\n\treturn <BlockQuickNavigation clientIds={ clientIds } />;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAQA,IAAAE,WAAA,GAAAF,OAAA;AAZA;AACA;AACA;;AAOA;AACA;AACA;;AAGA,MAAM;EAAEG;AAAqB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAEjE,MAAMC,mBAAmB,GAAG,CAC3B,mBAAmB,EACnB,0BAA0B,EAC1B,iBAAiB,CACjB;AAEc,SAASC,WAAWA,CAAA,EAAG;EACrC,MAAMC,SAAS,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC1C,MAAM;MAAEC;IAAgB,CAAC,GAAGD,MAAM,CAAEE,kBAAiB,CAAC;IACtD,OAAOD,eAAe,CAAEL,mBAAoB,CAAC;EAC9C,CAAC,EAAE,EAAG,CAAC;EACP,OAAO,IAAAO,MAAA,CAAAC,aAAA,EAACX,oBAAoB;IAACK,SAAS,EAAGA;EAAW,CAAE,CAAC;AACxD"}
|