@wordpress/edit-post 6.0.2 → 6.1.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/block-manager/category.js +2 -2
- package/build/components/block-manager/category.js.map +1 -1
- package/build/components/block-manager/index.js +2 -2
- package/build/components/block-manager/index.js.map +1 -1
- package/build/components/header/header-toolbar/index.js +1 -1
- package/build/components/header/header-toolbar/index.js.map +1 -1
- package/build/components/header/header-toolbar/index.native.js +1 -1
- package/build/components/header/header-toolbar/index.native.js.map +1 -1
- package/build/components/header/more-menu/index.js +0 -6
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/components/header/writing-menu/index.js +7 -7
- package/build/components/header/writing-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +5 -0
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/index.native.js +1 -1
- package/build/components/layout/index.native.js.map +1 -1
- package/build/components/preferences-modal/index.js +14 -99
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preferences-modal/meta-boxes-section.js +2 -4
- package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
- package/build/components/preferences-modal/options/enable-custom-fields.js +2 -8
- package/build/components/preferences-modal/options/enable-custom-fields.js.map +1 -1
- package/build/components/preferences-modal/options/enable-feature.js +2 -4
- package/build/components/preferences-modal/options/enable-feature.js.map +1 -1
- package/build/components/preferences-modal/options/enable-panel.js +2 -4
- package/build/components/preferences-modal/options/enable-panel.js.map +1 -1
- package/build/components/preferences-modal/options/enable-publish-sidebar.js +2 -8
- package/build/components/preferences-modal/options/enable-publish-sidebar.js.map +1 -1
- package/build/components/sidebar/post-link/index.js +1 -1
- package/build/components/sidebar/post-link/index.js.map +1 -1
- package/build/editor.js +4 -3
- package/build/editor.js.map +1 -1
- package/build/editor.native.js +8 -8
- package/build/editor.native.js.map +1 -1
- package/build/hooks/validate-multiple-use/index.js +1 -1
- package/build/hooks/validate-multiple-use/index.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 +3 -3
- package/build/plugins/welcome-guide-menu-item/index.js.map +1 -1
- package/build/store/actions.js +62 -50
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +0 -12
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +44 -10
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-manager/category.js +2 -2
- 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/header/header-toolbar/index.js +1 -1
- package/build-module/components/header/header-toolbar/index.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.native.js +1 -1
- package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
- package/build-module/components/header/more-menu/index.js +0 -5
- package/build-module/components/header/more-menu/index.js.map +1 -1
- package/build-module/components/header/writing-menu/index.js +7 -7
- package/build-module/components/header/writing-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +5 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build-module/components/layout/index.js +2 -2
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/index.native.js +1 -1
- package/build-module/components/layout/index.native.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +15 -98
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preferences-modal/meta-boxes-section.js +2 -2
- package/build-module/components/preferences-modal/meta-boxes-section.js.map +1 -1
- package/build-module/components/preferences-modal/options/enable-custom-fields.js +1 -5
- package/build-module/components/preferences-modal/options/enable-custom-fields.js.map +1 -1
- package/build-module/components/preferences-modal/options/enable-feature.js +1 -1
- package/build-module/components/preferences-modal/options/enable-feature.js.map +1 -1
- package/build-module/components/preferences-modal/options/enable-panel.js +1 -1
- package/build-module/components/preferences-modal/options/enable-panel.js.map +1 -1
- package/build-module/components/preferences-modal/options/enable-publish-sidebar.js +1 -5
- package/build-module/components/preferences-modal/options/enable-publish-sidebar.js.map +1 -1
- package/build-module/components/sidebar/post-link/index.js +2 -2
- package/build-module/components/sidebar/post-link/index.js.map +1 -1
- package/build-module/editor.js +5 -4
- package/build-module/editor.js.map +1 -1
- package/build-module/editor.native.js +8 -8
- package/build-module/editor.native.js.map +1 -1
- package/build-module/hooks/validate-multiple-use/index.js +1 -1
- package/build-module/hooks/validate-multiple-use/index.js.map +1 -1
- package/build-module/index.js +5 -4
- package/build-module/index.js.map +1 -1
- package/build-module/plugins/welcome-guide-menu-item/index.js +3 -3
- package/build-module/plugins/welcome-guide-menu-item/index.js.map +1 -1
- package/build-module/store/actions.js +52 -43
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +1 -13
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +36 -6
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +91 -130
- package/build-style/style.css +91 -130
- package/package.json +30 -25
- package/src/components/block-manager/category.js +2 -2
- package/src/components/block-manager/index.js +2 -2
- package/src/components/header/fullscreen-mode-close/test/index.js +1 -1
- package/src/components/header/header-toolbar/index.js +1 -1
- package/src/components/header/header-toolbar/index.native.js +1 -1
- package/src/components/header/more-menu/index.js +0 -6
- package/src/components/header/style.scss +1 -1
- package/src/components/header/writing-menu/index.js +7 -7
- package/src/components/keyboard-shortcut-help-modal/config.js +4 -0
- package/src/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap +6 -0
- package/src/components/layout/index.js +2 -2
- package/src/components/layout/index.native.js +1 -1
- package/src/components/preferences-modal/index.js +24 -150
- package/src/components/preferences-modal/meta-boxes-section.js +3 -3
- package/src/components/preferences-modal/options/enable-custom-fields.js +1 -5
- package/src/components/preferences-modal/options/enable-feature.js +1 -1
- package/src/components/preferences-modal/options/enable-panel.js +1 -1
- package/src/components/preferences-modal/options/enable-publish-sidebar.js +1 -5
- package/src/components/preferences-modal/options/test/__snapshots__/enable-custom-fields.js.snap +4 -4
- package/src/components/preferences-modal/options/test/enable-custom-fields.js +1 -1
- package/src/components/preferences-modal/test/__snapshots__/index.js.snap +235 -357
- package/src/components/preferences-modal/test/index.js +6 -6
- package/src/components/sidebar/post-link/index.js +2 -2
- package/src/editor.js +4 -3
- package/src/editor.native.js +7 -7
- package/src/hooks/validate-multiple-use/index.js +1 -1
- package/src/index.js +5 -4
- package/src/plugins/welcome-guide-menu-item/index.js +3 -3
- package/src/store/actions.js +49 -33
- package/src/store/reducer.js +1 -12
- package/src/store/selectors.js +56 -8
- package/src/store/test/actions.js +167 -4
- package/src/store/test/reducer.js +0 -28
- package/src/style.scss +0 -2
- package/src/test/editor.native.js +2 -2
- package/build/components/preferences-modal/options/base.js +0 -35
- package/build/components/preferences-modal/options/base.js.map +0 -1
- package/build/components/preferences-modal/section.js +0 -27
- package/build/components/preferences-modal/section.js.map +0 -1
- package/build-module/components/preferences-modal/options/base.js +0 -27
- package/build-module/components/preferences-modal/options/base.js.map +0 -1
- package/build-module/components/preferences-modal/section.js +0 -19
- package/build-module/components/preferences-modal/section.js.map +0 -1
- package/src/components/header/more-menu/style.scss +0 -35
- package/src/components/preferences-modal/options/base.js +0 -20
- package/src/components/preferences-modal/section.js +0 -15
- package/src/components/preferences-modal/style.scss +0 -112
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-post",
|
|
3
|
-
"version": "6.0
|
|
3
|
+
"version": "6.1.0",
|
|
4
4
|
"description": "Edit Post module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -27,36 +27,41 @@
|
|
|
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.0
|
|
32
|
-
"@wordpress/block-editor": "^8.
|
|
33
|
-
"@wordpress/block-library": "^7.0
|
|
34
|
-
"@wordpress/blocks": "^11.
|
|
35
|
-
"@wordpress/components": "^19.
|
|
36
|
-
"@wordpress/compose": "^5.
|
|
37
|
-
"@wordpress/core-data": "^4.
|
|
38
|
-
"@wordpress/data": "^6.
|
|
39
|
-
"@wordpress/editor": "^12.
|
|
40
|
-
"@wordpress/element": "^4.
|
|
41
|
-
"@wordpress/hooks": "^3.
|
|
42
|
-
"@wordpress/i18n": "^4.
|
|
43
|
-
"@wordpress/icons": "^
|
|
44
|
-
"@wordpress/interface": "^4.
|
|
45
|
-
"@wordpress/keyboard-shortcuts": "^3.
|
|
46
|
-
"@wordpress/keycodes": "^3.
|
|
47
|
-
"@wordpress/media-utils": "^3.
|
|
48
|
-
"@wordpress/notices": "^3.
|
|
49
|
-
"@wordpress/plugins": "^4.
|
|
50
|
-
"@wordpress/
|
|
51
|
-
"@wordpress/
|
|
52
|
-
"@wordpress/
|
|
30
|
+
"@wordpress/a11y": "^3.4.0",
|
|
31
|
+
"@wordpress/api-fetch": "^6.1.0",
|
|
32
|
+
"@wordpress/block-editor": "^8.3.0",
|
|
33
|
+
"@wordpress/block-library": "^7.1.0",
|
|
34
|
+
"@wordpress/blocks": "^11.3.0",
|
|
35
|
+
"@wordpress/components": "^19.6.0",
|
|
36
|
+
"@wordpress/compose": "^5.2.0",
|
|
37
|
+
"@wordpress/core-data": "^4.2.0",
|
|
38
|
+
"@wordpress/data": "^6.4.0",
|
|
39
|
+
"@wordpress/editor": "^12.3.0",
|
|
40
|
+
"@wordpress/element": "^4.2.0",
|
|
41
|
+
"@wordpress/hooks": "^3.4.0",
|
|
42
|
+
"@wordpress/i18n": "^4.4.0",
|
|
43
|
+
"@wordpress/icons": "^8.0.0",
|
|
44
|
+
"@wordpress/interface": "^4.3.0",
|
|
45
|
+
"@wordpress/keyboard-shortcuts": "^3.2.0",
|
|
46
|
+
"@wordpress/keycodes": "^3.4.0",
|
|
47
|
+
"@wordpress/media-utils": "^3.2.0",
|
|
48
|
+
"@wordpress/notices": "^3.4.0",
|
|
49
|
+
"@wordpress/plugins": "^4.2.0",
|
|
50
|
+
"@wordpress/preferences": "^1.0.0-prerelease",
|
|
51
|
+
"@wordpress/url": "^3.5.0",
|
|
52
|
+
"@wordpress/viewport": "^4.2.0",
|
|
53
|
+
"@wordpress/warning": "^2.4.0",
|
|
53
54
|
"classnames": "^2.3.1",
|
|
54
55
|
"lodash": "^4.17.21",
|
|
55
56
|
"memize": "^1.1.0",
|
|
56
57
|
"rememo": "^3.0.0"
|
|
57
58
|
},
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"react": "^17.0.0",
|
|
61
|
+
"react-dom": "^17.0.0"
|
|
62
|
+
},
|
|
58
63
|
"publishConfig": {
|
|
59
64
|
"access": "public"
|
|
60
65
|
},
|
|
61
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "c37fd7edbc3e379540d7b24fce75a6f640a434ae"
|
|
62
67
|
}
|
|
@@ -23,11 +23,11 @@ function BlockManagerCategory( { title, blockTypes } ) {
|
|
|
23
23
|
const { defaultAllowedBlockTypes, hiddenBlockTypes } = useSelect(
|
|
24
24
|
( select ) => {
|
|
25
25
|
const { getEditorSettings } = select( editorStore );
|
|
26
|
-
const {
|
|
26
|
+
const { getHiddenBlockTypes } = select( editPostStore );
|
|
27
27
|
return {
|
|
28
28
|
defaultAllowedBlockTypes: getEditorSettings()
|
|
29
29
|
.defaultAllowedBlockTypes,
|
|
30
|
-
hiddenBlockTypes:
|
|
30
|
+
hiddenBlockTypes: getHiddenBlockTypes(),
|
|
31
31
|
};
|
|
32
32
|
},
|
|
33
33
|
[]
|
|
@@ -116,8 +116,8 @@ export default withSelect( ( select ) => {
|
|
|
116
116
|
hasBlockSupport,
|
|
117
117
|
isMatchingSearchTerm,
|
|
118
118
|
} = select( blocksStore );
|
|
119
|
-
const {
|
|
120
|
-
const hiddenBlockTypes =
|
|
119
|
+
const { getHiddenBlockTypes } = select( editPostStore );
|
|
120
|
+
const hiddenBlockTypes = getHiddenBlockTypes();
|
|
121
121
|
const numberOfHiddenBlocks =
|
|
122
122
|
isArray( hiddenBlockTypes ) && hiddenBlockTypes.length;
|
|
123
123
|
|
|
@@ -14,7 +14,7 @@ import { useSelect } from '@wordpress/data';
|
|
|
14
14
|
import FullscreenModeClose from '../';
|
|
15
15
|
|
|
16
16
|
jest.mock( '@wordpress/data/src/components/use-select', () => {
|
|
17
|
-
// This allows us to tweak the returned value on each test
|
|
17
|
+
// This allows us to tweak the returned value on each test.
|
|
18
18
|
const mock = jest.fn();
|
|
19
19
|
return mock;
|
|
20
20
|
} );
|
|
@@ -105,7 +105,7 @@ function HeaderToolbar() {
|
|
|
105
105
|
);
|
|
106
106
|
const openInserter = useCallback( () => {
|
|
107
107
|
if ( isInserterOpened ) {
|
|
108
|
-
// Focusing the inserter button closes the inserter popover
|
|
108
|
+
// Focusing the inserter button closes the inserter popover.
|
|
109
109
|
inserterButton.current.focus();
|
|
110
110
|
} else {
|
|
111
111
|
setIsInserterOpened( true );
|
|
@@ -53,7 +53,7 @@ function HeaderToolbar( {
|
|
|
53
53
|
};
|
|
54
54
|
const renderHistoryButtons = () => {
|
|
55
55
|
const buttons = [
|
|
56
|
-
/* TODO: replace with EditorHistoryRedo and EditorHistoryUndo */
|
|
56
|
+
/* TODO: replace with EditorHistoryRedo and EditorHistoryUndo. */
|
|
57
57
|
<ToolbarButton
|
|
58
58
|
key="undoButton"
|
|
59
59
|
title={ __( 'Undo' ) }
|
|
@@ -18,17 +18,11 @@ import PreferencesMenuItem from '../preferences-menu-item';
|
|
|
18
18
|
import ToolsMoreMenuGroup from '../tools-more-menu-group';
|
|
19
19
|
import WritingMenu from '../writing-menu';
|
|
20
20
|
|
|
21
|
-
const POPOVER_PROPS = {
|
|
22
|
-
className: 'edit-post-more-menu__content',
|
|
23
|
-
};
|
|
24
|
-
|
|
25
21
|
const MoreMenu = ( { showIconLabels } ) => {
|
|
26
22
|
const isLargeViewport = useViewportMatch( 'large' );
|
|
27
23
|
|
|
28
24
|
return (
|
|
29
25
|
<MoreMenuDropdown
|
|
30
|
-
className="edit-post-more-menu"
|
|
31
|
-
popoverProps={ POPOVER_PROPS }
|
|
32
26
|
toggleProps={ {
|
|
33
27
|
showTooltip: ! showIconLabels,
|
|
34
28
|
...( showIconLabels && { variant: 'tertiary' } ),
|
|
@@ -5,7 +5,7 @@ import { MenuGroup } from '@wordpress/components';
|
|
|
5
5
|
import { __, _x } from '@wordpress/i18n';
|
|
6
6
|
import { useViewportMatch } from '@wordpress/compose';
|
|
7
7
|
import { displayShortcut } from '@wordpress/keycodes';
|
|
8
|
-
import {
|
|
8
|
+
import { PreferenceToggleMenuItem } from '@wordpress/preferences';
|
|
9
9
|
|
|
10
10
|
function WritingMenu() {
|
|
11
11
|
const isLargeViewport = useViewportMatch( 'medium' );
|
|
@@ -15,9 +15,9 @@ function WritingMenu() {
|
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
17
|
<MenuGroup label={ _x( 'View', 'noun' ) }>
|
|
18
|
-
<
|
|
18
|
+
<PreferenceToggleMenuItem
|
|
19
19
|
scope="core/edit-post"
|
|
20
|
-
|
|
20
|
+
name="fixedToolbar"
|
|
21
21
|
label={ __( 'Top toolbar' ) }
|
|
22
22
|
info={ __(
|
|
23
23
|
'Access all block and document tools in a single place'
|
|
@@ -25,17 +25,17 @@ function WritingMenu() {
|
|
|
25
25
|
messageActivated={ __( 'Top toolbar activated' ) }
|
|
26
26
|
messageDeactivated={ __( 'Top toolbar deactivated' ) }
|
|
27
27
|
/>
|
|
28
|
-
<
|
|
28
|
+
<PreferenceToggleMenuItem
|
|
29
29
|
scope="core/edit-post"
|
|
30
|
-
|
|
30
|
+
name="focusMode"
|
|
31
31
|
label={ __( 'Spotlight mode' ) }
|
|
32
32
|
info={ __( 'Focus on one block at a time' ) }
|
|
33
33
|
messageActivated={ __( 'Spotlight mode activated' ) }
|
|
34
34
|
messageDeactivated={ __( 'Spotlight mode deactivated' ) }
|
|
35
35
|
/>
|
|
36
|
-
<
|
|
36
|
+
<PreferenceToggleMenuItem
|
|
37
37
|
scope="core/edit-post"
|
|
38
|
-
|
|
38
|
+
name="fullscreenMode"
|
|
39
39
|
label={ __( 'Fullscreen mode' ) }
|
|
40
40
|
info={ __( 'Work without distraction' ) }
|
|
41
41
|
messageActivated={ __( 'Fullscreen mode activated' ) }
|
|
@@ -20,6 +20,10 @@ export const textFormattingShortcuts = [
|
|
|
20
20
|
keyCombination: { modifier: 'primaryShift', character: 'k' },
|
|
21
21
|
description: __( 'Remove a link.' ),
|
|
22
22
|
},
|
|
23
|
+
{
|
|
24
|
+
keyCombination: { character: '[[' },
|
|
25
|
+
description: __( 'Insert a link to a post or page' ),
|
|
26
|
+
},
|
|
23
27
|
{
|
|
24
28
|
keyCombination: { modifier: 'primary', character: 'u' },
|
|
25
29
|
description: __( 'Underline the selected text.' ),
|
|
@@ -69,6 +69,12 @@ exports[`KeyboardShortcutHelpModal should match snapshot when the modal is activ
|
|
|
69
69
|
"modifier": "primaryShift",
|
|
70
70
|
},
|
|
71
71
|
},
|
|
72
|
+
Object {
|
|
73
|
+
"description": "Insert a link to a post or page",
|
|
74
|
+
"keyCombination": Object {
|
|
75
|
+
"character": "[[",
|
|
76
|
+
},
|
|
77
|
+
},
|
|
72
78
|
Object {
|
|
73
79
|
"description": "Underline the selected text.",
|
|
74
80
|
"keyCombination": Object {
|
|
@@ -38,7 +38,7 @@ import TextEditor from '../text-editor';
|
|
|
38
38
|
import VisualEditor from '../visual-editor';
|
|
39
39
|
import EditPostKeyboardShortcuts from '../keyboard-shortcuts';
|
|
40
40
|
import KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';
|
|
41
|
-
import
|
|
41
|
+
import EditPostPreferencesModal from '../preferences-modal';
|
|
42
42
|
import BrowserURL from '../browser-url';
|
|
43
43
|
import Header from '../header';
|
|
44
44
|
import InserterSidebar from '../secondary-sidebar/inserter-sidebar';
|
|
@@ -283,7 +283,7 @@ function Layout( { styles } ) {
|
|
|
283
283
|
next: nextShortcut,
|
|
284
284
|
} }
|
|
285
285
|
/>
|
|
286
|
-
<
|
|
286
|
+
<EditPostPreferencesModal />
|
|
287
287
|
<KeyboardShortcutHelpModal />
|
|
288
288
|
<WelcomeGuide />
|
|
289
289
|
<Popover.Slot />
|
|
@@ -112,7 +112,7 @@ class Layout extends Component {
|
|
|
112
112
|
|
|
113
113
|
const isHtmlView = mode === 'text';
|
|
114
114
|
|
|
115
|
-
//
|
|
115
|
+
// Add a margin view at the bottom for the header.
|
|
116
116
|
const marginBottom =
|
|
117
117
|
Platform.OS === 'android' && ! isHtmlView
|
|
118
118
|
? headerToolbarStyles.container.height
|
|
@@ -6,27 +6,11 @@ import { get } from 'lodash';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
__experimentalNavigatorScreen as NavigatorScreen,
|
|
12
|
-
__experimentalNavigatorButton as NavigatorButton,
|
|
13
|
-
__experimentalNavigatorBackButton as NavigatorBackButton,
|
|
14
|
-
__experimentalItemGroup as ItemGroup,
|
|
15
|
-
__experimentalItem as Item,
|
|
16
|
-
__experimentalHStack as HStack,
|
|
17
|
-
__experimentalText as Text,
|
|
18
|
-
__experimentalTruncate as Truncate,
|
|
19
|
-
FlexItem,
|
|
20
|
-
Modal,
|
|
21
|
-
TabPanel,
|
|
22
|
-
Card,
|
|
23
|
-
CardHeader,
|
|
24
|
-
CardBody,
|
|
25
|
-
} from '@wordpress/components';
|
|
26
|
-
import { isRTL, __ } from '@wordpress/i18n';
|
|
9
|
+
|
|
10
|
+
import { __ } from '@wordpress/i18n';
|
|
27
11
|
import { useViewportMatch } from '@wordpress/compose';
|
|
28
12
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
29
|
-
import { useMemo
|
|
13
|
+
import { useMemo } from '@wordpress/element';
|
|
30
14
|
import {
|
|
31
15
|
PostTaxonomies,
|
|
32
16
|
PostExcerptCheck,
|
|
@@ -36,12 +20,16 @@ import {
|
|
|
36
20
|
store as editorStore,
|
|
37
21
|
} from '@wordpress/editor';
|
|
38
22
|
import { store as coreStore } from '@wordpress/core-data';
|
|
39
|
-
import {
|
|
23
|
+
import {
|
|
24
|
+
PreferencesModal,
|
|
25
|
+
PreferencesModalTabs,
|
|
26
|
+
PreferencesModalSection,
|
|
27
|
+
} from '@wordpress/interface';
|
|
40
28
|
|
|
41
29
|
/**
|
|
42
30
|
* Internal dependencies
|
|
43
31
|
*/
|
|
44
|
-
|
|
32
|
+
|
|
45
33
|
import {
|
|
46
34
|
EnablePluginDocumentSettingPanelOption,
|
|
47
35
|
EnablePublishSidebarOption,
|
|
@@ -53,9 +41,8 @@ import { store as editPostStore } from '../../store';
|
|
|
53
41
|
import BlockManager from '../block-manager';
|
|
54
42
|
|
|
55
43
|
const MODAL_NAME = 'edit-post/preferences';
|
|
56
|
-
const PREFERENCES_MENU = 'preferences-menu';
|
|
57
44
|
|
|
58
|
-
export default function
|
|
45
|
+
export default function EditPostPreferencesModal() {
|
|
59
46
|
const isLargeViewport = useViewportMatch( 'medium' );
|
|
60
47
|
const { closeModal } = useDispatch( editPostStore );
|
|
61
48
|
const { isModalActive, isViewable } = useSelect( ( select ) => {
|
|
@@ -91,7 +78,7 @@ export default function PreferencesModal() {
|
|
|
91
78
|
content: (
|
|
92
79
|
<>
|
|
93
80
|
{ isLargeViewport && (
|
|
94
|
-
<
|
|
81
|
+
<PreferencesModalSection
|
|
95
82
|
title={ __( 'Publishing' ) }
|
|
96
83
|
description={ __(
|
|
97
84
|
'Change options related to publishing.'
|
|
@@ -105,10 +92,10 @@ export default function PreferencesModal() {
|
|
|
105
92
|
'Include pre-publish checklist'
|
|
106
93
|
) }
|
|
107
94
|
/>
|
|
108
|
-
</
|
|
95
|
+
</PreferencesModalSection>
|
|
109
96
|
) }
|
|
110
97
|
|
|
111
|
-
<
|
|
98
|
+
<PreferencesModalSection
|
|
112
99
|
title={ __( 'Appearance' ) }
|
|
113
100
|
description={ __(
|
|
114
101
|
'Customize options related to the block editor interface and editing flow.'
|
|
@@ -149,7 +136,7 @@ export default function PreferencesModal() {
|
|
|
149
136
|
label={ __( 'Display block breadcrumbs' ) }
|
|
150
137
|
/>
|
|
151
138
|
) }
|
|
152
|
-
</
|
|
139
|
+
</PreferencesModalSection>
|
|
153
140
|
</>
|
|
154
141
|
),
|
|
155
142
|
},
|
|
@@ -158,7 +145,7 @@ export default function PreferencesModal() {
|
|
|
158
145
|
tabLabel: __( 'Blocks' ),
|
|
159
146
|
content: (
|
|
160
147
|
<>
|
|
161
|
-
<
|
|
148
|
+
<PreferencesModalSection
|
|
162
149
|
title={ __( 'Block interactions' ) }
|
|
163
150
|
description={ __(
|
|
164
151
|
'Customize how you interact with blocks in the block library and editing canvas.'
|
|
@@ -180,15 +167,15 @@ export default function PreferencesModal() {
|
|
|
180
167
|
'Contain text cursor inside block'
|
|
181
168
|
) }
|
|
182
169
|
/>
|
|
183
|
-
</
|
|
184
|
-
<
|
|
170
|
+
</PreferencesModalSection>
|
|
171
|
+
<PreferencesModalSection
|
|
185
172
|
title={ __( 'Visible blocks' ) }
|
|
186
173
|
description={ __(
|
|
187
174
|
"Disable blocks that you don't want to appear in the inserter. They can always be toggled back on later."
|
|
188
175
|
) }
|
|
189
176
|
>
|
|
190
177
|
<BlockManager />
|
|
191
|
-
</
|
|
178
|
+
</PreferencesModalSection>
|
|
192
179
|
</>
|
|
193
180
|
),
|
|
194
181
|
},
|
|
@@ -197,7 +184,7 @@ export default function PreferencesModal() {
|
|
|
197
184
|
tabLabel: __( 'Panels' ),
|
|
198
185
|
content: (
|
|
199
186
|
<>
|
|
200
|
-
<
|
|
187
|
+
<PreferencesModalSection
|
|
201
188
|
title={ __( 'Document settings' ) }
|
|
202
189
|
description={ __(
|
|
203
190
|
'Choose what displays in the panel.'
|
|
@@ -253,7 +240,7 @@ export default function PreferencesModal() {
|
|
|
253
240
|
panelName="page-attributes"
|
|
254
241
|
/>
|
|
255
242
|
</PageAttributesCheck>
|
|
256
|
-
</
|
|
243
|
+
</PreferencesModalSection>
|
|
257
244
|
<MetaBoxesSection
|
|
258
245
|
title={ __( 'Additional' ) }
|
|
259
246
|
description={ __(
|
|
@@ -267,126 +254,13 @@ export default function PreferencesModal() {
|
|
|
267
254
|
[ isViewable, isLargeViewport, showBlockBreadcrumbsOption ]
|
|
268
255
|
);
|
|
269
256
|
|
|
270
|
-
// This is also used to sync the two different rendered components
|
|
271
|
-
// between small and large viewports.
|
|
272
|
-
const [ activeMenu, setActiveMenu ] = useState( PREFERENCES_MENU );
|
|
273
|
-
/**
|
|
274
|
-
* Create helper objects from `sections` for easier data handling.
|
|
275
|
-
* `tabs` is used for creating the `TabPanel` and `sectionsContentMap`
|
|
276
|
-
* is used for easier access to active tab's content.
|
|
277
|
-
*/
|
|
278
|
-
const { tabs, sectionsContentMap } = useMemo(
|
|
279
|
-
() =>
|
|
280
|
-
sections.reduce(
|
|
281
|
-
( accumulator, { name, tabLabel: title, content } ) => {
|
|
282
|
-
accumulator.tabs.push( { name, title } );
|
|
283
|
-
accumulator.sectionsContentMap[ name ] = content;
|
|
284
|
-
return accumulator;
|
|
285
|
-
},
|
|
286
|
-
{ tabs: [], sectionsContentMap: {} }
|
|
287
|
-
),
|
|
288
|
-
[ sections ]
|
|
289
|
-
);
|
|
290
|
-
const getCurrentTab = useCallback(
|
|
291
|
-
( tab ) => sectionsContentMap[ tab.name ] || null,
|
|
292
|
-
[ sectionsContentMap ]
|
|
293
|
-
);
|
|
294
257
|
if ( ! isModalActive ) {
|
|
295
258
|
return null;
|
|
296
259
|
}
|
|
297
|
-
|
|
298
|
-
// We render different components based on the viewport size.
|
|
299
|
-
if ( isLargeViewport ) {
|
|
300
|
-
modalContent = (
|
|
301
|
-
<TabPanel
|
|
302
|
-
className="edit-post-preferences__tabs"
|
|
303
|
-
tabs={ tabs }
|
|
304
|
-
initialTabName={
|
|
305
|
-
activeMenu !== PREFERENCES_MENU ? activeMenu : undefined
|
|
306
|
-
}
|
|
307
|
-
onSelect={ setActiveMenu }
|
|
308
|
-
orientation="vertical"
|
|
309
|
-
>
|
|
310
|
-
{ getCurrentTab }
|
|
311
|
-
</TabPanel>
|
|
312
|
-
);
|
|
313
|
-
} else {
|
|
314
|
-
modalContent = (
|
|
315
|
-
<NavigatorProvider initialPath="/">
|
|
316
|
-
<NavigatorScreen path="/">
|
|
317
|
-
<Card isBorderless size="small">
|
|
318
|
-
<CardBody>
|
|
319
|
-
<ItemGroup>
|
|
320
|
-
{ tabs.map( ( tab ) => {
|
|
321
|
-
return (
|
|
322
|
-
<NavigatorButton
|
|
323
|
-
key={ tab.name }
|
|
324
|
-
path={ tab.name }
|
|
325
|
-
as={ Item }
|
|
326
|
-
isAction
|
|
327
|
-
>
|
|
328
|
-
<HStack justify="space-between">
|
|
329
|
-
<FlexItem>
|
|
330
|
-
<Truncate>
|
|
331
|
-
{ tab.title }
|
|
332
|
-
</Truncate>
|
|
333
|
-
</FlexItem>
|
|
334
|
-
<FlexItem>
|
|
335
|
-
<Icon
|
|
336
|
-
icon={
|
|
337
|
-
isRTL()
|
|
338
|
-
? chevronLeft
|
|
339
|
-
: chevronRight
|
|
340
|
-
}
|
|
341
|
-
/>
|
|
342
|
-
</FlexItem>
|
|
343
|
-
</HStack>
|
|
344
|
-
</NavigatorButton>
|
|
345
|
-
);
|
|
346
|
-
} ) }
|
|
347
|
-
</ItemGroup>
|
|
348
|
-
</CardBody>
|
|
349
|
-
</Card>
|
|
350
|
-
</NavigatorScreen>
|
|
351
|
-
{ sections.map( ( section ) => {
|
|
352
|
-
return (
|
|
353
|
-
<NavigatorScreen
|
|
354
|
-
key={ `${ section.name }-menu` }
|
|
355
|
-
path={ section.name }
|
|
356
|
-
>
|
|
357
|
-
<Card isBorderless size="large">
|
|
358
|
-
<CardHeader
|
|
359
|
-
isBorderless={ false }
|
|
360
|
-
justify="left"
|
|
361
|
-
size="small"
|
|
362
|
-
gap="6"
|
|
363
|
-
>
|
|
364
|
-
<NavigatorBackButton
|
|
365
|
-
icon={
|
|
366
|
-
isRTL() ? chevronRight : chevronLeft
|
|
367
|
-
}
|
|
368
|
-
aria-label={ __(
|
|
369
|
-
'Navigate to the previous view'
|
|
370
|
-
) }
|
|
371
|
-
/>
|
|
372
|
-
<Text size="16">{ section.tabLabel }</Text>
|
|
373
|
-
</CardHeader>
|
|
374
|
-
<CardBody>{ section.content }</CardBody>
|
|
375
|
-
</Card>
|
|
376
|
-
</NavigatorScreen>
|
|
377
|
-
);
|
|
378
|
-
} ) }
|
|
379
|
-
</NavigatorProvider>
|
|
380
|
-
);
|
|
381
|
-
}
|
|
260
|
+
|
|
382
261
|
return (
|
|
383
|
-
<
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
closeLabel={ __( 'Close' ) }
|
|
387
|
-
onRequestClose={ closeModal }
|
|
388
|
-
>
|
|
389
|
-
{ modalContent }
|
|
390
|
-
</Modal>
|
|
262
|
+
<PreferencesModal closeModal={ closeModal }>
|
|
263
|
+
<PreferencesModalTabs sections={ sections } />
|
|
264
|
+
</PreferencesModal>
|
|
391
265
|
);
|
|
392
266
|
}
|
|
@@ -9,11 +9,11 @@ import { filter, map } from 'lodash';
|
|
|
9
9
|
import { __ } from '@wordpress/i18n';
|
|
10
10
|
import { withSelect } from '@wordpress/data';
|
|
11
11
|
import { store as editorStore } from '@wordpress/editor';
|
|
12
|
+
import { PreferencesModalSection } from '@wordpress/interface';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Internal dependencies
|
|
15
16
|
*/
|
|
16
|
-
import Section from './section';
|
|
17
17
|
import { EnableCustomFieldsOption, EnablePanelOption } from './options';
|
|
18
18
|
import { store as editPostStore } from '../../store';
|
|
19
19
|
|
|
@@ -33,7 +33,7 @@ export function MetaBoxesSection( {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
return (
|
|
36
|
-
<
|
|
36
|
+
<PreferencesModalSection { ...sectionProps }>
|
|
37
37
|
{ areCustomFieldsRegistered && (
|
|
38
38
|
<EnableCustomFieldsOption label={ __( 'Custom fields' ) } />
|
|
39
39
|
) }
|
|
@@ -44,7 +44,7 @@ export function MetaBoxesSection( {
|
|
|
44
44
|
panelName={ `meta-box-${ id }` }
|
|
45
45
|
/>
|
|
46
46
|
) ) }
|
|
47
|
-
</
|
|
47
|
+
</PreferencesModalSection>
|
|
48
48
|
);
|
|
49
49
|
}
|
|
50
50
|
|
|
@@ -6,11 +6,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
6
6
|
import { Button } from '@wordpress/components';
|
|
7
7
|
import { withSelect } from '@wordpress/data';
|
|
8
8
|
import { store as editorStore } from '@wordpress/editor';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Internal dependencies
|
|
12
|
-
*/
|
|
13
|
-
import BaseOption from './base';
|
|
9
|
+
import { ___unstablePreferencesModalBaseOption as BaseOption } from '@wordpress/interface';
|
|
14
10
|
|
|
15
11
|
export function CustomFieldsConfirmation( { willEnable } ) {
|
|
16
12
|
const [ isReloading, setIsReloading ] = useState( false );
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { compose } from '@wordpress/compose';
|
|
5
5
|
import { withSelect, withDispatch } from '@wordpress/data';
|
|
6
|
+
import { ___unstablePreferencesModalBaseOption as BaseOption } from '@wordpress/interface';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Internal dependencies
|
|
9
10
|
*/
|
|
10
|
-
import BaseOption from './base';
|
|
11
11
|
import { store as editPostStore } from '../../../store';
|
|
12
12
|
|
|
13
13
|
export default compose(
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { compose, ifCondition } from '@wordpress/compose';
|
|
5
5
|
import { withSelect, withDispatch } from '@wordpress/data';
|
|
6
|
+
import { ___unstablePreferencesModalBaseOption as BaseOption } from '@wordpress/interface';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Internal dependencies
|
|
9
10
|
*/
|
|
10
|
-
import BaseOption from './base';
|
|
11
11
|
import { store as editPostStore } from '../../../store';
|
|
12
12
|
|
|
13
13
|
export default compose(
|
|
@@ -5,11 +5,7 @@ import { compose } from '@wordpress/compose';
|
|
|
5
5
|
import { withSelect, withDispatch } from '@wordpress/data';
|
|
6
6
|
import { ifViewportMatches } from '@wordpress/viewport';
|
|
7
7
|
import { store as editorStore } from '@wordpress/editor';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Internal dependencies
|
|
11
|
-
*/
|
|
12
|
-
import BaseOption from './base';
|
|
8
|
+
import { ___unstablePreferencesModalBaseOption as BaseOption } from '@wordpress/interface';
|
|
13
9
|
|
|
14
10
|
export default compose(
|
|
15
11
|
withSelect( ( select ) => ( {
|
package/src/components/preferences-modal/options/test/__snapshots__/enable-custom-fields.js.snap
CHANGED
|
@@ -15,7 +15,7 @@ exports[`EnableCustomFieldsOption renders a checked checkbox and a confirmation
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
<div
|
|
18
|
-
className="
|
|
18
|
+
className="interface-preferences-modal__option"
|
|
19
19
|
>
|
|
20
20
|
<div
|
|
21
21
|
className="components-base-control components-toggle-control emotion-0 emotion-1"
|
|
@@ -78,7 +78,7 @@ exports[`EnableCustomFieldsOption renders a checked checkbox when custom fields
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
<div
|
|
81
|
-
className="
|
|
81
|
+
className="interface-preferences-modal__option"
|
|
82
82
|
>
|
|
83
83
|
<div
|
|
84
84
|
className="components-base-control components-toggle-control emotion-0 emotion-1"
|
|
@@ -127,7 +127,7 @@ exports[`EnableCustomFieldsOption renders an unchecked checkbox and a confirmati
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
<div
|
|
130
|
-
className="
|
|
130
|
+
className="interface-preferences-modal__option"
|
|
131
131
|
>
|
|
132
132
|
<div
|
|
133
133
|
className="components-base-control components-toggle-control emotion-0 emotion-1"
|
|
@@ -190,7 +190,7 @@ exports[`EnableCustomFieldsOption renders an unchecked checkbox when custom fiel
|
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
<div
|
|
193
|
-
className="
|
|
193
|
+
className="interface-preferences-modal__option"
|
|
194
194
|
>
|
|
195
195
|
<div
|
|
196
196
|
className="components-base-control components-toggle-control emotion-0 emotion-1"
|
|
@@ -7,6 +7,7 @@ import { default as TestRenderer, act } from 'react-test-renderer';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { Button } from '@wordpress/components';
|
|
10
|
+
import { ___unstablePreferencesModalBaseOption as BaseOption } from '@wordpress/interface';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Internal dependencies
|
|
@@ -15,7 +16,6 @@ import {
|
|
|
15
16
|
EnableCustomFieldsOption,
|
|
16
17
|
CustomFieldsConfirmation,
|
|
17
18
|
} from '../enable-custom-fields';
|
|
18
|
-
import BaseOption from '../base';
|
|
19
19
|
|
|
20
20
|
describe( 'EnableCustomFieldsOption', () => {
|
|
21
21
|
it( 'renders a checked checkbox when custom fields are enabled', () => {
|