@wordpress/edit-post 7.33.0 → 7.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -2
- package/README.md +22 -36
- package/build/components/header/fullscreen-mode-close/index.js +2 -2
- package/build/components/header/fullscreen-mode-close/index.js.map +1 -1
- package/build/components/header/index.js +7 -127
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/more-menu/index.js +17 -43
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/components/header/more-menu/manage-patterns-menu-item.js +40 -0
- package/build/components/header/more-menu/manage-patterns-menu-item.js.map +1 -0
- package/build/{plugins/welcome-guide-menu-item/index.js → components/header/more-menu/welcome-guide-menu-item.js} +1 -1
- package/build/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
- package/build/components/keyboard-shortcuts/index.js +0 -88
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/index.js +72 -33
- package/build/components/layout/index.js.map +1 -1
- package/build/components/meta-boxes/meta-boxes-area/index.js +2 -2
- package/build/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +2 -11
- package/build/components/preferences-modal/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/components/visual-editor/use-padding-appender.js +6 -1
- package/build/components/visual-editor/use-padding-appender.js.map +1 -1
- package/build/deprecated.js +132 -0
- package/build/deprecated.js.map +1 -0
- package/build/index.js +19 -58
- package/build/index.js.map +1 -1
- package/build-module/components/header/fullscreen-mode-close/index.js +2 -2
- package/build-module/components/header/fullscreen-mode-close/index.js.map +1 -1
- package/build-module/components/header/index.js +11 -131
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/more-menu/index.js +17 -43
- package/build-module/components/header/more-menu/index.js.map +1 -1
- package/build-module/components/header/more-menu/manage-patterns-menu-item.js +33 -0
- package/build-module/components/header/more-menu/manage-patterns-menu-item.js.map +1 -0
- package/build-module/{plugins/welcome-guide-menu-item/index.js → components/header/more-menu/welcome-guide-menu-item.js} +1 -1
- package/build-module/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
- package/build-module/components/keyboard-shortcuts/index.js +1 -89
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/index.js +73 -34
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/meta-boxes/meta-boxes-area/index.js +2 -2
- package/build-module/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +3 -12
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/visual-editor/index.js +11 -5
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/components/visual-editor/use-padding-appender.js +6 -1
- package/build-module/components/visual-editor/use-padding-appender.js.map +1 -1
- package/build-module/deprecated.js +116 -0
- package/build-module/deprecated.js.map +1 -0
- package/build-module/index.js +2 -15
- package/build-module/index.js.map +1 -1
- package/build-style/style-rtl.css +14 -409
- package/build-style/style.css +14 -409
- package/package.json +32 -32
- package/src/components/header/fullscreen-mode-close/index.js +2 -2
- package/src/components/header/index.js +11 -159
- package/src/components/header/more-menu/index.js +27 -42
- package/src/components/header/more-menu/manage-patterns-menu-item.js +33 -0
- package/src/components/header/style.scss +4 -320
- package/src/components/keyboard-shortcuts/index.js +1 -106
- package/src/components/layout/index.js +84 -25
- package/src/components/layout/style.scss +7 -80
- package/src/components/meta-boxes/meta-boxes-area/index.js +4 -8
- package/src/components/preferences-modal/index.js +2 -22
- package/src/components/visual-editor/index.js +11 -4
- package/src/components/visual-editor/use-padding-appender.js +7 -1
- package/src/deprecated.js +107 -0
- package/src/index.js +3 -24
- package/src/style.scss +1 -5
- package/build/components/header/post-publish-button-or-toggle.js +0 -94
- package/build/components/header/post-publish-button-or-toggle.js.map +0 -1
- package/build/components/header/preferences-menu-item/index.js +0 -39
- package/build/components/header/preferences-menu-item/index.js.map +0 -1
- package/build/components/header/tools-more-menu-group/index.js +0 -26
- package/build/components/header/tools-more-menu-group/index.js.map +0 -1
- package/build/components/header/writing-menu/index.js +0 -71
- package/build/components/header/writing-menu/index.js.map +0 -1
- package/build/components/layout/actions-panel.js +0 -86
- package/build/components/layout/actions-panel.js.map +0 -1
- package/build/components/preferences-modal/enable-publish-sidebar.js +0 -38
- package/build/components/preferences-modal/enable-publish-sidebar.js.map +0 -1
- package/build/components/sidebar/plugin-post-publish-panel/index.js +0 -39
- package/build/components/sidebar/plugin-post-publish-panel/index.js.map +0 -1
- package/build/components/sidebar/plugin-pre-publish-panel/index.js +0 -43
- package/build/components/sidebar/plugin-pre-publish-panel/index.js.map +0 -1
- package/build/components/sidebar/post-format/index.js +0 -21
- package/build/components/sidebar/post-format/index.js.map +0 -1
- package/build/components/sidebar/post-pending-status/index.js +0 -26
- package/build/components/sidebar/post-pending-status/index.js.map +0 -1
- package/build/components/sidebar/post-slug/index.js +0 -21
- package/build/components/sidebar/post-slug/index.js.map +0 -1
- package/build/components/sidebar/post-status/index.js +0 -69
- package/build/components/sidebar/post-status/index.js.map +0 -1
- package/build/components/sidebar/post-sticky/index.js +0 -26
- package/build/components/sidebar/post-sticky/index.js.map +0 -1
- package/build/components/sidebar/post-trash/index.js +0 -16
- package/build/components/sidebar/post-trash/index.js.map +0 -1
- package/build/components/sidebar/post-visibility/index.js +0 -78
- package/build/components/sidebar/post-visibility/index.js.map +0 -1
- package/build/components/sidebar/settings-header/index.js +0 -53
- package/build/components/sidebar/settings-header/index.js.map +0 -1
- package/build/components/sidebar/settings-sidebar/index.js +0 -163
- package/build/components/sidebar/settings-sidebar/index.js.map +0 -1
- package/build/plugins/copy-content-menu-item/index.js +0 -39
- package/build/plugins/copy-content-menu-item/index.js.map +0 -1
- package/build/plugins/index.js +0 -69
- package/build/plugins/index.js.map +0 -1
- package/build/plugins/keyboard-shortcuts-help-menu-item/index.js +0 -44
- package/build/plugins/keyboard-shortcuts-help-menu-item/index.js.map +0 -1
- package/build/plugins/welcome-guide-menu-item/index.js.map +0 -1
- package/build-module/components/header/post-publish-button-or-toggle.js +0 -86
- package/build-module/components/header/post-publish-button-or-toggle.js.map +0 -1
- package/build-module/components/header/preferences-menu-item/index.js +0 -32
- package/build-module/components/header/preferences-menu-item/index.js.map +0 -1
- package/build-module/components/header/tools-more-menu-group/index.js +0 -19
- package/build-module/components/header/tools-more-menu-group/index.js.map +0 -1
- package/build-module/components/header/writing-menu/index.js +0 -64
- package/build-module/components/header/writing-menu/index.js.map +0 -1
- package/build-module/components/layout/actions-panel.js +0 -78
- package/build-module/components/layout/actions-panel.js.map +0 -1
- package/build-module/components/preferences-modal/enable-publish-sidebar.js +0 -31
- package/build-module/components/preferences-modal/enable-publish-sidebar.js.map +0 -1
- package/build-module/components/sidebar/plugin-post-publish-panel/index.js +0 -32
- package/build-module/components/sidebar/plugin-post-publish-panel/index.js.map +0 -1
- package/build-module/components/sidebar/plugin-pre-publish-panel/index.js +0 -36
- package/build-module/components/sidebar/plugin-pre-publish-panel/index.js.map +0 -1
- package/build-module/components/sidebar/post-format/index.js +0 -13
- package/build-module/components/sidebar/post-format/index.js.map +0 -1
- package/build-module/components/sidebar/post-pending-status/index.js +0 -18
- package/build-module/components/sidebar/post-pending-status/index.js.map +0 -1
- package/build-module/components/sidebar/post-slug/index.js +0 -13
- package/build-module/components/sidebar/post-slug/index.js.map +0 -1
- package/build-module/components/sidebar/post-status/index.js +0 -61
- package/build-module/components/sidebar/post-status/index.js.map +0 -1
- package/build-module/components/sidebar/post-sticky/index.js +0 -18
- package/build-module/components/sidebar/post-sticky/index.js.map +0 -1
- package/build-module/components/sidebar/post-trash/index.js +0 -9
- package/build-module/components/sidebar/post-trash/index.js.map +0 -1
- package/build-module/components/sidebar/post-visibility/index.js +0 -70
- package/build-module/components/sidebar/post-visibility/index.js.map +0 -1
- package/build-module/components/sidebar/settings-header/index.js +0 -46
- package/build-module/components/sidebar/settings-header/index.js.map +0 -1
- package/build-module/components/sidebar/settings-sidebar/index.js +0 -155
- package/build-module/components/sidebar/settings-sidebar/index.js.map +0 -1
- package/build-module/plugins/copy-content-menu-item/index.js +0 -32
- package/build-module/plugins/copy-content-menu-item/index.js.map +0 -1
- package/build-module/plugins/index.js +0 -65
- package/build-module/plugins/index.js.map +0 -1
- package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js +0 -36
- package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js.map +0 -1
- package/build-module/plugins/welcome-guide-menu-item/index.js.map +0 -1
- package/src/components/header/post-publish-button-or-toggle.js +0 -97
- package/src/components/header/preferences-menu-item/index.js +0 -31
- package/src/components/header/test/index.js +0 -63
- package/src/components/header/tools-more-menu-group/index.js +0 -20
- package/src/components/header/writing-menu/index.js +0 -73
- package/src/components/layout/actions-panel.js +0 -103
- package/src/components/preferences-modal/enable-publish-sidebar.js +0 -32
- package/src/components/preferences-modal/test/index.js +0 -28
- package/src/components/sidebar/plugin-post-publish-panel/index.js +0 -28
- package/src/components/sidebar/plugin-pre-publish-panel/index.js +0 -32
- package/src/components/sidebar/post-format/index.js +0 -20
- package/src/components/sidebar/post-format/style.scss +0 -5
- package/src/components/sidebar/post-pending-status/index.js +0 -27
- package/src/components/sidebar/post-slug/index.js +0 -17
- package/src/components/sidebar/post-slug/style.scss +0 -5
- package/src/components/sidebar/post-status/index.js +0 -88
- package/src/components/sidebar/post-sticky/index.js +0 -27
- package/src/components/sidebar/post-trash/index.js +0 -12
- package/src/components/sidebar/post-visibility/index.js +0 -88
- package/src/components/sidebar/post-visibility/style.scss +0 -5
- package/src/components/sidebar/settings-header/index.js +0 -49
- package/src/components/sidebar/settings-sidebar/index.js +0 -211
- package/src/components/sidebar/style.scss +0 -18
- package/src/plugins/copy-content-menu-item/index.js +0 -29
- package/src/plugins/index.js +0 -85
- package/src/plugins/keyboard-shortcuts-help-menu-item/index.js +0 -36
- /package/src/{plugins/welcome-guide-menu-item/index.js → components/header/more-menu/welcome-guide-menu-item.js} +0 -0
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
PostPendingStatus as PostPendingStatusForm,
|
|
6
|
-
PostPendingStatusCheck,
|
|
7
|
-
privateApis as editorPrivateApis,
|
|
8
|
-
} from '@wordpress/editor';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Internal dependencies
|
|
12
|
-
*/
|
|
13
|
-
import { unlock } from '../../../lock-unlock';
|
|
14
|
-
|
|
15
|
-
const { PostPanelRow } = unlock( editorPrivateApis );
|
|
16
|
-
|
|
17
|
-
export function PostPendingStatus() {
|
|
18
|
-
return (
|
|
19
|
-
<PostPendingStatusCheck>
|
|
20
|
-
<PostPanelRow>
|
|
21
|
-
<PostPendingStatusForm />
|
|
22
|
-
</PostPanelRow>
|
|
23
|
-
</PostPendingStatusCheck>
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export default PostPendingStatus;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { PanelRow } from '@wordpress/components';
|
|
5
|
-
import { PostSlug as PostSlugForm, PostSlugCheck } from '@wordpress/editor';
|
|
6
|
-
|
|
7
|
-
export function PostSlug() {
|
|
8
|
-
return (
|
|
9
|
-
<PostSlugCheck>
|
|
10
|
-
<PanelRow className="edit-post-post-slug">
|
|
11
|
-
<PostSlugForm />
|
|
12
|
-
</PanelRow>
|
|
13
|
-
</PostSlugCheck>
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export default PostSlug;
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import {
|
|
6
|
-
__experimentalHStack as HStack,
|
|
7
|
-
PanelBody,
|
|
8
|
-
} from '@wordpress/components';
|
|
9
|
-
import { useDispatch, useSelect } from '@wordpress/data';
|
|
10
|
-
import {
|
|
11
|
-
PluginPostStatusInfo,
|
|
12
|
-
PostAuthorPanel,
|
|
13
|
-
PostSchedulePanel,
|
|
14
|
-
PostSyncStatus,
|
|
15
|
-
PostURLPanel,
|
|
16
|
-
PostTemplatePanel,
|
|
17
|
-
PostFeaturedImagePanel,
|
|
18
|
-
store as editorStore,
|
|
19
|
-
privateApis as editorPrivateApis,
|
|
20
|
-
} from '@wordpress/editor';
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Internal dependencies
|
|
24
|
-
*/
|
|
25
|
-
import PostTrash from '../post-trash';
|
|
26
|
-
import PostSticky from '../post-sticky';
|
|
27
|
-
import PostSlug from '../post-slug';
|
|
28
|
-
import PostFormat from '../post-format';
|
|
29
|
-
import { unlock } from '../../../lock-unlock';
|
|
30
|
-
|
|
31
|
-
const { PostStatus: PostStatusPanel } = unlock( editorPrivateApis );
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Module Constants
|
|
35
|
-
*/
|
|
36
|
-
const PANEL_NAME = 'post-status';
|
|
37
|
-
|
|
38
|
-
export default function PostStatus() {
|
|
39
|
-
const { isOpened, isRemoved } = useSelect( ( select ) => {
|
|
40
|
-
// We use isEditorPanelRemoved to hide the panel if it was programatically removed. We do
|
|
41
|
-
// not use isEditorPanelEnabled since this panel should not be disabled through the UI.
|
|
42
|
-
const { isEditorPanelRemoved, isEditorPanelOpened } =
|
|
43
|
-
select( editorStore );
|
|
44
|
-
return {
|
|
45
|
-
isRemoved: isEditorPanelRemoved( PANEL_NAME ),
|
|
46
|
-
isOpened: isEditorPanelOpened( PANEL_NAME ),
|
|
47
|
-
};
|
|
48
|
-
}, [] );
|
|
49
|
-
const { toggleEditorPanelOpened } = useDispatch( editorStore );
|
|
50
|
-
|
|
51
|
-
if ( isRemoved ) {
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return (
|
|
56
|
-
<PanelBody
|
|
57
|
-
className="edit-post-post-status"
|
|
58
|
-
title={ __( 'Summary' ) }
|
|
59
|
-
opened={ isOpened }
|
|
60
|
-
onToggle={ () => toggleEditorPanelOpened( PANEL_NAME ) }
|
|
61
|
-
>
|
|
62
|
-
<PluginPostStatusInfo.Slot>
|
|
63
|
-
{ ( fills ) => (
|
|
64
|
-
<>
|
|
65
|
-
<PostStatusPanel />
|
|
66
|
-
<PostFeaturedImagePanel withPanelBody={ false } />
|
|
67
|
-
<PostSchedulePanel />
|
|
68
|
-
<PostTemplatePanel />
|
|
69
|
-
<PostURLPanel />
|
|
70
|
-
<PostSyncStatus />
|
|
71
|
-
<PostSticky />
|
|
72
|
-
<PostFormat />
|
|
73
|
-
<PostSlug />
|
|
74
|
-
<PostAuthorPanel />
|
|
75
|
-
{ fills }
|
|
76
|
-
<HStack
|
|
77
|
-
style={ {
|
|
78
|
-
marginTop: '16px',
|
|
79
|
-
} }
|
|
80
|
-
>
|
|
81
|
-
<PostTrash />
|
|
82
|
-
</HStack>
|
|
83
|
-
</>
|
|
84
|
-
) }
|
|
85
|
-
</PluginPostStatusInfo.Slot>
|
|
86
|
-
</PanelBody>
|
|
87
|
-
);
|
|
88
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
PostSticky as PostStickyForm,
|
|
6
|
-
PostStickyCheck,
|
|
7
|
-
privateApis as editorPrivateApis,
|
|
8
|
-
} from '@wordpress/editor';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Internal dependencies
|
|
12
|
-
*/
|
|
13
|
-
import { unlock } from '../../../lock-unlock';
|
|
14
|
-
|
|
15
|
-
const { PostPanelRow } = unlock( editorPrivateApis );
|
|
16
|
-
|
|
17
|
-
export function PostSticky() {
|
|
18
|
-
return (
|
|
19
|
-
<PostStickyCheck>
|
|
20
|
-
<PostPanelRow>
|
|
21
|
-
<PostStickyForm />
|
|
22
|
-
</PostPanelRow>
|
|
23
|
-
</PostStickyCheck>
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export default PostSticky;
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
5
|
-
import { Dropdown, Button } from '@wordpress/components';
|
|
6
|
-
import {
|
|
7
|
-
PostVisibility as PostVisibilityForm,
|
|
8
|
-
PostVisibilityLabel,
|
|
9
|
-
PostVisibilityCheck,
|
|
10
|
-
usePostVisibilityLabel,
|
|
11
|
-
privateApis as editorPrivateApis,
|
|
12
|
-
} from '@wordpress/editor';
|
|
13
|
-
import { useMemo, useState } from '@wordpress/element';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Internal dependencies
|
|
17
|
-
*/
|
|
18
|
-
import { unlock } from '../../../lock-unlock';
|
|
19
|
-
|
|
20
|
-
const { PostPanelRow } = unlock( editorPrivateApis );
|
|
21
|
-
|
|
22
|
-
export function PostVisibility() {
|
|
23
|
-
// Use internal state instead of a ref to make sure that the component
|
|
24
|
-
// re-renders when the popover's anchor updates.
|
|
25
|
-
const [ popoverAnchor, setPopoverAnchor ] = useState( null );
|
|
26
|
-
// Memoize popoverProps to avoid returning a new object every time.
|
|
27
|
-
const popoverProps = useMemo(
|
|
28
|
-
() => ( {
|
|
29
|
-
// Anchor the popover to the middle of the entire row so that it doesn't
|
|
30
|
-
// move around when the label changes.
|
|
31
|
-
anchor: popoverAnchor,
|
|
32
|
-
placement: 'bottom-end',
|
|
33
|
-
} ),
|
|
34
|
-
[ popoverAnchor ]
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<PostVisibilityCheck
|
|
39
|
-
render={ ( { canEdit } ) => (
|
|
40
|
-
<PostPanelRow
|
|
41
|
-
label={ __( 'Visibility' ) }
|
|
42
|
-
ref={ setPopoverAnchor }
|
|
43
|
-
>
|
|
44
|
-
{ ! canEdit && (
|
|
45
|
-
<span>
|
|
46
|
-
<PostVisibilityLabel />
|
|
47
|
-
</span>
|
|
48
|
-
) }
|
|
49
|
-
{ canEdit && (
|
|
50
|
-
<Dropdown
|
|
51
|
-
contentClassName="edit-post-post-visibility__dialog"
|
|
52
|
-
popoverProps={ popoverProps }
|
|
53
|
-
focusOnMount
|
|
54
|
-
renderToggle={ ( { isOpen, onToggle } ) => (
|
|
55
|
-
<PostVisibilityToggle
|
|
56
|
-
isOpen={ isOpen }
|
|
57
|
-
onClick={ onToggle }
|
|
58
|
-
/>
|
|
59
|
-
) }
|
|
60
|
-
renderContent={ ( { onClose } ) => (
|
|
61
|
-
<PostVisibilityForm onClose={ onClose } />
|
|
62
|
-
) }
|
|
63
|
-
/>
|
|
64
|
-
) }
|
|
65
|
-
</PostPanelRow>
|
|
66
|
-
) }
|
|
67
|
-
/>
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function PostVisibilityToggle( { isOpen, onClick } ) {
|
|
72
|
-
const label = usePostVisibilityLabel();
|
|
73
|
-
return (
|
|
74
|
-
<Button
|
|
75
|
-
__next40pxDefaultSize
|
|
76
|
-
className="edit-post-post-visibility__toggle"
|
|
77
|
-
variant="tertiary"
|
|
78
|
-
aria-expanded={ isOpen }
|
|
79
|
-
// translators: %s: Current post visibility.
|
|
80
|
-
aria-label={ sprintf( __( 'Select visibility: %s' ), label ) }
|
|
81
|
-
onClick={ onClick }
|
|
82
|
-
>
|
|
83
|
-
{ label }
|
|
84
|
-
</Button>
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export default PostVisibility;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { privateApis as componentsPrivateApis } from '@wordpress/components';
|
|
5
|
-
import { __, _x } from '@wordpress/i18n';
|
|
6
|
-
import { useSelect } from '@wordpress/data';
|
|
7
|
-
import { forwardRef } from '@wordpress/element';
|
|
8
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Internal dependencies
|
|
12
|
-
*/
|
|
13
|
-
import { unlock } from '../../../lock-unlock';
|
|
14
|
-
import { sidebars } from '../settings-sidebar';
|
|
15
|
-
|
|
16
|
-
const { Tabs } = unlock( componentsPrivateApis );
|
|
17
|
-
|
|
18
|
-
const SettingsHeader = ( _, ref ) => {
|
|
19
|
-
const { documentLabel } = useSelect( ( select ) => {
|
|
20
|
-
const { getPostTypeLabel } = select( editorStore );
|
|
21
|
-
|
|
22
|
-
return {
|
|
23
|
-
// translators: Default label for the Document sidebar tab, not selected.
|
|
24
|
-
documentLabel: getPostTypeLabel() || _x( 'Document', 'noun' ),
|
|
25
|
-
};
|
|
26
|
-
}, [] );
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<Tabs.TabList ref={ ref }>
|
|
30
|
-
<Tabs.Tab
|
|
31
|
-
tabId={ sidebars.document }
|
|
32
|
-
// Used for focus management in the SettingsSidebar component.
|
|
33
|
-
data-tab-id={ sidebars.document }
|
|
34
|
-
>
|
|
35
|
-
{ documentLabel }
|
|
36
|
-
</Tabs.Tab>
|
|
37
|
-
<Tabs.Tab
|
|
38
|
-
tabId={ sidebars.block }
|
|
39
|
-
// Used for focus management in the SettingsSidebar component.
|
|
40
|
-
data-tab-id={ sidebars.block }
|
|
41
|
-
>
|
|
42
|
-
{ /* translators: Text label for the Block Settings Sidebar tab. */ }
|
|
43
|
-
{ __( 'Block' ) }
|
|
44
|
-
</Tabs.Tab>
|
|
45
|
-
</Tabs.TabList>
|
|
46
|
-
);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export default forwardRef( SettingsHeader );
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
BlockInspector,
|
|
6
|
-
store as blockEditorStore,
|
|
7
|
-
} from '@wordpress/block-editor';
|
|
8
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
9
|
-
import {
|
|
10
|
-
Platform,
|
|
11
|
-
useCallback,
|
|
12
|
-
useContext,
|
|
13
|
-
useEffect,
|
|
14
|
-
useRef,
|
|
15
|
-
} from '@wordpress/element';
|
|
16
|
-
import { isRTL, __ } from '@wordpress/i18n';
|
|
17
|
-
import { drawerLeft, drawerRight } from '@wordpress/icons';
|
|
18
|
-
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
19
|
-
import {
|
|
20
|
-
store as editorStore,
|
|
21
|
-
PageAttributesPanel,
|
|
22
|
-
PluginDocumentSettingPanel,
|
|
23
|
-
PluginSidebar,
|
|
24
|
-
PostDiscussionPanel,
|
|
25
|
-
PostExcerptPanel,
|
|
26
|
-
PostLastRevisionPanel,
|
|
27
|
-
PostTaxonomiesPanel,
|
|
28
|
-
privateApis as editorPrivateApis,
|
|
29
|
-
} from '@wordpress/editor';
|
|
30
|
-
import { addQueryArgs } from '@wordpress/url';
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Internal dependencies
|
|
34
|
-
*/
|
|
35
|
-
import SettingsHeader from '../settings-header';
|
|
36
|
-
import PostStatus from '../post-status';
|
|
37
|
-
import MetaBoxes from '../../meta-boxes';
|
|
38
|
-
import { store as editPostStore } from '../../../store';
|
|
39
|
-
import { privateApis as componentsPrivateApis } from '@wordpress/components';
|
|
40
|
-
import { unlock } from '../../../lock-unlock';
|
|
41
|
-
|
|
42
|
-
const { PostCardPanel, PostActions, interfaceStore } =
|
|
43
|
-
unlock( editorPrivateApis );
|
|
44
|
-
const { Tabs } = unlock( componentsPrivateApis );
|
|
45
|
-
const { PatternOverridesPanel, useAutoSwitchEditorSidebars } =
|
|
46
|
-
unlock( editorPrivateApis );
|
|
47
|
-
|
|
48
|
-
const SIDEBAR_ACTIVE_BY_DEFAULT = Platform.select( {
|
|
49
|
-
web: true,
|
|
50
|
-
native: false,
|
|
51
|
-
} );
|
|
52
|
-
export const sidebars = {
|
|
53
|
-
document: 'edit-post/document',
|
|
54
|
-
block: 'edit-post/block',
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
function onActionPerformed( actionId, items ) {
|
|
58
|
-
if ( actionId === 'move-to-trash' ) {
|
|
59
|
-
const postType = items[ 0 ].type;
|
|
60
|
-
document.location.href = addQueryArgs( 'edit.php', {
|
|
61
|
-
post_type: postType,
|
|
62
|
-
} );
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const SidebarContent = ( { tabName, keyboardShortcut, isEditingTemplate } ) => {
|
|
67
|
-
const tabListRef = useRef( null );
|
|
68
|
-
// Because `PluginSidebar` renders a `ComplementaryArea`, we
|
|
69
|
-
// need to forward the `Tabs` context so it can be passed through the
|
|
70
|
-
// underlying slot/fill.
|
|
71
|
-
const tabsContextValue = useContext( Tabs.Context );
|
|
72
|
-
|
|
73
|
-
// This effect addresses a race condition caused by tabbing from the last
|
|
74
|
-
// block in the editor into the settings sidebar. Without this effect, the
|
|
75
|
-
// selected tab and browser focus can become separated in an unexpected way
|
|
76
|
-
// (e.g the "block" tab is focused, but the "post" tab is selected).
|
|
77
|
-
useEffect( () => {
|
|
78
|
-
const tabsElements = Array.from(
|
|
79
|
-
tabListRef.current?.querySelectorAll( '[role="tab"]' ) || []
|
|
80
|
-
);
|
|
81
|
-
const selectedTabElement = tabsElements.find(
|
|
82
|
-
// We are purposefully using a custom `data-tab-id` attribute here
|
|
83
|
-
// because we don't want rely on any assumptions about `Tabs`
|
|
84
|
-
// component internals.
|
|
85
|
-
( element ) => element.getAttribute( 'data-tab-id' ) === tabName
|
|
86
|
-
);
|
|
87
|
-
const activeElement = selectedTabElement?.ownerDocument.activeElement;
|
|
88
|
-
const tabsHasFocus = tabsElements.some( ( element ) => {
|
|
89
|
-
return activeElement && activeElement.id === element.id;
|
|
90
|
-
} );
|
|
91
|
-
if (
|
|
92
|
-
tabsHasFocus &&
|
|
93
|
-
selectedTabElement &&
|
|
94
|
-
selectedTabElement.id !== activeElement?.id
|
|
95
|
-
) {
|
|
96
|
-
selectedTabElement?.focus();
|
|
97
|
-
}
|
|
98
|
-
}, [ tabName ] );
|
|
99
|
-
|
|
100
|
-
return (
|
|
101
|
-
<PluginSidebar
|
|
102
|
-
identifier={ tabName }
|
|
103
|
-
header={
|
|
104
|
-
<Tabs.Context.Provider value={ tabsContextValue }>
|
|
105
|
-
<SettingsHeader ref={ tabListRef } />
|
|
106
|
-
</Tabs.Context.Provider>
|
|
107
|
-
}
|
|
108
|
-
closeLabel={ __( 'Close Settings' ) }
|
|
109
|
-
// This classname is added so we can apply a corrective negative
|
|
110
|
-
// margin to the panel.
|
|
111
|
-
// see https://github.com/WordPress/gutenberg/pull/55360#pullrequestreview-1737671049
|
|
112
|
-
className="edit-post-sidebar__panel"
|
|
113
|
-
headerClassName="edit-post-sidebar__panel-tabs"
|
|
114
|
-
/* translators: button label text should, if possible, be under 16 characters. */
|
|
115
|
-
title={ __( 'Settings' ) }
|
|
116
|
-
toggleShortcut={ keyboardShortcut }
|
|
117
|
-
icon={ isRTL() ? drawerLeft : drawerRight }
|
|
118
|
-
isActiveByDefault={ SIDEBAR_ACTIVE_BY_DEFAULT }
|
|
119
|
-
>
|
|
120
|
-
<Tabs.Context.Provider value={ tabsContextValue }>
|
|
121
|
-
<Tabs.TabPanel tabId={ sidebars.document } focusable={ false }>
|
|
122
|
-
<PostCardPanel
|
|
123
|
-
actions={
|
|
124
|
-
<PostActions
|
|
125
|
-
onActionPerformed={ onActionPerformed }
|
|
126
|
-
/>
|
|
127
|
-
}
|
|
128
|
-
/>
|
|
129
|
-
{ ! isEditingTemplate && (
|
|
130
|
-
<>
|
|
131
|
-
<PostStatus />
|
|
132
|
-
<PluginDocumentSettingPanel.Slot />
|
|
133
|
-
<PostLastRevisionPanel />
|
|
134
|
-
<PostTaxonomiesPanel />
|
|
135
|
-
<PostExcerptPanel />
|
|
136
|
-
<PostDiscussionPanel />
|
|
137
|
-
<PageAttributesPanel />
|
|
138
|
-
<PatternOverridesPanel />
|
|
139
|
-
<MetaBoxes location="side" />
|
|
140
|
-
</>
|
|
141
|
-
) }
|
|
142
|
-
</Tabs.TabPanel>
|
|
143
|
-
<Tabs.TabPanel tabId={ sidebars.block } focusable={ false }>
|
|
144
|
-
<BlockInspector />
|
|
145
|
-
</Tabs.TabPanel>
|
|
146
|
-
</Tabs.Context.Provider>
|
|
147
|
-
</PluginSidebar>
|
|
148
|
-
);
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
const SettingsSidebar = () => {
|
|
152
|
-
useAutoSwitchEditorSidebars();
|
|
153
|
-
const { tabName, keyboardShortcut, isEditingTemplate } = useSelect(
|
|
154
|
-
( select ) => {
|
|
155
|
-
const shortcut = select(
|
|
156
|
-
keyboardShortcutsStore
|
|
157
|
-
).getShortcutRepresentation( 'core/editor/toggle-sidebar' );
|
|
158
|
-
|
|
159
|
-
const sidebar =
|
|
160
|
-
select( interfaceStore ).getActiveComplementaryArea( 'core' );
|
|
161
|
-
const _isEditorSidebarOpened = [
|
|
162
|
-
sidebars.block,
|
|
163
|
-
sidebars.document,
|
|
164
|
-
].includes( sidebar );
|
|
165
|
-
let _tabName = sidebar;
|
|
166
|
-
if ( ! _isEditorSidebarOpened ) {
|
|
167
|
-
_tabName = !! select(
|
|
168
|
-
blockEditorStore
|
|
169
|
-
).getBlockSelectionStart()
|
|
170
|
-
? sidebars.block
|
|
171
|
-
: sidebars.document;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
return {
|
|
175
|
-
tabName: _tabName,
|
|
176
|
-
keyboardShortcut: shortcut,
|
|
177
|
-
isEditingTemplate:
|
|
178
|
-
select( editorStore ).getCurrentPostType() ===
|
|
179
|
-
'wp_template',
|
|
180
|
-
};
|
|
181
|
-
},
|
|
182
|
-
[]
|
|
183
|
-
);
|
|
184
|
-
|
|
185
|
-
const { openGeneralSidebar } = useDispatch( editPostStore );
|
|
186
|
-
|
|
187
|
-
const onTabSelect = useCallback(
|
|
188
|
-
( newSelectedTabId ) => {
|
|
189
|
-
if ( !! newSelectedTabId ) {
|
|
190
|
-
openGeneralSidebar( newSelectedTabId );
|
|
191
|
-
}
|
|
192
|
-
},
|
|
193
|
-
[ openGeneralSidebar ]
|
|
194
|
-
);
|
|
195
|
-
|
|
196
|
-
return (
|
|
197
|
-
<Tabs
|
|
198
|
-
selectedTabId={ tabName }
|
|
199
|
-
onSelect={ onTabSelect }
|
|
200
|
-
selectOnMove={ false }
|
|
201
|
-
>
|
|
202
|
-
<SidebarContent
|
|
203
|
-
tabName={ tabName }
|
|
204
|
-
keyboardShortcut={ keyboardShortcut }
|
|
205
|
-
isEditingTemplate={ isEditingTemplate }
|
|
206
|
-
/>
|
|
207
|
-
</Tabs>
|
|
208
|
-
);
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
export default SettingsSidebar;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
.components-panel__header.edit-post-sidebar__panel-tabs {
|
|
2
|
-
padding-left: 0;
|
|
3
|
-
padding-right: $grid-unit-20;
|
|
4
|
-
|
|
5
|
-
.components-button.has-icon {
|
|
6
|
-
padding: 0;
|
|
7
|
-
min-width: $icon-size;
|
|
8
|
-
height: $icon-size;
|
|
9
|
-
|
|
10
|
-
@include break-medium() {
|
|
11
|
-
display: flex;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.edit-post-sidebar__panel {
|
|
17
|
-
margin-top: -1px;
|
|
18
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { MenuItem } from '@wordpress/components';
|
|
5
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
|
-
import { __ } from '@wordpress/i18n';
|
|
7
|
-
import { useCopyToClipboard } from '@wordpress/compose';
|
|
8
|
-
import { store as noticesStore } from '@wordpress/notices';
|
|
9
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
10
|
-
|
|
11
|
-
export default function CopyContentMenuItem() {
|
|
12
|
-
const { createNotice } = useDispatch( noticesStore );
|
|
13
|
-
const { getEditedPostAttribute } = useSelect( editorStore );
|
|
14
|
-
|
|
15
|
-
function getText() {
|
|
16
|
-
return getEditedPostAttribute( 'content' );
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function onSuccess() {
|
|
20
|
-
createNotice( 'info', __( 'All content copied.' ), {
|
|
21
|
-
isDismissible: true,
|
|
22
|
-
type: 'snackbar',
|
|
23
|
-
} );
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const ref = useCopyToClipboard( getText, onSuccess );
|
|
27
|
-
|
|
28
|
-
return <MenuItem ref={ ref }>{ __( 'Copy all blocks' ) }</MenuItem>;
|
|
29
|
-
}
|
package/src/plugins/index.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { MenuItem, VisuallyHidden } from '@wordpress/components';
|
|
5
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
6
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
7
|
-
import { useSelect } from '@wordpress/data';
|
|
8
|
-
import { external } from '@wordpress/icons';
|
|
9
|
-
import { __ } from '@wordpress/i18n';
|
|
10
|
-
import { registerPlugin } from '@wordpress/plugins';
|
|
11
|
-
import { addQueryArgs } from '@wordpress/url';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Internal dependencies
|
|
15
|
-
*/
|
|
16
|
-
import CopyContentMenuItem from './copy-content-menu-item';
|
|
17
|
-
import KeyboardShortcutsHelpMenuItem from './keyboard-shortcuts-help-menu-item';
|
|
18
|
-
import ToolsMoreMenuGroup from '../components/header/tools-more-menu-group';
|
|
19
|
-
import WelcomeGuideMenuItem from './welcome-guide-menu-item';
|
|
20
|
-
|
|
21
|
-
function ManagePatternsMenuItem() {
|
|
22
|
-
const url = useSelect( ( select ) => {
|
|
23
|
-
const { canUser } = select( coreStore );
|
|
24
|
-
const { getEditorSettings } = select( editorStore );
|
|
25
|
-
|
|
26
|
-
const isBlockTheme = getEditorSettings().__unstableIsBlockBasedTheme;
|
|
27
|
-
const defaultUrl = addQueryArgs( 'edit.php', {
|
|
28
|
-
post_type: 'wp_block',
|
|
29
|
-
} );
|
|
30
|
-
const patternsUrl = addQueryArgs( 'site-editor.php', {
|
|
31
|
-
path: '/patterns',
|
|
32
|
-
} );
|
|
33
|
-
|
|
34
|
-
// The site editor and templates both check whether the user has
|
|
35
|
-
// edit_theme_options capabilities. We can leverage that here and not
|
|
36
|
-
// display the manage patterns link if the user can't access it.
|
|
37
|
-
return canUser( 'read', 'templates' ) && isBlockTheme
|
|
38
|
-
? patternsUrl
|
|
39
|
-
: defaultUrl;
|
|
40
|
-
}, [] );
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<MenuItem role="menuitem" href={ url }>
|
|
44
|
-
{ __( 'Manage patterns' ) }
|
|
45
|
-
</MenuItem>
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
registerPlugin( 'edit-post', {
|
|
50
|
-
render() {
|
|
51
|
-
return (
|
|
52
|
-
<>
|
|
53
|
-
<ToolsMoreMenuGroup>
|
|
54
|
-
{ ( { onClose } ) => (
|
|
55
|
-
<>
|
|
56
|
-
<ManagePatternsMenuItem />
|
|
57
|
-
<KeyboardShortcutsHelpMenuItem
|
|
58
|
-
onSelect={ onClose }
|
|
59
|
-
/>
|
|
60
|
-
<WelcomeGuideMenuItem />
|
|
61
|
-
<CopyContentMenuItem />
|
|
62
|
-
<MenuItem
|
|
63
|
-
role="menuitem"
|
|
64
|
-
icon={ external }
|
|
65
|
-
href={ __(
|
|
66
|
-
'https://wordpress.org/documentation/article/wordpress-block-editor/'
|
|
67
|
-
) }
|
|
68
|
-
target="_blank"
|
|
69
|
-
rel="noopener noreferrer"
|
|
70
|
-
>
|
|
71
|
-
{ __( 'Help' ) }
|
|
72
|
-
<VisuallyHidden as="span">
|
|
73
|
-
{
|
|
74
|
-
/* translators: accessibility text */
|
|
75
|
-
__( '(opens in a new tab)' )
|
|
76
|
-
}
|
|
77
|
-
</VisuallyHidden>
|
|
78
|
-
</MenuItem>
|
|
79
|
-
</>
|
|
80
|
-
) }
|
|
81
|
-
</ToolsMoreMenuGroup>
|
|
82
|
-
</>
|
|
83
|
-
);
|
|
84
|
-
},
|
|
85
|
-
} );
|