@wordpress/editor 13.34.0 → 13.35.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 +10 -4
- package/build/bindings/pattern-overrides.js +70 -1
- package/build/bindings/pattern-overrides.js.map +1 -1
- package/build/components/block-settings-menu/content-only-settings-menu.js +126 -0
- package/build/components/block-settings-menu/content-only-settings-menu.js.map +1 -0
- package/build/components/block-settings-menu/content-only-settings-menu.native.js +11 -0
- package/build/components/block-settings-menu/content-only-settings-menu.native.js.map +1 -0
- package/build/components/collapsible-block-toolbar/index.js +2 -2
- package/build/components/collapsible-block-toolbar/index.js.map +1 -1
- package/build/components/document-bar/index.js +2 -2
- package/build/components/document-bar/index.js.map +1 -1
- package/build/components/document-outline/item.js +2 -2
- package/build/components/document-outline/item.js.map +1 -1
- package/build/components/document-tools/index.js +15 -18
- package/build/components/document-tools/index.js.map +1 -1
- package/build/components/editor-canvas/index.js +19 -8
- package/build/components/editor-canvas/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js +1 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build/components/global-styles-provider/index.js +130 -0
- package/build/components/global-styles-provider/index.js.map +1 -0
- package/build/components/header/index.js +147 -0
- package/build/components/header/index.js.map +1 -0
- package/build/components/inserter-sidebar/index.js +56 -31
- package/build/components/inserter-sidebar/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +2 -2
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/post-actions/actions.js +122 -64
- package/build/components/post-actions/actions.js.map +1 -1
- package/build/components/post-actions/index.js +7 -14
- package/build/components/post-actions/index.js.map +1 -1
- package/build/components/post-card-panel/index.js +5 -29
- package/build/components/post-card-panel/index.js.map +1 -1
- package/build/components/post-comments/index.js +28 -8
- package/build/components/post-comments/index.js.map +1 -1
- package/build/components/post-discussion/panel.js +103 -21
- package/build/components/post-discussion/panel.js.map +1 -1
- package/build/components/post-excerpt/panel.js +2 -2
- package/build/components/post-excerpt/panel.js.map +1 -1
- package/build/components/post-format/panel.js +27 -0
- package/build/components/post-format/panel.js.map +1 -0
- package/build/components/post-panel-row/index.js +2 -2
- package/build/components/post-panel-row/index.js.map +1 -1
- package/build/components/post-panel-section/index.js +28 -0
- package/build/components/post-panel-section/index.js.map +1 -0
- package/build/components/post-pingbacks/index.js +5 -2
- package/build/components/post-pingbacks/index.js.map +1 -1
- package/build/components/post-saved-state/index.js +2 -2
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-slug/panel.js +27 -0
- package/build/components/post-slug/panel.js.map +1 -0
- package/build/components/post-status/index.js +4 -4
- package/build/components/post-status/index.js.map +1 -1
- package/build/components/post-sticky/panel.js +21 -0
- package/build/components/post-sticky/panel.js.map +1 -0
- package/build/components/post-title/index.js +2 -2
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/post-title/post-title-raw.js +2 -2
- package/build/components/post-title/post-title-raw.js.map +1 -1
- package/build/components/post-transform-panel/hooks.js +90 -0
- package/build/components/post-transform-panel/hooks.js.map +1 -0
- package/build/components/post-transform-panel/index.js +101 -0
- package/build/components/post-transform-panel/index.js.map +1 -0
- package/build/components/post-trash/panel.js +18 -0
- package/build/components/post-trash/panel.js.map +1 -0
- package/build/components/post-type-support-check/index.js +1 -1
- package/build/components/post-type-support-check/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +3 -3
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/provider/index.js +3 -1
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +21 -3
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/sidebar/constants.js +11 -0
- package/build/components/sidebar/constants.js.map +1 -0
- package/build/components/sidebar/header.js +53 -0
- package/build/components/sidebar/header.js.map +1 -0
- package/build/components/sidebar/index.js +157 -0
- package/build/components/sidebar/index.js.map +1 -0
- package/build/components/sidebar/post-summary.js +84 -0
- package/build/components/sidebar/post-summary.js.map +1 -0
- package/build/components/start-page-options/index.js +5 -7
- package/build/components/start-page-options/index.js.map +1 -1
- package/build/components/start-template-options/index.js +192 -0
- package/build/components/start-template-options/index.js.map +1 -0
- package/build/components/template-content-panel/index.js +38 -0
- package/build/components/template-content-panel/index.js.map +1 -0
- package/build/hooks/pattern-overrides.js +10 -5
- package/build/hooks/pattern-overrides.js.map +1 -1
- package/build/private-apis.js +7 -12
- package/build/private-apis.js.map +1 -1
- package/build/private-apis.native.js +72 -0
- package/build/private-apis.native.js.map +1 -0
- package/build/store/private-selectors.js +6 -1
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +15 -0
- package/build/store/reducer.js.map +1 -1
- package/build-module/bindings/pattern-overrides.js +69 -1
- package/build-module/bindings/pattern-overrides.js.map +1 -1
- package/build-module/components/block-settings-menu/content-only-settings-menu.js +119 -0
- package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -0
- package/build-module/components/block-settings-menu/content-only-settings-menu.native.js +5 -0
- package/build-module/components/block-settings-menu/content-only-settings-menu.native.js.map +1 -0
- package/build-module/components/collapsible-block-toolbar/index.js +2 -2
- package/build-module/components/collapsible-block-toolbar/index.js.map +1 -1
- package/build-module/components/document-bar/index.js +2 -2
- package/build-module/components/document-bar/index.js.map +1 -1
- package/build-module/components/document-outline/item.js +2 -2
- package/build-module/components/document-outline/item.js.map +1 -1
- package/build-module/components/document-tools/index.js +16 -19
- package/build-module/components/document-tools/index.js.map +1 -1
- package/build-module/components/editor-canvas/index.js +19 -8
- package/build-module/components/editor-canvas/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +1 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build-module/components/global-styles-provider/index.js +120 -0
- package/build-module/components/global-styles-provider/index.js.map +1 -0
- package/build-module/components/header/index.js +139 -0
- package/build-module/components/header/index.js.map +1 -0
- package/build-module/components/inserter-sidebar/index.js +59 -34
- package/build-module/components/inserter-sidebar/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +2 -2
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/post-actions/actions.js +125 -66
- package/build-module/components/post-actions/actions.js.map +1 -1
- package/build-module/components/post-actions/index.js +7 -14
- package/build-module/components/post-actions/index.js.map +1 -1
- package/build-module/components/post-card-panel/index.js +7 -30
- package/build-module/components/post-card-panel/index.js.map +1 -1
- package/build-module/components/post-comments/index.js +30 -10
- package/build-module/components/post-comments/index.js.map +1 -1
- package/build-module/components/post-discussion/panel.js +105 -23
- package/build-module/components/post-discussion/panel.js.map +1 -1
- package/build-module/components/post-excerpt/panel.js +2 -2
- package/build-module/components/post-excerpt/panel.js.map +1 -1
- package/build-module/components/post-format/panel.js +18 -0
- package/build-module/components/post-format/panel.js.map +1 -0
- package/build-module/components/post-panel-row/index.js +2 -2
- package/build-module/components/post-panel-row/index.js.map +1 -1
- package/build-module/components/post-panel-section/index.js +20 -0
- package/build-module/components/post-panel-section/index.js.map +1 -0
- package/build-module/components/post-pingbacks/index.js +6 -3
- package/build-module/components/post-pingbacks/index.js.map +1 -1
- package/build-module/components/post-saved-state/index.js +2 -2
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-slug/panel.js +18 -0
- package/build-module/components/post-slug/panel.js.map +1 -0
- package/build-module/components/post-status/index.js +4 -4
- package/build-module/components/post-status/index.js.map +1 -1
- package/build-module/components/post-sticky/panel.js +12 -0
- package/build-module/components/post-sticky/panel.js.map +1 -0
- package/build-module/components/post-title/index.js +2 -2
- package/build-module/components/post-title/index.js.map +1 -1
- package/build-module/components/post-title/post-title-raw.js +2 -2
- package/build-module/components/post-title/post-title-raw.js.map +1 -1
- package/build-module/components/post-transform-panel/hooks.js +83 -0
- package/build-module/components/post-transform-panel/hooks.js.map +1 -0
- package/build-module/components/post-transform-panel/index.js +94 -0
- package/build-module/components/post-transform-panel/index.js.map +1 -0
- package/build-module/components/post-trash/panel.js +10 -0
- package/build-module/components/post-trash/panel.js.map +1 -0
- package/build-module/components/post-type-support-check/index.js +1 -1
- package/build-module/components/post-type-support-check/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +3 -3
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/provider/index.js +3 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +21 -3
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/sidebar/constants.js +5 -0
- package/build-module/components/sidebar/constants.js.map +1 -0
- package/build-module/components/sidebar/header.js +46 -0
- package/build-module/components/sidebar/header.js.map +1 -0
- package/build-module/components/sidebar/index.js +149 -0
- package/build-module/components/sidebar/index.js.map +1 -0
- package/build-module/components/sidebar/post-summary.js +77 -0
- package/build-module/components/sidebar/post-summary.js.map +1 -0
- package/build-module/components/start-page-options/index.js +5 -7
- package/build-module/components/start-page-options/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +185 -0
- package/build-module/components/start-template-options/index.js.map +1 -0
- package/build-module/components/template-content-panel/index.js +31 -0
- package/build-module/components/template-content-panel/index.js.map +1 -0
- package/build-module/hooks/pattern-overrides.js +10 -5
- package/build-module/hooks/pattern-overrides.js.map +1 -1
- package/build-module/private-apis.js +7 -12
- package/build-module/private-apis.js.map +1 -1
- package/build-module/private-apis.native.js +62 -0
- package/build-module/private-apis.native.js.map +1 -0
- package/build-module/store/private-selectors.js +3 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +14 -0
- package/build-module/store/reducer.js.map +1 -1
- package/build-style/style-rtl.css +328 -18
- package/build-style/style.css +328 -18
- package/package.json +38 -36
- package/src/bindings/pattern-overrides.js +83 -1
- package/src/components/autocompleters/style.scss +1 -2
- package/src/components/block-settings-menu/content-only-settings-menu.js +175 -0
- package/src/components/block-settings-menu/content-only-settings-menu.native.js +4 -0
- package/src/components/block-settings-menu/style.scss +4 -0
- package/src/components/collapsible-block-toolbar/index.js +2 -2
- package/src/components/document-bar/index.js +2 -2
- package/src/components/document-outline/item.js +2 -2
- package/src/components/document-tools/index.js +19 -21
- package/src/components/editor-canvas/index.js +18 -6
- package/src/components/global-keyboard-shortcuts/register-shortcuts.js +1 -1
- package/src/components/global-styles-provider/index.js +162 -0
- package/src/components/header/index.js +154 -0
- package/src/components/header/style.scss +231 -0
- package/src/components/inserter-sidebar/index.js +52 -29
- package/src/components/inserter-sidebar/style.scss +10 -3
- package/src/components/keyboard-shortcut-help-modal/index.js +2 -2
- package/src/components/list-view-sidebar/style.scss +1 -0
- package/src/components/page-attributes/test/order.js +5 -1
- package/src/components/post-actions/actions.js +256 -150
- package/src/components/post-actions/index.js +5 -38
- package/src/components/post-card-panel/index.js +39 -85
- package/src/components/post-comments/index.js +47 -9
- package/src/components/post-discussion/panel.js +108 -31
- package/src/components/post-discussion/style.scss +26 -0
- package/src/components/post-excerpt/panel.js +2 -2
- package/src/components/post-format/panel.js +22 -0
- package/src/components/post-format/style.scss +6 -0
- package/src/components/post-last-revision/test/check.js +5 -1
- package/src/components/post-panel-row/index.js +2 -2
- package/src/components/post-panel-section/index.js +19 -0
- package/src/components/post-panel-section/style.scss +3 -0
- package/src/components/post-pingbacks/index.js +11 -2
- package/src/components/post-publish-panel/style.scss +5 -0
- package/src/components/post-saved-state/index.js +2 -2
- package/src/components/post-slug/panel.js +22 -0
- package/src/components/post-slug/style.scss +5 -0
- package/src/components/post-slug/test/index.js +5 -1
- package/src/components/post-status/index.js +4 -4
- package/src/components/post-sticky/panel.js +18 -0
- package/src/components/post-title/index.js +2 -2
- package/src/components/post-title/post-title-raw.js +2 -2
- package/src/components/post-transform-panel/hooks.js +114 -0
- package/src/components/post-transform-panel/index.js +99 -0
- package/src/components/post-trash/panel.js +13 -0
- package/src/components/post-type-support-check/index.js +1 -1
- package/src/components/post-type-support-check/test/index.js +2 -2
- package/src/components/preferences-modal/index.js +3 -3
- package/src/components/provider/index.js +4 -0
- package/src/components/provider/use-block-editor-settings.js +19 -4
- package/src/components/sidebar/constants.js +4 -0
- package/src/components/sidebar/header.js +49 -0
- package/src/components/sidebar/index.js +200 -0
- package/src/components/sidebar/post-summary.js +104 -0
- package/src/components/sidebar/style.scss +18 -0
- package/src/components/start-page-options/index.js +6 -4
- package/src/components/start-template-options/index.js +219 -0
- package/src/components/start-template-options/style.scss +55 -0
- package/src/components/template-areas/style.scss +0 -1
- package/src/components/template-content-panel/index.js +36 -0
- package/src/hooks/pattern-overrides.js +12 -6
- package/src/private-apis.js +10 -12
- package/src/private-apis.native.js +61 -0
- package/src/store/private-selectors.js +3 -0
- package/src/store/reducer.js +12 -0
- package/src/style.scss +7 -0
- package/src/components/post-slug/test/check.js +0 -17
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import classnames from 'classnames';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
9
4
|
import {
|
|
10
5
|
Icon,
|
|
11
6
|
__experimentalHStack as HStack,
|
|
12
|
-
__experimentalVStack as VStack,
|
|
13
7
|
__experimentalText as Text,
|
|
14
|
-
PanelBody,
|
|
15
8
|
} from '@wordpress/components';
|
|
16
9
|
import { store as coreStore } from '@wordpress/core-data';
|
|
17
10
|
import { useSelect } from '@wordpress/data';
|
|
@@ -25,89 +18,50 @@ import { store as editorStore } from '../../store';
|
|
|
25
18
|
import {
|
|
26
19
|
TEMPLATE_POST_TYPE,
|
|
27
20
|
TEMPLATE_PART_POST_TYPE,
|
|
28
|
-
PATTERN_POST_TYPE,
|
|
29
21
|
} from '../../store/constants';
|
|
30
|
-
import { PrivatePostExcerptPanel } from '../post-excerpt/panel';
|
|
31
|
-
import PostLastEditedPanel from '../post-last-edited-panel';
|
|
32
22
|
import { unlock } from '../../lock-unlock';
|
|
33
|
-
import TemplateAreas from '../template-areas';
|
|
34
23
|
|
|
35
|
-
export default function PostCardPanel( {
|
|
36
|
-
const { title,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
icon: unlock( select( editorStore ) ).getPostIcon( _type, {
|
|
58
|
-
area: _record?.area,
|
|
59
|
-
} ),
|
|
60
|
-
// Post excerpt panel and Last Edited info are rendered in different place depending on the post type.
|
|
61
|
-
// So we cannot make this check inside the PostExcerpt or PostLastEditedPanel component based on the current edited entity.
|
|
62
|
-
showPostContentPanels: [
|
|
63
|
-
TEMPLATE_POST_TYPE,
|
|
64
|
-
TEMPLATE_PART_POST_TYPE,
|
|
65
|
-
PATTERN_POST_TYPE,
|
|
66
|
-
].includes( _type ),
|
|
67
|
-
};
|
|
68
|
-
},
|
|
69
|
-
[]
|
|
70
|
-
);
|
|
24
|
+
export default function PostCardPanel( { actions } ) {
|
|
25
|
+
const { title, icon } = useSelect( ( select ) => {
|
|
26
|
+
const {
|
|
27
|
+
getEditedPostAttribute,
|
|
28
|
+
getCurrentPostType,
|
|
29
|
+
getCurrentPostId,
|
|
30
|
+
__experimentalGetTemplateInfo,
|
|
31
|
+
} = select( editorStore );
|
|
32
|
+
const { getEditedEntityRecord } = select( coreStore );
|
|
33
|
+
const _type = getCurrentPostType();
|
|
34
|
+
const _id = getCurrentPostId();
|
|
35
|
+
const _record = getEditedEntityRecord( 'postType', _type, _id );
|
|
36
|
+
const _templateInfo =
|
|
37
|
+
[ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE ].includes( _type ) &&
|
|
38
|
+
__experimentalGetTemplateInfo( _record );
|
|
39
|
+
return {
|
|
40
|
+
title: _templateInfo?.title || getEditedPostAttribute( 'title' ),
|
|
41
|
+
icon: unlock( select( editorStore ) ).getPostIcon( _type, {
|
|
42
|
+
area: _record?.area,
|
|
43
|
+
} ),
|
|
44
|
+
};
|
|
45
|
+
}, [] );
|
|
71
46
|
return (
|
|
72
|
-
<
|
|
73
|
-
<
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
47
|
+
<div className="editor-post-card-panel">
|
|
48
|
+
<HStack
|
|
49
|
+
spacing={ 2 }
|
|
50
|
+
className="editor-post-card-panel__header"
|
|
51
|
+
align="flex-start"
|
|
77
52
|
>
|
|
78
|
-
<
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
53
|
+
<Icon className="editor-post-card-panel__icon" icon={ icon } />
|
|
54
|
+
<Text
|
|
55
|
+
numberOfLines={ 2 }
|
|
56
|
+
truncate
|
|
57
|
+
className="editor-post-card-panel__title"
|
|
58
|
+
weight={ 500 }
|
|
59
|
+
as="h2"
|
|
82
60
|
>
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
numberOfLines={ 2 }
|
|
89
|
-
truncate
|
|
90
|
-
className="editor-post-card-panel__title"
|
|
91
|
-
weight={ 500 }
|
|
92
|
-
as="h2"
|
|
93
|
-
>
|
|
94
|
-
{ title ? decodeEntities( title ) : __( 'No Title' ) }
|
|
95
|
-
</Text>
|
|
96
|
-
{ actions }
|
|
97
|
-
</HStack>
|
|
98
|
-
<VStack className="editor-post-card-panel__content">
|
|
99
|
-
{ showPostContentPanels && (
|
|
100
|
-
<VStack
|
|
101
|
-
className="editor-post-card-panel__description"
|
|
102
|
-
spacing={ 2 }
|
|
103
|
-
>
|
|
104
|
-
<PrivatePostExcerptPanel />
|
|
105
|
-
<PostLastEditedPanel />
|
|
106
|
-
</VStack>
|
|
107
|
-
) }
|
|
108
|
-
{ postType === TEMPLATE_POST_TYPE && <TemplateAreas /> }
|
|
109
|
-
</VStack>
|
|
110
|
-
</div>
|
|
111
|
-
</PanelBody>
|
|
61
|
+
{ title ? decodeEntities( title ) : __( 'No Title' ) }
|
|
62
|
+
</Text>
|
|
63
|
+
{ actions }
|
|
64
|
+
</HStack>
|
|
65
|
+
</div>
|
|
112
66
|
);
|
|
113
67
|
}
|
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
RadioControl,
|
|
7
|
+
__experimentalText as Text,
|
|
8
|
+
__experimentalVStack as VStack,
|
|
9
|
+
} from '@wordpress/components';
|
|
6
10
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
7
11
|
|
|
8
12
|
/**
|
|
@@ -10,6 +14,34 @@ import { useDispatch, useSelect } from '@wordpress/data';
|
|
|
10
14
|
*/
|
|
11
15
|
import { store as editorStore } from '../../store';
|
|
12
16
|
|
|
17
|
+
const COMMENT_OPTIONS = [
|
|
18
|
+
{
|
|
19
|
+
label: (
|
|
20
|
+
<>
|
|
21
|
+
{ __( 'Open' ) }
|
|
22
|
+
<Text variant="muted" size={ 12 }>
|
|
23
|
+
{ __( 'Visitors can add new comments and replies.' ) }
|
|
24
|
+
</Text>
|
|
25
|
+
</>
|
|
26
|
+
),
|
|
27
|
+
value: 'open',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
label: (
|
|
31
|
+
<>
|
|
32
|
+
{ __( 'Closed' ) }
|
|
33
|
+
<Text variant="muted" size={ 12 }>
|
|
34
|
+
{ __( 'Visitors cannot add new comments or replies.' ) }
|
|
35
|
+
</Text>
|
|
36
|
+
<Text variant="muted" size={ 12 }>
|
|
37
|
+
{ __( 'Existing comments remain visible.' ) }
|
|
38
|
+
</Text>
|
|
39
|
+
</>
|
|
40
|
+
),
|
|
41
|
+
value: 'closed',
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
|
|
13
45
|
function PostComments() {
|
|
14
46
|
const commentStatus = useSelect(
|
|
15
47
|
( select ) =>
|
|
@@ -18,18 +50,24 @@ function PostComments() {
|
|
|
18
50
|
[]
|
|
19
51
|
);
|
|
20
52
|
const { editPost } = useDispatch( editorStore );
|
|
21
|
-
const
|
|
53
|
+
const handleStatus = ( newCommentStatus ) =>
|
|
22
54
|
editPost( {
|
|
23
|
-
comment_status:
|
|
55
|
+
comment_status: newCommentStatus,
|
|
24
56
|
} );
|
|
25
57
|
|
|
26
58
|
return (
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
59
|
+
<form>
|
|
60
|
+
<VStack spacing={ 4 }>
|
|
61
|
+
<RadioControl
|
|
62
|
+
className="editor-change-status__options"
|
|
63
|
+
hideLabelFromVision
|
|
64
|
+
label={ __( 'Comment status' ) }
|
|
65
|
+
options={ COMMENT_OPTIONS }
|
|
66
|
+
onChange={ handleStatus }
|
|
67
|
+
selected={ commentStatus }
|
|
68
|
+
/>
|
|
69
|
+
</VStack>
|
|
70
|
+
</form>
|
|
33
71
|
);
|
|
34
72
|
}
|
|
35
73
|
|
|
@@ -2,8 +2,16 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import {
|
|
6
|
-
|
|
5
|
+
import {
|
|
6
|
+
Dropdown,
|
|
7
|
+
Button,
|
|
8
|
+
__experimentalVStack as VStack,
|
|
9
|
+
__experimentalText as Text,
|
|
10
|
+
} from '@wordpress/components';
|
|
11
|
+
import { useSelect } from '@wordpress/data';
|
|
12
|
+
import { useState, useMemo } from '@wordpress/element';
|
|
13
|
+
import { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';
|
|
14
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
7
15
|
|
|
8
16
|
/**
|
|
9
17
|
* Internal dependencies
|
|
@@ -12,50 +20,119 @@ import { store as editorStore } from '../../store';
|
|
|
12
20
|
import PostTypeSupportCheck from '../post-type-support-check';
|
|
13
21
|
import PostComments from '../post-comments';
|
|
14
22
|
import PostPingbacks from '../post-pingbacks';
|
|
23
|
+
import PostPanelRow from '../post-panel-row';
|
|
15
24
|
|
|
16
25
|
const PANEL_NAME = 'discussion-panel';
|
|
17
26
|
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
27
|
+
function ModalContents( { onClose } ) {
|
|
28
|
+
return (
|
|
29
|
+
<div className="editor-post-discussion">
|
|
30
|
+
<InspectorPopoverHeader
|
|
31
|
+
title={ __( 'Discussion' ) }
|
|
32
|
+
onClose={ onClose }
|
|
33
|
+
/>
|
|
34
|
+
<VStack spacing={ 4 }>
|
|
35
|
+
<PostTypeSupportCheck supportKeys="comments">
|
|
36
|
+
<PostComments />
|
|
37
|
+
</PostTypeSupportCheck>
|
|
38
|
+
<PostTypeSupportCheck supportKeys="trackbacks">
|
|
39
|
+
<PostPingbacks />
|
|
40
|
+
</PostTypeSupportCheck>
|
|
41
|
+
</VStack>
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function PostDiscussionToggle( { isOpen, onClick } ) {
|
|
47
|
+
const {
|
|
48
|
+
commentStatus,
|
|
49
|
+
pingStatus,
|
|
50
|
+
commentsSupported,
|
|
51
|
+
trackbacksSupported,
|
|
52
|
+
} = useSelect( ( select ) => {
|
|
53
|
+
const { getEditedPostAttribute } = select( editorStore );
|
|
54
|
+
const { getPostType } = select( coreStore );
|
|
55
|
+
const postType = getPostType( getEditedPostAttribute( 'type' ) );
|
|
22
56
|
return {
|
|
23
|
-
|
|
24
|
-
|
|
57
|
+
commentStatus: getEditedPostAttribute( 'comment_status' ) ?? 'open',
|
|
58
|
+
pingStatus: getEditedPostAttribute( 'ping_status' ) ?? 'open',
|
|
59
|
+
commentsSupported: !! postType.supports.comments,
|
|
60
|
+
trackbacksSupported: !! postType.supports.trackbacks,
|
|
25
61
|
};
|
|
26
62
|
}, [] );
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
63
|
+
let label;
|
|
64
|
+
if ( commentStatus === 'open' ) {
|
|
65
|
+
if ( pingStatus === 'open' ) {
|
|
66
|
+
label = __( 'Open' );
|
|
67
|
+
} else {
|
|
68
|
+
label = trackbacksSupported ? __( 'Comments only' ) : __( 'Open' );
|
|
69
|
+
}
|
|
70
|
+
} else if ( pingStatus === 'open' ) {
|
|
71
|
+
label = commentsSupported ? __( 'Pings only' ) : __( 'Pings enabled' );
|
|
72
|
+
} else {
|
|
73
|
+
label = __( 'Closed' );
|
|
32
74
|
}
|
|
33
|
-
|
|
34
75
|
return (
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
76
|
+
<Button
|
|
77
|
+
size="compact"
|
|
78
|
+
className="editor-post-discussion__panel-toggle"
|
|
79
|
+
variant="tertiary"
|
|
80
|
+
aria-label={ __( 'Change discussion options' ) }
|
|
81
|
+
aria-expanded={ isOpen }
|
|
82
|
+
onClick={ onClick }
|
|
39
83
|
>
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
<PostComments />
|
|
43
|
-
</PanelRow>
|
|
44
|
-
</PostTypeSupportCheck>
|
|
45
|
-
|
|
46
|
-
<PostTypeSupportCheck supportKeys="trackbacks">
|
|
47
|
-
<PanelRow>
|
|
48
|
-
<PostPingbacks />
|
|
49
|
-
</PanelRow>
|
|
50
|
-
</PostTypeSupportCheck>
|
|
51
|
-
</PanelBody>
|
|
84
|
+
<Text>{ label }</Text>
|
|
85
|
+
</Button>
|
|
52
86
|
);
|
|
53
87
|
}
|
|
54
88
|
|
|
55
89
|
export default function PostDiscussionPanel() {
|
|
90
|
+
const { isEnabled } = useSelect( ( select ) => {
|
|
91
|
+
const { isEditorPanelEnabled } = select( editorStore );
|
|
92
|
+
return {
|
|
93
|
+
isEnabled: isEditorPanelEnabled( PANEL_NAME ),
|
|
94
|
+
};
|
|
95
|
+
}, [] );
|
|
96
|
+
|
|
97
|
+
// Use internal state instead of a ref to make sure that the component
|
|
98
|
+
// re-renders when the popover's anchor updates.
|
|
99
|
+
const [ popoverAnchor, setPopoverAnchor ] = useState( null );
|
|
100
|
+
// Memoize popoverProps to avoid returning a new object every time.
|
|
101
|
+
const popoverProps = useMemo(
|
|
102
|
+
() => ( {
|
|
103
|
+
// Anchor the popover to the middle of the entire row so that it doesn't
|
|
104
|
+
// move around when the label changes.
|
|
105
|
+
anchor: popoverAnchor,
|
|
106
|
+
placement: 'left-start',
|
|
107
|
+
offset: 36,
|
|
108
|
+
shift: true,
|
|
109
|
+
} ),
|
|
110
|
+
[ popoverAnchor ]
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
if ( ! isEnabled ) {
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
|
|
56
117
|
return (
|
|
57
118
|
<PostTypeSupportCheck supportKeys={ [ 'comments', 'trackbacks' ] }>
|
|
58
|
-
<
|
|
119
|
+
<PostPanelRow label={ __( 'Discussion' ) } ref={ setPopoverAnchor }>
|
|
120
|
+
<Dropdown
|
|
121
|
+
popoverProps={ popoverProps }
|
|
122
|
+
className="editor-post-discussion__panel-dropdown"
|
|
123
|
+
contentClassName="editor-post-discussion__panel-dialog"
|
|
124
|
+
focusOnMount
|
|
125
|
+
renderToggle={ ( { isOpen, onToggle } ) => (
|
|
126
|
+
<PostDiscussionToggle
|
|
127
|
+
isOpen={ isOpen }
|
|
128
|
+
onClick={ onToggle }
|
|
129
|
+
/>
|
|
130
|
+
) }
|
|
131
|
+
renderContent={ ( { onClose } ) => (
|
|
132
|
+
<ModalContents onClose={ onClose } />
|
|
133
|
+
) }
|
|
134
|
+
/>
|
|
135
|
+
</PostPanelRow>
|
|
59
136
|
</PostTypeSupportCheck>
|
|
60
137
|
);
|
|
61
138
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
.editor-post-discussion__panel-dialog .editor-post-discussion {
|
|
2
|
+
// sidebar width - popover padding - form margin
|
|
3
|
+
min-width: $sidebar-width - $grid-unit-20 - $grid-unit-20;
|
|
4
|
+
margin: $grid-unit-10;
|
|
5
|
+
|
|
6
|
+
.components-radio-control__option {
|
|
7
|
+
align-items: flex-start;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.components-radio-control__label .components-text {
|
|
11
|
+
display: block;
|
|
12
|
+
margin-top: $grid-unit-05;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
.editor-post-discussion__panel-toggle {
|
|
16
|
+
&.components-button {
|
|
17
|
+
height: auto;
|
|
18
|
+
}
|
|
19
|
+
.components-text {
|
|
20
|
+
color: inherit;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.editor-post-discussion__panel-dialog .components-popover__content {
|
|
25
|
+
min-width: 320px;
|
|
26
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
4
|
+
import clsx from 'clsx';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -194,7 +194,7 @@ function PrivateExcerpt() {
|
|
|
194
194
|
ref={ setPopoverAnchor }
|
|
195
195
|
renderToggle={ ( { onToggle } ) => (
|
|
196
196
|
<Button
|
|
197
|
-
className={
|
|
197
|
+
className={ clsx(
|
|
198
198
|
'editor-post-excerpt__dropdown__trigger',
|
|
199
199
|
{ 'has-excerpt': !! excerpt }
|
|
200
200
|
) }
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { PanelRow } from '@wordpress/components';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import PostFormatForm from './';
|
|
10
|
+
import PostFormatCheck from './check';
|
|
11
|
+
|
|
12
|
+
export function PostFormat() {
|
|
13
|
+
return (
|
|
14
|
+
<PostFormatCheck>
|
|
15
|
+
<PanelRow className="editor-post-format__panel">
|
|
16
|
+
<PostFormatForm />
|
|
17
|
+
</PanelRow>
|
|
18
|
+
</PostFormatCheck>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default PostFormat;
|
|
@@ -21,7 +21,11 @@ function setupDataMock( id, count ) {
|
|
|
21
21
|
getCurrentPostLastRevisionId: () => id,
|
|
22
22
|
getCurrentPostRevisionsCount: () => count,
|
|
23
23
|
getEditedPostAttribute: () => null,
|
|
24
|
-
getPostType: () =>
|
|
24
|
+
getPostType: () => ( {
|
|
25
|
+
supports: {
|
|
26
|
+
revisions: true,
|
|
27
|
+
},
|
|
28
|
+
} ),
|
|
25
29
|
} ) )
|
|
26
30
|
);
|
|
27
31
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
4
|
+
import clsx from 'clsx';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -12,7 +12,7 @@ import { forwardRef } from '@wordpress/element';
|
|
|
12
12
|
const PostPanelRow = forwardRef( ( { className, label, children }, ref ) => {
|
|
13
13
|
return (
|
|
14
14
|
<HStack
|
|
15
|
-
className={
|
|
15
|
+
className={ clsx( 'editor-post-panel__row', className ) }
|
|
16
16
|
ref={ ref }
|
|
17
17
|
>
|
|
18
18
|
{ label && (
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { __experimentalVStack as VStack } from '@wordpress/components';
|
|
10
|
+
|
|
11
|
+
function PostPanelSection( { className, children } ) {
|
|
12
|
+
return (
|
|
13
|
+
<VStack className={ clsx( 'editor-post-panel__section', className ) }>
|
|
14
|
+
{ children }
|
|
15
|
+
</VStack>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default PostPanelSection;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { CheckboxControl } from '@wordpress/components';
|
|
5
|
+
import { CheckboxControl, ExternalLink } from '@wordpress/components';
|
|
6
6
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -26,9 +26,18 @@ function PostPingbacks() {
|
|
|
26
26
|
return (
|
|
27
27
|
<CheckboxControl
|
|
28
28
|
__nextHasNoMarginBottom
|
|
29
|
-
label={ __( '
|
|
29
|
+
label={ __( 'Enable pingbacks & trackbacks' ) }
|
|
30
30
|
checked={ pingStatus === 'open' }
|
|
31
31
|
onChange={ onTogglePingback }
|
|
32
|
+
help={
|
|
33
|
+
<ExternalLink
|
|
34
|
+
href={ __(
|
|
35
|
+
'https://wordpress.org/documentation/article/trackbacks-and-pingbacks/'
|
|
36
|
+
) }
|
|
37
|
+
>
|
|
38
|
+
{ __( 'Learn more about pingbacks & trackbacks' ) }
|
|
39
|
+
</ExternalLink>
|
|
40
|
+
}
|
|
32
41
|
/>
|
|
33
42
|
);
|
|
34
43
|
}
|
|
@@ -119,6 +119,11 @@
|
|
|
119
119
|
.editor-post-visibility__dialog-legend {
|
|
120
120
|
display: none;
|
|
121
121
|
}
|
|
122
|
+
|
|
123
|
+
.components-panel__body-title .components-button {
|
|
124
|
+
align-items: flex-start;
|
|
125
|
+
text-wrap: pretty;
|
|
126
|
+
}
|
|
122
127
|
}
|
|
123
128
|
|
|
124
129
|
.post-publish-panel__postpublish .components-panel__body {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
4
|
+
import clsx from 'clsx';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -141,7 +141,7 @@ export default function PostSavedState( { forceIsDirty } ) {
|
|
|
141
141
|
<Button
|
|
142
142
|
className={
|
|
143
143
|
isSaveable || isSaving
|
|
144
|
-
?
|
|
144
|
+
? clsx( {
|
|
145
145
|
'editor-post-save-draft': ! isSavedState,
|
|
146
146
|
'editor-post-saved-state': isSavedState,
|
|
147
147
|
'is-saving': isSaving,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { PanelRow } from '@wordpress/components';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import PostSlugForm from './';
|
|
10
|
+
import PostSlugCheck from './check';
|
|
11
|
+
|
|
12
|
+
export function PostSlug() {
|
|
13
|
+
return (
|
|
14
|
+
<PostSlugCheck>
|
|
15
|
+
<PanelRow className="editor-post-slug">
|
|
16
|
+
<PostSlugForm />
|
|
17
|
+
</PanelRow>
|
|
18
|
+
</PostSlugCheck>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default PostSlug;
|
|
@@ -26,7 +26,11 @@ describe( 'PostSlug', () => {
|
|
|
26
26
|
|
|
27
27
|
useSelect.mockImplementation( ( mapSelect ) =>
|
|
28
28
|
mapSelect( () => ( {
|
|
29
|
-
getPostType: () =>
|
|
29
|
+
getPostType: () => ( {
|
|
30
|
+
supports: {
|
|
31
|
+
slug: true,
|
|
32
|
+
},
|
|
33
|
+
} ),
|
|
30
34
|
getEditedPostAttribute: () => 'post',
|
|
31
35
|
getEditedPostSlug: () => '1',
|
|
32
36
|
} ) )
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
4
|
+
import clsx from 'clsx';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -53,15 +53,15 @@ function PostStatusLabel( { canEdit } ) {
|
|
|
53
53
|
statusLabel = __( 'Draft' );
|
|
54
54
|
break;
|
|
55
55
|
case 'pending':
|
|
56
|
-
statusLabel = __( 'Pending
|
|
56
|
+
statusLabel = __( 'Pending' );
|
|
57
57
|
break;
|
|
58
58
|
case 'private':
|
|
59
|
-
statusLabel = __( '
|
|
59
|
+
statusLabel = __( 'Private' );
|
|
60
60
|
break;
|
|
61
61
|
}
|
|
62
62
|
return (
|
|
63
63
|
<Text
|
|
64
|
-
className={
|
|
64
|
+
className={ clsx( 'editor-post-status-label', {
|
|
65
65
|
[ ` has-status-${ status }` ]: !! status,
|
|
66
66
|
'has-icon': canEdit,
|
|
67
67
|
} ) }
|