@wordpress/edit-site 6.0.4 → 6.0.6

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 (43) hide show
  1. package/build/components/editor/index.js +2 -0
  2. package/build/components/editor/index.js.map +1 -1
  3. package/build/components/global-styles/shadows-edit-panel.js +1 -2
  4. package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
  5. package/build/components/layout/index.js +16 -8
  6. package/build/components/layout/index.js.map +1 -1
  7. package/build/components/layout/router.js +15 -10
  8. package/build/components/layout/router.js.map +1 -1
  9. package/build/components/revisions/index.js +10 -7
  10. package/build/components/revisions/index.js.map +1 -1
  11. package/build/components/site-hub/index.js +81 -1
  12. package/build/components/site-hub/index.js.map +1 -1
  13. package/build/store/private-actions.js +7 -2
  14. package/build/store/private-actions.js.map +1 -1
  15. package/build-module/components/editor/index.js +2 -0
  16. package/build-module/components/editor/index.js.map +1 -1
  17. package/build-module/components/global-styles/shadows-edit-panel.js +1 -2
  18. package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
  19. package/build-module/components/layout/index.js +14 -8
  20. package/build-module/components/layout/index.js.map +1 -1
  21. package/build-module/components/layout/router.js +15 -10
  22. package/build-module/components/layout/router.js.map +1 -1
  23. package/build-module/components/revisions/index.js +10 -7
  24. package/build-module/components/revisions/index.js.map +1 -1
  25. package/build-module/components/site-hub/index.js +81 -1
  26. package/build-module/components/site-hub/index.js.map +1 -1
  27. package/build-module/store/private-actions.js +7 -2
  28. package/build-module/store/private-actions.js.map +1 -1
  29. package/build-style/style-rtl.css +17 -13
  30. package/build-style/style.css +17 -13
  31. package/package.json +11 -11
  32. package/src/components/editor/index.js +2 -0
  33. package/src/components/global-styles/shadows-edit-panel.js +1 -2
  34. package/src/components/layout/index.js +13 -4
  35. package/src/components/layout/router.js +23 -15
  36. package/src/components/layout/style.scss +12 -0
  37. package/src/components/page-pages/style.scss +1 -1
  38. package/src/components/page-patterns/style.scss +1 -8
  39. package/src/components/page-templates/style.scss +1 -6
  40. package/src/components/revisions/index.js +9 -1
  41. package/src/components/sidebar/style.scss +6 -0
  42. package/src/components/site-hub/index.js +84 -1
  43. package/src/store/private-actions.js +7 -3
@@ -43,7 +43,7 @@
43
43
  overflow: hidden;
44
44
  height: 100%;
45
45
  width: 100%;
46
- border-radius: 3px 3px 0 0;
46
+ border-radius: $grid-unit-05;
47
47
 
48
48
  &:focus-visible {
49
49
  box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
@@ -35,13 +35,6 @@
35
35
  display: flex;
36
36
  flex-direction: column;
37
37
  height: 100%;
38
- border-radius: 3px 3px 0 0;
39
-
40
- &.is-viewtype-grid {
41
- .block-editor-block-preview__container {
42
- border-radius: 3px 3px 0 0;
43
- }
44
- }
45
38
 
46
39
  &.is-viewtype-table {
47
40
  width: 96px;
@@ -62,7 +55,7 @@
62
55
  cursor: pointer;
63
56
  overflow: hidden;
64
57
  height: 100%;
65
- border-radius: 3px 3px 0 0;
58
+ border-radius: $grid-unit-05;
66
59
 
67
60
  &:focus-visible {
68
61
  box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
@@ -2,7 +2,6 @@
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  height: 100%;
5
- border-radius: 3px 3px 0 0;
6
5
 
7
6
  .page-templates-preview-field__button {
8
7
  box-shadow: none;
@@ -13,7 +12,7 @@
13
12
  cursor: pointer;
14
13
  overflow: hidden;
15
14
  height: 100%;
16
- border-radius: 3px;
15
+ border-radius: $grid-unit-05;
17
16
 
18
17
  &:focus-visible {
19
18
  box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
@@ -32,10 +31,6 @@
32
31
  .block-editor-block-preview__container {
33
32
  height: 100%;
34
33
  }
35
-
36
- .page-templates-preview-field__button {
37
- border-radius: 3px 3px 0 0;
38
- }
39
34
  }
40
35
 
41
36
  &.is-viewtype-table {
@@ -25,6 +25,7 @@ const {
25
25
  ExperimentalBlockEditorProvider,
26
26
  GlobalStylesContext,
27
27
  useGlobalStylesOutputWithConfig,
28
+ __unstableBlockStyleVariationOverridesWithConfig,
28
29
  } = unlock( blockEditorPrivateApis );
29
30
  const { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );
30
31
 
@@ -74,7 +75,6 @@ function Revisions( { userConfig, blocks } ) {
74
75
  name="revisions"
75
76
  tabIndex={ 0 }
76
77
  >
77
- <EditorStyles styles={ editorStyles } />
78
78
  <style>
79
79
  {
80
80
  // Forming a "block formatting context" to prevent margin collapsing.
@@ -88,6 +88,14 @@ function Revisions( { userConfig, blocks } ) {
88
88
  settings={ settings }
89
89
  >
90
90
  <BlockList renderAppender={ false } />
91
+ { /*
92
+ * Styles are printed inside the block editor provider,
93
+ * so they can access any registered style overrides.
94
+ */ }
95
+ <EditorStyles styles={ editorStyles } />
96
+ <__unstableBlockStyleVariationOverridesWithConfig
97
+ config={ mergedConfig }
98
+ />
91
99
  </ExperimentalBlockEditorProvider>
92
100
  </Disabled>
93
101
  </Iframe>
@@ -1,6 +1,12 @@
1
1
  .edit-site-sidebar__content {
2
2
  flex-grow: 1;
3
3
  overflow-y: auto;
4
+ // Prevents horizontal overflow while animating screen transitions
5
+ overflow-x: hidden;
6
+ // Mark this section of the DOM as isolated, providing performance benefits
7
+ // by limiting calculations of layout, style and paint to a DOM subtree rather
8
+ // than the entire page.
9
+ contain: content;
4
10
  }
5
11
 
6
12
  @keyframes slide-from-right {
@@ -11,11 +11,12 @@ import { Button, __experimentalHStack as HStack } from '@wordpress/components';
11
11
  import { __ } from '@wordpress/i18n';
12
12
  import { store as coreStore } from '@wordpress/core-data';
13
13
  import { decodeEntities } from '@wordpress/html-entities';
14
- import { memo, forwardRef } from '@wordpress/element';
14
+ import { memo, forwardRef, useContext } from '@wordpress/element';
15
15
  import { search } from '@wordpress/icons';
16
16
  import { store as commandsStore } from '@wordpress/commands';
17
17
  import { displayShortcut } from '@wordpress/keycodes';
18
18
  import { filterURLForDisplay } from '@wordpress/url';
19
+ import { privateApis as routerPrivateApis } from '@wordpress/router';
19
20
 
20
21
  /**
21
22
  * Internal dependencies
@@ -23,6 +24,8 @@ import { filterURLForDisplay } from '@wordpress/url';
23
24
  import { store as editSiteStore } from '../../store';
24
25
  import SiteIcon from '../site-icon';
25
26
  import { unlock } from '../../lock-unlock';
27
+ const { useHistory } = unlock( routerPrivateApis );
28
+ import { SidebarNavigationContext } from '../sidebar';
26
29
 
27
30
  const SiteHub = memo(
28
31
  forwardRef( ( { isTransparent }, ref ) => {
@@ -103,3 +106,83 @@ const SiteHub = memo(
103
106
  );
104
107
 
105
108
  export default SiteHub;
109
+
110
+ export const SiteHubMobile = memo(
111
+ forwardRef( ( { isTransparent }, ref ) => {
112
+ const history = useHistory();
113
+ const { navigate } = useContext( SidebarNavigationContext );
114
+
115
+ const { homeUrl, siteTitle } = useSelect( ( select ) => {
116
+ const {
117
+ getSite,
118
+ getUnstableBase, // Site index.
119
+ } = select( coreStore );
120
+ const _site = getSite();
121
+ return {
122
+ homeUrl: getUnstableBase()?.home,
123
+ siteTitle:
124
+ ! _site?.title && !! _site?.url
125
+ ? filterURLForDisplay( _site?.url )
126
+ : _site?.title,
127
+ };
128
+ }, [] );
129
+ const { open: openCommandCenter } = useDispatch( commandsStore );
130
+
131
+ return (
132
+ <div className="edit-site-site-hub">
133
+ <HStack justify="flex-start" spacing="0">
134
+ <div
135
+ className={ clsx(
136
+ 'edit-site-site-hub__view-mode-toggle-container',
137
+ {
138
+ 'has-transparent-background': isTransparent,
139
+ }
140
+ ) }
141
+ >
142
+ <Button
143
+ ref={ ref }
144
+ label={ __( 'Go to Site Editor' ) }
145
+ className="edit-site-layout__view-mode-toggle"
146
+ style={ {
147
+ transform: 'scale(0.5)',
148
+ borderRadius: 4,
149
+ } }
150
+ onClick={ () => {
151
+ history.push( {} );
152
+ navigate( 'back' );
153
+ } }
154
+ >
155
+ <SiteIcon className="edit-site-layout__view-mode-toggle-icon" />
156
+ </Button>
157
+ </div>
158
+
159
+ <HStack>
160
+ <div className="edit-site-site-hub__title">
161
+ <Button
162
+ variant="link"
163
+ href={ homeUrl }
164
+ target="_blank"
165
+ label={ __( 'View site (opens in a new tab)' ) }
166
+ >
167
+ { decodeEntities( siteTitle ) }
168
+ </Button>
169
+ </div>
170
+ <HStack
171
+ spacing={ 0 }
172
+ expanded={ false }
173
+ className="edit-site-site-hub__actions"
174
+ >
175
+ <Button
176
+ className="edit-site-site-hub_toggle-command-center"
177
+ icon={ search }
178
+ onClick={ () => openCommandCenter() }
179
+ label={ __( 'Open command palette' ) }
180
+ shortcut={ displayShortcut.primary( 'k' ) }
181
+ />
182
+ </HStack>
183
+ </HStack>
184
+ </HStack>
185
+ </div>
186
+ );
187
+ } )
188
+ );
@@ -13,10 +13,10 @@ import { store as editorStore } from '@wordpress/editor';
13
13
  export const setCanvasMode =
14
14
  ( mode ) =>
15
15
  ( { registry, dispatch } ) => {
16
+ const isMediumOrBigger =
17
+ window.matchMedia( '(min-width: 782px)' ).matches;
16
18
  const switchCanvasMode = () => {
17
19
  registry.batch( () => {
18
- const isMediumOrBigger =
19
- window.matchMedia( '(min-width: 782px)' ).matches;
20
20
  registry.dispatch( blockEditorStore ).clearSelectedBlock();
21
21
  registry.dispatch( editorStore ).setDeviceType( 'Desktop' );
22
22
  registry
@@ -59,7 +59,11 @@ export const setCanvasMode =
59
59
  } );
60
60
  };
61
61
 
62
- if ( ! document.startViewTransition ) {
62
+ /*
63
+ * Skip transition in mobile, otherwise it crashes the browser.
64
+ * See: https://github.com/WordPress/gutenberg/pull/63002.
65
+ */
66
+ if ( ! isMediumOrBigger || ! document.startViewTransition ) {
63
67
  switchCanvasMode();
64
68
  } else {
65
69
  document.documentElement.classList.add(