@wordpress/edit-widgets 5.33.0 → 5.35.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 (50) hide show
  1. package/CHANGELOG.md +10 -2
  2. package/build/blocks/widget-area/edit/inner-blocks.js +2 -2
  3. package/build/blocks/widget-area/edit/inner-blocks.js.map +1 -1
  4. package/build/components/header/document-tools/index.js +6 -38
  5. package/build/components/header/document-tools/index.js.map +1 -1
  6. package/build/components/keyboard-shortcut-help-modal/config.js +4 -0
  7. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  8. package/build/components/keyboard-shortcut-help-modal/index.js +2 -2
  9. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  10. package/build/components/keyboard-shortcuts/index.js +0 -59
  11. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  12. package/build/components/secondary-sidebar/inserter-sidebar.js +1 -4
  13. package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
  14. package/build/components/widget-areas-block-editor-provider/index.js +5 -1
  15. package/build/components/widget-areas-block-editor-provider/index.js.map +1 -1
  16. package/build/store/private-selectors.js +4 -0
  17. package/build/store/private-selectors.js.map +1 -1
  18. package/build/store/reducer.js +16 -0
  19. package/build/store/reducer.js.map +1 -1
  20. package/build-module/blocks/widget-area/edit/inner-blocks.js +2 -2
  21. package/build-module/blocks/widget-area/edit/inner-blocks.js.map +1 -1
  22. package/build-module/components/header/document-tools/index.js +8 -40
  23. package/build-module/components/header/document-tools/index.js.map +1 -1
  24. package/build-module/components/keyboard-shortcut-help-modal/config.js +4 -0
  25. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  26. package/build-module/components/keyboard-shortcut-help-modal/index.js +2 -2
  27. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  28. package/build-module/components/keyboard-shortcuts/index.js +1 -60
  29. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  30. package/build-module/components/secondary-sidebar/inserter-sidebar.js +2 -5
  31. package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
  32. package/build-module/components/widget-areas-block-editor-provider/index.js +5 -1
  33. package/build-module/components/widget-areas-block-editor-provider/index.js.map +1 -1
  34. package/build-module/store/private-selectors.js +3 -0
  35. package/build-module/store/private-selectors.js.map +1 -1
  36. package/build-module/store/reducer.js +15 -0
  37. package/build-module/store/reducer.js.map +1 -1
  38. package/build-style/style-rtl.css +17 -11
  39. package/build-style/style.css +17 -11
  40. package/package.json +29 -29
  41. package/src/blocks/widget-area/edit/inner-blocks.js +2 -2
  42. package/src/components/header/document-tools/index.js +29 -56
  43. package/src/components/keyboard-shortcut-help-modal/config.js +10 -1
  44. package/src/components/keyboard-shortcut-help-modal/index.js +2 -2
  45. package/src/components/keyboard-shortcuts/index.js +1 -72
  46. package/src/components/layout/style.scss +4 -0
  47. package/src/components/secondary-sidebar/inserter-sidebar.js +2 -5
  48. package/src/components/widget-areas-block-editor-provider/index.js +4 -0
  49. package/src/store/private-selectors.js +4 -0
  50. package/src/store/reducer.js +13 -0
@@ -1 +1 @@
1
- {"version":3,"names":["combineReducers","widgetAreasOpenState","state","action","type","clientId","isOpen","blockInserterPanel","value","listViewPanel","listViewToggleRef","current"],"sources":["@wordpress/edit-widgets/src/store/reducer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Controls the open state of the widget areas.\n *\n * @param {Object} state Redux state.\n * @param {Object} action Redux action.\n *\n * @return {Array} Updated state.\n */\nexport function widgetAreasOpenState( state = {}, action ) {\n\tconst { type } = action;\n\tswitch ( type ) {\n\t\tcase 'SET_WIDGET_AREAS_OPEN_STATE': {\n\t\t\treturn action.widgetAreasOpenState;\n\t\t}\n\t\tcase 'SET_IS_WIDGET_AREA_OPEN': {\n\t\t\tconst { clientId, isOpen } = action;\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ clientId ]: isOpen,\n\t\t\t};\n\t\t}\n\t\tdefault: {\n\t\t\treturn state;\n\t\t}\n\t}\n}\n\n/**\n * Reducer to set the block inserter panel open or closed.\n *\n * Note: this reducer interacts with the list view panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the list view panel open or closed.\n *\n * Note: this reducer interacts with the inserter panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function listViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value ? false : state;\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t}\n\treturn state;\n}\n\n/**\n * This reducer does nothing aside initializing a ref to the list view toggle.\n * We will have a unique ref per \"editor\" instance.\n *\n * @param {Object} state\n * @return {Object} Reference to the list view toggle button.\n */\nexport function listViewToggleRef( state = { current: null } ) {\n\treturn state;\n}\n\nexport default combineReducers( {\n\tblockInserterPanel,\n\tlistViewPanel,\n\twidgetAreasOpenState,\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,iBAAiB;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAAEC,KAAK,GAAG,CAAC,CAAC,EAAEC,MAAM,EAAG;EAC1D,MAAM;IAAEC;EAAK,CAAC,GAAGD,MAAM;EACvB,QAASC,IAAI;IACZ,KAAK,6BAA6B;MAAE;QACnC,OAAOD,MAAM,CAACF,oBAAoB;MACnC;IACA,KAAK,yBAAyB;MAAE;QAC/B,MAAM;UAAEI,QAAQ;UAAEC;QAAO,CAAC,GAAGH,MAAM;QACnC,OAAO;UACN,GAAGD,KAAK;UACR,CAAEG,QAAQ,GAAIC;QACf,CAAC;MACF;IACA;MAAS;QACR,OAAOJ,KAAK;MACb;EACD;AACD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASK,kBAAkBA,CAAEL,KAAK,GAAG,KAAK,EAAEC,MAAM,EAAG;EAC3D,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,yBAAyB;MAC7B,OAAOD,MAAM,CAACG,MAAM,GAAG,KAAK,GAAGJ,KAAK;IACrC,KAAK,wBAAwB;MAC5B,OAAOC,MAAM,CAACK,KAAK;EACrB;EACA,OAAON,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASO,aAAaA,CAAEP,KAAK,GAAG,KAAK,EAAEC,MAAM,EAAG;EACtD,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,wBAAwB;MAC5B,OAAOD,MAAM,CAACK,KAAK,GAAG,KAAK,GAAGN,KAAK;IACpC,KAAK,yBAAyB;MAC7B,OAAOC,MAAM,CAACG,MAAM;EACtB;EACA,OAAOJ,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASQ,iBAAiBA,CAAER,KAAK,GAAG;EAAES,OAAO,EAAE;AAAK,CAAC,EAAG;EAC9D,OAAOT,KAAK;AACb;AAEA,eAAeF,eAAe,CAAE;EAC/BO,kBAAkB;EAClBE,aAAa;EACbR;AACD,CAAE,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["combineReducers","widgetAreasOpenState","state","action","type","clientId","isOpen","blockInserterPanel","value","listViewPanel","listViewToggleRef","current","inserterSidebarToggleRef"],"sources":["@wordpress/edit-widgets/src/store/reducer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Controls the open state of the widget areas.\n *\n * @param {Object} state Redux state.\n * @param {Object} action Redux action.\n *\n * @return {Array} Updated state.\n */\nexport function widgetAreasOpenState( state = {}, action ) {\n\tconst { type } = action;\n\tswitch ( type ) {\n\t\tcase 'SET_WIDGET_AREAS_OPEN_STATE': {\n\t\t\treturn action.widgetAreasOpenState;\n\t\t}\n\t\tcase 'SET_IS_WIDGET_AREA_OPEN': {\n\t\t\tconst { clientId, isOpen } = action;\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ clientId ]: isOpen,\n\t\t\t};\n\t\t}\n\t\tdefault: {\n\t\t\treturn state;\n\t\t}\n\t}\n}\n\n/**\n * Reducer to set the block inserter panel open or closed.\n *\n * Note: this reducer interacts with the list view panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the list view panel open or closed.\n *\n * Note: this reducer interacts with the inserter panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function listViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value ? false : state;\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t}\n\treturn state;\n}\n\n/**\n * This reducer does nothing aside initializing a ref to the list view toggle.\n * We will have a unique ref per \"editor\" instance.\n *\n * @param {Object} state\n * @return {Object} Reference to the list view toggle button.\n */\nexport function listViewToggleRef( state = { current: null } ) {\n\treturn state;\n}\n\n/**\n * This reducer does nothing aside initializing a ref to the inserter sidebar toggle.\n * We will have a unique ref per \"editor\" instance.\n *\n * @param {Object} state\n * @return {Object} Reference to the inserter sidebar toggle button.\n */\nexport function inserterSidebarToggleRef( state = { current: null } ) {\n\treturn state;\n}\n\nexport default combineReducers( {\n\tblockInserterPanel,\n\tinserterSidebarToggleRef,\n\tlistViewPanel,\n\tlistViewToggleRef,\n\twidgetAreasOpenState,\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,iBAAiB;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAAEC,KAAK,GAAG,CAAC,CAAC,EAAEC,MAAM,EAAG;EAC1D,MAAM;IAAEC;EAAK,CAAC,GAAGD,MAAM;EACvB,QAASC,IAAI;IACZ,KAAK,6BAA6B;MAAE;QACnC,OAAOD,MAAM,CAACF,oBAAoB;MACnC;IACA,KAAK,yBAAyB;MAAE;QAC/B,MAAM;UAAEI,QAAQ;UAAEC;QAAO,CAAC,GAAGH,MAAM;QACnC,OAAO;UACN,GAAGD,KAAK;UACR,CAAEG,QAAQ,GAAIC;QACf,CAAC;MACF;IACA;MAAS;QACR,OAAOJ,KAAK;MACb;EACD;AACD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASK,kBAAkBA,CAAEL,KAAK,GAAG,KAAK,EAAEC,MAAM,EAAG;EAC3D,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,yBAAyB;MAC7B,OAAOD,MAAM,CAACG,MAAM,GAAG,KAAK,GAAGJ,KAAK;IACrC,KAAK,wBAAwB;MAC5B,OAAOC,MAAM,CAACK,KAAK;EACrB;EACA,OAAON,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASO,aAAaA,CAAEP,KAAK,GAAG,KAAK,EAAEC,MAAM,EAAG;EACtD,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,wBAAwB;MAC5B,OAAOD,MAAM,CAACK,KAAK,GAAG,KAAK,GAAGN,KAAK;IACpC,KAAK,yBAAyB;MAC7B,OAAOC,MAAM,CAACG,MAAM;EACtB;EACA,OAAOJ,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASQ,iBAAiBA,CAAER,KAAK,GAAG;EAAES,OAAO,EAAE;AAAK,CAAC,EAAG;EAC9D,OAAOT,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASU,wBAAwBA,CAAEV,KAAK,GAAG;EAAES,OAAO,EAAE;AAAK,CAAC,EAAG;EACrE,OAAOT,KAAK;AACb;AAEA,eAAeF,eAAe,CAAE;EAC/BO,kBAAkB;EAClBK,wBAAwB;EACxBH,aAAa;EACbC,iBAAiB;EACjBT;AACD,CAAE,CAAC","ignoreList":[]}
@@ -123,7 +123,8 @@
123
123
 
124
124
  .interface-complementary-area-header {
125
125
  background: #fff;
126
- padding-left: 4px;
126
+ padding-left: 12px;
127
+ gap: 8px;
127
128
  }
128
129
  .interface-complementary-area-header .interface-complementary-area-header__title {
129
130
  margin: 0;
@@ -141,15 +142,11 @@
141
142
  }
142
143
  }
143
144
 
144
- @media (min-width: 782px) {
145
- .components-panel__header + .interface-complementary-area-header {
146
- margin-top: 0;
147
- }
148
- }
149
-
150
145
  .interface-complementary-area {
151
146
  background: #fff;
152
147
  color: #1e1e1e;
148
+ height: 100%;
149
+ overflow: auto;
153
150
  }
154
151
  @media (min-width: 600px) {
155
152
  .interface-complementary-area {
@@ -171,11 +168,11 @@
171
168
  top: 0;
172
169
  z-index: 1;
173
170
  }
174
- .interface-complementary-area .components-panel__header.edit-post-sidebar__panel-tabs {
171
+ .interface-complementary-area .components-panel__header.editor-sidebar__panel-tabs {
175
172
  top: 48px;
176
173
  }
177
174
  @media (min-width: 782px) {
178
- .interface-complementary-area .components-panel__header.edit-post-sidebar__panel-tabs {
175
+ .interface-complementary-area .components-panel__header.editor-sidebar__panel-tabs {
179
176
  top: 0;
180
177
  }
181
178
  }
@@ -184,6 +181,7 @@
184
181
  }
185
182
  .interface-complementary-area h2 {
186
183
  font-size: 13px;
184
+ font-weight: 500;
187
185
  color: #1e1e1e;
188
186
  margin-bottom: 1.5em;
189
187
  }
@@ -215,6 +213,10 @@
215
213
  right: auto;
216
214
  }
217
215
 
216
+ .interface-complementary-area__fill {
217
+ height: 100%;
218
+ }
219
+
218
220
  @media (min-width: 782px) {
219
221
  body.js.is-fullscreen-mode {
220
222
  margin-top: -32px;
@@ -235,7 +237,7 @@ html.interface-interface-skeleton__html-container {
235
237
  width: 100%;
236
238
  }
237
239
  @media (min-width: 782px) {
238
- html.interface-interface-skeleton__html-container {
240
+ html.interface-interface-skeleton__html-container:not(:has(.is-zoom-out)) {
239
241
  position: initial;
240
242
  width: initial;
241
243
  }
@@ -307,6 +309,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
307
309
  }
308
310
 
309
311
  .interface-interface-skeleton__body {
312
+ position: relative;
310
313
  flex-grow: 1;
311
314
  display: flex;
312
315
  overflow: auto;
@@ -355,7 +358,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
355
358
  }
356
359
 
357
360
  .interface-interface-skeleton__sidebar {
358
- overflow: auto;
361
+ overflow: hidden;
359
362
  }
360
363
  @media (min-width: 782px) {
361
364
  .interface-interface-skeleton__sidebar {
@@ -790,6 +793,9 @@ body.is-fullscreen-mode .edit-widgets-notices__snackbar {
790
793
  .edit-widgets-layout__inserter-panel-content {
791
794
  height: calc(100% - 36px - 8px);
792
795
  }
796
+ .edit-widgets-layout__inserter-panel-content .block-editor-inserter-sidebar__header {
797
+ display: none;
798
+ }
793
799
  @media (min-width: 782px) {
794
800
  .edit-widgets-layout__inserter-panel-content {
795
801
  height: 100%;
@@ -123,7 +123,8 @@
123
123
 
124
124
  .interface-complementary-area-header {
125
125
  background: #fff;
126
- padding-right: 4px;
126
+ padding-right: 12px;
127
+ gap: 8px;
127
128
  }
128
129
  .interface-complementary-area-header .interface-complementary-area-header__title {
129
130
  margin: 0;
@@ -141,15 +142,11 @@
141
142
  }
142
143
  }
143
144
 
144
- @media (min-width: 782px) {
145
- .components-panel__header + .interface-complementary-area-header {
146
- margin-top: 0;
147
- }
148
- }
149
-
150
145
  .interface-complementary-area {
151
146
  background: #fff;
152
147
  color: #1e1e1e;
148
+ height: 100%;
149
+ overflow: auto;
153
150
  }
154
151
  @media (min-width: 600px) {
155
152
  .interface-complementary-area {
@@ -171,11 +168,11 @@
171
168
  top: 0;
172
169
  z-index: 1;
173
170
  }
174
- .interface-complementary-area .components-panel__header.edit-post-sidebar__panel-tabs {
171
+ .interface-complementary-area .components-panel__header.editor-sidebar__panel-tabs {
175
172
  top: 48px;
176
173
  }
177
174
  @media (min-width: 782px) {
178
- .interface-complementary-area .components-panel__header.edit-post-sidebar__panel-tabs {
175
+ .interface-complementary-area .components-panel__header.editor-sidebar__panel-tabs {
179
176
  top: 0;
180
177
  }
181
178
  }
@@ -184,6 +181,7 @@
184
181
  }
185
182
  .interface-complementary-area h2 {
186
183
  font-size: 13px;
184
+ font-weight: 500;
187
185
  color: #1e1e1e;
188
186
  margin-bottom: 1.5em;
189
187
  }
@@ -215,6 +213,10 @@
215
213
  left: auto;
216
214
  }
217
215
 
216
+ .interface-complementary-area__fill {
217
+ height: 100%;
218
+ }
219
+
218
220
  @media (min-width: 782px) {
219
221
  body.js.is-fullscreen-mode {
220
222
  margin-top: -32px;
@@ -235,7 +237,7 @@ html.interface-interface-skeleton__html-container {
235
237
  width: 100%;
236
238
  }
237
239
  @media (min-width: 782px) {
238
- html.interface-interface-skeleton__html-container {
240
+ html.interface-interface-skeleton__html-container:not(:has(.is-zoom-out)) {
239
241
  position: initial;
240
242
  width: initial;
241
243
  }
@@ -307,6 +309,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
307
309
  }
308
310
 
309
311
  .interface-interface-skeleton__body {
312
+ position: relative;
310
313
  flex-grow: 1;
311
314
  display: flex;
312
315
  overflow: auto;
@@ -355,7 +358,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
355
358
  }
356
359
 
357
360
  .interface-interface-skeleton__sidebar {
358
- overflow: auto;
361
+ overflow: hidden;
359
362
  }
360
363
  @media (min-width: 782px) {
361
364
  .interface-interface-skeleton__sidebar {
@@ -790,6 +793,9 @@ body.is-fullscreen-mode .edit-widgets-notices__snackbar {
790
793
  .edit-widgets-layout__inserter-panel-content {
791
794
  height: calc(100% - 36px - 8px);
792
795
  }
796
+ .edit-widgets-layout__inserter-panel-content .block-editor-inserter-sidebar__header {
797
+ display: none;
798
+ }
793
799
  @media (min-width: 782px) {
794
800
  .edit-widgets-layout__inserter-panel-content {
795
801
  height: 100%;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-widgets",
3
- "version": "5.33.0",
3
+ "version": "5.35.0",
4
4
  "description": "Widgets Page module for WordPress..",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -27,33 +27,33 @@
27
27
  "react-native": "src/index",
28
28
  "dependencies": {
29
29
  "@babel/runtime": "^7.16.0",
30
- "@wordpress/api-fetch": "^6.53.0",
31
- "@wordpress/block-editor": "^12.24.0",
32
- "@wordpress/block-library": "^8.33.0",
33
- "@wordpress/blocks": "^12.33.0",
34
- "@wordpress/components": "^27.4.0",
35
- "@wordpress/compose": "^6.33.0",
36
- "@wordpress/core-data": "^6.33.0",
37
- "@wordpress/data": "^9.26.0",
38
- "@wordpress/deprecated": "^3.56.0",
39
- "@wordpress/dom": "^3.56.0",
40
- "@wordpress/element": "^5.33.0",
41
- "@wordpress/hooks": "^3.56.0",
42
- "@wordpress/i18n": "^4.56.0",
43
- "@wordpress/icons": "^9.47.0",
44
- "@wordpress/interface": "^5.33.0",
45
- "@wordpress/keyboard-shortcuts": "^4.33.0",
46
- "@wordpress/keycodes": "^3.56.0",
47
- "@wordpress/media-utils": "^4.47.0",
48
- "@wordpress/notices": "^4.24.0",
49
- "@wordpress/patterns": "^1.17.0",
50
- "@wordpress/plugins": "^6.24.0",
51
- "@wordpress/preferences": "^3.33.0",
52
- "@wordpress/private-apis": "^0.38.0",
53
- "@wordpress/reusable-blocks": "^4.33.0",
54
- "@wordpress/url": "^3.57.0",
55
- "@wordpress/widgets": "^3.33.0",
56
- "classnames": "^2.3.1"
30
+ "@wordpress/api-fetch": "^6.55.0",
31
+ "@wordpress/block-editor": "^12.26.0",
32
+ "@wordpress/block-library": "^8.35.0",
33
+ "@wordpress/blocks": "^12.35.0",
34
+ "@wordpress/components": "^27.6.0",
35
+ "@wordpress/compose": "^6.35.0",
36
+ "@wordpress/core-data": "^6.35.0",
37
+ "@wordpress/data": "^9.28.0",
38
+ "@wordpress/deprecated": "^3.58.0",
39
+ "@wordpress/dom": "^3.58.0",
40
+ "@wordpress/element": "^5.35.0",
41
+ "@wordpress/hooks": "^3.58.0",
42
+ "@wordpress/i18n": "^4.58.0",
43
+ "@wordpress/icons": "^9.49.0",
44
+ "@wordpress/interface": "^5.35.0",
45
+ "@wordpress/keyboard-shortcuts": "^4.35.0",
46
+ "@wordpress/keycodes": "^3.58.0",
47
+ "@wordpress/media-utils": "^4.49.0",
48
+ "@wordpress/notices": "^4.26.0",
49
+ "@wordpress/patterns": "^1.19.0",
50
+ "@wordpress/plugins": "^6.26.0",
51
+ "@wordpress/preferences": "^3.35.0",
52
+ "@wordpress/private-apis": "^0.40.0",
53
+ "@wordpress/reusable-blocks": "^4.35.0",
54
+ "@wordpress/url": "^3.59.0",
55
+ "@wordpress/widgets": "^3.35.0",
56
+ "clsx": "^2.1.1"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "react": "^18.0.0",
@@ -62,5 +62,5 @@
62
62
  "publishConfig": {
63
63
  "access": "public"
64
64
  },
65
- "gitHead": "280403b4c1cf6cc2c55a6c4d56f9ef91145e4191"
65
+ "gitHead": "42f38f287506a6b3ed8ccba839b18ad066821044"
66
66
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import classnames from 'classnames';
4
+ import clsx from 'clsx';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -38,7 +38,7 @@ export default function WidgetAreaInnerBlocks( { id } ) {
38
38
  return (
39
39
  <div
40
40
  data-widget-area-id={ id }
41
- className={ classnames(
41
+ className={ clsx(
42
42
  'wp-block-widget-area__inner-blocks block-editor-inner-blocks editor-styles-wrapper',
43
43
  {
44
44
  'wp-block-widget-area__highlight-drop-zone':
@@ -4,13 +4,9 @@
4
4
  import { useSelect, useDispatch } from '@wordpress/data';
5
5
  import { __, _x } from '@wordpress/i18n';
6
6
  import { Button, ToolbarItem } from '@wordpress/components';
7
- import {
8
- NavigableToolbar,
9
- store as blockEditorStore,
10
- privateApis as blockEditorPrivateApis,
11
- } from '@wordpress/block-editor';
7
+ import { NavigableToolbar } from '@wordpress/block-editor';
12
8
  import { listView, plus } from '@wordpress/icons';
13
- import { useCallback, useRef } from '@wordpress/element';
9
+ import { useCallback } from '@wordpress/element';
14
10
  import { useViewportMatch } from '@wordpress/compose';
15
11
 
16
12
  /**
@@ -18,75 +14,52 @@ import { useViewportMatch } from '@wordpress/compose';
18
14
  */
19
15
  import UndoButton from '../undo-redo/undo';
20
16
  import RedoButton from '../undo-redo/redo';
21
- import useLastSelectedWidgetArea from '../../../hooks/use-last-selected-widget-area';
22
17
  import { store as editWidgetsStore } from '../../../store';
23
18
  import { unlock } from '../../../lock-unlock';
24
19
 
25
- const { useShowBlockTools } = unlock( blockEditorPrivateApis );
26
-
27
20
  function DocumentTools() {
28
21
  const isMediumViewport = useViewportMatch( 'medium' );
29
- const inserterButton = useRef();
30
- const widgetAreaClientId = useLastSelectedWidgetArea();
31
- const isLastSelectedWidgetAreaOpen = useSelect(
32
- ( select ) =>
33
- select( editWidgetsStore ).getIsWidgetAreaOpen(
34
- widgetAreaClientId
35
- ),
36
- [ widgetAreaClientId ]
37
- );
38
- const { isInserterOpen, isListViewOpen, listViewToggleRef } = useSelect(
39
- ( select ) => {
40
- const { isInserterOpened, isListViewOpened, getListViewToggleRef } =
41
- unlock( select( editWidgetsStore ) );
42
- return {
43
- isInserterOpen: isInserterOpened(),
44
- isListViewOpen: isListViewOpened(),
45
- listViewToggleRef: getListViewToggleRef(),
46
- };
47
- },
48
- []
49
- );
50
- const { setIsWidgetAreaOpen, setIsInserterOpened, setIsListViewOpened } =
22
+
23
+ const {
24
+ isInserterOpen,
25
+ isListViewOpen,
26
+ inserterSidebarToggleRef,
27
+ listViewToggleRef,
28
+ } = useSelect( ( select ) => {
29
+ const {
30
+ isInserterOpened,
31
+ getInserterSidebarToggleRef,
32
+ isListViewOpened,
33
+ getListViewToggleRef,
34
+ } = unlock( select( editWidgetsStore ) );
35
+ return {
36
+ isInserterOpen: isInserterOpened(),
37
+ isListViewOpen: isListViewOpened(),
38
+ inserterSidebarToggleRef: getInserterSidebarToggleRef(),
39
+ listViewToggleRef: getListViewToggleRef(),
40
+ };
41
+ }, [] );
42
+ const { setIsInserterOpened, setIsListViewOpened } =
51
43
  useDispatch( editWidgetsStore );
52
- const { selectBlock } = useDispatch( blockEditorStore );
53
- const handleClick = () => {
54
- if ( isInserterOpen ) {
55
- // Focusing the inserter button closes the inserter popover.
56
- setIsInserterOpened( false );
57
- } else {
58
- if ( ! isLastSelectedWidgetAreaOpen ) {
59
- // Select the last selected block if hasn't already.
60
- selectBlock( widgetAreaClientId );
61
- // Open the last selected widget area when opening the inserter.
62
- setIsWidgetAreaOpen( widgetAreaClientId, true );
63
- }
64
- // The DOM updates resulting from selectBlock() and setIsInserterOpened() calls are applied the
65
- // same tick and pretty much in a random order. The inserter is closed if any other part of the
66
- // app receives focus. If selectBlock() happens to take effect after setIsInserterOpened() then
67
- // the inserter is visible for a brief moment and then gets auto-closed due to focus moving to
68
- // the selected block.
69
- window.requestAnimationFrame( () => setIsInserterOpened( true ) );
70
- }
71
- };
72
44
 
73
45
  const toggleListView = useCallback(
74
46
  () => setIsListViewOpened( ! isListViewOpen ),
75
47
  [ setIsListViewOpened, isListViewOpen ]
76
48
  );
77
49
 
78
- // If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.
79
- const { showFixedToolbar } = useShowBlockTools();
50
+ const toggleInserterSidebar = useCallback(
51
+ () => setIsInserterOpened( ! isInserterOpen ),
52
+ [ setIsInserterOpened, isInserterOpen ]
53
+ );
80
54
 
81
55
  return (
82
56
  <NavigableToolbar
83
57
  className="edit-widgets-header-toolbar"
84
58
  aria-label={ __( 'Document tools' ) }
85
- shouldUseKeyboardFocusShortcut={ ! showFixedToolbar }
86
59
  variant="unstyled"
87
60
  >
88
61
  <ToolbarItem
89
- ref={ inserterButton }
62
+ ref={ inserterSidebarToggleRef }
90
63
  as={ Button }
91
64
  className="edit-widgets-header-toolbar__inserter-toggle"
92
65
  variant="primary"
@@ -94,7 +67,7 @@ function DocumentTools() {
94
67
  onMouseDown={ ( event ) => {
95
68
  event.preventDefault();
96
69
  } }
97
- onClick={ handleClick }
70
+ onClick={ toggleInserterSidebar }
98
71
  icon={ plus }
99
72
  /* translators: button label text should, if possible, be under 16
100
73
  characters. */
@@ -37,7 +37,16 @@ export const textFormattingShortcuts = [
37
37
  description: __( 'Make the selected text inline code.' ),
38
38
  },
39
39
  {
40
- keyCombination: { modifier: 'access', character: '0' },
40
+ keyCombination: {
41
+ modifier: 'access',
42
+ character: '0',
43
+ },
44
+ aliases: [
45
+ {
46
+ modifier: 'access',
47
+ character: '7',
48
+ },
49
+ ],
41
50
  description: __( 'Convert the current heading to a paragraph.' ),
42
51
  },
43
52
  {
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import classnames from 'classnames';
4
+ import clsx from 'clsx';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -49,7 +49,7 @@ const ShortcutList = ( { shortcuts } ) => (
49
49
 
50
50
  const ShortcutSection = ( { title, shortcuts, className } ) => (
51
51
  <section
52
- className={ classnames(
52
+ className={ clsx(
53
53
  'edit-widgets-keyboard-shortcut-help-modal__section',
54
54
  className
55
55
  ) }
@@ -7,11 +7,9 @@ import {
7
7
  store as keyboardShortcutsStore,
8
8
  } from '@wordpress/keyboard-shortcuts';
9
9
  import { isAppleOS } from '@wordpress/keycodes';
10
- import { useDispatch, useSelect } from '@wordpress/data';
10
+ import { useDispatch } from '@wordpress/data';
11
11
  import { __ } from '@wordpress/i18n';
12
12
  import { store as coreStore } from '@wordpress/core-data';
13
- import { store as blockEditorStore } from '@wordpress/block-editor';
14
- import { createBlock } from '@wordpress/blocks';
15
13
 
16
14
  /**
17
15
  * Internal dependencies
@@ -22,38 +20,6 @@ function KeyboardShortcuts() {
22
20
  const { redo, undo } = useDispatch( coreStore );
23
21
  const { saveEditedWidgetAreas } = useDispatch( editWidgetsStore );
24
22
 
25
- const { replaceBlocks } = useDispatch( blockEditorStore );
26
- const { getBlockName, getSelectedBlockClientId, getBlockAttributes } =
27
- useSelect( blockEditorStore );
28
-
29
- const handleTextLevelShortcut = ( event, level ) => {
30
- event.preventDefault();
31
- const destinationBlockName =
32
- level === 0 ? 'core/paragraph' : 'core/heading';
33
- const currentClientId = getSelectedBlockClientId();
34
- if ( currentClientId === null ) {
35
- return;
36
- }
37
- const blockName = getBlockName( currentClientId );
38
- if ( blockName !== 'core/paragraph' && blockName !== 'core/heading' ) {
39
- return;
40
- }
41
- const attributes = getBlockAttributes( currentClientId );
42
- const textAlign =
43
- blockName === 'core/paragraph' ? 'align' : 'textAlign';
44
- const destinationTextAlign =
45
- destinationBlockName === 'core/paragraph' ? 'align' : 'textAlign';
46
-
47
- replaceBlocks(
48
- currentClientId,
49
- createBlock( destinationBlockName, {
50
- level,
51
- content: attributes.content,
52
- ...{ [ destinationTextAlign ]: attributes[ textAlign ] },
53
- } )
54
- );
55
- };
56
-
57
23
  useShortcut( 'core/edit-widgets/undo', ( event ) => {
58
24
  undo();
59
25
  event.preventDefault();
@@ -69,21 +35,6 @@ function KeyboardShortcuts() {
69
35
  saveEditedWidgetAreas();
70
36
  } );
71
37
 
72
- useShortcut(
73
- 'core/edit-widgets/transform-heading-to-paragraph',
74
- ( event ) => handleTextLevelShortcut( event, 0 )
75
- );
76
-
77
- [ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {
78
- //the loop is based off on a constant therefore
79
- //the hook will execute the same way every time
80
- //eslint-disable-next-line react-hooks/rules-of-hooks
81
- useShortcut(
82
- `core/edit-widgets/transform-paragraph-to-heading-${ level }`,
83
- ( event ) => handleTextLevelShortcut( event, level )
84
- );
85
- } );
86
-
87
38
  return null;
88
39
  }
89
40
 
@@ -178,28 +129,6 @@ function KeyboardShortcutsRegister() {
178
129
  },
179
130
  ],
180
131
  } );
181
-
182
- registerShortcut( {
183
- name: 'core/edit-widgets/transform-heading-to-paragraph',
184
- category: 'block-library',
185
- description: __( 'Transform heading to paragraph.' ),
186
- keyCombination: {
187
- modifier: 'access',
188
- character: `0`,
189
- },
190
- } );
191
-
192
- [ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {
193
- registerShortcut( {
194
- name: `core/edit-widgets/transform-paragraph-to-heading-${ level }`,
195
- category: 'block-library',
196
- description: __( 'Transform paragraph to heading.' ),
197
- keyCombination: {
198
- modifier: 'access',
199
- character: `${ level }`,
200
- },
201
- } );
202
- } );
203
132
  }, [ registerShortcut ] );
204
133
 
205
134
  return null;
@@ -18,6 +18,10 @@
18
18
  // Leave space for the close button
19
19
  height: calc(100% - #{$button-size} - #{$grid-unit-10});
20
20
 
21
+ .block-editor-inserter-sidebar__header {
22
+ display: none;
23
+ }
24
+
21
25
  @include break-medium() {
22
26
  height: 100%;
23
27
  }
@@ -8,7 +8,7 @@ import {
8
8
  useViewportMatch,
9
9
  __experimentalUseDialog as useDialog,
10
10
  } from '@wordpress/compose';
11
- import { useCallback, useEffect, useRef } from '@wordpress/element';
11
+ import { useCallback, useRef } from '@wordpress/element';
12
12
  import { useDispatch } from '@wordpress/data';
13
13
  import { __ } from '@wordpress/i18n';
14
14
 
@@ -31,13 +31,10 @@ export default function InserterSidebar() {
31
31
  const TagName = ! isMobileViewport ? VisuallyHidden : 'div';
32
32
  const [ inserterDialogRef, inserterDialogProps ] = useDialog( {
33
33
  onClose: closeInserter,
34
- focusOnMount: null,
34
+ focusOnMount: true,
35
35
  } );
36
36
 
37
37
  const libraryRef = useRef();
38
- useEffect( () => {
39
- libraryRef.current.focusSearch();
40
- }, [] );
41
38
 
42
39
  return (
43
40
  <div
@@ -14,6 +14,7 @@ import { useMemo } from '@wordpress/element';
14
14
  import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
15
15
  import { privateApis as editPatternsPrivateApis } from '@wordpress/patterns';
16
16
  import { store as preferencesStore } from '@wordpress/preferences';
17
+ import { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';
17
18
 
18
19
  /**
19
20
  * Internal dependencies
@@ -27,6 +28,8 @@ import { unlock } from '../../lock-unlock';
27
28
 
28
29
  const { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );
29
30
  const { PatternsMenuItems } = unlock( editPatternsPrivateApis );
31
+ const { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );
32
+
30
33
  export default function WidgetAreasBlockEditorProvider( {
31
34
  blockEditorSettings,
32
35
  children,
@@ -111,6 +114,7 @@ export default function WidgetAreasBlockEditorProvider( {
111
114
  return (
112
115
  <SlotFillProvider>
113
116
  <KeyboardShortcuts.Register />
117
+ <BlockKeyboardShortcuts />
114
118
  <ExperimentalBlockEditorProvider
115
119
  value={ blocks }
116
120
  onInput={ onInput }
@@ -1,3 +1,7 @@
1
1
  export function getListViewToggleRef( state ) {
2
2
  return state.listViewToggleRef;
3
3
  }
4
+
5
+ export function getInserterSidebarToggleRef( state ) {
6
+ return state.inserterSidebarToggleRef;
7
+ }
@@ -79,8 +79,21 @@ export function listViewToggleRef( state = { current: null } ) {
79
79
  return state;
80
80
  }
81
81
 
82
+ /**
83
+ * This reducer does nothing aside initializing a ref to the inserter sidebar toggle.
84
+ * We will have a unique ref per "editor" instance.
85
+ *
86
+ * @param {Object} state
87
+ * @return {Object} Reference to the inserter sidebar toggle button.
88
+ */
89
+ export function inserterSidebarToggleRef( state = { current: null } ) {
90
+ return state;
91
+ }
92
+
82
93
  export default combineReducers( {
83
94
  blockInserterPanel,
95
+ inserterSidebarToggleRef,
84
96
  listViewPanel,
97
+ listViewToggleRef,
85
98
  widgetAreasOpenState,
86
99
  } );