@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.
- package/CHANGELOG.md +2 -0
- package/build/components/block-settings-menu/content-only-settings-menu.js +15 -18
- package/build/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
- package/build/components/document-tools/index.js +1 -6
- package/build/components/document-tools/index.js.map +1 -1
- package/build/components/header/index.js +22 -17
- package/build/components/header/index.js.map +1 -1
- package/build/components/inserter-sidebar/index.js +8 -9
- package/build/components/inserter-sidebar/index.js.map +1 -1
- package/build/components/provider/disable-non-page-content-blocks.js +17 -18
- package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
- package/build/components/provider/use-post-content-blocks.js +34 -0
- package/build/components/provider/use-post-content-blocks.js.map +1 -0
- package/build/components/resizable-editor/resize-handle.js +4 -0
- package/build/components/resizable-editor/resize-handle.js.map +1 -1
- package/build/components/zoom-out-toggle/index.js +1 -1
- package/build/components/zoom-out-toggle/index.js.map +1 -1
- package/build/dataviews/store/private-actions.js +2 -7
- package/build/dataviews/store/private-actions.js.map +1 -1
- package/build/store/actions.js +20 -5
- package/build/store/actions.js.map +1 -1
- package/build/store/private-selectors.js +3 -3
- package/build/store/private-selectors.js.map +1 -1
- package/build-module/components/block-settings-menu/content-only-settings-menu.js +14 -18
- package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
- package/build-module/components/document-tools/index.js +1 -6
- package/build-module/components/document-tools/index.js.map +1 -1
- package/build-module/components/header/index.js +22 -17
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/inserter-sidebar/index.js +8 -9
- package/build-module/components/inserter-sidebar/index.js.map +1 -1
- package/build-module/components/provider/disable-non-page-content-blocks.js +17 -18
- package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
- package/build-module/components/provider/use-post-content-blocks.js +27 -0
- package/build-module/components/provider/use-post-content-blocks.js.map +1 -0
- package/build-module/components/resizable-editor/resize-handle.js +4 -0
- package/build-module/components/resizable-editor/resize-handle.js.map +1 -1
- package/build-module/components/zoom-out-toggle/index.js +1 -1
- package/build-module/components/zoom-out-toggle/index.js.map +1 -1
- package/build-module/dataviews/store/private-actions.js +4 -8
- package/build-module/dataviews/store/private-actions.js.map +1 -1
- package/build-module/store/actions.js +18 -5
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-selectors.js +2 -2
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-style/style-rtl.css +10 -1
- package/build-style/style.css +10 -1
- package/build-types/components/document-tools/index.d.ts.map +1 -1
- package/build-types/components/header/index.d.ts.map +1 -1
- package/build-types/components/inserter-sidebar/index.d.ts.map +1 -1
- package/build-types/components/provider/disable-non-page-content-blocks.d.ts.map +1 -1
- package/build-types/components/provider/use-post-content-blocks.d.ts +2 -0
- package/build-types/components/provider/use-post-content-blocks.d.ts.map +1 -0
- package/build-types/components/resizable-editor/resize-handle.d.ts.map +1 -1
- package/build-types/store/actions.d.ts +1 -13
- package/build-types/store/actions.d.ts.map +1 -1
- package/build-types/store/private-selectors.d.ts +2 -2
- package/build-types/store/private-selectors.d.ts.map +1 -1
- package/package.json +37 -37
- package/src/components/block-settings-menu/content-only-settings-menu.js +19 -19
- package/src/components/document-tools/index.js +1 -4
- package/src/components/header/index.js +30 -14
- package/src/components/inserter-sidebar/index.js +8 -11
- package/src/components/provider/disable-non-page-content-blocks.js +20 -34
- package/src/components/provider/use-post-content-blocks.js +42 -0
- package/src/components/resizable-editor/resize-handle.js +5 -0
- package/src/components/zoom-out-toggle/index.js +1 -1
- package/src/dataviews/store/private-actions.ts +7 -7
- package/src/store/actions.js +23 -6
- package/src/store/private-selectors.js +2 -2
- package/src/store/test/actions.js +76 -0
- package/src/store/test/reducer.js +0 -22
- package/tsconfig.tsbuildinfo +1 -1
- package/build/dataviews/actions/delete-post.js +0 -98
- package/build/dataviews/actions/delete-post.js.map +0 -1
- package/build/dataviews/actions/rename-post.js +0 -125
- package/build/dataviews/actions/rename-post.js.map +0 -1
- package/build/dataviews/actions/reset-post.js +0 -113
- package/build/dataviews/actions/reset-post.js.map +0 -1
- package/build/dataviews/actions/restore-post.js +0 -112
- package/build/dataviews/actions/restore-post.js.map +0 -1
- package/build/dataviews/actions/trash-post.js +0 -144
- package/build/dataviews/actions/trash-post.js.map +0 -1
- package/build/dataviews/fields/index.js +0 -32
- package/build/dataviews/fields/index.js.map +0 -1
- package/build-module/dataviews/actions/delete-post.js +0 -89
- package/build-module/dataviews/actions/delete-post.js.map +0 -1
- package/build-module/dataviews/actions/rename-post.js +0 -118
- package/build-module/dataviews/actions/rename-post.js.map +0 -1
- package/build-module/dataviews/actions/reset-post.js +0 -106
- package/build-module/dataviews/actions/reset-post.js.map +0 -1
- package/build-module/dataviews/actions/restore-post.js +0 -104
- package/build-module/dataviews/actions/restore-post.js.map +0 -1
- package/build-module/dataviews/actions/trash-post.js +0 -137
- package/build-module/dataviews/actions/trash-post.js.map +0 -1
- package/build-module/dataviews/fields/index.js +0 -26
- package/build-module/dataviews/fields/index.js.map +0 -1
- package/build-types/dataviews/actions/delete-post.d.ts +0 -5
- package/build-types/dataviews/actions/delete-post.d.ts.map +0 -1
- package/build-types/dataviews/actions/rename-post.d.ts +0 -5
- package/build-types/dataviews/actions/rename-post.d.ts.map +0 -1
- package/build-types/dataviews/actions/reset-post.d.ts +0 -5
- package/build-types/dataviews/actions/reset-post.d.ts.map +0 -1
- package/build-types/dataviews/actions/restore-post.d.ts +0 -5
- package/build-types/dataviews/actions/restore-post.d.ts.map +0 -1
- package/build-types/dataviews/actions/trash-post.d.ts +0 -5
- package/build-types/dataviews/actions/trash-post.d.ts.map +0 -1
- package/build-types/dataviews/fields/index.d.ts +0 -8
- package/build-types/dataviews/fields/index.d.ts.map +0 -1
- package/src/dataviews/actions/delete-post.tsx +0 -109
- package/src/dataviews/actions/rename-post.tsx +0 -146
- package/src/dataviews/actions/reset-post.tsx +0 -147
- package/src/dataviews/actions/restore-post.tsx +0 -134
- package/src/dataviews/actions/trash-post.tsx +0 -198
- 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;
|
|
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
|
|
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
|
|
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,
|
|
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.
|
|
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.
|
|
36
|
-
"@wordpress/api-fetch": "^7.
|
|
37
|
-
"@wordpress/blob": "^4.
|
|
38
|
-
"@wordpress/block-editor": "^14.
|
|
39
|
-
"@wordpress/blocks": "^13.
|
|
40
|
-
"@wordpress/commands": "^1.
|
|
41
|
-
"@wordpress/components": "^28.
|
|
42
|
-
"@wordpress/compose": "^7.
|
|
43
|
-
"@wordpress/core-data": "^7.
|
|
44
|
-
"@wordpress/data": "^10.
|
|
45
|
-
"@wordpress/dataviews": "^4.
|
|
46
|
-
"@wordpress/date": "^5.
|
|
47
|
-
"@wordpress/deprecated": "^4.
|
|
48
|
-
"@wordpress/dom": "^4.
|
|
49
|
-
"@wordpress/element": "^6.
|
|
50
|
-
"@wordpress/fields": "^0.0
|
|
51
|
-
"@wordpress/hooks": "^4.
|
|
52
|
-
"@wordpress/html-entities": "^4.
|
|
53
|
-
"@wordpress/i18n": "^5.
|
|
54
|
-
"@wordpress/icons": "^10.
|
|
55
|
-
"@wordpress/interface": "^6.
|
|
56
|
-
"@wordpress/keyboard-shortcuts": "^5.
|
|
57
|
-
"@wordpress/keycodes": "^4.
|
|
58
|
-
"@wordpress/media-utils": "^5.
|
|
59
|
-
"@wordpress/notices": "^5.
|
|
60
|
-
"@wordpress/patterns": "^2.
|
|
61
|
-
"@wordpress/plugins": "^7.
|
|
62
|
-
"@wordpress/preferences": "^4.
|
|
63
|
-
"@wordpress/private-apis": "^1.
|
|
64
|
-
"@wordpress/reusable-blocks": "^5.
|
|
65
|
-
"@wordpress/rich-text": "^7.
|
|
66
|
-
"@wordpress/server-side-render": "^5.
|
|
67
|
-
"@wordpress/url": "^4.
|
|
68
|
-
"@wordpress/warning": "^3.
|
|
69
|
-
"@wordpress/wordcount": "^4.
|
|
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": "
|
|
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
|
|
31
|
-
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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 &&
|
|
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 =
|
|
92
|
+
const hasCenter =
|
|
93
|
+
( ! hasBlockSelection || isBlockToolsCollapsed ) &&
|
|
94
|
+
! isTooNarrowForDocumentBar;
|
|
85
95
|
const hasBackButton = useHasBackButton();
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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
|
-
|
|
27
|
+
inserter,
|
|
28
28
|
showMostUsedBlocks,
|
|
29
29
|
sidebarIsOpened,
|
|
30
30
|
} = useSelect( ( select ) => {
|
|
31
31
|
const {
|
|
32
32
|
getInserterSidebarToggleRef,
|
|
33
|
-
|
|
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
|
-
|
|
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
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
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
|
|
7
|
-
import { applyFilters } from '@wordpress/hooks';
|
|
6
|
+
import { useEffect } from '@wordpress/element';
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* Internal dependencies
|
|
11
10
|
*/
|
|
12
|
-
import
|
|
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
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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 {
|
|
42
|
-
return
|
|
25
|
+
const { getBlockOrder } = select( blockEditorStore );
|
|
26
|
+
return templateParts.flatMap( ( clientId ) =>
|
|
27
|
+
getBlockOrder( clientId )
|
|
28
|
+
);
|
|
43
29
|
},
|
|
44
|
-
[
|
|
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 )
|
|
@@ -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
|
|
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,
|
package/src/store/actions.js
CHANGED
|
@@ -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
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
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
|
|
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
|
|
46
|
+
export const getInserter = createRegistrySelector( ( select ) =>
|
|
47
47
|
createSelector(
|
|
48
48
|
( state ) => {
|
|
49
49
|
if ( typeof state.blockInserterPanel === 'object' ) {
|