@wordpress/edit-site 5.3.0 → 5.3.2

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 (131) hide show
  1. package/build/components/add-new-template/new-template-part.js +5 -4
  2. package/build/components/add-new-template/new-template-part.js.map +1 -1
  3. package/build/components/add-new-template/new-template.js +5 -4
  4. package/build/components/add-new-template/new-template.js.map +1 -1
  5. package/build/components/block-editor/editor-canvas.js +13 -2
  6. package/build/components/block-editor/editor-canvas.js.map +1 -1
  7. package/build/components/block-editor/index.js +3 -3
  8. package/build/components/block-editor/index.js.map +1 -1
  9. package/build/components/editor/index.js +6 -18
  10. package/build/components/editor/index.js.map +1 -1
  11. package/build/components/global-styles/block-preview-panel.js +10 -12
  12. package/build/components/global-styles/block-preview-panel.js.map +1 -1
  13. package/build/components/global-styles/context-menu.js +9 -2
  14. package/build/components/global-styles/context-menu.js.map +1 -1
  15. package/build/components/global-styles/screen-border.js +0 -6
  16. package/build/components/global-styles/screen-border.js.map +1 -1
  17. package/build/components/global-styles/screen-effects.js +53 -0
  18. package/build/components/global-styles/screen-effects.js.map +1 -0
  19. package/build/components/global-styles/shadow-panel.js +1 -1
  20. package/build/components/global-styles/shadow-panel.js.map +1 -1
  21. package/build/components/global-styles/ui.js +28 -2
  22. package/build/components/global-styles/ui.js.map +1 -1
  23. package/build/components/layout/index.js +8 -4
  24. package/build/components/layout/index.js.map +1 -1
  25. package/build/components/navigation-inspector/index.js +8 -4
  26. package/build/components/navigation-inspector/index.js.map +1 -1
  27. package/build/components/navigation-inspector/navigation-menu.js +4 -2
  28. package/build/components/navigation-inspector/navigation-menu.js.map +1 -1
  29. package/build/components/save-panel/index.js +77 -0
  30. package/build/components/save-panel/index.js.map +1 -0
  31. package/build/components/sidebar/index.js +25 -2
  32. package/build/components/sidebar/index.js.map +1 -1
  33. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +18 -1
  34. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  35. package/build/components/site-hub/index.js +9 -8
  36. package/build/components/site-hub/index.js.map +1 -1
  37. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +6 -4
  38. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  39. package/build/store/actions.js +1 -27
  40. package/build/store/actions.js.map +1 -1
  41. package/build/store/index.js +8 -0
  42. package/build/store/index.js.map +1 -1
  43. package/build/store/private-actions.js +40 -0
  44. package/build/store/private-actions.js.map +1 -0
  45. package/build/store/private-selectors.js +18 -0
  46. package/build/store/private-selectors.js.map +1 -0
  47. package/build/store/selectors.js +0 -13
  48. package/build/store/selectors.js.map +1 -1
  49. package/build-module/components/add-new-template/new-template-part.js +4 -4
  50. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  51. package/build-module/components/add-new-template/new-template.js +4 -4
  52. package/build-module/components/add-new-template/new-template.js.map +1 -1
  53. package/build-module/components/block-editor/editor-canvas.js +13 -3
  54. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  55. package/build-module/components/block-editor/index.js +3 -3
  56. package/build-module/components/block-editor/index.js.map +1 -1
  57. package/build-module/components/editor/index.js +7 -20
  58. package/build-module/components/editor/index.js.map +1 -1
  59. package/build-module/components/global-styles/block-preview-panel.js +10 -11
  60. package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
  61. package/build-module/components/global-styles/context-menu.js +9 -3
  62. package/build-module/components/global-styles/context-menu.js.map +1 -1
  63. package/build-module/components/global-styles/screen-border.js +0 -5
  64. package/build-module/components/global-styles/screen-border.js.map +1 -1
  65. package/build-module/components/global-styles/screen-effects.js +35 -0
  66. package/build-module/components/global-styles/screen-effects.js.map +1 -0
  67. package/build-module/components/global-styles/shadow-panel.js +1 -1
  68. package/build-module/components/global-styles/shadow-panel.js.map +1 -1
  69. package/build-module/components/global-styles/ui.js +26 -2
  70. package/build-module/components/global-styles/ui.js.map +1 -1
  71. package/build-module/components/layout/index.js +6 -4
  72. package/build-module/components/layout/index.js.map +1 -1
  73. package/build-module/components/navigation-inspector/index.js +8 -4
  74. package/build-module/components/navigation-inspector/index.js.map +1 -1
  75. package/build-module/components/navigation-inspector/navigation-menu.js +4 -2
  76. package/build-module/components/navigation-inspector/navigation-menu.js.map +1 -1
  77. package/build-module/components/save-panel/index.js +63 -0
  78. package/build-module/components/save-panel/index.js.map +1 -0
  79. package/build-module/components/sidebar/index.js +22 -2
  80. package/build-module/components/sidebar/index.js.map +1 -1
  81. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +18 -1
  82. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  83. package/build-module/components/site-hub/index.js +8 -8
  84. package/build-module/components/site-hub/index.js.map +1 -1
  85. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +5 -4
  86. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  87. package/build-module/store/actions.js +0 -23
  88. package/build-module/store/actions.js.map +1 -1
  89. package/build-module/store/index.js +5 -0
  90. package/build-module/store/index.js.map +1 -1
  91. package/build-module/store/private-actions.js +29 -0
  92. package/build-module/store/private-actions.js.map +1 -0
  93. package/build-module/store/private-selectors.js +11 -0
  94. package/build-module/store/private-selectors.js.map +1 -0
  95. package/build-module/store/selectors.js +0 -11
  96. package/build-module/store/selectors.js.map +1 -1
  97. package/build-style/style-rtl.css +83 -26
  98. package/build-style/style.css +83 -26
  99. package/package.json +31 -31
  100. package/src/components/add-new-template/new-template-part.js +3 -2
  101. package/src/components/add-new-template/new-template.js +5 -3
  102. package/src/components/block-editor/editor-canvas.js +12 -2
  103. package/src/components/block-editor/index.js +4 -3
  104. package/src/components/block-editor/style.scss +1 -0
  105. package/src/components/editor/index.js +7 -46
  106. package/src/components/editor/style.scss +2 -2
  107. package/src/components/global-styles/block-preview-panel.js +8 -12
  108. package/src/components/global-styles/context-menu.js +14 -2
  109. package/src/components/global-styles/screen-border.js +0 -5
  110. package/src/components/global-styles/screen-effects.js +28 -0
  111. package/src/components/global-styles/shadow-panel.js +1 -1
  112. package/src/components/global-styles/style.scss +0 -4
  113. package/src/components/global-styles/ui.js +28 -4
  114. package/src/components/layout/index.js +6 -2
  115. package/src/components/layout/style.scss +25 -3
  116. package/src/components/navigation-inspector/index.js +5 -2
  117. package/src/components/navigation-inspector/navigation-menu.js +2 -2
  118. package/src/components/save-panel/index.js +65 -0
  119. package/src/components/save-panel/style.scss +5 -0
  120. package/src/components/sidebar/index.js +26 -6
  121. package/src/components/sidebar/style.scss +15 -0
  122. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +21 -1
  123. package/src/components/site-hub/index.js +7 -9
  124. package/src/components/site-hub/style.scss +1 -0
  125. package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +4 -3
  126. package/src/store/actions.js +0 -24
  127. package/src/store/index.js +5 -0
  128. package/src/store/private-actions.js +29 -0
  129. package/src/store/private-selectors.js +10 -0
  130. package/src/store/selectors.js +0 -11
  131. package/src/style.scss +1 -0
@@ -14,6 +14,7 @@ import { experiments as blockEditorExperiments } from '@wordpress/block-editor';
14
14
  import { __ } from '@wordpress/i18n';
15
15
  import { store as preferencesStore } from '@wordpress/preferences';
16
16
  import { moreVertical } from '@wordpress/icons';
17
+ import { store as coreStore } from '@wordpress/core-data';
17
18
 
18
19
  /**
19
20
  * Internal dependencies
@@ -37,6 +38,7 @@ import ScreenBorder from './screen-border';
37
38
  import StyleBook from '../style-book';
38
39
  import ScreenCSS from './screen-css';
39
40
  import { unlock } from '../../experiments';
41
+ import ScreenEffects from './screen-effects';
40
42
 
41
43
  const SLOT_FILL_NAME = 'GlobalStylesMenu';
42
44
  const { Slot: GlobalStylesMenuSlot, Fill: GlobalStylesMenuFill } =
@@ -44,6 +46,20 @@ const { Slot: GlobalStylesMenuSlot, Fill: GlobalStylesMenuFill } =
44
46
 
45
47
  function GlobalStylesActionMenu() {
46
48
  const { toggle } = useDispatch( preferencesStore );
49
+ const { canEditCSS } = useSelect( ( select ) => {
50
+ const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =
51
+ select( coreStore );
52
+
53
+ const globalStylesId = __experimentalGetCurrentGlobalStylesId();
54
+ const globalStyles = globalStylesId
55
+ ? getEntityRecord( 'root', 'globalStyles', globalStylesId )
56
+ : undefined;
57
+
58
+ return {
59
+ canEditCSS:
60
+ !! globalStyles?._links?.[ 'wp:action-edit-css' ] ?? false,
61
+ };
62
+ }, [] );
47
63
  const { useGlobalStylesReset } = unlock( blockEditorExperiments );
48
64
  const [ canReset, onReset ] = useGlobalStylesReset();
49
65
  const { goTo } = useNavigator();
@@ -64,10 +80,14 @@ function GlobalStylesActionMenu() {
64
80
  onClick: () =>
65
81
  toggle( 'core/edit-site', 'welcomeGuideStyles' ),
66
82
  },
67
- {
68
- title: __( 'Additional CSS' ),
69
- onClick: loadCustomCSS,
70
- },
83
+ ...( canEditCSS
84
+ ? [
85
+ {
86
+ title: __( 'Additional CSS' ),
87
+ onClick: loadCustomCSS,
88
+ },
89
+ ]
90
+ : [] ),
71
91
  ] }
72
92
  />
73
93
  </GlobalStylesMenuFill>
@@ -209,6 +229,10 @@ function ContextScreens( { name, parentMenu = '', variation = '' } ) {
209
229
  <ScreenBorder name={ name } variation={ variation } />
210
230
  </GlobalStylesNavigationScreen>
211
231
 
232
+ <GlobalStylesNavigationScreen path={ parentMenu + '/effects' }>
233
+ <ScreenEffects name={ name } variation={ variation } />
234
+ </GlobalStylesNavigationScreen>
235
+
212
236
  <GlobalStylesNavigationScreen path={ parentMenu + '/layout' }>
213
237
  <ScreenLayout name={ name } variation={ variation } />
214
238
  </GlobalStylesNavigationScreen>
@@ -38,6 +38,8 @@ import useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-e
38
38
  import SiteHub from '../site-hub';
39
39
  import ResizeHandle from '../block-editor/resize-handle';
40
40
  import useSyncCanvasModeWithURL from '../sync-state-with-url/use-sync-canvas-mode-with-url';
41
+ import { unlock } from '../../experiments';
42
+ import SavePanel from '../save-panel';
41
43
 
42
44
  const ANIMATION_DURATION = 0.5;
43
45
  const emptyResizeHandleStyles = {
@@ -66,9 +68,9 @@ export default function Layout() {
66
68
  const { getAllShortcutKeyCombinations } = select(
67
69
  keyboardShortcutsStore
68
70
  );
69
- const { __unstableGetCanvasMode } = select( editSiteStore );
71
+ const { getCanvasMode } = unlock( select( editSiteStore ) );
70
72
  return {
71
- canvasMode: __unstableGetCanvasMode(),
73
+ canvasMode: getCanvasMode(),
72
74
  previousShortcut: getAllShortcutKeyCombinations(
73
75
  'core/edit-site/previous-region'
74
76
  ),
@@ -266,6 +268,8 @@ export default function Layout() {
266
268
  ) }
267
269
  </AnimatePresence>
268
270
 
271
+ <SavePanel />
272
+
269
273
  { showCanvas && (
270
274
  <div
271
275
  className={ classnames(
@@ -85,9 +85,9 @@ $hub-height: $grid-unit-20 * 2 + $button-size;
85
85
  }
86
86
 
87
87
  > div {
88
- overflow-y: auto;
89
- min-height: 100%;
90
- @include custom-scrollbars-on-hover;
88
+ display: flex;
89
+ flex-direction: column;
90
+ height: 100%;
91
91
  }
92
92
 
93
93
  .resizable-editor__drag-handle {
@@ -205,3 +205,25 @@ $hub-height: $grid-unit-20 * 2 + $button-size;
205
205
  border-radius: $radius-block-ui;
206
206
  }
207
207
  }
208
+
209
+ .edit-site-layout__actions {
210
+ z-index: z-index(".edit-site-layout__actions");
211
+ position: fixed !important; // Need to override the default relative positioning
212
+ top: -9999em;
213
+ bottom: auto;
214
+ left: auto;
215
+ right: 0;
216
+ width: $sidebar-width;
217
+ color: $gray-900;
218
+ background: $white;
219
+
220
+ &:focus,
221
+ &:focus-within {
222
+ top: 0;
223
+ bottom: 0;
224
+ }
225
+
226
+ @include break-medium {
227
+ border-left: $border-width solid $gray-300;
228
+ }
229
+ }
@@ -20,7 +20,7 @@ import NavigationMenu from './navigation-menu';
20
20
 
21
21
  const NAVIGATION_MENUS_QUERY = [ { per_page: -1, status: 'publish' } ];
22
22
 
23
- export default function NavigationInspector() {
23
+ export default function NavigationInspector( { onSelect } ) {
24
24
  const {
25
25
  selectedNavigationBlockId,
26
26
  clientIdToRef,
@@ -206,7 +206,10 @@ export default function NavigationInspector() {
206
206
  onChange={ onChange }
207
207
  onInput={ onInput }
208
208
  >
209
- <NavigationMenu innerBlocks={ publishedInnerBlocks } />
209
+ <NavigationMenu
210
+ innerBlocks={ publishedInnerBlocks }
211
+ onSelect={ onSelect }
212
+ />
210
213
  </BlockEditorProvider>
211
214
  ) }
212
215
 
@@ -36,7 +36,7 @@ const ALLOWED_BLOCKS = {
36
36
  ],
37
37
  };
38
38
 
39
- export default function NavigationMenu( { innerBlocks } ) {
39
+ export default function NavigationMenu( { innerBlocks, onSelect } ) {
40
40
  const { updateBlockListSettings } = useDispatch( blockEditorStore );
41
41
 
42
42
  const { OffCanvasEditor } = unlock( blockEditorExperiments );
@@ -56,5 +56,5 @@ export default function NavigationMenu( { innerBlocks } ) {
56
56
  } );
57
57
  }, [ updateBlockListSettings, innerBlocks ] );
58
58
 
59
- return <OffCanvasEditor blocks={ innerBlocks } />;
59
+ return <OffCanvasEditor blocks={ innerBlocks } onSelect={ onSelect } />;
60
60
  }
@@ -0,0 +1,65 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { Button, Modal } from '@wordpress/components';
5
+ import { EntitiesSavedStates } from '@wordpress/editor';
6
+ import { useDispatch, useSelect } from '@wordpress/data';
7
+ import { __ } from '@wordpress/i18n';
8
+ import { NavigableRegion } from '@wordpress/interface';
9
+
10
+ /**
11
+ * Internal dependencies
12
+ */
13
+ import { store as editSiteStore } from '../../store';
14
+ import { unlock } from '../../experiments';
15
+
16
+ export default function SavePanel() {
17
+ const { isSaveViewOpen, canvasMode } = useSelect( ( select ) => {
18
+ const { isSaveViewOpened, getCanvasMode } = unlock(
19
+ select( editSiteStore )
20
+ );
21
+
22
+ // The currently selected entity to display.
23
+ // Typically template or template part in the site editor.
24
+ return {
25
+ isSaveViewOpen: isSaveViewOpened(),
26
+ canvasMode: getCanvasMode(),
27
+ };
28
+ }, [] );
29
+ const { setIsSaveViewOpened } = useDispatch( editSiteStore );
30
+ const onClose = () => setIsSaveViewOpened( false );
31
+
32
+ if ( canvasMode === 'view' ) {
33
+ return isSaveViewOpen ? (
34
+ <Modal
35
+ className="edit-site-save-panel__modal"
36
+ onRequestClose={ onClose }
37
+ __experimentalHideHeader
38
+ >
39
+ <EntitiesSavedStates close={ onClose } />
40
+ </Modal>
41
+ ) : null;
42
+ }
43
+
44
+ return (
45
+ <NavigableRegion
46
+ className="edit-site-layout__actions"
47
+ ariaLabel={ __( 'Save sidebar' ) }
48
+ >
49
+ { isSaveViewOpen ? (
50
+ <EntitiesSavedStates close={ onClose } />
51
+ ) : (
52
+ <div className="edit-site-editor__toggle-save-panel">
53
+ <Button
54
+ variant="secondary"
55
+ className="edit-site-editor__toggle-save-panel-button"
56
+ onClick={ () => setIsSaveViewOpened( true ) }
57
+ aria-expanded={ false }
58
+ >
59
+ { __( 'Open save panel' ) }
60
+ </Button>
61
+ </div>
62
+ ) }
63
+ </NavigableRegion>
64
+ );
65
+ }
@@ -0,0 +1,5 @@
1
+ .edit-site-save-panel__modal {
2
+ @include break-small() {
3
+ width: 600px;
4
+ }
5
+ }
@@ -2,7 +2,9 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { memo } from '@wordpress/element';
5
+ import { useSelect } from '@wordpress/data';
5
6
  import { __experimentalNavigatorProvider as NavigatorProvider } from '@wordpress/components';
7
+ import { store as coreStore } from '@wordpress/core-data';
6
8
 
7
9
  /**
8
10
  * Internal dependencies
@@ -11,6 +13,7 @@ import SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';
11
13
  import SidebarNavigationScreenTemplates from '../sidebar-navigation-screen-templates';
12
14
  import useSyncSidebarPathWithURL from '../sync-state-with-url/use-sync-sidebar-path-with-url';
13
15
  import SidebarNavigationScreenNavigationMenus from '../sidebar-navigation-screen-navigation-menus';
16
+ import SaveButton from '../save-button';
14
17
 
15
18
  function SidebarScreens() {
16
19
  useSyncSidebarPathWithURL();
@@ -26,13 +29,30 @@ function SidebarScreens() {
26
29
  }
27
30
 
28
31
  function Sidebar() {
32
+ const { isDirty } = useSelect( ( select ) => {
33
+ const { __experimentalGetDirtyEntityRecords } = select( coreStore );
34
+ const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
35
+ // The currently selected entity to display.
36
+ // Typically template or template part in the site editor.
37
+ return {
38
+ isDirty: dirtyEntityRecords.length > 0,
39
+ };
40
+ }, [] );
41
+
29
42
  return (
30
- <NavigatorProvider
31
- className="edit-site-sidebar__content"
32
- initialPath="/"
33
- >
34
- <SidebarScreens />
35
- </NavigatorProvider>
43
+ <>
44
+ <NavigatorProvider
45
+ className="edit-site-sidebar__content"
46
+ initialPath="/"
47
+ >
48
+ <SidebarScreens />
49
+ </NavigatorProvider>
50
+ { isDirty && (
51
+ <div className="edit-site-sidebar__footer">
52
+ <SaveButton />
53
+ </div>
54
+ ) }
55
+ </>
36
56
  );
37
57
  }
38
58
 
@@ -1,3 +1,18 @@
1
+ .edit-site-sidebar__content {
2
+ flex-grow: 1;
3
+ overflow-y: auto;
4
+ @include custom-scrollbars-on-hover;
5
+ }
6
+
7
+ .edit-site-sidebar__footer {
8
+ border-top: 1px solid $gray-800;
9
+ flex-shrink: 0;
10
+ margin: 0 $canvas-padding;
11
+ padding: $canvas-padding 0;
12
+ display: flex;
13
+ justify-content: flex-end;
14
+ }
15
+
1
16
  .edit-site-sidebar__content.edit-site-sidebar__content {
2
17
  overflow-x: unset;
3
18
  }
@@ -2,14 +2,34 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
+ import { useCallback } from '@wordpress/element';
5
6
 
6
7
  /**
7
8
  * Internal dependencies
8
9
  */
9
10
  import SidebarNavigationScreen from '../sidebar-navigation-screen';
10
11
  import NavigationInspector from '../navigation-inspector';
12
+ import { useHistory } from '../routes';
11
13
 
12
14
  export default function SidebarNavigationScreenNavigationMenus() {
15
+ const history = useHistory();
16
+ const onSelect = useCallback(
17
+ ( selectedBlock ) => {
18
+ const { attributes } = selectedBlock;
19
+ if (
20
+ attributes.kind === 'post-type' &&
21
+ attributes.id &&
22
+ attributes.type &&
23
+ history
24
+ ) {
25
+ history.push( {
26
+ postType: attributes.type,
27
+ postId: attributes.id,
28
+ } );
29
+ }
30
+ },
31
+ [ history ]
32
+ );
13
33
  return (
14
34
  <SidebarNavigationScreen
15
35
  path="/navigation"
@@ -17,7 +37,7 @@ export default function SidebarNavigationScreenNavigationMenus() {
17
37
  title={ __( 'Navigation' ) }
18
38
  content={
19
39
  <div className="edit-site-sidebar-navigation-screen-navigation-menus">
20
- <NavigationInspector />
40
+ <NavigationInspector onSelect={ onSelect } />
21
41
  </div>
22
42
  }
23
43
  />
@@ -27,6 +27,7 @@ import { useLocation } from '../routes';
27
27
  import getIsListPage from '../../utils/get-is-list-page';
28
28
  import SiteIcon from '../site-icon';
29
29
  import useEditedEntityRecord from '../use-edited-entity-record';
30
+ import { unlock } from '../../experiments';
30
31
 
31
32
  const HUB_ANIMATION_DURATION = 0.3;
32
33
 
@@ -38,13 +39,10 @@ const SiteHub = forwardRef(
38
39
  const { canvasMode, dashboardLink, entityConfig } = useSelect(
39
40
  ( select ) => {
40
41
  select( editSiteStore ).getEditedPostType();
41
- const {
42
- __unstableGetCanvasMode,
43
- getSettings,
44
- getEditedPostType,
45
- } = select( editSiteStore );
42
+ const { getCanvasMode, getSettings, getEditedPostType } =
43
+ unlock( select( editSiteStore ) );
46
44
  return {
47
- canvasMode: __unstableGetCanvasMode(),
45
+ canvasMode: getCanvasMode(),
48
46
  dashboardLink: getSettings().__experimentalDashboardLink,
49
47
  entityConfig: select( coreStore ).getEntityConfig(
50
48
  'postType',
@@ -56,7 +54,7 @@ const SiteHub = forwardRef(
56
54
  );
57
55
  const disableMotion = useReducedMotion();
58
56
  const isMobileViewport = useViewportMatch( 'medium', '<' );
59
- const { __unstableSetCanvasMode } = useDispatch( editSiteStore );
57
+ const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
60
58
  const { clearSelectedBlock } = useDispatch( blockEditorStore );
61
59
  const showEditButton =
62
60
  ( isEditorPage && canvasMode === 'view' && ! isMobileViewport ) ||
@@ -77,7 +75,7 @@ const SiteHub = forwardRef(
77
75
  onClick: () => {
78
76
  clearSelectedBlock();
79
77
  setIsMobileCanvasVisible( false );
80
- __unstableSetCanvasMode( 'view' );
78
+ setCanvasMode( 'view' );
81
79
  },
82
80
  };
83
81
  const { getTitle } = useEditedEntityRecord();
@@ -137,7 +135,7 @@ const SiteHub = forwardRef(
137
135
  <Button
138
136
  className="edit-site-site-hub__edit-button"
139
137
  onClick={ () => {
140
- __unstableSetCanvasMode( 'edit' );
138
+ setCanvasMode( 'edit' );
141
139
  } }
142
140
  variant="primary"
143
141
  >
@@ -7,6 +7,7 @@
7
7
 
8
8
  .edit-site-site-hub__edit-button {
9
9
  height: $grid-unit-40;
10
+ color: $white;
10
11
  }
11
12
 
12
13
  .edit-site-site-hub__post-type {
@@ -9,15 +9,16 @@ import { useSelect, useDispatch } from '@wordpress/data';
9
9
  */
10
10
  import { store as editSiteStore } from '../../store';
11
11
  import { useLocation, useHistory } from '../routes';
12
+ import { unlock } from '../../experiments';
12
13
 
13
14
  export default function useSyncCanvasModeWithURL() {
14
15
  const history = useHistory();
15
16
  const { params } = useLocation();
16
17
  const canvasMode = useSelect(
17
- ( select ) => select( editSiteStore ).__unstableGetCanvasMode(),
18
+ ( select ) => unlock( select( editSiteStore ) ).getCanvasMode(),
18
19
  []
19
20
  );
20
- const { __unstableSetCanvasMode } = useDispatch( editSiteStore );
21
+ const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
21
22
  const currentCanvasMode = useRef( canvasMode );
22
23
  const { canvas: canvasInUrl = 'view' } = params;
23
24
  const currentCanvasInUrl = useRef( canvasInUrl );
@@ -34,7 +35,7 @@ export default function useSyncCanvasModeWithURL() {
34
35
  useEffect( () => {
35
36
  currentCanvasInUrl.current = canvasInUrl;
36
37
  if ( canvasInUrl !== currentCanvasMode.current ) {
37
- __unstableSetCanvasMode( canvasInUrl );
38
+ setCanvasMode( canvasInUrl );
38
39
  }
39
40
  }, [ canvasInUrl ] );
40
41
  }
@@ -530,27 +530,3 @@ export const switchEditorMode =
530
530
  speak( __( 'Mosaic view selected' ), 'assertive' );
531
531
  }
532
532
  };
533
-
534
- /**
535
- * Action that switches the canvas mode.
536
- *
537
- * @param {?string} mode Canvas mode.
538
- */
539
- export const __unstableSetCanvasMode =
540
- ( mode ) =>
541
- ( { registry, dispatch } ) => {
542
- registry.dispatch( blockEditorStore ).__unstableSetEditorMode( 'edit' );
543
- dispatch( {
544
- type: 'SET_CANVAS_MODE',
545
- mode,
546
- } );
547
- // Check if the block list view should be open by default.
548
- if (
549
- mode === 'edit' &&
550
- registry
551
- .select( preferencesStore )
552
- .get( 'core/edit-site', 'showListViewByDefault' )
553
- ) {
554
- dispatch.setIsListViewOpened( true );
555
- }
556
- };
@@ -8,8 +8,11 @@ import { createReduxStore, register } from '@wordpress/data';
8
8
  */
9
9
  import reducer from './reducer';
10
10
  import * as actions from './actions';
11
+ import * as privateActions from './private-actions';
11
12
  import * as selectors from './selectors';
13
+ import * as privateSelectors from './private-selectors';
12
14
  import { STORE_NAME } from './constants';
15
+ import { unlock } from '../experiments';
13
16
 
14
17
  export const storeConfig = {
15
18
  reducer,
@@ -19,3 +22,5 @@ export const storeConfig = {
19
22
 
20
23
  export const store = createReduxStore( STORE_NAME, storeConfig );
21
24
  register( store );
25
+ unlock( store ).registerPrivateSelectors( privateSelectors );
26
+ unlock( store ).registerPrivateActions( privateActions );
@@ -0,0 +1,29 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { store as blockEditorStore } from '@wordpress/block-editor';
5
+ import { store as preferencesStore } from '@wordpress/preferences';
6
+
7
+ /**
8
+ * Action that switches the canvas mode.
9
+ *
10
+ * @param {?string} mode Canvas mode.
11
+ */
12
+ export const setCanvasMode =
13
+ ( mode ) =>
14
+ ( { registry, dispatch } ) => {
15
+ registry.dispatch( blockEditorStore ).__unstableSetEditorMode( 'edit' );
16
+ dispatch( {
17
+ type: 'SET_CANVAS_MODE',
18
+ mode,
19
+ } );
20
+ // Check if the block list view should be open by default.
21
+ if (
22
+ mode === 'edit' &&
23
+ registry
24
+ .select( preferencesStore )
25
+ .get( 'core/edit-site', 'showListViewByDefault' )
26
+ ) {
27
+ dispatch.setIsListViewOpened( true );
28
+ }
29
+ };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Returns the current canvas mode.
3
+ *
4
+ * @param {Object} state Global application state.
5
+ *
6
+ * @return {string} Canvas mode.
7
+ */
8
+ export function getCanvasMode( state ) {
9
+ return state.canvasMode;
10
+ }
@@ -288,17 +288,6 @@ export function getEditorMode( state ) {
288
288
  return __unstableGetPreference( state, 'editorMode' );
289
289
  }
290
290
 
291
- /**
292
- * Returns the current canvas mode.
293
- *
294
- * @param {Object} state Global application state.
295
- *
296
- * @return {string} Canvas mode.
297
- */
298
- export function __unstableGetCanvasMode( state ) {
299
- return state.canvasMode;
300
- }
301
-
302
291
  /**
303
292
  * @deprecated
304
293
  */
package/src/style.scss CHANGED
@@ -19,6 +19,7 @@
19
19
  @import "./components/welcome-guide/style.scss";
20
20
  @import "./components/keyboard-shortcut-help-modal/style.scss";
21
21
  @import "./components/layout/style.scss";
22
+ @import "./components/save-panel/style.scss";
22
23
  @import "./components/sidebar/style.scss";
23
24
  @import "./components/sidebar-navigation-item/style.scss";
24
25
  @import "./components/sidebar-navigation-screen/style.scss";