@wordpress/editor 14.20.0 → 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.
Files changed (44) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +1 -1
  3. package/build/components/plugin-pre-publish-panel/index.js +1 -1
  4. package/build/components/plugin-pre-publish-panel/index.js.map +1 -1
  5. package/build/components/post-status/index.js +4 -0
  6. package/build/components/post-status/index.js.map +1 -1
  7. package/build/components/post-template/block-theme.js +1 -3
  8. package/build/components/post-template/block-theme.js.map +1 -1
  9. package/build/components/post-template/create-new-template-modal.js +1 -0
  10. package/build/components/post-template/create-new-template-modal.js.map +1 -1
  11. package/build/components/post-template/create-new-template.js +1 -4
  12. package/build/components/post-template/create-new-template.js.map +1 -1
  13. package/build/components/preview-dropdown/index.js +2 -4
  14. package/build/components/preview-dropdown/index.js.map +1 -1
  15. package/build-module/components/plugin-pre-publish-panel/index.js +1 -1
  16. package/build-module/components/plugin-pre-publish-panel/index.js.map +1 -1
  17. package/build-module/components/post-status/index.js +4 -0
  18. package/build-module/components/post-status/index.js.map +1 -1
  19. package/build-module/components/post-template/block-theme.js +1 -3
  20. package/build-module/components/post-template/block-theme.js.map +1 -1
  21. package/build-module/components/post-template/create-new-template-modal.js +1 -0
  22. package/build-module/components/post-template/create-new-template-modal.js.map +1 -1
  23. package/build-module/components/post-template/create-new-template.js +1 -4
  24. package/build-module/components/post-template/create-new-template.js.map +1 -1
  25. package/build-module/components/preview-dropdown/index.js +2 -4
  26. package/build-module/components/preview-dropdown/index.js.map +1 -1
  27. package/build-style/style-rtl.css +4 -0
  28. package/build-style/style.css +4 -0
  29. package/build-types/components/plugin-pre-publish-panel/index.d.ts +1 -1
  30. package/build-types/components/post-status/index.d.ts.map +1 -1
  31. package/build-types/components/post-template/block-theme.d.ts.map +1 -1
  32. package/build-types/components/post-template/create-new-template-modal.d.ts.map +1 -1
  33. package/build-types/components/post-template/create-new-template.d.ts +1 -3
  34. package/build-types/components/post-template/create-new-template.d.ts.map +1 -1
  35. package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
  36. package/package.json +37 -37
  37. package/src/components/plugin-pre-publish-panel/index.js +1 -1
  38. package/src/components/post-status/index.js +6 -1
  39. package/src/components/post-template/block-theme.js +1 -3
  40. package/src/components/post-template/create-new-template-modal.js +1 -0
  41. package/src/components/post-template/create-new-template.js +1 -2
  42. package/src/components/post-template/style.scss +4 -0
  43. package/src/components/preview-dropdown/index.js +6 -3
  44. package/tsconfig.tsbuildinfo +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","useDispatch","decodeEntities","DropdownMenu","MenuGroup","MenuItem","useState","useMemo","__","useEntityRecord","store","coreStore","check","noticesStore","preferencesStore","PostPanelRow","editorStore","SwapTemplateButton","ResetDefaultTemplate","unlock","CreateNewTemplate","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","BlockThemeControl","id","isTemplateHidden","onNavigateToEntityRecord","getEditorSettings","hasGoBack","select","getRenderingMode","_getEditorSettings","editorSettings","hasOwnProperty","get","getPreference","editedRecord","template","hasResolved","createSuccessNotice","setRenderingMode","setDefaultRenderingMode","canCreateTemplate","canUser","kind","name","popoverAnchor","setPopoverAnchor","popoverProps","anchor","className","placement","offset","shift","notificationAction","label","onClick","onNavigateToPreviousEntityRecord","undefined","mayShowTemplateEditNotice","type","actions","ref","children","focusOnMount","toggleProps","size","variant","tooltipPosition","text","title","icon","onClose","postId","postType","isSelected","role","newRenderingMode"],"sources":["@wordpress/editor/src/components/post-template/block-theme.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { useState, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecord, store as coreStore } from '@wordpress/core-data';\nimport { check } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport PostPanelRow from '../post-panel-row';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport SwapTemplateButton from './swap-template-button';\nimport ResetDefaultTemplate from './reset-default-template';\nimport { unlock } from '../../lock-unlock';\nimport CreateNewTemplate from './create-new-template';\n\nexport default function BlockThemeControl( { id } ) {\n\tconst {\n\t\tisTemplateHidden,\n\t\tonNavigateToEntityRecord,\n\t\tgetEditorSettings,\n\t\thasGoBack,\n\t} = useSelect( ( select ) => {\n\t\tconst { getRenderingMode, getEditorSettings: _getEditorSettings } =\n\t\t\tunlock( select( editorStore ) );\n\t\tconst editorSettings = _getEditorSettings();\n\t\treturn {\n\t\t\tisTemplateHidden: getRenderingMode() === 'post-only',\n\t\t\tonNavigateToEntityRecord: editorSettings.onNavigateToEntityRecord,\n\t\t\tgetEditorSettings: _getEditorSettings,\n\t\t\thasGoBack: editorSettings.hasOwnProperty(\n\t\t\t\t'onNavigateToPreviousEntityRecord'\n\t\t\t),\n\t\t};\n\t}, [] );\n\n\tconst { get: getPreference } = useSelect( preferencesStore );\n\n\tconst { editedRecord: template, hasResolved } = useEntityRecord(\n\t\t'postType',\n\t\t'wp_template',\n\t\tid\n\t);\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst { setRenderingMode, setDefaultRenderingMode } = unlock(\n\t\tuseDispatch( editorStore )\n\t);\n\n\tconst canCreateTemplate = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( coreStore ).canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ),\n\t\t[]\n\t);\n\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\tclassName: 'editor-post-template__dropdown',\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\tif ( ! hasResolved ) {\n\t\treturn null;\n\t}\n\n\t// The site editor does not have a `onNavigateToPreviousEntityRecord` setting as it uses its own routing\n\t// and assigns its own backlink to focusMode pages.\n\tconst notificationAction = hasGoBack\n\t\t? [\n\t\t\t\t{\n\t\t\t\t\tlabel: __( 'Go back' ),\n\t\t\t\t\tonClick: () =>\n\t\t\t\t\t\tgetEditorSettings().onNavigateToPreviousEntityRecord(),\n\t\t\t\t},\n\t\t ]\n\t\t: undefined;\n\n\tconst mayShowTemplateEditNotice = () => {\n\t\tif ( ! getPreference( 'core/edit-site', 'welcomeGuideTemplate' ) ) {\n\t\t\tcreateSuccessNotice(\n\t\t\t\t__(\n\t\t\t\t\t'Editing template. Changes made here affect all posts and pages that use the template.'\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar', actions: notificationAction }\n\t\t\t);\n\t\t}\n\t};\n\treturn (\n\t\t<PostPanelRow label={ __( 'Template' ) } ref={ setPopoverAnchor }>\n\t\t\t<DropdownMenu\n\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\tfocusOnMount\n\t\t\t\ttoggleProps={ {\n\t\t\t\t\tsize: 'compact',\n\t\t\t\t\tvariant: 'tertiary',\n\t\t\t\t\ttooltipPosition: 'middle left',\n\t\t\t\t} }\n\t\t\t\tlabel={ __( 'Template options' ) }\n\t\t\t\ttext={ decodeEntities( template.title ) }\n\t\t\t\ticon={ null }\n\t\t\t>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t{ canCreateTemplate && (\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\t\t\t\tpostId: template.id,\n\t\t\t\t\t\t\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\tmayShowTemplateEditNotice();\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\t\t{ __( 'Edit template' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t<SwapTemplateButton onClick={ onClose } />\n\t\t\t\t\t\t\t<ResetDefaultTemplate onClick={ onClose } />\n\t\t\t\t\t\t\t{ canCreateTemplate && (\n\t\t\t\t\t\t\t\t<CreateNewTemplate onClick={ onClose } />\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</MenuGroup>\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) }\n\t\t\t</DropdownMenu>\n\t\t</PostPanelRow>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,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AE,CAAC,EAC1C9B,iBAAiB,iBAClBxB,IAAA,CAACF,iBAAiB;YAACwC,OAAO,EAAGgB;UAAS,CAAE,CACxC;QAAA,CACS,CAAC,eACZtD,IAAA,CAAClB,SAAS;UAAA+D,QAAA,eACT7C,IAAA,CAACjB,QAAQ;YACRsE,IAAI,EAAG,CAAE9C,gBAAgB,GAAGjB,KAAK,GAAGkD,SAAW;YAC/CiB,UAAU,EAAG,CAAElD,gBAAkB;YACjCmD,IAAI,EAAC,kBAAkB;YACvBpB,OAAO,EAAGA,CAAA,KAAM;cACf,MAAMqB,gBAAgB,GAAGpD,gBAAgB,GACtC,iBAAiB,GACjB,WAAW;cACde,gBAAgB,CAAEqC,gBAAiB,CAAC;cACpCpC,uBAAuB,CAAEoC,gBAAiB,CAAC;YAC5C,CAAG;YAAAd,QAAA,EAED3D,EAAE,CAAE,eAAgB;UAAC,CACd;QAAC,CACD,CAAC;MAAA,CACX;IACF,CACY;EAAC,CACF,CAAC;AAEjB","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","useDispatch","decodeEntities","DropdownMenu","MenuGroup","MenuItem","useState","useMemo","__","useEntityRecord","store","coreStore","check","noticesStore","preferencesStore","PostPanelRow","editorStore","SwapTemplateButton","ResetDefaultTemplate","unlock","CreateNewTemplate","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","BlockThemeControl","id","isTemplateHidden","onNavigateToEntityRecord","getEditorSettings","hasGoBack","select","getRenderingMode","_getEditorSettings","editorSettings","hasOwnProperty","get","getPreference","editedRecord","template","hasResolved","createSuccessNotice","setRenderingMode","setDefaultRenderingMode","canCreateTemplate","canUser","kind","name","popoverAnchor","setPopoverAnchor","popoverProps","anchor","className","placement","offset","shift","notificationAction","label","onClick","onNavigateToPreviousEntityRecord","undefined","mayShowTemplateEditNotice","type","actions","ref","children","focusOnMount","toggleProps","size","variant","tooltipPosition","text","title","icon","onClose","postId","postType","isSelected","role","newRenderingMode"],"sources":["@wordpress/editor/src/components/post-template/block-theme.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { useState, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecord, store as coreStore } from '@wordpress/core-data';\nimport { check } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport PostPanelRow from '../post-panel-row';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport SwapTemplateButton from './swap-template-button';\nimport ResetDefaultTemplate from './reset-default-template';\nimport { unlock } from '../../lock-unlock';\nimport CreateNewTemplate from './create-new-template';\n\nexport default function BlockThemeControl( { id } ) {\n\tconst {\n\t\tisTemplateHidden,\n\t\tonNavigateToEntityRecord,\n\t\tgetEditorSettings,\n\t\thasGoBack,\n\t} = useSelect( ( select ) => {\n\t\tconst { getRenderingMode, getEditorSettings: _getEditorSettings } =\n\t\t\tunlock( select( editorStore ) );\n\t\tconst editorSettings = _getEditorSettings();\n\t\treturn {\n\t\t\tisTemplateHidden: getRenderingMode() === 'post-only',\n\t\t\tonNavigateToEntityRecord: editorSettings.onNavigateToEntityRecord,\n\t\t\tgetEditorSettings: _getEditorSettings,\n\t\t\thasGoBack: editorSettings.hasOwnProperty(\n\t\t\t\t'onNavigateToPreviousEntityRecord'\n\t\t\t),\n\t\t};\n\t}, [] );\n\n\tconst { get: getPreference } = useSelect( preferencesStore );\n\n\tconst { editedRecord: template, hasResolved } = useEntityRecord(\n\t\t'postType',\n\t\t'wp_template',\n\t\tid\n\t);\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst { setRenderingMode, setDefaultRenderingMode } = unlock(\n\t\tuseDispatch( editorStore )\n\t);\n\n\tconst canCreateTemplate = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( coreStore ).canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ),\n\t\t[]\n\t);\n\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\tclassName: 'editor-post-template__dropdown',\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\tif ( ! hasResolved ) {\n\t\treturn null;\n\t}\n\n\t// The site editor does not have a `onNavigateToPreviousEntityRecord` setting as it uses its own routing\n\t// and assigns its own backlink to focusMode pages.\n\tconst notificationAction = hasGoBack\n\t\t? [\n\t\t\t\t{\n\t\t\t\t\tlabel: __( 'Go back' ),\n\t\t\t\t\tonClick: () =>\n\t\t\t\t\t\tgetEditorSettings().onNavigateToPreviousEntityRecord(),\n\t\t\t\t},\n\t\t ]\n\t\t: undefined;\n\n\tconst mayShowTemplateEditNotice = () => {\n\t\tif ( ! getPreference( 'core/edit-site', 'welcomeGuideTemplate' ) ) {\n\t\t\tcreateSuccessNotice(\n\t\t\t\t__(\n\t\t\t\t\t'Editing template. Changes made here affect all posts and pages that use the template.'\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar', actions: notificationAction }\n\t\t\t);\n\t\t}\n\t};\n\treturn (\n\t\t<PostPanelRow label={ __( 'Template' ) } ref={ setPopoverAnchor }>\n\t\t\t<DropdownMenu\n\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\tfocusOnMount\n\t\t\t\ttoggleProps={ {\n\t\t\t\t\tsize: 'compact',\n\t\t\t\t\tvariant: 'tertiary',\n\t\t\t\t\ttooltipPosition: 'middle left',\n\t\t\t\t} }\n\t\t\t\tlabel={ __( 'Template options' ) }\n\t\t\t\ttext={ decodeEntities( template.title ) }\n\t\t\t\ticon={ null }\n\t\t\t>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t{ canCreateTemplate && (\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\t\t\t\tpostId: template.id,\n\t\t\t\t\t\t\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\tmayShowTemplateEditNotice();\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\t\t{ __( 'Edit template' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t<SwapTemplateButton onClick={ onClose } />\n\t\t\t\t\t\t\t<ResetDefaultTemplate onClick={ onClose } />\n\t\t\t\t\t\t\t{ canCreateTemplate && <CreateNewTemplate /> }\n\t\t\t\t\t\t</MenuGroup>\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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,CAAC,CAAC;YAC5B,CAAG;YAAAI,QAAA,EAED3D,EAAE,CAAE,eAAgB;UAAC,CACd,CACV,eAEDc,IAAA,CAACL,kBAAkB;YAAC2C,OAAO,EAAGgB;UAAS,CAAE,CAAC,eAC1CtD,IAAA,CAACJ,oBAAoB;YAAC0C,OAAO,EAAGgB;UAAS,CAAE,CAAC,EAC1C9B,iBAAiB,iBAAIxB,IAAA,CAACF,iBAAiB,IAAE,CAAC;QAAA,CAClC,CAAC,eACZE,IAAA,CAAClB,SAAS;UAAA+D,QAAA,eACT7C,IAAA,CAACjB,QAAQ;YACRsE,IAAI,EAAG,CAAE9C,gBAAgB,GAAGjB,KAAK,GAAGkD,SAAW;YAC/CiB,UAAU,EAAG,CAAElD,gBAAkB;YACjCmD,IAAI,EAAC,kBAAkB;YACvBpB,OAAO,EAAGA,CAAA,KAAM;cACf,MAAMqB,gBAAgB,GAAGpD,gBAAgB,GACtC,iBAAiB,GACjB,WAAW;cACde,gBAAgB,CAAEqC,gBAAiB,CAAC;cACpCpC,uBAAuB,CAAEoC,gBAAiB,CAAC;YAC5C,CAAG;YAAAd,QAAA,EAED3D,EAAE,CAAE,eAAgB;UAAC,CACd;QAAC,CACD,CAAC;MAAA,CACX;IACF,CACY;EAAC,CACF,CAAC;AAEjB","ignoreList":[]}
@@ -80,6 +80,7 @@ export default function CreateNewTemplateModal({
80
80
  onRequestClose: cancel,
81
81
  focusOnMount: "firstContentElement",
82
82
  size: "small",
83
+ overlayClassName: "editor-post-template__create-template-modal",
83
84
  children: /*#__PURE__*/_jsx("form", {
84
85
  className: "editor-post-template__create-form",
85
86
  onSubmit: submit,
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","useDispatch","useState","serialize","createBlock","Modal","TextControl","Button","__experimentalHStack","HStack","__experimentalVStack","VStack","__","cleanForSlug","unlock","store","editorStore","jsx","_jsx","jsxs","_jsxs","DEFAULT_TITLE","CreateNewTemplateModal","onClose","defaultBlockTemplate","onNavigateToEntityRecord","select","getEditorSettings","getCurrentTemplateId","getTemplateId","createTemplate","title","setTitle","isBusy","setIsBusy","cancel","submit","event","preventDefault","newTemplateContent","tagName","layout","inherit","newTemplate","slug","content","postId","id","postType","onRequestClose","focusOnMount","size","children","className","onSubmit","spacing","__next40pxDefaultSize","__nextHasNoMarginBottom","label","value","onChange","placeholder","disabled","help","justify","variant","onClick","type"],"sources":["@wordpress/editor/src/components/post-template/create-new-template-modal.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { serialize, createBlock } from '@wordpress/blocks';\nimport {\n\tModal,\n\tTextControl,\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { cleanForSlug } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\n\nconst DEFAULT_TITLE = __( 'Custom Template' );\n\nexport default function CreateNewTemplateModal( { onClose } ) {\n\tconst { defaultBlockTemplate, onNavigateToEntityRecord } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditorSettings, getCurrentTemplateId } =\n\t\t\t\tselect( editorStore );\n\t\t\treturn {\n\t\t\t\tdefaultBlockTemplate: getEditorSettings().defaultBlockTemplate,\n\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\tgetEditorSettings().onNavigateToEntityRecord,\n\t\t\t\tgetTemplateId: getCurrentTemplateId,\n\t\t\t};\n\t\t}\n\t);\n\n\tconst { createTemplate } = unlock( useDispatch( editorStore ) );\n\n\tconst [ title, setTitle ] = useState( '' );\n\n\tconst [ isBusy, setIsBusy ] = useState( false );\n\n\tconst cancel = () => {\n\t\tsetTitle( '' );\n\t\tonClose();\n\t};\n\n\tconst submit = async ( event ) => {\n\t\tevent.preventDefault();\n\n\t\tif ( isBusy ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsBusy( true );\n\n\t\tconst newTemplateContent =\n\t\t\tdefaultBlockTemplate ??\n\t\t\tserialize( [\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{\n\t\t\t\t\t\ttagName: 'header',\n\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock( 'core/site-title' ),\n\t\t\t\t\t\tcreateBlock( 'core/site-tagline' ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t\t\tcreateBlock( 'core/separator' ),\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{\n\t\t\t\t\t\ttagName: 'main',\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t'core/group',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t[ createBlock( 'core/post-title' ) ]\n\t\t\t\t\t\t),\n\t\t\t\t\t\tcreateBlock( 'core/post-content', {\n\t\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t\t} ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t\t] );\n\n\t\tconst newTemplate = await createTemplate( {\n\t\t\tslug: cleanForSlug( title || DEFAULT_TITLE ),\n\t\t\tcontent: newTemplateContent,\n\t\t\ttitle: title || DEFAULT_TITLE,\n\t\t} );\n\n\t\tsetIsBusy( false );\n\t\tonNavigateToEntityRecord( {\n\t\t\tpostId: newTemplate.id,\n\t\t\tpostType: 'wp_template',\n\t\t} );\n\t\tcancel();\n\t};\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Create custom template' ) }\n\t\t\tonRequestClose={ cancel }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\tsize=\"small\"\n\t\t>\n\t\t\t<form\n\t\t\t\tclassName=\"editor-post-template__create-form\"\n\t\t\t\tonSubmit={ submit }\n\t\t\t>\n\t\t\t\t<VStack spacing=\"3\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ DEFAULT_TITLE }\n\t\t\t\t\t\tdisabled={ isBusy }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t// eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts\n\t\t\t\t\t\t\t'Describe the template, e.g. \"Post with sidebar\". A custom template can be manually applied to any post or page.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ cancel }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tisBusy={ isBusy }\n\t\t\t\t\t\t\taria-disabled={ isBusy }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,SAAS,EAAEC,WAAW,QAAQ,mBAAmB;AAC1D,SACCC,KAAK,EACLC,WAAW,EACXC,M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,mCAAmC;MAC7CC,QAAQ,EAAGlB,MAAQ;MAAAgB,QAAA,eAEnBhC,KAAA,CAACT,MAAM;QAAC4C,OAAO,EAAC,GAAG;QAAAH,QAAA,gBAClBlC,IAAA,CAACZ,WAAW;UACXkD,qBAAqB;UACrBC,uBAAuB;UACvBC,KAAK,EAAG9C,EAAE,CAAE,MAAO,CAAG;UACtB+C,KAAK,EAAG5B,KAAO;UACf6B,QAAQ,EAAG5B,QAAU;UACrB6B,WAAW,EAAGxC,aAAe;UAC7ByC,QAAQ,EAAG7B,MAAQ;UACnB8B,IAAI,EAAGnD,EAAE;UACR;UACA,iHACD;QAAG,CACH,CAAC,eACFQ,KAAA,CAACX,MAAM;UAACuD,OAAO,EAAC,OAAO;UAAAZ,QAAA,gBACtBlC,IAAA,CAACX,MAAM;YACNiD,qBAAqB;YACrBS,OAAO,EAAC,UAAU;YAClBC,OAAO,EAAG/B,MAAQ;YAAAiB,QAAA,EAEhBxC,EAAE,CAAE,QAAS;UAAC,CACT,CAAC,eAETM,IAAA,CAACX,MAAM;YACNiD,qBAAqB;YACrBS,OAAO,EAAC,SAAS;YACjBE,IAAI,EAAC,QAAQ;YACblC,MAAM,EAAGA,MAAQ;YACjB,iBAAgBA,MAAQ;YAAAmB,QAAA,EAEtBxC,EAAE,CAAE,QAAS;UAAC,CACT,CAAC;QAAA,CACF,CAAC;MAAA,CACF;IAAC,CACJ;EAAC,CACD,CAAC;AAEV","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","useDispatch","useState","serialize","createBlock","Modal","TextControl","Button","__experimentalHStack","HStack","__experimentalVStack","VStack","__","cleanForSlug","unlock","store","editorStore","jsx","_jsx","jsxs","_jsxs","DEFAULT_TITLE","CreateNewTemplateModal","onClose","defaultBlockTemplate","onNavigateToEntityRecord","select","getEditorSettings","getCurrentTemplateId","getTemplateId","createTemplate","title","setTitle","isBusy","setIsBusy","cancel","submit","event","preventDefault","newTemplateContent","tagName","layout","inherit","newTemplate","slug","content","postId","id","postType","onRequestClose","focusOnMount","size","overlayClassName","children","className","onSubmit","spacing","__next40pxDefaultSize","__nextHasNoMarginBottom","label","value","onChange","placeholder","disabled","help","justify","variant","onClick","type"],"sources":["@wordpress/editor/src/components/post-template/create-new-template-modal.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { serialize, createBlock } from '@wordpress/blocks';\nimport {\n\tModal,\n\tTextControl,\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { cleanForSlug } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\n\nconst DEFAULT_TITLE = __( 'Custom Template' );\n\nexport default function CreateNewTemplateModal( { onClose } ) {\n\tconst { defaultBlockTemplate, onNavigateToEntityRecord } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditorSettings, getCurrentTemplateId } =\n\t\t\t\tselect( editorStore );\n\t\t\treturn {\n\t\t\t\tdefaultBlockTemplate: getEditorSettings().defaultBlockTemplate,\n\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\tgetEditorSettings().onNavigateToEntityRecord,\n\t\t\t\tgetTemplateId: getCurrentTemplateId,\n\t\t\t};\n\t\t}\n\t);\n\n\tconst { createTemplate } = unlock( useDispatch( editorStore ) );\n\n\tconst [ title, setTitle ] = useState( '' );\n\n\tconst [ isBusy, setIsBusy ] = useState( false );\n\n\tconst cancel = () => {\n\t\tsetTitle( '' );\n\t\tonClose();\n\t};\n\n\tconst submit = async ( event ) => {\n\t\tevent.preventDefault();\n\n\t\tif ( isBusy ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsBusy( true );\n\n\t\tconst newTemplateContent =\n\t\t\tdefaultBlockTemplate ??\n\t\t\tserialize( [\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{\n\t\t\t\t\t\ttagName: 'header',\n\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock( 'core/site-title' ),\n\t\t\t\t\t\tcreateBlock( 'core/site-tagline' ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t\t\tcreateBlock( 'core/separator' ),\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{\n\t\t\t\t\t\ttagName: 'main',\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t'core/group',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t[ createBlock( 'core/post-title' ) ]\n\t\t\t\t\t\t),\n\t\t\t\t\t\tcreateBlock( 'core/post-content', {\n\t\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t\t} ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t\t] );\n\n\t\tconst newTemplate = await createTemplate( {\n\t\t\tslug: cleanForSlug( title || DEFAULT_TITLE ),\n\t\t\tcontent: newTemplateContent,\n\t\t\ttitle: title || DEFAULT_TITLE,\n\t\t} );\n\n\t\tsetIsBusy( false );\n\t\tonNavigateToEntityRecord( {\n\t\t\tpostId: newTemplate.id,\n\t\t\tpostType: 'wp_template',\n\t\t} );\n\t\tcancel();\n\t};\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Create custom template' ) }\n\t\t\tonRequestClose={ cancel }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\tsize=\"small\"\n\t\t\toverlayClassName=\"editor-post-template__create-template-modal\"\n\t\t>\n\t\t\t<form\n\t\t\t\tclassName=\"editor-post-template__create-form\"\n\t\t\t\tonSubmit={ submit }\n\t\t\t>\n\t\t\t\t<VStack spacing=\"3\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ DEFAULT_TITLE }\n\t\t\t\t\t\tdisabled={ isBusy }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t// eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts\n\t\t\t\t\t\t\t'Describe the template, e.g. \"Post with sidebar\". A custom template can be manually applied to any post or page.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ cancel }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tisBusy={ isBusy }\n\t\t\t\t\t\t\taria-disabled={ isBusy }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,SAAS,EAAEC,WAAW,QAAQ,mBAAmB;AAC1D,SACCC,KAAK,EACLC,WAAW,EACXC,MAAM,EACNC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB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iB,QAAA,eAEnBjC,KAAA,CAACT,MAAM;QAAC6C,OAAO,EAAC,GAAG;QAAAH,QAAA,gBAClBnC,IAAA,CAACZ,WAAW;UACXmD,qBAAqB;UACrBC,uBAAuB;UACvBC,KAAK,EAAG/C,EAAE,CAAE,MAAO,CAAG;UACtBgD,KAAK,EAAG7B,KAAO;UACf8B,QAAQ,EAAG7B,QAAU;UACrB8B,WAAW,EAAGzC,aAAe;UAC7B0C,QAAQ,EAAG9B,MAAQ;UACnB+B,IAAI,EAAGpD,EAAE;UACR;UACA,iHACD;QAAG,CACH,CAAC,eACFQ,KAAA,CAACX,MAAM;UAACwD,OAAO,EAAC,OAAO;UAAAZ,QAAA,gBACtBnC,IAAA,CAACX,MAAM;YACNkD,qBAAqB;YACrBS,OAAO,EAAC,UAAU;YAClBC,OAAO,EAAGhC,MAAQ;YAAAkB,QAAA,EAEhBzC,EAAE,CAAE,QAAS;UAAC,CACT,CAAC,eAETM,IAAA,CAACX,MAAM;YACNkD,qBAAqB;YACrBS,OAAO,EAAC,SAAS;YACjBE,IAAI,EAAC,QAAQ;YACbnC,MAAM,EAAGA,MAAQ;YACjB,iBAAgBA,MAAQ;YAAAoB,QAAA,EAEtBzC,EAAE,CAAE,QAAS;UAAC,CACT,CAAC;QAAA,CACF,CAAC;MAAA,CACF;IAAC,CACJ;EAAC,CACD,CAAC;AAEV","ignoreList":[]}
@@ -13,9 +13,7 @@ import { useState } from '@wordpress/element';
13
13
  import CreateNewTemplateModal from './create-new-template-modal';
14
14
  import { useAllowSwitchingTemplates } from './hooks';
15
15
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
16
- export default function CreateNewTemplate({
17
- onClick
18
- }) {
16
+ export default function CreateNewTemplate() {
19
17
  const {
20
18
  canCreateTemplates
21
19
  } = useSelect(select => {
@@ -45,7 +43,6 @@ export default function CreateNewTemplate({
45
43
  }), isCreateModalOpen && /*#__PURE__*/_jsx(CreateNewTemplateModal, {
46
44
  onClose: () => {
47
45
  setIsCreateModalOpen(false);
48
- onClick();
49
46
  }
50
47
  })]
51
48
  });
@@ -1 +1 @@
1
- {"version":3,"names":["MenuItem","__","useSelect","store","coreStore","useState","CreateNewTemplateModal","useAllowSwitchingTemplates","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","CreateNewTemplate","onClick","canCreateTemplates","select","canUser","kind","name","isCreateModalOpen","setIsCreateModalOpen","allowSwitchingTemplate","children","onClose"],"sources":["@wordpress/editor/src/components/post-template/create-new-template.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport CreateNewTemplateModal from './create-new-template-modal';\nimport { useAllowSwitchingTemplates } from './hooks';\n\nexport default function CreateNewTemplate( { onClick } ) {\n\tconst { canCreateTemplates } = useSelect( ( select ) => {\n\t\tconst { canUser } = select( coreStore );\n\t\treturn {\n\t\t\tcanCreateTemplates: canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ),\n\t\t};\n\t}, [] );\n\tconst [ isCreateModalOpen, setIsCreateModalOpen ] = useState( false );\n\tconst allowSwitchingTemplate = useAllowSwitchingTemplates();\n\n\t// The default template in a post is indicated by an empty string.\n\tif ( ! canCreateTemplates || ! allowSwitchingTemplate ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<>\n\t\t\t<MenuItem\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetIsCreateModalOpen( true );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ __( 'Create new template' ) }\n\t\t\t</MenuItem>\n\n\t\t\t{ isCreateModalOpen && (\n\t\t\t\t<CreateNewTemplateModal\n\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\tsetIsCreateModalOpen( false );\n\t\t\t\t\t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iBAAiB,iBAClBZ,IAAA,CAACH,sBAAsB;MACtBmB,OAAO,EAAGA,CAAA,KAAM;QACfH,oBAAoB,CAAE,KAAM,CAAC;QAC7BP,OAAO,CAAC,CAAC;MACV;IAAG,CACH,CACD;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["MenuItem","__","useSelect","store","coreStore","useState","CreateNewTemplateModal","useAllowSwitchingTemplates","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","CreateNewTemplate","canCreateTemplates","select","canUser","kind","name","isCreateModalOpen","setIsCreateModalOpen","allowSwitchingTemplate","children","onClick","onClose"],"sources":["@wordpress/editor/src/components/post-template/create-new-template.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport CreateNewTemplateModal from './create-new-template-modal';\nimport { useAllowSwitchingTemplates } from './hooks';\n\nexport default function CreateNewTemplate() {\n\tconst { canCreateTemplates } = useSelect( ( select ) => {\n\t\tconst { canUser } = select( coreStore );\n\t\treturn {\n\t\t\tcanCreateTemplates: canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ),\n\t\t};\n\t}, [] );\n\tconst [ isCreateModalOpen, setIsCreateModalOpen ] = useState( false );\n\tconst allowSwitchingTemplate = useAllowSwitchingTemplates();\n\n\t// The default template in a post is indicated by an empty string.\n\tif ( ! canCreateTemplates || ! allowSwitchingTemplate ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<>\n\t\t\t<MenuItem\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetIsCreateModalOpen( true );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ __( 'Create new template' ) }\n\t\t\t</MenuItem>\n\n\t\t\t{ isCreateModalOpen && (\n\t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AA,EAEDtB,EAAE,CAAE,qBAAsB;IAAC,CACpB,CAAC,EAETmB,iBAAiB,iBAClBX,IAAA,CAACH,sBAAsB;MACtBmB,OAAO,EAAGA,CAAA,KAAM;QACfJ,oBAAoB,CAAE,KAAM,CAAC;MAC9B;IAAG,CACH,CACD;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
@@ -40,11 +40,9 @@ export default function PreviewDropdown({
40
40
  const {
41
41
  getDeviceType,
42
42
  getCurrentPostType,
43
- getCurrentTemplateId
44
- } = select(editorStore);
45
- const {
43
+ getCurrentTemplateId,
46
44
  getRenderingMode
47
- } = unlock(select(editorStore));
45
+ } = select(editorStore);
48
46
  const {
49
47
  getEntityRecord,
50
48
  getPostType
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","useViewportMatch","DropdownMenu","MenuGroup","MenuItem","MenuItemsChoice","VisuallyHidden","Icon","__","desktop","mobile","tablet","external","check","useSelect","useDispatch","store","coreStore","preferencesStore","ActionItem","editorStore","blockEditorStore","PostPreviewButton","unlock","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","PreviewDropdown","forceIsAutosaveable","disabled","deviceType","homeUrl","isTemplate","isViewable","showIconLabels","isTemplateHidden","templateId","select","_getPostType$viewable","getDeviceType","getCurrentPostType","getCurrentTemplateId","getRenderingMode","getEntityRecord","getPostType","get","_currentPostType","home","viewable","setDeviceType","setRenderingMode","setDefaultRenderingMode","resetZoomLevel","handleDevicePreviewChange","newDeviceType","isMobile","popoverProps","placement","toggleProps","className","iconPosition","size","showTooltip","accessibleWhenDisabled","menuProps","deviceIcons","choices","value","label","icon","toLowerCase","disableOpenOnArrowDown","children","onClose","onSelect","href","target","onClick","as","undefined","isSelected","role","newRenderingMode","textContent","onPreview","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\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":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SACCC,YAAY,EACZC,SAAS,EACTC,QAAQ,EACRC,eAAe,EACfC,cAAc,EACdC,IAAI,QACE,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,OAAO,EAAEC,MAAM,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,KAAK,QAAQ,kBAAkB;AAC3E,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASD,KAAK,IAAIE,gBAAgB,QAAQ,wBAAwB;AAClE,SAASC,UAAU,QAAQ,sBAAsB;;AAEjD;AACA;AACA;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IAAI,EAAG,CAAElC,gBAAgB,GAAGzB,KAAK,GAAGqE,SAAW;UAC/CC,UAAU,EAAG,CAAE7C,gBAAkB;UACjC8C,IAAI,EAAC,kBAAkB;UACvBJ,OAAO,EAAGA,CAAA,KAAM;YACf,MAAMK,gBAAgB,GAAG/C,gBAAgB,GACtC,iBAAiB,GACjB,WAAW;YACde,gBAAgB,CAAEgC,gBAAiB,CAAC;YACpC/B,uBAAuB,CAAE+B,gBAAiB,CAAC;UAC5C,CAAG;UAAAV,QAAA,EAEDnE,EAAE,CAAE,eAAgB;QAAC,CACd;MAAC,CACD,CACX,EACC4B,UAAU,iBACXX,IAAA,CAACtB,SAAS;QAAAwE,QAAA,eACTlD,IAAA,CAACH,iBAAiB;UACjBwC,SAAS,EAAC,0CAA0C;UACpDsB,IAAI,EAAC,UAAU;UACfrD,mBAAmB,EAAGA,mBAAqB;UAC3C,cAAavB,EAAE,CAAE,oBAAqB,CAAG;UACzC8E,WAAW,eACV3D,KAAA,CAAAE,SAAA;YAAA8C,QAAA,GACGnE,EAAE,CAAE,oBAAqB,CAAC,eAC5BiB,IAAA,CAAClB,IAAI;cAACiE,IAAI,EAAG5D;YAAU,CAAE,CAAC;UAAA,CACzB,CACF;UACD2E,SAAS,EAAGX;QAAS,CACrB;MAAC,CACQ,CACX,eACDnD,IAAA,CAACN,UAAU,CAACqE,IAAI;QACfC,IAAI,EAAC,0BAA0B;QAC/BC,SAAS,EAAG;UAAEV,OAAO,EAAEJ;QAAQ;MAAG,CAClC,CAAC;IAAA,CACD;EACF,CACY,CAAC;AAEjB","ignoreList":[]}
1
+ {"version":3,"names":["clsx","useViewportMatch","DropdownMenu","MenuGroup","MenuItem","MenuItemsChoice","VisuallyHidden","Icon","__","desktop","mobile","tablet","external","check","useSelect","useDispatch","store","coreStore","preferencesStore","ActionItem","editorStore","blockEditorStore","PostPreviewButton","unlock","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","PreviewDropdown","forceIsAutosaveable","disabled","deviceType","homeUrl","isTemplate","isViewable","showIconLabels","isTemplateHidden","templateId","select","_getPostType$viewable","getDeviceType","getCurrentPostType","getCurrentTemplateId","getRenderingMode","getEntityRecord","getPostType","get","_currentPostType","home","viewable","setDeviceType","setRenderingMode","setDefaultRenderingMode","resetZoomLevel","handleDevicePreviewChange","newDeviceType","isMobile","popoverProps","placement","toggleProps","className","iconPosition","size","showTooltip","accessibleWhenDisabled","menuProps","deviceIcons","choices","value","label","icon","toLowerCase","disableOpenOnArrowDown","children","onClose","onSelect","href","target","onClick","as","undefined","isSelected","role","newRenderingMode","textContent","onPreview","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</Drop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EAAGX;QAAS,CACrB;MAAC,CACQ,CACX,eACDnD,IAAA,CAACN,UAAU,CAACqE,IAAI;QACfC,IAAI,EAAC,0BAA0B;QAC/BC,SAAS,EAAG;UAAEV,OAAO,EAAEJ;QAAQ;MAAG,CAClC,CAAC;IAAA,CACD;EACF,CACY,CAAC;AAEjB","ignoreList":[]}
@@ -2042,6 +2042,10 @@ body.is-fullscreen-mode .interface-interface-skeleton {
2042
2042
  z-index: 1000001;
2043
2043
  }
2044
2044
 
2045
+ .editor-post-template__create-template-modal {
2046
+ z-index: 1000001;
2047
+ }
2048
+
2045
2049
  .editor-post-template__swap-template-modal-content .block-editor-block-patterns-list {
2046
2050
  column-count: 2;
2047
2051
  column-gap: 24px;
@@ -2042,6 +2042,10 @@ body.is-fullscreen-mode .interface-interface-skeleton {
2042
2042
  z-index: 1000001;
2043
2043
  }
2044
2044
 
2045
+ .editor-post-template__create-template-modal {
2046
+ z-index: 1000001;
2047
+ }
2048
+
2045
2049
  .editor-post-template__swap-template-modal-content .block-editor-block-patterns-list {
2046
2050
  column-count: 2;
2047
2051
  column-gap: 24px;
@@ -10,7 +10,7 @@ export default PluginPrePublishPanel;
10
10
  * When no title is provided it is always opened.
11
11
  * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/)
12
12
  * icon slug string, or an SVG WP element, to be rendered when
13
- * the sidebar is pinned to toolbar.
13
+ * the sidebar is pinned to toolbar. If `false` is passed, no icon will be rendered.
14
14
  * @param {React.ReactNode} props.children Children to be rendered
15
15
  *
16
16
  * @example
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/post-status/index.js"],"names":[],"mappings":"AAmFA,yEAkMC;AArOD;;;;IA0BE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/post-status/index.js"],"names":[],"mappings":"AAmFA,yEAuMC;AA1OD;;;;IA0BE"}
@@ -1 +1 @@
1
- {"version":3,"file":"block-theme.d.ts","sourceRoot":"","sources":["../../../src/components/post-template/block-theme.js"],"names":[],"mappings":"AA2BA;;uCA6IC"}
1
+ {"version":3,"file":"block-theme.d.ts","sourceRoot":"","sources":["../../../src/components/post-template/block-theme.js"],"names":[],"mappings":"AA2BA;;uCA2IC"}
@@ -1 +1 @@
1
- {"version":3,"file":"create-new-template-modal.d.ts","sourceRoot":"","sources":["../../../src/components/post-template/create-new-template-modal.js"],"names":[],"mappings":"AAwBA;;gCAmIC"}
1
+ {"version":3,"file":"create-new-template-modal.d.ts","sourceRoot":"","sources":["../../../src/components/post-template/create-new-template-modal.js"],"names":[],"mappings":"AAwBA;;gCAoIC"}
@@ -1,4 +1,2 @@
1
- export default function CreateNewTemplate({ onClick }: {
2
- onClick: any;
3
- }): import("react").JSX.Element | null;
1
+ export default function CreateNewTemplate(): import("react").JSX.Element | null;
4
2
  //# sourceMappingURL=create-new-template.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-new-template.d.ts","sourceRoot":"","sources":["../../../src/components/post-template/create-new-template.js"],"names":[],"mappings":"AAeA;;uCAqCC"}
1
+ {"version":3,"file":"create-new-template.d.ts","sourceRoot":"","sources":["../../../src/components/post-template/create-new-template.js"],"names":[],"mappings":"AAeA,gFAoCC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/preview-dropdown/index.js"],"names":[],"mappings":"AAgCA;;;uCAwKC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/preview-dropdown/index.js"],"names":[],"mappings":"AAgCA;;;uCA2KC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/editor",
3
- "version": "14.20.0",
3
+ "version": "14.21.0",
4
4
  "description": "Enhanced block editor for WordPress posts.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -34,41 +34,41 @@
34
34
  ],
35
35
  "dependencies": {
36
36
  "@babel/runtime": "7.25.7",
37
- "@wordpress/a11y": "^4.20.0",
38
- "@wordpress/api-fetch": "^7.20.0",
39
- "@wordpress/blob": "^4.20.0",
40
- "@wordpress/block-editor": "^14.15.0",
41
- "@wordpress/blocks": "^14.9.0",
42
- "@wordpress/commands": "^1.20.0",
43
- "@wordpress/components": "^29.6.0",
44
- "@wordpress/compose": "^7.20.0",
45
- "@wordpress/core-data": "^7.20.0",
46
- "@wordpress/data": "^10.20.0",
47
- "@wordpress/dataviews": "^4.16.0",
48
- "@wordpress/date": "^5.20.0",
49
- "@wordpress/deprecated": "^4.20.0",
50
- "@wordpress/dom": "^4.20.0",
51
- "@wordpress/element": "^6.20.0",
52
- "@wordpress/fields": "^0.12.0",
53
- "@wordpress/hooks": "^4.20.0",
54
- "@wordpress/html-entities": "^4.20.0",
55
- "@wordpress/i18n": "^5.20.0",
56
- "@wordpress/icons": "^10.20.0",
57
- "@wordpress/interface": "^9.5.0",
58
- "@wordpress/keyboard-shortcuts": "^5.20.0",
59
- "@wordpress/keycodes": "^4.20.0",
60
- "@wordpress/media-utils": "^5.20.0",
61
- "@wordpress/notices": "^5.20.0",
62
- "@wordpress/patterns": "^2.20.0",
63
- "@wordpress/plugins": "^7.20.0",
64
- "@wordpress/preferences": "^4.20.0",
65
- "@wordpress/private-apis": "^1.20.0",
66
- "@wordpress/reusable-blocks": "^5.20.0",
67
- "@wordpress/rich-text": "^7.20.0",
68
- "@wordpress/server-side-render": "^5.20.0",
69
- "@wordpress/url": "^4.20.0",
70
- "@wordpress/warning": "^3.20.0",
71
- "@wordpress/wordcount": "^4.20.0",
37
+ "@wordpress/a11y": "^4.21.0",
38
+ "@wordpress/api-fetch": "^7.21.0",
39
+ "@wordpress/blob": "^4.21.0",
40
+ "@wordpress/block-editor": "^14.16.0",
41
+ "@wordpress/blocks": "^14.10.0",
42
+ "@wordpress/commands": "^1.21.0",
43
+ "@wordpress/components": "^29.7.0",
44
+ "@wordpress/compose": "^7.21.0",
45
+ "@wordpress/core-data": "^7.21.0",
46
+ "@wordpress/data": "^10.21.0",
47
+ "@wordpress/dataviews": "^4.17.0",
48
+ "@wordpress/date": "^5.21.0",
49
+ "@wordpress/deprecated": "^4.21.0",
50
+ "@wordpress/dom": "^4.21.0",
51
+ "@wordpress/element": "^6.21.0",
52
+ "@wordpress/fields": "^0.13.0",
53
+ "@wordpress/hooks": "^4.21.0",
54
+ "@wordpress/html-entities": "^4.21.0",
55
+ "@wordpress/i18n": "^5.21.0",
56
+ "@wordpress/icons": "^10.21.0",
57
+ "@wordpress/interface": "^9.6.0",
58
+ "@wordpress/keyboard-shortcuts": "^5.21.0",
59
+ "@wordpress/keycodes": "^4.21.0",
60
+ "@wordpress/media-utils": "^5.21.0",
61
+ "@wordpress/notices": "^5.21.0",
62
+ "@wordpress/patterns": "^2.21.0",
63
+ "@wordpress/plugins": "^7.21.0",
64
+ "@wordpress/preferences": "^4.21.0",
65
+ "@wordpress/private-apis": "^1.21.0",
66
+ "@wordpress/reusable-blocks": "^5.21.0",
67
+ "@wordpress/rich-text": "^7.21.0",
68
+ "@wordpress/server-side-render": "^5.21.0",
69
+ "@wordpress/url": "^4.21.0",
70
+ "@wordpress/warning": "^3.21.0",
71
+ "@wordpress/wordcount": "^4.21.0",
72
72
  "change-case": "^4.1.2",
73
73
  "client-zip": "^2.4.5",
74
74
  "clsx": "^2.1.1",
@@ -88,5 +88,5 @@
88
88
  "publishConfig": {
89
89
  "access": "public"
90
90
  },
91
- "gitHead": "72476970386146d450c375e5c71a96dda7c9aaa8"
91
+ "gitHead": "104af00f9abcd7a4d36b87e648f148c72cc4ea5f"
92
92
  }
@@ -17,7 +17,7 @@ const { Fill, Slot } = createSlotFill( 'PluginPrePublishPanel' );
17
17
  * When no title is provided it is always opened.
18
18
  * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/)
19
19
  * icon slug string, or an SVG WP element, to be rendered when
20
- * the sidebar is pinned to toolbar.
20
+ * the sidebar is pinned to toolbar. If `false` is passed, no icon will be rendered.
21
21
  * @param {React.ReactNode} props.children Children to be rendered
22
22
  *
23
23
  * @example
@@ -194,7 +194,12 @@ export default function PostStatus() {
194
194
  title={ __( 'Status & visibility' ) }
195
195
  onClose={ onClose }
196
196
  />
197
- <form>
197
+ <form
198
+ onSubmit={ ( event ) => {
199
+ event.preventDefault();
200
+ onClose();
201
+ } }
202
+ >
198
203
  <VStack spacing={ 4 }>
199
204
  <RadioControl
200
205
  className="editor-change-status__options"
@@ -141,9 +141,7 @@ export default function BlockThemeControl( { id } ) {
141
141
 
142
142
  <SwapTemplateButton onClick={ onClose } />
143
143
  <ResetDefaultTemplate onClick={ onClose } />
144
- { canCreateTemplate && (
145
- <CreateNewTemplate onClick={ onClose } />
146
- ) }
144
+ { canCreateTemplate && <CreateNewTemplate /> }
147
145
  </MenuGroup>
148
146
  <MenuGroup>
149
147
  <MenuItem
@@ -111,6 +111,7 @@ export default function CreateNewTemplateModal( { onClose } ) {
111
111
  onRequestClose={ cancel }
112
112
  focusOnMount="firstContentElement"
113
113
  size="small"
114
+ overlayClassName="editor-post-template__create-template-modal"
114
115
  >
115
116
  <form
116
117
  className="editor-post-template__create-form"
@@ -13,7 +13,7 @@ import { useState } from '@wordpress/element';
13
13
  import CreateNewTemplateModal from './create-new-template-modal';
14
14
  import { useAllowSwitchingTemplates } from './hooks';
15
15
 
16
- export default function CreateNewTemplate( { onClick } ) {
16
+ export default function CreateNewTemplate() {
17
17
  const { canCreateTemplates } = useSelect( ( select ) => {
18
18
  const { canUser } = select( coreStore );
19
19
  return {
@@ -44,7 +44,6 @@ export default function CreateNewTemplate( { onClick } ) {
44
44
  <CreateNewTemplateModal
45
45
  onClose={ () => {
46
46
  setIsCreateModalOpen( false );
47
- onClick();
48
47
  } }
49
48
  />
50
49
  ) }
@@ -2,6 +2,10 @@
2
2
  z-index: z-index(".editor-post-template__swap-template-modal");
3
3
  }
4
4
 
5
+ .editor-post-template__create-template-modal {
6
+ z-index: z-index(".editor-post-template__create-template-modal");
7
+ }
8
+
5
9
  .editor-post-template__swap-template-modal-content .block-editor-block-patterns-list {
6
10
  column-count: 2;
7
11
  column-gap: $grid-unit-30;
@@ -40,9 +40,12 @@ export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
40
40
  isTemplateHidden,
41
41
  templateId,
42
42
  } = useSelect( ( select ) => {
43
- const { getDeviceType, getCurrentPostType, getCurrentTemplateId } =
44
- select( editorStore );
45
- const { getRenderingMode } = unlock( select( editorStore ) );
43
+ const {
44
+ getDeviceType,
45
+ getCurrentPostType,
46
+ getCurrentTemplateId,
47
+ getRenderingMode,
48
+ } = select( editorStore );
46
49
  const { getEntityRecord, getPostType } = select( coreStore );
47
50
  const { get } = select( preferencesStore );
48
51
  const _currentPostType = getCurrentPostType();