@wordpress/edit-post 6.17.0 → 6.19.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 +8 -0
- package/build/components/block-manager/category.js +4 -12
- package/build/components/block-manager/category.js.map +1 -1
- package/build/components/block-manager/checklist.js +4 -3
- package/build/components/block-manager/checklist.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/header/header-toolbar/index.js +2 -8
- package/build/components/header/header-toolbar/index.js.map +1 -1
- package/build/components/header/index.js +5 -4
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/more-menu/index.js +1 -3
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/components/header/writing-menu/index.js +13 -14
- package/build/components/header/writing-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +12 -0
- package/build/components/keyboard-shortcut-help-modal/config.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 +71 -5
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/index.js +2 -7
- package/build/components/layout/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +1 -1
- package/build/components/preferences-modal/index.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 +38 -13
- 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/store/actions.js +24 -41
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +29 -8
- package/build/store/reducer.js.map +1 -1
- package/build-module/components/block-manager/category.js +5 -13
- package/build-module/components/block-manager/category.js.map +1 -1
- package/build-module/components/block-manager/checklist.js +5 -4
- package/build-module/components/block-manager/checklist.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/header/header-toolbar/index.js +3 -9
- package/build-module/components/header/header-toolbar/index.js.map +1 -1
- package/build-module/components/header/index.js +5 -4
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/more-menu/index.js +1 -3
- package/build-module/components/header/more-menu/index.js.map +1 -1
- package/build-module/components/header/writing-menu/index.js +13 -14
- package/build-module/components/header/writing-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +12 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.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 +71 -6
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/index.js +2 -7
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +1 -1
- package/build-module/components/preferences-modal/index.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 +36 -14
- 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/store/actions.js +22 -37
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +30 -7
- package/build-module/store/reducer.js.map +1 -1
- package/build-style/style-rtl.css +96 -40
- package/build-style/style.css +96 -40
- package/package.json +27 -27
- package/src/components/block-manager/category.js +5 -12
- package/src/components/block-manager/checklist.js +3 -6
- package/src/components/block-manager/index.js +2 -2
- package/src/components/block-manager/style.scss +4 -15
- 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 +2 -10
- package/src/components/header/index.js +4 -1
- package/src/components/header/more-menu/index.js +1 -1
- package/src/components/header/style.scss +3 -9
- package/src/components/header/writing-menu/index.js +13 -11
- package/src/components/keyboard-shortcut-help-modal/config.js +10 -0
- package/src/components/keyboard-shortcut-help-modal/shortcut.js +15 -18
- package/src/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap +70 -0
- package/src/components/keyboard-shortcuts/index.js +77 -8
- package/src/components/layout/index.js +2 -9
- package/src/components/layout/style.scss +12 -1
- package/src/components/preferences-modal/index.js +1 -1
- package/src/components/preferences-modal/test/__snapshots__/index.js.snap +52 -47
- package/src/components/secondary-sidebar/list-view-outline.js +98 -0
- package/src/components/secondary-sidebar/list-view-sidebar.js +49 -10
- package/src/components/secondary-sidebar/style.scss +67 -11
- 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 +1 -1
- package/src/components/sidebar/plugin-pre-publish-panel/test/index.js +8 -6
- package/src/components/visual-editor/index.js +9 -3
- package/src/components/visual-editor/test/index.native.js +13 -13
- package/src/store/actions.js +21 -35
- package/src/store/reducer.js +28 -8
- package/src/store/test/reducer.js +32 -2
- package/src/components/sidebar/plugin-pre-publish-panel/test/__snapshots__/index.js.snap +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-post",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.19.0",
|
|
4
4
|
"description": "Edit Post module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -27,31 +27,31 @@
|
|
|
27
27
|
"react-native": "src/index",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@babel/runtime": "^7.16.0",
|
|
30
|
-
"@wordpress/a11y": "^3.
|
|
31
|
-
"@wordpress/api-fetch": "^6.
|
|
32
|
-
"@wordpress/block-editor": "^10.
|
|
33
|
-
"@wordpress/block-library": "^7.
|
|
34
|
-
"@wordpress/blocks": "^11.
|
|
35
|
-
"@wordpress/components": "^
|
|
36
|
-
"@wordpress/compose": "^5.
|
|
37
|
-
"@wordpress/core-data": "^5.
|
|
38
|
-
"@wordpress/data": "^7.
|
|
39
|
-
"@wordpress/deprecated": "^3.
|
|
40
|
-
"@wordpress/editor": "^12.
|
|
41
|
-
"@wordpress/element": "^4.
|
|
42
|
-
"@wordpress/hooks": "^3.
|
|
43
|
-
"@wordpress/i18n": "^4.
|
|
44
|
-
"@wordpress/icons": "^9.
|
|
45
|
-
"@wordpress/interface": "^4.
|
|
46
|
-
"@wordpress/keyboard-shortcuts": "^3.
|
|
47
|
-
"@wordpress/keycodes": "^3.
|
|
48
|
-
"@wordpress/media-utils": "^4.
|
|
49
|
-
"@wordpress/notices": "^3.
|
|
50
|
-
"@wordpress/plugins": "^4.
|
|
51
|
-
"@wordpress/preferences": "^2.
|
|
52
|
-
"@wordpress/url": "^3.
|
|
53
|
-
"@wordpress/viewport": "^4.
|
|
54
|
-
"@wordpress/warning": "^2.
|
|
30
|
+
"@wordpress/a11y": "^3.22.0",
|
|
31
|
+
"@wordpress/api-fetch": "^6.19.0",
|
|
32
|
+
"@wordpress/block-editor": "^10.5.0",
|
|
33
|
+
"@wordpress/block-library": "^7.19.0",
|
|
34
|
+
"@wordpress/blocks": "^11.21.0",
|
|
35
|
+
"@wordpress/components": "^22.1.0",
|
|
36
|
+
"@wordpress/compose": "^5.20.0",
|
|
37
|
+
"@wordpress/core-data": "^5.5.0",
|
|
38
|
+
"@wordpress/data": "^7.6.0",
|
|
39
|
+
"@wordpress/deprecated": "^3.22.0",
|
|
40
|
+
"@wordpress/editor": "^12.21.0",
|
|
41
|
+
"@wordpress/element": "^4.20.0",
|
|
42
|
+
"@wordpress/hooks": "^3.22.0",
|
|
43
|
+
"@wordpress/i18n": "^4.22.0",
|
|
44
|
+
"@wordpress/icons": "^9.13.0",
|
|
45
|
+
"@wordpress/interface": "^4.21.0",
|
|
46
|
+
"@wordpress/keyboard-shortcuts": "^3.20.0",
|
|
47
|
+
"@wordpress/keycodes": "^3.22.0",
|
|
48
|
+
"@wordpress/media-utils": "^4.13.0",
|
|
49
|
+
"@wordpress/notices": "^3.22.0",
|
|
50
|
+
"@wordpress/plugins": "^4.20.0",
|
|
51
|
+
"@wordpress/preferences": "^2.14.0",
|
|
52
|
+
"@wordpress/url": "^3.23.0",
|
|
53
|
+
"@wordpress/viewport": "^4.20.0",
|
|
54
|
+
"@wordpress/warning": "^2.22.0",
|
|
55
55
|
"classnames": "^2.3.1",
|
|
56
56
|
"lodash": "^4.17.21",
|
|
57
57
|
"memize": "^1.1.0",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"access": "public"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "7ac04f446242452d3cb24372f9ca58f0cae97715"
|
|
68
68
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { map } from 'lodash';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -37,7 +37,7 @@ function BlockManagerCategory( { title, blockTypes } ) {
|
|
|
37
37
|
return blockTypes;
|
|
38
38
|
}
|
|
39
39
|
return blockTypes.filter( ( { name } ) => {
|
|
40
|
-
return includes(
|
|
40
|
+
return defaultAllowedBlockTypes?.includes( name );
|
|
41
41
|
} );
|
|
42
42
|
}, [ defaultAllowedBlockTypes, blockTypes ] );
|
|
43
43
|
const { showBlockTypes, hideBlockTypes } = useDispatch( editPostStore );
|
|
@@ -71,15 +71,7 @@ function BlockManagerCategory( { title, blockTypes } ) {
|
|
|
71
71
|
const titleId = 'edit-post-block-manager__category-title-' + instanceId;
|
|
72
72
|
|
|
73
73
|
const isAllChecked = checkedBlockNames.length === filteredBlockTypes.length;
|
|
74
|
-
|
|
75
|
-
let ariaChecked;
|
|
76
|
-
if ( isAllChecked ) {
|
|
77
|
-
ariaChecked = 'true';
|
|
78
|
-
} else if ( checkedBlockNames.length > 0 ) {
|
|
79
|
-
ariaChecked = 'mixed';
|
|
80
|
-
} else {
|
|
81
|
-
ariaChecked = 'false';
|
|
82
|
-
}
|
|
74
|
+
const isIndeterminate = ! isAllChecked && checkedBlockNames.length > 0;
|
|
83
75
|
|
|
84
76
|
return (
|
|
85
77
|
<div
|
|
@@ -88,10 +80,11 @@ function BlockManagerCategory( { title, blockTypes } ) {
|
|
|
88
80
|
className="edit-post-block-manager__category"
|
|
89
81
|
>
|
|
90
82
|
<CheckboxControl
|
|
83
|
+
__nextHasNoMarginBottom
|
|
91
84
|
checked={ isAllChecked }
|
|
92
85
|
onChange={ toggleAllVisible }
|
|
93
86
|
className="edit-post-block-manager__category-title"
|
|
94
|
-
|
|
87
|
+
indeterminate={ isIndeterminate }
|
|
95
88
|
label={ <span id={ titleId }>{ title }</span> }
|
|
96
89
|
/>
|
|
97
90
|
<BlockTypesChecklist
|
|
@@ -13,17 +13,14 @@ function BlockTypesChecklist( { blockTypes, value, onItemChange } ) {
|
|
|
13
13
|
className="edit-post-block-manager__checklist-item"
|
|
14
14
|
>
|
|
15
15
|
<CheckboxControl
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
{ blockType.title }
|
|
19
|
-
<BlockIcon icon={ blockType.icon } />
|
|
20
|
-
</>
|
|
21
|
-
}
|
|
16
|
+
__nextHasNoMarginBottom
|
|
17
|
+
label={ blockType.title }
|
|
22
18
|
checked={ value.includes( blockType.name ) }
|
|
23
19
|
onChange={ ( ...args ) =>
|
|
24
20
|
onItemChange( blockType.name, ...args )
|
|
25
21
|
}
|
|
26
22
|
/>
|
|
23
|
+
<BlockIcon icon={ blockType.icon } />
|
|
27
24
|
</li>
|
|
28
25
|
) ) }
|
|
29
26
|
</ul>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { filter
|
|
4
|
+
import { filter } from 'lodash';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -38,7 +38,7 @@ function BlockManager( {
|
|
|
38
38
|
hasBlockSupport( blockType, 'inserter', true ) &&
|
|
39
39
|
( ! search || isMatchingSearchTerm( blockType, search ) ) &&
|
|
40
40
|
( ! blockType.parent ||
|
|
41
|
-
|
|
41
|
+
blockType.parent.includes( 'core/post-content' ) )
|
|
42
42
|
);
|
|
43
43
|
|
|
44
44
|
// Announce search results on change
|
|
@@ -51,30 +51,19 @@
|
|
|
51
51
|
.edit-post-block-manager__category-title,
|
|
52
52
|
.edit-post-block-manager__checklist-item {
|
|
53
53
|
border-bottom: 1px solid $gray-300;
|
|
54
|
-
|
|
55
|
-
.components-base-control__field {
|
|
56
|
-
align-items: center;
|
|
57
|
-
display: flex;
|
|
58
|
-
margin: 0;
|
|
59
|
-
}
|
|
60
54
|
}
|
|
61
55
|
|
|
62
56
|
.edit-post-block-manager__checklist-item {
|
|
57
|
+
display: flex;
|
|
58
|
+
justify-content: space-between;
|
|
59
|
+
align-items: center;
|
|
63
60
|
margin-bottom: 0;
|
|
64
|
-
padding
|
|
61
|
+
padding: $grid-unit-10 0 $grid-unit-10 $grid-unit-20;
|
|
65
62
|
|
|
66
63
|
.components-modal__content &.components-checkbox-control__input-container {
|
|
67
64
|
margin: 0 $grid-unit-10;
|
|
68
65
|
}
|
|
69
66
|
|
|
70
|
-
.components-checkbox-control__label {
|
|
71
|
-
display: flex;
|
|
72
|
-
align-items: center;
|
|
73
|
-
justify-content: space-between;
|
|
74
|
-
flex-grow: 1;
|
|
75
|
-
padding: $grid-unit-10 0;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
67
|
.block-editor-block-icon {
|
|
79
68
|
margin-right: 10px;
|
|
80
69
|
fill: $gray-900;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`FullscreenModeClose when in full screen mode should display a default site icon if no user uploaded site icon exists 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<div>
|
|
6
|
+
<a
|
|
7
|
+
aria-label="Back"
|
|
8
|
+
class="components-button edit-post-fullscreen-mode-close"
|
|
9
|
+
href="edit.php?"
|
|
10
|
+
>
|
|
11
|
+
<svg
|
|
12
|
+
aria-hidden="true"
|
|
13
|
+
focusable="false"
|
|
14
|
+
height="36px"
|
|
15
|
+
viewBox="-2 -2 24 24"
|
|
16
|
+
width="36px"
|
|
17
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
18
|
+
>
|
|
19
|
+
<path
|
|
20
|
+
d="M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z"
|
|
21
|
+
/>
|
|
22
|
+
</svg>
|
|
23
|
+
</a>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { render } from '@testing-library/react';
|
|
4
|
+
import { render, screen } from '@testing-library/react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -36,12 +36,11 @@ describe( 'FullscreenModeClose', () => {
|
|
|
36
36
|
} ) );
|
|
37
37
|
} );
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
);
|
|
39
|
+
render( <FullscreenModeClose /> );
|
|
40
|
+
|
|
41
|
+
const siteIcon = screen.getByAltText( 'Site Icon' );
|
|
43
42
|
|
|
44
|
-
expect( siteIcon ).
|
|
43
|
+
expect( siteIcon ).toBeVisible();
|
|
45
44
|
} );
|
|
46
45
|
|
|
47
46
|
it( 'should display a default site icon if no user uploaded site icon exists', () => {
|
|
@@ -58,13 +57,12 @@ describe( 'FullscreenModeClose', () => {
|
|
|
58
57
|
} );
|
|
59
58
|
|
|
60
59
|
const { container } = render( <FullscreenModeClose /> );
|
|
61
|
-
const siteIcon = container.querySelector(
|
|
62
|
-
'.edit-post-fullscreen-mode-close_site-icon'
|
|
63
|
-
);
|
|
64
|
-
const defaultIcon = container.querySelector( 'svg' );
|
|
65
60
|
|
|
66
|
-
expect(
|
|
67
|
-
|
|
61
|
+
expect(
|
|
62
|
+
screen.queryByAltText( 'Site Icon' )
|
|
63
|
+
).not.toBeInTheDocument();
|
|
64
|
+
|
|
65
|
+
expect( container ).toMatchSnapshot();
|
|
68
66
|
} );
|
|
69
67
|
} );
|
|
70
68
|
} );
|
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
store as blockEditorStore,
|
|
11
11
|
} from '@wordpress/block-editor';
|
|
12
12
|
import {
|
|
13
|
-
TableOfContents,
|
|
14
13
|
EditorHistoryRedo,
|
|
15
14
|
EditorHistoryUndo,
|
|
16
15
|
store as editorStore,
|
|
@@ -77,21 +76,14 @@ function HeaderToolbar() {
|
|
|
77
76
|
);
|
|
78
77
|
const overflowItems = (
|
|
79
78
|
<>
|
|
80
|
-
<ToolbarItem
|
|
81
|
-
as={ TableOfContents }
|
|
82
|
-
hasOutlineItemsDisabled={ isTextModeEnabled }
|
|
83
|
-
repositionDropdown={ showIconLabels && ! isWideViewport }
|
|
84
|
-
showTooltip={ ! showIconLabels }
|
|
85
|
-
variant={ showIconLabels ? 'tertiary' : undefined }
|
|
86
|
-
/>
|
|
87
79
|
<ToolbarItem
|
|
88
80
|
as={ Button }
|
|
89
|
-
className="edit-post-header-
|
|
81
|
+
className="edit-post-header-toolbar__document-overview-toggle"
|
|
90
82
|
icon={ listView }
|
|
91
83
|
disabled={ isTextModeEnabled }
|
|
92
84
|
isPressed={ isListViewOpen }
|
|
93
85
|
/* translators: button label text should, if possible, be under 16 characters. */
|
|
94
|
-
label={ __( '
|
|
86
|
+
label={ __( 'Document Overview' ) }
|
|
95
87
|
onClick={ toggleListView }
|
|
96
88
|
shortcut={ listViewShortcut }
|
|
97
89
|
showTooltip={ ! showIconLabels }
|
|
@@ -24,12 +24,13 @@ import MainDashboardButton from './main-dashboard-button';
|
|
|
24
24
|
import { store as editPostStore } from '../../store';
|
|
25
25
|
import TemplateTitle from './template-title';
|
|
26
26
|
|
|
27
|
-
function Header( { setEntitiesSavedStatesCallback
|
|
27
|
+
function Header( { setEntitiesSavedStatesCallback } ) {
|
|
28
28
|
const {
|
|
29
29
|
hasActiveMetaboxes,
|
|
30
30
|
isPublishSidebarOpened,
|
|
31
31
|
isSaving,
|
|
32
32
|
showIconLabels,
|
|
33
|
+
isDistractionFree,
|
|
33
34
|
} = useSelect(
|
|
34
35
|
( select ) => ( {
|
|
35
36
|
hasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),
|
|
@@ -38,6 +39,8 @@ function Header( { setEntitiesSavedStatesCallback, isDistractionFree } ) {
|
|
|
38
39
|
isSaving: select( editPostStore ).isSavingMetaBoxes(),
|
|
39
40
|
showIconLabels:
|
|
40
41
|
select( editPostStore ).isFeatureActive( 'showIconLabels' ),
|
|
42
|
+
isDistractionFree:
|
|
43
|
+
select( editPostStore ).isFeatureActive( 'distractionFree' ),
|
|
41
44
|
} ),
|
|
42
45
|
[]
|
|
43
46
|
);
|
|
@@ -146,16 +146,11 @@
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
|
|
150
|
-
.editor-post-
|
|
149
|
+
.editor-post-save-draft.editor-post-save-draft,
|
|
150
|
+
.editor-post-saved-state.editor-post-saved-state {
|
|
151
151
|
&::after {
|
|
152
152
|
content: none;
|
|
153
153
|
}
|
|
154
|
-
@include break-small {
|
|
155
|
-
&::after {
|
|
156
|
-
content: attr(aria-label);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
154
|
}
|
|
160
155
|
}
|
|
161
156
|
|
|
@@ -220,7 +215,7 @@
|
|
|
220
215
|
}
|
|
221
216
|
|
|
222
217
|
& > .edit-post-header__toolbar .edit-post-header-toolbar__inserter-toggle,
|
|
223
|
-
& > .edit-post-header__toolbar .edit-post-header-
|
|
218
|
+
& > .edit-post-header__toolbar .edit-post-header-toolbar__document-overview-toggle,
|
|
224
219
|
& > .edit-post-header__settings > .block-editor-post-preview__dropdown,
|
|
225
220
|
& > .edit-post-header__settings > .interface-pinned-items {
|
|
226
221
|
display: none;
|
|
@@ -242,5 +237,4 @@
|
|
|
242
237
|
position: absolute;
|
|
243
238
|
z-index: 35;
|
|
244
239
|
}
|
|
245
|
-
|
|
246
240
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
4
|
+
import { useSelect, 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';
|
|
@@ -17,7 +17,8 @@ import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
|
17
17
|
*/
|
|
18
18
|
import { store as postEditorStore } from '../../../store';
|
|
19
19
|
|
|
20
|
-
function WritingMenu(
|
|
20
|
+
function WritingMenu() {
|
|
21
|
+
const registry = useRegistry();
|
|
21
22
|
const isDistractionFree = useSelect(
|
|
22
23
|
( select ) =>
|
|
23
24
|
select( blockEditorStore ).getSettings().isDistractionFree,
|
|
@@ -36,14 +37,15 @@ function WritingMenu( { onClose } ) {
|
|
|
36
37
|
const { selectBlock } = useDispatch( blockEditorStore );
|
|
37
38
|
|
|
38
39
|
const toggleDistractionFree = () => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
registry.batch( () => {
|
|
41
|
+
setPreference( 'core/edit-post', 'fixedToolbar', false );
|
|
42
|
+
setIsInserterOpened( false );
|
|
43
|
+
setIsListViewOpened( false );
|
|
44
|
+
closeGeneralSidebar();
|
|
45
|
+
if ( ! isDistractionFree && !! blocks.length ) {
|
|
46
|
+
selectBlock( blocks[ 0 ].clientId );
|
|
47
|
+
}
|
|
48
|
+
} );
|
|
47
49
|
};
|
|
48
50
|
|
|
49
51
|
const isLargeViewport = useViewportMatch( 'medium' );
|
|
@@ -84,7 +86,7 @@ function WritingMenu( { onClose } ) {
|
|
|
84
86
|
<PreferenceToggleMenuItem
|
|
85
87
|
scope="core/edit-post"
|
|
86
88
|
name="distractionFree"
|
|
87
|
-
|
|
89
|
+
onToggle={ toggleDistractionFree }
|
|
88
90
|
label={ __( 'Distraction free' ) }
|
|
89
91
|
info={ __( 'Write with calmness' ) }
|
|
90
92
|
messageActivated={ __( 'Distraction free mode activated' ) }
|
|
@@ -36,4 +36,14 @@ export const textFormattingShortcuts = [
|
|
|
36
36
|
keyCombination: { modifier: 'access', character: 'x' },
|
|
37
37
|
description: __( 'Make the selected text inline code.' ),
|
|
38
38
|
},
|
|
39
|
+
{
|
|
40
|
+
keyCombination: { modifier: 'access', character: '0' },
|
|
41
|
+
description: __( 'Convert the current heading to a paragraph.' ),
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
keyCombination: { modifier: 'access', character: '1-6' },
|
|
45
|
+
description: __(
|
|
46
|
+
'Convert the current paragraph or heading to a heading of level 1 to 6.'
|
|
47
|
+
),
|
|
48
|
+
},
|
|
39
49
|
];
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { castArray } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -26,20 +21,22 @@ function KeyCombination( { keyCombination, forceAriaLabel } ) {
|
|
|
26
21
|
className="edit-post-keyboard-shortcut-help-modal__shortcut-key-combination"
|
|
27
22
|
aria-label={ forceAriaLabel || ariaLabel }
|
|
28
23
|
>
|
|
29
|
-
{
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
{ ( Array.isArray( shortcut ) ? shortcut : [ shortcut ] ).map(
|
|
25
|
+
( character, index ) => {
|
|
26
|
+
if ( character === '+' ) {
|
|
27
|
+
return <Fragment key={ index }>{ character }</Fragment>;
|
|
28
|
+
}
|
|
33
29
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
30
|
+
return (
|
|
31
|
+
<kbd
|
|
32
|
+
key={ index }
|
|
33
|
+
className="edit-post-keyboard-shortcut-help-modal__shortcut-key"
|
|
34
|
+
>
|
|
35
|
+
{ character }
|
|
36
|
+
</kbd>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
) }
|
|
43
40
|
</kbd>
|
|
44
41
|
);
|
|
45
42
|
}
|
|
@@ -821,6 +821,76 @@ exports[`KeyboardShortcutHelpModal should match snapshot when the modal is activ
|
|
|
821
821
|
</kbd>
|
|
822
822
|
</div>
|
|
823
823
|
</li>
|
|
824
|
+
<li
|
|
825
|
+
class="edit-post-keyboard-shortcut-help-modal__shortcut"
|
|
826
|
+
>
|
|
827
|
+
<div
|
|
828
|
+
class="edit-post-keyboard-shortcut-help-modal__shortcut-description"
|
|
829
|
+
>
|
|
830
|
+
Convert the current heading to a paragraph.
|
|
831
|
+
</div>
|
|
832
|
+
<div
|
|
833
|
+
class="edit-post-keyboard-shortcut-help-modal__shortcut-term"
|
|
834
|
+
>
|
|
835
|
+
<kbd
|
|
836
|
+
aria-label="Shift + Alt + 0"
|
|
837
|
+
class="edit-post-keyboard-shortcut-help-modal__shortcut-key-combination"
|
|
838
|
+
>
|
|
839
|
+
<kbd
|
|
840
|
+
class="edit-post-keyboard-shortcut-help-modal__shortcut-key"
|
|
841
|
+
>
|
|
842
|
+
Shift
|
|
843
|
+
</kbd>
|
|
844
|
+
+
|
|
845
|
+
<kbd
|
|
846
|
+
class="edit-post-keyboard-shortcut-help-modal__shortcut-key"
|
|
847
|
+
>
|
|
848
|
+
Alt
|
|
849
|
+
</kbd>
|
|
850
|
+
+
|
|
851
|
+
<kbd
|
|
852
|
+
class="edit-post-keyboard-shortcut-help-modal__shortcut-key"
|
|
853
|
+
>
|
|
854
|
+
0
|
|
855
|
+
</kbd>
|
|
856
|
+
</kbd>
|
|
857
|
+
</div>
|
|
858
|
+
</li>
|
|
859
|
+
<li
|
|
860
|
+
class="edit-post-keyboard-shortcut-help-modal__shortcut"
|
|
861
|
+
>
|
|
862
|
+
<div
|
|
863
|
+
class="edit-post-keyboard-shortcut-help-modal__shortcut-description"
|
|
864
|
+
>
|
|
865
|
+
Convert the current paragraph or heading to a heading of level 1 to 6.
|
|
866
|
+
</div>
|
|
867
|
+
<div
|
|
868
|
+
class="edit-post-keyboard-shortcut-help-modal__shortcut-term"
|
|
869
|
+
>
|
|
870
|
+
<kbd
|
|
871
|
+
aria-label="Shift + Alt + 1 6"
|
|
872
|
+
class="edit-post-keyboard-shortcut-help-modal__shortcut-key-combination"
|
|
873
|
+
>
|
|
874
|
+
<kbd
|
|
875
|
+
class="edit-post-keyboard-shortcut-help-modal__shortcut-key"
|
|
876
|
+
>
|
|
877
|
+
Shift
|
|
878
|
+
</kbd>
|
|
879
|
+
+
|
|
880
|
+
<kbd
|
|
881
|
+
class="edit-post-keyboard-shortcut-help-modal__shortcut-key"
|
|
882
|
+
>
|
|
883
|
+
Alt
|
|
884
|
+
</kbd>
|
|
885
|
+
+
|
|
886
|
+
<kbd
|
|
887
|
+
class="edit-post-keyboard-shortcut-help-modal__shortcut-key"
|
|
888
|
+
>
|
|
889
|
+
1-6
|
|
890
|
+
</kbd>
|
|
891
|
+
</kbd>
|
|
892
|
+
</div>
|
|
893
|
+
</li>
|
|
824
894
|
</ul>
|
|
825
895
|
</section>
|
|
826
896
|
</div>
|