@wordpress/editor 14.20.0 → 14.22.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 (65) hide show
  1. package/CHANGELOG.md +4 -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-actions/set-as-homepage.js +1 -0
  6. package/build/components/post-actions/set-as-homepage.js.map +1 -1
  7. package/build/components/post-actions/set-as-posts-page.js +1 -0
  8. package/build/components/post-actions/set-as-posts-page.js.map +1 -1
  9. package/build/components/post-status/index.js +4 -0
  10. package/build/components/post-status/index.js.map +1 -1
  11. package/build/components/post-template/block-theme.js +1 -3
  12. package/build/components/post-template/block-theme.js.map +1 -1
  13. package/build/components/post-template/create-new-template-modal.js +7 -2
  14. package/build/components/post-template/create-new-template-modal.js.map +1 -1
  15. package/build/components/post-template/create-new-template.js +1 -4
  16. package/build/components/post-template/create-new-template.js.map +1 -1
  17. package/build/components/preview-dropdown/index.js +2 -4
  18. package/build/components/preview-dropdown/index.js.map +1 -1
  19. package/build/components/start-page-options/index.js +2 -1
  20. package/build/components/start-page-options/index.js.map +1 -1
  21. package/build-module/components/plugin-pre-publish-panel/index.js +1 -1
  22. package/build-module/components/plugin-pre-publish-panel/index.js.map +1 -1
  23. package/build-module/components/post-actions/set-as-homepage.js +1 -0
  24. package/build-module/components/post-actions/set-as-homepage.js.map +1 -1
  25. package/build-module/components/post-actions/set-as-posts-page.js +1 -0
  26. package/build-module/components/post-actions/set-as-posts-page.js.map +1 -1
  27. package/build-module/components/post-status/index.js +4 -0
  28. package/build-module/components/post-status/index.js.map +1 -1
  29. package/build-module/components/post-template/block-theme.js +1 -3
  30. package/build-module/components/post-template/block-theme.js.map +1 -1
  31. package/build-module/components/post-template/create-new-template-modal.js +7 -2
  32. package/build-module/components/post-template/create-new-template-modal.js.map +1 -1
  33. package/build-module/components/post-template/create-new-template.js +1 -4
  34. package/build-module/components/post-template/create-new-template.js.map +1 -1
  35. package/build-module/components/preview-dropdown/index.js +2 -4
  36. package/build-module/components/preview-dropdown/index.js.map +1 -1
  37. package/build-module/components/start-page-options/index.js +2 -1
  38. package/build-module/components/start-page-options/index.js.map +1 -1
  39. package/build-style/style-rtl.css +5 -0
  40. package/build-style/style.css +5 -0
  41. package/build-types/components/plugin-pre-publish-panel/index.d.ts +1 -1
  42. package/build-types/components/post-actions/set-as-homepage.d.ts +1 -0
  43. package/build-types/components/post-actions/set-as-homepage.d.ts.map +1 -1
  44. package/build-types/components/post-actions/set-as-posts-page.d.ts +1 -0
  45. package/build-types/components/post-actions/set-as-posts-page.d.ts.map +1 -1
  46. package/build-types/components/post-status/index.d.ts.map +1 -1
  47. package/build-types/components/post-template/block-theme.d.ts.map +1 -1
  48. package/build-types/components/post-template/create-new-template-modal.d.ts.map +1 -1
  49. package/build-types/components/post-template/create-new-template.d.ts +1 -3
  50. package/build-types/components/post-template/create-new-template.d.ts.map +1 -1
  51. package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
  52. package/build-types/components/start-page-options/index.d.ts.map +1 -1
  53. package/package.json +37 -37
  54. package/src/components/plugin-pre-publish-panel/index.js +1 -1
  55. package/src/components/post-actions/set-as-homepage.js +1 -0
  56. package/src/components/post-actions/set-as-posts-page.js +1 -0
  57. package/src/components/post-publish-panel/style.scss +1 -0
  58. package/src/components/post-status/index.js +6 -1
  59. package/src/components/post-template/block-theme.js +1 -3
  60. package/src/components/post-template/create-new-template-modal.js +7 -2
  61. package/src/components/post-template/create-new-template.js +1 -2
  62. package/src/components/post-template/style.scss +4 -0
  63. package/src/components/preview-dropdown/index.js +6 -3
  64. package/src/components/start-page-options/index.js +3 -1
  65. package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 14.22.0 (2025-04-11)
6
+
7
+ ## 14.21.0 (2025-03-27)
8
+
5
9
  ## 14.20.0 (2025-03-13)
6
10
 
7
11
  ## 14.19.0 (2025-02-28)
package/README.md CHANGED
@@ -858,7 +858,7 @@ _Parameters_
858
858
  - _props.className_ `[string]`: An optional class name added to the panel.
859
859
  - _props.title_ `[string]`: Title displayed at the top of the panel.
860
860
  - _props.initialOpen_ `[boolean]`: Whether to have the panel initially opened. When no title is provided it is always opened.
861
- - _props.icon_ `[WPBlockTypeIconRender]`: The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
861
+ - _props.icon_ `[WPBlockTypeIconRender]`: The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar. If `false` is passed, no icon will be rendered.
862
862
  - _props.children_ `React.ReactNode`: Children to be rendered
863
863
 
864
864
  _Returns_
@@ -27,7 +27,7 @@ const {
27
27
  * When no title is provided it is always opened.
28
28
  * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/)
29
29
  * icon slug string, or an SVG WP element, to be rendered when
30
- * the sidebar is pinned to toolbar.
30
+ * the sidebar is pinned to toolbar. If `false` is passed, no icon will be rendered.
31
31
  * @param {React.ReactNode} props.children Children to be rendered
32
32
  *
33
33
  * @example
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_plugins","_jsxRuntime","Fill","Slot","createSlotFill","PluginPrePublishPanel","children","className","title","initialOpen","icon","pluginIcon","usePluginContext","jsx","PanelBody","_default","exports","default"],"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":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAAsD,IAAAE,WAAA,GAAAF,OAAA;AAJtD;AACA;AACA;;AAIA,MAAM;EAAEG,IAAI;EAAEC;AAAK,CAAC,GAAG,IAAAC,0BAAc,EAAE,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,MAAMC,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,GAAG,IAAAC,yBAAgB,EAAC,CAAC;EAE/C,oBACC,IAAAX,WAAA,CAAAY,GAAA,EAACX,IAAI;IAAAI,QAAA,eACJ,IAAAL,WAAA,CAAAY,GAAA,EAACf,WAAA,CAAAgB,SAAS;MACTP,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,CAACF,IAAI,GAAGA,IAAI;AAAC,IAAAY,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEnBZ,qBAAqB","ignoreList":[]}
1
+ {"version":3,"names":["_components","require","_plugins","_jsxRuntime","Fill","Slot","createSlotFill","PluginPrePublishPanel","children","className","title","initialOpen","icon","pluginIcon","usePluginContext","jsx","PanelBody","_default","exports","default"],"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":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAAsD,IAAAE,WAAA,GAAAF,OAAA;AAJtD;AACA;AACA;;AAIA,MAAM;EAAEG,IAAI;EAAEC;AAAK,CAAC,GAAG,IAAAC,0BAAc,EAAE,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,MAAMC,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,GAAG,IAAAC,yBAAgB,EAAC,CAAC;EAE/C,oBACC,IAAAX,WAAA,CAAAY,GAAA,EAACX,IAAI;IAAAI,QAAA,eACJ,IAAAL,WAAA,CAAAY,GAAA,EAACf,WAAA,CAAAgB,SAAS;MACTP,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,CAACF,IAAI,GAAGA,IAAI;AAAC,IAAAY,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEnBZ,qBAAqB","ignoreList":[]}
@@ -152,6 +152,7 @@ const useSetAsHomepageAction = () => {
152
152
  }
153
153
  return true;
154
154
  },
155
+ modalFocusOnMount: 'firstContentElement',
155
156
  RenderModal: SetAsHomepageModal
156
157
  }), [pageForPosts, pageOnFront]);
157
158
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_element","_components","_data","_coreData","_notices","_getItemTitle","_jsxRuntime","SetAsHomepageModal","items","closeModal","item","pageTitle","getItemTitle","showOnFront","currentHomePage","isSaving","useSelect","select","getEntityRecord","isSavingEntityRecord","coreStore","siteSettings","currentHomePageItem","page_on_front","show_on_front","saveEntityRecord","useDispatch","createSuccessNotice","createErrorNotice","noticesStore","onSetPageAsHomepage","event","preventDefault","id","__","type","error","errorMessage","message","code","modalWarning","sprintf","modalText","trim","modalButtonLabel","jsx","onSubmit","children","jsxs","__experimentalVStack","spacing","__experimentalText","__experimentalHStack","justify","Button","__next40pxDefaultSize","variant","onClick","disabled","accessibleWhenDisabled","useSetAsHomepageAction","pageOnFront","pageForPosts","canUser","kind","name","undefined","page_for_posts","useMemo","label","isEligible","post","status","RenderModal","exports"],"sources":["@wordpress/editor/src/components/post-actions/set-as-homepage.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport {\n\tButton,\n\t__experimentalText as Text,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { getItemTitle } from '../../utils/get-item-title';\n\nconst SetAsHomepageModal = ( { items, closeModal } ) => {\n\tconst [ item ] = items;\n\tconst pageTitle = getItemTitle( item );\n\tconst { showOnFront, currentHomePage, isSaving } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, isSavingEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\t\t\tconst currentHomePageItem = getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'page',\n\t\t\t\tsiteSettings?.page_on_front\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tshowOnFront: siteSettings?.show_on_front,\n\t\t\t\tcurrentHomePage: currentHomePageItem,\n\t\t\t\tisSaving: isSavingEntityRecord( 'root', 'site' ),\n\t\t\t};\n\t\t}\n\t);\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tasync function onSetPageAsHomepage( event ) {\n\t\tevent.preventDefault();\n\n\t\ttry {\n\t\t\tawait saveEntityRecord( 'root', 'site', {\n\t\t\t\tpage_on_front: item.id,\n\t\t\t\tshow_on_front: 'page',\n\t\t\t} );\n\n\t\t\tcreateSuccessNotice( __( 'Homepage updated.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while setting the homepage.' );\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t} finally {\n\t\t\tcloseModal?.();\n\t\t}\n\t}\n\n\tlet modalWarning = '';\n\tif ( 'posts' === showOnFront ) {\n\t\tmodalWarning = __(\n\t\t\t'This will replace the current homepage which is set to display latest posts.'\n\t\t);\n\t} else if ( currentHomePage ) {\n\t\tmodalWarning = sprintf(\n\t\t\t// translators: %s: title of the current home page.\n\t\t\t__( 'This will replace the current homepage: \"%s\"' ),\n\t\t\tgetItemTitle( currentHomePage )\n\t\t);\n\t}\n\n\tconst modalText = sprintf(\n\t\t// translators: %1$s: title of the page to be set as the homepage, %2$s: homepage replacement warning message.\n\t\t__( 'Set \"%1$s\" as the site homepage? %2$s' ),\n\t\tpageTitle,\n\t\tmodalWarning\n\t).trim();\n\n\t// translators: Button label to confirm setting the specified page as the homepage.\n\tconst modalButtonLabel = __( 'Set homepage' );\n\n\treturn (\n\t\t<form onSubmit={ onSetPageAsHomepage }>\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<Text>{ modalText }</Text>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tcloseModal?.();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tdisabled={ isSaving }\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\tdisabled={ isSaving }\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t>\n\t\t\t\t\t\t{ modalButtonLabel }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t</form>\n\t);\n};\n\nexport const useSetAsHomepageAction = () => {\n\tconst { pageOnFront, pageForPosts } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, canUser } = select( coreStore );\n\t\tconst siteSettings = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\t\treturn {\n\t\t\tpageOnFront: siteSettings?.page_on_front,\n\t\t\tpageForPosts: siteSettings?.page_for_posts,\n\t\t};\n\t} );\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'set-as-homepage',\n\t\t\tlabel: __( 'Set as homepage' ),\n\t\t\tisEligible( post ) {\n\t\t\t\tif ( post.status !== 'publish' ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tif ( post.type !== 'page' ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\t// Don't show the action if the page is already set as the homepage.\n\t\t\t\tif ( pageOnFront === post.id ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\t// Don't show the action if the page is already set as the page for posts.\n\t\t\t\tif ( pageForPosts === post.id ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\tRenderModal: SetAsHomepageModal,\n\t\t} ),\n\t\t[ pageForPosts, pageOnFront ]\n\t);\n};\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAA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AC,gBAAO,EACb,OAAQ;IACPnC,EAAE,EAAE,iBAAiB;IACrBoC,KAAK,EAAE,IAAAnC,QAAE,EAAE,iBAAkB,CAAC;IAC9BoC,UAAUA,CAAEC,IAAI,EAAG;MAClB,IAAKA,IAAI,CAACC,MAAM,KAAK,SAAS,EAAG;QAChC,OAAO,KAAK;MACb;MAEA,IAAKD,IAAI,CAACpC,IAAI,KAAK,MAAM,EAAG;QAC3B,OAAO,KAAK;MACb;;MAEA;MACA,IAAK0B,WAAW,KAAKU,IAAI,CAACtC,EAAE,EAAG;QAC9B,OAAO,KAAK;MACb;;MAEA;MACA,IAAK6B,YAAY,KAAKS,IAAI,CAACtC,EAAE,EAAG;QAC/B,OAAO,KAAK;MACb;MAEA,OAAO,IAAI;IACZ,CAAC;IACDwC,WAAW,EAAElE;EACd,CAAC,CAAE,EACH,CAAEuD,YAAY,EAAED,WAAW,CAC5B,CAAC;AACF,CAAC;AAACa,OAAA,CAAAd,sBAAA,GAAAA,sBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_element","_components","_data","_coreData","_notices","_getItemTitle","_jsxRuntime","SetAsHomepageModal","items","closeModal","item","pageTitle","getItemTitle","showOnFront","currentHomePage","isSaving","useSelect","select","getEntityRecord","isSavingEntityRecord","coreStore","siteSettings","currentHomePageItem","page_on_front","show_on_front","saveEntityRecord","useDispatch","createSuccessNotice","createErrorNotice","noticesStore","onSetPageAsHomepage","event","preventDefault","id","__","type","error","errorMessage","message","code","modalWarning","sprintf","modalText","trim","modalButtonLabel","jsx","onSubmit","children","jsxs","__experimentalVStack","spacing","__experimentalText","__experimentalHStack","justify","Button","__next40pxDefaultSize","variant","onClick","disabled","accessibleWhenDisabled","useSetAsHomepageAction","pageOnFront","pageForPosts","canUser","kind","name","undefined","page_for_posts","useMemo","label","isEligible","post","status","modalFocusOnMount","RenderModal","exports"],"sources":["@wordpress/editor/src/components/post-actions/set-as-homepage.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport {\n\tButton,\n\t__experimentalText as Text,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { getItemTitle } from '../../utils/get-item-title';\n\nconst SetAsHomepageModal = ( { items, closeModal } ) => {\n\tconst [ item ] = items;\n\tconst pageTitle = getItemTitle( item );\n\tconst { showOnFront, currentHomePage, isSaving } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, isSavingEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\t\t\tconst currentHomePageItem = getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'page',\n\t\t\t\tsiteSettings?.page_on_front\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tshowOnFront: siteSettings?.show_on_front,\n\t\t\t\tcurrentHomePage: currentHomePageItem,\n\t\t\t\tisSaving: isSavingEntityRecord( 'root', 'site' ),\n\t\t\t};\n\t\t}\n\t);\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tasync function onSetPageAsHomepage( event ) {\n\t\tevent.preventDefault();\n\n\t\ttry {\n\t\t\tawait saveEntityRecord( 'root', 'site', {\n\t\t\t\tpage_on_front: item.id,\n\t\t\t\tshow_on_front: 'page',\n\t\t\t} );\n\n\t\t\tcreateSuccessNotice( __( 'Homepage updated.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while setting the homepage.' );\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t} finally {\n\t\t\tcloseModal?.();\n\t\t}\n\t}\n\n\tlet modalWarning = '';\n\tif ( 'posts' === showOnFront ) {\n\t\tmodalWarning = __(\n\t\t\t'This will replace the current homepage which is set to display latest posts.'\n\t\t);\n\t} else if ( currentHomePage ) {\n\t\tmodalWarning = sprintf(\n\t\t\t// translators: %s: title of the current home page.\n\t\t\t__( 'This will replace the current homepage: \"%s\"' ),\n\t\t\tgetItemTitle( currentHomePage )\n\t\t);\n\t}\n\n\tconst modalText = sprintf(\n\t\t// translators: %1$s: title of the page to be set as the homepage, %2$s: homepage replacement warning message.\n\t\t__( 'Set \"%1$s\" as the site homepage? %2$s' ),\n\t\tpageTitle,\n\t\tmodalWarning\n\t).trim();\n\n\t// translators: Button label to confirm setting the specified page as the homepage.\n\tconst modalButtonLabel = __( 'Set homepage' );\n\n\treturn (\n\t\t<form onSubmit={ onSetPageAsHomepage }>\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<Text>{ modalText }</Text>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tcloseModal?.();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tdisabled={ isSaving }\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\tdisabled={ isSaving }\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t>\n\t\t\t\t\t\t{ modalButtonLabel }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t</form>\n\t);\n};\n\nexport const useSetAsHomepageAction = () => {\n\tconst { pageOnFront, pageForPosts } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, canUser } = select( coreStore );\n\t\tconst siteSettings = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\t\treturn {\n\t\t\tpageOnFront: siteSettings?.page_on_front,\n\t\t\tpageForPosts: siteSettings?.page_for_posts,\n\t\t};\n\t} );\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'set-as-homepage',\n\t\t\tlabel: __( 'Set as homepage' ),\n\t\t\tisEligible( post ) {\n\t\t\t\tif ( post.status !== 'publish' ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tif ( post.type !== 'page' ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\t// Don't show the action if the page is already set as the homepage.\n\t\t\t\tif ( pageOnFront === post.id ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\t// Don't show the action if the page is already set as the page for posts.\n\t\t\t\tif ( pageForPosts === post.id ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\tmodalFocusOnMount: 'firstContentElement',\n\t\t\tRenderModal: SetAsHomepageModal,\n\t\t} ),\n\t\t[ pageForPosts, pageOnFront ]\n\t);\n};\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAMA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,aAAA,GAAAN,OAAA;AAA0D,IAAAO,WAAA,GAAAP,OAAA;AAlB1D;AACA;AACA;;AAaA;AACA;AACA;;AAGA,MAAMQ,kBAAk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MAEA;MACA,IAAK0B,WAAW,KAAKU,IAAI,CAACtC,EAAE,EAAG;QAC9B,OAAO,KAAK;MACb;;MAEA;MACA,IAAK6B,YAAY,KAAKS,IAAI,CAACtC,EAAE,EAAG;QAC/B,OAAO,KAAK;MACb;MAEA,OAAO,IAAI;IACZ,CAAC;IACDwC,iBAAiB,EAAE,qBAAqB;IACxCC,WAAW,EAAEnE;EACd,CAAC,CAAE,EACH,CAAEuD,YAAY,EAAED,WAAW,CAC5B,CAAC;AACF,CAAC;AAACc,OAAA,CAAAf,sBAAA,GAAAA,sBAAA","ignoreList":[]}
@@ -147,6 +147,7 @@ const useSetAsPostsPageAction = () => {
147
147
  }
148
148
  return true;
149
149
  },
150
+ modalFocusOnMount: 'firstContentElement',
150
151
  RenderModal: SetAsPostsPageModal
151
152
  }), [pageForPosts, pageOnFront]);
152
153
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_element","_components","_data","_coreData","_notices","_getItemTitle","_jsxRuntime","SetAsPostsPageModal","items","closeModal","item","pageTitle","getItemTitle","currentPostsPage","isPageForPostsSet","isSaving","useSelect","select","getEntityRecord","isSavingEntityRecord","coreStore","siteSettings","currentPostsPageItem","page_for_posts","saveEntityRecord","useDispatch","createSuccessNotice","createErrorNotice","noticesStore","onSetPageAsPostsPage","event","preventDefault","id","show_on_front","__","type","error","errorMessage","message","code","modalWarning","sprintf","modalText","modalButtonLabel","jsx","onSubmit","children","jsxs","__experimentalVStack","spacing","__experimentalText","__experimentalHStack","justify","Button","__next40pxDefaultSize","variant","onClick","disabled","accessibleWhenDisabled","useSetAsPostsPageAction","pageOnFront","pageForPosts","canUser","kind","name","undefined","page_on_front","useMemo","label","isEligible","post","status","RenderModal","exports"],"sources":["@wordpress/editor/src/components/post-actions/set-as-posts-page.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport {\n\tButton,\n\t__experimentalText as Text,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { getItemTitle } from '../../utils/get-item-title';\n\nconst SetAsPostsPageModal = ( { items, closeModal } ) => {\n\tconst [ item ] = items;\n\tconst pageTitle = getItemTitle( item );\n\tconst { currentPostsPage, isPageForPostsSet, isSaving } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, isSavingEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\t\t\tconst currentPostsPageItem = getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'page',\n\t\t\t\tsiteSettings?.page_for_posts\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tcurrentPostsPage: currentPostsPageItem,\n\t\t\t\tisPageForPostsSet: siteSettings?.page_for_posts !== 0,\n\t\t\t\tisSaving: isSavingEntityRecord( 'root', 'site' ),\n\t\t\t};\n\t\t}\n\t);\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tasync function onSetPageAsPostsPage( event ) {\n\t\tevent.preventDefault();\n\n\t\ttry {\n\t\t\tawait saveEntityRecord( 'root', 'site', {\n\t\t\t\tpage_for_posts: item.id,\n\t\t\t\tshow_on_front: 'page',\n\t\t\t} );\n\n\t\t\tcreateSuccessNotice( __( 'Posts page updated.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while setting the posts page.' );\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t} finally {\n\t\t\tcloseModal?.();\n\t\t}\n\t}\n\n\tconst modalWarning =\n\t\tisPageForPostsSet && currentPostsPage\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %s: title of the current posts page.\n\t\t\t\t\t__( 'This will replace the current posts page: \"%s\"' ),\n\t\t\t\t\tgetItemTitle( currentPostsPage )\n\t\t\t )\n\t\t\t: __( 'This page will show the latest posts.' );\n\n\tconst modalText = sprintf(\n\t\t// translators: %1$s: title of the page to be set as the posts page, %2$s: posts page replacement warning message.\n\t\t__( 'Set \"%1$s\" as the posts page? %2$s' ),\n\t\tpageTitle,\n\t\tmodalWarning\n\t);\n\n\t// translators: Button label to confirm setting the specified page as the posts page.\n\tconst modalButtonLabel = __( 'Set posts page' );\n\n\treturn (\n\t\t<form onSubmit={ onSetPageAsPostsPage }>\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<Text>{ modalText }</Text>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tcloseModal?.();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tdisabled={ isSaving }\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\tdisabled={ isSaving }\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t>\n\t\t\t\t\t\t{ modalButtonLabel }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t</form>\n\t);\n};\n\nexport const useSetAsPostsPageAction = () => {\n\tconst { pageOnFront, pageForPosts } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, canUser } = select( coreStore );\n\t\tconst siteSettings = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\tpageOnFront: siteSettings?.page_on_front,\n\t\t\tpageForPosts: siteSettings?.page_for_posts,\n\t\t};\n\t} );\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'set-as-posts-page',\n\t\t\tlabel: __( 'Set as posts page' ),\n\t\t\tisEligible( post ) {\n\t\t\t\tif ( post.status !== 'publish' ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tif ( post.type !== 'page' ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\t// Don't show the action if the page is already set as the homepage.\n\t\t\t\tif ( pageOnFront === post.id ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\t// Don't show the action if the page is already set as the page for posts.\n\t\t\t\tif ( pageForPosts === post.id ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\tRenderModal: SetAsPostsPageModal,\n\t\t} ),\n\t\t[ pageForPosts, pageOnFront ]\n\t);\n};\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAMA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,aAAA,GAAAN,OAAA;AAA0D,IAAAO,WAAA,GAAAP,OAAA;AAlB1D;AACA;AACA;;AAaA;AACA;AACA;;AAGA,MAAMQ,mBAAmB,GAAGA,CAAE;EAAEC,KAAK;EAAEC;AAAW,CAAC,KAAM;EACxD,MAAM,CAAEC,IAAI,CAAE,GAAGF,KAAK;EACtB,MAAMG,SAAS,GAAG,IAAAC,0BAAY,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C,CAAE,EACH,CAAEsD,YAAY,EAAED,WAAW,CAC5B,CAAC;AACF,CAAC;AAACa,OAAA,CAAAd,uBAAA,GAAAA,uBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_element","_components","_data","_coreData","_notices","_getItemTitle","_jsxRuntime","SetAsPostsPageModal","items","closeModal","item","pageTitle","getItemTitle","currentPostsPage","isPageForPostsSet","isSaving","useSelect","select","getEntityRecord","isSavingEntityRecord","coreStore","siteSettings","currentPostsPageItem","page_for_posts","saveEntityRecord","useDispatch","createSuccessNotice","createErrorNotice","noticesStore","onSetPageAsPostsPage","event","preventDefault","id","show_on_front","__","type","error","errorMessage","message","code","modalWarning","sprintf","modalText","modalButtonLabel","jsx","onSubmit","children","jsxs","__experimentalVStack","spacing","__experimentalText","__experimentalHStack","justify","Button","__next40pxDefaultSize","variant","onClick","disabled","accessibleWhenDisabled","useSetAsPostsPageAction","pageOnFront","pageForPosts","canUser","kind","name","undefined","page_on_front","useMemo","label","isEligible","post","status","modalFocusOnMount","RenderModal","exports"],"sources":["@wordpress/editor/src/components/post-actions/set-as-posts-page.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport {\n\tButton,\n\t__experimentalText as Text,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { getItemTitle } from '../../utils/get-item-title';\n\nconst SetAsPostsPageModal = ( { items, closeModal } ) => {\n\tconst [ item ] = items;\n\tconst pageTitle = getItemTitle( item );\n\tconst { currentPostsPage, isPageForPostsSet, isSaving } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, isSavingEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\t\t\tconst currentPostsPageItem = getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'page',\n\t\t\t\tsiteSettings?.page_for_posts\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tcurrentPostsPage: currentPostsPageItem,\n\t\t\t\tisPageForPostsSet: siteSettings?.page_for_posts !== 0,\n\t\t\t\tisSaving: isSavingEntityRecord( 'root', 'site' ),\n\t\t\t};\n\t\t}\n\t);\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tasync function onSetPageAsPostsPage( event ) {\n\t\tevent.preventDefault();\n\n\t\ttry {\n\t\t\tawait saveEntityRecord( 'root', 'site', {\n\t\t\t\tpage_for_posts: item.id,\n\t\t\t\tshow_on_front: 'page',\n\t\t\t} );\n\n\t\t\tcreateSuccessNotice( __( 'Posts page updated.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while setting the posts page.' );\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t} finally {\n\t\t\tcloseModal?.();\n\t\t}\n\t}\n\n\tconst modalWarning =\n\t\tisPageForPostsSet && currentPostsPage\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %s: title of the current posts page.\n\t\t\t\t\t__( 'This will replace the current posts page: \"%s\"' ),\n\t\t\t\t\tgetItemTitle( currentPostsPage )\n\t\t\t )\n\t\t\t: __( 'This page will show the latest posts.' );\n\n\tconst modalText = sprintf(\n\t\t// translators: %1$s: title of the page to be set as the posts page, %2$s: posts page replacement warning message.\n\t\t__( 'Set \"%1$s\" as the posts page? %2$s' ),\n\t\tpageTitle,\n\t\tmodalWarning\n\t);\n\n\t// translators: Button label to confirm setting the specified page as the posts page.\n\tconst modalButtonLabel = __( 'Set posts page' );\n\n\treturn (\n\t\t<form onSubmit={ onSetPageAsPostsPage }>\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<Text>{ modalText }</Text>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tcloseModal?.();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tdisabled={ isSaving }\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\tdisabled={ isSaving }\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t>\n\t\t\t\t\t\t{ modalButtonLabel }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t</form>\n\t);\n};\n\nexport const useSetAsPostsPageAction = () => {\n\tconst { pageOnFront, pageForPosts } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, canUser } = select( coreStore );\n\t\tconst siteSettings = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\tpageOnFront: siteSettings?.page_on_front,\n\t\t\tpageForPosts: siteSettings?.page_for_posts,\n\t\t};\n\t} );\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'set-as-posts-page',\n\t\t\tlabel: __( 'Set as posts page' ),\n\t\t\tisEligible( post ) {\n\t\t\t\tif ( post.status !== 'publish' ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tif ( post.type !== 'page' ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\t// Don't show the action if the page is already set as the homepage.\n\t\t\t\tif ( pageOnFront === post.id ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\t// Don't show the action if the page is already set as the page for posts.\n\t\t\t\tif ( pageForPosts === post.id ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\tmodalFocusOnMount: 'firstContentElement',\n\t\t\tRenderModal: SetAsPostsPageModal,\n\t\t} ),\n\t\t[ pageForPosts, pageOnFront ]\n\t);\n};\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAMA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,aAAA,GAAAN,OAAA;AAA0D,IAAAO,WAAA,GAAAP,OAAA;AAlB1D;AACA;AACA;;AAaA;AACA;AACA;;AAGA,MAAMQ,mBAAmB,GAAGA,CAAE;EAAEC,KAAK;EAAEC;AAAW,CAAC,KAAM;EACxD,MAAM,CAAEC,IAAI,CAAE,GAAGF,KAAK;EACtB,MAAMG,SAAS,GAAG,IAAAC,0BAAY,EAAEF,IAAK,CAAC;EACtC,MAAM;IAAEG,gBAAgB;IAAEC,iBAAiB;IAAEC;EAAS,CAAC,GAAG,IAAAC,eAAS,EAChEC,MAAM,IAAM;IACb,MAAM;MAAEC,eAAe;MAAEC;IAAqB,CAAC,GAC9CF,MAAM,CAAEG,eAAU,CAAC;IACpB,MAAMC,YAAY,GAAGH,eAAe,CAAE,MAAM,EAAE,MAAO,CAAC;IACtD,MAAMI,oBAAoB,GAAGJ,eAAe,CAC3C,UAAU,EACV,MAAM,EACNG,YAAY,EAAEE,cACf,CAAC;IACD,OAAO;MACNV,gBAAgB,EAAES,oB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7C,MAAM,CAAEG,eAAU,CAAC;IACxD,MAAMC,YAAY,GAAGyC,OAAO,CAAE,MAAM,EAAE;MACrCC,IAAI,EAAE,MAAM;MACZC,IAAI,EAAE;IACP,CAAE,CAAC,GACA9C,eAAe,CAAE,MAAM,EAAE,MAAO,CAAC,GACjC+C,SAAS;IAEZ,OAAO;MACNL,WAAW,EAAEvC,YAAY,EAAE6C,aAAa;MACxCL,YAAY,EAAExC,YAAY,EAAEE;IAC7B,CAAC;EACF,CAAE,CAAC;EAEH,OAAO,IAAA4C,gBAAO,EACb,OAAQ;IACPnC,EAAE,EAAE,mBAAmB;IACvBoC,KAAK,EAAE,IAAAlC,QAAE,EAAE,mBAAoB,CAAC;IAChCmC,UAAUA,CAAEC,IAAI,EAAG;MAClB,IAAKA,IAAI,CAACC,MAAM,KAAK,SAAS,EAAG;QAChC,OAAO,KAAK;MACb;MAEA,IAAKD,IAAI,CAACnC,IAAI,KAAK,MAAM,EAAG;QAC3B,OAAO,KAAK;MACb;;MAEA;MACA,IAAKyB,WAAW,KAAKU,IAAI,CAACtC,EAAE,EAAG;QAC9B,OAAO,KAAK;MACb;;MAEA;MACA,IAAK6B,YAAY,KAAKS,IAAI,CAACtC,EAAE,EAAG;QAC/B,OAAO,KAAK;MACb;MAEA,OAAO,IAAI;IACZ,CAAC;IACDwC,iBAAiB,EAAE,qBAAqB;IACxCC,WAAW,EAAElE;EACd,CAAC,CAAE,EACH,CAAEsD,YAAY,EAAED,WAAW,CAC5B,CAAC;AACF,CAAC;AAACc,OAAA,CAAAf,uBAAA,GAAAA,uBAAA","ignoreList":[]}
@@ -185,6 +185,10 @@ function PostStatus() {
185
185
  title: (0, _i18n.__)('Status & visibility'),
186
186
  onClose: onClose
187
187
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("form", {
188
+ onSubmit: event => {
189
+ event.preventDefault();
190
+ onClose();
191
+ },
188
192
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
189
193
  spacing: 4,
190
194
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.RadioControl, {
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_i18n","_data","_element","_coreData","_blockEditor","_compose","_icons","_constants","_postPanelRow","_interopRequireDefault","_postSticky","_postSchedule","_store","_jsxRuntime","postStatusesInfo","label","__","icon","drafts","draft","pending","private","notAllowed","future","scheduled","publish","published","STATUS_OPTIONS","exports","value","description","DESIGN_POST_TYPES","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","PATTERN_POST_TYPE","NAVIGATION_POST_TYPE","PostStatus","status","date","password","postId","postType","canEdit","useSelect","select","_getCurrentPost$_link","getEditedPostAttribute","getCurrentPostId","getCurrentPostType","getCurrentPost","editorStore","_links","showPassword","setShowPassword","useState","passwordInputId","useInstanceId","editEntityRecord","useDispatch","coreStore","popoverAnchor","setPopoverAnchor","popoverProps","useMemo","anchor","headerTitle","placement","offset","shift","includes","updatePost","newStatus","newPassword","newDate","handleTogglePassword","handleStatus","Date","jsx","default","ref","children","Dropdown","className","contentClassName","focusOnMount","renderToggle","onToggle","isOpen","Button","variant","size","onClick","sprintf","renderContent","onClose","jsxs","Fragment","__experimentalInspectorPopoverHeader","title","__experimentalVStack","spacing","RadioControl","hideLabelFromVision","options","onChange","selected","PrivatePostSchedule","showPopoverHeaderActions","isCompact","as","CheckboxControl","__nextHasNoMarginBottom","help","checked","TextControl","placeholder","type","id","__next40pxDefaultSize","maxLength"],"sources":["@wordpress/editor/src/components/post-status/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tCheckboxControl,\n\tDropdown,\n\t__experimentalVStack as VStack,\n\tTextControl,\n\tRadioControl,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { useInstanceId } from '@wordpress/compose';\nimport {\n\tdrafts,\n\tpublished,\n\tscheduled,\n\tpending,\n\tnotAllowed,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n} from '../../store/constants';\nimport PostPanelRow from '../post-panel-row';\nimport PostSticky from '../post-sticky';\nimport { PrivatePostSchedule } from '../post-schedule';\nimport { store as editorStore } from '../../store';\n\nconst postStatusesInfo = {\n\t'auto-draft': { label: __( 'Draft' ), icon: drafts },\n\tdraft: { label: __( 'Draft' ), icon: drafts },\n\tpending: { label: __( 'Pending' ), icon: pending },\n\tprivate: { label: __( 'Private' ), icon: notAllowed },\n\tfuture: { label: __( 'Scheduled' ), icon: scheduled },\n\tpublish: { label: __( 'Published' ), icon: published },\n};\n\nexport const STATUS_OPTIONS = [\n\t{\n\t\tlabel: __( 'Draft' ),\n\t\tvalue: 'draft',\n\t\tdescription: __( 'Not ready to publish.' ),\n\t},\n\t{\n\t\tlabel: __( 'Pending' ),\n\t\tvalue: 'pending',\n\t\tdescription: __( 'Waiting for review before publishing.' ),\n\t},\n\t{\n\t\tlabel: __( 'Private' ),\n\t\tvalue: 'private',\n\t\tdescription: __( 'Only visible to site admins and editors.' ),\n\t},\n\t{\n\t\tlabel: __( 'Scheduled' ),\n\t\tvalue: 'future',\n\t\tdescription: __( 'Publish automatically on a chosen date.' ),\n\t},\n\t{\n\t\tlabel: __( 'Published' ),\n\t\tvalue: 'publish',\n\t\tdescription: __( 'Visible to everyone.' ),\n\t},\n];\n\nconst DESIGN_POST_TYPES = [\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n];\n\nexport default function PostStatus() {\n\tconst { status, date, password, postId, postType, canEdit } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t\tgetCurrentPostId,\n\t\t\t\tgetCurrentPostType,\n\t\t\t\tgetCurrentPost,\n\t\t\t} = select( editorStore );\n\t\t\treturn {\n\t\t\t\tstatus: getEditedPostAttribute( 'status' ),\n\t\t\t\tdate: getEditedPostAttribute( 'date' ),\n\t\t\t\tpassword: getEditedPostAttribute( 'password' ),\n\t\t\t\tpostId: getCurrentPostId(),\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t\tcanEdit:\n\t\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst [ showPassword, setShowPassword ] = useState( !! password );\n\tconst passwordInputId = useInstanceId(\n\t\tPostStatus,\n\t\t'editor-change-status__password-input'\n\t);\n\tconst { editEntityRecord } = useDispatch( coreStore );\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\t'aria-label': __( 'Status & visibility' ),\n\t\t\theaderTitle: __( 'Status & visibility' ),\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 ( DESIGN_POST_TYPES.includes( postType ) ) {\n\t\treturn null;\n\t}\n\n\tconst updatePost = ( {\n\t\tstatus: newStatus = status,\n\t\tpassword: newPassword = password,\n\t\tdate: newDate = date,\n\t} ) => {\n\t\teditEntityRecord( 'postType', postType, postId, {\n\t\t\tstatus: newStatus,\n\t\t\tdate: newDate,\n\t\t\tpassword: newPassword,\n\t\t} );\n\t};\n\n\tconst handleTogglePassword = ( value ) => {\n\t\tsetShowPassword( value );\n\t\tif ( ! value ) {\n\t\t\tupdatePost( { password: '' } );\n\t\t}\n\t};\n\n\tconst handleStatus = ( value ) => {\n\t\tlet newDate = date;\n\t\tlet newPassword = password;\n\t\tif ( status === 'future' && new Date( date ) > new Date() ) {\n\t\t\tnewDate = null;\n\t\t}\n\t\tif ( value === 'private' && password ) {\n\t\t\tnewPassword = '';\n\t\t}\n\t\tupdatePost( {\n\t\t\tstatus: value,\n\t\t\tdate: newDate,\n\t\t\tpassword: newPassword,\n\t\t} );\n\t};\n\n\treturn (\n\t\t<PostPanelRow label={ __( 'Status' ) } ref={ setPopoverAnchor }>\n\t\t\t{ canEdit ? (\n\t\t\t\t<Dropdown\n\t\t\t\t\tclassName=\"editor-post-status\"\n\t\t\t\t\tcontentClassName=\"editor-change-status__content\"\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { onToggle, isOpen } ) => (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"editor-post-status__toggle\"\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\ticon={ postStatusesInfo[ status ]?.icon }\n\t\t\t\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Current post status.\n\t\t\t\t\t\t\t\t__( 'Change status: %s' ),\n\t\t\t\t\t\t\t\tpostStatusesInfo[ status ]?.label\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ postStatusesInfo[ status ]?.label }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<InspectorPopoverHeader\n\t\t\t\t\t\t\t\ttitle={ __( 'Status & visibility' ) }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<form>\n\t\t\t\t\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t\t\t\t\t<RadioControl\n\t\t\t\t\t\t\t\t\t\tclassName=\"editor-change-status__options\"\n\t\t\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Status' ) }\n\t\t\t\t\t\t\t\t\t\toptions={ STATUS_OPTIONS }\n\t\t\t\t\t\t\t\t\t\tonChange={ handleStatus }\n\t\t\t\t\t\t\t\t\t\tselected={\n\t\t\t\t\t\t\t\t\t\t\tstatus === 'auto-draft'\n\t\t\t\t\t\t\t\t\t\t\t\t? 'draft'\n\t\t\t\t\t\t\t\t\t\t\t\t: status\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\t{ status === 'future' && (\n\t\t\t\t\t\t\t\t\t\t<div className=\"editor-change-status__publish-date-wrapper\">\n\t\t\t\t\t\t\t\t\t\t\t<PrivatePostSchedule\n\t\t\t\t\t\t\t\t\t\t\t\tshowPopoverHeaderActions={\n\t\t\t\t\t\t\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tisCompact\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ status !== 'private' && (\n\t\t\t\t\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\t\t\t\t\tas=\"fieldset\"\n\t\t\t\t\t\t\t\t\t\t\tspacing={ 4 }\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-change-status__password-fieldset\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Password protected'\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Only visible to those who know the password.'\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\tchecked={ showPassword }\n\t\t\t\t\t\t\t\t\t\t\t\tonChange={\n\t\t\t\t\t\t\t\t\t\t\t\t\thandleTogglePassword\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t{ showPassword && (\n\t\t\t\t\t\t\t\t\t\t\t\t<div className=\"editor-change-status__password-input\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Password'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tupdatePost( {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpassword: value,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue={ password }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tplaceholder={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Use a secure password'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tid={ passwordInputId }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tmaxLength={ 255 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t<PostSticky />\n\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t</form>\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\t\t<div className=\"editor-post-status is-read-only\">\n\t\t\t\t\t{ postStatusesInfo[ status ]?.label }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</PostPanelRow>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAQA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAWA,IAAAQ,UAAA,GAAAR,OAAA;AAMA,IAAAS,aAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,WAAA,GAAAD,sBAAA,CAAAV,OAAA;AACA,IAAAY,aAAA,GAAAZ,OAAA;AACA,IAAAa,MAAA,GAAAb,OAAA;AAAmD,IAAAc,WAAA,GAAAd,OAAA;AArCnD;AACA;AACA;;AAuBA;AACA;AACA;;AAYA,MAAMe,gBAAgB,GAAG;EACxB,YAAY,EAAE;IAAEC,KAAK,EAAE,IAAAC,QAAE,EAAE,OAAQ,CAAC;IAAEC,IAAI,EAAEC;EAAO,CAAC;EACpDC,KAAK,EAAE;IAAEJ,KAAK,EAAE,IAAAC,QAAE,EA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BACXnG,KAAK,EAAG,IAAAC,QAAE,EACT,UACD,CAAG;kBACHwF,QAAQ,EAAK3E,KAAK,IACjByC,UAAU,CAAE;oBACX/B,QAAQ,EAAEV;kBACX,CAAE,CACF;kBACDA,KAAK,EAAGU,QAAU;kBAClB4E,WAAW,EAAG,IAAAnG,QAAE,EACf,uBACD,CAAG;kBACHoG,IAAI,EAAC,MAAM;kBACXC,EAAE,EAAG9D,eAAiB;kBACtB+D,qBAAqB;kBACrBP,uBAAuB;kBACvBQ,SAAS,EAAG;gBAAK,CACjB;cAAC,CACE,CACL;YAAA,CACM,CACR,eACD,IAAA1G,WAAA,CAAAgE,GAAA,EAACnE,WAAA,CAAAoE,OAAU,IAAE,CAAC;UAAA,CACP;QAAC,CACJ,CAAC;MAAA,CACN;IACA,CACH,CAAC,gBAEF,IAAAjE,WAAA,CAAAgE,GAAA;MAAKK,SAAS,EAAC,iCAAiC;MAAAF,QAAA,EAC7ClE,gBAAgB,CAAEuB,MAAM,CAAE,EAAEtB;IAAK,CAC/B;EACL,CACY,CAAC;AAEjB","ignoreList":[]}
1
+ {"version":3,"names":["_components","require","_i18n","_data","_element","_coreData","_blockEditor","_compose","_icons","_constants","_postPanelRow","_interopRequireDefault","_postSticky","_postSchedule","_store","_jsxRuntime","postStatusesInfo","label","__","icon","drafts","draft","pending","private","notAllowed","future","scheduled","publish","published","STATUS_OPTIONS","exports","value","description","DESIGN_POST_TYPES","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","PATTERN_POST_TYPE","NAVIGATION_POST_TYPE","PostStatus","status","date","password","postId","postType","canEdit","useSelect","select","_getCurrentPost$_link","getEditedPostAttribute","getCurrentPostId","getCurrentPostType","getCurrentPost","editorStore","_links","showPassword","setShowPassword","useState","passwordInputId","useInstanceId","editEntityRecord","useDispatch","coreStore","popoverAnchor","setPopoverAnchor","popoverProps","useMemo","anchor","headerTitle","placement","offset","shift","includes","updatePost","newStatus","newPassword","newDate","handleTogglePassword","handleStatus","Date","jsx","default","ref","children","Dropdown","className","contentClassName","focusOnMount","renderToggle","onToggle","isOpen","Button","variant","size","onClick","sprintf","renderContent","onClose","jsxs","Fragment","__experimentalInspectorPopoverHeader","title","onSubmit","event","preventDefault","__experimentalVStack","spacing","RadioControl","hideLabelFromVision","options","onChange","selected","PrivatePostSchedule","showPopoverHeaderActions","isCompact","as","CheckboxControl","__nextHasNoMarginBottom","help","checked","TextControl","placeholder","type","id","__next40pxDefaultSize","maxLength"],"sources":["@wordpress/editor/src/components/post-status/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tCheckboxControl,\n\tDropdown,\n\t__experimentalVStack as VStack,\n\tTextControl,\n\tRadioControl,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { useInstanceId } from '@wordpress/compose';\nimport {\n\tdrafts,\n\tpublished,\n\tscheduled,\n\tpending,\n\tnotAllowed,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n} from '../../store/constants';\nimport PostPanelRow from '../post-panel-row';\nimport PostSticky from '../post-sticky';\nimport { PrivatePostSchedule } from '../post-schedule';\nimport { store as editorStore } from '../../store';\n\nconst postStatusesInfo = {\n\t'auto-draft': { label: __( 'Draft' ), icon: drafts },\n\tdraft: { label: __( 'Draft' ), icon: drafts },\n\tpending: { label: __( 'Pending' ), icon: pending },\n\tprivate: { label: __( 'Private' ), icon: notAllowed },\n\tfuture: { label: __( 'Scheduled' ), icon: scheduled },\n\tpublish: { label: __( 'Published' ), icon: published },\n};\n\nexport const STATUS_OPTIONS = [\n\t{\n\t\tlabel: __( 'Draft' ),\n\t\tvalue: 'draft',\n\t\tdescription: __( 'Not ready to publish.' ),\n\t},\n\t{\n\t\tlabel: __( 'Pending' ),\n\t\tvalue: 'pending',\n\t\tdescription: __( 'Waiting for review before publishing.' ),\n\t},\n\t{\n\t\tlabel: __( 'Private' ),\n\t\tvalue: 'private',\n\t\tdescription: __( 'Only visible to site admins and editors.' ),\n\t},\n\t{\n\t\tlabel: __( 'Scheduled' ),\n\t\tvalue: 'future',\n\t\tdescription: __( 'Publish automatically on a chosen date.' ),\n\t},\n\t{\n\t\tlabel: __( 'Published' ),\n\t\tvalue: 'publish',\n\t\tdescription: __( 'Visible to everyone.' ),\n\t},\n];\n\nconst DESIGN_POST_TYPES = [\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n];\n\nexport default function PostStatus() {\n\tconst { status, date, password, postId, postType, canEdit } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t\tgetCurrentPostId,\n\t\t\t\tgetCurrentPostType,\n\t\t\t\tgetCurrentPost,\n\t\t\t} = select( editorStore );\n\t\t\treturn {\n\t\t\t\tstatus: getEditedPostAttribute( 'status' ),\n\t\t\t\tdate: getEditedPostAttribute( 'date' ),\n\t\t\t\tpassword: getEditedPostAttribute( 'password' ),\n\t\t\t\tpostId: getCurrentPostId(),\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t\tcanEdit:\n\t\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst [ showPassword, setShowPassword ] = useState( !! password );\n\tconst passwordInputId = useInstanceId(\n\t\tPostStatus,\n\t\t'editor-change-status__password-input'\n\t);\n\tconst { editEntityRecord } = useDispatch( coreStore );\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\t'aria-label': __( 'Status & visibility' ),\n\t\t\theaderTitle: __( 'Status & visibility' ),\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 ( DESIGN_POST_TYPES.includes( postType ) ) {\n\t\treturn null;\n\t}\n\n\tconst updatePost = ( {\n\t\tstatus: newStatus = status,\n\t\tpassword: newPassword = password,\n\t\tdate: newDate = date,\n\t} ) => {\n\t\teditEntityRecord( 'postType', postType, postId, {\n\t\t\tstatus: newStatus,\n\t\t\tdate: newDate,\n\t\t\tpassword: newPassword,\n\t\t} );\n\t};\n\n\tconst handleTogglePassword = ( value ) => {\n\t\tsetShowPassword( value );\n\t\tif ( ! value ) {\n\t\t\tupdatePost( { password: '' } );\n\t\t}\n\t};\n\n\tconst handleStatus = ( value ) => {\n\t\tlet newDate = date;\n\t\tlet newPassword = password;\n\t\tif ( status === 'future' && new Date( date ) > new Date() ) {\n\t\t\tnewDate = null;\n\t\t}\n\t\tif ( value === 'private' && password ) {\n\t\t\tnewPassword = '';\n\t\t}\n\t\tupdatePost( {\n\t\t\tstatus: value,\n\t\t\tdate: newDate,\n\t\t\tpassword: newPassword,\n\t\t} );\n\t};\n\n\treturn (\n\t\t<PostPanelRow label={ __( 'Status' ) } ref={ setPopoverAnchor }>\n\t\t\t{ canEdit ? (\n\t\t\t\t<Dropdown\n\t\t\t\t\tclassName=\"editor-post-status\"\n\t\t\t\t\tcontentClassName=\"editor-change-status__content\"\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { onToggle, isOpen } ) => (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"editor-post-status__toggle\"\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\ticon={ postStatusesInfo[ status ]?.icon }\n\t\t\t\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Current post status.\n\t\t\t\t\t\t\t\t__( 'Change status: %s' ),\n\t\t\t\t\t\t\t\tpostStatusesInfo[ status ]?.label\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ postStatusesInfo[ status ]?.label }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<InspectorPopoverHeader\n\t\t\t\t\t\t\t\ttitle={ __( 'Status & visibility' ) }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<form\n\t\t\t\t\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\tonClose();\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<VStack spacing={ 4 }>\n\t\t\t\t\t\t\t\t\t<RadioControl\n\t\t\t\t\t\t\t\t\t\tclassName=\"editor-change-status__options\"\n\t\t\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Status' ) }\n\t\t\t\t\t\t\t\t\t\toptions={ STATUS_OPTIONS }\n\t\t\t\t\t\t\t\t\t\tonChange={ handleStatus }\n\t\t\t\t\t\t\t\t\t\tselected={\n\t\t\t\t\t\t\t\t\t\t\tstatus === 'auto-draft'\n\t\t\t\t\t\t\t\t\t\t\t\t? 'draft'\n\t\t\t\t\t\t\t\t\t\t\t\t: status\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\t{ status === 'future' && (\n\t\t\t\t\t\t\t\t\t\t<div className=\"editor-change-status__publish-date-wrapper\">\n\t\t\t\t\t\t\t\t\t\t\t<PrivatePostSchedule\n\t\t\t\t\t\t\t\t\t\t\t\tshowPopoverHeaderActions={\n\t\t\t\t\t\t\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tisCompact\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ status !== 'private' && (\n\t\t\t\t\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\t\t\t\t\tas=\"fieldset\"\n\t\t\t\t\t\t\t\t\t\t\tspacing={ 4 }\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-change-status__password-fieldset\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Password protected'\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Only visible to those who know the password.'\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\tchecked={ showPassword }\n\t\t\t\t\t\t\t\t\t\t\t\tonChange={\n\t\t\t\t\t\t\t\t\t\t\t\t\thandleTogglePassword\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t{ showPassword && (\n\t\t\t\t\t\t\t\t\t\t\t\t<div className=\"editor-change-status__password-input\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Password'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tupdatePost( {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpassword: value,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue={ password }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tplaceholder={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Use a secure password'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tid={ passwordInputId }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tmaxLength={ 255 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t<PostSticky />\n\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t</form>\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\t\t<div className=\"editor-post-status is-read-only\">\n\t\t\t\t\t{ postStatusesInfo[ status ]?.label }\n\t\t\t\t</div>\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CACM,CACR,eACD,IAAA7G,WAAA,CAAAgE,GAAA,EAACnE,WAAA,CAAAoE,OAAU,IAAE,CAAC;UAAA,CACP;QAAC,CACJ,CAAC;MAAA,CACN;IACA,CACH,CAAC,gBAEF,IAAAjE,WAAA,CAAAgE,GAAA;MAAKK,SAAS,EAAC,iCAAiC;MAAAF,QAAA,EAC7ClE,gBAAgB,CAAEuB,MAAM,CAAE,EAAEtB;IAAK,CAC/B;EACL,CACY,CAAC;AAEjB","ignoreList":[]}
@@ -133,9 +133,7 @@ function BlockThemeControl({
133
133
  onClick: onClose
134
134
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_resetDefaultTemplate.default, {
135
135
  onClick: onClose
136
- }), canCreateTemplate && /*#__PURE__*/(0, _jsxRuntime.jsx)(_createNewTemplate.default, {
137
- onClick: onClose
138
- })]
136
+ }), canCreateTemplate && /*#__PURE__*/(0, _jsxRuntime.jsx)(_createNewTemplate.default, {})]
139
137
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MenuGroup, {
140
138
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MenuItem, {
141
139
  icon: !isTemplateHidden ? _icons.check : undefined,
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_htmlEntities","_components","_element","_i18n","_coreData","_icons","_notices","_preferences","_postPanelRow","_interopRequireDefault","_store","_swapTemplateButton","_resetDefaultTemplate","_lockUnlock","_createNewTemplate","_jsxRuntime","BlockThemeControl","id","isTemplateHidden","onNavigateToEntityRecord","getEditorSettings","hasGoBack","useSelect","select","getRenderingMode","_getEditorSettings","unlock","editorStore","editorSettings","hasOwnProperty","get","getPreference","preferencesStore","editedRecord","template","hasResolved","useEntityRecord","createSuccessNotice","useDispatch","noticesStore","setRenderingMode","setDefaultRenderingMode","canCreateTemplate","coreStore","canUser","kind","name","popoverAnchor","setPopoverAnchor","useState","popoverProps","useMemo","anchor","className","placement","offset","shift","notificationAction","label","__","onClick","onNavigateToPreviousEntityRecord","undefined","mayShowTemplateEditNotice","type","actions","jsx","default","ref","children","DropdownMenu","focusOnMount","toggleProps","size","variant","tooltipPosition","text","decodeEntities","title","icon","onClose","jsxs","Fragment","MenuGroup","MenuItem","postId","postType","check","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":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AAKA,IAAAS,aAAA,GAAAC,sBAAA,CAAAV,OAAA;AAKA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,mBAAA,GAAAF,sBAAA,CAAAV,OAAA;AACA,IAAAa,qBAAA,GAAAH,sBAAA,CAAAV,OAAA;AACA,IAAAc,WAAA,GAAAd,OAAA;AACA,IAAAe,kBAAA,GAAAL,sBAAA,CAAAV,OAAA;AAAsD,IAAAgB,WAAA,GAAAhB,OAAA;AAzBtD;AACA;AACA;;AAWA;AACA;AACA;;AAGA;AACA;AACA;;AAOe,SAASiB,iBAAiBA,CAAE;EAAEC;AAAG,CAAC,EAAG;EACnD,MAAM;IACLC,gBAAgB;IAChBC,wBAAwB;IACxBC,iBAAiB;IACjBC;EACD,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC5B,MAA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AAG;YAAArB,QAAA,EAED,IAAAV,QAAE,EAAE,eAAgB;UAAC,CACd;QAAC,CACD,CAAC;MAAA,CACX;IACF,CACY;EAAC,CACF,CAAC;AAEjB","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_htmlEntities","_components","_element","_i18n","_coreData","_icons","_notices","_preferences","_postPanelRow","_interopRequireDefault","_store","_swapTemplateButton","_resetDefaultTemplate","_lockUnlock","_createNewTemplate","_jsxRuntime","BlockThemeControl","id","isTemplateHidden","onNavigateToEntityRecord","getEditorSettings","hasGoBack","useSelect","select","getRenderingMode","_getEditorSettings","unlock","editorStore","editorSettings","hasOwnProperty","get","getPreference","preferencesStore","editedRecord","template","hasResolved","useEntityRecord","createSuccessNotice","useDispatch","noticesStore","setRenderingMode","setDefaultRenderingMode","canCreateTemplate","coreStore","canUser","kind","name","popoverAnchor","setPopoverAnchor","useState","popoverProps","useMemo","anchor","className","placement","offset","shift","notificationAction","label","__","onClick","onNavigateToPreviousEntityRecord","undefined","mayShowTemplateEditNotice","type","actions","jsx","default","ref","children","DropdownMenu","focusOnMount","toggleProps","size","variant","tooltipPosition","text","decodeEntities","title","icon","onClose","jsxs","Fragment","MenuGroup","MenuItem","postId","postType","check","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\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":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,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A3B,WAAA,CAAAmD,GAAA,EAACpD,kBAAA,CAAAqD,OAAiB,IAAE,CAAC;QAAA,CAClC,CAAC,eACZ,IAAApD,WAAA,CAAAmD,GAAA,EAACjE,WAAA,CAAAkF,SAAS;UAAAd,QAAA,eACT,IAAAtD,WAAA,CAAAmD,GAAA,EAACjE,WAAA,CAAAmF,QAAQ;YACRL,IAAI,EAAG,CAAE7D,gBAAgB,GAAGqE,YAAK,GAAGzB,SAAW;YAC/C0B,UAAU,EAAG,CAAEtE,gBAAkB;YACjCuE,IAAI,EAAC,kBAAkB;YACvB7B,OAAO,EAAGA,CAAA,KAAM;cACf,MAAM8B,gBAAgB,GAAGxE,gBAAgB,GACtC,iBAAiB,GACjB,WAAW;cACdsB,gBAAgB,CAAEkD,gBAAiB,CAAC;cACpCjD,uBAAuB,CAAEiD,gBAAiB,CAAC;YAC5C,CAAG;YAAArB,QAAA,EAED,IAAAV,QAAE,EAAE,eAAgB;UAAC,CACd;QAAC,CACD,CAAC;MAAA,CACX;IACF,CACY;EAAC,CACF,CAAC;AAEjB","ignoreList":[]}
@@ -4,15 +4,19 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = CreateNewTemplateModal;
7
+ var _changeCase = require("change-case");
7
8
  var _data = require("@wordpress/data");
8
9
  var _element = require("@wordpress/element");
9
10
  var _blocks = require("@wordpress/blocks");
10
11
  var _components = require("@wordpress/components");
11
12
  var _i18n = require("@wordpress/i18n");
12
- var _url = require("@wordpress/url");
13
13
  var _lockUnlock = require("../../lock-unlock");
14
14
  var _store = require("../../store");
15
15
  var _jsxRuntime = require("react/jsx-runtime");
16
+ /**
17
+ * External dependencies
18
+ */
19
+
16
20
  /**
17
21
  * WordPress dependencies
18
22
  */
@@ -71,7 +75,7 @@ function CreateNewTemplateModal({
71
75
  }
72
76
  })])]);
73
77
  const newTemplate = await createTemplate({
74
- slug: (0, _url.cleanForSlug)(title || DEFAULT_TITLE),
78
+ slug: (0, _changeCase.paramCase)(title || DEFAULT_TITLE) || 'wp-custom-template',
75
79
  content: newTemplateContent,
76
80
  title: title || DEFAULT_TITLE
77
81
  });
@@ -87,6 +91,7 @@ function CreateNewTemplateModal({
87
91
  onRequestClose: cancel,
88
92
  focusOnMount: "firstContentElement",
89
93
  size: "small",
94
+ overlayClassName: "editor-post-template__create-template-modal",
90
95
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("form", {
91
96
  className: "editor-post-template__create-form",
92
97
  onSubmit: submit,
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_element","_blocks","_components","_i18n","_url","_lockUnlock","_store","_jsxRuntime","DEFAULT_TITLE","__","CreateNewTemplateModal","onClose","defaultBlockTemplate","onNavigateToEntityRecord","useSelect","select","getEditorSettings","getCurrentTemplateId","editorStore","getTemplateId","createTemplate","unlock","useDispatch","title","setTitle","useState","isBusy","setIsBusy","cancel","submit","event","preventDefault","newTemplateContent","serialize","createBlock","tagName","layout","inherit","newTemplate","slug","cleanForSlug","content","postId","id","postType","jsx","Modal","onRequestClose","focusOnMount","size","children","className","onSubmit","jsxs","__experimentalVStack","spacing","TextControl","__next40pxDefaultSize","__nextHasNoMarginBottom","label","value","onChange","placeholder","disabled","help","__experimentalHStack","justify","Button","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":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAOA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,IAAA,GAAAL,OAAA;AAKA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAAmD,IAAAQ,WAAA,GAAAR,OAAA;AApBnD;AACA;AACA;;AAcA;AACA;AACA;;AAIA,MAAMS,aAAa,GAAG,IAAAC,QAAE,EAAE,iBAAkB,CAAC;AAE9B,SAASC,sBAAsBA,CAAE;EAAEC;AAAQ,CAAC,EAAG;EAC7D,MAAM;IAAEC,oBAAoB;IAAEC;EAAyB,CAAC,GAAG,IAAAC,eAAS,EACjEC,MAAM,IAAM;IACb,MAAM;MAAEC,iBAAiB;MAAEC;IAAqB,CAAC,GAChDF,MAAM,CAAEG,YAAY,CAAC;IACtB,OAAO;MACNN,oBAAoB,EAAEI,iBAAiB,CAAC,CAAC,CAACJ,oBAAoB;MAC9DC,wBAAwB,EACvBG,iBAAiB,CAAC,CAAC,CAACH,wBAAwB;MAC7CM,aAAa,EAAEF;IAChB,CAAC;EACF,CACD,CAAC;EAED,MAAM;IAAEG;EAAe,CAAC,GAAG,IAAAC,kBAAM,EAAE,IAAAC,iBAAW,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;YACrBW,OAAO,EAAC,UAAU;YAClBC,OAAO,EAAGzC,MAAQ;YAAAsB,QAAA,EAEhB,IAAAzC,QAAE,EAAE,QAAS;UAAC,CACT,CAAC,eAET,IAAAF,WAAA,CAAAsC,GAAA,EAAC3C,WAAA,CAAAiE,MAAM;YACNV,qBAAqB;YACrBW,OAAO,EAAC,SAAS;YACjBE,IAAI,EAAC,QAAQ;YACb5C,MAAM,EAAGA,MAAQ;YACjB,iBAAgBA,MAAQ;YAAAwB,QAAA,EAEtB,IAAAzC,QAAE,EAAE,QAAS;UAAC,CACT,CAAC;QAAA,CACF,CAAC;MAAA,CACF;IAAC,CACJ;EAAC,CACD,CAAC;AAEV","ignoreList":[]}
1
+ {"version":3,"names":["_changeCase","require","_data","_element","_blocks","_components","_i18n","_lockUnlock","_store","_jsxRuntime","DEFAULT_TITLE","__","CreateNewTemplateModal","onClose","defaultBlockTemplate","onNavigateToEntityRecord","useSelect","select","getEditorSettings","getCurrentTemplateId","editorStore","getTemplateId","createTemplate","unlock","useDispatch","title","setTitle","useState","isBusy","setIsBusy","cancel","submit","event","preventDefault","newTemplateContent","serialize","createBlock","tagName","layout","inherit","newTemplate","slug","kebabCase","content","postId","id","postType","jsx","Modal","onRequestClose","focusOnMount","size","overlayClassName","children","className","onSubmit","jsxs","__experimentalVStack","spacing","TextControl","__next40pxDefaultSize","__nextHasNoMarginBottom","label","value","onChange","placeholder","disabled","help","__experimentalHStack","justify","Button","variant","onClick","type"],"sources":["@wordpress/editor/src/components/post-template/create-new-template-modal.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { paramCase as kebabCase } from 'change-case';\n\n/**\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';\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: kebabCase( title || DEFAULT_TITLE ) || 'wp-custom-template',\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":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAOA,IAAAK,KAAA,GAAAL,OAAA;AAKA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAAmD,IAAAQ,WAAA,GAAAR,OAAA;AAxBnD;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;;AAIA,MAAMS,aAAa,GAAG,IAAAC,QAAE,EAAE,iBAAkB,CAAC;AAE9B,SAASC,sBAAsBA,CAAE;EAAEC;AAAQ,CAAC,EAAG;EAC7D,MAAM;IAAEC,oBAAoB;IAAEC;EAAyB,CAAC,GAAG,IAAAC,eAAS,EACjEC,MAAM,IAAM;IACb,MAAM;MAAEC,iBAAiB;MAAEC;IAAqB,CAAC,GAChDF,MAAM,CAAEG,YAAY,CAAC;IACtB,OAAO;MACNN,oBAAoB,EAAEI,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GtC,MAAQ;UACnBuC,IAAI,EAAG,IAAAxD,QAAE;UACR;UACA,iHACD;QAAG,CACH,CAAC,eACF,IAAAF,WAAA,CAAA+C,IAAA,EAACnD,WAAA,CAAA+D,oBAAM;UAACC,OAAO,EAAC,OAAO;UAAAhB,QAAA,gBACtB,IAAA5C,WAAA,CAAAsC,GAAA,EAAC1C,WAAA,CAAAiE,MAAM;YACNV,qBAAqB;YACrBW,OAAO,EAAC,UAAU;YAClBC,OAAO,EAAG1C,MAAQ;YAAAuB,QAAA,EAEhB,IAAA1C,QAAE,EAAE,QAAS;UAAC,CACT,CAAC,eAET,IAAAF,WAAA,CAAAsC,GAAA,EAAC1C,WAAA,CAAAiE,MAAM;YACNV,qBAAqB;YACrBW,OAAO,EAAC,SAAS;YACjBE,IAAI,EAAC,QAAQ;YACb7C,MAAM,EAAGA,MAAQ;YACjB,iBAAgBA,MAAQ;YAAAyB,QAAA,EAEtB,IAAA1C,QAAE,EAAE,QAAS;UAAC,CACT,CAAC;QAAA,CACF,CAAC;MAAA,CACF;IAAC,CACJ;EAAC,CACD,CAAC;AAEV","ignoreList":[]}
@@ -21,9 +21,7 @@ var _jsxRuntime = require("react/jsx-runtime");
21
21
  * Internal dependencies
22
22
  */
23
23
 
24
- function CreateNewTemplate({
25
- onClick
26
- }) {
24
+ function CreateNewTemplate() {
27
25
  const {
28
26
  canCreateTemplates
29
27
  } = (0, _data.useSelect)(select => {
@@ -53,7 +51,6 @@ function CreateNewTemplate({
53
51
  }), isCreateModalOpen && /*#__PURE__*/(0, _jsxRuntime.jsx)(_createNewTemplateModal.default, {
54
52
  onClose: () => {
55
53
  setIsCreateModalOpen(false);
56
- onClick();
57
54
  }
58
55
  })]
59
56
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_i18n","_data","_coreData","_element","_createNewTemplateModal","_interopRequireDefault","_hooks","_jsxRuntime","CreateNewTemplate","onClick","canCreateTemplates","useSelect","select","canUser","coreStore","kind","name","isCreateModalOpen","setIsCreateModalOpen","useState","allowSwitchingTemplate","useAllowSwitchingTemplates","jsxs","Fragment","children","jsx","MenuItem","__","default","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\tonClick();\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GA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G,CACH,CACD;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["_components","require","_i18n","_data","_coreData","_element","_createNewTemplateModal","_interopRequireDefault","_hooks","_jsxRuntime","CreateNewTemplate","canCreateTemplates","useSelect","select","canUser","coreStore","kind","name","isCreateModalOpen","setIsCreateModalOpen","useState","allowSwitchingTemplate","useAllowSwitchingTemplates","jsxs","Fragment","children","jsx","MenuItem","onClick","__","default","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\t\t\t<CreateNewTemplateModal\n\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\tsetIsCreateModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t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WAAA,CAAAiB,GAAA,EAACpB,uBAAA,CAAAwB,OAAsB;MACtBC,OAAO,EAAGA,CAAA,KAAM;QACfZ,oBAAoB,CAAE,KAAM,CAAC;MAC9B;IAAG,CACH,CACD;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
@@ -48,11 +48,9 @@ function PreviewDropdown({
48
48
  const {
49
49
  getDeviceType,
50
50
  getCurrentPostType,
51
- getCurrentTemplateId
52
- } = select(_store.store);
53
- const {
51
+ getCurrentTemplateId,
54
52
  getRenderingMode
55
- } = (0, _lockUnlock.unlock)(select(_store.store));
53
+ } = select(_store.store);
56
54
  const {
57
55
  getEntityRecord,
58
56
  getPostType
@@ -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\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,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AAKA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,YAAA,GAAAV,OAAA;AACA,IAAAW,kBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,WAAA,GAAAZ,OAAA;AAA2C,IAAAa,WAA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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,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AAKA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,YAAA,GAAAV,OAAA;AACA,IAAAW,kBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,WAAA,GAAAZ,OAAA;AAA2C,IAAAa,WAAA,GAAAb,OAAA;AA9B3C;AACA;AACA;;AAGA;AACA;AACA;;AAiBA;AACA;AACA;;AAMe,SAASc,eAAeA,CAAE;EAAEC,mBAAmB;EAAEC;AAAS,CAAC,EAAG;EAC5E,MAAM;IACLC,UAAU;IACVC,OAAO;IACPC,UAAU;IACVC,UAAU;IACVC,cAAc;IACdC,gBAAgB;IAChBC;EACD,CAAC,GA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,EAAC,kBAAkB;UACvBN,OAAO,EAAGA,CAAA,KAAM;YACf,MAAMO,gBAAgB,GAAGtE,gBAAgB,GACtC,iBAAiB,GACjB,WAAW;YACdmB,gBAAgB,CAAEmD,gBAAiB,CAAC;YACpClD,uBAAuB,CAAEkD,gBAAiB,CAAC;UAC5C,CAAG;UAAAlB,QAAA,EAED,IAAAd,QAAE,EAAE,eAAgB;QAAC,CACd;MAAC,CACD,CACX,EACCxC,UAAU,iBACX,IAAAP,WAAA,CAAAwD,GAAA,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":[]}
@@ -14,6 +14,7 @@ var _coreData = require("@wordpress/core-data");
14
14
  var _blocks = require("@wordpress/blocks");
15
15
  var _preferences = require("@wordpress/preferences");
16
16
  var _interface = require("@wordpress/interface");
17
+ var _constants = require("../../store/constants");
17
18
  var _store = require("../../store");
18
19
  var _jsxRuntime = require("react/jsx-runtime");
19
20
  /**
@@ -158,7 +159,7 @@ function StartPageOptions() {
158
159
  const choosePatternModalEnabled = select(_preferences.store).get('core', 'enableChoosePatternModal');
159
160
  return {
160
161
  postId: getCurrentPostId(),
161
- enabled: choosePatternModalEnabled && 'page' === getCurrentPostType()
162
+ enabled: choosePatternModalEnabled && _constants.TEMPLATE_POST_TYPE !== getCurrentPostType()
162
163
  };
163
164
  }, []);
164
165