@wordpress/editor 13.11.0 → 13.12.1

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 (416) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/autosave-monitor/index.js +1 -2
  3. package/build/components/autosave-monitor/index.js.map +1 -1
  4. package/build/components/deprecated.js +7 -9
  5. package/build/components/deprecated.js.map +1 -1
  6. package/build/components/document-outline/check.js +4 -5
  7. package/build/components/document-outline/check.js.map +1 -1
  8. package/build/components/document-outline/index.js +12 -16
  9. package/build/components/document-outline/index.js.map +1 -1
  10. package/build/components/document-outline/item.js +22 -25
  11. package/build/components/document-outline/item.js.map +1 -1
  12. package/build/components/editor-help/help-detail-navigation-screen.native.js +6 -9
  13. package/build/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
  14. package/build/components/editor-help/help-get-support-button.native.js +4 -5
  15. package/build/components/editor-help/help-get-support-button.native.js.map +1 -1
  16. package/build/components/editor-help/help-section-title.native.js +3 -4
  17. package/build/components/editor-help/help-section-title.native.js.map +1 -1
  18. package/build/components/editor-help/help-topic-row.native.js +6 -7
  19. package/build/components/editor-help/help-topic-row.native.js.map +1 -1
  20. package/build/components/editor-help/index.native.js +20 -27
  21. package/build/components/editor-help/index.native.js.map +1 -1
  22. package/build/components/editor-help/view-sections.native.js +16 -20
  23. package/build/components/editor-help/view-sections.native.js.map +1 -1
  24. package/build/components/editor-history/redo.js +2 -6
  25. package/build/components/editor-history/redo.js.map +1 -1
  26. package/build/components/editor-history/undo.js +2 -6
  27. package/build/components/editor-history/undo.js.map +1 -1
  28. package/build/components/editor-notices/index.js +12 -19
  29. package/build/components/editor-notices/index.js.map +1 -1
  30. package/build/components/editor-snackbars/index.js +3 -6
  31. package/build/components/editor-snackbars/index.js.map +1 -1
  32. package/build/components/entities-saved-states/entity-record-item.js +7 -10
  33. package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
  34. package/build/components/entities-saved-states/entity-type-list.js +6 -7
  35. package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
  36. package/build/components/entities-saved-states/hooks/use-is-dirty.js +86 -0
  37. package/build/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -0
  38. package/build/components/entities-saved-states/index.js +43 -116
  39. package/build/components/entities-saved-states/index.js.map +1 -1
  40. package/build/components/error-boundary/index.js +4 -5
  41. package/build/components/error-boundary/index.js.map +1 -1
  42. package/build/components/global-keyboard-shortcuts/save-shortcut.js +3 -4
  43. package/build/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
  44. package/build/components/index.js +18 -0
  45. package/build/components/index.js.map +1 -1
  46. package/build/components/media-categories/index.js +25 -42
  47. package/build/components/media-categories/index.js.map +1 -1
  48. package/build/components/page-attributes/check.js +4 -7
  49. package/build/components/page-attributes/check.js.map +1 -1
  50. package/build/components/page-attributes/order.js +7 -9
  51. package/build/components/page-attributes/order.js.map +1 -1
  52. package/build/components/page-attributes/parent.js +5 -12
  53. package/build/components/page-attributes/parent.js.map +1 -1
  54. package/build/components/post-author/check.js +6 -7
  55. package/build/components/post-author/check.js.map +1 -1
  56. package/build/components/post-author/combobox.js +3 -6
  57. package/build/components/post-author/combobox.js.map +1 -1
  58. package/build/components/post-author/index.js +1 -1
  59. package/build/components/post-author/index.js.map +1 -1
  60. package/build/components/post-comments/index.js +4 -6
  61. package/build/components/post-comments/index.js.map +1 -1
  62. package/build/components/post-excerpt/check.js +2 -4
  63. package/build/components/post-excerpt/check.js.map +1 -1
  64. package/build/components/post-excerpt/index.js +4 -5
  65. package/build/components/post-excerpt/index.js.map +1 -1
  66. package/build/components/post-featured-image/check.js +2 -4
  67. package/build/components/post-featured-image/check.js.map +1 -1
  68. package/build/components/post-featured-image/index.js +56 -69
  69. package/build/components/post-featured-image/index.js.map +1 -1
  70. package/build/components/post-format/check.js +6 -9
  71. package/build/components/post-format/check.js.map +1 -1
  72. package/build/components/post-format/index.js +1 -1
  73. package/build/components/post-format/index.js.map +1 -1
  74. package/build/components/post-last-revision/check.js +5 -7
  75. package/build/components/post-last-revision/check.js.map +1 -1
  76. package/build/components/post-last-revision/index.js +4 -5
  77. package/build/components/post-last-revision/index.js.map +1 -1
  78. package/build/components/post-locked-modal/index.js +1 -1
  79. package/build/components/post-locked-modal/index.js.map +1 -1
  80. package/build/components/post-pending-status/check.js +7 -9
  81. package/build/components/post-pending-status/check.js.map +1 -1
  82. package/build/components/post-pending-status/index.js +4 -6
  83. package/build/components/post-pending-status/index.js.map +1 -1
  84. package/build/components/post-pingbacks/index.js +4 -6
  85. package/build/components/post-pingbacks/index.js.map +1 -1
  86. package/build/components/post-preview-button/index.js +8 -12
  87. package/build/components/post-preview-button/index.js.map +1 -1
  88. package/build/components/post-publish-button/index.js +10 -19
  89. package/build/components/post-publish-button/index.js.map +1 -1
  90. package/build/components/post-publish-button/label.js +14 -17
  91. package/build/components/post-publish-button/label.js.map +1 -1
  92. package/build/components/post-publish-panel/index.js +10 -12
  93. package/build/components/post-publish-panel/index.js.map +1 -1
  94. package/build/components/post-publish-panel/maybe-category-panel.js +2 -4
  95. package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  96. package/build/components/post-publish-panel/maybe-post-format-panel.js +9 -12
  97. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  98. package/build/components/post-publish-panel/maybe-tags-panel.js +4 -7
  99. package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  100. package/build/components/post-publish-panel/maybe-upload-media.js +150 -0
  101. package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -0
  102. package/build/components/post-publish-panel/postpublish.js +8 -11
  103. package/build/components/post-publish-panel/postpublish.js.map +1 -1
  104. package/build/components/post-publish-panel/prepublish.js +8 -7
  105. package/build/components/post-publish-panel/prepublish.js.map +1 -1
  106. package/build/components/post-saved-state/index.js +13 -8
  107. package/build/components/post-saved-state/index.js.map +1 -1
  108. package/build/components/post-schedule/check.js +6 -8
  109. package/build/components/post-schedule/check.js.map +1 -1
  110. package/build/components/post-schedule/index.js +8 -12
  111. package/build/components/post-schedule/index.js.map +1 -1
  112. package/build/components/post-schedule/label.js +7 -10
  113. package/build/components/post-schedule/label.js.map +1 -1
  114. package/build/components/post-slug/check.js +3 -4
  115. package/build/components/post-slug/check.js.map +1 -1
  116. package/build/components/post-slug/index.js +5 -6
  117. package/build/components/post-slug/index.js.map +1 -1
  118. package/build/components/post-sticky/check.js +7 -9
  119. package/build/components/post-sticky/check.js.map +1 -1
  120. package/build/components/post-sticky/index.js +4 -5
  121. package/build/components/post-sticky/index.js.map +1 -1
  122. package/build/components/post-switch-to-draft-button/index.js +6 -7
  123. package/build/components/post-switch-to-draft-button/index.js.map +1 -1
  124. package/build/components/post-sync-status/index.js +67 -0
  125. package/build/components/post-sync-status/index.js.map +1 -0
  126. package/build/components/post-taxonomies/check.js +6 -7
  127. package/build/components/post-taxonomies/check.js.map +1 -1
  128. package/build/components/post-taxonomies/flat-term-selector.js +36 -46
  129. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  130. package/build/components/post-taxonomies/hierarchical-term-selector.js +13 -14
  131. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  132. package/build/components/post-taxonomies/index.js +6 -11
  133. package/build/components/post-taxonomies/index.js.map +1 -1
  134. package/build/components/post-taxonomies/most-used-terms.js +5 -6
  135. package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
  136. package/build/components/post-template/index.js +6 -9
  137. package/build/components/post-template/index.js.map +1 -1
  138. package/build/components/post-title/index.js +8 -5
  139. package/build/components/post-title/index.js.map +1 -1
  140. package/build/components/post-title/index.native.js +8 -11
  141. package/build/components/post-title/index.native.js.map +1 -1
  142. package/build/components/post-trash/check.js +7 -9
  143. package/build/components/post-trash/check.js.map +1 -1
  144. package/build/components/post-type-support-check/index.js +5 -6
  145. package/build/components/post-type-support-check/index.js.map +1 -1
  146. package/build/components/post-url/check.js +4 -5
  147. package/build/components/post-url/check.js.map +1 -1
  148. package/build/components/post-url/index.js +8 -9
  149. package/build/components/post-url/index.js.map +1 -1
  150. package/build/components/post-visibility/check.js +6 -7
  151. package/build/components/post-visibility/check.js.map +1 -1
  152. package/build/components/post-visibility/index.js +14 -19
  153. package/build/components/post-visibility/index.js.map +1 -1
  154. package/build/components/post-visibility/label.js +1 -3
  155. package/build/components/post-visibility/label.js.map +1 -1
  156. package/build/components/provider/index.js +12 -15
  157. package/build/components/provider/index.js.map +1 -1
  158. package/build/components/provider/index.native.js +19 -30
  159. package/build/components/provider/index.native.js.map +1 -1
  160. package/build/components/provider/use-block-editor-settings.js +5 -9
  161. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  162. package/build/components/provider/use-block-editor-settings.native.js +1 -3
  163. package/build/components/provider/use-block-editor-settings.native.js.map +1 -1
  164. package/build/components/provider/with-registry-provider.js +4 -2
  165. package/build/components/provider/with-registry-provider.js.map +1 -1
  166. package/build/components/table-of-contents/index.js +26 -35
  167. package/build/components/table-of-contents/index.js.map +1 -1
  168. package/build/components/table-of-contents/panel.js +4 -5
  169. package/build/components/table-of-contents/panel.js.map +1 -1
  170. package/build/components/template-validation-notice/index.js +4 -6
  171. package/build/components/template-validation-notice/index.js.map +1 -1
  172. package/build/components/theme-support-check/index.js +7 -8
  173. package/build/components/theme-support-check/index.js.map +1 -1
  174. package/build/hooks/custom-sources-backwards-compatibility.js +20 -42
  175. package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  176. package/build/hooks/default-autocompleters.js +1 -2
  177. package/build/hooks/default-autocompleters.js.map +1 -1
  178. package/build/{lockUnlock.js → lock-unlock.js} +1 -1
  179. package/build/lock-unlock.js.map +1 -0
  180. package/build/private-apis.js +5 -2
  181. package/build/private-apis.js.map +1 -1
  182. package/build/store/actions.js +147 -179
  183. package/build/store/actions.js.map +1 -1
  184. package/build/store/actions.native.js +1 -2
  185. package/build/store/actions.native.js.map +1 -1
  186. package/build/store/reducer.js +14 -44
  187. package/build/store/reducer.js.map +1 -1
  188. package/build/store/reducer.native.js +3 -12
  189. package/build/store/reducer.native.js.map +1 -1
  190. package/build/store/selectors.js +23 -54
  191. package/build/store/selectors.js.map +1 -1
  192. package/build/store/utils/notice-builder.js +3 -3
  193. package/build/store/utils/notice-builder.js.map +1 -1
  194. package/build/utils/media-upload/index.js +11 -15
  195. package/build/utils/media-upload/index.js.map +1 -1
  196. package/build/utils/terms.js +3 -6
  197. package/build/utils/terms.js.map +1 -1
  198. package/build-module/components/autosave-monitor/index.js +1 -2
  199. package/build-module/components/autosave-monitor/index.js.map +1 -1
  200. package/build-module/components/deprecated.js +7 -8
  201. package/build-module/components/deprecated.js.map +1 -1
  202. package/build-module/components/document-outline/check.js +4 -5
  203. package/build-module/components/document-outline/check.js.map +1 -1
  204. package/build-module/components/document-outline/index.js +12 -16
  205. package/build-module/components/document-outline/index.js.map +1 -1
  206. package/build-module/components/document-outline/item.js +22 -25
  207. package/build-module/components/document-outline/item.js.map +1 -1
  208. package/build-module/components/editor-help/help-detail-navigation-screen.native.js +6 -8
  209. package/build-module/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
  210. package/build-module/components/editor-help/help-get-support-button.native.js +4 -5
  211. package/build-module/components/editor-help/help-get-support-button.native.js.map +1 -1
  212. package/build-module/components/editor-help/help-section-title.native.js +3 -4
  213. package/build-module/components/editor-help/help-section-title.native.js.map +1 -1
  214. package/build-module/components/editor-help/help-topic-row.native.js +6 -7
  215. package/build-module/components/editor-help/help-topic-row.native.js.map +1 -1
  216. package/build-module/components/editor-help/index.native.js +20 -25
  217. package/build-module/components/editor-help/index.native.js.map +1 -1
  218. package/build-module/components/editor-help/view-sections.native.js +16 -20
  219. package/build-module/components/editor-help/view-sections.native.js.map +1 -1
  220. package/build-module/components/editor-history/redo.js +2 -3
  221. package/build-module/components/editor-history/redo.js.map +1 -1
  222. package/build-module/components/editor-history/undo.js +2 -3
  223. package/build-module/components/editor-history/undo.js.map +1 -1
  224. package/build-module/components/editor-notices/index.js +12 -19
  225. package/build-module/components/editor-notices/index.js.map +1 -1
  226. package/build-module/components/editor-snackbars/index.js +3 -6
  227. package/build-module/components/editor-snackbars/index.js.map +1 -1
  228. package/build-module/components/entities-saved-states/entity-record-item.js +7 -10
  229. package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
  230. package/build-module/components/entities-saved-states/entity-type-list.js +6 -7
  231. package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
  232. package/build-module/components/entities-saved-states/hooks/use-is-dirty.js +72 -0
  233. package/build-module/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -0
  234. package/build-module/components/entities-saved-states/index.js +44 -118
  235. package/build-module/components/entities-saved-states/index.js.map +1 -1
  236. package/build-module/components/error-boundary/index.js +4 -5
  237. package/build-module/components/error-boundary/index.js.map +1 -1
  238. package/build-module/components/global-keyboard-shortcuts/save-shortcut.js +3 -4
  239. package/build-module/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
  240. package/build-module/components/index.js +2 -0
  241. package/build-module/components/index.js.map +1 -1
  242. package/build-module/components/media-categories/index.js +25 -42
  243. package/build-module/components/media-categories/index.js.map +1 -1
  244. package/build-module/components/page-attributes/check.js +4 -7
  245. package/build-module/components/page-attributes/check.js.map +1 -1
  246. package/build-module/components/page-attributes/order.js +7 -9
  247. package/build-module/components/page-attributes/order.js.map +1 -1
  248. package/build-module/components/page-attributes/parent.js +5 -12
  249. package/build-module/components/page-attributes/parent.js.map +1 -1
  250. package/build-module/components/post-author/check.js +6 -7
  251. package/build-module/components/post-author/check.js.map +1 -1
  252. package/build-module/components/post-author/combobox.js +3 -6
  253. package/build-module/components/post-author/combobox.js.map +1 -1
  254. package/build-module/components/post-author/index.js +1 -1
  255. package/build-module/components/post-author/index.js.map +1 -1
  256. package/build-module/components/post-comments/index.js +4 -6
  257. package/build-module/components/post-comments/index.js.map +1 -1
  258. package/build-module/components/post-excerpt/check.js +2 -3
  259. package/build-module/components/post-excerpt/check.js.map +1 -1
  260. package/build-module/components/post-excerpt/index.js +4 -5
  261. package/build-module/components/post-excerpt/index.js.map +1 -1
  262. package/build-module/components/post-featured-image/check.js +2 -3
  263. package/build-module/components/post-featured-image/check.js.map +1 -1
  264. package/build-module/components/post-featured-image/index.js +56 -69
  265. package/build-module/components/post-featured-image/index.js.map +1 -1
  266. package/build-module/components/post-format/check.js +6 -8
  267. package/build-module/components/post-format/check.js.map +1 -1
  268. package/build-module/components/post-format/index.js +1 -1
  269. package/build-module/components/post-format/index.js.map +1 -1
  270. package/build-module/components/post-last-revision/check.js +5 -7
  271. package/build-module/components/post-last-revision/check.js.map +1 -1
  272. package/build-module/components/post-last-revision/index.js +4 -5
  273. package/build-module/components/post-last-revision/index.js.map +1 -1
  274. package/build-module/components/post-locked-modal/index.js +1 -1
  275. package/build-module/components/post-locked-modal/index.js.map +1 -1
  276. package/build-module/components/post-pending-status/check.js +7 -9
  277. package/build-module/components/post-pending-status/check.js.map +1 -1
  278. package/build-module/components/post-pending-status/index.js +4 -6
  279. package/build-module/components/post-pending-status/index.js.map +1 -1
  280. package/build-module/components/post-pingbacks/index.js +4 -6
  281. package/build-module/components/post-pingbacks/index.js.map +1 -1
  282. package/build-module/components/post-preview-button/index.js +8 -12
  283. package/build-module/components/post-preview-button/index.js.map +1 -1
  284. package/build-module/components/post-publish-button/index.js +10 -18
  285. package/build-module/components/post-publish-button/index.js.map +1 -1
  286. package/build-module/components/post-publish-button/label.js +14 -17
  287. package/build-module/components/post-publish-button/label.js.map +1 -1
  288. package/build-module/components/post-publish-panel/index.js +10 -11
  289. package/build-module/components/post-publish-panel/index.js.map +1 -1
  290. package/build-module/components/post-publish-panel/maybe-category-panel.js +2 -4
  291. package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  292. package/build-module/components/post-publish-panel/maybe-post-format-panel.js +9 -12
  293. package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  294. package/build-module/components/post-publish-panel/maybe-tags-panel.js +4 -7
  295. package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  296. package/build-module/components/post-publish-panel/maybe-upload-media.js +138 -0
  297. package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -0
  298. package/build-module/components/post-publish-panel/postpublish.js +8 -11
  299. package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
  300. package/build-module/components/post-publish-panel/prepublish.js +7 -7
  301. package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
  302. package/build-module/components/post-saved-state/index.js +13 -8
  303. package/build-module/components/post-saved-state/index.js.map +1 -1
  304. package/build-module/components/post-schedule/check.js +6 -8
  305. package/build-module/components/post-schedule/check.js.map +1 -1
  306. package/build-module/components/post-schedule/index.js +8 -12
  307. package/build-module/components/post-schedule/index.js.map +1 -1
  308. package/build-module/components/post-schedule/label.js +7 -10
  309. package/build-module/components/post-schedule/label.js.map +1 -1
  310. package/build-module/components/post-slug/check.js +3 -4
  311. package/build-module/components/post-slug/check.js.map +1 -1
  312. package/build-module/components/post-slug/index.js +5 -6
  313. package/build-module/components/post-slug/index.js.map +1 -1
  314. package/build-module/components/post-sticky/check.js +7 -9
  315. package/build-module/components/post-sticky/check.js.map +1 -1
  316. package/build-module/components/post-sticky/index.js +4 -5
  317. package/build-module/components/post-sticky/index.js.map +1 -1
  318. package/build-module/components/post-switch-to-draft-button/index.js +6 -7
  319. package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
  320. package/build-module/components/post-sync-status/index.js +56 -0
  321. package/build-module/components/post-sync-status/index.js.map +1 -0
  322. package/build-module/components/post-taxonomies/check.js +6 -7
  323. package/build-module/components/post-taxonomies/check.js.map +1 -1
  324. package/build-module/components/post-taxonomies/flat-term-selector.js +36 -44
  325. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  326. package/build-module/components/post-taxonomies/hierarchical-term-selector.js +13 -14
  327. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  328. package/build-module/components/post-taxonomies/index.js +6 -11
  329. package/build-module/components/post-taxonomies/index.js.map +1 -1
  330. package/build-module/components/post-taxonomies/most-used-terms.js +5 -6
  331. package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
  332. package/build-module/components/post-template/index.js +6 -9
  333. package/build-module/components/post-template/index.js.map +1 -1
  334. package/build-module/components/post-title/index.js +8 -5
  335. package/build-module/components/post-title/index.js.map +1 -1
  336. package/build-module/components/post-title/index.native.js +8 -11
  337. package/build-module/components/post-title/index.native.js.map +1 -1
  338. package/build-module/components/post-trash/check.js +7 -9
  339. package/build-module/components/post-trash/check.js.map +1 -1
  340. package/build-module/components/post-type-support-check/index.js +5 -6
  341. package/build-module/components/post-type-support-check/index.js.map +1 -1
  342. package/build-module/components/post-url/check.js +4 -5
  343. package/build-module/components/post-url/check.js.map +1 -1
  344. package/build-module/components/post-url/index.js +8 -9
  345. package/build-module/components/post-url/index.js.map +1 -1
  346. package/build-module/components/post-visibility/check.js +6 -7
  347. package/build-module/components/post-visibility/check.js.map +1 -1
  348. package/build-module/components/post-visibility/index.js +14 -16
  349. package/build-module/components/post-visibility/index.js.map +1 -1
  350. package/build-module/components/post-visibility/label.js +1 -3
  351. package/build-module/components/post-visibility/label.js.map +1 -1
  352. package/build-module/components/provider/index.js +12 -14
  353. package/build-module/components/provider/index.js.map +1 -1
  354. package/build-module/components/provider/index.native.js +19 -29
  355. package/build-module/components/provider/index.native.js.map +1 -1
  356. package/build-module/components/provider/use-block-editor-settings.js +5 -9
  357. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  358. package/build-module/components/provider/use-block-editor-settings.native.js +1 -3
  359. package/build-module/components/provider/use-block-editor-settings.native.js.map +1 -1
  360. package/build-module/components/provider/with-registry-provider.js +4 -2
  361. package/build-module/components/provider/with-registry-provider.js.map +1 -1
  362. package/build-module/components/table-of-contents/index.js +26 -34
  363. package/build-module/components/table-of-contents/index.js.map +1 -1
  364. package/build-module/components/table-of-contents/panel.js +4 -5
  365. package/build-module/components/table-of-contents/panel.js.map +1 -1
  366. package/build-module/components/template-validation-notice/index.js +4 -6
  367. package/build-module/components/template-validation-notice/index.js.map +1 -1
  368. package/build-module/components/theme-support-check/index.js +7 -8
  369. package/build-module/components/theme-support-check/index.js.map +1 -1
  370. package/build-module/hooks/custom-sources-backwards-compatibility.js +20 -39
  371. package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  372. package/build-module/hooks/default-autocompleters.js +1 -2
  373. package/build-module/hooks/default-autocompleters.js.map +1 -1
  374. package/build-module/{lockUnlock.js → lock-unlock.js} +1 -1
  375. package/build-module/lock-unlock.js.map +1 -0
  376. package/build-module/private-apis.js +4 -2
  377. package/build-module/private-apis.js.map +1 -1
  378. package/build-module/store/actions.js +147 -179
  379. package/build-module/store/actions.js.map +1 -1
  380. package/build-module/store/actions.native.js +1 -2
  381. package/build-module/store/actions.native.js.map +1 -1
  382. package/build-module/store/reducer.js +14 -44
  383. package/build-module/store/reducer.js.map +1 -1
  384. package/build-module/store/reducer.native.js +3 -12
  385. package/build-module/store/reducer.native.js.map +1 -1
  386. package/build-module/store/selectors.js +21 -54
  387. package/build-module/store/selectors.js.map +1 -1
  388. package/build-module/store/utils/notice-builder.js +3 -3
  389. package/build-module/store/utils/notice-builder.js.map +1 -1
  390. package/build-module/utils/media-upload/index.js +11 -15
  391. package/build-module/utils/media-upload/index.js.map +1 -1
  392. package/build-module/utils/terms.js +3 -6
  393. package/build-module/utils/terms.js.map +1 -1
  394. package/build-style/style-rtl.css +15 -1
  395. package/build-style/style.css +15 -1
  396. package/package.json +30 -31
  397. package/src/components/editor-help/test/index.native.js +3 -2
  398. package/src/components/entities-saved-states/hooks/use-is-dirty.js +87 -0
  399. package/src/components/entities-saved-states/index.js +25 -106
  400. package/src/components/entities-saved-states/test/use-is-dirty.js +94 -0
  401. package/src/components/index.js +2 -0
  402. package/src/components/post-publish-panel/maybe-upload-media.js +167 -0
  403. package/src/components/post-publish-panel/prepublish.js +2 -0
  404. package/src/components/post-publish-panel/style.scss +1 -1
  405. package/src/components/post-saved-state/index.js +6 -0
  406. package/src/components/post-sync-status/index.js +55 -0
  407. package/src/components/post-sync-status/style.scss +16 -0
  408. package/src/components/post-taxonomies/flat-term-selector.js +20 -30
  409. package/src/components/post-title/index.js +4 -1
  410. package/src/components/provider/index.js +1 -1
  411. package/src/components/provider/index.native.js +2 -9
  412. package/src/private-apis.js +3 -1
  413. package/src/style.scss +1 -0
  414. package/build/lockUnlock.js.map +0 -1
  415. package/build-module/lockUnlock.js.map +0 -1
  416. /package/src/{lockUnlock.js → lock-unlock.js} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-publish-panel/maybe-tags-panel.js"],"names":["TagsPanel","panelBodyTitle","MaybeTagsPanel","Component","constructor","props","state","hadTagsWhenOpeningThePanel","hasTags","render","select","postType","editorStore","getCurrentPostType","tagsTaxonomy","coreStore","getTaxonomy","tags","getEditedPostAttribute","rest_base","areTagsFetched","undefined","isPostTypeSupported","types","some","type","length"],"mappings":";;;;;;;;;AAIA;;AADA;;AAEA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAdA;AACA;AACA;;AAQA;AACA;AACA;AAIA,MAAMA,SAAS,GAAG,MAAM;AACvB,QAAMC,cAAc,GAAG,CACtB,cAAI,aAAJ,CADsB,EAEtB;AAAM,IAAA,SAAS,EAAC,iCAAhB;AAAkD,IAAA,GAAG,EAAC;AAAtD,KACG,cAAI,UAAJ,CADH,CAFsB,CAAvB;AAOA,SACC,4BAAC,qBAAD;AAAW,IAAA,WAAW,EAAG,KAAzB;AAAiC,IAAA,KAAK,EAAGA;AAAzC,KACC,uCACG,cACD,wHADC,CADH,CADD,EAMC,4BAAC,yBAAD;AAAkB,IAAA,IAAI,EAAG;AAAzB,IAND,CADD;AAUA,CAlBD;;AAoBA,MAAMC,cAAN,SAA6BC,kBAA7B,CAAuC;AACtCC,EAAAA,WAAW,CAAEC,KAAF,EAAU;AACpB,UAAOA,KAAP;AACA,SAAKC,KAAL,GAAa;AACZC,MAAAA,0BAA0B,EAAEF,KAAK,CAACG;AADtB,KAAb;AAGA;AAED;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACCC,EAAAA,MAAM,GAAG;AACR,QAAK,CAAE,KAAKH,KAAL,CAAWC,0BAAlB,EAA+C;AAC9C,aAAO,4BAAC,SAAD,OAAP;AACA;;AAED,WAAO,IAAP;AACA;;AAxBqC;;eA2BxB,sBACd,sBAAcG,MAAF,IAAc;AACzB,QAAMC,QAAQ,GAAGD,MAAM,CAAEE,YAAF,CAAN,CAAsBC,kBAAtB,EAAjB;AACA,QAAMC,YAAY,GAAGJ,MAAM,CAAEK,eAAF,CAAN,CAAoBC,WAApB,CAAiC,UAAjC,CAArB;AACA,QAAMC,IAAI,GACTH,YAAY,IACZJ,MAAM,CAAEE,YAAF,CAAN,CAAsBM,sBAAtB,CACCJ,YAAY,CAACK,SADd,CAFD;AAKA,SAAO;AACNC,IAAAA,cAAc,EAAEN,YAAY,KAAKO,SAD3B;AAENC,IAAAA,mBAAmB,EAClBR,YAAY,IACZA,YAAY,CAACS,KAAb,CAAmBC,IAAnB,CAA2BC,IAAF,IAAYA,IAAI,KAAKd,QAA9C,CAJK;AAKNH,IAAAA,OAAO,EAAES,IAAI,IAAIA,IAAI,CAACS;AALhB,GAAP;AAOA,CAfD,CADc,EAiBd,0BACC;AAAA,MAAE;AAAEN,IAAAA,cAAF;AAAkBE,IAAAA;AAAlB,GAAF;AAAA,SACCA,mBAAmB,IAAIF,cADxB;AAAA,CADD,CAjBc,EAqBZlB,cArBY,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Component } from '@wordpress/element';\nimport { compose, ifCondition } from '@wordpress/compose';\nimport { withSelect } from '@wordpress/data';\nimport { PanelBody } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport FlatTermSelector from '../post-taxonomies/flat-term-selector';\nimport { store as editorStore } from '../../store';\n\nconst TagsPanel = () => {\n\tconst panelBodyTitle = [\n\t\t__( 'Suggestion:' ),\n\t\t<span className=\"editor-post-publish-panel__link\" key=\"label\">\n\t\t\t{ __( 'Add tags' ) }\n\t\t</span>,\n\t];\n\n\treturn (\n\t\t<PanelBody initialOpen={ false } title={ panelBodyTitle }>\n\t\t\t<p>\n\t\t\t\t{ __(\n\t\t\t\t\t'Tags help users and search engines navigate your site and find your content. Add a few keywords to describe your post.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<FlatTermSelector slug={ 'post_tag' } />\n\t\t</PanelBody>\n\t);\n};\n\nclass MaybeTagsPanel extends Component {\n\tconstructor( props ) {\n\t\tsuper( props );\n\t\tthis.state = {\n\t\t\thadTagsWhenOpeningThePanel: props.hasTags,\n\t\t};\n\t}\n\n\t/*\n\t * We only want to show the tag panel if the post didn't have\n\t * any tags when the user hit the Publish button.\n\t *\n\t * We can't use the prop.hasTags because it'll change to true\n\t * if the user adds a new tag within the pre-publish panel.\n\t * This would force a re-render and a new prop.hasTags check,\n\t * hiding this panel and keeping the user from adding\n\t * more than one tag.\n\t */\n\trender() {\n\t\tif ( ! this.state.hadTagsWhenOpeningThePanel ) {\n\t\t\treturn <TagsPanel />;\n\t\t}\n\n\t\treturn null;\n\t}\n}\n\nexport default compose(\n\twithSelect( ( select ) => {\n\t\tconst postType = select( editorStore ).getCurrentPostType();\n\t\tconst tagsTaxonomy = select( coreStore ).getTaxonomy( 'post_tag' );\n\t\tconst tags =\n\t\t\ttagsTaxonomy &&\n\t\t\tselect( editorStore ).getEditedPostAttribute(\n\t\t\t\ttagsTaxonomy.rest_base\n\t\t\t);\n\t\treturn {\n\t\t\tareTagsFetched: tagsTaxonomy !== undefined,\n\t\t\tisPostTypeSupported:\n\t\t\t\ttagsTaxonomy &&\n\t\t\t\ttagsTaxonomy.types.some( ( type ) => type === postType ),\n\t\t\thasTags: tags && tags.length,\n\t\t};\n\t} ),\n\tifCondition(\n\t\t( { areTagsFetched, isPostTypeSupported } ) =>\n\t\t\tisPostTypeSupported && areTagsFetched\n\t)\n)( MaybeTagsPanel );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-publish-panel/maybe-tags-panel.js"],"names":["TagsPanel","panelBodyTitle","MaybeTagsPanel","Component","constructor","props","state","hadTagsWhenOpeningThePanel","hasTags","render","select","postType","editorStore","getCurrentPostType","tagsTaxonomy","coreStore","getTaxonomy","tags","getEditedPostAttribute","rest_base","areTagsFetched","undefined","isPostTypeSupported","types","some","type","length"],"mappings":";;;;;;;;;AAIA;;AADA;;AAEA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAdA;AACA;AACA;;AAQA;AACA;AACA;AAIA,MAAMA,SAAS,GAAG,MAAM;AACvB,QAAMC,cAAc,GAAG,CACtB,cAAI,aAAJ,CADsB,EAEtB;AAAM,IAAA,SAAS,EAAC,iCAAhB;AAAkD,IAAA,GAAG,EAAC;AAAtD,KACG,cAAI,UAAJ,CADH,CAFsB,CAAvB;AAOA,SACC,4BAAC,qBAAD;AAAW,IAAA,WAAW,EAAG,KAAzB;AAAiC,IAAA,KAAK,EAAGA;AAAzC,KACC,uCACG,cACD,wHADC,CADH,CADD,EAMC,4BAAC,yBAAD;AAAkB,IAAA,IAAI,EAAG;AAAzB,IAND,CADD;AAUA,CAlBD;;AAoBA,MAAMC,cAAN,SAA6BC,kBAA7B,CAAuC;AACtCC,EAAAA,WAAW,CAAEC,KAAF,EAAU;AACpB,UAAOA,KAAP;AACA,SAAKC,KAAL,GAAa;AACZC,MAAAA,0BAA0B,EAAEF,KAAK,CAACG;AADtB,KAAb;AAGA;AAED;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACCC,EAAAA,MAAM,GAAG;AACR,QAAK,CAAE,KAAKH,KAAL,CAAWC,0BAAlB,EAA+C;AAC9C,aAAO,4BAAC,SAAD,OAAP;AACA;;AAED,WAAO,IAAP;AACA;;AAxBqC;;eA2BxB,sBACd,sBAAcG,MAAF,IAAc;AACzB,QAAMC,QAAQ,GAAGD,MAAM,CAAEE,YAAF,CAAN,CAAsBC,kBAAtB,EAAjB;AACA,QAAMC,YAAY,GAAGJ,MAAM,CAAEK,eAAF,CAAN,CAAoBC,WAApB,CAAiC,UAAjC,CAArB;AACA,QAAMC,IAAI,GACTH,YAAY,IACZJ,MAAM,CAAEE,YAAF,CAAN,CAAsBM,sBAAtB,CACCJ,YAAY,CAACK,SADd,CAFD;AAKA,SAAO;AACNC,IAAAA,cAAc,EAAEN,YAAY,KAAKO,SAD3B;AAENC,IAAAA,mBAAmB,EAClBR,YAAY,IACZA,YAAY,CAACS,KAAb,CAAmBC,IAAnB,CAA2BC,IAAF,IAAYA,IAAI,KAAKd,QAA9C,CAJK;AAKNH,IAAAA,OAAO,EAAES,IAAI,IAAIA,IAAI,CAACS;AALhB,GAAP;AAOA,CAfD,CADc,EAiBd,0BACC,CAAE;AAAEN,EAAAA,cAAF;AAAkBE,EAAAA;AAAlB,CAAF,KACCA,mBAAmB,IAAIF,cAFzB,CAjBc,EAqBZlB,cArBY,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Component } from '@wordpress/element';\nimport { compose, ifCondition } from '@wordpress/compose';\nimport { withSelect } from '@wordpress/data';\nimport { PanelBody } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport FlatTermSelector from '../post-taxonomies/flat-term-selector';\nimport { store as editorStore } from '../../store';\n\nconst TagsPanel = () => {\n\tconst panelBodyTitle = [\n\t\t__( 'Suggestion:' ),\n\t\t<span className=\"editor-post-publish-panel__link\" key=\"label\">\n\t\t\t{ __( 'Add tags' ) }\n\t\t</span>,\n\t];\n\n\treturn (\n\t\t<PanelBody initialOpen={ false } title={ panelBodyTitle }>\n\t\t\t<p>\n\t\t\t\t{ __(\n\t\t\t\t\t'Tags help users and search engines navigate your site and find your content. Add a few keywords to describe your post.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<FlatTermSelector slug={ 'post_tag' } />\n\t\t</PanelBody>\n\t);\n};\n\nclass MaybeTagsPanel extends Component {\n\tconstructor( props ) {\n\t\tsuper( props );\n\t\tthis.state = {\n\t\t\thadTagsWhenOpeningThePanel: props.hasTags,\n\t\t};\n\t}\n\n\t/*\n\t * We only want to show the tag panel if the post didn't have\n\t * any tags when the user hit the Publish button.\n\t *\n\t * We can't use the prop.hasTags because it'll change to true\n\t * if the user adds a new tag within the pre-publish panel.\n\t * This would force a re-render and a new prop.hasTags check,\n\t * hiding this panel and keeping the user from adding\n\t * more than one tag.\n\t */\n\trender() {\n\t\tif ( ! this.state.hadTagsWhenOpeningThePanel ) {\n\t\t\treturn <TagsPanel />;\n\t\t}\n\n\t\treturn null;\n\t}\n}\n\nexport default compose(\n\twithSelect( ( select ) => {\n\t\tconst postType = select( editorStore ).getCurrentPostType();\n\t\tconst tagsTaxonomy = select( coreStore ).getTaxonomy( 'post_tag' );\n\t\tconst tags =\n\t\t\ttagsTaxonomy &&\n\t\t\tselect( editorStore ).getEditedPostAttribute(\n\t\t\t\ttagsTaxonomy.rest_base\n\t\t\t);\n\t\treturn {\n\t\t\tareTagsFetched: tagsTaxonomy !== undefined,\n\t\t\tisPostTypeSupported:\n\t\t\t\ttagsTaxonomy &&\n\t\t\t\ttagsTaxonomy.types.some( ( type ) => type === postType ),\n\t\t\thasTags: tags && tags.length,\n\t\t};\n\t} ),\n\tifCondition(\n\t\t( { areTagsFetched, isPostTypeSupported } ) =>\n\t\t\tisPostTypeSupported && areTagsFetched\n\t)\n)( MaybeTagsPanel );\n"]}
@@ -0,0 +1,150 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = PostFormatPanel;
7
+
8
+ var _element = require("@wordpress/element");
9
+
10
+ var _components = require("@wordpress/components");
11
+
12
+ var _data = require("@wordpress/data");
13
+
14
+ var _i18n = require("@wordpress/i18n");
15
+
16
+ var _icons = require("@wordpress/icons");
17
+
18
+ var _blockEditor = require("@wordpress/block-editor");
19
+
20
+ var _blob = require("@wordpress/blob");
21
+
22
+ var _store = require("../../store");
23
+
24
+ /**
25
+ * WordPress dependencies
26
+ */
27
+
28
+ /**
29
+ * Internal dependencies
30
+ */
31
+ function flattenBlocks(blocks) {
32
+ const result = [];
33
+ blocks.forEach(block => {
34
+ result.push(block);
35
+ result.push(...flattenBlocks(block.innerBlocks));
36
+ });
37
+ return result;
38
+ }
39
+
40
+ function Image(block) {
41
+ const {
42
+ selectBlock
43
+ } = (0, _data.useDispatch)(_blockEditor.store);
44
+ return (0, _element.createElement)(_components.__unstableMotion.img, {
45
+ tabIndex: 0,
46
+ role: "button",
47
+ "aria-label": (0, _i18n.__)('Select image block.'),
48
+ onClick: () => {
49
+ selectBlock(block.clientId);
50
+ },
51
+ onKeyDown: event => {
52
+ if (event.key === 'Enter' || event.key === ' ') {
53
+ selectBlock(block.clientId);
54
+ event.preventDefault();
55
+ }
56
+ },
57
+ key: block.clientId,
58
+ alt: block.attributes.alt,
59
+ src: block.attributes.url,
60
+ animate: {
61
+ opacity: 1
62
+ },
63
+ exit: {
64
+ opacity: 0,
65
+ scale: 0
66
+ },
67
+ style: {
68
+ width: '36px',
69
+ height: '36px',
70
+ objectFit: 'cover',
71
+ borderRadius: '2px',
72
+ cursor: 'pointer'
73
+ },
74
+ whileHover: {
75
+ scale: 1.08
76
+ }
77
+ });
78
+ }
79
+
80
+ function PostFormatPanel() {
81
+ const [isUploading, setIsUploading] = (0, _element.useState)(false);
82
+ const {
83
+ editorBlocks,
84
+ mediaUpload
85
+ } = (0, _data.useSelect)(select => ({
86
+ editorBlocks: select(_store.store).getEditorBlocks(),
87
+ mediaUpload: select(_blockEditor.store).getSettings().mediaUpload
88
+ }), []);
89
+ const externalImages = flattenBlocks(editorBlocks).filter(block => block.name === 'core/image' && block.attributes.url && !block.attributes.id);
90
+ const {
91
+ updateBlockAttributes
92
+ } = (0, _data.useDispatch)(_blockEditor.store);
93
+
94
+ if (!mediaUpload || !externalImages.length) {
95
+ return null;
96
+ }
97
+
98
+ const panelBodyTitle = [(0, _i18n.__)('Suggestion:'), (0, _element.createElement)("span", {
99
+ className: "editor-post-publish-panel__link",
100
+ key: "label"
101
+ }, (0, _i18n.__)('External media'))];
102
+
103
+ function uploadImages() {
104
+ setIsUploading(true);
105
+ Promise.all(externalImages.map(image => window.fetch(image.attributes.url.includes('?') ? image.attributes.url : image.attributes.url + '?').then(response => response.blob()).then(blob => new Promise((resolve, reject) => {
106
+ mediaUpload({
107
+ filesList: [blob],
108
+ onFileChange: ([media]) => {
109
+ if ((0, _blob.isBlobURL)(media.url)) {
110
+ return;
111
+ }
112
+
113
+ updateBlockAttributes(image.clientId, {
114
+ id: media.id,
115
+ url: media.url
116
+ });
117
+ resolve();
118
+ },
119
+
120
+ onError() {
121
+ reject();
122
+ }
123
+
124
+ });
125
+ })))).finally(() => {
126
+ setIsUploading(false);
127
+ });
128
+ }
129
+
130
+ return (0, _element.createElement)(_components.PanelBody, {
131
+ initialOpen: true,
132
+ title: panelBodyTitle
133
+ }, (0, _element.createElement)("p", null, (0, _i18n.__)('There are some external images in the post which can be uploaded to the media library. Images coming from different domains may not always display correctly, load slowly for visitors, or be removed unexpectedly.')), (0, _element.createElement)("div", {
134
+ style: {
135
+ display: 'inline-flex',
136
+ flexWrap: 'wrap',
137
+ gap: '8px'
138
+ }
139
+ }, (0, _element.createElement)(_components.__unstableAnimatePresence, null, externalImages.map(image => {
140
+ return (0, _element.createElement)(Image, {
141
+ key: image.clientId,
142
+ ...image
143
+ });
144
+ })), isUploading ? (0, _element.createElement)(_components.Spinner, null) : (0, _element.createElement)(_components.Button, {
145
+ icon: _icons.upload,
146
+ variant: "primary",
147
+ onClick: uploadImages
148
+ }, (0, _i18n.__)('Upload all'))));
149
+ }
150
+ //# sourceMappingURL=maybe-upload-media.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-publish-panel/maybe-upload-media.js"],"names":["flattenBlocks","blocks","result","forEach","block","push","innerBlocks","Image","selectBlock","blockEditorStore","clientId","event","key","preventDefault","attributes","alt","url","opacity","scale","width","height","objectFit","borderRadius","cursor","PostFormatPanel","isUploading","setIsUploading","editorBlocks","mediaUpload","select","editorStore","getEditorBlocks","getSettings","externalImages","filter","name","id","updateBlockAttributes","length","panelBodyTitle","uploadImages","Promise","all","map","image","window","fetch","includes","then","response","blob","resolve","reject","filesList","onFileChange","media","onError","finally","display","flexWrap","gap","upload"],"mappings":";;;;;;;AAcA;;AAXA;;AAOA;;AACA;;AACA;;AACA;;AAEA;;AAKA;;AApBA;AACA;AACA;;AAeA;AACA;AACA;AAGA,SAASA,aAAT,CAAwBC,MAAxB,EAAiC;AAChC,QAAMC,MAAM,GAAG,EAAf;AAEAD,EAAAA,MAAM,CAACE,OAAP,CAAkBC,KAAF,IAAa;AAC5BF,IAAAA,MAAM,CAACG,IAAP,CAAaD,KAAb;AACAF,IAAAA,MAAM,CAACG,IAAP,CAAa,GAAGL,aAAa,CAAEI,KAAK,CAACE,WAAR,CAA7B;AACA,GAHD;AAKA,SAAOJ,MAAP;AACA;;AAED,SAASK,KAAT,CAAgBH,KAAhB,EAAwB;AACvB,QAAM;AAAEI,IAAAA;AAAF,MAAkB,uBAAaC,kBAAb,CAAxB;AACA,SACC,4BAAC,4BAAD,CAAQ,GAAR;AACC,IAAA,QAAQ,EAAG,CADZ;AAEC,IAAA,IAAI,EAAC,QAFN;AAGC,kBAAa,cAAI,qBAAJ,CAHd;AAIC,IAAA,OAAO,EAAG,MAAM;AACfD,MAAAA,WAAW,CAAEJ,KAAK,CAACM,QAAR,CAAX;AACA,KANF;AAOC,IAAA,SAAS,EAAKC,KAAF,IAAa;AACxB,UAAKA,KAAK,CAACC,GAAN,KAAc,OAAd,IAAyBD,KAAK,CAACC,GAAN,KAAc,GAA5C,EAAkD;AACjDJ,QAAAA,WAAW,CAAEJ,KAAK,CAACM,QAAR,CAAX;AACAC,QAAAA,KAAK,CAACE,cAAN;AACA;AACD,KAZF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KAlBD,CATH,CADD,CADD,EAgCEK,OAhCF,CAgCW,MAAM;AAChB/B,MAAAA,cAAc,CAAE,KAAF,CAAd;AACA,KAlCD;AAmCA;;AAED,SACC,4BAAC,qBAAD;AAAW,IAAA,WAAW,EAAG,IAAzB;AAAgC,IAAA,KAAK,EAAGa;AAAxC,KACC,uCACG,cACD,qNADC,CADH,CADD,EAMC;AACC,IAAA,KAAK,EAAG;AACPmB,MAAAA,OAAO,EAAE,aADF;AAEPC,MAAAA,QAAQ,EAAE,MAFH;AAGPC,MAAAA,GAAG,EAAE;AAHE;AADT,KAOC,4BAAC,qCAAD,QACG3B,cAAc,CAACU,GAAf,CAAsBC,KAAF,IAAa;AAClC,WAAO,4BAAC,KAAD;AAAO,MAAA,GAAG,EAAGA,KAAK,CAAClC,QAAnB;AAAA,SAAmCkC;AAAnC,MAAP;AACA,GAFC,CADH,CAPD,EAYGnB,WAAW,GACZ,4BAAC,mBAAD,OADY,GAGZ,4BAAC,kBAAD;AACC,IAAA,IAAI,EAAGoC,aADR;AAEC,IAAA,OAAO,EAAC,SAFT;AAGC,IAAA,OAAO,EAAGrB;AAHX,KAKG,cAAI,YAAJ,CALH,CAfF,CAND,CADD;AAiCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tPanelBody,\n\tButton,\n\tSpinner,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { upload } from '@wordpress/icons';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useState } from '@wordpress/element';\nimport { isBlobURL } from '@wordpress/blob';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction flattenBlocks( blocks ) {\n\tconst result = [];\n\n\tblocks.forEach( ( block ) => {\n\t\tresult.push( block );\n\t\tresult.push( ...flattenBlocks( block.innerBlocks ) );\n\t} );\n\n\treturn result;\n}\n\nfunction Image( block ) {\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\treturn (\n\t\t<motion.img\n\t\t\ttabIndex={ 0 }\n\t\t\trole=\"button\"\n\t\t\taria-label={ __( 'Select image block.' ) }\n\t\t\tonClick={ () => {\n\t\t\t\tselectBlock( block.clientId );\n\t\t\t} }\n\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\tif ( event.key === 'Enter' || event.key === ' ' ) {\n\t\t\t\t\tselectBlock( block.clientId );\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t}\n\t\t\t} }\n\t\t\tkey={ block.clientId }\n\t\t\talt={ block.attributes.alt }\n\t\t\tsrc={ block.attributes.url }\n\t\t\tanimate={ { opacity: 1 } }\n\t\t\texit={ { opacity: 0, scale: 0 } }\n\t\t\tstyle={ {\n\t\t\t\twidth: '36px',\n\t\t\t\theight: '36px',\n\t\t\t\tobjectFit: 'cover',\n\t\t\t\tborderRadius: '2px',\n\t\t\t\tcursor: 'pointer',\n\t\t\t} }\n\t\t\twhileHover={ { scale: 1.08 } }\n\t\t/>\n\t);\n}\n\nexport default function PostFormatPanel() {\n\tconst [ isUploading, setIsUploading ] = useState( false );\n\tconst { editorBlocks, mediaUpload } = useSelect(\n\t\t( select ) => ( {\n\t\t\teditorBlocks: select( editorStore ).getEditorBlocks(),\n\t\t\tmediaUpload: select( blockEditorStore ).getSettings().mediaUpload,\n\t\t} ),\n\t\t[]\n\t);\n\tconst externalImages = flattenBlocks( editorBlocks ).filter(\n\t\t( block ) =>\n\t\t\tblock.name === 'core/image' &&\n\t\t\tblock.attributes.url &&\n\t\t\t! block.attributes.id\n\t);\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\n\tif ( ! mediaUpload || ! externalImages.length ) {\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{ __( 'External media' ) }\n\t\t</span>,\n\t];\n\n\tfunction uploadImages() {\n\t\tsetIsUploading( true );\n\t\tPromise.all(\n\t\t\texternalImages.map( ( image ) =>\n\t\t\t\twindow\n\t\t\t\t\t.fetch(\n\t\t\t\t\t\timage.attributes.url.includes( '?' )\n\t\t\t\t\t\t\t? image.attributes.url\n\t\t\t\t\t\t\t: image.attributes.url + '?'\n\t\t\t\t\t)\n\t\t\t\t\t.then( ( response ) => response.blob() )\n\t\t\t\t\t.then(\n\t\t\t\t\t\t( blob ) =>\n\t\t\t\t\t\t\tnew Promise( ( resolve, reject ) => {\n\t\t\t\t\t\t\t\tmediaUpload( {\n\t\t\t\t\t\t\t\t\tfilesList: [ blob ],\n\t\t\t\t\t\t\t\t\tonFileChange: ( [ media ] ) => {\n\t\t\t\t\t\t\t\t\t\tif ( isBlobURL( media.url ) ) {\n\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tupdateBlockAttributes( image.clientId, {\n\t\t\t\t\t\t\t\t\t\t\tid: media.id,\n\t\t\t\t\t\t\t\t\t\t\turl: media.url,\n\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tonError() {\n\t\t\t\t\t\t\t\t\t\treject();\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t)\n\t\t\t)\n\t\t).finally( () => {\n\t\t\tsetIsUploading( false );\n\t\t} );\n\t}\n\n\treturn (\n\t\t<PanelBody initialOpen={ true } title={ panelBodyTitle }>\n\t\t\t<p>\n\t\t\t\t{ __(\n\t\t\t\t\t'There are some external images in the post which can be uploaded to the media library. Images coming from different domains may not always display correctly, load slowly for visitors, or be removed unexpectedly.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<div\n\t\t\t\tstyle={ {\n\t\t\t\t\tdisplay: 'inline-flex',\n\t\t\t\t\tflexWrap: 'wrap',\n\t\t\t\t\tgap: '8px',\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<AnimatePresence>\n\t\t\t\t\t{ externalImages.map( ( image ) => {\n\t\t\t\t\t\treturn <Image key={ image.clientId } { ...image } />;\n\t\t\t\t\t} ) }\n\t\t\t\t</AnimatePresence>\n\t\t\t\t{ isUploading ? (\n\t\t\t\t\t<Spinner />\n\t\t\t\t) : (\n\t\t\t\t\t<Button\n\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ uploadImages }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Upload all' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</PanelBody>\n\t);\n}\n"]}
@@ -60,12 +60,11 @@ const getFuturePostUrl = post => {
60
60
  return post.permalink_template;
61
61
  };
62
62
 
63
- function CopyButton(_ref) {
64
- let {
65
- text,
66
- onCopy,
67
- children
68
- } = _ref;
63
+ function CopyButton({
64
+ text,
65
+ onCopy,
66
+ children
67
+ }) {
69
68
  const ref = (0, _compose.useCopyToClipboard)(text, onCopy);
70
69
  return (0, _element.createElement)(_components.Button, {
71
70
  variant: "secondary",
@@ -111,17 +110,15 @@ class PostPublishPanelPostpublish extends _element.Component {
111
110
  }
112
111
 
113
112
  render() {
114
- var _postType$labels, _postType$labels2, _postType$labels3;
115
-
116
113
  const {
117
114
  children,
118
115
  isScheduled,
119
116
  post,
120
117
  postType
121
118
  } = this.props;
122
- const postLabel = postType === null || postType === void 0 ? void 0 : (_postType$labels = postType.labels) === null || _postType$labels === void 0 ? void 0 : _postType$labels.singular_name;
123
- const viewPostLabel = postType === null || postType === void 0 ? void 0 : (_postType$labels2 = postType.labels) === null || _postType$labels2 === void 0 ? void 0 : _postType$labels2.view_item;
124
- const addNewPostLabel = postType === null || postType === void 0 ? void 0 : (_postType$labels3 = postType.labels) === null || _postType$labels3 === void 0 ? void 0 : _postType$labels3.add_new_item;
119
+ const postLabel = postType?.labels?.singular_name;
120
+ const viewPostLabel = postType?.labels?.view_item;
121
+ const addNewPostLabel = postType?.labels?.add_new_item;
125
122
  const link = post.status === 'future' ? getFuturePostUrl(post) : post.link;
126
123
  const addLink = (0, _url.addQueryArgs)('post-new.php', {
127
124
  post_type: post.type
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-publish-panel/postpublish.js"],"names":["POSTNAME","PAGENAME","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","labels","singular_name","viewPostLabel","view_item","addNewPostLabel","add_new_item","link","status","addLink","post_type","type","postPublishNonLinkHeader","title","getEditedPostAttribute","getCurrentPost","isCurrentPostScheduled","editorStore","getPostType","coreStore"],"mappings":";;;;;;;;;AAKA;;AAFA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAhBA;AACA;AACA;;AAUA;AACA;AACA;AAIA,MAAMA,QAAQ,GAAG,YAAjB;AACA,MAAMC,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,CAAkCN,QAAlC,CAAL,EAAoD;AACnD,WAAOG,IAAI,CAACE,kBAAL,CAAwBE,OAAxB,CAAiCP,QAAjC,EAA2CI,IAA3C,CAAP;AACA;;AAED,MAAKD,IAAI,CAACE,kBAAL,CAAwBC,QAAxB,CAAkCL,QAAlC,CAAL,EAAoD;AACnD,WAAOE,IAAI,CAACE,kBAAL,C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sBAAsB,CAAE,MAAF,CAAxB,CAFf;AAGNhB,IAAAA,WAAW,EAAEkB,sBAAsB;AAH7B,GAAP;AAKA,CAVc,EAUVzC,2BAVU,C","sourcesContent":["/**\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%';\nconst PAGENAME = '%pagename%';\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\tif ( post.permalink_template.includes( PAGENAME ) ) {\n\t\treturn post.permalink_template.replace( PAGENAME, 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 = postType?.labels?.singular_name;\n\t\tconst viewPostLabel = postType?.labels?.view_item;\n\t\tconst addNewPostLabel = 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\t__nextHasNoMarginBottom\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
+ {"version":3,"sources":["@wordpress/editor/src/components/post-publish-panel/postpublish.js"],"names":["POSTNAME","PAGENAME","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","labels","singular_name","viewPostLabel","view_item","addNewPostLabel","add_new_item","link","status","addLink","post_type","type","postPublishNonLinkHeader","title","getEditedPostAttribute","getCurrentPost","isCurrentPostScheduled","editorStore","getPostType","coreStore"],"mappings":";;;;;;;;;AAKA;;AAFA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAhBA;AACA;AACA;;AAUA;AACA;AACA;AAIA,MAAMA,QAAQ,GAAG,YAAjB;AACA,MAAMC,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,CAAkCN,QAAlC,CAAL,EAAoD;AACnD,WAAOG,IAAI,CAACE,kBAAL,CAAwBE,OAAxB,CAAiCP,QAAjC,EAA2CI,IAA3C,CAAP;AACA;;AAED,MAAKD,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,CAZD;;AAcA,SAASG,UAAT,CAAqB;AAAEC,EA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O,CAJT;AASC,MAAA,KAAK,EAAG,iCAAwBO,IAAxB,CATT;AAUC,MAAA,OAAO,EAAG,KAAKzB;AAVhB,MADD,EAcC;AAAK,MAAA,SAAS,EAAC;AAAf,OACC,4BAAC,UAAD;AAAY,MAAA,IAAI,EAAGyB,IAAnB;AAA0B,MAAA,MAAM,EAAG,KAAKnC;AAAxC,OACG,KAAKO,KAAL,CAAWC,oBAAX,GACC,cAAI,SAAJ,CADD,GAEC,cAAI,MAAJ,CAHJ,CADD,CAdD,CAJD,EA2BC;AAAK,MAAA,SAAS,EAAC;AAAf,OACG,CAAEkB,WAAF,IACD,4BAAC,kBAAD;AAAQ,MAAA,OAAO,EAAC,SAAhB;AAA0B,MAAA,IAAI,EAAGS;AAAjC,OACGJ,aADH,CAFF,EAMC,4BAAC,kBAAD;AACC,MAAA,OAAO,EAAGL,WAAW,GAAG,SAAH,GAAe,WADrC;AAEC,MAAA,IAAI,EAAGW;AAFR,OAIGJ,eAJH,CAND,CA3BD,CAPD,EAgDGhC,QAhDH,CADD;AAoDA;;AA9GkD;;eAiHrC,sBAAcuB,MAAF,IAAc;AACxC,QAAM;AAAEkB,IAAAA,sBAAF;AAA0BC,IAAAA,cAA1B;AAA0CC,IAAAA;AAA1C,MACLpB,MAAM,CAAEqB,YAAF,CADP;AAEA,QAAM;AAAEC,IAAAA;AAAF,MAAkBtB,MAAM,CAAEuB,eAAF,CAA9B;AAEA,SAAO;AACNtD,IAAAA,IAAI,EAAEkD,cAAc,EADd;AAENhB,IAAAA,QAAQ,EAAEmB,WAAW,CAAEJ,sBAAsB,CAAE,MAAF,CAAxB,CAFf;AAGNhB,IAAAA,WAAW,EAAEkB,sBAAsB;AAH7B,GAAP;AAKA,CAVc,EAUVzC,2BAVU,C","sourcesContent":["/**\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%';\nconst PAGENAME = '%pagename%';\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\tif ( post.permalink_template.includes( PAGENAME ) ) {\n\t\treturn post.permalink_template.replace( PAGENAME, 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 = postType?.labels?.singular_name;\n\t\tconst viewPostLabel = postType?.labels?.view_item;\n\t\tconst addNewPostLabel = 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\t__nextHasNoMarginBottom\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"]}
@@ -39,6 +39,8 @@ var _store = require("../../store");
39
39
 
40
40
  var _maybeCategoryPanel = _interopRequireDefault(require("./maybe-category-panel"));
41
41
 
42
+ var _maybeUploadMedia = _interopRequireDefault(require("./maybe-upload-media"));
43
+
42
44
  /**
43
45
  * WordPress dependencies
44
46
  */
@@ -46,10 +48,9 @@ var _maybeCategoryPanel = _interopRequireDefault(require("./maybe-category-panel
46
48
  /**
47
49
  * Internal dependencies
48
50
  */
49
- function PostPublishPanelPrepublish(_ref) {
50
- let {
51
- children
52
- } = _ref;
51
+ function PostPublishPanelPrepublish({
52
+ children
53
+ }) {
53
54
  const {
54
55
  isBeingScheduled,
55
56
  isRequestingSiteIcon,
@@ -58,7 +59,7 @@ function PostPublishPanelPrepublish(_ref) {
58
59
  siteTitle,
59
60
  siteHome
60
61
  } = (0, _data.useSelect)(select => {
61
- var _getCurrentPost$_link, _getCurrentPost$_link2;
62
+ var _getCurrentPost$_link;
62
63
 
63
64
  const {
64
65
  getCurrentPost,
@@ -70,7 +71,7 @@ function PostPublishPanelPrepublish(_ref) {
70
71
  } = select(_coreData.store);
71
72
  const siteData = getEntityRecord('root', '__unstableBase', undefined) || {};
72
73
  return {
73
- hasPublishAction: (_getCurrentPost$_link = (_getCurrentPost$_link2 = getCurrentPost()._links) === null || _getCurrentPost$_link2 === void 0 ? void 0 : _getCurrentPost$_link2['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false,
74
+ hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false,
74
75
  isBeingScheduled: isEditedPostBeingScheduled(),
75
76
  isRequestingSiteIcon: isResolving('getEntityRecord', ['root', '__unstableBase', undefined]),
76
77
  siteIconUrl: siteData.site_icon_url,
@@ -119,7 +120,7 @@ function PostPublishPanelPrepublish(_ref) {
119
120
  className: "components-site-name"
120
121
  }, (0, _htmlEntities.decodeEntities)(siteTitle) || (0, _i18n.__)('(Untitled)')), (0, _element.createElement)("span", {
121
122
  className: "components-site-home"
122
- }, siteHome))), hasPublishAction && (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.PanelBody, {
123
+ }, siteHome))), (0, _element.createElement)(_maybeUploadMedia.default, null), hasPublishAction && (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.PanelBody, {
123
124
  initialOpen: false,
124
125
  title: [(0, _i18n.__)('Visibility:'), (0, _element.createElement)("span", {
125
126
  className: "editor-post-publish-panel__link",
@@ -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","_links","site_icon_url","name","home","siteIcon","wordpress","prePublishTitle","prePublishBodyText"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AArBA;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;AAAA;;AAC5B,UAAM;AAAEC,MAAAA,cAAF;AAAkBC,MAAAA;AAAlB,QACLF,MAAM,CAAEG,YAAF,CADP;AAEA,UAAM;AAAEC,MAAAA,eAAF;AAAmBC,MAAAA;AAAnB,QAAmCL,MAAM,CAAEM,eAAF,CAA/C;AACA,UAAMC,QAAQ,GACbH,eAAe,CAAE,MAAF,EAAU,gBAAV,EAA4BI,SAA5B,CAAf,IAA0D,EAD3D;AAGA,WAAO;AACNZ,MAAAA,gBAAgB,qDACfK,cAAc,GAAGQ,MADF,2DACf,uBAA2B,mBAA3B,CADe,yEACqC,KAF/C;AAGNf,MAAAA,gBAAgB,EAAEQ,0BAA0B,EAHtC;AAINP,MAAAA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JD,EAKC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGH,QADH,EAEC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACG,kCAAgBf,SAAhB,KAA+B,cAAI,YAAJ,CADlC,CADD,EAIC;AAAM,IAAA,SAAS,EAAC;AAAhB,KAAyCC,QAAzC,CAJD,CAFD,CALD,EAcGH,gBAAgB,IACjB,qDACC,4BAAC,qBAAD;AACC,IAAA,WAAW,EAAG,KADf;AAEC,IAAA,KAAK,EAAG,CACP,cAAI,aAAJ,CADO,EAEP;AACC,MAAA,SAAS,EAAC,iCADX;AAEC,MAAA,GAAG,EAAC;AAFL,OAIC,4BAAC,cAAD,OAJD,CAFO;AAFT,KAYC,4BAAC,uBAAD,OAZD,CADD,EAeC,4BAAC,qBAAD;AACC,IAAA,WAAW,EAAG,KADf;AAEC,IAAA,KAAK,EAAG,CACP,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 * 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:\n\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\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","_links","site_icon_url","name","home","siteIcon","wordpress","prePublishTitle","prePublishBodyText"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAtBA;AACA;AACA;;AASA;AACA;AACA;AAWA,SAASA,0BAAT,CAAqC;AAAEC,EAAAA;AAAF,CAArC,EAAoD;AACnD,QAAM;AACLC,IAAAA,gBADK;AAELC,IAAAA,oBAFK;AAGLC,IAAAA,gBAHK;AAILC,IAAAA,WAJK;AAKLC,IAAAA,SALK;AAMLC,IAAAA;AANK,MAOF,qBAAaC,MAAF,IAAc;AAAA;;AAC5B,UAAM;AAAEC,MAAAA,cAAF;AAAkBC,MAAAA;AAAlB,QACLF,MAAM,CAAEG,YAAF,CADP;AAEA,UAAM;AAAEC,MAAAA,eAAF;AAAmBC,MAAAA;AAAnB,QAAmCL,MAAM,CAAEM,eAAF,CAA/C;AACA,UAAMC,QAAQ,GACbH,eAAe,CAAE,MAAF,EAAU,gBAAV,EAA4BI,SAA5B,CAAf,IAA0D,EAD3D;AAGA,WAAO;AACNZ,MAA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kB,GAAG,cACpB,+CADoB,CAArB;AAGA;;AAED,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,yCACC,4CAAUD,eAAV,CADD,CADD,EAIC,uCAAKC,kBAAL,CAJD,EAKC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGH,QADH,EAEC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACG,kCAAgBf,SAAhB,KAA+B,cAAI,YAAJ,CADlC,CADD,EAIC;AAAM,IAAA,SAAS,EAAC;AAAhB,KAAyCC,QAAzC,CAJD,CAFD,CALD,EAcC,4BAAC,yBAAD,OAdD,EAeGH,gBAAgB,IACjB,qDACC,4BAAC,qBAAD;AACC,IAAA,WAAW,EAAG,KADf;AAEC,IAAA,KAAK,EAAG,CACP,cAAI,aAAJ,CADO,EAEP;AACC,MAAA,SAAS,EAAC,iCADX;AAEC,MAAA,GAAG,EAAC;AAFL,OAIC,4BAAC,cAAD,OAJD,CAFO;AAFT,KAYC,4BAAC,uBAAD,OAZD,CADD,EAeC,4BAAC,qBAAD;AACC,IAAA,WAAW,EAAG,KADf;AAEC,IAAA,KAAK,EAAG,CACP,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,CAhBF,EA+CC,4BAAC,6BAAD,OA/CD,EAgDC,4BAAC,uBAAD,OAhDD,EAiDC,4BAAC,2BAAD,OAjDD,EAkDGH,QAlDH,CADD;AAsDA;;eAEcD,0B","sourcesContent":["/**\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';\nimport MaybeUploadMedia from './maybe-upload-media';\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:\n\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\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<MaybeUploadMedia />\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"]}
@@ -49,12 +49,11 @@ var _store = require("../../store");
49
49
  * @param {?boolean} props.showIconLabels Whether interface buttons show labels instead of icons
50
50
  * @return {import('@wordpress/element').WPComponent} The component.
51
51
  */
52
- function PostSavedState(_ref) {
53
- let {
54
- forceIsDirty,
55
- forceIsSaving,
56
- showIconLabels = false
57
- } = _ref;
52
+ function PostSavedState({
53
+ forceIsDirty,
54
+ forceIsSaving,
55
+ showIconLabels = false
56
+ }) {
58
57
  const [forceSavedMessage, setForceSavedMessage] = (0, _element.useState)(false);
59
58
  const isLargeViewport = (0, _compose.useViewportMatch)('small');
60
59
  const {
@@ -62,11 +61,13 @@ function PostSavedState(_ref) {
62
61
  isDirty,
63
62
  isNew,
64
63
  isPending,
64
+ isPublished,
65
65
  isSaveable,
66
66
  isSaving,
67
+ isScheduled,
67
68
  hasPublishAction
68
69
  } = (0, _data.useSelect)(select => {
69
- var _getCurrentPost$_link, _getCurrentPost, _getCurrentPost$_link2;
70
+ var _getCurrentPost$_link;
70
71
 
71
72
  const {
72
73
  isEditedPostNew,
@@ -88,7 +89,7 @@ function PostSavedState(_ref) {
88
89
  isSaving: forceIsSaving || isSavingPost(),
89
90
  isSaveable: isEditedPostSaveable(),
90
91
  isScheduled: isCurrentPostScheduled(),
91
- hasPublishAction: (_getCurrentPost$_link = (_getCurrentPost = getCurrentPost()) === null || _getCurrentPost === void 0 ? void 0 : (_getCurrentPost$_link2 = _getCurrentPost._links) === null || _getCurrentPost$_link2 === void 0 ? void 0 : _getCurrentPost$_link2['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false
92
+ hasPublishAction: (_getCurrentPost$_link = getCurrentPost()?._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false
92
93
  };
93
94
  }, [forceIsDirty, forceIsSaving]);
94
95
  const {
@@ -112,6 +113,10 @@ function PostSavedState(_ref) {
112
113
  if (!hasPublishAction && isPending) {
113
114
  return null;
114
115
  }
116
+
117
+ if (isPublished || isScheduled) {
118
+ return null;
119
+ }
115
120
  /* translators: button label text should, if possible, be under 16 characters. */
116
121
 
117
122
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-saved-state/index.js"],"names":["PostSavedState","forceIsDirty","forceIsSaving","showIconLabels","forceSavedMessage","setForceSavedMessage","isLargeViewport","isAutosaving","isDirty","isNew","isPending","isSaveable","isSaving","hasPublishAction","select","isEditedPostNew","isCurrentPostPublished","isCurrentPostScheduled","isEditedPostDirty","isSavingPost","isEditedPostSaveable","getCurrentPost","isAutosavingPost","getEditedPostAttribute","editorStore","isPublished","isScheduled","_links","savePost","wasSaving","timeoutId","setTimeout","clearTimeout","label","shortLabel","isSaved","isSavedState","isDisabled","text","type","undefined","displayShortcut","primary","cloudUpload","check","cloud"],"mappings":";;;;;;;;;AAcA;;AAXA;;AAKA;;AAIA;;AACA;;AAEA;;AACA;;AACA;;AAKA;;AAtBA;AACA;AACA;;AAGA;AACA;AACA;;AAYA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,c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FH;AACA;;;AACA,SACC,4BAAC,kBAAD;AACC,IAAA,SAAS,EACRvB,UAAU,IAAIC,QAAd,GACG,yBAAY;AACZ,gCAA0B,CAAEwB,YADhB;AAEZ,iCAA2BA,YAFf;AAGZ,mBAAaxB,QAHD;AAIZ,uBAAiBL,YAJL;AAKZ,kBAAY4B,OALA;AAMZ,OAAE,+CAAqB;AACtBI,QAAAA,IAAI,EAAE;AADgB,OAArB,CAAF,GAEO3B;AARK,KAAZ,CADH,GAWG4B,SAbL;AAeC,IAAA,OAAO,EAAGH,UAAU,GAAGG,SAAH,GAAe,MAAMZ,QAAQ;AACjD;AACH;AACA;AACA;AAnBE;AAoBC,IAAA,QAAQ,EAAGS,UAAU,GAAGG,SAAH,GAAeC,0BAAgBC,OAAhB,CAAyB,GAAzB;AACpC;AACH;AACA;AACA;AACA;AACA;AA1BE;AA2BC,IAAA,WAAW,MA3BZ;AA4BC,IAAA,OAAO,EAAC,UA5BT;AA6BC,IAAA,IAAI,EAAGpC,eAAe,GAAGkC,SAAH,GAAeG,kBA7BtC,CA8BC;AA9BD;AA+BC,IAAA,KAAK,EAAGL,IAAI,IAAIL,KA/BjB;AAgCC,qBAAgBI;AAhCjB,KAkCGD,YAAY,IAAI,4BAAC,WAAD;AAAM,IAAA,IAAI,EAAGD,OAAO,GAAGS,YAAH,GAAWC;AAA/B,IAlCnB,EAmCGP,IAnCH,CADD;AAuCA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__unstableGetAnimateClassName as getAnimateClassName,\n\tButton,\n} from '@wordpress/components';\nimport { usePrevious, useViewportMatch } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Icon, check, cloud, cloudUpload } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Component showing whether the post is saved or not and providing save\n * buttons.\n *\n * @param {Object} props Component props.\n * @param {?boolean} props.forceIsDirty Whether to force the post to be marked\n * as dirty.\n * @param {?boolean} props.forceIsSaving Whether to force the post to be marked\n * as being saved.\n * @param {?boolean} props.showIconLabels Whether interface buttons show labels instead of icons\n * @return {import('@wordpress/element').WPComponent} The component.\n */\nexport default function PostSavedState( {\n\tforceIsDirty,\n\tforceIsSaving,\n\tshowIconLabels = false,\n} ) {\n\tconst [ forceSavedMessage, setForceSavedMessage ] = useState( false );\n\tconst isLargeViewport = useViewportMatch( 'small' );\n\n\tconst {\n\t\tisAutosaving,\n\t\tisDirty,\n\t\tisNew,\n\t\tisPending,\n\t\tisSaveable,\n\t\tisSaving,\n\t\thasPublishAction,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisEditedPostNew,\n\t\t\t\tisCurrentPostPublished,\n\t\t\t\tisCurrentPostScheduled,\n\t\t\t\tisEditedPostDirty,\n\t\t\t\tisSavingPost,\n\t\t\t\tisEditedPostSaveable,\n\t\t\t\tgetCurrentPost,\n\t\t\t\tisAutosavingPost,\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t} = select( editorStore );\n\n\t\t\treturn {\n\t\t\t\tisAutosaving: isAutosavingPost(),\n\t\t\t\tisDirty: forceIsDirty || isEditedPostDirty(),\n\t\t\t\tisNew: isEditedPostNew(),\n\t\t\t\tisPending: 'pending' === getEditedPostAttribute( 'status' ),\n\t\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\t\tisSaving: forceIsSaving || isSavingPost(),\n\t\t\t\tisSaveable: isEditedPostSaveable(),\n\t\t\t\tisScheduled: isCurrentPostScheduled(),\n\t\t\t\thasPublishAction:\n\t\t\t\t\tgetCurrentPost()?._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\t};\n\t\t},\n\t\t[ forceIsDirty, forceIsSaving ]\n\t);\n\n\tconst { savePost } = useDispatch( editorStore );\n\n\tconst wasSaving = usePrevious( isSaving );\n\n\tuseEffect( () => {\n\t\tlet timeoutId;\n\n\t\tif ( wasSaving && ! isSaving ) {\n\t\t\tsetForceSavedMessage( true );\n\t\t\ttimeoutId = setTimeout( () => {\n\t\t\t\tsetForceSavedMessage( false );\n\t\t\t}, 1000 );\n\t\t}\n\n\t\treturn () => clearTimeout( timeoutId );\n\t}, [ isSaving ] );\n\n\t// Once the post has been submitted for review this button\n\t// is not needed for the contributor role.\n\tif ( ! hasPublishAction && isPending ) {\n\t\treturn null;\n\t}\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst label = isPending ? __( 'Save as pending' ) : __( 'Save draft' );\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst shortLabel = __( 'Save' );\n\n\tconst isSaved = forceSavedMessage || ( ! isNew && ! isDirty );\n\tconst isSavedState = isSaving || isSaved;\n\tconst isDisabled = isSaving || isSaved || ! isSaveable;\n\n\tlet text;\n\n\tif ( isSaving ) {\n\t\ttext = isAutosaving ? __( 'Autosaving' ) : __( 'Saving' );\n\t} else if ( isSaved ) {\n\t\ttext = __( 'Saved' );\n\t} else if ( isLargeViewport ) {\n\t\ttext = label;\n\t} else if ( showIconLabels ) {\n\t\ttext = shortLabel;\n\t}\n\n\t// Use common Button instance for all saved states so that focus is not\n\t// lost.\n\treturn (\n\t\t<Button\n\t\t\tclassName={\n\t\t\t\tisSaveable || isSaving\n\t\t\t\t\t? classnames( {\n\t\t\t\t\t\t\t'editor-post-save-draft': ! isSavedState,\n\t\t\t\t\t\t\t'editor-post-saved-state': isSavedState,\n\t\t\t\t\t\t\t'is-saving': isSaving,\n\t\t\t\t\t\t\t'is-autosaving': isAutosaving,\n\t\t\t\t\t\t\t'is-saved': isSaved,\n\t\t\t\t\t\t\t[ getAnimateClassName( {\n\t\t\t\t\t\t\t\ttype: 'loading',\n\t\t\t\t\t\t\t} ) ]: isSaving,\n\t\t\t\t\t } )\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t\tonClick={ isDisabled ? undefined : () => savePost() }\n\t\t\t/*\n\t\t\t * We want the tooltip to show the keyboard shortcut only when the\n\t\t\t * button does something, i.e. when it's not disabled.\n\t\t\t */\n\t\t\tshortcut={ isDisabled ? undefined : displayShortcut.primary( 's' ) }\n\t\t\t/*\n\t\t\t * Displaying the keyboard shortcut conditionally makes the tooltip\n\t\t\t * itself show conditionally. This would trigger a full-rerendering\n\t\t\t * of the button that we want to avoid. By setting `showTooltip`,\n\t\t\t & the tooltip is always rendered even when there's no keyboard shortcut.\n\t\t\t */\n\t\t\tshowTooltip\n\t\t\tvariant=\"tertiary\"\n\t\t\ticon={ isLargeViewport ? undefined : cloudUpload }\n\t\t\t// Make sure the aria-label has always a value, as the default `text` is undefined on small screens.\n\t\t\tlabel={ text || label }\n\t\t\taria-disabled={ isDisabled }\n\t\t>\n\t\t\t{ isSavedState && <Icon icon={ isSaved ? check : cloud } /> }\n\t\t\t{ text }\n\t\t</Button>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-saved-state/index.js"],"names":["PostSavedState","forceIsDirty","forceIsSaving","showIconLabels","forceSavedMessage","setForceSavedMessage","isLargeViewport","isAutosaving","isDirty","isNew","isPending","isPublished","isSaveable","isSaving","isScheduled","hasPublishAction","select","isEditedPostNew","isCurrentPostPublished","isCurrentPostScheduled","isEditedPostDirty","isSavingPost","isEditedPostSaveable","getCurrentPost","isAutosavingPost","getEditedPostAttribute","editorStore","_links","savePost","wasSaving","timeoutId","setTimeout","clearTimeout","label","shortLabel","isSaved","isSavedState","isDisabled","text","type","undefined","displayShortcut","primary","cloudUpload","check","cloud"],"mappings":";;;;;;;;;AAcA;;AAXA;;AAKA;;AAIA;;AACA;;AAEA;;AACA;;AACA;;AAKA;;AAtBA;AACA;AACA;;AAGA;AACA;AACA;;AAYA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,cAAT,CAAyB;AACv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cAAL,EAAsB;AAC5BmC,IAAAA,IAAI,GAAGJ,UAAP;AACA,GA3FE,CA6FH;AACA;;;AACA,SACC,4BAAC,kBAAD;AACC,IAAA,SAAS,EACRtB,UAAU,IAAIC,QAAd,GACG,yBAAY;AACZ,gCAA0B,CAAEuB,YADhB;AAEZ,iCAA2BA,YAFf;AAGZ,mBAAavB,QAHD;AAIZ,uBAAiBN,YAJL;AAKZ,kBAAY4B,OALA;AAMZ,OAAE,+CAAqB;AACtBI,QAAAA,IAAI,EAAE;AADgB,OAArB,CAAF,GAEO1B;AARK,KAAZ,CADH,GAWG2B,SAbL;AAeC,IAAA,OAAO,EAAGH,UAAU,GAAGG,SAAH,GAAe,MAAMZ,QAAQ;AACjD;AACH;AACA;AACA;AAnBE;AAoBC,IAAA,QAAQ,EAAGS,UAAU,GAAGG,SAAH,GAAeC,0BAAgBC,OAAhB,CAAyB,GAAzB;AACpC;AACH;AACA;AACA;AACA;AACA;AA1BE;AA2BC,IAAA,WAAW,MA3BZ;AA4BC,IAAA,OAAO,EAAC,UA5BT;AA6BC,IAAA,IAAI,EAAGpC,eAAe,GAAGkC,SAAH,GAAeG,kBA7BtC,CA8BC;AA9BD;AA+BC,IAAA,KAAK,EAAGL,IAAI,IAAIL,KA/BjB;AAgCC,qBAAgBI;AAhCjB,KAkCGD,YAAY,IAAI,4BAAC,WAAD;AAAM,IAAA,IAAI,EAAGD,OAAO,GAAGS,YAAH,GAAWC;AAA/B,IAlCnB,EAmCGP,IAnCH,CADD;AAuCA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__unstableGetAnimateClassName as getAnimateClassName,\n\tButton,\n} from '@wordpress/components';\nimport { usePrevious, useViewportMatch } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Icon, check, cloud, cloudUpload } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Component showing whether the post is saved or not and providing save\n * buttons.\n *\n * @param {Object} props Component props.\n * @param {?boolean} props.forceIsDirty Whether to force the post to be marked\n * as dirty.\n * @param {?boolean} props.forceIsSaving Whether to force the post to be marked\n * as being saved.\n * @param {?boolean} props.showIconLabels Whether interface buttons show labels instead of icons\n * @return {import('@wordpress/element').WPComponent} The component.\n */\nexport default function PostSavedState( {\n\tforceIsDirty,\n\tforceIsSaving,\n\tshowIconLabels = false,\n} ) {\n\tconst [ forceSavedMessage, setForceSavedMessage ] = useState( false );\n\tconst isLargeViewport = useViewportMatch( 'small' );\n\n\tconst {\n\t\tisAutosaving,\n\t\tisDirty,\n\t\tisNew,\n\t\tisPending,\n\t\tisPublished,\n\t\tisSaveable,\n\t\tisSaving,\n\t\tisScheduled,\n\t\thasPublishAction,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisEditedPostNew,\n\t\t\t\tisCurrentPostPublished,\n\t\t\t\tisCurrentPostScheduled,\n\t\t\t\tisEditedPostDirty,\n\t\t\t\tisSavingPost,\n\t\t\t\tisEditedPostSaveable,\n\t\t\t\tgetCurrentPost,\n\t\t\t\tisAutosavingPost,\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t} = select( editorStore );\n\n\t\t\treturn {\n\t\t\t\tisAutosaving: isAutosavingPost(),\n\t\t\t\tisDirty: forceIsDirty || isEditedPostDirty(),\n\t\t\t\tisNew: isEditedPostNew(),\n\t\t\t\tisPending: 'pending' === getEditedPostAttribute( 'status' ),\n\t\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\t\tisSaving: forceIsSaving || isSavingPost(),\n\t\t\t\tisSaveable: isEditedPostSaveable(),\n\t\t\t\tisScheduled: isCurrentPostScheduled(),\n\t\t\t\thasPublishAction:\n\t\t\t\t\tgetCurrentPost()?._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\t};\n\t\t},\n\t\t[ forceIsDirty, forceIsSaving ]\n\t);\n\n\tconst { savePost } = useDispatch( editorStore );\n\n\tconst wasSaving = usePrevious( isSaving );\n\n\tuseEffect( () => {\n\t\tlet timeoutId;\n\n\t\tif ( wasSaving && ! isSaving ) {\n\t\t\tsetForceSavedMessage( true );\n\t\t\ttimeoutId = setTimeout( () => {\n\t\t\t\tsetForceSavedMessage( false );\n\t\t\t}, 1000 );\n\t\t}\n\n\t\treturn () => clearTimeout( timeoutId );\n\t}, [ isSaving ] );\n\n\t// Once the post has been submitted for review this button\n\t// is not needed for the contributor role.\n\tif ( ! hasPublishAction && isPending ) {\n\t\treturn null;\n\t}\n\n\tif ( isPublished || isScheduled ) {\n\t\treturn null;\n\t}\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst label = isPending ? __( 'Save as pending' ) : __( 'Save draft' );\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst shortLabel = __( 'Save' );\n\n\tconst isSaved = forceSavedMessage || ( ! isNew && ! isDirty );\n\tconst isSavedState = isSaving || isSaved;\n\tconst isDisabled = isSaving || isSaved || ! isSaveable;\n\n\tlet text;\n\n\tif ( isSaving ) {\n\t\ttext = isAutosaving ? __( 'Autosaving' ) : __( 'Saving' );\n\t} else if ( isSaved ) {\n\t\ttext = __( 'Saved' );\n\t} else if ( isLargeViewport ) {\n\t\ttext = label;\n\t} else if ( showIconLabels ) {\n\t\ttext = shortLabel;\n\t}\n\n\t// Use common Button instance for all saved states so that focus is not\n\t// lost.\n\treturn (\n\t\t<Button\n\t\t\tclassName={\n\t\t\t\tisSaveable || isSaving\n\t\t\t\t\t? classnames( {\n\t\t\t\t\t\t\t'editor-post-save-draft': ! isSavedState,\n\t\t\t\t\t\t\t'editor-post-saved-state': isSavedState,\n\t\t\t\t\t\t\t'is-saving': isSaving,\n\t\t\t\t\t\t\t'is-autosaving': isAutosaving,\n\t\t\t\t\t\t\t'is-saved': isSaved,\n\t\t\t\t\t\t\t[ getAnimateClassName( {\n\t\t\t\t\t\t\t\ttype: 'loading',\n\t\t\t\t\t\t\t} ) ]: isSaving,\n\t\t\t\t\t } )\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t\tonClick={ isDisabled ? undefined : () => savePost() }\n\t\t\t/*\n\t\t\t * We want the tooltip to show the keyboard shortcut only when the\n\t\t\t * button does something, i.e. when it's not disabled.\n\t\t\t */\n\t\t\tshortcut={ isDisabled ? undefined : displayShortcut.primary( 's' ) }\n\t\t\t/*\n\t\t\t * Displaying the keyboard shortcut conditionally makes the tooltip\n\t\t\t * itself show conditionally. This would trigger a full-rerendering\n\t\t\t * of the button that we want to avoid. By setting `showTooltip`,\n\t\t\t & the tooltip is always rendered even when there's no keyboard shortcut.\n\t\t\t */\n\t\t\tshowTooltip\n\t\t\tvariant=\"tertiary\"\n\t\t\ticon={ isLargeViewport ? undefined : cloudUpload }\n\t\t\t// Make sure the aria-label has always a value, as the default `text` is undefined on small screens.\n\t\t\tlabel={ text || label }\n\t\t\taria-disabled={ isDisabled }\n\t\t>\n\t\t\t{ isSavedState && <Icon icon={ isSaved ? check : cloud } /> }\n\t\t\t{ text }\n\t\t</Button>\n\t);\n}\n"]}
@@ -19,12 +19,10 @@ var _store = require("../../store");
19
19
  /**
20
20
  * Internal dependencies
21
21
  */
22
- function PostScheduleCheck(_ref) {
23
- let {
24
- hasPublishAction,
25
- children
26
- } = _ref;
27
-
22
+ function PostScheduleCheck({
23
+ hasPublishAction,
24
+ children
25
+ }) {
28
26
  if (!hasPublishAction) {
29
27
  return null;
30
28
  }
@@ -33,14 +31,14 @@ function PostScheduleCheck(_ref) {
33
31
  }
34
32
 
35
33
  var _default = (0, _compose.compose)([(0, _data.withSelect)(select => {
36
- var _getCurrentPost$_link, _getCurrentPost$_link2;
34
+ var _getCurrentPost$_link;
37
35
 
38
36
  const {
39
37
  getCurrentPost,
40
38
  getCurrentPostType
41
39
  } = select(_store.store);
42
40
  return {
43
- hasPublishAction: (_getCurrentPost$_link = (_getCurrentPost$_link2 = getCurrentPost()._links) === null || _getCurrentPost$_link2 === void 0 ? void 0 : _getCurrentPost$_link2['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false,
41
+ hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false,
44
42
  postType: getCurrentPostType()
45
43
  };
46
44
  })])(PostScheduleCheck);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-schedule/check.js"],"names":["PostScheduleCheck","hasPublishAction","children","select","getCurrentPost","getCurrentPostType","editorStore","_links","postType"],"mappings":";;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGO,SAASA,iBAAT,OAA6D;AAAA,MAAjC;AAAEC,IAAAA,gBAAF;AAAoBC,IAAAA;AAApB,GAAiC;;AACnE,MAAK,CAAED,gBAAP,EAA0B;AACzB,WAAO,IAAP;AACA;;AAED,SAAOC,QAAP;AACA;;eAEc,sBAAS,CACvB,sBAAcC,MAAF,IAAc;AAAA;;AACzB,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,MAAyCF,MAAM,CAAEG,YAAF,CAArD;AACA,SAAO;AACNL,IAAAA,gBAAgB,qDACfG,cAAc,GAAGG,MADF,2DACf,uBAA2B,mBAA3B,CADe,yEACqC,KAF/C;AAGNC,IAAAA,QAAQ,EAAEH,kBAAkB;AAHtB,GAAP;AAKA,CAPD,CADuB,CAAT,EASVL,iBATU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { compose } from '@wordpress/compose';\nimport { withSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function PostScheduleCheck( { hasPublishAction, children } ) {\n\tif ( ! hasPublishAction ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getCurrentPost, getCurrentPostType } = select( editorStore );\n\t\treturn {\n\t\t\thasPublishAction:\n\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t} ),\n] )( PostScheduleCheck );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-schedule/check.js"],"names":["PostScheduleCheck","hasPublishAction","children","select","getCurrentPost","getCurrentPostType","editorStore","_links","postType"],"mappings":";;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGO,SAASA,iBAAT,CAA4B;AAAEC,EAAAA,gBAAF;AAAoBC,EAAAA;AAApB,CAA5B,EAA6D;AACnE,MAAK,CAAED,gBAAP,EAA0B;AACzB,WAAO,IAAP;AACA;;AAED,SAAOC,QAAP;AACA;;eAEc,sBAAS,CACvB,sBAAcC,MAAF,IAAc;AAAA;;AACzB,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,MAAyCF,MAAM,CAAEG,YAAF,CAArD;AACA,SAAO;AACNL,IAAAA,gBAAgB,2BACfG,cAAc,GAAGG,MAAjB,GAA2B,mBAA3B,CADe,yEACqC,KAF/C;AAGNC,IAAAA,QAAQ,EAAEH,kBAAkB;AAHtB,GAAP;AAKA,CAPD,CADuB,CAAT,EASVL,iBATU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { compose } from '@wordpress/compose';\nimport { withSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function PostScheduleCheck( { hasPublishAction, children } ) {\n\tif ( ! hasPublishAction ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getCurrentPost, getCurrentPostType } = select( editorStore );\n\t\treturn {\n\t\t\thasPublishAction:\n\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t} ),\n] )( PostScheduleCheck );\n"]}
@@ -30,10 +30,9 @@ var _store = require("../../store");
30
30
  /**
31
31
  * Internal dependencies
32
32
  */
33
- function PostSchedule(_ref) {
34
- let {
35
- onClose
36
- } = _ref;
33
+ function PostSchedule({
34
+ onClose
35
+ }) {
37
36
  const {
38
37
  postDate,
39
38
  postType
@@ -59,14 +58,11 @@ function PostSchedule(_ref) {
59
58
  per_page: 100,
60
59
  _fields: 'id,date'
61
60
  }), [previewedMonth, postType]);
62
- const events = (0, _element.useMemo)(() => (eventsByPostType || []).map(_ref2 => {
63
- let {
64
- date: eventDate
65
- } = _ref2;
66
- return {
67
- date: new Date(eventDate)
68
- };
69
- }), [eventsByPostType]);
61
+ const events = (0, _element.useMemo)(() => (eventsByPostType || []).map(({
62
+ date: eventDate
63
+ }) => ({
64
+ date: new Date(eventDate)
65
+ })), [eventsByPostType]);
70
66
  const settings = (0, _date.getSettings)(); // To know if the current timezone is a 12 hour time with look for "a" in the time format
71
67
  // We also make sure this a is not escaped by a "/"
72
68
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-schedule/index.js"],"names":["PostSchedule","onClose","postDate","postType","select","editorStore","getEditedPostAttribute","getCurrentPostType","editPost","onUpdateDate","date","previewedMonth","setPreviewedMonth","Date","eventsByPostType","coreStore","getEntityRecords","status","after","toISOString","before","exclude","getCurrentPostId","per_page","_fields","events","map","eventDate","settings","is12HourTime","test","formats","time","toLowerCase","replace","split","reverse","join"],"mappings":";;;;;;;AAWA;;AARA;;AAKA;;AACA;;AACA;;AAEA;;AAKA;;AAjBA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AAGe,SAASA,YAAT,OAAqC;AAAA,MAAd;AAAEC,IAAAA;AAAF,GAAc;AACnD,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAyB,qBAC5BC,MAAF,KAAgB;AACfF,IAAAA,QA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Kd,CAAEb,gBAAF,CALc,CAAf;AAQA,QAAMc,QAAQ,GAAG,wBAAjB,CAtCmD,CAwCnD;AACA;;AACA,QAAMC,YAAY,GAAG,WAAWC,IAAX,CACpBF,QAAQ,CAACG,OAAT,CAAiBC,IAAjB,CACEC,WADF,GACgB;AADhB,GAEEC,OAFF,CAEW,OAFX,EAEoB,EAFpB,EAEyB;AAFzB,GAGEC,KAHF,CAGS,EAHT,EAIEC,OAJF,GAKEC,IALF,CAKQ,EALR,CADoB,CAMP;AANO,GAArB;AASA,SACC,4BAAC,gDAAD;AACC,IAAA,WAAW,EAAGnC,QADf;AAEC,IAAA,QAAQ,EAAGO,YAFZ;AAGC,IAAA,QAAQ,EAAGoB,YAHZ;AAIC,IAAA,MAAM,EAAGJ,MAJV;AAKC,IAAA,gBAAgB,EAAKf,IAAF,IAClBE,iBAAiB,CAAE,uBAAUF,IAAV,CAAF,CANnB;AAQC,IAAA,OAAO,EAAGT;AARX,IADD;AAYA","sourcesContent":["/**\n * External dependencies\n */\nimport { parseISO, endOfMonth, startOfMonth } from 'date-fns';\n\n/**\n * WordPress dependencies\n */\nimport { getSettings } from '@wordpress/date';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __experimentalPublishDateTimePicker as PublishDateTimePicker } from '@wordpress/block-editor';\nimport { useState, useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function PostSchedule( { onClose } ) {\n\tconst { postDate, postType } = useSelect(\n\t\t( select ) => ( {\n\t\t\tpostDate: select( editorStore ).getEditedPostAttribute( 'date' ),\n\t\t\tpostType: select( editorStore ).getCurrentPostType(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\tconst onUpdateDate = ( date ) => editPost( { date } );\n\n\tconst [ previewedMonth, setPreviewedMonth ] = useState(\n\t\tstartOfMonth( new Date( postDate ) )\n\t);\n\n\t// Pick up published and schduled site posts.\n\tconst eventsByPostType = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecords( 'postType', postType, {\n\t\t\t\tstatus: 'publish,future',\n\t\t\t\tafter: startOfMonth( previewedMonth ).toISOString(),\n\t\t\t\tbefore: endOfMonth( previewedMonth ).toISOString(),\n\t\t\t\texclude: [ select( editorStore ).getCurrentPostId() ],\n\t\t\t\tper_page: 100,\n\t\t\t\t_fields: 'id,date',\n\t\t\t} ),\n\t\t[ previewedMonth, postType ]\n\t);\n\n\tconst events = useMemo(\n\t\t() =>\n\t\t\t( eventsByPostType || [] ).map( ( { date: eventDate } ) => ( {\n\t\t\t\tdate: new Date( eventDate ),\n\t\t\t} ) ),\n\t\t[ eventsByPostType ]\n\t);\n\n\tconst settings = getSettings();\n\n\t// To know if the current timezone is a 12 hour time with look for \"a\" in the time format\n\t// We also make sure this a is not escaped by a \"/\"\n\tconst is12HourTime = /a(?!\\\\)/i.test(\n\t\tsettings.formats.time\n\t\t\t.toLowerCase() // Test only the lower case a.\n\t\t\t.replace( /\\\\\\\\/g, '' ) // Replace \"//\" with empty strings.\n\t\t\t.split( '' )\n\t\t\t.reverse()\n\t\t\t.join( '' ) // Reverse the string and test for \"a\" not followed by a slash.\n\t);\n\n\treturn (\n\t\t<PublishDateTimePicker\n\t\t\tcurrentDate={ postDate }\n\t\t\tonChange={ onUpdateDate }\n\t\t\tis12Hour={ is12HourTime }\n\t\t\tevents={ events }\n\t\t\tonMonthPreviewed={ ( date ) =>\n\t\t\t\tsetPreviewedMonth( parseISO( date ) )\n\t\t\t}\n\t\t\tonClose={ onClose }\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-schedule/index.js"],"names":["PostSchedule","onClose","postDate","postType","select","editorStore","getEditedPostAttribute","getCurrentPostType","editPost","onUpdateDate","date","previewedMonth","setPreviewedMonth","Date","eventsByPostType","coreStore","getEntityRecords","status","after","toISOString","before","exclude","getCurrentPostId","per_page","_fields","events","map","eventDate","settings","is12HourTime","test","formats","time","toLowerCase","replace","split","reverse","join"],"mappings":";;;;;;;AAWA;;AARA;;AAKA;;AACA;;AACA;;AAEA;;AAKA;;AAjBA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AAGe,SAASA,YAAT,CAAuB;AAAEC,EAAAA;AAAF,CAAvB,EAAqC;AACnD,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAyB,qBAC5BC,MAAF,KAAgB;AACfF,IAAAA,QAAQ,EAAEE,MAAM,CAAEC,YAAF,CAAN,CAAsBC,sBAAtB,CAA8C,MAA9C,CADK;AAEfH,IAAAA,QAAQ,EAAEC,MAAM,CAAEC,YAAF,CAAN,CAAsBE,kBAAtB;AAFK,GAAhB,CAD8B,EAK9B,EAL8B,CAA/B;AAQA,QAAM;AAAEC,IAAAA;AAAF,MAAe,uBAAaH,YAAb,CAArB;;AACA,QAAMI,YAAY,GAAKC,IAAF,IAAYF,QAAQ,CAAE;AAAEE,IAAAA;AAAF,GAAF,CAAzC;;AAEA,QAAM,CAAEC,cAAF,EAAkBC,iBAAlB,IAAwC,uBAC7C,2BAAc,IAAIC,IAAJ,CAAUX,QAAV,CAAd,CAD6C,CAA9C,CAZmD,CAgBnD;;AACA,QAAMY,gBAAgB,GAAG,qBACtBV,MAAF,IACCA,MAAM,CAAEW,eAAF,CAAN,CAAoBC,gBAApB,CAAsC,UAAtC,EAAkDb,QAAlD,EAA4D;AAC3Dc,IAAAA,MAAM,EAAE,gBADmD;AAE3DC,IAAAA,KAAK,EAAE,2BAAcP,cAAd,EAA+BQ,WAA/B,EAFoD;AAG3DC,IAAAA,MAAM,EAAE,yBAAYT,cAAZ,EAA6BQ,WAA7B,EAHmD;AAI3DE,IAAAA,OAAO,EAAE,CAAEjB,MAAM,CAAEC,YAAF,CAAN,CAAsBiB,gBAAtB,EAAF,CAJkD;AAK3DC,IAAAA,QAAQ,EAAE,GALiD;AAM3DC,IAAAA,OAAO,EAAE;AANkD,GAA5D,CAFuB,EAUxB,CAAEb,cAAF,EAAkBR,QAAlB,CAVwB,CAAzB;AAaA,QAAMsB,MAAM,GAAG,sBACd,MACC,CAAEX,gBAAgB,IAAI,EAAtB,EAA2BY,GAA3B,CAAgC,CAAE;AAAEhB,IAAAA,IAAI,EAAEiB;AAAR,GAAF,MAA6B;AAC5DjB,IAAAA,IAAI,EAAE,IAAIG,IAAJ,CAAUc,SAAV;AADsD,GAA7B,CAAhC,CAFa,EAKd,CAAEb,gBAAF,CALc,CAAf;AAQA,QAAMc,QAAQ,GAAG,wBAAjB,CAtCmD,CAwCnD;AACA;;AACA,QAAMC,YAAY,GAAG,WAAWC,IAAX,CACpBF,QAAQ,CAACG,OAAT,CAAiBC,IAAjB,CACEC,WADF,GACgB;AADhB,GAEEC,OAFF,CAEW,OAFX,EAEoB,EAFpB,EAEyB;AAFzB,GAGEC,KAHF,CAGS,EAHT,EAIEC,OAJF,GAKEC,IALF,CAKQ,EALR,CADoB,CAMP;AANO,GAArB;AASA,SACC,4BAAC,gDAAD;AACC,IAAA,WAAW,EAAGnC,QADf;AAEC,IAAA,QAAQ,EAAGO,YAFZ;AAGC,IAAA,QAAQ,EAAGoB,YAHZ;AAIC,IAAA,MAAM,EAAGJ,MAJV;AAKC,IAAA,gBAAgB,EAAKf,IAAF,IAClBE,iBAAiB,CAAE,uBAAUF,IAAV,CAAF,CANnB;AAQC,IAAA,OAAO,EAAGT;AARX,IADD;AAYA","sourcesContent":["/**\n * External dependencies\n */\nimport { parseISO, endOfMonth, startOfMonth } from 'date-fns';\n\n/**\n * WordPress dependencies\n */\nimport { getSettings } from '@wordpress/date';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __experimentalPublishDateTimePicker as PublishDateTimePicker } from '@wordpress/block-editor';\nimport { useState, useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function PostSchedule( { onClose } ) {\n\tconst { postDate, postType } = useSelect(\n\t\t( select ) => ( {\n\t\t\tpostDate: select( editorStore ).getEditedPostAttribute( 'date' ),\n\t\t\tpostType: select( editorStore ).getCurrentPostType(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\tconst onUpdateDate = ( date ) => editPost( { date } );\n\n\tconst [ previewedMonth, setPreviewedMonth ] = useState(\n\t\tstartOfMonth( new Date( postDate ) )\n\t);\n\n\t// Pick up published and schduled site posts.\n\tconst eventsByPostType = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecords( 'postType', postType, {\n\t\t\t\tstatus: 'publish,future',\n\t\t\t\tafter: startOfMonth( previewedMonth ).toISOString(),\n\t\t\t\tbefore: endOfMonth( previewedMonth ).toISOString(),\n\t\t\t\texclude: [ select( editorStore ).getCurrentPostId() ],\n\t\t\t\tper_page: 100,\n\t\t\t\t_fields: 'id,date',\n\t\t\t} ),\n\t\t[ previewedMonth, postType ]\n\t);\n\n\tconst events = useMemo(\n\t\t() =>\n\t\t\t( eventsByPostType || [] ).map( ( { date: eventDate } ) => ( {\n\t\t\t\tdate: new Date( eventDate ),\n\t\t\t} ) ),\n\t\t[ eventsByPostType ]\n\t);\n\n\tconst settings = getSettings();\n\n\t// To know if the current timezone is a 12 hour time with look for \"a\" in the time format\n\t// We also make sure this a is not escaped by a \"/\"\n\tconst is12HourTime = /a(?!\\\\)/i.test(\n\t\tsettings.formats.time\n\t\t\t.toLowerCase() // Test only the lower case a.\n\t\t\t.replace( /\\\\\\\\/g, '' ) // Replace \"//\" with empty strings.\n\t\t\t.split( '' )\n\t\t\t.reverse()\n\t\t\t.join( '' ) // Reverse the string and test for \"a\" not followed by a slash.\n\t);\n\n\treturn (\n\t\t<PublishDateTimePicker\n\t\t\tcurrentDate={ postDate }\n\t\t\tonChange={ onUpdateDate }\n\t\t\tis12Hour={ is12HourTime }\n\t\t\tevents={ events }\n\t\t\tonMonthPreviewed={ ( date ) =>\n\t\t\t\tsetPreviewedMonth( parseISO( date ) )\n\t\t\t}\n\t\t\tonClose={ onClose }\n\t\t/>\n\t);\n}\n"]}