@wordpress/edit-post 8.8.7 → 8.8.9
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/build/components/layout/index.js +151 -140
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/use-padding-appender.js +13 -4
- package/build/components/layout/use-padding-appender.js.map +1 -1
- package/build/index.js +1 -3
- package/build/index.js.map +1 -1
- package/build/store/actions.js +1 -1
- package/build/store/actions.js.map +1 -1
- package/build-module/components/layout/index.js +152 -141
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/use-padding-appender.js +13 -4
- package/build-module/components/layout/use-padding-appender.js.map +1 -1
- package/build-module/index.js +1 -3
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +1 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-style/style-rtl.css +65 -29
- package/build-style/style.css +65 -29
- package/package.json +13 -13
- package/src/components/layout/index.js +148 -141
- package/src/components/layout/style.scss +83 -43
- package/src/components/layout/use-padding-appender.js +13 -4
- package/src/index.js +0 -2
- package/src/store/actions.js +1 -1
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
useRef,
|
|
32
32
|
useState,
|
|
33
33
|
} from '@wordpress/element';
|
|
34
|
+
import { chevronDown, chevronUp } from '@wordpress/icons';
|
|
34
35
|
import { store as noticesStore } from '@wordpress/notices';
|
|
35
36
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
36
37
|
import {
|
|
@@ -43,10 +44,12 @@ import { addQueryArgs } from '@wordpress/url';
|
|
|
43
44
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
44
45
|
import { store as coreStore } from '@wordpress/core-data';
|
|
45
46
|
import {
|
|
47
|
+
Icon,
|
|
46
48
|
ResizableBox,
|
|
47
49
|
SlotFillProvider,
|
|
48
50
|
Tooltip,
|
|
49
51
|
VisuallyHidden,
|
|
52
|
+
__unstableUseNavigateRegions as useNavigateRegions,
|
|
50
53
|
} from '@wordpress/components';
|
|
51
54
|
import {
|
|
52
55
|
useMediaQuery,
|
|
@@ -75,7 +78,7 @@ import useNavigateToEntityRecord from '../../hooks/use-navigate-to-entity-record
|
|
|
75
78
|
const { getLayoutStyles } = unlock( blockEditorPrivateApis );
|
|
76
79
|
const { useCommands } = unlock( coreCommandsPrivateApis );
|
|
77
80
|
const { useCommandContext } = unlock( commandsPrivateApis );
|
|
78
|
-
const { Editor, FullscreenMode } = unlock( editorPrivateApis );
|
|
81
|
+
const { Editor, FullscreenMode, NavigableRegion } = unlock( editorPrivateApis );
|
|
79
82
|
const { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );
|
|
80
83
|
const DESIGN_POST_TYPES = [
|
|
81
84
|
'wp_template',
|
|
@@ -183,7 +186,7 @@ function MetaBoxesMain( { isLegacy } ) {
|
|
|
183
186
|
];
|
|
184
187
|
}, [] );
|
|
185
188
|
const { set: setPreference } = useDispatch( preferencesStore );
|
|
186
|
-
const
|
|
189
|
+
const metaBoxesMainRef = useRef();
|
|
187
190
|
const isShort = useMediaQuery( '(max-height: 549px)' );
|
|
188
191
|
|
|
189
192
|
const [ { min, max }, setHeightConstraints ] = useState( () => ( {} ) );
|
|
@@ -198,9 +201,9 @@ function MetaBoxesMain( { isLegacy } ) {
|
|
|
198
201
|
':scope > .components-notice-list'
|
|
199
202
|
);
|
|
200
203
|
const resizeHandle = container.querySelector(
|
|
201
|
-
'.edit-post-meta-boxes-
|
|
204
|
+
'.edit-post-meta-boxes-main__presenter'
|
|
202
205
|
);
|
|
203
|
-
const
|
|
206
|
+
const deriveConstraints = () => {
|
|
204
207
|
const fullHeight = container.offsetHeight;
|
|
205
208
|
let nextMax = fullHeight;
|
|
206
209
|
for ( const element of noticeLists ) {
|
|
@@ -209,7 +212,7 @@ function MetaBoxesMain( { isLegacy } ) {
|
|
|
209
212
|
const nextMin = resizeHandle.offsetHeight;
|
|
210
213
|
setHeightConstraints( { min: nextMin, max: nextMax } );
|
|
211
214
|
};
|
|
212
|
-
const observer = new window.ResizeObserver(
|
|
215
|
+
const observer = new window.ResizeObserver( deriveConstraints );
|
|
213
216
|
observer.observe( container );
|
|
214
217
|
for ( const element of noticeLists ) {
|
|
215
218
|
observer.observe( element );
|
|
@@ -221,12 +224,33 @@ function MetaBoxesMain( { isLegacy } ) {
|
|
|
221
224
|
const separatorHelpId = useId();
|
|
222
225
|
|
|
223
226
|
const [ isUntouched, setIsUntouched ] = useState( true );
|
|
227
|
+
const applyHeight = ( candidateHeight, isPersistent, isInstant ) => {
|
|
228
|
+
const nextHeight = Math.min( max, Math.max( min, candidateHeight ) );
|
|
229
|
+
if ( isPersistent ) {
|
|
230
|
+
setPreference(
|
|
231
|
+
'core/edit-post',
|
|
232
|
+
'metaBoxesMainOpenHeight',
|
|
233
|
+
nextHeight
|
|
234
|
+
);
|
|
235
|
+
} else {
|
|
236
|
+
separatorRef.current.ariaValueNow = getAriaValueNow( nextHeight );
|
|
237
|
+
}
|
|
238
|
+
if ( isInstant ) {
|
|
239
|
+
metaBoxesMainRef.current.updateSize( {
|
|
240
|
+
height: nextHeight,
|
|
241
|
+
// Oddly, when the event that triggered this was not from the mouse (e.g. keydown),
|
|
242
|
+
// if `width` is left unspecified a subsequent drag gesture applies a fixed
|
|
243
|
+
// width and the pane fails to widen/narrow with parent width changes from
|
|
244
|
+
// sidebars opening/closing or window resizes.
|
|
245
|
+
width: 'auto',
|
|
246
|
+
} );
|
|
247
|
+
}
|
|
248
|
+
};
|
|
224
249
|
|
|
225
250
|
if ( ! hasAnyVisible ) {
|
|
226
251
|
return;
|
|
227
252
|
}
|
|
228
253
|
|
|
229
|
-
const className = 'edit-post-meta-boxes-main';
|
|
230
254
|
const contents = (
|
|
231
255
|
<div
|
|
232
256
|
className={ clsx(
|
|
@@ -234,6 +258,7 @@ function MetaBoxesMain( { isLegacy } ) {
|
|
|
234
258
|
'edit-post-layout__metaboxes',
|
|
235
259
|
! isLegacy && 'edit-post-meta-boxes-main__liner'
|
|
236
260
|
) }
|
|
261
|
+
hidden={ ! isLegacy && isShort && ! isOpen }
|
|
237
262
|
>
|
|
238
263
|
<MetaBoxes location="normal" />
|
|
239
264
|
<MetaBoxes location="advanced" />
|
|
@@ -256,59 +281,39 @@ function MetaBoxesMain( { isLegacy } ) {
|
|
|
256
281
|
const usedAriaValueNow =
|
|
257
282
|
max === undefined || isAutoHeight ? 50 : getAriaValueNow( openHeight );
|
|
258
283
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
<details
|
|
262
|
-
className={ className }
|
|
263
|
-
open={ isOpen }
|
|
264
|
-
onToggle={ ( { target } ) => {
|
|
265
|
-
setPreference(
|
|
266
|
-
'core/edit-post',
|
|
267
|
-
'metaBoxesMainIsOpen',
|
|
268
|
-
target.open
|
|
269
|
-
);
|
|
270
|
-
} }
|
|
271
|
-
>
|
|
272
|
-
<summary>{ __( 'Meta Boxes' ) }</summary>
|
|
273
|
-
{ contents }
|
|
274
|
-
</details>
|
|
275
|
-
);
|
|
276
|
-
}
|
|
284
|
+
const toggle = () =>
|
|
285
|
+
setPreference( 'core/edit-post', 'metaBoxesMainIsOpen', ! isOpen );
|
|
277
286
|
|
|
278
287
|
// TODO: Support more/all keyboard interactions from the window splitter pattern:
|
|
279
288
|
// https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/
|
|
280
289
|
const onSeparatorKeyDown = ( event ) => {
|
|
281
290
|
const delta = { ArrowUp: 20, ArrowDown: -20 }[ event.key ];
|
|
282
291
|
if ( delta ) {
|
|
283
|
-
const
|
|
284
|
-
const fromHeight = isAutoHeight
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
max,
|
|
289
|
-
Math.max( min, delta + fromHeight )
|
|
290
|
-
);
|
|
291
|
-
resizableBoxRef.current.updateSize( {
|
|
292
|
-
height: nextHeight,
|
|
293
|
-
// Oddly, if left unspecified a subsequent drag gesture applies a fixed
|
|
294
|
-
// width and the pane fails to shrink/grow with parent width changes from
|
|
295
|
-
// sidebars opening/closing or window resizes.
|
|
296
|
-
width: 'auto',
|
|
297
|
-
} );
|
|
298
|
-
setPreference(
|
|
299
|
-
'core/edit-post',
|
|
300
|
-
'metaBoxesMainOpenHeight',
|
|
301
|
-
nextHeight
|
|
302
|
-
);
|
|
292
|
+
const pane = metaBoxesMainRef.current.resizable;
|
|
293
|
+
const fromHeight = isAutoHeight ? pane.offsetHeight : openHeight;
|
|
294
|
+
const nextHeight = delta + fromHeight;
|
|
295
|
+
applyHeight( nextHeight, true, true );
|
|
296
|
+
event.preventDefault();
|
|
303
297
|
}
|
|
304
298
|
};
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
299
|
+
const className = 'edit-post-meta-boxes-main';
|
|
300
|
+
const paneLabel = __( 'Meta Boxes' );
|
|
301
|
+
let Pane, paneProps;
|
|
302
|
+
if ( isShort ) {
|
|
303
|
+
Pane = NavigableRegion;
|
|
304
|
+
paneProps = {
|
|
305
|
+
className: clsx( className, 'is-toggle-only' ),
|
|
306
|
+
};
|
|
307
|
+
} else {
|
|
308
|
+
Pane = ResizableBox;
|
|
309
|
+
paneProps = /** @type {Parameters<typeof ResizableBox>[0]} */ ( {
|
|
310
|
+
as: NavigableRegion,
|
|
311
|
+
ref: metaBoxesMainRef,
|
|
312
|
+
className: clsx( className, 'is-resizable' ),
|
|
313
|
+
defaultSize: { height: openHeight },
|
|
314
|
+
minHeight: min,
|
|
315
|
+
maxHeight: usedMax,
|
|
316
|
+
enable: {
|
|
312
317
|
top: true,
|
|
313
318
|
right: false,
|
|
314
319
|
bottom: false,
|
|
@@ -317,72 +322,66 @@ function MetaBoxesMain( { isLegacy } ) {
|
|
|
317
322
|
topRight: false,
|
|
318
323
|
bottomRight: false,
|
|
319
324
|
bottomLeft: false,
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
bounds="parent"
|
|
324
|
-
boundsByDirection
|
|
325
|
-
// Avoids hiccups while dragging over objects like iframes and ensures that
|
|
326
|
-
// the event to end the drag is captured by the target (resize handle)
|
|
327
|
-
// whether or not it’s under the pointer.
|
|
328
|
-
onPointerDown={ ( { pointerId, target } ) => {
|
|
329
|
-
target.setPointerCapture( pointerId );
|
|
330
|
-
} }
|
|
331
|
-
onResizeStart={ ( event, direction, elementRef ) => {
|
|
332
|
-
if ( isAutoHeight ) {
|
|
333
|
-
const heightNow = elementRef.offsetHeight;
|
|
334
|
-
// Sets the starting height to avoid visual jumps in height and
|
|
335
|
-
// aria-valuenow being `NaN` for the first (few) resize events.
|
|
336
|
-
resizableBoxRef.current.updateSize( { height: heightNow } );
|
|
337
|
-
// Causes `maxHeight` to update to full `max` value instead of half.
|
|
338
|
-
setIsUntouched( false );
|
|
339
|
-
}
|
|
340
|
-
} }
|
|
341
|
-
onResize={ () => {
|
|
342
|
-
const { height } = resizableBoxRef.current.state;
|
|
343
|
-
const separator = separatorRef.current;
|
|
344
|
-
separator.ariaValueNow = getAriaValueNow( height );
|
|
345
|
-
} }
|
|
346
|
-
onResizeStop={ () => {
|
|
347
|
-
const nextHeight = resizableBoxRef.current.state.height;
|
|
348
|
-
setPreference(
|
|
349
|
-
'core/edit-post',
|
|
350
|
-
'metaBoxesMainOpenHeight',
|
|
351
|
-
nextHeight
|
|
352
|
-
);
|
|
353
|
-
} }
|
|
354
|
-
handleClasses={ {
|
|
355
|
-
top: 'edit-post-meta-boxes-main__resize-handle',
|
|
356
|
-
} }
|
|
357
|
-
handleComponent={ {
|
|
325
|
+
},
|
|
326
|
+
handleClasses: { top: 'edit-post-meta-boxes-main__presenter' },
|
|
327
|
+
handleComponent: {
|
|
358
328
|
top: (
|
|
359
329
|
<>
|
|
360
330
|
<Tooltip text={ __( 'Drag to resize' ) }>
|
|
361
|
-
|
|
362
|
-
{ /* eslint-disable-next-line jsx-a11y/role-supports-aria-props */ }
|
|
363
|
-
<button
|
|
331
|
+
<button // eslint-disable-line jsx-a11y/role-supports-aria-props
|
|
364
332
|
ref={ separatorRef }
|
|
333
|
+
role="separator" // eslint-disable-line jsx-a11y/no-interactive-element-to-noninteractive-role
|
|
334
|
+
aria-valuenow={ usedAriaValueNow }
|
|
365
335
|
aria-label={ __( 'Drag to resize' ) }
|
|
366
336
|
aria-describedby={ separatorHelpId }
|
|
367
337
|
onKeyDown={ onSeparatorKeyDown }
|
|
368
|
-
// Disable reason: buttons are allowed to be separator role.
|
|
369
|
-
// eslint-disable-next-line jsx-a11y/no-interactive-element-to-noninteractive-role
|
|
370
|
-
role="separator"
|
|
371
|
-
aria-valuenow={ usedAriaValueNow }
|
|
372
338
|
/>
|
|
373
339
|
</Tooltip>
|
|
374
340
|
<VisuallyHidden id={ separatorHelpId }>
|
|
375
341
|
{ __(
|
|
376
|
-
'Use up and down arrow keys to resize the metabox
|
|
342
|
+
'Use up and down arrow keys to resize the metabox pane.'
|
|
377
343
|
) }
|
|
378
344
|
</VisuallyHidden>
|
|
379
345
|
</>
|
|
380
346
|
),
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
|
|
347
|
+
},
|
|
348
|
+
// Avoids hiccups while dragging over objects like iframes and ensures that
|
|
349
|
+
// the event to end the drag is captured by the target (resize handle)
|
|
350
|
+
// whether or not it’s under the pointer.
|
|
351
|
+
onPointerDown: ( { pointerId, target } ) => {
|
|
352
|
+
target.setPointerCapture( pointerId );
|
|
353
|
+
},
|
|
354
|
+
onResizeStart: ( event, direction, elementRef ) => {
|
|
355
|
+
if ( isAutoHeight ) {
|
|
356
|
+
// Sets the starting height to avoid visual jumps in height and
|
|
357
|
+
// aria-valuenow being `NaN` for the first (few) resize events.
|
|
358
|
+
applyHeight( elementRef.offsetHeight, false, true );
|
|
359
|
+
setIsUntouched( false );
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
onResize: () =>
|
|
363
|
+
applyHeight( metaBoxesMainRef.current.state.height ),
|
|
364
|
+
onResizeStop: () =>
|
|
365
|
+
applyHeight( metaBoxesMainRef.current.state.height, true ),
|
|
366
|
+
} );
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
return (
|
|
370
|
+
<Pane aria-label={ paneLabel } { ...paneProps }>
|
|
371
|
+
{ isShort ? (
|
|
372
|
+
<button
|
|
373
|
+
aria-expanded={ isOpen }
|
|
374
|
+
className="edit-post-meta-boxes-main__presenter"
|
|
375
|
+
onClick={ toggle }
|
|
376
|
+
>
|
|
377
|
+
{ paneLabel }
|
|
378
|
+
<Icon icon={ isOpen ? chevronUp : chevronDown } />
|
|
379
|
+
</button>
|
|
380
|
+
) : (
|
|
381
|
+
<meta ref={ effectSizeConstraints } />
|
|
382
|
+
) }
|
|
384
383
|
{ contents }
|
|
385
|
-
</
|
|
384
|
+
</Pane>
|
|
386
385
|
);
|
|
387
386
|
}
|
|
388
387
|
|
|
@@ -482,6 +481,8 @@ function Layout( {
|
|
|
482
481
|
document.body.classList.remove( 'show-icon-labels' );
|
|
483
482
|
}
|
|
484
483
|
|
|
484
|
+
const navigateRegionsProps = useNavigateRegions();
|
|
485
|
+
|
|
485
486
|
const className = clsx( 'edit-post-layout', 'is-mode-' + mode, {
|
|
486
487
|
'has-metaboxes': hasActiveMetaboxes,
|
|
487
488
|
} );
|
|
@@ -567,47 +568,53 @@ function Layout( {
|
|
|
567
568
|
<ErrorBoundary>
|
|
568
569
|
<CommandMenu />
|
|
569
570
|
<WelcomeGuide postType={ currentPostType } />
|
|
570
|
-
<
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
postId={ currentPostId }
|
|
575
|
-
templateId={ templateId }
|
|
576
|
-
className={ className }
|
|
577
|
-
styles={ styles }
|
|
578
|
-
forceIsDirty={ hasActiveMetaboxes }
|
|
579
|
-
contentRef={ paddingAppenderRef }
|
|
580
|
-
disableIframe={ ! shouldIframe }
|
|
581
|
-
// We should auto-focus the canvas (title) on load.
|
|
582
|
-
// eslint-disable-next-line jsx-a11y/no-autofocus
|
|
583
|
-
autoFocus={ ! isWelcomeGuideVisible }
|
|
584
|
-
onActionPerformed={ onActionPerformed }
|
|
585
|
-
extraSidebarPanels={
|
|
586
|
-
showMetaBoxes && <MetaBoxes location="side" />
|
|
587
|
-
}
|
|
588
|
-
extraContent={
|
|
589
|
-
! isDistractionFree &&
|
|
590
|
-
showMetaBoxes && (
|
|
591
|
-
<MetaBoxesMain isLegacy={ ! shouldIframe } />
|
|
592
|
-
)
|
|
593
|
-
}
|
|
571
|
+
<div
|
|
572
|
+
className={ navigateRegionsProps.className }
|
|
573
|
+
{ ...navigateRegionsProps }
|
|
574
|
+
ref={ navigateRegionsProps.ref }
|
|
594
575
|
>
|
|
595
|
-
<
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
576
|
+
<Editor
|
|
577
|
+
settings={ editorSettings }
|
|
578
|
+
initialEdits={ initialEdits }
|
|
579
|
+
postType={ currentPostType }
|
|
580
|
+
postId={ currentPostId }
|
|
581
|
+
templateId={ templateId }
|
|
582
|
+
className={ className }
|
|
583
|
+
styles={ styles }
|
|
584
|
+
forceIsDirty={ hasActiveMetaboxes }
|
|
585
|
+
contentRef={ paddingAppenderRef }
|
|
586
|
+
disableIframe={ ! shouldIframe }
|
|
587
|
+
// We should auto-focus the canvas (title) on load.
|
|
588
|
+
// eslint-disable-next-line jsx-a11y/no-autofocus
|
|
589
|
+
autoFocus={ ! isWelcomeGuideVisible }
|
|
590
|
+
onActionPerformed={ onActionPerformed }
|
|
591
|
+
extraSidebarPanels={
|
|
592
|
+
showMetaBoxes && <MetaBoxes location="side" />
|
|
593
|
+
}
|
|
594
|
+
extraContent={
|
|
595
|
+
! isDistractionFree &&
|
|
596
|
+
showMetaBoxes && (
|
|
597
|
+
<MetaBoxesMain isLegacy={ ! shouldIframe } />
|
|
598
|
+
)
|
|
599
|
+
}
|
|
600
|
+
>
|
|
601
|
+
<PostLockedModal />
|
|
602
|
+
<EditorInitialization />
|
|
603
|
+
<FullscreenMode isActive={ isFullscreenActive } />
|
|
604
|
+
<BrowserURL hasHistory={ hasHistory } />
|
|
605
|
+
<UnsavedChangesWarning />
|
|
606
|
+
<AutosaveMonitor />
|
|
607
|
+
<LocalAutosaveMonitor />
|
|
608
|
+
<EditPostKeyboardShortcuts />
|
|
609
|
+
<EditorKeyboardShortcutsRegister />
|
|
610
|
+
<BlockKeyboardShortcuts />
|
|
611
|
+
<InitPatternModal />
|
|
612
|
+
<PluginArea onError={ onPluginAreaError } />
|
|
613
|
+
<PostEditorMoreMenu />
|
|
614
|
+
{ backButton }
|
|
615
|
+
<EditorSnackbars />
|
|
616
|
+
</Editor>
|
|
617
|
+
</div>
|
|
611
618
|
</ErrorBoundary>
|
|
612
619
|
</SlotFillProvider>
|
|
613
620
|
);
|
|
@@ -1,71 +1,111 @@
|
|
|
1
|
-
$resize-handle-height: $grid-unit-30;
|
|
2
|
-
|
|
3
1
|
.edit-post-meta-boxes-main {
|
|
4
2
|
filter: drop-shadow(0 -1px rgba($color: #000, $alpha: 0.133)); // 0.133 = $gray-200 but with alpha.
|
|
3
|
+
// Windows High Contrast mode will show this outline, but not the shadow.
|
|
4
|
+
outline: 1px solid transparent;
|
|
5
5
|
background-color: $white;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
padding-top: $resize-handle-height;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// The component renders as a details element in short viewports.
|
|
13
|
-
&:is(details) {
|
|
14
|
-
& > summary {
|
|
15
|
-
cursor: pointer;
|
|
16
|
-
color: $gray-900;
|
|
17
|
-
background-color: $white;
|
|
18
|
-
height: $button-size-compact;
|
|
19
|
-
line-height: $button-size-compact;
|
|
20
|
-
font-size: 13px;
|
|
21
|
-
padding-left: $grid-unit-30;
|
|
22
|
-
box-shadow: 0 $border-width $gray-300;
|
|
23
|
-
}
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
overflow: hidden;
|
|
24
9
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
top: 0;
|
|
28
|
-
z-index: 1;
|
|
29
|
-
}
|
|
10
|
+
&.is-resizable {
|
|
11
|
+
padding-block-start: $grid-unit-30;
|
|
30
12
|
}
|
|
31
13
|
}
|
|
32
14
|
|
|
33
|
-
.edit-post-meta-boxes-
|
|
15
|
+
.edit-post-meta-boxes-main__presenter {
|
|
34
16
|
display: flex;
|
|
35
|
-
// The position is absolute by default inline style of ResizableBox.
|
|
36
|
-
inset: 0 0 auto 0;
|
|
37
|
-
height: $resize-handle-height;
|
|
38
17
|
box-shadow: 0 $border-width $gray-300;
|
|
18
|
+
// Windows High Contrast mode will show this outline, but not the shadow.
|
|
19
|
+
outline: 1px solid transparent;
|
|
20
|
+
position: relative;
|
|
21
|
+
z-index: 1;
|
|
39
22
|
|
|
40
|
-
|
|
23
|
+
// Button style reset for both toggle or resizable.
|
|
24
|
+
.is-toggle-only > &,
|
|
25
|
+
.is-resizable.edit-post-meta-boxes-main & > button {
|
|
41
26
|
appearance: none;
|
|
42
|
-
cursor: inherit;
|
|
43
|
-
margin: auto;
|
|
44
27
|
padding: 0;
|
|
45
28
|
border: none;
|
|
46
29
|
outline: none;
|
|
47
|
-
background-color:
|
|
48
|
-
width: $grid-unit-80;
|
|
49
|
-
height: $grid-unit-05;
|
|
50
|
-
border-radius: $radius-small;
|
|
51
|
-
transition: width 0.3s ease-out;
|
|
52
|
-
@include reduce-motion("transition");
|
|
30
|
+
background-color: transparent;
|
|
53
31
|
}
|
|
54
32
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
33
|
+
.is-toggle-only > & {
|
|
34
|
+
flex-shrink: 0;
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
height: $button-size-compact;
|
|
37
|
+
justify-content: space-between;
|
|
38
|
+
align-items: center;
|
|
39
|
+
padding-inline: $grid-unit-30 $grid-unit-15;
|
|
40
|
+
|
|
41
|
+
&:is(:hover, :focus-visible) {
|
|
42
|
+
color: var(--wp-admin-theme-color);
|
|
43
|
+
}
|
|
44
|
+
&:focus-visible::after {
|
|
45
|
+
content: "";
|
|
46
|
+
position: absolute;
|
|
47
|
+
inset: var(--wp-admin-border-width-focus);
|
|
48
|
+
@include button-style__focus();
|
|
49
|
+
}
|
|
50
|
+
> svg {
|
|
51
|
+
fill: currentColor;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.is-resizable.edit-post-meta-boxes-main & {
|
|
56
|
+
inset: 0 0 auto;
|
|
57
|
+
|
|
58
|
+
> button {
|
|
59
|
+
cursor: inherit;
|
|
60
|
+
width: $grid-unit-80;
|
|
61
|
+
height: $grid-unit-30;
|
|
62
|
+
margin: auto;
|
|
63
|
+
|
|
64
|
+
&::before {
|
|
65
|
+
content: "";
|
|
66
|
+
background-color: $gray-300;
|
|
67
|
+
// Windows High Contrast mode will show this outline, but not the background-color.
|
|
68
|
+
outline: 2px solid transparent;
|
|
69
|
+
outline-offset: -2px;
|
|
70
|
+
position: absolute;
|
|
71
|
+
inset-block: calc(50% - #{$grid-unit-05} / 2) auto;
|
|
72
|
+
transform: translateX(-50%);
|
|
73
|
+
width: inherit;
|
|
74
|
+
height: $grid-unit-05;
|
|
75
|
+
border-radius: $radius-small;
|
|
76
|
+
transition: width 0.3s ease-out;
|
|
77
|
+
@include reduce-motion("transition");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&:is(:hover, :focus-within) > button::before {
|
|
82
|
+
background-color: var(--wp-admin-theme-color);
|
|
83
|
+
width: $grid-unit-80 + $grid-unit-20;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@media (pointer: coarse) {
|
|
89
|
+
.is-resizable.edit-post-meta-boxes-main {
|
|
90
|
+
padding-block-start: $button-size-compact;
|
|
91
|
+
|
|
92
|
+
.edit-post-meta-boxes-main__presenter > button {
|
|
93
|
+
height: $button-size-compact;
|
|
94
|
+
}
|
|
59
95
|
}
|
|
60
96
|
}
|
|
61
97
|
|
|
62
98
|
.edit-post-meta-boxes-main__liner {
|
|
63
99
|
overflow: auto;
|
|
64
|
-
max-height: 100%;
|
|
65
100
|
// Keep the contents behind the resize handle or details summary.
|
|
66
101
|
isolation: isolate;
|
|
67
102
|
}
|
|
68
103
|
|
|
104
|
+
// In case the canvas is not iframe’d.
|
|
105
|
+
.edit-post-layout__metaboxes {
|
|
106
|
+
clear: both;
|
|
107
|
+
}
|
|
108
|
+
|
|
69
109
|
.has-metaboxes .editor-visual-editor {
|
|
70
110
|
flex: 1;
|
|
71
111
|
|
|
@@ -11,7 +11,13 @@ export function usePaddingAppender() {
|
|
|
11
11
|
return useRefEffect(
|
|
12
12
|
( node ) => {
|
|
13
13
|
function onMouseDown( event ) {
|
|
14
|
-
if (
|
|
14
|
+
if (
|
|
15
|
+
event.target !== node &&
|
|
16
|
+
// Tests for the parent element because in the iframed editor if the click is
|
|
17
|
+
// below the padding the target will be the parent element (html) and should
|
|
18
|
+
// still be treated as intent to append.
|
|
19
|
+
event.target !== node.parentElement
|
|
20
|
+
) {
|
|
15
21
|
return;
|
|
16
22
|
}
|
|
17
23
|
|
|
@@ -38,7 +44,7 @@ export function usePaddingAppender() {
|
|
|
38
44
|
return;
|
|
39
45
|
}
|
|
40
46
|
|
|
41
|
-
event.
|
|
47
|
+
event.preventDefault();
|
|
42
48
|
|
|
43
49
|
const blockOrder = registry
|
|
44
50
|
.select( blockEditorStore )
|
|
@@ -57,9 +63,12 @@ export function usePaddingAppender() {
|
|
|
57
63
|
insertDefaultBlock();
|
|
58
64
|
}
|
|
59
65
|
}
|
|
60
|
-
|
|
66
|
+
const { ownerDocument } = node;
|
|
67
|
+
// Adds the listener on the document so that in the iframed editor clicks below the
|
|
68
|
+
// padding can be handled as they too should be treated as intent to append.
|
|
69
|
+
ownerDocument.addEventListener( 'mousedown', onMouseDown );
|
|
61
70
|
return () => {
|
|
62
|
-
|
|
71
|
+
ownerDocument.removeEventListener( 'mousedown', onMouseDown );
|
|
63
72
|
};
|
|
64
73
|
},
|
|
65
74
|
[ registry ]
|
package/src/index.js
CHANGED
|
@@ -28,7 +28,6 @@ import { unlock } from './lock-unlock';
|
|
|
28
28
|
const {
|
|
29
29
|
BackButton: __experimentalMainDashboardButton,
|
|
30
30
|
registerCoreBlockBindingsSources,
|
|
31
|
-
bootstrapBlockBindingsSourcesFromServer,
|
|
32
31
|
} = unlock( editorPrivateApis );
|
|
33
32
|
|
|
34
33
|
/**
|
|
@@ -95,7 +94,6 @@ export function initializeEditor(
|
|
|
95
94
|
}
|
|
96
95
|
|
|
97
96
|
registerCoreBlocks();
|
|
98
|
-
bootstrapBlockBindingsSourcesFromServer( settings?.blockBindingsSources );
|
|
99
97
|
registerCoreBlockBindingsSources();
|
|
100
98
|
registerLegacyWidgetBlock( { inserter: false } );
|
|
101
99
|
registerWidgetGroupBlock( { inserter: false } );
|
package/src/store/actions.js
CHANGED
|
@@ -481,7 +481,7 @@ export const initializeMetaBoxes =
|
|
|
481
481
|
addAction(
|
|
482
482
|
'editor.savePost',
|
|
483
483
|
'core/edit-post/save-metaboxes',
|
|
484
|
-
async ( options ) => {
|
|
484
|
+
async ( post, options ) => {
|
|
485
485
|
if ( ! options.isAutosave && select.hasMetaBoxes() ) {
|
|
486
486
|
await dispatch.requestMetaBoxUpdates();
|
|
487
487
|
}
|