@wordpress/editor 14.8.6 → 14.9.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 (115) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/block-settings-menu/content-only-settings-menu.js +15 -18
  3. package/build/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
  4. package/build/components/document-tools/index.js +1 -6
  5. package/build/components/document-tools/index.js.map +1 -1
  6. package/build/components/header/index.js +22 -17
  7. package/build/components/header/index.js.map +1 -1
  8. package/build/components/inserter-sidebar/index.js +8 -9
  9. package/build/components/inserter-sidebar/index.js.map +1 -1
  10. package/build/components/provider/disable-non-page-content-blocks.js +17 -18
  11. package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
  12. package/build/components/provider/use-post-content-blocks.js +34 -0
  13. package/build/components/provider/use-post-content-blocks.js.map +1 -0
  14. package/build/components/resizable-editor/resize-handle.js +4 -0
  15. package/build/components/resizable-editor/resize-handle.js.map +1 -1
  16. package/build/components/zoom-out-toggle/index.js +1 -1
  17. package/build/components/zoom-out-toggle/index.js.map +1 -1
  18. package/build/dataviews/store/private-actions.js +2 -7
  19. package/build/dataviews/store/private-actions.js.map +1 -1
  20. package/build/store/actions.js +20 -5
  21. package/build/store/actions.js.map +1 -1
  22. package/build/store/private-selectors.js +3 -3
  23. package/build/store/private-selectors.js.map +1 -1
  24. package/build-module/components/block-settings-menu/content-only-settings-menu.js +14 -18
  25. package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
  26. package/build-module/components/document-tools/index.js +1 -6
  27. package/build-module/components/document-tools/index.js.map +1 -1
  28. package/build-module/components/header/index.js +22 -17
  29. package/build-module/components/header/index.js.map +1 -1
  30. package/build-module/components/inserter-sidebar/index.js +8 -9
  31. package/build-module/components/inserter-sidebar/index.js.map +1 -1
  32. package/build-module/components/provider/disable-non-page-content-blocks.js +17 -18
  33. package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
  34. package/build-module/components/provider/use-post-content-blocks.js +27 -0
  35. package/build-module/components/provider/use-post-content-blocks.js.map +1 -0
  36. package/build-module/components/resizable-editor/resize-handle.js +4 -0
  37. package/build-module/components/resizable-editor/resize-handle.js.map +1 -1
  38. package/build-module/components/zoom-out-toggle/index.js +1 -1
  39. package/build-module/components/zoom-out-toggle/index.js.map +1 -1
  40. package/build-module/dataviews/store/private-actions.js +4 -8
  41. package/build-module/dataviews/store/private-actions.js.map +1 -1
  42. package/build-module/store/actions.js +18 -5
  43. package/build-module/store/actions.js.map +1 -1
  44. package/build-module/store/private-selectors.js +2 -2
  45. package/build-module/store/private-selectors.js.map +1 -1
  46. package/build-style/style-rtl.css +10 -1
  47. package/build-style/style.css +10 -1
  48. package/build-types/components/document-tools/index.d.ts.map +1 -1
  49. package/build-types/components/header/index.d.ts.map +1 -1
  50. package/build-types/components/inserter-sidebar/index.d.ts.map +1 -1
  51. package/build-types/components/provider/disable-non-page-content-blocks.d.ts.map +1 -1
  52. package/build-types/components/provider/use-post-content-blocks.d.ts +2 -0
  53. package/build-types/components/provider/use-post-content-blocks.d.ts.map +1 -0
  54. package/build-types/components/resizable-editor/resize-handle.d.ts.map +1 -1
  55. package/build-types/store/actions.d.ts +1 -13
  56. package/build-types/store/actions.d.ts.map +1 -1
  57. package/build-types/store/private-selectors.d.ts +2 -2
  58. package/build-types/store/private-selectors.d.ts.map +1 -1
  59. package/package.json +37 -37
  60. package/src/components/block-settings-menu/content-only-settings-menu.js +19 -19
  61. package/src/components/document-tools/index.js +1 -4
  62. package/src/components/header/index.js +30 -14
  63. package/src/components/inserter-sidebar/index.js +8 -11
  64. package/src/components/provider/disable-non-page-content-blocks.js +20 -34
  65. package/src/components/provider/use-post-content-blocks.js +42 -0
  66. package/src/components/resizable-editor/resize-handle.js +5 -0
  67. package/src/components/zoom-out-toggle/index.js +1 -1
  68. package/src/dataviews/store/private-actions.ts +7 -7
  69. package/src/store/actions.js +23 -6
  70. package/src/store/private-selectors.js +2 -2
  71. package/src/store/test/actions.js +76 -0
  72. package/src/store/test/reducer.js +0 -22
  73. package/tsconfig.tsbuildinfo +1 -1
  74. package/build/dataviews/actions/delete-post.js +0 -98
  75. package/build/dataviews/actions/delete-post.js.map +0 -1
  76. package/build/dataviews/actions/rename-post.js +0 -125
  77. package/build/dataviews/actions/rename-post.js.map +0 -1
  78. package/build/dataviews/actions/reset-post.js +0 -113
  79. package/build/dataviews/actions/reset-post.js.map +0 -1
  80. package/build/dataviews/actions/restore-post.js +0 -112
  81. package/build/dataviews/actions/restore-post.js.map +0 -1
  82. package/build/dataviews/actions/trash-post.js +0 -144
  83. package/build/dataviews/actions/trash-post.js.map +0 -1
  84. package/build/dataviews/fields/index.js +0 -32
  85. package/build/dataviews/fields/index.js.map +0 -1
  86. package/build-module/dataviews/actions/delete-post.js +0 -89
  87. package/build-module/dataviews/actions/delete-post.js.map +0 -1
  88. package/build-module/dataviews/actions/rename-post.js +0 -118
  89. package/build-module/dataviews/actions/rename-post.js.map +0 -1
  90. package/build-module/dataviews/actions/reset-post.js +0 -106
  91. package/build-module/dataviews/actions/reset-post.js.map +0 -1
  92. package/build-module/dataviews/actions/restore-post.js +0 -104
  93. package/build-module/dataviews/actions/restore-post.js.map +0 -1
  94. package/build-module/dataviews/actions/trash-post.js +0 -137
  95. package/build-module/dataviews/actions/trash-post.js.map +0 -1
  96. package/build-module/dataviews/fields/index.js +0 -26
  97. package/build-module/dataviews/fields/index.js.map +0 -1
  98. package/build-types/dataviews/actions/delete-post.d.ts +0 -5
  99. package/build-types/dataviews/actions/delete-post.d.ts.map +0 -1
  100. package/build-types/dataviews/actions/rename-post.d.ts +0 -5
  101. package/build-types/dataviews/actions/rename-post.d.ts.map +0 -1
  102. package/build-types/dataviews/actions/reset-post.d.ts +0 -5
  103. package/build-types/dataviews/actions/reset-post.d.ts.map +0 -1
  104. package/build-types/dataviews/actions/restore-post.d.ts +0 -5
  105. package/build-types/dataviews/actions/restore-post.d.ts.map +0 -1
  106. package/build-types/dataviews/actions/trash-post.d.ts +0 -5
  107. package/build-types/dataviews/actions/trash-post.d.ts.map +0 -1
  108. package/build-types/dataviews/fields/index.d.ts +0 -8
  109. package/build-types/dataviews/fields/index.d.ts.map +0 -1
  110. package/src/dataviews/actions/delete-post.tsx +0 -109
  111. package/src/dataviews/actions/rename-post.tsx +0 -146
  112. package/src/dataviews/actions/reset-post.tsx +0 -147
  113. package/src/dataviews/actions/restore-post.tsx +0 -134
  114. package/src/dataviews/actions/trash-post.tsx +0 -198
  115. package/src/dataviews/fields/index.ts +0 -26
@@ -170,19 +170,6 @@ export function setDeviceType(deviceType: string): Object;
170
170
  * @return {Object} Action object.
171
171
  */
172
172
  export function removeEditorPanel(panelName: string): Object;
173
- /**
174
- * Returns an action object used to open/close the inserter.
175
- *
176
- * @param {boolean|Object} value Whether the inserter should be
177
- * opened (true) or closed (false).
178
- * To specify an insertion point,
179
- * use an object.
180
- * @param {string} value.rootClientId The root client ID to insert at.
181
- * @param {number} value.insertionIndex The index to insert at.
182
- *
183
- * @return {Object} Action object.
184
- */
185
- export function setIsInserterOpened(value: boolean | Object): Object;
186
173
  /**
187
174
  * Returns an action object used to open/close the list view.
188
175
  *
@@ -263,6 +250,7 @@ export function toggleEditorPanelEnabled(panelName: string): Object;
263
250
  export function toggleEditorPanelOpened(panelName: string): ({ registry }: {
264
251
  registry: any;
265
252
  }) => void;
253
+ export function setIsInserterOpened(value: boolean | Object): Object;
266
254
  export function toggleDistractionFree(): ({ dispatch, registry }: {
267
255
  dispatch: any;
268
256
  registry: any;
@@ -1 +1 @@
1
- {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/store/actions.js"],"names":[],"mappings":"AA0EA;;;;;;;GAOG;AACH,gDAFY,MAAM,CAUjB;AAED;;;;;GAKG;AACH;;EAOC;AAED;;;;;;GAMG;AACH,8BAHY,MAAM,CAWjB;AAED;;;;;;GAMG;AACH,uCAFW,MAAM,UAQhB;AAED;;;;;;;GAOG;AACH,wCALW,MAAM,UACN,MAAM,GAEL,MAAM,CAQjB;AAiJD;;;;GAIG;AACH;;EAOC;AAqGD;;;;GAIG;AACH;;EAOC;AAED;;;;;GAKG;AACH,qCAHW,MAAM,GACL,MAAM,CAOjB;AAwBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,yCAxCW,MAAM,GAsCL,MAAM,CAOjB;AAED;;;;;;;;;;;;GAYG;AACH,2CAVW,MAAM,GAQL,MAAM,CAOjB;AAED;;;;;;;;;;;;GAYG;AACH,6CAVW,MAAM,GAQL,MAAM,CAOjB;AAED;;;;;;;;;;;;GAYG;AACH,+CAVW,MAAM,GAQL,MAAM,CAOjB;AA6CD;;;EAKC;AAyBD;;;;;;GAMG;AACH,0CAJW,MAAM,GAEL,MAAM,CAOjB;AAiED;;;;;;GAMG;AACH,6CAJW,MAAM,GAEL,MAAM,CAOjB;AAED;;;;;;;;;;;GAWG;AACH,2CATW,OAAO,GAAC,MAAM,GAOb,MAAM,CAOjB;AAED;;;;;GAKG;AACH,4CAHW,OAAO,GACN,MAAM,CAOjB;AA+FD;;;;;GAKG;AACH,sCAFY,MAAM,CAMjB;AAED;;;;;GAKG;AACH,uCAFY,MAAM,CAMjB;AAED;;;;GAIG;AACH,wCAFY,MAAM,CAMjB;AAn1BM,kCAJI,MAAM,SACN,MAAM,YACN,YAAM;;WAiCf;AA0FK,gCAHI,MAAM,WACN,MAAM;;;WASf;AAOK,mCAFI,MAAM;;;;oBA0Hf;AAmBK;;;;oBA2BL;AAUK,iDAFI,MAAM,OAAC;;;oBAqBhB;AAEK;;;;;mBAkBL;AAKK;;WAIL;AAKK;;WAIL;AAgCK;;WAML;AAKK;;WAML;AAsHK,2DAFK,MAAM,OAAA;;;;WA8BhB;AAwBK,uCAFI,MAAM;;;;WAef;AAuBK,oDAJI,MAAM,GAEL,MAAM,CA0BhB;AAOK,mDAFI,MAAM;;WAyBf;AAqDK;;;WA0DL;AAOK,uCAFI,MAAM;;;WAuBf;AA2CD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC"}
1
+ {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/store/actions.js"],"names":[],"mappings":"AA0EA;;;;;;;GAOG;AACH,gDAFY,MAAM,CAUjB;AAED;;;;;GAKG;AACH;;EAOC;AAED;;;;;;GAMG;AACH,8BAHY,MAAM,CAWjB;AAED;;;;;;GAMG;AACH,uCAFW,MAAM,UAQhB;AAED;;;;;;;GAOG;AACH,wCALW,MAAM,UACN,MAAM,GAEL,MAAM,CAQjB;AAiJD;;;;GAIG;AACH;;EAOC;AAqGD;;;;GAIG;AACH;;EAOC;AAED;;;;;GAKG;AACH,qCAHW,MAAM,GACL,MAAM,CAOjB;AAwBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,yCAxCW,MAAM,GAsCL,MAAM,CAOjB;AAED;;;;;;;;;;;;GAYG;AACH,2CAVW,MAAM,GAQL,MAAM,CAOjB;AAED;;;;;;;;;;;;GAYG;AACH,6CAVW,MAAM,GAQL,MAAM,CAOjB;AAED;;;;;;;;;;;;GAYG;AACH,+CAVW,MAAM,GAQL,MAAM,CAOjB;AA6CD;;;EAKC;AAyBD;;;;;;GAMG;AACH,0CAJW,MAAM,GAEL,MAAM,CAOjB;AAiED;;;;;;GAMG;AACH,6CAJW,MAAM,GAEL,MAAM,CAOjB;AAsCD;;;;;GAKG;AACH,4CAHW,OAAO,GACN,MAAM,CAOjB;AA+FD;;;;;GAKG;AACH,sCAFY,MAAM,CAMjB;AAED;;;;;GAKG;AACH,uCAFY,MAAM,CAMjB;AAED;;;;GAIG;AACH,wCAFY,MAAM,CAMjB;AAp2BM,kCAJI,MAAM,SACN,MAAM,YACN,YAAM;;WAiCf;AA0FK,gCAHI,MAAM,WACN,MAAM;;;WASf;AAOK,mCAFI,MAAM;;;;oBA0Hf;AAmBK;;;;oBA2BL;AAUK,iDAFI,MAAM,OAAC;;;oBAqBhB;AAEK;;;;;mBAkBL;AAKK;;WAIL;AAKK;;WAIL;AAgCK;;WAML;AAKK;;WAML;AAsHK,2DAFK,MAAM,OAAA;;;;WA8BhB;AAwBK,uCAFI,MAAM;;;;WAef;AAuBK,oDAJI,MAAM,GAEL,MAAM,CA0BhB;AAOK,mDAFI,MAAM;;WAyBf;AAgCK,2CAbI,OAAO,GAAC,MAAM,GAWb,MAAM,CAoBhB;AAoBK;;;WA0DL;AAOK,uCAFI,MAAM;;;WAuBf;AA2CD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC"}
@@ -3,13 +3,13 @@ export function getInserterSidebarToggleRef(state: any): any;
3
3
  export function getEntityActions(state: any, ...args: any[]): import("@wordpress/dataviews").Action<any>[];
4
4
  export function isEntityReady(state: any, ...args: any[]): boolean;
5
5
  /**
6
- * Get the insertion point for the inserter.
6
+ * Get the inserter.
7
7
  *
8
8
  * @param {Object} state Global application state.
9
9
  *
10
10
  * @return {Object} The root client ID, index to insert at and starting filter value.
11
11
  */
12
- export const getInsertionPoint: Function;
12
+ export const getInserter: Function;
13
13
  export const getPostIcon: Function;
14
14
  /**
15
15
  * Returns true if there are unsaved changes to the
@@ -1 +1 @@
1
- {"version":3,"file":"private-selectors.d.ts","sourceRoot":"","sources":["../../src/store/private-selectors.js"],"names":[],"mappings":"AAkFA,sDAEC;AACD,6DAEC;AA8ED,2GAEC;AAED,mEAEC;AArID;;;;;;GAMG;AACH,yCAmCE;AAeF,mCA6BE;AAEF;;;;;;;;;GASG;AACH,0CA2BE;AAUF;;;;;;;;GAQG;AACH,2CAsBE"}
1
+ {"version":3,"file":"private-selectors.d.ts","sourceRoot":"","sources":["../../src/store/private-selectors.js"],"names":[],"mappings":"AAkFA,sDAEC;AACD,6DAEC;AA8ED,2GAEC;AAED,mEAEC;AArID;;;;;;GAMG;AACH,mCAmCE;AAeF,mCA6BE;AAEF;;;;;;;;;GASG;AACH,0CA2BE;AAUF;;;;;;;;GAQG;AACH,2CAsBE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/editor",
3
- "version": "14.8.6",
3
+ "version": "14.9.0",
4
4
  "description": "Enhanced block editor for WordPress posts.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -32,41 +32,41 @@
32
32
  ],
33
33
  "dependencies": {
34
34
  "@babel/runtime": "^7.16.0",
35
- "@wordpress/a11y": "^4.8.2",
36
- "@wordpress/api-fetch": "^7.8.2",
37
- "@wordpress/blob": "^4.8.1",
38
- "@wordpress/block-editor": "^14.3.4",
39
- "@wordpress/blocks": "^13.8.4",
40
- "@wordpress/commands": "^1.8.4",
41
- "@wordpress/components": "^28.8.4",
42
- "@wordpress/compose": "^7.8.3",
43
- "@wordpress/core-data": "^7.8.4",
44
- "@wordpress/data": "^10.8.3",
45
- "@wordpress/dataviews": "^4.4.4",
46
- "@wordpress/date": "^5.8.2",
47
- "@wordpress/deprecated": "^4.8.2",
48
- "@wordpress/dom": "^4.8.2",
49
- "@wordpress/element": "^6.8.1",
50
- "@wordpress/fields": "^0.0.5",
51
- "@wordpress/hooks": "^4.8.2",
52
- "@wordpress/html-entities": "^4.8.1",
53
- "@wordpress/i18n": "^5.8.2",
54
- "@wordpress/icons": "^10.8.2",
55
- "@wordpress/interface": "^6.8.4",
56
- "@wordpress/keyboard-shortcuts": "^5.8.3",
57
- "@wordpress/keycodes": "^4.8.2",
58
- "@wordpress/media-utils": "^5.8.2",
59
- "@wordpress/notices": "^5.8.3",
60
- "@wordpress/patterns": "^2.8.4",
61
- "@wordpress/plugins": "^7.8.4",
62
- "@wordpress/preferences": "^4.8.4",
63
- "@wordpress/private-apis": "^1.8.1",
64
- "@wordpress/reusable-blocks": "^5.8.4",
65
- "@wordpress/rich-text": "^7.8.3",
66
- "@wordpress/server-side-render": "^5.8.4",
67
- "@wordpress/url": "^4.8.1",
68
- "@wordpress/warning": "^3.8.1",
69
- "@wordpress/wordcount": "^4.8.1",
35
+ "@wordpress/a11y": "^4.9.0",
36
+ "@wordpress/api-fetch": "^7.9.0",
37
+ "@wordpress/blob": "^4.9.0",
38
+ "@wordpress/block-editor": "^14.4.0",
39
+ "@wordpress/blocks": "^13.9.0",
40
+ "@wordpress/commands": "^1.9.0",
41
+ "@wordpress/components": "^28.9.0",
42
+ "@wordpress/compose": "^7.9.0",
43
+ "@wordpress/core-data": "^7.9.0",
44
+ "@wordpress/data": "^10.9.0",
45
+ "@wordpress/dataviews": "^4.5.0",
46
+ "@wordpress/date": "^5.9.0",
47
+ "@wordpress/deprecated": "^4.9.0",
48
+ "@wordpress/dom": "^4.9.0",
49
+ "@wordpress/element": "^6.9.0",
50
+ "@wordpress/fields": "^0.1.0",
51
+ "@wordpress/hooks": "^4.9.0",
52
+ "@wordpress/html-entities": "^4.9.0",
53
+ "@wordpress/i18n": "^5.9.0",
54
+ "@wordpress/icons": "^10.9.0",
55
+ "@wordpress/interface": "^6.9.0",
56
+ "@wordpress/keyboard-shortcuts": "^5.9.0",
57
+ "@wordpress/keycodes": "^4.9.0",
58
+ "@wordpress/media-utils": "^5.9.0",
59
+ "@wordpress/notices": "^5.9.0",
60
+ "@wordpress/patterns": "^2.9.0",
61
+ "@wordpress/plugins": "^7.9.0",
62
+ "@wordpress/preferences": "^4.9.0",
63
+ "@wordpress/private-apis": "^1.9.0",
64
+ "@wordpress/reusable-blocks": "^5.9.0",
65
+ "@wordpress/rich-text": "^7.9.0",
66
+ "@wordpress/server-side-render": "^5.9.0",
67
+ "@wordpress/url": "^4.9.0",
68
+ "@wordpress/warning": "^3.9.0",
69
+ "@wordpress/wordcount": "^4.9.0",
70
70
  "change-case": "^4.1.2",
71
71
  "client-zip": "^2.4.5",
72
72
  "clsx": "^2.1.1",
@@ -86,5 +86,5 @@
86
86
  "publishConfig": {
87
87
  "access": "public"
88
88
  },
89
- "gitHead": "07c75154341d1e5a1b8aaa1c226029b6666a52a9"
89
+ "gitHead": "2e5495c635910cb34bfaca3c6258d2e989f66214"
90
90
  }
@@ -17,21 +17,20 @@ import { __, _x } from '@wordpress/i18n';
17
17
  */
18
18
  import { store as editorStore } from '../../store';
19
19
  import { unlock } from '../../lock-unlock';
20
+ import usePostContentBlocks from '../provider/use-post-content-blocks';
20
21
 
21
22
  function ContentOnlySettingsMenuItems( { clientId, onClose } ) {
23
+ const postContentBlocks = usePostContentBlocks();
22
24
  const { entity, onNavigateToEntityRecord, canEditTemplates } = useSelect(
23
25
  ( select ) => {
24
26
  const {
25
- getBlockEditingMode,
26
27
  getBlockParentsByBlockName,
27
28
  getSettings,
28
29
  getBlockAttributes,
30
+ getBlockParents,
29
31
  } = select( blockEditorStore );
30
- const contentOnly =
31
- getBlockEditingMode( clientId ) === 'contentOnly';
32
- if ( ! contentOnly ) {
33
- return {};
34
- }
32
+ const { getCurrentTemplateId, getRenderingMode } =
33
+ select( editorStore );
35
34
  const patternParent = getBlockParentsByBlockName(
36
35
  clientId,
37
36
  'core/block',
@@ -45,19 +44,20 @@ function ContentOnlySettingsMenuItems( { clientId, onClose } ) {
45
44
  'wp_block',
46
45
  getBlockAttributes( patternParent ).ref
47
46
  );
48
- } else {
49
- const { getCurrentTemplateId } = select( editorStore );
50
- const templateId = getCurrentTemplateId();
51
- const { getContentLockingParent } = unlock(
52
- select( blockEditorStore )
47
+ } else if (
48
+ getRenderingMode() === 'template-locked' &&
49
+ ! getBlockParents( clientId ).some( ( parent ) =>
50
+ postContentBlocks.includes( parent )
51
+ )
52
+ ) {
53
+ record = select( coreStore ).getEntityRecord(
54
+ 'postType',
55
+ 'wp_template',
56
+ getCurrentTemplateId()
53
57
  );
54
- if ( ! getContentLockingParent( clientId ) && templateId ) {
55
- record = select( coreStore ).getEntityRecord(
56
- 'postType',
57
- 'wp_template',
58
- templateId
59
- );
60
- }
58
+ }
59
+ if ( ! record ) {
60
+ return {};
61
61
  }
62
62
  const _canEditTemplates = select( coreStore ).canUser( 'create', {
63
63
  kind: 'postType',
@@ -70,7 +70,7 @@ function ContentOnlySettingsMenuItems( { clientId, onClose } ) {
70
70
  getSettings().onNavigateToEntityRecord,
71
71
  };
72
72
  },
73
- [ clientId ]
73
+ [ clientId, postContentBlocks ]
74
74
  );
75
75
 
76
76
  if ( ! entity ) {
@@ -38,10 +38,8 @@ function DocumentTools( { className, disableBlockTools = false } ) {
38
38
  listViewShortcut,
39
39
  inserterSidebarToggleRef,
40
40
  listViewToggleRef,
41
- hasFixedToolbar,
42
41
  showIconLabels,
43
42
  } = useSelect( ( select ) => {
44
- const { getSettings } = select( blockEditorStore );
45
43
  const { get } = select( preferencesStore );
46
44
  const {
47
45
  isListViewOpened,
@@ -60,7 +58,6 @@ function DocumentTools( { className, disableBlockTools = false } ) {
60
58
  ),
61
59
  inserterSidebarToggleRef: getInserterSidebarToggleRef(),
62
60
  listViewToggleRef: getListViewToggleRef(),
63
- hasFixedToolbar: getSettings().hasFixedToolbar,
64
61
  showIconLabels: get( 'core', 'showIconLabels' ),
65
62
  isDistractionFree: get( 'core', 'distractionFree' ),
66
63
  isVisualMode: getEditorMode() === 'visual',
@@ -137,7 +134,7 @@ function DocumentTools( { className, disableBlockTools = false } ) {
137
134
  ) }
138
135
  { ( isWideViewport || ! showIconLabels ) && (
139
136
  <>
140
- { isLargeViewport && ! hasFixedToolbar && (
137
+ { isLargeViewport && (
141
138
  <ToolbarItem
142
139
  as={ ToolSelector }
143
140
  showTooltip={ ! showIconLabels }
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
+ import { store as blockEditorStore } from '@wordpress/block-editor';
4
5
  import { useSelect } from '@wordpress/data';
5
6
  import { useMediaQuery, useViewportMatch } from '@wordpress/compose';
6
7
  import { __unstableMotion as motion } from '@wordpress/components';
7
8
  import { store as preferencesStore } from '@wordpress/preferences';
8
9
  import { useState } from '@wordpress/element';
9
10
  import { PinnedItems } from '@wordpress/interface';
10
- import { store as blockEditorStore } from '@wordpress/block-editor';
11
11
 
12
12
  /**
13
13
  * Internal dependencies
@@ -53,39 +53,50 @@ function Header( {
53
53
  const isLargeViewport = useViewportMatch( 'medium' );
54
54
  const isTooNarrowForDocumentBar = useMediaQuery( '(max-width: 403px)' );
55
55
  const {
56
+ postType,
56
57
  isTextEditor,
57
58
  isPublishSidebarOpened,
58
59
  showIconLabels,
59
60
  hasFixedToolbar,
61
+ hasBlockSelection,
60
62
  isNestedEntity,
61
63
  } = useSelect( ( select ) => {
62
64
  const { get: getPreference } = select( preferencesStore );
63
65
  const {
64
66
  getEditorMode,
65
67
  getEditorSettings,
68
+ getCurrentPostType,
66
69
  isPublishSidebarOpened: _isPublishSidebarOpened,
67
70
  } = select( editorStore );
68
- const { __unstableGetEditorMode } = select( blockEditorStore );
69
71
 
70
72
  return {
73
+ postType: getCurrentPostType(),
71
74
  isTextEditor: getEditorMode() === 'text',
72
75
  isPublishSidebarOpened: _isPublishSidebarOpened(),
73
76
  showIconLabels: getPreference( 'core', 'showIconLabels' ),
74
77
  hasFixedToolbar: getPreference( 'core', 'fixedToolbar' ),
78
+ hasBlockSelection:
79
+ !! select( blockEditorStore ).getBlockSelectionStart(),
75
80
  isNestedEntity:
76
81
  !! getEditorSettings().onNavigateToPreviousEntityRecord,
77
- isZoomedOutView: __unstableGetEditorMode() === 'zoom-out',
78
82
  };
79
83
  }, [] );
80
84
 
85
+ const canBeZoomedOut = [ 'post', 'page', 'wp_template' ].includes(
86
+ postType
87
+ );
88
+
81
89
  const [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =
82
90
  useState( true );
83
91
 
84
- const hasCenter = isBlockToolsCollapsed && ! isTooNarrowForDocumentBar;
92
+ const hasCenter =
93
+ ( ! hasBlockSelection || isBlockToolsCollapsed ) &&
94
+ ! isTooNarrowForDocumentBar;
85
95
  const hasBackButton = useHasBackButton();
86
-
87
- // The edit-post-header classname is only kept for backward compatibilty
88
- // as some plugins might be relying on its presence.
96
+ /*
97
+ * The edit-post-header classname is only kept for backward compatability
98
+ * as some plugins might be relying on its presence.
99
+ */
89
100
  return (
90
101
  <div className="editor-header edit-post-header">
91
102
  { hasBackButton && (
@@ -127,13 +138,20 @@ function Header( {
127
138
  className="editor-header__settings"
128
139
  >
129
140
  { ! customSaveButton && ! isPublishSidebarOpened && (
130
- // This button isn't completely hidden by the publish sidebar.
131
- // We can't hide the whole toolbar when the publish sidebar is open because
132
- // we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.
133
- // We track that DOM node to return focus to the PostPublishButtonOrToggle
134
- // when the publish sidebar has been closed.
141
+ /*
142
+ * This button isn't completely hidden by the publish sidebar.
143
+ * We can't hide the whole toolbar when the publish sidebar is open because
144
+ * we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.
145
+ * We track that DOM node to return focus to the PostPublishButtonOrToggle
146
+ * when the publish sidebar has been closed.
147
+ */
135
148
  <PostSavedState forceIsDirty={ forceIsDirty } />
136
149
  ) }
150
+
151
+ { canBeZoomedOut && isEditorIframed && isWideViewport && (
152
+ <ZoomOutToggle />
153
+ ) }
154
+
137
155
  <PreviewDropdown
138
156
  forceIsAutosaveable={ forceIsDirty }
139
157
  disabled={ isNestedEntity }
@@ -144,8 +162,6 @@ function Header( {
144
162
  />
145
163
  <PostViewLink />
146
164
 
147
- { isEditorIframed && isWideViewport && <ZoomOutToggle /> }
148
-
149
165
  { ( isWideViewport || ! showIconLabels ) && (
150
166
  <PinnedItems.Slot scope="core" />
151
167
  ) }
@@ -24,13 +24,13 @@ export default function InserterSidebar() {
24
24
  const {
25
25
  blockSectionRootClientId,
26
26
  inserterSidebarToggleRef,
27
- insertionPoint,
27
+ inserter,
28
28
  showMostUsedBlocks,
29
29
  sidebarIsOpened,
30
30
  } = useSelect( ( select ) => {
31
31
  const {
32
32
  getInserterSidebarToggleRef,
33
- getInsertionPoint,
33
+ getInserter,
34
34
  isPublishSidebarOpened,
35
35
  } = unlock( select( editorStore ) );
36
36
  const {
@@ -52,7 +52,7 @@ export default function InserterSidebar() {
52
52
  };
53
53
  return {
54
54
  inserterSidebarToggleRef: getInserterSidebarToggleRef(),
55
- insertionPoint: getInsertionPoint(),
55
+ inserter: getInserter(),
56
56
  showMostUsedBlocks: get( 'core', 'mostUsedBlocks' ),
57
57
  blockSectionRootClientId: getBlockSectionRootClientId(),
58
58
  sidebarIsOpened: !! (
@@ -88,14 +88,11 @@ export default function InserterSidebar() {
88
88
  showMostUsedBlocks={ showMostUsedBlocks }
89
89
  showInserterHelpPanel
90
90
  shouldFocusBlock={ isMobileViewport }
91
- rootClientId={
92
- blockSectionRootClientId ?? insertionPoint.rootClientId
93
- }
94
- __experimentalInsertionIndex={ insertionPoint.insertionIndex }
95
- onSelect={ insertionPoint.onSelect }
96
- __experimentalInitialTab={ insertionPoint.tab }
97
- __experimentalInitialCategory={ insertionPoint.category }
98
- __experimentalFilterValue={ insertionPoint.filterValue }
91
+ rootClientId={ blockSectionRootClientId }
92
+ onSelect={ inserter.onSelect }
93
+ __experimentalInitialTab={ inserter.tab }
94
+ __experimentalInitialCategory={ inserter.category }
95
+ __experimentalFilterValue={ inserter.filterValue }
99
96
  onPatternCategorySelection={
100
97
  sidebarIsOpened
101
98
  ? () => disableComplementaryArea( 'core' )
@@ -3,52 +3,32 @@
3
3
  */
4
4
  import { useSelect, useRegistry } from '@wordpress/data';
5
5
  import { store as blockEditorStore } from '@wordpress/block-editor';
6
- import { useEffect, useMemo } from '@wordpress/element';
7
- import { applyFilters } from '@wordpress/hooks';
6
+ import { useEffect } from '@wordpress/element';
8
7
 
9
8
  /**
10
9
  * Internal dependencies
11
10
  */
12
- import { store as editorStore } from '../../store';
13
- import { unlock } from '../../lock-unlock';
14
-
15
- const POST_CONTENT_BLOCK_TYPES = [
16
- 'core/post-title',
17
- 'core/post-featured-image',
18
- 'core/post-content',
19
- ];
11
+ import usePostContentBlocks from './use-post-content-blocks';
20
12
 
21
13
  /**
22
14
  * Component that when rendered, makes it so that the site editor allows only
23
15
  * page content to be edited.
24
16
  */
25
17
  export default function DisableNonPageContentBlocks() {
26
- const contentOnlyBlockTypes = useMemo(
27
- () => [
28
- ...applyFilters(
29
- 'editor.postContentBlockTypes',
30
- POST_CONTENT_BLOCK_TYPES
31
- ),
32
- 'core/template-part',
33
- ],
34
- []
35
- );
36
-
37
- // Note that there are two separate subscriptions because the result for each
38
- // returns a new array.
39
- const contentOnlyIds = useSelect(
18
+ const contentOnlyIds = usePostContentBlocks();
19
+ const templateParts = useSelect( ( select ) => {
20
+ const { getBlocksByName } = select( blockEditorStore );
21
+ return getBlocksByName( 'core/template-part' );
22
+ }, [] );
23
+ const disabledIds = useSelect(
40
24
  ( select ) => {
41
- const { getPostBlocksByName } = unlock( select( editorStore ) );
42
- return getPostBlocksByName( contentOnlyBlockTypes );
25
+ const { getBlockOrder } = select( blockEditorStore );
26
+ return templateParts.flatMap( ( clientId ) =>
27
+ getBlockOrder( clientId )
28
+ );
43
29
  },
44
- [ contentOnlyBlockTypes ]
30
+ [ templateParts ]
45
31
  );
46
- const disabledIds = useSelect( ( select ) => {
47
- const { getBlocksByName, getBlockOrder } = select( blockEditorStore );
48
- return getBlocksByName( 'core/template-part' ).flatMap( ( clientId ) =>
49
- getBlockOrder( clientId )
50
- );
51
- }, [] );
52
32
 
53
33
  const registry = useRegistry();
54
34
 
@@ -61,6 +41,9 @@ export default function DisableNonPageContentBlocks() {
61
41
  for ( const clientId of contentOnlyIds ) {
62
42
  setBlockEditingMode( clientId, 'contentOnly' );
63
43
  }
44
+ for ( const clientId of templateParts ) {
45
+ setBlockEditingMode( clientId, 'contentOnly' );
46
+ }
64
47
  for ( const clientId of disabledIds ) {
65
48
  setBlockEditingMode( clientId, 'disabled' );
66
49
  }
@@ -72,12 +55,15 @@ export default function DisableNonPageContentBlocks() {
72
55
  for ( const clientId of contentOnlyIds ) {
73
56
  unsetBlockEditingMode( clientId );
74
57
  }
58
+ for ( const clientId of templateParts ) {
59
+ unsetBlockEditingMode( clientId );
60
+ }
75
61
  for ( const clientId of disabledIds ) {
76
62
  unsetBlockEditingMode( clientId );
77
63
  }
78
64
  } );
79
65
  };
80
- }, [ contentOnlyIds, disabledIds, registry ] );
66
+ }, [ templateParts, contentOnlyIds, disabledIds, registry ] );
81
67
 
82
68
  return null;
83
69
  }
@@ -0,0 +1,42 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useSelect } from '@wordpress/data';
5
+ import { useMemo } from '@wordpress/element';
6
+ import { applyFilters } from '@wordpress/hooks';
7
+
8
+ /**
9
+ * Internal dependencies
10
+ */
11
+ import { store as editorStore } from '../../store';
12
+ import { unlock } from '../../lock-unlock';
13
+
14
+ const POST_CONTENT_BLOCK_TYPES = [
15
+ 'core/post-title',
16
+ 'core/post-featured-image',
17
+ 'core/post-content',
18
+ ];
19
+
20
+ export default function usePostContentBlocks() {
21
+ const contentOnlyBlockTypes = useMemo(
22
+ () => [
23
+ ...applyFilters(
24
+ 'editor.postContentBlockTypes',
25
+ POST_CONTENT_BLOCK_TYPES
26
+ ),
27
+ ],
28
+ []
29
+ );
30
+
31
+ // Note that there are two separate subscriptions because the result for each
32
+ // returns a new array.
33
+ const contentOnlyIds = useSelect(
34
+ ( select ) => {
35
+ const { getPostBlocksByName } = unlock( select( editorStore ) );
36
+ return getPostBlocksByName( contentOnlyBlockTypes );
37
+ },
38
+ [ contentOnlyBlockTypes ]
39
+ );
40
+
41
+ return contentOnlyIds;
42
+ }
@@ -15,6 +15,11 @@ export default function ResizeHandle( { direction, resizeWidthBy } ) {
15
15
  function handleKeyDown( event ) {
16
16
  const { keyCode } = event;
17
17
 
18
+ if ( keyCode !== LEFT && keyCode !== RIGHT ) {
19
+ return;
20
+ }
21
+ event.preventDefault();
22
+
18
23
  if (
19
24
  ( direction === 'left' && keyCode === LEFT ) ||
20
25
  ( direction === 'right' && keyCode === RIGHT )
@@ -40,7 +40,7 @@ const ZoomOutToggle = () => {
40
40
  <Button
41
41
  onClick={ handleZoomOut }
42
42
  icon={ zoomOutIcon }
43
- label={ __( 'Toggle Zoom Out' ) }
43
+ label={ __( 'Zoom Out' ) }
44
44
  isPressed={ isZoomOut }
45
45
  size="compact"
46
46
  showTooltip={ ! showIconLabels }
@@ -8,11 +8,6 @@ import { doAction } from '@wordpress/hooks';
8
8
  /**
9
9
  * Internal dependencies
10
10
  */
11
- import duplicateTemplatePart from '../actions/duplicate-template-part';
12
- import resetPost from '../actions/reset-post';
13
- import trashPost from '../actions/trash-post';
14
- import renamePost from '../actions/rename-post';
15
- import restorePost from '../actions/restore-post';
16
11
  import type { PostType } from '../types';
17
12
  import { store as editorStore } from '../../store';
18
13
  import { unlock } from '../../lock-unlock';
@@ -24,8 +19,13 @@ import {
24
19
  reorderPage,
25
20
  exportPattern,
26
21
  permanentlyDeletePost,
22
+ restorePost,
23
+ trashPost,
24
+ renamePost,
25
+ resetPost,
26
+ deletePost,
27
27
  } from '@wordpress/fields';
28
- import deletePost from '../actions/delete-post';
28
+ import duplicateTemplatePart from '../actions/duplicate-template-part';
29
29
 
30
30
  export function registerEntityAction< Item >(
31
31
  kind: string,
@@ -117,8 +117,8 @@ export const registerPostTypeActions =
117
117
  ? reorderPage
118
118
  : undefined,
119
119
  postTypeConfig.slug === 'wp_block' ? exportPattern : undefined,
120
- resetPost,
121
120
  restorePost,
121
+ resetPost,
122
122
  deletePost,
123
123
  trashPost,
124
124
  permanentlyDeletePost,
@@ -30,7 +30,7 @@ import {
30
30
  getNotificationArgumentsForSaveFail,
31
31
  getNotificationArgumentsForTrashFail,
32
32
  } from './utils/notice-builder';
33
-
33
+ import { unlock } from '../lock-unlock';
34
34
  /**
35
35
  * Returns an action generator used in signalling that editor has initialized with
36
36
  * the specified post object and editor settings.
@@ -741,15 +741,32 @@ export function removeEditorPanel( panelName ) {
741
741
  * use an object.
742
742
  * @param {string} value.rootClientId The root client ID to insert at.
743
743
  * @param {number} value.insertionIndex The index to insert at.
744
+ * @param {string} value.filterValue A query to filter the inserter results.
745
+ * @param {Function} value.onSelect A callback when an item is selected.
746
+ * @param {string} value.tab The tab to open in the inserter.
747
+ * @param {string} value.category The category to initialize in the inserter.
744
748
  *
745
749
  * @return {Object} Action object.
746
750
  */
747
- export function setIsInserterOpened( value ) {
748
- return {
749
- type: 'SET_IS_INSERTER_OPENED',
750
- value,
751
+ export const setIsInserterOpened =
752
+ ( value ) =>
753
+ ( { dispatch, registry } ) => {
754
+ if (
755
+ typeof value === 'object' &&
756
+ value.hasOwnProperty( 'rootClientId' ) &&
757
+ value.hasOwnProperty( 'insertionIndex' )
758
+ ) {
759
+ unlock( registry.dispatch( blockEditorStore ) ).setInsertionPoint( {
760
+ rootClientId: value.rootClientId,
761
+ index: value.insertionIndex,
762
+ } );
763
+ }
764
+
765
+ dispatch( {
766
+ type: 'SET_IS_INSERTER_OPENED',
767
+ value,
768
+ } );
751
769
  };
752
- }
753
770
 
754
771
  /**
755
772
  * Returns an action object used to open/close the list view.
@@ -37,13 +37,13 @@ const EMPTY_INSERTION_POINT = {
37
37
  };
38
38
 
39
39
  /**
40
- * Get the insertion point for the inserter.
40
+ * Get the inserter.
41
41
  *
42
42
  * @param {Object} state Global application state.
43
43
  *
44
44
  * @return {Object} The root client ID, index to insert at and starting filter value.
45
45
  */
46
- export const getInsertionPoint = createRegistrySelector( ( select ) =>
46
+ export const getInserter = createRegistrySelector( ( select ) =>
47
47
  createSelector(
48
48
  ( state ) => {
49
49
  if ( typeof state.blockInserterPanel === 'object' ) {