@wordpress/editor 12.6.0 → 12.9.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 +6 -0
- package/build/components/editor-help/help-section-title.native.js +43 -0
- package/build/components/editor-help/help-section-title.native.js.map +1 -0
- package/build/components/editor-help/help-topic-row.native.js +3 -2
- package/build/components/editor-help/help-topic-row.native.js.map +1 -1
- package/build/components/editor-help/icon-move-blocks.native.js +23 -0
- package/build/components/editor-help/icon-move-blocks.native.js.map +1 -0
- package/build/components/editor-help/index.native.js +10 -11
- package/build/components/editor-help/index.native.js.map +1 -1
- package/build/components/editor-help/move-blocks.native.js +14 -2
- package/build/components/editor-help/move-blocks.native.js.map +1 -1
- package/build/components/editor-help/view-sections.native.js +21 -5
- package/build/components/editor-help/view-sections.native.js.map +1 -1
- package/build/components/post-featured-image/index.js +84 -41
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-schedule/index.js +11 -18
- package/build/components/post-schedule/index.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +2 -2
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/index.js +7 -1
- package/build/components/post-taxonomies/index.js.map +1 -1
- package/build/components/post-text-editor/index.js +12 -1
- package/build/components/post-text-editor/index.js.map +1 -1
- package/build/components/post-visibility/index.js +132 -167
- package/build/components/post-visibility/index.js.map +1 -1
- package/build/components/post-visibility/label.js +5 -22
- package/build/components/post-visibility/label.js.map +1 -1
- package/build/components/post-visibility/utils.js +14 -13
- package/build/components/post-visibility/utils.js.map +1 -1
- package/build/components/provider/index.native.js +3 -1
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +15 -9
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/store/selectors.js +2 -2
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/editor-help/help-section-title.native.js +31 -0
- package/build-module/components/editor-help/help-section-title.native.js.map +1 -0
- package/build-module/components/editor-help/help-topic-row.native.js +3 -2
- package/build-module/components/editor-help/help-topic-row.native.js.map +1 -1
- package/build-module/components/editor-help/icon-move-blocks.native.js +13 -0
- package/build-module/components/editor-help/icon-move-blocks.native.js.map +1 -0
- package/build-module/components/editor-help/index.native.js +10 -12
- package/build-module/components/editor-help/index.native.js.map +1 -1
- package/build-module/components/editor-help/move-blocks.native.js +15 -3
- package/build-module/components/editor-help/move-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/view-sections.native.js +22 -6
- package/build-module/components/editor-help/view-sections.native.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +86 -42
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-schedule/index.js +12 -19
- package/build-module/components/post-schedule/index.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +2 -2
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/index.js +7 -1
- package/build-module/components/post-taxonomies/index.js.map +1 -1
- package/build-module/components/post-text-editor/index.js +13 -2
- package/build-module/components/post-text-editor/index.js.map +1 -1
- package/build-module/components/post-visibility/index.js +132 -166
- package/build-module/components/post-visibility/index.js.map +1 -1
- package/build-module/components/post-visibility/label.js +5 -20
- package/build-module/components/post-visibility/label.js.map +1 -1
- package/build-module/components/post-visibility/utils.js +14 -13
- package/build-module/components/post-visibility/utils.js.map +1 -1
- package/build-module/components/provider/index.native.js +2 -1
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +16 -10
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/store/selectors.js +2 -2
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +51 -52
- package/build-style/style.css +51 -52
- package/package.json +29 -28
- package/src/components/autosave-monitor/test/index.js +3 -0
- package/src/components/editor-help/help-section-title.native.js +29 -0
- package/src/components/editor-help/help-topic-row.native.js +2 -2
- package/src/components/editor-help/icon-move-blocks.native.js +10 -0
- package/src/components/editor-help/images/drag-and-drop-dark.png +0 -0
- package/src/components/editor-help/images/drag-and-drop-dark@2x.png +0 -0
- package/src/components/editor-help/images/drag-and-drop-dark@3x.png +0 -0
- package/src/components/editor-help/images/drag-and-drop-light.png +0 -0
- package/src/components/editor-help/images/drag-and-drop-light@2x.png +0 -0
- package/src/components/editor-help/images/drag-and-drop-light@3x.png +0 -0
- package/src/components/editor-help/index.native.js +20 -22
- package/src/components/editor-help/move-blocks.native.js +22 -2
- package/src/components/editor-help/style.scss +36 -4
- package/src/components/editor-help/test/index.native.js +1 -1
- package/src/components/editor-help/view-sections.native.js +23 -8
- package/src/components/post-featured-image/index.js +102 -69
- package/src/components/post-saved-state/style.scss +9 -0
- package/src/components/post-schedule/index.js +6 -13
- package/src/components/post-slug/test/index.js +4 -4
- package/src/components/post-taxonomies/flat-term-selector.js +5 -2
- package/src/components/post-taxonomies/index.js +3 -1
- package/src/components/post-text-editor/index.js +13 -1
- package/src/components/post-visibility/index.js +130 -150
- package/src/components/post-visibility/label.js +6 -15
- package/src/components/post-visibility/style.scss +25 -20
- package/src/components/post-visibility/utils.js +7 -12
- package/src/components/provider/index.native.js +2 -1
- package/src/components/provider/use-block-editor-settings.js +28 -12
- package/src/components/table-of-contents/style.scss +1 -3
- package/src/store/selectors.js +4 -2
- package/src/store/test/selectors.js +5 -5
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import {
|
|
5
|
+
import { useState } from '@wordpress/element';
|
|
6
6
|
import {
|
|
7
7
|
VisuallyHidden,
|
|
8
8
|
__experimentalConfirmDialog as ConfirmDialog,
|
|
9
|
+
Button,
|
|
9
10
|
} from '@wordpress/components';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
11
|
+
import { useInstanceId } from '@wordpress/compose';
|
|
12
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
13
|
+
import { close as closeIcon } from '@wordpress/icons';
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* Internal dependencies
|
|
@@ -16,172 +18,150 @@ import { withSelect, withDispatch } from '@wordpress/data';
|
|
|
16
18
|
import { visibilityOptions } from './utils';
|
|
17
19
|
import { store as editorStore } from '../../store';
|
|
18
20
|
|
|
19
|
-
export
|
|
20
|
-
|
|
21
|
-
super( ...arguments );
|
|
21
|
+
export default function PostVisibility( { onClose } ) {
|
|
22
|
+
const instanceId = useInstanceId( PostVisibility );
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
const { status, visibility, password } = useSelect( ( select ) => ( {
|
|
25
|
+
status: select( editorStore ).getEditedPostAttribute( 'status' ),
|
|
26
|
+
visibility: select( editorStore ).getEditedPostVisibility(),
|
|
27
|
+
password: select( editorStore ).getEditedPostAttribute( 'password' ),
|
|
28
|
+
} ) );
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
hasPassword: !! props.password,
|
|
30
|
-
showPrivateConfirmDialog: false,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
30
|
+
const { editPost, savePost } = useDispatch( editorStore );
|
|
33
31
|
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
const [ hasPassword, setHasPassword ] = useState( !! password );
|
|
33
|
+
const [ showPrivateConfirmDialog, setShowPrivateConfirmDialog ] = useState(
|
|
34
|
+
false
|
|
35
|
+
);
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
setPrivate() {
|
|
42
|
-
this.setState( { showPrivateConfirmDialog: true } );
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
confirmPrivate = () => {
|
|
46
|
-
const { onUpdateVisibility, onSave } = this.props;
|
|
47
|
-
|
|
48
|
-
onUpdateVisibility( 'private' );
|
|
49
|
-
this.setState( {
|
|
50
|
-
hasPassword: false,
|
|
51
|
-
showPrivateConfirmDialog: false,
|
|
37
|
+
const setPublic = () => {
|
|
38
|
+
editPost( {
|
|
39
|
+
status: visibility === 'private' ? 'draft' : status,
|
|
40
|
+
password: '',
|
|
52
41
|
} );
|
|
53
|
-
|
|
42
|
+
setHasPassword( false );
|
|
54
43
|
};
|
|
55
44
|
|
|
56
|
-
|
|
57
|
-
|
|
45
|
+
const setPrivate = () => {
|
|
46
|
+
setShowPrivateConfirmDialog( true );
|
|
58
47
|
};
|
|
59
48
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
);
|
|
67
|
-
this.setState( { hasPassword: true } );
|
|
68
|
-
}
|
|
49
|
+
const confirmPrivate = () => {
|
|
50
|
+
editPost( { status: 'private', password: '' } );
|
|
51
|
+
setHasPassword( false );
|
|
52
|
+
setShowPrivateConfirmDialog( false );
|
|
53
|
+
savePost();
|
|
54
|
+
};
|
|
69
55
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
56
|
+
const handleDialogCancel = () => {
|
|
57
|
+
setShowPrivateConfirmDialog( false );
|
|
58
|
+
};
|
|
74
59
|
|
|
75
|
-
|
|
76
|
-
|
|
60
|
+
const setPasswordProtected = () => {
|
|
61
|
+
editPost( {
|
|
62
|
+
status: visibility === 'private' ? 'draft' : status,
|
|
63
|
+
password: password || '',
|
|
64
|
+
} );
|
|
65
|
+
setHasPassword( true );
|
|
66
|
+
};
|
|
77
67
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
checked: visibility === 'public' && ! this.state.hasPassword,
|
|
82
|
-
},
|
|
83
|
-
private: {
|
|
84
|
-
onSelect: this.setPrivate,
|
|
85
|
-
checked: visibility === 'private',
|
|
86
|
-
},
|
|
87
|
-
password: {
|
|
88
|
-
onSelect: this.setPasswordProtected,
|
|
89
|
-
checked: this.state.hasPassword,
|
|
90
|
-
},
|
|
91
|
-
};
|
|
68
|
+
const updatePassword = ( event ) => {
|
|
69
|
+
editPost( { password: event.target.value } );
|
|
70
|
+
};
|
|
92
71
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
className="editor-post-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
72
|
+
return (
|
|
73
|
+
<>
|
|
74
|
+
<Button
|
|
75
|
+
className="editor-post-visibility__close"
|
|
76
|
+
isSmall
|
|
77
|
+
icon={ closeIcon }
|
|
78
|
+
onClick={ onClose }
|
|
79
|
+
/>
|
|
80
|
+
<fieldset className="editor-post-visibility__fieldset">
|
|
81
|
+
<legend className="editor-post-visibility__legend">
|
|
82
|
+
{ __( 'Visibility' ) }
|
|
100
83
|
</legend>
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
84
|
+
<p className="editor-post-visibility__description">
|
|
85
|
+
{ __( 'Control how this post is viewed.' ) }
|
|
86
|
+
</p>
|
|
87
|
+
<PostVisibilityChoice
|
|
88
|
+
instanceId={ instanceId }
|
|
89
|
+
value="public"
|
|
90
|
+
label={ visibilityOptions.public.label }
|
|
91
|
+
info={ visibilityOptions.public.info }
|
|
92
|
+
checked={ visibility === 'public' && ! hasPassword }
|
|
93
|
+
onChange={ setPublic }
|
|
94
|
+
/>
|
|
95
|
+
<PostVisibilityChoice
|
|
96
|
+
instanceId={ instanceId }
|
|
97
|
+
value="private"
|
|
98
|
+
label={ visibilityOptions.private.label }
|
|
99
|
+
info={ visibilityOptions.private.info }
|
|
100
|
+
checked={ visibility === 'private' }
|
|
101
|
+
onChange={ setPrivate }
|
|
102
|
+
/>
|
|
103
|
+
<PostVisibilityChoice
|
|
104
|
+
instanceId={ instanceId }
|
|
105
|
+
value="password"
|
|
106
|
+
label={ visibilityOptions.password.label }
|
|
107
|
+
info={ visibilityOptions.password.info }
|
|
108
|
+
checked={ hasPassword }
|
|
109
|
+
onChange={ setPasswordProtected }
|
|
110
|
+
/>
|
|
111
|
+
{ hasPassword && (
|
|
112
|
+
<div className="editor-post-visibility__password">
|
|
113
|
+
<VisuallyHidden
|
|
114
|
+
as="label"
|
|
115
|
+
htmlFor={ `editor-post-visibility__password-input-${ instanceId }` }
|
|
116
|
+
>
|
|
117
|
+
{ __( 'Create password' ) }
|
|
118
|
+
</VisuallyHidden>
|
|
106
119
|
<input
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
onChange={
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
aria-describedby={ `editor-post-${ value }-${ instanceId }-description` }
|
|
114
|
-
className="editor-post-visibility__dialog-radio"
|
|
120
|
+
className="editor-post-visibility__password-input"
|
|
121
|
+
id={ `editor-post-visibility__password-input-${ instanceId }` }
|
|
122
|
+
type="text"
|
|
123
|
+
onChange={ updatePassword }
|
|
124
|
+
value={ password }
|
|
125
|
+
placeholder={ __( 'Use a secure password' ) }
|
|
115
126
|
/>
|
|
116
|
-
<label
|
|
117
|
-
htmlFor={ `editor-post-${ value }-${ instanceId }` }
|
|
118
|
-
className="editor-post-visibility__dialog-label"
|
|
119
|
-
>
|
|
120
|
-
{ label }
|
|
121
|
-
</label>
|
|
122
|
-
{
|
|
123
|
-
<p
|
|
124
|
-
id={ `editor-post-${ value }-${ instanceId }-description` }
|
|
125
|
-
className="editor-post-visibility__dialog-info"
|
|
126
|
-
>
|
|
127
|
-
{ info }
|
|
128
|
-
</p>
|
|
129
|
-
}
|
|
130
127
|
</div>
|
|
131
|
-
)
|
|
132
|
-
</fieldset
|
|
133
|
-
this.state.hasPassword && (
|
|
134
|
-
<div
|
|
135
|
-
className="editor-post-visibility__dialog-password"
|
|
136
|
-
key="password-selector"
|
|
137
|
-
>
|
|
138
|
-
<VisuallyHidden
|
|
139
|
-
as="label"
|
|
140
|
-
htmlFor={ `editor-post-visibility__dialog-password-input-${ instanceId }` }
|
|
141
|
-
>
|
|
142
|
-
{ __( 'Create password' ) }
|
|
143
|
-
</VisuallyHidden>
|
|
144
|
-
<input
|
|
145
|
-
className="editor-post-visibility__dialog-password-input"
|
|
146
|
-
id={ `editor-post-visibility__dialog-password-input-${ instanceId }` }
|
|
147
|
-
type="text"
|
|
148
|
-
onChange={ this.updatePassword }
|
|
149
|
-
value={ password }
|
|
150
|
-
placeholder={ __( 'Use a secure password' ) }
|
|
151
|
-
/>
|
|
152
|
-
</div>
|
|
153
|
-
),
|
|
128
|
+
) }
|
|
129
|
+
</fieldset>
|
|
154
130
|
<ConfirmDialog
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
onCancel={ this.handleDialogCancel }
|
|
131
|
+
isOpen={ showPrivateConfirmDialog }
|
|
132
|
+
onConfirm={ confirmPrivate }
|
|
133
|
+
onCancel={ handleDialogCancel }
|
|
159
134
|
>
|
|
160
135
|
{ __( 'Would you like to privately publish this post now?' ) }
|
|
161
|
-
</ConfirmDialog
|
|
162
|
-
|
|
163
|
-
|
|
136
|
+
</ConfirmDialog>
|
|
137
|
+
</>
|
|
138
|
+
);
|
|
164
139
|
}
|
|
165
140
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
141
|
+
function PostVisibilityChoice( { instanceId, value, label, info, ...props } ) {
|
|
142
|
+
return (
|
|
143
|
+
<div className="editor-post-visibility__choice">
|
|
144
|
+
<input
|
|
145
|
+
type="radio"
|
|
146
|
+
name={ `editor-post-visibility__setting-${ instanceId }` }
|
|
147
|
+
value={ value }
|
|
148
|
+
id={ `editor-post-${ value }-${ instanceId }` }
|
|
149
|
+
aria-describedby={ `editor-post-${ value }-${ instanceId }-description` }
|
|
150
|
+
className="editor-post-visibility__radio"
|
|
151
|
+
{ ...props }
|
|
152
|
+
/>
|
|
153
|
+
<label
|
|
154
|
+
htmlFor={ `editor-post-${ value }-${ instanceId }` }
|
|
155
|
+
className="editor-post-visibility__label"
|
|
156
|
+
>
|
|
157
|
+
{ label }
|
|
158
|
+
</label>
|
|
159
|
+
<p
|
|
160
|
+
id={ `editor-post-${ value }-${ instanceId }-description` }
|
|
161
|
+
className="editor-post-visibility__info"
|
|
162
|
+
>
|
|
163
|
+
{ info }
|
|
164
|
+
</p>
|
|
165
|
+
</div>
|
|
166
|
+
);
|
|
167
|
+
}
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { find } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
9
|
-
import {
|
|
4
|
+
import { useSelect } from '@wordpress/data';
|
|
10
5
|
|
|
11
6
|
/**
|
|
12
7
|
* Internal dependencies
|
|
@@ -14,13 +9,9 @@ import { withSelect } from '@wordpress/data';
|
|
|
14
9
|
import { visibilityOptions } from './utils';
|
|
15
10
|
import { store as editorStore } from '../../store';
|
|
16
11
|
|
|
17
|
-
function PostVisibilityLabel(
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return
|
|
12
|
+
export default function PostVisibilityLabel() {
|
|
13
|
+
const visibility = useSelect( ( select ) =>
|
|
14
|
+
select( editorStore ).getEditedPostVisibility()
|
|
15
|
+
);
|
|
16
|
+
return visibilityOptions[ visibility ]?.label;
|
|
22
17
|
}
|
|
23
|
-
|
|
24
|
-
export default withSelect( ( select ) => ( {
|
|
25
|
-
visibility: select( editorStore ).getEditedPostVisibility(),
|
|
26
|
-
} ) )( PostVisibilityLabel );
|
|
@@ -1,39 +1,44 @@
|
|
|
1
|
-
.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
.editor-post-visibility__close {
|
|
2
|
+
position: absolute;
|
|
3
|
+
right: $grid-unit-20;
|
|
4
|
+
top: $grid-unit-20;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.editor-post-visibility__fieldset {
|
|
8
|
+
padding: $grid-unit-10;
|
|
5
9
|
|
|
6
|
-
.editor-post-
|
|
10
|
+
.editor-post-visibility__legend {
|
|
7
11
|
font-weight: 600;
|
|
8
|
-
|
|
12
|
+
padding: 1em 0 0 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.editor-post-visibility__description {
|
|
9
16
|
margin-top: 0.5em;
|
|
10
|
-
padding: 0;
|
|
11
17
|
}
|
|
12
18
|
|
|
13
|
-
.editor-post-
|
|
19
|
+
.editor-post-visibility__radio[type="radio"] {
|
|
14
20
|
@include radio-control;
|
|
15
21
|
margin-top: 2px;
|
|
16
22
|
}
|
|
17
23
|
|
|
18
|
-
.editor-post-
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
.editor-post-visibility__info {
|
|
25
|
+
color: $gray-700;
|
|
26
|
+
margin-left: $grid-unit-15 + $radio-input-size-sm;
|
|
27
|
+
margin-top: 0.5em;
|
|
21
28
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
29
|
+
@include break-small {
|
|
30
|
+
margin-left: $grid-unit-15 + $radio-input-size;
|
|
31
|
+
}
|
|
25
32
|
}
|
|
26
33
|
|
|
27
34
|
// Remove bottom margin on the last label only.
|
|
28
|
-
.editor-post-visibility__choice:last-child .editor-post-
|
|
35
|
+
.editor-post-visibility__choice:last-child .editor-post-visibility__info {
|
|
29
36
|
margin-bottom: 0;
|
|
30
37
|
}
|
|
31
|
-
}
|
|
32
38
|
|
|
33
|
-
.editor-post-
|
|
34
|
-
.editor-post-visibility__dialog-password-input[type="text"] {
|
|
39
|
+
.editor-post-visibility__password .editor-post-visibility__password-input[type="text"] {
|
|
35
40
|
@include input-control;
|
|
36
|
-
margin-left: $grid-unit * 4
|
|
37
|
-
|
|
41
|
+
margin-left: $grid-unit * 4;
|
|
42
|
+
width: calc(100% - #{$grid-unit * 4});
|
|
38
43
|
}
|
|
39
44
|
}
|
|
@@ -3,22 +3,17 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
|
|
6
|
-
export const visibilityOptions =
|
|
7
|
-
{
|
|
8
|
-
value: 'public',
|
|
6
|
+
export const visibilityOptions = {
|
|
7
|
+
public: {
|
|
9
8
|
label: __( 'Public' ),
|
|
10
9
|
info: __( 'Visible to everyone.' ),
|
|
11
10
|
},
|
|
12
|
-
{
|
|
13
|
-
value: 'private',
|
|
11
|
+
private: {
|
|
14
12
|
label: __( 'Private' ),
|
|
15
13
|
info: __( 'Only visible to site admins and editors.' ),
|
|
16
14
|
},
|
|
17
|
-
{
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
info: __(
|
|
21
|
-
'Protected with a password you choose. Only those with the password can view this post.'
|
|
22
|
-
),
|
|
15
|
+
password: {
|
|
16
|
+
label: __( 'Password protected' ),
|
|
17
|
+
info: __( 'Only those with the password can view this post.' ),
|
|
23
18
|
},
|
|
24
|
-
|
|
19
|
+
};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import memize from 'memize';
|
|
5
|
+
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* WordPress dependencies
|
|
@@ -333,7 +334,7 @@ class NativeEditorProvider extends Component {
|
|
|
333
334
|
settings={ editorSettings }
|
|
334
335
|
{ ...props }
|
|
335
336
|
>
|
|
336
|
-
{ children }
|
|
337
|
+
<SafeAreaProvider>{ children }</SafeAreaProvider>
|
|
337
338
|
</EditorProvider>
|
|
338
339
|
<EditorHelpTopics
|
|
339
340
|
isVisible={ this.state.isHelpVisible }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { pick, defaultTo } from 'lodash';
|
|
4
|
+
import { pick, defaultTo, unionBy } from 'lodash';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -61,20 +61,36 @@ function useBlockEditorSettings( settings, hasTemplate ) {
|
|
|
61
61
|
};
|
|
62
62
|
}, [] );
|
|
63
63
|
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
const settingsBlockPatterns =
|
|
65
|
+
settings.__experimentalAdditionalBlockPatterns ?? // WP 6.0
|
|
66
|
+
settings.__experimentalBlockPatterns; // WP 5.9
|
|
67
|
+
const settingsBlockPatternCategories =
|
|
68
|
+
settings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0
|
|
69
|
+
settings.__experimentalBlockPatternCategories; // WP 5.9
|
|
68
70
|
|
|
69
|
-
const {
|
|
71
|
+
const { restBlockPatterns, restBlockPatternCategories } = useSelect(
|
|
70
72
|
( select ) => ( {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
select( coreStore ).getBlockPatternCategories(),
|
|
73
|
+
restBlockPatterns: select( coreStore ).getBlockPatterns(),
|
|
74
|
+
restBlockPatternCategories: select(
|
|
75
|
+
coreStore
|
|
76
|
+
).getBlockPatternCategories(),
|
|
76
77
|
} ),
|
|
77
|
-
[
|
|
78
|
+
[]
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
const blockPatterns = useMemo(
|
|
82
|
+
() => unionBy( settingsBlockPatterns, restBlockPatterns, 'name' ),
|
|
83
|
+
[ settingsBlockPatterns, restBlockPatterns ]
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
const blockPatternCategories = useMemo(
|
|
87
|
+
() =>
|
|
88
|
+
unionBy(
|
|
89
|
+
settingsBlockPatternCategories,
|
|
90
|
+
restBlockPatternCategories,
|
|
91
|
+
'name'
|
|
92
|
+
),
|
|
93
|
+
[ settingsBlockPatternCategories, restBlockPatternCategories ]
|
|
78
94
|
);
|
|
79
95
|
|
|
80
96
|
const { undo } = useDispatch( editorStore );
|
package/src/store/selectors.js
CHANGED
|
@@ -1606,14 +1606,16 @@ export function __experimentalGetTemplateInfo( state, template ) {
|
|
|
1606
1606
|
return {};
|
|
1607
1607
|
}
|
|
1608
1608
|
|
|
1609
|
-
const {
|
|
1609
|
+
const { description, slug, title, area } = template;
|
|
1610
1610
|
const {
|
|
1611
1611
|
title: defaultTitle,
|
|
1612
1612
|
description: defaultDescription,
|
|
1613
1613
|
} = __experimentalGetDefaultTemplateType( state, slug );
|
|
1614
1614
|
|
|
1615
1615
|
const templateTitle = isString( title ) ? title : title?.rendered;
|
|
1616
|
-
const templateDescription = isString(
|
|
1616
|
+
const templateDescription = isString( description )
|
|
1617
|
+
? description
|
|
1618
|
+
: description?.raw;
|
|
1617
1619
|
const templateIcon =
|
|
1618
1620
|
__experimentalGetDefaultTemplatePartAreas( state ).find(
|
|
1619
1621
|
( item ) => area === item.area
|
|
@@ -2149,7 +2149,7 @@ describe( 'selectors', () => {
|
|
|
2149
2149
|
expect( didPostSaveRequestSucceed( state ) ).toBe( true );
|
|
2150
2150
|
} );
|
|
2151
2151
|
|
|
2152
|
-
it( 'should return
|
|
2152
|
+
it( 'should return false if the post save request has failed', () => {
|
|
2153
2153
|
const state = {
|
|
2154
2154
|
saving: {
|
|
2155
2155
|
successful: false,
|
|
@@ -2171,7 +2171,7 @@ describe( 'selectors', () => {
|
|
|
2171
2171
|
expect( didPostSaveRequestFail( state ) ).toBe( true );
|
|
2172
2172
|
} );
|
|
2173
2173
|
|
|
2174
|
-
it( 'should return
|
|
2174
|
+
it( 'should return false if the post save request is successful', () => {
|
|
2175
2175
|
const state = {
|
|
2176
2176
|
saving: {
|
|
2177
2177
|
error: false,
|
|
@@ -2968,7 +2968,7 @@ describe( 'selectors', () => {
|
|
|
2968
2968
|
expect(
|
|
2969
2969
|
__experimentalGetTemplateInfo( state, {
|
|
2970
2970
|
slug: 'index',
|
|
2971
|
-
|
|
2971
|
+
description: { raw: 'test description' },
|
|
2972
2972
|
} ).description
|
|
2973
2973
|
).toEqual( 'test description' );
|
|
2974
2974
|
} );
|
|
@@ -2996,7 +2996,7 @@ describe( 'selectors', () => {
|
|
|
2996
2996
|
expect(
|
|
2997
2997
|
__experimentalGetTemplateInfo( state, {
|
|
2998
2998
|
slug: 'index',
|
|
2999
|
-
|
|
2999
|
+
description: { raw: 'test description' },
|
|
3000
3000
|
} )
|
|
3001
3001
|
).toEqual( {
|
|
3002
3002
|
title: 'Default (Index)',
|
|
@@ -3008,7 +3008,7 @@ describe( 'selectors', () => {
|
|
|
3008
3008
|
__experimentalGetTemplateInfo( state, {
|
|
3009
3009
|
slug: 'index',
|
|
3010
3010
|
title: { rendered: 'test title' },
|
|
3011
|
-
|
|
3011
|
+
description: { raw: 'test description' },
|
|
3012
3012
|
} )
|
|
3013
3013
|
).toEqual( {
|
|
3014
3014
|
title: 'test title',
|