@wordpress/edit-post 7.14.0 → 7.16.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 +6 -6
- package/build/components/device-preview/index.js.map +1 -1
- package/build/components/header/{document-title → document-actions}/index.js +10 -11
- package/build/components/header/document-actions/index.js.map +1 -0
- package/build/components/header/header-toolbar/index.js +7 -6
- package/build/components/header/header-toolbar/index.js.map +1 -1
- package/build/components/header/header-toolbar/index.native.js +92 -49
- package/build/components/header/header-toolbar/index.native.js.map +1 -1
- package/build/components/header/index.js +4 -9
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/mode-switcher/index.js +23 -4
- package/build/components/header/mode-switcher/index.js.map +1 -1
- package/build/components/header/post-publish-button-or-toggle.js +0 -2
- package/build/components/header/post-publish-button-or-toggle.js.map +1 -1
- package/build/components/layout/actions-panel.js +5 -10
- package/build/components/layout/actions-panel.js.map +1 -1
- package/build/components/layout/index.js +36 -13
- package/build/components/layout/index.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +2 -2
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/discussion-panel/index.js +20 -20
- package/build/components/sidebar/discussion-panel/index.js.map +1 -1
- package/build/components/text-editor/index.js +1 -1
- package/build/components/text-editor/index.js.map +1 -1
- package/build/components/visual-editor/header.native.js +1 -13
- package/build/components/visual-editor/header.native.js.map +1 -1
- package/build/components/visual-editor/index.js +1 -1
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/editor.js +2 -39
- package/build/editor.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +61 -4
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/index.js +2 -1
- package/build/index.js.map +1 -1
- package/build/plugins/index.js +35 -6
- package/build/plugins/index.js.map +1 -1
- package/build/store/actions.js +12 -14
- package/build/store/actions.js.map +1 -1
- package/build-module/components/device-preview/index.js +6 -6
- package/build-module/components/device-preview/index.js.map +1 -1
- package/build-module/components/header/{document-title → document-actions}/index.js +10 -11
- package/build-module/components/header/document-actions/index.js.map +1 -0
- package/build-module/components/header/header-toolbar/index.js +7 -6
- package/build-module/components/header/header-toolbar/index.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.native.js +93 -53
- package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
- package/build-module/components/header/index.js +4 -9
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/mode-switcher/index.js +23 -4
- package/build-module/components/header/mode-switcher/index.js.map +1 -1
- package/build-module/components/header/post-publish-button-or-toggle.js +0 -2
- package/build-module/components/header/post-publish-button-or-toggle.js.map +1 -1
- package/build-module/components/layout/actions-panel.js +5 -10
- package/build-module/components/layout/actions-panel.js.map +1 -1
- package/build-module/components/layout/index.js +37 -14
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +3 -3
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/discussion-panel/index.js +21 -19
- package/build-module/components/sidebar/discussion-panel/index.js.map +1 -1
- package/build-module/components/text-editor/index.js +2 -2
- package/build-module/components/text-editor/index.js.map +1 -1
- package/build-module/components/visual-editor/header.native.js +1 -10
- package/build-module/components/visual-editor/header.native.js.map +1 -1
- package/build-module/components/visual-editor/index.js +2 -2
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/editor.js +2 -38
- package/build-module/editor.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +60 -5
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/index.js +2 -1
- package/build-module/index.js.map +1 -1
- package/build-module/plugins/index.js +33 -6
- package/build-module/plugins/index.js.map +1 -1
- package/build-module/store/actions.js +11 -14
- package/build-module/store/actions.js.map +1 -1
- package/build-style/style-rtl.css +30 -31
- package/build-style/style.css +30 -31
- package/package.json +32 -32
- package/src/components/device-preview/index.js +35 -39
- package/src/components/header/{document-title → document-actions}/index.js +22 -23
- package/src/components/header/{document-title → document-actions}/style.scss +25 -22
- package/src/components/header/header-toolbar/index.js +3 -2
- package/src/components/header/header-toolbar/index.native.js +125 -68
- package/src/components/header/header-toolbar/style.native.scss +23 -4
- package/src/components/header/header-toolbar/style.scss +4 -0
- package/src/components/header/index.js +15 -25
- package/src/components/header/mode-switcher/index.js +23 -4
- package/src/components/header/post-publish-button-or-toggle.js +0 -2
- package/src/components/header/style.scss +1 -1
- package/src/components/layout/actions-panel.js +5 -7
- package/src/components/layout/index.js +45 -9
- package/src/components/layout/style.native.scss +1 -1
- package/src/components/preferences-modal/test/__snapshots__/index.js.snap +16 -5
- package/src/components/preferences-modal/test/index.js +4 -4
- package/src/components/secondary-sidebar/list-view-sidebar.js +3 -3
- package/src/components/sidebar/discussion-panel/index.js +15 -20
- package/src/components/text-editor/index.js +0 -2
- package/src/components/visual-editor/header.native.js +1 -17
- package/src/components/visual-editor/index.js +1 -6
- package/src/components/visual-editor/test/__snapshots__/index.native.js.snap +15 -0
- package/src/components/visual-editor/test/index.native.js +118 -1
- package/src/editor.js +2 -47
- package/src/hooks/commands/use-common-commands.js +81 -15
- package/src/index.js +5 -1
- package/src/plugins/index.js +32 -8
- package/src/store/actions.js +18 -27
- package/src/style.scss +2 -8
- package/src/test/editor.native.js +4 -3
- package/build/components/header/document-title/index.js.map +0 -1
- package/build-module/components/header/document-title/index.js.map +0 -1
- package/src/components/visual-editor/style.native.scss +0 -18
package/src/editor.js
CHANGED
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
store as editorStore,
|
|
10
10
|
privateApis as editorPrivateApis,
|
|
11
11
|
} from '@wordpress/editor';
|
|
12
|
-
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
13
12
|
import { useMemo } from '@wordpress/element';
|
|
14
13
|
import { SlotFillProvider } from '@wordpress/components';
|
|
15
14
|
import { store as coreStore } from '@wordpress/core-data';
|
|
@@ -28,7 +27,6 @@ import { unlock } from './lock-unlock';
|
|
|
28
27
|
import useCommonCommands from './hooks/commands/use-common-commands';
|
|
29
28
|
|
|
30
29
|
const { ExperimentalEditorProvider } = unlock( editorPrivateApis );
|
|
31
|
-
const { getLayoutStyles } = unlock( blockEditorPrivateApis );
|
|
32
30
|
const { useCommands } = unlock( coreCommandsPrivateApis );
|
|
33
31
|
|
|
34
32
|
function Editor( { postId, postType, settings, initialEdits, ...props } ) {
|
|
@@ -39,7 +37,6 @@ function Editor( { postId, postType, settings, initialEdits, ...props } ) {
|
|
|
39
37
|
focusMode,
|
|
40
38
|
isDistractionFree,
|
|
41
39
|
hasInlineToolbar,
|
|
42
|
-
hasThemeStyles,
|
|
43
40
|
post,
|
|
44
41
|
preferredStyleVariations,
|
|
45
42
|
hiddenBlockTypes,
|
|
@@ -51,7 +48,6 @@ function Editor( { postId, postType, settings, initialEdits, ...props } ) {
|
|
|
51
48
|
( select ) => {
|
|
52
49
|
const {
|
|
53
50
|
isFeatureActive,
|
|
54
|
-
__experimentalGetPreviewDeviceType,
|
|
55
51
|
isEditingTemplate,
|
|
56
52
|
getEditedPostTemplate,
|
|
57
53
|
getHiddenBlockTypes,
|
|
@@ -80,13 +76,10 @@ function Editor( { postId, postType, settings, initialEdits, ...props } ) {
|
|
|
80
76
|
const canEditTemplate = canUser( 'create', 'templates' );
|
|
81
77
|
|
|
82
78
|
return {
|
|
83
|
-
hasFixedToolbar:
|
|
84
|
-
isFeatureActive( 'fixedToolbar' ) ||
|
|
85
|
-
__experimentalGetPreviewDeviceType() !== 'Desktop',
|
|
79
|
+
hasFixedToolbar: isFeatureActive( 'fixedToolbar' ),
|
|
86
80
|
focusMode: isFeatureActive( 'focusMode' ),
|
|
87
81
|
isDistractionFree: isFeatureActive( 'distractionFree' ),
|
|
88
82
|
hasInlineToolbar: isFeatureActive( 'inlineToolbar' ),
|
|
89
|
-
hasThemeStyles: isFeatureActive( 'themeStyles' ),
|
|
90
83
|
preferredStyleVariations: select( preferencesStore ).get(
|
|
91
84
|
'core/edit-post',
|
|
92
85
|
'preferredStyleVariations'
|
|
@@ -158,44 +151,6 @@ function Editor( { postId, postType, settings, initialEdits, ...props } ) {
|
|
|
158
151
|
keepCaretInsideBlock,
|
|
159
152
|
] );
|
|
160
153
|
|
|
161
|
-
const styles = useMemo( () => {
|
|
162
|
-
const themeStyles = [];
|
|
163
|
-
const presetStyles = [];
|
|
164
|
-
settings.styles?.forEach( ( style ) => {
|
|
165
|
-
if ( ! style.__unstableType || style.__unstableType === 'theme' ) {
|
|
166
|
-
themeStyles.push( style );
|
|
167
|
-
} else {
|
|
168
|
-
presetStyles.push( style );
|
|
169
|
-
}
|
|
170
|
-
} );
|
|
171
|
-
|
|
172
|
-
const defaultEditorStyles = [
|
|
173
|
-
...settings.defaultEditorStyles,
|
|
174
|
-
...presetStyles,
|
|
175
|
-
];
|
|
176
|
-
|
|
177
|
-
// If theme styles are not present or displayed, ensure that
|
|
178
|
-
// base layout styles are still present in the editor.
|
|
179
|
-
if (
|
|
180
|
-
! settings.disableLayoutStyles &&
|
|
181
|
-
! ( hasThemeStyles && themeStyles.length )
|
|
182
|
-
) {
|
|
183
|
-
defaultEditorStyles.push( {
|
|
184
|
-
css: getLayoutStyles( {
|
|
185
|
-
style: {},
|
|
186
|
-
selector: 'body',
|
|
187
|
-
hasBlockGapSupport: false,
|
|
188
|
-
hasFallbackGapSupport: true,
|
|
189
|
-
fallbackGapValue: '0.5em',
|
|
190
|
-
} ),
|
|
191
|
-
} );
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
return hasThemeStyles && themeStyles.length
|
|
195
|
-
? settings.styles
|
|
196
|
-
: defaultEditorStyles;
|
|
197
|
-
}, [ settings, hasThemeStyles ] );
|
|
198
|
-
|
|
199
154
|
if ( ! post ) {
|
|
200
155
|
return null;
|
|
201
156
|
}
|
|
@@ -214,7 +169,7 @@ function Editor( { postId, postType, settings, initialEdits, ...props } ) {
|
|
|
214
169
|
<ErrorBoundary>
|
|
215
170
|
<CommandMenu />
|
|
216
171
|
<EditorInitialization postId={ postId } />
|
|
217
|
-
<Layout
|
|
172
|
+
<Layout />
|
|
218
173
|
</ErrorBoundary>
|
|
219
174
|
<PostLockedModal />
|
|
220
175
|
</ExperimentalEditorProvider>
|
|
@@ -9,13 +9,17 @@ import {
|
|
|
9
9
|
drawerLeft,
|
|
10
10
|
drawerRight,
|
|
11
11
|
blockDefault,
|
|
12
|
-
|
|
12
|
+
keyboard,
|
|
13
13
|
desktop,
|
|
14
14
|
listView,
|
|
15
|
+
external,
|
|
16
|
+
formatListBullets,
|
|
15
17
|
} from '@wordpress/icons';
|
|
16
18
|
import { useCommand } from '@wordpress/commands';
|
|
17
19
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
18
20
|
import { store as interfaceStore } from '@wordpress/interface';
|
|
21
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
22
|
+
import { store as noticesStore } from '@wordpress/notices';
|
|
19
23
|
|
|
20
24
|
/**
|
|
21
25
|
* Internal dependencies
|
|
@@ -32,20 +36,29 @@ export default function useCommonCommands() {
|
|
|
32
36
|
setIsListViewOpened,
|
|
33
37
|
} = useDispatch( editPostStore );
|
|
34
38
|
const { openModal } = useDispatch( interfaceStore );
|
|
35
|
-
const {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
const {
|
|
40
|
+
editorMode,
|
|
41
|
+
activeSidebar,
|
|
42
|
+
isListViewOpen,
|
|
43
|
+
isPublishSidebarEnabled,
|
|
44
|
+
showBlockBreadcrumbs,
|
|
45
|
+
} = useSelect( ( select ) => {
|
|
46
|
+
const { getEditorMode, isListViewOpened, isFeatureActive } =
|
|
47
|
+
select( editPostStore );
|
|
48
|
+
return {
|
|
49
|
+
activeSidebar: select( interfaceStore ).getActiveComplementaryArea(
|
|
50
|
+
editPostStore.name
|
|
51
|
+
),
|
|
52
|
+
editorMode: getEditorMode(),
|
|
53
|
+
isListViewOpen: isListViewOpened(),
|
|
54
|
+
isPublishSidebarEnabled:
|
|
55
|
+
select( editorStore ).isPublishSidebarEnabled(),
|
|
56
|
+
showBlockBreadcrumbs: isFeatureActive( 'showBlockBreadcrumbs' ),
|
|
57
|
+
};
|
|
58
|
+
}, [] );
|
|
48
59
|
const { toggle } = useDispatch( preferencesStore );
|
|
60
|
+
const { createInfoNotice } = useDispatch( noticesStore );
|
|
61
|
+
const { __unstableSaveForPreview } = useDispatch( editorStore );
|
|
49
62
|
|
|
50
63
|
useCommand( {
|
|
51
64
|
name: 'core/open-settings-sidebar',
|
|
@@ -147,9 +160,62 @@ export default function useCommonCommands() {
|
|
|
147
160
|
useCommand( {
|
|
148
161
|
name: 'core/open-shortcut-help',
|
|
149
162
|
label: __( 'Open keyboard shortcuts' ),
|
|
150
|
-
icon:
|
|
163
|
+
icon: keyboard,
|
|
151
164
|
callback: () => {
|
|
152
165
|
openModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );
|
|
153
166
|
},
|
|
154
167
|
} );
|
|
168
|
+
|
|
169
|
+
useCommand( {
|
|
170
|
+
name: 'core/toggle-breadcrumbs',
|
|
171
|
+
label: showBlockBreadcrumbs
|
|
172
|
+
? __( 'Hide block breadcrumbs' )
|
|
173
|
+
: __( 'Show block breadcrumbs' ),
|
|
174
|
+
icon: cog,
|
|
175
|
+
callback: ( { close } ) => {
|
|
176
|
+
toggle( 'core/edit-post', 'showBlockBreadcrumbs' );
|
|
177
|
+
close();
|
|
178
|
+
createInfoNotice(
|
|
179
|
+
showBlockBreadcrumbs
|
|
180
|
+
? __( 'Breadcrumbs off.' )
|
|
181
|
+
: __( 'Breadcrumbs on.' ),
|
|
182
|
+
{
|
|
183
|
+
id: 'core/edit-post/toggle-breadcrumbs/notice',
|
|
184
|
+
type: 'snackbar',
|
|
185
|
+
}
|
|
186
|
+
);
|
|
187
|
+
},
|
|
188
|
+
} );
|
|
189
|
+
|
|
190
|
+
useCommand( {
|
|
191
|
+
name: 'core/toggle-publish-sidebar',
|
|
192
|
+
label: isPublishSidebarEnabled
|
|
193
|
+
? __( 'Disable pre-publish checklist' )
|
|
194
|
+
: __( 'Enable pre-publish checklist' ),
|
|
195
|
+
icon: formatListBullets,
|
|
196
|
+
callback: ( { close } ) => {
|
|
197
|
+
close();
|
|
198
|
+
toggle( 'core/edit-post', 'isPublishSidebarEnabled' );
|
|
199
|
+
createInfoNotice(
|
|
200
|
+
isPublishSidebarEnabled
|
|
201
|
+
? __( 'Pre-publish checklist off.' )
|
|
202
|
+
: __( 'Pre-publish checklist on.' ),
|
|
203
|
+
{
|
|
204
|
+
id: 'core/edit-post/publish-sidebar/notice',
|
|
205
|
+
type: 'snackbar',
|
|
206
|
+
}
|
|
207
|
+
);
|
|
208
|
+
},
|
|
209
|
+
} );
|
|
210
|
+
|
|
211
|
+
useCommand( {
|
|
212
|
+
name: 'core/preview-link',
|
|
213
|
+
label: __( 'Preview in a new tab' ),
|
|
214
|
+
icon: external,
|
|
215
|
+
callback: async ( { close } ) => {
|
|
216
|
+
close();
|
|
217
|
+
const link = await __unstableSaveForPreview( {} );
|
|
218
|
+
window.open( link, '_blank' );
|
|
219
|
+
},
|
|
220
|
+
} );
|
|
155
221
|
}
|
package/src/index.js
CHANGED
|
@@ -65,7 +65,11 @@ export function initializeEditor(
|
|
|
65
65
|
dispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();
|
|
66
66
|
|
|
67
67
|
// Check if the block list view should be open by default.
|
|
68
|
-
|
|
68
|
+
// If `distractionFree` mode is enabled, the block list view should not be open.
|
|
69
|
+
if (
|
|
70
|
+
select( editPostStore ).isFeatureActive( 'showListViewByDefault' ) &&
|
|
71
|
+
! select( editPostStore ).isFeatureActive( 'distractionFree' )
|
|
72
|
+
) {
|
|
69
73
|
dispatch( editPostStore ).setIsListViewOpened( true );
|
|
70
74
|
}
|
|
71
75
|
|
package/src/plugins/index.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { MenuItem, VisuallyHidden } from '@wordpress/components';
|
|
5
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
6
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
7
|
+
import { useSelect } from '@wordpress/data';
|
|
5
8
|
import { external } from '@wordpress/icons';
|
|
6
9
|
import { __ } from '@wordpress/i18n';
|
|
7
10
|
import { registerPlugin } from '@wordpress/plugins';
|
|
@@ -15,6 +18,34 @@ import KeyboardShortcutsHelpMenuItem from './keyboard-shortcuts-help-menu-item';
|
|
|
15
18
|
import ToolsMoreMenuGroup from '../components/header/tools-more-menu-group';
|
|
16
19
|
import WelcomeGuideMenuItem from './welcome-guide-menu-item';
|
|
17
20
|
|
|
21
|
+
function ManagePatternsMenuItem() {
|
|
22
|
+
const url = useSelect( ( select ) => {
|
|
23
|
+
const { canUser } = select( coreStore );
|
|
24
|
+
const { getEditorSettings } = select( editorStore );
|
|
25
|
+
|
|
26
|
+
const isBlockTheme = getEditorSettings().__unstableIsBlockBasedTheme;
|
|
27
|
+
const defaultUrl = addQueryArgs( 'edit.php', {
|
|
28
|
+
post_type: 'wp_block',
|
|
29
|
+
} );
|
|
30
|
+
const patternsUrl = addQueryArgs( 'site-editor.php', {
|
|
31
|
+
path: '/patterns',
|
|
32
|
+
} );
|
|
33
|
+
|
|
34
|
+
// The site editor and templates both check whether the user has
|
|
35
|
+
// edit_theme_options capabilities. We can leverage that here and not
|
|
36
|
+
// display the manage patterns link if the user can't access it.
|
|
37
|
+
return canUser( 'read', 'templates' ) && isBlockTheme
|
|
38
|
+
? patternsUrl
|
|
39
|
+
: defaultUrl;
|
|
40
|
+
}, [] );
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<MenuItem role="menuitem" href={ url }>
|
|
44
|
+
{ __( 'Manage patterns' ) }
|
|
45
|
+
</MenuItem>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
18
49
|
registerPlugin( 'edit-post', {
|
|
19
50
|
render() {
|
|
20
51
|
return (
|
|
@@ -22,14 +53,7 @@ registerPlugin( 'edit-post', {
|
|
|
22
53
|
<ToolsMoreMenuGroup>
|
|
23
54
|
{ ( { onClose } ) => (
|
|
24
55
|
<>
|
|
25
|
-
<
|
|
26
|
-
role="menuitem"
|
|
27
|
-
href={ addQueryArgs( 'edit.php', {
|
|
28
|
-
post_type: 'wp_block',
|
|
29
|
-
} ) }
|
|
30
|
-
>
|
|
31
|
-
{ __( 'Manage Patterns' ) }
|
|
32
|
-
</MenuItem>
|
|
56
|
+
<ManagePatternsMenuItem />
|
|
33
57
|
<KeyboardShortcutsHelpMenuItem
|
|
34
58
|
onSelect={ onClose }
|
|
35
59
|
/>
|
package/src/store/actions.js
CHANGED
|
@@ -11,6 +11,7 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
11
11
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
12
12
|
import { store as editorStore } from '@wordpress/editor';
|
|
13
13
|
import deprecated from '@wordpress/deprecated';
|
|
14
|
+
import { addFilter } from '@wordpress/hooks';
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Internal dependencies
|
|
@@ -567,33 +568,23 @@ export const initializeMetaBoxes =
|
|
|
567
568
|
|
|
568
569
|
metaBoxesInitialized = true;
|
|
569
570
|
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
.
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
select.hasMetaBoxes();
|
|
588
|
-
|
|
589
|
-
// Save current state for next inspection.
|
|
590
|
-
wasSavingPost = isSavingPost;
|
|
591
|
-
wasAutosavingPost = isAutosavingPost;
|
|
592
|
-
|
|
593
|
-
if ( shouldTriggerMetaboxesSave ) {
|
|
594
|
-
await dispatch.requestMetaBoxUpdates();
|
|
595
|
-
}
|
|
596
|
-
} );
|
|
571
|
+
// Save metaboxes on save completion, except for autosaves.
|
|
572
|
+
addFilter(
|
|
573
|
+
'editor.__unstableSavePost',
|
|
574
|
+
'core/edit-post/save-metaboxes',
|
|
575
|
+
( previous, options ) =>
|
|
576
|
+
previous.then( () => {
|
|
577
|
+
if ( options.isAutosave ) {
|
|
578
|
+
return;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
if ( ! select.hasMetaBoxes() ) {
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
return dispatch.requestMetaBoxUpdates();
|
|
586
|
+
} )
|
|
587
|
+
);
|
|
597
588
|
|
|
598
589
|
dispatch( {
|
|
599
590
|
type: 'META_BOXES_INITIALIZED',
|
package/src/style.scss
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
@import "./components/header/style.scss";
|
|
3
3
|
@import "./components/header/fullscreen-mode-close/style.scss";
|
|
4
4
|
@import "./components/header/header-toolbar/style.scss";
|
|
5
|
-
@import "./components/header/document-
|
|
5
|
+
@import "./components/header/document-actions/style.scss";
|
|
6
6
|
@import "./components/keyboard-shortcut-help-modal/style.scss";
|
|
7
7
|
@import "./components/layout/style.scss";
|
|
8
8
|
@import "./components/block-manager/style.scss";
|
|
@@ -41,13 +41,7 @@
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
// We scope it to .wp-toolbar to be wp-admin only, to prevent bleed into other implementations
|
|
46
|
-
html.wp-toolbar {
|
|
47
|
-
background: $white;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
body.block-editor-page {
|
|
44
|
+
body.js.block-editor-page {
|
|
51
45
|
@include wp-admin-reset( ".block-editor" );
|
|
52
46
|
}
|
|
53
47
|
|
|
@@ -74,11 +74,12 @@ describe( 'Editor', () => {
|
|
|
74
74
|
// Act
|
|
75
75
|
const paragraphBlock = getBlock( screen, 'Paragraph' );
|
|
76
76
|
fireEvent.press( paragraphBlock );
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
act( () => {
|
|
78
|
+
toggleMode();
|
|
79
|
+
} );
|
|
79
80
|
|
|
80
81
|
// Assert
|
|
81
|
-
const htmlEditor =
|
|
82
|
+
const htmlEditor = screen.getByLabelText( 'html-view-content' );
|
|
82
83
|
expect( htmlEditor ).toBeVisible();
|
|
83
84
|
} );
|
|
84
85
|
} );
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/header/document-title/index.js"],"names":["DocumentTitle","template","isEditing","select","isEditingTemplate","getEditedPostTemplate","editPostStore","_isEditing","clearSelectedBlock","blockEditorStore","setIsEditingTemplate","open","openCommandCenter","commandsStore","templateTitle","title","slug","chevronRightSmall","chevronLeftSmall","layout","displayShortcut","primary"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AAKA;;AAnBA;AACA;AACA;;AAcA;AACA;AACA;AAGA,SAASA,aAAT,GAAyB;AACxB,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAA0B,qBAAaC,MAAF,IAAc;AACxD,UAAM;AAAEC,MAAAA,iBAAF;AAAqBC,MAAAA;AAArB,QACLF,MAAM,CAAEG,YAAF,CADP;;AAEA,UAAMC,UAAU,GAAGH,iBAAiB,EAApC;;AAEA,WAAO;AACNH,MAAAA,QAAQ,EAAEM,UAAU,GAAGF,qBAAqB,EAAxB,GAA6B,IAD3C;AAENH,MAAAA,SAAS,EAAEK;AAFL,KAAP;AAIA,GAT+B,EAS7B,EAT6B,CAAhC;AAUA,QAAM;AAAEC,IAAAA;AAAF,MAAyB,uBAAaC,kBAAb,CAA/B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAA2B,uBAAaJ,YAAb,CAAjC;AACA,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zB,CAJH,CA3BD,CADD;AAoCA;;eAEcrB,a","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { BlockIcon, store as blockEditorStore } from '@wordpress/block-editor';\nimport {\n\tButton,\n\tVisuallyHidden,\n\t__experimentalHStack as HStack,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { layout, chevronLeftSmall, chevronRightSmall } from '@wordpress/icons';\nimport { store as commandsStore } from '@wordpress/commands';\nimport { displayShortcut } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nfunction DocumentTitle() {\n\tconst { template, isEditing } = useSelect( ( select ) => {\n\t\tconst { isEditingTemplate, getEditedPostTemplate } =\n\t\t\tselect( editPostStore );\n\t\tconst _isEditing = isEditingTemplate();\n\n\t\treturn {\n\t\t\ttemplate: _isEditing ? getEditedPostTemplate() : null,\n\t\t\tisEditing: _isEditing,\n\t\t};\n\t}, [] );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst { setIsEditingTemplate } = useDispatch( editPostStore );\n\tconst { open: openCommandCenter } = useDispatch( commandsStore );\n\n\tif ( ! isEditing || ! template ) {\n\t\treturn null;\n\t}\n\n\tlet templateTitle = __( 'Default' );\n\tif ( template?.title ) {\n\t\ttemplateTitle = template.title;\n\t} else if ( !! template ) {\n\t\ttemplateTitle = template.slug;\n\t}\n\n\treturn (\n\t\t<div className=\"edit-post-document-title\">\n\t\t\t<span className=\"edit-post-document-title__left\">\n\t\t\t\t<Button\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t\tsetIsEditingTemplate( false );\n\t\t\t\t\t} }\n\t\t\t\t\ticon={ isRTL() ? chevronRightSmall : chevronLeftSmall }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Back' ) }\n\t\t\t\t</Button>\n\t\t\t</span>\n\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-post-document-title__title\"\n\t\t\t\tonClick={ () => openCommandCenter() }\n\t\t\t>\n\t\t\t\t<HStack spacing={ 1 } justify=\"center\">\n\t\t\t\t\t<BlockIcon icon={ layout } />\n\t\t\t\t\t<Text size=\"body\" as=\"h1\">\n\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t{ __( 'Editing template: ' ) }\n\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t{ templateTitle }\n\t\t\t\t\t</Text>\n\t\t\t\t</HStack>\n\t\t\t</Button>\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-post-document-title__shortcut\"\n\t\t\t\tonClick={ () => openCommandCenter() }\n\t\t\t>\n\t\t\t\t{ displayShortcut.primary( 'k' ) }\n\t\t\t</Button>\n\t\t</div>\n\t);\n}\n\nexport default DocumentTitle;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/header/document-title/index.js"],"names":["__","isRTL","useSelect","useDispatch","BlockIcon","store","blockEditorStore","Button","VisuallyHidden","__experimentalHStack","HStack","__experimentalText","Text","layout","chevronLeftSmall","chevronRightSmall","commandsStore","displayShortcut","editPostStore","DocumentTitle","template","isEditing","select","isEditingTemplate","getEditedPostTemplate","_isEditing","clearSelectedBlock","setIsEditingTemplate","open","openCommandCenter","templateTitle","title","slug","primary"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,KAAb,QAA0B,iBAA1B;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,SAAT,EAAoBC,KAAK,IAAIC,gBAA7B,QAAqD,yBAArD;AACA,SACCC,MADD,EAECC,cAFD,EAGCC,oBAAoB,IAAIC,MAHzB,EAICC,kBAAkB,IAAIC,IAJvB,QAKO,uBALP;AAMA,SAASC,MAAT,EAAiBC,gBAAjB,EAAmCC,iBAAnC,QAA4D,kBAA5D;AACA,SAASV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,oBAAoB,CAAE,KAAF,CAApB;AACA,KAJF;AAKC,IAAA,IAAI,EAAG1B,KAAK,KAAKc,iBAAL,GAAyBD;AALtC,KAOGd,EAAE,CAAE,MAAF,CAPL,CADD,CADD,EAaC,cAAC,MAAD;AACC,IAAA,SAAS,EAAC,iCADX;AAEC,IAAA,OAAO,EAAG,MAAM6B,iBAAiB;AAFlC,KAIC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAG,CAAlB;AAAsB,IAAA,OAAO,EAAC;AAA9B,KACC,cAAC,SAAD;AAAW,IAAA,IAAI,EAAGhB;AAAlB,IADD,EAEC,cAAC,IAAD;AAAM,IAAA,IAAI,EAAC,MAAX;AAAkB,IAAA,EAAE,EAAC;AAArB,KACC,cAAC,cAAD;AAAgB,IAAA,EAAE,EAAC;AAAnB,KACGb,EAAE,CAAE,oBAAF,CADL,CADD,EAIG8B,aAJH,CAFD,CAJD,CAbD,EA2BC,cAAC,MAAD;AACC,IAAA,SAAS,EAAC,oCADX;AAEC,IAAA,OAAO,EAAG,MAAMD,iBAAiB;AAFlC,KAIGZ,eAAe,CAACgB,OAAhB,CAAyB,GAAzB,CAJH,CA3BD,CADD;AAoCA;;AAED,eAAed,aAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { BlockIcon, store as blockEditorStore } from '@wordpress/block-editor';\nimport {\n\tButton,\n\tVisuallyHidden,\n\t__experimentalHStack as HStack,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { layout, chevronLeftSmall, chevronRightSmall } from '@wordpress/icons';\nimport { store as commandsStore } from '@wordpress/commands';\nimport { displayShortcut } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nfunction DocumentTitle() {\n\tconst { template, isEditing } = useSelect( ( select ) => {\n\t\tconst { isEditingTemplate, getEditedPostTemplate } =\n\t\t\tselect( editPostStore );\n\t\tconst _isEditing = isEditingTemplate();\n\n\t\treturn {\n\t\t\ttemplate: _isEditing ? getEditedPostTemplate() : null,\n\t\t\tisEditing: _isEditing,\n\t\t};\n\t}, [] );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst { setIsEditingTemplate } = useDispatch( editPostStore );\n\tconst { open: openCommandCenter } = useDispatch( commandsStore );\n\n\tif ( ! isEditing || ! template ) {\n\t\treturn null;\n\t}\n\n\tlet templateTitle = __( 'Default' );\n\tif ( template?.title ) {\n\t\ttemplateTitle = template.title;\n\t} else if ( !! template ) {\n\t\ttemplateTitle = template.slug;\n\t}\n\n\treturn (\n\t\t<div className=\"edit-post-document-title\">\n\t\t\t<span className=\"edit-post-document-title__left\">\n\t\t\t\t<Button\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t\tsetIsEditingTemplate( false );\n\t\t\t\t\t} }\n\t\t\t\t\ticon={ isRTL() ? chevronRightSmall : chevronLeftSmall }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Back' ) }\n\t\t\t\t</Button>\n\t\t\t</span>\n\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-post-document-title__title\"\n\t\t\t\tonClick={ () => openCommandCenter() }\n\t\t\t>\n\t\t\t\t<HStack spacing={ 1 } justify=\"center\">\n\t\t\t\t\t<BlockIcon icon={ layout } />\n\t\t\t\t\t<Text size=\"body\" as=\"h1\">\n\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t{ __( 'Editing template: ' ) }\n\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t{ templateTitle }\n\t\t\t\t\t</Text>\n\t\t\t\t</HStack>\n\t\t\t</Button>\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-post-document-title__shortcut\"\n\t\t\t\tonClick={ () => openCommandCenter() }\n\t\t\t>\n\t\t\t\t{ displayShortcut.primary( 'k' ) }\n\t\t\t</Button>\n\t\t</div>\n\t);\n}\n\nexport default DocumentTitle;\n"]}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
.blockHolderFullBordered {
|
|
2
|
-
border-top-width: $block-selected-border-width;
|
|
3
|
-
border-bottom-width: $block-selected-border-width;
|
|
4
|
-
border-left-width: $block-selected-border-width;
|
|
5
|
-
border-right-width: $block-selected-border-width;
|
|
6
|
-
border-radius: 4px;
|
|
7
|
-
border-style: solid;
|
|
8
|
-
margin-left: 4px;
|
|
9
|
-
margin-right: 4px;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.blockHolderFocused {
|
|
13
|
-
border-color: $blue-wordpress;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.blockHolderFocusedDark {
|
|
17
|
-
border-color: $blue-30;
|
|
18
|
-
}
|