@wordpress/edit-post 8.34.1-next.2f1c7c01b.0 → 8.35.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 +2 -0
- package/build/components/layout/index.js +5 -24
- package/build/components/layout/index.js.map +2 -2
- package/build-module/components/layout/index.js +5 -24
- package/build-module/components/layout/index.js.map +2 -2
- package/package.json +33 -33
- package/src/components/layout/index.js +5 -30
- package/build/components/layout/use-padding-appender.js +0 -74
- package/build/components/layout/use-padding-appender.js.map +0 -7
- package/build-module/components/layout/use-padding-appender.js +0 -50
- package/build-module/components/layout/use-padding-appender.js.map +0 -7
- package/src/components/layout/use-padding-appender.js +0 -70
package/CHANGELOG.md
CHANGED
|
@@ -62,7 +62,6 @@ var import_welcome_guide = __toESM(require("../welcome-guide"));
|
|
|
62
62
|
var import_store = require("../../store");
|
|
63
63
|
var import_lock_unlock = require("../../lock-unlock");
|
|
64
64
|
var import_use_commands = __toESM(require("../../commands/use-commands"));
|
|
65
|
-
var import_use_padding_appender = require("./use-padding-appender");
|
|
66
65
|
var import_use_should_iframe = require("./use-should-iframe");
|
|
67
66
|
var import_use_navigate_to_entity_record = __toESM(require("../../hooks/use-navigate-to-entity-record"));
|
|
68
67
|
var import_use_meta_box_initialization = require("../meta-boxes/use-meta-box-initialization");
|
|
@@ -76,13 +75,12 @@ var DESIGN_POST_TYPES = [
|
|
|
76
75
|
"wp_block",
|
|
77
76
|
"wp_navigation"
|
|
78
77
|
];
|
|
79
|
-
function useEditorStyles(settings
|
|
78
|
+
function useEditorStyles(settings) {
|
|
80
79
|
const { hasThemeStyleSupport } = (0, import_data.useSelect)((select) => {
|
|
81
80
|
return {
|
|
82
81
|
hasThemeStyleSupport: select(import_store.store).isFeatureActive("themeStyles")
|
|
83
82
|
};
|
|
84
83
|
}, []);
|
|
85
|
-
const addedStyles = additionalStyles.join("\n");
|
|
86
84
|
return (0, import_element.useMemo)(() => {
|
|
87
85
|
const presetStyles = settings.styles?.filter(
|
|
88
86
|
(style) => style.__unstableType && style.__unstableType !== "theme"
|
|
@@ -103,17 +101,12 @@ function useEditorStyles(settings, ...additionalStyles) {
|
|
|
103
101
|
})
|
|
104
102
|
});
|
|
105
103
|
}
|
|
106
|
-
|
|
107
|
-
if (addedStyles) {
|
|
108
|
-
return [...baseStyles, { css: addedStyles }];
|
|
109
|
-
}
|
|
110
|
-
return baseStyles;
|
|
104
|
+
return hasThemeStyles ? settings.styles ?? [] : defaultEditorStyles;
|
|
111
105
|
}, [
|
|
112
106
|
settings.defaultEditorStyles,
|
|
113
107
|
settings.disableLayoutStyles,
|
|
114
108
|
settings.styles,
|
|
115
|
-
hasThemeStyleSupport
|
|
116
|
-
addedStyles
|
|
109
|
+
hasThemeStyleSupport
|
|
117
110
|
]);
|
|
118
111
|
}
|
|
119
112
|
function MetaBoxesMain({ isLegacy }) {
|
|
@@ -361,7 +354,6 @@ function Layout({
|
|
|
361
354
|
showMetaBoxes,
|
|
362
355
|
isWelcomeGuideVisible,
|
|
363
356
|
templateId,
|
|
364
|
-
enablePaddingAppender,
|
|
365
357
|
isDevicePreview
|
|
366
358
|
} = (0, import_data.useSelect)(
|
|
367
359
|
(select) => {
|
|
@@ -379,13 +371,7 @@ function Layout({
|
|
|
379
371
|
const { getBlockSelectionStart, isZoomOut } = (0, import_lock_unlock.unlock)(
|
|
380
372
|
select(import_block_editor.store)
|
|
381
373
|
);
|
|
382
|
-
const {
|
|
383
|
-
getEditorMode,
|
|
384
|
-
getRenderingMode,
|
|
385
|
-
getDefaultRenderingMode,
|
|
386
|
-
getDeviceType
|
|
387
|
-
} = (0, import_lock_unlock.unlock)(select(import_editor.store));
|
|
388
|
-
const isRenderingPostOnly = getRenderingMode() === "post-only";
|
|
374
|
+
const { getEditorMode, getDefaultRenderingMode, getDeviceType } = (0, import_lock_unlock.unlock)(select(import_editor.store));
|
|
389
375
|
const isNotDesignPostType = !DESIGN_POST_TYPES.includes(currentPostType);
|
|
390
376
|
const isDirectlyEditingPattern = currentPostType === "wp_block" && !onNavigateToPreviousEntityRecord;
|
|
391
377
|
const _templateId = getTemplateId(currentPostType, currentPostId);
|
|
@@ -401,7 +387,6 @@ function Layout({
|
|
|
401
387
|
showMetaBoxes: isNotDesignPostType && !isZoomOut() || isDirectlyEditingPattern,
|
|
402
388
|
isWelcomeGuideVisible: isFeatureActive("welcomeGuide"),
|
|
403
389
|
templateId: supportsTemplateMode && isViewable && canViewTemplate && !isEditingTemplate ? _templateId : null,
|
|
404
|
-
enablePaddingAppender: !isZoomOut() && isRenderingPostOnly && isNotDesignPostType,
|
|
405
390
|
isDevicePreview: getDeviceType() !== "Desktop"
|
|
406
391
|
};
|
|
407
392
|
},
|
|
@@ -414,12 +399,9 @@ function Layout({
|
|
|
414
399
|
]
|
|
415
400
|
);
|
|
416
401
|
(0, import_use_meta_box_initialization.useMetaBoxInitialization)(hasActiveMetaboxes && hasResolvedMode);
|
|
417
|
-
const [paddingAppenderRef, paddingStyle] = (0, import_use_padding_appender.usePaddingAppender)(
|
|
418
|
-
enablePaddingAppender
|
|
419
|
-
);
|
|
420
402
|
const commandContext = hasBlockSelected ? "block-selection-edit" : "entity-edit";
|
|
421
403
|
useCommandContext(commandContext);
|
|
422
|
-
const styles = useEditorStyles(settings
|
|
404
|
+
const styles = useEditorStyles(settings);
|
|
423
405
|
const editorSettings = (0, import_element.useMemo)(
|
|
424
406
|
() => ({
|
|
425
407
|
...settings,
|
|
@@ -526,7 +508,6 @@ function Layout({
|
|
|
526
508
|
templateId,
|
|
527
509
|
className,
|
|
528
510
|
forceIsDirty: hasActiveMetaboxes,
|
|
529
|
-
contentRef: paddingAppenderRef,
|
|
530
511
|
disableIframe: !shouldIframe,
|
|
531
512
|
autoFocus: !isWelcomeGuideVisible,
|
|
532
513
|
onActionPerformed,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/layout/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { NavigableRegion } from '@wordpress/admin-ui';\nimport {\n\tAutosaveMonitor,\n\tLocalAutosaveMonitor,\n\tUnsavedChangesWarning,\n\tEditorKeyboardShortcutsRegister,\n\tEditorSnackbars,\n\tErrorBoundary,\n\tPostLockedModal,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { getLayoutStyles } from '@wordpress/global-styles-engine';\nimport { PluginArea } from '@wordpress/plugins';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseId,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\nimport { chevronDown, chevronUp } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { privateApis as commandsPrivateApis } from '@wordpress/commands';\nimport { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';\nimport { addQueryArgs } from '@wordpress/url';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tIcon,\n\tResizableBox,\n\tSlotFillProvider,\n\tTooltip,\n\tVisuallyHidden,\n\t__unstableUseNavigateRegions as useNavigateRegions,\n} from '@wordpress/components';\nimport {\n\tuseEvent,\n\tuseMediaQuery,\n\tuseRefEffect,\n\tuseViewportMatch,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BackButton from '../back-button';\nimport EditorInitialization from '../editor-initialization';\nimport EditPostKeyboardShortcuts from '../keyboard-shortcuts';\nimport InitPatternModal from '../init-pattern-modal';\nimport BrowserURL from '../browser-url';\nimport MetaBoxes from '../meta-boxes';\nimport PostEditorMoreMenu from '../more-menu';\nimport WelcomeGuide from '../welcome-guide';\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport useEditPostCommands from '../../commands/use-commands';\nimport { usePaddingAppender } from './use-padding-appender';\nimport { useShouldIframe } from './use-should-iframe';\nimport useNavigateToEntityRecord from '../../hooks/use-navigate-to-entity-record';\nimport { useMetaBoxInitialization } from '../meta-boxes/use-meta-box-initialization';\n\nconst { useCommandContext } = unlock( commandsPrivateApis );\nconst { Editor, FullscreenMode } = unlock( editorPrivateApis );\nconst { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );\nconst DESIGN_POST_TYPES = [\n\t'wp_template',\n\t'wp_template_part',\n\t'wp_block',\n\t'wp_navigation',\n];\n\nfunction useEditorStyles( settings, ...additionalStyles ) {\n\tconst { hasThemeStyleSupport } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\thasThemeStyleSupport:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'themeStyles' ),\n\t\t};\n\t}, [] );\n\n\tconst addedStyles = additionalStyles.join( '\\n' );\n\n\t// Compute the default styles.\n\treturn useMemo( () => {\n\t\tconst presetStyles =\n\t\t\tsettings.styles?.filter(\n\t\t\t\t( style ) =>\n\t\t\t\t\tstyle.__unstableType && style.__unstableType !== 'theme'\n\t\t\t) ?? [];\n\n\t\tconst defaultEditorStyles = [\n\t\t\t...( settings?.defaultEditorStyles ?? [] ),\n\t\t\t...presetStyles,\n\t\t];\n\n\t\t// Has theme styles if the theme supports them and if some styles were not preset styles (in which case they're theme styles).\n\t\tconst hasThemeStyles =\n\t\t\thasThemeStyleSupport &&\n\t\t\tpresetStyles.length !== ( settings.styles?.length ?? 0 );\n\n\t\t// If theme styles are not present or displayed, ensure that\n\t\t// base layout styles are still present in the editor.\n\t\tif ( ! settings.disableLayoutStyles && ! hasThemeStyles ) {\n\t\t\tdefaultEditorStyles.push( {\n\t\t\t\tcss: getLayoutStyles( {\n\t\t\t\t\tstyle: {},\n\t\t\t\t\tselector: 'body',\n\t\t\t\t\thasBlockGapSupport: false,\n\t\t\t\t\thasFallbackGapSupport: true,\n\t\t\t\t\tfallbackGapValue: '0.5em',\n\t\t\t\t} ),\n\t\t\t} );\n\t\t}\n\n\t\tconst baseStyles = hasThemeStyles\n\t\t\t? settings.styles ?? []\n\t\t\t: defaultEditorStyles;\n\n\t\tif ( addedStyles ) {\n\t\t\treturn [ ...baseStyles, { css: addedStyles } ];\n\t\t}\n\n\t\treturn baseStyles;\n\t}, [\n\t\tsettings.defaultEditorStyles,\n\t\tsettings.disableLayoutStyles,\n\t\tsettings.styles,\n\t\thasThemeStyleSupport,\n\t\taddedStyles,\n\t] );\n}\n\n/**\n * @param {Object} props\n * @param {boolean} props.isLegacy True when the editor canvas is not in an iframe.\n */\nfunction MetaBoxesMain( { isLegacy } ) {\n\tconst [ isOpen, openHeight, hasAnyVisible ] = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { isMetaBoxLocationVisible } = select( editPostStore );\n\t\treturn [\n\t\t\t!! get( 'core/edit-post', 'metaBoxesMainIsOpen' ),\n\t\t\tget( 'core/edit-post', 'metaBoxesMainOpenHeight' ),\n\t\t\tisMetaBoxLocationVisible( 'normal' ) ||\n\t\t\t\tisMetaBoxLocationVisible( 'advanced' ) ||\n\t\t\t\tisMetaBoxLocationVisible( 'side' ),\n\t\t];\n\t}, [] );\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\tconst metaBoxesMainRef = useRef();\n\tconst isShort = useMediaQuery( '(max-height: 549px)' );\n\n\tconst [ { min, max }, setHeightConstraints ] = useState( () => ( {} ) );\n\t// Keeps the resizable area\u2019s size constraints updated taking into account\n\t// editor notices. The constraints are also used to derive the value for the\n\t// aria-valuenow attribute on the separator.\n\tconst effectSizeConstraints = useRefEffect( ( node ) => {\n\t\tconst container = node.closest(\n\t\t\t'.interface-interface-skeleton__content'\n\t\t);\n\t\tif ( ! container ) {\n\t\t\treturn;\n\t\t}\n\t\tconst noticeLists = container.querySelectorAll(\n\t\t\t':scope > .components-notice-list'\n\t\t);\n\t\tconst resizeHandle = container.querySelector(\n\t\t\t'.edit-post-meta-boxes-main__presenter'\n\t\t);\n\t\tconst deriveConstraints = () => {\n\t\t\tconst fullHeight = container.offsetHeight;\n\t\t\tlet nextMax = fullHeight;\n\t\t\tfor ( const element of noticeLists ) {\n\t\t\t\tnextMax -= element.offsetHeight;\n\t\t\t}\n\t\t\tconst nextMin = resizeHandle.offsetHeight;\n\t\t\tsetHeightConstraints( { min: nextMin, max: nextMax } );\n\t\t};\n\t\tconst observer = new window.ResizeObserver( deriveConstraints );\n\t\tobserver.observe( container );\n\t\tfor ( const element of noticeLists ) {\n\t\t\tobserver.observe( element );\n\t\t}\n\t\treturn () => observer.disconnect();\n\t}, [] );\n\n\tconst resizeDataRef = useRef( {} );\n\tconst separatorRef = useRef();\n\tconst separatorHelpId = useId();\n\n\t/**\n\t * @param {number|'auto'} [candidateHeight] Height in pixels or 'auto'.\n\t * @param {boolean} isPersistent Whether to persist the height in preferences.\n\t * @param {boolean} isInstant Whether to update the height in the DOM.\n\t */\n\tconst applyHeight = (\n\t\tcandidateHeight = 'auto',\n\t\tisPersistent,\n\t\tisInstant\n\t) => {\n\t\tif ( candidateHeight === 'auto' ) {\n\t\t\tisPersistent = false; // Just in case \u2014 \u201Cauto\u201D should never persist.\n\t\t} else {\n\t\t\tcandidateHeight = Math.min( max, Math.max( min, candidateHeight ) );\n\t\t}\n\t\tif ( isPersistent ) {\n\t\t\tsetPreference(\n\t\t\t\t'core/edit-post',\n\t\t\t\t'metaBoxesMainOpenHeight',\n\t\t\t\tcandidateHeight\n\t\t\t);\n\t\t}\n\t\t// Updates aria-valuenow only when not persisting the value because otherwise\n\t\t// it's done by the render that persisting the value causes.\n\t\telse if ( ! isShort ) {\n\t\t\tseparatorRef.current.ariaValueNow =\n\t\t\t\tgetAriaValueNow( candidateHeight );\n\t\t}\n\t\tif ( isInstant ) {\n\t\t\tmetaBoxesMainRef.current.updateSize( {\n\t\t\t\theight: candidateHeight,\n\t\t\t\t// Oddly, when the event that triggered this was not from the mouse (e.g. keydown),\n\t\t\t\t// if `width` is left unspecified a subsequent drag gesture applies a fixed\n\t\t\t\t// width and the pane fails to widen/narrow with parent width changes from\n\t\t\t\t// sidebars opening/closing or window resizes.\n\t\t\t\twidth: 'auto',\n\t\t\t} );\n\t\t}\n\t};\n\tconst getRenderValues = useEvent( () => ( { isOpen, openHeight, min } ) );\n\t// Sets the height to 'auto' when not resizable (isShort) and to the\n\t// preferred height when resizable.\n\tuseEffect( () => {\n\t\tconst fresh = getRenderValues();\n\t\t// Tests for `min` having a value to skip the first render.\n\t\tif ( fresh.min !== undefined && metaBoxesMainRef.current ) {\n\t\t\tconst usedOpenHeight = isShort ? 'auto' : fresh.openHeight;\n\t\t\tconst usedHeight = fresh.isOpen ? usedOpenHeight : fresh.min;\n\t\t\tapplyHeight( usedHeight, false, true );\n\t\t}\n\t}, [ isShort ] );\n\n\tif ( ! hasAnyVisible ) {\n\t\treturn;\n\t}\n\n\tconst contents = (\n\t\t<div\n\t\t\t// The class name 'edit-post-layout__metaboxes' is retained because some plugins use it.\n\t\t\tclassName=\"edit-post-layout__metaboxes edit-post-meta-boxes-main__liner\"\n\t\t\thidden={ ! isLegacy && ! isOpen }\n\t\t>\n\t\t\t<MetaBoxes location=\"normal\" />\n\t\t\t<MetaBoxes location=\"advanced\" />\n\t\t</div>\n\t);\n\n\tif ( isLegacy ) {\n\t\treturn contents;\n\t}\n\n\tconst isAutoHeight = openHeight === undefined;\n\tconst getAriaValueNow = ( height ) =>\n\t\tMath.round( ( ( height - min ) / ( max - min ) ) * 100 );\n\tconst usedAriaValueNow =\n\t\tmax === undefined || isAutoHeight ? 50 : getAriaValueNow( openHeight );\n\n\tconst persistIsOpen = ( to = ! isOpen ) =>\n\t\tsetPreference( 'core/edit-post', 'metaBoxesMainIsOpen', to );\n\n\t// TODO: Support more/all keyboard interactions from the window splitter pattern:\n\t// https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/\n\tconst onSeparatorKeyDown = ( event ) => {\n\t\tconst delta = { ArrowUp: 20, ArrowDown: -20 }[ event.key ];\n\t\tif ( delta ) {\n\t\t\tconst pane = metaBoxesMainRef.current.resizable;\n\t\t\tconst fromHeight = isAutoHeight ? pane.offsetHeight : openHeight;\n\t\t\tconst nextHeight = delta + fromHeight;\n\t\t\tapplyHeight( nextHeight, true, true );\n\t\t\tpersistIsOpen( nextHeight > min );\n\t\t\tevent.preventDefault();\n\t\t}\n\t};\n\tconst paneLabel = __( 'Meta Boxes' );\n\n\tconst toggle = (\n\t\t<button\n\t\t\taria-expanded={ isOpen }\n\t\t\tonClick={ ( { detail } ) => {\n\t\t\t\tconst { isToggleInferred } = resizeDataRef.current;\n\t\t\t\tif ( isShort || ! detail || isToggleInferred ) {\n\t\t\t\t\tpersistIsOpen();\n\t\t\t\t\tconst usedOpenHeight = isShort ? 'auto' : openHeight;\n\t\t\t\t\tconst usedHeight = isOpen ? min : usedOpenHeight;\n\t\t\t\t\tapplyHeight( usedHeight, false, true );\n\t\t\t\t}\n\t\t\t} }\n\t\t\t// Prevents resizing in short viewports.\n\t\t\t{ ...( isShort && {\n\t\t\t\tonMouseDown: ( event ) => event.stopPropagation(),\n\t\t\t\tonTouchStart: ( event ) => event.stopPropagation(),\n\t\t\t} ) }\n\t\t>\n\t\t\t{ paneLabel }\n\t\t\t<Icon icon={ isOpen ? chevronUp : chevronDown } />\n\t\t</button>\n\t);\n\n\tconst separator = ! isShort && (\n\t\t<>\n\t\t\t<Tooltip text={ __( 'Drag to resize' ) }>\n\t\t\t\t<button // eslint-disable-line jsx-a11y/role-supports-aria-props\n\t\t\t\t\tref={ separatorRef }\n\t\t\t\t\trole=\"separator\" // eslint-disable-line jsx-a11y/no-interactive-element-to-noninteractive-role\n\t\t\t\t\taria-valuenow={ usedAriaValueNow }\n\t\t\t\t\taria-label={ __( 'Drag to resize' ) }\n\t\t\t\t\taria-describedby={ separatorHelpId }\n\t\t\t\t\tonKeyDown={ onSeparatorKeyDown }\n\t\t\t\t/>\n\t\t\t</Tooltip>\n\t\t\t<VisuallyHidden id={ separatorHelpId }>\n\t\t\t\t{ __(\n\t\t\t\t\t'Use up and down arrow keys to resize the meta box panel.'\n\t\t\t\t) }\n\t\t\t</VisuallyHidden>\n\t\t</>\n\t);\n\n\tconst paneProps = /** @type {Parameters<typeof ResizableBox>[0]} */ ( {\n\t\tas: NavigableRegion,\n\t\tref: metaBoxesMainRef,\n\t\tclassName: 'edit-post-meta-boxes-main',\n\t\tdefaultSize: { height: isOpen ? openHeight : 0 },\n\t\tminHeight: min,\n\t\tmaxHeight: max,\n\t\tenable: { top: true },\n\t\thandleClasses: { top: 'edit-post-meta-boxes-main__presenter' },\n\t\thandleComponent: {\n\t\t\ttop: (\n\t\t\t\t<>\n\t\t\t\t\t{ toggle }\n\t\t\t\t\t{ separator }\n\t\t\t\t</>\n\t\t\t),\n\t\t},\n\t\t// Avoids hiccups while dragging over objects like iframes and ensures that\n\t\t// the event to end the drag is captured by the target (resize handle)\n\t\t// whether or not it\u2019s under the pointer.\n\t\tonPointerDown: ( { pointerId, target } ) => {\n\t\t\tif ( separatorRef.current?.parentElement.contains( target ) ) {\n\t\t\t\ttarget.setPointerCapture( pointerId );\n\t\t\t}\n\t\t},\n\t\tonResizeStart: ( { timeStamp }, direction, elementRef ) => {\n\t\t\tif ( isAutoHeight ) {\n\t\t\t\t// Sets the starting height to avoid visual jumps in height and\n\t\t\t\t// aria-valuenow being `NaN` for the first (few) resize events.\n\t\t\t\tapplyHeight( elementRef.offsetHeight, false, true );\n\t\t\t}\n\t\t\telementRef.classList.add( 'is-resizing' );\n\t\t\tresizeDataRef.current = { timeStamp, maxDelta: 0 };\n\t\t},\n\t\tonResize: ( event, direction, elementRef, delta ) => {\n\t\t\tconst { maxDelta } = resizeDataRef.current;\n\t\t\tconst newDelta = Math.abs( delta.height );\n\t\t\tresizeDataRef.current.maxDelta = Math.max( maxDelta, newDelta );\n\t\t\tapplyHeight( metaBoxesMainRef.current.state.height );\n\t\t},\n\t\tonResizeStop: ( event, direction, elementRef ) => {\n\t\t\telementRef.classList.remove( 'is-resizing' );\n\t\t\tconst duration = event.timeStamp - resizeDataRef.current.timeStamp;\n\t\t\tconst wasSeparator = event.target === separatorRef.current;\n\t\t\tconst { maxDelta } = resizeDataRef.current;\n\t\t\tconst isToggleInferred =\n\t\t\t\tmaxDelta < 1 || ( duration < 144 && maxDelta < 5 );\n\t\t\tif ( isShort || ( ! wasSeparator && isToggleInferred ) ) {\n\t\t\t\tresizeDataRef.current.isToggleInferred = true;\n\t\t\t} else {\n\t\t\t\tconst { height } = metaBoxesMainRef.current.state;\n\t\t\t\tconst nextIsOpen = height > min;\n\t\t\t\tpersistIsOpen( nextIsOpen );\n\t\t\t\t// Persists height only if still open. This is so that when closed by a drag the\n\t\t\t\t// prior height can be restored by the toggle button instead of having to drag\n\t\t\t\t// the pane open again. Also, if already closed, a click on the separator won\u2019t\n\t\t\t\t// persist the height as the minimum.\n\t\t\t\tif ( nextIsOpen ) {\n\t\t\t\t\tapplyHeight( height, true );\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t} );\n\n\treturn (\n\t\t<ResizableBox aria-label={ paneLabel } { ...paneProps }>\n\t\t\t<meta ref={ effectSizeConstraints } />\n\t\t\t{ contents }\n\t\t</ResizableBox>\n\t);\n}\n\nfunction Layout( {\n\tpostId: initialPostId,\n\tpostType: initialPostType,\n\tsettings,\n\tinitialEdits,\n} ) {\n\tuseEditPostCommands();\n\tconst shouldIframe = useShouldIframe();\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst {\n\t\tcurrentPost: { postId: currentPostId, postType: currentPostType },\n\t\tonNavigateToEntityRecord,\n\t\tonNavigateToPreviousEntityRecord,\n\t} = useNavigateToEntityRecord(\n\t\tinitialPostId,\n\t\tinitialPostType,\n\t\t'post-only'\n\t);\n\tconst isEditingTemplate = currentPostType === 'wp_template';\n\tconst {\n\t\tmode,\n\t\tisFullscreenActive,\n\t\thasResolvedMode,\n\t\thasActiveMetaboxes,\n\t\thasBlockSelected,\n\t\tshowIconLabels,\n\t\tisDistractionFree,\n\t\tshowMetaBoxes,\n\t\tisWelcomeGuideVisible,\n\t\ttemplateId,\n\t\tenablePaddingAppender,\n\t\tisDevicePreview,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\tconst { isFeatureActive, hasMetaBoxes } = select( editPostStore );\n\t\t\tconst { canUser, getPostType, getTemplateId } = unlock(\n\t\t\t\tselect( coreStore )\n\t\t\t);\n\n\t\t\tconst supportsTemplateMode = settings.supportsTemplateMode;\n\t\t\tconst isViewable =\n\t\t\t\tgetPostType( currentPostType )?.viewable ?? false;\n\t\t\tconst canViewTemplate = canUser( 'read', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} );\n\t\t\tconst { getBlockSelectionStart, isZoomOut } = unlock(\n\t\t\t\tselect( blockEditorStore )\n\t\t\t);\n\t\t\tconst {\n\t\t\t\tgetEditorMode,\n\t\t\t\tgetRenderingMode,\n\t\t\t\tgetDefaultRenderingMode,\n\t\t\t\tgetDeviceType,\n\t\t\t} = unlock( select( editorStore ) );\n\t\t\tconst isRenderingPostOnly = getRenderingMode() === 'post-only';\n\t\t\tconst isNotDesignPostType =\n\t\t\t\t! DESIGN_POST_TYPES.includes( currentPostType );\n\t\t\tconst isDirectlyEditingPattern =\n\t\t\t\tcurrentPostType === 'wp_block' &&\n\t\t\t\t! onNavigateToPreviousEntityRecord;\n\t\t\tconst _templateId = getTemplateId( currentPostType, currentPostId );\n\t\t\tconst defaultMode = getDefaultRenderingMode( currentPostType );\n\n\t\t\treturn {\n\t\t\t\tmode: getEditorMode(),\n\t\t\t\tisFullscreenActive: isFeatureActive( 'fullscreenMode' ),\n\t\t\t\thasActiveMetaboxes: hasMetaBoxes(),\n\t\t\t\thasResolvedMode:\n\t\t\t\t\tdefaultMode === 'template-locked'\n\t\t\t\t\t\t? !! _templateId\n\t\t\t\t\t\t: defaultMode !== undefined,\n\t\t\t\thasBlockSelected: !! getBlockSelectionStart(),\n\t\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\t\tshowMetaBoxes:\n\t\t\t\t\t( isNotDesignPostType && ! isZoomOut() ) ||\n\t\t\t\t\tisDirectlyEditingPattern,\n\t\t\t\tisWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),\n\t\t\t\ttemplateId:\n\t\t\t\t\tsupportsTemplateMode &&\n\t\t\t\t\tisViewable &&\n\t\t\t\t\tcanViewTemplate &&\n\t\t\t\t\t! isEditingTemplate\n\t\t\t\t\t\t? _templateId\n\t\t\t\t\t\t: null,\n\t\t\t\tenablePaddingAppender:\n\t\t\t\t\t! isZoomOut() && isRenderingPostOnly && isNotDesignPostType,\n\t\t\t\tisDevicePreview: getDeviceType() !== 'Desktop',\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tcurrentPostType,\n\t\t\tcurrentPostId,\n\t\t\tisEditingTemplate,\n\t\t\tsettings.supportsTemplateMode,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t]\n\t);\n\n\tuseMetaBoxInitialization( hasActiveMetaboxes && hasResolvedMode );\n\n\tconst [ paddingAppenderRef, paddingStyle ] = usePaddingAppender(\n\t\tenablePaddingAppender\n\t);\n\n\t// Set the right context for the command palette\n\tconst commandContext = hasBlockSelected\n\t\t? 'block-selection-edit'\n\t\t: 'entity-edit';\n\tuseCommandContext( commandContext );\n\tconst styles = useEditorStyles( settings, paddingStyle );\n\tconst editorSettings = useMemo(\n\t\t() => ( {\n\t\t\t...settings,\n\t\t\tstyles,\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t\tdefaultRenderingMode: 'post-only',\n\t\t} ),\n\t\t[\n\t\t\tsettings,\n\t\t\tstyles,\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t]\n\t);\n\n\t// We need to add the show-icon-labels class to the body element so it is applied to modals.\n\tif ( showIconLabels ) {\n\t\tdocument.body.classList.add( 'show-icon-labels' );\n\t} else {\n\t\tdocument.body.classList.remove( 'show-icon-labels' );\n\t}\n\n\tconst navigateRegionsProps = useNavigateRegions();\n\n\tconst className = clsx( 'edit-post-layout', 'is-mode-' + mode, {\n\t\t'has-metaboxes': hasActiveMetaboxes,\n\t} );\n\n\tfunction onPluginAreaError( name ) {\n\t\tcreateErrorNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: plugin name */\n\t\t\t\t__(\n\t\t\t\t\t'The \"%s\" plugin has encountered an error and cannot be rendered.'\n\t\t\t\t),\n\t\t\t\tname\n\t\t\t)\n\t\t);\n\t}\n\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst onActionPerformed = useCallback(\n\t\t( actionId, items ) => {\n\t\t\tswitch ( actionId ) {\n\t\t\t\tcase 'move-to-trash':\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.location.href = addQueryArgs( 'edit.php', {\n\t\t\t\t\t\t\ttrashed: 1,\n\t\t\t\t\t\t\tpost_type: items[ 0 ].type,\n\t\t\t\t\t\t\tids: items[ 0 ].id,\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'duplicate-post':\n\t\t\t\t\t{\n\t\t\t\t\t\tconst newItem = items[ 0 ];\n\t\t\t\t\t\tconst title =\n\t\t\t\t\t\t\ttypeof newItem.title === 'string'\n\t\t\t\t\t\t\t\t? newItem.title\n\t\t\t\t\t\t\t\t: newItem.title?.rendered;\n\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Title of the created post or template, e.g: \"Hello world\".\n\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\tdecodeEntities( title ) || __( '(no title)' )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlabel: __( 'Edit' ),\n\t\t\t\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\t\t\t\tconst postId = newItem.id;\n\t\t\t\t\t\t\t\t\t\t\tdocument.location.href =\n\t\t\t\t\t\t\t\t\t\t\t\taddQueryArgs( 'post.php', {\n\t\t\t\t\t\t\t\t\t\t\t\t\tpost: postId,\n\t\t\t\t\t\t\t\t\t\t\t\t\taction: 'edit',\n\t\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t},\n\t\t[ createSuccessNotice ]\n\t);\n\n\tconst initialPost = useMemo( () => {\n\t\treturn {\n\t\t\ttype: initialPostType,\n\t\t\tid: initialPostId,\n\t\t};\n\t}, [ initialPostType, initialPostId ] );\n\n\tconst backButton =\n\t\tuseViewportMatch( 'medium' ) && isFullscreenActive ? (\n\t\t\t<BackButton initialPost={ initialPost } />\n\t\t) : null;\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<ErrorBoundary canCopyContent>\n\t\t\t\t<WelcomeGuide postType={ currentPostType } />\n\t\t\t\t<div\n\t\t\t\t\tclassName={ navigateRegionsProps.className }\n\t\t\t\t\t{ ...navigateRegionsProps }\n\t\t\t\t\tref={ navigateRegionsProps.ref }\n\t\t\t\t>\n\t\t\t\t\t<Editor\n\t\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\t\tpostType={ currentPostType }\n\t\t\t\t\t\tpostId={ currentPostId }\n\t\t\t\t\t\ttemplateId={ templateId }\n\t\t\t\t\t\tclassName={ className }\n\t\t\t\t\t\tforceIsDirty={ hasActiveMetaboxes }\n\t\t\t\t\t\tcontentRef={ paddingAppenderRef }\n\t\t\t\t\t\tdisableIframe={ ! shouldIframe }\n\t\t\t\t\t\t// We should auto-focus the canvas (title) on load.\n\t\t\t\t\t\t// eslint-disable-next-line jsx-a11y/no-autofocus\n\t\t\t\t\t\tautoFocus={ ! isWelcomeGuideVisible }\n\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\textraSidebarPanels={\n\t\t\t\t\t\t\tshowMetaBoxes && <MetaBoxes location=\"side\" />\n\t\t\t\t\t\t}\n\t\t\t\t\t\textraContent={\n\t\t\t\t\t\t\t! isDistractionFree &&\n\t\t\t\t\t\t\tshowMetaBoxes && (\n\t\t\t\t\t\t\t\t<MetaBoxesMain\n\t\t\t\t\t\t\t\t\tisLegacy={\n\t\t\t\t\t\t\t\t\t\t! shouldIframe || isDevicePreview\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<PostLockedModal />\n\t\t\t\t\t\t<EditorInitialization />\n\t\t\t\t\t\t<FullscreenMode isActive={ isFullscreenActive } />\n\t\t\t\t\t\t<BrowserURL />\n\t\t\t\t\t\t<UnsavedChangesWarning />\n\t\t\t\t\t\t<AutosaveMonitor />\n\t\t\t\t\t\t<LocalAutosaveMonitor />\n\t\t\t\t\t\t<EditPostKeyboardShortcuts />\n\t\t\t\t\t\t<EditorKeyboardShortcutsRegister />\n\t\t\t\t\t\t<BlockKeyboardShortcuts />\n\t\t\t\t\t\t<InitPatternModal />\n\t\t\t\t\t\t<PluginArea onError={ onPluginAreaError } />\n\t\t\t\t\t\t<PostEditorMoreMenu />\n\t\t\t\t\t\t{ backButton }\n\t\t\t\t\t\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AAA;AAAA,IACD;AAAA,KACD,GACD;AAEF;AAEA,IAAO,iBAAQ;",
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { NavigableRegion } from '@wordpress/admin-ui';\nimport {\n\tAutosaveMonitor,\n\tLocalAutosaveMonitor,\n\tUnsavedChangesWarning,\n\tEditorKeyboardShortcutsRegister,\n\tEditorSnackbars,\n\tErrorBoundary,\n\tPostLockedModal,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { getLayoutStyles } from '@wordpress/global-styles-engine';\nimport { PluginArea } from '@wordpress/plugins';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseId,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\nimport { chevronDown, chevronUp } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { privateApis as commandsPrivateApis } from '@wordpress/commands';\nimport { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';\nimport { addQueryArgs } from '@wordpress/url';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tIcon,\n\tResizableBox,\n\tSlotFillProvider,\n\tTooltip,\n\tVisuallyHidden,\n\t__unstableUseNavigateRegions as useNavigateRegions,\n} from '@wordpress/components';\nimport {\n\tuseEvent,\n\tuseMediaQuery,\n\tuseRefEffect,\n\tuseViewportMatch,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BackButton from '../back-button';\nimport EditorInitialization from '../editor-initialization';\nimport EditPostKeyboardShortcuts from '../keyboard-shortcuts';\nimport InitPatternModal from '../init-pattern-modal';\nimport BrowserURL from '../browser-url';\nimport MetaBoxes from '../meta-boxes';\nimport PostEditorMoreMenu from '../more-menu';\nimport WelcomeGuide from '../welcome-guide';\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport useEditPostCommands from '../../commands/use-commands';\nimport { useShouldIframe } from './use-should-iframe';\nimport useNavigateToEntityRecord from '../../hooks/use-navigate-to-entity-record';\nimport { useMetaBoxInitialization } from '../meta-boxes/use-meta-box-initialization';\n\nconst { useCommandContext } = unlock( commandsPrivateApis );\nconst { Editor, FullscreenMode } = unlock( editorPrivateApis );\nconst { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );\nconst DESIGN_POST_TYPES = [\n\t'wp_template',\n\t'wp_template_part',\n\t'wp_block',\n\t'wp_navigation',\n];\n\nfunction useEditorStyles( settings ) {\n\tconst { hasThemeStyleSupport } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\thasThemeStyleSupport:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'themeStyles' ),\n\t\t};\n\t}, [] );\n\n\t// Compute the default styles.\n\treturn useMemo( () => {\n\t\tconst presetStyles =\n\t\t\tsettings.styles?.filter(\n\t\t\t\t( style ) =>\n\t\t\t\t\tstyle.__unstableType && style.__unstableType !== 'theme'\n\t\t\t) ?? [];\n\n\t\tconst defaultEditorStyles = [\n\t\t\t...( settings?.defaultEditorStyles ?? [] ),\n\t\t\t...presetStyles,\n\t\t];\n\n\t\t// Has theme styles if the theme supports them and if some styles were not preset styles (in which case they're theme styles).\n\t\tconst hasThemeStyles =\n\t\t\thasThemeStyleSupport &&\n\t\t\tpresetStyles.length !== ( settings.styles?.length ?? 0 );\n\n\t\t// If theme styles are not present or displayed, ensure that\n\t\t// base layout styles are still present in the editor.\n\t\tif ( ! settings.disableLayoutStyles && ! hasThemeStyles ) {\n\t\t\tdefaultEditorStyles.push( {\n\t\t\t\tcss: getLayoutStyles( {\n\t\t\t\t\tstyle: {},\n\t\t\t\t\tselector: 'body',\n\t\t\t\t\thasBlockGapSupport: false,\n\t\t\t\t\thasFallbackGapSupport: true,\n\t\t\t\t\tfallbackGapValue: '0.5em',\n\t\t\t\t} ),\n\t\t\t} );\n\t\t}\n\n\t\treturn hasThemeStyles ? settings.styles ?? [] : defaultEditorStyles;\n\t}, [\n\t\tsettings.defaultEditorStyles,\n\t\tsettings.disableLayoutStyles,\n\t\tsettings.styles,\n\t\thasThemeStyleSupport,\n\t] );\n}\n\n/**\n * @param {Object} props\n * @param {boolean} props.isLegacy True when the editor canvas is not in an iframe.\n */\nfunction MetaBoxesMain( { isLegacy } ) {\n\tconst [ isOpen, openHeight, hasAnyVisible ] = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { isMetaBoxLocationVisible } = select( editPostStore );\n\t\treturn [\n\t\t\t!! get( 'core/edit-post', 'metaBoxesMainIsOpen' ),\n\t\t\tget( 'core/edit-post', 'metaBoxesMainOpenHeight' ),\n\t\t\tisMetaBoxLocationVisible( 'normal' ) ||\n\t\t\t\tisMetaBoxLocationVisible( 'advanced' ) ||\n\t\t\t\tisMetaBoxLocationVisible( 'side' ),\n\t\t];\n\t}, [] );\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\tconst metaBoxesMainRef = useRef();\n\tconst isShort = useMediaQuery( '(max-height: 549px)' );\n\n\tconst [ { min, max }, setHeightConstraints ] = useState( () => ( {} ) );\n\t// Keeps the resizable area\u2019s size constraints updated taking into account\n\t// editor notices. The constraints are also used to derive the value for the\n\t// aria-valuenow attribute on the separator.\n\tconst effectSizeConstraints = useRefEffect( ( node ) => {\n\t\tconst container = node.closest(\n\t\t\t'.interface-interface-skeleton__content'\n\t\t);\n\t\tif ( ! container ) {\n\t\t\treturn;\n\t\t}\n\t\tconst noticeLists = container.querySelectorAll(\n\t\t\t':scope > .components-notice-list'\n\t\t);\n\t\tconst resizeHandle = container.querySelector(\n\t\t\t'.edit-post-meta-boxes-main__presenter'\n\t\t);\n\t\tconst deriveConstraints = () => {\n\t\t\tconst fullHeight = container.offsetHeight;\n\t\t\tlet nextMax = fullHeight;\n\t\t\tfor ( const element of noticeLists ) {\n\t\t\t\tnextMax -= element.offsetHeight;\n\t\t\t}\n\t\t\tconst nextMin = resizeHandle.offsetHeight;\n\t\t\tsetHeightConstraints( { min: nextMin, max: nextMax } );\n\t\t};\n\t\tconst observer = new window.ResizeObserver( deriveConstraints );\n\t\tobserver.observe( container );\n\t\tfor ( const element of noticeLists ) {\n\t\t\tobserver.observe( element );\n\t\t}\n\t\treturn () => observer.disconnect();\n\t}, [] );\n\n\tconst resizeDataRef = useRef( {} );\n\tconst separatorRef = useRef();\n\tconst separatorHelpId = useId();\n\n\t/**\n\t * @param {number|'auto'} [candidateHeight] Height in pixels or 'auto'.\n\t * @param {boolean} isPersistent Whether to persist the height in preferences.\n\t * @param {boolean} isInstant Whether to update the height in the DOM.\n\t */\n\tconst applyHeight = (\n\t\tcandidateHeight = 'auto',\n\t\tisPersistent,\n\t\tisInstant\n\t) => {\n\t\tif ( candidateHeight === 'auto' ) {\n\t\t\tisPersistent = false; // Just in case \u2014 \u201Cauto\u201D should never persist.\n\t\t} else {\n\t\t\tcandidateHeight = Math.min( max, Math.max( min, candidateHeight ) );\n\t\t}\n\t\tif ( isPersistent ) {\n\t\t\tsetPreference(\n\t\t\t\t'core/edit-post',\n\t\t\t\t'metaBoxesMainOpenHeight',\n\t\t\t\tcandidateHeight\n\t\t\t);\n\t\t}\n\t\t// Updates aria-valuenow only when not persisting the value because otherwise\n\t\t// it's done by the render that persisting the value causes.\n\t\telse if ( ! isShort ) {\n\t\t\tseparatorRef.current.ariaValueNow =\n\t\t\t\tgetAriaValueNow( candidateHeight );\n\t\t}\n\t\tif ( isInstant ) {\n\t\t\tmetaBoxesMainRef.current.updateSize( {\n\t\t\t\theight: candidateHeight,\n\t\t\t\t// Oddly, when the event that triggered this was not from the mouse (e.g. keydown),\n\t\t\t\t// if `width` is left unspecified a subsequent drag gesture applies a fixed\n\t\t\t\t// width and the pane fails to widen/narrow with parent width changes from\n\t\t\t\t// sidebars opening/closing or window resizes.\n\t\t\t\twidth: 'auto',\n\t\t\t} );\n\t\t}\n\t};\n\tconst getRenderValues = useEvent( () => ( { isOpen, openHeight, min } ) );\n\t// Sets the height to 'auto' when not resizable (isShort) and to the\n\t// preferred height when resizable.\n\tuseEffect( () => {\n\t\tconst fresh = getRenderValues();\n\t\t// Tests for `min` having a value to skip the first render.\n\t\tif ( fresh.min !== undefined && metaBoxesMainRef.current ) {\n\t\t\tconst usedOpenHeight = isShort ? 'auto' : fresh.openHeight;\n\t\t\tconst usedHeight = fresh.isOpen ? usedOpenHeight : fresh.min;\n\t\t\tapplyHeight( usedHeight, false, true );\n\t\t}\n\t}, [ isShort ] );\n\n\tif ( ! hasAnyVisible ) {\n\t\treturn;\n\t}\n\n\tconst contents = (\n\t\t<div\n\t\t\t// The class name 'edit-post-layout__metaboxes' is retained because some plugins use it.\n\t\t\tclassName=\"edit-post-layout__metaboxes edit-post-meta-boxes-main__liner\"\n\t\t\thidden={ ! isLegacy && ! isOpen }\n\t\t>\n\t\t\t<MetaBoxes location=\"normal\" />\n\t\t\t<MetaBoxes location=\"advanced\" />\n\t\t</div>\n\t);\n\n\tif ( isLegacy ) {\n\t\treturn contents;\n\t}\n\n\tconst isAutoHeight = openHeight === undefined;\n\tconst getAriaValueNow = ( height ) =>\n\t\tMath.round( ( ( height - min ) / ( max - min ) ) * 100 );\n\tconst usedAriaValueNow =\n\t\tmax === undefined || isAutoHeight ? 50 : getAriaValueNow( openHeight );\n\n\tconst persistIsOpen = ( to = ! isOpen ) =>\n\t\tsetPreference( 'core/edit-post', 'metaBoxesMainIsOpen', to );\n\n\t// TODO: Support more/all keyboard interactions from the window splitter pattern:\n\t// https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/\n\tconst onSeparatorKeyDown = ( event ) => {\n\t\tconst delta = { ArrowUp: 20, ArrowDown: -20 }[ event.key ];\n\t\tif ( delta ) {\n\t\t\tconst pane = metaBoxesMainRef.current.resizable;\n\t\t\tconst fromHeight = isAutoHeight ? pane.offsetHeight : openHeight;\n\t\t\tconst nextHeight = delta + fromHeight;\n\t\t\tapplyHeight( nextHeight, true, true );\n\t\t\tpersistIsOpen( nextHeight > min );\n\t\t\tevent.preventDefault();\n\t\t}\n\t};\n\tconst paneLabel = __( 'Meta Boxes' );\n\n\tconst toggle = (\n\t\t<button\n\t\t\taria-expanded={ isOpen }\n\t\t\tonClick={ ( { detail } ) => {\n\t\t\t\tconst { isToggleInferred } = resizeDataRef.current;\n\t\t\t\tif ( isShort || ! detail || isToggleInferred ) {\n\t\t\t\t\tpersistIsOpen();\n\t\t\t\t\tconst usedOpenHeight = isShort ? 'auto' : openHeight;\n\t\t\t\t\tconst usedHeight = isOpen ? min : usedOpenHeight;\n\t\t\t\t\tapplyHeight( usedHeight, false, true );\n\t\t\t\t}\n\t\t\t} }\n\t\t\t// Prevents resizing in short viewports.\n\t\t\t{ ...( isShort && {\n\t\t\t\tonMouseDown: ( event ) => event.stopPropagation(),\n\t\t\t\tonTouchStart: ( event ) => event.stopPropagation(),\n\t\t\t} ) }\n\t\t>\n\t\t\t{ paneLabel }\n\t\t\t<Icon icon={ isOpen ? chevronUp : chevronDown } />\n\t\t</button>\n\t);\n\n\tconst separator = ! isShort && (\n\t\t<>\n\t\t\t<Tooltip text={ __( 'Drag to resize' ) }>\n\t\t\t\t<button // eslint-disable-line jsx-a11y/role-supports-aria-props\n\t\t\t\t\tref={ separatorRef }\n\t\t\t\t\trole=\"separator\" // eslint-disable-line jsx-a11y/no-interactive-element-to-noninteractive-role\n\t\t\t\t\taria-valuenow={ usedAriaValueNow }\n\t\t\t\t\taria-label={ __( 'Drag to resize' ) }\n\t\t\t\t\taria-describedby={ separatorHelpId }\n\t\t\t\t\tonKeyDown={ onSeparatorKeyDown }\n\t\t\t\t/>\n\t\t\t</Tooltip>\n\t\t\t<VisuallyHidden id={ separatorHelpId }>\n\t\t\t\t{ __(\n\t\t\t\t\t'Use up and down arrow keys to resize the meta box panel.'\n\t\t\t\t) }\n\t\t\t</VisuallyHidden>\n\t\t</>\n\t);\n\n\tconst paneProps = /** @type {Parameters<typeof ResizableBox>[0]} */ ( {\n\t\tas: NavigableRegion,\n\t\tref: metaBoxesMainRef,\n\t\tclassName: 'edit-post-meta-boxes-main',\n\t\tdefaultSize: { height: isOpen ? openHeight : 0 },\n\t\tminHeight: min,\n\t\tmaxHeight: max,\n\t\tenable: { top: true },\n\t\thandleClasses: { top: 'edit-post-meta-boxes-main__presenter' },\n\t\thandleComponent: {\n\t\t\ttop: (\n\t\t\t\t<>\n\t\t\t\t\t{ toggle }\n\t\t\t\t\t{ separator }\n\t\t\t\t</>\n\t\t\t),\n\t\t},\n\t\t// Avoids hiccups while dragging over objects like iframes and ensures that\n\t\t// the event to end the drag is captured by the target (resize handle)\n\t\t// whether or not it\u2019s under the pointer.\n\t\tonPointerDown: ( { pointerId, target } ) => {\n\t\t\tif ( separatorRef.current?.parentElement.contains( target ) ) {\n\t\t\t\ttarget.setPointerCapture( pointerId );\n\t\t\t}\n\t\t},\n\t\tonResizeStart: ( { timeStamp }, direction, elementRef ) => {\n\t\t\tif ( isAutoHeight ) {\n\t\t\t\t// Sets the starting height to avoid visual jumps in height and\n\t\t\t\t// aria-valuenow being `NaN` for the first (few) resize events.\n\t\t\t\tapplyHeight( elementRef.offsetHeight, false, true );\n\t\t\t}\n\t\t\telementRef.classList.add( 'is-resizing' );\n\t\t\tresizeDataRef.current = { timeStamp, maxDelta: 0 };\n\t\t},\n\t\tonResize: ( event, direction, elementRef, delta ) => {\n\t\t\tconst { maxDelta } = resizeDataRef.current;\n\t\t\tconst newDelta = Math.abs( delta.height );\n\t\t\tresizeDataRef.current.maxDelta = Math.max( maxDelta, newDelta );\n\t\t\tapplyHeight( metaBoxesMainRef.current.state.height );\n\t\t},\n\t\tonResizeStop: ( event, direction, elementRef ) => {\n\t\t\telementRef.classList.remove( 'is-resizing' );\n\t\t\tconst duration = event.timeStamp - resizeDataRef.current.timeStamp;\n\t\t\tconst wasSeparator = event.target === separatorRef.current;\n\t\t\tconst { maxDelta } = resizeDataRef.current;\n\t\t\tconst isToggleInferred =\n\t\t\t\tmaxDelta < 1 || ( duration < 144 && maxDelta < 5 );\n\t\t\tif ( isShort || ( ! wasSeparator && isToggleInferred ) ) {\n\t\t\t\tresizeDataRef.current.isToggleInferred = true;\n\t\t\t} else {\n\t\t\t\tconst { height } = metaBoxesMainRef.current.state;\n\t\t\t\tconst nextIsOpen = height > min;\n\t\t\t\tpersistIsOpen( nextIsOpen );\n\t\t\t\t// Persists height only if still open. This is so that when closed by a drag the\n\t\t\t\t// prior height can be restored by the toggle button instead of having to drag\n\t\t\t\t// the pane open again. Also, if already closed, a click on the separator won\u2019t\n\t\t\t\t// persist the height as the minimum.\n\t\t\t\tif ( nextIsOpen ) {\n\t\t\t\t\tapplyHeight( height, true );\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t} );\n\n\treturn (\n\t\t<ResizableBox aria-label={ paneLabel } { ...paneProps }>\n\t\t\t<meta ref={ effectSizeConstraints } />\n\t\t\t{ contents }\n\t\t</ResizableBox>\n\t);\n}\n\nfunction Layout( {\n\tpostId: initialPostId,\n\tpostType: initialPostType,\n\tsettings,\n\tinitialEdits,\n} ) {\n\tuseEditPostCommands();\n\tconst shouldIframe = useShouldIframe();\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst {\n\t\tcurrentPost: { postId: currentPostId, postType: currentPostType },\n\t\tonNavigateToEntityRecord,\n\t\tonNavigateToPreviousEntityRecord,\n\t} = useNavigateToEntityRecord(\n\t\tinitialPostId,\n\t\tinitialPostType,\n\t\t'post-only'\n\t);\n\tconst isEditingTemplate = currentPostType === 'wp_template';\n\tconst {\n\t\tmode,\n\t\tisFullscreenActive,\n\t\thasResolvedMode,\n\t\thasActiveMetaboxes,\n\t\thasBlockSelected,\n\t\tshowIconLabels,\n\t\tisDistractionFree,\n\t\tshowMetaBoxes,\n\t\tisWelcomeGuideVisible,\n\t\ttemplateId,\n\t\tisDevicePreview,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\tconst { isFeatureActive, hasMetaBoxes } = select( editPostStore );\n\t\t\tconst { canUser, getPostType, getTemplateId } = unlock(\n\t\t\t\tselect( coreStore )\n\t\t\t);\n\n\t\t\tconst supportsTemplateMode = settings.supportsTemplateMode;\n\t\t\tconst isViewable =\n\t\t\t\tgetPostType( currentPostType )?.viewable ?? false;\n\t\t\tconst canViewTemplate = canUser( 'read', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} );\n\t\t\tconst { getBlockSelectionStart, isZoomOut } = unlock(\n\t\t\t\tselect( blockEditorStore )\n\t\t\t);\n\t\t\tconst { getEditorMode, getDefaultRenderingMode, getDeviceType } =\n\t\t\t\tunlock( select( editorStore ) );\n\t\t\tconst isNotDesignPostType =\n\t\t\t\t! DESIGN_POST_TYPES.includes( currentPostType );\n\t\t\tconst isDirectlyEditingPattern =\n\t\t\t\tcurrentPostType === 'wp_block' &&\n\t\t\t\t! onNavigateToPreviousEntityRecord;\n\t\t\tconst _templateId = getTemplateId( currentPostType, currentPostId );\n\t\t\tconst defaultMode = getDefaultRenderingMode( currentPostType );\n\n\t\t\treturn {\n\t\t\t\tmode: getEditorMode(),\n\t\t\t\tisFullscreenActive: isFeatureActive( 'fullscreenMode' ),\n\t\t\t\thasActiveMetaboxes: hasMetaBoxes(),\n\t\t\t\thasResolvedMode:\n\t\t\t\t\tdefaultMode === 'template-locked'\n\t\t\t\t\t\t? !! _templateId\n\t\t\t\t\t\t: defaultMode !== undefined,\n\t\t\t\thasBlockSelected: !! getBlockSelectionStart(),\n\t\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\t\tshowMetaBoxes:\n\t\t\t\t\t( isNotDesignPostType && ! isZoomOut() ) ||\n\t\t\t\t\tisDirectlyEditingPattern,\n\t\t\t\tisWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),\n\t\t\t\ttemplateId:\n\t\t\t\t\tsupportsTemplateMode &&\n\t\t\t\t\tisViewable &&\n\t\t\t\t\tcanViewTemplate &&\n\t\t\t\t\t! isEditingTemplate\n\t\t\t\t\t\t? _templateId\n\t\t\t\t\t\t: null,\n\t\t\t\tisDevicePreview: getDeviceType() !== 'Desktop',\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tcurrentPostType,\n\t\t\tcurrentPostId,\n\t\t\tisEditingTemplate,\n\t\t\tsettings.supportsTemplateMode,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t]\n\t);\n\n\tuseMetaBoxInitialization( hasActiveMetaboxes && hasResolvedMode );\n\n\t// Set the right context for the command palette\n\tconst commandContext = hasBlockSelected\n\t\t? 'block-selection-edit'\n\t\t: 'entity-edit';\n\tuseCommandContext( commandContext );\n\tconst styles = useEditorStyles( settings );\n\tconst editorSettings = useMemo(\n\t\t() => ( {\n\t\t\t...settings,\n\t\t\tstyles,\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t\tdefaultRenderingMode: 'post-only',\n\t\t} ),\n\t\t[\n\t\t\tsettings,\n\t\t\tstyles,\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t]\n\t);\n\n\t// We need to add the show-icon-labels class to the body element so it is applied to modals.\n\tif ( showIconLabels ) {\n\t\tdocument.body.classList.add( 'show-icon-labels' );\n\t} else {\n\t\tdocument.body.classList.remove( 'show-icon-labels' );\n\t}\n\n\tconst navigateRegionsProps = useNavigateRegions();\n\n\tconst className = clsx( 'edit-post-layout', 'is-mode-' + mode, {\n\t\t'has-metaboxes': hasActiveMetaboxes,\n\t} );\n\n\tfunction onPluginAreaError( name ) {\n\t\tcreateErrorNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: plugin name */\n\t\t\t\t__(\n\t\t\t\t\t'The \"%s\" plugin has encountered an error and cannot be rendered.'\n\t\t\t\t),\n\t\t\t\tname\n\t\t\t)\n\t\t);\n\t}\n\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst onActionPerformed = useCallback(\n\t\t( actionId, items ) => {\n\t\t\tswitch ( actionId ) {\n\t\t\t\tcase 'move-to-trash':\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.location.href = addQueryArgs( 'edit.php', {\n\t\t\t\t\t\t\ttrashed: 1,\n\t\t\t\t\t\t\tpost_type: items[ 0 ].type,\n\t\t\t\t\t\t\tids: items[ 0 ].id,\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'duplicate-post':\n\t\t\t\t\t{\n\t\t\t\t\t\tconst newItem = items[ 0 ];\n\t\t\t\t\t\tconst title =\n\t\t\t\t\t\t\ttypeof newItem.title === 'string'\n\t\t\t\t\t\t\t\t? newItem.title\n\t\t\t\t\t\t\t\t: newItem.title?.rendered;\n\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Title of the created post or template, e.g: \"Hello world\".\n\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\tdecodeEntities( title ) || __( '(no title)' )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlabel: __( 'Edit' ),\n\t\t\t\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\t\t\t\tconst postId = newItem.id;\n\t\t\t\t\t\t\t\t\t\t\tdocument.location.href =\n\t\t\t\t\t\t\t\t\t\t\t\taddQueryArgs( 'post.php', {\n\t\t\t\t\t\t\t\t\t\t\t\t\tpost: postId,\n\t\t\t\t\t\t\t\t\t\t\t\t\taction: 'edit',\n\t\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t},\n\t\t[ createSuccessNotice ]\n\t);\n\n\tconst initialPost = useMemo( () => {\n\t\treturn {\n\t\t\ttype: initialPostType,\n\t\t\tid: initialPostId,\n\t\t};\n\t}, [ initialPostType, initialPostId ] );\n\n\tconst backButton =\n\t\tuseViewportMatch( 'medium' ) && isFullscreenActive ? (\n\t\t\t<BackButton initialPost={ initialPost } />\n\t\t) : null;\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<ErrorBoundary canCopyContent>\n\t\t\t\t<WelcomeGuide postType={ currentPostType } />\n\t\t\t\t<div\n\t\t\t\t\tclassName={ navigateRegionsProps.className }\n\t\t\t\t\t{ ...navigateRegionsProps }\n\t\t\t\t\tref={ navigateRegionsProps.ref }\n\t\t\t\t>\n\t\t\t\t\t<Editor\n\t\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\t\tpostType={ currentPostType }\n\t\t\t\t\t\tpostId={ currentPostId }\n\t\t\t\t\t\ttemplateId={ templateId }\n\t\t\t\t\t\tclassName={ className }\n\t\t\t\t\t\tforceIsDirty={ hasActiveMetaboxes }\n\t\t\t\t\t\tdisableIframe={ ! shouldIframe }\n\t\t\t\t\t\t// We should auto-focus the canvas (title) on load.\n\t\t\t\t\t\t// eslint-disable-next-line jsx-a11y/no-autofocus\n\t\t\t\t\t\tautoFocus={ ! isWelcomeGuideVisible }\n\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\textraSidebarPanels={\n\t\t\t\t\t\t\tshowMetaBoxes && <MetaBoxes location=\"side\" />\n\t\t\t\t\t\t}\n\t\t\t\t\t\textraContent={\n\t\t\t\t\t\t\t! isDistractionFree &&\n\t\t\t\t\t\t\tshowMetaBoxes && (\n\t\t\t\t\t\t\t\t<MetaBoxesMain\n\t\t\t\t\t\t\t\t\tisLegacy={\n\t\t\t\t\t\t\t\t\t\t! shouldIframe || isDevicePreview\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<PostLockedModal />\n\t\t\t\t\t\t<EditorInitialization />\n\t\t\t\t\t\t<FullscreenMode isActive={ isFullscreenActive } />\n\t\t\t\t\t\t<BrowserURL />\n\t\t\t\t\t\t<UnsavedChangesWarning />\n\t\t\t\t\t\t<AutosaveMonitor />\n\t\t\t\t\t\t<LocalAutosaveMonitor />\n\t\t\t\t\t\t<EditPostKeyboardShortcuts />\n\t\t\t\t\t\t<EditorKeyboardShortcutsRegister />\n\t\t\t\t\t\t<BlockKeyboardShortcuts />\n\t\t\t\t\t\t<InitPatternModal />\n\t\t\t\t\t\t<PluginArea onError={ onPluginAreaError } />\n\t\t\t\t\t\t<PostEditorMoreMenu />\n\t\t\t\t\t\t{ backButton }\n\t\t\t\t\t\t<EditorSnackbars />\n\t\t\t\t\t</Editor>\n\t\t\t\t</div>\n\t\t\t</ErrorBoundary>\n\t\t</SlotFillProvider>\n\t);\n}\n\nexport default Layout;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,sBAAgC;AAChC,oBAUO;AACP,kBAAuC;AACvC,0BAA0C;AAC1C,kCAAgC;AAChC,qBAA2B;AAC3B,kBAA4B;AAC5B,qBAOO;AACP,mBAAuC;AACvC,qBAAsC;AACtC,yBAA0C;AAC1C,sBAAmD;AACnD,2BAAuD;AACvD,iBAA6B;AAC7B,2BAA+B;AAC/B,uBAAmC;A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,cAChD,4CAAC,mBAAAC,SAAA,EAAW;AAAA,cACZ,4CAAC,uCAAsB;AAAA,cACvB,4CAAC,iCAAgB;AAAA,cACjB,4CAAC,sCAAqB;AAAA,cACtB,4CAAC,0BAAAC,SAAA,EAA0B;AAAA,cAC3B,4CAAC,iDAAgC;AAAA,cACjC,4CAAC,0BAAuB;AAAA,cACxB,4CAAC,0BAAAC,SAAA,EAAiB;AAAA,cAClB,4CAAC,6BAAW,SAAU,mBAAoB;AAAA,cAC1C,4CAAC,iBAAAC,SAAA,EAAmB;AAAA,cAClB;AAAA,cACF,4CAAC,iCAAgB;AAAA;AAAA;AAAA,QAClB;AAAA;AAAA,IACD;AAAA,KACD,GACD;AAEF;AAEA,IAAO,iBAAQ;",
|
|
6
6
|
"names": ["commandsPrivateApis", "editorPrivateApis", "blockLibraryPrivateApis", "editPostStore", "preferencesStore", "MetaBoxes", "useEditPostCommands", "noticesStore", "useNavigateToEntityRecord", "coreStore", "blockEditorStore", "editorStore", "useNavigateRegions", "clsx", "BackButton", "WelcomeGuide", "EditorInitialization", "BrowserURL", "EditPostKeyboardShortcuts", "InitPatternModal", "PostEditorMoreMenu"]
|
|
7
7
|
}
|
|
@@ -58,7 +58,6 @@ import WelcomeGuide from "../welcome-guide";
|
|
|
58
58
|
import { store as editPostStore } from "../../store";
|
|
59
59
|
import { unlock } from "../../lock-unlock";
|
|
60
60
|
import useEditPostCommands from "../../commands/use-commands";
|
|
61
|
-
import { usePaddingAppender } from "./use-padding-appender";
|
|
62
61
|
import { useShouldIframe } from "./use-should-iframe";
|
|
63
62
|
import useNavigateToEntityRecord from "../../hooks/use-navigate-to-entity-record";
|
|
64
63
|
import { useMetaBoxInitialization } from "../meta-boxes/use-meta-box-initialization";
|
|
@@ -72,13 +71,12 @@ var DESIGN_POST_TYPES = [
|
|
|
72
71
|
"wp_block",
|
|
73
72
|
"wp_navigation"
|
|
74
73
|
];
|
|
75
|
-
function useEditorStyles(settings
|
|
74
|
+
function useEditorStyles(settings) {
|
|
76
75
|
const { hasThemeStyleSupport } = useSelect((select) => {
|
|
77
76
|
return {
|
|
78
77
|
hasThemeStyleSupport: select(editPostStore).isFeatureActive("themeStyles")
|
|
79
78
|
};
|
|
80
79
|
}, []);
|
|
81
|
-
const addedStyles = additionalStyles.join("\n");
|
|
82
80
|
return useMemo(() => {
|
|
83
81
|
const presetStyles = settings.styles?.filter(
|
|
84
82
|
(style) => style.__unstableType && style.__unstableType !== "theme"
|
|
@@ -99,17 +97,12 @@ function useEditorStyles(settings, ...additionalStyles) {
|
|
|
99
97
|
})
|
|
100
98
|
});
|
|
101
99
|
}
|
|
102
|
-
|
|
103
|
-
if (addedStyles) {
|
|
104
|
-
return [...baseStyles, { css: addedStyles }];
|
|
105
|
-
}
|
|
106
|
-
return baseStyles;
|
|
100
|
+
return hasThemeStyles ? settings.styles ?? [] : defaultEditorStyles;
|
|
107
101
|
}, [
|
|
108
102
|
settings.defaultEditorStyles,
|
|
109
103
|
settings.disableLayoutStyles,
|
|
110
104
|
settings.styles,
|
|
111
|
-
hasThemeStyleSupport
|
|
112
|
-
addedStyles
|
|
105
|
+
hasThemeStyleSupport
|
|
113
106
|
]);
|
|
114
107
|
}
|
|
115
108
|
function MetaBoxesMain({ isLegacy }) {
|
|
@@ -357,7 +350,6 @@ function Layout({
|
|
|
357
350
|
showMetaBoxes,
|
|
358
351
|
isWelcomeGuideVisible,
|
|
359
352
|
templateId,
|
|
360
|
-
enablePaddingAppender,
|
|
361
353
|
isDevicePreview
|
|
362
354
|
} = useSelect(
|
|
363
355
|
(select) => {
|
|
@@ -375,13 +367,7 @@ function Layout({
|
|
|
375
367
|
const { getBlockSelectionStart, isZoomOut } = unlock(
|
|
376
368
|
select(blockEditorStore)
|
|
377
369
|
);
|
|
378
|
-
const {
|
|
379
|
-
getEditorMode,
|
|
380
|
-
getRenderingMode,
|
|
381
|
-
getDefaultRenderingMode,
|
|
382
|
-
getDeviceType
|
|
383
|
-
} = unlock(select(editorStore));
|
|
384
|
-
const isRenderingPostOnly = getRenderingMode() === "post-only";
|
|
370
|
+
const { getEditorMode, getDefaultRenderingMode, getDeviceType } = unlock(select(editorStore));
|
|
385
371
|
const isNotDesignPostType = !DESIGN_POST_TYPES.includes(currentPostType);
|
|
386
372
|
const isDirectlyEditingPattern = currentPostType === "wp_block" && !onNavigateToPreviousEntityRecord;
|
|
387
373
|
const _templateId = getTemplateId(currentPostType, currentPostId);
|
|
@@ -397,7 +383,6 @@ function Layout({
|
|
|
397
383
|
showMetaBoxes: isNotDesignPostType && !isZoomOut() || isDirectlyEditingPattern,
|
|
398
384
|
isWelcomeGuideVisible: isFeatureActive("welcomeGuide"),
|
|
399
385
|
templateId: supportsTemplateMode && isViewable && canViewTemplate && !isEditingTemplate ? _templateId : null,
|
|
400
|
-
enablePaddingAppender: !isZoomOut() && isRenderingPostOnly && isNotDesignPostType,
|
|
401
386
|
isDevicePreview: getDeviceType() !== "Desktop"
|
|
402
387
|
};
|
|
403
388
|
},
|
|
@@ -410,12 +395,9 @@ function Layout({
|
|
|
410
395
|
]
|
|
411
396
|
);
|
|
412
397
|
useMetaBoxInitialization(hasActiveMetaboxes && hasResolvedMode);
|
|
413
|
-
const [paddingAppenderRef, paddingStyle] = usePaddingAppender(
|
|
414
|
-
enablePaddingAppender
|
|
415
|
-
);
|
|
416
398
|
const commandContext = hasBlockSelected ? "block-selection-edit" : "entity-edit";
|
|
417
399
|
useCommandContext(commandContext);
|
|
418
|
-
const styles = useEditorStyles(settings
|
|
400
|
+
const styles = useEditorStyles(settings);
|
|
419
401
|
const editorSettings = useMemo(
|
|
420
402
|
() => ({
|
|
421
403
|
...settings,
|
|
@@ -522,7 +504,6 @@ function Layout({
|
|
|
522
504
|
templateId,
|
|
523
505
|
className,
|
|
524
506
|
forceIsDirty: hasActiveMetaboxes,
|
|
525
|
-
contentRef: paddingAppenderRef,
|
|
526
507
|
disableIframe: !shouldIframe,
|
|
527
508
|
autoFocus: !isWelcomeGuideVisible,
|
|
528
509
|
onActionPerformed,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/layout/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { NavigableRegion } from '@wordpress/admin-ui';\nimport {\n\tAutosaveMonitor,\n\tLocalAutosaveMonitor,\n\tUnsavedChangesWarning,\n\tEditorKeyboardShortcutsRegister,\n\tEditorSnackbars,\n\tErrorBoundary,\n\tPostLockedModal,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { getLayoutStyles } from '@wordpress/global-styles-engine';\nimport { PluginArea } from '@wordpress/plugins';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseId,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\nimport { chevronDown, chevronUp } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { privateApis as commandsPrivateApis } from '@wordpress/commands';\nimport { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';\nimport { addQueryArgs } from '@wordpress/url';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tIcon,\n\tResizableBox,\n\tSlotFillProvider,\n\tTooltip,\n\tVisuallyHidden,\n\t__unstableUseNavigateRegions as useNavigateRegions,\n} from '@wordpress/components';\nimport {\n\tuseEvent,\n\tuseMediaQuery,\n\tuseRefEffect,\n\tuseViewportMatch,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BackButton from '../back-button';\nimport EditorInitialization from '../editor-initialization';\nimport EditPostKeyboardShortcuts from '../keyboard-shortcuts';\nimport InitPatternModal from '../init-pattern-modal';\nimport BrowserURL from '../browser-url';\nimport MetaBoxes from '../meta-boxes';\nimport PostEditorMoreMenu from '../more-menu';\nimport WelcomeGuide from '../welcome-guide';\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport useEditPostCommands from '../../commands/use-commands';\nimport { usePaddingAppender } from './use-padding-appender';\nimport { useShouldIframe } from './use-should-iframe';\nimport useNavigateToEntityRecord from '../../hooks/use-navigate-to-entity-record';\nimport { useMetaBoxInitialization } from '../meta-boxes/use-meta-box-initialization';\n\nconst { useCommandContext } = unlock( commandsPrivateApis );\nconst { Editor, FullscreenMode } = unlock( editorPrivateApis );\nconst { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );\nconst DESIGN_POST_TYPES = [\n\t'wp_template',\n\t'wp_template_part',\n\t'wp_block',\n\t'wp_navigation',\n];\n\nfunction useEditorStyles( settings, ...additionalStyles ) {\n\tconst { hasThemeStyleSupport } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\thasThemeStyleSupport:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'themeStyles' ),\n\t\t};\n\t}, [] );\n\n\tconst addedStyles = additionalStyles.join( '\\n' );\n\n\t// Compute the default styles.\n\treturn useMemo( () => {\n\t\tconst presetStyles =\n\t\t\tsettings.styles?.filter(\n\t\t\t\t( style ) =>\n\t\t\t\t\tstyle.__unstableType && style.__unstableType !== 'theme'\n\t\t\t) ?? [];\n\n\t\tconst defaultEditorStyles = [\n\t\t\t...( settings?.defaultEditorStyles ?? [] ),\n\t\t\t...presetStyles,\n\t\t];\n\n\t\t// Has theme styles if the theme supports them and if some styles were not preset styles (in which case they're theme styles).\n\t\tconst hasThemeStyles =\n\t\t\thasThemeStyleSupport &&\n\t\t\tpresetStyles.length !== ( settings.styles?.length ?? 0 );\n\n\t\t// If theme styles are not present or displayed, ensure that\n\t\t// base layout styles are still present in the editor.\n\t\tif ( ! settings.disableLayoutStyles && ! hasThemeStyles ) {\n\t\t\tdefaultEditorStyles.push( {\n\t\t\t\tcss: getLayoutStyles( {\n\t\t\t\t\tstyle: {},\n\t\t\t\t\tselector: 'body',\n\t\t\t\t\thasBlockGapSupport: false,\n\t\t\t\t\thasFallbackGapSupport: true,\n\t\t\t\t\tfallbackGapValue: '0.5em',\n\t\t\t\t} ),\n\t\t\t} );\n\t\t}\n\n\t\tconst baseStyles = hasThemeStyles\n\t\t\t? settings.styles ?? []\n\t\t\t: defaultEditorStyles;\n\n\t\tif ( addedStyles ) {\n\t\t\treturn [ ...baseStyles, { css: addedStyles } ];\n\t\t}\n\n\t\treturn baseStyles;\n\t}, [\n\t\tsettings.defaultEditorStyles,\n\t\tsettings.disableLayoutStyles,\n\t\tsettings.styles,\n\t\thasThemeStyleSupport,\n\t\taddedStyles,\n\t] );\n}\n\n/**\n * @param {Object} props\n * @param {boolean} props.isLegacy True when the editor canvas is not in an iframe.\n */\nfunction MetaBoxesMain( { isLegacy } ) {\n\tconst [ isOpen, openHeight, hasAnyVisible ] = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { isMetaBoxLocationVisible } = select( editPostStore );\n\t\treturn [\n\t\t\t!! get( 'core/edit-post', 'metaBoxesMainIsOpen' ),\n\t\t\tget( 'core/edit-post', 'metaBoxesMainOpenHeight' ),\n\t\t\tisMetaBoxLocationVisible( 'normal' ) ||\n\t\t\t\tisMetaBoxLocationVisible( 'advanced' ) ||\n\t\t\t\tisMetaBoxLocationVisible( 'side' ),\n\t\t];\n\t}, [] );\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\tconst metaBoxesMainRef = useRef();\n\tconst isShort = useMediaQuery( '(max-height: 549px)' );\n\n\tconst [ { min, max }, setHeightConstraints ] = useState( () => ( {} ) );\n\t// Keeps the resizable area\u2019s size constraints updated taking into account\n\t// editor notices. The constraints are also used to derive the value for the\n\t// aria-valuenow attribute on the separator.\n\tconst effectSizeConstraints = useRefEffect( ( node ) => {\n\t\tconst container = node.closest(\n\t\t\t'.interface-interface-skeleton__content'\n\t\t);\n\t\tif ( ! container ) {\n\t\t\treturn;\n\t\t}\n\t\tconst noticeLists = container.querySelectorAll(\n\t\t\t':scope > .components-notice-list'\n\t\t);\n\t\tconst resizeHandle = container.querySelector(\n\t\t\t'.edit-post-meta-boxes-main__presenter'\n\t\t);\n\t\tconst deriveConstraints = () => {\n\t\t\tconst fullHeight = container.offsetHeight;\n\t\t\tlet nextMax = fullHeight;\n\t\t\tfor ( const element of noticeLists ) {\n\t\t\t\tnextMax -= element.offsetHeight;\n\t\t\t}\n\t\t\tconst nextMin = resizeHandle.offsetHeight;\n\t\t\tsetHeightConstraints( { min: nextMin, max: nextMax } );\n\t\t};\n\t\tconst observer = new window.ResizeObserver( deriveConstraints );\n\t\tobserver.observe( container );\n\t\tfor ( const element of noticeLists ) {\n\t\t\tobserver.observe( element );\n\t\t}\n\t\treturn () => observer.disconnect();\n\t}, [] );\n\n\tconst resizeDataRef = useRef( {} );\n\tconst separatorRef = useRef();\n\tconst separatorHelpId = useId();\n\n\t/**\n\t * @param {number|'auto'} [candidateHeight] Height in pixels or 'auto'.\n\t * @param {boolean} isPersistent Whether to persist the height in preferences.\n\t * @param {boolean} isInstant Whether to update the height in the DOM.\n\t */\n\tconst applyHeight = (\n\t\tcandidateHeight = 'auto',\n\t\tisPersistent,\n\t\tisInstant\n\t) => {\n\t\tif ( candidateHeight === 'auto' ) {\n\t\t\tisPersistent = false; // Just in case \u2014 \u201Cauto\u201D should never persist.\n\t\t} else {\n\t\t\tcandidateHeight = Math.min( max, Math.max( min, candidateHeight ) );\n\t\t}\n\t\tif ( isPersistent ) {\n\t\t\tsetPreference(\n\t\t\t\t'core/edit-post',\n\t\t\t\t'metaBoxesMainOpenHeight',\n\t\t\t\tcandidateHeight\n\t\t\t);\n\t\t}\n\t\t// Updates aria-valuenow only when not persisting the value because otherwise\n\t\t// it's done by the render that persisting the value causes.\n\t\telse if ( ! isShort ) {\n\t\t\tseparatorRef.current.ariaValueNow =\n\t\t\t\tgetAriaValueNow( candidateHeight );\n\t\t}\n\t\tif ( isInstant ) {\n\t\t\tmetaBoxesMainRef.current.updateSize( {\n\t\t\t\theight: candidateHeight,\n\t\t\t\t// Oddly, when the event that triggered this was not from the mouse (e.g. keydown),\n\t\t\t\t// if `width` is left unspecified a subsequent drag gesture applies a fixed\n\t\t\t\t// width and the pane fails to widen/narrow with parent width changes from\n\t\t\t\t// sidebars opening/closing or window resizes.\n\t\t\t\twidth: 'auto',\n\t\t\t} );\n\t\t}\n\t};\n\tconst getRenderValues = useEvent( () => ( { isOpen, openHeight, min } ) );\n\t// Sets the height to 'auto' when not resizable (isShort) and to the\n\t// preferred height when resizable.\n\tuseEffect( () => {\n\t\tconst fresh = getRenderValues();\n\t\t// Tests for `min` having a value to skip the first render.\n\t\tif ( fresh.min !== undefined && metaBoxesMainRef.current ) {\n\t\t\tconst usedOpenHeight = isShort ? 'auto' : fresh.openHeight;\n\t\t\tconst usedHeight = fresh.isOpen ? usedOpenHeight : fresh.min;\n\t\t\tapplyHeight( usedHeight, false, true );\n\t\t}\n\t}, [ isShort ] );\n\n\tif ( ! hasAnyVisible ) {\n\t\treturn;\n\t}\n\n\tconst contents = (\n\t\t<div\n\t\t\t// The class name 'edit-post-layout__metaboxes' is retained because some plugins use it.\n\t\t\tclassName=\"edit-post-layout__metaboxes edit-post-meta-boxes-main__liner\"\n\t\t\thidden={ ! isLegacy && ! isOpen }\n\t\t>\n\t\t\t<MetaBoxes location=\"normal\" />\n\t\t\t<MetaBoxes location=\"advanced\" />\n\t\t</div>\n\t);\n\n\tif ( isLegacy ) {\n\t\treturn contents;\n\t}\n\n\tconst isAutoHeight = openHeight === undefined;\n\tconst getAriaValueNow = ( height ) =>\n\t\tMath.round( ( ( height - min ) / ( max - min ) ) * 100 );\n\tconst usedAriaValueNow =\n\t\tmax === undefined || isAutoHeight ? 50 : getAriaValueNow( openHeight );\n\n\tconst persistIsOpen = ( to = ! isOpen ) =>\n\t\tsetPreference( 'core/edit-post', 'metaBoxesMainIsOpen', to );\n\n\t// TODO: Support more/all keyboard interactions from the window splitter pattern:\n\t// https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/\n\tconst onSeparatorKeyDown = ( event ) => {\n\t\tconst delta = { ArrowUp: 20, ArrowDown: -20 }[ event.key ];\n\t\tif ( delta ) {\n\t\t\tconst pane = metaBoxesMainRef.current.resizable;\n\t\t\tconst fromHeight = isAutoHeight ? pane.offsetHeight : openHeight;\n\t\t\tconst nextHeight = delta + fromHeight;\n\t\t\tapplyHeight( nextHeight, true, true );\n\t\t\tpersistIsOpen( nextHeight > min );\n\t\t\tevent.preventDefault();\n\t\t}\n\t};\n\tconst paneLabel = __( 'Meta Boxes' );\n\n\tconst toggle = (\n\t\t<button\n\t\t\taria-expanded={ isOpen }\n\t\t\tonClick={ ( { detail } ) => {\n\t\t\t\tconst { isToggleInferred } = resizeDataRef.current;\n\t\t\t\tif ( isShort || ! detail || isToggleInferred ) {\n\t\t\t\t\tpersistIsOpen();\n\t\t\t\t\tconst usedOpenHeight = isShort ? 'auto' : openHeight;\n\t\t\t\t\tconst usedHeight = isOpen ? min : usedOpenHeight;\n\t\t\t\t\tapplyHeight( usedHeight, false, true );\n\t\t\t\t}\n\t\t\t} }\n\t\t\t// Prevents resizing in short viewports.\n\t\t\t{ ...( isShort && {\n\t\t\t\tonMouseDown: ( event ) => event.stopPropagation(),\n\t\t\t\tonTouchStart: ( event ) => event.stopPropagation(),\n\t\t\t} ) }\n\t\t>\n\t\t\t{ paneLabel }\n\t\t\t<Icon icon={ isOpen ? chevronUp : chevronDown } />\n\t\t</button>\n\t);\n\n\tconst separator = ! isShort && (\n\t\t<>\n\t\t\t<Tooltip text={ __( 'Drag to resize' ) }>\n\t\t\t\t<button // eslint-disable-line jsx-a11y/role-supports-aria-props\n\t\t\t\t\tref={ separatorRef }\n\t\t\t\t\trole=\"separator\" // eslint-disable-line jsx-a11y/no-interactive-element-to-noninteractive-role\n\t\t\t\t\taria-valuenow={ usedAriaValueNow }\n\t\t\t\t\taria-label={ __( 'Drag to resize' ) }\n\t\t\t\t\taria-describedby={ separatorHelpId }\n\t\t\t\t\tonKeyDown={ onSeparatorKeyDown }\n\t\t\t\t/>\n\t\t\t</Tooltip>\n\t\t\t<VisuallyHidden id={ separatorHelpId }>\n\t\t\t\t{ __(\n\t\t\t\t\t'Use up and down arrow keys to resize the meta box panel.'\n\t\t\t\t) }\n\t\t\t</VisuallyHidden>\n\t\t</>\n\t);\n\n\tconst paneProps = /** @type {Parameters<typeof ResizableBox>[0]} */ ( {\n\t\tas: NavigableRegion,\n\t\tref: metaBoxesMainRef,\n\t\tclassName: 'edit-post-meta-boxes-main',\n\t\tdefaultSize: { height: isOpen ? openHeight : 0 },\n\t\tminHeight: min,\n\t\tmaxHeight: max,\n\t\tenable: { top: true },\n\t\thandleClasses: { top: 'edit-post-meta-boxes-main__presenter' },\n\t\thandleComponent: {\n\t\t\ttop: (\n\t\t\t\t<>\n\t\t\t\t\t{ toggle }\n\t\t\t\t\t{ separator }\n\t\t\t\t</>\n\t\t\t),\n\t\t},\n\t\t// Avoids hiccups while dragging over objects like iframes and ensures that\n\t\t// the event to end the drag is captured by the target (resize handle)\n\t\t// whether or not it\u2019s under the pointer.\n\t\tonPointerDown: ( { pointerId, target } ) => {\n\t\t\tif ( separatorRef.current?.parentElement.contains( target ) ) {\n\t\t\t\ttarget.setPointerCapture( pointerId );\n\t\t\t}\n\t\t},\n\t\tonResizeStart: ( { timeStamp }, direction, elementRef ) => {\n\t\t\tif ( isAutoHeight ) {\n\t\t\t\t// Sets the starting height to avoid visual jumps in height and\n\t\t\t\t// aria-valuenow being `NaN` for the first (few) resize events.\n\t\t\t\tapplyHeight( elementRef.offsetHeight, false, true );\n\t\t\t}\n\t\t\telementRef.classList.add( 'is-resizing' );\n\t\t\tresizeDataRef.current = { timeStamp, maxDelta: 0 };\n\t\t},\n\t\tonResize: ( event, direction, elementRef, delta ) => {\n\t\t\tconst { maxDelta } = resizeDataRef.current;\n\t\t\tconst newDelta = Math.abs( delta.height );\n\t\t\tresizeDataRef.current.maxDelta = Math.max( maxDelta, newDelta );\n\t\t\tapplyHeight( metaBoxesMainRef.current.state.height );\n\t\t},\n\t\tonResizeStop: ( event, direction, elementRef ) => {\n\t\t\telementRef.classList.remove( 'is-resizing' );\n\t\t\tconst duration = event.timeStamp - resizeDataRef.current.timeStamp;\n\t\t\tconst wasSeparator = event.target === separatorRef.current;\n\t\t\tconst { maxDelta } = resizeDataRef.current;\n\t\t\tconst isToggleInferred =\n\t\t\t\tmaxDelta < 1 || ( duration < 144 && maxDelta < 5 );\n\t\t\tif ( isShort || ( ! wasSeparator && isToggleInferred ) ) {\n\t\t\t\tresizeDataRef.current.isToggleInferred = true;\n\t\t\t} else {\n\t\t\t\tconst { height } = metaBoxesMainRef.current.state;\n\t\t\t\tconst nextIsOpen = height > min;\n\t\t\t\tpersistIsOpen( nextIsOpen );\n\t\t\t\t// Persists height only if still open. This is so that when closed by a drag the\n\t\t\t\t// prior height can be restored by the toggle button instead of having to drag\n\t\t\t\t// the pane open again. Also, if already closed, a click on the separator won\u2019t\n\t\t\t\t// persist the height as the minimum.\n\t\t\t\tif ( nextIsOpen ) {\n\t\t\t\t\tapplyHeight( height, true );\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t} );\n\n\treturn (\n\t\t<ResizableBox aria-label={ paneLabel } { ...paneProps }>\n\t\t\t<meta ref={ effectSizeConstraints } />\n\t\t\t{ contents }\n\t\t</ResizableBox>\n\t);\n}\n\nfunction Layout( {\n\tpostId: initialPostId,\n\tpostType: initialPostType,\n\tsettings,\n\tinitialEdits,\n} ) {\n\tuseEditPostCommands();\n\tconst shouldIframe = useShouldIframe();\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst {\n\t\tcurrentPost: { postId: currentPostId, postType: currentPostType },\n\t\tonNavigateToEntityRecord,\n\t\tonNavigateToPreviousEntityRecord,\n\t} = useNavigateToEntityRecord(\n\t\tinitialPostId,\n\t\tinitialPostType,\n\t\t'post-only'\n\t);\n\tconst isEditingTemplate = currentPostType === 'wp_template';\n\tconst {\n\t\tmode,\n\t\tisFullscreenActive,\n\t\thasResolvedMode,\n\t\thasActiveMetaboxes,\n\t\thasBlockSelected,\n\t\tshowIconLabels,\n\t\tisDistractionFree,\n\t\tshowMetaBoxes,\n\t\tisWelcomeGuideVisible,\n\t\ttemplateId,\n\t\tenablePaddingAppender,\n\t\tisDevicePreview,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\tconst { isFeatureActive, hasMetaBoxes } = select( editPostStore );\n\t\t\tconst { canUser, getPostType, getTemplateId } = unlock(\n\t\t\t\tselect( coreStore )\n\t\t\t);\n\n\t\t\tconst supportsTemplateMode = settings.supportsTemplateMode;\n\t\t\tconst isViewable =\n\t\t\t\tgetPostType( currentPostType )?.viewable ?? false;\n\t\t\tconst canViewTemplate = canUser( 'read', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} );\n\t\t\tconst { getBlockSelectionStart, isZoomOut } = unlock(\n\t\t\t\tselect( blockEditorStore )\n\t\t\t);\n\t\t\tconst {\n\t\t\t\tgetEditorMode,\n\t\t\t\tgetRenderingMode,\n\t\t\t\tgetDefaultRenderingMode,\n\t\t\t\tgetDeviceType,\n\t\t\t} = unlock( select( editorStore ) );\n\t\t\tconst isRenderingPostOnly = getRenderingMode() === 'post-only';\n\t\t\tconst isNotDesignPostType =\n\t\t\t\t! DESIGN_POST_TYPES.includes( currentPostType );\n\t\t\tconst isDirectlyEditingPattern =\n\t\t\t\tcurrentPostType === 'wp_block' &&\n\t\t\t\t! onNavigateToPreviousEntityRecord;\n\t\t\tconst _templateId = getTemplateId( currentPostType, currentPostId );\n\t\t\tconst defaultMode = getDefaultRenderingMode( currentPostType );\n\n\t\t\treturn {\n\t\t\t\tmode: getEditorMode(),\n\t\t\t\tisFullscreenActive: isFeatureActive( 'fullscreenMode' ),\n\t\t\t\thasActiveMetaboxes: hasMetaBoxes(),\n\t\t\t\thasResolvedMode:\n\t\t\t\t\tdefaultMode === 'template-locked'\n\t\t\t\t\t\t? !! _templateId\n\t\t\t\t\t\t: defaultMode !== undefined,\n\t\t\t\thasBlockSelected: !! getBlockSelectionStart(),\n\t\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\t\tshowMetaBoxes:\n\t\t\t\t\t( isNotDesignPostType && ! isZoomOut() ) ||\n\t\t\t\t\tisDirectlyEditingPattern,\n\t\t\t\tisWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),\n\t\t\t\ttemplateId:\n\t\t\t\t\tsupportsTemplateMode &&\n\t\t\t\t\tisViewable &&\n\t\t\t\t\tcanViewTemplate &&\n\t\t\t\t\t! isEditingTemplate\n\t\t\t\t\t\t? _templateId\n\t\t\t\t\t\t: null,\n\t\t\t\tenablePaddingAppender:\n\t\t\t\t\t! isZoomOut() && isRenderingPostOnly && isNotDesignPostType,\n\t\t\t\tisDevicePreview: getDeviceType() !== 'Desktop',\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tcurrentPostType,\n\t\t\tcurrentPostId,\n\t\t\tisEditingTemplate,\n\t\t\tsettings.supportsTemplateMode,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t]\n\t);\n\n\tuseMetaBoxInitialization( hasActiveMetaboxes && hasResolvedMode );\n\n\tconst [ paddingAppenderRef, paddingStyle ] = usePaddingAppender(\n\t\tenablePaddingAppender\n\t);\n\n\t// Set the right context for the command palette\n\tconst commandContext = hasBlockSelected\n\t\t? 'block-selection-edit'\n\t\t: 'entity-edit';\n\tuseCommandContext( commandContext );\n\tconst styles = useEditorStyles( settings, paddingStyle );\n\tconst editorSettings = useMemo(\n\t\t() => ( {\n\t\t\t...settings,\n\t\t\tstyles,\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t\tdefaultRenderingMode: 'post-only',\n\t\t} ),\n\t\t[\n\t\t\tsettings,\n\t\t\tstyles,\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t]\n\t);\n\n\t// We need to add the show-icon-labels class to the body element so it is applied to modals.\n\tif ( showIconLabels ) {\n\t\tdocument.body.classList.add( 'show-icon-labels' );\n\t} else {\n\t\tdocument.body.classList.remove( 'show-icon-labels' );\n\t}\n\n\tconst navigateRegionsProps = useNavigateRegions();\n\n\tconst className = clsx( 'edit-post-layout', 'is-mode-' + mode, {\n\t\t'has-metaboxes': hasActiveMetaboxes,\n\t} );\n\n\tfunction onPluginAreaError( name ) {\n\t\tcreateErrorNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: plugin name */\n\t\t\t\t__(\n\t\t\t\t\t'The \"%s\" plugin has encountered an error and cannot be rendered.'\n\t\t\t\t),\n\t\t\t\tname\n\t\t\t)\n\t\t);\n\t}\n\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst onActionPerformed = useCallback(\n\t\t( actionId, items ) => {\n\t\t\tswitch ( actionId ) {\n\t\t\t\tcase 'move-to-trash':\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.location.href = addQueryArgs( 'edit.php', {\n\t\t\t\t\t\t\ttrashed: 1,\n\t\t\t\t\t\t\tpost_type: items[ 0 ].type,\n\t\t\t\t\t\t\tids: items[ 0 ].id,\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'duplicate-post':\n\t\t\t\t\t{\n\t\t\t\t\t\tconst newItem = items[ 0 ];\n\t\t\t\t\t\tconst title =\n\t\t\t\t\t\t\ttypeof newItem.title === 'string'\n\t\t\t\t\t\t\t\t? newItem.title\n\t\t\t\t\t\t\t\t: newItem.title?.rendered;\n\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Title of the created post or template, e.g: \"Hello world\".\n\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\tdecodeEntities( title ) || __( '(no title)' )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlabel: __( 'Edit' ),\n\t\t\t\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\t\t\t\tconst postId = newItem.id;\n\t\t\t\t\t\t\t\t\t\t\tdocument.location.href =\n\t\t\t\t\t\t\t\t\t\t\t\taddQueryArgs( 'post.php', {\n\t\t\t\t\t\t\t\t\t\t\t\t\tpost: postId,\n\t\t\t\t\t\t\t\t\t\t\t\t\taction: 'edit',\n\t\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t},\n\t\t[ createSuccessNotice ]\n\t);\n\n\tconst initialPost = useMemo( () => {\n\t\treturn {\n\t\t\ttype: initialPostType,\n\t\t\tid: initialPostId,\n\t\t};\n\t}, [ initialPostType, initialPostId ] );\n\n\tconst backButton =\n\t\tuseViewportMatch( 'medium' ) && isFullscreenActive ? (\n\t\t\t<BackButton initialPost={ initialPost } />\n\t\t) : null;\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<ErrorBoundary canCopyContent>\n\t\t\t\t<WelcomeGuide postType={ currentPostType } />\n\t\t\t\t<div\n\t\t\t\t\tclassName={ navigateRegionsProps.className }\n\t\t\t\t\t{ ...navigateRegionsProps }\n\t\t\t\t\tref={ navigateRegionsProps.ref }\n\t\t\t\t>\n\t\t\t\t\t<Editor\n\t\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\t\tpostType={ currentPostType }\n\t\t\t\t\t\tpostId={ currentPostId }\n\t\t\t\t\t\ttemplateId={ templateId }\n\t\t\t\t\t\tclassName={ className }\n\t\t\t\t\t\tforceIsDirty={ hasActiveMetaboxes }\n\t\t\t\t\t\tcontentRef={ paddingAppenderRef }\n\t\t\t\t\t\tdisableIframe={ ! shouldIframe }\n\t\t\t\t\t\t// We should auto-focus the canvas (title) on load.\n\t\t\t\t\t\t// eslint-disable-next-line jsx-a11y/no-autofocus\n\t\t\t\t\t\tautoFocus={ ! isWelcomeGuideVisible }\n\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\textraSidebarPanels={\n\t\t\t\t\t\t\tshowMetaBoxes && <MetaBoxes location=\"side\" />\n\t\t\t\t\t\t}\n\t\t\t\t\t\textraContent={\n\t\t\t\t\t\t\t! isDistractionFree &&\n\t\t\t\t\t\t\tshowMetaBoxes && (\n\t\t\t\t\t\t\t\t<MetaBoxesMain\n\t\t\t\t\t\t\t\t\tisLegacy={\n\t\t\t\t\t\t\t\t\t\t! shouldIframe || isDevicePreview\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<PostLockedModal />\n\t\t\t\t\t\t<EditorInitialization />\n\t\t\t\t\t\t<FullscreenMode isActive={ isFullscreenActive } />\n\t\t\t\t\t\t<BrowserURL />\n\t\t\t\t\t\t<UnsavedChangesWarning />\n\t\t\t\t\t\t<AutosaveMonitor />\n\t\t\t\t\t\t<LocalAutosaveMonitor />\n\t\t\t\t\t\t<EditPostKeyboardShortcuts />\n\t\t\t\t\t\t<EditorKeyboardShortcutsRegister />\n\t\t\t\t\t\t<BlockKeyboardShortcuts />\n\t\t\t\t\t\t<InitPatternModal />\n\t\t\t\t\t\t<PluginArea onError={ onPluginAreaError } />\n\t\t\t\t\t\t<PostEditorMoreMenu />\n\t\t\t\t\t\t{ backButton }\n\t\t\t\t\t\t<EditorSnackbars />\n\t\t\t\t\t</Editor>\n\t\t\t\t</div>\n\t\t\t</ErrorBoundary>\n\t\t</SlotFillProvider>\n\t);\n}\n\nexport default Layout;\n"],
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,uBAAuB;AAChC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT,eAAe;AAAA,OACT;AACP,SAAS,WAAW,mBAAmB;AACvC,SAAS,SAAS,wBAAwB;AAC1C,SAAS,uBAAuB;AAChC,SAAS,kBAAkB;AAC3B,SAAS,IAAI,eAAe;AAC5B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,aAAa,iBAAiB;AACvC,SAAS,SAAS,oBAAoB;AACtC,SAAS,SAAS,wBAAwB;AAC1C,SAAS,eAAe,2BAA2B;AACnD,SAAS,eAAe,+BAA+B;AACvD,SAAS,oBAAoB;AAC7B,SAAS,sBAAsB;AAC/B,SAAS,SAAS,iBAAiB;AACnC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,gCAAgC;AAAA,OAC1B;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAKP,OAAO,gBAAgB;AACvB,OAAO,0BAA0B;AACjC,OAAO,+BAA+B;AACtC,OAAO,sBAAsB;AAC7B,OAAO,gBAAgB;AACvB,OAAO,eAAe;AACtB,OAAO,wBAAwB;AAC/B,OAAO,kBAAkB;AACzB,SAAS,SAAS,qBAAqB;AACvC,SAAS,cAAc;AACvB,OAAO,yBAAyB;AAChC,SAAS,0BAA0B;AACnC,SAA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AC,mBAAgB;AAAA,cACjB,oBAAC,wBAAqB;AAAA,cACtB,oBAAC,6BAA0B;AAAA,cAC3B,oBAAC,mCAAgC;AAAA,cACjC,oBAAC,0BAAuB;AAAA,cACxB,oBAAC,oBAAiB;AAAA,cAClB,oBAAC,cAAW,SAAU,mBAAoB;AAAA,cAC1C,oBAAC,sBAAmB;AAAA,cAClB;AAAA,cACF,oBAAC,mBAAgB;AAAA;AAAA;AAAA,QAClB;AAAA;AAAA,IACD;AAAA,KACD,GACD;AAEF;AAEA,IAAO,iBAAQ;",
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { NavigableRegion } from '@wordpress/admin-ui';\nimport {\n\tAutosaveMonitor,\n\tLocalAutosaveMonitor,\n\tUnsavedChangesWarning,\n\tEditorKeyboardShortcutsRegister,\n\tEditorSnackbars,\n\tErrorBoundary,\n\tPostLockedModal,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { getLayoutStyles } from '@wordpress/global-styles-engine';\nimport { PluginArea } from '@wordpress/plugins';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseId,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\nimport { chevronDown, chevronUp } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { privateApis as commandsPrivateApis } from '@wordpress/commands';\nimport { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';\nimport { addQueryArgs } from '@wordpress/url';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tIcon,\n\tResizableBox,\n\tSlotFillProvider,\n\tTooltip,\n\tVisuallyHidden,\n\t__unstableUseNavigateRegions as useNavigateRegions,\n} from '@wordpress/components';\nimport {\n\tuseEvent,\n\tuseMediaQuery,\n\tuseRefEffect,\n\tuseViewportMatch,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BackButton from '../back-button';\nimport EditorInitialization from '../editor-initialization';\nimport EditPostKeyboardShortcuts from '../keyboard-shortcuts';\nimport InitPatternModal from '../init-pattern-modal';\nimport BrowserURL from '../browser-url';\nimport MetaBoxes from '../meta-boxes';\nimport PostEditorMoreMenu from '../more-menu';\nimport WelcomeGuide from '../welcome-guide';\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport useEditPostCommands from '../../commands/use-commands';\nimport { useShouldIframe } from './use-should-iframe';\nimport useNavigateToEntityRecord from '../../hooks/use-navigate-to-entity-record';\nimport { useMetaBoxInitialization } from '../meta-boxes/use-meta-box-initialization';\n\nconst { useCommandContext } = unlock( commandsPrivateApis );\nconst { Editor, FullscreenMode } = unlock( editorPrivateApis );\nconst { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );\nconst DESIGN_POST_TYPES = [\n\t'wp_template',\n\t'wp_template_part',\n\t'wp_block',\n\t'wp_navigation',\n];\n\nfunction useEditorStyles( settings ) {\n\tconst { hasThemeStyleSupport } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\thasThemeStyleSupport:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'themeStyles' ),\n\t\t};\n\t}, [] );\n\n\t// Compute the default styles.\n\treturn useMemo( () => {\n\t\tconst presetStyles =\n\t\t\tsettings.styles?.filter(\n\t\t\t\t( style ) =>\n\t\t\t\t\tstyle.__unstableType && style.__unstableType !== 'theme'\n\t\t\t) ?? [];\n\n\t\tconst defaultEditorStyles = [\n\t\t\t...( settings?.defaultEditorStyles ?? [] ),\n\t\t\t...presetStyles,\n\t\t];\n\n\t\t// Has theme styles if the theme supports them and if some styles were not preset styles (in which case they're theme styles).\n\t\tconst hasThemeStyles =\n\t\t\thasThemeStyleSupport &&\n\t\t\tpresetStyles.length !== ( settings.styles?.length ?? 0 );\n\n\t\t// If theme styles are not present or displayed, ensure that\n\t\t// base layout styles are still present in the editor.\n\t\tif ( ! settings.disableLayoutStyles && ! hasThemeStyles ) {\n\t\t\tdefaultEditorStyles.push( {\n\t\t\t\tcss: getLayoutStyles( {\n\t\t\t\t\tstyle: {},\n\t\t\t\t\tselector: 'body',\n\t\t\t\t\thasBlockGapSupport: false,\n\t\t\t\t\thasFallbackGapSupport: true,\n\t\t\t\t\tfallbackGapValue: '0.5em',\n\t\t\t\t} ),\n\t\t\t} );\n\t\t}\n\n\t\treturn hasThemeStyles ? settings.styles ?? [] : defaultEditorStyles;\n\t}, [\n\t\tsettings.defaultEditorStyles,\n\t\tsettings.disableLayoutStyles,\n\t\tsettings.styles,\n\t\thasThemeStyleSupport,\n\t] );\n}\n\n/**\n * @param {Object} props\n * @param {boolean} props.isLegacy True when the editor canvas is not in an iframe.\n */\nfunction MetaBoxesMain( { isLegacy } ) {\n\tconst [ isOpen, openHeight, hasAnyVisible ] = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { isMetaBoxLocationVisible } = select( editPostStore );\n\t\treturn [\n\t\t\t!! get( 'core/edit-post', 'metaBoxesMainIsOpen' ),\n\t\t\tget( 'core/edit-post', 'metaBoxesMainOpenHeight' ),\n\t\t\tisMetaBoxLocationVisible( 'normal' ) ||\n\t\t\t\tisMetaBoxLocationVisible( 'advanced' ) ||\n\t\t\t\tisMetaBoxLocationVisible( 'side' ),\n\t\t];\n\t}, [] );\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\tconst metaBoxesMainRef = useRef();\n\tconst isShort = useMediaQuery( '(max-height: 549px)' );\n\n\tconst [ { min, max }, setHeightConstraints ] = useState( () => ( {} ) );\n\t// Keeps the resizable area\u2019s size constraints updated taking into account\n\t// editor notices. The constraints are also used to derive the value for the\n\t// aria-valuenow attribute on the separator.\n\tconst effectSizeConstraints = useRefEffect( ( node ) => {\n\t\tconst container = node.closest(\n\t\t\t'.interface-interface-skeleton__content'\n\t\t);\n\t\tif ( ! container ) {\n\t\t\treturn;\n\t\t}\n\t\tconst noticeLists = container.querySelectorAll(\n\t\t\t':scope > .components-notice-list'\n\t\t);\n\t\tconst resizeHandle = container.querySelector(\n\t\t\t'.edit-post-meta-boxes-main__presenter'\n\t\t);\n\t\tconst deriveConstraints = () => {\n\t\t\tconst fullHeight = container.offsetHeight;\n\t\t\tlet nextMax = fullHeight;\n\t\t\tfor ( const element of noticeLists ) {\n\t\t\t\tnextMax -= element.offsetHeight;\n\t\t\t}\n\t\t\tconst nextMin = resizeHandle.offsetHeight;\n\t\t\tsetHeightConstraints( { min: nextMin, max: nextMax } );\n\t\t};\n\t\tconst observer = new window.ResizeObserver( deriveConstraints );\n\t\tobserver.observe( container );\n\t\tfor ( const element of noticeLists ) {\n\t\t\tobserver.observe( element );\n\t\t}\n\t\treturn () => observer.disconnect();\n\t}, [] );\n\n\tconst resizeDataRef = useRef( {} );\n\tconst separatorRef = useRef();\n\tconst separatorHelpId = useId();\n\n\t/**\n\t * @param {number|'auto'} [candidateHeight] Height in pixels or 'auto'.\n\t * @param {boolean} isPersistent Whether to persist the height in preferences.\n\t * @param {boolean} isInstant Whether to update the height in the DOM.\n\t */\n\tconst applyHeight = (\n\t\tcandidateHeight = 'auto',\n\t\tisPersistent,\n\t\tisInstant\n\t) => {\n\t\tif ( candidateHeight === 'auto' ) {\n\t\t\tisPersistent = false; // Just in case \u2014 \u201Cauto\u201D should never persist.\n\t\t} else {\n\t\t\tcandidateHeight = Math.min( max, Math.max( min, candidateHeight ) );\n\t\t}\n\t\tif ( isPersistent ) {\n\t\t\tsetPreference(\n\t\t\t\t'core/edit-post',\n\t\t\t\t'metaBoxesMainOpenHeight',\n\t\t\t\tcandidateHeight\n\t\t\t);\n\t\t}\n\t\t// Updates aria-valuenow only when not persisting the value because otherwise\n\t\t// it's done by the render that persisting the value causes.\n\t\telse if ( ! isShort ) {\n\t\t\tseparatorRef.current.ariaValueNow =\n\t\t\t\tgetAriaValueNow( candidateHeight );\n\t\t}\n\t\tif ( isInstant ) {\n\t\t\tmetaBoxesMainRef.current.updateSize( {\n\t\t\t\theight: candidateHeight,\n\t\t\t\t// Oddly, when the event that triggered this was not from the mouse (e.g. keydown),\n\t\t\t\t// if `width` is left unspecified a subsequent drag gesture applies a fixed\n\t\t\t\t// width and the pane fails to widen/narrow with parent width changes from\n\t\t\t\t// sidebars opening/closing or window resizes.\n\t\t\t\twidth: 'auto',\n\t\t\t} );\n\t\t}\n\t};\n\tconst getRenderValues = useEvent( () => ( { isOpen, openHeight, min } ) );\n\t// Sets the height to 'auto' when not resizable (isShort) and to the\n\t// preferred height when resizable.\n\tuseEffect( () => {\n\t\tconst fresh = getRenderValues();\n\t\t// Tests for `min` having a value to skip the first render.\n\t\tif ( fresh.min !== undefined && metaBoxesMainRef.current ) {\n\t\t\tconst usedOpenHeight = isShort ? 'auto' : fresh.openHeight;\n\t\t\tconst usedHeight = fresh.isOpen ? usedOpenHeight : fresh.min;\n\t\t\tapplyHeight( usedHeight, false, true );\n\t\t}\n\t}, [ isShort ] );\n\n\tif ( ! hasAnyVisible ) {\n\t\treturn;\n\t}\n\n\tconst contents = (\n\t\t<div\n\t\t\t// The class name 'edit-post-layout__metaboxes' is retained because some plugins use it.\n\t\t\tclassName=\"edit-post-layout__metaboxes edit-post-meta-boxes-main__liner\"\n\t\t\thidden={ ! isLegacy && ! isOpen }\n\t\t>\n\t\t\t<MetaBoxes location=\"normal\" />\n\t\t\t<MetaBoxes location=\"advanced\" />\n\t\t</div>\n\t);\n\n\tif ( isLegacy ) {\n\t\treturn contents;\n\t}\n\n\tconst isAutoHeight = openHeight === undefined;\n\tconst getAriaValueNow = ( height ) =>\n\t\tMath.round( ( ( height - min ) / ( max - min ) ) * 100 );\n\tconst usedAriaValueNow =\n\t\tmax === undefined || isAutoHeight ? 50 : getAriaValueNow( openHeight );\n\n\tconst persistIsOpen = ( to = ! isOpen ) =>\n\t\tsetPreference( 'core/edit-post', 'metaBoxesMainIsOpen', to );\n\n\t// TODO: Support more/all keyboard interactions from the window splitter pattern:\n\t// https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/\n\tconst onSeparatorKeyDown = ( event ) => {\n\t\tconst delta = { ArrowUp: 20, ArrowDown: -20 }[ event.key ];\n\t\tif ( delta ) {\n\t\t\tconst pane = metaBoxesMainRef.current.resizable;\n\t\t\tconst fromHeight = isAutoHeight ? pane.offsetHeight : openHeight;\n\t\t\tconst nextHeight = delta + fromHeight;\n\t\t\tapplyHeight( nextHeight, true, true );\n\t\t\tpersistIsOpen( nextHeight > min );\n\t\t\tevent.preventDefault();\n\t\t}\n\t};\n\tconst paneLabel = __( 'Meta Boxes' );\n\n\tconst toggle = (\n\t\t<button\n\t\t\taria-expanded={ isOpen }\n\t\t\tonClick={ ( { detail } ) => {\n\t\t\t\tconst { isToggleInferred } = resizeDataRef.current;\n\t\t\t\tif ( isShort || ! detail || isToggleInferred ) {\n\t\t\t\t\tpersistIsOpen();\n\t\t\t\t\tconst usedOpenHeight = isShort ? 'auto' : openHeight;\n\t\t\t\t\tconst usedHeight = isOpen ? min : usedOpenHeight;\n\t\t\t\t\tapplyHeight( usedHeight, false, true );\n\t\t\t\t}\n\t\t\t} }\n\t\t\t// Prevents resizing in short viewports.\n\t\t\t{ ...( isShort && {\n\t\t\t\tonMouseDown: ( event ) => event.stopPropagation(),\n\t\t\t\tonTouchStart: ( event ) => event.stopPropagation(),\n\t\t\t} ) }\n\t\t>\n\t\t\t{ paneLabel }\n\t\t\t<Icon icon={ isOpen ? chevronUp : chevronDown } />\n\t\t</button>\n\t);\n\n\tconst separator = ! isShort && (\n\t\t<>\n\t\t\t<Tooltip text={ __( 'Drag to resize' ) }>\n\t\t\t\t<button // eslint-disable-line jsx-a11y/role-supports-aria-props\n\t\t\t\t\tref={ separatorRef }\n\t\t\t\t\trole=\"separator\" // eslint-disable-line jsx-a11y/no-interactive-element-to-noninteractive-role\n\t\t\t\t\taria-valuenow={ usedAriaValueNow }\n\t\t\t\t\taria-label={ __( 'Drag to resize' ) }\n\t\t\t\t\taria-describedby={ separatorHelpId }\n\t\t\t\t\tonKeyDown={ onSeparatorKeyDown }\n\t\t\t\t/>\n\t\t\t</Tooltip>\n\t\t\t<VisuallyHidden id={ separatorHelpId }>\n\t\t\t\t{ __(\n\t\t\t\t\t'Use up and down arrow keys to resize the meta box panel.'\n\t\t\t\t) }\n\t\t\t</VisuallyHidden>\n\t\t</>\n\t);\n\n\tconst paneProps = /** @type {Parameters<typeof ResizableBox>[0]} */ ( {\n\t\tas: NavigableRegion,\n\t\tref: metaBoxesMainRef,\n\t\tclassName: 'edit-post-meta-boxes-main',\n\t\tdefaultSize: { height: isOpen ? openHeight : 0 },\n\t\tminHeight: min,\n\t\tmaxHeight: max,\n\t\tenable: { top: true },\n\t\thandleClasses: { top: 'edit-post-meta-boxes-main__presenter' },\n\t\thandleComponent: {\n\t\t\ttop: (\n\t\t\t\t<>\n\t\t\t\t\t{ toggle }\n\t\t\t\t\t{ separator }\n\t\t\t\t</>\n\t\t\t),\n\t\t},\n\t\t// Avoids hiccups while dragging over objects like iframes and ensures that\n\t\t// the event to end the drag is captured by the target (resize handle)\n\t\t// whether or not it\u2019s under the pointer.\n\t\tonPointerDown: ( { pointerId, target } ) => {\n\t\t\tif ( separatorRef.current?.parentElement.contains( target ) ) {\n\t\t\t\ttarget.setPointerCapture( pointerId );\n\t\t\t}\n\t\t},\n\t\tonResizeStart: ( { timeStamp }, direction, elementRef ) => {\n\t\t\tif ( isAutoHeight ) {\n\t\t\t\t// Sets the starting height to avoid visual jumps in height and\n\t\t\t\t// aria-valuenow being `NaN` for the first (few) resize events.\n\t\t\t\tapplyHeight( elementRef.offsetHeight, false, true );\n\t\t\t}\n\t\t\telementRef.classList.add( 'is-resizing' );\n\t\t\tresizeDataRef.current = { timeStamp, maxDelta: 0 };\n\t\t},\n\t\tonResize: ( event, direction, elementRef, delta ) => {\n\t\t\tconst { maxDelta } = resizeDataRef.current;\n\t\t\tconst newDelta = Math.abs( delta.height );\n\t\t\tresizeDataRef.current.maxDelta = Math.max( maxDelta, newDelta );\n\t\t\tapplyHeight( metaBoxesMainRef.current.state.height );\n\t\t},\n\t\tonResizeStop: ( event, direction, elementRef ) => {\n\t\t\telementRef.classList.remove( 'is-resizing' );\n\t\t\tconst duration = event.timeStamp - resizeDataRef.current.timeStamp;\n\t\t\tconst wasSeparator = event.target === separatorRef.current;\n\t\t\tconst { maxDelta } = resizeDataRef.current;\n\t\t\tconst isToggleInferred =\n\t\t\t\tmaxDelta < 1 || ( duration < 144 && maxDelta < 5 );\n\t\t\tif ( isShort || ( ! wasSeparator && isToggleInferred ) ) {\n\t\t\t\tresizeDataRef.current.isToggleInferred = true;\n\t\t\t} else {\n\t\t\t\tconst { height } = metaBoxesMainRef.current.state;\n\t\t\t\tconst nextIsOpen = height > min;\n\t\t\t\tpersistIsOpen( nextIsOpen );\n\t\t\t\t// Persists height only if still open. This is so that when closed by a drag the\n\t\t\t\t// prior height can be restored by the toggle button instead of having to drag\n\t\t\t\t// the pane open again. Also, if already closed, a click on the separator won\u2019t\n\t\t\t\t// persist the height as the minimum.\n\t\t\t\tif ( nextIsOpen ) {\n\t\t\t\t\tapplyHeight( height, true );\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t} );\n\n\treturn (\n\t\t<ResizableBox aria-label={ paneLabel } { ...paneProps }>\n\t\t\t<meta ref={ effectSizeConstraints } />\n\t\t\t{ contents }\n\t\t</ResizableBox>\n\t);\n}\n\nfunction Layout( {\n\tpostId: initialPostId,\n\tpostType: initialPostType,\n\tsettings,\n\tinitialEdits,\n} ) {\n\tuseEditPostCommands();\n\tconst shouldIframe = useShouldIframe();\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst {\n\t\tcurrentPost: { postId: currentPostId, postType: currentPostType },\n\t\tonNavigateToEntityRecord,\n\t\tonNavigateToPreviousEntityRecord,\n\t} = useNavigateToEntityRecord(\n\t\tinitialPostId,\n\t\tinitialPostType,\n\t\t'post-only'\n\t);\n\tconst isEditingTemplate = currentPostType === 'wp_template';\n\tconst {\n\t\tmode,\n\t\tisFullscreenActive,\n\t\thasResolvedMode,\n\t\thasActiveMetaboxes,\n\t\thasBlockSelected,\n\t\tshowIconLabels,\n\t\tisDistractionFree,\n\t\tshowMetaBoxes,\n\t\tisWelcomeGuideVisible,\n\t\ttemplateId,\n\t\tisDevicePreview,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\tconst { isFeatureActive, hasMetaBoxes } = select( editPostStore );\n\t\t\tconst { canUser, getPostType, getTemplateId } = unlock(\n\t\t\t\tselect( coreStore )\n\t\t\t);\n\n\t\t\tconst supportsTemplateMode = settings.supportsTemplateMode;\n\t\t\tconst isViewable =\n\t\t\t\tgetPostType( currentPostType )?.viewable ?? false;\n\t\t\tconst canViewTemplate = canUser( 'read', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} );\n\t\t\tconst { getBlockSelectionStart, isZoomOut } = unlock(\n\t\t\t\tselect( blockEditorStore )\n\t\t\t);\n\t\t\tconst { getEditorMode, getDefaultRenderingMode, getDeviceType } =\n\t\t\t\tunlock( select( editorStore ) );\n\t\t\tconst isNotDesignPostType =\n\t\t\t\t! DESIGN_POST_TYPES.includes( currentPostType );\n\t\t\tconst isDirectlyEditingPattern =\n\t\t\t\tcurrentPostType === 'wp_block' &&\n\t\t\t\t! onNavigateToPreviousEntityRecord;\n\t\t\tconst _templateId = getTemplateId( currentPostType, currentPostId );\n\t\t\tconst defaultMode = getDefaultRenderingMode( currentPostType );\n\n\t\t\treturn {\n\t\t\t\tmode: getEditorMode(),\n\t\t\t\tisFullscreenActive: isFeatureActive( 'fullscreenMode' ),\n\t\t\t\thasActiveMetaboxes: hasMetaBoxes(),\n\t\t\t\thasResolvedMode:\n\t\t\t\t\tdefaultMode === 'template-locked'\n\t\t\t\t\t\t? !! _templateId\n\t\t\t\t\t\t: defaultMode !== undefined,\n\t\t\t\thasBlockSelected: !! getBlockSelectionStart(),\n\t\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\t\tshowMetaBoxes:\n\t\t\t\t\t( isNotDesignPostType && ! isZoomOut() ) ||\n\t\t\t\t\tisDirectlyEditingPattern,\n\t\t\t\tisWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),\n\t\t\t\ttemplateId:\n\t\t\t\t\tsupportsTemplateMode &&\n\t\t\t\t\tisViewable &&\n\t\t\t\t\tcanViewTemplate &&\n\t\t\t\t\t! isEditingTemplate\n\t\t\t\t\t\t? _templateId\n\t\t\t\t\t\t: null,\n\t\t\t\tisDevicePreview: getDeviceType() !== 'Desktop',\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tcurrentPostType,\n\t\t\tcurrentPostId,\n\t\t\tisEditingTemplate,\n\t\t\tsettings.supportsTemplateMode,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t]\n\t);\n\n\tuseMetaBoxInitialization( hasActiveMetaboxes && hasResolvedMode );\n\n\t// Set the right context for the command palette\n\tconst commandContext = hasBlockSelected\n\t\t? 'block-selection-edit'\n\t\t: 'entity-edit';\n\tuseCommandContext( commandContext );\n\tconst styles = useEditorStyles( settings );\n\tconst editorSettings = useMemo(\n\t\t() => ( {\n\t\t\t...settings,\n\t\t\tstyles,\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t\tdefaultRenderingMode: 'post-only',\n\t\t} ),\n\t\t[\n\t\t\tsettings,\n\t\t\tstyles,\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t]\n\t);\n\n\t// We need to add the show-icon-labels class to the body element so it is applied to modals.\n\tif ( showIconLabels ) {\n\t\tdocument.body.classList.add( 'show-icon-labels' );\n\t} else {\n\t\tdocument.body.classList.remove( 'show-icon-labels' );\n\t}\n\n\tconst navigateRegionsProps = useNavigateRegions();\n\n\tconst className = clsx( 'edit-post-layout', 'is-mode-' + mode, {\n\t\t'has-metaboxes': hasActiveMetaboxes,\n\t} );\n\n\tfunction onPluginAreaError( name ) {\n\t\tcreateErrorNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: plugin name */\n\t\t\t\t__(\n\t\t\t\t\t'The \"%s\" plugin has encountered an error and cannot be rendered.'\n\t\t\t\t),\n\t\t\t\tname\n\t\t\t)\n\t\t);\n\t}\n\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst onActionPerformed = useCallback(\n\t\t( actionId, items ) => {\n\t\t\tswitch ( actionId ) {\n\t\t\t\tcase 'move-to-trash':\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.location.href = addQueryArgs( 'edit.php', {\n\t\t\t\t\t\t\ttrashed: 1,\n\t\t\t\t\t\t\tpost_type: items[ 0 ].type,\n\t\t\t\t\t\t\tids: items[ 0 ].id,\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'duplicate-post':\n\t\t\t\t\t{\n\t\t\t\t\t\tconst newItem = items[ 0 ];\n\t\t\t\t\t\tconst title =\n\t\t\t\t\t\t\ttypeof newItem.title === 'string'\n\t\t\t\t\t\t\t\t? newItem.title\n\t\t\t\t\t\t\t\t: newItem.title?.rendered;\n\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Title of the created post or template, e.g: \"Hello world\".\n\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\tdecodeEntities( title ) || __( '(no title)' )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlabel: __( 'Edit' ),\n\t\t\t\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\t\t\t\tconst postId = newItem.id;\n\t\t\t\t\t\t\t\t\t\t\tdocument.location.href =\n\t\t\t\t\t\t\t\t\t\t\t\taddQueryArgs( 'post.php', {\n\t\t\t\t\t\t\t\t\t\t\t\t\tpost: postId,\n\t\t\t\t\t\t\t\t\t\t\t\t\taction: 'edit',\n\t\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t},\n\t\t[ createSuccessNotice ]\n\t);\n\n\tconst initialPost = useMemo( () => {\n\t\treturn {\n\t\t\ttype: initialPostType,\n\t\t\tid: initialPostId,\n\t\t};\n\t}, [ initialPostType, initialPostId ] );\n\n\tconst backButton =\n\t\tuseViewportMatch( 'medium' ) && isFullscreenActive ? (\n\t\t\t<BackButton initialPost={ initialPost } />\n\t\t) : null;\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<ErrorBoundary canCopyContent>\n\t\t\t\t<WelcomeGuide postType={ currentPostType } />\n\t\t\t\t<div\n\t\t\t\t\tclassName={ navigateRegionsProps.className }\n\t\t\t\t\t{ ...navigateRegionsProps }\n\t\t\t\t\tref={ navigateRegionsProps.ref }\n\t\t\t\t>\n\t\t\t\t\t<Editor\n\t\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\t\tpostType={ currentPostType }\n\t\t\t\t\t\tpostId={ currentPostId }\n\t\t\t\t\t\ttemplateId={ templateId }\n\t\t\t\t\t\tclassName={ className }\n\t\t\t\t\t\tforceIsDirty={ hasActiveMetaboxes }\n\t\t\t\t\t\tdisableIframe={ ! shouldIframe }\n\t\t\t\t\t\t// We should auto-focus the canvas (title) on load.\n\t\t\t\t\t\t// eslint-disable-next-line jsx-a11y/no-autofocus\n\t\t\t\t\t\tautoFocus={ ! isWelcomeGuideVisible }\n\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\textraSidebarPanels={\n\t\t\t\t\t\t\tshowMetaBoxes && <MetaBoxes location=\"side\" />\n\t\t\t\t\t\t}\n\t\t\t\t\t\textraContent={\n\t\t\t\t\t\t\t! isDistractionFree &&\n\t\t\t\t\t\t\tshowMetaBoxes && (\n\t\t\t\t\t\t\t\t<MetaBoxesMain\n\t\t\t\t\t\t\t\t\tisLegacy={\n\t\t\t\t\t\t\t\t\t\t! shouldIframe || isDevicePreview\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<PostLockedModal />\n\t\t\t\t\t\t<EditorInitialization />\n\t\t\t\t\t\t<FullscreenMode isActive={ isFullscreenActive } />\n\t\t\t\t\t\t<BrowserURL />\n\t\t\t\t\t\t<UnsavedChangesWarning />\n\t\t\t\t\t\t<AutosaveMonitor />\n\t\t\t\t\t\t<LocalAutosaveMonitor />\n\t\t\t\t\t\t<EditPostKeyboardShortcuts />\n\t\t\t\t\t\t<EditorKeyboardShortcutsRegister />\n\t\t\t\t\t\t<BlockKeyboardShortcuts />\n\t\t\t\t\t\t<InitPatternModal />\n\t\t\t\t\t\t<PluginArea onError={ onPluginAreaError } />\n\t\t\t\t\t\t<PostEditorMoreMenu />\n\t\t\t\t\t\t{ backButton }\n\t\t\t\t\t\t<EditorSnackbars />\n\t\t\t\t\t</Editor>\n\t\t\t\t</div>\n\t\t\t</ErrorBoundary>\n\t\t</SlotFillProvider>\n\t);\n}\n\nexport default Layout;\n"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS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BAAqB;AAAA,QAC/B,GAAG;AAAA,QACL,KAAM,qBAAqB;AAAA,QAE3B;AAAA,UAAC;AAAA;AAAA,YACA,UAAW;AAAA,YACX;AAAA,YACA,UAAW;AAAA,YACX,QAAS;AAAA,YACT;AAAA,YACA;AAAA,YACA,cAAe;AAAA,YACf,eAAgB,CAAE;AAAA,YAGlB,WAAY,CAAE;AAAA,YACd;AAAA,YACA,oBACC,iBAAiB,oBAAC,aAAU,UAAS,QAAO;AAAA,YAE7C,cACC,CAAE,qBACF,iBACC;AAAA,cAAC;AAAA;AAAA,gBACA,UACC,CAAE,gBAAgB;AAAA;AAAA,YAEpB;AAAA,YAIF;AAAA,kCAAC,mBAAgB;AAAA,cACjB,oBAAC,wBAAqB;AAAA,cACtB,oBAAC,kBAAe,UAAW,oBAAqB;AAAA,cAChD,oBAAC,cAAW;AAAA,cACZ,oBAAC,yBAAsB;AAAA,cACvB,oBAAC,mBAAgB;AAAA,cACjB,oBAAC,wBAAqB;AAAA,cACtB,oBAAC,6BAA0B;AAAA,cAC3B,oBAAC,mCAAgC;AAAA,cACjC,oBAAC,0BAAuB;AAAA,cACxB,oBAAC,oBAAiB;AAAA,cAClB,oBAAC,cAAW,SAAU,mBAAoB;AAAA,cAC1C,oBAAC,sBAAmB;AAAA,cAClB;AAAA,cACF,oBAAC,mBAAgB;AAAA;AAAA;AAAA,QAClB;AAAA;AAAA,IACD;AAAA,KACD,GACD;AAEF;AAEA,IAAO,iBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-post",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.35.0",
|
|
4
4
|
"description": "Edit Post module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -40,37 +40,37 @@
|
|
|
40
40
|
"postbox"
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@wordpress/a11y": "^4.
|
|
44
|
-
"@wordpress/admin-ui": "^1.
|
|
45
|
-
"@wordpress/api-fetch": "^7.
|
|
46
|
-
"@wordpress/base-styles": "^6.
|
|
47
|
-
"@wordpress/block-editor": "^15.
|
|
48
|
-
"@wordpress/block-library": "^9.
|
|
49
|
-
"@wordpress/blocks": "^15.
|
|
50
|
-
"@wordpress/commands": "^1.
|
|
51
|
-
"@wordpress/components": "^30.
|
|
52
|
-
"@wordpress/compose": "^7.
|
|
53
|
-
"@wordpress/core-data": "^7.
|
|
54
|
-
"@wordpress/data": "^10.
|
|
55
|
-
"@wordpress/deprecated": "^4.
|
|
56
|
-
"@wordpress/dom": "^4.
|
|
57
|
-
"@wordpress/editor": "^14.
|
|
58
|
-
"@wordpress/element": "^6.
|
|
59
|
-
"@wordpress/global-styles-engine": "^1.
|
|
60
|
-
"@wordpress/hooks": "^4.
|
|
61
|
-
"@wordpress/html-entities": "^4.
|
|
62
|
-
"@wordpress/i18n": "^6.
|
|
63
|
-
"@wordpress/icons": "^11.
|
|
64
|
-
"@wordpress/keyboard-shortcuts": "^5.
|
|
65
|
-
"@wordpress/keycodes": "^4.
|
|
66
|
-
"@wordpress/notices": "^5.
|
|
67
|
-
"@wordpress/plugins": "^7.
|
|
68
|
-
"@wordpress/preferences": "^4.
|
|
69
|
-
"@wordpress/private-apis": "^1.
|
|
70
|
-
"@wordpress/url": "^4.
|
|
71
|
-
"@wordpress/viewport": "^6.
|
|
72
|
-
"@wordpress/warning": "^3.
|
|
73
|
-
"@wordpress/widgets": "^4.
|
|
43
|
+
"@wordpress/a11y": "^4.35.0",
|
|
44
|
+
"@wordpress/admin-ui": "^1.3.0",
|
|
45
|
+
"@wordpress/api-fetch": "^7.35.0",
|
|
46
|
+
"@wordpress/base-styles": "^6.11.0",
|
|
47
|
+
"@wordpress/block-editor": "^15.8.0",
|
|
48
|
+
"@wordpress/block-library": "^9.35.0",
|
|
49
|
+
"@wordpress/blocks": "^15.8.0",
|
|
50
|
+
"@wordpress/commands": "^1.35.0",
|
|
51
|
+
"@wordpress/components": "^30.8.0",
|
|
52
|
+
"@wordpress/compose": "^7.35.0",
|
|
53
|
+
"@wordpress/core-data": "^7.35.0",
|
|
54
|
+
"@wordpress/data": "^10.35.0",
|
|
55
|
+
"@wordpress/deprecated": "^4.35.0",
|
|
56
|
+
"@wordpress/dom": "^4.35.0",
|
|
57
|
+
"@wordpress/editor": "^14.35.0",
|
|
58
|
+
"@wordpress/element": "^6.35.0",
|
|
59
|
+
"@wordpress/global-styles-engine": "^1.2.0",
|
|
60
|
+
"@wordpress/hooks": "^4.35.0",
|
|
61
|
+
"@wordpress/html-entities": "^4.35.0",
|
|
62
|
+
"@wordpress/i18n": "^6.8.0",
|
|
63
|
+
"@wordpress/icons": "^11.2.0",
|
|
64
|
+
"@wordpress/keyboard-shortcuts": "^5.35.0",
|
|
65
|
+
"@wordpress/keycodes": "^4.35.0",
|
|
66
|
+
"@wordpress/notices": "^5.35.0",
|
|
67
|
+
"@wordpress/plugins": "^7.35.0",
|
|
68
|
+
"@wordpress/preferences": "^4.35.0",
|
|
69
|
+
"@wordpress/private-apis": "^1.35.0",
|
|
70
|
+
"@wordpress/url": "^4.35.0",
|
|
71
|
+
"@wordpress/viewport": "^6.35.0",
|
|
72
|
+
"@wordpress/warning": "^3.35.0",
|
|
73
|
+
"@wordpress/widgets": "^4.35.0",
|
|
74
74
|
"clsx": "^2.1.1",
|
|
75
75
|
"memize": "^2.1.0"
|
|
76
76
|
},
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"publishConfig": {
|
|
82
82
|
"access": "public"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "77aa1f194edceafe8ac2a1b9438bf84b557e76e3"
|
|
85
85
|
}
|
|
@@ -68,7 +68,6 @@ import WelcomeGuide from '../welcome-guide';
|
|
|
68
68
|
import { store as editPostStore } from '../../store';
|
|
69
69
|
import { unlock } from '../../lock-unlock';
|
|
70
70
|
import useEditPostCommands from '../../commands/use-commands';
|
|
71
|
-
import { usePaddingAppender } from './use-padding-appender';
|
|
72
71
|
import { useShouldIframe } from './use-should-iframe';
|
|
73
72
|
import useNavigateToEntityRecord from '../../hooks/use-navigate-to-entity-record';
|
|
74
73
|
import { useMetaBoxInitialization } from '../meta-boxes/use-meta-box-initialization';
|
|
@@ -83,7 +82,7 @@ const DESIGN_POST_TYPES = [
|
|
|
83
82
|
'wp_navigation',
|
|
84
83
|
];
|
|
85
84
|
|
|
86
|
-
function useEditorStyles( settings
|
|
85
|
+
function useEditorStyles( settings ) {
|
|
87
86
|
const { hasThemeStyleSupport } = useSelect( ( select ) => {
|
|
88
87
|
return {
|
|
89
88
|
hasThemeStyleSupport:
|
|
@@ -91,8 +90,6 @@ function useEditorStyles( settings, ...additionalStyles ) {
|
|
|
91
90
|
};
|
|
92
91
|
}, [] );
|
|
93
92
|
|
|
94
|
-
const addedStyles = additionalStyles.join( '\n' );
|
|
95
|
-
|
|
96
93
|
// Compute the default styles.
|
|
97
94
|
return useMemo( () => {
|
|
98
95
|
const presetStyles =
|
|
@@ -125,21 +122,12 @@ function useEditorStyles( settings, ...additionalStyles ) {
|
|
|
125
122
|
} );
|
|
126
123
|
}
|
|
127
124
|
|
|
128
|
-
|
|
129
|
-
? settings.styles ?? []
|
|
130
|
-
: defaultEditorStyles;
|
|
131
|
-
|
|
132
|
-
if ( addedStyles ) {
|
|
133
|
-
return [ ...baseStyles, { css: addedStyles } ];
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
return baseStyles;
|
|
125
|
+
return hasThemeStyles ? settings.styles ?? [] : defaultEditorStyles;
|
|
137
126
|
}, [
|
|
138
127
|
settings.defaultEditorStyles,
|
|
139
128
|
settings.disableLayoutStyles,
|
|
140
129
|
settings.styles,
|
|
141
130
|
hasThemeStyleSupport,
|
|
142
|
-
addedStyles,
|
|
143
131
|
] );
|
|
144
132
|
}
|
|
145
133
|
|
|
@@ -441,7 +429,6 @@ function Layout( {
|
|
|
441
429
|
showMetaBoxes,
|
|
442
430
|
isWelcomeGuideVisible,
|
|
443
431
|
templateId,
|
|
444
|
-
enablePaddingAppender,
|
|
445
432
|
isDevicePreview,
|
|
446
433
|
} = useSelect(
|
|
447
434
|
( select ) => {
|
|
@@ -461,13 +448,8 @@ function Layout( {
|
|
|
461
448
|
const { getBlockSelectionStart, isZoomOut } = unlock(
|
|
462
449
|
select( blockEditorStore )
|
|
463
450
|
);
|
|
464
|
-
const {
|
|
465
|
-
|
|
466
|
-
getRenderingMode,
|
|
467
|
-
getDefaultRenderingMode,
|
|
468
|
-
getDeviceType,
|
|
469
|
-
} = unlock( select( editorStore ) );
|
|
470
|
-
const isRenderingPostOnly = getRenderingMode() === 'post-only';
|
|
451
|
+
const { getEditorMode, getDefaultRenderingMode, getDeviceType } =
|
|
452
|
+
unlock( select( editorStore ) );
|
|
471
453
|
const isNotDesignPostType =
|
|
472
454
|
! DESIGN_POST_TYPES.includes( currentPostType );
|
|
473
455
|
const isDirectlyEditingPattern =
|
|
@@ -498,8 +480,6 @@ function Layout( {
|
|
|
498
480
|
! isEditingTemplate
|
|
499
481
|
? _templateId
|
|
500
482
|
: null,
|
|
501
|
-
enablePaddingAppender:
|
|
502
|
-
! isZoomOut() && isRenderingPostOnly && isNotDesignPostType,
|
|
503
483
|
isDevicePreview: getDeviceType() !== 'Desktop',
|
|
504
484
|
};
|
|
505
485
|
},
|
|
@@ -514,16 +494,12 @@ function Layout( {
|
|
|
514
494
|
|
|
515
495
|
useMetaBoxInitialization( hasActiveMetaboxes && hasResolvedMode );
|
|
516
496
|
|
|
517
|
-
const [ paddingAppenderRef, paddingStyle ] = usePaddingAppender(
|
|
518
|
-
enablePaddingAppender
|
|
519
|
-
);
|
|
520
|
-
|
|
521
497
|
// Set the right context for the command palette
|
|
522
498
|
const commandContext = hasBlockSelected
|
|
523
499
|
? 'block-selection-edit'
|
|
524
500
|
: 'entity-edit';
|
|
525
501
|
useCommandContext( commandContext );
|
|
526
|
-
const styles = useEditorStyles( settings
|
|
502
|
+
const styles = useEditorStyles( settings );
|
|
527
503
|
const editorSettings = useMemo(
|
|
528
504
|
() => ( {
|
|
529
505
|
...settings,
|
|
@@ -646,7 +622,6 @@ function Layout( {
|
|
|
646
622
|
templateId={ templateId }
|
|
647
623
|
className={ className }
|
|
648
624
|
forceIsDirty={ hasActiveMetaboxes }
|
|
649
|
-
contentRef={ paddingAppenderRef }
|
|
650
625
|
disableIframe={ ! shouldIframe }
|
|
651
626
|
// We should auto-focus the canvas (title) on load.
|
|
652
627
|
// eslint-disable-next-line jsx-a11y/no-autofocus
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// packages/edit-post/src/components/layout/use-padding-appender.js
|
|
20
|
-
var use_padding_appender_exports = {};
|
|
21
|
-
__export(use_padding_appender_exports, {
|
|
22
|
-
usePaddingAppender: () => usePaddingAppender
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(use_padding_appender_exports);
|
|
25
|
-
var import_data = require("@wordpress/data");
|
|
26
|
-
var import_compose = require("@wordpress/compose");
|
|
27
|
-
var import_block_editor = require("@wordpress/block-editor");
|
|
28
|
-
var import_blocks = require("@wordpress/blocks");
|
|
29
|
-
var CSS = ':root :where(.editor-styles-wrapper)::after {content: ""; display: block; height: 40vh;}';
|
|
30
|
-
function usePaddingAppender(enabled) {
|
|
31
|
-
const registry = (0, import_data.useRegistry)();
|
|
32
|
-
const effect = (0, import_compose.useRefEffect)(
|
|
33
|
-
(node) => {
|
|
34
|
-
function onMouseDown(event) {
|
|
35
|
-
if (event.target !== node && // Tests for the parent element because in the iframed editor if the click is
|
|
36
|
-
// below the padding the target will be the parent element (html) and should
|
|
37
|
-
// still be treated as intent to append.
|
|
38
|
-
event.target !== node.parentElement) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
const lastChild = node.lastElementChild;
|
|
42
|
-
if (!lastChild) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
const lastChildRect = lastChild.getBoundingClientRect();
|
|
46
|
-
if (event.clientY < lastChildRect.bottom) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
event.preventDefault();
|
|
50
|
-
const blockOrder = registry.select(import_block_editor.store).getBlockOrder("");
|
|
51
|
-
const lastBlockClientId = blockOrder[blockOrder.length - 1];
|
|
52
|
-
const lastBlock = registry.select(import_block_editor.store).getBlock(lastBlockClientId);
|
|
53
|
-
const { selectBlock, insertDefaultBlock } = registry.dispatch(import_block_editor.store);
|
|
54
|
-
if (lastBlock && (0, import_blocks.isUnmodifiedDefaultBlock)(lastBlock)) {
|
|
55
|
-
selectBlock(lastBlockClientId);
|
|
56
|
-
} else {
|
|
57
|
-
insertDefaultBlock();
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
const { ownerDocument } = node;
|
|
61
|
-
ownerDocument.addEventListener("pointerdown", onMouseDown);
|
|
62
|
-
return () => {
|
|
63
|
-
ownerDocument.removeEventListener("pointerdown", onMouseDown);
|
|
64
|
-
};
|
|
65
|
-
},
|
|
66
|
-
[registry]
|
|
67
|
-
);
|
|
68
|
-
return enabled ? [effect, CSS] : [];
|
|
69
|
-
}
|
|
70
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
71
|
-
0 && (module.exports = {
|
|
72
|
-
usePaddingAppender
|
|
73
|
-
});
|
|
74
|
-
//# sourceMappingURL=use-padding-appender.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/layout/use-padding-appender.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useRegistry } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { isUnmodifiedDefaultBlock } from '@wordpress/blocks';\n\n// Ruleset to add space for the typewriter effect. When typing in the last\n// block, there needs to be room to scroll up.\nconst CSS =\n\t':root :where(.editor-styles-wrapper)::after {content: \"\"; display: block; height: 40vh;}';\n\nexport function usePaddingAppender( enabled ) {\n\tconst registry = useRegistry();\n\tconst effect = useRefEffect(\n\t\t( node ) => {\n\t\t\tfunction onMouseDown( event ) {\n\t\t\t\tif (\n\t\t\t\t\tevent.target !== node &&\n\t\t\t\t\t// Tests for the parent element because in the iframed editor if the click is\n\t\t\t\t\t// below the padding the target will be the parent element (html) and should\n\t\t\t\t\t// still be treated as intent to append.\n\t\t\t\t\tevent.target !== node.parentElement\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Only handle clicks under the last child.\n\t\t\t\tconst lastChild = node.lastElementChild;\n\t\t\t\tif ( ! lastChild ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst lastChildRect = lastChild.getBoundingClientRect();\n\t\t\t\tif ( event.clientY < lastChildRect.bottom ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\tconst blockOrder = registry\n\t\t\t\t\t.select( blockEditorStore )\n\t\t\t\t\t.getBlockOrder( '' );\n\t\t\t\tconst lastBlockClientId = blockOrder[ blockOrder.length - 1 ];\n\n\t\t\t\tconst lastBlock = registry\n\t\t\t\t\t.select( blockEditorStore )\n\t\t\t\t\t.getBlock( lastBlockClientId );\n\t\t\t\tconst { selectBlock, insertDefaultBlock } =\n\t\t\t\t\tregistry.dispatch( blockEditorStore );\n\n\t\t\t\tif ( lastBlock && isUnmodifiedDefaultBlock( lastBlock ) ) {\n\t\t\t\t\tselectBlock( lastBlockClientId );\n\t\t\t\t} else {\n\t\t\t\t\tinsertDefaultBlock();\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst { ownerDocument } = node;\n\t\t\t// Adds the listener on the document so that in the iframed editor clicks below the\n\t\t\t// padding can be handled as they too should be treated as intent to append.\n\t\t\townerDocument.addEventListener( 'pointerdown', onMouseDown );\n\t\t\treturn () => {\n\t\t\t\townerDocument.removeEventListener( 'pointerdown', onMouseDown );\n\t\t\t};\n\t\t},\n\t\t[ registry ]\n\t);\n\treturn enabled ? [ effect, CSS ] : [];\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA4B;AAC5B,qBAA6B;AAC7B,0BAA0C;AAC1C,oBAAyC;AAIzC,IAAM,MACL;AAEM,SAAS,mBAAoB,SAAU;AAC7C,QAAM,eAAW,yBAAY;AAC7B,QAAM,aAAS;AAAA,IACd,CAAE,SAAU;AACX,eAAS,YAAa,OAAQ;AAC7B,YACC,MAAM,WAAW;AAAA;AAAA;AAAA,QAIjB,MAAM,WAAW,KAAK,eACrB;AACD;AAAA,QACD;AAGA,cAAM,YAAY,KAAK;AACvB,YAAK,CAAE,WAAY;AAClB;AAAA,QACD;AAEA,cAAM,gBAAgB,UAAU,sBAAsB;AACtD,YAAK,MAAM,UAAU,cAAc,QAAS;AAC3C;AAAA,QACD;AAEA,cAAM,eAAe;AAErB,cAAM,aAAa,SACjB,OAAQ,oBAAAA,KAAiB,EACzB,cAAe,EAAG;AACpB,cAAM,oBAAoB,WAAY,WAAW,SAAS,CAAE;AAE5D,cAAM,YAAY,SAChB,OAAQ,oBAAAA,KAAiB,EACzB,SAAU,iBAAkB;AAC9B,cAAM,EAAE,aAAa,mBAAmB,IACvC,SAAS,SAAU,oBAAAA,KAAiB;AAErC,YAAK,iBAAa,wCAA0B,SAAU,GAAI;AACzD,sBAAa,iBAAkB;AAAA,QAChC,OAAO;AACN,6BAAmB;AAAA,QACpB;AAAA,MACD;AACA,YAAM,EAAE,cAAc,IAAI;AAG1B,oBAAc,iBAAkB,eAAe,WAAY;AAC3D,aAAO,MAAM;AACZ,sBAAc,oBAAqB,eAAe,WAAY;AAAA,MAC/D;AAAA,IACD;AAAA,IACA,CAAE,QAAS;AAAA,EACZ;AACA,SAAO,UAAU,CAAE,QAAQ,GAAI,IAAI,CAAC;AACrC;",
|
|
6
|
-
"names": ["blockEditorStore"]
|
|
7
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// packages/edit-post/src/components/layout/use-padding-appender.js
|
|
2
|
-
import { useRegistry } from "@wordpress/data";
|
|
3
|
-
import { useRefEffect } from "@wordpress/compose";
|
|
4
|
-
import { store as blockEditorStore } from "@wordpress/block-editor";
|
|
5
|
-
import { isUnmodifiedDefaultBlock } from "@wordpress/blocks";
|
|
6
|
-
var CSS = ':root :where(.editor-styles-wrapper)::after {content: ""; display: block; height: 40vh;}';
|
|
7
|
-
function usePaddingAppender(enabled) {
|
|
8
|
-
const registry = useRegistry();
|
|
9
|
-
const effect = useRefEffect(
|
|
10
|
-
(node) => {
|
|
11
|
-
function onMouseDown(event) {
|
|
12
|
-
if (event.target !== node && // Tests for the parent element because in the iframed editor if the click is
|
|
13
|
-
// below the padding the target will be the parent element (html) and should
|
|
14
|
-
// still be treated as intent to append.
|
|
15
|
-
event.target !== node.parentElement) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
const lastChild = node.lastElementChild;
|
|
19
|
-
if (!lastChild) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
const lastChildRect = lastChild.getBoundingClientRect();
|
|
23
|
-
if (event.clientY < lastChildRect.bottom) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
event.preventDefault();
|
|
27
|
-
const blockOrder = registry.select(blockEditorStore).getBlockOrder("");
|
|
28
|
-
const lastBlockClientId = blockOrder[blockOrder.length - 1];
|
|
29
|
-
const lastBlock = registry.select(blockEditorStore).getBlock(lastBlockClientId);
|
|
30
|
-
const { selectBlock, insertDefaultBlock } = registry.dispatch(blockEditorStore);
|
|
31
|
-
if (lastBlock && isUnmodifiedDefaultBlock(lastBlock)) {
|
|
32
|
-
selectBlock(lastBlockClientId);
|
|
33
|
-
} else {
|
|
34
|
-
insertDefaultBlock();
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
const { ownerDocument } = node;
|
|
38
|
-
ownerDocument.addEventListener("pointerdown", onMouseDown);
|
|
39
|
-
return () => {
|
|
40
|
-
ownerDocument.removeEventListener("pointerdown", onMouseDown);
|
|
41
|
-
};
|
|
42
|
-
},
|
|
43
|
-
[registry]
|
|
44
|
-
);
|
|
45
|
-
return enabled ? [effect, CSS] : [];
|
|
46
|
-
}
|
|
47
|
-
export {
|
|
48
|
-
usePaddingAppender
|
|
49
|
-
};
|
|
50
|
-
//# sourceMappingURL=use-padding-appender.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/layout/use-padding-appender.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useRegistry } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { isUnmodifiedDefaultBlock } from '@wordpress/blocks';\n\n// Ruleset to add space for the typewriter effect. When typing in the last\n// block, there needs to be room to scroll up.\nconst CSS =\n\t':root :where(.editor-styles-wrapper)::after {content: \"\"; display: block; height: 40vh;}';\n\nexport function usePaddingAppender( enabled ) {\n\tconst registry = useRegistry();\n\tconst effect = useRefEffect(\n\t\t( node ) => {\n\t\t\tfunction onMouseDown( event ) {\n\t\t\t\tif (\n\t\t\t\t\tevent.target !== node &&\n\t\t\t\t\t// Tests for the parent element because in the iframed editor if the click is\n\t\t\t\t\t// below the padding the target will be the parent element (html) and should\n\t\t\t\t\t// still be treated as intent to append.\n\t\t\t\t\tevent.target !== node.parentElement\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Only handle clicks under the last child.\n\t\t\t\tconst lastChild = node.lastElementChild;\n\t\t\t\tif ( ! lastChild ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst lastChildRect = lastChild.getBoundingClientRect();\n\t\t\t\tif ( event.clientY < lastChildRect.bottom ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\tconst blockOrder = registry\n\t\t\t\t\t.select( blockEditorStore )\n\t\t\t\t\t.getBlockOrder( '' );\n\t\t\t\tconst lastBlockClientId = blockOrder[ blockOrder.length - 1 ];\n\n\t\t\t\tconst lastBlock = registry\n\t\t\t\t\t.select( blockEditorStore )\n\t\t\t\t\t.getBlock( lastBlockClientId );\n\t\t\t\tconst { selectBlock, insertDefaultBlock } =\n\t\t\t\t\tregistry.dispatch( blockEditorStore );\n\n\t\t\t\tif ( lastBlock && isUnmodifiedDefaultBlock( lastBlock ) ) {\n\t\t\t\t\tselectBlock( lastBlockClientId );\n\t\t\t\t} else {\n\t\t\t\t\tinsertDefaultBlock();\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst { ownerDocument } = node;\n\t\t\t// Adds the listener on the document so that in the iframed editor clicks below the\n\t\t\t// padding can be handled as they too should be treated as intent to append.\n\t\t\townerDocument.addEventListener( 'pointerdown', onMouseDown );\n\t\t\treturn () => {\n\t\t\t\townerDocument.removeEventListener( 'pointerdown', onMouseDown );\n\t\t\t};\n\t\t},\n\t\t[ registry ]\n\t);\n\treturn enabled ? [ effect, CSS ] : [];\n}\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAC7B,SAAS,SAAS,wBAAwB;AAC1C,SAAS,gCAAgC;AAIzC,IAAM,MACL;AAEM,SAAS,mBAAoB,SAAU;AAC7C,QAAM,WAAW,YAAY;AAC7B,QAAM,SAAS;AAAA,IACd,CAAE,SAAU;AACX,eAAS,YAAa,OAAQ;AAC7B,YACC,MAAM,WAAW;AAAA;AAAA;AAAA,QAIjB,MAAM,WAAW,KAAK,eACrB;AACD;AAAA,QACD;AAGA,cAAM,YAAY,KAAK;AACvB,YAAK,CAAE,WAAY;AAClB;AAAA,QACD;AAEA,cAAM,gBAAgB,UAAU,sBAAsB;AACtD,YAAK,MAAM,UAAU,cAAc,QAAS;AAC3C;AAAA,QACD;AAEA,cAAM,eAAe;AAErB,cAAM,aAAa,SACjB,OAAQ,gBAAiB,EACzB,cAAe,EAAG;AACpB,cAAM,oBAAoB,WAAY,WAAW,SAAS,CAAE;AAE5D,cAAM,YAAY,SAChB,OAAQ,gBAAiB,EACzB,SAAU,iBAAkB;AAC9B,cAAM,EAAE,aAAa,mBAAmB,IACvC,SAAS,SAAU,gBAAiB;AAErC,YAAK,aAAa,yBAA0B,SAAU,GAAI;AACzD,sBAAa,iBAAkB;AAAA,QAChC,OAAO;AACN,6BAAmB;AAAA,QACpB;AAAA,MACD;AACA,YAAM,EAAE,cAAc,IAAI;AAG1B,oBAAc,iBAAkB,eAAe,WAAY;AAC3D,aAAO,MAAM;AACZ,sBAAc,oBAAqB,eAAe,WAAY;AAAA,MAC/D;AAAA,IACD;AAAA,IACA,CAAE,QAAS;AAAA,EACZ;AACA,SAAO,UAAU,CAAE,QAAQ,GAAI,IAAI,CAAC;AACrC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useRegistry } from '@wordpress/data';
|
|
5
|
-
import { useRefEffect } from '@wordpress/compose';
|
|
6
|
-
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
7
|
-
import { isUnmodifiedDefaultBlock } from '@wordpress/blocks';
|
|
8
|
-
|
|
9
|
-
// Ruleset to add space for the typewriter effect. When typing in the last
|
|
10
|
-
// block, there needs to be room to scroll up.
|
|
11
|
-
const CSS =
|
|
12
|
-
':root :where(.editor-styles-wrapper)::after {content: ""; display: block; height: 40vh;}';
|
|
13
|
-
|
|
14
|
-
export function usePaddingAppender( enabled ) {
|
|
15
|
-
const registry = useRegistry();
|
|
16
|
-
const effect = useRefEffect(
|
|
17
|
-
( node ) => {
|
|
18
|
-
function onMouseDown( event ) {
|
|
19
|
-
if (
|
|
20
|
-
event.target !== node &&
|
|
21
|
-
// Tests for the parent element because in the iframed editor if the click is
|
|
22
|
-
// below the padding the target will be the parent element (html) and should
|
|
23
|
-
// still be treated as intent to append.
|
|
24
|
-
event.target !== node.parentElement
|
|
25
|
-
) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// Only handle clicks under the last child.
|
|
30
|
-
const lastChild = node.lastElementChild;
|
|
31
|
-
if ( ! lastChild ) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const lastChildRect = lastChild.getBoundingClientRect();
|
|
36
|
-
if ( event.clientY < lastChildRect.bottom ) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
event.preventDefault();
|
|
41
|
-
|
|
42
|
-
const blockOrder = registry
|
|
43
|
-
.select( blockEditorStore )
|
|
44
|
-
.getBlockOrder( '' );
|
|
45
|
-
const lastBlockClientId = blockOrder[ blockOrder.length - 1 ];
|
|
46
|
-
|
|
47
|
-
const lastBlock = registry
|
|
48
|
-
.select( blockEditorStore )
|
|
49
|
-
.getBlock( lastBlockClientId );
|
|
50
|
-
const { selectBlock, insertDefaultBlock } =
|
|
51
|
-
registry.dispatch( blockEditorStore );
|
|
52
|
-
|
|
53
|
-
if ( lastBlock && isUnmodifiedDefaultBlock( lastBlock ) ) {
|
|
54
|
-
selectBlock( lastBlockClientId );
|
|
55
|
-
} else {
|
|
56
|
-
insertDefaultBlock();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
const { ownerDocument } = node;
|
|
60
|
-
// Adds the listener on the document so that in the iframed editor clicks below the
|
|
61
|
-
// padding can be handled as they too should be treated as intent to append.
|
|
62
|
-
ownerDocument.addEventListener( 'pointerdown', onMouseDown );
|
|
63
|
-
return () => {
|
|
64
|
-
ownerDocument.removeEventListener( 'pointerdown', onMouseDown );
|
|
65
|
-
};
|
|
66
|
-
},
|
|
67
|
-
[ registry ]
|
|
68
|
-
);
|
|
69
|
-
return enabled ? [ effect, CSS ] : [];
|
|
70
|
-
}
|