@wordpress/edit-site 5.33.0 → 5.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/add-new-page/index.js +3 -0
- package/build/components/add-new-page/index.js.map +1 -1
- package/build/components/add-new-pattern/index.js +8 -7
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js +3 -0
- 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 +3 -1
- package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build/components/block-editor/resize-handle.js +20 -5
- package/build/components/block-editor/resize-handle.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +3 -0
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/editor/index.js +28 -5
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +9 -3
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +7 -2
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +22 -20
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/sort-font-faces.js +6 -2
- package/build/components/global-styles/font-library-modal/utils/sort-font-faces.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +8 -2
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/header-edit-mode/index.js +33 -49
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/index.js +3 -97
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/register.js +0 -49
- package/build/components/keyboard-shortcuts/register.js.map +1 -1
- package/build/components/layout/index.js +7 -4
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/router.js +9 -38
- package/build/components/layout/router.js.map +1 -1
- package/build/components/page-pages/index.js +4 -3
- package/build/components/page-pages/index.js.map +1 -1
- package/build/components/page-patterns/dataviews-pattern-actions.js +11 -7
- package/build/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
- package/build/components/page-patterns/header.js +3 -1
- package/build/components/page-patterns/header.js.map +1 -1
- package/build/components/page-patterns/index.js +20 -49
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +1 -0
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-templates/hooks.js.map +1 -0
- package/build/components/{page-templates-template-parts → page-templates}/index.js +67 -80
- package/build/components/page-templates/index.js.map +1 -0
- package/build/components/pattern-modal/duplicate.js +7 -5
- package/build/components/pattern-modal/duplicate.js.map +1 -1
- package/build/components/plugin-template-setting-panel/index.js +9 -0
- package/build/components/plugin-template-setting-panel/index.js.map +1 -1
- package/build/components/resizable-frame/index.js +9 -6
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +3 -2
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/index.js +40 -9
- package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js +24 -17
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-panel/index.js +2 -5
- package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/index.js +39 -8
- package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/index.js +6 -13
- package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.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/sidebar-navigation-screen-patterns/category-item.js +3 -2
- package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +34 -28
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/index.js +1 -1
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/content.js +3 -3
- package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +5 -35
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -8
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/template-actions/index.js +1 -1
- package/build/components/template-actions/index.js.map +1 -1
- package/build/deprecated.js +55 -0
- package/build/deprecated.js.map +1 -0
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +35 -4
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build/index.js +18 -18
- package/build/index.js.map +1 -1
- package/build/utils/constants.js +1 -2
- package/build/utils/constants.js.map +1 -1
- package/build-module/components/add-new-page/index.js +3 -0
- package/build-module/components/add-new-page/index.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +8 -7
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js +3 -0
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-template-modal-content.js +3 -1
- package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build-module/components/block-editor/resize-handle.js +21 -6
- package/build-module/components/block-editor/resize-handle.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +3 -0
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/editor/index.js +28 -5
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +9 -3
- package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js +7 -2
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +22 -20
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/sort-font-faces.js +6 -2
- package/build-module/components/global-styles/font-library-modal/utils/sort-font-faces.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +8 -2
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +39 -55
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js +5 -99
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/register.js +0 -49
- package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
- package/build-module/components/layout/index.js +7 -4
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/router.js +9 -38
- package/build-module/components/layout/router.js.map +1 -1
- package/build-module/components/page-pages/index.js +5 -4
- package/build-module/components/page-pages/index.js.map +1 -1
- package/build-module/components/page-patterns/dataviews-pattern-actions.js +11 -7
- package/build-module/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
- package/build-module/components/page-patterns/header.js +3 -1
- package/build-module/components/page-patterns/header.js.map +1 -1
- package/build-module/components/page-patterns/index.js +22 -51
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +1 -0
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-templates/hooks.js.map +1 -0
- package/build-module/components/{page-templates-template-parts → page-templates}/index.js +67 -80
- package/build-module/components/page-templates/index.js.map +1 -0
- package/build-module/components/pattern-modal/duplicate.js +7 -5
- package/build-module/components/pattern-modal/duplicate.js.map +1 -1
- package/build-module/components/plugin-template-setting-panel/index.js +8 -0
- package/build-module/components/plugin-template-setting-panel/index.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +9 -6
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +4 -3
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/index.js +43 -12
- package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +25 -17
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/index.js +3 -6
- package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/index.js +40 -9
- package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/index.js +6 -13
- package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +3 -2
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +35 -29
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js +1 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +3 -3
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +5 -35
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -8
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/template-actions/index.js +1 -1
- package/build-module/components/template-actions/index.js.map +1 -1
- package/build-module/deprecated.js +45 -0
- package/build-module/deprecated.js.map +1 -0
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +34 -4
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build-module/index.js +2 -4
- package/build-module/index.js.map +1 -1
- package/build-module/utils/constants.js +0 -1
- package/build-module/utils/constants.js.map +1 -1
- package/build-style/style-rtl.css +79 -125
- package/build-style/style.css +79 -125
- package/package.json +42 -42
- package/src/components/add-new-page/index.js +7 -1
- package/src/components/add-new-pattern/index.js +15 -12
- package/src/components/add-new-template/add-custom-generic-template-modal-content.js +3 -0
- package/src/components/add-new-template/add-custom-template-modal-content.js +3 -1
- package/src/components/block-editor/resize-handle.js +30 -11
- package/src/components/block-editor/style.scss +10 -15
- package/src/components/create-template-part-modal/index.js +3 -0
- package/src/components/editor/index.js +42 -3
- package/src/components/editor/style.scss +6 -1
- package/src/components/global-styles/font-library-modal/context.js +9 -3
- package/src/components/global-styles/font-library-modal/font-collection.js +31 -12
- package/src/components/global-styles/font-library-modal/installed-fonts.js +82 -54
- package/src/components/global-styles/font-library-modal/style.scss +17 -0
- package/src/components/global-styles/font-library-modal/utils/sort-font-faces.js +6 -2
- package/src/components/global-styles/style-variations-container.js +11 -2
- package/src/components/header-edit-mode/index.js +56 -76
- package/src/components/header-edit-mode/more-menu/index.js +8 -145
- package/src/components/header-edit-mode/style.scss +13 -85
- package/src/components/keyboard-shortcuts/register.js +0 -58
- package/src/components/layout/index.js +11 -2
- package/src/components/layout/router.js +9 -49
- package/src/components/page-pages/index.js +14 -4
- package/src/components/page-pages/style.scss +11 -0
- package/src/components/page-patterns/dataviews-pattern-actions.js +8 -9
- package/src/components/page-patterns/header.js +3 -1
- package/src/components/page-patterns/index.js +17 -76
- package/src/components/page-patterns/style.scss +14 -1
- package/src/components/page-patterns/use-patterns.js +1 -0
- package/src/components/{page-templates-template-parts → page-templates}/index.js +23 -46
- package/src/components/{page-templates-template-parts → page-templates}/style.scss +2 -2
- package/src/components/pattern-modal/duplicate.js +4 -3
- package/src/components/plugin-template-setting-panel/index.js +8 -0
- package/src/components/resizable-frame/index.js +4 -3
- package/src/components/sidebar-edit-mode/index.js +13 -2
- package/src/components/sidebar-edit-mode/page-panels/index.js +49 -21
- package/src/components/sidebar-edit-mode/page-panels/page-summary.js +31 -19
- package/src/components/sidebar-edit-mode/template-panel/index.js +2 -12
- package/src/components/sidebar-navigation-screen-page/index.js +48 -9
- package/src/components/sidebar-navigation-screen-pattern/index.js +6 -11
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -1
- package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
- package/src/components/sidebar-navigation-screen-patterns/category-item.js +2 -1
- package/src/components/sidebar-navigation-screen-patterns/index.js +30 -38
- package/src/components/sidebar-navigation-screen-template/index.js +1 -1
- package/src/components/sidebar-navigation-screen-templates-browse/content.js +3 -3
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +7 -39
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -4
- package/src/components/template-actions/index.js +1 -1
- package/src/deprecated.js +42 -0
- package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +69 -16
- package/src/index.js +2 -9
- package/src/style.scss +1 -5
- package/src/utils/constants.js +1 -1
- package/build/components/header-edit-mode/more-menu/copy-content-menu-item.js +0 -59
- package/build/components/header-edit-mode/more-menu/copy-content-menu-item.js.map +0 -1
- package/build/components/header-edit-mode/tools-more-menu-group/index.js +0 -23
- package/build/components/header-edit-mode/tools-more-menu-group/index.js.map +0 -1
- package/build/components/keyboard-shortcuts/edit-mode.js +0 -56
- package/build/components/keyboard-shortcuts/edit-mode.js.map +0 -1
- package/build/components/page-templates-template-parts/add-new-template-part.js +0 -65
- package/build/components/page-templates-template-parts/add-new-template-part.js.map +0 -1
- package/build/components/page-templates-template-parts/hooks.js.map +0 -1
- package/build/components/page-templates-template-parts/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/page-status.js +0 -188
- package/build/components/sidebar-edit-mode/page-panels/page-status.js.map +0 -1
- package/build-module/components/header-edit-mode/more-menu/copy-content-menu-item.js +0 -52
- package/build-module/components/header-edit-mode/more-menu/copy-content-menu-item.js.map +0 -1
- package/build-module/components/header-edit-mode/tools-more-menu-group/index.js +0 -16
- package/build-module/components/header-edit-mode/tools-more-menu-group/index.js.map +0 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js +0 -49
- package/build-module/components/keyboard-shortcuts/edit-mode.js.map +0 -1
- package/build-module/components/page-templates-template-parts/add-new-template-part.js +0 -57
- package/build-module/components/page-templates-template-parts/add-new-template-part.js.map +0 -1
- package/build-module/components/page-templates-template-parts/hooks.js.map +0 -1
- package/build-module/components/page-templates-template-parts/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js +0 -180
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +0 -1
- package/src/components/header-edit-mode/more-menu/copy-content-menu-item.js +0 -51
- package/src/components/header-edit-mode/tools-more-menu-group/index.js +0 -16
- package/src/components/keyboard-shortcuts/edit-mode.js +0 -59
- package/src/components/page-templates-template-parts/add-new-template-part.js +0 -62
- package/src/components/sidebar-edit-mode/page-panels/page-status.js +0 -249
- package/src/components/sidebar-edit-mode/page-panels/style.scss +0 -34
- /package/build/components/{page-templates-template-parts → page-templates}/hooks.js +0 -0
- /package/build-module/components/{page-templates-template-parts → page-templates}/hooks.js +0 -0
- /package/src/components/{page-templates-template-parts → page-templates}/hooks.js +0 -0
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = PageStatus;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _components = require("@wordpress/components");
|
|
10
|
-
var _i18n = require("@wordpress/i18n");
|
|
11
|
-
var _data = require("@wordpress/data");
|
|
12
|
-
var _element = require("@wordpress/element");
|
|
13
|
-
var _coreData = require("@wordpress/core-data");
|
|
14
|
-
var _notices = require("@wordpress/notices");
|
|
15
|
-
var _blockEditor = require("@wordpress/block-editor");
|
|
16
|
-
var _compose = require("@wordpress/compose");
|
|
17
|
-
var _editor = require("@wordpress/editor");
|
|
18
|
-
var _statusLabel = _interopRequireDefault(require("../../sidebar-navigation-screen-page/status-label"));
|
|
19
|
-
var _lockUnlock = require("../../../lock-unlock");
|
|
20
|
-
/**
|
|
21
|
-
* WordPress dependencies
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Internal dependencies
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
const {
|
|
29
|
-
PostPanelRow
|
|
30
|
-
} = (0, _lockUnlock.unlock)(_editor.privateApis);
|
|
31
|
-
const STATUS_OPTIONS = [{
|
|
32
|
-
label: (0, _react.createElement)(_react.Fragment, null, (0, _i18n.__)('Draft'), (0, _react.createElement)(_components.__experimentalText, {
|
|
33
|
-
variant: "muted"
|
|
34
|
-
}, (0, _i18n.__)('Not ready to publish.'))),
|
|
35
|
-
value: 'draft'
|
|
36
|
-
}, {
|
|
37
|
-
label: (0, _react.createElement)(_react.Fragment, null, (0, _i18n.__)('Pending'), (0, _react.createElement)(_components.__experimentalText, {
|
|
38
|
-
variant: "muted"
|
|
39
|
-
}, (0, _i18n.__)('Waiting for review before publishing.'))),
|
|
40
|
-
value: 'pending'
|
|
41
|
-
}, {
|
|
42
|
-
label: (0, _react.createElement)(_react.Fragment, null, (0, _i18n.__)('Private'), (0, _react.createElement)(_components.__experimentalText, {
|
|
43
|
-
variant: "muted"
|
|
44
|
-
}, (0, _i18n.__)('Only visible to site admins and editors.'))),
|
|
45
|
-
value: 'private'
|
|
46
|
-
}, {
|
|
47
|
-
label: (0, _react.createElement)(_react.Fragment, null, (0, _i18n.__)('Scheduled'), (0, _react.createElement)(_components.__experimentalText, {
|
|
48
|
-
variant: "muted"
|
|
49
|
-
}, (0, _i18n.__)('Publish automatically on a chosen date.'))),
|
|
50
|
-
value: 'future'
|
|
51
|
-
}, {
|
|
52
|
-
label: (0, _react.createElement)(_react.Fragment, null, (0, _i18n.__)('Published'), (0, _react.createElement)(_components.__experimentalText, {
|
|
53
|
-
variant: "muted"
|
|
54
|
-
}, (0, _i18n.__)('Visible to everyone.'))),
|
|
55
|
-
value: 'publish'
|
|
56
|
-
}];
|
|
57
|
-
function PageStatus({
|
|
58
|
-
postType,
|
|
59
|
-
postId,
|
|
60
|
-
status,
|
|
61
|
-
password,
|
|
62
|
-
date
|
|
63
|
-
}) {
|
|
64
|
-
const [showPassword, setShowPassword] = (0, _element.useState)(!!password);
|
|
65
|
-
const instanceId = (0, _compose.useInstanceId)(PageStatus);
|
|
66
|
-
const {
|
|
67
|
-
editEntityRecord
|
|
68
|
-
} = (0, _data.useDispatch)(_coreData.store);
|
|
69
|
-
const {
|
|
70
|
-
createErrorNotice
|
|
71
|
-
} = (0, _data.useDispatch)(_notices.store);
|
|
72
|
-
const [popoverAnchor, setPopoverAnchor] = (0, _element.useState)(null);
|
|
73
|
-
// Memoize popoverProps to avoid returning a new object every time.
|
|
74
|
-
const popoverProps = (0, _element.useMemo)(() => ({
|
|
75
|
-
// Anchor the popover to the middle of the entire row so that it doesn't
|
|
76
|
-
// move around when the label changes.
|
|
77
|
-
anchor: popoverAnchor,
|
|
78
|
-
'aria-label': (0, _i18n.__)('Change status'),
|
|
79
|
-
placement: 'bottom-end'
|
|
80
|
-
}), [popoverAnchor]);
|
|
81
|
-
const saveStatus = async ({
|
|
82
|
-
status: newStatus = status,
|
|
83
|
-
password: newPassword = password,
|
|
84
|
-
date: newDate = date
|
|
85
|
-
}) => {
|
|
86
|
-
try {
|
|
87
|
-
await editEntityRecord('postType', postType, postId, {
|
|
88
|
-
status: newStatus,
|
|
89
|
-
date: newDate,
|
|
90
|
-
password: newPassword
|
|
91
|
-
});
|
|
92
|
-
} catch (error) {
|
|
93
|
-
const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0, _i18n.__)('An error occurred while updating the status');
|
|
94
|
-
createErrorNotice(errorMessage, {
|
|
95
|
-
type: 'snackbar'
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
const handleTogglePassword = value => {
|
|
100
|
-
setShowPassword(value);
|
|
101
|
-
if (!value) {
|
|
102
|
-
saveStatus({
|
|
103
|
-
password: ''
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
const handleStatus = value => {
|
|
108
|
-
let newDate = date;
|
|
109
|
-
let newPassword = password;
|
|
110
|
-
if (value === 'publish') {
|
|
111
|
-
if (new Date(date) > new Date()) {
|
|
112
|
-
newDate = null;
|
|
113
|
-
}
|
|
114
|
-
} else if (value === 'future') {
|
|
115
|
-
if (!date || new Date(date) < new Date()) {
|
|
116
|
-
newDate = new Date();
|
|
117
|
-
newDate.setDate(newDate.getDate() + 7);
|
|
118
|
-
}
|
|
119
|
-
} else if (value === 'private' && password) {
|
|
120
|
-
setShowPassword(false);
|
|
121
|
-
newPassword = '';
|
|
122
|
-
}
|
|
123
|
-
saveStatus({
|
|
124
|
-
status: value,
|
|
125
|
-
date: newDate,
|
|
126
|
-
password: newPassword
|
|
127
|
-
});
|
|
128
|
-
};
|
|
129
|
-
return (0, _react.createElement)(PostPanelRow, {
|
|
130
|
-
label: (0, _i18n.__)('Status')
|
|
131
|
-
}, (0, _react.createElement)(_components.Dropdown, {
|
|
132
|
-
contentClassName: "edit-site-change-status__content",
|
|
133
|
-
popoverProps: popoverProps,
|
|
134
|
-
focusOnMount: true,
|
|
135
|
-
ref: setPopoverAnchor,
|
|
136
|
-
renderToggle: ({
|
|
137
|
-
onToggle
|
|
138
|
-
}) => (0, _react.createElement)(_components.Button, {
|
|
139
|
-
className: "edit-site-summary-field__trigger",
|
|
140
|
-
variant: "tertiary",
|
|
141
|
-
onClick: onToggle
|
|
142
|
-
}, (0, _react.createElement)(_statusLabel.default, {
|
|
143
|
-
status: password ? 'protected' : status
|
|
144
|
-
})),
|
|
145
|
-
renderContent: ({
|
|
146
|
-
onClose
|
|
147
|
-
}) => (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_blockEditor.__experimentalInspectorPopoverHeader, {
|
|
148
|
-
title: (0, _i18n.__)('Status'),
|
|
149
|
-
onClose: onClose
|
|
150
|
-
}), (0, _react.createElement)("form", null, (0, _react.createElement)(_components.__experimentalVStack, {
|
|
151
|
-
spacing: 5
|
|
152
|
-
}, (0, _react.createElement)(_components.RadioControl, {
|
|
153
|
-
className: "edit-site-change-status__options",
|
|
154
|
-
hideLabelFromVision: true,
|
|
155
|
-
label: (0, _i18n.__)('Status'),
|
|
156
|
-
options: STATUS_OPTIONS,
|
|
157
|
-
onChange: handleStatus,
|
|
158
|
-
selected: status
|
|
159
|
-
}), status !== 'private' && (0, _react.createElement)("fieldset", {
|
|
160
|
-
className: "edit-site-change-status__password-fieldset"
|
|
161
|
-
}, (0, _react.createElement)(_components.__experimentalText, {
|
|
162
|
-
as: "legend",
|
|
163
|
-
className: "edit-site-change-status__password-legend",
|
|
164
|
-
size: "11",
|
|
165
|
-
lineHeight: 1.4,
|
|
166
|
-
weight: 500,
|
|
167
|
-
upperCase: true
|
|
168
|
-
}, (0, _i18n.__)('Password')), (0, _react.createElement)(_components.ToggleControl, {
|
|
169
|
-
label: (0, _i18n.__)('Hide this page behind a password'),
|
|
170
|
-
checked: showPassword,
|
|
171
|
-
onChange: handleTogglePassword
|
|
172
|
-
}), showPassword && (0, _react.createElement)("div", {
|
|
173
|
-
className: "edit-site-change-status__password-input"
|
|
174
|
-
}, (0, _react.createElement)(_components.VisuallyHidden, {
|
|
175
|
-
as: "label",
|
|
176
|
-
htmlFor: `edit-site-change-status__password-input-${instanceId}`
|
|
177
|
-
}, (0, _i18n.__)('Create password')), (0, _react.createElement)(_components.TextControl, {
|
|
178
|
-
onChange: value => saveStatus({
|
|
179
|
-
password: value
|
|
180
|
-
}),
|
|
181
|
-
value: password,
|
|
182
|
-
placeholder: (0, _i18n.__)('Use a secure password'),
|
|
183
|
-
type: "text",
|
|
184
|
-
id: `edit-site-change-status__password-input-${instanceId}`
|
|
185
|
-
}))))))
|
|
186
|
-
}));
|
|
187
|
-
}
|
|
188
|
-
//# sourceMappingURL=page-status.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_i18n","_data","_element","_coreData","_notices","_blockEditor","_compose","_editor","_statusLabel","_interopRequireDefault","_lockUnlock","PostPanelRow","unlock","editorPrivateApis","STATUS_OPTIONS","label","_react","createElement","Fragment","__","__experimentalText","variant","value","PageStatus","postType","postId","status","password","date","showPassword","setShowPassword","useState","instanceId","useInstanceId","editEntityRecord","useDispatch","coreStore","createErrorNotice","noticesStore","popoverAnchor","setPopoverAnchor","popoverProps","useMemo","anchor","placement","saveStatus","newStatus","newPassword","newDate","error","errorMessage","message","code","type","handleTogglePassword","handleStatus","Date","setDate","getDate","Dropdown","contentClassName","focusOnMount","ref","renderToggle","onToggle","Button","className","onClick","default","renderContent","onClose","__experimentalInspectorPopoverHeader","title","__experimentalVStack","spacing","RadioControl","hideLabelFromVision","options","onChange","selected","as","size","lineHeight","weight","upperCase","ToggleControl","checked","VisuallyHidden","htmlFor","TextControl","placeholder","id"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/page-panels/page-status.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tToggleControl,\n\tDropdown,\n\t__experimentalText as Text,\n\t__experimentalVStack as VStack,\n\tTextControl,\n\tRadioControl,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { useInstanceId } from '@wordpress/compose';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport StatusLabel from '../../sidebar-navigation-screen-page/status-label';\nimport { unlock } from '../../../lock-unlock';\n\nconst { PostPanelRow } = unlock( editorPrivateApis );\n\nconst STATUS_OPTIONS = [\n\t{\n\t\tlabel: (\n\t\t\t<>\n\t\t\t\t{ __( 'Draft' ) }\n\t\t\t\t<Text variant=\"muted\">{ __( 'Not ready to publish.' ) }</Text>\n\t\t\t</>\n\t\t),\n\t\tvalue: 'draft',\n\t},\n\t{\n\t\tlabel: (\n\t\t\t<>\n\t\t\t\t{ __( 'Pending' ) }\n\t\t\t\t<Text variant=\"muted\">\n\t\t\t\t\t{ __( 'Waiting for review before publishing.' ) }\n\t\t\t\t</Text>\n\t\t\t</>\n\t\t),\n\t\tvalue: 'pending',\n\t},\n\t{\n\t\tlabel: (\n\t\t\t<>\n\t\t\t\t{ __( 'Private' ) }\n\t\t\t\t<Text variant=\"muted\">\n\t\t\t\t\t{ __( 'Only visible to site admins and editors.' ) }\n\t\t\t\t</Text>\n\t\t\t</>\n\t\t),\n\t\tvalue: 'private',\n\t},\n\t{\n\t\tlabel: (\n\t\t\t<>\n\t\t\t\t{ __( 'Scheduled' ) }\n\t\t\t\t<Text variant=\"muted\">\n\t\t\t\t\t{ __( 'Publish automatically on a chosen date.' ) }\n\t\t\t\t</Text>\n\t\t\t</>\n\t\t),\n\t\tvalue: 'future',\n\t},\n\t{\n\t\tlabel: (\n\t\t\t<>\n\t\t\t\t{ __( 'Published' ) }\n\t\t\t\t<Text variant=\"muted\">{ __( 'Visible to everyone.' ) }</Text>\n\t\t\t</>\n\t\t),\n\t\tvalue: 'publish',\n\t},\n];\n\nexport default function PageStatus( {\n\tpostType,\n\tpostId,\n\tstatus,\n\tpassword,\n\tdate,\n} ) {\n\tconst [ showPassword, setShowPassword ] = useState( !! password );\n\tconst instanceId = useInstanceId( PageStatus );\n\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\t'aria-label': __( 'Change status' ),\n\t\t\tplacement: 'bottom-end',\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\tconst saveStatus = async ( {\n\t\tstatus: newStatus = status,\n\t\tpassword: newPassword = password,\n\t\tdate: newDate = date,\n\t} ) => {\n\t\ttry {\n\t\t\tawait editEntityRecord( 'postType', postType, postId, {\n\t\t\t\tstatus: newStatus,\n\t\t\t\tdate: newDate,\n\t\t\t\tpassword: newPassword,\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while updating the status' );\n\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t}\n\t};\n\n\tconst handleTogglePassword = ( value ) => {\n\t\tsetShowPassword( value );\n\t\tif ( ! value ) {\n\t\t\tsaveStatus( { password: '' } );\n\t\t}\n\t};\n\n\tconst handleStatus = ( value ) => {\n\t\tlet newDate = date;\n\t\tlet newPassword = password;\n\t\tif ( value === 'publish' ) {\n\t\t\tif ( new Date( date ) > new Date() ) {\n\t\t\t\tnewDate = null;\n\t\t\t}\n\t\t} else if ( value === 'future' ) {\n\t\t\tif ( ! date || new Date( date ) < new Date() ) {\n\t\t\t\tnewDate = new Date();\n\t\t\t\tnewDate.setDate( newDate.getDate() + 7 );\n\t\t\t}\n\t\t} else if ( value === 'private' && password ) {\n\t\t\tsetShowPassword( false );\n\t\t\tnewPassword = '';\n\t\t}\n\t\tsaveStatus( {\n\t\t\tstatus: value,\n\t\t\tdate: newDate,\n\t\t\tpassword: newPassword,\n\t\t} );\n\t};\n\n\treturn (\n\t\t<PostPanelRow label={ __( 'Status' ) }>\n\t\t\t<Dropdown\n\t\t\t\tcontentClassName=\"edit-site-change-status__content\"\n\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\tfocusOnMount\n\t\t\t\tref={ setPopoverAnchor }\n\t\t\t\trenderToggle={ ( { onToggle } ) => (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"edit-site-summary-field__trigger\"\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t>\n\t\t\t\t\t\t<StatusLabel\n\t\t\t\t\t\t\tstatus={ password ? 'protected' : status }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<InspectorPopoverHeader\n\t\t\t\t\t\t\ttitle={ __( 'Status' ) }\n\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<form>\n\t\t\t\t\t\t\t<VStack spacing={ 5 }>\n\t\t\t\t\t\t\t\t<RadioControl\n\t\t\t\t\t\t\t\t\tclassName=\"edit-site-change-status__options\"\n\t\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Status' ) }\n\t\t\t\t\t\t\t\t\toptions={ STATUS_OPTIONS }\n\t\t\t\t\t\t\t\t\tonChange={ handleStatus }\n\t\t\t\t\t\t\t\t\tselected={ status }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{ status !== 'private' && (\n\t\t\t\t\t\t\t\t\t<fieldset className=\"edit-site-change-status__password-fieldset\">\n\t\t\t\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\t\t\t\tas=\"legend\"\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-change-status__password-legend\"\n\t\t\t\t\t\t\t\t\t\t\tsize=\"11\"\n\t\t\t\t\t\t\t\t\t\t\tlineHeight={ 1.4 }\n\t\t\t\t\t\t\t\t\t\t\tweight={ 500 }\n\t\t\t\t\t\t\t\t\t\t\tupperCase\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Password' ) }\n\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Hide this page behind a password'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tchecked={ showPassword }\n\t\t\t\t\t\t\t\t\t\t\tonChange={ handleTogglePassword }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t{ showPassword && (\n\t\t\t\t\t\t\t\t\t\t\t<div className=\"edit-site-change-status__password-input\">\n\t\t\t\t\t\t\t\t\t\t\t\t<VisuallyHidden\n\t\t\t\t\t\t\t\t\t\t\t\t\tas=\"label\"\n\t\t\t\t\t\t\t\t\t\t\t\t\thtmlFor={ `edit-site-change-status__password-input-${ instanceId }` }\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ __( 'Create password' ) }\n\t\t\t\t\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsaveStatus( {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpassword: value,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tvalue={ password }\n\t\t\t\t\t\t\t\t\t\t\t\t\tplaceholder={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Use a secure password'\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tid={ `edit-site-change-status__password-input-${ instanceId }` }\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</fieldset>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t</form>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t/>\n\t\t</PostPanelRow>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAUA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AAKA,IAAAS,YAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,WAAA,GAAAX,OAAA;AA1BA;AACA;AACA;;AAoBA;AACA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oreList":[]}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { MenuItem } from '@wordpress/components';
|
|
6
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
7
|
-
import { __ } from '@wordpress/i18n';
|
|
8
|
-
import { useCopyToClipboard } from '@wordpress/compose';
|
|
9
|
-
import { store as noticesStore } from '@wordpress/notices';
|
|
10
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
11
|
-
import { __unstableSerializeAndClean } from '@wordpress/blocks';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Internal dependencies
|
|
15
|
-
*/
|
|
16
|
-
import { store as editSiteStore } from '../../../store';
|
|
17
|
-
export default function CopyContentMenuItem() {
|
|
18
|
-
const {
|
|
19
|
-
createNotice
|
|
20
|
-
} = useDispatch(noticesStore);
|
|
21
|
-
const {
|
|
22
|
-
getEditedPostId,
|
|
23
|
-
getEditedPostType
|
|
24
|
-
} = useSelect(editSiteStore);
|
|
25
|
-
const {
|
|
26
|
-
getEditedEntityRecord
|
|
27
|
-
} = useSelect(coreStore);
|
|
28
|
-
function getText() {
|
|
29
|
-
const record = getEditedEntityRecord('postType', getEditedPostType(), getEditedPostId());
|
|
30
|
-
if (!record) {
|
|
31
|
-
return '';
|
|
32
|
-
}
|
|
33
|
-
if (typeof record.content === 'function') {
|
|
34
|
-
return record.content(record);
|
|
35
|
-
} else if (record.blocks) {
|
|
36
|
-
return __unstableSerializeAndClean(record.blocks);
|
|
37
|
-
} else if (record.content) {
|
|
38
|
-
return record.content;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
function onSuccess() {
|
|
42
|
-
createNotice('info', __('All content copied.'), {
|
|
43
|
-
isDismissible: true,
|
|
44
|
-
type: 'snackbar'
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
const ref = useCopyToClipboard(getText, onSuccess);
|
|
48
|
-
return createElement(MenuItem, {
|
|
49
|
-
ref: ref
|
|
50
|
-
}, __('Copy all blocks'));
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=copy-content-menu-item.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["MenuItem","useSelect","useDispatch","__","useCopyToClipboard","store","noticesStore","coreStore","__unstableSerializeAndClean","editSiteStore","CopyContentMenuItem","createNotice","getEditedPostId","getEditedPostType","getEditedEntityRecord","getText","record","content","blocks","onSuccess","isDismissible","type","ref","createElement"],"sources":["@wordpress/edit-site/src/components/header-edit-mode/more-menu/copy-content-menu-item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __unstableSerializeAndClean } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\n\nexport default function CopyContentMenuItem() {\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst { getEditedPostId, getEditedPostType } = useSelect( editSiteStore );\n\tconst { getEditedEntityRecord } = useSelect( coreStore );\n\n\tfunction getText() {\n\t\tconst record = getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\tgetEditedPostType(),\n\t\t\tgetEditedPostId()\n\t\t);\n\t\tif ( ! record ) {\n\t\t\treturn '';\n\t\t}\n\n\t\tif ( typeof record.content === 'function' ) {\n\t\t\treturn record.content( record );\n\t\t} else if ( record.blocks ) {\n\t\t\treturn __unstableSerializeAndClean( record.blocks );\n\t\t} else if ( record.content ) {\n\t\t\treturn record.content;\n\t\t}\n\t}\n\n\tfunction onSuccess() {\n\t\tcreateNotice( 'info', __( 'All content copied.' ), {\n\t\t\tisDismissible: true,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\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CAAA,EAAG;IACpBR,YAAY,CAAE,MAAM,EAAER,EAAE,CAAE,qBAAsB,CAAC,EAAE;MAClDiB,aAAa,EAAE,IAAI;MACnBC,IAAI,EAAE;IACP,CAAE,CAAC;EACJ;EAEA,MAAMC,GAAG,GAAGlB,kBAAkB,CAAEW,OAAO,EAAEI,SAAU,CAAC;EAEpD,OAAOI,aAAA,CAACvB,QAAQ;IAACsB,GAAG,EAAGA;EAAK,GAAGnB,EAAE,CAAE,iBAAkB,CAAa,CAAC;AACpE","ignoreList":[]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { createSlotFill } from '@wordpress/components';
|
|
6
|
-
const {
|
|
7
|
-
Fill: ToolsMoreMenuGroup,
|
|
8
|
-
Slot
|
|
9
|
-
} = createSlotFill('EditSiteToolsMoreMenuGroup');
|
|
10
|
-
ToolsMoreMenuGroup.Slot = ({
|
|
11
|
-
fillProps
|
|
12
|
-
}) => createElement(Slot, {
|
|
13
|
-
fillProps: fillProps
|
|
14
|
-
}, fills => fills && fills.length > 0);
|
|
15
|
-
export default ToolsMoreMenuGroup;
|
|
16
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createSlotFill","Fill","ToolsMoreMenuGroup","Slot","fillProps","createElement","fills","length"],"sources":["@wordpress/edit-site/src/components/header-edit-mode/tools-more-menu-group/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill } from '@wordpress/components';\n\nconst { Fill: ToolsMoreMenuGroup, Slot } = createSlotFill(\n\t'EditSiteToolsMoreMenuGroup'\n);\n\nToolsMoreMenuGroup.Slot = ( { fillProps } ) => (\n\t<Slot fillProps={ fillProps }>\n\t\t{ ( fills ) => fills && fills.length > 0 }\n\t</Slot>\n);\n\nexport default ToolsMoreMenuGroup;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,cAAc,QAAQ,uBAAuB;AAEtD,MAAM;EAAEC,IAAI,EAAEC,kBAAkB;EAAEC;AAAK,CAAC,GAAGH,cAAc,CACxD,4BACD,CAAC;AAEDE,kBAAkB,CAACC,IAAI,GAAG,CAAE;EAAEC;AAAU,CAAC,KACxCC,aAAA,CAACF,IAAI;EAACC,SAAS,EAAGA;AAAW,GACxBE,KAAK,IAAMA,KAAK,IAAIA,KAAK,CAACC,MAAM,GAAG,CAClC,CACN;AAED,eAAeL,kBAAkB","ignoreList":[]}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useShortcut } from '@wordpress/keyboard-shortcuts';
|
|
5
|
-
import { useDispatch, useSelect } from '@wordpress/data';
|
|
6
|
-
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
7
|
-
import { createBlock } from '@wordpress/blocks';
|
|
8
|
-
function KeyboardShortcutsEditMode() {
|
|
9
|
-
const {
|
|
10
|
-
replaceBlocks
|
|
11
|
-
} = useDispatch(blockEditorStore);
|
|
12
|
-
const {
|
|
13
|
-
getBlockName,
|
|
14
|
-
getSelectedBlockClientId,
|
|
15
|
-
getBlockAttributes
|
|
16
|
-
} = useSelect(blockEditorStore);
|
|
17
|
-
const handleTextLevelShortcut = (event, level) => {
|
|
18
|
-
event.preventDefault();
|
|
19
|
-
const destinationBlockName = level === 0 ? 'core/paragraph' : 'core/heading';
|
|
20
|
-
const currentClientId = getSelectedBlockClientId();
|
|
21
|
-
if (currentClientId === null) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
const blockName = getBlockName(currentClientId);
|
|
25
|
-
if (blockName !== 'core/paragraph' && blockName !== 'core/heading') {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
const attributes = getBlockAttributes(currentClientId);
|
|
29
|
-
const textAlign = blockName === 'core/paragraph' ? 'align' : 'textAlign';
|
|
30
|
-
const destinationTextAlign = destinationBlockName === 'core/paragraph' ? 'align' : 'textAlign';
|
|
31
|
-
replaceBlocks(currentClientId, createBlock(destinationBlockName, {
|
|
32
|
-
level,
|
|
33
|
-
content: attributes.content,
|
|
34
|
-
...{
|
|
35
|
-
[destinationTextAlign]: attributes[textAlign]
|
|
36
|
-
}
|
|
37
|
-
}));
|
|
38
|
-
};
|
|
39
|
-
useShortcut('core/edit-site/transform-heading-to-paragraph', event => handleTextLevelShortcut(event, 0));
|
|
40
|
-
[1, 2, 3, 4, 5, 6].forEach(level => {
|
|
41
|
-
//the loop is based off on a constant therefore
|
|
42
|
-
//the hook will execute the same way every time
|
|
43
|
-
//eslint-disable-next-line react-hooks/rules-of-hooks
|
|
44
|
-
useShortcut(`core/edit-site/transform-paragraph-to-heading-${level}`, event => handleTextLevelShortcut(event, level));
|
|
45
|
-
});
|
|
46
|
-
return null;
|
|
47
|
-
}
|
|
48
|
-
export default KeyboardShortcutsEditMode;
|
|
49
|
-
//# sourceMappingURL=edit-mode.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useShortcut","useDispatch","useSelect","store","blockEditorStore","createBlock","KeyboardShortcutsEditMode","replaceBlocks","getBlockName","getSelectedBlockClientId","getBlockAttributes","handleTextLevelShortcut","event","level","preventDefault","destinationBlockName","currentClientId","blockName","attributes","textAlign","destinationTextAlign","content","forEach"],"sources":["@wordpress/edit-site/src/components/keyboard-shortcuts/edit-mode.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\n\nfunction KeyboardShortcutsEditMode() {\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\tconst { getBlockName, getSelectedBlockClientId, getBlockAttributes } =\n\t\tuseSelect( blockEditorStore );\n\n\tconst handleTextLevelShortcut = ( event, level ) => {\n\t\tevent.preventDefault();\n\t\tconst destinationBlockName =\n\t\t\tlevel === 0 ? 'core/paragraph' : 'core/heading';\n\t\tconst currentClientId = getSelectedBlockClientId();\n\t\tif ( currentClientId === null ) {\n\t\t\treturn;\n\t\t}\n\t\tconst blockName = getBlockName( currentClientId );\n\t\tif ( blockName !== 'core/paragraph' && blockName !== 'core/heading' ) {\n\t\t\treturn;\n\t\t}\n\t\tconst attributes = getBlockAttributes( currentClientId );\n\t\tconst textAlign =\n\t\t\tblockName === 'core/paragraph' ? 'align' : 'textAlign';\n\t\tconst destinationTextAlign =\n\t\t\tdestinationBlockName === 'core/paragraph' ? 'align' : 'textAlign';\n\n\t\treplaceBlocks(\n\t\t\tcurrentClientId,\n\t\t\tcreateBlock( destinationBlockName, {\n\t\t\t\tlevel,\n\t\t\t\tcontent: attributes.content,\n\t\t\t\t...{ [ destinationTextAlign ]: attributes[ textAlign ] },\n\t\t\t} )\n\t\t);\n\t};\n\n\tuseShortcut( 'core/edit-site/transform-heading-to-paragraph', ( event ) =>\n\t\thandleTextLevelShortcut( event, 0 )\n\t);\n\n\t[ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {\n\t\t//the loop is based off on a constant therefore\n\t\t//the hook will execute the same way every time\n\t\t//eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseShortcut(\n\t\t\t`core/edit-site/transform-paragraph-to-heading-${ level }`,\n\t\t\t( event ) => handleTextLevelShortcut( event, level )\n\t\t);\n\t} );\n\n\treturn null;\n}\n\nexport default KeyboardShortcutsEditMode;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,+BAA+B;AAC3D,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SAASC,WAAW,QAAQ,mBAAmB;AAE/C,SAASC,yBAAyBA,CAAA,EAAG;EACpC,MAAM;IAAEC;EAAc,CAAC,GAAGN,WAAW,C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EC,KAAM,CACpD,CAAC;EACF,CAAE,CAAC;EAEH,OAAO,IAAI;AACZ;AAEA,eAAeP,yBAAyB","ignoreList":[]}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { createElement, Fragment } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
6
|
-
import { useSelect } from '@wordpress/data';
|
|
7
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
8
|
-
import { useState, memo } from '@wordpress/element';
|
|
9
|
-
import { Button } from '@wordpress/components';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import { unlock } from '../../lock-unlock';
|
|
15
|
-
import { store as editSiteStore } from '../../store';
|
|
16
|
-
import CreateTemplatePartModal from '../create-template-part-modal';
|
|
17
|
-
import { TEMPLATE_PART_POST_TYPE } from '../../utils/constants';
|
|
18
|
-
const {
|
|
19
|
-
useHistory
|
|
20
|
-
} = unlock(routerPrivateApis);
|
|
21
|
-
function AddNewTemplatePart() {
|
|
22
|
-
const {
|
|
23
|
-
canCreate,
|
|
24
|
-
postType
|
|
25
|
-
} = useSelect(select => {
|
|
26
|
-
const {
|
|
27
|
-
supportsTemplatePartsMode
|
|
28
|
-
} = select(editSiteStore).getSettings();
|
|
29
|
-
return {
|
|
30
|
-
canCreate: !supportsTemplatePartsMode,
|
|
31
|
-
postType: select(coreStore).getPostType(TEMPLATE_PART_POST_TYPE)
|
|
32
|
-
};
|
|
33
|
-
}, []);
|
|
34
|
-
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
35
|
-
const history = useHistory();
|
|
36
|
-
if (!canCreate || !postType) {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
return createElement(Fragment, null, createElement(Button, {
|
|
40
|
-
variant: "primary",
|
|
41
|
-
onClick: () => setIsModalOpen(true)
|
|
42
|
-
}, postType.labels.add_new_item), isModalOpen && createElement(CreateTemplatePartModal, {
|
|
43
|
-
closeModal: () => setIsModalOpen(false),
|
|
44
|
-
blocks: [],
|
|
45
|
-
onCreate: templatePart => {
|
|
46
|
-
setIsModalOpen(false);
|
|
47
|
-
history.push({
|
|
48
|
-
postId: templatePart.id,
|
|
49
|
-
postType: TEMPLATE_PART_POST_TYPE,
|
|
50
|
-
canvas: 'edit'
|
|
51
|
-
});
|
|
52
|
-
},
|
|
53
|
-
onError: () => setIsModalOpen(false)
|
|
54
|
-
}));
|
|
55
|
-
}
|
|
56
|
-
export default memo(AddNewTemplatePart);
|
|
57
|
-
//# sourceMappingURL=add-new-template-part.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["privateApis","routerPrivateApis","useSelect","store","coreStore","useState","memo","Button","unlock","editSiteStore","CreateTemplatePartModal","TEMPLATE_PART_POST_TYPE","useHistory","AddNewTemplatePart","canCreate","postType","select","supportsTemplatePartsMode","getSettings","getPostType","isModalOpen","setIsModalOpen","history","createElement","Fragment","variant","onClick","labels","add_new_item","closeModal","blocks","onCreate","templatePart","push","postId","id","canvas","onError"],"sources":["@wordpress/edit-site/src/components/page-templates-template-parts/add-new-template-part.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, memo } from '@wordpress/element';\nimport { Button } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport CreateTemplatePartModal from '../create-template-part-modal';\nimport { TEMPLATE_PART_POST_TYPE } from '../../utils/constants';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nfunction AddNewTemplatePart() {\n\tconst { canCreate, postType } = useSelect( ( select ) => {\n\t\tconst { supportsTemplatePartsMode } =\n\t\t\tselect( editSiteStore ).getSettings();\n\t\treturn {\n\t\t\tcanCreate: ! supportsTemplatePartsMode,\n\t\t\tpostType: select( coreStore ).getPostType(\n\t\t\t\tTEMPLATE_PART_POST_TYPE\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst history = useHistory();\n\n\tif ( ! canCreate || ! postType ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Button variant=\"primary\" onClick={ () => setIsModalOpen( true ) }>\n\t\t\t\t{ postType.labels.add_new_item }\n\t\t\t</Button>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<CreateTemplatePartModal\n\t\t\t\t\tcloseModal={ () => setIsModalOpen( false ) }\n\t\t\t\t\tblocks={ [] }\n\t\t\t\t\tonCreate={ ( templatePart ) => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\tpostId: templatePart.id,\n\t\t\t\t\t\t\tpostType: TEMPLATE_PART_POST_TYPE,\n\t\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tonError={ () => setIsModalOpen( false ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default memo( AddNewTemplatePart );\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,QAAQ,EAAEC,IAAI,QAAQ,oBAAoB;AACnD,SAASC,MAAM,QAAQ,uBAAuB;;AAE9C;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASL,KAAK,IAAIM,aAAa,QAAQ,aAAa;AACpD,OAAOC,uBAAuB,MAAM,+BAA+B;AACnE,SAASC,uBAAuB,QAAQ,uBAAuB;AAE/D,MAAM;EAAEC;AAAW,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AAmB,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["store","coreStore","useSelect","commentAuthorAvatar","authorIcon","layout","themeIcon","plugins","pluginIcon","globe","globeIcon","TEMPLATE_ORIGINS","useAddedBy","postType","postId","select","getEntityRecord","getMedia","getUser","getEditedEntityRecord","template","originalSource","original_source","authorText","author_text","type","icon","text","isCustomized","source","custom","siteData","imageUrl","site_logo","source_url","undefined","user","author","avatar_urls"],"sources":["@wordpress/edit-site/src/components/page-templates-template-parts/hooks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tcommentAuthorAvatar as authorIcon,\n\tlayout as themeIcon,\n\tplugins as pluginIcon,\n\tglobe as globeIcon,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_ORIGINS } from '../../utils/constants';\n\n/** @typedef {'wp_template'|'wp_template_part'} TemplateType */\n\n/**\n * @typedef {'theme'|'plugin'|'site'|'user'} AddedByType\n *\n * @typedef AddedByData\n * @type {Object}\n * @property {AddedByType} type The type of the data.\n * @property {JSX.Element} icon The icon to display.\n * @property {string} [imageUrl] The optional image URL to display.\n * @property {string} [text] The text to display.\n * @property {boolean} isCustomized Whether the template has been customized.\n *\n * @param {TemplateType} postType The template post type.\n * @param {number} postId The template post id.\n * @return {AddedByData} The added by object or null.\n */\nexport function useAddedBy( postType, postId ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEntityRecord,\n\t\t\t\tgetMedia,\n\t\t\t\tgetUser,\n\t\t\t\tgetEditedEntityRecord,\n\t\t\t} = select( coreStore );\n\t\t\tconst template = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t\tconst originalSource = template?.original_source;\n\t\t\tconst authorText = template?.author_text;\n\n\t\t\tswitch ( originalSource ) {\n\t\t\t\tcase 'theme': {\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: originalSource,\n\t\t\t\t\t\ticon: themeIcon,\n\t\t\t\t\t\ttext: authorText,\n\t\t\t\t\t\tisCustomized:\n\t\t\t\t\t\t\ttemplate.source === TEMPLATE_ORIGINS.custom,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tcase 'plugin': {\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: originalSource,\n\t\t\t\t\t\ticon: pluginIcon,\n\t\t\t\t\t\ttext: authorText,\n\t\t\t\t\t\tisCustomized:\n\t\t\t\t\t\t\ttemplate.source === TEMPLATE_ORIGINS.custom,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tcase 'site': {\n\t\t\t\t\tconst siteData = getEntityRecord(\n\t\t\t\t\t\t'root',\n\t\t\t\t\t\t'__unstableBase'\n\t\t\t\t\t);\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: originalSource,\n\t\t\t\t\t\ticon: globeIcon,\n\t\t\t\t\t\timageUrl: siteData?.site_logo\n\t\t\t\t\t\t\t? getMedia( siteData.site_logo )?.source_url\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\ttext: authorText,\n\t\t\t\t\t\tisCustomized: false,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tconst user = getUser( template.author );\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: 'user',\n\t\t\t\t\t\ticon: authorIcon,\n\t\t\t\t\t\timageUrl: user?.avatar_urls?.[ 48 ],\n\t\t\t\t\t\ttext: authorText,\n\t\t\t\t\t\tisCustomized: false,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[ postType, postId ]\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SACCC,mBA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,CAAEc,QAAQ,CAACE,SAAU,CAAC,EAAEC,UAAU,GAC1CC,SAAS;YACZR,IAAI,EAAEJ,UAAU;YAChBK,YAAY,EAAE;UACf,CAAC;QACF;MACA;QAAS;UACR,MAAMQ,IAAI,GAAGlB,OAAO,CAAEE,QAAQ,CAACiB,MAAO,CAAC;UACvC,OAAO;YACNZ,IAAI,EAAE,MAAM;YACZC,IAAI,EAAEtB,UAAU;YAChB4B,QAAQ,EAAEI,IAAI,EAAEE,WAAW,GAAI,EAAE,CAAE;YACnCX,IAAI,EAAEJ,UAAU;YAChBK,YAAY,EAAE;UACf,CAAC;QACF;IACD;EACD,CAAC,EACD,CAAEf,QAAQ,EAAEC,MAAM,CACnB,CAAC;AACF","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","Icon","__experimentalText","Text","__experimentalHStack","HStack","VisuallyHidden","__","useState","useMemo","useCallback","useEffect","useEntityRecords","decodeEntities","parse","BlockPreview","privateApis","blockEditorPrivateApis","DataViews","filterSortAndPaginate","routerPrivateApis","editorPrivateApis","Async","Page","default","Link","useLink","AddNewTemplate","useAddedBy","TEMPLATE_POST_TYPE","ENUMERATION_TYPE","OPERATOR_IS_ANY","LAYOUT_GRID","LAYOUT_TABLE","LAYOUT_LIST","usePatternSettings","unlock","AddNewTemplatePart","usePostActions","ExperimentalBlockEditorProvider","useGlobalStyle","useHistory","useLocation","EMPTY_ARRAY","defaultConfigPerViewType","primaryField","mediaField","columnFields","DEFAULT_VIEW","type","search","page","perPage","sort","field","direction","hiddenFields","layout","filters","Title","item","viewType","title","rendered","linkProps","params","postId","id","postType","canvas","createElement","AuthorField","isImageLoaded","setIsImageLoaded","text","icon","imageUrl","withIcon","alignment","spacing","className","onLoad","alt","src","Preview","settings","backgroundColor","blocks","content","raw","onClick","isEmpty","length","style","TEMPLATE_ACTIONS","PageTemplatesTemplateParts","activeView","defaultView","usedType","operator","value","view","setView","currentView","records","isResolving","isLoadingData","per_page","history","onSelectionChange","items","push","undefined","authors","authorsSet","Set","forEach","template","add","author_text","Array","from","map","author","label","fields","_fields","header","render","minWidth","maxWidth","enableSorting","getValue","enableHiding","enableGlobalSearch","description","Fragment","variant","elements","width","data","paginationInfo","onActionPerformed","actionId","post","actions","onChangeView","newView","isLoading"],"sources":["@wordpress/edit-site/src/components/page-templates-template-parts/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\t__experimentalText as Text,\n\t__experimentalHStack as HStack,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo, useCallback, useEffect } from '@wordpress/element';\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { parse } from '@wordpress/blocks';\nimport {\n\tBlockPreview,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { DataViews, filterSortAndPaginate } from '@wordpress/dataviews';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { Async } from '../async';\nimport Page from '../page';\nimport { default as Link, useLink } from '../routes/link';\nimport AddNewTemplate from '../add-new-template';\nimport { useAddedBy } from './hooks';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tENUMERATION_TYPE,\n\tOPERATOR_IS_ANY,\n\tLAYOUT_GRID,\n\tLAYOUT_TABLE,\n\tLAYOUT_LIST,\n} from '../../utils/constants';\n\nimport usePatternSettings from '../page-patterns/use-pattern-settings';\nimport { unlock } from '../../lock-unlock';\nimport AddNewTemplatePart from './add-new-template-part';\n\nconst { usePostActions } = unlock( editorPrivateApis );\n\nconst { ExperimentalBlockEditorProvider, useGlobalStyle } = unlock(\n\tblockEditorPrivateApis\n);\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\n\nconst EMPTY_ARRAY = [];\n\nconst defaultConfigPerViewType = {\n\t[ LAYOUT_TABLE ]: {\n\t\tprimaryField: 'title',\n\t},\n\t[ LAYOUT_GRID ]: {\n\t\tmediaField: 'preview',\n\t\tprimaryField: 'title',\n\t\tcolumnFields: [ 'description' ],\n\t},\n\t[ LAYOUT_LIST ]: {\n\t\tprimaryField: 'title',\n\t\tmediaField: 'preview',\n\t},\n};\n\nconst DEFAULT_VIEW = {\n\ttype: LAYOUT_GRID,\n\tsearch: '',\n\tpage: 1,\n\tperPage: 20,\n\tsort: {\n\t\tfield: 'title',\n\t\tdirection: 'asc',\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: [ 'preview' ],\n\tlayout: defaultConfigPerViewType[ LAYOUT_GRID ],\n\tfilters: [],\n};\n\nfunction Title( { item, viewType } ) {\n\tif ( viewType === LAYOUT_LIST ) {\n\t\treturn decodeEntities( item.title?.rendered ) || __( '(no title)' );\n\t}\n\tconst linkProps = {\n\t\tparams: {\n\t\t\tpostId: item.id,\n\t\t\tpostType: item.type,\n\t\t\tcanvas: 'edit',\n\t\t},\n\t};\n\treturn (\n\t\t<Link { ...linkProps }>\n\t\t\t{ decodeEntities( item.title?.rendered ) || __( '(no title)' ) }\n\t\t</Link>\n\t);\n}\n\nfunction AuthorField( { item, viewType } ) {\n\tconst [ isImageLoaded, setIsImageLoaded ] = useState( false );\n\tconst { text, icon, imageUrl } = useAddedBy( item.type, item.id );\n\tconst withIcon = viewType !== LAYOUT_LIST;\n\n\treturn (\n\t\t<HStack alignment=\"left\" spacing={ 1 }>\n\t\t\t{ withIcon && imageUrl && (\n\t\t\t\t<div\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'page-templates-author-field__avatar',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-loaded': isImageLoaded,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\tonLoad={ () => setIsImageLoaded( true ) }\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\tsrc={ imageUrl }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ withIcon && ! imageUrl && (\n\t\t\t\t<div className=\"page-templates-author-field__icon\">\n\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<span className=\"page-templates-author-field__name\">{ text }</span>\n\t\t</HStack>\n\t);\n}\n\nfunction Preview( { item, viewType } ) {\n\tconst settings = usePatternSettings();\n\tconst [ backgroundColor = 'white' ] = useGlobalStyle( 'color.background' );\n\tconst blocks = useMemo( () => {\n\t\treturn parse( item.content.raw );\n\t}, [ item.content.raw ] );\n\tconst { onClick } = useLink( {\n\t\tpostId: item.id,\n\t\tpostType: item.type,\n\t\tcanvas: 'edit',\n\t} );\n\n\tconst isEmpty = ! blocks?.length;\n\t// Wrap everything in a block editor provider to ensure 'styles' that are needed\n\t// for the previews are synced between the site editor store and the block editor store.\n\t// Additionally we need to have the `__experimentalBlockPatterns` setting in order to\n\t// render patterns inside the previews.\n\t// TODO: Same approach is used in the patterns list and it becomes obvious that some of\n\t// the block editor settings are needed in context where we don't have the block editor.\n\t// Explore how we can solve this in a better way.\n\treturn (\n\t\t<ExperimentalBlockEditorProvider settings={ settings }>\n\t\t\t<div\n\t\t\t\tclassName={ `page-templates-preview-field is-viewtype-${ viewType }` }\n\t\t\t\tstyle={ { backgroundColor } }\n\t\t\t>\n\t\t\t\t{ viewType === LAYOUT_LIST && ! isEmpty && (\n\t\t\t\t\t<Async>\n\t\t\t\t\t\t<BlockPreview blocks={ blocks } />\n\t\t\t\t\t</Async>\n\t\t\t\t) }\n\t\t\t\t{ viewType !== LAYOUT_LIST && (\n\t\t\t\t\t<button\n\t\t\t\t\t\tclassName=\"page-templates-preview-field__button\"\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\t\taria-label={ item.title?.rendered || item.title }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isEmpty &&\n\t\t\t\t\t\t\t( item.type === TEMPLATE_POST_TYPE\n\t\t\t\t\t\t\t\t? __( 'Empty template' )\n\t\t\t\t\t\t\t\t: __( 'Empty template part' ) ) }\n\t\t\t\t\t\t{ ! isEmpty && (\n\t\t\t\t\t\t\t<Async>\n\t\t\t\t\t\t\t\t<BlockPreview blocks={ blocks } />\n\t\t\t\t\t\t\t</Async>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</button>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n}\n\nconst TEMPLATE_ACTIONS = [\n\t'edit-post',\n\t'reset-template',\n\t'rename-template',\n\t'view-post-revisions',\n\t'delete-template',\n];\n\nexport default function PageTemplatesTemplateParts( { postType } ) {\n\tconst { params } = useLocation();\n\tconst { activeView = 'all', layout } = params;\n\tconst defaultView = useMemo( () => {\n\t\tconst usedType = layout ?? DEFAULT_VIEW.type;\n\t\treturn {\n\t\t\t...DEFAULT_VIEW,\n\t\t\ttype: usedType,\n\t\t\tlayout: defaultConfigPerViewType[ usedType ],\n\t\t\tfilters:\n\t\t\t\tactiveView !== 'all'\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfield: 'author',\n\t\t\t\t\t\t\t\toperator: 'isAny',\n\t\t\t\t\t\t\t\tvalue: [ activeView ],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t ]\n\t\t\t\t\t: [],\n\t\t};\n\t}, [ layout, activeView ] );\n\tconst [ view, setView ] = useState( defaultView );\n\tuseEffect( () => {\n\t\tsetView( ( currentView ) => ( {\n\t\t\t...currentView,\n\t\t\tfilters:\n\t\t\t\tactiveView !== 'all'\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfield: 'author',\n\t\t\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\t\t\tvalue: [ activeView ],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t ]\n\t\t\t\t\t: [],\n\t\t} ) );\n\t}, [ activeView ] );\n\n\tconst { records, isResolving: isLoadingData } = useEntityRecords(\n\t\t'postType',\n\t\tpostType,\n\t\t{\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\tconst history = useHistory();\n\tconst onSelectionChange = useCallback(\n\t\t( items ) => {\n\t\t\tif ( view?.type === LAYOUT_LIST ) {\n\t\t\t\thistory.push( {\n\t\t\t\t\t...params,\n\t\t\t\t\tpostId: items.length === 1 ? items[ 0 ].id : undefined,\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ history, params, view?.type ]\n\t);\n\n\tconst authors = useMemo( () => {\n\t\tif ( ! records ) {\n\t\t\treturn EMPTY_ARRAY;\n\t\t}\n\t\tconst authorsSet = new Set();\n\t\trecords.forEach( ( template ) => {\n\t\t\tauthorsSet.add( template.author_text );\n\t\t} );\n\t\treturn Array.from( authorsSet ).map( ( author ) => ( {\n\t\t\tvalue: author,\n\t\t\tlabel: author,\n\t\t} ) );\n\t}, [ records ] );\n\n\tconst fields = useMemo( () => {\n\t\tconst _fields = [\n\t\t\t{\n\t\t\t\theader: __( 'Preview' ),\n\t\t\t\tid: 'preview',\n\t\t\t\trender: ( { item } ) => {\n\t\t\t\t\treturn <Preview item={ item } viewType={ view.type } />;\n\t\t\t\t},\n\t\t\t\tminWidth: 120,\n\t\t\t\tmaxWidth: 120,\n\t\t\t\tenableSorting: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\theader:\n\t\t\t\t\tpostType === TEMPLATE_POST_TYPE\n\t\t\t\t\t\t? __( 'Template' )\n\t\t\t\t\t\t: __( 'Template Part' ),\n\t\t\t\tid: 'title',\n\t\t\t\tgetValue: ( { item } ) => item.title?.rendered,\n\t\t\t\trender: ( { item } ) => (\n\t\t\t\t\t<Title item={ item } viewType={ view.type } />\n\t\t\t\t),\n\t\t\t\tmaxWidth: 400,\n\t\t\t\tenableHiding: false,\n\t\t\t\tenableGlobalSearch: true,\n\t\t\t},\n\t\t];\n\t\tif ( postType === TEMPLATE_POST_TYPE ) {\n\t\t\t_fields.push( {\n\t\t\t\theader: __( 'Description' ),\n\t\t\t\tid: 'description',\n\t\t\t\trender: ( { item } ) => {\n\t\t\t\t\treturn item.description ? (\n\t\t\t\t\t\t<span className=\"page-templates-description\">\n\t\t\t\t\t\t\t{ decodeEntities( item.description ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) : (\n\t\t\t\t\t\tview.type === LAYOUT_TABLE && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<Text variant=\"muted\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t—\n\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t<VisuallyHidden>\n\t\t\t\t\t\t\t\t\t{ __( 'No description.' ) }\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tmaxWidth: 400,\n\t\t\t\tminWidth: 320,\n\t\t\t\tenableSorting: false,\n\t\t\t\tenableGlobalSearch: true,\n\t\t\t} );\n\t\t}\n\t\t// TODO: The plan is to support fields reordering, which would require an API like `order` or something\n\t\t// similar. With the aforementioned API we wouldn't need to construct the fields array like this.\n\t\t_fields.push( {\n\t\t\theader: __( 'Author' ),\n\t\t\tid: 'author',\n\t\t\tgetValue: ( { item } ) => item.author_text,\n\t\t\trender: ( { item } ) => {\n\t\t\t\treturn <AuthorField viewType={ view.type } item={ item } />;\n\t\t\t},\n\t\t\ttype: ENUMERATION_TYPE,\n\t\t\telements: authors,\n\t\t\twidth: '1%',\n\t\t} );\n\t\treturn _fields;\n\t}, [ postType, authors, view.type ] );\n\n\tconst { data, paginationInfo } = useMemo( () => {\n\t\treturn filterSortAndPaginate( records, view, fields );\n\t}, [ records, view, fields ] );\n\n\tconst onActionPerformed = useCallback(\n\t\t( actionId, items ) => {\n\t\t\tif ( actionId === 'edit-post' ) {\n\t\t\t\tconst post = items[ 0 ];\n\t\t\t\thistory.push( {\n\t\t\t\t\tpostId: post.id,\n\t\t\t\t\tpostType: post.type,\n\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ history ]\n\t);\n\n\tconst actions = usePostActions( onActionPerformed, TEMPLATE_ACTIONS );\n\n\tconst onChangeView = useCallback(\n\t\t( newView ) => {\n\t\t\tif ( newView.type !== view.type ) {\n\t\t\t\tnewView = {\n\t\t\t\t\t...newView,\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\t...defaultConfigPerViewType[ newView.type ],\n\t\t\t\t\t},\n\t\t\t\t};\n\n\t\t\t\thistory.push( {\n\t\t\t\t\t...params,\n\t\t\t\t\tlayout: newView.type,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tsetView( newView );\n\t\t},\n\t\t[ view.type, setView, history, params ]\n\t);\n\n\treturn (\n\t\t<Page\n\t\t\tclassName=\"edit-site-page-template-template-parts-dataviews\"\n\t\t\ttitle={\n\t\t\t\tpostType === TEMPLATE_POST_TYPE\n\t\t\t\t\t? __( 'Templates' )\n\t\t\t\t\t: __( 'Template Parts' )\n\t\t\t}\n\t\t\tactions={\n\t\t\t\tpostType === TEMPLATE_POST_TYPE ? (\n\t\t\t\t\t<AddNewTemplate />\n\t\t\t\t) : (\n\t\t\t\t\t<AddNewTemplatePart />\n\t\t\t\t)\n\t\t\t}\n\t\t>\n\t\t\t<DataViews\n\t\t\t\tpaginationInfo={ paginationInfo }\n\t\t\t\tfields={ fields }\n\t\t\t\tactions={ actions }\n\t\t\t\tdata={ data }\n\t\t\t\tisLoading={ isLoadingData }\n\t\t\t\tview={ view }\n\t\t\t\tonChangeView={ onChangeView }\n\t\t\t\tonSelectionChange={ onSelectionChange }\n\t\t\t/>\n\t\t</Page>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;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