@wordpress/editor 14.19.3 → 14.21.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 +4 -0
- package/README.md +1 -1
- package/build/components/commands/index.js +1 -1
- package/build/components/commands/index.js.map +1 -1
- package/build/components/plugin-pre-publish-panel/index.js +1 -1
- package/build/components/plugin-pre-publish-panel/index.js.map +1 -1
- package/build/components/post-actions/actions.js +10 -8
- package/build/components/post-actions/actions.js.map +1 -1
- package/build/components/post-publish-panel/maybe-category-panel.js +19 -3
- package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-tags-panel.js +16 -6
- package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
- package/build/components/post-status/index.js +5 -1
- package/build/components/post-status/index.js.map +1 -1
- package/build/components/post-sticky/index.js +1 -1
- package/build/components/post-sticky/index.js.map +1 -1
- package/build/components/post-template/block-theme.js +1 -3
- package/build/components/post-template/block-theme.js.map +1 -1
- package/build/components/post-template/create-new-template-modal.js +1 -0
- package/build/components/post-template/create-new-template-modal.js.map +1 -1
- package/build/components/post-template/create-new-template.js +1 -4
- package/build/components/post-template/create-new-template.js.map +1 -1
- package/build/components/post-template/hooks.js +6 -5
- package/build/components/post-template/hooks.js.map +1 -1
- package/build/components/post-template/swap-template-button.js +2 -3
- package/build/components/post-template/swap-template-button.js.map +1 -1
- package/build/components/post-visibility/index.js +39 -109
- package/build/components/post-visibility/index.js.map +1 -1
- package/build/components/post-visibility/label.js +2 -2
- package/build/components/post-visibility/label.js.map +1 -1
- package/build/components/post-visibility/utils.js +14 -15
- package/build/components/post-visibility/utils.js.map +1 -1
- package/build/components/preview-dropdown/index.js +2 -4
- package/build/components/preview-dropdown/index.js.map +1 -1
- package/build-module/components/commands/index.js +1 -1
- package/build-module/components/commands/index.js.map +1 -1
- package/build-module/components/plugin-pre-publish-panel/index.js +1 -1
- package/build-module/components/plugin-pre-publish-panel/index.js.map +1 -1
- package/build-module/components/post-actions/actions.js +10 -8
- package/build-module/components/post-actions/actions.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-category-panel.js +19 -3
- package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-tags-panel.js +16 -6
- package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
- package/build-module/components/post-status/index.js +5 -1
- package/build-module/components/post-status/index.js.map +1 -1
- package/build-module/components/post-sticky/index.js +1 -1
- package/build-module/components/post-sticky/index.js.map +1 -1
- package/build-module/components/post-template/block-theme.js +1 -3
- package/build-module/components/post-template/block-theme.js.map +1 -1
- package/build-module/components/post-template/create-new-template-modal.js +1 -0
- package/build-module/components/post-template/create-new-template-modal.js.map +1 -1
- package/build-module/components/post-template/create-new-template.js +1 -4
- package/build-module/components/post-template/create-new-template.js.map +1 -1
- package/build-module/components/post-template/hooks.js +6 -5
- package/build-module/components/post-template/hooks.js.map +1 -1
- package/build-module/components/post-template/swap-template-button.js +2 -3
- package/build-module/components/post-template/swap-template-button.js.map +1 -1
- package/build-module/components/post-visibility/index.js +41 -111
- package/build-module/components/post-visibility/index.js.map +1 -1
- package/build-module/components/post-visibility/label.js +3 -3
- package/build-module/components/post-visibility/label.js.map +1 -1
- package/build-module/components/post-visibility/utils.js +13 -14
- package/build-module/components/post-visibility/utils.js.map +1 -1
- package/build-module/components/preview-dropdown/index.js +2 -4
- package/build-module/components/preview-dropdown/index.js.map +1 -1
- package/build-style/style-rtl.css +6 -137
- package/build-style/style.css +6 -137
- package/build-types/components/plugin-pre-publish-panel/index.d.ts +1 -1
- package/build-types/components/post-actions/actions.d.ts.map +1 -1
- package/build-types/components/post-publish-panel/maybe-category-panel.d.ts.map +1 -1
- package/build-types/components/post-publish-panel/maybe-tags-panel.d.ts.map +1 -1
- package/build-types/components/post-status/index.d.ts.map +1 -1
- package/build-types/components/post-template/block-theme.d.ts.map +1 -1
- package/build-types/components/post-template/create-new-template-modal.d.ts.map +1 -1
- package/build-types/components/post-template/create-new-template.d.ts +1 -3
- package/build-types/components/post-template/create-new-template.d.ts.map +1 -1
- package/build-types/components/post-template/hooks.d.ts.map +1 -1
- package/build-types/components/post-template/swap-template-button.d.ts +1 -1
- package/build-types/components/post-template/swap-template-button.d.ts.map +1 -1
- package/build-types/components/post-visibility/index.d.ts.map +1 -1
- package/build-types/components/post-visibility/label.d.ts.map +1 -1
- package/build-types/components/post-visibility/utils.d.ts +5 -20
- package/build-types/components/post-visibility/utils.d.ts.map +1 -1
- package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
- package/package.json +37 -37
- package/src/components/autocompleters/style.scss +2 -3
- package/src/components/commands/index.js +1 -1
- package/src/components/plugin-pre-publish-panel/index.js +1 -1
- package/src/components/post-actions/actions.js +13 -8
- package/src/components/post-publish-panel/maybe-category-panel.js +20 -5
- package/src/components/post-publish-panel/maybe-tags-panel.js +39 -22
- package/src/components/post-status/index.js +7 -2
- package/src/components/post-sticky/index.js +1 -1
- package/src/components/post-template/block-theme.js +1 -3
- package/src/components/post-template/create-new-template-modal.js +1 -0
- package/src/components/post-template/create-new-template.js +1 -2
- package/src/components/post-template/hooks.js +12 -8
- package/src/components/post-template/style.scss +4 -0
- package/src/components/post-template/swap-template-button.js +6 -4
- package/src/components/post-visibility/index.js +41 -118
- package/src/components/post-visibility/label.js +7 -4
- package/src/components/post-visibility/utils.js +11 -8
- package/src/components/preview-dropdown/index.js +6 -3
- package/src/style.scss +0 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/src/components/post-visibility/style.scss +0 -27
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import { useState } from '@wordpress/element';
|
|
6
6
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
TextControl,
|
|
8
|
+
RadioControl,
|
|
9
|
+
__experimentalVStack as VStack,
|
|
9
10
|
} from '@wordpress/components';
|
|
10
11
|
import { useInstanceId } from '@wordpress/compose';
|
|
11
12
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
@@ -14,7 +15,7 @@ import { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '
|
|
|
14
15
|
/**
|
|
15
16
|
* Internal dependencies
|
|
16
17
|
*/
|
|
17
|
-
import {
|
|
18
|
+
import { VISIBILITY_OPTIONS } from './utils';
|
|
18
19
|
import { store as editorStore } from '../../store';
|
|
19
20
|
|
|
20
21
|
/**
|
|
@@ -33,45 +34,29 @@ export default function PostVisibility( { onClose } ) {
|
|
|
33
34
|
password: select( editorStore ).getEditedPostAttribute( 'password' ),
|
|
34
35
|
} ) );
|
|
35
36
|
|
|
36
|
-
const { editPost
|
|
37
|
+
const { editPost } = useDispatch( editorStore );
|
|
37
38
|
|
|
38
39
|
const [ hasPassword, setHasPassword ] = useState( !! password );
|
|
39
|
-
const [ showPrivateConfirmDialog, setShowPrivateConfirmDialog ] =
|
|
40
|
-
useState( false );
|
|
41
40
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const confirmPrivate = () => {
|
|
55
|
-
editPost( { status: 'private', password: '' } );
|
|
56
|
-
setHasPassword( false );
|
|
57
|
-
setShowPrivateConfirmDialog( false );
|
|
58
|
-
savePost();
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const handleDialogCancel = () => {
|
|
62
|
-
setShowPrivateConfirmDialog( false );
|
|
63
|
-
};
|
|
41
|
+
function updateVisibility( value ) {
|
|
42
|
+
const nextValues = {
|
|
43
|
+
public: {
|
|
44
|
+
status: visibility === 'private' ? 'draft' : status,
|
|
45
|
+
password: '',
|
|
46
|
+
},
|
|
47
|
+
private: { status: 'private', password: '' },
|
|
48
|
+
password: {
|
|
49
|
+
status: visibility === 'private' ? 'draft' : status,
|
|
50
|
+
password: password || '',
|
|
51
|
+
},
|
|
52
|
+
};
|
|
64
53
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
password: password || '',
|
|
69
|
-
} );
|
|
70
|
-
setHasPassword( true );
|
|
71
|
-
};
|
|
54
|
+
editPost( nextValues[ value ] );
|
|
55
|
+
setHasPassword( value === 'password' );
|
|
56
|
+
}
|
|
72
57
|
|
|
73
|
-
const updatePassword = (
|
|
74
|
-
editPost( { password:
|
|
58
|
+
const updatePassword = ( value ) => {
|
|
59
|
+
editPost( { password: value } );
|
|
75
60
|
};
|
|
76
61
|
|
|
77
62
|
return (
|
|
@@ -81,90 +66,28 @@ export default function PostVisibility( { onClose } ) {
|
|
|
81
66
|
help={ __( 'Control how this post is viewed.' ) }
|
|
82
67
|
onClose={ onClose }
|
|
83
68
|
/>
|
|
84
|
-
<
|
|
85
|
-
<
|
|
86
|
-
{ __( 'Visibility' ) }
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
label={ visibilityOptions.public.label }
|
|
92
|
-
info={ visibilityOptions.public.info }
|
|
93
|
-
checked={ visibility === 'public' && ! hasPassword }
|
|
94
|
-
onChange={ setPublic }
|
|
95
|
-
/>
|
|
96
|
-
<PostVisibilityChoice
|
|
97
|
-
instanceId={ instanceId }
|
|
98
|
-
value="private"
|
|
99
|
-
label={ visibilityOptions.private.label }
|
|
100
|
-
info={ visibilityOptions.private.info }
|
|
101
|
-
checked={ visibility === 'private' }
|
|
102
|
-
onChange={ setPrivate }
|
|
103
|
-
/>
|
|
104
|
-
<PostVisibilityChoice
|
|
105
|
-
instanceId={ instanceId }
|
|
106
|
-
value="password"
|
|
107
|
-
label={ visibilityOptions.password.label }
|
|
108
|
-
info={ visibilityOptions.password.info }
|
|
109
|
-
checked={ hasPassword }
|
|
110
|
-
onChange={ setPasswordProtected }
|
|
69
|
+
<VStack spacing={ 4 }>
|
|
70
|
+
<RadioControl
|
|
71
|
+
label={ __( 'Visibility' ) }
|
|
72
|
+
hideLabelFromVision
|
|
73
|
+
options={ VISIBILITY_OPTIONS }
|
|
74
|
+
selected={ hasPassword ? 'password' : visibility }
|
|
75
|
+
onChange={ updateVisibility }
|
|
111
76
|
/>
|
|
112
77
|
{ hasPassword && (
|
|
113
|
-
<
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
onChange={ updatePassword }
|
|
125
|
-
value={ password }
|
|
126
|
-
placeholder={ __( 'Use a secure password' ) }
|
|
127
|
-
/>
|
|
128
|
-
</div>
|
|
78
|
+
<TextControl
|
|
79
|
+
label={ __( 'Password' ) }
|
|
80
|
+
onChange={ updatePassword }
|
|
81
|
+
value={ password }
|
|
82
|
+
placeholder={ __( 'Use a secure password' ) }
|
|
83
|
+
type="text"
|
|
84
|
+
id={ `editor-post-visibility__password-input-${ instanceId }` }
|
|
85
|
+
__next40pxDefaultSize
|
|
86
|
+
__nextHasNoMarginBottom
|
|
87
|
+
maxLength={ 255 }
|
|
88
|
+
/>
|
|
129
89
|
) }
|
|
130
|
-
</
|
|
131
|
-
<ConfirmDialog
|
|
132
|
-
isOpen={ showPrivateConfirmDialog }
|
|
133
|
-
onConfirm={ confirmPrivate }
|
|
134
|
-
onCancel={ handleDialogCancel }
|
|
135
|
-
confirmButtonText={ __( 'Publish' ) }
|
|
136
|
-
size="medium"
|
|
137
|
-
>
|
|
138
|
-
{ __( 'Would you like to privately publish this post now?' ) }
|
|
139
|
-
</ConfirmDialog>
|
|
140
|
-
</div>
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function PostVisibilityChoice( { instanceId, value, label, info, ...props } ) {
|
|
145
|
-
return (
|
|
146
|
-
<div className="editor-post-visibility__choice">
|
|
147
|
-
<input
|
|
148
|
-
type="radio"
|
|
149
|
-
name={ `editor-post-visibility__setting-${ instanceId }` }
|
|
150
|
-
value={ value }
|
|
151
|
-
id={ `editor-post-${ value }-${ instanceId }` }
|
|
152
|
-
aria-describedby={ `editor-post-${ value }-${ instanceId }-description` }
|
|
153
|
-
className="editor-post-visibility__radio"
|
|
154
|
-
{ ...props }
|
|
155
|
-
/>
|
|
156
|
-
<label
|
|
157
|
-
htmlFor={ `editor-post-${ value }-${ instanceId }` }
|
|
158
|
-
className="editor-post-visibility__label"
|
|
159
|
-
>
|
|
160
|
-
{ label }
|
|
161
|
-
</label>
|
|
162
|
-
<p
|
|
163
|
-
id={ `editor-post-${ value }-${ instanceId }-description` }
|
|
164
|
-
className="editor-post-visibility__info"
|
|
165
|
-
>
|
|
166
|
-
{ info }
|
|
167
|
-
</p>
|
|
90
|
+
</VStack>
|
|
168
91
|
</div>
|
|
169
92
|
);
|
|
170
93
|
}
|
|
@@ -6,7 +6,7 @@ import { useSelect } from '@wordpress/data';
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
9
|
+
import { VISIBILITY_OPTIONS } from './utils';
|
|
10
10
|
import { store as editorStore } from '../../store';
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -24,8 +24,11 @@ export default function PostVisibilityLabel() {
|
|
|
24
24
|
* @return {string} Post visibility label.
|
|
25
25
|
*/
|
|
26
26
|
export function usePostVisibilityLabel() {
|
|
27
|
-
const visibility = useSelect(
|
|
28
|
-
select( editorStore ).getEditedPostVisibility()
|
|
27
|
+
const visibility = useSelect(
|
|
28
|
+
( select ) => select( editorStore ).getEditedPostVisibility(),
|
|
29
|
+
[]
|
|
29
30
|
);
|
|
30
|
-
|
|
31
|
+
|
|
32
|
+
return VISIBILITY_OPTIONS.find( ( option ) => option.value === visibility )
|
|
33
|
+
?.label;
|
|
31
34
|
}
|
|
@@ -3,17 +3,20 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
|
|
6
|
-
export const
|
|
7
|
-
|
|
6
|
+
export const VISIBILITY_OPTIONS = [
|
|
7
|
+
{
|
|
8
8
|
label: __( 'Public' ),
|
|
9
|
-
|
|
9
|
+
value: 'public',
|
|
10
|
+
description: __( 'Visible to everyone.' ),
|
|
10
11
|
},
|
|
11
|
-
|
|
12
|
+
{
|
|
12
13
|
label: __( 'Private' ),
|
|
13
|
-
|
|
14
|
+
value: 'private',
|
|
15
|
+
description: __( 'Only visible to site admins and editors.' ),
|
|
14
16
|
},
|
|
15
|
-
|
|
17
|
+
{
|
|
16
18
|
label: __( 'Password protected' ),
|
|
17
|
-
|
|
19
|
+
value: 'password',
|
|
20
|
+
description: __( 'Only visible to those who know the password.' ),
|
|
18
21
|
},
|
|
19
|
-
|
|
22
|
+
];
|
|
@@ -40,9 +40,12 @@ export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
|
|
|
40
40
|
isTemplateHidden,
|
|
41
41
|
templateId,
|
|
42
42
|
} = useSelect( ( select ) => {
|
|
43
|
-
const {
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
const {
|
|
44
|
+
getDeviceType,
|
|
45
|
+
getCurrentPostType,
|
|
46
|
+
getCurrentTemplateId,
|
|
47
|
+
getRenderingMode,
|
|
48
|
+
} = select( editorStore );
|
|
46
49
|
const { getEntityRecord, getPostType } = select( coreStore );
|
|
47
50
|
const { get } = select( preferencesStore );
|
|
48
51
|
const _currentPostType = getCurrentPostType();
|
package/src/style.scss
CHANGED
|
@@ -41,7 +41,6 @@
|
|
|
41
41
|
@import "./components/post-text-editor/style.scss";
|
|
42
42
|
@import "./components/post-title/style.scss";
|
|
43
43
|
@import "./components/post-url/style.scss";
|
|
44
|
-
@import "./components/post-visibility/style.scss";
|
|
45
44
|
@import "./components/posts-per-page/style.scss";
|
|
46
45
|
@import "./components/post-trash/style.scss";
|
|
47
46
|
@import "./components/preview-dropdown/style.scss";
|