@wordpress/edit-post 6.0.2 → 6.0.3-next.a55ed9455a.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.
Files changed (145) hide show
  1. package/build/components/block-manager/category.js +2 -2
  2. package/build/components/block-manager/category.js.map +1 -1
  3. package/build/components/block-manager/index.js +2 -2
  4. package/build/components/block-manager/index.js.map +1 -1
  5. package/build/components/header/header-toolbar/index.js +1 -1
  6. package/build/components/header/header-toolbar/index.js.map +1 -1
  7. package/build/components/header/header-toolbar/index.native.js +1 -1
  8. package/build/components/header/header-toolbar/index.native.js.map +1 -1
  9. package/build/components/header/more-menu/index.js +0 -6
  10. package/build/components/header/more-menu/index.js.map +1 -1
  11. package/build/components/header/writing-menu/index.js +7 -7
  12. package/build/components/header/writing-menu/index.js.map +1 -1
  13. package/build/components/keyboard-shortcut-help-modal/config.js +5 -0
  14. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  15. package/build/components/layout/index.js.map +1 -1
  16. package/build/components/layout/index.native.js +1 -1
  17. package/build/components/layout/index.native.js.map +1 -1
  18. package/build/components/preferences-modal/index.js +14 -99
  19. package/build/components/preferences-modal/index.js.map +1 -1
  20. package/build/components/preferences-modal/meta-boxes-section.js +2 -4
  21. package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
  22. package/build/components/preferences-modal/options/enable-custom-fields.js +2 -8
  23. package/build/components/preferences-modal/options/enable-custom-fields.js.map +1 -1
  24. package/build/components/preferences-modal/options/enable-feature.js +2 -4
  25. package/build/components/preferences-modal/options/enable-feature.js.map +1 -1
  26. package/build/components/preferences-modal/options/enable-panel.js +2 -4
  27. package/build/components/preferences-modal/options/enable-panel.js.map +1 -1
  28. package/build/components/preferences-modal/options/enable-publish-sidebar.js +2 -8
  29. package/build/components/preferences-modal/options/enable-publish-sidebar.js.map +1 -1
  30. package/build/components/sidebar/post-link/index.js +1 -1
  31. package/build/components/sidebar/post-link/index.js.map +1 -1
  32. package/build/editor.js +4 -3
  33. package/build/editor.js.map +1 -1
  34. package/build/editor.native.js +8 -8
  35. package/build/editor.native.js.map +1 -1
  36. package/build/hooks/validate-multiple-use/index.js +1 -1
  37. package/build/hooks/validate-multiple-use/index.js.map +1 -1
  38. package/build/index.js +5 -4
  39. package/build/index.js.map +1 -1
  40. package/build/plugins/welcome-guide-menu-item/index.js +3 -3
  41. package/build/plugins/welcome-guide-menu-item/index.js.map +1 -1
  42. package/build/store/actions.js +62 -50
  43. package/build/store/actions.js.map +1 -1
  44. package/build/store/reducer.js +0 -12
  45. package/build/store/reducer.js.map +1 -1
  46. package/build/store/selectors.js +44 -10
  47. package/build/store/selectors.js.map +1 -1
  48. package/build-module/components/block-manager/category.js +2 -2
  49. package/build-module/components/block-manager/category.js.map +1 -1
  50. package/build-module/components/block-manager/index.js +2 -2
  51. package/build-module/components/block-manager/index.js.map +1 -1
  52. package/build-module/components/header/header-toolbar/index.js +1 -1
  53. package/build-module/components/header/header-toolbar/index.js.map +1 -1
  54. package/build-module/components/header/header-toolbar/index.native.js +1 -1
  55. package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
  56. package/build-module/components/header/more-menu/index.js +0 -5
  57. package/build-module/components/header/more-menu/index.js.map +1 -1
  58. package/build-module/components/header/writing-menu/index.js +7 -7
  59. package/build-module/components/header/writing-menu/index.js.map +1 -1
  60. package/build-module/components/keyboard-shortcut-help-modal/config.js +5 -0
  61. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  62. package/build-module/components/layout/index.js +2 -2
  63. package/build-module/components/layout/index.js.map +1 -1
  64. package/build-module/components/layout/index.native.js +1 -1
  65. package/build-module/components/layout/index.native.js.map +1 -1
  66. package/build-module/components/preferences-modal/index.js +15 -98
  67. package/build-module/components/preferences-modal/index.js.map +1 -1
  68. package/build-module/components/preferences-modal/meta-boxes-section.js +2 -2
  69. package/build-module/components/preferences-modal/meta-boxes-section.js.map +1 -1
  70. package/build-module/components/preferences-modal/options/enable-custom-fields.js +1 -5
  71. package/build-module/components/preferences-modal/options/enable-custom-fields.js.map +1 -1
  72. package/build-module/components/preferences-modal/options/enable-feature.js +1 -1
  73. package/build-module/components/preferences-modal/options/enable-feature.js.map +1 -1
  74. package/build-module/components/preferences-modal/options/enable-panel.js +1 -1
  75. package/build-module/components/preferences-modal/options/enable-panel.js.map +1 -1
  76. package/build-module/components/preferences-modal/options/enable-publish-sidebar.js +1 -5
  77. package/build-module/components/preferences-modal/options/enable-publish-sidebar.js.map +1 -1
  78. package/build-module/components/sidebar/post-link/index.js +2 -2
  79. package/build-module/components/sidebar/post-link/index.js.map +1 -1
  80. package/build-module/editor.js +5 -4
  81. package/build-module/editor.js.map +1 -1
  82. package/build-module/editor.native.js +8 -8
  83. package/build-module/editor.native.js.map +1 -1
  84. package/build-module/hooks/validate-multiple-use/index.js +1 -1
  85. package/build-module/hooks/validate-multiple-use/index.js.map +1 -1
  86. package/build-module/index.js +5 -4
  87. package/build-module/index.js.map +1 -1
  88. package/build-module/plugins/welcome-guide-menu-item/index.js +3 -3
  89. package/build-module/plugins/welcome-guide-menu-item/index.js.map +1 -1
  90. package/build-module/store/actions.js +52 -43
  91. package/build-module/store/actions.js.map +1 -1
  92. package/build-module/store/reducer.js +1 -13
  93. package/build-module/store/reducer.js.map +1 -1
  94. package/build-module/store/selectors.js +36 -6
  95. package/build-module/store/selectors.js.map +1 -1
  96. package/build-style/style-rtl.css +90 -129
  97. package/build-style/style.css +90 -129
  98. package/package.json +30 -25
  99. package/src/components/block-manager/category.js +2 -2
  100. package/src/components/block-manager/index.js +2 -2
  101. package/src/components/header/fullscreen-mode-close/test/index.js +1 -1
  102. package/src/components/header/header-toolbar/index.js +1 -1
  103. package/src/components/header/header-toolbar/index.native.js +1 -1
  104. package/src/components/header/more-menu/index.js +0 -6
  105. package/src/components/header/style.scss +1 -1
  106. package/src/components/header/writing-menu/index.js +7 -7
  107. package/src/components/keyboard-shortcut-help-modal/config.js +4 -0
  108. package/src/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap +6 -0
  109. package/src/components/layout/index.js +2 -2
  110. package/src/components/layout/index.native.js +1 -1
  111. package/src/components/preferences-modal/index.js +24 -150
  112. package/src/components/preferences-modal/meta-boxes-section.js +3 -3
  113. package/src/components/preferences-modal/options/enable-custom-fields.js +1 -5
  114. package/src/components/preferences-modal/options/enable-feature.js +1 -1
  115. package/src/components/preferences-modal/options/enable-panel.js +1 -1
  116. package/src/components/preferences-modal/options/enable-publish-sidebar.js +1 -5
  117. package/src/components/preferences-modal/options/test/__snapshots__/enable-custom-fields.js.snap +4 -4
  118. package/src/components/preferences-modal/options/test/enable-custom-fields.js +1 -1
  119. package/src/components/preferences-modal/test/__snapshots__/index.js.snap +235 -357
  120. package/src/components/preferences-modal/test/index.js +6 -6
  121. package/src/components/sidebar/post-link/index.js +2 -2
  122. package/src/editor.js +4 -3
  123. package/src/editor.native.js +7 -7
  124. package/src/hooks/validate-multiple-use/index.js +1 -1
  125. package/src/index.js +5 -4
  126. package/src/plugins/welcome-guide-menu-item/index.js +3 -3
  127. package/src/store/actions.js +49 -33
  128. package/src/store/reducer.js +1 -12
  129. package/src/store/selectors.js +56 -8
  130. package/src/store/test/actions.js +167 -4
  131. package/src/store/test/reducer.js +0 -28
  132. package/src/style.scss +0 -2
  133. package/src/test/editor.native.js +2 -2
  134. package/build/components/preferences-modal/options/base.js +0 -35
  135. package/build/components/preferences-modal/options/base.js.map +0 -1
  136. package/build/components/preferences-modal/section.js +0 -27
  137. package/build/components/preferences-modal/section.js.map +0 -1
  138. package/build-module/components/preferences-modal/options/base.js +0 -27
  139. package/build-module/components/preferences-modal/options/base.js.map +0 -1
  140. package/build-module/components/preferences-modal/section.js +0 -19
  141. package/build-module/components/preferences-modal/section.js.map +0 -1
  142. package/src/components/header/more-menu/style.scss +0 -35
  143. package/src/components/preferences-modal/options/base.js +0 -20
  144. package/src/components/preferences-modal/section.js +0 -15
  145. 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.2",
3
+ "version": "6.0.3-next.a55ed9455a.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.3.1",
31
- "@wordpress/api-fetch": "^6.0.1",
32
- "@wordpress/block-editor": "^8.2.0",
33
- "@wordpress/block-library": "^7.0.2",
34
- "@wordpress/blocks": "^11.2.2",
35
- "@wordpress/components": "^19.5.0",
36
- "@wordpress/compose": "^5.1.2",
37
- "@wordpress/core-data": "^4.1.2",
38
- "@wordpress/data": "^6.3.0",
39
- "@wordpress/editor": "^12.2.2",
40
- "@wordpress/element": "^4.1.1",
41
- "@wordpress/hooks": "^3.3.1",
42
- "@wordpress/i18n": "^4.3.1",
43
- "@wordpress/icons": "^7.0.1",
44
- "@wordpress/interface": "^4.2.3",
45
- "@wordpress/keyboard-shortcuts": "^3.1.2",
46
- "@wordpress/keycodes": "^3.3.1",
47
- "@wordpress/media-utils": "^3.1.1",
48
- "@wordpress/notices": "^3.3.2",
49
- "@wordpress/plugins": "^4.1.3",
50
- "@wordpress/url": "^3.4.1",
51
- "@wordpress/viewport": "^4.1.2",
52
- "@wordpress/warning": "^2.3.1",
30
+ "@wordpress/a11y": "^3.3.2-next.a55ed9455a.0",
31
+ "@wordpress/api-fetch": "^6.0.2-next.a55ed9455a.0",
32
+ "@wordpress/block-editor": "^8.2.1-next.a55ed9455a.0",
33
+ "@wordpress/block-library": "^7.0.3-next.a55ed9455a.0",
34
+ "@wordpress/blocks": "^11.2.3-next.a55ed9455a.0",
35
+ "@wordpress/components": "^19.6.1-next.a55ed9455a.0",
36
+ "@wordpress/compose": "^5.1.3-next.a55ed9455a.0",
37
+ "@wordpress/core-data": "^4.1.3-next.a55ed9455a.0",
38
+ "@wordpress/data": "^6.3.1-next.a55ed9455a.0",
39
+ "@wordpress/editor": "^12.3.1-next.a55ed9455a.0",
40
+ "@wordpress/element": "^4.1.3-next.a55ed9455a.0",
41
+ "@wordpress/hooks": "^3.3.2-next.a55ed9455a.0",
42
+ "@wordpress/i18n": "^4.3.2-next.a55ed9455a.0",
43
+ "@wordpress/icons": "^7.0.2-next.a55ed9455a.0",
44
+ "@wordpress/interface": "^4.2.4-next.a55ed9455a.0",
45
+ "@wordpress/keyboard-shortcuts": "^3.1.3-next.a55ed9455a.0",
46
+ "@wordpress/keycodes": "^3.3.2-next.a55ed9455a.0",
47
+ "@wordpress/media-utils": "^3.1.2-next.a55ed9455a.0",
48
+ "@wordpress/notices": "^3.3.3-next.a55ed9455a.0",
49
+ "@wordpress/plugins": "^4.1.4-next.a55ed9455a.0",
50
+ "@wordpress/preferences": "^1.0.0-prerelease",
51
+ "@wordpress/url": "^3.4.2-next.a55ed9455a.0",
52
+ "@wordpress/viewport": "^4.1.3-next.a55ed9455a.0",
53
+ "@wordpress/warning": "^2.3.2-next.a55ed9455a.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": "4566ac290359553d04de4eb574545309343f790b"
66
+ "gitHead": "c5108185851b824d531bce55991a3589947e8551"
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 { getPreference } = select( editPostStore );
26
+ const { getHiddenBlockTypes } = select( editPostStore );
27
27
  return {
28
28
  defaultAllowedBlockTypes: getEditorSettings()
29
29
  .defaultAllowedBlockTypes,
30
- hiddenBlockTypes: getPreference( '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 { getPreference } = select( editPostStore );
120
- const hiddenBlockTypes = getPreference( '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' } ),
@@ -73,7 +73,7 @@
73
73
  padding: 0 #{ $grid-unit-15 * 0.5 };
74
74
  }
75
75
 
76
- .edit-post-more-menu .components-button,
76
+ .interface-more-menu-dropdown .components-button,
77
77
  .interface-pinned-items .components-button {
78
78
  margin-right: 0;
79
79
  }
@@ -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 { MoreMenuFeatureToggle } from '@wordpress/interface';
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
- <MoreMenuFeatureToggle
18
+ <PreferenceToggleMenuItem
19
19
  scope="core/edit-post"
20
- feature="fixedToolbar"
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
- <MoreMenuFeatureToggle
28
+ <PreferenceToggleMenuItem
29
29
  scope="core/edit-post"
30
- feature="focusMode"
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
- <MoreMenuFeatureToggle
36
+ <PreferenceToggleMenuItem
37
37
  scope="core/edit-post"
38
- feature="fullscreenMode"
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 PreferencesModal from '../preferences-modal';
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
- <PreferencesModal />
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
- // add a margin view at the bottom for the header
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
- import {
10
- __experimentalNavigatorProvider as NavigatorProvider,
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, useCallback, useState } from '@wordpress/element';
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 { chevronLeft, chevronRight, Icon } from '@wordpress/icons';
23
+ import {
24
+ PreferencesModal,
25
+ PreferencesModalTabs,
26
+ PreferencesModalSection,
27
+ } from '@wordpress/interface';
40
28
 
41
29
  /**
42
30
  * Internal dependencies
43
31
  */
44
- import Section from './section';
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 PreferencesModal() {
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
- <Section
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
- </Section>
95
+ </PreferencesModalSection>
109
96
  ) }
110
97
 
111
- <Section
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
- </Section>
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
- <Section
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
- </Section>
184
- <Section
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
- </Section>
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
- <Section
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
- </Section>
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
- let modalContent;
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
- <Modal
384
- className="edit-post-preferences-modal"
385
- title={ __( 'Preferences' ) }
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
- <Section { ...sectionProps }>
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
- </Section>
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 ) => ( {
@@ -15,7 +15,7 @@ exports[`EnableCustomFieldsOption renders a checked checkbox and a confirmation
15
15
  }
16
16
 
17
17
  <div
18
- className="edit-post-preferences-modal__option"
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="edit-post-preferences-modal__option"
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="edit-post-preferences-modal__option"
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="edit-post-preferences-modal__option"
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', () => {