@wordpress/edit-site 3.0.26 → 3.0.29

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 (130) hide show
  1. package/build/components/add-new-template/new-template-part.js +4 -1
  2. package/build/components/add-new-template/new-template-part.js.map +1 -1
  3. package/build/components/editor/global-styles-renderer.js +7 -3
  4. package/build/components/editor/global-styles-renderer.js.map +1 -1
  5. package/build/components/error-boundary/index.js +11 -27
  6. package/build/components/error-boundary/index.js.map +1 -1
  7. package/build/components/error-boundary/warning.js +70 -0
  8. package/build/components/error-boundary/warning.js.map +1 -0
  9. package/build/components/global-styles/screen-background-color.js +8 -9
  10. package/build/components/global-styles/screen-background-color.js.map +1 -1
  11. package/build/components/global-styles/screen-link-color.js +6 -10
  12. package/build/components/global-styles/screen-link-color.js.map +1 -1
  13. package/build/components/global-styles/screen-text-color.js +6 -10
  14. package/build/components/global-styles/screen-text-color.js.map +1 -1
  15. package/build/components/header/more-menu/index.js +68 -39
  16. package/build/components/header/more-menu/index.js.map +1 -1
  17. package/build/{plugins → components/header/more-menu}/site-export.js +0 -0
  18. package/build/components/header/more-menu/site-export.js.map +1 -0
  19. package/build/{plugins → components/header/more-menu}/welcome-guide-menu-item.js +1 -1
  20. package/build/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
  21. package/build/components/header/tools-more-menu-group/index.js +1 -5
  22. package/build/components/header/tools-more-menu-group/index.js.map +1 -1
  23. package/build/components/keyboard-shortcut-help-modal/config.js +45 -0
  24. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -0
  25. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +56 -0
  26. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -0
  27. package/build/components/keyboard-shortcut-help-modal/index.js +137 -0
  28. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -0
  29. package/build/components/keyboard-shortcut-help-modal/shortcut.js +65 -0
  30. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -0
  31. package/build/components/keyboard-shortcuts/index.js +9 -0
  32. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  33. package/build/components/list/added-by.js +51 -50
  34. package/build/components/list/added-by.js.map +1 -1
  35. package/build/components/list/table.js +3 -1
  36. package/build/components/list/table.js.map +1 -1
  37. package/build/components/routes/redirect-to-homepage.js +106 -0
  38. package/build/components/routes/redirect-to-homepage.js.map +1 -0
  39. package/build/components/template-part-converter/convert-to-template-part.js +4 -1
  40. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  41. package/build/components/url-query-controller/index.js +1 -38
  42. package/build/components/url-query-controller/index.js.map +1 -1
  43. package/build/index.js +23 -4
  44. package/build/index.js.map +1 -1
  45. package/build/store/actions.js +7 -25
  46. package/build/store/actions.js.map +1 -1
  47. package/build-module/components/add-new-template/new-template-part.js +4 -1
  48. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  49. package/build-module/components/editor/global-styles-renderer.js +6 -3
  50. package/build-module/components/editor/global-styles-renderer.js.map +1 -1
  51. package/build-module/components/error-boundary/index.js +9 -26
  52. package/build-module/components/error-boundary/index.js.map +1 -1
  53. package/build-module/components/error-boundary/warning.js +60 -0
  54. package/build-module/components/error-boundary/warning.js.map +1 -0
  55. package/build-module/components/global-styles/screen-background-color.js +8 -10
  56. package/build-module/components/global-styles/screen-background-color.js.map +1 -1
  57. package/build-module/components/global-styles/screen-link-color.js +7 -11
  58. package/build-module/components/global-styles/screen-link-color.js.map +1 -1
  59. package/build-module/components/global-styles/screen-text-color.js +7 -11
  60. package/build-module/components/global-styles/screen-text-color.js.map +1 -1
  61. package/build-module/components/header/more-menu/index.js +65 -40
  62. package/build-module/components/header/more-menu/index.js.map +1 -1
  63. package/build-module/{plugins → components/header/more-menu}/site-export.js +0 -0
  64. package/build-module/components/header/more-menu/site-export.js.map +1 -0
  65. package/build-module/{plugins → components/header/more-menu}/welcome-guide-menu-item.js +1 -1
  66. package/build-module/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
  67. package/build-module/components/header/tools-more-menu-group/index.js +2 -5
  68. package/build-module/components/header/tools-more-menu-group/index.js.map +1 -1
  69. package/build-module/components/keyboard-shortcut-help-modal/config.js +36 -0
  70. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -0
  71. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +44 -0
  72. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -0
  73. package/build-module/components/keyboard-shortcut-help-modal/index.js +120 -0
  74. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -0
  75. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +58 -0
  76. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -0
  77. package/build-module/components/keyboard-shortcuts/index.js +9 -0
  78. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  79. package/build-module/components/list/added-by.js +52 -51
  80. package/build-module/components/list/added-by.js.map +1 -1
  81. package/build-module/components/list/table.js +2 -1
  82. package/build-module/components/list/table.js.map +1 -1
  83. package/build-module/components/routes/redirect-to-homepage.js +94 -0
  84. package/build-module/components/routes/redirect-to-homepage.js.map +1 -0
  85. package/build-module/components/template-part-converter/convert-to-template-part.js +4 -1
  86. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  87. package/build-module/components/url-query-controller/index.js +3 -40
  88. package/build-module/components/url-query-controller/index.js.map +1 -1
  89. package/build-module/index.js +20 -3
  90. package/build-module/index.js.map +1 -1
  91. package/build-module/store/actions.js +7 -23
  92. package/build-module/store/actions.js.map +1 -1
  93. package/build-style/style-rtl.css +51 -0
  94. package/build-style/style.css +51 -0
  95. package/package.json +13 -13
  96. package/src/components/add-new-template/new-template-part.js +7 -1
  97. package/src/components/editor/global-styles-renderer.js +7 -1
  98. package/src/components/error-boundary/index.js +11 -28
  99. package/src/components/error-boundary/warning.js +59 -0
  100. package/src/components/global-styles/screen-background-color.js +6 -9
  101. package/src/components/global-styles/screen-link-color.js +6 -14
  102. package/src/components/global-styles/screen-text-color.js +6 -14
  103. package/src/components/header/more-menu/index.js +103 -44
  104. package/src/{plugins → components/header/more-menu}/site-export.js +0 -0
  105. package/src/{plugins → components/header/more-menu}/welcome-guide-menu-item.js +1 -1
  106. package/src/components/header/tools-more-menu-group/index.js +2 -7
  107. package/src/components/keyboard-shortcut-help-modal/config.js +27 -0
  108. package/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +41 -0
  109. package/src/components/keyboard-shortcut-help-modal/index.js +135 -0
  110. package/src/components/keyboard-shortcut-help-modal/shortcut.js +73 -0
  111. package/src/components/keyboard-shortcut-help-modal/style.scss +66 -0
  112. package/src/components/keyboard-shortcuts/index.js +10 -0
  113. package/src/components/list/added-by.js +57 -63
  114. package/src/components/list/table.js +5 -2
  115. package/src/components/routes/redirect-to-homepage.js +94 -0
  116. package/src/components/template-part-converter/convert-to-template-part.js +6 -1
  117. package/src/components/url-query-controller/index.js +3 -35
  118. package/src/index.js +25 -2
  119. package/src/store/actions.js +7 -35
  120. package/src/store/test/actions.js +0 -90
  121. package/src/style.scss +1 -0
  122. package/build/plugins/index.js +0 -28
  123. package/build/plugins/index.js.map +0 -1
  124. package/build/plugins/site-export.js.map +0 -1
  125. package/build/plugins/welcome-guide-menu-item.js.map +0 -1
  126. package/build-module/plugins/index.js +0 -20
  127. package/build-module/plugins/index.js.map +0 -1
  128. package/build-module/plugins/site-export.js.map +0 -1
  129. package/build-module/plugins/welcome-guide-menu-item.js.map +0 -1
  130. package/src/plugins/index.js +0 -24
@@ -7,6 +7,7 @@ import { useSelect } from '@wordpress/data';
7
7
  import { store as coreStore } from '@wordpress/core-data';
8
8
  import { __, sprintf } from '@wordpress/i18n';
9
9
  import { VisuallyHidden, __experimentalHeading as Heading } from '@wordpress/components';
10
+ import { decodeEntities } from '@wordpress/html-entities';
10
11
  /**
11
12
  * Internal dependencies
12
13
  */
@@ -84,7 +85,7 @@ export default function Table(_ref) {
84
85
  postId: template.id,
85
86
  postType: template.type
86
87
  }
87
- }, ((_template$title = template.title) === null || _template$title === void 0 ? void 0 : _template$title.rendered) || template.slug)), template.description), createElement("td", {
88
+ }, decodeEntities(((_template$title = template.title) === null || _template$title === void 0 ? void 0 : _template$title.rendered) || template.slug))), template.description), createElement("td", {
88
89
  className: "edit-site-list-table-column",
89
90
  role: "cell"
90
91
  }, createElement(AddedBy, {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/list/table.js"],"names":["useSelect","store","coreStore","__","sprintf","VisuallyHidden","__experimentalHeading","Heading","Link","Actions","AddedBy","Table","templateType","templates","isLoading","postType","select","getEntityRecords","hasFinishedResolution","getPostType","per_page","length","labels","name","toLowerCase","map","template","id","postId","type","title","rendered","slug","description"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,cADD,EAECC,qBAAqB,IAAIC,OAF1B,QAGO,uBAHP;AAKA;AACA;AACA;;AACA,OAAOC,IAAP,MAAiB,gBAAjB;AACA,OAAOC,OAAP,MAAoB,WAApB;AACA,OAAOC,OAAP,MAAoB,YAApB;AAEA,eAAe,SAASC,KAAT,OAAmC;AAAA,MAAnB;AAAEC,IAAAA;AAAF,GAAmB;AACjD,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,SAAb;AAAwBC,IAAAA;AAAxB,MAAqCf,SAAS,CACjDgB,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,gBADK;AAELC,MAAAA,qBAFK;AAGLC,MAAAA;AAHK,QAIFH,MAAM,CAAEd,SAAF,CAJV;AAMA,WAAO;AACNW,MAAAA,SAAS,EAAEI,gBAAgB,CAAE,UAAF,EAAcL,YAAd,EAA4B;AACtDQ,QAAAA,QAAQ,EAAE,CAAC;AAD2C,OAA5B,CADrB;AAINN,M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IAAI,EAAC;AAHN,SAKC;AAAI,QAAA,SAAS,EAAC,6BAAd;AAA4C,QAAA,IAAI,EAAC;AAAjD,SACC,cAAC,OAAD;AAAS,QAAA,KAAK,EAAG;AAAjB,SACC,cAAC,IAAD;AACC,QAAA,MAAM,EAAG;AACRC,UAAAA,MAAM,EAAEF,QAAQ,CAACC,EADT;AAERZ,UAAAA,QAAQ,EAAEW,QAAQ,CAACG;AAFX;AADV,SAMG,oBAAAH,QAAQ,CAACI,KAAT,oEAAgBC,QAAhB,KACDL,QAAQ,CAACM,IAPX,CADD,CADD,EAYGN,QAAQ,CAACO,WAZZ,CALD,EAoBC;AAAI,QAAA,SAAS,EAAC,6BAAd;AAA4C,QAAA,IAAI,EAAC;AAAjD,SACC,cAAC,OAAD;AACC,QAAA,YAAY,EAAGrB,YADhB;AAEC,QAAA,QAAQ,EAAGc;AAFZ,QADD,CApBD,EA0BC;AAAI,QAAA,SAAS,EAAC,6BAAd;AAA4C,QAAA,IAAI,EAAC;AAAjD,SACC,cAAC,OAAD;AAAS,QAAA,QAAQ,EAAGA;AAApB,QADD,CA1BD,CADgB;AAAA,KAAf,CADH,CAxBD;AAHD;AA+DA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tVisuallyHidden,\n\t__experimentalHeading as Heading,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport Link from '../routes/link';\nimport Actions from './actions';\nimport AddedBy from './added-by';\n\nexport default function Table( { templateType } ) {\n\tconst { templates, isLoading, postType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEntityRecords,\n\t\t\t\thasFinishedResolution,\n\t\t\t\tgetPostType,\n\t\t\t} = select( coreStore );\n\n\t\t\treturn {\n\t\t\t\ttemplates: getEntityRecords( 'postType', templateType, {\n\t\t\t\t\tper_page: -1,\n\t\t\t\t} ),\n\t\t\t\tisLoading: ! hasFinishedResolution( 'getEntityRecords', [\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplateType,\n\t\t\t\t\t{ per_page: -1 },\n\t\t\t\t] ),\n\t\t\t\tpostType: getPostType( templateType ),\n\t\t\t};\n\t\t},\n\t\t[ templateType ]\n\t);\n\n\tif ( ! templates || isLoading ) {\n\t\treturn null;\n\t}\n\n\tif ( ! templates.length ) {\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t// translators: The template type name, should be either \"templates\" or \"template parts\".\n\t\t\t\t\t__( 'No %s found.' ),\n\t\t\t\t\tpostType?.labels?.name?.toLowerCase()\n\t\t\t\t) }\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t// These explicit aria roles are needed for Safari.\n\t\t// See https://developer.mozilla.org/en-US/docs/Web/CSS/display#tables\n\t\t<table className=\"edit-site-list-table\" role=\"table\">\n\t\t\t<thead>\n\t\t\t\t<tr className=\"edit-site-list-table-head\" role=\"row\">\n\t\t\t\t\t<th\n\t\t\t\t\t\tclassName=\"edit-site-list-table-column\"\n\t\t\t\t\t\trole=\"columnheader\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Template' ) }\n\t\t\t\t\t</th>\n\t\t\t\t\t<th\n\t\t\t\t\t\tclassName=\"edit-site-list-table-column\"\n\t\t\t\t\t\trole=\"columnheader\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Added by' ) }\n\t\t\t\t\t</th>\n\t\t\t\t\t<th\n\t\t\t\t\t\tclassName=\"edit-site-list-table-column\"\n\t\t\t\t\t\trole=\"columnheader\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<VisuallyHidden>{ __( 'Actions' ) }</VisuallyHidden>\n\t\t\t\t\t</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\n\t\t\t<tbody>\n\t\t\t\t{ templates.map( ( template ) => (\n\t\t\t\t\t<tr\n\t\t\t\t\t\tkey={ template.id }\n\t\t\t\t\t\tclassName=\"edit-site-list-table-row\"\n\t\t\t\t\t\trole=\"row\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<td className=\"edit-site-list-table-column\" role=\"cell\">\n\t\t\t\t\t\t\t<Heading level={ 4 }>\n\t\t\t\t\t\t\t\t<Link\n\t\t\t\t\t\t\t\t\tparams={ {\n\t\t\t\t\t\t\t\t\t\tpostId: template.id,\n\t\t\t\t\t\t\t\t\t\tpostType: template.type,\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{ template.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\ttemplate.slug }\n\t\t\t\t\t\t\t\t</Link>\n\t\t\t\t\t\t\t</Heading>\n\t\t\t\t\t\t\t{ template.description }\n\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t<td className=\"edit-site-list-table-column\" role=\"cell\">\n\t\t\t\t\t\t\t<AddedBy\n\t\t\t\t\t\t\t\ttemplateType={ templateType }\n\t\t\t\t\t\t\t\ttemplate={ template }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td className=\"edit-site-list-table-column\" role=\"cell\">\n\t\t\t\t\t\t\t<Actions template={ template } />\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t) ) }\n\t\t\t</tbody>\n\t\t</table>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/list/table.js"],"names":["useSelect","store","coreStore","__","sprintf","VisuallyHidden","__experimentalHeading","Heading","decodeEntities","Link","Actions","AddedBy","Table","templateType","templates","isLoading","postType","select","getEntityRecords","hasFinishedResolution","getPostType","per_page","length","labels","name","toLowerCase","map","template","id","postId","type","title","rendered","slug","description"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,EAAT,EAAaC,OAA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C;AAAI,QAAA,SAAS,EAAC,6BAAd;AAA4C,QAAA,IAAI,EAAC;AAAjD,SACC,cAAC,OAAD;AAAS,QAAA,QAAQ,EAAGA;AAApB,QADD,CA5BD,CADgB;AAAA,KAAf,CADH,CAxBD;AAHD;AAiEA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tVisuallyHidden,\n\t__experimentalHeading as Heading,\n} from '@wordpress/components';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport Link from '../routes/link';\nimport Actions from './actions';\nimport AddedBy from './added-by';\n\nexport default function Table( { templateType } ) {\n\tconst { templates, isLoading, postType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEntityRecords,\n\t\t\t\thasFinishedResolution,\n\t\t\t\tgetPostType,\n\t\t\t} = select( coreStore );\n\n\t\t\treturn {\n\t\t\t\ttemplates: getEntityRecords( 'postType', templateType, {\n\t\t\t\t\tper_page: -1,\n\t\t\t\t} ),\n\t\t\t\tisLoading: ! hasFinishedResolution( 'getEntityRecords', [\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplateType,\n\t\t\t\t\t{ per_page: -1 },\n\t\t\t\t] ),\n\t\t\t\tpostType: getPostType( templateType ),\n\t\t\t};\n\t\t},\n\t\t[ templateType ]\n\t);\n\n\tif ( ! templates || isLoading ) {\n\t\treturn null;\n\t}\n\n\tif ( ! templates.length ) {\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t// translators: The template type name, should be either \"templates\" or \"template parts\".\n\t\t\t\t\t__( 'No %s found.' ),\n\t\t\t\t\tpostType?.labels?.name?.toLowerCase()\n\t\t\t\t) }\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t// These explicit aria roles are needed for Safari.\n\t\t// See https://developer.mozilla.org/en-US/docs/Web/CSS/display#tables\n\t\t<table className=\"edit-site-list-table\" role=\"table\">\n\t\t\t<thead>\n\t\t\t\t<tr className=\"edit-site-list-table-head\" role=\"row\">\n\t\t\t\t\t<th\n\t\t\t\t\t\tclassName=\"edit-site-list-table-column\"\n\t\t\t\t\t\trole=\"columnheader\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Template' ) }\n\t\t\t\t\t</th>\n\t\t\t\t\t<th\n\t\t\t\t\t\tclassName=\"edit-site-list-table-column\"\n\t\t\t\t\t\trole=\"columnheader\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Added by' ) }\n\t\t\t\t\t</th>\n\t\t\t\t\t<th\n\t\t\t\t\t\tclassName=\"edit-site-list-table-column\"\n\t\t\t\t\t\trole=\"columnheader\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<VisuallyHidden>{ __( 'Actions' ) }</VisuallyHidden>\n\t\t\t\t\t</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\n\t\t\t<tbody>\n\t\t\t\t{ templates.map( ( template ) => (\n\t\t\t\t\t<tr\n\t\t\t\t\t\tkey={ template.id }\n\t\t\t\t\t\tclassName=\"edit-site-list-table-row\"\n\t\t\t\t\t\trole=\"row\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<td className=\"edit-site-list-table-column\" role=\"cell\">\n\t\t\t\t\t\t\t<Heading level={ 4 }>\n\t\t\t\t\t\t\t\t<Link\n\t\t\t\t\t\t\t\t\tparams={ {\n\t\t\t\t\t\t\t\t\t\tpostId: template.id,\n\t\t\t\t\t\t\t\t\t\tpostType: template.type,\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{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\ttemplate.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\t\ttemplate.slug\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</Link>\n\t\t\t\t\t\t\t</Heading>\n\t\t\t\t\t\t\t{ template.description }\n\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t<td className=\"edit-site-list-table-column\" role=\"cell\">\n\t\t\t\t\t\t\t<AddedBy\n\t\t\t\t\t\t\t\ttemplateType={ templateType }\n\t\t\t\t\t\t\t\ttemplate={ template }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td className=\"edit-site-list-table-column\" role=\"cell\">\n\t\t\t\t\t\t\t<Actions template={ template } />\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t) ) }\n\t\t\t</tbody>\n\t\t</table>\n\t);\n}\n"]}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import apiFetch from '@wordpress/api-fetch';
5
+ import { addQueryArgs } from '@wordpress/url';
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+
10
+ import history from '../../utils/history';
11
+ import getIsListPage from '../../utils/get-is-list-page';
12
+
13
+ function getNeedsHomepageRedirect(params) {
14
+ const {
15
+ postType
16
+ } = params;
17
+ return !getIsListPage(params) && !['post', 'page', 'wp_template', 'wp_template_part'].includes(postType);
18
+ }
19
+ /**
20
+ * Returns the postType and postId of the default homepage.
21
+ *
22
+ * @param {string} siteUrl The URL of the site.
23
+ * @return {Object} An object containing the postType and postId properties
24
+ * or `undefined` if a homepage could not be found.
25
+ */
26
+
27
+
28
+ async function getHomepageParams(siteUrl) {
29
+ const siteSettings = await apiFetch({
30
+ path: '/wp/v2/settings'
31
+ });
32
+
33
+ if (!siteSettings) {
34
+ throw new Error('`getHomepageParams`: unable to load site settings.');
35
+ }
36
+
37
+ const {
38
+ show_on_front: showOnFront,
39
+ page_on_front: frontpageId
40
+ } = siteSettings; // If the user has set a page as the homepage, use those details.
41
+
42
+ if (showOnFront === 'page') {
43
+ return {
44
+ postType: 'page',
45
+ postId: frontpageId
46
+ };
47
+ } // Else get the home template.
48
+ // This matches the logic in `__experimentalGetTemplateForLink`.
49
+ // (packages/core-data/src/resolvers.js)
50
+
51
+
52
+ const template = await window.fetch(addQueryArgs(siteUrl, {
53
+ '_wp-find-template': true
54
+ })).then(response => {
55
+ if (!response.ok) {
56
+ throw new Error(`\`getHomepageParams\`: HTTP status error, ${response.status} ${response.statusText}`);
57
+ }
58
+
59
+ return response.json();
60
+ }).then(_ref => {
61
+ let {
62
+ data
63
+ } = _ref;
64
+
65
+ if (data.message) {
66
+ throw new Error(`\`getHomepageParams\`: REST API error, ${data.message}`);
67
+ }
68
+
69
+ return data;
70
+ });
71
+
72
+ if (!(template !== null && template !== void 0 && template.id)) {
73
+ throw new Error('`getHomepageParams`: unable to find home template.');
74
+ }
75
+
76
+ return {
77
+ postType: 'wp_template',
78
+ postId: template.id
79
+ };
80
+ }
81
+
82
+ export default async function redirectToHomepage(siteUrl) {
83
+ const searchParams = new URLSearchParams(history.location.search);
84
+ const params = Object.fromEntries(searchParams.entries());
85
+
86
+ if (getNeedsHomepageRedirect(params)) {
87
+ const homepageParams = await getHomepageParams(siteUrl);
88
+
89
+ if (homepageParams) {
90
+ history.replace(homepageParams);
91
+ }
92
+ }
93
+ }
94
+ //# sourceMappingURL=redirect-to-homepage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/routes/redirect-to-homepage.js"],"names":["apiFetch","addQueryArgs","history","getIsListPage","getNeedsHomepageRedirect","params","postType","includes","getHomepageParams","siteUrl","siteSettings","path","Error","show_on_front","showOnFront","page_on_front","frontpageId","postId","template","window","fetch","then","response","ok","status","statusText","json","data","message","id","redirectToHomepage","searchParams","URLSearchParams","location","search","Object","fromEntries","entries","homepageParams","replace"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,QAAP,MAAqB,sBAArB;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA;AACA;AACA;;AACA,OAAOC,OAAP,MAAoB,qBAApB;AACA,OAAOC,aAAP,MAA0B,8BAA1B;;AAEA,SAASC,wBAAT,CAA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ce,IAAI,CAACC,OAAS,EADpD,CAAN;AAGA;;AAED,WAAOD,IAAP;AACA,GAnBqB,CAAvB;;AAqBA,MAAK,EAAET,QAAF,aAAEA,QAAF,eAAEA,QAAQ,CAAEW,EAAZ,CAAL,EAAsB;AACrB,UAAM,IAAIjB,KAAJ,CAAW,oDAAX,CAAN;AACA;;AAED,SAAO;AACNN,IAAAA,QAAQ,EAAE,aADJ;AAENW,IAAAA,MAAM,EAAEC,QAAQ,CAACW;AAFX,GAAP;AAIA;;AAED,eAAe,eAAeC,kBAAf,CAAmCrB,OAAnC,EAA6C;AAC3D,QAAMsB,YAAY,GAAG,IAAIC,eAAJ,CAAqB9B,OAAO,CAAC+B,QAAR,CAAiBC,MAAtC,CAArB;AACA,QAAM7B,MAAM,GAAG8B,MAAM,CAACC,WAAP,CAAoBL,YAAY,CAACM,OAAb,EAApB,CAAf;;AAEA,MAAKjC,wBAAwB,CAAEC,MAAF,CAA7B,EAA0C;AACzC,UAAMiC,cAAc,GAAG,MAAM9B,iBAAiB,CAAEC,OAAF,CAA9C;;AAEA,QAAK6B,cAAL,EAAsB;AACrBpC,MAAAA,OAAO,CAACqC,OAAR,CAAiBD,cAAjB;AACA;AACD;AACD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport history from '../../utils/history';\nimport getIsListPage from '../../utils/get-is-list-page';\n\nfunction getNeedsHomepageRedirect( params ) {\n\tconst { postType } = params;\n\treturn (\n\t\t! getIsListPage( params ) &&\n\t\t! [ 'post', 'page', 'wp_template', 'wp_template_part' ].includes(\n\t\t\tpostType\n\t\t)\n\t);\n}\n\n/**\n * Returns the postType and postId of the default homepage.\n *\n * @param {string} siteUrl The URL of the site.\n * @return {Object} An object containing the postType and postId properties\n * or `undefined` if a homepage could not be found.\n */\nasync function getHomepageParams( siteUrl ) {\n\tconst siteSettings = await apiFetch( { path: '/wp/v2/settings' } );\n\tif ( ! siteSettings ) {\n\t\tthrow new Error( '`getHomepageParams`: unable to load site settings.' );\n\t}\n\n\tconst {\n\t\tshow_on_front: showOnFront,\n\t\tpage_on_front: frontpageId,\n\t} = siteSettings;\n\n\t// If the user has set a page as the homepage, use those details.\n\tif ( showOnFront === 'page' ) {\n\t\treturn {\n\t\t\tpostType: 'page',\n\t\t\tpostId: frontpageId,\n\t\t};\n\t}\n\n\t// Else get the home template.\n\t// This matches the logic in `__experimentalGetTemplateForLink`.\n\t// (packages/core-data/src/resolvers.js)\n\tconst template = await window\n\t\t.fetch( addQueryArgs( siteUrl, { '_wp-find-template': true } ) )\n\t\t.then( ( response ) => {\n\t\t\tif ( ! response.ok ) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`\\`getHomepageParams\\`: HTTP status error, ${ response.status } ${ response.statusText }`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn response.json();\n\t\t} )\n\t\t.then( ( { data } ) => {\n\t\t\tif ( data.message ) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`\\`getHomepageParams\\`: REST API error, ${ data.message }`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn data;\n\t\t} );\n\n\tif ( ! template?.id ) {\n\t\tthrow new Error( '`getHomepageParams`: unable to find home template.' );\n\t}\n\n\treturn {\n\t\tpostType: 'wp_template',\n\t\tpostId: template.id,\n\t};\n}\n\nexport default async function redirectToHomepage( siteUrl ) {\n\tconst searchParams = new URLSearchParams( history.location.search );\n\tconst params = Object.fromEntries( searchParams.entries() );\n\n\tif ( getNeedsHomepageRedirect( params ) ) {\n\t\tconst homepageParams = await getHomepageParams( siteUrl );\n\n\t\tif ( homepageParams ) {\n\t\t\thistory.replace( homepageParams );\n\t\t}\n\t}\n}\n"]}
@@ -42,8 +42,11 @@ export default function ConvertToTemplatePart(_ref) {
42
42
  title,
43
43
  area
44
44
  } = _ref2;
45
+ // Currently template parts only allow latin chars.
46
+ // Fallback slug will receive suffix by default.
47
+ const cleanSlug = kebabCase(title).replace(/[^\w-]+/g, '') || 'wp-custom-part';
45
48
  const templatePart = await saveEntityRecord('postType', 'wp_template_part', {
46
- slug: kebabCase(title),
49
+ slug: cleanSlug,
47
50
  title,
48
51
  content: serialize(blocks),
49
52
  area
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/template-part-converter/convert-to-template-part.js"],"names":["kebabCase","useDispatch","BlockSettingsMenuControls","store","blockEditorStore","MenuItem","createBlock","serialize","__","useState","coreStore","noticesStore","CreateTemplatePartModal","ConvertToTemplatePart","clientIds","blocks","isModalOpen","setIsModalOpen","replaceBlocks","saveEntityRecord","createSuccessNotice","onConvert","title","area","templatePart","slug","content","theme","type"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AAEA;AACA;AACA;;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SACCC,yBADD,EAECC,KAAK,IAAIC,gBAFV,QAGO,yBAHP;AAIA,SAASC,QAAT,QAAyB,uBAAzB;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,mBAAvC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASN,KAAK,IAAIO,SAAlB,QAAmC,sBAAnC;AACA,SAASP,KAAK,IAAIQ,YAAlB,QAAsC,oBAAtC;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,+BAApC;AAEA,eAAe,SAASC,qBAAT,OAAwD;AAAA,MAAxB;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,GAAwB;AACtE,QAAM,CAAEC,WAAF,EAAeC,cAAf,IAAkCR,QAAQ,CAAE,KAAF,CAAhD;AACA,QAAM;AAAES,IAAAA;AAAF,MAAoBjB,WAAW,CAAEG,gBAAF,CAArC;AACA,QAAM;AAAEe,IAAAA;AAAF,MAAuBlB,WAAW,CAAES,SAAF,CAAxC;AACA,QAAM;AAAEU,IAAAA;AAAF,MAA0BnB,WAAW,CAAEU,YAAF,CAA3C;;AAEA,QAAMU,SAAS,GAAG,eAA6B;AAAA,QAArB;AAAEC,MAAAA,KAAF;AAASC,MAAAA;AAAT,KAAqB;AAC9C,UAAMC,YAAY,GAAG,MAAML,gBAAgB,CAC1C,UAD0C,EAE1C,kBAF0C,EAG1C;AACCM,MAAAA,IAAI,EAAEzB,SAAS,CAAEsB,KAAF,CADhB;AAECA,MAAAA,KAFD;AAGCI,MAAAA,OAAO,EAAEnB,SAAS,CAAEQ,MAAF,CAHnB;AAICQ,MAAAA;AAJD,KAH0C,CAA3C;AAUAL,IAAAA,aAAa,CACZJ,SADY,EAEZR,WAAW,CAAE,oBAAF,EAAwB;AAClCmB,MAAAA,IAAI,EAAED,YAAY,CAACC,IADe;AAElCE,MAAAA,KAAK,EAAEH,YAAY,CAACG;AAFc,KAAxB,CAFC,CAAb;AAOAP,IAAAA,mBAAmB,CAAEZ,EAAE,CAAE,wBAAF,CAAJ,EAAkC;AACpDoB,MAAAA,IAAI,EAAE;AAD8C,KAAlC,CAAnB,CAlB8C,CAsB9C;AACA;AACA,GAxBD;;AA0BA,SACC,8BACC,cAAC,yBAAD,QACG,MACD,cAAC,QAAD;AACC,IAAA,OAAO,EAAG,MAAM;AACfX,MAAAA,cAAc,CAAE,IAAF,CAAd;AACA;AAHF,KAKGT,EAAE,CAAE,oBAAF,CALL,CAFF,CADD,EAYGQ,WAAW,IACZ,cAAC,uBAAD;AACC,IAAA,UAAU,EAAG,MAAM;AAClBC,MAAAA,cAAc,CAAE,KAAF,CAAd;AACA,KAHF;AAIC,IAAA,QAAQ,EAAGI;AAJZ,IAbF,CADD;AAuBA","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport {\n\tBlockSettingsMenuControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { MenuItem } from '@wordpress/components';\nimport { createBlock, serialize } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport CreateTemplatePartModal from '../create-template-part-modal';\n\nexport default function ConvertToTemplatePart( { clientIds, blocks } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst onConvert = async ( { title, area } ) => {\n\t\tconst templatePart = await saveEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\t{\n\t\t\t\tslug: kebabCase( title ),\n\t\t\t\ttitle,\n\t\t\t\tcontent: serialize( blocks ),\n\t\t\t\tarea,\n\t\t\t}\n\t\t);\n\t\treplaceBlocks(\n\t\t\tclientIds,\n\t\t\tcreateBlock( 'core/template-part', {\n\t\t\t\tslug: templatePart.slug,\n\t\t\t\ttheme: templatePart.theme,\n\t\t\t} )\n\t\t);\n\t\tcreateSuccessNotice( __( 'Template part created.' ), {\n\t\t\ttype: 'snackbar',\n\t\t} );\n\n\t\t// The modal and this component will be unmounted because of `replaceBlocks` above,\n\t\t// so no need to call `closeModal` or `onClose`.\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t{ () => (\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetIsModalOpen( true );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Make template part' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t) }\n\t\t\t</BlockSettingsMenuControls>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<CreateTemplatePartModal\n\t\t\t\t\tcloseModal={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\tonCreate={ onConvert }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/template-part-converter/convert-to-template-part.js"],"names":["kebabCase","useDispatch","BlockSettingsMenuControls","store","blockEditorStore","MenuItem","createBlock","serialize","__","useState","coreStore","noticesStore","CreateTemplatePartModal","ConvertToTemplatePart","clientIds","blocks","isModalOpen","setIsModalOpen","replaceBlocks","saveEntityRecord","createSuccessNotice","onConvert","title","area","cleanSlug","replace","templatePart","slug","content","theme","type"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AAEA;AACA;AACA;;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SACCC,yBADD,EAECC,KAAK,IAAIC,gBAFV,QAGO,yBAHP;AAIA,SAASC,QAAT,QAAyB,uBAAzB;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,mBAAvC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASN,KAAK,IAAIO,SAAlB,QAAmC,sBAAnC;AACA,SAASP,KAAK,IAAIQ,YAAlB,QAAsC,oBAAtC;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,+BAApC;AAEA,eAAe,SAASC,qBAAT,OAAwD;AAAA,MAAxB;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,GAAwB;AACtE,QAAM,CAAEC,WAAF,EAAeC,cAAf,IAAkCR,QAAQ,CAAE,KAAF,CAAhD;AACA,QAAM;AAAES,IAAAA;AAAF,MAAoBjB,WAAW,CAAEG,gBAAF,CAArC;AACA,QAAM;AAAEe,IAAAA;AAAF,MAAuBlB,WAAW,CAAES,SAAF,CAAxC;AACA,QAAM;AAAEU,IAAAA;AAAF,MAA0BnB,WAAW,CAAEU,YAAF,CAA3C;;AAEA,QAAMU,SAAS,GAAG,eAA6B;AAAA,QAArB;AAAEC,MAAAA,KAAF;AAASC,MAAAA;AAAT,KAAqB;AAC9C;AACA;AACA,UAAMC,SAAS,GACdxB,SAAS,CAAEsB,KAAF,CAAT,CAAmBG,OAAnB,CAA4B,UAA5B,EAAwC,EAAxC,KAAgD,gBADjD;AAGA,UAAMC,YAAY,GAAG,MAAMP,gBAAgB,CAC1C,UAD0C,EAE1C,kBAF0C,EAG1C;AACCQ,MAAAA,IAAI,EAAEH,SADP;AAECF,MAAAA,KAFD;AAGCM,MAAAA,OAAO,EAAErB,SAAS,CAAEQ,MAAF,CAHnB;AAICQ,MAAAA;AAJD,KAH0C,CAA3C;AAUAL,IAAAA,aAAa,CACZJ,SADY,EAEZR,WAAW,CAAE,oBAAF,EAAwB;AAClCqB,MAAAA,IAAI,EAAED,YAAY,CAACC,IADe;AAElCE,MAAAA,KAAK,EAAEH,YAAY,CAACG;AAFc,KAAxB,CAFC,CAAb;AAOAT,IAAAA,mBAAmB,CAAEZ,EAAE,CAAE,wBAAF,CAAJ,EAAkC;AACpDsB,MAAAA,IAAI,EAAE;AAD8C,KAAlC,CAAnB,CAvB8C,CA2B9C;AACA;AACA,GA7BD;;AA+BA,SACC,8BACC,cAAC,yBAAD,QACG,MACD,cAAC,QAAD;AACC,IAAA,OAAO,EAAG,MAAM;AACfb,MAAAA,cAAc,CAAE,IAAF,CAAd;AACA;AAHF,KAKGT,EAAE,CAAE,oBAAF,CALL,CAFF,CADD,EAYGQ,WAAW,IACZ,cAAC,uBAAD;AACC,IAAA,UAAU,EAAG,MAAM;AAClBC,MAAAA,cAAc,CAAE,KAAF,CAAd;AACA,KAHF;AAIC,IAAA,QAAQ,EAAGI;AAJZ,IAbF,CADD;AAuBA","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport {\n\tBlockSettingsMenuControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { MenuItem } from '@wordpress/components';\nimport { createBlock, serialize } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport CreateTemplatePartModal from '../create-template-part-modal';\n\nexport default function ConvertToTemplatePart( { clientIds, blocks } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst onConvert = async ( { title, area } ) => {\n\t\t// Currently template parts only allow latin chars.\n\t\t// Fallback slug will receive suffix by default.\n\t\tconst cleanSlug =\n\t\t\tkebabCase( title ).replace( /[^\\w-]+/g, '' ) || 'wp-custom-part';\n\n\t\tconst templatePart = await saveEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\t{\n\t\t\t\tslug: cleanSlug,\n\t\t\t\ttitle,\n\t\t\t\tcontent: serialize( blocks ),\n\t\t\t\tarea,\n\t\t\t}\n\t\t);\n\t\treplaceBlocks(\n\t\t\tclientIds,\n\t\t\tcreateBlock( 'core/template-part', {\n\t\t\t\tslug: templatePart.slug,\n\t\t\t\ttheme: templatePart.theme,\n\t\t\t} )\n\t\t);\n\t\tcreateSuccessNotice( __( 'Template part created.' ), {\n\t\t\ttype: 'snackbar',\n\t\t} );\n\n\t\t// The modal and this component will be unmounted because of `replaceBlocks` above,\n\t\t// so no need to call `closeModal` or `onClose`.\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t{ () => (\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetIsModalOpen( true );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Make template part' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t) }\n\t\t\t</BlockSettingsMenuControls>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<CreateTemplatePartModal\n\t\t\t\t\tcloseModal={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\tonCreate={ onConvert }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
@@ -2,36 +2,27 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { useEffect } from '@wordpress/element';
5
- import { useDispatch, useSelect } from '@wordpress/data';
5
+ import { useDispatch } from '@wordpress/data';
6
6
  /**
7
7
  * Internal dependencies
8
8
  */
9
9
 
10
- import { useLocation, useHistory } from '../routes';
10
+ import { useLocation } from '../routes';
11
11
  import { store as editSiteStore } from '../../store';
12
12
  export default function URLQueryController() {
13
13
  const {
14
14
  setTemplate,
15
15
  setTemplatePart,
16
- showHomepage,
17
16
  setPage
18
17
  } = useDispatch(editSiteStore);
19
- const history = useHistory();
20
18
  const {
21
19
  params: {
22
20
  postId,
23
21
  postType
24
22
  }
25
- } = useLocation();
26
- const {
27
- getPage,
28
- getEditedPostId,
29
- getEditedPostType
30
- } = useSelect(editSiteStore); // Set correct entity on page navigation.
23
+ } = useLocation(); // Set correct entity on page navigation.
31
24
 
32
25
  useEffect(() => {
33
- let isMounted = true;
34
-
35
26
  if ('page' === postType || 'post' === postType) {
36
27
  setPage({
37
28
  context: {
@@ -43,35 +34,7 @@ export default function URLQueryController() {
43
34
  setTemplate(postId);
44
35
  } else if ('wp_template_part' === postType) {
45
36
  setTemplatePart(postId);
46
- } else {
47
- showHomepage().then(() => {
48
- var _page$context, _page$context2;
49
-
50
- if (!isMounted) {
51
- return;
52
- }
53
-
54
- const page = getPage();
55
- const editedPostId = getEditedPostId();
56
- const editedPostType = getEditedPostType();
57
-
58
- if (page !== null && page !== void 0 && (_page$context = page.context) !== null && _page$context !== void 0 && _page$context.postId && page !== null && page !== void 0 && (_page$context2 = page.context) !== null && _page$context2 !== void 0 && _page$context2.postType) {
59
- history.replace({
60
- postId: page.context.postId,
61
- postType: page.context.postType
62
- });
63
- } else if (editedPostId && editedPostType) {
64
- history.replace({
65
- postId: editedPostId,
66
- postType: editedPostType
67
- });
68
- }
69
- });
70
37
  }
71
-
72
- return () => {
73
- isMounted = false;
74
- };
75
38
  }, [postId, postType]);
76
39
  return null;
77
40
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/url-query-controller/index.js"],"names":["useEffect","useDispatch","useSelect","useLocation","useHistory","store","editSiteStore","URLQueryController","setTemplate","setTemplatePart","showHomepage","setPage","history","params","postId","postType","getPage","getEditedPostId","getEditedPostType","isMounted","context","then","page","editedPostId","editedPostType","replace"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AAEA;AACA;AACA;;AACA,SAASC,WAAT,EAAsBC,UAAtB,QAAwC,WAAxC;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,kBAAT,GAA8B;AAC5C,QAAM;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,eAAf;AAAgCC,IAAAA,YAAhC;AAA8CC,IAAAA;AAA9C,MAA0DV,WAAW,CAC1EK,aAD0E,CAA3E;AAGA,QAAMM,OAAO,GAAGR,UAAU,EAA1B;AACA,QAAM;AACLS,IAAAA,MAAM,EAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA;AAAV;AADH,MAEFZ,WAAW,EAFf;AAGA,QAAM;AAAEa,IAAAA,OAAF;AAAWC,IAAAA,eAAX;AAA4BC,IAAAA;AAA5B,MAAkDhB,SAAS,CAChEI,aADgE,CAAjE,CAR4C,CAY5C;;AACAN,EAAAA,SAAS,CAAE,MAAM;AAChB,QAAImB,SAAS,GAAG,IAAhB;;AAEA,QAAK,WAAWJ,QAAX,IAAuB,WAAWA,QAAvC,EAAkD;A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n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useLocation, useHistory } from '../routes';\nimport { store as editSiteStore } from '../../store';\n\nexport default function URLQueryController() {\n\tconst { setTemplate, setTemplatePart, showHomepage, setPage } = useDispatch(\n\t\teditSiteStore\n\t);\n\tconst history = useHistory();\n\tconst {\n\t\tparams: { postId, postType },\n\t} = useLocation();\n\tconst { getPage, getEditedPostId, getEditedPostType } = useSelect(\n\t\teditSiteStore\n\t);\n\n\t// Set correct entity on page navigation.\n\tuseEffect( () => {\n\t\tlet isMounted = true;\n\n\t\tif ( 'page' === postType || 'post' === postType ) {\n\t\t\tsetPage( { context: { postType, postId } } ); // Resolves correct template based on ID.\n\t\t} else if ( 'wp_template' === postType ) {\n\t\t\tsetTemplate( postId );\n\t\t} else if ( 'wp_template_part' === postType ) {\n\t\t\tsetTemplatePart( postId );\n\t\t} else {\n\t\t\tshowHomepage().then( () => {\n\t\t\t\tif ( ! isMounted ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst page = getPage();\n\t\t\t\tconst editedPostId = getEditedPostId();\n\t\t\t\tconst editedPostType = getEditedPostType();\n\n\t\t\t\tif ( page?.context?.postId && page?.context?.postType ) {\n\t\t\t\t\thistory.replace( {\n\t\t\t\t\t\tpostId: page.context.postId,\n\t\t\t\t\t\tpostType: page.context.postType,\n\t\t\t\t\t} );\n\t\t\t\t} else if ( editedPostId && editedPostType ) {\n\t\t\t\t\thistory.replace( {\n\t\t\t\t\t\tpostId: editedPostId,\n\t\t\t\t\t\tpostType: editedPostType,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\treturn () => {\n\t\t\tisMounted = false;\n\t\t};\n\t}, [ postId, postType ] );\n\n\treturn null;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/url-query-controller/index.js"],"names":["useEffect","useDispatch","useLocation","store","editSiteStore","URLQueryController","setTemplate","setTemplatePart","setPage","params","postId","postType","context"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,SAASC,WAAT,QAA4B,iBAA5B;AAEA;AACA;AACA;;AACA,SAASC,WAAT,QAA4B,WAA5B;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,kBAAT,GAA8B;AAC5C,QAAM;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,eAAf;AAAgCC,IAAAA;AAAhC,MAA4CP,WAAW,CAC5DG,aAD4D,CAA7D;AAGA,QAAM;AACLK,IAAAA,MAAM,EAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA;AAAV;AADH,MAEFT,WAAW,EAFf,CAJ4C,CAQ5C;;AACAF,EAAAA,SAAS,CAAE,MAAM;AAChB,QAAK,WAAWW,QAAX,IAAuB,WAAWA,QAAvC,EAAkD;AACjDH,MAAAA,OAAO,CAAE;AAAEI,QAAAA,OAAO,EAAE;AAAED,UAAAA,QAAF;AAAYD,UAAAA;AAAZ;AAAX,OAAF,CAAP,CADiD,CACH;AAC9C,KAFD,MAEO,IAAK,kBAAkBC,QAAvB,EAAkC;AACxCL,MAAAA,WAAW,CAAEI,MAAF,CAAX;AACA,KAFM,MAEA,IAAK,uBAAuBC,QAA5B,EAAuC;AAC7CJ,MAAAA,eAAe,CAAEG,MAAF,CAAf;AACA;AACD,GARQ,EAQN,CAAEA,MAAF,EAAUC,QAAV,CARM,CAAT;AAUA,SAAO,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useLocation } from '../routes';\nimport { store as editSiteStore } from '../../store';\n\nexport default function URLQueryController() {\n\tconst { setTemplate, setTemplatePart, setPage } = useDispatch(\n\t\teditSiteStore\n\t);\n\tconst {\n\t\tparams: { postId, postType },\n\t} = useLocation();\n\n\t// Set correct entity on page navigation.\n\tuseEffect( () => {\n\t\tif ( 'page' === postType || 'post' === postType ) {\n\t\t\tsetPage( { context: { postType, postId } } ); // Resolves correct template based on ID.\n\t\t} else if ( 'wp_template' === postType ) {\n\t\t\tsetTemplate( postId );\n\t\t} else if ( 'wp_template_part' === postType ) {\n\t\t\tsetTemplatePart( postId );\n\t\t}\n\t}, [ postId, postType ] );\n\n\treturn null;\n}\n"]}
@@ -9,17 +9,19 @@ import { dispatch, select } from '@wordpress/data';
9
9
  import { render, unmountComponentAtNode } from '@wordpress/element';
10
10
  import { __experimentalFetchLinkSuggestions as fetchLinkSuggestions, __experimentalFetchUrlData as fetchUrlData } from '@wordpress/core-data';
11
11
  import { store as editorStore } from '@wordpress/editor';
12
+ import { __ } from '@wordpress/i18n';
12
13
  import { store as viewportStore } from '@wordpress/viewport';
13
14
  import { getQueryArgs } from '@wordpress/url';
14
15
  /**
15
16
  * Internal dependencies
16
17
  */
17
18
 
18
- import './plugins';
19
19
  import './hooks';
20
20
  import { store as editSiteStore } from './store';
21
21
  import EditSiteApp from './components/app';
22
22
  import getIsListPage from './utils/get-is-list-page';
23
+ import redirectToHomepage from './components/routes/redirect-to-homepage';
24
+ import ErrorBoundaryWarning from './components/error-boundary/warning';
23
25
  /**
24
26
  * Reinitializes the editor after the user chooses to reboot the editor after
25
27
  * an unhandled error occurs, replacing previously mounted editor element using
@@ -29,8 +31,23 @@ import getIsListPage from './utils/get-is-list-page';
29
31
  * @param {?Object} settings Editor settings object.
30
32
  */
31
33
 
32
- export function reinitializeEditor(target, settings) {
33
- // This will be a no-op if the target doesn't have any React nodes.
34
+ export async function reinitializeEditor(target, settings) {
35
+ // The site editor relies on `postType` and `postId` params in the URL to
36
+ // define what's being edited. When visiting via the dashboard link, these
37
+ // won't be present. Do a client side redirect to the 'homepage' if that's
38
+ // the case.
39
+ try {
40
+ await redirectToHomepage(settings.siteUrl);
41
+ } catch (error) {
42
+ render(createElement(ErrorBoundaryWarning, {
43
+ message: __('The editor is unable to find a block template for the homepage.'),
44
+ error: error,
45
+ dashboardLink: "index.php"
46
+ }), target);
47
+ return;
48
+ } // This will be a no-op if the target doesn't have any React nodes.
49
+
50
+
34
51
  unmountComponentAtNode(target);
35
52
  const reboot = reinitializeEditor.bind(null, target, settings); // We dispatch actions and update the store synchronously before rendering
36
53
  // so that we won't trigger unnecessary re-renders with useEffect.
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["store","blocksStore","registerCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","dispatch","select","render","unmountComponentAtNode","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","editorStore","viewportStore","getQueryArgs","editSiteStore","EditSiteApp","getIsListPage","reinitializeEditor","target","settings","reboot","bind","updateSettings","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","isLandingOnListPage","window","location","href","setIsNavigationPanelOpened","isViewportMatch","initializeEditor","id","search","searchOptions","__experimentalFetchRichUrlData","__experimentalSpotlightEntityBlocks","document","getElementById","__experimentalReapplyBlockTypeFilters","process","env","GUTENBERG_PHASE","enableFSEBlocks","default","__experimentalMainDashboardButton","__experimentalNavigationToggle","PluginSidebar","PluginSidebarMoreMenuItem","PluginMoreMenuItem"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SACCC,kBADD,EAECC,4CAFD,QAGO,0BAHP;AAIA,SAASC,QAAT,EAAmBC,MAAnB,QAAiC,iBAAjC;AACA,SAASC,MAAT,EAAiBC,sBAAjB,QAA+C,oBAA/C;AACA,SACCC,kCAAkC,IAAIC,oBADvC,EAECC,0BAA0B,IAAIC,YAF/B,QAGO,sBAHP;AAIA,SAASX,KAAK,IAAIY,WAAlB,QAAqC,mBAArC;AACA,SAASZ,KAAK,IAAIa,aAAlB,QAAuC,qBAAvC;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAE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AE2B,MAAF,EAAUC,aAAV,KAC7C3B,oBAAoB,CAAE0B,MAAF,EAAUC,aAAV,EAAyBhB,QAAzB,CADrB;;AAEAA,EAAAA,QAAQ,CAACiB,8BAAT,GAA0C1B,YAA1C;AACAS,EAAAA,QAAQ,CAACkB,mCAAT,GAA+C,CAAE,oBAAF,CAA/C;AAEA,QAAMnB,MAAM,GAAGoB,QAAQ,CAACC,cAAT,CAAyBN,EAAzB,CAAf;;AAEA9B,EAAAA,QAAQ,CAAEH,WAAF,CAAR,CAAwBwC,qCAAxB;;AACAvC,EAAAA,kBAAkB;;AAClB,MAAKwC,OAAO,CAACC,GAAR,CAAYC,eAAZ,KAAgC,CAArC,EAAyC;AACxCzC,IAAAA,4CAA4C,CAAE;AAC7C0C,MAAAA,eAAe,EAAE;AAD4B,KAAF,CAA5C;AAGA;;AAED3B,EAAAA,kBAAkB,CAAEC,MAAF,EAAUC,QAAV,CAAlB;AACA;AAED,SAAS0B,OAAO,IAAIC,iCAApB,QAA6D,oCAA7D;AACA,SAASD,OAAO,IAAIE,8BAApB,QAA0D,mDAA1D;AACA,SAASF,OAAO,IAAIG,aAApB,QAAyC,qCAAzC;AACA,SAASH,OAAO,IAAII,yBAApB,QAAqD,mDAArD;AACA,SAASJ,OAAO,IAAIK,kBAApB,QAA8C,2CAA9C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch, select } from '@wordpress/data';\nimport { render, unmountComponentAtNode } from '@wordpress/element';\nimport {\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as viewportStore } from '@wordpress/viewport';\nimport { getQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport './plugins';\nimport './hooks';\nimport { store as editSiteStore } from './store';\nimport EditSiteApp from './components/app';\nimport getIsListPage from './utils/get-is-list-page';\n\n/**\n * Reinitializes the editor after the user chooses to reboot the editor after\n * an unhandled error occurs, replacing previously mounted editor element using\n * an initial state from prior to the crash.\n *\n * @param {Element} target DOM node in which editor is rendered.\n * @param {?Object} settings Editor settings object.\n */\nexport function reinitializeEditor( target, settings ) {\n\t// This will be a no-op if the target doesn't have any React nodes.\n\tunmountComponentAtNode( target );\n\tconst reboot = reinitializeEditor.bind( null, target, settings );\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\t{\n\t\tdispatch( editSiteStore ).updateSettings( settings );\n\t\t// Keep the defaultTemplateTypes in the core/editor settings too,\n\t\t// so that they can be selected with core/editor selectors in any editor.\n\t\t// This is needed because edit-site doesn't initialize with EditorProvider,\n\t\t// which internally uses updateEditorSettings as well.\n\t\tdispatch( editorStore ).updateEditorSettings( {\n\t\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t\t} );\n\n\t\tconst isLandingOnListPage = getIsListPage(\n\t\t\tgetQueryArgs( window.location.href )\n\t\t);\n\n\t\tif ( isLandingOnListPage ) {\n\t\t\t// Default the navigation panel to be opened when we're in a bigger\n\t\t\t// screen and land in the list screen.\n\t\t\tdispatch( editSiteStore ).setIsNavigationPanelOpened(\n\t\t\t\tselect( viewportStore ).isViewportMatch( 'medium' )\n\t\t\t);\n\t\t}\n\t}\n\n\trender( <EditSiteApp reboot={ reboot } />, target );\n}\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tsettings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>\n\t\tfetchLinkSuggestions( search, searchOptions, settings );\n\tsettings.__experimentalFetchRichUrlData = fetchUrlData;\n\tsettings.__experimentalSpotlightEntityBlocks = [ 'core/template-part' ];\n\n\tconst target = document.getElementById( id );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tregisterCoreBlocks();\n\tif ( process.env.GUTENBERG_PHASE === 2 ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\treinitializeEditor( target, settings );\n}\n\nexport { default as __experimentalMainDashboardButton } from './components/main-dashboard-button';\nexport { default as __experimentalNavigationToggle } from './components/navigation-sidebar/navigation-toggle';\nexport { default as PluginSidebar } from './components/sidebar/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';\nexport { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["store","blocksStore","registerCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","dispatch","select","render","unmountComponentAtNode","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","editorStore","__","viewportStore","getQueryArgs","editSiteStore","EditSiteApp","getIsListPage","redirectToHomepage","ErrorBoundaryWarning","reinitializeEditor","target","settings","siteUrl","error","reboot","bind","updateSettings","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","isLandingOnListPage","window","location","href","setIsNavigationPanelOpened","isViewportMatch","initializeEditor","id","search","searchOptions","__experimentalFetchRichUrlData","__experimentalSpotlightEntityBlocks","document","getElementById","__experimentalReapplyBlockTypeFilters","process","env","GUTENBERG_PHASE","enableFSEBlocks","default","__experimentalMainDashboardButton","__experimentalNavigationToggle","PluginSidebar","PluginSidebarMoreMenuItem","PluginMoreMenuItem"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SACCC,kBADD,EAECC,4CAFD,QAGO,0BAHP;AAIA,SAASC,QAAT,EAAmBC,MAAnB,QAAiC,iBA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AUC,QAAV,CAAlB;AACA;AAED,SAAS4B,OAAO,IAAIC,iCAApB,QAA6D,oCAA7D;AACA,SAASD,OAAO,IAAIE,8BAApB,QAA0D,mDAA1D;AACA,SAASF,OAAO,IAAIG,aAApB,QAAyC,qCAAzC;AACA,SAASH,OAAO,IAAII,yBAApB,QAAqD,mDAArD;AACA,SAASJ,OAAO,IAAIK,kBAApB,QAA8C,2CAA9C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch, select } from '@wordpress/data';\nimport { render, unmountComponentAtNode } from '@wordpress/element';\nimport {\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\nimport { store as viewportStore } from '@wordpress/viewport';\nimport { getQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport { store as editSiteStore } from './store';\nimport EditSiteApp from './components/app';\nimport getIsListPage from './utils/get-is-list-page';\nimport redirectToHomepage from './components/routes/redirect-to-homepage';\nimport ErrorBoundaryWarning from './components/error-boundary/warning';\n\n/**\n * Reinitializes the editor after the user chooses to reboot the editor after\n * an unhandled error occurs, replacing previously mounted editor element using\n * an initial state from prior to the crash.\n *\n * @param {Element} target DOM node in which editor is rendered.\n * @param {?Object} settings Editor settings object.\n */\nexport async function reinitializeEditor( target, settings ) {\n\t// The site editor relies on `postType` and `postId` params in the URL to\n\t// define what's being edited. When visiting via the dashboard link, these\n\t// won't be present. Do a client side redirect to the 'homepage' if that's\n\t// the case.\n\ttry {\n\t\tawait redirectToHomepage( settings.siteUrl );\n\t} catch ( error ) {\n\t\trender(\n\t\t\t<ErrorBoundaryWarning\n\t\t\t\tmessage={ __(\n\t\t\t\t\t'The editor is unable to find a block template for the homepage.'\n\t\t\t\t) }\n\t\t\t\terror={ error }\n\t\t\t\tdashboardLink=\"index.php\"\n\t\t\t/>,\n\t\t\ttarget\n\t\t);\n\t\treturn;\n\t}\n\n\t// This will be a no-op if the target doesn't have any React nodes.\n\tunmountComponentAtNode( target );\n\tconst reboot = reinitializeEditor.bind( null, target, settings );\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\t{\n\t\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t\t// Keep the defaultTemplateTypes in the core/editor settings too,\n\t\t// so that they can be selected with core/editor selectors in any editor.\n\t\t// This is needed because edit-site doesn't initialize with EditorProvider,\n\t\t// which internally uses updateEditorSettings as well.\n\t\tdispatch( editorStore ).updateEditorSettings( {\n\t\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t\t} );\n\n\t\tconst isLandingOnListPage = getIsListPage(\n\t\t\tgetQueryArgs( window.location.href )\n\t\t);\n\n\t\tif ( isLandingOnListPage ) {\n\t\t\t// Default the navigation panel to be opened when we're in a bigger\n\t\t\t// screen and land in the list screen.\n\t\t\tdispatch( editSiteStore ).setIsNavigationPanelOpened(\n\t\t\t\tselect( viewportStore ).isViewportMatch( 'medium' )\n\t\t\t);\n\t\t}\n\t}\n\n\trender( <EditSiteApp reboot={ reboot } />, target );\n}\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tsettings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>\n\t\tfetchLinkSuggestions( search, searchOptions, settings );\n\tsettings.__experimentalFetchRichUrlData = fetchUrlData;\n\tsettings.__experimentalSpotlightEntityBlocks = [ 'core/template-part' ];\n\n\tconst target = document.getElementById( id );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tregisterCoreBlocks();\n\tif ( process.env.GUTENBERG_PHASE === 2 ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\treinitializeEditor( target, settings );\n}\n\nexport { default as __experimentalMainDashboardButton } from './components/main-dashboard-button';\nexport { default as __experimentalNavigationToggle } from './components/navigation-sidebar/navigation-toggle';\nexport { default as PluginSidebar } from './components/sidebar/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';\nexport { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';\n"]}
@@ -175,10 +175,16 @@ export function* setPage(page) {
175
175
  page.path = getPathAndQueryString(entity.link);
176
176
  }
177
177
 
178
+ const template = yield controls.resolveSelect(coreStore, '__experimentalGetTemplateForLink', page.path);
179
+
180
+ if (!template) {
181
+ return;
182
+ }
183
+
178
184
  const {
179
185
  id: templateId,
180
186
  slug: templateSlug
181
- } = yield controls.resolveSelect(coreStore, '__experimentalGetTemplateForLink', page.path);
187
+ } = template;
182
188
  yield {
183
189
  type: 'SET_PAGE',
184
190
  page: !templateSlug ? page : { ...page,
@@ -190,28 +196,6 @@ export function* setPage(page) {
190
196
  };
191
197
  return templateId;
192
198
  }
193
- /**
194
- * Displays the site homepage for editing in the editor.
195
- */
196
-
197
- export function* showHomepage() {
198
- const {
199
- show_on_front: showOnFront,
200
- page_on_front: frontpageId
201
- } = yield controls.resolveSelect(coreStore, 'getEntityRecord', 'root', 'site');
202
- const {
203
- siteUrl
204
- } = yield controls.select(editSiteStoreName, 'getSettings');
205
- const page = {
206
- path: siteUrl,
207
- context: showOnFront === 'page' ? {
208
- postType: 'page',
209
- postId: frontpageId
210
- } : {}
211
- };
212
- const homeTemplate = yield* setPage(page);
213
- yield setHomeTemplateId(homeTemplate);
214
- }
215
199
  /**
216
200
  * Returns an action object used to set the active navigation panel menu.
217
201
  *
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/store/actions.js"],"names":["parse","__unstableSerializeAndClean","controls","dispatch","apiFetch","addQueryArgs","getPathAndQueryString","__","sprintf","store","noticesStore","coreStore","interfaceStore","STORE_NAME","editSiteStoreName","isTemplateRevertable","toggleFeature","feature","type","__experimentalSetPreviewDeviceType","deviceType","setTemplate","templateId","templateSlug","pageContext","template","resolveSelect","slug","page","context","addTemplate","newTemplate","content","id","blocks","undoIgnore","removeTemplate","force","lastError","select","title","rendered","error","errorMessage","message","code","setTemplatePart","templatePartId","setHomeTemplateId","homeTemplateId","setPage","path","postId","entity","postType","link","showHomepage","show_on_front","showOnFront","page_on_front","frontpageId","siteUrl","homeTemplate","setNavigationPanelActiveMenu","menu","openNavigationPanelToMenu","setIsNavigationPanelOpened","isOpen","setIsInserterOpened","value","updateSettings","settings","setIsListViewOpened","revertTemplate","allowUndo","templateEntity","fileTemplatePath","baseURL","source","fileTemplate","serializeBlocks","blocksForSerialization","edited","raw","undoRevert","editEntityRecord","actions","label","onClick","openGeneralSidebar","name","closeGeneralSidebar"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAT,EAAgBC,2BAAhB,QAAmD,mBAAnD;AACA,SAASC,QAAT,EAAmBC,QAAnB,QAAmC,iBAAnC;AACA,SAASC,QAAT,QAAyB,0BAAzB;AACA,SAASC,YAAT,EAAuBC,qBAAvB,QAAoD,gBAApD;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AACA,SAASF,KAAK,IAAIG,cAAlB,QAAwC,sBAAxC;AAEA;AACA;AACA;;AACA,SAASC,UAAU,IAAIC,iBAAvB,QAAgD,aAAhD;AACA,OAAOC,oBAAP,MAAiC,iCAAjC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,aAAT,CAAwBC,OAAxB,EAAkC;AACxC,SAAO;AACNC,IAAA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,EAAqC;AAC3C,QAAMxF,QAAQ,CAACC,QAAT,CACLS,cADK,EAEL,yBAFK,EAGLE,iBAHK,EAIL4E,IAJK,CAAN;AAMA;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,UAAUC,mBAAV,GAAgC;AACtC,QAAMzF,QAAQ,CAACC,QAAT,CACLS,cADK,EAEL,0BAFK,EAGLE,iBAHK,CAAN;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { parse, __unstableSerializeAndClean } from '@wordpress/blocks';\nimport { controls, dispatch } from '@wordpress/data';\nimport { apiFetch } from '@wordpress/data-controls';\nimport { addQueryArgs, getPathAndQueryString } from '@wordpress/url';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME as editSiteStoreName } from './constants';\nimport isTemplateRevertable from '../utils/is-template-revertable';\n\n/**\n * Returns an action object used to toggle a feature flag.\n *\n * @param {string} feature Feature name.\n *\n * @return {Object} Action object.\n */\nexport function toggleFeature( feature ) {\n\treturn {\n\t\ttype: 'TOGGLE_FEATURE',\n\t\tfeature,\n\t};\n}\n\n/**\n * Returns an action object used to toggle the width of the editing canvas.\n *\n * @param {string} deviceType\n *\n * @return {Object} Action object.\n */\nexport function __experimentalSetPreviewDeviceType( deviceType ) {\n\treturn {\n\t\ttype: 'SET_PREVIEW_DEVICE_TYPE',\n\t\tdeviceType,\n\t};\n}\n\n/**\n * Returns an action object used to set a template.\n *\n * @param {number} templateId The template ID.\n * @param {string} templateSlug The template slug.\n * @return {Object} Action object.\n */\nexport function* setTemplate( templateId, templateSlug ) {\n\tconst pageContext = { templateSlug };\n\tif ( ! templateSlug ) {\n\t\tconst template = yield controls.resolveSelect(\n\t\t\tcoreStore,\n\t\t\t'getEntityRecord',\n\t\t\t'postType',\n\t\t\t'wp_template',\n\t\t\ttemplateId\n\t\t);\n\t\tpageContext.templateSlug = template?.slug;\n\t}\n\treturn {\n\t\ttype: 'SET_TEMPLATE',\n\t\ttemplateId,\n\t\tpage: { context: pageContext },\n\t};\n}\n\n/**\n * Adds a new template, and sets it as the current template.\n *\n * @param {Object} template The template.\n *\n * @return {Object} Action object used to set the current template.\n */\nexport function* addTemplate( template ) {\n\tconst newTemplate = yield controls.dispatch(\n\t\tcoreStore,\n\t\t'saveEntityRecord',\n\t\t'postType',\n\t\t'wp_template',\n\t\ttemplate\n\t);\n\n\tif ( template.content ) {\n\t\tyield controls.dispatch(\n\t\t\tcoreStore,\n\t\t\t'editEntityRecord',\n\t\t\t'postType',\n\t\t\t'wp_template',\n\t\t\tnewTemplate.id,\n\t\t\t{ blocks: parse( template.content ) },\n\t\t\t{ undoIgnore: true }\n\t\t);\n\t}\n\n\treturn {\n\t\ttype: 'SET_TEMPLATE',\n\t\ttemplateId: newTemplate.id,\n\t\tpage: { context: { templateSlug: newTemplate.slug } },\n\t};\n}\n\n/**\n * Removes a template.\n *\n * @param {Object} template The template object.\n */\nexport function* removeTemplate( template ) {\n\ttry {\n\t\tyield controls.dispatch(\n\t\t\tcoreStore,\n\t\t\t'deleteEntityRecord',\n\t\t\t'postType',\n\t\t\ttemplate.type,\n\t\t\ttemplate.id,\n\t\t\t{ force: true }\n\t\t);\n\n\t\tconst lastError = yield controls.select(\n\t\t\tcoreStore,\n\t\t\t'getLastEntityDeleteError',\n\t\t\t'postType',\n\t\t\ttemplate.type,\n\t\t\ttemplate.id\n\t\t);\n\n\t\tif ( lastError ) {\n\t\t\tthrow lastError;\n\t\t}\n\n\t\tyield controls.dispatch(\n\t\t\tnoticesStore,\n\t\t\t'createSuccessNotice',\n\t\t\tsprintf(\n\t\t\t\t/* translators: The template/part's name. */\n\t\t\t\t__( '\"%s\" removed.' ),\n\t\t\t\ttemplate.title.rendered\n\t\t\t),\n\t\t\t{ type: 'snackbar' }\n\t\t);\n\t} catch ( error ) {\n\t\tconst errorMessage =\n\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t? error.message\n\t\t\t\t: __( 'An error occurred while deleting the template.' );\n\n\t\tyield controls.dispatch(\n\t\t\tnoticesStore,\n\t\t\t'createErrorNotice',\n\t\t\terrorMessage,\n\t\t\t{ type: 'snackbar' }\n\t\t);\n\t}\n}\n\n/**\n * Returns an action object used to set a template part.\n *\n * @param {string} templatePartId The template part ID.\n *\n * @return {Object} Action object.\n */\nexport function setTemplatePart( templatePartId ) {\n\treturn {\n\t\ttype: 'SET_TEMPLATE_PART',\n\t\ttemplatePartId,\n\t};\n}\n\n/**\n * Updates the homeTemplateId state with the templateId of the page resolved\n * from the given path.\n *\n * @param {number} homeTemplateId The template ID for the homepage.\n */\nexport function setHomeTemplateId( homeTemplateId ) {\n\treturn {\n\t\ttype: 'SET_HOME_TEMPLATE',\n\t\thomeTemplateId,\n\t};\n}\n\n/**\n * Resolves the template for a page and displays both. If no path is given, attempts\n * to use the postId to generate a path like `?p=${ postId }`.\n *\n * @param {Object} page The page object.\n * @param {string} page.type The page type.\n * @param {string} page.slug The page slug.\n * @param {string} page.path The page path.\n * @param {Object} page.context The page context.\n *\n * @return {number} The resolved template ID for the page route.\n */\nexport function* setPage( page ) {\n\tif ( ! page.path && page.context?.postId ) {\n\t\tconst entity = yield controls.resolveSelect(\n\t\t\tcoreStore,\n\t\t\t'getEntityRecord',\n\t\t\t'postType',\n\t\t\tpage.context.postType || 'post',\n\t\t\tpage.context.postId\n\t\t);\n\n\t\tpage.path = getPathAndQueryString( entity.link );\n\t}\n\tconst { id: templateId, slug: templateSlug } = yield controls.resolveSelect(\n\t\tcoreStore,\n\t\t'__experimentalGetTemplateForLink',\n\t\tpage.path\n\t);\n\tyield {\n\t\ttype: 'SET_PAGE',\n\t\tpage: ! templateSlug\n\t\t\t? page\n\t\t\t: {\n\t\t\t\t\t...page,\n\t\t\t\t\tcontext: {\n\t\t\t\t\t\t...page.context,\n\t\t\t\t\t\ttemplateSlug,\n\t\t\t\t\t},\n\t\t\t },\n\t\ttemplateId,\n\t};\n\treturn templateId;\n}\n\n/**\n * Displays the site homepage for editing in the editor.\n */\nexport function* showHomepage() {\n\tconst {\n\t\tshow_on_front: showOnFront,\n\t\tpage_on_front: frontpageId,\n\t} = yield controls.resolveSelect(\n\t\tcoreStore,\n\t\t'getEntityRecord',\n\t\t'root',\n\t\t'site'\n\t);\n\n\tconst { siteUrl } = yield controls.select(\n\t\teditSiteStoreName,\n\t\t'getSettings'\n\t);\n\n\tconst page = {\n\t\tpath: siteUrl,\n\t\tcontext:\n\t\t\tshowOnFront === 'page'\n\t\t\t\t? {\n\t\t\t\t\t\tpostType: 'page',\n\t\t\t\t\t\tpostId: frontpageId,\n\t\t\t\t }\n\t\t\t\t: {},\n\t};\n\n\tconst homeTemplate = yield* setPage( page );\n\tyield setHomeTemplateId( homeTemplate );\n}\n\n/**\n * Returns an action object used to set the active navigation panel menu.\n *\n * @param {string} menu Menu prop of active menu.\n *\n * @return {Object} Action object.\n */\nexport function setNavigationPanelActiveMenu( menu ) {\n\treturn {\n\t\ttype: 'SET_NAVIGATION_PANEL_ACTIVE_MENU',\n\t\tmenu,\n\t};\n}\n\n/**\n * Opens the navigation panel and sets its active menu at the same time.\n *\n * @param {string} menu Identifies the menu to open.\n */\nexport function openNavigationPanelToMenu( menu ) {\n\treturn {\n\t\ttype: 'OPEN_NAVIGATION_PANEL_TO_MENU',\n\t\tmenu,\n\t};\n}\n\n/**\n * Sets whether the navigation panel should be open.\n *\n * @param {boolean} isOpen If true, opens the nav panel. If false, closes it. It\n * does not toggle the state, but sets it directly.\n */\nexport function setIsNavigationPanelOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_NAVIGATION_PANEL_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Returns an action object used to open/close the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\n\n/**\n * Returns an action object used to update the settings.\n *\n * @param {Object} settings New settings.\n *\n * @return {Object} Action object.\n */\nexport function updateSettings( settings ) {\n\treturn {\n\t\ttype: 'UPDATE_SETTINGS',\n\t\tsettings,\n\t};\n}\n\n/**\n * Sets whether the list view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the list view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsListViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_LIST_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Reverts a template to its original theme-provided file.\n *\n * @param {Object} template The template to revert.\n * @param {Object} [options]\n * @param {boolean} [options.allowUndo] Whether to allow the user to undo\n * reverting the template. Default true.\n */\nexport function* revertTemplate( template, { allowUndo = true } = {} ) {\n\tif ( ! isTemplateRevertable( template ) ) {\n\t\tyield controls.dispatch(\n\t\t\tnoticesStore,\n\t\t\t'createErrorNotice',\n\t\t\t__( 'This template is not revertable.' ),\n\t\t\t{ type: 'snackbar' }\n\t\t);\n\t\treturn;\n\t}\n\n\ttry {\n\t\tconst templateEntity = yield controls.select(\n\t\t\tcoreStore,\n\t\t\t'getEntity',\n\t\t\t'postType',\n\t\t\ttemplate.type\n\t\t);\n\t\tif ( ! templateEntity ) {\n\t\t\tyield controls.dispatch(\n\t\t\t\tnoticesStore,\n\t\t\t\t'createErrorNotice',\n\t\t\t\t__(\n\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar' }\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst fileTemplatePath = addQueryArgs(\n\t\t\t`${ templateEntity.baseURL }/${ template.id }`,\n\t\t\t{ context: 'edit', source: 'theme' }\n\t\t);\n\t\tconst fileTemplate = yield apiFetch( { path: fileTemplatePath } );\n\t\tif ( ! fileTemplate ) {\n\t\t\tyield controls.dispatch(\n\t\t\t\tnoticesStore,\n\t\t\t\t'createErrorNotice',\n\t\t\t\t__(\n\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar' }\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst serializeBlocks = ( { blocks: blocksForSerialization = [] } ) =>\n\t\t\t__unstableSerializeAndClean( blocksForSerialization );\n\t\tconst edited = yield controls.select(\n\t\t\tcoreStore,\n\t\t\t'getEditedEntityRecord',\n\t\t\t'postType',\n\t\t\ttemplate.type,\n\t\t\ttemplate.id\n\t\t);\n\t\t// We are fixing up the undo level here to make sure we can undo\n\t\t// the revert in the header toolbar correctly.\n\t\tyield controls.dispatch(\n\t\t\tcoreStore,\n\t\t\t'editEntityRecord',\n\t\t\t'postType',\n\t\t\ttemplate.type,\n\t\t\ttemplate.id,\n\t\t\t{\n\t\t\t\tcontent: serializeBlocks, // required to make the `undo` behave correctly\n\t\t\t\tblocks: edited.blocks, // required to revert the blocks in the editor\n\t\t\t\tsource: 'custom', // required to avoid turning the editor into a dirty state\n\t\t\t},\n\t\t\t{\n\t\t\t\tundoIgnore: true, // required to merge this edit with the last undo level\n\t\t\t}\n\t\t);\n\n\t\tconst blocks = parse( fileTemplate?.content?.raw );\n\t\tyield controls.dispatch(\n\t\t\tcoreStore,\n\t\t\t'editEntityRecord',\n\t\t\t'postType',\n\t\t\ttemplate.type,\n\t\t\tfileTemplate.id,\n\t\t\t{\n\t\t\t\tcontent: serializeBlocks,\n\t\t\t\tblocks,\n\t\t\t\tsource: 'theme',\n\t\t\t}\n\t\t);\n\n\t\tif ( allowUndo ) {\n\t\t\tconst undoRevert = async () => {\n\t\t\t\tawait dispatch( coreStore ).editEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\tedited.id,\n\t\t\t\t\t{\n\t\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\t\tblocks: edited.blocks,\n\t\t\t\t\t\tsource: 'custom',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t};\n\t\t\tyield controls.dispatch(\n\t\t\t\tnoticesStore,\n\t\t\t\t'createSuccessNotice',\n\t\t\t\t__( 'Template reverted.' ),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick: undoRevert,\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} else {\n\t\t\tyield controls.dispatch(\n\t\t\t\tnoticesStore,\n\t\t\t\t'createSuccessNotice',\n\t\t\t\t__( 'Template reverted.' )\n\t\t\t);\n\t\t}\n\t} catch ( error ) {\n\t\tconst errorMessage =\n\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t? error.message\n\t\t\t\t: __( 'Template revert failed. Please reload.' );\n\t\tyield controls.dispatch(\n\t\t\tnoticesStore,\n\t\t\t'createErrorNotice',\n\t\t\terrorMessage,\n\t\t\t{ type: 'snackbar' }\n\t\t);\n\t}\n}\n/**\n * Returns an action object used in signalling that the user opened an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n *\n * @yield {Object} Action object.\n */\nexport function* openGeneralSidebar( name ) {\n\tyield controls.dispatch(\n\t\tinterfaceStore,\n\t\t'enableComplementaryArea',\n\t\teditSiteStoreName,\n\t\tname\n\t);\n}\n\n/**\n * Returns an action object signalling that the user closed the sidebar.\n *\n * @yield {Object} Action object.\n */\nexport function* closeGeneralSidebar() {\n\tyield controls.dispatch(\n\t\tinterfaceStore,\n\t\t'disableComplementaryArea',\n\t\teditSiteStoreName\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/store/actions.js"],"names":["parse","__unstableSerializeAndClean","controls","dispatch","apiFetch","addQueryArgs","getPathAndQueryString","__","sprintf","store","noticesStore","coreStore","interfaceStore","STORE_NAME","editSiteStoreName","isTemplateRevertable","toggleFeature","feature","type","__experimentalSetPreviewDeviceType","deviceType","setTemplate","templateId","templateSlug","pageContext","template","resolveSelect","slug","page","context","addTemplate","newTemplate","content","id","blocks","undoIgnore","removeTemplate","force","lastError","select","title","rendered","error","errorMessage","message","code","setTemplatePart","templatePartId","setHomeTemplateId","homeTemplateId","setPage","path","postId","entity","postType","link","setNavigationPanelActiveMenu","menu","openNavigationPanelToMenu","setIsNavigationPanelOpened","isOpen","setIsInserterOpened","value","updateSettings","settings","setIsListViewOpened","revertTemplate","allowUndo","templateEntity","fileTemplatePath","baseURL","source","fileTemplate","serializeBlocks","blocksForSerialization","edited","raw","undoRevert","editEntityRecord","actions","label","onClick","openGeneralSidebar","name","closeGeneralSidebar"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAT,EAAgBC,2BAAhB,QAAmD,mBAAnD;AACA,SAASC,QAAT,EAAmBC,QAAnB,QAAmC,iBAAnC;AACA,SAASC,QAAT,QAAyB,0BAAzB;AACA,SAASC,YAAT,EAAuBC,qBAAvB,QAAoD,gBAApD;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AACA,SAASF,KAAK,IAAIG,cAAlB,QAAwC,sBAAxC;AAEA;AACA;AACA;;AACA,SAASC,UAAU,IAAIC,iBAAvB,QAAgD,aAAhD;AACA,OAAOC,oBAAP,MAAiC,iCAAjC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,aAAT,CAAwBC,OAAxB,EAAkC;AACxC,SAAO;AACNC,IAAAA,IAAI,EAAE,gBADA;AAEND,IAAAA;AAFM,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,O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EAAE,CAAE,MAAF,CADV;AAEC0E,UAAAA,OAAO,EAAEJ;AAFV,SADQ;AAFV,OAJK,CAAN;AAcA,KA3BD,MA2BO;AACN,YAAM3E,QAAQ,CAACC,QAAT,CACLO,YADK,EAEL,qBAFK,EAGLH,EAAE,CAAE,oBAAF,CAHG,CAAN;AAKA;AACD,GA/GD,CA+GE,OAAQmC,KAAR,EAAgB;AACjB,UAAMC,YAAY,GACjBD,KAAK,CAACE,OAAN,IAAiBF,KAAK,CAACG,IAAN,KAAe,eAAhC,GACGH,KAAK,CAACE,OADT,GAEGrC,EAAE,CAAE,wCAAF,CAHN;AAIA,UAAML,QAAQ,CAACC,QAAT,CACLO,YADK,EAEL,mBAFK,EAGLiC,YAHK,EAIL;AAAEzB,MAAAA,IAAI,EAAE;AAAR,KAJK,CAAN;AAMA;AACD;AACD;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,UAAUgE,kBAAV,CAA8BC,IAA9B,EAAqC;AAC3C,QAAMjF,QAAQ,CAACC,QAAT,CACLS,cADK,EAEL,yBAFK,EAGLE,iBAHK,EAILqE,IAJK,CAAN;AAMA;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,UAAUC,mBAAV,GAAgC;AACtC,QAAMlF,QAAQ,CAACC,QAAT,CACLS,cADK,EAEL,0BAFK,EAGLE,iBAHK,CAAN;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { parse, __unstableSerializeAndClean } from '@wordpress/blocks';\nimport { controls, dispatch } from '@wordpress/data';\nimport { apiFetch } from '@wordpress/data-controls';\nimport { addQueryArgs, getPathAndQueryString } from '@wordpress/url';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME as editSiteStoreName } from './constants';\nimport isTemplateRevertable from '../utils/is-template-revertable';\n\n/**\n * Returns an action object used to toggle a feature flag.\n *\n * @param {string} feature Feature name.\n *\n * @return {Object} Action object.\n */\nexport function toggleFeature( feature ) {\n\treturn {\n\t\ttype: 'TOGGLE_FEATURE',\n\t\tfeature,\n\t};\n}\n\n/**\n * Returns an action object used to toggle the width of the editing canvas.\n *\n * @param {string} deviceType\n *\n * @return {Object} Action object.\n */\nexport function __experimentalSetPreviewDeviceType( deviceType ) {\n\treturn {\n\t\ttype: 'SET_PREVIEW_DEVICE_TYPE',\n\t\tdeviceType,\n\t};\n}\n\n/**\n * Returns an action object used to set a template.\n *\n * @param {number} templateId The template ID.\n * @param {string} templateSlug The template slug.\n * @return {Object} Action object.\n */\nexport function* setTemplate( templateId, templateSlug ) {\n\tconst pageContext = { templateSlug };\n\tif ( ! templateSlug ) {\n\t\tconst template = yield controls.resolveSelect(\n\t\t\tcoreStore,\n\t\t\t'getEntityRecord',\n\t\t\t'postType',\n\t\t\t'wp_template',\n\t\t\ttemplateId\n\t\t);\n\t\tpageContext.templateSlug = template?.slug;\n\t}\n\treturn {\n\t\ttype: 'SET_TEMPLATE',\n\t\ttemplateId,\n\t\tpage: { context: pageContext },\n\t};\n}\n\n/**\n * Adds a new template, and sets it as the current template.\n *\n * @param {Object} template The template.\n *\n * @return {Object} Action object used to set the current template.\n */\nexport function* addTemplate( template ) {\n\tconst newTemplate = yield controls.dispatch(\n\t\tcoreStore,\n\t\t'saveEntityRecord',\n\t\t'postType',\n\t\t'wp_template',\n\t\ttemplate\n\t);\n\n\tif ( template.content ) {\n\t\tyield controls.dispatch(\n\t\t\tcoreStore,\n\t\t\t'editEntityRecord',\n\t\t\t'postType',\n\t\t\t'wp_template',\n\t\t\tnewTemplate.id,\n\t\t\t{ blocks: parse( template.content ) },\n\t\t\t{ undoIgnore: true }\n\t\t);\n\t}\n\n\treturn {\n\t\ttype: 'SET_TEMPLATE',\n\t\ttemplateId: newTemplate.id,\n\t\tpage: { context: { templateSlug: newTemplate.slug } },\n\t};\n}\n\n/**\n * Removes a template.\n *\n * @param {Object} template The template object.\n */\nexport function* removeTemplate( template ) {\n\ttry {\n\t\tyield controls.dispatch(\n\t\t\tcoreStore,\n\t\t\t'deleteEntityRecord',\n\t\t\t'postType',\n\t\t\ttemplate.type,\n\t\t\ttemplate.id,\n\t\t\t{ force: true }\n\t\t);\n\n\t\tconst lastError = yield controls.select(\n\t\t\tcoreStore,\n\t\t\t'getLastEntityDeleteError',\n\t\t\t'postType',\n\t\t\ttemplate.type,\n\t\t\ttemplate.id\n\t\t);\n\n\t\tif ( lastError ) {\n\t\t\tthrow lastError;\n\t\t}\n\n\t\tyield controls.dispatch(\n\t\t\tnoticesStore,\n\t\t\t'createSuccessNotice',\n\t\t\tsprintf(\n\t\t\t\t/* translators: The template/part's name. */\n\t\t\t\t__( '\"%s\" removed.' ),\n\t\t\t\ttemplate.title.rendered\n\t\t\t),\n\t\t\t{ type: 'snackbar' }\n\t\t);\n\t} catch ( error ) {\n\t\tconst errorMessage =\n\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t? error.message\n\t\t\t\t: __( 'An error occurred while deleting the template.' );\n\n\t\tyield controls.dispatch(\n\t\t\tnoticesStore,\n\t\t\t'createErrorNotice',\n\t\t\terrorMessage,\n\t\t\t{ type: 'snackbar' }\n\t\t);\n\t}\n}\n\n/**\n * Returns an action object used to set a template part.\n *\n * @param {string} templatePartId The template part ID.\n *\n * @return {Object} Action object.\n */\nexport function setTemplatePart( templatePartId ) {\n\treturn {\n\t\ttype: 'SET_TEMPLATE_PART',\n\t\ttemplatePartId,\n\t};\n}\n\n/**\n * Updates the homeTemplateId state with the templateId of the page resolved\n * from the given path.\n *\n * @param {number} homeTemplateId The template ID for the homepage.\n */\nexport function setHomeTemplateId( homeTemplateId ) {\n\treturn {\n\t\ttype: 'SET_HOME_TEMPLATE',\n\t\thomeTemplateId,\n\t};\n}\n\n/**\n * Resolves the template for a page and displays both. If no path is given, attempts\n * to use the postId to generate a path like `?p=${ postId }`.\n *\n * @param {Object} page The page object.\n * @param {string} page.type The page type.\n * @param {string} page.slug The page slug.\n * @param {string} page.path The page path.\n * @param {Object} page.context The page context.\n *\n * @return {number} The resolved template ID for the page route.\n */\nexport function* setPage( page ) {\n\tif ( ! page.path && page.context?.postId ) {\n\t\tconst entity = yield controls.resolveSelect(\n\t\t\tcoreStore,\n\t\t\t'getEntityRecord',\n\t\t\t'postType',\n\t\t\tpage.context.postType || 'post',\n\t\t\tpage.context.postId\n\t\t);\n\n\t\tpage.path = getPathAndQueryString( entity.link );\n\t}\n\tconst template = yield controls.resolveSelect(\n\t\tcoreStore,\n\t\t'__experimentalGetTemplateForLink',\n\t\tpage.path\n\t);\n\n\tif ( ! template ) {\n\t\treturn;\n\t}\n\n\tconst { id: templateId, slug: templateSlug } = template;\n\tyield {\n\t\ttype: 'SET_PAGE',\n\t\tpage: ! templateSlug\n\t\t\t? page\n\t\t\t: {\n\t\t\t\t\t...page,\n\t\t\t\t\tcontext: {\n\t\t\t\t\t\t...page.context,\n\t\t\t\t\t\ttemplateSlug,\n\t\t\t\t\t},\n\t\t\t },\n\t\ttemplateId,\n\t};\n\treturn templateId;\n}\n\n/**\n * Returns an action object used to set the active navigation panel menu.\n *\n * @param {string} menu Menu prop of active menu.\n *\n * @return {Object} Action object.\n */\nexport function setNavigationPanelActiveMenu( menu ) {\n\treturn {\n\t\ttype: 'SET_NAVIGATION_PANEL_ACTIVE_MENU',\n\t\tmenu,\n\t};\n}\n\n/**\n * Opens the navigation panel and sets its active menu at the same time.\n *\n * @param {string} menu Identifies the menu to open.\n */\nexport function openNavigationPanelToMenu( menu ) {\n\treturn {\n\t\ttype: 'OPEN_NAVIGATION_PANEL_TO_MENU',\n\t\tmenu,\n\t};\n}\n\n/**\n * Sets whether the navigation panel should be open.\n *\n * @param {boolean} isOpen If true, opens the nav panel. If false, closes it. It\n * does not toggle the state, but sets it directly.\n */\nexport function setIsNavigationPanelOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_NAVIGATION_PANEL_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Returns an action object used to open/close the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\n\n/**\n * Returns an action object used to update the settings.\n *\n * @param {Object} settings New settings.\n *\n * @return {Object} Action object.\n */\nexport function updateSettings( settings ) {\n\treturn {\n\t\ttype: 'UPDATE_SETTINGS',\n\t\tsettings,\n\t};\n}\n\n/**\n * Sets whether the list view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the list view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsListViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_LIST_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Reverts a template to its original theme-provided file.\n *\n * @param {Object} template The template to revert.\n * @param {Object} [options]\n * @param {boolean} [options.allowUndo] Whether to allow the user to undo\n * reverting the template. Default true.\n */\nexport function* revertTemplate( template, { allowUndo = true } = {} ) {\n\tif ( ! isTemplateRevertable( template ) ) {\n\t\tyield controls.dispatch(\n\t\t\tnoticesStore,\n\t\t\t'createErrorNotice',\n\t\t\t__( 'This template is not revertable.' ),\n\t\t\t{ type: 'snackbar' }\n\t\t);\n\t\treturn;\n\t}\n\n\ttry {\n\t\tconst templateEntity = yield controls.select(\n\t\t\tcoreStore,\n\t\t\t'getEntity',\n\t\t\t'postType',\n\t\t\ttemplate.type\n\t\t);\n\t\tif ( ! templateEntity ) {\n\t\t\tyield controls.dispatch(\n\t\t\t\tnoticesStore,\n\t\t\t\t'createErrorNotice',\n\t\t\t\t__(\n\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar' }\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst fileTemplatePath = addQueryArgs(\n\t\t\t`${ templateEntity.baseURL }/${ template.id }`,\n\t\t\t{ context: 'edit', source: 'theme' }\n\t\t);\n\t\tconst fileTemplate = yield apiFetch( { path: fileTemplatePath } );\n\t\tif ( ! fileTemplate ) {\n\t\t\tyield controls.dispatch(\n\t\t\t\tnoticesStore,\n\t\t\t\t'createErrorNotice',\n\t\t\t\t__(\n\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar' }\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst serializeBlocks = ( { blocks: blocksForSerialization = [] } ) =>\n\t\t\t__unstableSerializeAndClean( blocksForSerialization );\n\t\tconst edited = yield controls.select(\n\t\t\tcoreStore,\n\t\t\t'getEditedEntityRecord',\n\t\t\t'postType',\n\t\t\ttemplate.type,\n\t\t\ttemplate.id\n\t\t);\n\t\t// We are fixing up the undo level here to make sure we can undo\n\t\t// the revert in the header toolbar correctly.\n\t\tyield controls.dispatch(\n\t\t\tcoreStore,\n\t\t\t'editEntityRecord',\n\t\t\t'postType',\n\t\t\ttemplate.type,\n\t\t\ttemplate.id,\n\t\t\t{\n\t\t\t\tcontent: serializeBlocks, // required to make the `undo` behave correctly\n\t\t\t\tblocks: edited.blocks, // required to revert the blocks in the editor\n\t\t\t\tsource: 'custom', // required to avoid turning the editor into a dirty state\n\t\t\t},\n\t\t\t{\n\t\t\t\tundoIgnore: true, // required to merge this edit with the last undo level\n\t\t\t}\n\t\t);\n\n\t\tconst blocks = parse( fileTemplate?.content?.raw );\n\t\tyield controls.dispatch(\n\t\t\tcoreStore,\n\t\t\t'editEntityRecord',\n\t\t\t'postType',\n\t\t\ttemplate.type,\n\t\t\tfileTemplate.id,\n\t\t\t{\n\t\t\t\tcontent: serializeBlocks,\n\t\t\t\tblocks,\n\t\t\t\tsource: 'theme',\n\t\t\t}\n\t\t);\n\n\t\tif ( allowUndo ) {\n\t\t\tconst undoRevert = async () => {\n\t\t\t\tawait dispatch( coreStore ).editEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\tedited.id,\n\t\t\t\t\t{\n\t\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\t\tblocks: edited.blocks,\n\t\t\t\t\t\tsource: 'custom',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t};\n\t\t\tyield controls.dispatch(\n\t\t\t\tnoticesStore,\n\t\t\t\t'createSuccessNotice',\n\t\t\t\t__( 'Template reverted.' ),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick: undoRevert,\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} else {\n\t\t\tyield controls.dispatch(\n\t\t\t\tnoticesStore,\n\t\t\t\t'createSuccessNotice',\n\t\t\t\t__( 'Template reverted.' )\n\t\t\t);\n\t\t}\n\t} catch ( error ) {\n\t\tconst errorMessage =\n\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t? error.message\n\t\t\t\t: __( 'Template revert failed. Please reload.' );\n\t\tyield controls.dispatch(\n\t\t\tnoticesStore,\n\t\t\t'createErrorNotice',\n\t\t\terrorMessage,\n\t\t\t{ type: 'snackbar' }\n\t\t);\n\t}\n}\n/**\n * Returns an action object used in signalling that the user opened an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n *\n * @yield {Object} Action object.\n */\nexport function* openGeneralSidebar( name ) {\n\tyield controls.dispatch(\n\t\tinterfaceStore,\n\t\t'enableComplementaryArea',\n\t\teditSiteStoreName,\n\t\tname\n\t);\n}\n\n/**\n * Returns an action object signalling that the user closed the sidebar.\n *\n * @yield {Object} Action object.\n */\nexport function* closeGeneralSidebar() {\n\tyield controls.dispatch(\n\t\tinterfaceStore,\n\t\t'disableComplementaryArea',\n\t\teditSiteStoreName\n\t);\n}\n"]}
@@ -1772,6 +1772,57 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
1772
1772
  vertical-align: text-top;
1773
1773
  }
1774
1774
 
1775
+ .edit-site-keyboard-shortcut-help-modal__section {
1776
+ margin: 0 0 2rem 0;
1777
+ }
1778
+ .edit-site-keyboard-shortcut-help-modal__main-shortcuts .edit-site-keyboard-shortcut-help-modal__shortcut-list {
1779
+ margin-top: -25px;
1780
+ }
1781
+ .edit-site-keyboard-shortcut-help-modal__section-title {
1782
+ font-size: 0.9rem;
1783
+ font-weight: 600;
1784
+ }
1785
+ .edit-site-keyboard-shortcut-help-modal__shortcut {
1786
+ display: flex;
1787
+ align-items: baseline;
1788
+ padding: 0.6rem 0;
1789
+ border-top: 1px solid #ddd;
1790
+ margin-bottom: 0;
1791
+ }
1792
+ .edit-site-keyboard-shortcut-help-modal__shortcut:last-child {
1793
+ border-bottom: 1px solid #ddd;
1794
+ }
1795
+ .edit-site-keyboard-shortcut-help-modal__shortcut:empty {
1796
+ display: none;
1797
+ }
1798
+ .edit-site-keyboard-shortcut-help-modal__shortcut-term {
1799
+ font-weight: 600;
1800
+ margin: 0 1rem 0 0;
1801
+ text-align: left;
1802
+ }
1803
+ .edit-site-keyboard-shortcut-help-modal__shortcut-description {
1804
+ flex: 1;
1805
+ margin: 0;
1806
+ flex-basis: auto;
1807
+ }
1808
+ .edit-site-keyboard-shortcut-help-modal__shortcut-key-combination {
1809
+ display: block;
1810
+ background: none;
1811
+ margin: 0;
1812
+ padding: 0;
1813
+ }
1814
+ .edit-site-keyboard-shortcut-help-modal__shortcut-key-combination + .edit-site-keyboard-shortcut-help-modal__shortcut-key-combination {
1815
+ margin-top: 10px;
1816
+ }
1817
+ .edit-site-keyboard-shortcut-help-modal__shortcut-key {
1818
+ padding: 0.25rem 0.5rem;
1819
+ border-radius: 8%;
1820
+ margin: 0 0.2rem 0 0.2rem;
1821
+ }
1822
+ .edit-site-keyboard-shortcut-help-modal__shortcut-key:last-child {
1823
+ margin: 0 0.2rem 0 0;
1824
+ }
1825
+
1775
1826
  html.wp-toolbar {
1776
1827
  background: #fff;
1777
1828
  }