@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,180 +0,0 @@
|
|
|
1
|
-
import { createElement, Fragment } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { Button, ToggleControl, Dropdown, __experimentalText as Text, __experimentalVStack as VStack, TextControl, RadioControl, VisuallyHidden } from '@wordpress/components';
|
|
6
|
-
import { __ } from '@wordpress/i18n';
|
|
7
|
-
import { useDispatch } from '@wordpress/data';
|
|
8
|
-
import { useState, useMemo } from '@wordpress/element';
|
|
9
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
10
|
-
import { store as noticesStore } from '@wordpress/notices';
|
|
11
|
-
import { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';
|
|
12
|
-
import { useInstanceId } from '@wordpress/compose';
|
|
13
|
-
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Internal dependencies
|
|
17
|
-
*/
|
|
18
|
-
import StatusLabel from '../../sidebar-navigation-screen-page/status-label';
|
|
19
|
-
import { unlock } from '../../../lock-unlock';
|
|
20
|
-
const {
|
|
21
|
-
PostPanelRow
|
|
22
|
-
} = unlock(editorPrivateApis);
|
|
23
|
-
const STATUS_OPTIONS = [{
|
|
24
|
-
label: createElement(Fragment, null, __('Draft'), createElement(Text, {
|
|
25
|
-
variant: "muted"
|
|
26
|
-
}, __('Not ready to publish.'))),
|
|
27
|
-
value: 'draft'
|
|
28
|
-
}, {
|
|
29
|
-
label: createElement(Fragment, null, __('Pending'), createElement(Text, {
|
|
30
|
-
variant: "muted"
|
|
31
|
-
}, __('Waiting for review before publishing.'))),
|
|
32
|
-
value: 'pending'
|
|
33
|
-
}, {
|
|
34
|
-
label: createElement(Fragment, null, __('Private'), createElement(Text, {
|
|
35
|
-
variant: "muted"
|
|
36
|
-
}, __('Only visible to site admins and editors.'))),
|
|
37
|
-
value: 'private'
|
|
38
|
-
}, {
|
|
39
|
-
label: createElement(Fragment, null, __('Scheduled'), createElement(Text, {
|
|
40
|
-
variant: "muted"
|
|
41
|
-
}, __('Publish automatically on a chosen date.'))),
|
|
42
|
-
value: 'future'
|
|
43
|
-
}, {
|
|
44
|
-
label: createElement(Fragment, null, __('Published'), createElement(Text, {
|
|
45
|
-
variant: "muted"
|
|
46
|
-
}, __('Visible to everyone.'))),
|
|
47
|
-
value: 'publish'
|
|
48
|
-
}];
|
|
49
|
-
export default function PageStatus({
|
|
50
|
-
postType,
|
|
51
|
-
postId,
|
|
52
|
-
status,
|
|
53
|
-
password,
|
|
54
|
-
date
|
|
55
|
-
}) {
|
|
56
|
-
const [showPassword, setShowPassword] = useState(!!password);
|
|
57
|
-
const instanceId = useInstanceId(PageStatus);
|
|
58
|
-
const {
|
|
59
|
-
editEntityRecord
|
|
60
|
-
} = useDispatch(coreStore);
|
|
61
|
-
const {
|
|
62
|
-
createErrorNotice
|
|
63
|
-
} = useDispatch(noticesStore);
|
|
64
|
-
const [popoverAnchor, setPopoverAnchor] = useState(null);
|
|
65
|
-
// Memoize popoverProps to avoid returning a new object every time.
|
|
66
|
-
const popoverProps = useMemo(() => ({
|
|
67
|
-
// Anchor the popover to the middle of the entire row so that it doesn't
|
|
68
|
-
// move around when the label changes.
|
|
69
|
-
anchor: popoverAnchor,
|
|
70
|
-
'aria-label': __('Change status'),
|
|
71
|
-
placement: 'bottom-end'
|
|
72
|
-
}), [popoverAnchor]);
|
|
73
|
-
const saveStatus = async ({
|
|
74
|
-
status: newStatus = status,
|
|
75
|
-
password: newPassword = password,
|
|
76
|
-
date: newDate = date
|
|
77
|
-
}) => {
|
|
78
|
-
try {
|
|
79
|
-
await editEntityRecord('postType', postType, postId, {
|
|
80
|
-
status: newStatus,
|
|
81
|
-
date: newDate,
|
|
82
|
-
password: newPassword
|
|
83
|
-
});
|
|
84
|
-
} catch (error) {
|
|
85
|
-
const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : __('An error occurred while updating the status');
|
|
86
|
-
createErrorNotice(errorMessage, {
|
|
87
|
-
type: 'snackbar'
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
const handleTogglePassword = value => {
|
|
92
|
-
setShowPassword(value);
|
|
93
|
-
if (!value) {
|
|
94
|
-
saveStatus({
|
|
95
|
-
password: ''
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
const handleStatus = value => {
|
|
100
|
-
let newDate = date;
|
|
101
|
-
let newPassword = password;
|
|
102
|
-
if (value === 'publish') {
|
|
103
|
-
if (new Date(date) > new Date()) {
|
|
104
|
-
newDate = null;
|
|
105
|
-
}
|
|
106
|
-
} else if (value === 'future') {
|
|
107
|
-
if (!date || new Date(date) < new Date()) {
|
|
108
|
-
newDate = new Date();
|
|
109
|
-
newDate.setDate(newDate.getDate() + 7);
|
|
110
|
-
}
|
|
111
|
-
} else if (value === 'private' && password) {
|
|
112
|
-
setShowPassword(false);
|
|
113
|
-
newPassword = '';
|
|
114
|
-
}
|
|
115
|
-
saveStatus({
|
|
116
|
-
status: value,
|
|
117
|
-
date: newDate,
|
|
118
|
-
password: newPassword
|
|
119
|
-
});
|
|
120
|
-
};
|
|
121
|
-
return createElement(PostPanelRow, {
|
|
122
|
-
label: __('Status')
|
|
123
|
-
}, createElement(Dropdown, {
|
|
124
|
-
contentClassName: "edit-site-change-status__content",
|
|
125
|
-
popoverProps: popoverProps,
|
|
126
|
-
focusOnMount: true,
|
|
127
|
-
ref: setPopoverAnchor,
|
|
128
|
-
renderToggle: ({
|
|
129
|
-
onToggle
|
|
130
|
-
}) => createElement(Button, {
|
|
131
|
-
className: "edit-site-summary-field__trigger",
|
|
132
|
-
variant: "tertiary",
|
|
133
|
-
onClick: onToggle
|
|
134
|
-
}, createElement(StatusLabel, {
|
|
135
|
-
status: password ? 'protected' : status
|
|
136
|
-
})),
|
|
137
|
-
renderContent: ({
|
|
138
|
-
onClose
|
|
139
|
-
}) => createElement(Fragment, null, createElement(InspectorPopoverHeader, {
|
|
140
|
-
title: __('Status'),
|
|
141
|
-
onClose: onClose
|
|
142
|
-
}), createElement("form", null, createElement(VStack, {
|
|
143
|
-
spacing: 5
|
|
144
|
-
}, createElement(RadioControl, {
|
|
145
|
-
className: "edit-site-change-status__options",
|
|
146
|
-
hideLabelFromVision: true,
|
|
147
|
-
label: __('Status'),
|
|
148
|
-
options: STATUS_OPTIONS,
|
|
149
|
-
onChange: handleStatus,
|
|
150
|
-
selected: status
|
|
151
|
-
}), status !== 'private' && createElement("fieldset", {
|
|
152
|
-
className: "edit-site-change-status__password-fieldset"
|
|
153
|
-
}, createElement(Text, {
|
|
154
|
-
as: "legend",
|
|
155
|
-
className: "edit-site-change-status__password-legend",
|
|
156
|
-
size: "11",
|
|
157
|
-
lineHeight: 1.4,
|
|
158
|
-
weight: 500,
|
|
159
|
-
upperCase: true
|
|
160
|
-
}, __('Password')), createElement(ToggleControl, {
|
|
161
|
-
label: __('Hide this page behind a password'),
|
|
162
|
-
checked: showPassword,
|
|
163
|
-
onChange: handleTogglePassword
|
|
164
|
-
}), showPassword && createElement("div", {
|
|
165
|
-
className: "edit-site-change-status__password-input"
|
|
166
|
-
}, createElement(VisuallyHidden, {
|
|
167
|
-
as: "label",
|
|
168
|
-
htmlFor: `edit-site-change-status__password-input-${instanceId}`
|
|
169
|
-
}, __('Create password')), createElement(TextControl, {
|
|
170
|
-
onChange: value => saveStatus({
|
|
171
|
-
password: value
|
|
172
|
-
}),
|
|
173
|
-
value: password,
|
|
174
|
-
placeholder: __('Use a secure password'),
|
|
175
|
-
type: "text",
|
|
176
|
-
id: `edit-site-change-status__password-input-${instanceId}`
|
|
177
|
-
}))))))
|
|
178
|
-
}));
|
|
179
|
-
}
|
|
180
|
-
//# sourceMappingURL=page-status.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["Button","ToggleControl","Dropdown","__experimentalText","Text","__experimentalVStack","VStack","TextControl","RadioControl","VisuallyHidden","__","useDispatch","useState","useMemo","store","coreStore","noticesStore","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","useInstanceId","privateApis","editorPrivateApis","StatusLabel","unlock","PostPanelRow","STATUS_OPTIONS","label","createElement","Fragment","variant","value","PageStatus","postType","postId","status","password","date","showPassword","setShowPassword","instanceId","editEntityRecord","createErrorNotice","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","saveStatus","newStatus","newPassword","newDate","error","errorMessage","message","code","type","handleTogglePassword","handleStatus","Date","setDate","getDate","contentClassName","focusOnMount","ref","renderToggle","onToggle","className","onClick","renderContent","onClose","title","spacing","hideLabelFromVision","options","onChange","selected","as","size","lineHeight","weight","upperCase","checked","htmlFor","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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AAG;MACxB+D,OAAO,EAAGhD,cAAgB;MAC1BiD,QAAQ,EAAGjB,YAAc;MACzBkB,QAAQ,EAAGzC;IAAQ,CACnB,CAAC,EACAA,MAAM,KAAK,SAAS,IACrBP,aAAA;MAAUuC,SAAS,EAAC;IAA4C,GAC/DvC,aAAA,CAACvB,IAAI;MACJwE,EAAE,EAAC,QAAQ;MACXV,SAAS,EAAC,0CAA0C;MACpDW,IAAI,EAAC,IAAI;MACTC,UAAU,EAAG,GAAK;MAClBC,MAAM,EAAG,GAAK;MACdC,SAAS;IAAA,GAEPtE,EAAE,CAAE,UAAW,CACZ,CAAC,EACPiB,aAAA,CAAC1B,aAAa;MACbyB,KAAK,EAAGhB,EAAE,CACT,kCACD,CAAG;MACHuE,OAAO,EAAG5C,YAAc;MACxBqC,QAAQ,EAAGlB;IAAsB,CACjC,CAAC,EACAnB,YAAY,IACbV,aAAA;MAAKuC,SAAS,EAAC;IAAyC,GACvDvC,aAAA,CAAClB,cAAc;MACdmE,EAAE,EAAC,OAAO;MACVM,OAAO,EAAI,2CAA2C3C,UAAY;IAAG,GAEnE7B,EAAE,CAAE,iBAAkB,CACT,CAAC,EACjBiB,aAAA,CAACpB,WAAW;MACXmE,QAAQ,EAAK5C,KAAK,IACjBiB,UAAU,CAAE;QACXZ,QAAQ,EAAEL;MACX,CAAE,CACF;MACDA,KAAK,EAAGK,QAAU;MAClBgD,WAAW,EAAGzE,EAAE,CACf,uBACD,CAAG;MACH6C,IAAI,EAAC,MAAM;MACX6B,EAAE,EAAI,2CAA2C7C,UAAY;IAAG,CAChE,CACG,CAEG,CAEJ,CACH,CACL;EACA,CACH,CACY,CAAC;AAEjB","ignoreList":[]}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { MenuItem } from '@wordpress/components';
|
|
5
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
|
-
import { __ } from '@wordpress/i18n';
|
|
7
|
-
import { useCopyToClipboard } from '@wordpress/compose';
|
|
8
|
-
import { store as noticesStore } from '@wordpress/notices';
|
|
9
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
10
|
-
import { __unstableSerializeAndClean } from '@wordpress/blocks';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Internal dependencies
|
|
14
|
-
*/
|
|
15
|
-
import { store as editSiteStore } from '../../../store';
|
|
16
|
-
|
|
17
|
-
export default function CopyContentMenuItem() {
|
|
18
|
-
const { createNotice } = useDispatch( noticesStore );
|
|
19
|
-
const { getEditedPostId, getEditedPostType } = useSelect( editSiteStore );
|
|
20
|
-
const { getEditedEntityRecord } = useSelect( coreStore );
|
|
21
|
-
|
|
22
|
-
function getText() {
|
|
23
|
-
const record = getEditedEntityRecord(
|
|
24
|
-
'postType',
|
|
25
|
-
getEditedPostType(),
|
|
26
|
-
getEditedPostId()
|
|
27
|
-
);
|
|
28
|
-
if ( ! record ) {
|
|
29
|
-
return '';
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if ( typeof record.content === 'function' ) {
|
|
33
|
-
return record.content( record );
|
|
34
|
-
} else if ( record.blocks ) {
|
|
35
|
-
return __unstableSerializeAndClean( record.blocks );
|
|
36
|
-
} else if ( record.content ) {
|
|
37
|
-
return record.content;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function onSuccess() {
|
|
42
|
-
createNotice( 'info', __( 'All content copied.' ), {
|
|
43
|
-
isDismissible: true,
|
|
44
|
-
type: 'snackbar',
|
|
45
|
-
} );
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const ref = useCopyToClipboard( getText, onSuccess );
|
|
49
|
-
|
|
50
|
-
return <MenuItem ref={ ref }>{ __( 'Copy all blocks' ) }</MenuItem>;
|
|
51
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { createSlotFill } from '@wordpress/components';
|
|
5
|
-
|
|
6
|
-
const { Fill: ToolsMoreMenuGroup, Slot } = createSlotFill(
|
|
7
|
-
'EditSiteToolsMoreMenuGroup'
|
|
8
|
-
);
|
|
9
|
-
|
|
10
|
-
ToolsMoreMenuGroup.Slot = ( { fillProps } ) => (
|
|
11
|
-
<Slot fillProps={ fillProps }>
|
|
12
|
-
{ ( fills ) => fills && fills.length > 0 }
|
|
13
|
-
</Slot>
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
export default ToolsMoreMenuGroup;
|
|
@@ -1,59 +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
|
-
|
|
9
|
-
function KeyboardShortcutsEditMode() {
|
|
10
|
-
const { replaceBlocks } = useDispatch( blockEditorStore );
|
|
11
|
-
const { getBlockName, getSelectedBlockClientId, getBlockAttributes } =
|
|
12
|
-
useSelect( blockEditorStore );
|
|
13
|
-
|
|
14
|
-
const handleTextLevelShortcut = ( event, level ) => {
|
|
15
|
-
event.preventDefault();
|
|
16
|
-
const destinationBlockName =
|
|
17
|
-
level === 0 ? 'core/paragraph' : 'core/heading';
|
|
18
|
-
const currentClientId = getSelectedBlockClientId();
|
|
19
|
-
if ( currentClientId === null ) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
const blockName = getBlockName( currentClientId );
|
|
23
|
-
if ( blockName !== 'core/paragraph' && blockName !== 'core/heading' ) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
const attributes = getBlockAttributes( currentClientId );
|
|
27
|
-
const textAlign =
|
|
28
|
-
blockName === 'core/paragraph' ? 'align' : 'textAlign';
|
|
29
|
-
const destinationTextAlign =
|
|
30
|
-
destinationBlockName === 'core/paragraph' ? 'align' : 'textAlign';
|
|
31
|
-
|
|
32
|
-
replaceBlocks(
|
|
33
|
-
currentClientId,
|
|
34
|
-
createBlock( destinationBlockName, {
|
|
35
|
-
level,
|
|
36
|
-
content: attributes.content,
|
|
37
|
-
...{ [ destinationTextAlign ]: attributes[ textAlign ] },
|
|
38
|
-
} )
|
|
39
|
-
);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
useShortcut( 'core/edit-site/transform-heading-to-paragraph', ( event ) =>
|
|
43
|
-
handleTextLevelShortcut( event, 0 )
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
[ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {
|
|
47
|
-
//the loop is based off on a constant therefore
|
|
48
|
-
//the hook will execute the same way every time
|
|
49
|
-
//eslint-disable-next-line react-hooks/rules-of-hooks
|
|
50
|
-
useShortcut(
|
|
51
|
-
`core/edit-site/transform-paragraph-to-heading-${ level }`,
|
|
52
|
-
( event ) => handleTextLevelShortcut( event, level )
|
|
53
|
-
);
|
|
54
|
-
} );
|
|
55
|
-
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export default KeyboardShortcutsEditMode;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
5
|
-
import { useSelect } from '@wordpress/data';
|
|
6
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
7
|
-
import { useState, memo } from '@wordpress/element';
|
|
8
|
-
import { Button } from '@wordpress/components';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Internal dependencies
|
|
12
|
-
*/
|
|
13
|
-
import { unlock } from '../../lock-unlock';
|
|
14
|
-
import { store as editSiteStore } from '../../store';
|
|
15
|
-
import CreateTemplatePartModal from '../create-template-part-modal';
|
|
16
|
-
import { TEMPLATE_PART_POST_TYPE } from '../../utils/constants';
|
|
17
|
-
|
|
18
|
-
const { useHistory } = unlock( routerPrivateApis );
|
|
19
|
-
|
|
20
|
-
function AddNewTemplatePart() {
|
|
21
|
-
const { canCreate, postType } = useSelect( ( select ) => {
|
|
22
|
-
const { supportsTemplatePartsMode } =
|
|
23
|
-
select( editSiteStore ).getSettings();
|
|
24
|
-
return {
|
|
25
|
-
canCreate: ! supportsTemplatePartsMode,
|
|
26
|
-
postType: select( coreStore ).getPostType(
|
|
27
|
-
TEMPLATE_PART_POST_TYPE
|
|
28
|
-
),
|
|
29
|
-
};
|
|
30
|
-
}, [] );
|
|
31
|
-
const [ isModalOpen, setIsModalOpen ] = useState( false );
|
|
32
|
-
const history = useHistory();
|
|
33
|
-
|
|
34
|
-
if ( ! canCreate || ! postType ) {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<>
|
|
40
|
-
<Button variant="primary" onClick={ () => setIsModalOpen( true ) }>
|
|
41
|
-
{ postType.labels.add_new_item }
|
|
42
|
-
</Button>
|
|
43
|
-
{ isModalOpen && (
|
|
44
|
-
<CreateTemplatePartModal
|
|
45
|
-
closeModal={ () => setIsModalOpen( false ) }
|
|
46
|
-
blocks={ [] }
|
|
47
|
-
onCreate={ ( templatePart ) => {
|
|
48
|
-
setIsModalOpen( false );
|
|
49
|
-
history.push( {
|
|
50
|
-
postId: templatePart.id,
|
|
51
|
-
postType: TEMPLATE_PART_POST_TYPE,
|
|
52
|
-
canvas: 'edit',
|
|
53
|
-
} );
|
|
54
|
-
} }
|
|
55
|
-
onError={ () => setIsModalOpen( false ) }
|
|
56
|
-
/>
|
|
57
|
-
) }
|
|
58
|
-
</>
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export default memo( AddNewTemplatePart );
|
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
Button,
|
|
6
|
-
ToggleControl,
|
|
7
|
-
Dropdown,
|
|
8
|
-
__experimentalText as Text,
|
|
9
|
-
__experimentalVStack as VStack,
|
|
10
|
-
TextControl,
|
|
11
|
-
RadioControl,
|
|
12
|
-
VisuallyHidden,
|
|
13
|
-
} from '@wordpress/components';
|
|
14
|
-
import { __ } from '@wordpress/i18n';
|
|
15
|
-
import { useDispatch } from '@wordpress/data';
|
|
16
|
-
import { useState, useMemo } from '@wordpress/element';
|
|
17
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
18
|
-
import { store as noticesStore } from '@wordpress/notices';
|
|
19
|
-
import { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';
|
|
20
|
-
import { useInstanceId } from '@wordpress/compose';
|
|
21
|
-
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Internal dependencies
|
|
25
|
-
*/
|
|
26
|
-
import StatusLabel from '../../sidebar-navigation-screen-page/status-label';
|
|
27
|
-
import { unlock } from '../../../lock-unlock';
|
|
28
|
-
|
|
29
|
-
const { PostPanelRow } = unlock( editorPrivateApis );
|
|
30
|
-
|
|
31
|
-
const STATUS_OPTIONS = [
|
|
32
|
-
{
|
|
33
|
-
label: (
|
|
34
|
-
<>
|
|
35
|
-
{ __( 'Draft' ) }
|
|
36
|
-
<Text variant="muted">{ __( 'Not ready to publish.' ) }</Text>
|
|
37
|
-
</>
|
|
38
|
-
),
|
|
39
|
-
value: 'draft',
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
label: (
|
|
43
|
-
<>
|
|
44
|
-
{ __( 'Pending' ) }
|
|
45
|
-
<Text variant="muted">
|
|
46
|
-
{ __( 'Waiting for review before publishing.' ) }
|
|
47
|
-
</Text>
|
|
48
|
-
</>
|
|
49
|
-
),
|
|
50
|
-
value: 'pending',
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
label: (
|
|
54
|
-
<>
|
|
55
|
-
{ __( 'Private' ) }
|
|
56
|
-
<Text variant="muted">
|
|
57
|
-
{ __( 'Only visible to site admins and editors.' ) }
|
|
58
|
-
</Text>
|
|
59
|
-
</>
|
|
60
|
-
),
|
|
61
|
-
value: 'private',
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
label: (
|
|
65
|
-
<>
|
|
66
|
-
{ __( 'Scheduled' ) }
|
|
67
|
-
<Text variant="muted">
|
|
68
|
-
{ __( 'Publish automatically on a chosen date.' ) }
|
|
69
|
-
</Text>
|
|
70
|
-
</>
|
|
71
|
-
),
|
|
72
|
-
value: 'future',
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
label: (
|
|
76
|
-
<>
|
|
77
|
-
{ __( 'Published' ) }
|
|
78
|
-
<Text variant="muted">{ __( 'Visible to everyone.' ) }</Text>
|
|
79
|
-
</>
|
|
80
|
-
),
|
|
81
|
-
value: 'publish',
|
|
82
|
-
},
|
|
83
|
-
];
|
|
84
|
-
|
|
85
|
-
export default function PageStatus( {
|
|
86
|
-
postType,
|
|
87
|
-
postId,
|
|
88
|
-
status,
|
|
89
|
-
password,
|
|
90
|
-
date,
|
|
91
|
-
} ) {
|
|
92
|
-
const [ showPassword, setShowPassword ] = useState( !! password );
|
|
93
|
-
const instanceId = useInstanceId( PageStatus );
|
|
94
|
-
|
|
95
|
-
const { editEntityRecord } = useDispatch( coreStore );
|
|
96
|
-
const { createErrorNotice } = useDispatch( noticesStore );
|
|
97
|
-
|
|
98
|
-
const [ popoverAnchor, setPopoverAnchor ] = useState( null );
|
|
99
|
-
// Memoize popoverProps to avoid returning a new object every time.
|
|
100
|
-
const popoverProps = useMemo(
|
|
101
|
-
() => ( {
|
|
102
|
-
// Anchor the popover to the middle of the entire row so that it doesn't
|
|
103
|
-
// move around when the label changes.
|
|
104
|
-
anchor: popoverAnchor,
|
|
105
|
-
'aria-label': __( 'Change status' ),
|
|
106
|
-
placement: 'bottom-end',
|
|
107
|
-
} ),
|
|
108
|
-
[ popoverAnchor ]
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
const saveStatus = async ( {
|
|
112
|
-
status: newStatus = status,
|
|
113
|
-
password: newPassword = password,
|
|
114
|
-
date: newDate = date,
|
|
115
|
-
} ) => {
|
|
116
|
-
try {
|
|
117
|
-
await editEntityRecord( 'postType', postType, postId, {
|
|
118
|
-
status: newStatus,
|
|
119
|
-
date: newDate,
|
|
120
|
-
password: newPassword,
|
|
121
|
-
} );
|
|
122
|
-
} catch ( error ) {
|
|
123
|
-
const errorMessage =
|
|
124
|
-
error.message && error.code !== 'unknown_error'
|
|
125
|
-
? error.message
|
|
126
|
-
: __( 'An error occurred while updating the status' );
|
|
127
|
-
|
|
128
|
-
createErrorNotice( errorMessage, {
|
|
129
|
-
type: 'snackbar',
|
|
130
|
-
} );
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
const handleTogglePassword = ( value ) => {
|
|
135
|
-
setShowPassword( value );
|
|
136
|
-
if ( ! value ) {
|
|
137
|
-
saveStatus( { password: '' } );
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
const handleStatus = ( value ) => {
|
|
142
|
-
let newDate = date;
|
|
143
|
-
let newPassword = password;
|
|
144
|
-
if ( value === 'publish' ) {
|
|
145
|
-
if ( new Date( date ) > new Date() ) {
|
|
146
|
-
newDate = null;
|
|
147
|
-
}
|
|
148
|
-
} else if ( value === 'future' ) {
|
|
149
|
-
if ( ! date || new Date( date ) < new Date() ) {
|
|
150
|
-
newDate = new Date();
|
|
151
|
-
newDate.setDate( newDate.getDate() + 7 );
|
|
152
|
-
}
|
|
153
|
-
} else if ( value === 'private' && password ) {
|
|
154
|
-
setShowPassword( false );
|
|
155
|
-
newPassword = '';
|
|
156
|
-
}
|
|
157
|
-
saveStatus( {
|
|
158
|
-
status: value,
|
|
159
|
-
date: newDate,
|
|
160
|
-
password: newPassword,
|
|
161
|
-
} );
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
return (
|
|
165
|
-
<PostPanelRow label={ __( 'Status' ) }>
|
|
166
|
-
<Dropdown
|
|
167
|
-
contentClassName="edit-site-change-status__content"
|
|
168
|
-
popoverProps={ popoverProps }
|
|
169
|
-
focusOnMount
|
|
170
|
-
ref={ setPopoverAnchor }
|
|
171
|
-
renderToggle={ ( { onToggle } ) => (
|
|
172
|
-
<Button
|
|
173
|
-
className="edit-site-summary-field__trigger"
|
|
174
|
-
variant="tertiary"
|
|
175
|
-
onClick={ onToggle }
|
|
176
|
-
>
|
|
177
|
-
<StatusLabel
|
|
178
|
-
status={ password ? 'protected' : status }
|
|
179
|
-
/>
|
|
180
|
-
</Button>
|
|
181
|
-
) }
|
|
182
|
-
renderContent={ ( { onClose } ) => (
|
|
183
|
-
<>
|
|
184
|
-
<InspectorPopoverHeader
|
|
185
|
-
title={ __( 'Status' ) }
|
|
186
|
-
onClose={ onClose }
|
|
187
|
-
/>
|
|
188
|
-
<form>
|
|
189
|
-
<VStack spacing={ 5 }>
|
|
190
|
-
<RadioControl
|
|
191
|
-
className="edit-site-change-status__options"
|
|
192
|
-
hideLabelFromVision
|
|
193
|
-
label={ __( 'Status' ) }
|
|
194
|
-
options={ STATUS_OPTIONS }
|
|
195
|
-
onChange={ handleStatus }
|
|
196
|
-
selected={ status }
|
|
197
|
-
/>
|
|
198
|
-
{ status !== 'private' && (
|
|
199
|
-
<fieldset className="edit-site-change-status__password-fieldset">
|
|
200
|
-
<Text
|
|
201
|
-
as="legend"
|
|
202
|
-
className="edit-site-change-status__password-legend"
|
|
203
|
-
size="11"
|
|
204
|
-
lineHeight={ 1.4 }
|
|
205
|
-
weight={ 500 }
|
|
206
|
-
upperCase
|
|
207
|
-
>
|
|
208
|
-
{ __( 'Password' ) }
|
|
209
|
-
</Text>
|
|
210
|
-
<ToggleControl
|
|
211
|
-
label={ __(
|
|
212
|
-
'Hide this page behind a password'
|
|
213
|
-
) }
|
|
214
|
-
checked={ showPassword }
|
|
215
|
-
onChange={ handleTogglePassword }
|
|
216
|
-
/>
|
|
217
|
-
{ showPassword && (
|
|
218
|
-
<div className="edit-site-change-status__password-input">
|
|
219
|
-
<VisuallyHidden
|
|
220
|
-
as="label"
|
|
221
|
-
htmlFor={ `edit-site-change-status__password-input-${ instanceId }` }
|
|
222
|
-
>
|
|
223
|
-
{ __( 'Create password' ) }
|
|
224
|
-
</VisuallyHidden>
|
|
225
|
-
<TextControl
|
|
226
|
-
onChange={ ( value ) =>
|
|
227
|
-
saveStatus( {
|
|
228
|
-
password: value,
|
|
229
|
-
} )
|
|
230
|
-
}
|
|
231
|
-
value={ password }
|
|
232
|
-
placeholder={ __(
|
|
233
|
-
'Use a secure password'
|
|
234
|
-
) }
|
|
235
|
-
type="text"
|
|
236
|
-
id={ `edit-site-change-status__password-input-${ instanceId }` }
|
|
237
|
-
/>
|
|
238
|
-
</div>
|
|
239
|
-
) }
|
|
240
|
-
</fieldset>
|
|
241
|
-
) }
|
|
242
|
-
</VStack>
|
|
243
|
-
</form>
|
|
244
|
-
</>
|
|
245
|
-
) }
|
|
246
|
-
/>
|
|
247
|
-
</PostPanelRow>
|
|
248
|
-
);
|
|
249
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
.edit-site-change-status__content {
|
|
2
|
-
.components-popover__content {
|
|
3
|
-
min-width: 320px;
|
|
4
|
-
padding: $grid-unit-20;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.edit-site-change-status__options {
|
|
8
|
-
.components-base-control__field > .components-v-stack {
|
|
9
|
-
gap: $grid-unit-10;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
label {
|
|
13
|
-
.components-text {
|
|
14
|
-
display: block;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.edit-site-change-status__password-legend {
|
|
20
|
-
padding: 0;
|
|
21
|
-
margin-bottom: $grid-unit-10;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.edit-site-summary-field__trigger {
|
|
26
|
-
max-width: 100%;
|
|
27
|
-
|
|
28
|
-
// Truncate
|
|
29
|
-
display: block;
|
|
30
|
-
text-align: left;
|
|
31
|
-
white-space: nowrap;
|
|
32
|
-
overflow: hidden;
|
|
33
|
-
text-overflow: ellipsis;
|
|
34
|
-
}
|
|
File without changes
|
|
File without changes
|