@wordpress/edit-post 8.45.1-next.v.202605131032.0 → 8.47.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/back-button/fullscreen-mode-close.cjs +10 -3
- package/build/components/back-button/fullscreen-mode-close.cjs.map +3 -3
- package/build/components/layout/index.cjs +34 -21
- package/build/components/layout/index.cjs.map +3 -3
- package/build/components/meta-boxes/meta-boxes-area/index.cjs +1 -1
- package/build/components/meta-boxes/meta-boxes-area/index.cjs.map +2 -2
- package/build/components/meta-boxes/use-meta-box-initialization.cjs +21 -7
- package/build/components/meta-boxes/use-meta-box-initialization.cjs.map +2 -2
- package/build/index.cjs +120 -9
- package/build/index.cjs.map +3 -3
- package/build-module/components/back-button/fullscreen-mode-close.mjs +21 -8
- package/build-module/components/back-button/fullscreen-mode-close.mjs.map +2 -2
- package/build-module/components/layout/index.mjs +37 -25
- package/build-module/components/layout/index.mjs.map +2 -2
- package/build-module/components/meta-boxes/meta-boxes-area/index.mjs +1 -1
- package/build-module/components/meta-boxes/meta-boxes-area/index.mjs.map +2 -2
- package/build-module/components/meta-boxes/use-meta-box-initialization.mjs +21 -7
- package/build-module/components/meta-boxes/use-meta-box-initialization.mjs.map +2 -2
- package/build-module/index.mjs +121 -10
- package/build-module/index.mjs.map +2 -2
- package/build-style/experimental-admin-bar-in-editor-rtl.css +50 -0
- package/build-style/experimental-admin-bar-in-editor.css +50 -0
- package/build-style/style-rtl.css +53 -2
- package/build-style/style.css +53 -2
- package/package.json +36 -36
- package/src/components/back-button/fullscreen-mode-close.js +39 -21
- package/src/components/layout/index.js +75 -66
- package/src/components/layout/index.native.js +3 -3
- package/src/components/meta-boxes/meta-boxes-area/index.js +3 -1
- package/src/components/meta-boxes/meta-boxes-area/style.scss +4 -4
- package/src/components/meta-boxes/test/use-meta-box-initialization.js +31 -0
- package/src/components/meta-boxes/use-meta-box-initialization.js +30 -11
- package/src/experimental-admin-bar-in-editor.scss +67 -0
- package/src/index.js +155 -11
- package/src/style.scss +1 -0
|
@@ -9,12 +9,18 @@ import clsx from 'clsx';
|
|
|
9
9
|
import { useSelect } from '@wordpress/data';
|
|
10
10
|
import {
|
|
11
11
|
Button,
|
|
12
|
-
Icon,
|
|
12
|
+
Icon as WCIcon,
|
|
13
13
|
__unstableMotion as motion,
|
|
14
14
|
} from '@wordpress/components';
|
|
15
|
-
import { __ } from '@wordpress/i18n';
|
|
15
|
+
import { __, isRTL } from '@wordpress/i18n';
|
|
16
16
|
import { addQueryArgs } from '@wordpress/url';
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
wordpress,
|
|
19
|
+
arrowUpLeft,
|
|
20
|
+
arrowUpRight,
|
|
21
|
+
chevronLeft,
|
|
22
|
+
chevronRight,
|
|
23
|
+
} from '@wordpress/icons';
|
|
18
24
|
import { store as editorStore } from '@wordpress/editor';
|
|
19
25
|
import { store as coreStore } from '@wordpress/core-data';
|
|
20
26
|
import { useReducedMotion } from '@wordpress/compose';
|
|
@@ -90,7 +96,7 @@ function FullscreenModeClose( { showTooltip, icon, href, initialPost } ) {
|
|
|
90
96
|
);
|
|
91
97
|
} else {
|
|
92
98
|
siteIconContent = (
|
|
93
|
-
<
|
|
99
|
+
<WCIcon
|
|
94
100
|
className="edit-post-fullscreen-mode-close-site-icon__icon"
|
|
95
101
|
icon={ wordpress }
|
|
96
102
|
size={ 48 }
|
|
@@ -100,7 +106,7 @@ function FullscreenModeClose( { showTooltip, icon, href, initialPost } ) {
|
|
|
100
106
|
|
|
101
107
|
// Override default icon if custom icon is provided via props.
|
|
102
108
|
const buttonIcon = icon ? (
|
|
103
|
-
<
|
|
109
|
+
<WCIcon size="36px" icon={ icon } />
|
|
104
110
|
) : (
|
|
105
111
|
<div className="edit-post-fullscreen-mode-close-site-icon">
|
|
106
112
|
{ siteIconContent }
|
|
@@ -119,6 +125,8 @@ function FullscreenModeClose( { showTooltip, icon, href, initialPost } ) {
|
|
|
119
125
|
|
|
120
126
|
const buttonLabel = postType?.labels?.view_items ?? __( 'Back' );
|
|
121
127
|
|
|
128
|
+
const hasAdminBarInEditor = window.__experimentalAdminBarInEditor;
|
|
129
|
+
|
|
122
130
|
return (
|
|
123
131
|
<motion.div
|
|
124
132
|
className="edit-post-fullscreen-mode-close__view-mode-toggle"
|
|
@@ -136,23 +144,33 @@ function FullscreenModeClose( { showTooltip, icon, href, initialPost } ) {
|
|
|
136
144
|
showTooltip={ showTooltip }
|
|
137
145
|
tooltipPosition="bottom"
|
|
138
146
|
>
|
|
139
|
-
|
|
140
|
-
<div
|
|
141
|
-
{
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
'edit-post-fullscreen-mode-close__back-icon',
|
|
148
|
-
{
|
|
149
|
-
'has-site-icon': siteIconUrl,
|
|
150
|
-
}
|
|
147
|
+
{ ! hasAdminBarInEditor && (
|
|
148
|
+
<motion.div
|
|
149
|
+
variants={ ! disableMotion && siteIconVariants }
|
|
150
|
+
>
|
|
151
|
+
<div className="edit-post-fullscreen-mode-close__view-mode-toggle-icon">
|
|
152
|
+
{ buttonIcon }
|
|
153
|
+
</div>
|
|
154
|
+
</motion.div>
|
|
151
155
|
) }
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
<
|
|
155
|
-
|
|
156
|
+
</Button>
|
|
157
|
+
{ hasAdminBarInEditor ? (
|
|
158
|
+
<div className="edit-post-fullscreen-mode-close__back-icon">
|
|
159
|
+
<WCIcon icon={ isRTL() ? chevronRight : chevronLeft } />
|
|
160
|
+
</div>
|
|
161
|
+
) : (
|
|
162
|
+
<motion.div
|
|
163
|
+
className={ clsx(
|
|
164
|
+
'edit-post-fullscreen-mode-close__back-icon',
|
|
165
|
+
{
|
|
166
|
+
'has-site-icon': siteIconUrl,
|
|
167
|
+
}
|
|
168
|
+
) }
|
|
169
|
+
variants={ ! disableMotion && toggleHomeIconVariants }
|
|
170
|
+
>
|
|
171
|
+
<WCIcon icon={ isRTL() ? arrowUpRight : arrowUpLeft } />
|
|
172
|
+
</motion.div>
|
|
173
|
+
) }
|
|
156
174
|
</motion.div>
|
|
157
175
|
);
|
|
158
176
|
}
|
|
@@ -38,9 +38,8 @@ import { addQueryArgs } from '@wordpress/url';
|
|
|
38
38
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
39
39
|
import { store as coreStore } from '@wordpress/core-data';
|
|
40
40
|
import {
|
|
41
|
-
Icon,
|
|
41
|
+
Icon as WCIcon,
|
|
42
42
|
SlotFillProvider,
|
|
43
|
-
Tooltip,
|
|
44
43
|
__unstableUseNavigateRegions as useNavigateRegions,
|
|
45
44
|
privateApis as componentsPrivateApis,
|
|
46
45
|
} from '@wordpress/components';
|
|
@@ -50,7 +49,8 @@ import {
|
|
|
50
49
|
useRefEffect,
|
|
51
50
|
useViewportMatch,
|
|
52
51
|
} from '@wordpress/compose';
|
|
53
|
-
|
|
52
|
+
// eslint-disable-next-line @wordpress/use-recommended-components -- `Tooltip` is not yet on the recommended `@wordpress/ui` allow-list; landing as a migration step ahead of the wider rollout.
|
|
53
|
+
import { Tooltip, VisuallyHidden } from '@wordpress/ui';
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
56
|
* Internal dependencies
|
|
@@ -162,8 +162,8 @@ function MetaBoxesMain( { isLegacy } ) {
|
|
|
162
162
|
if ( ! container ) {
|
|
163
163
|
return;
|
|
164
164
|
}
|
|
165
|
-
const
|
|
166
|
-
':scope > .
|
|
165
|
+
const noticeContainer = container.querySelector(
|
|
166
|
+
':scope > .notices-inline-notices-wrapper'
|
|
167
167
|
);
|
|
168
168
|
const resizeHandle = container.querySelector(
|
|
169
169
|
'.edit-post-meta-boxes-main__presenter'
|
|
@@ -171,16 +171,16 @@ function MetaBoxesMain( { isLegacy } ) {
|
|
|
171
171
|
const deriveConstraints = () => {
|
|
172
172
|
const fullHeight = container.offsetHeight;
|
|
173
173
|
let nextMax = fullHeight;
|
|
174
|
-
|
|
175
|
-
nextMax -=
|
|
174
|
+
if ( noticeContainer ) {
|
|
175
|
+
nextMax -= noticeContainer.offsetHeight;
|
|
176
176
|
}
|
|
177
|
-
const nextMin = resizeHandle
|
|
177
|
+
const nextMin = resizeHandle?.offsetHeight ?? 0;
|
|
178
178
|
setHeightConstraints( { min: nextMin, max: nextMax } );
|
|
179
179
|
};
|
|
180
180
|
const observer = new window.ResizeObserver( deriveConstraints );
|
|
181
181
|
observer.observe( container );
|
|
182
|
-
|
|
183
|
-
observer.observe(
|
|
182
|
+
if ( noticeContainer ) {
|
|
183
|
+
observer.observe( noticeContainer );
|
|
184
184
|
}
|
|
185
185
|
return () => observer.disconnect();
|
|
186
186
|
}, [] );
|
|
@@ -321,23 +321,28 @@ function MetaBoxesMain( { isLegacy } ) {
|
|
|
321
321
|
{ ...( ! isShort && bindDragGesture( persistIsOpen ) ) }
|
|
322
322
|
>
|
|
323
323
|
{ paneLabel }
|
|
324
|
-
<
|
|
324
|
+
<WCIcon icon={ isOpen ? chevronUp : chevronDown } />
|
|
325
325
|
</button>
|
|
326
326
|
);
|
|
327
327
|
|
|
328
328
|
// The separator button that provides a11y for resizing.
|
|
329
329
|
const separator = ! isShort && (
|
|
330
330
|
<>
|
|
331
|
-
<Tooltip
|
|
332
|
-
<
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
331
|
+
<Tooltip.Root>
|
|
332
|
+
<Tooltip.Trigger
|
|
333
|
+
render={
|
|
334
|
+
<button
|
|
335
|
+
ref={ separatorRef }
|
|
336
|
+
role="separator" // eslint-disable-line jsx-a11y/no-interactive-element-to-noninteractive-role
|
|
337
|
+
aria-valuenow={ usedAriaValueNow }
|
|
338
|
+
aria-label={ __( 'Drag to resize' ) }
|
|
339
|
+
aria-describedby={ separatorHelpId }
|
|
340
|
+
{ ...bindDragGesture() }
|
|
341
|
+
/>
|
|
342
|
+
}
|
|
339
343
|
/>
|
|
340
|
-
|
|
344
|
+
<Tooltip.Popup>{ __( 'Drag to resize' ) }</Tooltip.Popup>
|
|
345
|
+
</Tooltip.Root>
|
|
341
346
|
<VisuallyHidden id={ separatorHelpId }>
|
|
342
347
|
{ __(
|
|
343
348
|
'Use up and down arrow keys to resize the meta box pane.'
|
|
@@ -572,52 +577,56 @@ function Layout( {
|
|
|
572
577
|
|
|
573
578
|
return (
|
|
574
579
|
<SlotFillProvider>
|
|
575
|
-
<
|
|
576
|
-
<
|
|
577
|
-
|
|
578
|
-
<
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
<
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
580
|
+
<Tooltip.Provider>
|
|
581
|
+
<ErrorBoundary canCopyContent>
|
|
582
|
+
<WelcomeGuide postType={ currentPostType } />
|
|
583
|
+
<div { ...navigateRegionsProps }>
|
|
584
|
+
<Editor
|
|
585
|
+
settings={ editorSettings }
|
|
586
|
+
initialEdits={ initialEdits }
|
|
587
|
+
postType={ currentPostType }
|
|
588
|
+
postId={ currentPostId }
|
|
589
|
+
templateId={ templateId }
|
|
590
|
+
className={ className }
|
|
591
|
+
forceIsDirty={ hasActiveMetaboxes }
|
|
592
|
+
disableIframe={ ! shouldIframe }
|
|
593
|
+
// We should auto-focus the canvas (title) on load.
|
|
594
|
+
// eslint-disable-next-line jsx-a11y/no-autofocus
|
|
595
|
+
autoFocus={ ! isWelcomeGuideVisible }
|
|
596
|
+
onActionPerformed={ onActionPerformed }
|
|
597
|
+
extraSidebarPanels={
|
|
598
|
+
showMetaBoxes && <MetaBoxes location="side" />
|
|
599
|
+
}
|
|
600
|
+
extraContent={
|
|
601
|
+
! isDistractionFree &&
|
|
602
|
+
showMetaBoxes && (
|
|
603
|
+
<MetaBoxesMain
|
|
604
|
+
isLegacy={ isDevicePreview }
|
|
605
|
+
/>
|
|
606
|
+
)
|
|
607
|
+
}
|
|
608
|
+
>
|
|
609
|
+
<PostLockedModal />
|
|
610
|
+
<EditorInitialization />
|
|
611
|
+
<FullscreenMode isActive={ isFullscreenActive } />
|
|
612
|
+
<BrowserURL />
|
|
613
|
+
<UnsavedChangesWarning />
|
|
614
|
+
<AutosaveMonitor />
|
|
615
|
+
<LocalAutosaveMonitor />
|
|
616
|
+
<EditPostKeyboardShortcuts />
|
|
617
|
+
<EditorKeyboardShortcutsRegister />
|
|
618
|
+
<BlockKeyboardShortcuts />
|
|
619
|
+
{ currentPostType === 'wp_block' && (
|
|
620
|
+
<InitPatternModal />
|
|
621
|
+
) }
|
|
622
|
+
<PluginArea onError={ onPluginAreaError } />
|
|
623
|
+
<PostEditorMoreMenu />
|
|
624
|
+
{ backButton }
|
|
625
|
+
<SnackbarNotices className="edit-post-layout__snackbar" />
|
|
626
|
+
</Editor>
|
|
627
|
+
</div>
|
|
628
|
+
</ErrorBoundary>
|
|
629
|
+
</Tooltip.Provider>
|
|
621
630
|
</SlotFillProvider>
|
|
622
631
|
);
|
|
623
632
|
}
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
HTMLTextInput,
|
|
20
20
|
KeyboardAvoidingView,
|
|
21
21
|
NoticeList,
|
|
22
|
-
Tooltip,
|
|
22
|
+
Tooltip as WCTooltip,
|
|
23
23
|
__unstableAutocompletionItemsSlot as AutocompletionItemsSlot,
|
|
24
24
|
} from '@wordpress/components';
|
|
25
25
|
import {
|
|
@@ -145,7 +145,7 @@ class Layout extends Component {
|
|
|
145
145
|
];
|
|
146
146
|
|
|
147
147
|
return (
|
|
148
|
-
<
|
|
148
|
+
<WCTooltip.Slot>
|
|
149
149
|
<SafeAreaView
|
|
150
150
|
style={ containerStyles }
|
|
151
151
|
onLayout={ this.onRootViewLayout }
|
|
@@ -184,7 +184,7 @@ class Layout extends Component {
|
|
|
184
184
|
) }
|
|
185
185
|
{ Platform.OS === 'android' && <AutocompletionItemsSlot /> }
|
|
186
186
|
</SafeAreaView>
|
|
187
|
-
</
|
|
187
|
+
</WCTooltip.Slot>
|
|
188
188
|
);
|
|
189
189
|
}
|
|
190
190
|
}
|
|
@@ -54,7 +54,9 @@ function MetaBoxesArea( { location } ) {
|
|
|
54
54
|
|
|
55
55
|
return (
|
|
56
56
|
<div className={ classes }>
|
|
57
|
-
{ isSaving &&
|
|
57
|
+
{ isSaving && (
|
|
58
|
+
<Spinner className="edit-post-meta-boxes-area__spinner" />
|
|
59
|
+
) }
|
|
58
60
|
<div
|
|
59
61
|
className="edit-post-meta-boxes-area__container"
|
|
60
62
|
ref={ container }
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
@use "@wordpress/base-styles/colors" as *;
|
|
2
2
|
@use "@wordpress/base-styles/variables" as *;
|
|
3
|
-
@use "@wordpress/base-styles/z-index" as *;
|
|
4
3
|
|
|
5
4
|
.edit-post-meta-boxes-area {
|
|
6
5
|
position: relative;
|
|
@@ -64,6 +63,7 @@
|
|
|
64
63
|
width: 44px;
|
|
65
64
|
}
|
|
66
65
|
|
|
66
|
+
// Block interaction with meta boxes while they are being saved.
|
|
67
67
|
&.is-loading::before {
|
|
68
68
|
position: absolute;
|
|
69
69
|
top: 0;
|
|
@@ -72,14 +72,14 @@
|
|
|
72
72
|
bottom: 0;
|
|
73
73
|
content: "";
|
|
74
74
|
background: transparent;
|
|
75
|
-
z-index:
|
|
75
|
+
z-index: 1;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
.
|
|
78
|
+
.edit-post-meta-boxes-area__spinner {
|
|
79
79
|
position: absolute;
|
|
80
80
|
top: 10px;
|
|
81
81
|
right: 20px;
|
|
82
|
-
z-index:
|
|
82
|
+
z-index: 2; // Stack above the .is-loading::before overlay.
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
// Hide disabled meta boxes using CSS so that we don't interfere with plugins
|
|
@@ -35,6 +35,10 @@ const initializeMetaBoxes = jest.fn( () => ( {
|
|
|
35
35
|
type: 'META_BOXES_INITIALIZED',
|
|
36
36
|
} ) );
|
|
37
37
|
|
|
38
|
+
const updateEditorSettings = jest.fn( () => ( {
|
|
39
|
+
type: 'UPDATE_EDITOR_SETTINGS',
|
|
40
|
+
} ) );
|
|
41
|
+
|
|
38
42
|
function createMockStores( {
|
|
39
43
|
isEditorReady = true,
|
|
40
44
|
isCollaborationEnabled = true,
|
|
@@ -43,6 +47,10 @@ function createMockStores( {
|
|
|
43
47
|
return {
|
|
44
48
|
'core/editor': {
|
|
45
49
|
...storeConfig,
|
|
50
|
+
actions: {
|
|
51
|
+
...storeConfig.actions,
|
|
52
|
+
updateEditorSettings,
|
|
53
|
+
},
|
|
46
54
|
selectors: {
|
|
47
55
|
__unstableIsEditorReady: jest.fn( () => isEditorReady ),
|
|
48
56
|
isCollaborationEnabledForCurrentPost: jest.fn(
|
|
@@ -91,6 +99,7 @@ describe( 'useMetaBoxInitialization', () => {
|
|
|
91
99
|
afterEach( () => {
|
|
92
100
|
setCollaborationSupported.mockClear();
|
|
93
101
|
initializeMetaBoxes.mockClear();
|
|
102
|
+
updateEditorSettings.mockClear();
|
|
94
103
|
} );
|
|
95
104
|
|
|
96
105
|
it( 'disables collaboration when metaboxes are present', () => {
|
|
@@ -188,4 +197,26 @@ describe( 'useMetaBoxInitialization', () => {
|
|
|
188
197
|
|
|
189
198
|
expect( setCollaborationSupported ).not.toHaveBeenCalled();
|
|
190
199
|
} );
|
|
200
|
+
|
|
201
|
+
it( 'disables visual revisions when metaboxes are present', () => {
|
|
202
|
+
const mockStores = createMockStores( {
|
|
203
|
+
metaBoxes: [ { id: 'my-metabox', title: 'My Meta Box' } ],
|
|
204
|
+
} );
|
|
205
|
+
const registry = createRegistry( mockStores );
|
|
206
|
+
|
|
207
|
+
renderHook( registry );
|
|
208
|
+
|
|
209
|
+
expect( updateEditorSettings ).toHaveBeenCalledWith( {
|
|
210
|
+
disableVisualRevisions: true,
|
|
211
|
+
} );
|
|
212
|
+
} );
|
|
213
|
+
|
|
214
|
+
it( 'does not disable visual revisions when there are no metaboxes', () => {
|
|
215
|
+
const mockStores = createMockStores( { metaBoxes: [] } );
|
|
216
|
+
const registry = createRegistry( mockStores );
|
|
217
|
+
|
|
218
|
+
renderHook( registry );
|
|
219
|
+
|
|
220
|
+
expect( updateEditorSettings ).not.toHaveBeenCalled();
|
|
221
|
+
} );
|
|
191
222
|
} );
|
|
@@ -22,21 +22,29 @@ export const useMetaBoxInitialization = ( enabled ) => {
|
|
|
22
22
|
isEnabledAndEditorReady,
|
|
23
23
|
isCollaborationEnabled,
|
|
24
24
|
hasIncompatibleMetaBoxes,
|
|
25
|
+
hasActiveMetaBoxes,
|
|
25
26
|
} = useSelect(
|
|
26
|
-
( select ) =>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
27
|
+
( select ) => {
|
|
28
|
+
const {
|
|
29
|
+
__unstableIsEditorReady,
|
|
30
|
+
isCollaborationEnabledForCurrentPost,
|
|
31
|
+
} = unlock( select( editorStore ) );
|
|
32
|
+
return {
|
|
33
|
+
isEnabledAndEditorReady: enabled && __unstableIsEditorReady(),
|
|
34
|
+
isCollaborationEnabled: isCollaborationEnabledForCurrentPost(),
|
|
35
|
+
hasIncompatibleMetaBoxes: enabled
|
|
36
|
+
? select( editPostStore )
|
|
37
|
+
.getAllMetaBoxes()
|
|
38
|
+
.some( ( metaBox ) => ! metaBox.__rtc_compatible )
|
|
39
|
+
: false,
|
|
40
|
+
hasActiveMetaBoxes:
|
|
41
|
+
enabled && select( editPostStore ).hasMetaBoxes(),
|
|
42
|
+
};
|
|
43
|
+
},
|
|
37
44
|
[ enabled ]
|
|
38
45
|
);
|
|
39
46
|
const { setCollaborationSupported } = unlock( useDispatch( coreStore ) );
|
|
47
|
+
const { updateEditorSettings } = useDispatch( editorStore );
|
|
40
48
|
const { initializeMetaBoxes } = useDispatch( editPostStore );
|
|
41
49
|
|
|
42
50
|
// The effect has to rerun when the editor is ready because initializeMetaBoxes
|
|
@@ -49,6 +57,15 @@ export const useMetaBoxInitialization = ( enabled ) => {
|
|
|
49
57
|
if ( isCollaborationEnabled && hasIncompatibleMetaBoxes ) {
|
|
50
58
|
setCollaborationSupported( false );
|
|
51
59
|
}
|
|
60
|
+
|
|
61
|
+
// Classic meta box values are saved through a separate
|
|
62
|
+
// admin-ajax submission that the in-editor revisions restore
|
|
63
|
+
// does not drive, so visual revisions would silently leave
|
|
64
|
+
// them untouched. Fall back to the classic revision.php
|
|
65
|
+
// admin screen instead.
|
|
66
|
+
if ( hasActiveMetaBoxes ) {
|
|
67
|
+
updateEditorSettings( { disableVisualRevisions: true } );
|
|
68
|
+
}
|
|
52
69
|
}
|
|
53
70
|
}, [
|
|
54
71
|
isEnabledAndEditorReady,
|
|
@@ -56,5 +73,7 @@ export const useMetaBoxInitialization = ( enabled ) => {
|
|
|
56
73
|
isCollaborationEnabled,
|
|
57
74
|
setCollaborationSupported,
|
|
58
75
|
hasIncompatibleMetaBoxes,
|
|
76
|
+
hasActiveMetaBoxes,
|
|
77
|
+
updateEditorSettings,
|
|
59
78
|
] );
|
|
60
79
|
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Styles for the experimental admin bar in editor.
|
|
2
|
+
|
|
3
|
+
body.has-admin-bar-in-editor {
|
|
4
|
+
.edit-post-fullscreen-mode-close__view-mode-toggle {
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
width: 32px;
|
|
9
|
+
height: 32px;
|
|
10
|
+
|
|
11
|
+
.edit-post-fullscreen-mode-close__back-icon {
|
|
12
|
+
top: auto;
|
|
13
|
+
left: auto;
|
|
14
|
+
width: 32px;
|
|
15
|
+
height: 32px;
|
|
16
|
+
background: transparent;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&:hover .edit-post-fullscreen-mode-close__back-icon {
|
|
20
|
+
color: var(--wp-admin-theme-color);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&.is-fullscreen-mode {
|
|
25
|
+
.editor-header:has(> .editor-header__back-button) {
|
|
26
|
+
grid-template-columns: 32px minmax(0, max-content) minmax(min-content, 1fr) 64px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.editor-header:has(> .editor-header__back-button):has(> .editor-header__center) {
|
|
30
|
+
grid-template-columns: 32px min-content 1fr min-content 64px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.editor-header__back-button {
|
|
34
|
+
padding-left: 8px;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@media (min-width: 782px) {
|
|
39
|
+
&.is-fullscreen-mode {
|
|
40
|
+
margin-top: 0;
|
|
41
|
+
height: 100%;
|
|
42
|
+
|
|
43
|
+
#wpadminbar {
|
|
44
|
+
display: block;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.interface-interface-skeleton,
|
|
48
|
+
.editor-post-publish-panel,
|
|
49
|
+
.is-entity-save-view-open .interface-interface-skeleton__actions:focus,
|
|
50
|
+
.is-entity-save-view-open .interface-interface-skeleton__actions:focus-within {
|
|
51
|
+
top: var(--wp-admin--admin-bar--height, 0);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.block-editor__container {
|
|
55
|
+
min-height: calc(100vh - var(--wp-admin--admin-bar--height, 0));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&:has(.editor-editor-interface.is-distraction-free) {
|
|
59
|
+
--wp-admin--admin-bar--height: 0;
|
|
60
|
+
|
|
61
|
+
#wpadminbar {
|
|
62
|
+
display: none;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|