@wordpress/edit-post 6.9.0 → 6.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/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 +4 -3
- 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 +4 -2
- package/build/components/visual-editor/index.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 +4 -3
- 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 +4 -2
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-style/style-rtl.css +34 -47
- package/build-style/style.css +34 -51
- package/package.json +27 -27
- 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/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 +4 -3
- 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 +2 -1
- 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
|
@@ -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 &&
|
|
@@ -27,8 +27,8 @@ export default function PostTemplate() {
|
|
|
27
27
|
const hasTemplates =
|
|
28
28
|
!! settings.availableTemplates &&
|
|
29
29
|
Object.keys( settings.availableTemplates ).length > 0;
|
|
30
|
-
if ( hasTemplates ) {
|
|
31
|
-
return
|
|
30
|
+
if ( ! hasTemplates && ! settings.supportsTemplateMode ) {
|
|
31
|
+
return false;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
const canCreateTemplates =
|
|
@@ -48,6 +48,7 @@ export default function PostTemplate() {
|
|
|
48
48
|
position="bottom left"
|
|
49
49
|
className="edit-post-post-template__dropdown"
|
|
50
50
|
contentClassName="edit-post-post-template__dialog"
|
|
51
|
+
focusOnMount
|
|
51
52
|
renderToggle={ ( { isOpen, onToggle } ) => (
|
|
52
53
|
<PostTemplateToggle
|
|
53
54
|
isOpen={ isOpen }
|
|
@@ -95,7 +96,7 @@ function PostTemplateToggle( { isOpen, onClick } ) {
|
|
|
95
96
|
}
|
|
96
97
|
onClick={ onClick }
|
|
97
98
|
>
|
|
98
|
-
{ templateTitle ?? __( '
|
|
99
|
+
{ templateTitle ?? __( 'Default template' ) }
|
|
99
100
|
</Button>
|
|
100
101
|
);
|
|
101
102
|
}
|
|
@@ -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.
|
|
@@ -245,6 +245,7 @@ export default function VisualEditor( { styles } ) {
|
|
|
245
245
|
<LayoutStyle
|
|
246
246
|
selector=".edit-post-visual-editor__post-title-wrapper, .block-editor-block-list__layout.is-root-container"
|
|
247
247
|
layout={ defaultLayout }
|
|
248
|
+
layoutDefinitions={ defaultLayout?.definitions }
|
|
248
249
|
/>
|
|
249
250
|
) }
|
|
250
251
|
{ ! isTemplateMode && (
|
|
@@ -260,7 +261,7 @@ export default function VisualEditor( { styles } ) {
|
|
|
260
261
|
className={
|
|
261
262
|
isTemplateMode
|
|
262
263
|
? 'wp-site-blocks'
|
|
263
|
-
:
|
|
264
|
+
: 'is-layout-flow' // Ensure root level blocks receive default/flow blockGap styling rules.
|
|
264
265
|
}
|
|
265
266
|
__experimentalLayout={ layout }
|
|
266
267
|
/>
|
package/src/style.scss
CHANGED
|
@@ -11,11 +11,12 @@
|
|
|
11
11
|
@import "./components/sidebar/style.scss";
|
|
12
12
|
@import "./components/sidebar/last-revision/style.scss";
|
|
13
13
|
@import "./components/sidebar/post-author/style.scss";
|
|
14
|
-
@import "./components/sidebar/post-
|
|
14
|
+
@import "./components/sidebar/post-format/style.scss";
|
|
15
15
|
@import "./components/sidebar/post-schedule/style.scss";
|
|
16
16
|
@import "./components/sidebar/post-slug/style.scss";
|
|
17
17
|
@import "./components/sidebar/post-status/style.scss";
|
|
18
18
|
@import "./components/sidebar/post-template/style.scss";
|
|
19
|
+
@import "./components/sidebar/post-url/style.scss";
|
|
19
20
|
@import "./components/sidebar/post-visibility/style.scss";
|
|
20
21
|
@import "./components/sidebar/settings-header/style.scss";
|
|
21
22
|
@import "./components/sidebar/template-summary/style.scss";
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _element = require("@wordpress/element");
|
|
9
|
-
|
|
10
|
-
var _lodash = require("lodash");
|
|
11
|
-
|
|
12
|
-
var _i18n = require("@wordpress/i18n");
|
|
13
|
-
|
|
14
|
-
var _components = require("@wordpress/components");
|
|
15
|
-
|
|
16
|
-
var _data = require("@wordpress/data");
|
|
17
|
-
|
|
18
|
-
var _compose = require("@wordpress/compose");
|
|
19
|
-
|
|
20
|
-
var _editor = require("@wordpress/editor");
|
|
21
|
-
|
|
22
|
-
var _url = require("@wordpress/url");
|
|
23
|
-
|
|
24
|
-
var _coreData = require("@wordpress/core-data");
|
|
25
|
-
|
|
26
|
-
var _store = require("../../../store");
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* External dependencies
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* WordPress dependencies
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Internal dependencies
|
|
38
|
-
*/
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Module Constants
|
|
42
|
-
*/
|
|
43
|
-
const PANEL_NAME = 'post-link';
|
|
44
|
-
|
|
45
|
-
function PostLink(_ref) {
|
|
46
|
-
let {
|
|
47
|
-
isOpened,
|
|
48
|
-
onTogglePanel,
|
|
49
|
-
isEditable,
|
|
50
|
-
postLink,
|
|
51
|
-
permalinkPrefix,
|
|
52
|
-
permalinkSuffix,
|
|
53
|
-
editPermalink,
|
|
54
|
-
postSlug,
|
|
55
|
-
postTypeLabel
|
|
56
|
-
} = _ref;
|
|
57
|
-
const [forceEmptyField, setForceEmptyField] = (0, _element.useState)(false);
|
|
58
|
-
let prefixElement, postNameElement, suffixElement;
|
|
59
|
-
|
|
60
|
-
if (isEditable) {
|
|
61
|
-
prefixElement = permalinkPrefix && (0, _element.createElement)("span", {
|
|
62
|
-
className: "edit-post-post-link__link-prefix"
|
|
63
|
-
}, permalinkPrefix);
|
|
64
|
-
postNameElement = postSlug && (0, _element.createElement)("span", {
|
|
65
|
-
className: "edit-post-post-link__link-post-name"
|
|
66
|
-
}, postSlug);
|
|
67
|
-
suffixElement = permalinkSuffix && (0, _element.createElement)("span", {
|
|
68
|
-
className: "edit-post-post-link__link-suffix"
|
|
69
|
-
}, permalinkSuffix);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return (0, _element.createElement)(_components.PanelBody, {
|
|
73
|
-
title: (0, _i18n.__)('Permalink'),
|
|
74
|
-
opened: isOpened,
|
|
75
|
-
onToggle: onTogglePanel
|
|
76
|
-
}, isEditable && (0, _element.createElement)("div", {
|
|
77
|
-
className: "editor-post-link"
|
|
78
|
-
}, (0, _element.createElement)(_components.TextControl, {
|
|
79
|
-
label: (0, _i18n.__)('URL Slug'),
|
|
80
|
-
value: forceEmptyField ? '' : postSlug,
|
|
81
|
-
autoComplete: "off",
|
|
82
|
-
spellCheck: "false",
|
|
83
|
-
onChange: newValue => {
|
|
84
|
-
editPermalink(newValue); // When we delete the field the permalink gets
|
|
85
|
-
// reverted to the original value.
|
|
86
|
-
// The forceEmptyField logic allows the user to have
|
|
87
|
-
// the field temporarily empty while typing.
|
|
88
|
-
|
|
89
|
-
if (!newValue) {
|
|
90
|
-
if (!forceEmptyField) {
|
|
91
|
-
setForceEmptyField(true);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (forceEmptyField) {
|
|
98
|
-
setForceEmptyField(false);
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
onBlur: event => {
|
|
102
|
-
editPermalink((0, _url.cleanForSlug)(event.target.value));
|
|
103
|
-
|
|
104
|
-
if (forceEmptyField) {
|
|
105
|
-
setForceEmptyField(false);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}), (0, _element.createElement)("p", null, (0, _i18n.__)('The last part of the URL.'), ' ', (0, _element.createElement)(_components.ExternalLink, {
|
|
109
|
-
href: (0, _i18n.__)('https://wordpress.org/support/article/settings-sidebar/#permalink')
|
|
110
|
-
}, (0, _i18n.__)('Read about permalinks')))), (0, _element.createElement)("h3", {
|
|
111
|
-
className: "edit-post-post-link__preview-label"
|
|
112
|
-
}, postTypeLabel || (0, _i18n.__)('View post')), (0, _element.createElement)("div", {
|
|
113
|
-
className: "edit-post-post-link__preview-link-container"
|
|
114
|
-
}, (0, _element.createElement)(_components.ExternalLink, {
|
|
115
|
-
className: "edit-post-post-link__link",
|
|
116
|
-
href: postLink,
|
|
117
|
-
target: "_blank"
|
|
118
|
-
}, isEditable ? (0, _element.createElement)(_element.Fragment, null, prefixElement, postNameElement, suffixElement) : postLink)));
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
var _default = (0, _compose.compose)([(0, _data.withSelect)(select => {
|
|
122
|
-
const {
|
|
123
|
-
isPermalinkEditable,
|
|
124
|
-
getCurrentPost,
|
|
125
|
-
isCurrentPostPublished,
|
|
126
|
-
getPermalinkParts,
|
|
127
|
-
getEditedPostAttribute,
|
|
128
|
-
getEditedPostSlug
|
|
129
|
-
} = select(_editor.store);
|
|
130
|
-
const {
|
|
131
|
-
isEditorPanelEnabled,
|
|
132
|
-
isEditorPanelOpened
|
|
133
|
-
} = select(_store.store);
|
|
134
|
-
const {
|
|
135
|
-
getPostType
|
|
136
|
-
} = select(_coreData.store);
|
|
137
|
-
const {
|
|
138
|
-
link
|
|
139
|
-
} = getCurrentPost();
|
|
140
|
-
const postTypeName = getEditedPostAttribute('type');
|
|
141
|
-
const postType = getPostType(postTypeName);
|
|
142
|
-
const permalinkParts = getPermalinkParts();
|
|
143
|
-
return {
|
|
144
|
-
postLink: link,
|
|
145
|
-
isEditable: isPermalinkEditable(),
|
|
146
|
-
isPublished: isCurrentPostPublished(),
|
|
147
|
-
isOpened: isEditorPanelOpened(PANEL_NAME),
|
|
148
|
-
isEnabled: isEditorPanelEnabled(PANEL_NAME),
|
|
149
|
-
isViewable: (0, _lodash.get)(postType, ['viewable'], false),
|
|
150
|
-
postSlug: (0, _url.safeDecodeURIComponent)(getEditedPostSlug()),
|
|
151
|
-
postTypeLabel: (0, _lodash.get)(postType, ['labels', 'view_item']),
|
|
152
|
-
hasPermalinkParts: !!permalinkParts,
|
|
153
|
-
permalinkPrefix: permalinkParts === null || permalinkParts === void 0 ? void 0 : permalinkParts.prefix,
|
|
154
|
-
permalinkSuffix: permalinkParts === null || permalinkParts === void 0 ? void 0 : permalinkParts.suffix
|
|
155
|
-
};
|
|
156
|
-
}), (0, _compose.ifCondition)(_ref2 => {
|
|
157
|
-
let {
|
|
158
|
-
isEnabled,
|
|
159
|
-
postLink,
|
|
160
|
-
isViewable,
|
|
161
|
-
hasPermalinkParts
|
|
162
|
-
} = _ref2;
|
|
163
|
-
return isEnabled && postLink && isViewable && hasPermalinkParts;
|
|
164
|
-
}), (0, _data.withDispatch)(dispatch => {
|
|
165
|
-
const {
|
|
166
|
-
toggleEditorPanelOpened
|
|
167
|
-
} = dispatch(_store.store);
|
|
168
|
-
const {
|
|
169
|
-
editPost
|
|
170
|
-
} = dispatch(_editor.store);
|
|
171
|
-
return {
|
|
172
|
-
onTogglePanel: () => toggleEditorPanelOpened(PANEL_NAME),
|
|
173
|
-
editPermalink: newSlug => {
|
|
174
|
-
editPost({
|
|
175
|
-
slug: newSlug
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
|
-
})])(PostLink);
|
|
180
|
-
|
|
181
|
-
exports.default = _default;
|
|
182
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/post-link/index.js"],"names":["PANEL_NAME","PostLink","isOpened","onTogglePanel","isEditable","postLink","permalinkPrefix","permalinkSuffix","editPermalink","postSlug","postTypeLabel","forceEmptyField","setForceEmptyField","prefixElement","postNameElement","suffixElement","newValue","event","target","value","select","isPermalinkEditable","getCurrentPost","isCurrentPostPublished","getPermalinkParts","getEditedPostAttribute","getEditedPostSlug","editorStore","isEditorPanelEnabled","isEditorPanelOpened","editPostStore","getPostType","coreStore","link","postTypeName","postType","permalinkParts","isPublished","isEnabled","isViewable","hasPermalinkParts","prefix","suffix","dispatch","toggleEditorPanelOpened","editPost","newSlug","slug"],"mappings":";;;;;;;AAeA;;AAZA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AApBA;AACA;AACA;;AAGA;AACA;AACA;;AAUA;AACA;AACA;;AAGA;AACA;AACA;AACA,MAAMA,UAAU,GAAG,WAAnB;;AAEA,SAASC,QAAT,OAUI;AAAA,MAVe;AAClBC,IAAAA,QADkB;AAElBC,IAAAA,aAFkB;AAGlBC,IAAAA,UAHkB;AAIlBC,IAAAA,QAJkB;AAKlBC,IAAAA,eALkB;AAMlBC,IAAAA,eANkB;AAOlBC,IAAAA,aAPkB;AAQlBC,IAAAA,QARkB;AASlBC,IAAAA;AATkB,GAUf;AACH,QAAM,CAAEC,eAAF,EAAmBC,kBAAnB,IAA0C,uBAAU,KAAV,CAAhD;AAEA,MAAIC,aAAJ,EAAmBC,eAAnB,EAAoCC,aAApC;;AACA,MAAKX,UAAL,EAAkB;AACjBS,IAAAA,aAAa,GAAGP,eAAe,IAC9B;AAAM,MAAA,SAAS,EAAC;AAAhB,OACGA,eADH,CADD;AAKAQ,IAAAA,eAAe,GAAGL,QAAQ,IACzB;AAAM,MAAA,SAAS,EAAC;AAAhB,OACGA,QADH,CADD;AAKAM,IAAAA,aAAa,GAAGR,eAAe,IAC9B;AAAM,MAAA,SAAS,EAAC;AAAhB,OACGA,eADH,CADD;AAKA;;AAED,SACC,4BAAC,qBAAD;AACC,IAAA,KAAK,EAAG,cAAI,WAAJ,CADT;AAEC,IAAA,MAAM,EAAGL,QAFV;AAGC,IAAA,QAAQ,EAAGC;AAHZ,KAKGC,UAAU,IACX;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAG,cAAI,UAAJ,CADT;AAEC,IAAA,KAAK,EAAGO,eAAe,GAAG,EAAH,GAAQF,QAFhC;AAGC,IAAA,YAAY,EAAC,KAHd;AAIC,IAAA,UAAU,EAAC,OAJZ;AAKC,IAAA,QAAQ,EAAKO,QAAF,IAAgB;AAC1BR,MAAAA,aAAa,CAAEQ,QAAF,CAAb,CAD0B,CAE1B;AACA;AACA;AACA;;AACA,UAAK,CAAEA,QAAP,EAAkB;AACjB,YAAK,CAAEL,eAAP,EAAyB;AACxBC,UAAAA,kBAAkB,CAAE,IAAF,CAAlB;AACA;;AACD;AACA;;AACD,UAAKD,eAAL,EAAuB;AACtBC,QAAAA,kBAAkB,CAAE,KAAF,CAAlB;AACA;AACD,KApBF;AAqBC,IAAA,MAAM,EAAKK,KAAF,IAAa;AACrBT,MAAAA,aAAa,CAAE,uBAAcS,KAAK,CAACC,MAAN,CAAaC,KAA3B,CAAF,CAAb;;AACA,UAAKR,eAAL,EAAuB;AACtBC,QAAAA,kBAAkB,CAAE,KAAF,CAAlB;AACA;AACD;AA1BF,IADD,EA6BC,uCACG,cAAI,2BAAJ,CADH,EACwC,GADxC,EAEC,4BAAC,wBAAD;AACC,IAAA,IAAI,EAAG,cACN,mEADM;AADR,KAKG,cAAI,uBAAJ,CALH,CAFD,CA7BD,CANF,EA+CC;AAAI,IAAA,SAAS,EAAC;AAAd,KACGF,aAAa,IAAI,cAAI,WAAJ,CADpB,CA/CD,EAkDC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,wBAAD;AACC,IAAA,SAAS,EAAC,2BADX;AAEC,IAAA,IAAI,EAAGL,QAFR;AAGC,IAAA,MAAM,EAAC;AAHR,KAKGD,UAAU,GACX,qDACGS,aADH,EAEGC,eAFH,EAGGC,aAHH,CADW,GAOXV,QAZF,CADD,CAlDD,CADD;AAsEA;;eAEc,sBAAS,CACvB,sBAAce,MAAF,IAAc;AACzB,QAAM;AACLC,IAAAA,mBADK;AAELC,IAAAA,cAFK;AAGLC,IAAAA,sBAHK;AAILC,IAAAA,iBAJK;AAKLC,IAAAA,sBALK;AAMLC,IAAAA;AANK,MAOFN,MAAM,CAAEO,aAAF,CAPV;AAQA,QAAM;AAAEC,IAAAA,oBAAF;AAAwBC,IAAAA;AAAxB,MACLT,MAAM,CAAEU,YAAF,CADP;AAEA,QAAM;AAAEC,IAAAA;AAAF,MAAkBX,MAAM,CAAEY,eAAF,CAA9B;AAEA,QAAM;AAAEC,IAAAA;AAAF,MAAWX,cAAc,EAA/B;AAEA,QAAMY,YAAY,GAAGT,sBAAsB,CAAE,MAAF,CAA3C;AACA,QAAMU,QAAQ,GAAGJ,WAAW,CAAEG,YAAF,CAA5B;AACA,QAAME,cAAc,GAAGZ,iBAAiB,EAAxC;AAEA,SAAO;AACNnB,IAAAA,QAAQ,EAAE4B,IADJ;AAEN7B,IAAAA,UAAU,EAAEiB,mBAAmB,EAFzB;AAGNgB,IAAAA,WAAW,EAAEd,sBAAsB,EAH7B;AAINrB,IAAAA,QAAQ,EAAE2B,mBAAmB,CAAE7B,UAAF,CAJvB;AAKNsC,IAAAA,SAAS,EAAEV,oBAAoB,CAAE5B,UAAF,CALzB;AAMNuC,IAAAA,UAAU,EAAE,iBAAKJ,QAAL,EAAe,CAAE,UAAF,CAAf,EAA+B,KAA/B,CANN;AAON1B,IAAAA,QAAQ,EAAE,iCAAwBiB,iBAAiB,EAAzC,CAPJ;AAQNhB,IAAAA,aAAa,EAAE,iBAAKyB,QAAL,EAAe,CAAE,QAAF,EAAY,WAAZ,CAAf,CART;AASNK,IAAAA,iBAAiB,EAAE,CAAC,CAAEJ,cAThB;AAUN9B,IAAAA,eAAe,EAAE8B,cAAF,aAAEA,cAAF,uBAAEA,cAAc,CAAEK,MAV3B;AAWNlC,IAAAA,eAAe,EAAE6B,cAAF,aAAEA,cAAF,uBAAEA,cAAc,CAAEM;AAX3B,GAAP;AAaA,CAhCD,CADuB,EAkCvB,0BAAa,SAA8D;AAAA,MAA5D;AAAEJ,IAAAA,SAAF;AAAajC,IAAAA,QAAb;AAAuBkC,IAAAA,UAAvB;AAAmCC,IAAAA;AAAnC,GAA4D;AAC1E,SAAOF,SAAS,IAAIjC,QAAb,IAAyBkC,UAAzB,IAAuCC,iBAA9C;AACA,CAFD,CAlCuB,EAqCvB,wBAAgBG,QAAF,IAAgB;AAC7B,QAAM;AAAEC,IAAAA;AAAF,MAA8BD,QAAQ,CAAEb,YAAF,CAA5C;AACA,QAAM;AAAEe,IAAAA;AAAF,MAAeF,QAAQ,CAAEhB,aAAF,CAA7B;AACA,SAAO;AACNxB,IAAAA,aAAa,EAAE,MAAMyC,uBAAuB,CAAE5C,UAAF,CADtC;AAENQ,IAAAA,aAAa,EAAIsC,OAAF,IAAe;AAC7BD,MAAAA,QAAQ,CAAE;AAAEE,QAAAA,IAAI,EAAED;AAAR,OAAF,CAAR;AACA;AAJK,GAAP;AAMA,CATD,CArCuB,CAAT,EA+CV7C,QA/CU,C","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { PanelBody, TextControl, ExternalLink } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose, ifCondition } from '@wordpress/compose';\nimport { store as editorStore } from '@wordpress/editor';\nimport { safeDecodeURIComponent, cleanForSlug } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\n/**\n * Module Constants\n */\nconst PANEL_NAME = 'post-link';\n\nfunction PostLink( {\n\tisOpened,\n\tonTogglePanel,\n\tisEditable,\n\tpostLink,\n\tpermalinkPrefix,\n\tpermalinkSuffix,\n\teditPermalink,\n\tpostSlug,\n\tpostTypeLabel,\n} ) {\n\tconst [ forceEmptyField, setForceEmptyField ] = useState( false );\n\n\tlet prefixElement, postNameElement, suffixElement;\n\tif ( isEditable ) {\n\t\tprefixElement = permalinkPrefix && (\n\t\t\t<span className=\"edit-post-post-link__link-prefix\">\n\t\t\t\t{ permalinkPrefix }\n\t\t\t</span>\n\t\t);\n\t\tpostNameElement = postSlug && (\n\t\t\t<span className=\"edit-post-post-link__link-post-name\">\n\t\t\t\t{ postSlug }\n\t\t\t</span>\n\t\t);\n\t\tsuffixElement = permalinkSuffix && (\n\t\t\t<span className=\"edit-post-post-link__link-suffix\">\n\t\t\t\t{ permalinkSuffix }\n\t\t\t</span>\n\t\t);\n\t}\n\n\treturn (\n\t\t<PanelBody\n\t\t\ttitle={ __( 'Permalink' ) }\n\t\t\topened={ isOpened }\n\t\t\tonToggle={ onTogglePanel }\n\t\t>\n\t\t\t{ isEditable && (\n\t\t\t\t<div className=\"editor-post-link\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'URL Slug' ) }\n\t\t\t\t\t\tvalue={ forceEmptyField ? '' : postSlug }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\tspellCheck=\"false\"\n\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\teditPermalink( newValue );\n\t\t\t\t\t\t\t// When we delete the field the permalink gets\n\t\t\t\t\t\t\t// reverted to the original value.\n\t\t\t\t\t\t\t// The forceEmptyField logic allows the user to have\n\t\t\t\t\t\t\t// the field temporarily empty while typing.\n\t\t\t\t\t\t\tif ( ! newValue ) {\n\t\t\t\t\t\t\t\tif ( ! forceEmptyField ) {\n\t\t\t\t\t\t\t\t\tsetForceEmptyField( true );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif ( forceEmptyField ) {\n\t\t\t\t\t\t\t\tsetForceEmptyField( false );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonBlur={ ( event ) => {\n\t\t\t\t\t\t\teditPermalink( cleanForSlug( event.target.value ) );\n\t\t\t\t\t\t\tif ( forceEmptyField ) {\n\t\t\t\t\t\t\t\tsetForceEmptyField( false );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ __( 'The last part of the URL.' ) }{ ' ' }\n\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t'https://wordpress.org/support/article/settings-sidebar/#permalink'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Read about permalinks' ) }\n\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<h3 className=\"edit-post-post-link__preview-label\">\n\t\t\t\t{ postTypeLabel || __( 'View post' ) }\n\t\t\t</h3>\n\t\t\t<div className=\"edit-post-post-link__preview-link-container\">\n\t\t\t\t<ExternalLink\n\t\t\t\t\tclassName=\"edit-post-post-link__link\"\n\t\t\t\t\thref={ postLink }\n\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t>\n\t\t\t\t\t{ isEditable ? (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ prefixElement }\n\t\t\t\t\t\t\t{ postNameElement }\n\t\t\t\t\t\t\t{ suffixElement }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) : (\n\t\t\t\t\t\tpostLink\n\t\t\t\t\t) }\n\t\t\t\t</ExternalLink>\n\t\t\t</div>\n\t\t</PanelBody>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\tisPermalinkEditable,\n\t\t\tgetCurrentPost,\n\t\t\tisCurrentPostPublished,\n\t\t\tgetPermalinkParts,\n\t\t\tgetEditedPostAttribute,\n\t\t\tgetEditedPostSlug,\n\t\t} = select( editorStore );\n\t\tconst { isEditorPanelEnabled, isEditorPanelOpened } =\n\t\t\tselect( editPostStore );\n\t\tconst { getPostType } = select( coreStore );\n\n\t\tconst { link } = getCurrentPost();\n\n\t\tconst postTypeName = getEditedPostAttribute( 'type' );\n\t\tconst postType = getPostType( postTypeName );\n\t\tconst permalinkParts = getPermalinkParts();\n\n\t\treturn {\n\t\t\tpostLink: link,\n\t\t\tisEditable: isPermalinkEditable(),\n\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\tisOpened: isEditorPanelOpened( PANEL_NAME ),\n\t\t\tisEnabled: isEditorPanelEnabled( PANEL_NAME ),\n\t\t\tisViewable: get( postType, [ 'viewable' ], false ),\n\t\t\tpostSlug: safeDecodeURIComponent( getEditedPostSlug() ),\n\t\t\tpostTypeLabel: get( postType, [ 'labels', 'view_item' ] ),\n\t\t\thasPermalinkParts: !! permalinkParts,\n\t\t\tpermalinkPrefix: permalinkParts?.prefix,\n\t\t\tpermalinkSuffix: permalinkParts?.suffix,\n\t\t};\n\t} ),\n\tifCondition( ( { isEnabled, postLink, isViewable, hasPermalinkParts } ) => {\n\t\treturn isEnabled && postLink && isViewable && hasPermalinkParts;\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { toggleEditorPanelOpened } = dispatch( editPostStore );\n\t\tconst { editPost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonTogglePanel: () => toggleEditorPanelOpened( PANEL_NAME ),\n\t\t\teditPermalink: ( newSlug ) => {\n\t\t\t\teditPost( { slug: newSlug } );\n\t\t\t},\n\t\t};\n\t} ),\n] )( PostLink );\n"]}
|