@wordpress/editor 12.9.0 → 12.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (224) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/components/document-outline/index.js +7 -9
  3. package/build/components/document-outline/index.js.map +1 -1
  4. package/build/components/editor-help/index.native.js.map +1 -1
  5. package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
  6. package/build/components/entities-saved-states/index.js.map +1 -1
  7. package/build/components/error-boundary/index.js +3 -0
  8. package/build/components/error-boundary/index.js.map +1 -1
  9. package/build/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
  10. package/build/components/index.js +61 -9
  11. package/build/components/index.js.map +1 -1
  12. package/build/components/local-autosave-monitor/index.js +24 -19
  13. package/build/components/local-autosave-monitor/index.js.map +1 -1
  14. package/build/components/page-attributes/order.js +3 -7
  15. package/build/components/page-attributes/order.js.map +1 -1
  16. package/build/components/page-attributes/parent.js +2 -2
  17. package/build/components/page-attributes/parent.js.map +1 -1
  18. package/build/components/post-author/select.js.map +1 -1
  19. package/build/components/post-comments/index.js.map +1 -1
  20. package/build/components/post-format/index.js +5 -8
  21. package/build/components/post-format/index.js.map +1 -1
  22. package/build/components/post-last-revision/check.js.map +1 -1
  23. package/build/components/post-last-revision/index.js.map +1 -1
  24. package/build/components/post-pending-status/check.js.map +1 -1
  25. package/build/components/post-pingbacks/index.js.map +1 -1
  26. package/build/components/post-publish-button/index.js +4 -2
  27. package/build/components/post-publish-button/index.js.map +1 -1
  28. package/build/components/post-publish-panel/index.js.map +1 -1
  29. package/build/components/post-publish-panel/maybe-category-panel.js +5 -5
  30. package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  31. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  32. package/build/components/post-publish-panel/postpublish.js.map +1 -1
  33. package/build/components/post-publish-panel/prepublish.js.map +1 -1
  34. package/build/components/post-schedule/label.js +93 -13
  35. package/build/components/post-schedule/label.js.map +1 -1
  36. package/build/components/post-slug/index.js +8 -13
  37. package/build/components/post-slug/index.js.map +1 -1
  38. package/build/components/post-sticky/index.js.map +1 -1
  39. package/build/components/post-switch-to-draft-button/index.js.map +1 -1
  40. package/build/components/post-taxonomies/flat-term-selector.js +8 -4
  41. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  42. package/build/components/post-taxonomies/hierarchical-term-selector.js +1 -0
  43. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  44. package/build/components/post-taxonomies/index.js +3 -1
  45. package/build/components/post-taxonomies/index.js.map +1 -1
  46. package/build/components/post-template/index.js +1 -2
  47. package/build/components/post-template/index.js.map +1 -1
  48. package/build/components/post-title/index.js.map +1 -1
  49. package/build/components/post-title/index.native.js.map +1 -1
  50. package/build/components/post-trash/check.js.map +1 -1
  51. package/build/components/post-url/check.js +54 -0
  52. package/build/components/post-url/check.js.map +1 -0
  53. package/build/components/post-url/index.js +115 -0
  54. package/build/components/post-url/index.js.map +1 -0
  55. package/build/components/post-url/label.js +30 -0
  56. package/build/components/post-url/label.js.map +1 -0
  57. package/build/components/post-visibility/index.js +10 -11
  58. package/build/components/post-visibility/index.js.map +1 -1
  59. package/build/components/post-visibility/label.js +5 -0
  60. package/build/components/post-visibility/label.js.map +1 -1
  61. package/build/components/provider/index.js.map +1 -1
  62. package/build/components/provider/index.native.js +0 -1
  63. package/build/components/provider/index.native.js.map +1 -1
  64. package/build/components/provider/use-block-editor-settings.js +3 -1
  65. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  66. package/build/components/table-of-contents/panel.js +5 -1
  67. package/build/components/table-of-contents/panel.js.map +1 -1
  68. package/build/components/template-validation-notice/index.js.map +1 -1
  69. package/build/components/theme-support-check/index.js +1 -1
  70. package/build/components/theme-support-check/index.js.map +1 -1
  71. package/build/components/time-to-read/index.js +60 -0
  72. package/build/components/time-to-read/index.js.map +1 -0
  73. package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  74. package/build/store/actions.js +5 -1
  75. package/build/store/actions.js.map +1 -1
  76. package/build/store/reducer.js +1 -1
  77. package/build/store/reducer.js.map +1 -1
  78. package/build/store/selectors.js +2 -2
  79. package/build/store/selectors.js.map +1 -1
  80. package/build/utils/media-upload/index.js +4 -8
  81. package/build/utils/media-upload/index.js.map +1 -1
  82. package/build-module/components/document-outline/index.js +7 -8
  83. package/build-module/components/document-outline/index.js.map +1 -1
  84. package/build-module/components/editor-help/index.native.js.map +1 -1
  85. package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
  86. package/build-module/components/entities-saved-states/index.js.map +1 -1
  87. package/build-module/components/error-boundary/index.js +2 -0
  88. package/build-module/components/error-boundary/index.js.map +1 -1
  89. package/build-module/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
  90. package/build-module/components/index.js +7 -4
  91. package/build-module/components/index.js.map +1 -1
  92. package/build-module/components/local-autosave-monitor/index.js +24 -18
  93. package/build-module/components/local-autosave-monitor/index.js.map +1 -1
  94. package/build-module/components/page-attributes/order.js +3 -6
  95. package/build-module/components/page-attributes/order.js.map +1 -1
  96. package/build-module/components/page-attributes/parent.js +3 -3
  97. package/build-module/components/page-attributes/parent.js.map +1 -1
  98. package/build-module/components/post-author/select.js.map +1 -1
  99. package/build-module/components/post-comments/index.js.map +1 -1
  100. package/build-module/components/post-format/index.js +5 -8
  101. package/build-module/components/post-format/index.js.map +1 -1
  102. package/build-module/components/post-last-revision/check.js.map +1 -1
  103. package/build-module/components/post-last-revision/index.js.map +1 -1
  104. package/build-module/components/post-pending-status/check.js.map +1 -1
  105. package/build-module/components/post-pingbacks/index.js.map +1 -1
  106. package/build-module/components/post-publish-button/index.js +4 -1
  107. package/build-module/components/post-publish-button/index.js.map +1 -1
  108. package/build-module/components/post-publish-panel/index.js.map +1 -1
  109. package/build-module/components/post-publish-panel/maybe-category-panel.js +5 -5
  110. package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  111. package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  112. package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
  113. package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
  114. package/build-module/components/post-schedule/label.js +90 -13
  115. package/build-module/components/post-schedule/label.js.map +1 -1
  116. package/build-module/components/post-slug/index.js +8 -14
  117. package/build-module/components/post-slug/index.js.map +1 -1
  118. package/build-module/components/post-sticky/index.js.map +1 -1
  119. package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
  120. package/build-module/components/post-taxonomies/flat-term-selector.js +8 -6
  121. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  122. package/build-module/components/post-taxonomies/hierarchical-term-selector.js +1 -2
  123. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  124. package/build-module/components/post-taxonomies/index.js +4 -1
  125. package/build-module/components/post-taxonomies/index.js.map +1 -1
  126. package/build-module/components/post-template/index.js +1 -2
  127. package/build-module/components/post-template/index.js.map +1 -1
  128. package/build-module/components/post-title/index.js.map +1 -1
  129. package/build-module/components/post-title/index.native.js.map +1 -1
  130. package/build-module/components/post-trash/check.js.map +1 -1
  131. package/build-module/components/post-url/check.js +44 -0
  132. package/build-module/components/post-url/check.js.map +1 -0
  133. package/build-module/components/post-url/index.js +102 -0
  134. package/build-module/components/post-url/index.js.map +1 -0
  135. package/build-module/components/post-url/label.js +18 -0
  136. package/build-module/components/post-url/label.js.map +1 -0
  137. package/build-module/components/post-visibility/index.js +12 -13
  138. package/build-module/components/post-visibility/index.js.map +1 -1
  139. package/build-module/components/post-visibility/label.js +3 -0
  140. package/build-module/components/post-visibility/label.js.map +1 -1
  141. package/build-module/components/provider/index.js.map +1 -1
  142. package/build-module/components/provider/index.native.js +0 -1
  143. package/build-module/components/provider/index.native.js.map +1 -1
  144. package/build-module/components/provider/use-block-editor-settings.js +4 -2
  145. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  146. package/build-module/components/table-of-contents/panel.js +4 -1
  147. package/build-module/components/table-of-contents/panel.js.map +1 -1
  148. package/build-module/components/template-validation-notice/index.js.map +1 -1
  149. package/build-module/components/theme-support-check/index.js +2 -2
  150. package/build-module/components/theme-support-check/index.js.map +1 -1
  151. package/build-module/components/time-to-read/index.js +50 -0
  152. package/build-module/components/time-to-read/index.js.map +1 -0
  153. package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  154. package/build-module/store/actions.js +5 -1
  155. package/build-module/store/actions.js.map +1 -1
  156. package/build-module/store/reducer.js +2 -2
  157. package/build-module/store/reducer.js.map +1 -1
  158. package/build-module/store/selectors.js +3 -3
  159. package/build-module/store/selectors.js.map +1 -1
  160. package/build-module/utils/media-upload/index.js +3 -5
  161. package/build-module/utils/media-upload/index.js.map +1 -1
  162. package/build-style/style-rtl.css +12 -30
  163. package/build-style/style.css +15 -29
  164. package/package.json +28 -28
  165. package/src/components/document-outline/index.js +9 -8
  166. package/src/components/editor-help/index.native.js +6 -6
  167. package/src/components/entities-saved-states/entity-record-item.js +6 -6
  168. package/src/components/entities-saved-states/index.js +6 -9
  169. package/src/components/error-boundary/index.js +3 -0
  170. package/src/components/global-keyboard-shortcuts/save-shortcut.js +2 -3
  171. package/src/components/index.js +13 -4
  172. package/src/components/local-autosave-monitor/index.js +39 -38
  173. package/src/components/page-attributes/order.js +1 -9
  174. package/src/components/page-attributes/parent.js +6 -10
  175. package/src/components/post-author/select.js +2 -3
  176. package/src/components/post-comments/index.js +4 -3
  177. package/src/components/post-format/index.js +15 -22
  178. package/src/components/post-format/style.scss +2 -17
  179. package/src/components/post-last-revision/check.js +2 -4
  180. package/src/components/post-last-revision/index.js +2 -4
  181. package/src/components/post-pending-status/check.js +2 -5
  182. package/src/components/post-pingbacks/index.js +2 -3
  183. package/src/components/post-publish-button/index.js +7 -8
  184. package/src/components/post-publish-panel/index.js +2 -3
  185. package/src/components/post-publish-panel/maybe-category-panel.js +7 -5
  186. package/src/components/post-publish-panel/maybe-post-format-panel.js +2 -3
  187. package/src/components/post-publish-panel/postpublish.js +2 -5
  188. package/src/components/post-publish-panel/prepublish.js +2 -3
  189. package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +1 -1
  190. package/src/components/post-schedule/label.js +111 -17
  191. package/src/components/post-schedule/test/label.js +127 -15
  192. package/src/components/post-slug/index.js +9 -16
  193. package/src/components/post-slug/test/index.js +7 -6
  194. package/src/components/post-sticky/index.js +2 -3
  195. package/src/components/post-switch-to-draft-button/index.js +2 -5
  196. package/src/components/post-taxonomies/flat-term-selector.js +10 -13
  197. package/src/components/post-taxonomies/hierarchical-term-selector.js +5 -7
  198. package/src/components/post-taxonomies/index.js +3 -1
  199. package/src/components/post-template/index.js +1 -1
  200. package/src/components/post-title/index.js +21 -31
  201. package/src/components/post-title/index.native.js +10 -16
  202. package/src/components/post-title/style.scss +1 -1
  203. package/src/components/post-trash/check.js +2 -3
  204. package/src/components/post-url/check.js +38 -0
  205. package/src/components/post-url/index.js +122 -0
  206. package/src/components/post-url/label.js +22 -0
  207. package/src/components/post-url/style.scss +16 -0
  208. package/src/components/post-visibility/index.js +11 -17
  209. package/src/components/post-visibility/label.js +4 -0
  210. package/src/components/post-visibility/style.scss +0 -17
  211. package/src/components/provider/index.js +2 -3
  212. package/src/components/provider/index.native.js +12 -17
  213. package/src/components/provider/use-block-editor-settings.js +4 -8
  214. package/src/components/table-of-contents/panel.js +7 -2
  215. package/src/components/template-validation-notice/index.js +2 -3
  216. package/src/components/theme-support-check/index.js +2 -2
  217. package/src/components/time-to-read/index.js +59 -0
  218. package/src/hooks/custom-sources-backwards-compatibility.js +45 -44
  219. package/src/store/actions.js +213 -190
  220. package/src/store/reducer.js +2 -2
  221. package/src/store/selectors.js +17 -25
  222. package/src/store/test/selectors.js +10 -13
  223. package/src/style.scss +1 -0
  224. package/src/utils/media-upload/index.js +2 -5
@@ -36,14 +36,14 @@ var _store = require("../../store");
36
36
  */
37
37
  function MaybeCategoryPanel() {
38
38
  const hasNoCategory = (0, _data.useSelect)(select => {
39
- var _select$getEntityReco;
39
+ var _select$getEntityReco, _select$getEntityReco2;
40
40
 
41
41
  const postType = select(_store.store).getCurrentPostType();
42
42
  const categoriesTaxonomy = select(_coreData.store).getTaxonomy('category');
43
- const defaultCategorySlug = 'uncategorized';
44
- const defaultCategory = (_select$getEntityReco = select(_coreData.store).getEntityRecords('taxonomy', 'category', {
45
- slug: defaultCategorySlug
46
- })) === null || _select$getEntityReco === void 0 ? void 0 : _select$getEntityReco[0];
43
+ const defaultCategoryId = (_select$getEntityReco = select(_coreData.store).getEntityRecord('root', 'site')) === null || _select$getEntityReco === void 0 ? void 0 : _select$getEntityReco.default_category;
44
+ const defaultCategory = (_select$getEntityReco2 = select(_coreData.store).getEntityRecords('taxonomy', 'category', {
45
+ id: defaultCategoryId
46
+ })) === null || _select$getEntityReco2 === void 0 ? void 0 : _select$getEntityReco2[0];
47
47
  const postTypeSupportsCategories = categoriesTaxonomy && (0, _lodash.some)(categoriesTaxonomy.types, type => type === postType);
48
48
  const categories = categoriesTaxonomy && select(_store.store).getEditedPostAttribute(categoriesTaxonomy.rest_base); // This boolean should return true if everything is loaded
49
49
  // ( categoriesTaxonomy, defaultCategory )
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-publish-panel/maybe-category-panel.js"],"names":["MaybeCategoryPanel","hasNoCategory","select","postType","editorStore","getCurrentPostType","categoriesTaxonomy","coreStore","getTaxonomy","defaultCategorySlug","defaultCategory","getEntityRecords","slug","postTypeSupportsCategories","types","type","categories","getEditedPostAttribute","rest_base","length","id","shouldShowPanel","setShouldShowPanel","panelBodyTitle"],"mappings":";;;;;;;;;AAYA;;AATA;;AAKA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AAIA,SAASA,kBAAT,GAA8B;AAC7B,QAAMC,aAAa,GAAG,qBAAaC,MAAF,IAAc;AAAA;;AAC9C,UAAMC,QAAQ,GAAGD,MAAM,CA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Ac,GAAG,CACtB,cAAI,aAAJ,CADsB,EAEtB;AAAM,IAAA,SAAS,EAAC,iCAAhB;AAAkD,IAAA,GAAG,EAAC;AAAtD,KACG,cAAI,mBAAJ,CADH,CAFsB,CAAvB;AAOA,SACC,4BAAC,qBAAD;AAAW,IAAA,WAAW,EAAG,KAAzB;AAAiC,IAAA,KAAK,EAAGA;AAAzC,KACC,uCACG,cACD,oHADC,CADH,CADD,EAMC,4BAAC,iCAAD;AAA0B,IAAA,IAAI,EAAC;AAA/B,IAND,CADD;AAUA;;eAEcvB,kB","sourcesContent":["/**\n * External dependencies\n */\nimport { some } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { PanelBody } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport HierarchicalTermSelector from '../post-taxonomies/hierarchical-term-selector';\nimport { store as editorStore } from '../../store';\n\nfunction MaybeCategoryPanel() {\n\tconst hasNoCategory = useSelect( ( select ) => {\n\t\tconst postType = select( editorStore ).getCurrentPostType();\n\t\tconst categoriesTaxonomy = select( coreStore ).getTaxonomy(\n\t\t\t'category'\n\t\t);\n\t\tconst defaultCategorySlug = 'uncategorized';\n\t\tconst defaultCategory = select( coreStore ).getEntityRecords(\n\t\t\t'taxonomy',\n\t\t\t'category',\n\t\t\t{\n\t\t\t\tslug: defaultCategorySlug,\n\t\t\t}\n\t\t)?.[ 0 ];\n\t\tconst postTypeSupportsCategories =\n\t\t\tcategoriesTaxonomy &&\n\t\t\tsome( categoriesTaxonomy.types, ( type ) => type === postType );\n\t\tconst categories =\n\t\t\tcategoriesTaxonomy &&\n\t\t\tselect( editorStore ).getEditedPostAttribute(\n\t\t\t\tcategoriesTaxonomy.rest_base\n\t\t\t);\n\n\t\t// This boolean should return true if everything is loaded\n\t\t// ( categoriesTaxonomy, defaultCategory )\n\t\t// and the post has not been assigned a category different than \"uncategorized\".\n\t\treturn (\n\t\t\t!! categoriesTaxonomy &&\n\t\t\t!! defaultCategory &&\n\t\t\tpostTypeSupportsCategories &&\n\t\t\t( categories?.length === 0 ||\n\t\t\t\t( categories?.length === 1 &&\n\t\t\t\t\tdefaultCategory.id === categories[ 0 ] ) )\n\t\t);\n\t}, [] );\n\tconst [ shouldShowPanel, setShouldShowPanel ] = useState( false );\n\tuseEffect( () => {\n\t\t// We use state to avoid hiding the panel if the user edits the categories\n\t\t// and adds one within the panel itself (while visible).\n\t\tif ( hasNoCategory ) {\n\t\t\tsetShouldShowPanel( true );\n\t\t}\n\t}, [ hasNoCategory ] );\n\n\tif ( ! shouldShowPanel ) {\n\t\treturn null;\n\t}\n\n\tconst panelBodyTitle = [\n\t\t__( 'Suggestion:' ),\n\t\t<span className=\"editor-post-publish-panel__link\" key=\"label\">\n\t\t\t{ __( 'Assign a category' ) }\n\t\t</span>,\n\t];\n\n\treturn (\n\t\t<PanelBody initialOpen={ false } title={ panelBodyTitle }>\n\t\t\t<p>\n\t\t\t\t{ __(\n\t\t\t\t\t'Categories provide a helpful way to group related posts together and to quickly tell readers what a post is about.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<HierarchicalTermSelector slug=\"category\" />\n\t\t</PanelBody>\n\t);\n}\n\nexport default MaybeCategoryPanel;\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-publish-panel/maybe-category-panel.js"],"names":["MaybeCategoryPanel","hasNoCategory","select","postType","editorStore","getCurrentPostType","categoriesTaxonomy","coreStore","getTaxonomy","defaultCategoryId","getEntityRecord","default_category","defaultCategory","getEntityRecords","id","postTypeSupportsCategories","types","type","categories","getEditedPostAttribute","rest_base","length","shouldShowPanel","setShouldShowPanel","panelBodyTitle"],"mappings":";;;;;;;;;AAYA;;AATA;;AAKA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AAIA,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,MAAM;AAChB;AACA;AACA,QAAKtB,aAAL,EAAqB;AACpBsB,MAAAA,kBAAkB,CAAE,IAAF,CAAlB;AACA;AACD,GAND,EAMG,CAAEtB,aAAF,CANH;;AAQA,MAAK,CAAEqB,eAAP,EAAyB;AACxB,WAAO,IAAP;AACA;;AAED,QAAME,cAAc,GAAG,CACtB,cAAI,aAAJ,CADsB,EAEtB;AAAM,IAAA,SAAS,EAAC,iCAAhB;AAAkD,IAAA,GAAG,EAAC;AAAtD,KACG,cAAI,mBAAJ,CADH,CAFsB,CAAvB;AAOA,SACC,4BAAC,qBAAD;AAAW,IAAA,WAAW,EAAG,KAAzB;AAAiC,IAAA,KAAK,EAAGA;AAAzC,KACC,uCACG,cACD,oHADC,CADH,CADD,EAMC,4BAAC,iCAAD;AAA0B,IAAA,IAAI,EAAC;AAA/B,IAND,CADD;AAUA;;eAEcxB,kB","sourcesContent":["/**\n * External dependencies\n */\nimport { some } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { PanelBody } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport HierarchicalTermSelector from '../post-taxonomies/hierarchical-term-selector';\nimport { store as editorStore } from '../../store';\n\nfunction MaybeCategoryPanel() {\n\tconst hasNoCategory = useSelect( ( select ) => {\n\t\tconst postType = select( editorStore ).getCurrentPostType();\n\t\tconst categoriesTaxonomy =\n\t\t\tselect( coreStore ).getTaxonomy( 'category' );\n\t\tconst defaultCategoryId = select( coreStore ).getEntityRecord(\n\t\t\t'root',\n\t\t\t'site'\n\t\t)?.default_category;\n\t\tconst defaultCategory = select( coreStore ).getEntityRecords(\n\t\t\t'taxonomy',\n\t\t\t'category',\n\t\t\t{\n\t\t\t\tid: defaultCategoryId,\n\t\t\t}\n\t\t)?.[ 0 ];\n\t\tconst postTypeSupportsCategories =\n\t\t\tcategoriesTaxonomy &&\n\t\t\tsome( categoriesTaxonomy.types, ( type ) => type === postType );\n\t\tconst categories =\n\t\t\tcategoriesTaxonomy &&\n\t\t\tselect( editorStore ).getEditedPostAttribute(\n\t\t\t\tcategoriesTaxonomy.rest_base\n\t\t\t);\n\n\t\t// This boolean should return true if everything is loaded\n\t\t// ( categoriesTaxonomy, defaultCategory )\n\t\t// and the post has not been assigned a category different than \"uncategorized\".\n\t\treturn (\n\t\t\t!! categoriesTaxonomy &&\n\t\t\t!! defaultCategory &&\n\t\t\tpostTypeSupportsCategories &&\n\t\t\t( categories?.length === 0 ||\n\t\t\t\t( categories?.length === 1 &&\n\t\t\t\t\tdefaultCategory.id === categories[ 0 ] ) )\n\t\t);\n\t}, [] );\n\tconst [ shouldShowPanel, setShouldShowPanel ] = useState( false );\n\tuseEffect( () => {\n\t\t// We use state to avoid hiding the panel if the user edits the categories\n\t\t// and adds one within the panel itself (while visible).\n\t\tif ( hasNoCategory ) {\n\t\t\tsetShouldShowPanel( true );\n\t\t}\n\t}, [ hasNoCategory ] );\n\n\tif ( ! shouldShowPanel ) {\n\t\treturn null;\n\t}\n\n\tconst panelBodyTitle = [\n\t\t__( 'Suggestion:' ),\n\t\t<span className=\"editor-post-publish-panel__link\" key=\"label\">\n\t\t\t{ __( 'Assign a category' ) }\n\t\t</span>,\n\t];\n\n\treturn (\n\t\t<PanelBody initialOpen={ false } title={ panelBodyTitle }>\n\t\t\t<p>\n\t\t\t\t{ __(\n\t\t\t\t\t'Categories provide a helpful way to group related posts together and to quickly tell readers what a post is about.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<HierarchicalTermSelector slug=\"category\" />\n\t\t</PanelBody>\n\t);\n}\n\nexport default MaybeCategoryPanel;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-publish-panel/maybe-post-format-panel.js"],"names":["getSuggestion","supportedFormats","suggestedPostFormat","formats","POST_FORMATS","filter","format","id","PostFormatSuggestion","suggestionText","onUpdatePostFormat","PostFormatPanel","currentPostFormat","suggestion","select","getEditedPostAttribute","getSuggestedPostFormat","editorStore","coreStore","getThemeSupports","editPost","panelBodyTitle","caption"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAjBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAIA,MAAMA,aAAa,GAAG,CAAEC,gBAAF,EAAoBC,mBAApB,KAA6C;AAClE,QAAMC,OAAO,GAAGC,yBAAaC,MAAb,CAAuBC,MAAF,IACpC,sBAAUL,gBAAV,EAA4BK,MAAM,CAACC,EAAnC,CADe,CAAhB;;AAGA,SAAO,kBAAMJ,OAAN,EAAiBG,MAAF,IAAcA,MAAM,CAACC,EAAP,KAAcL,mBAA3C,CAAP;AACA,CALD;;AAOA,MAAMM,oBAAoB,GAAG;AAAA,MAAE;AAC9BN,IAAAA,mBAD8B;AAE9BO,IAAAA,cAF8B;AAG9BC,IAAAA;AAH8B,GAAF;AAAA,SAK5B,4BAAC,kBAAD;AACC,IAAA,OAAO,EAAC,MADT;AAEC,IAAA,OAAO,EAAG,MAAMA,kBAAkB,CAAER,mBAAF;AAFnC,KAIGO,cAJH,CAL4B;AAAA,CAA7B;;AAae,SAASE,eAAT,GAA2B;AACzC,QAAM;AAAEC,IAAAA,iBAAF;AAAqBC,IAAAA;AAArB,MAAoC,qBAAaC,MAAF,IAAc;AAClE,UAAM;AAAEC,MAAAA,sBAAF;AAA0BC,MAAAA;AAA1B,QAAqDF,MAAM,CAChEG,YADgE,CAAjE;AAGA,UAAMhB,gBAAgB,GAAG,iBACxBa,MAAM,CAAEI,eAAF,CAAN,CAAoBC,gBAApB,EADwB,EAExB,CAAE,SAAF,CAFwB,EAGxB,EAHwB,CAAzB;AAKA,WAAO;AACNP,MAAAA,iBAAiB,EAAEG,sBAAsB,CAAE,QAAF,CADnC;AAENF,MAAAA,UAAU,EAAEb,aAAa,CACxBC,gBADwB,EAExBe,sBAAsB,EAFE;AAFnB,KAAP;AAOA,GAhByC,EAgBvC,EAhBuC,CAA1C;AAkBA,QAAM;AAAEI,IAAAA;AAAF,MAAe,uBAAaH,YAAb,CAArB;;AAEA,QAAMP,kBAAkB,GAAKJ,MAAF,IAAcc,QAAQ,CAAE;AAAEd,IAAAA;AAAF,GAAF,CAAjD;;AAEA,QAAMe,cAAc,GAAG,CACtB,cAAI,aAAJ,CADsB,EAEtB;AAAM,IAAA,SAAS,EAAC,iCAAhB;AAAkD,IAAA,GAAG,EAAC;AAAtD,KACG,cAAI,mBAAJ,CADH,CAFsB,CAAvB;;AAOA,MAAK,CAAER,UAAF,IAAgBA,UAAU,CAACN,EAAX,KAAkBK,iBAAvC,EAA2D;AAC1D,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,qBAAD;AAAW,IAAA,WAAW,EAAG,KAAzB;AAAiC,IAAA,KAAK,EAAGS;AAAzC,KACC,uCACG,cACD,+IADC,CADH,CADD,EAMC,uCACC,4BAAC,oBAAD;AACC,IAAA,kBAAkB,EAAGX,kBADtB;AAEC,IAAA,mBAAmB,EAAGG,UAAU,CAACN,EAFlC;AAGC,IAAA,cAAc,EAAG;AAChB;AACA,kBAAI,0BAAJ,CAFgB,EAGhBM,UAAU,CAACS,OAHK;AAHlB,IADD,CAND,CADD;AAoBA","sourcesContent":["/**\n * External dependencies\n */\nimport { find, get, includes } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Button, PanelBody } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { POST_FORMATS } from '../post-format';\nimport { store as editorStore } from '../../store';\n\nconst getSuggestion = ( supportedFormats, suggestedPostFormat ) => {\n\tconst formats = POST_FORMATS.filter( ( format ) =>\n\t\tincludes( supportedFormats, format.id )\n\t);\n\treturn find( formats, ( format ) => format.id === suggestedPostFormat );\n};\n\nconst PostFormatSuggestion = ( {\n\tsuggestedPostFormat,\n\tsuggestionText,\n\tonUpdatePostFormat,\n} ) => (\n\t<Button\n\t\tvariant=\"link\"\n\t\tonClick={ () => onUpdatePostFormat( suggestedPostFormat ) }\n\t>\n\t\t{ suggestionText }\n\t</Button>\n);\n\nexport default function PostFormatPanel() {\n\tconst { currentPostFormat, suggestion } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute, getSuggestedPostFormat } = select(\n\t\t\teditorStore\n\t\t);\n\t\tconst supportedFormats = get(\n\t\t\tselect( coreStore ).getThemeSupports(),\n\t\t\t[ 'formats' ],\n\t\t\t[]\n\t\t);\n\t\treturn {\n\t\t\tcurrentPostFormat: getEditedPostAttribute( 'format' ),\n\t\t\tsuggestion: getSuggestion(\n\t\t\t\tsupportedFormats,\n\t\t\t\tgetSuggestedPostFormat()\n\t\t\t),\n\t\t};\n\t}, [] );\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tconst onUpdatePostFormat = ( format ) => editPost( { format } );\n\n\tconst panelBodyTitle = [\n\t\t__( 'Suggestion:' ),\n\t\t<span className=\"editor-post-publish-panel__link\" key=\"label\">\n\t\t\t{ __( 'Use a post format' ) }\n\t\t</span>,\n\t];\n\n\tif ( ! suggestion || suggestion.id === currentPostFormat ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PanelBody initialOpen={ false } title={ panelBodyTitle }>\n\t\t\t<p>\n\t\t\t\t{ __(\n\t\t\t\t\t'Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<p>\n\t\t\t\t<PostFormatSuggestion\n\t\t\t\t\tonUpdatePostFormat={ onUpdatePostFormat }\n\t\t\t\t\tsuggestedPostFormat={ suggestion.id }\n\t\t\t\t\tsuggestionText={ sprintf(\n\t\t\t\t\t\t/* translators: %s: post format */\n\t\t\t\t\t\t__( 'Apply the \"%1$s\" format.' ),\n\t\t\t\t\t\tsuggestion.caption\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</p>\n\t\t</PanelBody>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-publish-panel/maybe-post-format-panel.js"],"names":["getSuggestion","supportedFormats","suggestedPostFormat","formats","POST_FORMATS","filter","format","id","PostFormatSuggestion","suggestionText","onUpdatePostFormat","PostFormatPanel","currentPostFormat","suggestion","select","getEditedPostAttribute","getSuggestedPostFormat","editorStore","coreStore","getThemeSupports","editPost","panelBodyTitle","caption"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAjBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAIA,MAAMA,aAAa,GAAG,CAAEC,gBAAF,EAAoBC,mBAApB,KAA6C;AAClE,QAAMC,OAAO,GAAGC,yBAAaC,MAAb,CAAuBC,MAAF,IACpC,sBAAUL,gBAAV,EAA4BK,MAAM,CAACC,EAAnC,CADe,CAAhB;;AAGA,SAAO,kBAAMJ,OAAN,EAAiBG,MAAF,IAAcA,MAAM,CAACC,EAAP,KAAcL,mBAA3C,CAAP;AACA,CALD;;AAOA,MAAMM,oBAAoB,GAAG;AAAA,MAAE;AAC9BN,IAAAA,mBAD8B;AAE9BO,IAAAA,cAF8B;AAG9BC,IAAAA;AAH8B,GAAF;AAAA,SAK5B,4BAAC,kBAAD;AACC,IAAA,OAAO,EAAC,MADT;AAEC,IAAA,OAAO,EAAG,MAAMA,kBAAkB,CAAER,mBAAF;AAFnC,KAIGO,cAJH,CAL4B;AAAA,CAA7B;;AAae,SAASE,eAAT,GAA2B;AACzC,QAAM;AAAEC,IAAAA,iBAAF;AAAqBC,IAAAA;AAArB,MAAoC,qBAAaC,MAAF,IAAc;AAClE,UAAM;AAAEC,MAAAA,sBAAF;AAA0BC,MAAAA;AAA1B,QACLF,MAAM,CAAEG,YAAF,CADP;AAEA,UAAMhB,gBAAgB,GAAG,iBACxBa,MAAM,CAAEI,eAAF,CAAN,CAAoBC,gBAApB,EADwB,EAExB,CAAE,SAAF,CAFwB,EAGxB,EAHwB,CAAzB;AAKA,WAAO;AACNP,MAAAA,iBAAiB,EAAEG,sBAAsB,CAAE,QAAF,CADnC;AAENF,MAAAA,UAAU,EAAEb,aAAa,CACxBC,gBADwB,EAExBe,sBAAsB,EAFE;AAFnB,KAAP;AAOA,GAfyC,EAevC,EAfuC,CAA1C;AAiBA,QAAM;AAAEI,IAAAA;AAAF,MAAe,uBAAaH,YAAb,CAArB;;AAEA,QAAMP,kBAAkB,GAAKJ,MAAF,IAAcc,QAAQ,CAAE;AAAEd,IAAAA;AAAF,GAAF,CAAjD;;AAEA,QAAMe,cAAc,GAAG,CACtB,cAAI,aAAJ,CADsB,EAEtB;AAAM,IAAA,SAAS,EAAC,iCAAhB;AAAkD,IAAA,GAAG,EAAC;AAAtD,KACG,cAAI,mBAAJ,CADH,CAFsB,CAAvB;;AAOA,MAAK,CAAER,UAAF,IAAgBA,UAAU,CAACN,EAAX,KAAkBK,iBAAvC,EAA2D;AAC1D,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,qBAAD;AAAW,IAAA,WAAW,EAAG,KAAzB;AAAiC,IAAA,KAAK,EAAGS;AAAzC,KACC,uCACG,cACD,+IADC,CADH,CADD,EAMC,uCACC,4BAAC,oBAAD;AACC,IAAA,kBAAkB,EAAGX,kBADtB;AAEC,IAAA,mBAAmB,EAAGG,UAAU,CAACN,EAFlC;AAGC,IAAA,cAAc,EAAG;AAChB;AACA,kBAAI,0BAAJ,CAFgB,EAGhBM,UAAU,CAACS,OAHK;AAHlB,IADD,CAND,CADD;AAoBA","sourcesContent":["/**\n * External dependencies\n */\nimport { find, get, includes } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Button, PanelBody } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { POST_FORMATS } from '../post-format';\nimport { store as editorStore } from '../../store';\n\nconst getSuggestion = ( supportedFormats, suggestedPostFormat ) => {\n\tconst formats = POST_FORMATS.filter( ( format ) =>\n\t\tincludes( supportedFormats, format.id )\n\t);\n\treturn find( formats, ( format ) => format.id === suggestedPostFormat );\n};\n\nconst PostFormatSuggestion = ( {\n\tsuggestedPostFormat,\n\tsuggestionText,\n\tonUpdatePostFormat,\n} ) => (\n\t<Button\n\t\tvariant=\"link\"\n\t\tonClick={ () => onUpdatePostFormat( suggestedPostFormat ) }\n\t>\n\t\t{ suggestionText }\n\t</Button>\n);\n\nexport default function PostFormatPanel() {\n\tconst { currentPostFormat, suggestion } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute, getSuggestedPostFormat } =\n\t\t\tselect( editorStore );\n\t\tconst supportedFormats = get(\n\t\t\tselect( coreStore ).getThemeSupports(),\n\t\t\t[ 'formats' ],\n\t\t\t[]\n\t\t);\n\t\treturn {\n\t\t\tcurrentPostFormat: getEditedPostAttribute( 'format' ),\n\t\t\tsuggestion: getSuggestion(\n\t\t\t\tsupportedFormats,\n\t\t\t\tgetSuggestedPostFormat()\n\t\t\t),\n\t\t};\n\t}, [] );\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tconst onUpdatePostFormat = ( format ) => editPost( { format } );\n\n\tconst panelBodyTitle = [\n\t\t__( 'Suggestion:' ),\n\t\t<span className=\"editor-post-publish-panel__link\" key=\"label\">\n\t\t\t{ __( 'Use a post format' ) }\n\t\t</span>,\n\t];\n\n\tif ( ! suggestion || suggestion.id === currentPostFormat ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PanelBody initialOpen={ false } title={ panelBodyTitle }>\n\t\t\t<p>\n\t\t\t\t{ __(\n\t\t\t\t\t'Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<p>\n\t\t\t\t<PostFormatSuggestion\n\t\t\t\t\tonUpdatePostFormat={ onUpdatePostFormat }\n\t\t\t\t\tsuggestedPostFormat={ suggestion.id }\n\t\t\t\t\tsuggestionText={ sprintf(\n\t\t\t\t\t\t/* translators: %s: post format */\n\t\t\t\t\t\t__( 'Apply the \"%1$s\" format.' ),\n\t\t\t\t\t\tsuggestion.caption\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</p>\n\t\t</PanelBody>\n\t);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-publish-panel/postpublish.js"],"names":["POSTNAME","getFuturePostUrl","post","slug","permalink_template","includes","replace","CopyButton","text","onCopy","children","ref","PostPublishPanelPostpublish","Component","constructor","arguments","state","showCopyConfirmation","bind","onSelectInput","postLink","componentDidMount","props","focusOnMount","current","focus","componentWillUnmount","clearTimeout","dismissCopyConfirmation","setState","setTimeout","event","target","select","render","isScheduled","postType","postLabel","viewPostLabel","addNewPostLabel","link","status","addLink","post_type","type","postPublishNonLinkHeader","title","getEditedPostAttribute","getCurrentPost","isCurrentPostScheduled","editorStore","getPostType","coreStore"],"mappings":";;;;;;;;;AAUA;;AAPA;;AAKA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AArBA;AACA;AACA;;AAGA;AACA;AACA;;AAUA;AACA;AACA;AAIA,MAAMA,QAAQ,GAAG,YAAjB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMC,gBAAgB,GAAKC,IAAF,IAAY;AACpC,QAAM;AAAEC,IAAAA;AAAF,MAAWD,IAAjB;;AAEA,MAAKA,IAAI,CAACE,kBAAL,CAAwBC,QAAxB,CAAkCL,QAAlC,CAAL,EAAoD;AACnD,WAAOE,IAAI,CAACE,kBAAL,CAAwBE,OAAxB,CAAiCN,QAAjC,EAA2CG,IAA3C,CAAP;AACA;;AAED,SAAOD,IAAI,CAACE,kBAAZ;AACA,CARD;;AAUA,SAASG,UAAT,OAAkD;AAAA,MAA7B;AAAEC,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BAAI,YAAJ,CAFO,EAGPR,SAHO,CAHT;AAQC,MAAA,KAAK,EAAG,iCAAwBG,IAAxB,CART;AASC,MAAA,OAAO,EAAG,KAAKrB;AAThB,MADD,EAaC;AAAK,MAAA,SAAS,EAAC;AAAf,OACC,4BAAC,UAAD;AAAY,MAAA,IAAI,EAAGqB,IAAnB;AAA0B,MAAA,MAAM,EAAG,KAAK/B;AAAxC,OACG,KAAKO,KAAL,CAAWC,oBAAX,GACC,cAAI,SAAJ,CADD,GAEC,cAAI,MAAJ,CAHJ,CADD,CAbD,CAJD,EA0BC;AAAK,MAAA,SAAS,EAAC;AAAf,OACG,CAAEkB,WAAF,IACD,4BAAC,kBAAD;AAAQ,MAAA,OAAO,EAAC,SAAhB;AAA0B,MAAA,IAAI,EAAGK;AAAjC,OACGF,aADH,CAFF,EAMC,4BAAC,kBAAD;AACC,MAAA,OAAO,EAAGH,WAAW,GAAG,SAAH,GAAe,WADrC;AAEC,MAAA,IAAI,EAAGO;AAFR,OAIGH,eAJH,CAND,CA1BD,CAPD,EA+CG7B,QA/CH,CADD;AAmDA;;AA7GkD;;eAgHrC,sBAAcuB,MAAF,IAAc;AACxC,QAAM;AACLc,IAAAA,sBADK;AAELC,IAAAA,cAFK;AAGLC,IAAAA;AAHK,MAIFhB,MAAM,CAAEiB,YAAF,CAJV;AAKA,QAAM;AAAEC,IAAAA;AAAF,MAAkBlB,MAAM,CAAEmB,eAAF,CAA9B;AAEA,SAAO;AACNlD,IAAAA,IAAI,EAAE8C,cAAc,EADd;AAENZ,IAAAA,QAAQ,EAAEe,WAAW,CAAEJ,sBAAsB,CAAE,MAAF,CAAxB,CAFf;AAGNZ,IAAAA,WAAW,EAAEc,sBAAsB;AAH7B,GAAP;AAKA,CAbc,EAaVrC,2BAbU,C","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { PanelBody, Button, TextControl } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Component, createRef } from '@wordpress/element';\nimport { withSelect } from '@wordpress/data';\nimport { addQueryArgs, safeDecodeURIComponent } from '@wordpress/url';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostScheduleLabel from '../post-schedule/label';\nimport { store as editorStore } from '../../store';\n\nconst POSTNAME = '%postname%';\n\n/**\n * Returns URL for a future post.\n *\n * @param {Object} post Post object.\n *\n * @return {string} PostPublish URL.\n */\n\nconst getFuturePostUrl = ( post ) => {\n\tconst { slug } = post;\n\n\tif ( post.permalink_template.includes( POSTNAME ) ) {\n\t\treturn post.permalink_template.replace( POSTNAME, slug );\n\t}\n\n\treturn post.permalink_template;\n};\n\nfunction CopyButton( { text, onCopy, children } ) {\n\tconst ref = useCopyToClipboard( text, onCopy );\n\treturn (\n\t\t<Button variant=\"secondary\" ref={ ref }>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n}\n\nclass PostPublishPanelPostpublish extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.state = {\n\t\t\tshowCopyConfirmation: false,\n\t\t};\n\t\tthis.onCopy = this.onCopy.bind( this );\n\t\tthis.onSelectInput = this.onSelectInput.bind( this );\n\t\tthis.postLink = createRef();\n\t}\n\n\tcomponentDidMount() {\n\t\tif ( this.props.focusOnMount ) {\n\t\t\tthis.postLink.current.focus();\n\t\t}\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearTimeout( this.dismissCopyConfirmation );\n\t}\n\n\tonCopy() {\n\t\tthis.setState( {\n\t\t\tshowCopyConfirmation: true,\n\t\t} );\n\n\t\tclearTimeout( this.dismissCopyConfirmation );\n\t\tthis.dismissCopyConfirmation = setTimeout( () => {\n\t\t\tthis.setState( {\n\t\t\t\tshowCopyConfirmation: false,\n\t\t\t} );\n\t\t}, 4000 );\n\t}\n\n\tonSelectInput( event ) {\n\t\tevent.target.select();\n\t}\n\n\trender() {\n\t\tconst { children, isScheduled, post, postType } = this.props;\n\t\tconst postLabel = get( postType, [ 'labels', 'singular_name' ] );\n\t\tconst viewPostLabel = get( postType, [ 'labels', 'view_item' ] );\n\t\tconst addNewPostLabel = get( postType, [ 'labels', 'add_new_item' ] );\n\t\tconst link =\n\t\t\tpost.status === 'future' ? getFuturePostUrl( post ) : post.link;\n\t\tconst addLink = addQueryArgs( 'post-new.php', {\n\t\t\tpost_type: post.type,\n\t\t} );\n\n\t\tconst postPublishNonLinkHeader = isScheduled ? (\n\t\t\t<>\n\t\t\t\t{ __( 'is now scheduled. It will go live on' ) }{ ' ' }\n\t\t\t\t<PostScheduleLabel />.\n\t\t\t</>\n\t\t) : (\n\t\t\t__( 'is now live.' )\n\t\t);\n\n\t\treturn (\n\t\t\t<div className=\"post-publish-panel__postpublish\">\n\t\t\t\t<PanelBody className=\"post-publish-panel__postpublish-header\">\n\t\t\t\t\t<a ref={ this.postLink } href={ link }>\n\t\t\t\t\t\t{ decodeEntities( post.title ) || __( '(no title)' ) }\n\t\t\t\t\t</a>{ ' ' }\n\t\t\t\t\t{ postPublishNonLinkHeader }\n\t\t\t\t</PanelBody>\n\t\t\t\t<PanelBody>\n\t\t\t\t\t<p className=\"post-publish-panel__postpublish-subheader\">\n\t\t\t\t\t\t<strong>{ __( 'What’s next?' ) }</strong>\n\t\t\t\t\t</p>\n\t\t\t\t\t<div className=\"post-publish-panel__postpublish-post-address-container\">\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\tclassName=\"post-publish-panel__postpublish-post-address\"\n\t\t\t\t\t\t\treadOnly\n\t\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: post type singular name */\n\t\t\t\t\t\t\t\t__( '%s address' ),\n\t\t\t\t\t\t\t\tpostLabel\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tvalue={ safeDecodeURIComponent( link ) }\n\t\t\t\t\t\t\tonFocus={ this.onSelectInput }\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t<div className=\"post-publish-panel__postpublish-post-address__copy-button-wrap\">\n\t\t\t\t\t\t\t<CopyButton text={ link } onCopy={ this.onCopy }>\n\t\t\t\t\t\t\t\t{ this.state.showCopyConfirmation\n\t\t\t\t\t\t\t\t\t? __( 'Copied!' )\n\t\t\t\t\t\t\t\t\t: __( 'Copy' ) }\n\t\t\t\t\t\t\t</CopyButton>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div className=\"post-publish-panel__postpublish-buttons\">\n\t\t\t\t\t\t{ ! isScheduled && (\n\t\t\t\t\t\t\t<Button variant=\"primary\" href={ link }>\n\t\t\t\t\t\t\t\t{ viewPostLabel }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant={ isScheduled ? 'primary' : 'secondary' }\n\t\t\t\t\t\t\thref={ addLink }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ addNewPostLabel }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</div>\n\t\t\t\t</PanelBody>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t);\n\t}\n}\n\nexport default withSelect( ( select ) => {\n\tconst {\n\t\tgetEditedPostAttribute,\n\t\tgetCurrentPost,\n\t\tisCurrentPostScheduled,\n\t} = select( editorStore );\n\tconst { getPostType } = select( coreStore );\n\n\treturn {\n\t\tpost: getCurrentPost(),\n\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t\tisScheduled: isCurrentPostScheduled(),\n\t};\n} )( PostPublishPanelPostpublish );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-publish-panel/postpublish.js"],"names":["POSTNAME","getFuturePostUrl","post","slug","permalink_template","includes","replace","CopyButton","text","onCopy","children","ref","PostPublishPanelPostpublish","Component","constructor","arguments","state","showCopyConfirmation","bind","onSelectInput","postLink","componentDidMount","props","focusOnMount","current","focus","componentWillUnmount","clearTimeout","dismissCopyConfirmation","setState","setTimeout","event","target","select","render","isScheduled","postType","postLabel","viewPostLabel","addNewPostLabel","link","status","addLink","post_type","type","postPublishNonLinkHeader","title","getEditedPostAttribute","getCurrentPost","isCurrentPostScheduled","editorStore","getPostType","coreStore"],"mappings":";;;;;;;;;AAUA;;AAPA;;AAKA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AArBA;AACA;AACA;;AAGA;AACA;AACA;;AAUA;AACA;AACA;AAIA,MAAMA,QAAQ,GAAG,YAAjB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMC,gBAAgB,GAAKC,IAAF,IAAY;AACpC,QAAM;AAAEC,IAAAA;AAAF,MAAWD,IAAjB;;AAEA,MAAKA,IAAI,CAACE,kBAAL,CAAwBC,QAAxB,CAAkCL,QAAlC,CAAL,EAAoD;AACnD,WAAOE,IAAI,CAACE,kBAAL,CAAwBE,OAAxB,CAAiCN,QAAjC,EAA2CG,IAA3C,CAAP;AACA;;AAED,SAAOD,IAAI,CAACE,kBAAZ;AACA,CARD;;AAUA,SAASG,UAAT,OAAkD;AAAA,MAA7B;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,MAAR;AAAgBC,IAAAA;AAAhB,GAA6B;AACjD,QAAMC,GAAG,GAAG,iCAAoBH,IAApB,EAA0BC,MAA1B,CAAZ;AACA,SACC,4BAAC,kBAAD;AAAQ,IAAA,OAAO,EAAC,WAAhB;AAA4B,IAAA,GAAG,EAAGE;AAAlC,KACGD,QADH,CADD;AAKA;;AAED,MAAME,2BAAN,SAA0CC,kBAA1C,CAAoD;AACnDC,EAAAA,WAAW,GAAG;AACb,UAAO,GAAGC,SAAV;AACA,SAAKC,KAAL,GAAa;AACZC,MAAAA,oBAAoB,EAAE;AADV,KAAb;AAGA,SAAKR,MAAL,GAAc,KAAKA,MAAL,CAAYS,IAAZ,CAAkB,IAAlB,CAAd;AACA,SAAKC,aAA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K;AAAjC,OACGF,aADH,CAFF,EAMC,4BAAC,kBAAD;AACC,MAAA,OAAO,EAAGH,WAAW,GAAG,SAAH,GAAe,WADrC;AAEC,MAAA,IAAI,EAAGO;AAFR,OAIGH,eAJH,CAND,CA1BD,CAPD,EA+CG7B,QA/CH,CADD;AAmDA;;AA7GkD;;eAgHrC,sBAAcuB,MAAF,IAAc;AACxC,QAAM;AAAEc,IAAAA,sBAAF;AAA0BC,IAAAA,cAA1B;AAA0CC,IAAAA;AAA1C,MACLhB,MAAM,CAAEiB,YAAF,CADP;AAEA,QAAM;AAAEC,IAAAA;AAAF,MAAkBlB,MAAM,CAAEmB,eAAF,CAA9B;AAEA,SAAO;AACNlD,IAAAA,IAAI,EAAE8C,cAAc,EADd;AAENZ,IAAAA,QAAQ,EAAEe,WAAW,CAAEJ,sBAAsB,CAAE,MAAF,CAAxB,CAFf;AAGNZ,IAAAA,WAAW,EAAEc,sBAAsB;AAH7B,GAAP;AAKA,CAVc,EAUVrC,2BAVU,C","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { PanelBody, Button, TextControl } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Component, createRef } from '@wordpress/element';\nimport { withSelect } from '@wordpress/data';\nimport { addQueryArgs, safeDecodeURIComponent } from '@wordpress/url';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostScheduleLabel from '../post-schedule/label';\nimport { store as editorStore } from '../../store';\n\nconst POSTNAME = '%postname%';\n\n/**\n * Returns URL for a future post.\n *\n * @param {Object} post Post object.\n *\n * @return {string} PostPublish URL.\n */\n\nconst getFuturePostUrl = ( post ) => {\n\tconst { slug } = post;\n\n\tif ( post.permalink_template.includes( POSTNAME ) ) {\n\t\treturn post.permalink_template.replace( POSTNAME, slug );\n\t}\n\n\treturn post.permalink_template;\n};\n\nfunction CopyButton( { text, onCopy, children } ) {\n\tconst ref = useCopyToClipboard( text, onCopy );\n\treturn (\n\t\t<Button variant=\"secondary\" ref={ ref }>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n}\n\nclass PostPublishPanelPostpublish extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.state = {\n\t\t\tshowCopyConfirmation: false,\n\t\t};\n\t\tthis.onCopy = this.onCopy.bind( this );\n\t\tthis.onSelectInput = this.onSelectInput.bind( this );\n\t\tthis.postLink = createRef();\n\t}\n\n\tcomponentDidMount() {\n\t\tif ( this.props.focusOnMount ) {\n\t\t\tthis.postLink.current.focus();\n\t\t}\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearTimeout( this.dismissCopyConfirmation );\n\t}\n\n\tonCopy() {\n\t\tthis.setState( {\n\t\t\tshowCopyConfirmation: true,\n\t\t} );\n\n\t\tclearTimeout( this.dismissCopyConfirmation );\n\t\tthis.dismissCopyConfirmation = setTimeout( () => {\n\t\t\tthis.setState( {\n\t\t\t\tshowCopyConfirmation: false,\n\t\t\t} );\n\t\t}, 4000 );\n\t}\n\n\tonSelectInput( event ) {\n\t\tevent.target.select();\n\t}\n\n\trender() {\n\t\tconst { children, isScheduled, post, postType } = this.props;\n\t\tconst postLabel = get( postType, [ 'labels', 'singular_name' ] );\n\t\tconst viewPostLabel = get( postType, [ 'labels', 'view_item' ] );\n\t\tconst addNewPostLabel = get( postType, [ 'labels', 'add_new_item' ] );\n\t\tconst link =\n\t\t\tpost.status === 'future' ? getFuturePostUrl( post ) : post.link;\n\t\tconst addLink = addQueryArgs( 'post-new.php', {\n\t\t\tpost_type: post.type,\n\t\t} );\n\n\t\tconst postPublishNonLinkHeader = isScheduled ? (\n\t\t\t<>\n\t\t\t\t{ __( 'is now scheduled. It will go live on' ) }{ ' ' }\n\t\t\t\t<PostScheduleLabel />.\n\t\t\t</>\n\t\t) : (\n\t\t\t__( 'is now live.' )\n\t\t);\n\n\t\treturn (\n\t\t\t<div className=\"post-publish-panel__postpublish\">\n\t\t\t\t<PanelBody className=\"post-publish-panel__postpublish-header\">\n\t\t\t\t\t<a ref={ this.postLink } href={ link }>\n\t\t\t\t\t\t{ decodeEntities( post.title ) || __( '(no title)' ) }\n\t\t\t\t\t</a>{ ' ' }\n\t\t\t\t\t{ postPublishNonLinkHeader }\n\t\t\t\t</PanelBody>\n\t\t\t\t<PanelBody>\n\t\t\t\t\t<p className=\"post-publish-panel__postpublish-subheader\">\n\t\t\t\t\t\t<strong>{ __( 'What’s next?' ) }</strong>\n\t\t\t\t\t</p>\n\t\t\t\t\t<div className=\"post-publish-panel__postpublish-post-address-container\">\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\tclassName=\"post-publish-panel__postpublish-post-address\"\n\t\t\t\t\t\t\treadOnly\n\t\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: post type singular name */\n\t\t\t\t\t\t\t\t__( '%s address' ),\n\t\t\t\t\t\t\t\tpostLabel\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tvalue={ safeDecodeURIComponent( link ) }\n\t\t\t\t\t\t\tonFocus={ this.onSelectInput }\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t<div className=\"post-publish-panel__postpublish-post-address__copy-button-wrap\">\n\t\t\t\t\t\t\t<CopyButton text={ link } onCopy={ this.onCopy }>\n\t\t\t\t\t\t\t\t{ this.state.showCopyConfirmation\n\t\t\t\t\t\t\t\t\t? __( 'Copied!' )\n\t\t\t\t\t\t\t\t\t: __( 'Copy' ) }\n\t\t\t\t\t\t\t</CopyButton>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div className=\"post-publish-panel__postpublish-buttons\">\n\t\t\t\t\t\t{ ! isScheduled && (\n\t\t\t\t\t\t\t<Button variant=\"primary\" href={ link }>\n\t\t\t\t\t\t\t\t{ viewPostLabel }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant={ isScheduled ? 'primary' : 'secondary' }\n\t\t\t\t\t\t\thref={ addLink }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ addNewPostLabel }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</div>\n\t\t\t\t</PanelBody>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t);\n\t}\n}\n\nexport default withSelect( ( select ) => {\n\tconst { getEditedPostAttribute, getCurrentPost, isCurrentPostScheduled } =\n\t\tselect( editorStore );\n\tconst { getPostType } = select( coreStore );\n\n\treturn {\n\t\tpost: getCurrentPost(),\n\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t\tisScheduled: isCurrentPostScheduled(),\n\t};\n} )( PostPublishPanelPostpublish );\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-publish-panel/prepublish.js"],"names":["PostPublishPanelPrepublish","children","isBeingScheduled","isRequestingSiteIcon","hasPublishAction","siteIconUrl","siteTitle","siteHome","select","getCurrentPost","isEditedPostBeingScheduled","editorStore","getEntityRecord","isResolving","coreStore","siteData","undefined","site_icon_url","name","home","siteIcon","wordpress","prePublishTitle","prePublishBodyText"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA1BA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;AAUA,SAASA,0BAAT,OAAoD;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACnD,QAAM;AACLC,IAAAA,gBADK;AAELC,IAAAA,oBAFK;AAGLC,IAAAA,gBAHK;AAILC,IAAAA,WAJK;AAKLC,IAAAA,SALK;AAMLC,IAAAA;AANK,MAOF,qBAAaC,MAAF,IAAc;AAC5B,UAAM;AAAEC,MAAAA,cAAF;AAAkBC,MA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AiDGH,QAjDH,CADD;AAqDA;;eAEcD,0B","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Icon, PanelBody } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { wordpress } from '@wordpress/icons';\nimport { filterURLForDisplay } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport PostVisibility from '../post-visibility';\nimport PostVisibilityLabel from '../post-visibility/label';\nimport PostSchedule from '../post-schedule';\nimport PostScheduleLabel from '../post-schedule/label';\nimport MaybeTagsPanel from './maybe-tags-panel';\nimport MaybePostFormatPanel from './maybe-post-format-panel';\nimport { store as editorStore } from '../../store';\nimport MaybeCategoryPanel from './maybe-category-panel';\n\nfunction PostPublishPanelPrepublish( { children } ) {\n\tconst {\n\t\tisBeingScheduled,\n\t\tisRequestingSiteIcon,\n\t\thasPublishAction,\n\t\tsiteIconUrl,\n\t\tsiteTitle,\n\t\tsiteHome,\n\t} = useSelect( ( select ) => {\n\t\tconst { getCurrentPost, isEditedPostBeingScheduled } = select(\n\t\t\teditorStore\n\t\t);\n\t\tconst { getEntityRecord, isResolving } = select( coreStore );\n\t\tconst siteData =\n\t\t\tgetEntityRecord( 'root', '__unstableBase', undefined ) || {};\n\n\t\treturn {\n\t\t\thasPublishAction: get(\n\t\t\t\tgetCurrentPost(),\n\t\t\t\t[ '_links', 'wp:action-publish' ],\n\t\t\t\tfalse\n\t\t\t),\n\t\t\tisBeingScheduled: isEditedPostBeingScheduled(),\n\t\t\tisRequestingSiteIcon: isResolving( 'getEntityRecord', [\n\t\t\t\t'root',\n\t\t\t\t'__unstableBase',\n\t\t\t\tundefined,\n\t\t\t] ),\n\t\t\tsiteIconUrl: siteData.site_icon_url,\n\t\t\tsiteTitle: siteData.name,\n\t\t\tsiteHome: siteData.home && filterURLForDisplay( siteData.home ),\n\t\t};\n\t}, [] );\n\n\tlet siteIcon = (\n\t\t<Icon className=\"components-site-icon\" size=\"36px\" icon={ wordpress } />\n\t);\n\n\tif ( siteIconUrl ) {\n\t\tsiteIcon = (\n\t\t\t<img\n\t\t\t\talt={ __( 'Site Icon' ) }\n\t\t\t\tclassName=\"components-site-icon\"\n\t\t\t\tsrc={ siteIconUrl }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( isRequestingSiteIcon ) {\n\t\tsiteIcon = null;\n\t}\n\n\tlet prePublishTitle, prePublishBodyText;\n\n\tif ( ! hasPublishAction ) {\n\t\tprePublishTitle = __( 'Are you ready to submit for review?' );\n\t\tprePublishBodyText = __(\n\t\t\t'When you’re ready, submit your work for review, and an Editor will be able to approve it for you.'\n\t\t);\n\t} else if ( isBeingScheduled ) {\n\t\tprePublishTitle = __( 'Are you ready to schedule?' );\n\t\tprePublishBodyText = __(\n\t\t\t'Your work will be published at the specified date and time.'\n\t\t);\n\t} else {\n\t\tprePublishTitle = __( 'Are you ready to publish?' );\n\t\tprePublishBodyText = __(\n\t\t\t'Double-check your settings before publishing.'\n\t\t);\n\t}\n\n\treturn (\n\t\t<div className=\"editor-post-publish-panel__prepublish\">\n\t\t\t<div>\n\t\t\t\t<strong>{ prePublishTitle }</strong>\n\t\t\t</div>\n\t\t\t<p>{ prePublishBodyText }</p>\n\t\t\t<div className=\"components-site-card\">\n\t\t\t\t{ siteIcon }\n\t\t\t\t<div className=\"components-site-info\">\n\t\t\t\t\t<span className=\"components-site-name\">\n\t\t\t\t\t\t{ decodeEntities( siteTitle ) || __( '(Untitled)' ) }\n\t\t\t\t\t</span>\n\t\t\t\t\t<span className=\"components-site-home\">{ siteHome }</span>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t{ hasPublishAction && (\n\t\t\t\t<>\n\t\t\t\t\t<PanelBody\n\t\t\t\t\t\tinitialOpen={ false }\n\t\t\t\t\t\ttitle={ [\n\t\t\t\t\t\t\t__( 'Visibility:' ),\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tclassName=\"editor-post-publish-panel__link\"\n\t\t\t\t\t\t\t\tkey=\"label\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<PostVisibilityLabel />\n\t\t\t\t\t\t\t</span>,\n\t\t\t\t\t\t] }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PostVisibility />\n\t\t\t\t\t</PanelBody>\n\t\t\t\t\t<PanelBody\n\t\t\t\t\t\tinitialOpen={ false }\n\t\t\t\t\t\ttitle={ [\n\t\t\t\t\t\t\t__( 'Publish:' ),\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tclassName=\"editor-post-publish-panel__link\"\n\t\t\t\t\t\t\t\tkey=\"label\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<PostScheduleLabel />\n\t\t\t\t\t\t\t</span>,\n\t\t\t\t\t\t] }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PostSchedule />\n\t\t\t\t\t</PanelBody>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<MaybePostFormatPanel />\n\t\t\t<MaybeTagsPanel />\n\t\t\t<MaybeCategoryPanel />\n\t\t\t{ children }\n\t\t</div>\n\t);\n}\n\nexport default PostPublishPanelPrepublish;\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-publish-panel/prepublish.js"],"names":["PostPublishPanelPrepublish","children","isBeingScheduled","isRequestingSiteIcon","hasPublishAction","siteIconUrl","siteTitle","siteHome","select","getCurrentPost","isEditedPostBeingScheduled","editorStore","getEntityRecord","isResolving","coreStore","siteData","undefined","site_icon_url","name","home","siteIcon","wordpress","prePublishTitle","prePublishBodyText"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA1BA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;AAUA,SAASA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P,cAAI,UAAJ,CADO,EAEP;AACC,MAAA,SAAS,EAAC,iCADX;AAEC,MAAA,GAAG,EAAC;AAFL,OAIC,4BAAC,eAAD,OAJD,CAFO;AAFT,KAYC,4BAAC,qBAAD,OAZD,CAfD,CAfF,EA8CC,4BAAC,6BAAD,OA9CD,EA+CC,4BAAC,uBAAD,OA/CD,EAgDC,4BAAC,2BAAD,OAhDD,EAiDGH,QAjDH,CADD;AAqDA;;eAEcD,0B","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Icon, PanelBody } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { wordpress } from '@wordpress/icons';\nimport { filterURLForDisplay } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport PostVisibility from '../post-visibility';\nimport PostVisibilityLabel from '../post-visibility/label';\nimport PostSchedule from '../post-schedule';\nimport PostScheduleLabel from '../post-schedule/label';\nimport MaybeTagsPanel from './maybe-tags-panel';\nimport MaybePostFormatPanel from './maybe-post-format-panel';\nimport { store as editorStore } from '../../store';\nimport MaybeCategoryPanel from './maybe-category-panel';\n\nfunction PostPublishPanelPrepublish( { children } ) {\n\tconst {\n\t\tisBeingScheduled,\n\t\tisRequestingSiteIcon,\n\t\thasPublishAction,\n\t\tsiteIconUrl,\n\t\tsiteTitle,\n\t\tsiteHome,\n\t} = useSelect( ( select ) => {\n\t\tconst { getCurrentPost, isEditedPostBeingScheduled } =\n\t\t\tselect( editorStore );\n\t\tconst { getEntityRecord, isResolving } = select( coreStore );\n\t\tconst siteData =\n\t\t\tgetEntityRecord( 'root', '__unstableBase', undefined ) || {};\n\n\t\treturn {\n\t\t\thasPublishAction: get(\n\t\t\t\tgetCurrentPost(),\n\t\t\t\t[ '_links', 'wp:action-publish' ],\n\t\t\t\tfalse\n\t\t\t),\n\t\t\tisBeingScheduled: isEditedPostBeingScheduled(),\n\t\t\tisRequestingSiteIcon: isResolving( 'getEntityRecord', [\n\t\t\t\t'root',\n\t\t\t\t'__unstableBase',\n\t\t\t\tundefined,\n\t\t\t] ),\n\t\t\tsiteIconUrl: siteData.site_icon_url,\n\t\t\tsiteTitle: siteData.name,\n\t\t\tsiteHome: siteData.home && filterURLForDisplay( siteData.home ),\n\t\t};\n\t}, [] );\n\n\tlet siteIcon = (\n\t\t<Icon className=\"components-site-icon\" size=\"36px\" icon={ wordpress } />\n\t);\n\n\tif ( siteIconUrl ) {\n\t\tsiteIcon = (\n\t\t\t<img\n\t\t\t\talt={ __( 'Site Icon' ) }\n\t\t\t\tclassName=\"components-site-icon\"\n\t\t\t\tsrc={ siteIconUrl }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( isRequestingSiteIcon ) {\n\t\tsiteIcon = null;\n\t}\n\n\tlet prePublishTitle, prePublishBodyText;\n\n\tif ( ! hasPublishAction ) {\n\t\tprePublishTitle = __( 'Are you ready to submit for review?' );\n\t\tprePublishBodyText = __(\n\t\t\t'When you’re ready, submit your work for review, and an Editor will be able to approve it for you.'\n\t\t);\n\t} else if ( isBeingScheduled ) {\n\t\tprePublishTitle = __( 'Are you ready to schedule?' );\n\t\tprePublishBodyText = __(\n\t\t\t'Your work will be published at the specified date and time.'\n\t\t);\n\t} else {\n\t\tprePublishTitle = __( 'Are you ready to publish?' );\n\t\tprePublishBodyText = __(\n\t\t\t'Double-check your settings before publishing.'\n\t\t);\n\t}\n\n\treturn (\n\t\t<div className=\"editor-post-publish-panel__prepublish\">\n\t\t\t<div>\n\t\t\t\t<strong>{ prePublishTitle }</strong>\n\t\t\t</div>\n\t\t\t<p>{ prePublishBodyText }</p>\n\t\t\t<div className=\"components-site-card\">\n\t\t\t\t{ siteIcon }\n\t\t\t\t<div className=\"components-site-info\">\n\t\t\t\t\t<span className=\"components-site-name\">\n\t\t\t\t\t\t{ decodeEntities( siteTitle ) || __( '(Untitled)' ) }\n\t\t\t\t\t</span>\n\t\t\t\t\t<span className=\"components-site-home\">{ siteHome }</span>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t{ hasPublishAction && (\n\t\t\t\t<>\n\t\t\t\t\t<PanelBody\n\t\t\t\t\t\tinitialOpen={ false }\n\t\t\t\t\t\ttitle={ [\n\t\t\t\t\t\t\t__( 'Visibility:' ),\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tclassName=\"editor-post-publish-panel__link\"\n\t\t\t\t\t\t\t\tkey=\"label\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<PostVisibilityLabel />\n\t\t\t\t\t\t\t</span>,\n\t\t\t\t\t\t] }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PostVisibility />\n\t\t\t\t\t</PanelBody>\n\t\t\t\t\t<PanelBody\n\t\t\t\t\t\tinitialOpen={ false }\n\t\t\t\t\t\ttitle={ [\n\t\t\t\t\t\t\t__( 'Publish:' ),\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tclassName=\"editor-post-publish-panel__link\"\n\t\t\t\t\t\t\t\tkey=\"label\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<PostScheduleLabel />\n\t\t\t\t\t\t\t</span>,\n\t\t\t\t\t\t] }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PostSchedule />\n\t\t\t\t\t</PanelBody>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<MaybePostFormatPanel />\n\t\t\t<MaybeTagsPanel />\n\t\t\t<MaybeCategoryPanel />\n\t\t\t{ children }\n\t\t</div>\n\t);\n}\n\nexport default PostPublishPanelPrepublish;\n"]}
@@ -3,8 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.PostScheduleLabel = PostScheduleLabel;
7
- exports.default = void 0;
6
+ exports.default = PostScheduleLabel;
7
+ exports.getFullPostScheduleLabel = getFullPostScheduleLabel;
8
+ exports.getPostScheduleLabel = getPostScheduleLabel;
9
+ exports.usePostScheduleLabel = usePostScheduleLabel;
8
10
 
9
11
  var _i18n = require("@wordpress/i18n");
10
12
 
@@ -21,21 +23,99 @@ var _store = require("../../store");
21
23
  /**
22
24
  * Internal dependencies
23
25
  */
24
- function PostScheduleLabel(_ref) {
26
+ function PostScheduleLabel(props) {
27
+ return usePostScheduleLabel(props);
28
+ }
29
+
30
+ function usePostScheduleLabel() {
25
31
  let {
32
+ full = false
33
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
34
+ const {
26
35
  date,
27
36
  isFloating
28
- } = _ref;
29
- const settings = (0, _date.__experimentalGetSettings)();
30
- return date && !isFloating ? (0, _date.format)(`${settings.formats.date} ${settings.formats.time}`, date) : (0, _i18n.__)('Immediately');
31
- }
32
-
33
- var _default = (0, _data.withSelect)(select => {
34
- return {
37
+ } = (0, _data.useSelect)(select => ({
35
38
  date: select(_store.store).getEditedPostAttribute('date'),
36
39
  isFloating: select(_store.store).isEditedPostDateFloating()
37
- };
38
- })(PostScheduleLabel);
40
+ }), []);
41
+ return full ? getFullPostScheduleLabel(date) : getPostScheduleLabel(date, {
42
+ isFloating
43
+ });
44
+ }
45
+
46
+ function getFullPostScheduleLabel(dateAttribute) {
47
+ const date = (0, _date.getDate)(dateAttribute);
48
+ const timezoneAbbreviation = getTimezoneAbbreviation();
49
+ const formattedDate = (0, _date.dateI18n)( // translators: If using a space between 'g:i' and 'a', use a non-breaking sapce.
50
+ (0, _i18n._x)('F j, Y g:i\xa0a', 'post schedule full date format'), date);
51
+ return (0, _i18n.isRTL)() ? `${timezoneAbbreviation} ${formattedDate}` : `${formattedDate} ${timezoneAbbreviation}`;
52
+ }
53
+
54
+ function getPostScheduleLabel(dateAttribute) {
55
+ let {
56
+ isFloating = false,
57
+ now = new Date()
58
+ } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
59
+
60
+ if (!dateAttribute || isFloating) {
61
+ return (0, _i18n.__)('Immediately');
62
+ } // If the user timezone does not equal the site timezone then using words
63
+ // like 'tomorrow' is confusing, so show the full date.
64
+
65
+
66
+ if (!isTimezoneSameAsSiteTimezone(now)) {
67
+ return getFullPostScheduleLabel(dateAttribute);
68
+ }
69
+
70
+ const date = (0, _date.getDate)(dateAttribute);
39
71
 
40
- exports.default = _default;
72
+ if (isSameDay(date, now)) {
73
+ return (0, _i18n.sprintf)( // translators: %s: Time of day the post is scheduled for.
74
+ (0, _i18n.__)('Today at %s'), // translators: If using a space between 'g:i' and 'a', use a non-breaking sapce.
75
+ (0, _date.dateI18n)((0, _i18n._x)('g:i\xa0a', 'post schedule time format'), date));
76
+ }
77
+
78
+ const tomorrow = new Date(now);
79
+ tomorrow.setDate(tomorrow.getDate() + 1);
80
+
81
+ if (isSameDay(date, tomorrow)) {
82
+ return (0, _i18n.sprintf)( // translators: %s: Time of day the post is scheduled for.
83
+ (0, _i18n.__)('Tomorrow at %s'), // translators: If using a space between 'g:i' and 'a', use a non-breaking sapce.
84
+ (0, _date.dateI18n)((0, _i18n._x)('g:i\xa0a', 'post schedule time format'), date));
85
+ }
86
+
87
+ if (date.getFullYear() === now.getFullYear()) {
88
+ return (0, _date.dateI18n)( // translators: If using a space between 'g:i' and 'a', use a non-breaking sapce.
89
+ (0, _i18n._x)('F j g:i\xa0a', 'post schedule date format without year'), date);
90
+ }
91
+
92
+ return (0, _date.dateI18n)( // translators: Use a non-breaking space between 'g:i' and 'a' if appropriate.
93
+ (0, _i18n._x)('F j, Y g:i\xa0a', 'post schedule full date format'), date);
94
+ }
95
+
96
+ function getTimezoneAbbreviation() {
97
+ const {
98
+ timezone
99
+ } = (0, _date.__experimentalGetSettings)();
100
+
101
+ if (timezone.abbr && isNaN(Number(timezone.abbr))) {
102
+ return timezone.abbr;
103
+ }
104
+
105
+ const symbol = timezone.offset < 0 ? '' : '+';
106
+ return `UTC${symbol}${timezone.offset}`;
107
+ }
108
+
109
+ function isTimezoneSameAsSiteTimezone(date) {
110
+ const {
111
+ timezone
112
+ } = (0, _date.__experimentalGetSettings)();
113
+ const siteOffset = Number(timezone.offset);
114
+ const dateOffset = -1 * (date.getTimezoneOffset() / 60);
115
+ return siteOffset === dateOffset;
116
+ }
117
+
118
+ function isSameDay(left, right) {
119
+ return left.getDate() === right.getDate() && left.getMonth() === right.getMonth() && left.getFullYear() === right.getFullYear();
120
+ }
41
121
  //# sourceMappingURL=label.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-schedule/label.js"],"names":["PostScheduleLabel","date","isFloating","settings","formats","time","select","editorStore","getEditedPostAttribute","isEditedPostDateFloating"],"mappings":";;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAVA;AACA;AACA;;AAKA;AACA;AACA;AAGO,SAASA,iBAAT,OAAmD;AAAA,MAAvB;AAAEC,IAAAA,IAAF;AAAQC,IAAAA;AAAR,GAAuB;AACzD,QAAMC,QAAQ,GAAG,sCAAjB;AACA,SAAOF,IAAI,IAAI,CAAEC,UAAV,GACJ,kBACC,GAAGC,QAAQ,CAACC,OAAT,CAAiBH,IAAM,IAAIE,QAAQ,CAACC,OAAT,CAAiBC,IAAM,EADtD,EAEAJ,IAFA,CADI,GAKJ,cAAI,aAAJ,CALH;AAMA;;eAEc,sBAAcK,MAAF,IAAc;AACxC,SAAO;AACNL,IAAAA,IAAI,EAAEK,MAAM,CAAEC,YAAF,CAAN,CAAsBC,sBAAtB,CAA8C,MAA9C,CADA;AAENN,IAAAA,UAAU,EAAEI,MAAM,CAAEC,YAAF,CAAN,CAAsBE,wBAAtB;AAFN,GAAP;AAIA,CALc,EAKVT,iBALU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { format, __experimentalGetSettings } from '@wordpress/date';\nimport { withSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function PostScheduleLabel( { date, isFloating } ) {\n\tconst settings = __experimentalGetSettings();\n\treturn date && ! isFloating\n\t\t? format(\n\t\t\t\t`${ settings.formats.date } ${ settings.formats.time }`,\n\t\t\t\tdate\n\t\t )\n\t\t: __( 'Immediately' );\n}\n\nexport default withSelect( ( select ) => {\n\treturn {\n\t\tdate: select( editorStore ).getEditedPostAttribute( 'date' ),\n\t\tisFloating: select( editorStore ).isEditedPostDateFloating(),\n\t};\n} )( PostScheduleLabel );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-schedule/label.js"],"names":["PostScheduleLabel","props","usePostScheduleLabel","full","date","isFloating","select","editorStore","getEditedPostAttribute","isEditedPostDateFloating","getFullPostScheduleLabel","getPostScheduleLabel","dateAttribute","timezoneAbbreviation","getTimezoneAbbreviation","formattedDate","now","Date","isTimezoneSameAsSiteTimezone","isSameDay","tomorrow","setDate","getDate","getFullYear","timezone","abbr","isNaN","Number","symbol","offset","siteOffset","dateOffset","getTimezoneOffset","left","right","getMonth"],"mappings":";;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAVA;AACA;AACA;;AAKA;AACA;AACA;AAGe,SAASA,iBAAT,CAA4BC,KAA5B,EAAoC;AAClD,SAAOC,oBAAoB,CAAED,KAAF,CAA3B;AACA;;AAEM,SAASC,oBAAT,GAAuD;AAAA,MAAxB;AAAEC,IAAAA,IAAI,GAAG;AAAT,GAAwB,uEAAL,EAAK;AAC7D,QAAM;AAAEC,IAAAA,IAAF;AAAQC,IAAAA;AAAR,MAAuB,qBAC1BC,MAAF,KAAgB;AACfF,IAAAA,IAAI,EAAEE,MAAM,CAAEC,YAAF,CAAN,CAAsBC,sBAAtB,CAA8C,MAA9C,CADS;AAEfH,IAAAA,UAAU,EAAEC,MAAM,CAAEC,YAAF,CAAN,CAAsBE,wBAAtB;AAFG,GAAhB,CAD4B,EAK5B,EAL4B,CAA7B;AAQA,SAAON,IAAI,GACRO,wBAAwB,CAAEN,IAAF,CADhB,GAERO,oBAAoB,CAAEP,IAAF,EAAQ;AAAEC,IAAAA;AAAF,GAAR,C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} from '@wordpress/i18n';\nimport { __experimentalGetSettings, getDate, dateI18n } from '@wordpress/date';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function PostScheduleLabel( props ) {\n\treturn usePostScheduleLabel( props );\n}\n\nexport function usePostScheduleLabel( { full = false } = {} ) {\n\tconst { date, isFloating } = useSelect(\n\t\t( select ) => ( {\n\t\t\tdate: select( editorStore ).getEditedPostAttribute( 'date' ),\n\t\t\tisFloating: select( editorStore ).isEditedPostDateFloating(),\n\t\t} ),\n\t\t[]\n\t);\n\n\treturn full\n\t\t? getFullPostScheduleLabel( date )\n\t\t: getPostScheduleLabel( date, { isFloating } );\n}\n\nexport function getFullPostScheduleLabel( dateAttribute ) {\n\tconst date = getDate( dateAttribute );\n\n\tconst timezoneAbbreviation = getTimezoneAbbreviation();\n\tconst formattedDate = dateI18n(\n\t\t// translators: If using a space between 'g:i' and 'a', use a non-breaking sapce.\n\t\t_x( 'F j, Y g:i\\xa0a', 'post schedule full date format' ),\n\t\tdate\n\t);\n\treturn isRTL()\n\t\t? `${ timezoneAbbreviation } ${ formattedDate }`\n\t\t: `${ formattedDate } ${ timezoneAbbreviation }`;\n}\n\nexport function getPostScheduleLabel(\n\tdateAttribute,\n\t{ isFloating = false, now = new Date() } = {}\n) {\n\tif ( ! dateAttribute || isFloating ) {\n\t\treturn __( 'Immediately' );\n\t}\n\n\t// If the user timezone does not equal the site timezone then using words\n\t// like 'tomorrow' is confusing, so show the full date.\n\tif ( ! isTimezoneSameAsSiteTimezone( now ) ) {\n\t\treturn getFullPostScheduleLabel( dateAttribute );\n\t}\n\n\tconst date = getDate( dateAttribute );\n\n\tif ( isSameDay( date, now ) ) {\n\t\treturn sprintf(\n\t\t\t// translators: %s: Time of day the post is scheduled for.\n\t\t\t__( 'Today at %s' ),\n\t\t\t// translators: If using a space between 'g:i' and 'a', use a non-breaking sapce.\n\t\t\tdateI18n( _x( 'g:i\\xa0a', 'post schedule time format' ), date )\n\t\t);\n\t}\n\n\tconst tomorrow = new Date( now );\n\ttomorrow.setDate( tomorrow.getDate() + 1 );\n\n\tif ( isSameDay( date, tomorrow ) ) {\n\t\treturn sprintf(\n\t\t\t// translators: %s: Time of day the post is scheduled for.\n\t\t\t__( 'Tomorrow at %s' ),\n\t\t\t// translators: If using a space between 'g:i' and 'a', use a non-breaking sapce.\n\t\t\tdateI18n( _x( 'g:i\\xa0a', 'post schedule time format' ), date )\n\t\t);\n\t}\n\n\tif ( date.getFullYear() === now.getFullYear() ) {\n\t\treturn dateI18n(\n\t\t\t// translators: If using a space between 'g:i' and 'a', use a non-breaking sapce.\n\t\t\t_x( 'F j g:i\\xa0a', 'post schedule date format without year' ),\n\t\t\tdate\n\t\t);\n\t}\n\n\treturn dateI18n(\n\t\t// translators: Use a non-breaking space between 'g:i' and 'a' if appropriate.\n\t\t_x( 'F j, Y g:i\\xa0a', 'post schedule full date format' ),\n\t\tdate\n\t);\n}\n\nfunction getTimezoneAbbreviation() {\n\tconst { timezone } = __experimentalGetSettings();\n\n\tif ( timezone.abbr && isNaN( Number( timezone.abbr ) ) ) {\n\t\treturn timezone.abbr;\n\t}\n\n\tconst symbol = timezone.offset < 0 ? '' : '+';\n\treturn `UTC${ symbol }${ timezone.offset }`;\n}\n\nfunction isTimezoneSameAsSiteTimezone( date ) {\n\tconst { timezone } = __experimentalGetSettings();\n\n\tconst siteOffset = Number( timezone.offset );\n\tconst dateOffset = -1 * ( date.getTimezoneOffset() / 60 );\n\treturn siteOffset === dateOffset;\n}\n\nfunction isSameDay( left, right ) {\n\treturn (\n\t\tleft.getDate() === right.getDate() &&\n\t\tleft.getMonth() === right.getMonth() &&\n\t\tleft.getFullYear() === right.getFullYear()\n\t);\n}\n"]}
@@ -17,6 +17,8 @@ var _compose = require("@wordpress/compose");
17
17
 
18
18
  var _url = require("@wordpress/url");
19
19
 
20
+ var _components = require("@wordpress/components");
21
+
20
22
  var _check = _interopRequireDefault(require("./check"));
21
23
 
22
24
  var _store = require("../../store");
@@ -60,26 +62,19 @@ class PostSlug extends _element.Component {
60
62
  }
61
63
 
62
64
  render() {
63
- const {
64
- instanceId
65
- } = this.props;
66
65
  const {
67
66
  editedSlug
68
67
  } = this.state;
69
- const inputId = 'editor-post-slug-' + instanceId;
70
- return (0, _element.createElement)(_check.default, null, (0, _element.createElement)("label", {
71
- htmlFor: inputId
72
- }, (0, _i18n.__)('Slug')), (0, _element.createElement)("input", {
68
+ return (0, _element.createElement)(_check.default, null, (0, _element.createElement)(_components.TextControl, {
69
+ label: (0, _i18n.__)('Slug'),
73
70
  autoComplete: "off",
74
71
  spellCheck: "false",
75
- type: "text",
76
- id: inputId,
77
72
  value: editedSlug,
78
- onChange: event => this.setState({
79
- editedSlug: event.target.value
73
+ onChange: slug => this.setState({
74
+ editedSlug: slug
80
75
  }),
81
76
  onBlur: this.setSlug,
82
- className: "editor-post-slug__input"
77
+ className: "editor-post-slug"
83
78
  }));
84
79
  }
85
80
 
@@ -112,7 +107,7 @@ var _default = (0, _compose.compose)([(0, _data.withSelect)(select => {
112
107
  }
113
108
 
114
109
  };
115
- }), _compose.withInstanceId])(PostSlug);
110
+ })])(PostSlug);
116
111
 
117
112
  exports.default = _default;
118
113
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-slug/index.js"],"names":["PostSlug","Component","constructor","postSlug","postTitle","postID","arguments","state","editedSlug","setSlug","bind","event","onUpdateSlug","props","value","target","render","instanceId","inputId","setState","select","getCurrentPost","getEditedPostAttribute","editorStore","id","dispatch","editPost","slug","withInstanceId"],"mappings":";;;;;;;;;AAIA;;AADA;;AAEA;;AACA;;AACA;;AAKA;;AACA;;AAbA;AACA;AACA;;AAOA;AACA;AACA;AAIO,MAAMA,QAAN,SAAuBC,kBAAvB,CAAiC;AACvCC,EAAAA,WAAW,OAAoC;AAAA,QAAlC;AAAEC,MAAAA,QAAF;AAAYC,MAAAA,SAAZ;AAAuB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B,sBAAcW,MAAF,IAAc;AACzB,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,MAA6CF,MAAM,CACxDG,YADwD,CAAzD;AAIA,QAAM;AAAEC,IAAAA;AAAF,MAASH,cAAc,EAA7B;AACA,SAAO;AACNlB,IAAAA,QAAQ,EAAEmB,sBAAsB,CAAE,MAAF,CAD1B;AAENlB,IAAAA,SAAS,EAAEkB,sBAAsB,CAAE,OAAF,CAF3B;AAGNjB,IAAAA,MAAM,EAAEmB;AAHF,GAAP;AAKA,CAXD,CADuB,EAavB,wBAAgBC,QAAF,IAAgB;AAC7B,QAAM;AAAEC,IAAAA;AAAF,MAAeD,QAAQ,CAAEF,YAAF,CAA7B;AACA,SAAO;AACNX,IAAAA,YAAY,CAAEe,IAAF,EAAS;AACpBD,MAAAA,QAAQ,CAAE;AAAEC,QAAAA;AAAF,OAAF,CAAR;AACA;;AAHK,GAAP;AAKA,CAPD,CAbuB,EAqBvBC,uBArBuB,CAAT,EAsBV5B,QAtBU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { withInstanceId, compose } from '@wordpress/compose';\nimport { safeDecodeURIComponent, cleanForSlug } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport PostSlugCheck from './check';\nimport { store as editorStore } from '../../store';\n\nexport class PostSlug extends Component {\n\tconstructor( { postSlug, postTitle, postID } ) {\n\t\tsuper( ...arguments );\n\n\t\tthis.state = {\n\t\t\teditedSlug:\n\t\t\t\tsafeDecodeURIComponent( postSlug ) ||\n\t\t\t\tcleanForSlug( postTitle ) ||\n\t\t\t\tpostID,\n\t\t};\n\n\t\tthis.setSlug = this.setSlug.bind( this );\n\t}\n\n\tsetSlug( event ) {\n\t\tconst { postSlug, onUpdateSlug } = this.props;\n\t\tconst { value } = event.target;\n\n\t\tconst editedSlug = cleanForSlug( value );\n\n\t\tif ( editedSlug === postSlug ) {\n\t\t\treturn;\n\t\t}\n\n\t\tonUpdateSlug( editedSlug );\n\t}\n\n\trender() {\n\t\tconst { instanceId } = this.props;\n\t\tconst { editedSlug } = this.state;\n\n\t\tconst inputId = 'editor-post-slug-' + instanceId;\n\n\t\treturn (\n\t\t\t<PostSlugCheck>\n\t\t\t\t<label htmlFor={ inputId }>{ __( 'Slug' ) }</label>\n\t\t\t\t<input\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\tspellCheck=\"false\"\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\tid={ inputId }\n\t\t\t\t\tvalue={ editedSlug }\n\t\t\t\t\tonChange={ ( event ) =>\n\t\t\t\t\t\tthis.setState( { editedSlug: event.target.value } )\n\t\t\t\t\t}\n\t\t\t\t\tonBlur={ this.setSlug }\n\t\t\t\t\tclassName=\"editor-post-slug__input\"\n\t\t\t\t/>\n\t\t\t</PostSlugCheck>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getCurrentPost, getEditedPostAttribute } = select(\n\t\t\teditorStore\n\t\t);\n\n\t\tconst { id } = getCurrentPost();\n\t\treturn {\n\t\t\tpostSlug: getEditedPostAttribute( 'slug' ),\n\t\t\tpostTitle: getEditedPostAttribute( 'title' ),\n\t\t\tpostID: id,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonUpdateSlug( slug ) {\n\t\t\t\teditPost( { slug } );\n\t\t\t},\n\t\t};\n\t} ),\n\twithInstanceId,\n] )( PostSlug );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-slug/index.js"],"names":["PostSlug","Component","constructor","postSlug","postTitle","postID","arguments","state","editedSlug","setSlug","bind","event","onUpdateSlug","props","value","target","render","slug","setState","select","getCurrentPost","getEditedPostAttribute","editorStore","id","dispatch","editPost"],"mappings":";;;;;;;;;AAIA;;AADA;;AAEA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cU,MAAF,IAAc;AACzB,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,MACLF,MAAM,CAAEG,YAAF,CADP;AAGA,QAAM;AAAEC,IAAAA;AAAF,MAASH,cAAc,EAA7B;AACA,SAAO;AACNjB,IAAAA,QAAQ,EAAEkB,sBAAsB,CAAE,MAAF,CAD1B;AAENjB,IAAAA,SAAS,EAAEiB,sBAAsB,CAAE,OAAF,CAF3B;AAGNhB,IAAAA,MAAM,EAAEkB;AAHF,GAAP;AAKA,CAVD,CADuB,EAYvB,wBAAgBC,QAAF,IAAgB;AAC7B,QAAM;AAAEC,IAAAA;AAAF,MAAeD,QAAQ,CAAEF,YAAF,CAA7B;AACA,SAAO;AACNV,IAAAA,YAAY,CAAEK,IAAF,EAAS;AACpBQ,MAAAA,QAAQ,CAAE;AAAER,QAAAA;AAAF,OAAF,CAAR;AACA;;AAHK,GAAP;AAKA,CAPD,CAZuB,CAAT,EAoBVjB,QApBU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { compose } from '@wordpress/compose';\nimport { safeDecodeURIComponent, cleanForSlug } from '@wordpress/url';\nimport { TextControl } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport PostSlugCheck from './check';\nimport { store as editorStore } from '../../store';\n\nexport class PostSlug extends Component {\n\tconstructor( { postSlug, postTitle, postID } ) {\n\t\tsuper( ...arguments );\n\n\t\tthis.state = {\n\t\t\teditedSlug:\n\t\t\t\tsafeDecodeURIComponent( postSlug ) ||\n\t\t\t\tcleanForSlug( postTitle ) ||\n\t\t\t\tpostID,\n\t\t};\n\n\t\tthis.setSlug = this.setSlug.bind( this );\n\t}\n\n\tsetSlug( event ) {\n\t\tconst { postSlug, onUpdateSlug } = this.props;\n\t\tconst { value } = event.target;\n\n\t\tconst editedSlug = cleanForSlug( value );\n\n\t\tif ( editedSlug === postSlug ) {\n\t\t\treturn;\n\t\t}\n\n\t\tonUpdateSlug( editedSlug );\n\t}\n\n\trender() {\n\t\tconst { editedSlug } = this.state;\n\t\treturn (\n\t\t\t<PostSlugCheck>\n\t\t\t\t<TextControl\n\t\t\t\t\tlabel={ __( 'Slug' ) }\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\tspellCheck=\"false\"\n\t\t\t\t\tvalue={ editedSlug }\n\t\t\t\t\tonChange={ ( slug ) =>\n\t\t\t\t\t\tthis.setState( { editedSlug: slug } )\n\t\t\t\t\t}\n\t\t\t\t\tonBlur={ this.setSlug }\n\t\t\t\t\tclassName=\"editor-post-slug\"\n\t\t\t\t/>\n\t\t\t</PostSlugCheck>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getCurrentPost, getEditedPostAttribute } =\n\t\t\tselect( editorStore );\n\n\t\tconst { id } = getCurrentPost();\n\t\treturn {\n\t\t\tpostSlug: getEditedPostAttribute( 'slug' ),\n\t\t\tpostTitle: getEditedPostAttribute( 'title' ),\n\t\t\tpostID: id,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonUpdateSlug( slug ) {\n\t\t\t\teditPost( { slug } );\n\t\t\t},\n\t\t};\n\t} ),\n] )( PostSlug );\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-sticky/index.js"],"names":["PostSticky","onUpdateSticky","postSticky","select","editorStore","getEditedPostAttribute","dispatch","editPost","sticky"],"mappings":";;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAZA;AACA;AACA;;AAMA;AACA;AACA;AAIO,SAASA,UAAT,OAA8D;AAAA,MAAzC;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,UAAU,GAAG;AAA/B,GAAyC;AACpE,SACC,4BAAC,cAAD,QACC,4BAAC,2BAAD;AACC,IAAA,KAAK,EAAG,cAAI,8BAAJ,CADT;AAEC,IAAA,OAAO,EAAGA,UAFX;AAGC,IAAA,QAAQ,EAAG,MAAMD,cAAc,CAAE,CAAEC,UAAJ;AAHhC,IADD,CADD;AASA;;eAEc,sBAAS,CACvB,sBAAcC,MAAF,IAAc;AACzB,SAAO;AACND,IAAAA,UAAU,EAAEC,MAAM,CAAEC,YAAF,CAAN,CAAsBC,sBAAtB,CACX,QADW;AADN,GAAP;AAKA,CAND,CADuB,EAQvB,wBAAgBC,QAAF,IAAgB;AAC7B,SAAO;AACNL,IAAAA,cAAc,CAAEC,UAAF,EAAe;AAC5BI,MAAAA,QAAQ,CAAEF,YAAF,CAAR,CAAwBG,QAAxB,CAAkC;AAAEC,QAAAA,MAAM,EAAEN;AAAV,OAAlC;AACA;;AAHK,GAAP;AAKA,CAND,CARuB,CAAT,EAeVF,UAfU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { CheckboxControl } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport PostStickyCheck from './check';\nimport { store as editorStore } from '../../store';\n\nexport function PostSticky( { onUpdateSticky, postSticky = false } ) {\n\treturn (\n\t\t<PostStickyCheck>\n\t\t\t<CheckboxControl\n\t\t\t\tlabel={ __( 'Stick to the top of the blog' ) }\n\t\t\t\tchecked={ postSticky }\n\t\t\t\tonChange={ () => onUpdateSticky( ! postSticky ) }\n\t\t\t/>\n\t\t</PostStickyCheck>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostSticky: select( editorStore ).getEditedPostAttribute(\n\t\t\t\t'sticky'\n\t\t\t),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\treturn {\n\t\t\tonUpdateSticky( postSticky ) {\n\t\t\t\tdispatch( editorStore ).editPost( { sticky: postSticky } );\n\t\t\t},\n\t\t};\n\t} ),\n] )( PostSticky );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-sticky/index.js"],"names":["PostSticky","onUpdateSticky","postSticky","select","editorStore","getEditedPostAttribute","dispatch","editPost","sticky"],"mappings":";;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAZA;AACA;AACA;;AAMA;AACA;AACA;AAIO,SAASA,UAAT,OAA8D;AAAA,MAAzC;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,UAAU,GAAG;AAA/B,GAAyC;AACpE,SACC,4BAAC,cAAD,QACC,4BAAC,2BAAD;AACC,IAAA,KAAK,EAAG,cAAI,8BAAJ,CADT;AAEC,IAAA,OAAO,EAAGA,UAFX;AAGC,IAAA,QAAQ,EAAG,MAAMD,cAAc,CAAE,CAAEC,UAAJ;AAHhC,IADD,CADD;AASA;;eAEc,sBAAS,CACvB,sBAAcC,MAAF,IAAc;AACzB,SAAO;AACND,IAAAA,UAAU,EACTC,MAAM,CAAEC,YAAF,CAAN,CAAsBC,sBAAtB,CAA8C,QAA9C;AAFK,GAAP;AAIA,CALD,CADuB,EAOvB,wBAAgBC,QAAF,IAAgB;AAC7B,SAAO;AACNL,IAAAA,cAAc,CAAEC,UAAF,EAAe;AAC5BI,MAAAA,QAAQ,CAAEF,YAAF,CAAR,CAAwBG,QAAxB,CAAkC;AAAEC,QAAAA,MAAM,EAAEN;AAAV,OAAlC;AACA;;AAHK,GAAP;AAKA,CAND,CAPuB,CAAT,EAcVF,UAdU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { CheckboxControl } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport PostStickyCheck from './check';\nimport { store as editorStore } from '../../store';\n\nexport function PostSticky( { onUpdateSticky, postSticky = false } ) {\n\treturn (\n\t\t<PostStickyCheck>\n\t\t\t<CheckboxControl\n\t\t\t\tlabel={ __( 'Stick to the top of the blog' ) }\n\t\t\t\tchecked={ postSticky }\n\t\t\t\tonChange={ () => onUpdateSticky( ! postSticky ) }\n\t\t\t/>\n\t\t</PostStickyCheck>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostSticky:\n\t\t\t\tselect( editorStore ).getEditedPostAttribute( 'sticky' ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\treturn {\n\t\t\tonUpdateSticky( postSticky ) {\n\t\t\t\tdispatch( editorStore ).editPost( { sticky: postSticky } );\n\t\t\t},\n\t\t};\n\t} ),\n] )( PostSticky );\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-switch-to-draft-button/index.js"],"names":["PostSwitchToDraftButton","isSaving","isPublished","isScheduled","onClick","isMobileViewport","showConfirmDialog","setShowConfirmDialog","alertMessage","handleConfirm","select","isSavingPost","isCurrentPostPublished","isCurrentPostScheduled","editorStore","dispatch","editPost","savePost","status"],"mappings":";;;;;;;AAUA;;AAPA;;AAIA;;AACA;;AACA;;AAMA;;AAfA;AACA;AACA;;AAUA;AACA;AACA;AAGA,SAASA,uBAAT,OAKI;AAAA,MAL8B;AACjCC,IAAAA,QADiC;AAEjCC,IAAAA,WAFiC;AAGjCC,IAAAA,WAHiC;AAIjCC,IAAAA;AAJiC,GAK9B;AACH,QAAMC,gBAAgB,GAAG,+BAAkB,OAAlB,EAA2B,GAA3B,CAAzB;AACA,QAAM,CAAEC,iBAAF,EAAqBC,oBAArB,IAA8C,uBAAU,KAAV,CAApD;;AAEA,MAAK,CAAEL,WAAF,IAAiB,CAAEC,WAAxB,EAAsC;AACrC,WAAO,IAAP;AACA;;AAED,MAAIK,YAAJ;;AACA,MAAKN,WAAL,EAAmB;AAClBM,IAAAA,YAAY,GAAG,cAAI,+CAAJ,CAAf;AACA,GAFD,MAEO,IAAKL,WAAL,EAAmB;AACzBK,IAAAA,YAAY,GAAG,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\n\tButton,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose, useViewportMatch } from '@wordpress/compose';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction PostSwitchToDraftButton( {\n\tisSaving,\n\tisPublished,\n\tisScheduled,\n\tonClick,\n} ) {\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst [ showConfirmDialog, setShowConfirmDialog ] = useState( false );\n\n\tif ( ! isPublished && ! isScheduled ) {\n\t\treturn null;\n\t}\n\n\tlet alertMessage;\n\tif ( isPublished ) {\n\t\talertMessage = __( 'Are you sure you want to unpublish this post?' );\n\t} else if ( isScheduled ) {\n\t\talertMessage = __( 'Are you sure you want to unschedule this post?' );\n\t}\n\n\tconst handleConfirm = () => {\n\t\tsetShowConfirmDialog( false );\n\t\tonClick();\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tclassName=\"editor-post-switch-to-draft\"\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetShowConfirmDialog( true );\n\t\t\t\t} }\n\t\t\t\tdisabled={ isSaving }\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t>\n\t\t\t\t{ isMobileViewport ? __( 'Draft' ) : __( 'Switch to draft' ) }\n\t\t\t</Button>\n\t\t\t<ConfirmDialog\n\t\t\t\tisOpen={ showConfirmDialog }\n\t\t\t\tonConfirm={ handleConfirm }\n\t\t\t\tonCancel={ () => setShowConfirmDialog( false ) }\n\t\t\t>\n\t\t\t\t{ alertMessage }\n\t\t\t</ConfirmDialog>\n\t\t</>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\tisSavingPost,\n\t\t\tisCurrentPostPublished,\n\t\t\tisCurrentPostScheduled,\n\t\t} = select( editorStore );\n\t\treturn {\n\t\t\tisSaving: isSavingPost(),\n\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\tisScheduled: isCurrentPostScheduled(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost, savePost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonClick: () => {\n\t\t\t\teditPost( { status: 'draft' } );\n\t\t\t\tsavePost();\n\t\t\t},\n\t\t};\n\t} ),\n] )( PostSwitchToDraftButton );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-switch-to-draft-button/index.js"],"names":["PostSwitchToDraftButton","isSaving","isPublished","isScheduled","onClick","isMobileViewport","showConfirmDialog","setShowConfirmDialog","alertMessage","handleConfirm","select","isSavingPost","isCurrentPostPublished","isCurrentPostScheduled","editorStore","dispatch","editPost","savePost","status"],"mappings":";;;;;;;AAUA;;AAPA;;AAIA;;AACA;;AACA;;AAMA;;AAfA;AACA;AACA;;AAUA;AACA;AACA;AAGA,SAASA,uBAAT,OAKI;AAAA,MAL8B;AACjCC,IAAAA,QADiC;AAEjCC,IAAAA,WAFiC;AAGjCC,IAAAA,WAHiC;AAIjCC,IAAAA;AAJiC,GAK9B;AACH,QAAMC,gBAAgB,GAAG,+BAAkB,OAAlB,EAA2B,GAA3B,CAAzB;AACA,QAAM,CAAEC,iBAAF,EAAqBC,oBAArB,IAA8C,uBAAU,KAAV,CAApD;;AAEA,MAAK,CAAEL,WAAF,IAAiB,CAAEC,WAAxB,EAAsC;AACrC,WAAO,IAAP;AACA;;AAED,MAAIK,YAAJ;;AACA,MAAKN,WAAL,EAAmB;AAClBM,IAAAA,YAAY,GAAG,cAAI,+CAAJ,CAAf;AACA,GAFD,MAEO,IAAKL,WAAL,EAAmB;AACzBK,IAAAA,YAAY,GAAG,cAAI,gDAAJ,CAAf;AACA;;AAED,QAAMC,aAAa,GAAG,MAAM;AAC3BF,IAAAA,oBAAoB,CAAE,KAAF,CAApB;AACAH,IAAAA,OAAO;AACP,GAHD;;AAKA,SACC,qDACC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,6BADX;AAEC,IAAA,OAAO,EAAG,MAAM;AACfG,MAAAA,oBAAoB,CAAE,IAAF,CAApB;AACA,KAJF;AAKC,IAAA,QAAQ,EAAGN,QALZ;AAMC,IAAA,OAAO,EAAC;AANT,KAQGI,gBAAgB,GAAG,cAAI,OAAJ,CAAH,GAAmB,cAAI,iBAAJ,CARtC,CADD,EAWC,4BAAC,uCAAD;AACC,IAAA,MAAM,EAAGC,iBADV;AAEC,IAAA,SAAS,EAAGG,aAFb;AAGC,IAAA,QAAQ,EAAG,MAAMF,oBAAoB,CAAE,KAAF;AAHtC,KAKGC,YALH,CAXD,CADD;AAqBA;;eAEc,sBAAS,CACvB,sBAAcE,MAAF,IAAc;AACzB,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA,sBAAhB;AAAwCC,IAAAA;AAAxC,MACLH,MAAM,CAAEI,YAAF,CADP;AAEA,SAAO;AACNb,IAAAA,QAAQ,EAAEU,YAAY,EADhB;AAENT,IAAAA,WAAW,EAAEU,sBAAsB,EAF7B;AAGNT,IAAAA,WAAW,EAAEU,sBAAsB;AAH7B,GAAP;AAKA,CARD,CADuB,EAUvB,wBAAgBE,QAAF,IAAgB;AAC7B,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAyBF,QAAQ,CAAED,YAAF,CAAvC;AACA,SAAO;AACNV,IAAAA,OAAO,EAAE,MAAM;AACdY,MAAAA,QAAQ,CAAE;AAAEE,QAAAA,MAAM,EAAE;AAAV,OAAF,CAAR;AACAD,MAAAA,QAAQ;AACR;AAJK,GAAP;AAMA,CARD,CAVuB,CAAT,EAmBVjB,uBAnBU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose, useViewportMatch } from '@wordpress/compose';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction PostSwitchToDraftButton( {\n\tisSaving,\n\tisPublished,\n\tisScheduled,\n\tonClick,\n} ) {\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst [ showConfirmDialog, setShowConfirmDialog ] = useState( false );\n\n\tif ( ! isPublished && ! isScheduled ) {\n\t\treturn null;\n\t}\n\n\tlet alertMessage;\n\tif ( isPublished ) {\n\t\talertMessage = __( 'Are you sure you want to unpublish this post?' );\n\t} else if ( isScheduled ) {\n\t\talertMessage = __( 'Are you sure you want to unschedule this post?' );\n\t}\n\n\tconst handleConfirm = () => {\n\t\tsetShowConfirmDialog( false );\n\t\tonClick();\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tclassName=\"editor-post-switch-to-draft\"\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetShowConfirmDialog( true );\n\t\t\t\t} }\n\t\t\t\tdisabled={ isSaving }\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t>\n\t\t\t\t{ isMobileViewport ? __( 'Draft' ) : __( 'Switch to draft' ) }\n\t\t\t</Button>\n\t\t\t<ConfirmDialog\n\t\t\t\tisOpen={ showConfirmDialog }\n\t\t\t\tonConfirm={ handleConfirm }\n\t\t\t\tonCancel={ () => setShowConfirmDialog( false ) }\n\t\t\t>\n\t\t\t\t{ alertMessage }\n\t\t\t</ConfirmDialog>\n\t\t</>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { isSavingPost, isCurrentPostPublished, isCurrentPostScheduled } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tisSaving: isSavingPost(),\n\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\tisScheduled: isCurrentPostScheduled(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost, savePost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonClick: () => {\n\t\t\t\teditPost( { status: 'draft' } );\n\t\t\t\tsavePost();\n\t\t\t},\n\t\t};\n\t} ),\n] )( PostSwitchToDraftButton );\n"]}
@@ -5,6 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
+ exports.FlatTermSelector = FlatTermSelector;
8
9
  exports.default = void 0;
9
10
 
10
11
  var _element = require("@wordpress/element");
@@ -72,10 +73,10 @@ const termNamesToIds = (names, terms) => {
72
73
  }; // Tries to create a term or fetch it if it already exists.
73
74
 
74
75
 
75
- function findOrCreateTerm(termName, restBase) {
76
+ function findOrCreateTerm(termName, restBase, namespace) {
76
77
  const escapedTermName = (0, _lodash.escape)(termName);
77
78
  return (0, _apiFetch.default)({
78
- path: `/wp/v2/${restBase}`,
79
+ path: `/${namespace}/${restBase}`,
79
80
  method: 'POST',
80
81
  data: {
81
82
  name: escapedTermName
@@ -86,7 +87,7 @@ function findOrCreateTerm(termName, restBase) {
86
87
  if (errorCode === 'term_exists') {
87
88
  // If the terms exist, fetch it instead of creating a new one.
88
89
  const addRequest = (0, _apiFetch.default)({
89
- path: (0, _url.addQueryArgs)(`/wp/v2/${restBase}`, { ...DEFAULT_QUERY,
90
+ path: (0, _url.addQueryArgs)(`/${namespace}/${restBase}`, { ...DEFAULT_QUERY,
90
91
  search: escapedTermName
91
92
  })
92
93
  }).then(_terms.unescapeTerms);
@@ -181,6 +182,8 @@ function FlatTermSelector(_ref) {
181
182
  }
182
183
 
183
184
  function onChange(termNames) {
185
+ var _taxonomy$rest_namesp;
186
+
184
187
  const availableTerms = [...(terms !== null && terms !== void 0 ? terms : []), ...(searchResults !== null && searchResults !== void 0 ? searchResults : [])];
185
188
  const uniqueTerms = (0, _lodash.uniqBy)(termNames, term => term.toLowerCase());
186
189
  const newTermNames = uniqueTerms.filter(termName => !(0, _lodash.find)(availableTerms, term => isSameTermName(term.name, termName))); // Optimistically update term values.
@@ -196,7 +199,8 @@ function FlatTermSelector(_ref) {
196
199
  return;
197
200
  }
198
201
 
199
- Promise.all(newTermNames.map(termName => findOrCreateTerm(termName, taxonomy.rest_base))).then(newTerms => {
202
+ const namespace = (_taxonomy$rest_namesp = taxonomy === null || taxonomy === void 0 ? void 0 : taxonomy.rest_namespace) !== null && _taxonomy$rest_namesp !== void 0 ? _taxonomy$rest_namesp : 'wp/v2';
203
+ Promise.all(newTermNames.map(termName => findOrCreateTerm(termName, taxonomy.rest_base, namespace))).then(newTerms => {
200
204
  const newAvailableTerms = availableTerms.concat(newTerms);
201
205
  return onUpdateTerms(termNamesToIds(uniqueTerms, newAvailableTerms));
202
206
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-taxonomies/flat-term-selector.js"],"names":["EMPTY_ARRAY","MAX_TERMS_SUGGESTIONS","DEFAULT_QUERY","per_page","orderby","order","_fields","context","isSameTermName","termA","termB","toLowerCase","termNamesToIds","names","terms","map","termName","term","name","id","findOrCreateTerm","restBase","escapedTermName","path","method","data","catch","error","errorCode","code","addRequest","search","then","unescapeTerms","searchResult","result","Promise","reject","unescapeTerm","FlatTermSelector","slug","values","setValues","setSearch","debouncedSearch","termIds","taxonomy","hasAssignAction","hasCreateAction","hasResolvedTerms","select","getCurrentPost","getEditedPostAttribute","editorStore","getEntityRecords","getTaxonomy","hasFinishedResolution","coreStore","post","_taxonomy","_termIds","rest_base","query","include","join","length","searchResults","newValues","suggestions","editPost","onUpdateTerms","newTermIds","onChange","termNames","availableTerms","uniqueTerms","newTermNames","filter","all","newTerms","newAvailableTerms","concat","appendTerm","newTerm","includes","termAddedMessage","newTermLabel","singularName","termAddedLabel","termRemovedLabel","removeTermLabel","added","removed","remove"],"mappings":";;;;;;;;;AASA;;AANA;;AAKA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAvBA;AACA;AACA;;AAGA;AACA;AACA;;AAWA;AACA;AACA;;AAKA;AAC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E,QAAF,EAAY,eAAZ,CAFoB,EAGpBN,IAAI,KAAK,UAAT,GAAsB,cAAI,KAAJ,CAAtB,GAAoC,cAAI,MAAJ,CAHhB,CAArB;AAKA,QAAMgD,cAAc,GAAG;AACtB;AACA,gBAAI,UAAJ,EAAgB,MAAhB,CAFsB,EAGtBD,YAHsB,CAAvB;AAKA,QAAME,gBAAgB,GAAG;AACxB;AACA,gBAAI,YAAJ,EAAkB,MAAlB,CAFwB,EAGxBF,YAHwB,CAAzB;AAKA,QAAMG,eAAe,GAAG;AACvB;AACA,gBAAI,WAAJ,EAAiB,MAAjB,CAFuB,EAGvBH,YAHuB,CAAxB;AAMA,SACC,qDACC,4BAAC,0BAAD;AACC,IAAA,KAAK,EAAG9C,MADT;AAEC,IAAA,WAAW,EAAG2B,WAFf;AAGC,IAAA,QAAQ,EAAGI,QAHZ;AAIC,IAAA,aAAa,EAAG5B,eAJjB;AAKC,IAAA,cAAc,EAAG3C,qBALlB;AAMC,IAAA,KAAK,EAAGqF,YANT;AAOC,IAAA,QAAQ,EAAG;AACVK,MAAAA,KAAK,EAAEH,cADG;AAEVI,MAAAA,OAAO,EAAEH,gBAFC;AAGVI,MAAAA,MAAM,EAAEH;AAHE;AAPZ,IADD,EAcC,4BAAC,sBAAD;AAAe,IAAA,QAAQ,EAAG5C,QAA1B;AAAqC,IAAA,QAAQ,EAAGoC;AAAhD,IAdD,CADD;AAkBA;;eAEc,6BAAa,yBAAb,EAA0C3C,gBAA1C,C","sourcesContent":["/**\n * External dependencies\n */\nimport { escape as escapeString, find, get, uniqBy } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useEffect, useMemo, useState } from '@wordpress/element';\nimport { FormTokenField, withFilters } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useDebounce } from '@wordpress/compose';\nimport apiFetch from '@wordpress/api-fetch';\nimport { addQueryArgs } from '@wordpress/url';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unescapeString, unescapeTerm, unescapeTerms } from '../../utils/terms';\nimport MostUsedTerms from './most-used-terms';\n\n/**\n * Shared reference to an empty array for cases where it is important to avoid\n * returning a new array reference on every invocation.\n *\n * @type {Array<any>}\n */\nconst EMPTY_ARRAY = [];\n\n/**\n * Module constants\n */\nconst MAX_TERMS_SUGGESTIONS = 20;\nconst DEFAULT_QUERY = {\n\tper_page: MAX_TERMS_SUGGESTIONS,\n\torderby: 'count',\n\torder: 'desc',\n\t_fields: 'id,name',\n\tcontext: 'view',\n};\n\nconst isSameTermName = ( termA, termB ) =>\n\tunescapeString( termA ).toLowerCase() ===\n\tunescapeString( termB ).toLowerCase();\n\nconst termNamesToIds = ( names, terms ) => {\n\treturn names.map(\n\t\t( termName ) =>\n\t\t\tfind( terms, ( term ) => isSameTermName( term.name, termName ) ).id\n\t);\n};\n\n// Tries to create a term or fetch it if it already exists.\nfunction findOrCreateTerm( termName, restBase ) {\n\tconst escapedTermName = escapeString( termName );\n\n\treturn apiFetch( {\n\t\tpath: `/wp/v2/${ restBase }`,\n\t\tmethod: 'POST',\n\t\tdata: { name: escapedTermName },\n\t} )\n\t\t.catch( ( error ) => {\n\t\t\tconst errorCode = error.code;\n\t\t\tif ( errorCode === 'term_exists' ) {\n\t\t\t\t// If the terms exist, fetch it instead of creating a new one.\n\t\t\t\tconst addRequest = apiFetch( {\n\t\t\t\t\tpath: addQueryArgs( `/wp/v2/${ restBase }`, {\n\t\t\t\t\t\t...DEFAULT_QUERY,\n\t\t\t\t\t\tsearch: escapedTermName,\n\t\t\t\t\t} ),\n\t\t\t\t} ).then( unescapeTerms );\n\n\t\t\t\treturn addRequest.then( ( searchResult ) => {\n\t\t\t\t\treturn find( searchResult, ( result ) =>\n\t\t\t\t\t\tisSameTermName( result.name, termName )\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\treturn Promise.reject( error );\n\t\t} )\n\t\t.then( unescapeTerm );\n}\n\nfunction FlatTermSelector( { slug } ) {\n\tconst [ values, setValues ] = useState( [] );\n\tconst [ search, setSearch ] = useState( '' );\n\tconst debouncedSearch = useDebounce( setSearch, 500 );\n\n\tconst {\n\t\tterms,\n\t\ttermIds,\n\t\ttaxonomy,\n\t\thasAssignAction,\n\t\thasCreateAction,\n\t\thasResolvedTerms,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentPost, getEditedPostAttribute } = select(\n\t\t\t\teditorStore\n\t\t\t);\n\t\t\tconst {\n\t\t\t\tgetEntityRecords,\n\t\t\t\tgetTaxonomy,\n\t\t\t\thasFinishedResolution,\n\t\t\t} = select( coreStore );\n\t\t\tconst post = getCurrentPost();\n\t\t\tconst _taxonomy = getTaxonomy( slug );\n\t\t\tconst _termIds = _taxonomy\n\t\t\t\t? getEditedPostAttribute( _taxonomy.rest_base )\n\t\t\t\t: EMPTY_ARRAY;\n\n\t\t\tconst query = {\n\t\t\t\t...DEFAULT_QUERY,\n\t\t\t\tinclude: _termIds.join( ',' ),\n\t\t\t\tper_page: -1,\n\t\t\t};\n\n\t\t\treturn {\n\t\t\t\thasCreateAction: _taxonomy\n\t\t\t\t\t? get(\n\t\t\t\t\t\t\tpost,\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t'_links',\n\t\t\t\t\t\t\t\t'wp:action-create-' + _taxonomy.rest_base,\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t )\n\t\t\t\t\t: false,\n\t\t\t\thasAssignAction: _taxonomy\n\t\t\t\t\t? get(\n\t\t\t\t\t\t\tpost,\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t'_links',\n\t\t\t\t\t\t\t\t'wp:action-assign-' + _taxonomy.rest_base,\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t )\n\t\t\t\t\t: false,\n\t\t\t\ttaxonomy: _taxonomy,\n\t\t\t\ttermIds: _termIds,\n\t\t\t\tterms: _termIds.length\n\t\t\t\t\t? getEntityRecords( 'taxonomy', slug, query )\n\t\t\t\t\t: EMPTY_ARRAY,\n\t\t\t\thasResolvedTerms: hasFinishedResolution( 'getEntityRecords', [\n\t\t\t\t\t'taxonomy',\n\t\t\t\t\tslug,\n\t\t\t\t\tquery,\n\t\t\t\t] ),\n\t\t\t};\n\t\t},\n\t\t[ slug ]\n\t);\n\n\tconst { searchResults } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\n\t\t\treturn {\n\t\t\t\tsearchResults: !! search\n\t\t\t\t\t? getEntityRecords( 'taxonomy', slug, {\n\t\t\t\t\t\t\t...DEFAULT_QUERY,\n\t\t\t\t\t\t\tsearch,\n\t\t\t\t\t } )\n\t\t\t\t\t: EMPTY_ARRAY,\n\t\t\t};\n\t\t},\n\t\t[ search ]\n\t);\n\n\t// Update terms state only after the selectors are resolved.\n\t// We're using this to avoid terms temporarily disappearing on slow networks\n\t// while core data makes REST API requests.\n\tuseEffect( () => {\n\t\tif ( hasResolvedTerms ) {\n\t\t\tconst newValues = ( terms ?? [] ).map( ( term ) =>\n\t\t\t\tunescapeString( term.name )\n\t\t\t);\n\n\t\t\tsetValues( newValues );\n\t\t}\n\t}, [ terms, hasResolvedTerms ] );\n\n\tconst suggestions = useMemo( () => {\n\t\treturn ( searchResults ?? [] ).map( ( term ) =>\n\t\t\tunescapeString( term.name )\n\t\t);\n\t}, [ searchResults ] );\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tif ( ! hasAssignAction ) {\n\t\treturn null;\n\t}\n\n\tfunction onUpdateTerms( newTermIds ) {\n\t\teditPost( { [ taxonomy.rest_base ]: newTermIds } );\n\t}\n\n\tfunction onChange( termNames ) {\n\t\tconst availableTerms = [\n\t\t\t...( terms ?? [] ),\n\t\t\t...( searchResults ?? [] ),\n\t\t];\n\t\tconst uniqueTerms = uniqBy( termNames, ( term ) => term.toLowerCase() );\n\t\tconst newTermNames = uniqueTerms.filter(\n\t\t\t( termName ) =>\n\t\t\t\t! find( availableTerms, ( term ) =>\n\t\t\t\t\tisSameTermName( term.name, termName )\n\t\t\t\t)\n\t\t);\n\n\t\t// Optimistically update term values.\n\t\t// The selector will always re-fetch terms later.\n\t\tsetValues( uniqueTerms );\n\n\t\tif ( newTermNames.length === 0 ) {\n\t\t\treturn onUpdateTerms(\n\t\t\t\ttermNamesToIds( uniqueTerms, availableTerms )\n\t\t\t);\n\t\t}\n\n\t\tif ( ! hasCreateAction ) {\n\t\t\treturn;\n\t\t}\n\n\t\tPromise.all(\n\t\t\tnewTermNames.map( ( termName ) =>\n\t\t\t\tfindOrCreateTerm( termName, taxonomy.rest_base )\n\t\t\t)\n\t\t).then( ( newTerms ) => {\n\t\t\tconst newAvailableTerms = availableTerms.concat( newTerms );\n\t\t\treturn onUpdateTerms(\n\t\t\t\ttermNamesToIds( uniqueTerms, newAvailableTerms )\n\t\t\t);\n\t\t} );\n\t}\n\n\tfunction appendTerm( newTerm ) {\n\t\tif ( termIds.includes( newTerm.id ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst newTermIds = [ ...termIds, newTerm.id ];\n\t\tconst termAddedMessage = sprintf(\n\t\t\t/* translators: %s: term name. */\n\t\t\t_x( '%s added', 'term' ),\n\t\t\tget(\n\t\t\t\ttaxonomy,\n\t\t\t\t[ 'labels', 'singular_name' ],\n\t\t\t\tslug === 'post_tag' ? __( 'Tag' ) : __( 'Term' )\n\t\t\t)\n\t\t);\n\n\t\tspeak( termAddedMessage, 'assertive' );\n\t\tonUpdateTerms( newTermIds );\n\t}\n\n\tconst newTermLabel = get(\n\t\ttaxonomy,\n\t\t[ 'labels', 'add_new_item' ],\n\t\tslug === 'post_tag' ? __( 'Add new tag' ) : __( 'Add new Term' )\n\t);\n\tconst singularName = get(\n\t\ttaxonomy,\n\t\t[ 'labels', 'singular_name' ],\n\t\tslug === 'post_tag' ? __( 'Tag' ) : __( 'Term' )\n\t);\n\tconst termAddedLabel = sprintf(\n\t\t/* translators: %s: term name. */\n\t\t_x( '%s added', 'term' ),\n\t\tsingularName\n\t);\n\tconst termRemovedLabel = sprintf(\n\t\t/* translators: %s: term name. */\n\t\t_x( '%s removed', 'term' ),\n\t\tsingularName\n\t);\n\tconst removeTermLabel = sprintf(\n\t\t/* translators: %s: term name. */\n\t\t_x( 'Remove %s', 'term' ),\n\t\tsingularName\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<FormTokenField\n\t\t\t\tvalue={ values }\n\t\t\t\tsuggestions={ suggestions }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tonInputChange={ debouncedSearch }\n\t\t\t\tmaxSuggestions={ MAX_TERMS_SUGGESTIONS }\n\t\t\t\tlabel={ newTermLabel }\n\t\t\t\tmessages={ {\n\t\t\t\t\tadded: termAddedLabel,\n\t\t\t\t\tremoved: termRemovedLabel,\n\t\t\t\t\tremove: removeTermLabel,\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<MostUsedTerms taxonomy={ taxonomy } onSelect={ appendTerm } />\n\t\t</>\n\t);\n}\n\nexport default withFilters( 'editor.PostTaxonomyType' )( FlatTermSelector );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-taxonomies/flat-term-selector.js"],"names":["EMPTY_ARRAY","MAX_TERMS_SUGGESTIONS","DEFAULT_QUERY","per_page","orderby","order","_fields","context","isSameTermName","termA","termB","toLowerCase","termNamesToIds","names","terms","map","termName","term","name","id","findOrCreateTerm","restBase","namespace","escapedTermName","path","method","data","catch","error","errorCode","code","addRequest","search","then","unescapeTerms","searchResult","result","Promise","reject","unescapeTerm","FlatTermSelector","slug","values","setValues","setSearch","debouncedSearch","termIds","taxonomy","hasAssignAction","hasCreateAction","hasResolvedTerms","select","getCurrentPost","getEditedPostAttribute","editorStore","getEntityRecords","getTaxonomy","hasFinishedResolution","coreStore","post","_taxonomy","_termIds","rest_base","query","include","join","length","searchResults","newValues","suggestions","editPost","onUpdateTerms","newTermIds","onChange","termNames","availableTerms","uniqueTerms","newTermNames","filter","rest_namespace","all","newTerms","newAvailableTerms","concat","appendTerm","newTerm","includes","termAddedMessage","newTermLabel","singularName","termAddedLabel","termRemovedLabel","removeTermLabel","added","removed","remove"],"mappings":";;;;;;;;;;AASA;;AANA;;AAKA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAvBA;AACA;AACA;;AAGA;AACA;AACA;;AAWA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,WAAW,GAAG,EAApB;AAEA;AACA;AACA;;AACA,MAAMC,qBAAqB,GAAG,EAA9B;AACA,MAAMC,aAAa,GAAG;AACrBC,EAAAA,QAAQ,EAAEF,qBADW;AAErBG,EAAAA,OAAO,EAAE,OAFY;AAGrBC,EAAAA,KAAK,EAAE,MAHc;AAIrBC,EAAAA,OAAO,EAAE,SAJY;AAKrBC,EAAAA,OAAO,EAAE;AALY,CAAtB;;AAQA,MAAMC,cAAc,GAAG,CAAEC,KAAF,EAASC,KAAT,KACtB,2BAAgBD,KAAhB,EAAwBE,WAAxB,OACA,2BAAgBD,KAAhB,EAAwBC,WAAxB,EAFD;;AAIA,MAAMC,cAAc,GAAG,CAAEC,KAAF,EAASC,KAAT,KAAoB;AAC1C,SAAOD,KAAK,CAACE,GAAN,CACJC,QAAF,IACC,kBAAMF,KAAN,EAAeG,IAAF,IAAYT,cAAc,CAAES,IAAI,CAACC,IAAP,EAAaF,QAAb,CAAvC,EAAiEG,EAF5D,CAAP;AAIA,CALD,C,CAOA;;;AACA,SAASC,gBAAT,CAA2BJ,QAA3B,EAAqCK,QAArC,EAA+CC,SAA/C,EAA2D;AAC1D,QAAMC,eAAe,GAAG,oBAAcP,QAAd,CAAxB;AAEA,SAAO,uBAAU;AAChBQ,IAAAA,IAAI,EAAG,IAAIF,SAAW,IAAID,QAAU,EADpB;AAEhBI,IA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C;AAGVI,MAAAA,MAAM,EAAEH;AAHE;AAPZ,IADD,EAcC,4BAAC,sBAAD;AAAe,IAAA,QAAQ,EAAG7C,QAA1B;AAAqC,IAAA,QAAQ,EAAGqC;AAAhD,IAdD,CADD;AAkBA;;eAEc,6BAAa,yBAAb,EAA0C5C,gBAA1C,C","sourcesContent":["/**\n * External dependencies\n */\nimport { escape as escapeString, find, get, uniqBy } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useEffect, useMemo, useState } from '@wordpress/element';\nimport { FormTokenField, withFilters } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useDebounce } from '@wordpress/compose';\nimport apiFetch from '@wordpress/api-fetch';\nimport { addQueryArgs } from '@wordpress/url';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unescapeString, unescapeTerm, unescapeTerms } from '../../utils/terms';\nimport MostUsedTerms from './most-used-terms';\n\n/**\n * Shared reference to an empty array for cases where it is important to avoid\n * returning a new array reference on every invocation.\n *\n * @type {Array<any>}\n */\nconst EMPTY_ARRAY = [];\n\n/**\n * Module constants\n */\nconst MAX_TERMS_SUGGESTIONS = 20;\nconst DEFAULT_QUERY = {\n\tper_page: MAX_TERMS_SUGGESTIONS,\n\torderby: 'count',\n\torder: 'desc',\n\t_fields: 'id,name',\n\tcontext: 'view',\n};\n\nconst isSameTermName = ( termA, termB ) =>\n\tunescapeString( termA ).toLowerCase() ===\n\tunescapeString( termB ).toLowerCase();\n\nconst termNamesToIds = ( names, terms ) => {\n\treturn names.map(\n\t\t( termName ) =>\n\t\t\tfind( terms, ( term ) => isSameTermName( term.name, termName ) ).id\n\t);\n};\n\n// Tries to create a term or fetch it if it already exists.\nfunction findOrCreateTerm( termName, restBase, namespace ) {\n\tconst escapedTermName = escapeString( termName );\n\n\treturn apiFetch( {\n\t\tpath: `/${ namespace }/${ restBase }`,\n\t\tmethod: 'POST',\n\t\tdata: { name: escapedTermName },\n\t} )\n\t\t.catch( ( error ) => {\n\t\t\tconst errorCode = error.code;\n\t\t\tif ( errorCode === 'term_exists' ) {\n\t\t\t\t// If the terms exist, fetch it instead of creating a new one.\n\t\t\t\tconst addRequest = apiFetch( {\n\t\t\t\t\tpath: addQueryArgs( `/${ namespace }/${ restBase }`, {\n\t\t\t\t\t\t...DEFAULT_QUERY,\n\t\t\t\t\t\tsearch: escapedTermName,\n\t\t\t\t\t} ),\n\t\t\t\t} ).then( unescapeTerms );\n\n\t\t\t\treturn addRequest.then( ( searchResult ) => {\n\t\t\t\t\treturn find( searchResult, ( result ) =>\n\t\t\t\t\t\tisSameTermName( result.name, termName )\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\treturn Promise.reject( error );\n\t\t} )\n\t\t.then( unescapeTerm );\n}\n\nexport function FlatTermSelector( { slug } ) {\n\tconst [ values, setValues ] = useState( [] );\n\tconst [ search, setSearch ] = useState( '' );\n\tconst debouncedSearch = useDebounce( setSearch, 500 );\n\n\tconst {\n\t\tterms,\n\t\ttermIds,\n\t\ttaxonomy,\n\t\thasAssignAction,\n\t\thasCreateAction,\n\t\thasResolvedTerms,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentPost, getEditedPostAttribute } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst { getEntityRecords, getTaxonomy, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst post = getCurrentPost();\n\t\t\tconst _taxonomy = getTaxonomy( slug );\n\t\t\tconst _termIds = _taxonomy\n\t\t\t\t? getEditedPostAttribute( _taxonomy.rest_base )\n\t\t\t\t: EMPTY_ARRAY;\n\n\t\t\tconst query = {\n\t\t\t\t...DEFAULT_QUERY,\n\t\t\t\tinclude: _termIds.join( ',' ),\n\t\t\t\tper_page: -1,\n\t\t\t};\n\n\t\t\treturn {\n\t\t\t\thasCreateAction: _taxonomy\n\t\t\t\t\t? get(\n\t\t\t\t\t\t\tpost,\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t'_links',\n\t\t\t\t\t\t\t\t'wp:action-create-' + _taxonomy.rest_base,\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t )\n\t\t\t\t\t: false,\n\t\t\t\thasAssignAction: _taxonomy\n\t\t\t\t\t? get(\n\t\t\t\t\t\t\tpost,\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t'_links',\n\t\t\t\t\t\t\t\t'wp:action-assign-' + _taxonomy.rest_base,\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t )\n\t\t\t\t\t: false,\n\t\t\t\ttaxonomy: _taxonomy,\n\t\t\t\ttermIds: _termIds,\n\t\t\t\tterms: _termIds.length\n\t\t\t\t\t? getEntityRecords( 'taxonomy', slug, query )\n\t\t\t\t\t: EMPTY_ARRAY,\n\t\t\t\thasResolvedTerms: hasFinishedResolution( 'getEntityRecords', [\n\t\t\t\t\t'taxonomy',\n\t\t\t\t\tslug,\n\t\t\t\t\tquery,\n\t\t\t\t] ),\n\t\t\t};\n\t\t},\n\t\t[ slug ]\n\t);\n\n\tconst { searchResults } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\n\t\t\treturn {\n\t\t\t\tsearchResults: !! search\n\t\t\t\t\t? getEntityRecords( 'taxonomy', slug, {\n\t\t\t\t\t\t\t...DEFAULT_QUERY,\n\t\t\t\t\t\t\tsearch,\n\t\t\t\t\t } )\n\t\t\t\t\t: EMPTY_ARRAY,\n\t\t\t};\n\t\t},\n\t\t[ search ]\n\t);\n\n\t// Update terms state only after the selectors are resolved.\n\t// We're using this to avoid terms temporarily disappearing on slow networks\n\t// while core data makes REST API requests.\n\tuseEffect( () => {\n\t\tif ( hasResolvedTerms ) {\n\t\t\tconst newValues = ( terms ?? [] ).map( ( term ) =>\n\t\t\t\tunescapeString( term.name )\n\t\t\t);\n\n\t\t\tsetValues( newValues );\n\t\t}\n\t}, [ terms, hasResolvedTerms ] );\n\n\tconst suggestions = useMemo( () => {\n\t\treturn ( searchResults ?? [] ).map( ( term ) =>\n\t\t\tunescapeString( term.name )\n\t\t);\n\t}, [ searchResults ] );\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tif ( ! hasAssignAction ) {\n\t\treturn null;\n\t}\n\n\tfunction onUpdateTerms( newTermIds ) {\n\t\teditPost( { [ taxonomy.rest_base ]: newTermIds } );\n\t}\n\n\tfunction onChange( termNames ) {\n\t\tconst availableTerms = [\n\t\t\t...( terms ?? [] ),\n\t\t\t...( searchResults ?? [] ),\n\t\t];\n\t\tconst uniqueTerms = uniqBy( termNames, ( term ) => term.toLowerCase() );\n\t\tconst newTermNames = uniqueTerms.filter(\n\t\t\t( termName ) =>\n\t\t\t\t! find( availableTerms, ( term ) =>\n\t\t\t\t\tisSameTermName( term.name, termName )\n\t\t\t\t)\n\t\t);\n\n\t\t// Optimistically update term values.\n\t\t// The selector will always re-fetch terms later.\n\t\tsetValues( uniqueTerms );\n\n\t\tif ( newTermNames.length === 0 ) {\n\t\t\treturn onUpdateTerms(\n\t\t\t\ttermNamesToIds( uniqueTerms, availableTerms )\n\t\t\t);\n\t\t}\n\n\t\tif ( ! hasCreateAction ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst namespace = taxonomy?.rest_namespace ?? 'wp/v2';\n\t\tPromise.all(\n\t\t\tnewTermNames.map( ( termName ) =>\n\t\t\t\tfindOrCreateTerm( termName, taxonomy.rest_base, namespace )\n\t\t\t)\n\t\t).then( ( newTerms ) => {\n\t\t\tconst newAvailableTerms = availableTerms.concat( newTerms );\n\t\t\treturn onUpdateTerms(\n\t\t\t\ttermNamesToIds( uniqueTerms, newAvailableTerms )\n\t\t\t);\n\t\t} );\n\t}\n\n\tfunction appendTerm( newTerm ) {\n\t\tif ( termIds.includes( newTerm.id ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst newTermIds = [ ...termIds, newTerm.id ];\n\t\tconst termAddedMessage = sprintf(\n\t\t\t/* translators: %s: term name. */\n\t\t\t_x( '%s added', 'term' ),\n\t\t\tget(\n\t\t\t\ttaxonomy,\n\t\t\t\t[ 'labels', 'singular_name' ],\n\t\t\t\tslug === 'post_tag' ? __( 'Tag' ) : __( 'Term' )\n\t\t\t)\n\t\t);\n\n\t\tspeak( termAddedMessage, 'assertive' );\n\t\tonUpdateTerms( newTermIds );\n\t}\n\n\tconst newTermLabel = get(\n\t\ttaxonomy,\n\t\t[ 'labels', 'add_new_item' ],\n\t\tslug === 'post_tag' ? __( 'Add new tag' ) : __( 'Add new Term' )\n\t);\n\tconst singularName = get(\n\t\ttaxonomy,\n\t\t[ 'labels', 'singular_name' ],\n\t\tslug === 'post_tag' ? __( 'Tag' ) : __( 'Term' )\n\t);\n\tconst termAddedLabel = sprintf(\n\t\t/* translators: %s: term name. */\n\t\t_x( '%s added', 'term' ),\n\t\tsingularName\n\t);\n\tconst termRemovedLabel = sprintf(\n\t\t/* translators: %s: term name. */\n\t\t_x( '%s removed', 'term' ),\n\t\tsingularName\n\t);\n\tconst removeTermLabel = sprintf(\n\t\t/* translators: %s: term name. */\n\t\t_x( 'Remove %s', 'term' ),\n\t\tsingularName\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<FormTokenField\n\t\t\t\tvalue={ values }\n\t\t\t\tsuggestions={ suggestions }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tonInputChange={ debouncedSearch }\n\t\t\t\tmaxSuggestions={ MAX_TERMS_SUGGESTIONS }\n\t\t\t\tlabel={ newTermLabel }\n\t\t\t\tmessages={ {\n\t\t\t\t\tadded: termAddedLabel,\n\t\t\t\t\tremoved: termRemovedLabel,\n\t\t\t\t\tremove: removeTermLabel,\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<MostUsedTerms taxonomy={ taxonomy } onSelect={ appendTerm } />\n\t\t</>\n\t);\n}\n\nexport default withFilters( 'editor.PostTaxonomyType' )( FlatTermSelector );\n"]}
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.HierarchicalTermSelector = HierarchicalTermSelector;
6
7
  exports.default = void 0;
7
8
  exports.findTerm = findTerm;
8
9
  exports.getFilterMatcher = getFilterMatcher;