@wordpress/edit-post 6.19.0 → 7.1.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 +8 -0
- package/build/components/block-manager/index.js +3 -10
- package/build/components/block-manager/index.js.map +1 -1
- package/build/components/header/index.js +2 -2
- package/build/components/header/index.js.map +1 -1
- package/build/components/layout/index.js +2 -1
- package/build/components/layout/index.js.map +1 -1
- package/build/components/preferences-modal/meta-boxes-section.js +1 -1
- package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-outline.js +4 -4
- package/build/components/secondary-sidebar/list-view-outline.js.map +1 -1
- package/build/components/sidebar/post-status/index.js +1 -1
- package/build/components/sidebar/post-status/index.js.map +1 -1
- package/build/components/sidebar/post-template/index.js +2 -4
- package/build/components/sidebar/post-template/index.js.map +1 -1
- package/build/components/sidebar/settings-sidebar/index.js +7 -7
- package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build/components/visual-editor/index.js +16 -10
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/editor.native.js +8 -2
- package/build/editor.native.js.map +1 -1
- package/build/hooks/validate-multiple-use/index.js +1 -7
- package/build/hooks/validate-multiple-use/index.js.map +1 -1
- package/build/index.js +5 -0
- package/build/index.js.map +1 -1
- package/build/plugins/index.js +3 -1
- package/build/plugins/index.js.map +1 -1
- package/build/plugins/navigation-list-view-menu-item.js +48 -0
- package/build/plugins/navigation-list-view-menu-item.js.map +1 -0
- package/build-module/components/block-manager/index.js +3 -9
- package/build-module/components/block-manager/index.js.map +1 -1
- package/build-module/components/header/index.js +2 -2
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/layout/index.js +2 -1
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/preferences-modal/meta-boxes-section.js +2 -2
- package/build-module/components/preferences-modal/meta-boxes-section.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-outline.js +4 -4
- package/build-module/components/secondary-sidebar/list-view-outline.js.map +1 -1
- package/build-module/components/sidebar/post-status/index.js +1 -1
- package/build-module/components/sidebar/post-status/index.js.map +1 -1
- package/build-module/components/sidebar/post-template/index.js +2 -4
- package/build-module/components/sidebar/post-template/index.js.map +1 -1
- package/build-module/components/sidebar/settings-sidebar/index.js +5 -5
- package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build-module/components/visual-editor/index.js +16 -10
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/editor.native.js +7 -2
- package/build-module/editor.native.js.map +1 -1
- package/build-module/hooks/validate-multiple-use/index.js +1 -6
- package/build-module/hooks/validate-multiple-use/index.js.map +1 -1
- package/build-module/index.js +4 -0
- package/build-module/index.js.map +1 -1
- package/build-module/plugins/index.js +2 -1
- package/build-module/plugins/index.js.map +1 -1
- package/build-module/plugins/navigation-list-view-menu-item.js +40 -0
- package/build-module/plugins/navigation-list-view-menu-item.js.map +1 -0
- package/build-style/classic-rtl.css +17 -3
- package/build-style/classic.css +17 -3
- package/build-style/style-rtl.css +70 -46
- package/build-style/style.css +70 -46
- package/package.json +30 -29
- package/src/components/block-manager/index.js +6 -10
- package/src/components/editor-initialization/test/listener-hooks.js +1 -0
- package/src/components/header/fullscreen-mode-close/style.scss +1 -1
- package/src/components/header/index.js +3 -3
- package/src/components/layout/index.js +3 -1
- package/src/components/preferences-modal/meta-boxes-section.js +2 -3
- package/src/components/preferences-modal/options/test/__snapshots__/enable-custom-fields.js.snap +56 -4
- package/src/components/preferences-modal/options/test/enable-custom-fields.js +2 -0
- package/src/components/preferences-modal/test/__snapshots__/index.js.snap +39 -14
- package/src/components/preferences-modal/test/__snapshots__/meta-boxes-section.js.snap +51 -6
- package/src/components/secondary-sidebar/list-view-outline.js +12 -12
- package/src/components/secondary-sidebar/style.scss +11 -12
- package/src/components/sidebar/post-schedule/style.scss +2 -1
- package/src/components/sidebar/post-status/index.js +1 -1
- package/src/components/sidebar/post-template/index.js +8 -3
- package/src/components/sidebar/post-template/style.scss +2 -0
- package/src/components/sidebar/post-url/style.scss +3 -0
- package/src/components/sidebar/post-visibility/style.scss +2 -0
- package/src/components/sidebar/settings-header/style.scss +47 -34
- package/src/components/sidebar/settings-sidebar/index.js +5 -5
- package/src/components/visual-editor/index.js +26 -3
- package/src/components/visual-editor/test/index.native.js +20 -9
- package/src/editor.native.js +14 -11
- package/src/hooks/validate-multiple-use/index.js +1 -7
- package/src/index.js +2 -0
- package/src/plugins/index.js +2 -0
- package/src/plugins/navigation-list-view-menu-item.js +56 -0
|
@@ -5,10 +5,12 @@ import {
|
|
|
5
5
|
BlockInspector,
|
|
6
6
|
store as blockEditorStore,
|
|
7
7
|
} from '@wordpress/block-editor';
|
|
8
|
-
import {
|
|
8
|
+
import { useSelect } from '@wordpress/data';
|
|
9
9
|
import { Platform } from '@wordpress/element';
|
|
10
|
-
import {
|
|
10
|
+
import { isRTL, __ } from '@wordpress/i18n';
|
|
11
|
+
import { drawerLeft, drawerRight } from '@wordpress/icons';
|
|
11
12
|
import { store as interfaceStore } from '@wordpress/interface';
|
|
13
|
+
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* Internal dependencies
|
|
@@ -25,8 +27,6 @@ import MetaBoxes from '../../meta-boxes';
|
|
|
25
27
|
import PluginDocumentSettingPanel from '../plugin-document-setting-panel';
|
|
26
28
|
import PluginSidebarEditPost from '../plugin-sidebar';
|
|
27
29
|
import TemplateSummary from '../template-summary';
|
|
28
|
-
import { __ } from '@wordpress/i18n';
|
|
29
|
-
import { useSelect } from '@wordpress/data';
|
|
30
30
|
import { store as editPostStore } from '../../../store';
|
|
31
31
|
|
|
32
32
|
const SIDEBAR_ACTIVE_BY_DEFAULT = Platform.select( {
|
|
@@ -78,7 +78,7 @@ const SettingsSidebar = () => {
|
|
|
78
78
|
/* translators: button label text should, if possible, be under 16 characters. */
|
|
79
79
|
title={ __( 'Settings' ) }
|
|
80
80
|
toggleShortcut={ keyboardShortcut }
|
|
81
|
-
icon={
|
|
81
|
+
icon={ isRTL() ? drawerLeft : drawerRight }
|
|
82
82
|
isActiveByDefault={ SIDEBAR_ACTIVE_BY_DEFAULT }
|
|
83
83
|
>
|
|
84
84
|
{ ! isTemplateMode && sidebarName === 'edit-post/document' && (
|
|
@@ -119,6 +119,7 @@ export default function VisualEditor( { styles } ) {
|
|
|
119
119
|
editedPostTemplate = {},
|
|
120
120
|
wrapperBlockName,
|
|
121
121
|
wrapperUniqueId,
|
|
122
|
+
isBlockBasedTheme,
|
|
122
123
|
} = useSelect( ( select ) => {
|
|
123
124
|
const {
|
|
124
125
|
isFeatureActive,
|
|
@@ -137,7 +138,8 @@ export default function VisualEditor( { styles } ) {
|
|
|
137
138
|
_wrapperBlockName = 'core/post-content';
|
|
138
139
|
}
|
|
139
140
|
|
|
140
|
-
const
|
|
141
|
+
const editorSettings = getEditorSettings();
|
|
142
|
+
const supportsTemplateMode = editorSettings.supportsTemplateMode;
|
|
141
143
|
const canEditTemplate = select( coreStore ).canUser(
|
|
142
144
|
'create',
|
|
143
145
|
'templates'
|
|
@@ -155,6 +157,7 @@ export default function VisualEditor( { styles } ) {
|
|
|
155
157
|
: undefined,
|
|
156
158
|
wrapperBlockName: _wrapperBlockName,
|
|
157
159
|
wrapperUniqueId: getCurrentPostId(),
|
|
160
|
+
isBlockBasedTheme: editorSettings.__unstableIsBlockBasedTheme,
|
|
158
161
|
};
|
|
159
162
|
}, [] );
|
|
160
163
|
const { isCleanNewPost } = useSelect( editorStore );
|
|
@@ -302,6 +305,21 @@ export default function VisualEditor( { styles } ) {
|
|
|
302
305
|
titleRef?.current?.focus();
|
|
303
306
|
}, [ isWelcomeGuideVisible, isCleanNewPost ] );
|
|
304
307
|
|
|
308
|
+
styles = useMemo(
|
|
309
|
+
() => [
|
|
310
|
+
...styles,
|
|
311
|
+
{
|
|
312
|
+
// We should move this in to future to the body.
|
|
313
|
+
css:
|
|
314
|
+
`.edit-post-visual-editor__post-title-wrapper{margin-top:4rem}` +
|
|
315
|
+
( paddingBottom
|
|
316
|
+
? `body{padding-bottom:${ paddingBottom }}`
|
|
317
|
+
: '' ),
|
|
318
|
+
},
|
|
319
|
+
],
|
|
320
|
+
[ styles ]
|
|
321
|
+
);
|
|
322
|
+
|
|
305
323
|
return (
|
|
306
324
|
<BlockTools
|
|
307
325
|
__unstableContentRef={ ref }
|
|
@@ -336,6 +354,7 @@ export default function VisualEditor( { styles } ) {
|
|
|
336
354
|
>
|
|
337
355
|
<MaybeIframe
|
|
338
356
|
shouldIframe={
|
|
357
|
+
( isBlockBasedTheme && ! hasMetaBoxes ) ||
|
|
339
358
|
isTemplateMode ||
|
|
340
359
|
deviceType === 'Tablet' ||
|
|
341
360
|
deviceType === 'Mobile'
|
|
@@ -343,7 +362,6 @@ export default function VisualEditor( { styles } ) {
|
|
|
343
362
|
contentRef={ contentRef }
|
|
344
363
|
styles={ styles }
|
|
345
364
|
assets={ assets }
|
|
346
|
-
style={ { paddingBottom } }
|
|
347
365
|
>
|
|
348
366
|
{ themeSupportsLayout &&
|
|
349
367
|
! themeHasDisabledLayoutStyles &&
|
|
@@ -370,10 +388,15 @@ export default function VisualEditor( { styles } ) {
|
|
|
370
388
|
{ ! isTemplateMode && (
|
|
371
389
|
<div
|
|
372
390
|
className={ classnames(
|
|
391
|
+
// This wrapper div should have the same
|
|
392
|
+
// classes as the block list beneath.
|
|
393
|
+
'is-root-container',
|
|
394
|
+
'block-editor-block-list__layout',
|
|
373
395
|
'edit-post-visual-editor__post-title-wrapper',
|
|
374
396
|
{
|
|
375
397
|
'is-focus-mode': isFocusMode,
|
|
376
|
-
}
|
|
398
|
+
},
|
|
399
|
+
blockListLayoutClass
|
|
377
400
|
) }
|
|
378
401
|
contentEditable={ false }
|
|
379
402
|
>
|
|
@@ -38,7 +38,9 @@ describe( 'when title is focused', () => {
|
|
|
38
38
|
} );
|
|
39
39
|
|
|
40
40
|
// Focus first block
|
|
41
|
-
fireEvent.press(
|
|
41
|
+
fireEvent.press(
|
|
42
|
+
screen.getAllByLabelText( /Paragraph Block. Row 1/ )[ 0 ]
|
|
43
|
+
);
|
|
42
44
|
|
|
43
45
|
// Focus title
|
|
44
46
|
fireEvent(
|
|
@@ -50,12 +52,15 @@ describe( 'when title is focused', () => {
|
|
|
50
52
|
fireEvent.press( screen.getByLabelText( 'Add block' ) );
|
|
51
53
|
fireEvent.press( screen.getByText( 'Heading' ) );
|
|
52
54
|
|
|
53
|
-
expect( screen.getByLabelText( /Heading Block. Row 1/ ) ).toBeDefined();
|
|
54
55
|
expect(
|
|
55
|
-
screen.
|
|
56
|
+
screen.getAllByLabelText( /Heading Block. Row 1/ )[ 0 ]
|
|
57
|
+
).toBeDefined();
|
|
58
|
+
expect(
|
|
59
|
+
screen.getAllByLabelText( /Paragraph Block. Row 2/ )[ 0 ]
|
|
56
60
|
).toBeDefined();
|
|
61
|
+
|
|
57
62
|
expect(
|
|
58
|
-
screen.
|
|
63
|
+
screen.getAllByLabelText( /Paragraph Block. Row 3/ )[ 0 ]
|
|
59
64
|
).toBeDefined();
|
|
60
65
|
} );
|
|
61
66
|
} );
|
|
@@ -67,7 +72,9 @@ describe( 'when title is no longer focused', () => {
|
|
|
67
72
|
} );
|
|
68
73
|
|
|
69
74
|
// Focus first block
|
|
70
|
-
fireEvent.press(
|
|
75
|
+
fireEvent.press(
|
|
76
|
+
screen.getAllByLabelText( /Paragraph Block. Row 1/ )[ 0 ]
|
|
77
|
+
);
|
|
71
78
|
|
|
72
79
|
// Focus title
|
|
73
80
|
fireEvent(
|
|
@@ -76,18 +83,22 @@ describe( 'when title is no longer focused', () => {
|
|
|
76
83
|
);
|
|
77
84
|
|
|
78
85
|
// Focus last block
|
|
79
|
-
fireEvent.press(
|
|
86
|
+
fireEvent.press(
|
|
87
|
+
screen.getAllByLabelText( /Paragraph Block. Row 2/ )[ 0 ]
|
|
88
|
+
);
|
|
80
89
|
|
|
81
90
|
// Add new Heading block
|
|
82
91
|
fireEvent.press( screen.getByLabelText( 'Add block' ) );
|
|
83
92
|
fireEvent.press( screen.getByText( 'Heading' ) );
|
|
84
93
|
|
|
85
94
|
expect(
|
|
86
|
-
screen.
|
|
95
|
+
screen.getAllByLabelText( /Paragraph Block. Row 1/ )[ 0 ]
|
|
96
|
+
).toBeDefined();
|
|
97
|
+
expect(
|
|
98
|
+
screen.getAllByLabelText( /Paragraph Block. Row 2/ )[ 0 ]
|
|
87
99
|
).toBeDefined();
|
|
88
100
|
expect(
|
|
89
|
-
screen.
|
|
101
|
+
screen.getAllByLabelText( /Heading Block. Row 3/ )[ 0 ]
|
|
90
102
|
).toBeDefined();
|
|
91
|
-
expect( screen.getByLabelText( /Heading Block. Row 3/ ) ).toBeDefined();
|
|
92
103
|
} );
|
|
93
104
|
} );
|
package/src/editor.native.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import memize from 'memize';
|
|
5
5
|
import { map } from 'lodash';
|
|
6
6
|
import { I18nManager } from 'react-native';
|
|
7
|
+
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* WordPress dependencies
|
|
@@ -173,17 +174,19 @@ class Editor extends Component {
|
|
|
173
174
|
};
|
|
174
175
|
|
|
175
176
|
return (
|
|
176
|
-
<
|
|
177
|
-
<
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
177
|
+
<GestureHandlerRootView style={ { flex: 1 } }>
|
|
178
|
+
<SlotFillProvider>
|
|
179
|
+
<EditorProvider
|
|
180
|
+
settings={ editorSettings }
|
|
181
|
+
post={ normalizedPost }
|
|
182
|
+
initialEdits={ initialEdits }
|
|
183
|
+
useSubRegistry={ false }
|
|
184
|
+
{ ...props }
|
|
185
|
+
>
|
|
186
|
+
<Layout setTitleRef={ this.setTitleRef } />
|
|
187
|
+
</EditorProvider>
|
|
188
|
+
</SlotFillProvider>
|
|
189
|
+
</GestureHandlerRootView>
|
|
187
190
|
);
|
|
188
191
|
}
|
|
189
192
|
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { find } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -44,8 +39,7 @@ const enhance = compose(
|
|
|
44
39
|
// Otherwise, only pass `originalBlockClientId` if it refers to a different
|
|
45
40
|
// block from the current one.
|
|
46
41
|
const blocks = select( blockEditorStore ).getBlocks();
|
|
47
|
-
const firstOfSameType = find(
|
|
48
|
-
blocks,
|
|
42
|
+
const firstOfSameType = blocks.find(
|
|
49
43
|
( { name } ) => block.name === name
|
|
50
44
|
);
|
|
51
45
|
const isInvalid =
|
package/src/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import { render, unmountComponentAtNode } from '@wordpress/element';
|
|
|
10
10
|
import { dispatch, select } from '@wordpress/data';
|
|
11
11
|
import { addFilter } from '@wordpress/hooks';
|
|
12
12
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
13
|
+
import { registerLegacyWidgetBlock } from '@wordpress/widgets';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Internal dependencies
|
|
@@ -115,6 +116,7 @@ export function initializeEditor(
|
|
|
115
116
|
}
|
|
116
117
|
|
|
117
118
|
registerCoreBlocks();
|
|
119
|
+
registerLegacyWidgetBlock( { inserter: false } );
|
|
118
120
|
if ( process.env.IS_GUTENBERG_PLUGIN ) {
|
|
119
121
|
__experimentalRegisterExperimentalCoreBlocks( {
|
|
120
122
|
enableFSEBlocks: settings.__unstableEnableFullSiteEditingBlocks,
|
package/src/plugins/index.js
CHANGED
|
@@ -14,6 +14,7 @@ import CopyContentMenuItem from './copy-content-menu-item';
|
|
|
14
14
|
import KeyboardShortcutsHelpMenuItem from './keyboard-shortcuts-help-menu-item';
|
|
15
15
|
import ToolsMoreMenuGroup from '../components/header/tools-more-menu-group';
|
|
16
16
|
import WelcomeGuideMenuItem from './welcome-guide-menu-item';
|
|
17
|
+
import NavigationListViewMenuItem from './navigation-list-view-menu-item';
|
|
17
18
|
|
|
18
19
|
registerPlugin( 'edit-post', {
|
|
19
20
|
render() {
|
|
@@ -55,6 +56,7 @@ registerPlugin( 'edit-post', {
|
|
|
55
56
|
</>
|
|
56
57
|
) }
|
|
57
58
|
</ToolsMoreMenuGroup>
|
|
59
|
+
<NavigationListViewMenuItem />
|
|
58
60
|
</>
|
|
59
61
|
);
|
|
60
62
|
},
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
BlockEditorProvider,
|
|
6
|
+
__unstableBlockToolbarLastItem,
|
|
7
|
+
__unstableBlockNameContext,
|
|
8
|
+
} from '@wordpress/block-editor';
|
|
9
|
+
import { ToolbarButton, ToolbarGroup } from '@wordpress/components';
|
|
10
|
+
import { useDispatch } from '@wordpress/data';
|
|
11
|
+
import { Fragment } from '@wordpress/element';
|
|
12
|
+
import { __ } from '@wordpress/i18n';
|
|
13
|
+
import { listView } from '@wordpress/icons';
|
|
14
|
+
|
|
15
|
+
const NavMenuSidebarToggle = () => {
|
|
16
|
+
// eslint-disable-next-line @wordpress/data-no-store-string-literals
|
|
17
|
+
const { openGeneralSidebar } = useDispatch( 'core/edit-post' );
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<ToolbarGroup>
|
|
21
|
+
<ToolbarButton
|
|
22
|
+
className="components-toolbar__control"
|
|
23
|
+
label={ __( 'Open navigation list view' ) }
|
|
24
|
+
onClick={ () => openGeneralSidebar( 'edit-post/block' ) }
|
|
25
|
+
icon={ listView }
|
|
26
|
+
/>
|
|
27
|
+
</ToolbarGroup>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
let MaybeNavMenuSidebarToggle = Fragment;
|
|
32
|
+
|
|
33
|
+
const isOffCanvasNavigationEditorEnabled =
|
|
34
|
+
window?.__experimentalEnableOffCanvasNavigationEditor === true;
|
|
35
|
+
|
|
36
|
+
if ( isOffCanvasNavigationEditorEnabled ) {
|
|
37
|
+
MaybeNavMenuSidebarToggle = NavMenuSidebarToggle;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const NavigationEditMenuItem = () => {
|
|
41
|
+
return (
|
|
42
|
+
<BlockEditorProvider>
|
|
43
|
+
<__unstableBlockToolbarLastItem>
|
|
44
|
+
<__unstableBlockNameContext.Consumer>
|
|
45
|
+
{ ( blockName ) =>
|
|
46
|
+
blockName === 'core/navigation' && (
|
|
47
|
+
<MaybeNavMenuSidebarToggle />
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
</__unstableBlockNameContext.Consumer>
|
|
51
|
+
</__unstableBlockToolbarLastItem>
|
|
52
|
+
</BlockEditorProvider>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export default NavigationEditMenuItem;
|