@wordpress/editor 14.19.3 → 14.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +1 -1
- package/build/components/commands/index.js +1 -1
- package/build/components/commands/index.js.map +1 -1
- package/build/components/plugin-pre-publish-panel/index.js +1 -1
- package/build/components/plugin-pre-publish-panel/index.js.map +1 -1
- package/build/components/post-actions/actions.js +10 -8
- package/build/components/post-actions/actions.js.map +1 -1
- package/build/components/post-publish-panel/maybe-category-panel.js +19 -3
- package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-tags-panel.js +16 -6
- package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
- package/build/components/post-status/index.js +5 -1
- package/build/components/post-status/index.js.map +1 -1
- package/build/components/post-sticky/index.js +1 -1
- package/build/components/post-sticky/index.js.map +1 -1
- package/build/components/post-template/block-theme.js +1 -3
- package/build/components/post-template/block-theme.js.map +1 -1
- package/build/components/post-template/create-new-template-modal.js +1 -0
- package/build/components/post-template/create-new-template-modal.js.map +1 -1
- package/build/components/post-template/create-new-template.js +1 -4
- package/build/components/post-template/create-new-template.js.map +1 -1
- package/build/components/post-template/hooks.js +6 -5
- package/build/components/post-template/hooks.js.map +1 -1
- package/build/components/post-template/swap-template-button.js +2 -3
- package/build/components/post-template/swap-template-button.js.map +1 -1
- package/build/components/post-visibility/index.js +39 -109
- package/build/components/post-visibility/index.js.map +1 -1
- package/build/components/post-visibility/label.js +2 -2
- package/build/components/post-visibility/label.js.map +1 -1
- package/build/components/post-visibility/utils.js +14 -15
- package/build/components/post-visibility/utils.js.map +1 -1
- package/build/components/preview-dropdown/index.js +2 -4
- package/build/components/preview-dropdown/index.js.map +1 -1
- package/build-module/components/commands/index.js +1 -1
- package/build-module/components/commands/index.js.map +1 -1
- package/build-module/components/plugin-pre-publish-panel/index.js +1 -1
- package/build-module/components/plugin-pre-publish-panel/index.js.map +1 -1
- package/build-module/components/post-actions/actions.js +10 -8
- package/build-module/components/post-actions/actions.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-category-panel.js +19 -3
- package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-tags-panel.js +16 -6
- package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
- package/build-module/components/post-status/index.js +5 -1
- package/build-module/components/post-status/index.js.map +1 -1
- package/build-module/components/post-sticky/index.js +1 -1
- package/build-module/components/post-sticky/index.js.map +1 -1
- package/build-module/components/post-template/block-theme.js +1 -3
- package/build-module/components/post-template/block-theme.js.map +1 -1
- package/build-module/components/post-template/create-new-template-modal.js +1 -0
- package/build-module/components/post-template/create-new-template-modal.js.map +1 -1
- package/build-module/components/post-template/create-new-template.js +1 -4
- package/build-module/components/post-template/create-new-template.js.map +1 -1
- package/build-module/components/post-template/hooks.js +6 -5
- package/build-module/components/post-template/hooks.js.map +1 -1
- package/build-module/components/post-template/swap-template-button.js +2 -3
- package/build-module/components/post-template/swap-template-button.js.map +1 -1
- package/build-module/components/post-visibility/index.js +41 -111
- package/build-module/components/post-visibility/index.js.map +1 -1
- package/build-module/components/post-visibility/label.js +3 -3
- package/build-module/components/post-visibility/label.js.map +1 -1
- package/build-module/components/post-visibility/utils.js +13 -14
- package/build-module/components/post-visibility/utils.js.map +1 -1
- package/build-module/components/preview-dropdown/index.js +2 -4
- package/build-module/components/preview-dropdown/index.js.map +1 -1
- package/build-style/style-rtl.css +6 -137
- package/build-style/style.css +6 -137
- package/build-types/components/plugin-pre-publish-panel/index.d.ts +1 -1
- package/build-types/components/post-actions/actions.d.ts.map +1 -1
- package/build-types/components/post-publish-panel/maybe-category-panel.d.ts.map +1 -1
- package/build-types/components/post-publish-panel/maybe-tags-panel.d.ts.map +1 -1
- package/build-types/components/post-status/index.d.ts.map +1 -1
- package/build-types/components/post-template/block-theme.d.ts.map +1 -1
- package/build-types/components/post-template/create-new-template-modal.d.ts.map +1 -1
- package/build-types/components/post-template/create-new-template.d.ts +1 -3
- package/build-types/components/post-template/create-new-template.d.ts.map +1 -1
- package/build-types/components/post-template/hooks.d.ts.map +1 -1
- package/build-types/components/post-template/swap-template-button.d.ts +1 -1
- package/build-types/components/post-template/swap-template-button.d.ts.map +1 -1
- package/build-types/components/post-visibility/index.d.ts.map +1 -1
- package/build-types/components/post-visibility/label.d.ts.map +1 -1
- package/build-types/components/post-visibility/utils.d.ts +5 -20
- package/build-types/components/post-visibility/utils.d.ts.map +1 -1
- package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
- package/package.json +37 -37
- package/src/components/autocompleters/style.scss +2 -3
- package/src/components/commands/index.js +1 -1
- package/src/components/plugin-pre-publish-panel/index.js +1 -1
- package/src/components/post-actions/actions.js +13 -8
- package/src/components/post-publish-panel/maybe-category-panel.js +20 -5
- package/src/components/post-publish-panel/maybe-tags-panel.js +39 -22
- package/src/components/post-status/index.js +7 -2
- package/src/components/post-sticky/index.js +1 -1
- package/src/components/post-template/block-theme.js +1 -3
- package/src/components/post-template/create-new-template-modal.js +1 -0
- package/src/components/post-template/create-new-template.js +1 -2
- package/src/components/post-template/hooks.js +12 -8
- package/src/components/post-template/style.scss +4 -0
- package/src/components/post-template/swap-template-button.js +6 -4
- package/src/components/post-visibility/index.js +41 -118
- package/src/components/post-visibility/label.js +7 -4
- package/src/components/post-visibility/utils.js +11 -8
- package/src/components/preview-dropdown/index.js +6 -3
- package/src/style.scss +0 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/src/components/post-visibility/style.scss +0 -27
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_compose","_components","_i18n","_icons","_data","_coreData","_preferences","_interface","_store","_blockEditor","_postPreviewButton","_lockUnlock","_jsxRuntime","PreviewDropdown","forceIsAutosaveable","disabled","deviceType","homeUrl","isTemplate","isViewable","showIconLabels","isTemplateHidden","templateId","useSelect","select","_getPostType$viewable","getDeviceType","getCurrentPostType","getCurrentTemplateId","editorStore","getRenderingMode","unlock","getEntityRecord","getPostType","coreStore","get","preferencesStore","_currentPostType","home","viewable","setDeviceType","setRenderingMode","setDefaultRenderingMode","useDispatch","resetZoomLevel","blockEditorStore","handleDevicePreviewChange","newDeviceType","isMobile","useViewportMatch","popoverProps","placement","toggleProps","className","iconPosition","size","showTooltip","accessibleWhenDisabled","menuProps","__","deviceIcons","desktop","mobile","tablet","choices","value","label","icon","jsx","DropdownMenu","clsx","toLowerCase","disableOpenOnArrowDown","children","onClose","jsxs","Fragment","MenuGroup","MenuItemsChoice","onSelect","MenuItem","href","target","external","onClick","VisuallyHidden","as","check","undefined","isSelected","role","newRenderingMode","default","textContent","Icon","onPreview","ActionItem","Slot","name","fillProps"],"sources":["@wordpress/editor/src/components/preview-dropdown/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\tMenuItemsChoice,\n\tVisuallyHidden,\n\tIcon,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { desktop, mobile, tablet, external, check } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { ActionItem } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport PostPreviewButton from '../post-preview-button';\nimport { unlock } from '../../lock-unlock';\n\nexport default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {\n\tconst {\n\t\tdeviceType,\n\t\thomeUrl,\n\t\tisTemplate,\n\t\tisViewable,\n\t\tshowIconLabels,\n\t\tisTemplateHidden,\n\t\ttemplateId,\n\t} = useSelect( ( select ) => {\n\t\tconst { getDeviceType, getCurrentPostType, getCurrentTemplateId } =\n\t\t\tselect( editorStore );\n\t\tconst { getRenderingMode } = unlock( select( editorStore ) );\n\t\tconst { getEntityRecord, getPostType } = select( coreStore );\n\t\tconst { get } = select( preferencesStore );\n\t\tconst _currentPostType = getCurrentPostType();\n\t\treturn {\n\t\t\tdeviceType: getDeviceType(),\n\t\t\thomeUrl: getEntityRecord( 'root', '__unstableBase' )?.home,\n\t\t\tisTemplate: _currentPostType === 'wp_template',\n\t\t\tisViewable: getPostType( _currentPostType )?.viewable ?? false,\n\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\tisTemplateHidden: getRenderingMode() === 'post-only',\n\t\t\ttemplateId: getCurrentTemplateId(),\n\t\t};\n\t}, [] );\n\tconst { setDeviceType, setRenderingMode, setDefaultRenderingMode } = unlock(\n\t\tuseDispatch( editorStore )\n\t);\n\tconst { resetZoomLevel } = unlock( useDispatch( blockEditorStore ) );\n\n\tconst handleDevicePreviewChange = ( newDeviceType ) => {\n\t\tsetDeviceType( newDeviceType );\n\t\tresetZoomLevel();\n\t};\n\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\tif ( isMobile ) {\n\t\treturn null;\n\t}\n\n\tconst popoverProps = {\n\t\tplacement: 'bottom-end',\n\t};\n\tconst toggleProps = {\n\t\tclassName: 'editor-preview-dropdown__toggle',\n\t\ticonPosition: 'right',\n\t\tsize: 'compact',\n\t\tshowTooltip: ! showIconLabels,\n\t\tdisabled,\n\t\taccessibleWhenDisabled: disabled,\n\t};\n\tconst menuProps = {\n\t\t'aria-label': __( 'View options' ),\n\t};\n\n\tconst deviceIcons = {\n\t\tdesktop,\n\t\tmobile,\n\t\ttablet,\n\t};\n\n\t/**\n\t * The choices for the device type.\n\t *\n\t * @type {Array}\n\t */\n\tconst choices = [\n\t\t{\n\t\t\tvalue: 'Desktop',\n\t\t\tlabel: __( 'Desktop' ),\n\t\t\ticon: desktop,\n\t\t},\n\t\t{\n\t\t\tvalue: 'Tablet',\n\t\t\tlabel: __( 'Tablet' ),\n\t\t\ticon: tablet,\n\t\t},\n\t\t{\n\t\t\tvalue: 'Mobile',\n\t\t\tlabel: __( 'Mobile' ),\n\t\t\ticon: mobile,\n\t\t},\n\t];\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName={ clsx(\n\t\t\t\t'editor-preview-dropdown',\n\t\t\t\t`editor-preview-dropdown--${ deviceType.toLowerCase() }`\n\t\t\t) }\n\t\t\tpopoverProps={ popoverProps }\n\t\t\ttoggleProps={ toggleProps }\n\t\t\tmenuProps={ menuProps }\n\t\t\ticon={ deviceIcons[ deviceType.toLowerCase() ] }\n\t\t\tlabel={ __( 'View' ) }\n\t\t\tdisableOpenOnArrowDown={ disabled }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\tchoices={ choices }\n\t\t\t\t\t\t\tvalue={ deviceType }\n\t\t\t\t\t\t\tonSelect={ handleDevicePreviewChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t{ isTemplate && (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\thref={ homeUrl }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'View site' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isTemplate && !! templateId && (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\ticon={ ! isTemplateHidden ? check : undefined }\n\t\t\t\t\t\t\t\tisSelected={ ! isTemplateHidden }\n\t\t\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tconst newRenderingMode = isTemplateHidden\n\t\t\t\t\t\t\t\t\t\t? 'template-locked'\n\t\t\t\t\t\t\t\t\t\t: 'post-only';\n\t\t\t\t\t\t\t\t\tsetRenderingMode( newRenderingMode );\n\t\t\t\t\t\t\t\t\tsetDefaultRenderingMode( newRenderingMode );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Show template' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isViewable && (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<PostPreviewButton\n\t\t\t\t\t\t\t\tclassName=\"editor-preview-dropdown__button-external\"\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\tforceIsAutosaveable={ forceIsAutosaveable }\n\t\t\t\t\t\t\t\taria-label={ __( 'Preview in new tab' ) }\n\t\t\t\t\t\t\t\ttextContent={\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Preview in new tab' ) }\n\t\t\t\t\t\t\t\t\t\t<Icon icon={ external } />\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\tonPreview={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t\t<ActionItem.Slot\n\t\t\t\t\t\tname=\"core/plugin-preview-menu\"\n\t\t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EAACnE,WAAA,CAAA4E,SAAS;QAAAJ,QAAA,eACT,IAAA7D,WAAA,CAAAwD,GAAA,EAAC1D,kBAAA,CAAAkF,OAAiB;UACjBvC,SAAS,EAAC,0CAA0C;UACpDqC,IAAI,EAAC,UAAU;UACf5E,mBAAmB,EAAGA,mBAAqB;UAC3C,cAAa,IAAA6C,QAAE,EAAE,oBAAqB,CAAG;UACzCkC,WAAW,eACV,IAAAjF,WAAA,CAAA+D,IAAA,EAAA/D,WAAA,CAAAgE,QAAA;YAAAH,QAAA,GACG,IAAAd,QAAE,EAAE,oBAAqB,CAAC,eAC5B,IAAA/C,WAAA,CAAAwD,GAAA,EAACnE,WAAA,CAAA6F,IAAI;cAAC3B,IAAI,EAAGgB;YAAU,CAAE,CAAC;UAAA,CACzB,CACF;UACDY,SAAS,EAAGrB;QAAS,CACrB;MAAC,CACQ,CACX,eACD,IAAA9D,WAAA,CAAAwD,GAAA,EAAC7D,UAAA,CAAAyF,UAAU,CAACC,IAAI;QACfC,IAAI,EAAC,0BAA0B;QAC/BC,SAAS,EAAG;UAAEf,OAAO,EAAEV;QAAQ;MAAG,CAClC,CAAC;IAAA,CACD;EACF,CACY,CAAC;AAEjB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_compose","_components","_i18n","_icons","_data","_coreData","_preferences","_interface","_store","_blockEditor","_postPreviewButton","_lockUnlock","_jsxRuntime","PreviewDropdown","forceIsAutosaveable","disabled","deviceType","homeUrl","isTemplate","isViewable","showIconLabels","isTemplateHidden","templateId","useSelect","select","_getPostType$viewable","getDeviceType","getCurrentPostType","getCurrentTemplateId","getRenderingMode","editorStore","getEntityRecord","getPostType","coreStore","get","preferencesStore","_currentPostType","home","viewable","setDeviceType","setRenderingMode","setDefaultRenderingMode","unlock","useDispatch","resetZoomLevel","blockEditorStore","handleDevicePreviewChange","newDeviceType","isMobile","useViewportMatch","popoverProps","placement","toggleProps","className","iconPosition","size","showTooltip","accessibleWhenDisabled","menuProps","__","deviceIcons","desktop","mobile","tablet","choices","value","label","icon","jsx","DropdownMenu","clsx","toLowerCase","disableOpenOnArrowDown","children","onClose","jsxs","Fragment","MenuGroup","MenuItemsChoice","onSelect","MenuItem","href","target","external","onClick","VisuallyHidden","as","check","undefined","isSelected","role","newRenderingMode","default","textContent","Icon","onPreview","ActionItem","Slot","name","fillProps"],"sources":["@wordpress/editor/src/components/preview-dropdown/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\tMenuItemsChoice,\n\tVisuallyHidden,\n\tIcon,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { desktop, mobile, tablet, external, check } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { ActionItem } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport PostPreviewButton from '../post-preview-button';\nimport { unlock } from '../../lock-unlock';\n\nexport default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {\n\tconst {\n\t\tdeviceType,\n\t\thomeUrl,\n\t\tisTemplate,\n\t\tisViewable,\n\t\tshowIconLabels,\n\t\tisTemplateHidden,\n\t\ttemplateId,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetDeviceType,\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentTemplateId,\n\t\t\tgetRenderingMode,\n\t\t} = select( editorStore );\n\t\tconst { getEntityRecord, getPostType } = select( coreStore );\n\t\tconst { get } = select( preferencesStore );\n\t\tconst _currentPostType = getCurrentPostType();\n\t\treturn {\n\t\t\tdeviceType: getDeviceType(),\n\t\t\thomeUrl: getEntityRecord( 'root', '__unstableBase' )?.home,\n\t\t\tisTemplate: _currentPostType === 'wp_template',\n\t\t\tisViewable: getPostType( _currentPostType )?.viewable ?? false,\n\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\tisTemplateHidden: getRenderingMode() === 'post-only',\n\t\t\ttemplateId: getCurrentTemplateId(),\n\t\t};\n\t}, [] );\n\tconst { setDeviceType, setRenderingMode, setDefaultRenderingMode } = unlock(\n\t\tuseDispatch( editorStore )\n\t);\n\tconst { resetZoomLevel } = unlock( useDispatch( blockEditorStore ) );\n\n\tconst handleDevicePreviewChange = ( newDeviceType ) => {\n\t\tsetDeviceType( newDeviceType );\n\t\tresetZoomLevel();\n\t};\n\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\tif ( isMobile ) {\n\t\treturn null;\n\t}\n\n\tconst popoverProps = {\n\t\tplacement: 'bottom-end',\n\t};\n\tconst toggleProps = {\n\t\tclassName: 'editor-preview-dropdown__toggle',\n\t\ticonPosition: 'right',\n\t\tsize: 'compact',\n\t\tshowTooltip: ! showIconLabels,\n\t\tdisabled,\n\t\taccessibleWhenDisabled: disabled,\n\t};\n\tconst menuProps = {\n\t\t'aria-label': __( 'View options' ),\n\t};\n\n\tconst deviceIcons = {\n\t\tdesktop,\n\t\tmobile,\n\t\ttablet,\n\t};\n\n\t/**\n\t * The choices for the device type.\n\t *\n\t * @type {Array}\n\t */\n\tconst choices = [\n\t\t{\n\t\t\tvalue: 'Desktop',\n\t\t\tlabel: __( 'Desktop' ),\n\t\t\ticon: desktop,\n\t\t},\n\t\t{\n\t\t\tvalue: 'Tablet',\n\t\t\tlabel: __( 'Tablet' ),\n\t\t\ticon: tablet,\n\t\t},\n\t\t{\n\t\t\tvalue: 'Mobile',\n\t\t\tlabel: __( 'Mobile' ),\n\t\t\ticon: mobile,\n\t\t},\n\t];\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName={ clsx(\n\t\t\t\t'editor-preview-dropdown',\n\t\t\t\t`editor-preview-dropdown--${ deviceType.toLowerCase() }`\n\t\t\t) }\n\t\t\tpopoverProps={ popoverProps }\n\t\t\ttoggleProps={ toggleProps }\n\t\t\tmenuProps={ menuProps }\n\t\t\ticon={ deviceIcons[ deviceType.toLowerCase() ] }\n\t\t\tlabel={ __( 'View' ) }\n\t\t\tdisableOpenOnArrowDown={ disabled }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\tchoices={ choices }\n\t\t\t\t\t\t\tvalue={ deviceType }\n\t\t\t\t\t\t\tonSelect={ handleDevicePreviewChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t{ isTemplate && (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\thref={ homeUrl }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'View site' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isTemplate && !! templateId && (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\ticon={ ! isTemplateHidden ? check : undefined }\n\t\t\t\t\t\t\t\tisSelected={ ! isTemplateHidden }\n\t\t\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tconst newRenderingMode = isTemplateHidden\n\t\t\t\t\t\t\t\t\t\t? 'template-locked'\n\t\t\t\t\t\t\t\t\t\t: 'post-only';\n\t\t\t\t\t\t\t\t\tsetRenderingMode( newRenderingMode );\n\t\t\t\t\t\t\t\t\tsetDefaultRenderingMode( newRenderingMode );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Show template' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isViewable && (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<PostPreviewButton\n\t\t\t\t\t\t\t\tclassName=\"editor-preview-dropdown__button-external\"\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\tforceIsAutosaveable={ forceIsAutosaveable }\n\t\t\t\t\t\t\t\taria-label={ __( 'Preview in new tab' ) }\n\t\t\t\t\t\t\t\ttextContent={\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Preview in new tab' ) }\n\t\t\t\t\t\t\t\t\t\t<Icon icon={ external } />\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\tonPreview={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t\t<ActionItem.Slot\n\t\t\t\t\t\tname=\"core/plugin-preview-menu\"\n\t\t\t\t\t\tfillProps={ { onClick: onClose } }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAQA,I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AAAH,QAAA,GACG,IAAAd,QAAE,EAAE,oBAAqB,CAAC,eAC5B,IAAA/C,WAAA,CAAAwD,GAAA,EAACnE,WAAA,CAAA6F,IAAI;cAAC3B,IAAI,EAAGgB;YAAU,CAAE,CAAC;UAAA,CACzB,CACF;UACDY,SAAS,EAAGrB;QAAS,CACrB;MAAC,CACQ,CACX,eACD,IAAA9D,WAAA,CAAAwD,GAAA,EAAC7D,UAAA,CAAAyF,UAAU,CAACC,IAAI;QACfC,IAAI,EAAC,0BAA0B;QAC/BC,SAAS,EAAG;UAAEf,OAAO,EAAEV;QAAQ;MAAG,CAClC,CAAC;IAAA,CACD;EACF,CACY,CAAC;AAEjB","ignoreList":[]}
|
|
@@ -203,7 +203,7 @@ const getEditorCommandLoader = () => function useEditorCommandLoader() {
|
|
|
203
203
|
});
|
|
204
204
|
commands.push({
|
|
205
205
|
name: 'core/open-settings-sidebar',
|
|
206
|
-
label: __('Show or hide the Settings panel
|
|
206
|
+
label: __('Show or hide the Settings panel'),
|
|
207
207
|
icon: isRTL() ? drawerLeft : drawerRight,
|
|
208
208
|
callback: ({
|
|
209
209
|
close
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","useDispatch","__","isRTL","sprintf","blockDefault","code","drawerLeft","drawerRight","edit","formatListBullets","listView","external","keyboard","symbol","page","layout","rotateRight","rotateLeft","useCommandLoader","store","preferencesStore","noticesStore","blockEditorStore","coreStore","useEntityRecord","interfaceStore","getPath","decodeEntities","unlock","editorStore","PATTERN_POST_TYPE","TEMPLATE_PART_POST_TYPE","TEMPLATE_POST_TYPE","modalName","patternRenameModalName","patternDuplicateModalName","isTemplateRevertable","getEditorCommandLoader","useEditorCommandLoader","editorMode","isListViewOpen","showBlockBreadcrumbs","isDistractionFree","isFocusMode","isPreviewMode","isViewable","isCodeEditingEnabled","isRichEditingEnabled","isPublishSidebarEnabled","select","_get","_getPostType$viewable","get","isListViewOpened","getCurrentPostType","getEditorSettings","getSettings","getPostType","viewable","codeEditingEnabled","richEditingEnabled","getActiveComplementaryArea","toggle","createInfoNotice","__unstableSaveForPreview","setIsListViewOpened","switchEditorMode","toggleDistractionFree","toggleSpotlightMode","toggleTopToolbar","openModal","enableComplementaryArea","disableComplementaryArea","getCurrentPostId","isBlockBasedTheme","canCreateTemplate","getCurrentTheme","is_block_theme","canUser","kind","name","allowSwitchEditorMode","commands","isLoading","push","label","icon","callback","close","id","type","activeSidebar","postId","link","window","open","isSiteEditor","location","href","includes","document","getEditedEntityContextualCommands","useEditedEntityContextualCommands","postType","getPageContentFocusCommands","usePageContentFocusCommands","onNavigateToEntityRecord","goBack","templateId","getRenderingMode","_getEditorSettings","getCurrentTemplateId","editorSettings","isTemplateHidden","onNavigateToPreviousEntityRecord","editedRecord","template","hasResolved","title","getManipulateDocumentCommands","useManipulateDocumentCommands","revertTemplate","useCommands","hook","context"],"sources":["@wordpress/editor/src/components/commands/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, isRTL, sprintf } from '@wordpress/i18n';\nimport {\n\tblockDefault,\n\tcode,\n\tdrawerLeft,\n\tdrawerRight,\n\tedit,\n\tformatListBullets,\n\tlistView,\n\texternal,\n\tkeyboard,\n\tsymbol,\n\tpage,\n\tlayout,\n\trotateRight,\n\trotateLeft,\n} from '@wordpress/icons';\nimport { useCommandLoader } from '@wordpress/commands';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore, useEntityRecord } from '@wordpress/core-data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { getPath } from '@wordpress/url';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\nimport {\n\tPATTERN_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n} from '../../store/constants';\nimport { modalName as patternRenameModalName } from '../pattern-rename-modal';\nimport { modalName as patternDuplicateModalName } from '../pattern-duplicate-modal';\nimport isTemplateRevertable from '../../store/utils/is-template-revertable';\n\nconst getEditorCommandLoader = () =>\n\tfunction useEditorCommandLoader() {\n\t\tconst {\n\t\t\teditorMode,\n\t\t\tisListViewOpen,\n\t\t\tshowBlockBreadcrumbs,\n\t\t\tisDistractionFree,\n\t\t\tisFocusMode,\n\t\t\tisPreviewMode,\n\t\t\tisViewable,\n\t\t\tisCodeEditingEnabled,\n\t\t\tisRichEditingEnabled,\n\t\t\tisPublishSidebarEnabled,\n\t\t} = useSelect( ( select ) => {\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\tconst { isListViewOpened, getCurrentPostType, getEditorSettings } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst { getSettings } = select( blockEditorStore );\n\t\t\tconst { getPostType } = select( coreStore );\n\n\t\t\treturn {\n\t\t\t\teditorMode: get( 'core', 'editorMode' ) ?? 'visual',\n\t\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\t\tshowBlockBreadcrumbs: get( 'core', 'showBlockBreadcrumbs' ),\n\t\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\t\tisFocusMode: get( 'core', 'focusMode' ),\n\t\t\t\tisPreviewMode: getSettings().isPreviewMode,\n\t\t\t\tisViewable:\n\t\t\t\t\tgetPostType( getCurrentPostType() )?.viewable ?? false,\n\t\t\t\tisCodeEditingEnabled: getEditorSettings().codeEditingEnabled,\n\t\t\t\tisRichEditingEnabled: getEditorSettings().richEditingEnabled,\n\t\t\t\tisPublishSidebarEnabled:\n\t\t\t\t\tselect( editorStore ).isPublishSidebarEnabled(),\n\t\t\t};\n\t\t}, [] );\n\t\tconst { getActiveComplementaryArea } = useSelect( interfaceStore );\n\t\tconst { toggle } = useDispatch( preferencesStore );\n\t\tconst { createInfoNotice } = useDispatch( noticesStore );\n\t\tconst {\n\t\t\t__unstableSaveForPreview,\n\t\t\tsetIsListViewOpened,\n\t\t\tswitchEditorMode,\n\t\t\ttoggleDistractionFree,\n\t\t\ttoggleSpotlightMode,\n\t\t\ttoggleTopToolbar,\n\t\t} = useDispatch( editorStore );\n\t\tconst { openModal, enableComplementaryArea, disableComplementaryArea } =\n\t\t\tuseDispatch( interfaceStore );\n\t\tconst { getCurrentPostId } = useSelect( editorStore );\n\t\tconst { isBlockBasedTheme, canCreateTemplate } = useSelect(\n\t\t\t( select ) => {\n\t\t\t\treturn {\n\t\t\t\t\tisBlockBasedTheme:\n\t\t\t\t\t\tselect( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t\t\t\tcanCreateTemplate: select( coreStore ).canUser( 'create', {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: 'wp_template',\n\t\t\t\t\t} ),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[]\n\t\t);\n\t\tconst allowSwitchEditorMode =\n\t\t\tisCodeEditingEnabled && isRichEditingEnabled;\n\n\t\tif ( isPreviewMode ) {\n\t\t\treturn { commands: [], isLoading: false };\n\t\t}\n\n\t\tconst commands = [];\n\n\t\tcommands.push( {\n\t\t\tname: 'core/open-shortcut-help',\n\t\t\tlabel: __( 'Keyboard shortcuts' ),\n\t\t\ticon: keyboard,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tclose();\n\t\t\t\topenModal( 'editor/keyboard-shortcut-help' );\n\t\t\t},\n\t\t} );\n\n\t\tcommands.push( {\n\t\t\tname: 'core/toggle-distraction-free',\n\t\t\tlabel: isDistractionFree\n\t\t\t\t? __( 'Exit Distraction free' )\n\t\t\t\t: __( 'Enter Distraction free' ),\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\ttoggleDistractionFree();\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\n\t\tcommands.push( {\n\t\t\tname: 'core/open-preferences',\n\t\t\tlabel: __( 'Editor preferences' ),\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tclose();\n\t\t\t\topenModal( 'editor/preferences' );\n\t\t\t},\n\t\t} );\n\n\t\tcommands.push( {\n\t\t\tname: 'core/toggle-spotlight-mode',\n\t\t\tlabel: isFocusMode\n\t\t\t\t? __( 'Exit Spotlight mode' )\n\t\t\t\t: __( 'Enter Spotlight mode' ),\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\ttoggleSpotlightMode();\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\n\t\tcommands.push( {\n\t\t\tname: 'core/toggle-list-view',\n\t\t\tlabel: isListViewOpen\n\t\t\t\t? __( 'Close List View' )\n\t\t\t\t: __( 'Open List View' ),\n\t\t\ticon: listView,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tsetIsListViewOpened( ! isListViewOpen );\n\t\t\t\tclose();\n\t\t\t\tcreateInfoNotice(\n\t\t\t\t\tisListViewOpen\n\t\t\t\t\t\t? __( 'List View off.' )\n\t\t\t\t\t\t: __( 'List View on.' ),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'core/editor/toggle-list-view/notice',\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t},\n\t\t} );\n\n\t\tcommands.push( {\n\t\t\tname: 'core/toggle-top-toolbar',\n\t\t\tlabel: __( 'Top toolbar' ),\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\ttoggleTopToolbar();\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\n\t\tif ( allowSwitchEditorMode ) {\n\t\t\tcommands.push( {\n\t\t\t\tname: 'core/toggle-code-editor',\n\t\t\t\tlabel:\n\t\t\t\t\teditorMode === 'visual'\n\t\t\t\t\t\t? __( 'Open code editor' )\n\t\t\t\t\t\t: __( 'Exit code editor' ),\n\t\t\t\ticon: code,\n\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\tswitchEditorMode(\n\t\t\t\t\t\teditorMode === 'visual' ? 'text' : 'visual'\n\t\t\t\t\t);\n\t\t\t\t\tclose();\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\tcommands.push( {\n\t\t\tname: 'core/toggle-breadcrumbs',\n\t\t\tlabel: showBlockBreadcrumbs\n\t\t\t\t? __( 'Hide block breadcrumbs' )\n\t\t\t\t: __( 'Show block breadcrumbs' ),\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\ttoggle( 'core', 'showBlockBreadcrumbs' );\n\t\t\t\tclose();\n\t\t\t\tcreateInfoNotice(\n\t\t\t\t\tshowBlockBreadcrumbs\n\t\t\t\t\t\t? __( 'Breadcrumbs hidden.' )\n\t\t\t\t\t\t: __( 'Breadcrumbs visible.' ),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'core/editor/toggle-breadcrumbs/notice',\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t},\n\t\t} );\n\n\t\tcommands.push( {\n\t\t\tname: 'core/open-settings-sidebar',\n\t\t\tlabel: __( 'Show or hide the Settings panel.' ),\n\t\t\ticon: isRTL() ? drawerLeft : drawerRight,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tconst activeSidebar = getActiveComplementaryArea( 'core' );\n\t\t\t\tclose();\n\t\t\t\tif ( activeSidebar === 'edit-post/document' ) {\n\t\t\t\t\tdisableComplementaryArea( 'core' );\n\t\t\t\t} else {\n\t\t\t\t\tenableComplementaryArea( 'core', 'edit-post/document' );\n\t\t\t\t}\n\t\t\t},\n\t\t} );\n\n\t\tcommands.push( {\n\t\t\tname: 'core/open-block-inspector',\n\t\t\tlabel: __( 'Show or hide the Block settings panel' ),\n\t\t\ticon: blockDefault,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tconst activeSidebar = getActiveComplementaryArea( 'core' );\n\t\t\t\tclose();\n\t\t\t\tif ( activeSidebar === 'edit-post/block' ) {\n\t\t\t\t\tdisableComplementaryArea( 'core' );\n\t\t\t\t} else {\n\t\t\t\t\tenableComplementaryArea( 'core', 'edit-post/block' );\n\t\t\t\t}\n\t\t\t},\n\t\t} );\n\n\t\tcommands.push( {\n\t\t\tname: 'core/toggle-publish-sidebar',\n\t\t\tlabel: isPublishSidebarEnabled\n\t\t\t\t? __( 'Disable pre-publish checks' )\n\t\t\t\t: __( 'Enable pre-publish checks' ),\n\t\t\ticon: formatListBullets,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tclose();\n\t\t\t\ttoggle( 'core', 'isPublishSidebarEnabled' );\n\t\t\t\tcreateInfoNotice(\n\t\t\t\t\tisPublishSidebarEnabled\n\t\t\t\t\t\t? __( 'Pre-publish checks disabled.' )\n\t\t\t\t\t\t: __( 'Pre-publish checks enabled.' ),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'core/editor/publish-sidebar/notice',\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t},\n\t\t} );\n\n\t\tif ( isViewable ) {\n\t\t\tcommands.push( {\n\t\t\t\tname: 'core/preview-link',\n\t\t\t\tlabel: __( 'Preview in a new tab' ),\n\t\t\t\ticon: external,\n\t\t\t\tcallback: async ( { close } ) => {\n\t\t\t\t\tclose();\n\t\t\t\t\tconst postId = getCurrentPostId();\n\t\t\t\t\tconst link = await __unstableSaveForPreview();\n\t\t\t\t\twindow.open( link, `wp-preview-${ postId }` );\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\t\tif ( canCreateTemplate && isBlockBasedTheme ) {\n\t\t\tconst isSiteEditor = getPath( window.location.href )?.includes(\n\t\t\t\t'site-editor.php'\n\t\t\t);\n\t\t\tif ( ! isSiteEditor ) {\n\t\t\t\tcommands.push( {\n\t\t\t\t\tname: 'core/go-to-site-editor',\n\t\t\t\t\tlabel: __( 'Open Site Editor' ),\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tclose();\n\t\t\t\t\t\tdocument.location = 'site-editor.php';\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tcommands,\n\t\t\tisLoading: false,\n\t\t};\n\t};\n\nconst getEditedEntityContextualCommands = () =>\n\tfunction useEditedEntityContextualCommands() {\n\t\tconst { postType } = useSelect( ( select ) => {\n\t\t\tconst { getCurrentPostType } = select( editorStore );\n\t\t\treturn {\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t};\n\t\t}, [] );\n\t\tconst { openModal } = useDispatch( interfaceStore );\n\t\tconst commands = [];\n\n\t\tif ( postType === PATTERN_POST_TYPE ) {\n\t\t\tcommands.push( {\n\t\t\t\tname: 'core/rename-pattern',\n\t\t\t\tlabel: __( 'Rename pattern' ),\n\t\t\t\ticon: edit,\n\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\topenModal( patternRenameModalName );\n\t\t\t\t\tclose();\n\t\t\t\t},\n\t\t\t} );\n\t\t\tcommands.push( {\n\t\t\t\tname: 'core/duplicate-pattern',\n\t\t\t\tlabel: __( 'Duplicate pattern' ),\n\t\t\t\ticon: symbol,\n\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\topenModal( patternDuplicateModalName );\n\t\t\t\t\tclose();\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\treturn { isLoading: false, commands };\n\t};\n\nconst getPageContentFocusCommands = () =>\n\tfunction usePageContentFocusCommands() {\n\t\tconst { onNavigateToEntityRecord, goBack, templateId, isPreviewMode } =\n\t\t\tuseSelect( ( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetRenderingMode,\n\t\t\t\t\tgetEditorSettings: _getEditorSettings,\n\t\t\t\t\tgetCurrentTemplateId,\n\t\t\t\t} = unlock( select( editorStore ) );\n\t\t\t\tconst editorSettings = _getEditorSettings();\n\t\t\t\treturn {\n\t\t\t\t\tisTemplateHidden: getRenderingMode() === 'post-only',\n\t\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\t\teditorSettings.onNavigateToEntityRecord,\n\t\t\t\t\tgetEditorSettings: _getEditorSettings,\n\t\t\t\t\tgoBack: editorSettings.onNavigateToPreviousEntityRecord,\n\t\t\t\t\ttemplateId: getCurrentTemplateId(),\n\t\t\t\t\tisPreviewMode: editorSettings.isPreviewMode,\n\t\t\t\t};\n\t\t\t}, [] );\n\t\tconst { editedRecord: template, hasResolved } = useEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template',\n\t\t\ttemplateId\n\t\t);\n\n\t\tif ( isPreviewMode ) {\n\t\t\treturn { isLoading: false, commands: [] };\n\t\t}\n\n\t\tconst commands = [];\n\n\t\tif ( templateId && hasResolved ) {\n\t\t\tcommands.push( {\n\t\t\t\tname: 'core/switch-to-template-focus',\n\t\t\t\tlabel: sprintf(\n\t\t\t\t\t/* translators: %s: template title */\n\t\t\t\t\t__( 'Edit template: %s' ),\n\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t),\n\t\t\t\ticon: layout,\n\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\tpostId: templateId,\n\t\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t\t} );\n\t\t\t\t\tclose();\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\tif ( !! goBack ) {\n\t\t\tcommands.push( {\n\t\t\t\tname: 'core/switch-to-previous-entity',\n\t\t\t\tlabel: __( 'Go back' ),\n\t\t\t\ticon: page,\n\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\tgoBack();\n\t\t\t\t\tclose();\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\treturn { isLoading: false, commands };\n\t};\n\nconst getManipulateDocumentCommands = () =>\n\tfunction useManipulateDocumentCommands() {\n\t\tconst { postType, postId } = useSelect( ( select ) => {\n\t\t\tconst { getCurrentPostId, getCurrentPostType } =\n\t\t\t\tselect( editorStore );\n\t\t\treturn {\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t\tpostId: getCurrentPostId(),\n\t\t\t};\n\t\t}, [] );\n\t\tconst { editedRecord: template, hasResolved } = useEntityRecord(\n\t\t\t'postType',\n\t\t\tpostType,\n\t\t\tpostId\n\t\t);\n\t\t// eslint-disable-next-line @wordpress/no-unused-vars-before-return\n\t\tconst { revertTemplate } = unlock( useDispatch( editorStore ) );\n\n\t\tif (\n\t\t\t! hasResolved ||\n\t\t\t! [ TEMPLATE_PART_POST_TYPE, TEMPLATE_POST_TYPE ].includes(\n\t\t\t\tpostType\n\t\t\t)\n\t\t) {\n\t\t\treturn { isLoading: true, commands: [] };\n\t\t}\n\n\t\tconst commands = [];\n\n\t\tif ( isTemplateRevertable( template ) ) {\n\t\t\tconst label =\n\t\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t/* translators: %s: template title */\n\t\t\t\t\t\t\t__( 'Reset template: %s' ),\n\t\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t\t )\n\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t/* translators: %s: template part title */\n\t\t\t\t\t\t\t__( 'Reset template part: %s' ),\n\t\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t\t );\n\t\t\tcommands.push( {\n\t\t\t\tname: 'core/reset-template',\n\t\t\t\tlabel,\n\t\t\t\ticon: isRTL() ? rotateRight : rotateLeft,\n\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\trevertTemplate( template );\n\t\t\t\t\tclose();\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\treturn {\n\t\t\tisLoading: ! hasResolved,\n\t\t\tcommands,\n\t\t};\n\t};\n\nexport default function useCommands() {\n\tuseCommandLoader( {\n\t\tname: 'core/editor/edit-ui',\n\t\thook: getEditorCommandLoader(),\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/editor/contextual-commands',\n\t\thook: getEditedEntityContextualCommands(),\n\t\tcontext: 'entity-edit',\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/editor/page-content-focus',\n\t\thook: getPageContentFocusCommands(),\n\t\tcontext: 'entity-edit',\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/manipulate-document',\n\t\thook: getManipulateDocumentCommands(),\n\t} );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,EAAEC,KAAK,EAAEC,OAAO,QAAQ,iBAAiB;AACpD,SACCC,YAAY,EACZC,IAAI,EACJC,UAAU,EACVC,WAAW,EACXC,IAAI,EACJC,iBAAiB,EACjBC,QAAQ,EACRC,QAAQ,EACRC,QAAQ,EACRC,MAAM,EACNC,IAAI,EACJC,MAAM,EACNC,WAAW,EACXC,UAAU,QACJ,kBAAkB;AACzB,SAASC,gBAAgB,QAAQ,qBAAqB;AACtD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;AAClE,SAASD,KAAK,IAAIE,YAAY,QAAQ,oBAAoB;AAC1D,SAASF,KAAK,IAAIG,gBAAgB,QAAQ,yBAAyB;AACnE,SAASH,KAAK,IAAII,SAAS,EAAEC,eAAe,QAAQ,sBAAsB;AAC1E,SAASL,KAAK,IAAIM,cAAc,QAAQ,sBAAsB;AAC9D,SAASC,OAAO,QAAQ,gBAAgB;AACxC,SAASC,cAAc,QAAQ,0BAA0B;;AAEzD;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAAST,KAAK,IAAIU,WAAW,QAAQ,aAAa;AAClD,SACCC,iBAAiB,EACjBC,uBAAuB,EACvBC,kBAAkB,QACZ,uBAAuB;AAC9B,SAASC,SAAS,IAAIC,sBAAsB,QAAQ,yBAAyB;AAC7E,SAASD,SAAS,IAAIE,yBAAyB,QAAQ,4BAA4B;AACnF,OAAOC,oBAAoB,MAAM,0CAA0C;AAE3E,MAAMC,sBAAsB,GAAGA,CAAA,KAC9B,SAASC,sBAAsBA,CAAA,EAAG;EACjC,MAAM;IACLC,UAAU;IACVC,cAAc;IACdC,oBAAoB;IACpBC,iBAAiB;IACjBC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drawerRight","edit","formatListBullets","listView","external","keyboard","symbol","page","layout","rotateRight","rotateLeft","useCommandLoader","store","preferencesStore","noticesStore","blockEditorStore","coreStore","useEntityRecord","interfaceStore","getPath","decodeEntities","unlock","editorStore","PATTERN_POST_TYPE","TEMPLATE_PART_POST_TYPE","TEMPLATE_POST_TYPE","modalName","patternRenameModalName","patternDuplicateModalName","isTemplateRevertable","getEditorCommandLoader","useEditorCommandLoader","editorMode","isListViewOpen","showBlockBreadcrumbs","isDistractionFree","isFocusMode","isPreviewMode","isViewable","isCodeEditingEnabled","isRichEditingEnabled","isPublishSidebarEnabled","select","_get","_getPostType$viewable","get","isListViewOpened","getCurrentPostType","getEditorSettings","getSettings","getPostType","viewable","codeEditingEnabled","richEditingEnabled","getActiveComplementaryArea","toggle","createInfoNotice","__unstableSaveForPreview","setIsListViewOpened","switchEditorMode","toggleDistractionFree","toggleSpotlightMode","toggleTopToolbar","openModal","enableComplementaryArea","disableComplementaryArea","getCurrentPostId","isBlockBasedTheme","canCreateTemplate","getCurrentTheme","is_block_theme","canUser","kind","name","allowSwitchEditorMode","commands","isLoading","push","label","icon","callback","close","id","type","activeSidebar","postId","link","window","open","isSiteEditor","location","href","includes","document","getEditedEntityContextualCommands","useEditedEntityContextualCommands","postType","getPageContentFocusCommands","usePageContentFocusCommands","onNavigateToEntityRecord","goBack","templateId","getRenderingMode","_getEditorSettings","getCurrentTemplateId","editorSettings","isTemplateHidden","onNavigateToPreviousEntityRecord","editedRecord","template","hasResolved","title","getManipulateDocumentCommands","useManipulateDocumentCommands","revertTemplate","useCommands","hook","context"],"sources":["@wordpress/editor/src/components/commands/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, isRTL, sprintf } from '@wordpress/i18n';\nimport {\n\tblockDefault,\n\tcode,\n\tdrawerLeft,\n\tdrawerRight,\n\tedit,\n\tformatListBullets,\n\tlistView,\n\texternal,\n\tkeyboard,\n\tsymbol,\n\tpage,\n\tlayout,\n\trotateRight,\n\trotateLeft,\n} from '@wordpress/icons';\nimport { useCommandLoader } from '@wordpress/commands';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore, useEntityRecord } from '@wordpress/core-data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { getPath } from '@wordpress/url';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\nimport {\n\tPATTERN_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n} from '../../store/constants';\nimport { modalName as patternRenameModalName } from '../pattern-rename-modal';\nimport { modalName as patternDuplicateModalName } from '../pattern-duplicate-modal';\nimport isTemplateRevertable from '../../store/utils/is-template-revertable';\n\nconst getEditorCommandLoader = () =>\n\tfunction useEditorCommandLoader() {\n\t\tconst {\n\t\t\teditorMode,\n\t\t\tisListViewOpen,\n\t\t\tshowBlockBreadcrumbs,\n\t\t\tisDistractionFree,\n\t\t\tisFocusMode,\n\t\t\tisPreviewMode,\n\t\t\tisViewable,\n\t\t\tisCodeEditingEnabled,\n\t\t\tisRichEditingEnabled,\n\t\t\tisPublishSidebarEnabled,\n\t\t} = useSelect( ( select ) => {\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\tconst { isListViewOpened, getCurrentPostType, getEditorSettings } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst { getSettings } = select( blockEditorStore );\n\t\t\tconst { getPostType } = select( coreStore );\n\n\t\t\treturn {\n\t\t\t\teditorMode: get( 'core', 'editorMode' ) ?? 'visual',\n\t\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\t\tshowBlockBreadcrumbs: get( 'core', 'showBlockBreadcrumbs' ),\n\t\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\t\tisFocusMode: get( 'core', 'focusMode' ),\n\t\t\t\tisPreviewMode: getSettings().isPreviewMode,\n\t\t\t\tisViewable:\n\t\t\t\t\tgetPostType( getCurrentPostType() )?.viewable ?? false,\n\t\t\t\tisCodeEditingEnabled: getEditorSettings().codeEditingEnabled,\n\t\t\t\tisRichEditingEnabled: getEditorSettings().richEditingEnabled,\n\t\t\t\tisPublishSidebarEnabled:\n\t\t\t\t\tselect( editorStore ).isPublishSidebarEnabled(),\n\t\t\t};\n\t\t}, [] );\n\t\tconst { getActiveComplementaryArea } = useSelect( interfaceStore );\n\t\tconst { toggle } = useDispatch( preferencesStore );\n\t\tconst { createInfoNotice } = useDispatch( noticesStore );\n\t\tconst {\n\t\t\t__unstableSaveForPreview,\n\t\t\tsetIsListViewOpened,\n\t\t\tswitchEditorMode,\n\t\t\ttoggleDistractionFree,\n\t\t\ttoggleSpotlightMode,\n\t\t\ttoggleTopToolbar,\n\t\t} = useDispatch( editorStore );\n\t\tconst { openModal, enableComplementaryArea, disableComplementaryArea } =\n\t\t\tuseDispatch( interfaceStore );\n\t\tconst { getCurrentPostId } = useSelect( editorStore );\n\t\tconst { isBlockBasedTheme, canCreateTemplate } = useSelect(\n\t\t\t( select ) => {\n\t\t\t\treturn {\n\t\t\t\t\tisBlockBasedTheme:\n\t\t\t\t\t\tselect( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t\t\t\tcanCreateTemplate: select( coreStore ).canUser( 'create', {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: 'wp_template',\n\t\t\t\t\t} ),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[]\n\t\t);\n\t\tconst allowSwitchEditorMode =\n\t\t\tisCodeEditingEnabled && isRichEditingEnabled;\n\n\t\tif ( isPreviewMode ) {\n\t\t\treturn { commands: [], isLoading: false };\n\t\t}\n\n\t\tconst commands = [];\n\n\t\tcommands.push( {\n\t\t\tname: 'core/open-shortcut-help',\n\t\t\tlabel: __( 'Keyboard shortcuts' ),\n\t\t\ticon: keyboard,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tclose();\n\t\t\t\topenModal( 'editor/keyboard-shortcut-help' );\n\t\t\t},\n\t\t} );\n\n\t\tcommands.push( {\n\t\t\tname: 'core/toggle-distraction-free',\n\t\t\tlabel: isDistractionFree\n\t\t\t\t? __( 'Exit Distraction free' )\n\t\t\t\t: __( 'Enter Distraction free' ),\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\ttoggleDistractionFree();\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\n\t\tcommands.push( {\n\t\t\tname: 'core/open-preferences',\n\t\t\tlabel: __( 'Editor preferences' ),\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tclose();\n\t\t\t\topenModal( 'editor/preferences' );\n\t\t\t},\n\t\t} );\n\n\t\tcommands.push( {\n\t\t\tname: 'core/toggle-spotlight-mode',\n\t\t\tlabel: isFocusMode\n\t\t\t\t? __( 'Exit Spotlight mode' )\n\t\t\t\t: __( 'Enter Spotlight mode' ),\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\ttoggleSpotlightMode();\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\n\t\tcommands.push( {\n\t\t\tname: 'core/toggle-list-view',\n\t\t\tlabel: isListViewOpen\n\t\t\t\t? __( 'Close List View' )\n\t\t\t\t: __( 'Open List View' ),\n\t\t\ticon: listView,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tsetIsListViewOpened( ! isListViewOpen );\n\t\t\t\tclose();\n\t\t\t\tcreateInfoNotice(\n\t\t\t\t\tisListViewOpen\n\t\t\t\t\t\t? __( 'List View off.' )\n\t\t\t\t\t\t: __( 'List View on.' ),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'core/editor/toggle-list-view/notice',\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t},\n\t\t} );\n\n\t\tcommands.push( {\n\t\t\tname: 'core/toggle-top-toolbar',\n\t\t\tlabel: __( 'Top toolbar' ),\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\ttoggleTopToolbar();\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\n\t\tif ( allowSwitchEditorMode ) {\n\t\t\tcommands.push( {\n\t\t\t\tname: 'core/toggle-code-editor',\n\t\t\t\tlabel:\n\t\t\t\t\teditorMode === 'visual'\n\t\t\t\t\t\t? __( 'Open code editor' )\n\t\t\t\t\t\t: __( 'Exit code editor' ),\n\t\t\t\ticon: code,\n\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\tswitchEditorMode(\n\t\t\t\t\t\teditorMode === 'visual' ? 'text' : 'visual'\n\t\t\t\t\t);\n\t\t\t\t\tclose();\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\tcommands.push( {\n\t\t\tname: 'core/toggle-breadcrumbs',\n\t\t\tlabel: showBlockBreadcrumbs\n\t\t\t\t? __( 'Hide block breadcrumbs' )\n\t\t\t\t: __( 'Show block breadcrumbs' ),\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\ttoggle( 'core', 'showBlockBreadcrumbs' );\n\t\t\t\tclose();\n\t\t\t\tcreateInfoNotice(\n\t\t\t\t\tshowBlockBreadcrumbs\n\t\t\t\t\t\t? __( 'Breadcrumbs hidden.' )\n\t\t\t\t\t\t: __( 'Breadcrumbs visible.' ),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'core/editor/toggle-breadcrumbs/notice',\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t},\n\t\t} );\n\n\t\tcommands.push( {\n\t\t\tname: 'core/open-settings-sidebar',\n\t\t\tlabel: __( 'Show or hide the Settings panel' ),\n\t\t\ticon: isRTL() ? drawerLeft : drawerRight,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tconst activeSidebar = getActiveComplementaryArea( 'core' );\n\t\t\t\tclose();\n\t\t\t\tif ( activeSidebar === 'edit-post/document' ) {\n\t\t\t\t\tdisableComplementaryArea( 'core' );\n\t\t\t\t} else {\n\t\t\t\t\tenableComplementaryArea( 'core', 'edit-post/document' );\n\t\t\t\t}\n\t\t\t},\n\t\t} );\n\n\t\tcommands.push( {\n\t\t\tname: 'core/open-block-inspector',\n\t\t\tlabel: __( 'Show or hide the Block settings panel' ),\n\t\t\ticon: blockDefault,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tconst activeSidebar = getActiveComplementaryArea( 'core' );\n\t\t\t\tclose();\n\t\t\t\tif ( activeSidebar === 'edit-post/block' ) {\n\t\t\t\t\tdisableComplementaryArea( 'core' );\n\t\t\t\t} else {\n\t\t\t\t\tenableComplementaryArea( 'core', 'edit-post/block' );\n\t\t\t\t}\n\t\t\t},\n\t\t} );\n\n\t\tcommands.push( {\n\t\t\tname: 'core/toggle-publish-sidebar',\n\t\t\tlabel: isPublishSidebarEnabled\n\t\t\t\t? __( 'Disable pre-publish checks' )\n\t\t\t\t: __( 'Enable pre-publish checks' ),\n\t\t\ticon: formatListBullets,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tclose();\n\t\t\t\ttoggle( 'core', 'isPublishSidebarEnabled' );\n\t\t\t\tcreateInfoNotice(\n\t\t\t\t\tisPublishSidebarEnabled\n\t\t\t\t\t\t? __( 'Pre-publish checks disabled.' )\n\t\t\t\t\t\t: __( 'Pre-publish checks enabled.' ),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'core/editor/publish-sidebar/notice',\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t},\n\t\t} );\n\n\t\tif ( isViewable ) {\n\t\t\tcommands.push( {\n\t\t\t\tname: 'core/preview-link',\n\t\t\t\tlabel: __( 'Preview in a new tab' ),\n\t\t\t\ticon: external,\n\t\t\t\tcallback: async ( { close } ) => {\n\t\t\t\t\tclose();\n\t\t\t\t\tconst postId = getCurrentPostId();\n\t\t\t\t\tconst link = await __unstableSaveForPreview();\n\t\t\t\t\twindow.open( link, `wp-preview-${ postId }` );\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\t\tif ( canCreateTemplate && isBlockBasedTheme ) {\n\t\t\tconst isSiteEditor = getPath( window.location.href )?.includes(\n\t\t\t\t'site-editor.php'\n\t\t\t);\n\t\t\tif ( ! isSiteEditor ) {\n\t\t\t\tcommands.push( {\n\t\t\t\t\tname: 'core/go-to-site-editor',\n\t\t\t\t\tlabel: __( 'Open Site Editor' ),\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\tclose();\n\t\t\t\t\t\tdocument.location = 'site-editor.php';\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tcommands,\n\t\t\tisLoading: false,\n\t\t};\n\t};\n\nconst getEditedEntityContextualCommands = () =>\n\tfunction useEditedEntityContextualCommands() {\n\t\tconst { postType } = useSelect( ( select ) => {\n\t\t\tconst { getCurrentPostType } = select( editorStore );\n\t\t\treturn {\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t};\n\t\t}, [] );\n\t\tconst { openModal } = useDispatch( interfaceStore );\n\t\tconst commands = [];\n\n\t\tif ( postType === PATTERN_POST_TYPE ) {\n\t\t\tcommands.push( {\n\t\t\t\tname: 'core/rename-pattern',\n\t\t\t\tlabel: __( 'Rename pattern' ),\n\t\t\t\ticon: edit,\n\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\topenModal( patternRenameModalName );\n\t\t\t\t\tclose();\n\t\t\t\t},\n\t\t\t} );\n\t\t\tcommands.push( {\n\t\t\t\tname: 'core/duplicate-pattern',\n\t\t\t\tlabel: __( 'Duplicate pattern' ),\n\t\t\t\ticon: symbol,\n\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\topenModal( patternDuplicateModalName );\n\t\t\t\t\tclose();\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\treturn { isLoading: false, commands };\n\t};\n\nconst getPageContentFocusCommands = () =>\n\tfunction usePageContentFocusCommands() {\n\t\tconst { onNavigateToEntityRecord, goBack, templateId, isPreviewMode } =\n\t\t\tuseSelect( ( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetRenderingMode,\n\t\t\t\t\tgetEditorSettings: _getEditorSettings,\n\t\t\t\t\tgetCurrentTemplateId,\n\t\t\t\t} = unlock( select( editorStore ) );\n\t\t\t\tconst editorSettings = _getEditorSettings();\n\t\t\t\treturn {\n\t\t\t\t\tisTemplateHidden: getRenderingMode() === 'post-only',\n\t\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\t\teditorSettings.onNavigateToEntityRecord,\n\t\t\t\t\tgetEditorSettings: _getEditorSettings,\n\t\t\t\t\tgoBack: editorSettings.onNavigateToPreviousEntityRecord,\n\t\t\t\t\ttemplateId: getCurrentTemplateId(),\n\t\t\t\t\tisPreviewMode: editorSettings.isPreviewMode,\n\t\t\t\t};\n\t\t\t}, [] );\n\t\tconst { editedRecord: template, hasResolved } = useEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template',\n\t\t\ttemplateId\n\t\t);\n\n\t\tif ( isPreviewMode ) {\n\t\t\treturn { isLoading: false, commands: [] };\n\t\t}\n\n\t\tconst commands = [];\n\n\t\tif ( templateId && hasResolved ) {\n\t\t\tcommands.push( {\n\t\t\t\tname: 'core/switch-to-template-focus',\n\t\t\t\tlabel: sprintf(\n\t\t\t\t\t/* translators: %s: template title */\n\t\t\t\t\t__( 'Edit template: %s' ),\n\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t),\n\t\t\t\ticon: layout,\n\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\tpostId: templateId,\n\t\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t\t} );\n\t\t\t\t\tclose();\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\tif ( !! goBack ) {\n\t\t\tcommands.push( {\n\t\t\t\tname: 'core/switch-to-previous-entity',\n\t\t\t\tlabel: __( 'Go back' ),\n\t\t\t\ticon: page,\n\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\tgoBack();\n\t\t\t\t\tclose();\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\treturn { isLoading: false, commands };\n\t};\n\nconst getManipulateDocumentCommands = () =>\n\tfunction useManipulateDocumentCommands() {\n\t\tconst { postType, postId } = useSelect( ( select ) => {\n\t\t\tconst { getCurrentPostId, getCurrentPostType } =\n\t\t\t\tselect( editorStore );\n\t\t\treturn {\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t\tpostId: getCurrentPostId(),\n\t\t\t};\n\t\t}, [] );\n\t\tconst { editedRecord: template, hasResolved } = useEntityRecord(\n\t\t\t'postType',\n\t\t\tpostType,\n\t\t\tpostId\n\t\t);\n\t\t// eslint-disable-next-line @wordpress/no-unused-vars-before-return\n\t\tconst { revertTemplate } = unlock( useDispatch( editorStore ) );\n\n\t\tif (\n\t\t\t! hasResolved ||\n\t\t\t! [ TEMPLATE_PART_POST_TYPE, TEMPLATE_POST_TYPE ].includes(\n\t\t\t\tpostType\n\t\t\t)\n\t\t) {\n\t\t\treturn { isLoading: true, commands: [] };\n\t\t}\n\n\t\tconst commands = [];\n\n\t\tif ( isTemplateRevertable( template ) ) {\n\t\t\tconst label =\n\t\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t/* translators: %s: template title */\n\t\t\t\t\t\t\t__( 'Reset template: %s' ),\n\t\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t\t )\n\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t/* translators: %s: template part title */\n\t\t\t\t\t\t\t__( 'Reset template part: %s' ),\n\t\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t\t );\n\t\t\tcommands.push( {\n\t\t\t\tname: 'core/reset-template',\n\t\t\t\tlabel,\n\t\t\t\ticon: isRTL() ? rotateRight : rotateLeft,\n\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\trevertTemplate( template );\n\t\t\t\t\tclose();\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\treturn {\n\t\t\tisLoading: ! hasResolved,\n\t\t\tcommands,\n\t\t};\n\t};\n\nexport default function useCommands() {\n\tuseCommandLoader( {\n\t\tname: 'core/editor/edit-ui',\n\t\thook: getEditorCommandLoader(),\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/editor/contextual-commands',\n\t\thook: getEditedEntityContextualCommands(),\n\t\tcontext: 'entity-edit',\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/editor/page-content-focus',\n\t\thook: getPageContentFocusCommands(),\n\t\tcontext: 'entity-edit',\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/manipulate-document',\n\t\thook: getManipulateDocumentCommands(),\n\t} );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,EAAEC,KAAK,EAAEC,OAAO,QAAQ,iBAAiB;AACpD,SACCC,YAAY,EACZC,IAAI,EACJC,UAAU,EACVC,WAAW,EACXC,IAAI,EACJC,iBAAiB,EACjBC,QAAQ,EACRC,QAAQ,EACRC,QAAQ,EACRC,MAAM,EACNC,IAAI,EACJC,MAAM,EACNC,WAAW,EACXC,UAAU,QACJ,kBAAkB;AACzB,SAASC,gBAAgB,QAAQ,qBAAqB;AACtD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;AAClE,SAASD,KAAK,IAAIE,YAAY,QAAQ,oBAAoB;AAC1D,SAASF,KAAK,IAAIG,gBAAgB,QAAQ,yBAAyB;AACnE,SAASH,KAAK,IAAII,SAAS,EAAEC,eAAe,QAAQ,sBAAsB;AAC1E,SAASL,KAAK,IAAIM,cAAc,QAAQ,sBAAsB;AAC9D,SAASC,OAAO,QAAQ,gBAAgB;AACxC,SAASC,cAAc,QAAQ,0BAA0B;;AA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;IACjB8D,IAAI,EAAE,iCAAiC;IACvC2C,IAAI,EAAEtB,iCAAiC,CAAC,CAAC;IACzCuB,OAAO,EAAE;EACV,CAAE,CAAC;EAEH1G,gBAAgB,CAAE;IACjB8D,IAAI,EAAE,gCAAgC;IACtC2C,IAAI,EAAEnB,2BAA2B,CAAC,CAAC;IACnCoB,OAAO,EAAE;EACV,CAAE,CAAC;EAEH1G,gBAAgB,CAAE;IACjB8D,IAAI,EAAE,oCAAoC;IAC1C2C,IAAI,EAAEJ,6BAA6B,CAAC;EACrC,CAAE,CAAC;AACJ","ignoreList":[]}
|
|
@@ -20,7 +20,7 @@ const {
|
|
|
20
20
|
* When no title is provided it is always opened.
|
|
21
21
|
* @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/)
|
|
22
22
|
* icon slug string, or an SVG WP element, to be rendered when
|
|
23
|
-
* the sidebar is pinned to toolbar.
|
|
23
|
+
* the sidebar is pinned to toolbar. If `false` is passed, no icon will be rendered.
|
|
24
24
|
* @param {React.ReactNode} props.children Children to be rendered
|
|
25
25
|
*
|
|
26
26
|
* @example
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createSlotFill","PanelBody","usePluginContext","jsx","_jsx","Fill","Slot","PluginPrePublishPanel","children","className","title","initialOpen","icon","pluginIcon"],"sources":["@wordpress/editor/src/components/plugin-pre-publish-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill, PanelBody } from '@wordpress/components';\nimport { usePluginContext } from '@wordpress/plugins';\n\nconst { Fill, Slot } = createSlotFill( 'PluginPrePublishPanel' );\n\n/**\n * Renders provided content to the pre-publish side panel in the publish flow\n * (side panel that opens when a user first pushes \"Publish\" from the main editor).\n *\n * @param {Object} props Component props.\n * @param {string} [props.className] An optional class name added to the panel.\n * @param {string} [props.title] Title displayed at the top of the panel.\n * @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened.\n * When no title is provided it is always opened.\n * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/)\n * icon slug string, or an SVG WP element, to be rendered when\n * the sidebar is pinned to toolbar.\n * @param {React.ReactNode} props.children Children to be rendered\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { __ } from '@wordpress/i18n';\n * import { PluginPrePublishPanel } from '@wordpress/editor';\n *\n * const MyPluginPrePublishPanel = () => (\n * \t<PluginPrePublishPanel\n * \t\tclassName=\"my-plugin-pre-publish-panel\"\n * \t\ttitle={ __( 'My panel title' ) }\n * \t\tinitialOpen={ true }\n * \t>\n * \t { __( 'My panel content' ) }\n * \t</PluginPrePublishPanel>\n * );\n * ```\n *\n * @return {React.ReactNode} The rendered component.\n */\nconst PluginPrePublishPanel = ( {\n\tchildren,\n\tclassName,\n\ttitle,\n\tinitialOpen = false,\n\ticon,\n} ) => {\n\tconst { icon: pluginIcon } = usePluginContext();\n\n\treturn (\n\t\t<Fill>\n\t\t\t<PanelBody\n\t\t\t\tclassName={ className }\n\t\t\t\tinitialOpen={ initialOpen || ! title }\n\t\t\t\ttitle={ title }\n\t\t\t\ticon={ icon ?? pluginIcon }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</PanelBody>\n\t\t</Fill>\n\t);\n};\n\nPluginPrePublishPanel.Slot = Slot;\n\nexport default PluginPrePublishPanel;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,cAAc,EAAEC,SAAS,QAAQ,uBAAuB;AACjE,SAASC,gBAAgB,QAAQ,oBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEtD,MAAM;EAAEC,IAAI;EAAEC;AAAK,CAAC,GAAGN,cAAc,CAAE,uBAAwB,CAAC;;AAEhE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMO,qBAAqB,GAAGA,CAAE;EAC/BC,QAAQ;EACRC,SAAS;EACTC,KAAK;EACLC,WAAW,GAAG,KAAK;EACnBC;AACD,CAAC,KAAM;EACN,MAAM;IAAEA,IAAI,EAAEC;EAAW,CAAC,GAAGX,gBAAgB,CAAC,CAAC;EAE/C,oBACCE,IAAA,CAACC,IAAI;IAAAG,QAAA,eACJJ,IAAA,CAACH,SAAS;MACTQ,SAAS,EAAGA,SAAW;MACvBE,WAAW,EAAGA,WAAW,IAAI,CAAED,KAAO;MACtCA,KAAK,EAAGA,KAAO;MACfE,IAAI,EAAGA,IAAI,aAAJA,IAAI,cAAJA,IAAI,GAAIC,UAAY;MAAAL,QAAA,EAEzBA;IAAQ,CACA;EAAC,CACP,CAAC;AAET,CAAC;AAEDD,qBAAqB,CAACD,IAAI,GAAGA,IAAI;AAEjC,eAAeC,qBAAqB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["createSlotFill","PanelBody","usePluginContext","jsx","_jsx","Fill","Slot","PluginPrePublishPanel","children","className","title","initialOpen","icon","pluginIcon"],"sources":["@wordpress/editor/src/components/plugin-pre-publish-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill, PanelBody } from '@wordpress/components';\nimport { usePluginContext } from '@wordpress/plugins';\n\nconst { Fill, Slot } = createSlotFill( 'PluginPrePublishPanel' );\n\n/**\n * Renders provided content to the pre-publish side panel in the publish flow\n * (side panel that opens when a user first pushes \"Publish\" from the main editor).\n *\n * @param {Object} props Component props.\n * @param {string} [props.className] An optional class name added to the panel.\n * @param {string} [props.title] Title displayed at the top of the panel.\n * @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened.\n * When no title is provided it is always opened.\n * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/)\n * icon slug string, or an SVG WP element, to be rendered when\n * the sidebar is pinned to toolbar. If `false` is passed, no icon will be rendered.\n * @param {React.ReactNode} props.children Children to be rendered\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { __ } from '@wordpress/i18n';\n * import { PluginPrePublishPanel } from '@wordpress/editor';\n *\n * const MyPluginPrePublishPanel = () => (\n * \t<PluginPrePublishPanel\n * \t\tclassName=\"my-plugin-pre-publish-panel\"\n * \t\ttitle={ __( 'My panel title' ) }\n * \t\tinitialOpen={ true }\n * \t>\n * \t { __( 'My panel content' ) }\n * \t</PluginPrePublishPanel>\n * );\n * ```\n *\n * @return {React.ReactNode} The rendered component.\n */\nconst PluginPrePublishPanel = ( {\n\tchildren,\n\tclassName,\n\ttitle,\n\tinitialOpen = false,\n\ticon,\n} ) => {\n\tconst { icon: pluginIcon } = usePluginContext();\n\n\treturn (\n\t\t<Fill>\n\t\t\t<PanelBody\n\t\t\t\tclassName={ className }\n\t\t\t\tinitialOpen={ initialOpen || ! title }\n\t\t\t\ttitle={ title }\n\t\t\t\ticon={ icon ?? pluginIcon }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</PanelBody>\n\t\t</Fill>\n\t);\n};\n\nPluginPrePublishPanel.Slot = Slot;\n\nexport default PluginPrePublishPanel;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,cAAc,EAAEC,SAAS,QAAQ,uBAAuB;AACjE,SAASC,gBAAgB,QAAQ,oBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEtD,MAAM;EAAEC,IAAI;EAAEC;AAAK,CAAC,GAAGN,cAAc,CAAE,uBAAwB,CAAC;;AAEhE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMO,qBAAqB,GAAGA,CAAE;EAC/BC,QAAQ;EACRC,SAAS;EACTC,KAAK;EACLC,WAAW,GAAG,KAAK;EACnBC;AACD,CAAC,KAAM;EACN,MAAM;IAAEA,IAAI,EAAEC;EAAW,CAAC,GAAGX,gBAAgB,CAAC,CAAC;EAE/C,oBACCE,IAAA,CAACC,IAAI;IAAAG,QAAA,eACJJ,IAAA,CAACH,SAAS;MACTQ,SAAS,EAAGA,SAAW;MACvBE,WAAW,EAAGA,WAAW,IAAI,CAAED,KAAO;MACtCA,KAAK,EAAGA,KAAO;MACfE,IAAI,EAAGA,IAAI,aAAJA,IAAI,cAAJA,IAAI,GAAIC,UAAY;MAAAL,QAAA,EAEzBA;IAAQ,CACA;EAAC,CACP,CAAC;AAET,CAAC;AAEDD,qBAAqB,CAACD,IAAI,GAAGA,IAAI;AAEjC,eAAeC,qBAAqB","ignoreList":[]}
|
|
@@ -33,19 +33,21 @@ export function usePostActions({
|
|
|
33
33
|
hasFrontPageTemplate
|
|
34
34
|
} = useSelect(select => {
|
|
35
35
|
const {
|
|
36
|
-
getEntityRecords
|
|
36
|
+
getEntityRecords,
|
|
37
|
+
canUser
|
|
37
38
|
} = select(coreStore);
|
|
38
|
-
const
|
|
39
|
-
|
|
39
|
+
const canUpdateSettings = canUser('update', {
|
|
40
|
+
kind: 'root',
|
|
41
|
+
name: 'site'
|
|
40
42
|
});
|
|
43
|
+
const templates = 'page' === postType && canUpdateSettings ? getEntityRecords('postType', 'wp_template', {
|
|
44
|
+
per_page: -1
|
|
45
|
+
}) : [];
|
|
41
46
|
return {
|
|
42
|
-
canManageOptions:
|
|
43
|
-
kind: 'root',
|
|
44
|
-
name: 'site'
|
|
45
|
-
}),
|
|
47
|
+
canManageOptions: canUpdateSettings,
|
|
46
48
|
hasFrontPageTemplate: !!templates?.find(template => template?.slug === 'front-page')
|
|
47
49
|
};
|
|
48
|
-
});
|
|
50
|
+
}, [postType]);
|
|
49
51
|
const setAsHomepageAction = useSetAsHomepageAction();
|
|
50
52
|
const setAsPostsPageAction = useSetAsPostsPageAction();
|
|
51
53
|
const shouldShowHomepageActions = canManageOptions && !hasFrontPageTemplate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useDispatch","useSelect","useMemo","useEffect","store","coreStore","editorStore","unlock","useSetAsHomepageAction","useSetAsPostsPageAction","jsx","_jsx","usePostActions","postType","onActionPerformed","context","defaultActions","select","getEntityActions","canManageOptions","hasFrontPageTemplate","getEntityRecords","
|
|
1
|
+
{"version":3,"names":["useDispatch","useSelect","useMemo","useEffect","store","coreStore","editorStore","unlock","useSetAsHomepageAction","useSetAsPostsPageAction","jsx","_jsx","usePostActions","postType","onActionPerformed","context","defaultActions","select","getEntityActions","canManageOptions","hasFrontPageTemplate","getEntityRecords","canUser","canUpdateSettings","kind","name","templates","per_page","find","template","slug","setAsHomepageAction","setAsPostsPageAction","shouldShowHomepageActions","registerPostTypeSchema","actions","push","sort","a","b","id","filter","action","i","length","callback","existingCallback","items","argsObject","_items","RenderModal","ExistingRenderModal","props"],"sources":["@wordpress/editor/src/components/post-actions/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useMemo, useEffect } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { useSetAsHomepageAction } from './set-as-homepage';\nimport { useSetAsPostsPageAction } from './set-as-posts-page';\n\nexport function usePostActions( { postType, onActionPerformed, context } ) {\n\tconst { defaultActions } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityActions } = unlock( select( editorStore ) );\n\t\t\treturn {\n\t\t\t\tdefaultActions: getEntityActions( 'postType', postType ),\n\t\t\t};\n\t\t},\n\t\t[ postType ]\n\t);\n\n\tconst { canManageOptions, hasFrontPageTemplate } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, canUser } = select( coreStore );\n\t\t\tconst canUpdateSettings = canUser( 'update', {\n\t\t\t\tkind: 'root',\n\t\t\t\tname: 'site',\n\t\t\t} );\n\t\t\tconst templates =\n\t\t\t\t'page' === postType && canUpdateSettings\n\t\t\t\t\t? getEntityRecords( 'postType', 'wp_template', {\n\t\t\t\t\t\t\tper_page: -1,\n\t\t\t\t\t } )\n\t\t\t\t\t: [];\n\n\t\t\treturn {\n\t\t\t\tcanManageOptions: canUpdateSettings,\n\t\t\t\thasFrontPageTemplate: !! templates?.find(\n\t\t\t\t\t( template ) => template?.slug === 'front-page'\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ postType ]\n\t);\n\n\tconst setAsHomepageAction = useSetAsHomepageAction();\n\tconst setAsPostsPageAction = useSetAsPostsPageAction();\n\tconst shouldShowHomepageActions =\n\t\tcanManageOptions && ! hasFrontPageTemplate;\n\n\tconst { registerPostTypeSchema } = unlock( useDispatch( editorStore ) );\n\tuseEffect( () => {\n\t\tregisterPostTypeSchema( postType );\n\t}, [ registerPostTypeSchema, postType ] );\n\n\treturn useMemo( () => {\n\t\tlet actions = [ ...defaultActions ];\n\t\tif ( shouldShowHomepageActions ) {\n\t\t\tactions.push( setAsHomepageAction, setAsPostsPageAction );\n\t\t}\n\n\t\t// Ensure \"Move to trash\" is always the last action.\n\t\tactions = actions.sort( ( a, b ) =>\n\t\t\tb.id === 'move-to-trash' ? -1 : 0\n\t\t);\n\n\t\t// Filter actions based on provided context. If not provided\n\t\t// all actions are returned. We'll have a single entry for getting the actions\n\t\t// and the consumer should provide the context to filter the actions, if needed.\n\t\t// Actions should also provide the `context` they support, if it's specific, to\n\t\t// compare with the provided context to get all the actions.\n\t\t// Right now the only supported context is `list`.\n\t\tactions = actions.filter( ( action ) => {\n\t\t\tif ( ! action.context ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn action.context === context;\n\t\t} );\n\n\t\tif ( onActionPerformed ) {\n\t\t\tfor ( let i = 0; i < actions.length; ++i ) {\n\t\t\t\tif ( actions[ i ].callback ) {\n\t\t\t\t\tconst existingCallback = actions[ i ].callback;\n\t\t\t\t\tactions[ i ] = {\n\t\t\t\t\t\t...actions[ i ],\n\t\t\t\t\t\tcallback: ( items, argsObject ) => {\n\t\t\t\t\t\t\texistingCallback( items, {\n\t\t\t\t\t\t\t\t...argsObject,\n\t\t\t\t\t\t\t\tonActionPerformed: ( _items ) => {\n\t\t\t\t\t\t\t\t\tif ( argsObject?.onActionPerformed ) {\n\t\t\t\t\t\t\t\t\t\targsObject.onActionPerformed( _items );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonActionPerformed(\n\t\t\t\t\t\t\t\t\t\tactions[ i ].id,\n\t\t\t\t\t\t\t\t\t\t_items\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}\n\t\t\t\tif ( actions[ i ].RenderModal ) {\n\t\t\t\t\tconst ExistingRenderModal = actions[ i ].RenderModal;\n\t\t\t\t\tactions[ i ] = {\n\t\t\t\t\t\t...actions[ i ],\n\t\t\t\t\t\tRenderModal: ( props ) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<ExistingRenderModal\n\t\t\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t\t\t\tonActionPerformed={ ( _items ) => {\n\t\t\t\t\t\t\t\t\t\tif ( props.onActionPerformed ) {\n\t\t\t\t\t\t\t\t\t\t\tprops.onActionPerformed( _items );\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonActionPerformed(\n\t\t\t\t\t\t\t\t\t\t\tactions[ i ].id,\n\t\t\t\t\t\t\t\t\t\t\t_items\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}\n\t\t\t}\n\t\t}\n\n\t\treturn actions;\n\t}, [\n\t\tcontext,\n\t\tdefaultActions,\n\t\tonActionPerformed,\n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EACPC,cAAc,EACdF,iBAAiB,EACjBiB,mBAAmB,EACnBC,oBAAoB,EACpBC,yBAAyB,CACxB,CAAC;AACJ","ignoreList":[]}
|
|
@@ -14,7 +14,10 @@ import HierarchicalTermSelector from '../post-taxonomies/hierarchical-term-selec
|
|
|
14
14
|
import { store as editorStore } from '../../store';
|
|
15
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
16
|
function MaybeCategoryPanel() {
|
|
17
|
-
const
|
|
17
|
+
const {
|
|
18
|
+
hasNoCategory,
|
|
19
|
+
hasSiteCategories
|
|
20
|
+
} = useSelect(select => {
|
|
18
21
|
const postType = select(editorStore).getCurrentPostType();
|
|
19
22
|
const {
|
|
20
23
|
canUser,
|
|
@@ -28,11 +31,19 @@ function MaybeCategoryPanel() {
|
|
|
28
31
|
const defaultCategory = defaultCategoryId ? getEntityRecord('taxonomy', 'category', defaultCategoryId) : undefined;
|
|
29
32
|
const postTypeSupportsCategories = categoriesTaxonomy && categoriesTaxonomy.types.some(type => type === postType);
|
|
30
33
|
const categories = categoriesTaxonomy && select(editorStore).getEditedPostAttribute(categoriesTaxonomy.rest_base);
|
|
34
|
+
const siteCategories = postTypeSupportsCategories ? !!select(coreStore).getEntityRecords('taxonomy', 'category', {
|
|
35
|
+
exclude: [defaultCategoryId],
|
|
36
|
+
per_page: 1
|
|
37
|
+
})?.length : false;
|
|
31
38
|
|
|
32
39
|
// This boolean should return true if everything is loaded
|
|
33
40
|
// ( categoriesTaxonomy, defaultCategory )
|
|
34
41
|
// and the post has not been assigned a category different than "uncategorized".
|
|
35
|
-
|
|
42
|
+
const noCategory = !!categoriesTaxonomy && !!defaultCategory && postTypeSupportsCategories && (categories?.length === 0 || categories?.length === 1 && defaultCategory?.id === categories[0]);
|
|
43
|
+
return {
|
|
44
|
+
hasNoCategory: noCategory,
|
|
45
|
+
hasSiteCategories: siteCategories
|
|
46
|
+
};
|
|
36
47
|
}, []);
|
|
37
48
|
const [shouldShowPanel, setShouldShowPanel] = useState(false);
|
|
38
49
|
useEffect(() => {
|
|
@@ -42,7 +53,12 @@ function MaybeCategoryPanel() {
|
|
|
42
53
|
setShouldShowPanel(true);
|
|
43
54
|
}
|
|
44
55
|
}, [hasNoCategory]);
|
|
45
|
-
|
|
56
|
+
|
|
57
|
+
// We only want to show the category panel:
|
|
58
|
+
// if the post type supports categories,
|
|
59
|
+
// if the site has categories other than the default category,
|
|
60
|
+
// and if the post has no other categories than the default category.
|
|
61
|
+
if (!shouldShowPanel || !hasSiteCategories) {
|
|
46
62
|
return null;
|
|
47
63
|
}
|
|
48
64
|
const panelBodyTitle = [__('Suggestion:'), /*#__PURE__*/_jsx("span", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","useSelect","PanelBody","store","coreStore","useState","useEffect","HierarchicalTermSelector","editorStore","jsx","_jsx","jsxs","_jsxs","MaybeCategoryPanel","hasNoCategory","select","postType","getCurrentPostType","canUser","getEntityRecord","categoriesTaxonomy","defaultCategoryId","kind","name","default_category","undefined","defaultCategory","postTypeSupportsCategories","types","some","type","categories","getEditedPostAttribute","rest_base","length","id","shouldShowPanel","setShouldShowPanel","panelBodyTitle","className","children","initialOpen","title","slug"],"sources":["@wordpress/editor/src/components/post-publish-panel/maybe-category-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { PanelBody } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport HierarchicalTermSelector from '../post-taxonomies/hierarchical-term-selector';\nimport { store as editorStore } from '../../store';\n\nfunction MaybeCategoryPanel() {\n\tconst hasNoCategory = useSelect( ( select ) => {\n\t\tconst postType = select( editorStore ).getCurrentPostType();\n\t\tconst { canUser, getEntityRecord } = select( coreStore );\n\t\tconst categoriesTaxonomy = getEntityRecord(\n\t\t\t'root',\n\t\t\t'taxonomy',\n\t\t\t'category'\n\t\t);\n\t\tconst defaultCategoryId = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? getEntityRecord( 'root', 'site' )?.default_category\n\t\t\t: undefined;\n\t\tconst defaultCategory = defaultCategoryId\n\t\t\t? getEntityRecord( 'taxonomy', 'category', defaultCategoryId )\n\t\t\t: undefined;\n\t\tconst postTypeSupportsCategories =\n\t\t\tcategoriesTaxonomy &&\n\t\t\tcategoriesTaxonomy.types.some( ( type ) => type === postType );\n\t\tconst categories =\n\t\t\tcategoriesTaxonomy &&\n\t\t\tselect( editorStore ).getEditedPostAttribute(\n\t\t\t\tcategoriesTaxonomy.rest_base\n\t\t\t);\n\n\t\t// This boolean should return true if everything is loaded\n\t\t// ( categoriesTaxonomy, defaultCategory )\n\t\t// and the post has not been assigned a category different than \"uncategorized\".\n\t\
|
|
1
|
+
{"version":3,"names":["__","useSelect","PanelBody","store","coreStore","useState","useEffect","HierarchicalTermSelector","editorStore","jsx","_jsx","jsxs","_jsxs","MaybeCategoryPanel","hasNoCategory","hasSiteCategories","select","postType","getCurrentPostType","canUser","getEntityRecord","categoriesTaxonomy","defaultCategoryId","kind","name","default_category","undefined","defaultCategory","postTypeSupportsCategories","types","some","type","categories","getEditedPostAttribute","rest_base","siteCategories","getEntityRecords","exclude","per_page","length","noCategory","id","shouldShowPanel","setShouldShowPanel","panelBodyTitle","className","children","initialOpen","title","slug"],"sources":["@wordpress/editor/src/components/post-publish-panel/maybe-category-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { PanelBody } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport HierarchicalTermSelector from '../post-taxonomies/hierarchical-term-selector';\nimport { store as editorStore } from '../../store';\n\nfunction MaybeCategoryPanel() {\n\tconst { hasNoCategory, hasSiteCategories } = useSelect( ( select ) => {\n\t\tconst postType = select( editorStore ).getCurrentPostType();\n\t\tconst { canUser, getEntityRecord } = select( coreStore );\n\t\tconst categoriesTaxonomy = getEntityRecord(\n\t\t\t'root',\n\t\t\t'taxonomy',\n\t\t\t'category'\n\t\t);\n\t\tconst defaultCategoryId = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? getEntityRecord( 'root', 'site' )?.default_category\n\t\t\t: undefined;\n\t\tconst defaultCategory = defaultCategoryId\n\t\t\t? getEntityRecord( 'taxonomy', 'category', defaultCategoryId )\n\t\t\t: undefined;\n\t\tconst postTypeSupportsCategories =\n\t\t\tcategoriesTaxonomy &&\n\t\t\tcategoriesTaxonomy.types.some( ( type ) => type === postType );\n\t\tconst categories =\n\t\t\tcategoriesTaxonomy &&\n\t\t\tselect( editorStore ).getEditedPostAttribute(\n\t\t\t\tcategoriesTaxonomy.rest_base\n\t\t\t);\n\t\tconst siteCategories = postTypeSupportsCategories\n\t\t\t? !! select( coreStore ).getEntityRecords( 'taxonomy', 'category', {\n\t\t\t\t\texclude: [ defaultCategoryId ],\n\t\t\t\t\tper_page: 1,\n\t\t\t } )?.length\n\t\t\t: false;\n\n\t\t// This boolean should return true if everything is loaded\n\t\t// ( categoriesTaxonomy, defaultCategory )\n\t\t// and the post has not been assigned a category different than \"uncategorized\".\n\t\tconst noCategory =\n\t\t\t!! categoriesTaxonomy &&\n\t\t\t!! defaultCategory &&\n\t\t\tpostTypeSupportsCategories &&\n\t\t\t( categories?.length === 0 ||\n\t\t\t\t( categories?.length === 1 &&\n\t\t\t\t\tdefaultCategory?.id === categories[ 0 ] ) );\n\n\t\treturn {\n\t\t\thasNoCategory: noCategory,\n\t\t\thasSiteCategories: siteCategories,\n\t\t};\n\t}, [] );\n\n\tconst [ shouldShowPanel, setShouldShowPanel ] = useState( false );\n\tuseEffect( () => {\n\t\t// We use state to avoid hiding the panel if the user edits the categories\n\t\t// and adds one within the panel itself (while visible).\n\t\tif ( hasNoCategory ) {\n\t\t\tsetShouldShowPanel( true );\n\t\t}\n\t}, [ hasNoCategory ] );\n\n\t// We only want to show the category panel:\n\t// if the post type supports categories,\n\t// if the site has categories other than the default category,\n\t// and if the post has no other categories than the default category.\n\tif ( ! shouldShowPanel || ! hasSiteCategories ) {\n\t\treturn null;\n\t}\n\n\tconst panelBodyTitle = [\n\t\t__( 'Suggestion:' ),\n\t\t<span className=\"editor-post-publish-panel__link\" key=\"label\">\n\t\t\t{ __( 'Assign a category' ) }\n\t\t</span>,\n\t];\n\n\treturn (\n\t\t<PanelBody initialOpen={ false } title={ panelBodyTitle }>\n\t\t\t<p>\n\t\t\t\t{ __(\n\t\t\t\t\t'Categories provide a helpful way to group related posts together and to quickly tell readers what a post is about.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<HierarchicalTermSelector slug=\"category\" />\n\t\t</PanelBody>\n\t);\n}\n\nexport default MaybeCategoryPanel;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,SAAS,QAAQ,uBAAuB;AACjD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,QAAQ,EAAEC,SAAS,QAAQ,oBAAoB;;AAExD;AACA;AACA;AACA,OAAOC,wBAAwB,MAAM,+CAA+C;AACpF,SAASJ,KAAK,IAAIK,WAAW,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEnD,SAASC,kBAAkBA,CAAA,EAAG;EAC7B,MAAM;IAAEC,aAAa;IAAEC;EAAkB,CAAC,GAAGd,SAAS,CAAIe,MAAM,IAAM;IACrE,MAAMC,QAAQ,GAAGD,MAAM,CAAER,WAAY,CAAC,CAACU,kBAAkB,CAAC,CAAC;IAC3D,MAAM;MAAEC,OAAO;MAAEC;IAAgB,CAA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EP,MAAM,CAAEO,eAAe,EAAEC,kBAAkB,CAAE,GAAGtC,QAAQ,CAAE,KAAM,CAAC;EACjEC,SAAS,CAAE,MAAM;IAChB;IACA;IACA,IAAKQ,aAAa,EAAG;MACpB6B,kBAAkB,CAAE,IAAK,CAAC;IAC3B;EACD,CAAC,EAAE,CAAE7B,aAAa,CAAG,CAAC;;EAEtB;EACA;EACA;EACA;EACA,IAAK,CAAE4B,eAAe,IAAI,CAAE3B,iBAAiB,EAAG;IAC/C,OAAO,IAAI;EACZ;EAEA,MAAM6B,cAAc,GAAG,CACtB5C,EAAE,CAAE,aAAc,CAAC,eACnBU,IAAA;IAAMmC,SAAS,EAAC,iCAAiC;IAAAC,QAAA,EAC9C9C,EAAE,CAAE,mBAAoB;EAAC,GAD0B,OAEhD,CAAC,CACP;EAED,oBACCY,KAAA,CAACV,SAAS;IAAC6C,WAAW,EAAG,KAAO;IAACC,KAAK,EAAGJ,cAAgB;IAAAE,QAAA,gBACxDpC,IAAA;MAAAoC,QAAA,EACG9C,EAAE,CACH,oHACD;IAAC,CACC,CAAC,eACJU,IAAA,CAACH,wBAAwB;MAAC0C,IAAI,EAAC;IAAU,CAAE,CAAC;EAAA,CAClC,CAAC;AAEd;AAEA,eAAepC,kBAAkB","ignoreList":[]}
|
|
@@ -31,7 +31,8 @@ const TagsPanel = () => {
|
|
|
31
31
|
};
|
|
32
32
|
const MaybeTagsPanel = () => {
|
|
33
33
|
const {
|
|
34
|
-
|
|
34
|
+
postHasTags,
|
|
35
|
+
siteHasTags,
|
|
35
36
|
isPostTypeSupported
|
|
36
37
|
} = useSelect(select => {
|
|
37
38
|
const postType = select(editorStore).getCurrentPostType();
|
|
@@ -39,13 +40,22 @@ const MaybeTagsPanel = () => {
|
|
|
39
40
|
const _isPostTypeSupported = tagsTaxonomy?.types?.includes(postType);
|
|
40
41
|
const areTagsFetched = tagsTaxonomy !== undefined;
|
|
41
42
|
const tags = tagsTaxonomy && select(editorStore).getEditedPostAttribute(tagsTaxonomy.rest_base);
|
|
43
|
+
const siteTags = _isPostTypeSupported ? !!select(coreStore).getEntityRecords('taxonomy', 'post_tag', {
|
|
44
|
+
per_page: 1
|
|
45
|
+
})?.length : false;
|
|
42
46
|
return {
|
|
43
|
-
|
|
47
|
+
postHasTags: !!tags?.length,
|
|
48
|
+
siteHasTags: siteTags,
|
|
44
49
|
isPostTypeSupported: areTagsFetched && _isPostTypeSupported
|
|
45
50
|
};
|
|
46
51
|
}, []);
|
|
47
|
-
const [hadTagsWhenOpeningThePanel] = useState(
|
|
48
|
-
|
|
52
|
+
const [hadTagsWhenOpeningThePanel] = useState(postHasTags);
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* We only want to show the tag panel if the post type supports
|
|
56
|
+
* tags and the site has tags.
|
|
57
|
+
*/
|
|
58
|
+
if (!isPostTypeSupported || !siteHasTags) {
|
|
49
59
|
return null;
|
|
50
60
|
}
|
|
51
61
|
|
|
@@ -53,9 +63,9 @@ const MaybeTagsPanel = () => {
|
|
|
53
63
|
* We only want to show the tag panel if the post didn't have
|
|
54
64
|
* any tags when the user hit the Publish button.
|
|
55
65
|
*
|
|
56
|
-
* We can't use the prop.
|
|
66
|
+
* We can't use the prop.postHasTags because it'll change to true
|
|
57
67
|
* if the user adds a new tag within the pre-publish panel.
|
|
58
|
-
* This would force a re-render and a new prop.
|
|
68
|
+
* This would force a re-render and a new prop.postHasTags check,
|
|
59
69
|
* hiding this panel and keeping the user from adding
|
|
60
70
|
* more than one tag.
|
|
61
71
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","useState","useSelect","PanelBody","store","coreStore","FlatTermSelector","editorStore","jsx","_jsx","jsxs","_jsxs","TagsPanel","panelBodyTitle","className","children","initialOpen","title","slug","__nextHasNoMarginBottom","MaybeTagsPanel","
|
|
1
|
+
{"version":3,"names":["__","useState","useSelect","PanelBody","store","coreStore","FlatTermSelector","editorStore","jsx","_jsx","jsxs","_jsxs","TagsPanel","panelBodyTitle","className","children","initialOpen","title","slug","__nextHasNoMarginBottom","MaybeTagsPanel","postHasTags","siteHasTags","isPostTypeSupported","select","postType","getCurrentPostType","tagsTaxonomy","getEntityRecord","_isPostTypeSupported","types","includes","areTagsFetched","undefined","tags","getEditedPostAttribute","rest_base","siteTags","getEntityRecords","per_page","length","hadTagsWhenOpeningThePanel"],"sources":["@wordpress/editor/src/components/post-publish-panel/maybe-tags-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { PanelBody } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport FlatTermSelector from '../post-taxonomies/flat-term-selector';\nimport { store as editorStore } from '../../store';\n\nconst TagsPanel = () => {\n\tconst panelBodyTitle = [\n\t\t__( 'Suggestion:' ),\n\t\t<span className=\"editor-post-publish-panel__link\" key=\"label\">\n\t\t\t{ __( 'Add tags' ) }\n\t\t</span>,\n\t];\n\n\treturn (\n\t\t<PanelBody initialOpen={ false } title={ panelBodyTitle }>\n\t\t\t<p>\n\t\t\t\t{ __(\n\t\t\t\t\t'Tags help users and search engines navigate your site and find your content. Add a few keywords to describe your post.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<FlatTermSelector slug=\"post_tag\" __nextHasNoMarginBottom />\n\t\t</PanelBody>\n\t);\n};\n\nconst MaybeTagsPanel = () => {\n\tconst { postHasTags, siteHasTags, isPostTypeSupported } = useSelect(\n\t\t( select ) => {\n\t\t\tconst postType = select( editorStore ).getCurrentPostType();\n\t\t\tconst tagsTaxonomy = select( coreStore ).getEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'taxonomy',\n\t\t\t\t'post_tag'\n\t\t\t);\n\t\t\tconst _isPostTypeSupported =\n\t\t\t\ttagsTaxonomy?.types?.includes( postType );\n\t\t\tconst areTagsFetched = tagsTaxonomy !== undefined;\n\t\t\tconst tags =\n\t\t\t\ttagsTaxonomy &&\n\t\t\t\tselect( editorStore ).getEditedPostAttribute(\n\t\t\t\t\ttagsTaxonomy.rest_base\n\t\t\t\t);\n\t\t\tconst siteTags = _isPostTypeSupported\n\t\t\t\t? !! select( coreStore ).getEntityRecords(\n\t\t\t\t\t\t'taxonomy',\n\t\t\t\t\t\t'post_tag',\n\t\t\t\t\t\t{ per_page: 1 }\n\t\t\t\t )?.length\n\t\t\t\t: false;\n\n\t\t\treturn {\n\t\t\t\tpostHasTags: !! tags?.length,\n\t\t\t\tsiteHasTags: siteTags,\n\t\t\t\tisPostTypeSupported: areTagsFetched && _isPostTypeSupported,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst [ hadTagsWhenOpeningThePanel ] = useState( postHasTags );\n\n\t/**\n\t * We only want to show the tag panel if the post type supports\n\t * tags and the site has tags.\n\t */\n\tif ( ! isPostTypeSupported || ! siteHasTags ) {\n\t\treturn null;\n\t}\n\n\t/*\n\t * We only want to show the tag panel if the post didn't have\n\t * any tags when the user hit the Publish button.\n\t *\n\t * We can't use the prop.postHasTags because it'll change to true\n\t * if the user adds a new tag within the pre-publish panel.\n\t * This would force a re-render and a new prop.postHasTags check,\n\t * hiding this panel and keeping the user from adding\n\t * more than one tag.\n\t */\n\tif ( ! hadTagsWhenOpeningThePanel ) {\n\t\treturn <TagsPanel />;\n\t}\n\n\treturn null;\n};\n\nexport default MaybeTagsPanel;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,SAAS,QAAQ,uBAAuB;AACjD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,OAAOC,gBAAgB,MAAM,uCAAuC;AACpE,SAASF,KAAK,IAAIG,WAAW,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA,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AEC,MAAM,GACT,KAAK;IAER,OAAO;MACNnB,WAAW,EAAE,CAAC,CAAEa,IAAI,EAAEM,MAAM;MAC5BlB,WAAW,EAAEe,QAAQ;MACrBd,mBAAmB,EAAES,cAAc,IAAIH;IACxC,CAAC;EACF,CAAC,EACD,EACD,CAAC;EACD,MAAM,CAAEY,0BAA0B,CAAE,GAAGxC,QAAQ,CAAEoB,WAAY,CAAC;;EAE9D;AACD;AACA;AACA;EACC,IAAK,CAAEE,mBAAmB,IAAI,CAAED,WAAW,EAAG;IAC7C,OAAO,IAAI;EACZ;;EAEA;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACC,IAAK,CAAEmB,0BAA0B,EAAG;IACnC,oBAAOhC,IAAA,CAACG,SAAS,IAAE,CAAC;EACrB;EAEA,OAAO,IAAI;AACZ,CAAC;AAED,eAAeQ,cAAc","ignoreList":[]}
|
|
@@ -176,6 +176,10 @@ export default function PostStatus() {
|
|
|
176
176
|
title: __('Status & visibility'),
|
|
177
177
|
onClose: onClose
|
|
178
178
|
}), /*#__PURE__*/_jsx("form", {
|
|
179
|
+
onSubmit: event => {
|
|
180
|
+
event.preventDefault();
|
|
181
|
+
onClose();
|
|
182
|
+
},
|
|
179
183
|
children: /*#__PURE__*/_jsxs(VStack, {
|
|
180
184
|
spacing: 4,
|
|
181
185
|
children: [/*#__PURE__*/_jsx(RadioControl, {
|
|
@@ -198,7 +202,7 @@ export default function PostStatus() {
|
|
|
198
202
|
children: [/*#__PURE__*/_jsx(CheckboxControl, {
|
|
199
203
|
__nextHasNoMarginBottom: true,
|
|
200
204
|
label: __('Password protected'),
|
|
201
|
-
help: __('Only visible to those who know the password'),
|
|
205
|
+
help: __('Only visible to those who know the password.'),
|
|
202
206
|
checked: showPassword,
|
|
203
207
|
onChange: handleTogglePassword
|
|
204
208
|
}), showPassword && /*#__PURE__*/_jsx("div", {
|