@wordpress/edit-post 7.29.0 → 7.31.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/README.md +1 -58
- package/build/components/editor-initialization/index.js +3 -6
- package/build/components/editor-initialization/index.js.map +1 -1
- package/build/components/editor-initialization/listener-hooks.js +6 -10
- package/build/components/editor-initialization/listener-hooks.js.map +1 -1
- package/build/components/header/header-toolbar/index.native.js.map +1 -1
- package/build/components/header/index.js +18 -11
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/more-menu/index.js +10 -2
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/components/init-pattern-modal/index.js +99 -0
- package/build/components/init-pattern-modal/index.js.map +1 -0
- package/build/components/keyboard-shortcut-help-modal/config.js +6 -0
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/layout/index.js +2 -1
- package/build/components/layout/index.js.map +1 -1
- package/build/components/sidebar/post-status/index.js +3 -1
- package/build/components/sidebar/post-status/index.js.map +1 -1
- package/build/components/sidebar/settings-sidebar/index.js +1 -2
- package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build/editor.js +1 -15
- package/build/editor.js.map +1 -1
- package/build/editor.native.js +2 -2
- package/build/editor.native.js.map +1 -1
- package/build/index.js +1 -2
- package/build/index.js.map +1 -1
- package/build/store/selectors.js +1 -1
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/editor-initialization/index.js +3 -6
- package/build-module/components/editor-initialization/index.js.map +1 -1
- package/build-module/components/editor-initialization/listener-hooks.js +6 -10
- package/build-module/components/editor-initialization/listener-hooks.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
- package/build-module/components/header/index.js +19 -12
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/more-menu/index.js +12 -4
- package/build-module/components/header/more-menu/index.js.map +1 -1
- package/build-module/components/init-pattern-modal/index.js +93 -0
- package/build-module/components/init-pattern-modal/index.js.map +1 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js +6 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build-module/components/layout/index.js +3 -2
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/sidebar/post-status/index.js +4 -2
- package/build-module/components/sidebar/post-status/index.js.map +1 -1
- package/build-module/components/sidebar/settings-sidebar/index.js +2 -3
- package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build-module/editor.js +1 -15
- package/build-module/editor.js.map +1 -1
- package/build-module/editor.native.js +3 -3
- package/build-module/editor.native.js.map +1 -1
- package/build-module/index.js +2 -2
- package/build-module/index.js.map +1 -1
- package/build-module/store/selectors.js +1 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/classic-rtl.css +1 -0
- package/build-style/classic.css +1 -0
- package/build-style/style-rtl.css +5 -32
- package/build-style/style.css +5 -32
- package/package.json +32 -32
- package/src/components/editor-initialization/index.js +3 -4
- package/src/components/editor-initialization/listener-hooks.js +20 -22
- package/src/components/editor-initialization/test/listener-hooks.js +8 -8
- package/src/components/header/header-toolbar/index.native.js +1 -1
- package/src/components/header/index.js +31 -28
- package/src/components/header/more-menu/index.js +13 -9
- package/src/components/header/style.scss +4 -0
- package/src/components/header/test/index.js +4 -14
- package/src/components/init-pattern-modal/index.js +117 -0
- package/src/components/keyboard-shortcut-help-modal/config.js +4 -0
- package/src/components/layout/index.js +2 -2
- package/src/components/sidebar/plugin-post-publish-panel/test/index.js +1 -1
- package/src/components/sidebar/post-status/index.js +2 -0
- package/src/components/sidebar/settings-sidebar/index.js +1 -3
- package/src/editor.js +1 -12
- package/src/editor.native.js +8 -2
- package/src/index.js +2 -1
- package/src/store/selectors.js +1 -1
- package/build/components/sidebar/plugin-document-setting-panel/index.js +0 -126
- package/build/components/sidebar/plugin-document-setting-panel/index.js.map +0 -1
- package/build-module/components/sidebar/plugin-document-setting-panel/index.js +0 -118
- package/build-module/components/sidebar/plugin-document-setting-panel/index.js.map +0 -1
- package/src/components/sidebar/plugin-document-setting-panel/index.js +0 -125
|
@@ -88,14 +88,14 @@ describe( 'listener hook tests', () => {
|
|
|
88
88
|
} );
|
|
89
89
|
describe( 'useBlockSelectionListener', () => {
|
|
90
90
|
const registry = createRegistry( mockStores );
|
|
91
|
-
const TestComponent = (
|
|
92
|
-
useBlockSelectionListener(
|
|
91
|
+
const TestComponent = () => {
|
|
92
|
+
useBlockSelectionListener();
|
|
93
93
|
return null;
|
|
94
94
|
};
|
|
95
95
|
const TestedOutput = () => {
|
|
96
96
|
return (
|
|
97
97
|
<RegistryProvider value={ registry }>
|
|
98
|
-
<TestComponent
|
|
98
|
+
<TestComponent />
|
|
99
99
|
</RegistryProvider>
|
|
100
100
|
);
|
|
101
101
|
};
|
|
@@ -177,14 +177,14 @@ describe( 'listener hook tests', () => {
|
|
|
177
177
|
|
|
178
178
|
describe( 'useUpdatePostLinkListener', () => {
|
|
179
179
|
const registry = createRegistry( mockStores );
|
|
180
|
-
const TestComponent = (
|
|
181
|
-
useUpdatePostLinkListener(
|
|
180
|
+
const TestComponent = () => {
|
|
181
|
+
useUpdatePostLinkListener();
|
|
182
182
|
return null;
|
|
183
183
|
};
|
|
184
|
-
const TestedOutput = (
|
|
184
|
+
const TestedOutput = () => {
|
|
185
185
|
return (
|
|
186
186
|
<RegistryProvider value={ registry }>
|
|
187
|
-
<TestComponent
|
|
187
|
+
<TestComponent />
|
|
188
188
|
</RegistryProvider>
|
|
189
189
|
);
|
|
190
190
|
};
|
|
@@ -222,7 +222,7 @@ describe( 'listener hook tests', () => {
|
|
|
222
222
|
} );
|
|
223
223
|
const { rerender } = render( <TestedOutput /> );
|
|
224
224
|
|
|
225
|
-
rerender( <TestedOutput
|
|
225
|
+
rerender( <TestedOutput /> );
|
|
226
226
|
|
|
227
227
|
expect( mockSelector ).toHaveBeenCalledTimes( 1 );
|
|
228
228
|
act( () => {
|
|
@@ -181,7 +181,7 @@ function HeaderToolbar( {
|
|
|
181
181
|
<ScrollView
|
|
182
182
|
ref={ scrollViewRef }
|
|
183
183
|
onContentSizeChange={ scrollToStart }
|
|
184
|
-
horizontal
|
|
184
|
+
horizontal
|
|
185
185
|
showsHorizontalScrollIndicator={ false }
|
|
186
186
|
keyboardShouldPersistTaps="always"
|
|
187
187
|
alwaysBounceHorizontal={ false }
|
|
@@ -8,6 +8,7 @@ import classnames from 'classnames';
|
|
|
8
8
|
*/
|
|
9
9
|
import {
|
|
10
10
|
BlockToolbar,
|
|
11
|
+
privateApis as blockEditorPrivateApis,
|
|
11
12
|
store as blockEditorStore,
|
|
12
13
|
} from '@wordpress/block-editor';
|
|
13
14
|
import {
|
|
@@ -40,6 +41,7 @@ import MainDashboardButton from './main-dashboard-button';
|
|
|
40
41
|
import { store as editPostStore } from '../../store';
|
|
41
42
|
import { unlock } from '../../lock-unlock';
|
|
42
43
|
|
|
44
|
+
const { useShowBlockTools } = unlock( blockEditorPrivateApis );
|
|
43
45
|
const { DocumentTools, PostViewLink, PreviewDropdown } =
|
|
44
46
|
unlock( editorPrivateApis );
|
|
45
47
|
|
|
@@ -61,9 +63,8 @@ function Header( { setEntitiesSavedStatesCallback, initialPost } ) {
|
|
|
61
63
|
const blockToolbarRef = useRef();
|
|
62
64
|
const {
|
|
63
65
|
isTextEditor,
|
|
64
|
-
|
|
66
|
+
blockSelectionStart,
|
|
65
67
|
hasActiveMetaboxes,
|
|
66
|
-
hasFixedToolbar,
|
|
67
68
|
isPublishSidebarOpened,
|
|
68
69
|
showIconLabels,
|
|
69
70
|
hasHistory,
|
|
@@ -73,28 +74,31 @@ function Header( { setEntitiesSavedStatesCallback, initialPost } ) {
|
|
|
73
74
|
|
|
74
75
|
return {
|
|
75
76
|
isTextEditor: getEditorMode() === 'text',
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
blockSelectionStart:
|
|
78
|
+
select( blockEditorStore ).getBlockSelectionStart(),
|
|
78
79
|
hasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),
|
|
79
80
|
hasHistory:
|
|
80
81
|
!! select( editorStore ).getEditorSettings()
|
|
81
82
|
.onNavigateToPreviousEntityRecord,
|
|
82
83
|
isPublishSidebarOpened:
|
|
83
84
|
select( editPostStore ).isPublishSidebarOpened(),
|
|
84
|
-
hasFixedToolbar: getPreference( 'core', 'fixedToolbar' ),
|
|
85
85
|
showIconLabels: getPreference( 'core', 'showIconLabels' ),
|
|
86
86
|
};
|
|
87
87
|
}, [] );
|
|
88
88
|
|
|
89
|
+
const { showFixedToolbar } = useShowBlockTools();
|
|
90
|
+
const showTopToolbar = isLargeViewport && showFixedToolbar;
|
|
91
|
+
|
|
89
92
|
const [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =
|
|
90
93
|
useState( true );
|
|
94
|
+
const hasBlockSelection = !! blockSelectionStart;
|
|
91
95
|
|
|
92
96
|
useEffect( () => {
|
|
93
97
|
// If we have a new block selection, show the block tools
|
|
94
|
-
if (
|
|
98
|
+
if ( blockSelectionStart ) {
|
|
95
99
|
setIsBlockToolsCollapsed( false );
|
|
96
100
|
}
|
|
97
|
-
}, [
|
|
101
|
+
}, [ blockSelectionStart ] );
|
|
98
102
|
|
|
99
103
|
return (
|
|
100
104
|
<div className="edit-post-header">
|
|
@@ -115,13 +119,15 @@ function Header( { setEntitiesSavedStatesCallback, initialPost } ) {
|
|
|
115
119
|
className="edit-post-header__toolbar"
|
|
116
120
|
>
|
|
117
121
|
<DocumentTools disableBlockTools={ isTextEditor } />
|
|
118
|
-
{
|
|
122
|
+
{ showTopToolbar && (
|
|
119
123
|
<>
|
|
120
124
|
<div
|
|
121
125
|
className={ classnames(
|
|
122
126
|
'selected-block-tools-wrapper',
|
|
123
127
|
{
|
|
124
|
-
'is-collapsed':
|
|
128
|
+
'is-collapsed':
|
|
129
|
+
isBlockToolsCollapsed ||
|
|
130
|
+
! hasBlockSelection,
|
|
125
131
|
}
|
|
126
132
|
) }
|
|
127
133
|
>
|
|
@@ -131,32 +137,29 @@ function Header( { setEntitiesSavedStatesCallback, initialPost } ) {
|
|
|
131
137
|
ref={ blockToolbarRef }
|
|
132
138
|
name="block-toolbar"
|
|
133
139
|
/>
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
) }
|
|
140
|
+
<Button
|
|
141
|
+
className="edit-post-header__block-tools-toggle"
|
|
142
|
+
icon={ isBlockToolsCollapsed ? next : previous }
|
|
143
|
+
onClick={ () => {
|
|
144
|
+
setIsBlockToolsCollapsed(
|
|
145
|
+
( collapsed ) => ! collapsed
|
|
146
|
+
);
|
|
147
|
+
} }
|
|
148
|
+
label={
|
|
149
|
+
isBlockToolsCollapsed
|
|
150
|
+
? __( 'Show block tools' )
|
|
151
|
+
: __( 'Hide block tools' )
|
|
152
|
+
}
|
|
153
|
+
size="compact"
|
|
154
|
+
/>
|
|
150
155
|
</>
|
|
151
156
|
) }
|
|
152
157
|
<div
|
|
153
158
|
className={ classnames( 'edit-post-header__center', {
|
|
154
159
|
'is-collapsed':
|
|
155
160
|
hasHistory &&
|
|
156
|
-
hasBlockSelection &&
|
|
157
161
|
! isBlockToolsCollapsed &&
|
|
158
|
-
|
|
159
|
-
isLargeViewport,
|
|
162
|
+
showTopToolbar,
|
|
160
163
|
} ) }
|
|
161
164
|
>
|
|
162
165
|
{ hasHistory && <DocumentBar /> }
|
|
@@ -2,14 +2,11 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { MenuGroup } from '@wordpress/components';
|
|
6
|
-
import {
|
|
7
|
-
ActionItem,
|
|
8
|
-
MoreMenuDropdown,
|
|
9
|
-
PinnedItems,
|
|
10
|
-
} from '@wordpress/interface';
|
|
5
|
+
import { MenuGroup, DropdownMenu } from '@wordpress/components';
|
|
6
|
+
import { ActionItem, PinnedItems } from '@wordpress/interface';
|
|
11
7
|
import { useViewportMatch } from '@wordpress/compose';
|
|
12
8
|
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
9
|
+
import { moreVertical } from '@wordpress/icons';
|
|
13
10
|
|
|
14
11
|
/**
|
|
15
12
|
* Internal dependencies
|
|
@@ -25,10 +22,17 @@ const MoreMenu = ( { showIconLabels } ) => {
|
|
|
25
22
|
const isLargeViewport = useViewportMatch( 'large' );
|
|
26
23
|
|
|
27
24
|
return (
|
|
28
|
-
<
|
|
25
|
+
<DropdownMenu
|
|
26
|
+
icon={ moreVertical }
|
|
27
|
+
label={ __( 'Options' ) }
|
|
28
|
+
popoverProps={ {
|
|
29
|
+
placement: 'bottom-end',
|
|
30
|
+
className: 'more-menu-dropdown__content',
|
|
31
|
+
} }
|
|
29
32
|
toggleProps={ {
|
|
30
|
-
showTooltip: ! showIconLabels,
|
|
31
33
|
...( showIconLabels && { variant: 'tertiary' } ),
|
|
34
|
+
tooltipPosition: 'bottom',
|
|
35
|
+
showTooltip: ! showIconLabels,
|
|
32
36
|
size: 'compact',
|
|
33
37
|
} }
|
|
34
38
|
>
|
|
@@ -54,7 +58,7 @@ const MoreMenu = ( { showIconLabels } ) => {
|
|
|
54
58
|
</MenuGroup>
|
|
55
59
|
</>
|
|
56
60
|
) }
|
|
57
|
-
</
|
|
61
|
+
</DropdownMenu>
|
|
58
62
|
);
|
|
59
63
|
};
|
|
60
64
|
|
|
@@ -10,19 +10,14 @@ import { PostPublishButtonOrToggle } from '../post-publish-button-or-toggle';
|
|
|
10
10
|
|
|
11
11
|
describe( 'PostPublishButtonOrToggle should render a', () => {
|
|
12
12
|
it( 'button when the post is published (1)', () => {
|
|
13
|
-
render( <PostPublishButtonOrToggle isPublished
|
|
13
|
+
render( <PostPublishButtonOrToggle isPublished /> );
|
|
14
14
|
expect(
|
|
15
15
|
screen.getByRole( 'button', { name: 'Submit for Review' } )
|
|
16
16
|
).toBeVisible();
|
|
17
17
|
} );
|
|
18
18
|
|
|
19
19
|
it( 'button when the post is scheduled (2)', () => {
|
|
20
|
-
render(
|
|
21
|
-
<PostPublishButtonOrToggle
|
|
22
|
-
isScheduled={ true }
|
|
23
|
-
isBeingScheduled={ true }
|
|
24
|
-
/>
|
|
25
|
-
);
|
|
20
|
+
render( <PostPublishButtonOrToggle isScheduled isBeingScheduled /> );
|
|
26
21
|
expect(
|
|
27
22
|
screen.getByRole( 'button', { name: 'Submit for Review' } )
|
|
28
23
|
).toBeVisible();
|
|
@@ -30,10 +25,7 @@ describe( 'PostPublishButtonOrToggle should render a', () => {
|
|
|
30
25
|
|
|
31
26
|
it( 'button when the post is pending and cannot be published but the viewport is >= medium (3)', () => {
|
|
32
27
|
render(
|
|
33
|
-
<PostPublishButtonOrToggle
|
|
34
|
-
isPending={ true }
|
|
35
|
-
hasPublishAction={ false }
|
|
36
|
-
/>
|
|
28
|
+
<PostPublishButtonOrToggle isPending hasPublishAction={ false } />
|
|
37
29
|
);
|
|
38
30
|
|
|
39
31
|
expect(
|
|
@@ -42,9 +34,7 @@ describe( 'PostPublishButtonOrToggle should render a', () => {
|
|
|
42
34
|
} );
|
|
43
35
|
|
|
44
36
|
it( 'toggle when post is not (1), (2), (3), the viewport is >= medium, and the publish sidebar is enabled', () => {
|
|
45
|
-
render(
|
|
46
|
-
<PostPublishButtonOrToggle isPublishSidebarEnabled={ true } />
|
|
47
|
-
);
|
|
37
|
+
render( <PostPublishButtonOrToggle isPublishSidebarEnabled /> );
|
|
48
38
|
expect(
|
|
49
39
|
screen.getByRole( 'button', { name: 'Publish' } )
|
|
50
40
|
).toBeVisible();
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
5
|
+
import { __, _x } from '@wordpress/i18n';
|
|
6
|
+
import {
|
|
7
|
+
Modal,
|
|
8
|
+
Button,
|
|
9
|
+
__experimentalHStack as HStack,
|
|
10
|
+
__experimentalVStack as VStack,
|
|
11
|
+
ToggleControl,
|
|
12
|
+
TextControl,
|
|
13
|
+
} from '@wordpress/components';
|
|
14
|
+
import { useEffect, useState } from '@wordpress/element';
|
|
15
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
16
|
+
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Internal dependencies
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import { unlock } from '../../lock-unlock';
|
|
23
|
+
|
|
24
|
+
const { ReusableBlocksRenameHint } = unlock( blockEditorPrivateApis );
|
|
25
|
+
|
|
26
|
+
export default function InitPatternModal() {
|
|
27
|
+
const { editPost } = useDispatch( editorStore );
|
|
28
|
+
const [ isModalOpen, setIsModalOpen ] = useState( false );
|
|
29
|
+
const [ syncType, setSyncType ] = useState( undefined );
|
|
30
|
+
const [ title, setTitle ] = useState( '' );
|
|
31
|
+
|
|
32
|
+
const { postType, isNewPost } = useSelect( ( select ) => {
|
|
33
|
+
const { getEditedPostAttribute, isCleanNewPost } =
|
|
34
|
+
select( editorStore );
|
|
35
|
+
return {
|
|
36
|
+
postType: getEditedPostAttribute( 'type' ),
|
|
37
|
+
isNewPost: isCleanNewPost(),
|
|
38
|
+
};
|
|
39
|
+
}, [] );
|
|
40
|
+
|
|
41
|
+
useEffect( () => {
|
|
42
|
+
if ( isNewPost && postType === 'wp_block' ) {
|
|
43
|
+
setIsModalOpen( true );
|
|
44
|
+
}
|
|
45
|
+
// We only want the modal to open when the page is first loaded.
|
|
46
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
47
|
+
}, [] );
|
|
48
|
+
|
|
49
|
+
if ( postType !== 'wp_block' || ! isNewPost ) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<>
|
|
55
|
+
{ isModalOpen && (
|
|
56
|
+
<Modal
|
|
57
|
+
title={ __( 'Create pattern' ) }
|
|
58
|
+
onRequestClose={ () => {
|
|
59
|
+
setIsModalOpen( false );
|
|
60
|
+
} }
|
|
61
|
+
overlayClassName="reusable-blocks-menu-items__convert-modal"
|
|
62
|
+
>
|
|
63
|
+
<form
|
|
64
|
+
onSubmit={ ( event ) => {
|
|
65
|
+
event.preventDefault();
|
|
66
|
+
setIsModalOpen( false );
|
|
67
|
+
editPost( {
|
|
68
|
+
title,
|
|
69
|
+
meta: {
|
|
70
|
+
wp_pattern_sync_status: syncType,
|
|
71
|
+
},
|
|
72
|
+
} );
|
|
73
|
+
} }
|
|
74
|
+
>
|
|
75
|
+
<VStack spacing="5">
|
|
76
|
+
<TextControl
|
|
77
|
+
label={ __( 'Name' ) }
|
|
78
|
+
value={ title }
|
|
79
|
+
onChange={ setTitle }
|
|
80
|
+
placeholder={ __( 'My pattern' ) }
|
|
81
|
+
className="patterns-create-modal__name-input"
|
|
82
|
+
__nextHasNoMarginBottom
|
|
83
|
+
__next40pxDefaultSize
|
|
84
|
+
/>
|
|
85
|
+
<ReusableBlocksRenameHint />
|
|
86
|
+
<ToggleControl
|
|
87
|
+
label={ _x(
|
|
88
|
+
'Synced',
|
|
89
|
+
'Option that makes an individual pattern synchronized'
|
|
90
|
+
) }
|
|
91
|
+
help={ __(
|
|
92
|
+
'Sync this pattern across multiple locations.'
|
|
93
|
+
) }
|
|
94
|
+
checked={ ! syncType }
|
|
95
|
+
onChange={ () => {
|
|
96
|
+
setSyncType(
|
|
97
|
+
! syncType ? 'unsynced' : undefined
|
|
98
|
+
);
|
|
99
|
+
} }
|
|
100
|
+
/>
|
|
101
|
+
<HStack justify="right">
|
|
102
|
+
<Button
|
|
103
|
+
variant="primary"
|
|
104
|
+
type="submit"
|
|
105
|
+
disabled={ ! title }
|
|
106
|
+
__experimentalIsFocusable
|
|
107
|
+
>
|
|
108
|
+
{ __( 'Create' ) }
|
|
109
|
+
</Button>
|
|
110
|
+
</HStack>
|
|
111
|
+
</VStack>
|
|
112
|
+
</form>
|
|
113
|
+
</Modal>
|
|
114
|
+
) }
|
|
115
|
+
</>
|
|
116
|
+
);
|
|
117
|
+
}
|
|
@@ -46,4 +46,8 @@ export const textFormattingShortcuts = [
|
|
|
46
46
|
'Convert the current paragraph or heading to a heading of level 1 to 6.'
|
|
47
47
|
),
|
|
48
48
|
},
|
|
49
|
+
{
|
|
50
|
+
keyCombination: { modifier: 'primaryShift', character: '\u00a0' },
|
|
51
|
+
description: __( 'Add non breaking space.' ),
|
|
52
|
+
},
|
|
49
53
|
];
|
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
EditorKeyboardShortcutsRegister,
|
|
15
15
|
EditorKeyboardShortcuts,
|
|
16
16
|
EditorSnackbars,
|
|
17
|
-
PostSyncStatusModal,
|
|
18
17
|
store as editorStore,
|
|
19
18
|
privateApis as editorPrivateApis,
|
|
20
19
|
} from '@wordpress/editor';
|
|
@@ -50,6 +49,7 @@ import VisualEditor from '../visual-editor';
|
|
|
50
49
|
import EditPostKeyboardShortcuts from '../keyboard-shortcuts';
|
|
51
50
|
import KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';
|
|
52
51
|
import EditPostPreferencesModal from '../preferences-modal';
|
|
52
|
+
import InitPatternModal from '../init-pattern-modal';
|
|
53
53
|
import BrowserURL from '../browser-url';
|
|
54
54
|
import Header from '../header';
|
|
55
55
|
import SettingsSidebar from '../sidebar/settings-sidebar';
|
|
@@ -381,7 +381,7 @@ function Layout( { initialPost } ) {
|
|
|
381
381
|
<EditPostPreferencesModal />
|
|
382
382
|
<KeyboardShortcutHelpModal />
|
|
383
383
|
<WelcomeGuide />
|
|
384
|
-
<
|
|
384
|
+
<InitPatternModal />
|
|
385
385
|
<StartPageOptions />
|
|
386
386
|
<PluginArea onError={ onPluginAreaError } />
|
|
387
387
|
{ ! isDistractionFree && <SettingsSidebar /> }
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
PostSyncStatus,
|
|
15
15
|
PostURLPanel,
|
|
16
16
|
PostTemplatePanel,
|
|
17
|
+
PostFeaturedImagePanel,
|
|
17
18
|
store as editorStore,
|
|
18
19
|
} from '@wordpress/editor';
|
|
19
20
|
|
|
@@ -60,6 +61,7 @@ export default function PostStatus() {
|
|
|
60
61
|
<PluginPostStatusInfo.Slot>
|
|
61
62
|
{ ( fills ) => (
|
|
62
63
|
<>
|
|
64
|
+
<PostFeaturedImagePanel withPanelBody={ false } />
|
|
63
65
|
<PostVisibility />
|
|
64
66
|
<PostSchedulePanel />
|
|
65
67
|
<PostTemplatePanel />
|
|
@@ -20,9 +20,9 @@ import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
|
20
20
|
import {
|
|
21
21
|
store as editorStore,
|
|
22
22
|
PageAttributesPanel,
|
|
23
|
+
PluginDocumentSettingPanel,
|
|
23
24
|
PostDiscussionPanel,
|
|
24
25
|
PostExcerptPanel,
|
|
25
|
-
PostFeaturedImagePanel,
|
|
26
26
|
PostLastRevisionPanel,
|
|
27
27
|
PostTaxonomiesPanel,
|
|
28
28
|
} from '@wordpress/editor';
|
|
@@ -33,7 +33,6 @@ import {
|
|
|
33
33
|
import SettingsHeader from '../settings-header';
|
|
34
34
|
import PostStatus from '../post-status';
|
|
35
35
|
import MetaBoxes from '../../meta-boxes';
|
|
36
|
-
import PluginDocumentSettingPanel from '../plugin-document-setting-panel';
|
|
37
36
|
import PluginSidebarEditPost from '../plugin-sidebar';
|
|
38
37
|
import TemplateSummary from '../template-summary';
|
|
39
38
|
import { store as editPostStore } from '../../../store';
|
|
@@ -117,7 +116,6 @@ const SidebarContent = ( {
|
|
|
117
116
|
<PluginDocumentSettingPanel.Slot />
|
|
118
117
|
<PostLastRevisionPanel />
|
|
119
118
|
<PostTaxonomiesPanel />
|
|
120
|
-
<PostFeaturedImagePanel />
|
|
121
119
|
<PostExcerptPanel />
|
|
122
120
|
<PostDiscussionPanel />
|
|
123
121
|
<PageAttributesPanel />
|
package/src/editor.js
CHANGED
|
@@ -12,8 +12,6 @@ import { useMemo } from '@wordpress/element';
|
|
|
12
12
|
import { SlotFillProvider } from '@wordpress/components';
|
|
13
13
|
import { store as coreStore } from '@wordpress/core-data';
|
|
14
14
|
import { CommandMenu } from '@wordpress/commands';
|
|
15
|
-
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
16
|
-
import { __ } from '@wordpress/i18n';
|
|
17
15
|
|
|
18
16
|
/**
|
|
19
17
|
* Internal dependencies
|
|
@@ -25,14 +23,6 @@ import { unlock } from './lock-unlock';
|
|
|
25
23
|
import useNavigateToEntityRecord from './hooks/use-navigate-to-entity-record';
|
|
26
24
|
|
|
27
25
|
const { ExperimentalEditorProvider } = unlock( editorPrivateApis );
|
|
28
|
-
const { BlockRemovalWarningModal } = unlock( blockEditorPrivateApis );
|
|
29
|
-
// Prevent accidental removal of certain blocks, asking the user for
|
|
30
|
-
// confirmation.
|
|
31
|
-
const blockRemovalRules = {
|
|
32
|
-
'bindings/core/pattern-overrides': __(
|
|
33
|
-
'Blocks from synced patterns that can have overriden content.'
|
|
34
|
-
),
|
|
35
|
-
};
|
|
36
26
|
|
|
37
27
|
function Editor( {
|
|
38
28
|
postId: initialPostId,
|
|
@@ -106,9 +96,8 @@ function Editor( {
|
|
|
106
96
|
>
|
|
107
97
|
<ErrorBoundary>
|
|
108
98
|
<CommandMenu />
|
|
109
|
-
<EditorInitialization
|
|
99
|
+
<EditorInitialization />
|
|
110
100
|
<Layout initialPost={ initialPost } />
|
|
111
|
-
<BlockRemovalWarningModal rules={ blockRemovalRules } />
|
|
112
101
|
</ErrorBoundary>
|
|
113
102
|
<PostLockedModal />
|
|
114
103
|
</ExperimentalEditorProvider>
|
package/src/editor.native.js
CHANGED
|
@@ -9,7 +9,11 @@ import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
|
9
9
|
* WordPress dependencies
|
|
10
10
|
*/
|
|
11
11
|
import { Component } from '@wordpress/element';
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
EditorProvider,
|
|
14
|
+
ErrorBoundary,
|
|
15
|
+
store as editorStore,
|
|
16
|
+
} from '@wordpress/editor';
|
|
13
17
|
import { parse, serialize } from '@wordpress/blocks';
|
|
14
18
|
import { withDispatch, withSelect } from '@wordpress/data';
|
|
15
19
|
import { compose } from '@wordpress/compose';
|
|
@@ -143,7 +147,9 @@ class Editor extends Component {
|
|
|
143
147
|
useSubRegistry={ false }
|
|
144
148
|
{ ...props }
|
|
145
149
|
>
|
|
146
|
-
<
|
|
150
|
+
<ErrorBoundary>
|
|
151
|
+
<Layout setTitleRef={ this.setTitleRef } />
|
|
152
|
+
</ErrorBoundary>
|
|
147
153
|
</EditorProvider>
|
|
148
154
|
</SlotFillProvider>
|
|
149
155
|
</GestureHandlerRootView>
|
package/src/index.js
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
registerWidgetGroupBlock,
|
|
16
16
|
} from '@wordpress/widgets';
|
|
17
17
|
import {
|
|
18
|
+
PluginDocumentSettingPanel,
|
|
18
19
|
privateApis as editorPrivateApis,
|
|
19
20
|
store as editorStore,
|
|
20
21
|
} from '@wordpress/editor';
|
|
@@ -161,7 +162,7 @@ export function reinitializeEditor() {
|
|
|
161
162
|
}
|
|
162
163
|
|
|
163
164
|
export { default as PluginBlockSettingsMenuItem } from './components/block-settings-menu/plugin-block-settings-menu-item';
|
|
164
|
-
export {
|
|
165
|
+
export { PluginDocumentSettingPanel };
|
|
165
166
|
export { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';
|
|
166
167
|
export { default as PluginPostPublishPanel } from './components/sidebar/plugin-post-publish-panel';
|
|
167
168
|
export { default as PluginPostStatusInfo } from './components/sidebar/plugin-post-status-info';
|
package/src/store/selectors.js
CHANGED
|
@@ -538,7 +538,7 @@ export const isEditingTemplate = createRegistrySelector( ( select ) => () => {
|
|
|
538
538
|
since: '6.5',
|
|
539
539
|
alternative: `select( 'core/editor' ).getRenderingMode`,
|
|
540
540
|
} );
|
|
541
|
-
return select( editorStore ).getCurrentPostType()
|
|
541
|
+
return select( editorStore ).getCurrentPostType() === 'wp_template';
|
|
542
542
|
} );
|
|
543
543
|
|
|
544
544
|
/**
|