@wordpress/edit-post 7.4.0 → 7.6.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 +4 -0
- package/build/components/device-preview/index.js +3 -7
- package/build/components/device-preview/index.js.map +1 -1
- package/build/components/header/fullscreen-mode-close/index.js +3 -3
- package/build/components/header/fullscreen-mode-close/index.js.map +1 -1
- package/build/components/header/header-toolbar/index.native.js +5 -0
- package/build/components/header/header-toolbar/index.native.js.map +1 -1
- package/build/components/header/post-publish-button-or-toggle.js +13 -15
- package/build/components/header/post-publish-button-or-toggle.js.map +1 -1
- package/build/components/header/template-title/edit-template-title.js +6 -8
- package/build/components/header/template-title/edit-template-title.js.map +1 -1
- package/build/components/header/tools-more-menu-group/index.js +1 -7
- package/build/components/header/tools-more-menu-group/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +11 -11
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/index.js +13 -13
- package/build/components/layout/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +1 -7
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/sidebar/featured-image/index.js +3 -7
- package/build/components/sidebar/featured-image/index.js.map +1 -1
- package/build/components/sidebar/page-attributes/index.js +3 -7
- package/build/components/sidebar/page-attributes/index.js.map +1 -1
- package/build/components/sidebar/post-taxonomies/taxonomy-panel.js +6 -8
- package/build/components/sidebar/post-taxonomies/taxonomy-panel.js.map +1 -1
- package/build/components/sidebar/post-template/create-modal.js +1 -1
- package/build/components/sidebar/post-template/create-modal.js.map +1 -1
- package/build/components/visual-editor/index.js +29 -24
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/components/welcome-guide/default.js +1 -1
- package/build/components/welcome-guide/default.js.map +1 -1
- package/build/index.js +3 -0
- package/build/index.js.map +1 -1
- package/build-module/components/device-preview/index.js +3 -6
- package/build-module/components/device-preview/index.js.map +1 -1
- package/build-module/components/header/fullscreen-mode-close/index.js +3 -2
- package/build-module/components/header/fullscreen-mode-close/index.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.native.js +6 -0
- package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
- package/build-module/components/header/post-publish-button-or-toggle.js +13 -14
- package/build-module/components/header/post-publish-button-or-toggle.js.map +1 -1
- package/build-module/components/header/template-title/edit-template-title.js +6 -7
- package/build-module/components/header/template-title/edit-template-title.js.map +1 -1
- package/build-module/components/header/tools-more-menu-group/index.js +1 -6
- package/build-module/components/header/tools-more-menu-group/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +11 -11
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/index.js +13 -13
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +1 -6
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/sidebar/featured-image/index.js +3 -6
- package/build-module/components/sidebar/featured-image/index.js.map +1 -1
- package/build-module/components/sidebar/page-attributes/index.js +3 -6
- package/build-module/components/sidebar/page-attributes/index.js.map +1 -1
- package/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js +6 -7
- package/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js.map +1 -1
- package/build-module/components/sidebar/post-template/create-modal.js +1 -1
- package/build-module/components/sidebar/post-template/create-modal.js.map +1 -1
- package/build-module/components/visual-editor/index.js +28 -24
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/components/welcome-guide/default.js +1 -1
- package/build-module/components/welcome-guide/default.js.map +1 -1
- package/build-module/index.js +4 -1
- package/build-module/index.js.map +1 -1
- package/build-style/style-rtl.css +10 -3
- package/build-style/style.css +10 -3
- package/package.json +30 -31
- package/src/components/device-preview/index.js +1 -6
- package/src/components/header/fullscreen-mode-close/index.js +1 -6
- package/src/components/header/header-toolbar/index.native.js +5 -0
- package/src/components/header/post-publish-button-or-toggle.js +4 -10
- package/src/components/header/template-title/edit-template-title.js +8 -12
- package/src/components/header/tools-more-menu-group/index.js +1 -6
- package/src/components/keyboard-shortcuts/index.js +13 -11
- package/src/components/layout/index.js +14 -14
- package/src/components/preferences-modal/index.js +1 -9
- package/src/components/preferences-modal/test/__snapshots__/index.js.snap +1 -1
- package/src/components/sidebar/featured-image/index.js +3 -10
- package/src/components/sidebar/page-attributes/index.js +3 -10
- package/src/components/sidebar/post-taxonomies/taxonomy-panel.js +2 -7
- package/src/components/sidebar/post-template/create-modal.js +1 -1
- package/src/components/visual-editor/index.js +36 -22
- package/src/components/welcome-guide/default.js +1 -1
- package/src/index.js +5 -1
- package/src/test/editor.native.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-post",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.6.0",
|
|
4
4
|
"description": "Edit Post module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -27,36 +27,35 @@
|
|
|
27
27
|
"react-native": "src/index",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@babel/runtime": "^7.16.0",
|
|
30
|
-
"@wordpress/a11y": "^3.
|
|
31
|
-
"@wordpress/api-fetch": "^6.
|
|
32
|
-
"@wordpress/block-editor": "^11.
|
|
33
|
-
"@wordpress/block-library": "^8.
|
|
34
|
-
"@wordpress/blocks": "^12.
|
|
35
|
-
"@wordpress/components": "^23.
|
|
36
|
-
"@wordpress/compose": "^6.
|
|
37
|
-
"@wordpress/core-data": "^6.
|
|
38
|
-
"@wordpress/data": "^8.
|
|
39
|
-
"@wordpress/deprecated": "^3.
|
|
40
|
-
"@wordpress/dom": "^3.
|
|
41
|
-
"@wordpress/editor": "^13.
|
|
42
|
-
"@wordpress/element": "^5.
|
|
43
|
-
"@wordpress/hooks": "^3.
|
|
44
|
-
"@wordpress/i18n": "^4.
|
|
45
|
-
"@wordpress/icons": "^9.
|
|
46
|
-
"@wordpress/interface": "^5.
|
|
47
|
-
"@wordpress/keyboard-shortcuts": "^4.
|
|
48
|
-
"@wordpress/keycodes": "^3.
|
|
49
|
-
"@wordpress/media-utils": "^4.
|
|
50
|
-
"@wordpress/notices": "^3.
|
|
51
|
-
"@wordpress/plugins": "^5.
|
|
52
|
-
"@wordpress/preferences": "^3.
|
|
53
|
-
"@wordpress/private-apis": "^0.
|
|
54
|
-
"@wordpress/url": "^3.
|
|
55
|
-
"@wordpress/viewport": "^5.
|
|
56
|
-
"@wordpress/warning": "^2.
|
|
57
|
-
"@wordpress/widgets": "^3.
|
|
30
|
+
"@wordpress/a11y": "^3.29.0",
|
|
31
|
+
"@wordpress/api-fetch": "^6.26.0",
|
|
32
|
+
"@wordpress/block-editor": "^11.6.0",
|
|
33
|
+
"@wordpress/block-library": "^8.6.0",
|
|
34
|
+
"@wordpress/blocks": "^12.6.0",
|
|
35
|
+
"@wordpress/components": "^23.6.0",
|
|
36
|
+
"@wordpress/compose": "^6.6.0",
|
|
37
|
+
"@wordpress/core-data": "^6.6.0",
|
|
38
|
+
"@wordpress/data": "^8.6.0",
|
|
39
|
+
"@wordpress/deprecated": "^3.29.0",
|
|
40
|
+
"@wordpress/dom": "^3.29.0",
|
|
41
|
+
"@wordpress/editor": "^13.6.0",
|
|
42
|
+
"@wordpress/element": "^5.6.0",
|
|
43
|
+
"@wordpress/hooks": "^3.29.0",
|
|
44
|
+
"@wordpress/i18n": "^4.29.0",
|
|
45
|
+
"@wordpress/icons": "^9.20.0",
|
|
46
|
+
"@wordpress/interface": "^5.6.0",
|
|
47
|
+
"@wordpress/keyboard-shortcuts": "^4.6.0",
|
|
48
|
+
"@wordpress/keycodes": "^3.29.0",
|
|
49
|
+
"@wordpress/media-utils": "^4.20.0",
|
|
50
|
+
"@wordpress/notices": "^3.29.0",
|
|
51
|
+
"@wordpress/plugins": "^5.6.0",
|
|
52
|
+
"@wordpress/preferences": "^3.6.0",
|
|
53
|
+
"@wordpress/private-apis": "^0.11.0",
|
|
54
|
+
"@wordpress/url": "^3.30.0",
|
|
55
|
+
"@wordpress/viewport": "^5.6.0",
|
|
56
|
+
"@wordpress/warning": "^2.29.0",
|
|
57
|
+
"@wordpress/widgets": "^3.6.0",
|
|
58
58
|
"classnames": "^2.3.1",
|
|
59
|
-
"lodash": "^4.17.21",
|
|
60
59
|
"memize": "^1.1.0",
|
|
61
60
|
"rememo": "^4.0.0"
|
|
62
61
|
},
|
|
@@ -67,5 +66,5 @@
|
|
|
67
66
|
"publishConfig": {
|
|
68
67
|
"access": "public"
|
|
69
68
|
},
|
|
70
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "9534a7b3bbf07c1d40b94fdb7a3d091f297bfb06"
|
|
71
70
|
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -35,7 +30,7 @@ export default function DevicePreview() {
|
|
|
35
30
|
hasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),
|
|
36
31
|
isSaving: select( editPostStore ).isSavingMetaBoxes(),
|
|
37
32
|
isPostSaveable: select( editorStore ).isEditedPostSaveable(),
|
|
38
|
-
isViewable:
|
|
33
|
+
isViewable: postType?.viewable ?? false,
|
|
39
34
|
deviceType:
|
|
40
35
|
select( editPostStore ).__experimentalGetPreviewDeviceType(),
|
|
41
36
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
4
|
import classnames from 'classnames';
|
|
6
5
|
|
|
7
6
|
/**
|
|
@@ -99,11 +98,7 @@ function FullscreenModeClose( { showTooltip, icon, href } ) {
|
|
|
99
98
|
post_type: postType.slug,
|
|
100
99
|
} )
|
|
101
100
|
}
|
|
102
|
-
label={
|
|
103
|
-
postType,
|
|
104
|
-
[ 'labels', 'view_items' ],
|
|
105
|
-
__( 'Back' )
|
|
106
|
-
) }
|
|
101
|
+
label={ postType?.labels?.view_items ?? __( 'Back' ) }
|
|
107
102
|
showTooltip={ showTooltip }
|
|
108
103
|
>
|
|
109
104
|
{ buttonIcon }
|
|
@@ -99,8 +99,13 @@ function HeaderToolbar( {
|
|
|
99
99
|
? wasNoContentSelected.current
|
|
100
100
|
: noContentSelected;
|
|
101
101
|
|
|
102
|
+
/* translators: accessibility text for the editor toolbar */
|
|
103
|
+
const toolbarAriaLabel = __( 'Document tools' );
|
|
104
|
+
|
|
102
105
|
return (
|
|
103
106
|
<View
|
|
107
|
+
testID={ toolbarAriaLabel }
|
|
108
|
+
accessibilityLabel={ toolbarAriaLabel }
|
|
104
109
|
style={ [
|
|
105
110
|
getStylesFromColorScheme(
|
|
106
111
|
styles[ 'header-toolbar__container' ],
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -83,11 +78,10 @@ export function PostPublishButtonOrToggle( {
|
|
|
83
78
|
|
|
84
79
|
export default compose(
|
|
85
80
|
withSelect( ( select ) => ( {
|
|
86
|
-
hasPublishAction:
|
|
87
|
-
select( editorStore ).getCurrentPost()
|
|
88
|
-
|
|
89
|
-
false
|
|
90
|
-
),
|
|
81
|
+
hasPublishAction:
|
|
82
|
+
select( editorStore ).getCurrentPost()?._links?.[
|
|
83
|
+
'wp:action-publish'
|
|
84
|
+
] ?? false,
|
|
91
85
|
isBeingScheduled: select( editorStore ).isEditedPostBeingScheduled(),
|
|
92
86
|
isPending: select( editorStore ).isCurrentPostPending(),
|
|
93
87
|
isPublished: select( editorStore ).isCurrentPostPublished(),
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { mapValues } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -61,14 +56,15 @@ export default function EditTemplateTitle() {
|
|
|
61
56
|
setForceEmpty( false );
|
|
62
57
|
|
|
63
58
|
const settings = getEditorSettings();
|
|
64
|
-
const newAvailableTemplates =
|
|
65
|
-
settings.availableTemplates
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
59
|
+
const newAvailableTemplates = Object.fromEntries(
|
|
60
|
+
Object.entries( settings.availableTemplates ?? {} ).map(
|
|
61
|
+
( [ id, existingTitle ] ) => {
|
|
62
|
+
if ( id !== template.slug ) {
|
|
63
|
+
return existingTitle;
|
|
64
|
+
}
|
|
65
|
+
return newTitle;
|
|
69
66
|
}
|
|
70
|
-
|
|
71
|
-
}
|
|
67
|
+
)
|
|
72
68
|
);
|
|
73
69
|
updateEditorSettings( {
|
|
74
70
|
...settings,
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { isEmpty } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -15,7 +10,7 @@ const { Fill: ToolsMoreMenuGroup, Slot } =
|
|
|
15
10
|
ToolsMoreMenuGroup.Slot = ( { fillProps } ) => (
|
|
16
11
|
<Slot fillProps={ fillProps }>
|
|
17
12
|
{ ( fills ) =>
|
|
18
|
-
|
|
13
|
+
fills.length > 0 && (
|
|
19
14
|
<MenuGroup label={ __( 'Tools' ) }>{ fills }</MenuGroup>
|
|
20
15
|
)
|
|
21
16
|
}
|
|
@@ -70,15 +70,18 @@ function KeyboardShortcuts() {
|
|
|
70
70
|
if ( blockName !== 'core/paragraph' && blockName !== 'core/heading' ) {
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
|
-
const
|
|
74
|
-
const
|
|
75
|
-
|
|
73
|
+
const attributes = getBlockAttributes( currentClientId );
|
|
74
|
+
const textAlign =
|
|
75
|
+
blockName === 'core/paragraph' ? 'align' : 'textAlign';
|
|
76
|
+
const destinationTextAlign =
|
|
77
|
+
destinationBlockName === 'core/paragraph' ? 'align' : 'textAlign';
|
|
78
|
+
|
|
76
79
|
replaceBlocks(
|
|
77
80
|
currentClientId,
|
|
78
81
|
createBlock( destinationBlockName, {
|
|
79
82
|
level,
|
|
80
|
-
content:
|
|
81
|
-
|
|
83
|
+
content: attributes.content,
|
|
84
|
+
...{ [ destinationTextAlign ]: attributes[ textAlign ] },
|
|
82
85
|
} )
|
|
83
86
|
);
|
|
84
87
|
};
|
|
@@ -181,7 +184,7 @@ function KeyboardShortcuts() {
|
|
|
181
184
|
} );
|
|
182
185
|
|
|
183
186
|
registerShortcut( {
|
|
184
|
-
name: `core/
|
|
187
|
+
name: `core/edit-post/transform-heading-to-paragraph`,
|
|
185
188
|
category: 'block-library',
|
|
186
189
|
description: __( 'Transform heading to paragraph.' ),
|
|
187
190
|
keyCombination: {
|
|
@@ -192,7 +195,7 @@ function KeyboardShortcuts() {
|
|
|
192
195
|
|
|
193
196
|
[ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {
|
|
194
197
|
registerShortcut( {
|
|
195
|
-
name: `core/
|
|
198
|
+
name: `core/edit-post/transform-paragraph-to-heading-${ level }`,
|
|
196
199
|
category: 'block-library',
|
|
197
200
|
description: __( 'Transform paragraph to heading.' ),
|
|
198
201
|
keyCombination: {
|
|
@@ -257,9 +260,8 @@ function KeyboardShortcuts() {
|
|
|
257
260
|
}
|
|
258
261
|
} );
|
|
259
262
|
|
|
260
|
-
useShortcut(
|
|
261
|
-
|
|
262
|
-
( event ) => handleTextLevelShortcut( event, 0 )
|
|
263
|
+
useShortcut( 'core/edit-post/transform-heading-to-paragraph', ( event ) =>
|
|
264
|
+
handleTextLevelShortcut( event, 0 )
|
|
263
265
|
);
|
|
264
266
|
|
|
265
267
|
[ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {
|
|
@@ -267,7 +269,7 @@ function KeyboardShortcuts() {
|
|
|
267
269
|
//the hook will execute the same way every time
|
|
268
270
|
//eslint-disable-next-line react-hooks/rules-of-hooks
|
|
269
271
|
useShortcut(
|
|
270
|
-
`core/
|
|
272
|
+
`core/edit-post/transform-paragraph-to-heading-${ level }`,
|
|
271
273
|
( event ) => handleTextLevelShortcut( event, level )
|
|
272
274
|
);
|
|
273
275
|
} );
|
|
@@ -83,7 +83,7 @@ function Layout( { styles } ) {
|
|
|
83
83
|
isInserterOpened,
|
|
84
84
|
isListViewOpened,
|
|
85
85
|
showIconLabels,
|
|
86
|
-
|
|
86
|
+
isDistractionFree,
|
|
87
87
|
showBlockBreadcrumbs,
|
|
88
88
|
isTemplateMode,
|
|
89
89
|
documentLabel,
|
|
@@ -116,7 +116,7 @@ function Layout( { styles } ) {
|
|
|
116
116
|
).getAllShortcutKeyCombinations( 'core/edit-post/next-region' ),
|
|
117
117
|
showIconLabels:
|
|
118
118
|
select( editPostStore ).isFeatureActive( 'showIconLabels' ),
|
|
119
|
-
|
|
119
|
+
isDistractionFree:
|
|
120
120
|
select( editPostStore ).isFeatureActive( 'distractionFree' ),
|
|
121
121
|
showBlockBreadcrumbs: select( editPostStore ).isFeatureActive(
|
|
122
122
|
'showBlockBreadcrumbs'
|
|
@@ -126,15 +126,6 @@ function Layout( { styles } ) {
|
|
|
126
126
|
};
|
|
127
127
|
}, [] );
|
|
128
128
|
|
|
129
|
-
const isDistractionFree = isDistractionFreeMode && isLargeViewport;
|
|
130
|
-
|
|
131
|
-
const className = classnames( 'edit-post-layout', 'is-mode-' + mode, {
|
|
132
|
-
'is-sidebar-opened': sidebarIsOpened,
|
|
133
|
-
'has-fixed-toolbar': hasFixedToolbar,
|
|
134
|
-
'has-metaboxes': hasActiveMetaboxes,
|
|
135
|
-
'show-icon-labels': showIconLabels,
|
|
136
|
-
'is-distraction-free': isDistractionFree,
|
|
137
|
-
} );
|
|
138
129
|
const openSidebarPanel = () =>
|
|
139
130
|
openGeneralSidebar(
|
|
140
131
|
hasBlockSelected ? 'edit-post/block' : 'edit-post/document'
|
|
@@ -166,6 +157,15 @@ function Layout( { styles } ) {
|
|
|
166
157
|
[ entitiesSavedStatesCallback ]
|
|
167
158
|
);
|
|
168
159
|
|
|
160
|
+
const className = classnames( 'edit-post-layout', 'is-mode-' + mode, {
|
|
161
|
+
'is-sidebar-opened': sidebarIsOpened,
|
|
162
|
+
'has-fixed-toolbar': hasFixedToolbar,
|
|
163
|
+
'has-metaboxes': hasActiveMetaboxes,
|
|
164
|
+
'show-icon-labels': showIconLabels,
|
|
165
|
+
'is-distraction-free': isDistractionFree && isLargeViewport,
|
|
166
|
+
'is-entity-save-view-open': !! entitiesSavedStatesCallback,
|
|
167
|
+
} );
|
|
168
|
+
|
|
169
169
|
const secondarySidebarLabel = isListViewOpened
|
|
170
170
|
? __( 'Document Overview' )
|
|
171
171
|
: __( 'Block Library' );
|
|
@@ -204,7 +204,7 @@ function Layout( { styles } ) {
|
|
|
204
204
|
<EditorKeyboardShortcutsRegister />
|
|
205
205
|
<SettingsSidebar />
|
|
206
206
|
<InterfaceSkeleton
|
|
207
|
-
isDistractionFree={ isDistractionFree }
|
|
207
|
+
isDistractionFree={ isDistractionFree && isLargeViewport }
|
|
208
208
|
className={ className }
|
|
209
209
|
labels={ {
|
|
210
210
|
...interfaceLabels,
|
|
@@ -250,7 +250,7 @@ function Layout( { styles } ) {
|
|
|
250
250
|
{ isRichEditingEnabled && mode === 'visual' && (
|
|
251
251
|
<VisualEditor styles={ styles } />
|
|
252
252
|
) }
|
|
253
|
-
{ ! isTemplateMode && (
|
|
253
|
+
{ ! isDistractionFree && ! isTemplateMode && (
|
|
254
254
|
<div className="edit-post-layout__metaboxes">
|
|
255
255
|
<MetaBoxes location="normal" />
|
|
256
256
|
<MetaBoxes location="advanced" />
|
|
@@ -263,8 +263,8 @@ function Layout( { styles } ) {
|
|
|
263
263
|
}
|
|
264
264
|
footer={
|
|
265
265
|
! isDistractionFree &&
|
|
266
|
-
showBlockBreadcrumbs &&
|
|
267
266
|
! isMobileViewport &&
|
|
267
|
+
showBlockBreadcrumbs &&
|
|
268
268
|
isRichEditingEnabled &&
|
|
269
269
|
mode === 'visual' && (
|
|
270
270
|
<div className="edit-post-layout__footer">
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -213,10 +208,7 @@ export default function EditPostPreferencesModal() {
|
|
|
213
208
|
<PostTaxonomies
|
|
214
209
|
taxonomyWrapper={ ( content, taxonomy ) => (
|
|
215
210
|
<EnablePanelOption
|
|
216
|
-
label={
|
|
217
|
-
'labels',
|
|
218
|
-
'menu_name',
|
|
219
|
-
] ) }
|
|
211
|
+
label={ taxonomy.labels.menu_name }
|
|
220
212
|
panelName={ `taxonomy-panel-${ taxonomy.slug }` }
|
|
221
213
|
/>
|
|
222
214
|
) }
|
|
@@ -733,7 +733,7 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
|
|
|
733
733
|
class="emotion-2 components-navigator-screen"
|
|
734
734
|
data-wp-c16t="true"
|
|
735
735
|
data-wp-component="NavigatorScreen"
|
|
736
|
-
style="opacity:
|
|
736
|
+
style="opacity: 1; transform: none;"
|
|
737
737
|
>
|
|
738
738
|
<div
|
|
739
739
|
class="components-surface components-card emotion-3 emotion-1"
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -35,11 +30,9 @@ function FeaturedImage( { isEnabled, isOpened, postType, onTogglePanel } ) {
|
|
|
35
30
|
return (
|
|
36
31
|
<PostFeaturedImageCheck>
|
|
37
32
|
<PanelBody
|
|
38
|
-
title={
|
|
39
|
-
postType
|
|
40
|
-
|
|
41
|
-
__( 'Featured image' )
|
|
42
|
-
) }
|
|
33
|
+
title={
|
|
34
|
+
postType?.labels?.featured_image ?? __( 'Featured image' )
|
|
35
|
+
}
|
|
43
36
|
opened={ isOpened }
|
|
44
37
|
onToggle={ onTogglePanel }
|
|
45
38
|
>
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -52,11 +47,9 @@ export function PageAttributes() {
|
|
|
52
47
|
return (
|
|
53
48
|
<PageAttributesCheck>
|
|
54
49
|
<PanelBody
|
|
55
|
-
title={
|
|
56
|
-
postType
|
|
57
|
-
|
|
58
|
-
__( 'Page attributes' )
|
|
59
|
-
) }
|
|
50
|
+
title={
|
|
51
|
+
postType?.labels?.attributes ?? __( 'Page attributes' )
|
|
52
|
+
}
|
|
60
53
|
opened={ isOpened }
|
|
61
54
|
onToggle={ onTogglePanel }
|
|
62
55
|
>
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -26,7 +21,7 @@ function TaxonomyPanel( {
|
|
|
26
21
|
return null;
|
|
27
22
|
}
|
|
28
23
|
|
|
29
|
-
const taxonomyMenuName =
|
|
24
|
+
const taxonomyMenuName = taxonomy?.labels?.menu_name;
|
|
30
25
|
if ( ! taxonomyMenuName ) {
|
|
31
26
|
return null;
|
|
32
27
|
}
|
|
@@ -44,7 +39,7 @@ function TaxonomyPanel( {
|
|
|
44
39
|
|
|
45
40
|
export default compose(
|
|
46
41
|
withSelect( ( select, ownProps ) => {
|
|
47
|
-
const slug =
|
|
42
|
+
const slug = ownProps.taxonomy?.slug;
|
|
48
43
|
const panelName = slug ? `taxonomy-panel-${ slug }` : '';
|
|
49
44
|
return {
|
|
50
45
|
panelName,
|
|
@@ -116,7 +116,7 @@ export default function PostTemplateCreateModal( { onClose } ) {
|
|
|
116
116
|
placeholder={ DEFAULT_TITLE }
|
|
117
117
|
disabled={ isBusy }
|
|
118
118
|
help={ __(
|
|
119
|
-
'Describe the template, e.g. "Post with sidebar".
|
|
119
|
+
'Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.'
|
|
120
120
|
) }
|
|
121
121
|
/>
|
|
122
122
|
<HStack justify="right">
|
|
@@ -44,6 +44,8 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
44
44
|
*/
|
|
45
45
|
import { store as editPostStore } from '../../store';
|
|
46
46
|
|
|
47
|
+
const isGutenbergPlugin = process.env.IS_GUTENBERG_PLUGIN ? true : false;
|
|
48
|
+
|
|
47
49
|
function MaybeIframe( { children, contentRef, shouldIframe, styles, style } ) {
|
|
48
50
|
const ref = useMouseMoveTypingReset();
|
|
49
51
|
|
|
@@ -78,19 +80,20 @@ function MaybeIframe( { children, contentRef, shouldIframe, styles, style } ) {
|
|
|
78
80
|
|
|
79
81
|
/**
|
|
80
82
|
* Given an array of nested blocks, find the first Post Content
|
|
81
|
-
* block inside it, recursing through any nesting levels
|
|
83
|
+
* block inside it, recursing through any nesting levels,
|
|
84
|
+
* and return its attributes.
|
|
82
85
|
*
|
|
83
86
|
* @param {Array} blocks A list of blocks.
|
|
84
87
|
*
|
|
85
88
|
* @return {Object | undefined} The Post Content block.
|
|
86
89
|
*/
|
|
87
|
-
function
|
|
90
|
+
function getPostContentAttributes( blocks ) {
|
|
88
91
|
for ( let i = 0; i < blocks.length; i++ ) {
|
|
89
92
|
if ( blocks[ i ].name === 'core/post-content' ) {
|
|
90
|
-
return blocks[ i ];
|
|
93
|
+
return blocks[ i ].attributes;
|
|
91
94
|
}
|
|
92
95
|
if ( blocks[ i ].innerBlocks.length ) {
|
|
93
|
-
const nestedPostContent =
|
|
96
|
+
const nestedPostContent = getPostContentAttributes(
|
|
94
97
|
blocks[ i ].innerBlocks
|
|
95
98
|
);
|
|
96
99
|
|
|
@@ -106,6 +109,7 @@ export default function VisualEditor( { styles } ) {
|
|
|
106
109
|
deviceType,
|
|
107
110
|
isWelcomeGuideVisible,
|
|
108
111
|
isTemplateMode,
|
|
112
|
+
postContentAttributes,
|
|
109
113
|
editedPostTemplate = {},
|
|
110
114
|
wrapperBlockName,
|
|
111
115
|
wrapperUniqueId,
|
|
@@ -114,8 +118,8 @@ export default function VisualEditor( { styles } ) {
|
|
|
114
118
|
const {
|
|
115
119
|
isFeatureActive,
|
|
116
120
|
isEditingTemplate,
|
|
117
|
-
__experimentalGetPreviewDeviceType,
|
|
118
121
|
getEditedPostTemplate,
|
|
122
|
+
__experimentalGetPreviewDeviceType,
|
|
119
123
|
} = select( editPostStore );
|
|
120
124
|
const { getCurrentPostId, getCurrentPostType, getEditorSettings } =
|
|
121
125
|
select( editorStore );
|
|
@@ -139,8 +143,9 @@ export default function VisualEditor( { styles } ) {
|
|
|
139
143
|
deviceType: __experimentalGetPreviewDeviceType(),
|
|
140
144
|
isWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),
|
|
141
145
|
isTemplateMode: _isTemplateMode,
|
|
146
|
+
postContentAttributes: getEditorSettings().postContentAttributes,
|
|
142
147
|
// Post template fetch returns a 404 on classic themes, which
|
|
143
|
-
// messes with e2e tests, so
|
|
148
|
+
// messes with e2e tests, so check it's a block theme first.
|
|
144
149
|
editedPostTemplate:
|
|
145
150
|
supportsTemplateMode && canEditTemplate
|
|
146
151
|
? getEditedPostTemplate()
|
|
@@ -228,10 +233,13 @@ export default function VisualEditor( { styles } ) {
|
|
|
228
233
|
return { type: 'default' };
|
|
229
234
|
}, [ isTemplateMode, themeSupportsLayout, globalLayoutSettings ] );
|
|
230
235
|
|
|
231
|
-
const
|
|
236
|
+
const newestPostContentAttributes = useMemo( () => {
|
|
237
|
+
if ( ! editedPostTemplate?.content && ! editedPostTemplate?.blocks ) {
|
|
238
|
+
return postContentAttributes;
|
|
239
|
+
}
|
|
232
240
|
// When in template editing mode, we can access the blocks directly.
|
|
233
241
|
if ( editedPostTemplate?.blocks ) {
|
|
234
|
-
return
|
|
242
|
+
return getPostContentAttributes( editedPostTemplate?.blocks );
|
|
235
243
|
}
|
|
236
244
|
// If there are no blocks, we have to parse the content string.
|
|
237
245
|
// Best double-check it's a string otherwise the parse function gets unhappy.
|
|
@@ -240,10 +248,19 @@ export default function VisualEditor( { styles } ) {
|
|
|
240
248
|
? editedPostTemplate?.content
|
|
241
249
|
: '';
|
|
242
250
|
|
|
243
|
-
return
|
|
244
|
-
}, [
|
|
251
|
+
return getPostContentAttributes( parse( parseableContent ) ) || {};
|
|
252
|
+
}, [
|
|
253
|
+
editedPostTemplate?.content,
|
|
254
|
+
editedPostTemplate?.blocks,
|
|
255
|
+
postContentAttributes,
|
|
256
|
+
] );
|
|
257
|
+
|
|
258
|
+
const layout = newestPostContentAttributes?.layout || {};
|
|
245
259
|
|
|
246
|
-
const postContentLayoutClasses = useLayoutClasses(
|
|
260
|
+
const postContentLayoutClasses = useLayoutClasses(
|
|
261
|
+
newestPostContentAttributes,
|
|
262
|
+
'core/post-content'
|
|
263
|
+
);
|
|
247
264
|
|
|
248
265
|
const blockListLayoutClass = classnames(
|
|
249
266
|
{
|
|
@@ -253,12 +270,11 @@ export default function VisualEditor( { styles } ) {
|
|
|
253
270
|
);
|
|
254
271
|
|
|
255
272
|
const postContentLayoutStyles = useLayoutStyles(
|
|
256
|
-
|
|
273
|
+
newestPostContentAttributes,
|
|
274
|
+
'core/post-content',
|
|
257
275
|
'.block-editor-block-list__layout.is-root-container'
|
|
258
276
|
);
|
|
259
277
|
|
|
260
|
-
const layout = postContentBlock?.attributes?.layout || {};
|
|
261
|
-
|
|
262
278
|
// Update type for blocks using legacy layouts.
|
|
263
279
|
const postContentLayout = useMemo( () => {
|
|
264
280
|
return layout &&
|
|
@@ -278,7 +294,7 @@ export default function VisualEditor( { styles } ) {
|
|
|
278
294
|
|
|
279
295
|
// If there is a Post Content block we use its layout for the block list;
|
|
280
296
|
// if not, this must be a classic theme, in which case we use the fallback layout.
|
|
281
|
-
const blockListLayout =
|
|
297
|
+
const blockListLayout = postContentAttributes
|
|
282
298
|
? postContentLayout
|
|
283
299
|
: fallbackLayout;
|
|
284
300
|
|
|
@@ -316,7 +332,7 @@ export default function VisualEditor( { styles } ) {
|
|
|
316
332
|
<motion.div
|
|
317
333
|
className="edit-post-visual-editor__content-area"
|
|
318
334
|
animate={ {
|
|
319
|
-
padding: isTemplateMode ? '48px 48px 0' :
|
|
335
|
+
padding: isTemplateMode ? '48px 48px 0' : 0,
|
|
320
336
|
} }
|
|
321
337
|
ref={ blockSelectionClearerRef }
|
|
322
338
|
>
|
|
@@ -339,7 +355,9 @@ export default function VisualEditor( { styles } ) {
|
|
|
339
355
|
>
|
|
340
356
|
<MaybeIframe
|
|
341
357
|
shouldIframe={
|
|
342
|
-
(
|
|
358
|
+
( isGutenbergPlugin &&
|
|
359
|
+
isBlockBasedTheme &&
|
|
360
|
+
! hasMetaBoxes ) ||
|
|
343
361
|
isTemplateMode ||
|
|
344
362
|
deviceType === 'Tablet' ||
|
|
345
363
|
deviceType === 'Mobile'
|
|
@@ -372,15 +390,11 @@ export default function VisualEditor( { styles } ) {
|
|
|
372
390
|
{ ! isTemplateMode && (
|
|
373
391
|
<div
|
|
374
392
|
className={ classnames(
|
|
375
|
-
// This wrapper div should have the same
|
|
376
|
-
// classes as the block list beneath.
|
|
377
|
-
'is-root-container',
|
|
378
|
-
'block-editor-block-list__layout',
|
|
379
393
|
'edit-post-visual-editor__post-title-wrapper',
|
|
380
394
|
{
|
|
381
395
|
'is-focus-mode': isFocusMode,
|
|
382
396
|
},
|
|
383
|
-
|
|
397
|
+
'is-layout-flow'
|
|
384
398
|
) }
|
|
385
399
|
contentEditable={ false }
|
|
386
400
|
>
|
|
@@ -110,7 +110,7 @@ export default function WelcomeGuideDefault() {
|
|
|
110
110
|
) }
|
|
111
111
|
<ExternalLink
|
|
112
112
|
href={ __(
|
|
113
|
-
'https://wordpress.org/
|
|
113
|
+
'https://wordpress.org/documentation/article/wordpress-block-editor/'
|
|
114
114
|
) }
|
|
115
115
|
>
|
|
116
116
|
{ __( "Here's a detailed guide." ) }
|
package/src/index.js
CHANGED
|
@@ -11,7 +11,10 @@ import { createRoot } from '@wordpress/element';
|
|
|
11
11
|
import { dispatch, select } from '@wordpress/data';
|
|
12
12
|
import { addFilter } from '@wordpress/hooks';
|
|
13
13
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
registerLegacyWidgetBlock,
|
|
16
|
+
registerWidgetGroupBlock,
|
|
17
|
+
} from '@wordpress/widgets';
|
|
15
18
|
|
|
16
19
|
/**
|
|
17
20
|
* Internal dependencies
|
|
@@ -68,6 +71,7 @@ export function initializeEditor(
|
|
|
68
71
|
|
|
69
72
|
registerCoreBlocks();
|
|
70
73
|
registerLegacyWidgetBlock( { inserter: false } );
|
|
74
|
+
registerWidgetGroupBlock( { inserter: false } );
|
|
71
75
|
if ( process.env.IS_GUTENBERG_PLUGIN ) {
|
|
72
76
|
__experimentalRegisterExperimentalCoreBlocks( {
|
|
73
77
|
enableFSEBlocks: settings.__unstableEnableFullSiteEditingBlocks,
|