@wordpress/edit-site 6.11.0 → 6.12.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 (190) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/app/index.js +0 -2
  3. package/build/components/app/index.js.map +1 -1
  4. package/build/components/block-editor/use-editor-iframe-props.js +6 -8
  5. package/build/components/block-editor/use-editor-iframe-props.js.map +1 -1
  6. package/build/components/editor/index.js +9 -4
  7. package/build/components/editor/index.js.map +1 -1
  8. package/build/components/editor/use-editor-title.js +29 -12
  9. package/build/components/editor/use-editor-title.js.map +1 -1
  10. package/build/components/global-styles/screen-revisions/revisions-buttons.js +24 -22
  11. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  12. package/build/components/global-styles/shadows-edit-panel.js +2 -3
  13. package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
  14. package/build/components/global-styles/ui.js +42 -2
  15. package/build/components/global-styles/ui.js.map +1 -1
  16. package/build/components/global-styles-renderer/index.js +6 -8
  17. package/build/components/global-styles-renderer/index.js.map +1 -1
  18. package/build/components/layout/hooks.js +1 -10
  19. package/build/components/layout/hooks.js.map +1 -1
  20. package/build/components/layout/index.js +1 -0
  21. package/build/components/layout/index.js.map +1 -1
  22. package/build/components/page-patterns/fields.js +3 -7
  23. package/build/components/page-patterns/fields.js.map +1 -1
  24. package/build/components/page-templates/fields.js +1 -2
  25. package/build/components/page-templates/fields.js.map +1 -1
  26. package/build/components/post-edit/index.js +14 -8
  27. package/build/components/post-edit/index.js.map +1 -1
  28. package/build/components/post-fields/index.js +3 -197
  29. package/build/components/post-fields/index.js.map +1 -1
  30. package/build/components/post-list/index.js +11 -1
  31. package/build/components/post-list/index.js.map +1 -1
  32. package/build/components/sidebar/index.js +11 -3
  33. package/build/components/sidebar/index.js.map +1 -1
  34. package/build/components/sidebar-global-styles-wrapper/index.js +129 -0
  35. package/build/components/sidebar-global-styles-wrapper/index.js.map +1 -0
  36. package/build/components/sidebar-navigation-screen-global-styles/index.js +14 -72
  37. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  38. package/build/components/sidebar-navigation-screen-main/index.js +43 -42
  39. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  40. package/build/components/site-editor-routes/styles-edit.js +6 -1
  41. package/build/components/site-editor-routes/styles-edit.js.map +1 -1
  42. package/build/components/site-editor-routes/styles-view.js +8 -2
  43. package/build/components/site-editor-routes/styles-view.js.map +1 -1
  44. package/build/components/site-hub/index.js +19 -6
  45. package/build/components/site-hub/index.js.map +1 -1
  46. package/build/components/style-book/constants.js +10 -3
  47. package/build/components/style-book/constants.js.map +1 -1
  48. package/build/components/style-book/examples.js +71 -1
  49. package/build/components/style-book/examples.js.map +1 -1
  50. package/build/components/style-book/index.js +70 -11
  51. package/build/components/style-book/index.js.map +1 -1
  52. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +32 -32
  53. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  54. package/build/components/welcome-guide/index.js +4 -2
  55. package/build/components/welcome-guide/index.js.map +1 -1
  56. package/build/components/welcome-guide/page.js +1 -9
  57. package/build/components/welcome-guide/page.js.map +1 -1
  58. package/build/components/welcome-guide/template.js +1 -12
  59. package/build/components/welcome-guide/template.js.map +1 -1
  60. package/build/hooks/commands/use-common-commands.js +15 -15
  61. package/build/hooks/commands/use-common-commands.js.map +1 -1
  62. package/build/index.js +1 -0
  63. package/build/index.js.map +1 -1
  64. package/build/posts.js +1 -0
  65. package/build/posts.js.map +1 -1
  66. package/build-module/components/app/index.js +0 -2
  67. package/build-module/components/app/index.js.map +1 -1
  68. package/build-module/components/block-editor/use-editor-iframe-props.js +6 -8
  69. package/build-module/components/block-editor/use-editor-iframe-props.js.map +1 -1
  70. package/build-module/components/editor/index.js +9 -4
  71. package/build-module/components/editor/index.js.map +1 -1
  72. package/build-module/components/editor/use-editor-title.js +29 -12
  73. package/build-module/components/editor/use-editor-title.js.map +1 -1
  74. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +25 -23
  75. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  76. package/build-module/components/global-styles/shadows-edit-panel.js +2 -3
  77. package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
  78. package/build-module/components/global-styles/ui.js +43 -3
  79. package/build-module/components/global-styles/ui.js.map +1 -1
  80. package/build-module/components/global-styles-renderer/index.js +6 -8
  81. package/build-module/components/global-styles-renderer/index.js.map +1 -1
  82. package/build-module/components/layout/hooks.js +1 -9
  83. package/build-module/components/layout/hooks.js.map +1 -1
  84. package/build-module/components/layout/index.js +1 -0
  85. package/build-module/components/layout/index.js.map +1 -1
  86. package/build-module/components/page-patterns/fields.js +4 -8
  87. package/build-module/components/page-patterns/fields.js.map +1 -1
  88. package/build-module/components/page-templates/fields.js +1 -2
  89. package/build-module/components/page-templates/fields.js.map +1 -1
  90. package/build-module/components/post-edit/index.js +14 -8
  91. package/build-module/components/post-edit/index.js.map +1 -1
  92. package/build-module/components/post-fields/index.js +7 -202
  93. package/build-module/components/post-fields/index.js.map +1 -1
  94. package/build-module/components/post-list/index.js +11 -1
  95. package/build-module/components/post-list/index.js.map +1 -1
  96. package/build-module/components/sidebar/index.js +11 -3
  97. package/build-module/components/sidebar/index.js.map +1 -1
  98. package/build-module/components/sidebar-global-styles-wrapper/index.js +121 -0
  99. package/build-module/components/sidebar-global-styles-wrapper/index.js.map +1 -0
  100. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +15 -73
  101. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  102. package/build-module/components/sidebar-navigation-screen-main/index.js +43 -43
  103. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  104. package/build-module/components/site-editor-routes/styles-edit.js +6 -1
  105. package/build-module/components/site-editor-routes/styles-edit.js.map +1 -1
  106. package/build-module/components/site-editor-routes/styles-view.js +8 -2
  107. package/build-module/components/site-editor-routes/styles-view.js.map +1 -1
  108. package/build-module/components/site-hub/index.js +19 -6
  109. package/build-module/components/site-hub/index.js.map +1 -1
  110. package/build-module/components/style-book/constants.js +10 -3
  111. package/build-module/components/style-book/constants.js.map +1 -1
  112. package/build-module/components/style-book/examples.js +71 -1
  113. package/build-module/components/style-book/examples.js.map +1 -1
  114. package/build-module/components/style-book/index.js +71 -12
  115. package/build-module/components/style-book/index.js.map +1 -1
  116. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +32 -32
  117. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  118. package/build-module/components/welcome-guide/index.js +4 -2
  119. package/build-module/components/welcome-guide/index.js.map +1 -1
  120. package/build-module/components/welcome-guide/page.js +1 -9
  121. package/build-module/components/welcome-guide/page.js.map +1 -1
  122. package/build-module/components/welcome-guide/template.js +1 -11
  123. package/build-module/components/welcome-guide/template.js.map +1 -1
  124. package/build-module/hooks/commands/use-common-commands.js +15 -15
  125. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  126. package/build-module/index.js +1 -0
  127. package/build-module/index.js.map +1 -1
  128. package/build-module/posts.js +1 -0
  129. package/build-module/posts.js.map +1 -1
  130. package/build-style/posts-rtl.css +54 -5
  131. package/build-style/posts.css +54 -5
  132. package/build-style/style-rtl.css +109 -28
  133. package/build-style/style.css +109 -28
  134. package/package.json +3 -4
  135. package/src/components/app/index.js +0 -2
  136. package/src/components/block-editor/use-editor-iframe-props.js +2 -3
  137. package/src/components/editor/index.js +16 -4
  138. package/src/components/editor/use-editor-title.js +37 -13
  139. package/src/components/editor-canvas-container/style.scss +0 -1
  140. package/src/components/global-styles/screen-revisions/revisions-buttons.js +28 -31
  141. package/src/components/global-styles/screen-revisions/style.scss +11 -17
  142. package/src/components/global-styles/shadows-edit-panel.js +4 -2
  143. package/src/components/global-styles/ui.js +42 -2
  144. package/src/components/global-styles-renderer/index.js +4 -10
  145. package/src/components/layout/hooks.js +1 -7
  146. package/src/components/layout/index.js +6 -1
  147. package/src/components/page-patterns/fields.js +6 -12
  148. package/src/components/page-patterns/style.scss +0 -5
  149. package/src/components/page-templates/fields.js +2 -3
  150. package/src/components/post-edit/index.js +38 -30
  151. package/src/components/post-edit/style.scss +7 -0
  152. package/src/components/post-fields/index.js +19 -273
  153. package/src/components/post-list/index.js +9 -3
  154. package/src/components/post-list/style.scss +29 -3
  155. package/src/components/sidebar/index.js +23 -7
  156. package/src/components/sidebar-global-styles-wrapper/index.js +150 -0
  157. package/src/components/sidebar-global-styles-wrapper/style.scss +35 -0
  158. package/src/components/sidebar-navigation-item/style.scss +2 -2
  159. package/src/components/sidebar-navigation-screen-global-styles/index.js +13 -88
  160. package/src/components/sidebar-navigation-screen-main/index.js +46 -45
  161. package/src/components/site-editor-routes/styles-edit.js +10 -1
  162. package/src/components/site-editor-routes/styles-view.js +11 -1
  163. package/src/components/site-hub/index.js +33 -16
  164. package/src/components/site-icon/style.scss +16 -0
  165. package/src/components/style-book/constants.ts +11 -3
  166. package/src/components/style-book/examples.tsx +105 -1
  167. package/src/components/style-book/index.js +86 -8
  168. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +54 -64
  169. package/src/components/welcome-guide/index.js +3 -3
  170. package/src/components/welcome-guide/page.js +1 -7
  171. package/src/components/welcome-guide/template.js +1 -8
  172. package/src/hooks/commands/use-common-commands.js +253 -246
  173. package/src/index.js +1 -0
  174. package/src/posts.js +1 -0
  175. package/src/style.scss +2 -3
  176. package/build/components/async/index.js +0 -51
  177. package/build/components/async/index.js.map +0 -1
  178. package/build/components/use-edited-entity-record/index.js +0 -60
  179. package/build/components/use-edited-entity-record/index.js.map +0 -1
  180. package/build/hooks/commands/use-edit-mode-commands.js +0 -179
  181. package/build/hooks/commands/use-edit-mode-commands.js.map +0 -1
  182. package/build-module/components/async/index.js +0 -44
  183. package/build-module/components/async/index.js.map +0 -1
  184. package/build-module/components/use-edited-entity-record/index.js +0 -53
  185. package/build-module/components/use-edited-entity-record/index.js.map +0 -1
  186. package/build-module/hooks/commands/use-edit-mode-commands.js +0 -171
  187. package/build-module/hooks/commands/use-edit-mode-commands.js.map +0 -1
  188. package/src/components/async/index.js +0 -43
  189. package/src/components/use-edited-entity-record/index.js +0 -58
  190. package/src/hooks/commands/use-edit-mode-commands.js +0 -168
@@ -28,282 +28,289 @@ import { store as editSiteStore } from '../../store';
28
28
  const { useGlobalStylesReset } = unlock( blockEditorPrivateApis );
29
29
  const { useHistory, useLocation } = unlock( routerPrivateApis );
30
30
 
31
- function useGlobalStylesOpenStylesCommands() {
32
- const { openGeneralSidebar } = unlock( useDispatch( editSiteStore ) );
33
- const { params } = useLocation();
34
- const { canvas = 'view' } = params;
35
- const history = useHistory();
36
- const isBlockBasedTheme = useSelect( ( select ) => {
37
- return select( coreStore ).getCurrentTheme().is_block_theme;
38
- }, [] );
31
+ const getGlobalStylesOpenStylesCommands = () =>
32
+ function useGlobalStylesOpenStylesCommands() {
33
+ const { openGeneralSidebar } = unlock( useDispatch( editSiteStore ) );
34
+ const { params } = useLocation();
35
+ const { canvas = 'view' } = params;
36
+ const history = useHistory();
37
+ const isBlockBasedTheme = useSelect( ( select ) => {
38
+ return select( coreStore ).getCurrentTheme().is_block_theme;
39
+ }, [] );
39
40
 
40
- const commands = useMemo( () => {
41
- if ( ! isBlockBasedTheme ) {
42
- return [];
43
- }
41
+ const commands = useMemo( () => {
42
+ if ( ! isBlockBasedTheme ) {
43
+ return [];
44
+ }
44
45
 
45
- return [
46
- {
47
- name: 'core/edit-site/open-styles',
48
- label: __( 'Open styles' ),
49
- callback: ( { close } ) => {
50
- close();
51
- if ( ! params.postId ) {
52
- history.push( {
53
- path: '/wp_global_styles',
54
- canvas: 'edit',
55
- } );
56
- }
57
- if ( params.postId && canvas !== 'edit' ) {
58
- history.push(
59
- { ...params, canvas: 'edit' },
60
- undefined,
61
- {
62
- transition: 'canvas-mode-edit-transition',
63
- }
64
- );
65
- }
66
- openGeneralSidebar( 'edit-site/global-styles' );
46
+ return [
47
+ {
48
+ name: 'core/edit-site/open-styles',
49
+ label: __( 'Open styles' ),
50
+ callback: ( { close } ) => {
51
+ close();
52
+ if ( ! params.postId ) {
53
+ history.push( {
54
+ path: '/wp_global_styles',
55
+ canvas: 'edit',
56
+ } );
57
+ }
58
+ if ( params.postId && canvas !== 'edit' ) {
59
+ history.push(
60
+ { ...params, canvas: 'edit' },
61
+ undefined,
62
+ {
63
+ transition: 'canvas-mode-edit-transition',
64
+ }
65
+ );
66
+ }
67
+ openGeneralSidebar( 'edit-site/global-styles' );
68
+ },
69
+ icon: styles,
67
70
  },
68
- icon: styles,
69
- },
70
- ];
71
- }, [ history, openGeneralSidebar, params, canvas, isBlockBasedTheme ] );
71
+ ];
72
+ }, [ history, openGeneralSidebar, params, canvas, isBlockBasedTheme ] );
72
73
 
73
- return {
74
- isLoading: false,
75
- commands,
74
+ return {
75
+ isLoading: false,
76
+ commands,
77
+ };
76
78
  };
77
- }
78
79
 
79
- function useGlobalStylesToggleWelcomeGuideCommands() {
80
- const { openGeneralSidebar } = unlock( useDispatch( editSiteStore ) );
81
- const { params } = useLocation();
82
- const { canvas = 'view' } = params;
83
- const { set } = useDispatch( preferencesStore );
80
+ const getGlobalStylesToggleWelcomeGuideCommands = () =>
81
+ function useGlobalStylesToggleWelcomeGuideCommands() {
82
+ const { openGeneralSidebar } = unlock( useDispatch( editSiteStore ) );
83
+ const { params } = useLocation();
84
+ const { canvas = 'view' } = params;
85
+ const { set } = useDispatch( preferencesStore );
84
86
 
85
- const history = useHistory();
86
- const isBlockBasedTheme = useSelect( ( select ) => {
87
- return select( coreStore ).getCurrentTheme().is_block_theme;
88
- }, [] );
87
+ const history = useHistory();
88
+ const isBlockBasedTheme = useSelect( ( select ) => {
89
+ return select( coreStore ).getCurrentTheme().is_block_theme;
90
+ }, [] );
89
91
 
90
- const commands = useMemo( () => {
91
- if ( ! isBlockBasedTheme ) {
92
- return [];
93
- }
92
+ const commands = useMemo( () => {
93
+ if ( ! isBlockBasedTheme ) {
94
+ return [];
95
+ }
94
96
 
95
- return [
96
- {
97
- name: 'core/edit-site/toggle-styles-welcome-guide',
98
- label: __( 'Learn about styles' ),
99
- callback: ( { close } ) => {
100
- close();
101
- if ( ! params.postId ) {
102
- history.push( {
103
- path: '/wp_global_styles',
104
- canvas: 'edit',
105
- } );
106
- }
107
- if ( params.postId && canvas !== 'edit' ) {
108
- history.push(
109
- {
110
- ...params,
97
+ return [
98
+ {
99
+ name: 'core/edit-site/toggle-styles-welcome-guide',
100
+ label: __( 'Learn about styles' ),
101
+ callback: ( { close } ) => {
102
+ close();
103
+ if ( ! params.postId ) {
104
+ history.push( {
105
+ path: '/wp_global_styles',
111
106
  canvas: 'edit',
112
- },
113
- undefined,
114
- {
115
- transition: 'canvas-mode-edit-transition',
116
- }
117
- );
118
- }
119
- openGeneralSidebar( 'edit-site/global-styles' );
120
- set( 'core/edit-site', 'welcomeGuideStyles', true );
121
- // sometimes there's a focus loss that happens after some time
122
- // that closes the modal, we need to force reopening it.
123
- setTimeout( () => {
107
+ } );
108
+ }
109
+ if ( params.postId && canvas !== 'edit' ) {
110
+ history.push(
111
+ {
112
+ ...params,
113
+ canvas: 'edit',
114
+ },
115
+ undefined,
116
+ {
117
+ transition: 'canvas-mode-edit-transition',
118
+ }
119
+ );
120
+ }
121
+ openGeneralSidebar( 'edit-site/global-styles' );
124
122
  set( 'core/edit-site', 'welcomeGuideStyles', true );
125
- }, 500 );
123
+ // sometimes there's a focus loss that happens after some time
124
+ // that closes the modal, we need to force reopening it.
125
+ setTimeout( () => {
126
+ set( 'core/edit-site', 'welcomeGuideStyles', true );
127
+ }, 500 );
128
+ },
129
+ icon: help,
126
130
  },
127
- icon: help,
128
- },
129
- ];
130
- }, [
131
- history,
132
- openGeneralSidebar,
133
- canvas,
134
- isBlockBasedTheme,
135
- set,
136
- params,
137
- ] );
131
+ ];
132
+ }, [
133
+ history,
134
+ openGeneralSidebar,
135
+ canvas,
136
+ isBlockBasedTheme,
137
+ set,
138
+ params,
139
+ ] );
138
140
 
139
- return {
140
- isLoading: false,
141
- commands,
141
+ return {
142
+ isLoading: false,
143
+ commands,
144
+ };
142
145
  };
143
- }
144
146
 
145
- function useGlobalStylesResetCommands() {
146
- const [ canReset, onReset ] = useGlobalStylesReset();
147
- const commands = useMemo( () => {
148
- if ( ! canReset ) {
149
- return [];
150
- }
147
+ const getGlobalStylesResetCommands = () =>
148
+ function useGlobalStylesResetCommands() {
149
+ const [ canReset, onReset ] = useGlobalStylesReset();
150
+ const commands = useMemo( () => {
151
+ if ( ! canReset ) {
152
+ return [];
153
+ }
151
154
 
152
- return [
153
- {
154
- name: 'core/edit-site/reset-global-styles',
155
- label: __( 'Reset styles' ),
156
- icon: isRTL() ? rotateRight : rotateLeft,
157
- callback: ( { close } ) => {
158
- close();
159
- onReset();
155
+ return [
156
+ {
157
+ name: 'core/edit-site/reset-global-styles',
158
+ label: __( 'Reset styles' ),
159
+ icon: isRTL() ? rotateRight : rotateLeft,
160
+ callback: ( { close } ) => {
161
+ close();
162
+ onReset();
163
+ },
160
164
  },
161
- },
162
- ];
163
- }, [ canReset, onReset ] );
165
+ ];
166
+ }, [ canReset, onReset ] );
164
167
 
165
- return {
166
- isLoading: false,
167
- commands,
168
+ return {
169
+ isLoading: false,
170
+ commands,
171
+ };
168
172
  };
169
- }
170
173
 
171
- function useGlobalStylesOpenCssCommands() {
172
- const { openGeneralSidebar, setEditorCanvasContainerView } = unlock(
173
- useDispatch( editSiteStore )
174
- );
175
- const { params } = useLocation();
176
- const { canvas = 'view' } = params;
177
- const history = useHistory();
178
- const { canEditCSS } = useSelect( ( select ) => {
179
- const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =
180
- select( coreStore );
174
+ const getGlobalStylesOpenCssCommands = () =>
175
+ function useGlobalStylesOpenCssCommands() {
176
+ const { openGeneralSidebar, setEditorCanvasContainerView } = unlock(
177
+ useDispatch( editSiteStore )
178
+ );
179
+ const { params } = useLocation();
180
+ const { canvas = 'view' } = params;
181
+ const history = useHistory();
182
+ const { canEditCSS } = useSelect( ( select ) => {
183
+ const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =
184
+ select( coreStore );
181
185
 
182
- const globalStylesId = __experimentalGetCurrentGlobalStylesId();
183
- const globalStyles = globalStylesId
184
- ? getEntityRecord( 'root', 'globalStyles', globalStylesId )
185
- : undefined;
186
+ const globalStylesId = __experimentalGetCurrentGlobalStylesId();
187
+ const globalStyles = globalStylesId
188
+ ? getEntityRecord( 'root', 'globalStyles', globalStylesId )
189
+ : undefined;
186
190
 
187
- return {
188
- canEditCSS: !! globalStyles?._links?.[ 'wp:action-edit-css' ],
189
- };
190
- }, [] );
191
+ return {
192
+ canEditCSS: !! globalStyles?._links?.[ 'wp:action-edit-css' ],
193
+ };
194
+ }, [] );
191
195
 
192
- const commands = useMemo( () => {
193
- if ( ! canEditCSS ) {
194
- return [];
195
- }
196
+ const commands = useMemo( () => {
197
+ if ( ! canEditCSS ) {
198
+ return [];
199
+ }
196
200
 
197
- return [
198
- {
199
- name: 'core/edit-site/open-styles-css',
200
- label: __( 'Customize CSS' ),
201
- icon: brush,
202
- callback: ( { close } ) => {
203
- close();
204
- if ( ! params.postId ) {
205
- history.push( {
206
- path: '/wp_global_styles',
207
- canvas: 'edit',
208
- } );
209
- }
210
- if ( params.postId && canvas !== 'edit' ) {
211
- history.push(
212
- {
213
- ...params,
201
+ return [
202
+ {
203
+ name: 'core/edit-site/open-styles-css',
204
+ label: __( 'Customize CSS' ),
205
+ icon: brush,
206
+ callback: ( { close } ) => {
207
+ close();
208
+ if ( ! params.postId ) {
209
+ history.push( {
210
+ path: '/wp_global_styles',
214
211
  canvas: 'edit',
215
- },
216
- undefined,
217
- {
218
- transition: 'canvas-mode-edit-transition',
219
- }
220
- );
221
- }
222
- openGeneralSidebar( 'edit-site/global-styles' );
223
- setEditorCanvasContainerView( 'global-styles-css' );
212
+ } );
213
+ }
214
+ if ( params.postId && canvas !== 'edit' ) {
215
+ history.push(
216
+ {
217
+ ...params,
218
+ canvas: 'edit',
219
+ },
220
+ undefined,
221
+ {
222
+ transition: 'canvas-mode-edit-transition',
223
+ }
224
+ );
225
+ }
226
+ openGeneralSidebar( 'edit-site/global-styles' );
227
+ setEditorCanvasContainerView( 'global-styles-css' );
228
+ },
224
229
  },
225
- },
226
- ];
227
- }, [
228
- history,
229
- openGeneralSidebar,
230
- setEditorCanvasContainerView,
231
- canEditCSS,
232
- canvas,
233
- params,
234
- ] );
235
- return {
236
- isLoading: false,
237
- commands,
230
+ ];
231
+ }, [
232
+ history,
233
+ openGeneralSidebar,
234
+ setEditorCanvasContainerView,
235
+ canEditCSS,
236
+ canvas,
237
+ params,
238
+ ] );
239
+ return {
240
+ isLoading: false,
241
+ commands,
242
+ };
238
243
  };
239
- }
240
244
 
241
- function useGlobalStylesOpenRevisionsCommands() {
242
- const { openGeneralSidebar, setEditorCanvasContainerView } = unlock(
243
- useDispatch( editSiteStore )
244
- );
245
- const { params } = useLocation();
246
- const { canvas = 'view' } = params;
247
- const history = useHistory();
248
- const hasRevisions = useSelect( ( select ) => {
249
- const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =
250
- select( coreStore );
251
- const globalStylesId = __experimentalGetCurrentGlobalStylesId();
252
- const globalStyles = globalStylesId
253
- ? getEntityRecord( 'root', 'globalStyles', globalStylesId )
254
- : undefined;
255
- return !! globalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count;
256
- }, [] );
245
+ const getGlobalStylesOpenRevisionsCommands = () =>
246
+ function useGlobalStylesOpenRevisionsCommands() {
247
+ const { openGeneralSidebar, setEditorCanvasContainerView } = unlock(
248
+ useDispatch( editSiteStore )
249
+ );
250
+ const { params } = useLocation();
251
+ const { canvas = 'view' } = params;
252
+ const history = useHistory();
253
+ const hasRevisions = useSelect( ( select ) => {
254
+ const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =
255
+ select( coreStore );
256
+ const globalStylesId = __experimentalGetCurrentGlobalStylesId();
257
+ const globalStyles = globalStylesId
258
+ ? getEntityRecord( 'root', 'globalStyles', globalStylesId )
259
+ : undefined;
260
+ return !! globalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count;
261
+ }, [] );
257
262
 
258
- const commands = useMemo( () => {
259
- if ( ! hasRevisions ) {
260
- return [];
261
- }
263
+ const commands = useMemo( () => {
264
+ if ( ! hasRevisions ) {
265
+ return [];
266
+ }
262
267
 
263
- return [
264
- {
265
- name: 'core/edit-site/open-global-styles-revisions',
266
- label: __( 'Style revisions' ),
267
- icon: backup,
268
- callback: ( { close } ) => {
269
- close();
270
- if ( ! params.postId ) {
271
- history.push( {
272
- path: '/wp_global_styles',
273
- canvas: 'edit',
274
- } );
275
- }
276
- if ( params.postId && canvas !== 'edit' ) {
277
- history.push(
278
- {
279
- ...params,
268
+ return [
269
+ {
270
+ name: 'core/edit-site/open-global-styles-revisions',
271
+ label: __( 'Style revisions' ),
272
+ icon: backup,
273
+ callback: ( { close } ) => {
274
+ close();
275
+ if ( ! params.postId ) {
276
+ history.push( {
277
+ path: '/wp_global_styles',
280
278
  canvas: 'edit',
281
- },
282
- undefined,
283
- {
284
- transition: 'canvas-mode-edit-transition',
285
- }
279
+ } );
280
+ }
281
+ if ( params.postId && canvas !== 'edit' ) {
282
+ history.push(
283
+ {
284
+ ...params,
285
+ canvas: 'edit',
286
+ },
287
+ undefined,
288
+ {
289
+ transition: 'canvas-mode-edit-transition',
290
+ }
291
+ );
292
+ }
293
+ openGeneralSidebar( 'edit-site/global-styles' );
294
+ setEditorCanvasContainerView(
295
+ 'global-styles-revisions'
286
296
  );
287
- }
288
- openGeneralSidebar( 'edit-site/global-styles' );
289
- setEditorCanvasContainerView( 'global-styles-revisions' );
297
+ },
290
298
  },
291
- },
292
- ];
293
- }, [
294
- hasRevisions,
295
- history,
296
- openGeneralSidebar,
297
- setEditorCanvasContainerView,
298
- canvas,
299
- params,
300
- ] );
299
+ ];
300
+ }, [
301
+ hasRevisions,
302
+ history,
303
+ openGeneralSidebar,
304
+ setEditorCanvasContainerView,
305
+ canvas,
306
+ params,
307
+ ] );
301
308
 
302
- return {
303
- isLoading: false,
304
- commands,
309
+ return {
310
+ isLoading: false,
311
+ commands,
312
+ };
305
313
  };
306
- }
307
314
 
308
315
  export function useCommonCommands() {
309
316
  const homeUrl = useSelect( ( select ) => {
@@ -324,26 +331,26 @@ export function useCommonCommands() {
324
331
 
325
332
  useCommandLoader( {
326
333
  name: 'core/edit-site/open-styles',
327
- hook: useGlobalStylesOpenStylesCommands,
334
+ hook: getGlobalStylesOpenStylesCommands(),
328
335
  } );
329
336
 
330
337
  useCommandLoader( {
331
338
  name: 'core/edit-site/toggle-styles-welcome-guide',
332
- hook: useGlobalStylesToggleWelcomeGuideCommands,
339
+ hook: getGlobalStylesToggleWelcomeGuideCommands(),
333
340
  } );
334
341
 
335
342
  useCommandLoader( {
336
343
  name: 'core/edit-site/reset-global-styles',
337
- hook: useGlobalStylesResetCommands,
344
+ hook: getGlobalStylesResetCommands(),
338
345
  } );
339
346
 
340
347
  useCommandLoader( {
341
348
  name: 'core/edit-site/open-styles-css',
342
- hook: useGlobalStylesOpenCssCommands,
349
+ hook: getGlobalStylesOpenCssCommands(),
343
350
  } );
344
351
 
345
352
  useCommandLoader( {
346
353
  name: 'core/edit-site/open-styles-revisions',
347
- hook: useGlobalStylesOpenRevisionsCommands,
354
+ hook: getGlobalStylesOpenRevisionsCommands(),
348
355
  } );
349
356
  }
package/src/index.js CHANGED
@@ -68,6 +68,7 @@ export function initializeEditor( id, settings ) {
68
68
  allowRightClickOverrides: true,
69
69
  distractionFree: false,
70
70
  editorMode: 'visual',
71
+ editorTool: 'edit',
71
72
  fixedToolbar: false,
72
73
  focusMode: false,
73
74
  inactivePanels: [],
package/src/posts.js CHANGED
@@ -65,6 +65,7 @@ export function initializePostsDashboard( id, settings ) {
65
65
  allowRightClickOverrides: true,
66
66
  distractionFree: false,
67
67
  editorMode: 'visual',
68
+ editorTool: 'edit',
68
69
  fixedToolbar: false,
69
70
  focusMode: false,
70
71
  inactivePanels: [],
package/src/style.scss CHANGED
@@ -1,7 +1,5 @@
1
1
  @import "../../dataviews/src/style.scss";
2
- @import "../../fields/src/styles.scss";
3
- @import "../../fields/src/fields/featured-image/style.scss";
4
-
2
+ @import "../../fields/src/style.scss";
5
3
  @import "./components/add-new-template/style.scss";
6
4
  @import "./components/block-editor/style.scss";
7
5
  @import "./components/canvas-loader/style.scss";
@@ -38,6 +36,7 @@
38
36
  @import "./components/global-styles/font-library-modal/style.scss";
39
37
  @import "./components/pagination/style.scss";
40
38
  @import "./components/global-styles/variations/style.scss";
39
+ @import "./components/sidebar-global-styles-wrapper/style.scss";
41
40
 
42
41
  /* stylelint-disable -- Disable reason: View Transitions not supported properly by stylelint. */
43
42
  ::view-transition-image-pair(root) {
@@ -1,51 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Async = Async;
7
- var _element = require("@wordpress/element");
8
- var _priorityQueue = require("@wordpress/priority-queue");
9
- /**
10
- * WordPress dependencies
11
- */
12
-
13
- const blockPreviewQueue = (0, _priorityQueue.createQueue)();
14
-
15
- /**
16
- * Renders a component at the next idle time.
17
- * @param {*} props
18
- */
19
- function Async({
20
- children,
21
- placeholder
22
- }) {
23
- const [shouldRender, setShouldRender] = (0, _element.useState)(false);
24
-
25
- // In the future, we could try to use startTransition here, but currently
26
- // react will batch all transitions, which means all previews will be
27
- // rendered at the same time.
28
- // https://react.dev/reference/react/startTransition#caveats
29
- // > If there are multiple ongoing Transitions, React currently batches them
30
- // > together. This is a limitation that will likely be removed in a future
31
- // > release.
32
-
33
- (0, _element.useEffect)(() => {
34
- const context = {};
35
- blockPreviewQueue.add(context, () => {
36
- // Synchronously run all renders so it consumes timeRemaining.
37
- // See https://github.com/WordPress/gutenberg/pull/48238
38
- (0, _element.flushSync)(() => {
39
- setShouldRender(true);
40
- });
41
- });
42
- return () => {
43
- blockPreviewQueue.cancel(context);
44
- };
45
- }, []);
46
- if (!shouldRender) {
47
- return placeholder;
48
- }
49
- return children;
50
- }
51
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_element","require","_priorityQueue","blockPreviewQueue","createQueue","Async","children","placeholder","shouldRender","setShouldRender","useState","useEffect","context","add","flushSync","cancel"],"sources":["@wordpress/edit-site/src/components/async/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useState, flushSync } from '@wordpress/element';\nimport { createQueue } from '@wordpress/priority-queue';\n\nconst blockPreviewQueue = createQueue();\n\n/**\n * Renders a component at the next idle time.\n * @param {*} props\n */\nexport function Async( { children, placeholder } ) {\n\tconst [ shouldRender, setShouldRender ] = useState( false );\n\n\t// In the future, we could try to use startTransition here, but currently\n\t// react will batch all transitions, which means all previews will be\n\t// rendered at the same time.\n\t// https://react.dev/reference/react/startTransition#caveats\n\t// > If there are multiple ongoing Transitions, React currently batches them\n\t// > together. This is a limitation that will likely be removed in a future\n\t// > release.\n\n\tuseEffect( () => {\n\t\tconst context = {};\n\t\tblockPreviewQueue.add( context, () => {\n\t\t\t// Synchronously run all renders so it consumes timeRemaining.\n\t\t\t// See https://github.com/WordPress/gutenberg/pull/48238\n\t\t\tflushSync( () => {\n\t\t\t\tsetShouldRender( true );\n\t\t\t} );\n\t\t} );\n\t\treturn () => {\n\t\t\tblockPreviewQueue.cancel( context );\n\t\t};\n\t}, [] );\n\n\tif ( ! shouldRender ) {\n\t\treturn placeholder;\n\t}\n\n\treturn children;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA,MAAME,iBAAiB,GAAG,IAAAC,0BAAW,EAAC,CAAC;;AAEvC;AACA;AACA;AACA;AACO,SAASC,KAAKA,CAAE;EAAEC,QAAQ;EAAEC;AAAY,CAAC,EAAG;EAClD,MAAM,CAAEC,YAAY,EAAEC,eAAe,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;;EAE3D;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA,IAAAC,kBAAS,EAAE,MAAM;IAChB,MAAMC,OAAO,GAAG,CAAC,CAAC;IAClBT,iBAAiB,CAACU,GAAG,CAAED,OAAO,EAAE,MAAM;MACrC;MACA;MACA,IAAAE,kBAAS,EAAE,MAAM;QAChBL,eAAe,CAAE,IAAK,CAAC;MACxB,CAAE,CAAC;IACJ,CAAE,CAAC;IACH,OAAO,MAAM;MACZN,iBAAiB,CAACY,MAAM,CAAEH,OAAQ,CAAC;IACpC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAEJ,YAAY,EAAG;IACrB,OAAOD,WAAW;EACnB;EAEA,OAAOD,QAAQ;AAChB","ignoreList":[]}