@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
|
@@ -2,14 +2,12 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { useEffect } from '@wordpress/element';
|
|
5
|
-
import {
|
|
5
|
+
import { useDispatch } from '@wordpress/data';
|
|
6
6
|
import {
|
|
7
7
|
useShortcut,
|
|
8
8
|
store as keyboardShortcutsStore,
|
|
9
9
|
} from '@wordpress/keyboard-shortcuts';
|
|
10
10
|
import { __ } from '@wordpress/i18n';
|
|
11
|
-
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
12
|
-
import { createBlock } from '@wordpress/blocks';
|
|
13
11
|
|
|
14
12
|
/**
|
|
15
13
|
* Internal dependencies
|
|
@@ -19,37 +17,6 @@ import { store as editPostStore } from '../../store';
|
|
|
19
17
|
function KeyboardShortcuts() {
|
|
20
18
|
const { toggleFeature } = useDispatch( editPostStore );
|
|
21
19
|
const { registerShortcut } = useDispatch( keyboardShortcutsStore );
|
|
22
|
-
const { replaceBlocks } = useDispatch( blockEditorStore );
|
|
23
|
-
const { getBlockName, getSelectedBlockClientId, getBlockAttributes } =
|
|
24
|
-
useSelect( blockEditorStore );
|
|
25
|
-
|
|
26
|
-
const handleTextLevelShortcut = ( event, level ) => {
|
|
27
|
-
event.preventDefault();
|
|
28
|
-
const destinationBlockName =
|
|
29
|
-
level === 0 ? 'core/paragraph' : 'core/heading';
|
|
30
|
-
const currentClientId = getSelectedBlockClientId();
|
|
31
|
-
if ( currentClientId === null ) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
const blockName = getBlockName( currentClientId );
|
|
35
|
-
if ( blockName !== 'core/paragraph' && blockName !== 'core/heading' ) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
const attributes = getBlockAttributes( currentClientId );
|
|
39
|
-
const textAlign =
|
|
40
|
-
blockName === 'core/paragraph' ? 'align' : 'textAlign';
|
|
41
|
-
const destinationTextAlign =
|
|
42
|
-
destinationBlockName === 'core/paragraph' ? 'align' : 'textAlign';
|
|
43
|
-
|
|
44
|
-
replaceBlocks(
|
|
45
|
-
currentClientId,
|
|
46
|
-
createBlock( destinationBlockName, {
|
|
47
|
-
level,
|
|
48
|
-
content: attributes.content,
|
|
49
|
-
...{ [ destinationTextAlign ]: attributes[ textAlign ] },
|
|
50
|
-
} )
|
|
51
|
-
);
|
|
52
|
-
};
|
|
53
20
|
|
|
54
21
|
useEffect( () => {
|
|
55
22
|
registerShortcut( {
|
|
@@ -61,84 +28,12 @@ function KeyboardShortcuts() {
|
|
|
61
28
|
character: 'f',
|
|
62
29
|
},
|
|
63
30
|
} );
|
|
64
|
-
|
|
65
|
-
registerShortcut( {
|
|
66
|
-
name: 'core/edit-post/next-region',
|
|
67
|
-
category: 'global',
|
|
68
|
-
description: __( 'Navigate to the next part of the editor.' ),
|
|
69
|
-
keyCombination: {
|
|
70
|
-
modifier: 'ctrl',
|
|
71
|
-
character: '`',
|
|
72
|
-
},
|
|
73
|
-
aliases: [
|
|
74
|
-
{
|
|
75
|
-
modifier: 'access',
|
|
76
|
-
character: 'n',
|
|
77
|
-
},
|
|
78
|
-
],
|
|
79
|
-
} );
|
|
80
|
-
|
|
81
|
-
registerShortcut( {
|
|
82
|
-
name: 'core/edit-post/previous-region',
|
|
83
|
-
category: 'global',
|
|
84
|
-
description: __( 'Navigate to the previous part of the editor.' ),
|
|
85
|
-
keyCombination: {
|
|
86
|
-
modifier: 'ctrlShift',
|
|
87
|
-
character: '`',
|
|
88
|
-
},
|
|
89
|
-
aliases: [
|
|
90
|
-
{
|
|
91
|
-
modifier: 'access',
|
|
92
|
-
character: 'p',
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
modifier: 'ctrlShift',
|
|
96
|
-
character: '~',
|
|
97
|
-
},
|
|
98
|
-
],
|
|
99
|
-
} );
|
|
100
|
-
|
|
101
|
-
registerShortcut( {
|
|
102
|
-
name: 'core/edit-post/transform-heading-to-paragraph',
|
|
103
|
-
category: 'block-library',
|
|
104
|
-
description: __( 'Transform heading to paragraph.' ),
|
|
105
|
-
keyCombination: {
|
|
106
|
-
modifier: 'access',
|
|
107
|
-
character: `0`,
|
|
108
|
-
},
|
|
109
|
-
} );
|
|
110
|
-
|
|
111
|
-
[ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {
|
|
112
|
-
registerShortcut( {
|
|
113
|
-
name: `core/edit-post/transform-paragraph-to-heading-${ level }`,
|
|
114
|
-
category: 'block-library',
|
|
115
|
-
description: __( 'Transform paragraph to heading.' ),
|
|
116
|
-
keyCombination: {
|
|
117
|
-
modifier: 'access',
|
|
118
|
-
character: `${ level }`,
|
|
119
|
-
},
|
|
120
|
-
} );
|
|
121
|
-
} );
|
|
122
31
|
}, [] );
|
|
123
32
|
|
|
124
33
|
useShortcut( 'core/edit-post/toggle-fullscreen', () => {
|
|
125
34
|
toggleFeature( 'fullscreenMode' );
|
|
126
35
|
} );
|
|
127
36
|
|
|
128
|
-
useShortcut( 'core/edit-post/transform-heading-to-paragraph', ( event ) =>
|
|
129
|
-
handleTextLevelShortcut( event, 0 )
|
|
130
|
-
);
|
|
131
|
-
|
|
132
|
-
[ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {
|
|
133
|
-
//the loop is based off on a constant therefore
|
|
134
|
-
//the hook will execute the same way every time
|
|
135
|
-
//eslint-disable-next-line react-hooks/rules-of-hooks
|
|
136
|
-
useShortcut(
|
|
137
|
-
`core/edit-post/transform-paragraph-to-heading-${ level }`,
|
|
138
|
-
( event ) => handleTextLevelShortcut( event, level )
|
|
139
|
-
);
|
|
140
|
-
} );
|
|
141
|
-
|
|
142
37
|
return null;
|
|
143
38
|
}
|
|
144
39
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
4
|
+
import clsx from 'clsx';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -28,12 +28,14 @@ import { ScrollLock } from '@wordpress/components';
|
|
|
28
28
|
import { useViewportMatch } from '@wordpress/compose';
|
|
29
29
|
import { PluginArea } from '@wordpress/plugins';
|
|
30
30
|
import { __, _x, sprintf } from '@wordpress/i18n';
|
|
31
|
-
import { useState,
|
|
31
|
+
import { useState, useCallback, useMemo } from '@wordpress/element';
|
|
32
32
|
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
33
33
|
import { store as noticesStore } from '@wordpress/notices';
|
|
34
34
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
35
35
|
import { privateApis as commandsPrivateApis } from '@wordpress/commands';
|
|
36
36
|
import { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands';
|
|
37
|
+
import { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';
|
|
38
|
+
import { addQueryArgs } from '@wordpress/url';
|
|
37
39
|
|
|
38
40
|
/**
|
|
39
41
|
* Internal dependencies
|
|
@@ -41,14 +43,11 @@ import { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands
|
|
|
41
43
|
import TextEditor from '../text-editor';
|
|
42
44
|
import VisualEditor from '../visual-editor';
|
|
43
45
|
import EditPostKeyboardShortcuts from '../keyboard-shortcuts';
|
|
44
|
-
import EditPostPreferencesModal from '../preferences-modal';
|
|
45
46
|
import InitPatternModal from '../init-pattern-modal';
|
|
46
47
|
import BrowserURL from '../browser-url';
|
|
47
48
|
import Header from '../header';
|
|
48
|
-
import SettingsSidebar from '../sidebar/settings-sidebar';
|
|
49
49
|
import MetaBoxes from '../meta-boxes';
|
|
50
50
|
import WelcomeGuide from '../welcome-guide';
|
|
51
|
-
import ActionsPanel from './actions-panel';
|
|
52
51
|
import { store as editPostStore } from '../../store';
|
|
53
52
|
import { unlock } from '../../lock-unlock';
|
|
54
53
|
import useCommonCommands from '../../hooks/commands/use-common-commands';
|
|
@@ -61,9 +60,12 @@ const {
|
|
|
61
60
|
ListViewSidebar,
|
|
62
61
|
ComplementaryArea,
|
|
63
62
|
FullscreenMode,
|
|
63
|
+
SavePublishPanels,
|
|
64
64
|
InterfaceSkeleton,
|
|
65
65
|
interfaceStore,
|
|
66
|
+
Sidebar,
|
|
66
67
|
} = unlock( editorPrivateApis );
|
|
68
|
+
const { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );
|
|
67
69
|
|
|
68
70
|
const interfaceLabels = {
|
|
69
71
|
/* translators: accessibility text for the editor top bar landmark region. */
|
|
@@ -134,13 +136,11 @@ function Layout( { initialPost } ) {
|
|
|
134
136
|
useCommonCommands();
|
|
135
137
|
|
|
136
138
|
const isMobileViewport = useViewportMatch( 'medium', '<' );
|
|
137
|
-
const isHugeViewport = useViewportMatch( 'huge', '>=' );
|
|
138
139
|
const isWideViewport = useViewportMatch( 'large' );
|
|
139
140
|
const isLargeViewport = useViewportMatch( 'medium' );
|
|
140
141
|
|
|
141
142
|
const { closeGeneralSidebar } = useDispatch( editPostStore );
|
|
142
143
|
const { createErrorNotice } = useDispatch( noticesStore );
|
|
143
|
-
const { setIsInserterOpened } = useDispatch( editorStore );
|
|
144
144
|
const {
|
|
145
145
|
mode,
|
|
146
146
|
isFullscreenActive,
|
|
@@ -158,6 +158,9 @@ function Layout( { initialPost } ) {
|
|
|
158
158
|
showMetaBoxes,
|
|
159
159
|
documentLabel,
|
|
160
160
|
hasHistory,
|
|
161
|
+
hasBlockBreadcrumbs,
|
|
162
|
+
blockEditorMode,
|
|
163
|
+
isEditingTemplate,
|
|
161
164
|
} = useSelect( ( select ) => {
|
|
162
165
|
const { get } = select( preferencesStore );
|
|
163
166
|
const { getEditorSettings, getPostTypeLabel } = select( editorStore );
|
|
@@ -180,10 +183,10 @@ function Layout( { initialPost } ) {
|
|
|
180
183
|
hasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),
|
|
181
184
|
previousShortcut: select(
|
|
182
185
|
keyboardShortcutsStore
|
|
183
|
-
).getAllShortcutKeyCombinations( 'core/
|
|
186
|
+
).getAllShortcutKeyCombinations( 'core/editor/previous-region' ),
|
|
184
187
|
nextShortcut: select(
|
|
185
188
|
keyboardShortcutsStore
|
|
186
|
-
).getAllShortcutKeyCombinations( 'core/
|
|
189
|
+
).getAllShortcutKeyCombinations( 'core/editor/next-region' ),
|
|
187
190
|
showIconLabels: get( 'core', 'showIconLabels' ),
|
|
188
191
|
isDistractionFree: get( 'core', 'distractionFree' ),
|
|
189
192
|
showBlockBreadcrumbs: get( 'core', 'showBlockBreadcrumbs' ),
|
|
@@ -192,6 +195,11 @@ function Layout( { initialPost } ) {
|
|
|
192
195
|
hasBlockSelected:
|
|
193
196
|
!! select( blockEditorStore ).getBlockSelectionStart(),
|
|
194
197
|
hasHistory: !! getEditorSettings().onNavigateToPreviousEntityRecord,
|
|
198
|
+
hasBlockBreadcrumbs: get( 'core', 'showBlockBreadcrumbs' ),
|
|
199
|
+
blockEditorMode:
|
|
200
|
+
select( blockEditorStore ).__unstableGetEditorMode(),
|
|
201
|
+
isEditingTemplate:
|
|
202
|
+
select( editorStore ).getCurrentPostType() === 'wp_template',
|
|
195
203
|
};
|
|
196
204
|
}, [] );
|
|
197
205
|
|
|
@@ -203,18 +211,6 @@ function Layout( { initialPost } ) {
|
|
|
203
211
|
|
|
204
212
|
const styles = useEditorStyles();
|
|
205
213
|
|
|
206
|
-
// Inserter and Sidebars are mutually exclusive
|
|
207
|
-
useEffect( () => {
|
|
208
|
-
if ( sidebarIsOpened && ! isHugeViewport ) {
|
|
209
|
-
setIsInserterOpened( false );
|
|
210
|
-
}
|
|
211
|
-
}, [ isHugeViewport, setIsInserterOpened, sidebarIsOpened ] );
|
|
212
|
-
useEffect( () => {
|
|
213
|
-
if ( isInserterOpened && ! isHugeViewport ) {
|
|
214
|
-
closeGeneralSidebar();
|
|
215
|
-
}
|
|
216
|
-
}, [ closeGeneralSidebar, isInserterOpened, isHugeViewport ] );
|
|
217
|
-
|
|
218
214
|
// Local state for save panel.
|
|
219
215
|
// Note 'truthy' callback implies an open panel.
|
|
220
216
|
const [ entitiesSavedStatesCallback, setEntitiesSavedStatesCallback ] =
|
|
@@ -237,11 +233,13 @@ function Layout( { initialPost } ) {
|
|
|
237
233
|
document.body.classList.remove( 'show-icon-labels' );
|
|
238
234
|
}
|
|
239
235
|
|
|
240
|
-
const className =
|
|
236
|
+
const className = clsx( 'edit-post-layout', 'is-mode-' + mode, {
|
|
241
237
|
'is-sidebar-opened': sidebarIsOpened,
|
|
242
238
|
'has-metaboxes': hasActiveMetaboxes,
|
|
243
239
|
'is-distraction-free': isDistractionFree && isWideViewport,
|
|
244
240
|
'is-entity-save-view-open': !! entitiesSavedStatesCallback,
|
|
241
|
+
'has-block-breadcrumbs':
|
|
242
|
+
hasBlockBreadcrumbs && ! isDistractionFree && isWideViewport,
|
|
245
243
|
} );
|
|
246
244
|
|
|
247
245
|
const secondarySidebarLabel = isListViewOpened
|
|
@@ -276,6 +274,58 @@ function Layout( { initialPost } ) {
|
|
|
276
274
|
);
|
|
277
275
|
}
|
|
278
276
|
|
|
277
|
+
const { createSuccessNotice } = useDispatch( noticesStore );
|
|
278
|
+
|
|
279
|
+
const onActionPerformed = useCallback(
|
|
280
|
+
( actionId, items ) => {
|
|
281
|
+
switch ( actionId ) {
|
|
282
|
+
case 'move-to-trash':
|
|
283
|
+
{
|
|
284
|
+
document.location.href = addQueryArgs( 'edit.php', {
|
|
285
|
+
trashed: 1,
|
|
286
|
+
post_type: items[ 0 ].type,
|
|
287
|
+
ids: items[ 0 ].id,
|
|
288
|
+
} );
|
|
289
|
+
}
|
|
290
|
+
break;
|
|
291
|
+
case 'duplicate-post':
|
|
292
|
+
{
|
|
293
|
+
const newItem = items[ 0 ];
|
|
294
|
+
const title =
|
|
295
|
+
typeof newItem.title === 'string'
|
|
296
|
+
? newItem.title
|
|
297
|
+
: newItem.title?.rendered;
|
|
298
|
+
createSuccessNotice(
|
|
299
|
+
sprintf(
|
|
300
|
+
// translators: %s: Title of the created post e.g: "Post 1".
|
|
301
|
+
__( '"%s" successfully created.' ),
|
|
302
|
+
title
|
|
303
|
+
),
|
|
304
|
+
{
|
|
305
|
+
type: 'snackbar',
|
|
306
|
+
id: 'duplicate-post-action',
|
|
307
|
+
actions: [
|
|
308
|
+
{
|
|
309
|
+
label: __( 'Edit' ),
|
|
310
|
+
onClick: () => {
|
|
311
|
+
const postId = newItem.id;
|
|
312
|
+
document.location.href =
|
|
313
|
+
addQueryArgs( 'post.php', {
|
|
314
|
+
post: postId,
|
|
315
|
+
action: 'edit',
|
|
316
|
+
} );
|
|
317
|
+
},
|
|
318
|
+
},
|
|
319
|
+
],
|
|
320
|
+
}
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
break;
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
[ createSuccessNotice ]
|
|
327
|
+
);
|
|
328
|
+
|
|
279
329
|
return (
|
|
280
330
|
<>
|
|
281
331
|
<FullscreenMode isActive={ isFullscreenActive } />
|
|
@@ -286,6 +336,7 @@ function Layout( { initialPost } ) {
|
|
|
286
336
|
<EditPostKeyboardShortcuts />
|
|
287
337
|
<EditorKeyboardShortcutsRegister />
|
|
288
338
|
<EditorKeyboardShortcuts />
|
|
339
|
+
<BlockKeyboardShortcuts />
|
|
289
340
|
|
|
290
341
|
<InterfaceSkeleton
|
|
291
342
|
isDistractionFree={ isDistractionFree && isWideViewport }
|
|
@@ -336,6 +387,7 @@ function Layout( { initialPost } ) {
|
|
|
336
387
|
! isMobileViewport &&
|
|
337
388
|
showBlockBreadcrumbs &&
|
|
338
389
|
isRichEditingEnabled &&
|
|
390
|
+
blockEditorMode !== 'zoom-out' &&
|
|
339
391
|
mode === 'visual' && (
|
|
340
392
|
<div className="edit-post-layout__footer">
|
|
341
393
|
<BlockBreadcrumb rootLabelText={ documentLabel } />
|
|
@@ -343,7 +395,7 @@ function Layout( { initialPost } ) {
|
|
|
343
395
|
)
|
|
344
396
|
}
|
|
345
397
|
actions={
|
|
346
|
-
<
|
|
398
|
+
<SavePublishPanels
|
|
347
399
|
closeEntitiesSavedStates={ closeEntitiesSavedStates }
|
|
348
400
|
isEntitiesSavedStatesOpen={
|
|
349
401
|
entitiesSavedStatesCallback
|
|
@@ -351,6 +403,7 @@ function Layout( { initialPost } ) {
|
|
|
351
403
|
setEntitiesSavedStatesCallback={
|
|
352
404
|
setEntitiesSavedStatesCallback
|
|
353
405
|
}
|
|
406
|
+
forceIsDirtyPublishPanel={ hasActiveMetaboxes }
|
|
354
407
|
/>
|
|
355
408
|
}
|
|
356
409
|
shortcuts={ {
|
|
@@ -358,11 +411,17 @@ function Layout( { initialPost } ) {
|
|
|
358
411
|
next: nextShortcut,
|
|
359
412
|
} }
|
|
360
413
|
/>
|
|
361
|
-
<EditPostPreferencesModal />
|
|
362
414
|
<WelcomeGuide />
|
|
363
415
|
<InitPatternModal />
|
|
364
416
|
<PluginArea onError={ onPluginAreaError } />
|
|
365
|
-
{ ! isDistractionFree &&
|
|
417
|
+
{ ! isDistractionFree && (
|
|
418
|
+
<Sidebar
|
|
419
|
+
onActionPerformed={ onActionPerformed }
|
|
420
|
+
extraPanels={
|
|
421
|
+
! isEditingTemplate && <MetaBoxes location="side" />
|
|
422
|
+
}
|
|
423
|
+
/>
|
|
424
|
+
) }
|
|
366
425
|
</>
|
|
367
426
|
);
|
|
368
427
|
}
|
|
@@ -7,95 +7,22 @@
|
|
|
7
7
|
.edit-post-layout .components-editor-notices__snackbar {
|
|
8
8
|
position: fixed;
|
|
9
9
|
right: 0;
|
|
10
|
-
bottom:
|
|
10
|
+
bottom: 16px;
|
|
11
11
|
padding-left: 16px;
|
|
12
12
|
padding-right: 16px;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
.is-distraction-free {
|
|
16
16
|
.components-editor-notices__snackbar {
|
|
17
|
-
bottom:
|
|
17
|
+
bottom: 16px;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
.
|
|
24
|
-
|
|
25
|
-
z-index: z-index(".edit-post-layout .edit-post-post-publish-panel");
|
|
26
|
-
top: $admin-bar-height-big;
|
|
27
|
-
bottom: 0;
|
|
28
|
-
right: 0;
|
|
29
|
-
left: 0;
|
|
30
|
-
overflow: auto;
|
|
31
|
-
|
|
32
|
-
@include break-medium() {
|
|
33
|
-
z-index: z-index(".edit-post-layout .edit-post-post-publish-panel {greater than small}");
|
|
34
|
-
top: $admin-bar-height;
|
|
35
|
-
left: auto;
|
|
36
|
-
width: $sidebar-width + $border-width;
|
|
37
|
-
border-left: $border-width solid $gray-300;
|
|
38
|
-
transform: translateX(+100%);
|
|
39
|
-
animation: edit-post-post-publish-panel__slide-in-animation 0.1s forwards;
|
|
40
|
-
@include reduce-motion("animation");
|
|
41
|
-
|
|
42
|
-
body.is-fullscreen-mode & {
|
|
43
|
-
top: 0;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Keep it open on focus to avoid conflict with navigate-regions animation.
|
|
47
|
-
[role="region"]:focus & {
|
|
48
|
-
transform: translateX(0%);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
@keyframes edit-post-post-publish-panel__slide-in-animation {
|
|
54
|
-
100% {
|
|
55
|
-
transform: translateX(0%);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.edit-post-layout .editor-post-publish-panel__header-publish-button {
|
|
60
|
-
justify-content: center;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.edit-post-layout__toggle-publish-panel,
|
|
64
|
-
.edit-post-layout__toggle-sidebar-panel,
|
|
65
|
-
.edit-post-layout__toggle-entities-saved-states-panel {
|
|
66
|
-
z-index: z-index(".edit-post-layout__toggle-sidebar-panel");
|
|
67
|
-
position: fixed !important; // Need to override the default relative positionning
|
|
68
|
-
top: -9999em;
|
|
69
|
-
bottom: auto;
|
|
70
|
-
left: auto;
|
|
71
|
-
right: 0;
|
|
72
|
-
box-sizing: border-box;
|
|
73
|
-
width: $sidebar-width;
|
|
74
|
-
background-color: $white;
|
|
75
|
-
border: 1px dotted $gray-300;
|
|
76
|
-
height: auto !important; // Need to override the default sidebar positionnings
|
|
77
|
-
padding: $grid-unit-30;
|
|
78
|
-
display: flex;
|
|
79
|
-
justify-content: center;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.edit-post-layout__toggle-sidebar-panel {
|
|
83
|
-
.interface-interface-skeleton__sidebar:focus &,
|
|
84
|
-
.interface-interface-skeleton__sidebar:focus-within & {
|
|
85
|
-
top: auto;
|
|
86
|
-
bottom: 0;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.edit-post-layout__toggle-entities-saved-states-panel,
|
|
91
|
-
.edit-post-layout__toggle-publish-panel {
|
|
92
|
-
.interface-interface-skeleton__actions:focus &,
|
|
93
|
-
.interface-interface-skeleton__actions:focus-within & {
|
|
94
|
-
top: auto;
|
|
95
|
-
bottom: 0;
|
|
21
|
+
// Adjust the position of the notices when breadcrumbs are present
|
|
22
|
+
.has-block-breadcrumbs {
|
|
23
|
+
.components-editor-notices__snackbar {
|
|
24
|
+
bottom: 40px;
|
|
96
25
|
}
|
|
97
26
|
}
|
|
98
27
|
|
|
99
|
-
.edit-post-layout .
|
|
100
|
-
height: $header-height + $border-width;
|
|
101
|
-
}
|
|
28
|
+
@include editor-left(".edit-post-layout .components-editor-notices__snackbar");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
4
|
+
import clsx from 'clsx';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -48,13 +48,9 @@ function MetaBoxesArea( { location } ) {
|
|
|
48
48
|
return select( editPostStore ).isSavingMetaBoxes();
|
|
49
49
|
}, [] );
|
|
50
50
|
|
|
51
|
-
const classes =
|
|
52
|
-
'
|
|
53
|
-
|
|
54
|
-
{
|
|
55
|
-
'is-loading': isSaving,
|
|
56
|
-
}
|
|
57
|
-
);
|
|
51
|
+
const classes = clsx( 'edit-post-meta-boxes-area', `is-${ location }`, {
|
|
52
|
+
'is-loading': isSaving,
|
|
53
|
+
} );
|
|
58
54
|
|
|
59
55
|
return (
|
|
60
56
|
<div className={ classes }>
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import { useViewportMatch } from '@wordpress/compose';
|
|
7
6
|
import { privateApis as preferencesPrivateApis } from '@wordpress/preferences';
|
|
8
7
|
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
9
8
|
|
|
@@ -12,32 +11,13 @@ import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
|
12
11
|
*/
|
|
13
12
|
import { unlock } from '../../lock-unlock';
|
|
14
13
|
import MetaBoxesSection from './meta-boxes-section';
|
|
15
|
-
import EnablePublishSidebarOption from './enable-publish-sidebar';
|
|
16
14
|
|
|
17
|
-
const {
|
|
18
|
-
preferencesPrivateApis
|
|
19
|
-
);
|
|
15
|
+
const { PreferenceToggleControl } = unlock( preferencesPrivateApis );
|
|
20
16
|
const { PreferencesModal } = unlock( editorPrivateApis );
|
|
21
17
|
|
|
22
18
|
export default function EditPostPreferencesModal() {
|
|
23
|
-
const isLargeViewport = useViewportMatch( 'medium' );
|
|
24
|
-
|
|
25
19
|
const extraSections = {
|
|
26
|
-
general: (
|
|
27
|
-
<>
|
|
28
|
-
{ isLargeViewport && (
|
|
29
|
-
<PreferencesModalSection title={ __( 'Publishing' ) }>
|
|
30
|
-
<EnablePublishSidebarOption
|
|
31
|
-
help={ __(
|
|
32
|
-
'Review settings, such as visibility and tags.'
|
|
33
|
-
) }
|
|
34
|
-
label={ __( 'Enable pre-publish checks' ) }
|
|
35
|
-
/>
|
|
36
|
-
</PreferencesModalSection>
|
|
37
|
-
) }
|
|
38
|
-
<MetaBoxesSection title={ __( 'Advanced' ) } />
|
|
39
|
-
</>
|
|
40
|
-
),
|
|
20
|
+
general: <MetaBoxesSection title={ __( 'Advanced' ) } />,
|
|
41
21
|
appearance: (
|
|
42
22
|
<PreferenceToggleControl
|
|
43
23
|
scope="core/edit-post"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
4
|
+
import clsx from 'clsx';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
import { useMemo } from '@wordpress/element';
|
|
14
14
|
import { useSelect } from '@wordpress/data';
|
|
15
15
|
import { store as blocksStore } from '@wordpress/blocks';
|
|
16
|
+
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Internal dependencies
|
|
@@ -32,12 +33,13 @@ export default function VisualEditor( { styles } ) {
|
|
|
32
33
|
isBlockBasedTheme,
|
|
33
34
|
hasV3BlocksOnly,
|
|
34
35
|
isEditingTemplate,
|
|
36
|
+
isZoomedOutView,
|
|
35
37
|
} = useSelect( ( select ) => {
|
|
36
38
|
const { isFeatureActive } = select( editPostStore );
|
|
37
39
|
const { getEditorSettings, getRenderingMode } = select( editorStore );
|
|
38
40
|
const { getBlockTypes } = select( blocksStore );
|
|
41
|
+
const { __unstableGetEditorMode } = select( blockEditorStore );
|
|
39
42
|
const editorSettings = getEditorSettings();
|
|
40
|
-
|
|
41
43
|
return {
|
|
42
44
|
isWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),
|
|
43
45
|
renderingMode: getRenderingMode(),
|
|
@@ -47,6 +49,7 @@ export default function VisualEditor( { styles } ) {
|
|
|
47
49
|
} ),
|
|
48
50
|
isEditingTemplate:
|
|
49
51
|
select( editorStore ).getCurrentPostType() === 'wp_template',
|
|
52
|
+
isZoomedOutView: __unstableGetEditorMode() === 'zoom-out',
|
|
50
53
|
};
|
|
51
54
|
}, [] );
|
|
52
55
|
const hasMetaBoxes = useSelect(
|
|
@@ -60,7 +63,11 @@ export default function VisualEditor( { styles } ) {
|
|
|
60
63
|
|
|
61
64
|
// Add a constant padding for the typewritter effect. When typing at the
|
|
62
65
|
// bottom, there needs to be room to scroll up.
|
|
63
|
-
if (
|
|
66
|
+
if (
|
|
67
|
+
! isZoomedOutView &&
|
|
68
|
+
! hasMetaBoxes &&
|
|
69
|
+
renderingMode === 'post-only'
|
|
70
|
+
) {
|
|
64
71
|
paddingBottom = '40vh';
|
|
65
72
|
}
|
|
66
73
|
|
|
@@ -84,7 +91,7 @@ export default function VisualEditor( { styles } ) {
|
|
|
84
91
|
|
|
85
92
|
return (
|
|
86
93
|
<div
|
|
87
|
-
className={
|
|
94
|
+
className={ clsx( 'edit-post-visual-editor', {
|
|
88
95
|
'has-inline-canvas': ! isToBeIframed,
|
|
89
96
|
} ) }
|
|
90
97
|
>
|
|
@@ -27,7 +27,7 @@ export function usePaddingAppender() {
|
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
//
|
|
30
|
+
// Only handle clicks under the last child.
|
|
31
31
|
const lastChild = node.lastElementChild;
|
|
32
32
|
if ( ! lastChild ) {
|
|
33
33
|
return;
|
|
@@ -44,6 +44,12 @@ export function usePaddingAppender() {
|
|
|
44
44
|
.select( blockEditorStore )
|
|
45
45
|
.getBlockOrder( '' );
|
|
46
46
|
const lastBlockClientId = blockOrder[ blockOrder.length - 1 ];
|
|
47
|
+
|
|
48
|
+
// Do nothing when only default block appender is present.
|
|
49
|
+
if ( ! lastBlockClientId ) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
47
53
|
const lastBlock = registry
|
|
48
54
|
.select( blockEditorStore )
|
|
49
55
|
.getBlock( lastBlockClientId );
|