@wordpress/edit-post 7.24.0 → 7.25.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/header-toolbar/index.js +8 -4
- package/build/components/header/header-toolbar/index.js.map +1 -1
- package/build/components/header/index.js +13 -11
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/mode-switcher/index.js +1 -1
- package/build/components/header/mode-switcher/index.js.map +1 -1
- package/build/components/header/more-menu/index.js +2 -1
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/components/header/writing-menu/index.js +13 -12
- package/build/components/header/writing-menu/index.js.map +1 -1
- package/build/components/layout/index.js +12 -12
- package/build/components/layout/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +65 -49
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/sidebar/post-status/index.js +1 -2
- package/build/components/sidebar/post-status/index.js.map +1 -1
- package/build/components/sidebar/settings-header/index.js +17 -43
- package/build/components/sidebar/settings-header/index.js.map +1 -1
- package/build/components/sidebar/settings-sidebar/index.js +80 -20
- package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build/components/start-page-options/index.js +3 -3
- package/build/components/start-page-options/index.js.map +1 -1
- package/build/components/visual-editor/index.js +20 -257
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/components/welcome-guide/index.js +6 -3
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/editor.js +5 -6
- package/build/editor.js.map +1 -1
- package/build/editor.native.js +1 -2
- package/build/editor.native.js.map +1 -1
- package/build/index.js +5 -4
- package/build/index.js.map +1 -1
- package/build/plugins/welcome-guide-menu-item/index.js +2 -6
- package/build/plugins/welcome-guide-menu-item/index.js.map +1 -1
- package/build/store/actions.js +35 -39
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +1 -34
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +22 -12
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.js +8 -4
- package/build-module/components/header/header-toolbar/index.js.map +1 -1
- package/build-module/components/header/index.js +15 -13
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/mode-switcher/index.js +1 -1
- package/build-module/components/header/mode-switcher/index.js.map +1 -1
- package/build-module/components/header/more-menu/index.js +2 -1
- package/build-module/components/header/more-menu/index.js.map +1 -1
- package/build-module/components/header/writing-menu/index.js +14 -13
- package/build-module/components/header/writing-menu/index.js.map +1 -1
- package/build-module/components/layout/index.js +13 -13
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +65 -49
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/sidebar/post-status/index.js +2 -3
- package/build-module/components/sidebar/post-status/index.js.map +1 -1
- package/build-module/components/sidebar/settings-header/index.js +20 -46
- package/build-module/components/sidebar/settings-header/index.js.map +1 -1
- package/build-module/components/sidebar/settings-sidebar/index.js +80 -21
- package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build-module/components/start-page-options/index.js +3 -3
- package/build-module/components/start-page-options/index.js.map +1 -1
- package/build-module/components/visual-editor/index.js +24 -261
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +6 -3
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/editor.js +5 -6
- package/build-module/editor.js.map +1 -1
- package/build-module/editor.native.js +1 -2
- package/build-module/editor.native.js.map +1 -1
- package/build-module/index.js +3 -2
- package/build-module/index.js.map +1 -1
- package/build-module/plugins/welcome-guide-menu-item/index.js +2 -6
- package/build-module/plugins/welcome-guide-menu-item/index.js.map +1 -1
- package/build-module/store/actions.js +31 -36
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +1 -33
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +18 -9
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +63 -200
- package/build-style/style.css +63 -200
- package/package.json +32 -32
- package/src/components/header/header-toolbar/index.js +4 -0
- package/src/components/header/header-toolbar/style.scss +15 -13
- package/src/components/header/index.js +28 -13
- package/src/components/header/mode-switcher/index.js +2 -1
- package/src/components/header/more-menu/index.js +1 -0
- package/src/components/header/style.scss +60 -34
- package/src/components/header/writing-menu/index.js +16 -18
- package/src/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap +1 -1
- package/src/components/layout/index.js +13 -12
- package/src/components/preferences-modal/index.js +109 -96
- package/src/components/preferences-modal/test/index.js +1 -52
- package/src/components/sidebar/post-status/index.js +2 -2
- package/src/components/sidebar/settings-header/index.js +19 -71
- package/src/components/sidebar/settings-sidebar/index.js +117 -54
- package/src/components/sidebar/style.scss +4 -12
- package/src/components/start-page-options/index.js +3 -3
- package/src/components/visual-editor/index.js +26 -359
- package/src/components/visual-editor/style.scss +0 -15
- package/src/components/welcome-guide/index.js +4 -2
- package/src/editor.js +7 -7
- package/src/editor.native.js +3 -9
- package/src/index.js +3 -2
- package/src/plugins/welcome-guide-menu-item/index.js +3 -6
- package/src/store/actions.js +32 -46
- package/src/store/reducer.js +0 -33
- package/src/store/selectors.js +23 -9
- package/src/store/test/actions.js +0 -28
- package/src/style.scss +0 -3
- package/src/test/__snapshots__/editor.native.js.snap +21 -0
- package/src/test/editor.native.js +90 -56
- package/build/components/device-preview/index.js +0 -72
- package/build/components/device-preview/index.js.map +0 -1
- package/build/components/header/document-actions/index.js +0 -82
- package/build/components/header/document-actions/index.js.map +0 -1
- package/build/components/sidebar/post-template/create-modal.js +0 -99
- package/build/components/sidebar/post-template/create-modal.js.map +0 -1
- package/build/components/sidebar/post-template/form.js +0 -110
- package/build/components/sidebar/post-template/form.js.map +0 -1
- package/build/components/sidebar/post-template/index.js +0 -106
- package/build/components/sidebar/post-template/index.js.map +0 -1
- package/build-module/components/device-preview/index.js +0 -65
- package/build-module/components/device-preview/index.js.map +0 -1
- package/build-module/components/header/document-actions/index.js +0 -74
- package/build-module/components/header/document-actions/index.js.map +0 -1
- package/build-module/components/sidebar/post-template/create-modal.js +0 -92
- package/build-module/components/sidebar/post-template/create-modal.js.map +0 -1
- package/build-module/components/sidebar/post-template/form.js +0 -102
- package/build-module/components/sidebar/post-template/form.js.map +0 -1
- package/build-module/components/sidebar/post-template/index.js +0 -98
- package/build-module/components/sidebar/post-template/index.js.map +0 -1
- package/src/components/device-preview/index.js +0 -73
- package/src/components/header/document-actions/index.js +0 -82
- package/src/components/header/document-actions/style.scss +0 -64
- package/src/components/sidebar/post-template/create-modal.js +0 -140
- package/src/components/sidebar/post-template/form.js +0 -141
- package/src/components/sidebar/post-template/index.js +0 -120
- package/src/components/sidebar/post-template/style.scss +0 -22
- package/src/components/sidebar/settings-header/style.scss +0 -74
- package/src/components/sidebar/template/style.scss +0 -35
|
@@ -52,12 +52,43 @@
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
.block-editor-block-contextual-toolbar.is-fixed {
|
|
56
|
-
border: none;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
55
|
.selected-block-tools-wrapper {
|
|
60
56
|
overflow-x: hidden;
|
|
57
|
+
display: flex;
|
|
58
|
+
|
|
59
|
+
.block-editor-block-contextual-toolbar {
|
|
60
|
+
border-bottom: 0;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&::after {
|
|
64
|
+
content: "";
|
|
65
|
+
width: $border-width;
|
|
66
|
+
margin-top: $grid-unit + $grid-unit-05;
|
|
67
|
+
margin-bottom: $grid-unit + $grid-unit-05;
|
|
68
|
+
background-color: $gray-300;
|
|
69
|
+
margin-left: $grid-unit;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Modified group borders
|
|
73
|
+
.components-toolbar-group,
|
|
74
|
+
.components-toolbar {
|
|
75
|
+
border-right: none;
|
|
76
|
+
|
|
77
|
+
&::after {
|
|
78
|
+
content: "";
|
|
79
|
+
width: $border-width;
|
|
80
|
+
margin-top: $grid-unit + $grid-unit-05;
|
|
81
|
+
margin-bottom: $grid-unit + $grid-unit-05;
|
|
82
|
+
background-color: $gray-300;
|
|
83
|
+
margin-left: $grid-unit;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
& .components-toolbar-group.components-toolbar-group {
|
|
87
|
+
&::after {
|
|
88
|
+
display: none;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
61
92
|
|
|
62
93
|
&.is-collapsed {
|
|
63
94
|
display: none;
|
|
@@ -93,34 +124,7 @@
|
|
|
93
124
|
padding-right: $grid-unit-20 - ($grid-unit-15 * 0.5);
|
|
94
125
|
}
|
|
95
126
|
|
|
96
|
-
gap: $grid-unit-
|
|
97
|
-
|
|
98
|
-
@include break-small() {
|
|
99
|
-
gap: $grid-unit-10;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.edit-post-header-preview__grouping-external {
|
|
104
|
-
display: flex;
|
|
105
|
-
position: relative;
|
|
106
|
-
padding-bottom: 0;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
.edit-post-header-preview__button-external {
|
|
110
|
-
padding-left: $grid-unit-10;
|
|
111
|
-
|
|
112
|
-
margin-right: auto;
|
|
113
|
-
width: 100%;
|
|
114
|
-
display: flex;
|
|
115
|
-
justify-content: flex-start;
|
|
116
|
-
|
|
117
|
-
svg {
|
|
118
|
-
margin-left: auto;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.edit-post-post-preview-dropdown .components-popover__content {
|
|
123
|
-
padding-bottom: 0;
|
|
127
|
+
gap: $grid-unit-10;
|
|
124
128
|
}
|
|
125
129
|
|
|
126
130
|
/**
|
|
@@ -189,6 +193,22 @@
|
|
|
189
193
|
}
|
|
190
194
|
}
|
|
191
195
|
|
|
196
|
+
.show-icon-labels {
|
|
197
|
+
|
|
198
|
+
.edit-post-header__toolbar .block-editor-block-mover {
|
|
199
|
+
border-left: none;
|
|
200
|
+
|
|
201
|
+
&::before {
|
|
202
|
+
content: "";
|
|
203
|
+
width: $border-width;
|
|
204
|
+
margin-top: $grid-unit + $grid-unit-05;
|
|
205
|
+
margin-bottom: $grid-unit + $grid-unit-05;
|
|
206
|
+
background-color: $gray-300;
|
|
207
|
+
margin-left: $grid-unit;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
192
212
|
.edit-post-header__dropdown {
|
|
193
213
|
.components-menu-item__button.components-menu-item__button,
|
|
194
214
|
.components-button.editor-history__undo,
|
|
@@ -231,6 +251,12 @@
|
|
|
231
251
|
}
|
|
232
252
|
}
|
|
233
253
|
|
|
254
|
+
.edit-post-header__post-preview-button {
|
|
255
|
+
@include break-small {
|
|
256
|
+
display: none;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
234
260
|
.is-distraction-free {
|
|
235
261
|
.interface-interface-skeleton__header {
|
|
236
262
|
border-bottom: none;
|
|
@@ -245,13 +271,13 @@
|
|
|
245
271
|
|
|
246
272
|
|
|
247
273
|
// hide some parts
|
|
248
|
-
& > .edit-post-header__settings > .
|
|
274
|
+
& > .edit-post-header__settings > .edit-post-header__post-preview-button {
|
|
249
275
|
visibility: hidden;
|
|
250
276
|
}
|
|
251
277
|
|
|
252
278
|
& > .edit-post-header__toolbar .edit-post-header-toolbar__inserter-toggle,
|
|
253
279
|
& > .edit-post-header__toolbar .edit-post-header-toolbar__document-overview-toggle,
|
|
254
|
-
& > .edit-post-header__settings > .
|
|
280
|
+
& > .edit-post-header__settings > .editor-preview-dropdown,
|
|
255
281
|
& > .edit-post-header__settings > .interface-pinned-items {
|
|
256
282
|
display: none;
|
|
257
283
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { useDispatch, useRegistry } from '@wordpress/data';
|
|
5
5
|
import { MenuGroup } from '@wordpress/components';
|
|
6
6
|
import { __, _x } from '@wordpress/i18n';
|
|
7
7
|
import { useViewportMatch } from '@wordpress/compose';
|
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
PreferenceToggleMenuItem,
|
|
11
11
|
store as preferencesStore,
|
|
12
12
|
} from '@wordpress/preferences';
|
|
13
|
-
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
14
13
|
|
|
15
14
|
/**
|
|
16
15
|
* Internal dependencies
|
|
@@ -19,11 +18,6 @@ import { store as postEditorStore } from '../../../store';
|
|
|
19
18
|
|
|
20
19
|
function WritingMenu() {
|
|
21
20
|
const registry = useRegistry();
|
|
22
|
-
const isDistractionFree = useSelect(
|
|
23
|
-
( select ) =>
|
|
24
|
-
select( blockEditorStore ).getSettings().isDistractionFree,
|
|
25
|
-
[]
|
|
26
|
-
);
|
|
27
21
|
|
|
28
22
|
const { setIsInserterOpened, setIsListViewOpened, closeGeneralSidebar } =
|
|
29
23
|
useDispatch( postEditorStore );
|
|
@@ -38,6 +32,10 @@ function WritingMenu() {
|
|
|
38
32
|
} );
|
|
39
33
|
};
|
|
40
34
|
|
|
35
|
+
const turnOffDistractionFree = () => {
|
|
36
|
+
setPreference( 'core/edit-post', 'distractionFree', false );
|
|
37
|
+
};
|
|
38
|
+
|
|
41
39
|
const isLargeViewport = useViewportMatch( 'medium' );
|
|
42
40
|
if ( ! isLargeViewport ) {
|
|
43
41
|
return null;
|
|
@@ -47,8 +45,8 @@ function WritingMenu() {
|
|
|
47
45
|
<MenuGroup label={ _x( 'View', 'noun' ) }>
|
|
48
46
|
<PreferenceToggleMenuItem
|
|
49
47
|
scope="core/edit-post"
|
|
50
|
-
disabled={ isDistractionFree }
|
|
51
48
|
name="fixedToolbar"
|
|
49
|
+
onToggle={ turnOffDistractionFree }
|
|
52
50
|
label={ __( 'Top toolbar' ) }
|
|
53
51
|
info={ __(
|
|
54
52
|
'Access all block and document tools in a single place'
|
|
@@ -56,6 +54,16 @@ function WritingMenu() {
|
|
|
56
54
|
messageActivated={ __( 'Top toolbar activated' ) }
|
|
57
55
|
messageDeactivated={ __( 'Top toolbar deactivated' ) }
|
|
58
56
|
/>
|
|
57
|
+
<PreferenceToggleMenuItem
|
|
58
|
+
scope="core/edit-post"
|
|
59
|
+
name="distractionFree"
|
|
60
|
+
onToggle={ toggleDistractionFree }
|
|
61
|
+
label={ __( 'Distraction free' ) }
|
|
62
|
+
info={ __( 'Write with calmness' ) }
|
|
63
|
+
messageActivated={ __( 'Distraction free mode activated' ) }
|
|
64
|
+
messageDeactivated={ __( 'Distraction free mode deactivated' ) }
|
|
65
|
+
shortcut={ displayShortcut.primaryShift( '\\' ) }
|
|
66
|
+
/>
|
|
59
67
|
<PreferenceToggleMenuItem
|
|
60
68
|
scope="core/edit-post"
|
|
61
69
|
name="focusMode"
|
|
@@ -73,16 +81,6 @@ function WritingMenu() {
|
|
|
73
81
|
messageDeactivated={ __( 'Fullscreen mode deactivated' ) }
|
|
74
82
|
shortcut={ displayShortcut.secondary( 'f' ) }
|
|
75
83
|
/>
|
|
76
|
-
<PreferenceToggleMenuItem
|
|
77
|
-
scope="core/edit-post"
|
|
78
|
-
name="distractionFree"
|
|
79
|
-
onToggle={ toggleDistractionFree }
|
|
80
|
-
label={ __( 'Distraction free' ) }
|
|
81
|
-
info={ __( 'Write with calmness' ) }
|
|
82
|
-
messageActivated={ __( 'Distraction free mode activated' ) }
|
|
83
|
-
messageDeactivated={ __( 'Distraction free mode deactivated' ) }
|
|
84
|
-
shortcut={ displayShortcut.primaryShift( '\\' ) }
|
|
85
|
-
/>
|
|
86
84
|
</MenuGroup>
|
|
87
85
|
);
|
|
88
86
|
}
|
|
@@ -898,7 +898,7 @@ exports[`KeyboardShortcutHelpModal should match snapshot when the modal is activ
|
|
|
898
898
|
class="edit-post-keyboard-shortcut-help-modal__shortcut-term"
|
|
899
899
|
>
|
|
900
900
|
<kbd
|
|
901
|
-
aria-label="Shift + Alt + 1
|
|
901
|
+
aria-label="Shift + Alt + 1-6"
|
|
902
902
|
class="edit-post-keyboard-shortcut-help-modal__shortcut-key-combination"
|
|
903
903
|
>
|
|
904
904
|
<kbd
|
|
@@ -21,6 +21,7 @@ import { useSelect, useDispatch } from '@wordpress/data';
|
|
|
21
21
|
import {
|
|
22
22
|
useBlockCommands,
|
|
23
23
|
BlockBreadcrumb,
|
|
24
|
+
BlockToolbar,
|
|
24
25
|
privateApis as blockEditorPrivateApis,
|
|
25
26
|
store as blockEditorStore,
|
|
26
27
|
} from '@wordpress/block-editor';
|
|
@@ -138,7 +139,9 @@ function Layout() {
|
|
|
138
139
|
|
|
139
140
|
const isMobileViewport = useViewportMatch( 'medium', '<' );
|
|
140
141
|
const isHugeViewport = useViewportMatch( 'huge', '>=' );
|
|
141
|
-
const
|
|
142
|
+
const isWideViewport = useViewportMatch( 'large' );
|
|
143
|
+
const isLargeViewport = useViewportMatch( 'medium' );
|
|
144
|
+
|
|
142
145
|
const { openGeneralSidebar, closeGeneralSidebar, setIsInserterOpened } =
|
|
143
146
|
useDispatch( editPostStore );
|
|
144
147
|
const { createErrorNotice } = useDispatch( noticesStore );
|
|
@@ -148,7 +151,6 @@ function Layout() {
|
|
|
148
151
|
isRichEditingEnabled,
|
|
149
152
|
sidebarIsOpened,
|
|
150
153
|
hasActiveMetaboxes,
|
|
151
|
-
hasFixedToolbar,
|
|
152
154
|
previousShortcut,
|
|
153
155
|
nextShortcut,
|
|
154
156
|
hasBlockSelected,
|
|
@@ -157,7 +159,7 @@ function Layout() {
|
|
|
157
159
|
showIconLabels,
|
|
158
160
|
isDistractionFree,
|
|
159
161
|
showBlockBreadcrumbs,
|
|
160
|
-
|
|
162
|
+
showMetaBoxes,
|
|
161
163
|
documentLabel,
|
|
162
164
|
} = useSelect( ( select ) => {
|
|
163
165
|
const { getEditorSettings, getPostTypeLabel } = select( editorStore );
|
|
@@ -165,9 +167,8 @@ function Layout() {
|
|
|
165
167
|
const postTypeLabel = getPostTypeLabel();
|
|
166
168
|
|
|
167
169
|
return {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
select( editPostStore ).isFeatureActive( 'fixedToolbar' ),
|
|
170
|
+
showMetaBoxes:
|
|
171
|
+
select( editorStore ).getRenderingMode() === 'post-only',
|
|
171
172
|
sidebarIsOpened: !! (
|
|
172
173
|
select( interfaceStore ).getActiveComplementaryArea(
|
|
173
174
|
editPostStore.name
|
|
@@ -218,12 +219,12 @@ function Layout() {
|
|
|
218
219
|
if ( sidebarIsOpened && ! isHugeViewport ) {
|
|
219
220
|
setIsInserterOpened( false );
|
|
220
221
|
}
|
|
221
|
-
}, [
|
|
222
|
+
}, [ isHugeViewport, setIsInserterOpened, sidebarIsOpened ] );
|
|
222
223
|
useEffect( () => {
|
|
223
224
|
if ( isInserterOpened && ! isHugeViewport ) {
|
|
224
225
|
closeGeneralSidebar();
|
|
225
226
|
}
|
|
226
|
-
}, [ isInserterOpened, isHugeViewport ] );
|
|
227
|
+
}, [ closeGeneralSidebar, isInserterOpened, isHugeViewport ] );
|
|
227
228
|
|
|
228
229
|
// Local state for save panel.
|
|
229
230
|
// Note 'truthy' callback implies an open panel.
|
|
@@ -252,9 +253,8 @@ function Layout() {
|
|
|
252
253
|
|
|
253
254
|
const className = classnames( 'edit-post-layout', 'is-mode-' + mode, {
|
|
254
255
|
'is-sidebar-opened': sidebarIsOpened,
|
|
255
|
-
'has-fixed-toolbar': hasFixedToolbar,
|
|
256
256
|
'has-metaboxes': hasActiveMetaboxes,
|
|
257
|
-
'is-distraction-free': isDistractionFree &&
|
|
257
|
+
'is-distraction-free': isDistractionFree && isWideViewport,
|
|
258
258
|
'is-entity-save-view-open': !! entitiesSavedStatesCallback,
|
|
259
259
|
} );
|
|
260
260
|
|
|
@@ -301,7 +301,7 @@ function Layout() {
|
|
|
301
301
|
<EditorKeyboardShortcuts />
|
|
302
302
|
|
|
303
303
|
<InterfaceSkeleton
|
|
304
|
-
isDistractionFree={ isDistractionFree &&
|
|
304
|
+
isDistractionFree={ isDistractionFree && isWideViewport }
|
|
305
305
|
className={ className }
|
|
306
306
|
labels={ {
|
|
307
307
|
...interfaceLabels,
|
|
@@ -345,10 +345,11 @@ function Layout() {
|
|
|
345
345
|
{ ( mode === 'text' || ! isRichEditingEnabled ) && (
|
|
346
346
|
<TextEditor />
|
|
347
347
|
) }
|
|
348
|
+
{ ! isLargeViewport && <BlockToolbar hideDragHandle /> }
|
|
348
349
|
{ isRichEditingEnabled && mode === 'visual' && (
|
|
349
350
|
<VisualEditor styles={ styles } />
|
|
350
351
|
) }
|
|
351
|
-
{ ! isDistractionFree &&
|
|
352
|
+
{ ! isDistractionFree && showMetaBoxes && (
|
|
352
353
|
<div className="edit-post-layout__metaboxes">
|
|
353
354
|
<MetaBoxes location="normal" />
|
|
354
355
|
<MetaBoxes location="advanced" />
|
|
@@ -76,6 +76,10 @@ export default function EditPostPreferencesModal() {
|
|
|
76
76
|
closeGeneralSidebar();
|
|
77
77
|
};
|
|
78
78
|
|
|
79
|
+
const turnOffDistractionFree = () => {
|
|
80
|
+
setPreference( 'core/edit-post', 'distractionFree', false );
|
|
81
|
+
};
|
|
82
|
+
|
|
79
83
|
const sections = useMemo(
|
|
80
84
|
() => [
|
|
81
85
|
{
|
|
@@ -86,49 +90,16 @@ export default function EditPostPreferencesModal() {
|
|
|
86
90
|
{ isLargeViewport && (
|
|
87
91
|
<PreferencesModalSection
|
|
88
92
|
title={ __( 'Publishing' ) }
|
|
89
|
-
description={ __(
|
|
90
|
-
'Change options related to publishing.'
|
|
91
|
-
) }
|
|
92
93
|
>
|
|
93
94
|
<EnablePublishSidebarOption
|
|
94
95
|
help={ __(
|
|
95
96
|
'Review settings, such as visibility and tags.'
|
|
96
97
|
) }
|
|
97
|
-
label={ __(
|
|
98
|
-
'Include pre-publish checklist'
|
|
99
|
-
) }
|
|
98
|
+
label={ __( 'Enable pre-publish flow' ) }
|
|
100
99
|
/>
|
|
101
100
|
</PreferencesModalSection>
|
|
102
101
|
) }
|
|
103
|
-
|
|
104
|
-
<PreferencesModalSection
|
|
105
|
-
title={ __( 'Appearance' ) }
|
|
106
|
-
description={ __(
|
|
107
|
-
'Customize options related to the block editor interface and editing flow.'
|
|
108
|
-
) }
|
|
109
|
-
>
|
|
110
|
-
<EnableFeature
|
|
111
|
-
featureName="distractionFree"
|
|
112
|
-
onToggle={ toggleDistractionFree }
|
|
113
|
-
help={ __(
|
|
114
|
-
'Reduce visual distractions by hiding the toolbar and other elements to focus on writing.'
|
|
115
|
-
) }
|
|
116
|
-
label={ __( 'Distraction free' ) }
|
|
117
|
-
/>
|
|
118
|
-
<EnableFeature
|
|
119
|
-
featureName="focusMode"
|
|
120
|
-
help={ __(
|
|
121
|
-
'Highlights the current block and fades other content.'
|
|
122
|
-
) }
|
|
123
|
-
label={ __( 'Spotlight mode' ) }
|
|
124
|
-
/>
|
|
125
|
-
<EnableFeature
|
|
126
|
-
featureName="showIconLabels"
|
|
127
|
-
label={ __( 'Show button text labels' ) }
|
|
128
|
-
help={ __(
|
|
129
|
-
'Show text instead of icons on buttons.'
|
|
130
|
-
) }
|
|
131
|
-
/>
|
|
102
|
+
<PreferencesModalSection title={ __( 'Interface' ) }>
|
|
132
103
|
<EnableFeature
|
|
133
104
|
featureName="showListViewByDefault"
|
|
134
105
|
help={ __(
|
|
@@ -136,74 +107,20 @@ export default function EditPostPreferencesModal() {
|
|
|
136
107
|
) }
|
|
137
108
|
label={ __( 'Always open list view' ) }
|
|
138
109
|
/>
|
|
139
|
-
<EnableFeature
|
|
140
|
-
featureName="themeStyles"
|
|
141
|
-
help={ __(
|
|
142
|
-
'Make the editor look like your theme.'
|
|
143
|
-
) }
|
|
144
|
-
label={ __( 'Use theme styles' ) }
|
|
145
|
-
/>
|
|
146
110
|
{ showBlockBreadcrumbsOption && (
|
|
147
111
|
<EnableFeature
|
|
148
112
|
featureName="showBlockBreadcrumbs"
|
|
149
113
|
help={ __(
|
|
150
|
-
'
|
|
114
|
+
'Display the block hierarchy trail at the bottom of the editor.'
|
|
151
115
|
) }
|
|
152
|
-
label={ __( '
|
|
116
|
+
label={ __( 'Show block breadcrumbs' ) }
|
|
153
117
|
/>
|
|
154
118
|
) }
|
|
155
119
|
</PreferencesModalSection>
|
|
156
|
-
</>
|
|
157
|
-
),
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
name: 'blocks',
|
|
161
|
-
tabLabel: __( 'Blocks' ),
|
|
162
|
-
content: (
|
|
163
|
-
<>
|
|
164
|
-
<PreferencesModalSection
|
|
165
|
-
title={ __( 'Block interactions' ) }
|
|
166
|
-
description={ __(
|
|
167
|
-
'Customize how you interact with blocks in the block library and editing canvas.'
|
|
168
|
-
) }
|
|
169
|
-
>
|
|
170
|
-
<EnableFeature
|
|
171
|
-
featureName="mostUsedBlocks"
|
|
172
|
-
help={ __(
|
|
173
|
-
'Places the most frequent blocks in the block library.'
|
|
174
|
-
) }
|
|
175
|
-
label={ __( 'Show most used blocks' ) }
|
|
176
|
-
/>
|
|
177
|
-
<EnableFeature
|
|
178
|
-
featureName="keepCaretInsideBlock"
|
|
179
|
-
help={ __(
|
|
180
|
-
'Aids screen readers by stopping text caret from leaving blocks.'
|
|
181
|
-
) }
|
|
182
|
-
label={ __(
|
|
183
|
-
'Contain text cursor inside block'
|
|
184
|
-
) }
|
|
185
|
-
/>
|
|
186
|
-
</PreferencesModalSection>
|
|
187
|
-
<PreferencesModalSection
|
|
188
|
-
title={ __( 'Visible blocks' ) }
|
|
189
|
-
description={ __(
|
|
190
|
-
"Disable blocks that you don't want to appear in the inserter. They can always be toggled back on later."
|
|
191
|
-
) }
|
|
192
|
-
>
|
|
193
|
-
<BlockManager />
|
|
194
|
-
</PreferencesModalSection>
|
|
195
|
-
</>
|
|
196
|
-
),
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
name: 'panels',
|
|
200
|
-
tabLabel: __( 'Panels' ),
|
|
201
|
-
content: (
|
|
202
|
-
<>
|
|
203
120
|
<PreferencesModalSection
|
|
204
121
|
title={ __( 'Document settings' ) }
|
|
205
122
|
description={ __(
|
|
206
|
-
'
|
|
123
|
+
'Select what settings are shown in the document panel.'
|
|
207
124
|
) }
|
|
208
125
|
>
|
|
209
126
|
<EnablePluginDocumentSettingPanelOption.Slot />
|
|
@@ -242,12 +159,108 @@ export default function EditPostPreferencesModal() {
|
|
|
242
159
|
/>
|
|
243
160
|
</PageAttributesCheck>
|
|
244
161
|
</PreferencesModalSection>
|
|
245
|
-
<MetaBoxesSection
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
162
|
+
<MetaBoxesSection title={ __( 'Advanced' ) } />
|
|
163
|
+
</>
|
|
164
|
+
),
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
name: 'appearance',
|
|
168
|
+
tabLabel: __( 'Appearance' ),
|
|
169
|
+
content: (
|
|
170
|
+
<PreferencesModalSection
|
|
171
|
+
title={ __( 'Appearance' ) }
|
|
172
|
+
description={ __(
|
|
173
|
+
'Customize the editor interface to suit your needs.'
|
|
174
|
+
) }
|
|
175
|
+
>
|
|
176
|
+
<EnableFeature
|
|
177
|
+
featureName="fixedToolbar"
|
|
178
|
+
onToggle={ turnOffDistractionFree }
|
|
179
|
+
help={ __(
|
|
180
|
+
'Access all block and document tools in a single place.'
|
|
181
|
+
) }
|
|
182
|
+
label={ __( 'Top toolbar' ) }
|
|
183
|
+
/>
|
|
184
|
+
<EnableFeature
|
|
185
|
+
featureName="distractionFree"
|
|
186
|
+
onToggle={ toggleDistractionFree }
|
|
187
|
+
help={ __(
|
|
188
|
+
'Reduce visual distractions by hiding the toolbar and other elements to focus on writing.'
|
|
189
|
+
) }
|
|
190
|
+
label={ __( 'Distraction free' ) }
|
|
191
|
+
/>
|
|
192
|
+
<EnableFeature
|
|
193
|
+
featureName="focusMode"
|
|
194
|
+
help={ __(
|
|
195
|
+
'Highlights the current block and fades other content.'
|
|
196
|
+
) }
|
|
197
|
+
label={ __( 'Spotlight mode' ) }
|
|
198
|
+
/>
|
|
199
|
+
<EnableFeature
|
|
200
|
+
featureName="themeStyles"
|
|
201
|
+
help={ __(
|
|
202
|
+
'Make the editor look like your theme.'
|
|
249
203
|
) }
|
|
204
|
+
label={ __( 'Use theme styles' ) }
|
|
250
205
|
/>
|
|
206
|
+
</PreferencesModalSection>
|
|
207
|
+
),
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
name: 'accessibility',
|
|
211
|
+
tabLabel: __( 'Accessibility' ),
|
|
212
|
+
content: (
|
|
213
|
+
<>
|
|
214
|
+
<PreferencesModalSection
|
|
215
|
+
title={ __( 'Navigation' ) }
|
|
216
|
+
description={ __(
|
|
217
|
+
'Optimize the editing experience for enhanced control.'
|
|
218
|
+
) }
|
|
219
|
+
>
|
|
220
|
+
<EnableFeature
|
|
221
|
+
featureName="keepCaretInsideBlock"
|
|
222
|
+
help={ __(
|
|
223
|
+
'Keeps the text cursor within the block boundaries, aiding users with screen readers by preventing unintentional cursor movement outside the block.'
|
|
224
|
+
) }
|
|
225
|
+
label={ __(
|
|
226
|
+
'Contain text cursor inside block'
|
|
227
|
+
) }
|
|
228
|
+
/>
|
|
229
|
+
</PreferencesModalSection>
|
|
230
|
+
<PreferencesModalSection title={ __( 'Interface' ) }>
|
|
231
|
+
<EnableFeature
|
|
232
|
+
featureName="showIconLabels"
|
|
233
|
+
label={ __( 'Show button text labels' ) }
|
|
234
|
+
help={ __(
|
|
235
|
+
'Show text instead of icons on buttons across the interface.'
|
|
236
|
+
) }
|
|
237
|
+
/>
|
|
238
|
+
</PreferencesModalSection>
|
|
239
|
+
</>
|
|
240
|
+
),
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
name: 'blocks',
|
|
244
|
+
tabLabel: __( 'Blocks' ),
|
|
245
|
+
content: (
|
|
246
|
+
<>
|
|
247
|
+
<PreferencesModalSection title={ __( 'Inserter' ) }>
|
|
248
|
+
<EnableFeature
|
|
249
|
+
featureName="mostUsedBlocks"
|
|
250
|
+
help={ __(
|
|
251
|
+
'Adds a category with the most frequently used blocks in the inserter.'
|
|
252
|
+
) }
|
|
253
|
+
label={ __( 'Show most used blocks' ) }
|
|
254
|
+
/>
|
|
255
|
+
</PreferencesModalSection>
|
|
256
|
+
<PreferencesModalSection
|
|
257
|
+
title={ __( 'Manage block visibility' ) }
|
|
258
|
+
description={ __(
|
|
259
|
+
"Disable blocks that you don't want to appear in the inserter. They can always be toggled back on later."
|
|
260
|
+
) }
|
|
261
|
+
>
|
|
262
|
+
<BlockManager />
|
|
263
|
+
</PreferencesModalSection>
|
|
251
264
|
</>
|
|
252
265
|
),
|
|
253
266
|
},
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { render, screen
|
|
4
|
+
import { render, screen } from '@testing-library/react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { useSelect } from '@wordpress/data';
|
|
10
|
-
import { useViewportMatch } from '@wordpress/compose';
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* Internal dependencies
|
|
@@ -19,56 +18,6 @@ jest.mock( '@wordpress/data/src/components/use-select', () => jest.fn() );
|
|
|
19
18
|
jest.mock( '@wordpress/compose/src/hooks/use-viewport-match', () => jest.fn() );
|
|
20
19
|
|
|
21
20
|
describe( 'EditPostPreferencesModal', () => {
|
|
22
|
-
describe( 'should match snapshot when the modal is active', () => {
|
|
23
|
-
afterEach( () => {
|
|
24
|
-
useViewportMatch.mockClear();
|
|
25
|
-
} );
|
|
26
|
-
it( 'large viewports', async () => {
|
|
27
|
-
useSelect.mockImplementation( () => [ true, true, false ] );
|
|
28
|
-
useViewportMatch.mockImplementation( () => true );
|
|
29
|
-
render( <EditPostPreferencesModal /> );
|
|
30
|
-
const tabPanel = await screen.findByRole( 'tabpanel', {
|
|
31
|
-
name: 'General',
|
|
32
|
-
} );
|
|
33
|
-
|
|
34
|
-
expect(
|
|
35
|
-
within( tabPanel ).getByLabelText(
|
|
36
|
-
'Include pre-publish checklist'
|
|
37
|
-
)
|
|
38
|
-
).toBeInTheDocument();
|
|
39
|
-
} );
|
|
40
|
-
it( 'small viewports', async () => {
|
|
41
|
-
useSelect.mockImplementation( () => [ true, true, false ] );
|
|
42
|
-
useViewportMatch.mockImplementation( () => false );
|
|
43
|
-
render( <EditPostPreferencesModal /> );
|
|
44
|
-
|
|
45
|
-
// The tabpanel is not rendered in small viewports.
|
|
46
|
-
expect(
|
|
47
|
-
screen.queryByRole( 'tabpanel', {
|
|
48
|
-
name: 'General',
|
|
49
|
-
} )
|
|
50
|
-
).not.toBeInTheDocument();
|
|
51
|
-
|
|
52
|
-
const dialog = screen.getByRole( 'dialog', {
|
|
53
|
-
name: 'Preferences',
|
|
54
|
-
} );
|
|
55
|
-
|
|
56
|
-
// Checkbox toggle controls are not rendered in small viewports.
|
|
57
|
-
expect(
|
|
58
|
-
within( dialog ).queryByLabelText(
|
|
59
|
-
'Include pre-publish checklist'
|
|
60
|
-
)
|
|
61
|
-
).not.toBeInTheDocument();
|
|
62
|
-
|
|
63
|
-
// Individual preference nav buttons are rendered in small viewports.
|
|
64
|
-
expect(
|
|
65
|
-
within( dialog ).getByRole( 'button', {
|
|
66
|
-
name: 'General',
|
|
67
|
-
} )
|
|
68
|
-
).toBeInTheDocument();
|
|
69
|
-
} );
|
|
70
|
-
} );
|
|
71
|
-
|
|
72
21
|
it( 'should not render when the modal is not active', () => {
|
|
73
22
|
useSelect.mockImplementation( () => [ false, false, false ] );
|
|
74
23
|
render( <EditPostPreferencesModal /> );
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
PostSwitchToDraftButton,
|
|
14
14
|
PostSyncStatus,
|
|
15
15
|
PostURLPanel,
|
|
16
|
+
PostTemplatePanel,
|
|
16
17
|
} from '@wordpress/editor';
|
|
17
18
|
|
|
18
19
|
/**
|
|
@@ -26,7 +27,6 @@ import PostFormat from '../post-format';
|
|
|
26
27
|
import PostPendingStatus from '../post-pending-status';
|
|
27
28
|
import PluginPostStatusInfo from '../plugin-post-status-info';
|
|
28
29
|
import { store as editPostStore } from '../../../store';
|
|
29
|
-
import PostTemplate from '../post-template';
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* Module Constants
|
|
@@ -62,7 +62,7 @@ export default function PostStatus() {
|
|
|
62
62
|
<>
|
|
63
63
|
<PostVisibility />
|
|
64
64
|
<PostSchedulePanel />
|
|
65
|
-
<
|
|
65
|
+
<PostTemplatePanel />
|
|
66
66
|
<PostURLPanel />
|
|
67
67
|
<PostSyncStatus />
|
|
68
68
|
<PostSticky />
|