@wordpress/edit-post 6.14.1 → 6.15.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/keyboard-shortcut-help-modal/index.js +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/visual-editor/index.js +16 -4
- package/build/components/visual-editor/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/visual-editor/index.js +16 -4
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/package.json +27 -27
- package/src/components/keyboard-shortcut-help-modal/index.js +1 -1
- package/src/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap +823 -101
- package/src/components/keyboard-shortcut-help-modal/test/index.js +31 -14
- package/src/components/visual-editor/index.js +28 -13
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { render, screen } from '@testing-library/react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { EditorKeyboardShortcutsRegister } from '@wordpress/editor';
|
|
10
|
+
import { ShortcutProvider } from '@wordpress/keyboard-shortcuts';
|
|
5
11
|
|
|
6
12
|
/**
|
|
7
13
|
* Internal dependencies
|
|
@@ -12,24 +18,35 @@ const noop = () => {};
|
|
|
12
18
|
|
|
13
19
|
describe( 'KeyboardShortcutHelpModal', () => {
|
|
14
20
|
it( 'should match snapshot when the modal is active', () => {
|
|
15
|
-
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
toggleModal={ noop }
|
|
19
|
-
|
|
21
|
+
render(
|
|
22
|
+
<ShortcutProvider>
|
|
23
|
+
<EditorKeyboardShortcutsRegister />
|
|
24
|
+
<KeyboardShortcutHelpModal isModalActive toggleModal={ noop } />
|
|
25
|
+
</ShortcutProvider>
|
|
20
26
|
);
|
|
21
27
|
|
|
22
|
-
expect(
|
|
28
|
+
expect(
|
|
29
|
+
screen.getByRole( 'dialog', {
|
|
30
|
+
name: 'Keyboard shortcuts',
|
|
31
|
+
} )
|
|
32
|
+
).toMatchSnapshot();
|
|
23
33
|
} );
|
|
24
34
|
|
|
25
|
-
it( 'should
|
|
26
|
-
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
35
|
+
it( 'should not render the modal when inactive', () => {
|
|
36
|
+
render(
|
|
37
|
+
<ShortcutProvider>
|
|
38
|
+
<EditorKeyboardShortcutsRegister />
|
|
39
|
+
<KeyboardShortcutHelpModal
|
|
40
|
+
isModalActive={ false }
|
|
41
|
+
toggleModal={ noop }
|
|
42
|
+
/>
|
|
43
|
+
</ShortcutProvider>
|
|
31
44
|
);
|
|
32
45
|
|
|
33
|
-
expect(
|
|
46
|
+
expect(
|
|
47
|
+
screen.queryByRole( 'dialog', {
|
|
48
|
+
name: 'Keyboard shortcuts',
|
|
49
|
+
} )
|
|
50
|
+
).not.toBeInTheDocument();
|
|
34
51
|
} );
|
|
35
52
|
} );
|
|
@@ -118,15 +118,23 @@ export default function VisualEditor( { styles } ) {
|
|
|
118
118
|
( select ) => select( editPostStore ).hasMetaBoxes(),
|
|
119
119
|
[]
|
|
120
120
|
);
|
|
121
|
-
const {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
121
|
+
const {
|
|
122
|
+
themeHasDisabledLayoutStyles,
|
|
123
|
+
themeSupportsLayout,
|
|
124
|
+
assets,
|
|
125
|
+
useRootPaddingAwareAlignments,
|
|
126
|
+
isFocusMode,
|
|
127
|
+
} = useSelect( ( select ) => {
|
|
128
|
+
const _settings = select( blockEditorStore ).getSettings();
|
|
129
|
+
return {
|
|
130
|
+
themeHasDisabledLayoutStyles: _settings.disableLayoutStyles,
|
|
131
|
+
themeSupportsLayout: _settings.supportsLayout,
|
|
132
|
+
assets: _settings.__unstableResolvedAssets,
|
|
133
|
+
useRootPaddingAwareAlignments:
|
|
134
|
+
_settings.__experimentalFeatures?.useRootPaddingAwareAlignments,
|
|
135
|
+
isFocusMode: _settings.focusMode,
|
|
136
|
+
};
|
|
137
|
+
}, [] );
|
|
130
138
|
const { clearSelectedBlock } = useDispatch( blockEditorStore );
|
|
131
139
|
const { setIsEditingTemplate } = useDispatch( editPostStore );
|
|
132
140
|
const desktopCanvasStyles = {
|
|
@@ -189,9 +197,11 @@ export default function VisualEditor( { styles } ) {
|
|
|
189
197
|
return { type: 'default' };
|
|
190
198
|
}, [ isTemplateMode, themeSupportsLayout, defaultLayout ] );
|
|
191
199
|
|
|
192
|
-
const blockListLayoutClass =
|
|
193
|
-
|
|
194
|
-
|
|
200
|
+
const blockListLayoutClass = classnames( {
|
|
201
|
+
'is-layout-constrained': themeSupportsLayout,
|
|
202
|
+
'is-layout-flow': ! themeSupportsLayout,
|
|
203
|
+
'has-global-padding': useRootPaddingAwareAlignments,
|
|
204
|
+
} );
|
|
195
205
|
|
|
196
206
|
const titleRef = useRef();
|
|
197
207
|
useEffect( () => {
|
|
@@ -257,7 +267,12 @@ export default function VisualEditor( { styles } ) {
|
|
|
257
267
|
) }
|
|
258
268
|
{ ! isTemplateMode && (
|
|
259
269
|
<div
|
|
260
|
-
className=
|
|
270
|
+
className={ classnames(
|
|
271
|
+
'edit-post-visual-editor__post-title-wrapper',
|
|
272
|
+
{
|
|
273
|
+
'is-focus-mode': isFocusMode,
|
|
274
|
+
}
|
|
275
|
+
) }
|
|
261
276
|
contentEditable={ false }
|
|
262
277
|
>
|
|
263
278
|
<PostTitle ref={ titleRef } />
|