@wordpress/edit-post 6.9.0 → 6.12.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/header/header-toolbar/index.js +7 -6
- package/build/components/header/header-toolbar/index.js.map +1 -1
- package/build/components/header/template-title/delete-template.js +1 -1
- package/build/components/header/template-title/delete-template.js.map +1 -1
- package/build/components/header/template-title/edit-template-title.js +11 -2
- package/build/components/header/template-title/edit-template-title.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +1 -3
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +3 -26
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/sidebar/post-format/index.js +3 -1
- package/build/components/sidebar/post-format/index.js.map +1 -1
- package/build/components/sidebar/post-schedule/index.js +28 -12
- package/build/components/sidebar/post-schedule/index.js.map +1 -1
- package/build/components/sidebar/post-slug/index.js +3 -1
- package/build/components/sidebar/post-slug/index.js.map +1 -1
- package/build/components/sidebar/post-status/index.js +3 -1
- package/build/components/sidebar/post-status/index.js.map +1 -1
- package/build/components/sidebar/post-template/create-modal.js +1 -1
- package/build/components/sidebar/post-template/create-modal.js.map +1 -1
- package/build/components/sidebar/post-template/form.js +1 -1
- package/build/components/sidebar/post-template/form.js.map +1 -1
- package/build/components/sidebar/post-template/index.js +17 -14
- package/build/components/sidebar/post-template/index.js.map +1 -1
- package/build/components/sidebar/post-url/index.js +68 -0
- package/build/components/sidebar/post-url/index.js.map +1 -0
- package/build/components/sidebar/post-visibility/index.js +21 -6
- package/build/components/sidebar/post-visibility/index.js.map +1 -1
- package/build/components/sidebar/settings-sidebar/index.js +2 -4
- package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build/components/visual-editor/index.js +11 -5
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/editor.js +7 -2
- package/build/editor.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.js +8 -6
- package/build-module/components/header/header-toolbar/index.js.map +1 -1
- package/build-module/components/header/template-title/delete-template.js +1 -1
- package/build-module/components/header/template-title/delete-template.js.map +1 -1
- package/build-module/components/header/template-title/edit-template-title.js +12 -2
- package/build-module/components/header/template-title/edit-template-title.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +1 -2
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +3 -25
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/sidebar/post-format/index.js +3 -1
- package/build-module/components/sidebar/post-format/index.js.map +1 -1
- package/build-module/components/sidebar/post-schedule/index.js +31 -15
- package/build-module/components/sidebar/post-schedule/index.js.map +1 -1
- package/build-module/components/sidebar/post-slug/index.js +3 -1
- package/build-module/components/sidebar/post-slug/index.js.map +1 -1
- package/build-module/components/sidebar/post-status/index.js +2 -1
- package/build-module/components/sidebar/post-status/index.js.map +1 -1
- package/build-module/components/sidebar/post-template/create-modal.js +1 -1
- package/build-module/components/sidebar/post-template/create-modal.js.map +1 -1
- package/build-module/components/sidebar/post-template/form.js +1 -1
- package/build-module/components/sidebar/post-template/form.js.map +1 -1
- package/build-module/components/sidebar/post-template/index.js +16 -14
- package/build-module/components/sidebar/post-template/index.js.map +1 -1
- package/build-module/components/sidebar/post-url/index.js +59 -0
- package/build-module/components/sidebar/post-url/index.js.map +1 -0
- package/build-module/components/sidebar/post-visibility/index.js +24 -8
- package/build-module/components/sidebar/post-visibility/index.js.map +1 -1
- package/build-module/components/sidebar/settings-sidebar/index.js +2 -3
- package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build-module/components/visual-editor/index.js +12 -6
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/editor.js +7 -2
- package/build-module/editor.js.map +1 -1
- package/build-style/style-rtl.css +35 -56
- package/build-style/style.css +35 -60
- package/package.json +27 -27
- package/src/components/header/header-toolbar/index.js +10 -10
- package/src/components/header/header-toolbar/style.scss +2 -5
- package/src/components/header/style.scss +0 -6
- package/src/components/header/template-title/delete-template.js +1 -1
- package/src/components/header/template-title/edit-template-title.js +11 -1
- package/src/components/keyboard-shortcut-help-modal/index.js +1 -2
- package/src/components/keyboard-shortcut-help-modal/style.scss +0 -5
- package/src/components/preferences-modal/index.js +5 -23
- package/src/components/preferences-modal/options/test/__snapshots__/enable-custom-fields.js.snap +28 -0
- package/src/components/preferences-modal/test/index.js +3 -3
- package/src/components/sidebar/post-author/style.scss +4 -10
- package/src/components/sidebar/post-format/index.js +1 -1
- package/src/components/sidebar/post-format/style.scss +5 -0
- package/src/components/sidebar/post-schedule/index.js +26 -17
- package/src/components/sidebar/post-schedule/style.scss +0 -2
- package/src/components/sidebar/post-slug/index.js +1 -1
- package/src/components/sidebar/post-slug/style.scss +4 -3
- package/src/components/sidebar/post-status/index.js +3 -1
- package/src/components/sidebar/post-template/create-modal.js +1 -1
- package/src/components/sidebar/post-template/form.js +4 -1
- package/src/components/sidebar/post-template/index.js +13 -9
- package/src/components/sidebar/post-template/style.scss +0 -10
- package/src/components/sidebar/post-url/index.js +51 -0
- package/src/components/sidebar/post-url/style.scss +23 -0
- package/src/components/sidebar/post-visibility/index.js +22 -8
- package/src/components/sidebar/settings-sidebar/index.js +1 -3
- package/src/components/sidebar/template/style.scss +35 -0
- package/src/components/start-page-options/style.scss +0 -9
- package/src/components/visual-editor/index.js +26 -21
- package/src/editor.js +6 -2
- package/src/style.scss +2 -1
- package/build/components/sidebar/post-link/index.js +0 -182
- package/build/components/sidebar/post-link/index.js.map +0 -1
- package/build-module/components/sidebar/post-link/index.js +0 -165
- package/build-module/components/sidebar/post-link/index.js.map +0 -1
- package/src/components/sidebar/post-link/index.js +0 -179
- package/src/components/sidebar/post-link/style.scss +0 -20
|
@@ -19,7 +19,6 @@ import {
|
|
|
19
19
|
PostTypeSupportCheck,
|
|
20
20
|
store as editorStore,
|
|
21
21
|
} from '@wordpress/editor';
|
|
22
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
23
22
|
import {
|
|
24
23
|
PreferencesModal,
|
|
25
24
|
PreferencesModalTabs,
|
|
@@ -45,15 +44,10 @@ const MODAL_NAME = 'edit-post/preferences';
|
|
|
45
44
|
export default function EditPostPreferencesModal() {
|
|
46
45
|
const isLargeViewport = useViewportMatch( 'medium' );
|
|
47
46
|
const { closeModal } = useDispatch( editPostStore );
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return {
|
|
53
|
-
isModalActive: select( editPostStore ).isModalActive( MODAL_NAME ),
|
|
54
|
-
isViewable: get( postType, [ 'viewable' ], false ),
|
|
55
|
-
};
|
|
56
|
-
}, [] );
|
|
47
|
+
const isModalActive = useSelect(
|
|
48
|
+
( select ) => select( editPostStore ).isModalActive( MODAL_NAME ),
|
|
49
|
+
[]
|
|
50
|
+
);
|
|
57
51
|
const showBlockBreadcrumbsOption = useSelect(
|
|
58
52
|
( select ) => {
|
|
59
53
|
const { getEditorSettings } = select( editorStore );
|
|
@@ -200,18 +194,6 @@ export default function EditPostPreferencesModal() {
|
|
|
200
194
|
) }
|
|
201
195
|
>
|
|
202
196
|
<EnablePluginDocumentSettingPanelOption.Slot />
|
|
203
|
-
{ isViewable && (
|
|
204
|
-
<EnablePanelOption
|
|
205
|
-
label={ __( 'Permalink' ) }
|
|
206
|
-
panelName="post-link"
|
|
207
|
-
/>
|
|
208
|
-
) }
|
|
209
|
-
{ isViewable && (
|
|
210
|
-
<EnablePanelOption
|
|
211
|
-
label={ __( 'Template' ) }
|
|
212
|
-
panelName="template"
|
|
213
|
-
/>
|
|
214
|
-
) }
|
|
215
197
|
<PostTaxonomies
|
|
216
198
|
taxonomyWrapper={ ( content, taxonomy ) => (
|
|
217
199
|
<EnablePanelOption
|
|
@@ -260,7 +242,7 @@ export default function EditPostPreferencesModal() {
|
|
|
260
242
|
),
|
|
261
243
|
},
|
|
262
244
|
],
|
|
263
|
-
[
|
|
245
|
+
[ isLargeViewport, showBlockBreadcrumbsOption ]
|
|
264
246
|
);
|
|
265
247
|
|
|
266
248
|
if ( ! isModalActive ) {
|
package/src/components/preferences-modal/options/test/__snapshots__/enable-custom-fields.js.snap
CHANGED
|
@@ -4,6 +4,13 @@ exports[`EnableCustomFieldsOption renders a checked checkbox and a confirmation
|
|
|
4
4
|
.emotion-0 {
|
|
5
5
|
font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',sans-serif;
|
|
6
6
|
font-size: 13px;
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.emotion-0 *,
|
|
11
|
+
.emotion-0 *::before,
|
|
12
|
+
.emotion-0 *::after {
|
|
13
|
+
box-sizing: inherit;
|
|
7
14
|
}
|
|
8
15
|
|
|
9
16
|
.emotion-2 {
|
|
@@ -67,6 +74,13 @@ exports[`EnableCustomFieldsOption renders a checked checkbox when custom fields
|
|
|
67
74
|
.emotion-0 {
|
|
68
75
|
font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',sans-serif;
|
|
69
76
|
font-size: 13px;
|
|
77
|
+
box-sizing: border-box;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.emotion-0 *,
|
|
81
|
+
.emotion-0 *::before,
|
|
82
|
+
.emotion-0 *::after {
|
|
83
|
+
box-sizing: inherit;
|
|
70
84
|
}
|
|
71
85
|
|
|
72
86
|
.emotion-2 {
|
|
@@ -116,6 +130,13 @@ exports[`EnableCustomFieldsOption renders an unchecked checkbox and a confirmati
|
|
|
116
130
|
.emotion-0 {
|
|
117
131
|
font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',sans-serif;
|
|
118
132
|
font-size: 13px;
|
|
133
|
+
box-sizing: border-box;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.emotion-0 *,
|
|
137
|
+
.emotion-0 *::before,
|
|
138
|
+
.emotion-0 *::after {
|
|
139
|
+
box-sizing: inherit;
|
|
119
140
|
}
|
|
120
141
|
|
|
121
142
|
.emotion-2 {
|
|
@@ -179,6 +200,13 @@ exports[`EnableCustomFieldsOption renders an unchecked checkbox when custom fiel
|
|
|
179
200
|
.emotion-0 {
|
|
180
201
|
font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',sans-serif;
|
|
181
202
|
font-size: 13px;
|
|
203
|
+
box-sizing: border-box;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.emotion-0 *,
|
|
207
|
+
.emotion-0 *::before,
|
|
208
|
+
.emotion-0 *::after {
|
|
209
|
+
box-sizing: inherit;
|
|
182
210
|
}
|
|
183
211
|
|
|
184
212
|
.emotion-2 {
|
|
@@ -21,13 +21,13 @@ jest.mock( '@wordpress/compose/src/hooks/use-viewport-match', () => jest.fn() );
|
|
|
21
21
|
describe( 'EditPostPreferencesModal', () => {
|
|
22
22
|
describe( 'should match snapshot when the modal is active', () => {
|
|
23
23
|
it( 'large viewports', () => {
|
|
24
|
-
useSelect.mockImplementation( () =>
|
|
24
|
+
useSelect.mockImplementation( () => true );
|
|
25
25
|
useViewportMatch.mockImplementation( () => true );
|
|
26
26
|
const wrapper = shallow( <EditPostPreferencesModal /> );
|
|
27
27
|
expect( wrapper ).toMatchSnapshot();
|
|
28
28
|
} );
|
|
29
29
|
it( 'small viewports', () => {
|
|
30
|
-
useSelect.mockImplementation( () =>
|
|
30
|
+
useSelect.mockImplementation( () => true );
|
|
31
31
|
useViewportMatch.mockImplementation( () => false );
|
|
32
32
|
const wrapper = shallow( <EditPostPreferencesModal /> );
|
|
33
33
|
expect( wrapper ).toMatchSnapshot();
|
|
@@ -35,7 +35,7 @@ describe( 'EditPostPreferencesModal', () => {
|
|
|
35
35
|
} );
|
|
36
36
|
|
|
37
37
|
it( 'should not render when the modal is not active', () => {
|
|
38
|
-
useSelect.mockImplementation( () =>
|
|
38
|
+
useSelect.mockImplementation( () => false );
|
|
39
39
|
const wrapper = shallow( <EditPostPreferencesModal /> );
|
|
40
40
|
expect( wrapper.isEmptyRender() ).toBe( true );
|
|
41
41
|
} );
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
// outside of the container because of IE11 flexbox bugs.
|
|
6
|
-
// We reset it to `width: auto;` for non-IE11 browsers.
|
|
7
|
-
width: 100%;
|
|
8
|
-
@supports (position: sticky) {
|
|
9
|
-
width: auto;
|
|
10
|
-
}
|
|
1
|
+
.edit-post-post-author {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
align-items: stretch;
|
|
11
5
|
}
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
4
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
5
5
|
import { PanelRow, Dropdown, Button } from '@wordpress/components';
|
|
6
6
|
import { useRef } from '@wordpress/element';
|
|
7
7
|
import {
|
|
8
8
|
PostSchedule as PostScheduleForm,
|
|
9
|
-
PostScheduleLabel,
|
|
10
9
|
PostScheduleCheck,
|
|
11
10
|
usePostScheduleLabel,
|
|
12
11
|
} from '@wordpress/editor';
|
|
13
12
|
|
|
14
13
|
export default function PostSchedule() {
|
|
15
14
|
const anchorRef = useRef();
|
|
16
|
-
|
|
17
|
-
const fullLabel = usePostScheduleLabel( { full: true } );
|
|
18
|
-
|
|
19
15
|
return (
|
|
20
16
|
<PostScheduleCheck>
|
|
21
17
|
<PanelRow className="edit-post-post-schedule" ref={ anchorRef }>
|
|
@@ -24,18 +20,12 @@ export default function PostSchedule() {
|
|
|
24
20
|
popoverProps={ { anchorRef } }
|
|
25
21
|
position="bottom left"
|
|
26
22
|
contentClassName="edit-post-post-schedule__dialog"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
variant="tertiary"
|
|
34
|
-
label={ fullLabel }
|
|
35
|
-
>
|
|
36
|
-
<PostScheduleLabel />
|
|
37
|
-
</Button>
|
|
38
|
-
</>
|
|
23
|
+
focusOnMount
|
|
24
|
+
renderToggle={ ( { isOpen, onToggle } ) => (
|
|
25
|
+
<PostScheduleToggle
|
|
26
|
+
isOpen={ isOpen }
|
|
27
|
+
onClick={ onToggle }
|
|
28
|
+
/>
|
|
39
29
|
) }
|
|
40
30
|
renderContent={ ( { onClose } ) => (
|
|
41
31
|
<PostScheduleForm onClose={ onClose } />
|
|
@@ -45,3 +35,22 @@ export default function PostSchedule() {
|
|
|
45
35
|
</PostScheduleCheck>
|
|
46
36
|
);
|
|
47
37
|
}
|
|
38
|
+
|
|
39
|
+
function PostScheduleToggle( { isOpen, onClick } ) {
|
|
40
|
+
const label = usePostScheduleLabel();
|
|
41
|
+
const fullLabel = usePostScheduleLabel( { full: true } );
|
|
42
|
+
return (
|
|
43
|
+
<Button
|
|
44
|
+
className="edit-post-post-schedule__toggle"
|
|
45
|
+
variant="tertiary"
|
|
46
|
+
label={ fullLabel }
|
|
47
|
+
showTooltip
|
|
48
|
+
aria-expanded={ isOpen }
|
|
49
|
+
// translators: %s: Current post date.
|
|
50
|
+
aria-label={ sprintf( __( 'Change date: %s' ), label ) }
|
|
51
|
+
onClick={ onClick }
|
|
52
|
+
>
|
|
53
|
+
{ label }
|
|
54
|
+
</Button>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
@@ -20,6 +20,7 @@ import PostPendingStatus from '../post-pending-status';
|
|
|
20
20
|
import PluginPostStatusInfo from '../plugin-post-status-info';
|
|
21
21
|
import { store as editPostStore } from '../../../store';
|
|
22
22
|
import PostTemplate from '../post-template';
|
|
23
|
+
import PostURL from '../post-url';
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
26
|
* Module Constants
|
|
@@ -39,10 +40,11 @@ function PostStatus( { isOpened, onTogglePanel } ) {
|
|
|
39
40
|
<>
|
|
40
41
|
<PostVisibility />
|
|
41
42
|
<PostSchedule />
|
|
43
|
+
<PostURL />
|
|
42
44
|
<PostTemplate />
|
|
43
|
-
<PostFormat />
|
|
44
45
|
<PostSticky />
|
|
45
46
|
<PostPendingStatus />
|
|
47
|
+
<PostFormat />
|
|
46
48
|
<PostSlug />
|
|
47
49
|
<PostAuthor />
|
|
48
50
|
{ fills }
|
|
@@ -117,7 +117,7 @@ export default function PostTemplateCreateModal( { onClose } ) {
|
|
|
117
117
|
placeholder={ DEFAULT_TITLE }
|
|
118
118
|
disabled={ isBusy }
|
|
119
119
|
help={ __(
|
|
120
|
-
'Describe the
|
|
120
|
+
'Describe the template, e.g. "Post with sidebar". Custom templates can be applied to any post or page.'
|
|
121
121
|
) }
|
|
122
122
|
/>
|
|
123
123
|
</FlexItem>
|
|
@@ -50,7 +50,10 @@ export default function PostTemplateForm( { onClose } ) {
|
|
|
50
50
|
),
|
|
51
51
|
selectedTemplateSlug:
|
|
52
52
|
select( editorStore ).getEditedPostAttribute( 'template' ),
|
|
53
|
-
canCreate:
|
|
53
|
+
canCreate:
|
|
54
|
+
canCreateTemplates &&
|
|
55
|
+
! _isPostsPage &&
|
|
56
|
+
editorSettings.supportsTemplateMode,
|
|
54
57
|
canEdit:
|
|
55
58
|
canCreateTemplates &&
|
|
56
59
|
editorSettings.supportsTemplateMode &&
|
|
@@ -12,6 +12,7 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
12
12
|
* Internal dependencies
|
|
13
13
|
*/
|
|
14
14
|
import PostTemplateForm from './form';
|
|
15
|
+
import { store as editPostStore } from '../../../store';
|
|
15
16
|
|
|
16
17
|
export default function PostTemplate() {
|
|
17
18
|
const anchorRef = useRef();
|
|
@@ -31,6 +32,10 @@ export default function PostTemplate() {
|
|
|
31
32
|
return true;
|
|
32
33
|
}
|
|
33
34
|
|
|
35
|
+
if ( ! settings.supportsTemplateMode ) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
|
|
34
39
|
const canCreateTemplates =
|
|
35
40
|
select( coreStore ).canUser( 'create', 'templates' ) ?? false;
|
|
36
41
|
return canCreateTemplates;
|
|
@@ -48,6 +53,7 @@ export default function PostTemplate() {
|
|
|
48
53
|
position="bottom left"
|
|
49
54
|
className="edit-post-post-template__dropdown"
|
|
50
55
|
contentClassName="edit-post-post-template__dialog"
|
|
56
|
+
focusOnMount
|
|
51
57
|
renderToggle={ ( { isOpen, onToggle } ) => (
|
|
52
58
|
<PostTemplateToggle
|
|
53
59
|
isOpen={ isOpen }
|
|
@@ -67,16 +73,14 @@ function PostTemplateToggle( { isOpen, onClick } ) {
|
|
|
67
73
|
const templateSlug =
|
|
68
74
|
select( editorStore ).getEditedPostAttribute( 'template' );
|
|
69
75
|
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
76
|
+
const { supportsTemplateMode, availableTemplates } =
|
|
77
|
+
select( editorStore ).getEditorSettings();
|
|
78
|
+
if ( ! supportsTemplateMode && availableTemplates[ templateSlug ] ) {
|
|
79
|
+
return availableTemplates[ templateSlug ];
|
|
73
80
|
}
|
|
74
81
|
|
|
75
|
-
const template = select(
|
|
76
|
-
|
|
77
|
-
?.find( ( { slug } ) => slug === templateSlug );
|
|
78
|
-
|
|
79
|
-
return template?.title.rendered;
|
|
82
|
+
const template = select( editPostStore ).getEditedPostTemplate();
|
|
83
|
+
return template?.title ?? template?.slug;
|
|
80
84
|
}, [] );
|
|
81
85
|
|
|
82
86
|
return (
|
|
@@ -95,7 +99,7 @@ function PostTemplateToggle( { isOpen, onClick } ) {
|
|
|
95
99
|
}
|
|
96
100
|
onClick={ onClick }
|
|
97
101
|
>
|
|
98
|
-
{ templateTitle ?? __( '
|
|
102
|
+
{ templateTitle ?? __( 'Default template' ) }
|
|
99
103
|
</Button>
|
|
100
104
|
);
|
|
101
105
|
}
|
|
@@ -29,16 +29,6 @@
|
|
|
29
29
|
margin: $grid-unit-10;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
.edit-post-post-template__create-modal {
|
|
33
|
-
.components-modal__header {
|
|
34
|
-
border-bottom: none;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.components-modal__content::before {
|
|
38
|
-
margin-bottom: $grid-unit-05;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
32
|
.edit-post-post-template__create-form {
|
|
43
33
|
@include break-medium() {
|
|
44
34
|
width: $grid-unit * 40;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useRef } from '@wordpress/element';
|
|
5
|
+
import { PanelRow, Dropdown, Button } from '@wordpress/components';
|
|
6
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
7
|
+
import {
|
|
8
|
+
PostURLCheck,
|
|
9
|
+
PostURL as PostURLForm,
|
|
10
|
+
usePostURLLabel,
|
|
11
|
+
} from '@wordpress/editor';
|
|
12
|
+
|
|
13
|
+
export default function PostURL() {
|
|
14
|
+
const anchorRef = useRef();
|
|
15
|
+
return (
|
|
16
|
+
<PostURLCheck>
|
|
17
|
+
<PanelRow className="edit-post-post-url" ref={ anchorRef }>
|
|
18
|
+
<span>{ __( 'URL' ) }</span>
|
|
19
|
+
<Dropdown
|
|
20
|
+
popoverProps={ { anchorRef } }
|
|
21
|
+
position="bottom left"
|
|
22
|
+
className="edit-post-post-url__dropdown"
|
|
23
|
+
contentClassName="edit-post-post-url__dialog"
|
|
24
|
+
focusOnMount
|
|
25
|
+
renderToggle={ ( { isOpen, onToggle } ) => (
|
|
26
|
+
<PostURLToggle isOpen={ isOpen } onClick={ onToggle } />
|
|
27
|
+
) }
|
|
28
|
+
renderContent={ ( { onClose } ) => (
|
|
29
|
+
<PostURLForm onClose={ onClose } />
|
|
30
|
+
) }
|
|
31
|
+
/>
|
|
32
|
+
</PanelRow>
|
|
33
|
+
</PostURLCheck>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function PostURLToggle( { isOpen, onClick } ) {
|
|
38
|
+
const label = usePostURLLabel();
|
|
39
|
+
return (
|
|
40
|
+
<Button
|
|
41
|
+
className="edit-post-post-url__toggle"
|
|
42
|
+
variant="tertiary"
|
|
43
|
+
aria-expanded={ isOpen }
|
|
44
|
+
// translators: %s: Current post URL.
|
|
45
|
+
aria-label={ sprintf( __( 'Change URL: %s' ), label ) }
|
|
46
|
+
onClick={ onClick }
|
|
47
|
+
>
|
|
48
|
+
{ label }
|
|
49
|
+
</Button>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.edit-post-post-url {
|
|
2
|
+
width: 100%;
|
|
3
|
+
justify-content: flex-start;
|
|
4
|
+
|
|
5
|
+
span {
|
|
6
|
+
display: block;
|
|
7
|
+
width: 45%;
|
|
8
|
+
flex-shrink: 0;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.components-button.edit-post-post-url__toggle {
|
|
13
|
+
text-align: left;
|
|
14
|
+
white-space: normal;
|
|
15
|
+
height: auto;
|
|
16
|
+
word-break: break-word;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.edit-post-post-url__dialog .editor-post-url {
|
|
20
|
+
// sidebar width - popover padding - form margin
|
|
21
|
+
min-width: $sidebar-width - $grid-unit-20 - $grid-unit-20;
|
|
22
|
+
margin: $grid-unit-10;
|
|
23
|
+
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
4
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
5
5
|
import { PanelRow, Dropdown, Button } from '@wordpress/components';
|
|
6
6
|
import {
|
|
7
7
|
PostVisibility as PostVisibilityForm,
|
|
8
8
|
PostVisibilityLabel,
|
|
9
9
|
PostVisibilityCheck,
|
|
10
|
+
usePostVisibilityLabel,
|
|
10
11
|
} from '@wordpress/editor';
|
|
11
12
|
import { useRef } from '@wordpress/element';
|
|
12
13
|
|
|
@@ -32,15 +33,12 @@ export function PostVisibility() {
|
|
|
32
33
|
// when the label changes.
|
|
33
34
|
anchorRef: rowRef.current,
|
|
34
35
|
} }
|
|
36
|
+
focusOnMount
|
|
35
37
|
renderToggle={ ( { isOpen, onToggle } ) => (
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
className="edit-post-post-visibility__toggle"
|
|
38
|
+
<PostVisibilityToggle
|
|
39
|
+
isOpen={ isOpen }
|
|
39
40
|
onClick={ onToggle }
|
|
40
|
-
|
|
41
|
-
>
|
|
42
|
-
<PostVisibilityLabel />
|
|
43
|
-
</Button>
|
|
41
|
+
/>
|
|
44
42
|
) }
|
|
45
43
|
renderContent={ ( { onClose } ) => (
|
|
46
44
|
<PostVisibilityForm onClose={ onClose } />
|
|
@@ -53,4 +51,20 @@ export function PostVisibility() {
|
|
|
53
51
|
);
|
|
54
52
|
}
|
|
55
53
|
|
|
54
|
+
function PostVisibilityToggle( { isOpen, onClick } ) {
|
|
55
|
+
const label = usePostVisibilityLabel();
|
|
56
|
+
return (
|
|
57
|
+
<Button
|
|
58
|
+
className="edit-post-post-visibility__toggle"
|
|
59
|
+
variant="tertiary"
|
|
60
|
+
aria-expanded={ isOpen }
|
|
61
|
+
// translators: %s: Current post visibility.
|
|
62
|
+
aria-label={ sprintf( __( 'Select visibility: %s' ), label ) }
|
|
63
|
+
onClick={ onClick }
|
|
64
|
+
>
|
|
65
|
+
{ label }
|
|
66
|
+
</Button>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
56
70
|
export default PostVisibility;
|
|
@@ -19,7 +19,6 @@ import LastRevision from '../last-revision';
|
|
|
19
19
|
import PostTaxonomies from '../post-taxonomies';
|
|
20
20
|
import FeaturedImage from '../featured-image';
|
|
21
21
|
import PostExcerpt from '../post-excerpt';
|
|
22
|
-
import PostLink from '../post-link';
|
|
23
22
|
import DiscussionPanel from '../discussion-panel';
|
|
24
23
|
import PageAttributes from '../page-attributes';
|
|
25
24
|
import MetaBoxes from '../../meta-boxes';
|
|
@@ -41,7 +40,7 @@ const SettingsSidebar = () => {
|
|
|
41
40
|
// The settings sidebar is used by the edit-post/document and edit-post/block sidebars.
|
|
42
41
|
// sidebarName represents the sidebar that is active or that should be active when the SettingsSidebar toggle button is pressed.
|
|
43
42
|
// If one of the two sidebars is active the component will contain the content of that sidebar.
|
|
44
|
-
// When neither of the
|
|
43
|
+
// When neither of the two sidebars is active we can not simply return null, because the PluginSidebarEditPost
|
|
45
44
|
// component, besides being used to render the sidebar, also renders the toggle button. In that case sidebarName
|
|
46
45
|
// should contain the sidebar that will be active when the toggle button is pressed. If a block
|
|
47
46
|
// is selected, that should be edit-post/block otherwise it's edit-post/document.
|
|
@@ -87,7 +86,6 @@ const SettingsSidebar = () => {
|
|
|
87
86
|
<PostStatus />
|
|
88
87
|
<PluginDocumentSettingPanel.Slot />
|
|
89
88
|
<LastRevision />
|
|
90
|
-
<PostLink />
|
|
91
89
|
<PostTaxonomies />
|
|
92
90
|
<FeaturedImage />
|
|
93
91
|
<PostExcerpt />
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
.edit-post-template__modal {
|
|
2
|
+
.components-base-control {
|
|
3
|
+
@include break-medium() {
|
|
4
|
+
width: $grid-unit * 40;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.edit-post-template__modal-actions {
|
|
10
|
+
margin-top: $grid-unit-15;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.edit-post-template-modal__tip {
|
|
14
|
+
padding: $grid-unit-20 $grid-unit-30;
|
|
15
|
+
background: $gray-100;
|
|
16
|
+
border-radius: $radius-block-ui;
|
|
17
|
+
|
|
18
|
+
@include break-medium() {
|
|
19
|
+
width: $grid-unit * 30;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.edit-post-template__notice {
|
|
24
|
+
margin: 0 0 $grid-unit-10 0;
|
|
25
|
+
|
|
26
|
+
.components-notice__content {
|
|
27
|
+
margin: 0;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.edit-post-template__actions {
|
|
32
|
+
button:not(:last-child) {
|
|
33
|
+
margin-right: $grid-unit-10;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -11,15 +11,6 @@
|
|
|
11
11
|
@include break-large() {
|
|
12
12
|
height: 70%;
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
// @todo: Consider this for a minimal modal prop.
|
|
16
|
-
.components-modal__header {
|
|
17
|
-
border-bottom: none;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.components-modal__content::before {
|
|
21
|
-
content: none;
|
|
22
|
-
}
|
|
23
14
|
}
|
|
24
15
|
|
|
25
16
|
// 2 column masonry layout.
|