@wordpress/edit-post 6.16.0 → 6.18.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 +4 -0
- package/build/components/block-manager/category.js +2 -2
- package/build/components/block-manager/category.js.map +1 -1
- package/build/components/block-manager/index.js +1 -1
- package/build/components/block-manager/index.js.map +1 -1
- package/build/components/device-preview/index.js +3 -0
- package/build/components/device-preview/index.js.map +1 -1
- package/build/components/header/header-toolbar/index.js +0 -6
- package/build/components/header/header-toolbar/index.js.map +1 -1
- package/build/components/header/index.js +52 -8
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/writing-menu/index.js +49 -1
- package/build/components/header/writing-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +1 -7
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +41 -2
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/index.js +9 -8
- package/build/components/layout/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +27 -8
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preferences-modal/options/enable-feature.js +6 -2
- package/build/components/preferences-modal/options/enable-feature.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-outline.js +119 -0
- package/build/components/secondary-sidebar/list-view-outline.js.map +1 -0
- package/build/components/secondary-sidebar/list-view-sidebar.js +36 -11
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/visual-editor/index.js +4 -1
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/editor.js +5 -5
- package/build/editor.js.map +1 -1
- package/build/editor.native.js +1 -1
- package/build/editor.native.js.map +1 -1
- package/build/store/actions.js +23 -34
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +30 -9
- package/build/store/reducer.js.map +1 -1
- package/build-module/components/block-manager/category.js +3 -3
- package/build-module/components/block-manager/category.js.map +1 -1
- package/build-module/components/block-manager/index.js +2 -2
- package/build-module/components/block-manager/index.js.map +1 -1
- package/build-module/components/device-preview/index.js +3 -0
- package/build-module/components/device-preview/index.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.js +1 -7
- package/build-module/components/header/header-toolbar/index.js.map +1 -1
- package/build-module/components/header/index.js +51 -8
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/writing-menu/index.js +47 -2
- package/build-module/components/header/writing-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +1 -6
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +39 -2
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/index.js +10 -9
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +26 -8
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preferences-modal/options/enable-feature.js +6 -2
- package/build-module/components/preferences-modal/options/enable-feature.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-outline.js +108 -0
- package/build-module/components/secondary-sidebar/list-view-outline.js.map +1 -0
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +34 -12
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/visual-editor/index.js +3 -1
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/editor.js +6 -6
- package/build-module/editor.js.map +1 -1
- package/build-module/editor.native.js +2 -2
- package/build-module/editor.native.js.map +1 -1
- package/build-module/store/actions.js +22 -32
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +31 -8
- package/build-module/store/reducer.js.map +1 -1
- package/build-style/style-rtl.css +92 -6
- package/build-style/style.css +92 -6
- package/package.json +27 -27
- package/src/components/block-manager/category.js +4 -5
- package/src/components/block-manager/index.js +2 -2
- package/src/components/device-preview/index.js +2 -0
- package/src/components/editor-initialization/test/listener-hooks.js +47 -49
- package/src/components/header/fullscreen-mode-close/test/__snapshots__/index.js.snap +26 -0
- package/src/components/header/fullscreen-mode-close/test/index.js +10 -12
- package/src/components/header/header-toolbar/index.js +0 -8
- package/src/components/header/index.js +33 -11
- package/src/components/header/style.scss +43 -0
- package/src/components/header/writing-menu/index.js +53 -2
- package/src/components/keyboard-shortcut-help-modal/shortcut.js +15 -18
- package/src/components/keyboard-shortcuts/index.js +46 -2
- package/src/components/layout/index.js +10 -7
- package/src/components/layout/style.scss +7 -0
- package/src/components/preferences-modal/index.js +35 -19
- package/src/components/preferences-modal/options/enable-feature.js +5 -2
- package/src/components/preferences-modal/options/test/__snapshots__/enable-custom-fields.js.snap +128 -132
- package/src/components/preferences-modal/options/test/enable-custom-fields.js +35 -30
- package/src/components/preferences-modal/test/__snapshots__/index.js.snap +9 -9
- package/src/components/preferences-modal/test/index.js +3 -3
- package/src/components/secondary-sidebar/list-view-outline.js +98 -0
- package/src/components/secondary-sidebar/list-view-sidebar.js +47 -8
- package/src/components/secondary-sidebar/style.scss +64 -8
- package/src/components/sidebar/plugin-post-status-info/test/__snapshots__/index.js.snap +6 -4
- package/src/components/sidebar/plugin-post-status-info/test/index.js +4 -4
- package/src/components/visual-editor/index.js +9 -3
- package/src/editor.js +7 -8
- package/src/editor.native.js +3 -4
- package/src/store/actions.js +17 -23
- package/src/store/reducer.js +29 -9
- package/src/store/test/reducer.js +32 -2
package/src/components/preferences-modal/options/test/__snapshots__/enable-custom-fields.js.snap
CHANGED
|
@@ -41,58 +41,55 @@ exports[`EnableCustomFieldsOption renders a checked checkbox and a confirmation
|
|
|
41
41
|
min-width: 0;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
<div
|
|
45
|
-
className="interface-preferences-modal__option"
|
|
46
|
-
>
|
|
44
|
+
<div>
|
|
47
45
|
<div
|
|
48
|
-
|
|
46
|
+
class="interface-preferences-modal__option"
|
|
49
47
|
>
|
|
50
48
|
<div
|
|
51
|
-
|
|
49
|
+
class="components-base-control components-toggle-control emotion-0 emotion-1"
|
|
52
50
|
>
|
|
53
51
|
<div
|
|
54
|
-
|
|
55
|
-
data-wp-c16t={true}
|
|
56
|
-
data-wp-component="HStack"
|
|
52
|
+
class="components-base-control__field emotion-2 emotion-3"
|
|
57
53
|
>
|
|
58
|
-
<
|
|
59
|
-
|
|
54
|
+
<div
|
|
55
|
+
class="components-flex components-h-stack emotion-4 emotion-5"
|
|
56
|
+
data-wp-c16t="true"
|
|
57
|
+
data-wp-component="HStack"
|
|
60
58
|
>
|
|
61
|
-
<input
|
|
62
|
-
checked={true}
|
|
63
|
-
className="components-form-toggle__input"
|
|
64
|
-
id="inspector-toggle-control-3"
|
|
65
|
-
onChange={[Function]}
|
|
66
|
-
type="checkbox"
|
|
67
|
-
/>
|
|
68
|
-
<span
|
|
69
|
-
className="components-form-toggle__track"
|
|
70
|
-
/>
|
|
71
59
|
<span
|
|
72
|
-
|
|
60
|
+
class="components-form-toggle is-checked"
|
|
61
|
+
>
|
|
62
|
+
<input
|
|
63
|
+
class="components-form-toggle__input"
|
|
64
|
+
id="inspector-toggle-control-3"
|
|
65
|
+
type="checkbox"
|
|
66
|
+
/>
|
|
67
|
+
<span
|
|
68
|
+
class="components-form-toggle__track"
|
|
69
|
+
/>
|
|
70
|
+
<span
|
|
71
|
+
class="components-form-toggle__thumb"
|
|
72
|
+
/>
|
|
73
|
+
</span>
|
|
74
|
+
<label
|
|
75
|
+
class="components-toggle-control__label"
|
|
76
|
+
for="inspector-toggle-control-3"
|
|
73
77
|
/>
|
|
74
|
-
</
|
|
75
|
-
<label
|
|
76
|
-
className="components-toggle-control__label"
|
|
77
|
-
htmlFor="inspector-toggle-control-3"
|
|
78
|
-
/>
|
|
78
|
+
</div>
|
|
79
79
|
</div>
|
|
80
80
|
</div>
|
|
81
|
+
<p
|
|
82
|
+
class="edit-post-preferences-modal__custom-fields-confirmation-message"
|
|
83
|
+
>
|
|
84
|
+
A page reload is required for this change. Make sure your content is saved before reloading.
|
|
85
|
+
</p>
|
|
86
|
+
<button
|
|
87
|
+
class="components-button edit-post-preferences-modal__custom-fields-confirmation-button is-secondary"
|
|
88
|
+
type="button"
|
|
89
|
+
>
|
|
90
|
+
Enable & Reload
|
|
91
|
+
</button>
|
|
81
92
|
</div>
|
|
82
|
-
<p
|
|
83
|
-
className="edit-post-preferences-modal__custom-fields-confirmation-message"
|
|
84
|
-
>
|
|
85
|
-
A page reload is required for this change. Make sure your content is saved before reloading.
|
|
86
|
-
</p>
|
|
87
|
-
<button
|
|
88
|
-
aria-describedby={null}
|
|
89
|
-
className="components-button edit-post-preferences-modal__custom-fields-confirmation-button is-secondary"
|
|
90
|
-
disabled={false}
|
|
91
|
-
onClick={[Function]}
|
|
92
|
-
type="button"
|
|
93
|
-
>
|
|
94
|
-
Enable & Reload
|
|
95
|
-
</button>
|
|
96
93
|
</div>
|
|
97
94
|
`;
|
|
98
95
|
|
|
@@ -137,41 +134,42 @@ exports[`EnableCustomFieldsOption renders a checked checkbox when custom fields
|
|
|
137
134
|
min-width: 0;
|
|
138
135
|
}
|
|
139
136
|
|
|
140
|
-
<div
|
|
141
|
-
className="interface-preferences-modal__option"
|
|
142
|
-
>
|
|
137
|
+
<div>
|
|
143
138
|
<div
|
|
144
|
-
|
|
139
|
+
class="interface-preferences-modal__option"
|
|
145
140
|
>
|
|
146
141
|
<div
|
|
147
|
-
|
|
142
|
+
class="components-base-control components-toggle-control emotion-0 emotion-1"
|
|
148
143
|
>
|
|
149
144
|
<div
|
|
150
|
-
|
|
151
|
-
data-wp-c16t={true}
|
|
152
|
-
data-wp-component="HStack"
|
|
145
|
+
class="components-base-control__field emotion-2 emotion-3"
|
|
153
146
|
>
|
|
154
|
-
<
|
|
155
|
-
|
|
147
|
+
<div
|
|
148
|
+
class="components-flex components-h-stack emotion-4 emotion-5"
|
|
149
|
+
data-wp-c16t="true"
|
|
150
|
+
data-wp-component="HStack"
|
|
156
151
|
>
|
|
157
|
-
<input
|
|
158
|
-
checked={true}
|
|
159
|
-
className="components-form-toggle__input"
|
|
160
|
-
id="inspector-toggle-control-0"
|
|
161
|
-
onChange={[Function]}
|
|
162
|
-
type="checkbox"
|
|
163
|
-
/>
|
|
164
|
-
<span
|
|
165
|
-
className="components-form-toggle__track"
|
|
166
|
-
/>
|
|
167
152
|
<span
|
|
168
|
-
|
|
153
|
+
class="components-form-toggle is-checked"
|
|
154
|
+
>
|
|
155
|
+
<input
|
|
156
|
+
checked=""
|
|
157
|
+
class="components-form-toggle__input"
|
|
158
|
+
id="inspector-toggle-control-0"
|
|
159
|
+
type="checkbox"
|
|
160
|
+
/>
|
|
161
|
+
<span
|
|
162
|
+
class="components-form-toggle__track"
|
|
163
|
+
/>
|
|
164
|
+
<span
|
|
165
|
+
class="components-form-toggle__thumb"
|
|
166
|
+
/>
|
|
167
|
+
</span>
|
|
168
|
+
<label
|
|
169
|
+
class="components-toggle-control__label"
|
|
170
|
+
for="inspector-toggle-control-0"
|
|
169
171
|
/>
|
|
170
|
-
</
|
|
171
|
-
<label
|
|
172
|
-
className="components-toggle-control__label"
|
|
173
|
-
htmlFor="inspector-toggle-control-0"
|
|
174
|
-
/>
|
|
172
|
+
</div>
|
|
175
173
|
</div>
|
|
176
174
|
</div>
|
|
177
175
|
</div>
|
|
@@ -219,58 +217,56 @@ exports[`EnableCustomFieldsOption renders an unchecked checkbox and a confirmati
|
|
|
219
217
|
min-width: 0;
|
|
220
218
|
}
|
|
221
219
|
|
|
222
|
-
<div
|
|
223
|
-
className="interface-preferences-modal__option"
|
|
224
|
-
>
|
|
220
|
+
<div>
|
|
225
221
|
<div
|
|
226
|
-
|
|
222
|
+
class="interface-preferences-modal__option"
|
|
227
223
|
>
|
|
228
224
|
<div
|
|
229
|
-
|
|
225
|
+
class="components-base-control components-toggle-control emotion-0 emotion-1"
|
|
230
226
|
>
|
|
231
227
|
<div
|
|
232
|
-
|
|
233
|
-
data-wp-c16t={true}
|
|
234
|
-
data-wp-component="HStack"
|
|
228
|
+
class="components-base-control__field emotion-2 emotion-3"
|
|
235
229
|
>
|
|
236
|
-
<
|
|
237
|
-
|
|
230
|
+
<div
|
|
231
|
+
class="components-flex components-h-stack emotion-4 emotion-5"
|
|
232
|
+
data-wp-c16t="true"
|
|
233
|
+
data-wp-component="HStack"
|
|
238
234
|
>
|
|
239
|
-
<input
|
|
240
|
-
checked={false}
|
|
241
|
-
className="components-form-toggle__input"
|
|
242
|
-
id="inspector-toggle-control-2"
|
|
243
|
-
onChange={[Function]}
|
|
244
|
-
type="checkbox"
|
|
245
|
-
/>
|
|
246
|
-
<span
|
|
247
|
-
className="components-form-toggle__track"
|
|
248
|
-
/>
|
|
249
235
|
<span
|
|
250
|
-
|
|
236
|
+
class="components-form-toggle"
|
|
237
|
+
>
|
|
238
|
+
<input
|
|
239
|
+
checked=""
|
|
240
|
+
class="components-form-toggle__input"
|
|
241
|
+
id="inspector-toggle-control-2"
|
|
242
|
+
type="checkbox"
|
|
243
|
+
/>
|
|
244
|
+
<span
|
|
245
|
+
class="components-form-toggle__track"
|
|
246
|
+
/>
|
|
247
|
+
<span
|
|
248
|
+
class="components-form-toggle__thumb"
|
|
249
|
+
/>
|
|
250
|
+
</span>
|
|
251
|
+
<label
|
|
252
|
+
class="components-toggle-control__label"
|
|
253
|
+
for="inspector-toggle-control-2"
|
|
251
254
|
/>
|
|
252
|
-
</
|
|
253
|
-
<label
|
|
254
|
-
className="components-toggle-control__label"
|
|
255
|
-
htmlFor="inspector-toggle-control-2"
|
|
256
|
-
/>
|
|
255
|
+
</div>
|
|
257
256
|
</div>
|
|
258
257
|
</div>
|
|
258
|
+
<p
|
|
259
|
+
class="edit-post-preferences-modal__custom-fields-confirmation-message"
|
|
260
|
+
>
|
|
261
|
+
A page reload is required for this change. Make sure your content is saved before reloading.
|
|
262
|
+
</p>
|
|
263
|
+
<button
|
|
264
|
+
class="components-button edit-post-preferences-modal__custom-fields-confirmation-button is-secondary"
|
|
265
|
+
type="button"
|
|
266
|
+
>
|
|
267
|
+
Disable & Reload
|
|
268
|
+
</button>
|
|
259
269
|
</div>
|
|
260
|
-
<p
|
|
261
|
-
className="edit-post-preferences-modal__custom-fields-confirmation-message"
|
|
262
|
-
>
|
|
263
|
-
A page reload is required for this change. Make sure your content is saved before reloading.
|
|
264
|
-
</p>
|
|
265
|
-
<button
|
|
266
|
-
aria-describedby={null}
|
|
267
|
-
className="components-button edit-post-preferences-modal__custom-fields-confirmation-button is-secondary"
|
|
268
|
-
disabled={false}
|
|
269
|
-
onClick={[Function]}
|
|
270
|
-
type="button"
|
|
271
|
-
>
|
|
272
|
-
Disable & Reload
|
|
273
|
-
</button>
|
|
274
270
|
</div>
|
|
275
271
|
`;
|
|
276
272
|
|
|
@@ -315,41 +311,41 @@ exports[`EnableCustomFieldsOption renders an unchecked checkbox when custom fiel
|
|
|
315
311
|
min-width: 0;
|
|
316
312
|
}
|
|
317
313
|
|
|
318
|
-
<div
|
|
319
|
-
className="interface-preferences-modal__option"
|
|
320
|
-
>
|
|
314
|
+
<div>
|
|
321
315
|
<div
|
|
322
|
-
|
|
316
|
+
class="interface-preferences-modal__option"
|
|
323
317
|
>
|
|
324
318
|
<div
|
|
325
|
-
|
|
319
|
+
class="components-base-control components-toggle-control emotion-0 emotion-1"
|
|
326
320
|
>
|
|
327
321
|
<div
|
|
328
|
-
|
|
329
|
-
data-wp-c16t={true}
|
|
330
|
-
data-wp-component="HStack"
|
|
322
|
+
class="components-base-control__field emotion-2 emotion-3"
|
|
331
323
|
>
|
|
332
|
-
<
|
|
333
|
-
|
|
324
|
+
<div
|
|
325
|
+
class="components-flex components-h-stack emotion-4 emotion-5"
|
|
326
|
+
data-wp-c16t="true"
|
|
327
|
+
data-wp-component="HStack"
|
|
334
328
|
>
|
|
335
|
-
<input
|
|
336
|
-
checked={false}
|
|
337
|
-
className="components-form-toggle__input"
|
|
338
|
-
id="inspector-toggle-control-1"
|
|
339
|
-
onChange={[Function]}
|
|
340
|
-
type="checkbox"
|
|
341
|
-
/>
|
|
342
|
-
<span
|
|
343
|
-
className="components-form-toggle__track"
|
|
344
|
-
/>
|
|
345
329
|
<span
|
|
346
|
-
|
|
330
|
+
class="components-form-toggle"
|
|
331
|
+
>
|
|
332
|
+
<input
|
|
333
|
+
class="components-form-toggle__input"
|
|
334
|
+
id="inspector-toggle-control-1"
|
|
335
|
+
type="checkbox"
|
|
336
|
+
/>
|
|
337
|
+
<span
|
|
338
|
+
class="components-form-toggle__track"
|
|
339
|
+
/>
|
|
340
|
+
<span
|
|
341
|
+
class="components-form-toggle__thumb"
|
|
342
|
+
/>
|
|
343
|
+
</span>
|
|
344
|
+
<label
|
|
345
|
+
class="components-toggle-control__label"
|
|
346
|
+
for="inspector-toggle-control-1"
|
|
347
347
|
/>
|
|
348
|
-
</
|
|
349
|
-
<label
|
|
350
|
-
className="components-toggle-control__label"
|
|
351
|
-
htmlFor="inspector-toggle-control-1"
|
|
352
|
-
/>
|
|
348
|
+
</div>
|
|
353
349
|
</div>
|
|
354
350
|
</div>
|
|
355
351
|
</div>
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { Button } from '@wordpress/components';
|
|
10
|
-
import { ___unstablePreferencesModalBaseOption as BaseOption } from '@wordpress/interface';
|
|
4
|
+
import { render, screen } from '@testing-library/react';
|
|
5
|
+
import userEvent from '@testing-library/user-event';
|
|
11
6
|
|
|
12
7
|
/**
|
|
13
8
|
* Internal dependencies
|
|
@@ -19,42 +14,55 @@ import {
|
|
|
19
14
|
|
|
20
15
|
describe( 'EnableCustomFieldsOption', () => {
|
|
21
16
|
it( 'renders a checked checkbox when custom fields are enabled', () => {
|
|
22
|
-
const
|
|
17
|
+
const { container } = render(
|
|
23
18
|
<EnableCustomFieldsOption areCustomFieldsEnabled />
|
|
24
19
|
);
|
|
25
|
-
|
|
20
|
+
|
|
21
|
+
expect( container ).toMatchSnapshot();
|
|
26
22
|
} );
|
|
27
23
|
|
|
28
24
|
it( 'renders an unchecked checkbox when custom fields are disabled', () => {
|
|
29
|
-
const
|
|
25
|
+
const { container } = render(
|
|
30
26
|
<EnableCustomFieldsOption areCustomFieldsEnabled={ false } />
|
|
31
27
|
);
|
|
32
|
-
|
|
28
|
+
|
|
29
|
+
expect( container ).toMatchSnapshot();
|
|
33
30
|
} );
|
|
34
31
|
|
|
35
|
-
it( 'renders an unchecked checkbox and a confirmation message when toggled off', () => {
|
|
36
|
-
const
|
|
32
|
+
it( 'renders an unchecked checkbox and a confirmation message when toggled off', async () => {
|
|
33
|
+
const user = userEvent.setup( {
|
|
34
|
+
advanceTimers: jest.advanceTimersByTime,
|
|
35
|
+
} );
|
|
36
|
+
|
|
37
|
+
const { container } = render(
|
|
37
38
|
<EnableCustomFieldsOption areCustomFieldsEnabled />
|
|
38
39
|
);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
expect(
|
|
40
|
+
|
|
41
|
+
await user.click( screen.getByRole( 'checkbox' ) );
|
|
42
|
+
|
|
43
|
+
expect( container ).toMatchSnapshot();
|
|
43
44
|
} );
|
|
44
45
|
|
|
45
|
-
it( 'renders a checked checkbox and a confirmation message when toggled on', () => {
|
|
46
|
-
const
|
|
46
|
+
it( 'renders a checked checkbox and a confirmation message when toggled on', async () => {
|
|
47
|
+
const user = userEvent.setup( {
|
|
48
|
+
advanceTimers: jest.advanceTimersByTime,
|
|
49
|
+
} );
|
|
50
|
+
|
|
51
|
+
const { container } = render(
|
|
47
52
|
<EnableCustomFieldsOption areCustomFieldsEnabled={ false } />
|
|
48
53
|
);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
expect(
|
|
54
|
+
|
|
55
|
+
await user.click( screen.getByRole( 'checkbox' ) );
|
|
56
|
+
|
|
57
|
+
expect( container ).toMatchSnapshot();
|
|
53
58
|
} );
|
|
54
59
|
} );
|
|
55
60
|
|
|
56
61
|
describe( 'CustomFieldsConfirmation', () => {
|
|
57
|
-
it( 'submits the toggle-custom-fields-form', () => {
|
|
62
|
+
it( 'submits the toggle-custom-fields-form', async () => {
|
|
63
|
+
const user = userEvent.setup( {
|
|
64
|
+
advanceTimers: jest.advanceTimersByTime,
|
|
65
|
+
} );
|
|
58
66
|
const submit = jest.fn();
|
|
59
67
|
const getElementById = jest
|
|
60
68
|
.spyOn( document, 'getElementById' )
|
|
@@ -62,12 +70,9 @@ describe( 'CustomFieldsConfirmation', () => {
|
|
|
62
70
|
submit,
|
|
63
71
|
} ) );
|
|
64
72
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
);
|
|
68
|
-
act( () => {
|
|
69
|
-
renderer.root.findByType( Button ).props.onClick();
|
|
70
|
-
} );
|
|
73
|
+
render( <CustomFieldsConfirmation /> );
|
|
74
|
+
|
|
75
|
+
await user.click( screen.getByRole( 'button' ) );
|
|
71
76
|
|
|
72
77
|
expect( getElementById ).toHaveBeenCalledWith(
|
|
73
78
|
'toggle-custom-fields-form'
|
|
@@ -253,7 +253,7 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
|
|
|
253
253
|
class="components-toggle-control__label"
|
|
254
254
|
for="inspector-toggle-control-1"
|
|
255
255
|
>
|
|
256
|
-
|
|
256
|
+
Distraction Free
|
|
257
257
|
</label>
|
|
258
258
|
</div>
|
|
259
259
|
</div>
|
|
@@ -261,7 +261,7 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
|
|
|
261
261
|
class="components-base-control__help emotion-6 emotion-7"
|
|
262
262
|
id="inspector-toggle-control-1__help"
|
|
263
263
|
>
|
|
264
|
-
|
|
264
|
+
Reduce visual distractions by hiding the toolbar and other elements to focus on writing.
|
|
265
265
|
</p>
|
|
266
266
|
</div>
|
|
267
267
|
</div>
|
|
@@ -299,7 +299,7 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
|
|
|
299
299
|
class="components-toggle-control__label"
|
|
300
300
|
for="inspector-toggle-control-2"
|
|
301
301
|
>
|
|
302
|
-
|
|
302
|
+
Spotlight mode
|
|
303
303
|
</label>
|
|
304
304
|
</div>
|
|
305
305
|
</div>
|
|
@@ -307,7 +307,7 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
|
|
|
307
307
|
class="components-base-control__help emotion-6 emotion-7"
|
|
308
308
|
id="inspector-toggle-control-2__help"
|
|
309
309
|
>
|
|
310
|
-
|
|
310
|
+
Highlights the current block and fades other content.
|
|
311
311
|
</p>
|
|
312
312
|
</div>
|
|
313
313
|
</div>
|
|
@@ -345,7 +345,7 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
|
|
|
345
345
|
class="components-toggle-control__label"
|
|
346
346
|
for="inspector-toggle-control-3"
|
|
347
347
|
>
|
|
348
|
-
|
|
348
|
+
Show button text labels
|
|
349
349
|
</label>
|
|
350
350
|
</div>
|
|
351
351
|
</div>
|
|
@@ -353,7 +353,7 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
|
|
|
353
353
|
class="components-base-control__help emotion-6 emotion-7"
|
|
354
354
|
id="inspector-toggle-control-3__help"
|
|
355
355
|
>
|
|
356
|
-
|
|
356
|
+
Show text instead of icons on buttons.
|
|
357
357
|
</p>
|
|
358
358
|
</div>
|
|
359
359
|
</div>
|
|
@@ -391,7 +391,7 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
|
|
|
391
391
|
class="components-toggle-control__label"
|
|
392
392
|
for="inspector-toggle-control-4"
|
|
393
393
|
>
|
|
394
|
-
|
|
394
|
+
Always open list view
|
|
395
395
|
</label>
|
|
396
396
|
</div>
|
|
397
397
|
</div>
|
|
@@ -399,7 +399,7 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
|
|
|
399
399
|
class="components-base-control__help emotion-6 emotion-7"
|
|
400
400
|
id="inspector-toggle-control-4__help"
|
|
401
401
|
>
|
|
402
|
-
|
|
402
|
+
Opens the block list view sidebar by default.
|
|
403
403
|
</p>
|
|
404
404
|
</div>
|
|
405
405
|
</div>
|
|
@@ -570,7 +570,7 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
|
|
|
570
570
|
border: 1px solid transparent;
|
|
571
571
|
cursor: pointer;
|
|
572
572
|
background: none;
|
|
573
|
-
text-align:
|
|
573
|
+
text-align: start;
|
|
574
574
|
padding: calc((36px - calc(13px * 1.2) - 2px) / 2) 12px;
|
|
575
575
|
width: 100%;
|
|
576
576
|
display: block;
|
|
@@ -21,7 +21,7 @@ jest.mock( '@wordpress/compose/src/hooks/use-viewport-match', () => jest.fn() );
|
|
|
21
21
|
describe( 'EditPostPreferencesModal', () => {
|
|
22
22
|
describe( 'should match snapshot when the modal is active', () => {
|
|
23
23
|
it( 'large viewports', () => {
|
|
24
|
-
useSelect.mockImplementation( () => true );
|
|
24
|
+
useSelect.mockImplementation( () => [ true, true, false ] );
|
|
25
25
|
useViewportMatch.mockImplementation( () => true );
|
|
26
26
|
render( <EditPostPreferencesModal /> );
|
|
27
27
|
expect(
|
|
@@ -29,7 +29,7 @@ describe( 'EditPostPreferencesModal', () => {
|
|
|
29
29
|
).toMatchSnapshot();
|
|
30
30
|
} );
|
|
31
31
|
it( 'small viewports', () => {
|
|
32
|
-
useSelect.mockImplementation( () => true );
|
|
32
|
+
useSelect.mockImplementation( () => [ true, true, false ] );
|
|
33
33
|
useViewportMatch.mockImplementation( () => false );
|
|
34
34
|
render( <EditPostPreferencesModal /> );
|
|
35
35
|
expect(
|
|
@@ -39,7 +39,7 @@ describe( 'EditPostPreferencesModal', () => {
|
|
|
39
39
|
} );
|
|
40
40
|
|
|
41
41
|
it( 'should not render when the modal is not active', () => {
|
|
42
|
-
useSelect.mockImplementation( () => false );
|
|
42
|
+
useSelect.mockImplementation( () => [ false, false, false ] );
|
|
43
43
|
render( <EditPostPreferencesModal /> );
|
|
44
44
|
expect(
|
|
45
45
|
screen.queryByRole( 'dialog', { name: 'Preferences' } )
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useSelect } from '@wordpress/data';
|
|
5
|
+
import {
|
|
6
|
+
DocumentOutline,
|
|
7
|
+
WordCount,
|
|
8
|
+
TimeToRead,
|
|
9
|
+
CharacterCount,
|
|
10
|
+
} from '@wordpress/editor';
|
|
11
|
+
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
12
|
+
import {
|
|
13
|
+
__experimentalText as Text,
|
|
14
|
+
Path,
|
|
15
|
+
SVG,
|
|
16
|
+
Line,
|
|
17
|
+
Rect,
|
|
18
|
+
} from '@wordpress/components';
|
|
19
|
+
import { __ } from '@wordpress/i18n';
|
|
20
|
+
|
|
21
|
+
function EmptyOutlineIllustration() {
|
|
22
|
+
return (
|
|
23
|
+
<SVG
|
|
24
|
+
width="138"
|
|
25
|
+
height="148"
|
|
26
|
+
viewBox="0 0 138 148"
|
|
27
|
+
fill="none"
|
|
28
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
29
|
+
>
|
|
30
|
+
<Rect width="138" height="148" rx="4" fill="#F0F6FC" />
|
|
31
|
+
<Line x1="44" y1="28" x2="24" y2="28" stroke="#DDDDDD" />
|
|
32
|
+
<Rect x="48" y="16" width="27" height="23" rx="4" fill="#DDDDDD" />
|
|
33
|
+
<Path
|
|
34
|
+
d="M54.7585 32V23.2727H56.6037V26.8736H60.3494V23.2727H62.1903V32H60.3494V28.3949H56.6037V32H54.7585ZM67.4574 23.2727V32H65.6122V25.0241H65.5611L63.5625 26.277V24.6406L65.723 23.2727H67.4574Z"
|
|
35
|
+
fill="black"
|
|
36
|
+
/>
|
|
37
|
+
<Line x1="55" y1="59" x2="24" y2="59" stroke="#DDDDDD" />
|
|
38
|
+
<Rect x="59" y="47" width="29" height="23" rx="4" fill="#DDDDDD" />
|
|
39
|
+
<Path
|
|
40
|
+
d="M65.7585 63V54.2727H67.6037V57.8736H71.3494V54.2727H73.1903V63H71.3494V59.3949H67.6037V63H65.7585ZM74.6605 63V61.6705L77.767 58.794C78.0313 58.5384 78.2528 58.3082 78.4318 58.1037C78.6136 57.8991 78.7514 57.6989 78.8452 57.5028C78.9389 57.304 78.9858 57.0895 78.9858 56.8594C78.9858 56.6037 78.9276 56.3835 78.8111 56.1989C78.6946 56.0114 78.5355 55.8679 78.3338 55.7685C78.1321 55.6662 77.9034 55.6151 77.6477 55.6151C77.3807 55.6151 77.1477 55.669 76.9489 55.777C76.75 55.8849 76.5966 56.0398 76.4886 56.2415C76.3807 56.4432 76.3267 56.6832 76.3267 56.9616H74.5753C74.5753 56.3906 74.7045 55.8949 74.9631 55.4744C75.2216 55.054 75.5838 54.7287 76.0497 54.4986C76.5156 54.2685 77.0526 54.1534 77.6605 54.1534C78.2855 54.1534 78.8295 54.2642 79.2926 54.4858C79.7585 54.7045 80.1207 55.0085 80.3793 55.3977C80.6378 55.7869 80.767 56.233 80.767 56.7358C80.767 57.0653 80.7017 57.3906 80.571 57.7116C80.4432 58.0327 80.2145 58.3892 79.8849 58.7812C79.5554 59.1705 79.0909 59.6378 78.4915 60.1832L77.2173 61.4318V61.4915H80.8821V63H74.6605Z"
|
|
41
|
+
fill="black"
|
|
42
|
+
/>
|
|
43
|
+
<Line x1="80" y1="90" x2="24" y2="90" stroke="#DDDDDD" />
|
|
44
|
+
<Rect x="84" y="78" width="30" height="23" rx="4" fill="#F0B849" />
|
|
45
|
+
<Path
|
|
46
|
+
d="M90.7585 94V85.2727H92.6037V88.8736H96.3494V85.2727H98.1903V94H96.3494V90.3949H92.6037V94H90.7585ZM99.5284 92.4659V91.0128L103.172 85.2727H104.425V87.2841H103.683L101.386 90.919V90.9872H106.564V92.4659H99.5284ZM103.717 94V92.0227L103.751 91.3793V85.2727H105.482V94H103.717Z"
|
|
47
|
+
fill="black"
|
|
48
|
+
/>
|
|
49
|
+
<Line x1="66" y1="121" x2="24" y2="121" stroke="#DDDDDD" />
|
|
50
|
+
<Rect x="70" y="109" width="29" height="23" rx="4" fill="#DDDDDD" />
|
|
51
|
+
<Path
|
|
52
|
+
d="M76.7585 125V116.273H78.6037V119.874H82.3494V116.273H84.1903V125H82.3494V121.395H78.6037V125H76.7585ZM88.8864 125.119C88.25 125.119 87.6832 125.01 87.1861 124.791C86.6918 124.57 86.3011 124.266 86.0142 123.879C85.7301 123.49 85.5838 123.041 85.5753 122.533H87.4332C87.4446 122.746 87.5142 122.933 87.642 123.095C87.7727 123.254 87.946 123.378 88.1619 123.466C88.3778 123.554 88.6207 123.598 88.8906 123.598C89.1719 123.598 89.4205 123.548 89.6364 123.449C89.8523 123.349 90.0213 123.212 90.1435 123.036C90.2656 122.859 90.3267 122.656 90.3267 122.426C90.3267 122.193 90.2614 121.987 90.1307 121.808C90.0028 121.626 89.8182 121.484 89.5767 121.382C89.3381 121.28 89.054 121.229 88.7244 121.229H87.9105V119.874H88.7244C89.0028 119.874 89.2486 119.825 89.4616 119.729C89.6776 119.632 89.8452 119.499 89.9645 119.328C90.0838 119.155 90.1435 118.953 90.1435 118.723C90.1435 118.504 90.0909 118.312 89.9858 118.148C89.8835 117.98 89.7386 117.849 89.5511 117.756C89.3665 117.662 89.1506 117.615 88.9034 117.615C88.6534 117.615 88.4247 117.661 88.2173 117.751C88.0099 117.839 87.8438 117.966 87.7188 118.131C87.5938 118.295 87.527 118.489 87.5185 118.71H85.75C85.7585 118.207 85.902 117.764 86.1804 117.381C86.4588 116.997 86.8338 116.697 87.3054 116.482C87.7798 116.263 88.3153 116.153 88.9119 116.153C89.5142 116.153 90.0412 116.263 90.4929 116.482C90.9446 116.7 91.2955 116.996 91.5455 117.368C91.7983 117.737 91.9233 118.152 91.9205 118.612C91.9233 119.101 91.7713 119.509 91.4645 119.835C91.1605 120.162 90.7642 120.369 90.2756 120.457V120.526C90.9176 120.608 91.4063 120.831 91.7415 121.195C92.0795 121.555 92.2472 122.007 92.2443 122.55C92.2472 123.047 92.1037 123.489 91.8139 123.875C91.527 124.261 91.1307 124.565 90.625 124.787C90.1193 125.009 89.5398 125.119 88.8864 125.119Z"
|
|
53
|
+
fill="black"
|
|
54
|
+
/>
|
|
55
|
+
</SVG>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export default function ListViewOutline() {
|
|
60
|
+
const { headingCount } = useSelect( ( select ) => {
|
|
61
|
+
const { getGlobalBlockCount } = select( blockEditorStore );
|
|
62
|
+
return {
|
|
63
|
+
headingCount: getGlobalBlockCount( 'core/heading' ),
|
|
64
|
+
};
|
|
65
|
+
}, [] );
|
|
66
|
+
return (
|
|
67
|
+
<>
|
|
68
|
+
{ headingCount > 0 ? (
|
|
69
|
+
<DocumentOutline />
|
|
70
|
+
) : (
|
|
71
|
+
<div className="edit-post-editor__list-view-empty-headings">
|
|
72
|
+
<EmptyOutlineIllustration />
|
|
73
|
+
<p>
|
|
74
|
+
{ __(
|
|
75
|
+
'Navigate the structure of your document and address issues like empty or incorrect heading levels.'
|
|
76
|
+
) }
|
|
77
|
+
</p>
|
|
78
|
+
</div>
|
|
79
|
+
) }
|
|
80
|
+
<div className="edit-post-editor__list-view-overview">
|
|
81
|
+
<div>
|
|
82
|
+
<Text>{ __( 'Characters:' ) }</Text>
|
|
83
|
+
<Text>
|
|
84
|
+
<CharacterCount />
|
|
85
|
+
</Text>
|
|
86
|
+
</div>
|
|
87
|
+
<div>
|
|
88
|
+
<Text>{ __( 'Words:' ) }</Text>
|
|
89
|
+
<WordCount />
|
|
90
|
+
</div>
|
|
91
|
+
<div>
|
|
92
|
+
<Text>{ __( 'Time to read:' ) }</Text>
|
|
93
|
+
<TimeToRead />
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
</>
|
|
97
|
+
);
|
|
98
|
+
}
|