@wordpress/editor 13.16.0 → 13.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (549) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/autocompleters/index.js +0 -2
  3. package/build/components/autocompleters/index.js.map +1 -1
  4. package/build/components/autocompleters/user.js +2 -9
  5. package/build/components/autocompleters/user.js.map +1 -1
  6. package/build/components/autosave-monitor/index.js +0 -24
  7. package/build/components/autosave-monitor/index.js.map +1 -1
  8. package/build/components/character-count/index.js +1 -4
  9. package/build/components/character-count/index.js.map +1 -1
  10. package/build/components/deprecated.js +1 -11
  11. package/build/components/deprecated.js.map +1 -1
  12. package/build/components/deprecated.native.js +0 -1
  13. package/build/components/deprecated.native.js.map +1 -1
  14. package/build/components/document-outline/check.js +1 -7
  15. package/build/components/document-outline/check.js.map +1 -1
  16. package/build/components/document-outline/index.js +7 -24
  17. package/build/components/document-outline/index.js.map +1 -1
  18. package/build/components/document-outline/item.js +1 -5
  19. package/build/components/document-outline/item.js.map +1 -1
  20. package/build/components/editor-help/add-blocks.native.js +1 -8
  21. package/build/components/editor-help/add-blocks.native.js.map +1 -1
  22. package/build/components/editor-help/customize-blocks.native.js +1 -8
  23. package/build/components/editor-help/customize-blocks.native.js.map +1 -1
  24. package/build/components/editor-help/help-detail-navigation-screen.native.js +5 -13
  25. package/build/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
  26. package/build/components/editor-help/help-get-support-button.native.js +1 -7
  27. package/build/components/editor-help/help-get-support-button.native.js.map +1 -1
  28. package/build/components/editor-help/help-section-title.native.js +1 -7
  29. package/build/components/editor-help/help-section-title.native.js.map +1 -1
  30. package/build/components/editor-help/help-topic-row.native.js +1 -8
  31. package/build/components/editor-help/help-topic-row.native.js.map +1 -1
  32. package/build/components/editor-help/icon-move-blocks.native.js +0 -4
  33. package/build/components/editor-help/icon-move-blocks.native.js.map +1 -1
  34. package/build/components/editor-help/index.native.js +8 -29
  35. package/build/components/editor-help/index.native.js.map +1 -1
  36. package/build/components/editor-help/intro-to-blocks.native.js +1 -9
  37. package/build/components/editor-help/intro-to-blocks.native.js.map +1 -1
  38. package/build/components/editor-help/move-blocks.native.js +1 -8
  39. package/build/components/editor-help/move-blocks.native.js.map +1 -1
  40. package/build/components/editor-help/remove-blocks.native.js +1 -8
  41. package/build/components/editor-help/remove-blocks.native.js.map +1 -1
  42. package/build/components/editor-help/view-sections.native.js +1 -12
  43. package/build/components/editor-help/view-sections.native.js.map +1 -1
  44. package/build/components/editor-history/redo.js +6 -14
  45. package/build/components/editor-history/redo.js.map +1 -1
  46. package/build/components/editor-history/undo.js +6 -14
  47. package/build/components/editor-history/undo.js.map +1 -1
  48. package/build/components/editor-notices/index.js +1 -10
  49. package/build/components/editor-notices/index.js.map +1 -1
  50. package/build/components/editor-snackbars/index.js +1 -5
  51. package/build/components/editor-snackbars/index.js.map +1 -1
  52. package/build/components/entities-saved-states/entity-record-item.js +3 -10
  53. package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
  54. package/build/components/entities-saved-states/entity-type-list.js +3 -15
  55. package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
  56. package/build/components/entities-saved-states/hooks/use-is-dirty.js +5 -14
  57. package/build/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
  58. package/build/components/entities-saved-states/index.js +8 -27
  59. package/build/components/entities-saved-states/index.js.map +1 -1
  60. package/build/components/error-boundary/index.js +1 -18
  61. package/build/components/error-boundary/index.js.map +1 -1
  62. package/build/components/global-keyboard-shortcuts/index.js +5 -9
  63. package/build/components/global-keyboard-shortcuts/index.js.map +1 -1
  64. package/build/components/global-keyboard-shortcuts/register-shortcuts.js +1 -8
  65. package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  66. package/build/components/index.js +4 -76
  67. package/build/components/index.js.map +1 -1
  68. package/build/components/index.native.js +0 -9
  69. package/build/components/index.native.js.map +1 -1
  70. package/build/components/local-autosave-monitor/index.js +6 -31
  71. package/build/components/local-autosave-monitor/index.js.map +1 -1
  72. package/build/components/media-categories/index.js +30 -45
  73. package/build/components/media-categories/index.js.map +1 -1
  74. package/build/components/page-attributes/check.js +3 -7
  75. package/build/components/page-attributes/check.js.map +1 -1
  76. package/build/components/page-attributes/order.js +17 -42
  77. package/build/components/page-attributes/order.js.map +1 -1
  78. package/build/components/page-attributes/parent.js +8 -34
  79. package/build/components/page-attributes/parent.js.map +1 -1
  80. package/build/components/post-author/check.js +1 -11
  81. package/build/components/post-author/check.js.map +1 -1
  82. package/build/components/post-author/combobox.js +7 -23
  83. package/build/components/post-author/combobox.js.map +1 -1
  84. package/build/components/post-author/constants.js +0 -1
  85. package/build/components/post-author/constants.js.map +1 -1
  86. package/build/components/post-author/index.js +1 -12
  87. package/build/components/post-author/index.js.map +1 -1
  88. package/build/components/post-author/select.js +1 -12
  89. package/build/components/post-author/select.js.map +1 -1
  90. package/build/components/post-comments/index.js +1 -10
  91. package/build/components/post-comments/index.js.map +1 -1
  92. package/build/components/post-excerpt/check.js +6 -8
  93. package/build/components/post-excerpt/check.js.map +1 -1
  94. package/build/components/post-excerpt/index.js +1 -7
  95. package/build/components/post-excerpt/index.js.map +1 -1
  96. package/build/components/post-featured-image/check.js +6 -9
  97. package/build/components/post-featured-image/check.js.map +1 -1
  98. package/build/components/post-featured-image/index.js +13 -42
  99. package/build/components/post-featured-image/index.js.map +1 -1
  100. package/build/components/post-format/check.js +9 -18
  101. package/build/components/post-format/check.js.map +1 -1
  102. package/build/components/post-format/index.js +2 -20
  103. package/build/components/post-format/index.js.map +1 -1
  104. package/build/components/post-last-revision/check.js +15 -22
  105. package/build/components/post-last-revision/check.js.map +1 -1
  106. package/build/components/post-last-revision/index.js +17 -28
  107. package/build/components/post-last-revision/index.js.map +1 -1
  108. package/build/components/post-locked-modal/index.js +8 -28
  109. package/build/components/post-locked-modal/index.js.map +1 -1
  110. package/build/components/post-pending-status/check.js +16 -24
  111. package/build/components/post-pending-status/check.js.map +1 -1
  112. package/build/components/post-pending-status/index.js +10 -28
  113. package/build/components/post-pending-status/index.js.map +1 -1
  114. package/build/components/post-pingbacks/index.js +1 -10
  115. package/build/components/post-pingbacks/index.js.map +1 -1
  116. package/build/components/post-preview-button/index.js +11 -22
  117. package/build/components/post-preview-button/index.js.map +1 -1
  118. package/build/components/post-publish-button/index.js +6 -32
  119. package/build/components/post-publish-button/index.js.map +1 -1
  120. package/build/components/post-publish-button/label.js +1 -10
  121. package/build/components/post-publish-button/label.js.map +1 -1
  122. package/build/components/post-publish-panel/index.js +1 -22
  123. package/build/components/post-publish-panel/index.js.map +1 -1
  124. package/build/components/post-publish-panel/maybe-category-panel.js +4 -14
  125. package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  126. package/build/components/post-publish-panel/maybe-post-format-panel.js +2 -18
  127. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  128. package/build/components/post-publish-panel/maybe-tags-panel.js +2 -17
  129. package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  130. package/build/components/post-publish-panel/maybe-upload-media.js +1 -18
  131. package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  132. package/build/components/post-publish-panel/postpublish.js +3 -27
  133. package/build/components/post-publish-panel/postpublish.js.map +1 -1
  134. package/build/components/post-publish-panel/prepublish.js +1 -26
  135. package/build/components/post-publish-panel/prepublish.js.map +1 -1
  136. package/build/components/post-saved-state/index.js +12 -29
  137. package/build/components/post-saved-state/index.js.map +1 -1
  138. package/build/components/post-schedule/check.js +1 -8
  139. package/build/components/post-schedule/check.js.map +1 -1
  140. package/build/components/post-schedule/index.js +7 -13
  141. package/build/components/post-schedule/index.js.map +1 -1
  142. package/build/components/post-schedule/label.js +18 -29
  143. package/build/components/post-schedule/label.js.map +1 -1
  144. package/build/components/post-slug/check.js +1 -4
  145. package/build/components/post-slug/check.js.map +1 -1
  146. package/build/components/post-slug/index.js +1 -19
  147. package/build/components/post-slug/index.js.map +1 -1
  148. package/build/components/post-sticky/check.js +1 -8
  149. package/build/components/post-sticky/check.js.map +1 -1
  150. package/build/components/post-sticky/index.js +1 -12
  151. package/build/components/post-sticky/index.js.map +1 -1
  152. package/build/components/post-switch-to-draft-button/index.js +1 -14
  153. package/build/components/post-switch-to-draft-button/index.js.map +1 -1
  154. package/build/components/post-sync-status/index.js +5 -18
  155. package/build/components/post-sync-status/index.js.map +1 -1
  156. package/build/components/post-taxonomies/check.js +1 -9
  157. package/build/components/post-taxonomies/check.js.map +1 -1
  158. package/build/components/post-taxonomies/flat-term-selector.js +15 -50
  159. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  160. package/build/components/post-taxonomies/hierarchical-term-selector.js +27 -79
  161. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  162. package/build/components/post-taxonomies/index.js +3 -13
  163. package/build/components/post-taxonomies/index.js.map +1 -1
  164. package/build/components/post-taxonomies/most-used-terms.js +1 -9
  165. package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
  166. package/build/components/post-template/index.js +1 -11
  167. package/build/components/post-template/index.js.map +1 -1
  168. package/build/components/post-text-editor/index.js +3 -17
  169. package/build/components/post-text-editor/index.js.map +1 -1
  170. package/build/components/post-title/index.js +14 -46
  171. package/build/components/post-title/index.js.map +1 -1
  172. package/build/components/post-title/index.native.js +7 -44
  173. package/build/components/post-title/index.native.js.map +1 -1
  174. package/build/components/post-trash/check.js +1 -7
  175. package/build/components/post-trash/check.js.map +1 -1
  176. package/build/components/post-trash/index.js +1 -8
  177. package/build/components/post-trash/index.js.map +1 -1
  178. package/build/components/post-type-support-check/index.js +0 -9
  179. package/build/components/post-type-support-check/index.js.map +1 -1
  180. package/build/components/post-url/check.js +1 -12
  181. package/build/components/post-url/check.js.map +1 -1
  182. package/build/components/post-url/index.js +3 -15
  183. package/build/components/post-url/index.js.map +1 -1
  184. package/build/components/post-url/label.js +1 -5
  185. package/build/components/post-url/label.js.map +1 -1
  186. package/build/components/post-visibility/check.js +1 -7
  187. package/build/components/post-visibility/check.js.map +1 -1
  188. package/build/components/post-visibility/index.js +1 -17
  189. package/build/components/post-visibility/index.js.map +1 -1
  190. package/build/components/post-visibility/label.js +1 -5
  191. package/build/components/post-visibility/label.js.map +1 -1
  192. package/build/components/post-visibility/utils.js +1 -2
  193. package/build/components/post-visibility/utils.js.map +1 -1
  194. package/build/components/provider/index.js +13 -27
  195. package/build/components/provider/index.js.map +1 -1
  196. package/build/components/provider/index.native.js +18 -70
  197. package/build/components/provider/index.native.js.map +1 -1
  198. package/build/components/provider/use-block-editor-settings.js +9 -20
  199. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  200. package/build/components/provider/use-block-editor-settings.native.js +5 -11
  201. package/build/components/provider/use-block-editor-settings.native.js.map +1 -1
  202. package/build/components/provider/with-registry-provider.js +5 -12
  203. package/build/components/provider/with-registry-provider.js.map +1 -1
  204. package/build/components/table-of-contents/index.js +4 -14
  205. package/build/components/table-of-contents/index.js.map +1 -1
  206. package/build/components/table-of-contents/panel.js +1 -13
  207. package/build/components/table-of-contents/panel.js.map +1 -1
  208. package/build/components/template-validation-notice/index.js +3 -12
  209. package/build/components/template-validation-notice/index.js.map +1 -1
  210. package/build/components/theme-support-check/index.js +3 -12
  211. package/build/components/theme-support-check/index.js.map +1 -1
  212. package/build/components/time-to-read/index.js +2 -10
  213. package/build/components/time-to-read/index.js.map +1 -1
  214. package/build/components/unsaved-changes-warning/index.js +21 -35
  215. package/build/components/unsaved-changes-warning/index.js.map +1 -1
  216. package/build/components/word-count/index.js +2 -7
  217. package/build/components/word-count/index.js.map +1 -1
  218. package/build/hooks/custom-sources-backwards-compatibility.js +7 -18
  219. package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  220. package/build/hooks/default-autocompleters.js +3 -4
  221. package/build/hooks/default-autocompleters.js.map +1 -1
  222. package/build/hooks/index.js +0 -1
  223. package/build/hooks/index.js.map +1 -1
  224. package/build/hooks/index.native.js.map +1 -1
  225. package/build/index.js +0 -9
  226. package/build/index.js.map +1 -1
  227. package/build/index.native.js +0 -11
  228. package/build/index.native.js.map +1 -1
  229. package/build/lock-unlock.js +1 -2
  230. package/build/lock-unlock.js.map +1 -1
  231. package/build/private-apis.js +1 -4
  232. package/build/private-apis.js.map +1 -1
  233. package/build/store/actions.js +60 -129
  234. package/build/store/actions.js.map +1 -1
  235. package/build/store/actions.native.js +1 -8
  236. package/build/store/actions.native.js.map +1 -1
  237. package/build/store/constants.js +1 -2
  238. package/build/store/constants.js.map +1 -1
  239. package/build/store/defaults.js +2 -3
  240. package/build/store/defaults.js.map +1 -1
  241. package/build/store/index.js +3 -11
  242. package/build/store/index.js.map +1 -1
  243. package/build/store/local-autosave.js +0 -4
  244. package/build/store/local-autosave.js.map +1 -1
  245. package/build/store/reducer.js +19 -49
  246. package/build/store/reducer.js.map +1 -1
  247. package/build/store/reducer.native.js +3 -17
  248. package/build/store/reducer.native.js.map +1 -1
  249. package/build/store/selectors.js +169 -295
  250. package/build/store/selectors.js.map +1 -1
  251. package/build/store/selectors.native.js +4 -11
  252. package/build/store/selectors.native.js.map +1 -1
  253. package/build/store/utils/notice-builder.js +13 -24
  254. package/build/store/utils/notice-builder.js.map +1 -1
  255. package/build/utils/get-template-part-icon.js +0 -3
  256. package/build/utils/get-template-part-icon.js.map +1 -1
  257. package/build/utils/index.js +0 -4
  258. package/build/utils/index.js.map +1 -1
  259. package/build/utils/index.native.js +0 -2
  260. package/build/utils/index.native.js.map +1 -1
  261. package/build/utils/media-upload/index.js +2 -6
  262. package/build/utils/media-upload/index.js.map +1 -1
  263. package/build/utils/media-upload/index.native.js +0 -1
  264. package/build/utils/media-upload/index.native.js.map +1 -1
  265. package/build/utils/terms.js +8 -18
  266. package/build/utils/terms.js.map +1 -1
  267. package/build/utils/url.js +0 -4
  268. package/build/utils/url.js.map +1 -1
  269. package/build-module/components/autocompleters/index.js.map +1 -1
  270. package/build-module/components/autocompleters/user.js +2 -5
  271. package/build-module/components/autocompleters/user.js.map +1 -1
  272. package/build-module/components/autosave-monitor/index.js +2 -17
  273. package/build-module/components/autosave-monitor/index.js.map +1 -1
  274. package/build-module/components/character-count/index.js +1 -1
  275. package/build-module/components/character-count/index.js.map +1 -1
  276. package/build-module/components/deprecated.js +0 -4
  277. package/build-module/components/deprecated.js.map +1 -1
  278. package/build-module/components/deprecated.native.js +0 -1
  279. package/build-module/components/deprecated.native.js.map +1 -1
  280. package/build-module/components/document-outline/check.js +0 -4
  281. package/build-module/components/document-outline/check.js.map +1 -1
  282. package/build-module/components/document-outline/index.js +9 -13
  283. package/build-module/components/document-outline/index.js.map +1 -1
  284. package/build-module/components/document-outline/item.js +0 -3
  285. package/build-module/components/document-outline/item.js.map +1 -1
  286. package/build-module/components/editor-help/add-blocks.native.js +2 -5
  287. package/build-module/components/editor-help/add-blocks.native.js.map +1 -1
  288. package/build-module/components/editor-help/customize-blocks.native.js +2 -5
  289. package/build-module/components/editor-help/customize-blocks.native.js.map +1 -1
  290. package/build-module/components/editor-help/help-detail-navigation-screen.native.js +6 -8
  291. package/build-module/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
  292. package/build-module/components/editor-help/help-get-support-button.native.js +2 -5
  293. package/build-module/components/editor-help/help-get-support-button.native.js.map +1 -1
  294. package/build-module/components/editor-help/help-section-title.native.js +2 -5
  295. package/build-module/components/editor-help/help-section-title.native.js.map +1 -1
  296. package/build-module/components/editor-help/help-topic-row.native.js +1 -6
  297. package/build-module/components/editor-help/help-topic-row.native.js.map +1 -1
  298. package/build-module/components/editor-help/icon-move-blocks.native.js +0 -1
  299. package/build-module/components/editor-help/icon-move-blocks.native.js.map +1 -1
  300. package/build-module/components/editor-help/index.native.js +9 -9
  301. package/build-module/components/editor-help/index.native.js.map +1 -1
  302. package/build-module/components/editor-help/intro-to-blocks.native.js +2 -5
  303. package/build-module/components/editor-help/intro-to-blocks.native.js.map +1 -1
  304. package/build-module/components/editor-help/move-blocks.native.js +2 -5
  305. package/build-module/components/editor-help/move-blocks.native.js.map +1 -1
  306. package/build-module/components/editor-help/remove-blocks.native.js +2 -5
  307. package/build-module/components/editor-help/remove-blocks.native.js.map +1 -1
  308. package/build-module/components/editor-help/view-sections.native.js +2 -4
  309. package/build-module/components/editor-help/view-sections.native.js.map +1 -1
  310. package/build-module/components/editor-history/redo.js +6 -8
  311. package/build-module/components/editor-history/redo.js.map +1 -1
  312. package/build-module/components/editor-history/undo.js +6 -8
  313. package/build-module/components/editor-history/undo.js.map +1 -1
  314. package/build-module/components/editor-notices/index.js +1 -2
  315. package/build-module/components/editor-notices/index.js.map +1 -1
  316. package/build-module/components/editor-snackbars/index.js +0 -1
  317. package/build-module/components/editor-snackbars/index.js.map +1 -1
  318. package/build-module/components/entities-saved-states/entity-record-item.js +3 -4
  319. package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
  320. package/build-module/components/entities-saved-states/entity-type-list.js +3 -10
  321. package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
  322. package/build-module/components/entities-saved-states/hooks/use-is-dirty.js +4 -7
  323. package/build-module/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
  324. package/build-module/components/entities-saved-states/index.js +8 -16
  325. package/build-module/components/entities-saved-states/index.js.map +1 -1
  326. package/build-module/components/error-boundary/index.js +1 -12
  327. package/build-module/components/error-boundary/index.js.map +1 -1
  328. package/build-module/components/global-keyboard-shortcuts/index.js +5 -6
  329. package/build-module/components/global-keyboard-shortcuts/index.js.map +1 -1
  330. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +0 -3
  331. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  332. package/build-module/components/index.js +6 -3
  333. package/build-module/components/index.js.map +1 -1
  334. package/build-module/components/index.native.js +4 -2
  335. package/build-module/components/index.native.js.map +1 -1
  336. package/build-module/components/local-autosave-monitor/index.js +6 -21
  337. package/build-module/components/local-autosave-monitor/index.js.map +1 -1
  338. package/build-module/components/media-categories/index.js +31 -41
  339. package/build-module/components/media-categories/index.js.map +1 -1
  340. package/build-module/components/page-attributes/check.js +3 -3
  341. package/build-module/components/page-attributes/check.js.map +1 -1
  342. package/build-module/components/page-attributes/order.js +17 -31
  343. package/build-module/components/page-attributes/order.js.map +1 -1
  344. package/build-module/components/page-attributes/parent.js +9 -23
  345. package/build-module/components/page-attributes/parent.js.map +1 -1
  346. package/build-module/components/post-author/check.js +1 -5
  347. package/build-module/components/post-author/check.js.map +1 -1
  348. package/build-module/components/post-author/combobox.js +7 -16
  349. package/build-module/components/post-author/combobox.js.map +1 -1
  350. package/build-module/components/post-author/constants.js +0 -1
  351. package/build-module/components/post-author/constants.js.map +1 -1
  352. package/build-module/components/post-author/index.js +1 -6
  353. package/build-module/components/post-author/index.js.map +1 -1
  354. package/build-module/components/post-author/select.js +1 -6
  355. package/build-module/components/post-author/select.js.map +1 -1
  356. package/build-module/components/post-comments/index.js +1 -7
  357. package/build-module/components/post-comments/index.js.map +1 -1
  358. package/build-module/components/post-excerpt/check.js +5 -6
  359. package/build-module/components/post-excerpt/check.js.map +1 -1
  360. package/build-module/components/post-excerpt/index.js +1 -4
  361. package/build-module/components/post-excerpt/index.js.map +1 -1
  362. package/build-module/components/post-featured-image/check.js +5 -6
  363. package/build-module/components/post-featured-image/check.js.map +1 -1
  364. package/build-module/components/post-featured-image/index.js +13 -31
  365. package/build-module/components/post-featured-image/index.js.map +1 -1
  366. package/build-module/components/post-format/check.js +10 -15
  367. package/build-module/components/post-format/check.js.map +1 -1
  368. package/build-module/components/post-format/index.js +4 -12
  369. package/build-module/components/post-format/index.js.map +1 -1
  370. package/build-module/components/post-last-revision/check.js +17 -17
  371. package/build-module/components/post-last-revision/check.js.map +1 -1
  372. package/build-module/components/post-last-revision/index.js +18 -21
  373. package/build-module/components/post-last-revision/index.js.map +1 -1
  374. package/build-module/components/post-locked-modal/index.js +8 -22
  375. package/build-module/components/post-locked-modal/index.js.map +1 -1
  376. package/build-module/components/post-pending-status/check.js +17 -20
  377. package/build-module/components/post-pending-status/check.js.map +1 -1
  378. package/build-module/components/post-pending-status/index.js +11 -20
  379. package/build-module/components/post-pending-status/index.js.map +1 -1
  380. package/build-module/components/post-pingbacks/index.js +1 -7
  381. package/build-module/components/post-pingbacks/index.js.map +1 -1
  382. package/build-module/components/post-preview-button/index.js +11 -17
  383. package/build-module/components/post-preview-button/index.js.map +1 -1
  384. package/build-module/components/post-publish-button/index.js +7 -23
  385. package/build-module/components/post-publish-button/index.js.map +1 -1
  386. package/build-module/components/post-publish-button/label.js +1 -4
  387. package/build-module/components/post-publish-button/label.js.map +1 -1
  388. package/build-module/components/post-publish-panel/index.js +1 -8
  389. package/build-module/components/post-publish-panel/index.js.map +1 -1
  390. package/build-module/components/post-publish-panel/maybe-category-panel.js +4 -8
  391. package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  392. package/build-module/components/post-publish-panel/maybe-post-format-panel.js +2 -12
  393. package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  394. package/build-module/components/post-publish-panel/maybe-tags-panel.js +2 -9
  395. package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  396. package/build-module/components/post-publish-panel/maybe-upload-media.js +1 -12
  397. package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  398. package/build-module/components/post-publish-panel/postpublish.js +3 -16
  399. package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
  400. package/build-module/components/post-publish-panel/prepublish.js +1 -10
  401. package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
  402. package/build-module/components/post-saved-state/index.js +15 -23
  403. package/build-module/components/post-saved-state/index.js.map +1 -1
  404. package/build-module/components/post-schedule/check.js +1 -3
  405. package/build-module/components/post-schedule/check.js.map +1 -1
  406. package/build-module/components/post-schedule/index.js +8 -8
  407. package/build-module/components/post-schedule/index.js.map +1 -1
  408. package/build-module/components/post-schedule/label.js +18 -22
  409. package/build-module/components/post-schedule/label.js.map +1 -1
  410. package/build-module/components/post-slug/check.js +0 -1
  411. package/build-module/components/post-slug/check.js.map +1 -1
  412. package/build-module/components/post-slug/index.js +1 -8
  413. package/build-module/components/post-slug/index.js.map +1 -1
  414. package/build-module/components/post-sticky/check.js +1 -3
  415. package/build-module/components/post-sticky/check.js.map +1 -1
  416. package/build-module/components/post-sticky/index.js +1 -3
  417. package/build-module/components/post-sticky/index.js.map +1 -1
  418. package/build-module/components/post-switch-to-draft-button/index.js +1 -9
  419. package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
  420. package/build-module/components/post-sync-status/index.js +5 -11
  421. package/build-module/components/post-sync-status/index.js.map +1 -1
  422. package/build-module/components/post-taxonomies/check.js +1 -3
  423. package/build-module/components/post-taxonomies/check.js.map +1 -1
  424. package/build-module/components/post-taxonomies/flat-term-selector.js +17 -39
  425. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  426. package/build-module/components/post-taxonomies/hierarchical-term-selector.js +29 -66
  427. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  428. package/build-module/components/post-taxonomies/index.js +3 -5
  429. package/build-module/components/post-taxonomies/index.js.map +1 -1
  430. package/build-module/components/post-taxonomies/most-used-terms.js +1 -4
  431. package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
  432. package/build-module/components/post-template/index.js +1 -5
  433. package/build-module/components/post-template/index.js.map +1 -1
  434. package/build-module/components/post-text-editor/index.js +4 -9
  435. package/build-module/components/post-text-editor/index.js.map +1 -1
  436. package/build-module/components/post-title/index.js +17 -35
  437. package/build-module/components/post-title/index.js.map +1 -1
  438. package/build-module/components/post-title/index.native.js +8 -33
  439. package/build-module/components/post-title/index.native.js.map +1 -1
  440. package/build-module/components/post-trash/check.js +1 -4
  441. package/build-module/components/post-trash/check.js.map +1 -1
  442. package/build-module/components/post-trash/index.js +1 -4
  443. package/build-module/components/post-trash/index.js.map +1 -1
  444. package/build-module/components/post-type-support-check/index.js +3 -6
  445. package/build-module/components/post-type-support-check/index.js.map +1 -1
  446. package/build-module/components/post-url/check.js +1 -9
  447. package/build-module/components/post-url/check.js.map +1 -1
  448. package/build-module/components/post-url/index.js +3 -8
  449. package/build-module/components/post-url/index.js.map +1 -1
  450. package/build-module/components/post-url/label.js +1 -1
  451. package/build-module/components/post-url/label.js.map +1 -1
  452. package/build-module/components/post-visibility/check.js +1 -2
  453. package/build-module/components/post-visibility/check.js.map +1 -1
  454. package/build-module/components/post-visibility/index.js +1 -10
  455. package/build-module/components/post-visibility/index.js.map +1 -1
  456. package/build-module/components/post-visibility/label.js +1 -1
  457. package/build-module/components/post-visibility/label.js.map +1 -1
  458. package/build-module/components/post-visibility/utils.js.map +1 -1
  459. package/build-module/components/provider/index.js +13 -14
  460. package/build-module/components/provider/index.js.map +1 -1
  461. package/build-module/components/provider/index.native.js +21 -52
  462. package/build-module/components/provider/index.native.js.map +1 -1
  463. package/build-module/components/provider/use-block-editor-settings.js +9 -12
  464. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  465. package/build-module/components/provider/use-block-editor-settings.native.js +5 -5
  466. package/build-module/components/provider/use-block-editor-settings.native.js.map +1 -1
  467. package/build-module/components/provider/with-registry-provider.js +5 -8
  468. package/build-module/components/provider/with-registry-provider.js.map +1 -1
  469. package/build-module/components/table-of-contents/index.js +4 -7
  470. package/build-module/components/table-of-contents/index.js.map +1 -1
  471. package/build-module/components/table-of-contents/panel.js +1 -5
  472. package/build-module/components/table-of-contents/panel.js.map +1 -1
  473. package/build-module/components/template-validation-notice/index.js +2 -6
  474. package/build-module/components/template-validation-notice/index.js.map +1 -1
  475. package/build-module/components/theme-support-check/index.js +3 -7
  476. package/build-module/components/theme-support-check/index.js.map +1 -1
  477. package/build-module/components/time-to-read/index.js +4 -7
  478. package/build-module/components/time-to-read/index.js.map +1 -1
  479. package/build-module/components/unsaved-changes-warning/index.js +22 -31
  480. package/build-module/components/unsaved-changes-warning/index.js.map +1 -1
  481. package/build-module/components/word-count/index.js +2 -4
  482. package/build-module/components/word-count/index.js.map +1 -1
  483. package/build-module/hooks/custom-sources-backwards-compatibility.js +9 -15
  484. package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  485. package/build-module/hooks/default-autocompleters.js +3 -4
  486. package/build-module/hooks/default-autocompleters.js.map +1 -1
  487. package/build-module/hooks/index.js.map +1 -1
  488. package/build-module/hooks/index.native.js.map +1 -1
  489. package/build-module/index.js +1 -1
  490. package/build-module/index.js.map +1 -1
  491. package/build-module/index.native.js +1 -1
  492. package/build-module/index.native.js.map +1 -1
  493. package/build-module/lock-unlock.js.map +1 -1
  494. package/build-module/private-apis.js.map +1 -1
  495. package/build-module/store/actions.js +62 -84
  496. package/build-module/store/actions.js.map +1 -1
  497. package/build-module/store/actions.native.js +2 -2
  498. package/build-module/store/actions.native.js.map +1 -1
  499. package/build-module/store/constants.js +1 -1
  500. package/build-module/store/constants.js.map +1 -1
  501. package/build-module/store/defaults.js +3 -2
  502. package/build-module/store/defaults.js.map +1 -1
  503. package/build-module/store/index.js +5 -4
  504. package/build-module/store/index.js.map +1 -1
  505. package/build-module/store/local-autosave.js +0 -1
  506. package/build-module/store/local-autosave.js.map +1 -1
  507. package/build-module/store/reducer.js +21 -33
  508. package/build-module/store/reducer.js.map +1 -1
  509. package/build-module/store/reducer.native.js +4 -10
  510. package/build-module/store/reducer.native.js.map +1 -1
  511. package/build-module/store/selectors.js +172 -222
  512. package/build-module/store/selectors.js.map +1 -1
  513. package/build-module/store/selectors.native.js +6 -8
  514. package/build-module/store/selectors.native.js.map +1 -1
  515. package/build-module/store/utils/notice-builder.js +15 -21
  516. package/build-module/store/utils/notice-builder.js.map +1 -1
  517. package/build-module/utils/get-template-part-icon.js +0 -2
  518. package/build-module/utils/get-template-part-icon.js.map +1 -1
  519. package/build-module/utils/index.js.map +1 -1
  520. package/build-module/utils/index.native.js.map +1 -1
  521. package/build-module/utils/media-upload/index.js +2 -4
  522. package/build-module/utils/media-upload/index.js.map +1 -1
  523. package/build-module/utils/media-upload/index.native.js.map +1 -1
  524. package/build-module/utils/terms.js +9 -11
  525. package/build-module/utils/terms.js.map +1 -1
  526. package/build-module/utils/url.js +1 -1
  527. package/build-module/utils/url.js.map +1 -1
  528. package/build-style/style-rtl.css +10 -17
  529. package/build-style/style.css +10 -17
  530. package/package.json +32 -31
  531. package/src/components/editor-help/index.native.js +1 -1
  532. package/src/components/editor-help/style.scss +5 -0
  533. package/src/components/page-attributes/order.js +15 -23
  534. package/src/components/page-attributes/test/order.js +46 -15
  535. package/src/components/post-excerpt/check.js +6 -2
  536. package/src/components/post-featured-image/check.js +4 -2
  537. package/src/components/post-format/check.js +16 -11
  538. package/src/components/post-last-revision/check.js +12 -14
  539. package/src/components/post-last-revision/index.js +12 -10
  540. package/src/components/post-last-revision/test/check.js +28 -16
  541. package/src/components/post-pending-status/check.js +13 -19
  542. package/src/components/post-pending-status/index.js +9 -14
  543. package/src/components/post-pending-status/test/check.js +32 -10
  544. package/src/components/post-publish-panel/style.scss +12 -25
  545. package/src/components/post-sync-status/style.scss +4 -1
  546. package/src/components/post-type-support-check/index.js +1 -1
  547. package/src/components/post-type-support-check/test/index.js +1 -1
  548. package/src/components/provider/index.js +3 -2
  549. package/src/components/unsaved-changes-warning/index.js +22 -27
@@ -1,30 +1,19 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = PostSavedState;
9
-
10
8
  var _element = require("@wordpress/element");
11
-
12
9
  var _classnames = _interopRequireDefault(require("classnames"));
13
-
14
10
  var _components = require("@wordpress/components");
15
-
16
11
  var _compose = require("@wordpress/compose");
17
-
18
12
  var _data = require("@wordpress/data");
19
-
20
13
  var _i18n = require("@wordpress/i18n");
21
-
22
14
  var _icons = require("@wordpress/icons");
23
-
24
15
  var _keycodes = require("@wordpress/keycodes");
25
-
26
16
  var _store = require("../../store");
27
-
28
17
  /**
29
18
  * External dependencies
30
19
  */
@@ -65,7 +54,6 @@ function PostSavedState({
65
54
  hasPublishAction
66
55
  } = (0, _data.useSelect)(select => {
67
56
  var _getCurrentPost$_link;
68
-
69
57
  const {
70
58
  isEditedPostNew,
71
59
  isCurrentPostPublished,
@@ -95,37 +83,33 @@ function PostSavedState({
95
83
  const wasSaving = (0, _compose.usePrevious)(isSaving);
96
84
  (0, _element.useEffect)(() => {
97
85
  let timeoutId;
98
-
99
86
  if (wasSaving && !isSaving) {
100
87
  setForceSavedMessage(true);
101
88
  timeoutId = setTimeout(() => {
102
89
  setForceSavedMessage(false);
103
90
  }, 1000);
104
91
  }
105
-
106
92
  return () => clearTimeout(timeoutId);
107
- }, [isSaving]); // Once the post has been submitted for review this button
108
- // is not needed for the contributor role.
93
+ }, [isSaving]);
109
94
 
95
+ // Once the post has been submitted for review this button
96
+ // is not needed for the contributor role.
110
97
  if (!hasPublishAction && isPending) {
111
98
  return null;
112
99
  }
113
-
114
100
  if (isPublished || isScheduled) {
115
101
  return null;
116
102
  }
117
- /* translators: button label text should, if possible, be under 16 characters. */
118
-
119
103
 
120
- const label = isPending ? (0, _i18n.__)('Save as pending') : (0, _i18n.__)('Save draft');
121
104
  /* translators: button label text should, if possible, be under 16 characters. */
105
+ const label = isPending ? (0, _i18n.__)('Save as pending') : (0, _i18n.__)('Save draft');
122
106
 
107
+ /* translators: button label text should, if possible, be under 16 characters. */
123
108
  const shortLabel = (0, _i18n.__)('Save');
124
109
  const isSaved = forceSavedMessage || !isNew && !isDirty;
125
110
  const isSavedState = isSaving || isSaved;
126
111
  const isDisabled = isSaving || isSaved || !isSaveable;
127
112
  let text;
128
-
129
113
  if (isSaving) {
130
114
  text = isAutosaving ? (0, _i18n.__)('Autosaving') : (0, _i18n.__)('Saving');
131
115
  } else if (isSaved) {
@@ -134,10 +118,10 @@ function PostSavedState({
134
118
  text = label;
135
119
  } else if (showIconLabels) {
136
120
  text = shortLabel;
137
- } // Use common Button instance for all saved states so that focus is not
138
- // lost.
139
-
121
+ }
140
122
 
123
+ // Use common Button instance for all saved states so that focus is not
124
+ // lost.
141
125
  return (0, _element.createElement)(_components.Button, {
142
126
  className: isSaveable || isSaving ? (0, _classnames.default)({
143
127
  'editor-post-save-draft': !isSavedState,
@@ -153,19 +137,18 @@ function PostSavedState({
153
137
  /*
154
138
  * We want the tooltip to show the keyboard shortcut only when the
155
139
  * button does something, i.e. when it's not disabled.
156
- */
157
- ,
140
+ */,
158
141
  shortcut: isDisabled ? undefined : _keycodes.displayShortcut.primary('s')
159
142
  /*
160
143
  * Displaying the keyboard shortcut conditionally makes the tooltip
161
144
  * itself show conditionally. This would trigger a full-rerendering
162
145
  * of the button that we want to avoid. By setting `showTooltip`,
163
146
  & the tooltip is always rendered even when there's no keyboard shortcut.
164
- */
165
- ,
147
+ */,
166
148
  showTooltip: true,
167
149
  variant: "tertiary",
168
- icon: isLargeViewport ? undefined : _icons.cloudUpload // Make sure the aria-label has always a value, as the default `text` is undefined on small screens.
150
+ icon: isLargeViewport ? undefined : _icons.cloudUpload
151
+ // Make sure the aria-label has always a value, as the default `text` is undefined on small screens.
169
152
  ,
170
153
  label: text || label,
171
154
  "aria-disabled": isDisabled
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-saved-state/index.js"],"names":["PostSavedState","forceIsDirty","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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AAP;AACA,GAFM,MAEA,IAAK9B,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.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\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: 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 ]\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"]}
1
+ {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_components","_compose","_data","_i18n","_icons","_keycodes","_store","PostSavedState","forceIsDirty","showIconLabels","forceSavedMessage","setForceSavedMessage","useState","isLargeViewport","useViewportMatch","isAutosaving","isDirty","isNew","isPending","isPublished","isSaveable","isSaving","isScheduled","hasPublishAction","useSelect","select","_getCurrentPost$_link","isEditedPostNew","isCurrentPostPublished","isCurrentPostScheduled","isEditedPostDirty","isSavingPost","isEditedPostSaveable","getCurrentPost","isAutosavingPost","getEditedPostAttribute","editorStore","_links","savePost","useDispatch","wasSaving","usePrevious","useEffect","timeoutId","setTimeout","clearTimeout","label","__","shortLabel","isSaved","isSavedState","isDisabled","text","createElement","Button","className","classnames","getAnimateClassName","type","undefined","onClick","shortcut","displayShortcut","primary","showTooltip","variant","icon","cloudUpload","Icon","check","cloud"],"sources":["@wordpress/editor/src/components/post-saved-state/index.js"],"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.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\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: 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 ]\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"],"mappings":";;;;;;;AAcA,IAAAA,QAAA,GAAAC,OAAA;AAXA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,WAAA,GAAAH,OAAA;AAIA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAEA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,MAA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ck = PostScheduleCheck;
7
7
  exports.default = void 0;
8
-
9
8
  var _compose = require("@wordpress/compose");
10
-
11
9
  var _data = require("@wordpress/data");
12
-
13
10
  var _store = require("../../store");
14
-
15
11
  /**
16
12
  * WordPress dependencies
17
13
  */
@@ -19,6 +15,7 @@ var _store = require("../../store");
19
15
  /**
20
16
  * Internal dependencies
21
17
  */
18
+
22
19
  function PostScheduleCheck({
23
20
  hasPublishAction,
24
21
  children
@@ -26,13 +23,10 @@ function PostScheduleCheck({
26
23
  if (!hasPublishAction) {
27
24
  return null;
28
25
  }
29
-
30
26
  return children;
31
27
  }
32
-
33
28
  var _default = (0, _compose.compose)([(0, _data.withSelect)(select => {
34
29
  var _getCurrentPost$_link;
35
-
36
30
  const {
37
31
  getCurrentPost,
38
32
  getCurrentPostType
@@ -42,6 +36,5 @@ var _default = (0, _compose.compose)([(0, _data.withSelect)(select => {
42
36
  postType: getCurrentPostType()
43
37
  };
44
38
  })])(PostScheduleCheck);
45
-
46
39
  exports.default = _default;
47
40
  //# sourceMappingURL=check.js.map
@@ -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,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"]}
1
+ {"version":3,"names":["_compose","require","_data","_store","PostScheduleCheck","hasPublishAction","children","_default","compose","withSelect","select","_getCurrentPost$_link","getCurrentPost","getCurrentPostType","editorStore","_links","postType","exports","default"],"sources":["@wordpress/editor/src/components/post-schedule/check.js"],"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"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGO,SAASG,iBAAiBA,CAAE;EAAEC,gBAAgB;EAAEC;AAAS,CAAC,EAAG;EACnE,IAAK,CAAED,gBAAgB,EAAG;IACzB,OAAO,IAAI;EACZ;EAEA,OAAOC,QAAQ;AAChB;AAAC,IAAAC,QAAA,GAEc,IAAAC,gBAAO,EAAE,CACvB,IAAAC,gBAAU,EAAIC,MAAM,IAAM;EAAA,IAAAC,qBAAA;EACzB,MAAM;IAAEC,cAAc;IAAEC;EAAmB,CAAC,GAAGH,MAAM,CAAEI,YAAY,CAAC;EACpE,OAAO;IACNT,gBAAgB,GAAAM,qBAAA,GACfC,cAAc,CAAC,CAAC,CAACG,MAAM,GAAI,mBAAmB,CAAE,cAAAJ,qBAAA,cAAAA,qBAAA,GAAI,KAAK;IAC1DK,QAAQ,EAAEH,kBAAkB,CAAC;EAC9B,CAAC;AACF,CAAE,CAAC,CACF,CAAC,CAAET,iBAAkB,CAAC;AAAAa,OAAA,CAAAC,OAAA,GAAAX,QAAA"}
@@ -4,21 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = PostSchedule;
7
-
8
7
  var _element = require("@wordpress/element");
9
-
10
8
  var _dateFns = require("date-fns");
11
-
12
9
  var _date = require("@wordpress/date");
13
-
14
10
  var _data = require("@wordpress/data");
15
-
16
11
  var _blockEditor = require("@wordpress/block-editor");
17
-
18
12
  var _coreData = require("@wordpress/core-data");
19
-
20
13
  var _store = require("../../store");
21
-
22
14
  /**
23
15
  * External dependencies
24
16
  */
@@ -30,6 +22,7 @@ var _store = require("../../store");
30
22
  /**
31
23
  * Internal dependencies
32
24
  */
25
+
33
26
  function PostSchedule({
34
27
  onClose
35
28
  }) {
@@ -43,13 +36,12 @@ function PostSchedule({
43
36
  const {
44
37
  editPost
45
38
  } = (0, _data.useDispatch)(_store.store);
46
-
47
39
  const onUpdateDate = date => editPost({
48
40
  date
49
41
  });
42
+ const [previewedMonth, setPreviewedMonth] = (0, _element.useState)((0, _dateFns.startOfMonth)(new Date(postDate)));
50
43
 
51
- const [previewedMonth, setPreviewedMonth] = (0, _element.useState)((0, _dateFns.startOfMonth)(new Date(postDate))); // Pick up published and schduled site posts.
52
-
44
+ // Pick up published and schduled site posts.
53
45
  const eventsByPostType = (0, _data.useSelect)(select => select(_coreData.store).getEntityRecords('postType', postType, {
54
46
  status: 'publish,future',
55
47
  after: (0, _dateFns.startOfMonth)(previewedMonth).toISOString(),
@@ -63,13 +55,15 @@ function PostSchedule({
63
55
  }) => ({
64
56
  date: new Date(eventDate)
65
57
  })), [eventsByPostType]);
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
67
- // We also make sure this a is not escaped by a "/"
58
+ const settings = (0, _date.getSettings)();
68
59
 
60
+ // To know if the current timezone is a 12 hour time with look for "a" in the time format
61
+ // We also make sure this a is not escaped by a "/"
69
62
  const is12HourTime = /a(?!\\)/i.test(settings.formats.time.toLowerCase() // Test only the lower case a.
70
63
  .replace(/\\\\/g, '') // Replace "//" with empty strings.
71
64
  .split('').reverse().join('') // Reverse the string and test for "a" not followed by a slash.
72
65
  );
66
+
73
67
  return (0, _element.createElement)(_blockEditor.__experimentalPublishDateTimePicker, {
74
68
  currentDate: postDate,
75
69
  onChange: onUpdateDate,
@@ -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;AAG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AE;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"]}
1
+ {"version":3,"names":["_element","require","_dateFns","_date","_data","_blockEditor","_coreData","_store","PostSchedule","onClose","postDate","postType","useSelect","select","editorStore","getEditedPostAttribute","getCurrentPostType","editPost","useDispatch","onUpdateDate","date","previewedMonth","setPreviewedMonth","useState","startOfMonth","Date","eventsByPostType","coreStore","getEntityRecords","status","after","toISOString","before","endOfMonth","exclude","getCurrentPostId","per_page","_fields","events","useMemo","map","eventDate","settings","getSettings","is12HourTime","test","formats","time","toLowerCase","replace","split","reverse","join","createElement","__experimentalPublishDateTimePicker","currentDate","onChange","is12Hour","onMonthPreviewed","parseISO"],"sources":["@wordpress/editor/src/components/post-schedule/index.js"],"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"],"mappings":";;;;;;AAWA,IAAAA,QAAA,GAAAC,OAAA;AARA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAEA,IAAAK,SAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AAjBA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;;AAGe,SAASO,YAAYA,CAAE;EAAEC;AAAQ,CAAC,EAAG;EACnD,MAAM;IAAEC,QAAQ;IAAEC;EAAS,CAAC,GAAG,IAAAC,eAAS,EACrCC,MAAM,KAAQ;IACfH,QAAQ,EAAEG,MAAM,CAAEC,YAAY,CA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AC,iBAAW,EAAC,CAAC;;EAE9B;EACA;EACA,MAAMC,YAAY,GAAG,UAAU,CAACC,IAAI,CACnCH,QAAQ,CAACI,OAAO,CAACC,IAAI,CACnBC,WAAW,CAAC,CAAC,CAAC;EAAA,CACdC,OAAO,CAAE,OAAO,EAAE,EAAG,CAAC,CAAC;EAAA,CACvBC,KAAK,CAAE,EAAG,CAAC,CACXC,OAAO,CAAC,CAAC,CACTC,IAAI,CAAE,EAAG,CAAC,CAAC;EACd,CAAC;;EAED,OACC,IAAApD,QAAA,CAAAqD,aAAA,EAAChD,YAAA,CAAAiD,mCAAqB;IACrBC,WAAW,EAAG7C,QAAU;IACxB8C,QAAQ,EAAGrC,YAAc;IACzBsC,QAAQ,EAAGb,YAAc;IACzBN,MAAM,EAAGA,MAAQ;IACjBoB,gBAAgB,EAAKtC,IAAI,IACxBE,iBAAiB,CAAE,IAAAqC,iBAAQ,EAAEvC,IAAK,CAAE,CACpC;IACDX,OAAO,EAAGA;EAAS,CACnB,CAAC;AAEJ"}
@@ -7,15 +7,10 @@ exports.default = PostScheduleLabel;
7
7
  exports.getFullPostScheduleLabel = getFullPostScheduleLabel;
8
8
  exports.getPostScheduleLabel = getPostScheduleLabel;
9
9
  exports.usePostScheduleLabel = usePostScheduleLabel;
10
-
11
10
  var _i18n = require("@wordpress/i18n");
12
-
13
11
  var _date = require("@wordpress/date");
14
-
15
12
  var _data = require("@wordpress/data");
16
-
17
13
  var _store = require("../../store");
18
-
19
14
  /**
20
15
  * WordPress dependencies
21
16
  */
@@ -23,10 +18,10 @@ var _store = require("../../store");
23
18
  /**
24
19
  * Internal dependencies
25
20
  */
21
+
26
22
  function PostScheduleLabel(props) {
27
23
  return usePostScheduleLabel(props);
28
24
  }
29
-
30
25
  function usePostScheduleLabel({
31
26
  full = false
32
27
  } = {}) {
@@ -41,68 +36,63 @@ function usePostScheduleLabel({
41
36
  isFloating
42
37
  });
43
38
  }
44
-
45
39
  function getFullPostScheduleLabel(dateAttribute) {
46
40
  const date = (0, _date.getDate)(dateAttribute);
47
41
  const timezoneAbbreviation = getTimezoneAbbreviation();
48
- const formattedDate = (0, _date.dateI18n)( // translators: If using a space between 'g:i' and 'a', use a non-breaking space.
42
+ const formattedDate = (0, _date.dateI18n)(
43
+ // translators: If using a space between 'g:i' and 'a', use a non-breaking space.
49
44
  (0, _i18n._x)('F j, Y g:i\xa0a', 'post schedule full date format'), date);
50
45
  return (0, _i18n.isRTL)() ? `${timezoneAbbreviation} ${formattedDate}` : `${formattedDate} ${timezoneAbbreviation}`;
51
46
  }
52
-
53
47
  function getPostScheduleLabel(dateAttribute, {
54
48
  isFloating = false,
55
49
  now = new Date()
56
50
  } = {}) {
57
51
  if (!dateAttribute || isFloating) {
58
52
  return (0, _i18n.__)('Immediately');
59
- } // If the user timezone does not equal the site timezone then using words
60
- // like 'tomorrow' is confusing, so show the full date.
61
-
53
+ }
62
54
 
55
+ // If the user timezone does not equal the site timezone then using words
56
+ // like 'tomorrow' is confusing, so show the full date.
63
57
  if (!isTimezoneSameAsSiteTimezone(now)) {
64
58
  return getFullPostScheduleLabel(dateAttribute);
65
59
  }
66
-
67
60
  const date = (0, _date.getDate)(dateAttribute);
68
-
69
61
  if (isSameDay(date, now)) {
70
- return (0, _i18n.sprintf)( // translators: %s: Time of day the post is scheduled for.
71
- (0, _i18n.__)('Today at %s'), // translators: If using a space between 'g:i' and 'a', use a non-breaking space.
62
+ return (0, _i18n.sprintf)(
63
+ // translators: %s: Time of day the post is scheduled for.
64
+ (0, _i18n.__)('Today at %s'),
65
+ // translators: If using a space between 'g:i' and 'a', use a non-breaking space.
72
66
  (0, _date.dateI18n)((0, _i18n._x)('g:i\xa0a', 'post schedule time format'), date));
73
67
  }
74
-
75
68
  const tomorrow = new Date(now);
76
69
  tomorrow.setDate(tomorrow.getDate() + 1);
77
-
78
70
  if (isSameDay(date, tomorrow)) {
79
- return (0, _i18n.sprintf)( // translators: %s: Time of day the post is scheduled for.
80
- (0, _i18n.__)('Tomorrow at %s'), // translators: If using a space between 'g:i' and 'a', use a non-breaking space.
71
+ return (0, _i18n.sprintf)(
72
+ // translators: %s: Time of day the post is scheduled for.
73
+ (0, _i18n.__)('Tomorrow at %s'),
74
+ // translators: If using a space between 'g:i' and 'a', use a non-breaking space.
81
75
  (0, _date.dateI18n)((0, _i18n._x)('g:i\xa0a', 'post schedule time format'), date));
82
76
  }
83
-
84
77
  if (date.getFullYear() === now.getFullYear()) {
85
- return (0, _date.dateI18n)( // translators: If using a space between 'g:i' and 'a', use a non-breaking space.
78
+ return (0, _date.dateI18n)(
79
+ // translators: If using a space between 'g:i' and 'a', use a non-breaking space.
86
80
  (0, _i18n._x)('F j g:i\xa0a', 'post schedule date format without year'), date);
87
81
  }
88
-
89
- return (0, _date.dateI18n)( // translators: Use a non-breaking space between 'g:i' and 'a' if appropriate.
82
+ return (0, _date.dateI18n)(
83
+ // translators: Use a non-breaking space between 'g:i' and 'a' if appropriate.
90
84
  (0, _i18n._x)('F j, Y g:i\xa0a', 'post schedule full date format'), date);
91
85
  }
92
-
93
86
  function getTimezoneAbbreviation() {
94
87
  const {
95
88
  timezone
96
89
  } = (0, _date.getSettings)();
97
-
98
90
  if (timezone.abbr && isNaN(Number(timezone.abbr))) {
99
91
  return timezone.abbr;
100
92
  }
101
-
102
93
  const symbol = timezone.offset < 0 ? '' : '+';
103
94
  return `UTC${symbol}${timezone.offset}`;
104
95
  }
105
-
106
96
  function isTimezoneSameAsSiteTimezone(date) {
107
97
  const {
108
98
  timezone
@@ -111,7 +101,6 @@ function isTimezoneSameAsSiteTimezone(date) {
111
101
  const dateOffset = -1 * (date.getTimezoneOffset() / 60);
112
102
  return siteOffset === dateOffset;
113
103
  }
114
-
115
104
  function isSameDay(left, right) {
116
105
  return left.getDate() === right.getDate() && left.getMonth() === right.getMonth() && left.getFullYear() === right.getFullYear();
117
106
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-schedule/label.js"],"names":["PostScheduleLabel","props","usePostScheduleLabel","full","date","isFloating","select","editorStore","getEditedPostAttribute","isEditedPostDateFloating","getFullPostScheduleLabel","getPostScheduleLabel","dateAttribute","timezoneAbbreviation","getTimezoneAbbreviation","formattedDate","now","Date","isTimezoneSameAsSiteTimezone","isSameDay","tomorrow","setDate","getDate","getFullYear","timezone","abbr","isNaN","Number","symbol","offset","siteOffset","dateOffset","getTimezoneOffset","left","right","getMonth"],"mappings":";;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAVA;AACA;AACA;;AAKA;AACA;AACA;AAGe,SAASA,iBAAT,CAA4BC,KAA5B,EAAoC;AAClD,SAAOC,oBAAoB,CAAED,KAAF,CAA3B;AACA;;AAEM,SAASC,oBAAT,CAA+B;AAAEC,EAAAA,IAAI,GAAG;AAAT,IAAmB,EAAlD,EAAuD;AAC7D,QAAM;AAAEC,IAAAA,IAAF;AAAQC,IAAAA;AAAR,MAAuB,qBAC1BC,MAAF,KAAgB;AACfF,IAAAA,IAAI,EAAEE,MAAM,CAAEC,YAAF,CAAN,CAAsBC,sBAAtB,CAA8C,MAA9C,CADS;AAEfH,IAAAA,UAAU,EAAEC,MAAM,CAAEC,YAAF,CAAN,CAAsBE,wBAAtB;AAFG,GAAhB,CAD4B,EAK5B,EAL4B,CAA7B;AAQA,SAAON,IAAI,GACRO,wBAAwB,CAAEN,IAAF,CADhB,GAERO,oBAAoB,CAAEP,IAAF,EAAQ;AAAEC,IAAAA;AAAF,GAAR,CAFvB;AAGA;;AAEM,SAASK,wBAAT,CAAmCE,aAAnC,EAAmD;AACzD,QAAMR,IAAI,GAAG,mBAASQ,aAAT,CAAb;AAEA,QAAMC,oBAAoB,GAAGC,uBAAuB,EAApD;AACA,QAAMC,aAAa,GAAG,qBACrB;AACA,gBAAI,iBAAJ,EAAuB,gCAAvB,CAFqB,EAGrBX,IAHqB,CAAtB;AAKA,SAAO,qBACH,GAAGS,oBAAsB,IAAIE,aAAe,EADzC,GAEH,GAAGA,aAAe,IAAIF,oBAAsB,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Ae,wBAArB;;AAEA,MAAKA,QAAQ,CAACC,IAAT,IAAiBC,KAAK,CAAEC,MAAM,CAAEH,QAAQ,CAACC,IAAX,CAAR,CAA3B,EAAyD;AACxD,WAAOD,QAAQ,CAACC,IAAhB;AACA;;AAED,QAAMG,MAAM,GAAGJ,QAAQ,CAACK,MAAT,GAAkB,CAAlB,GAAsB,EAAtB,GAA2B,GAA1C;AACA,SAAQ,MAAMD,MAAQ,GAAGJ,QAAQ,CAACK,MAAQ,EAA1C;AACA;;AAED,SAASX,4BAAT,CAAuCd,IAAvC,EAA8C;AAC7C,QAAM;AAAEoB,IAAAA;AAAF,MAAe,wBAArB;AAEA,QAAMM,UAAU,GAAGH,MAAM,CAAEH,QAAQ,CAACK,MAAX,CAAzB;AACA,QAAME,UAAU,GAAG,CAAC,CAAD,IAAO3B,IAAI,CAAC4B,iBAAL,KAA2B,EAAlC,CAAnB;AACA,SAAOF,UAAU,KAAKC,UAAtB;AACA;;AAED,SAASZ,SAAT,CAAoBc,IAApB,EAA0BC,KAA1B,EAAkC;AACjC,SACCD,IAAI,CAACX,OAAL,OAAmBY,KAAK,CAACZ,OAAN,EAAnB,IACAW,IAAI,CAACE,QAAL,OAAoBD,KAAK,CAACC,QAAN,EADpB,IAEAF,IAAI,CAACV,WAAL,OAAuBW,KAAK,CAACX,WAAN,EAHxB;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf, isRTL } from '@wordpress/i18n';\nimport { getSettings, getDate, dateI18n } from '@wordpress/date';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function PostScheduleLabel( props ) {\n\treturn usePostScheduleLabel( props );\n}\n\nexport function usePostScheduleLabel( { full = false } = {} ) {\n\tconst { date, isFloating } = useSelect(\n\t\t( select ) => ( {\n\t\t\tdate: select( editorStore ).getEditedPostAttribute( 'date' ),\n\t\t\tisFloating: select( editorStore ).isEditedPostDateFloating(),\n\t\t} ),\n\t\t[]\n\t);\n\n\treturn full\n\t\t? getFullPostScheduleLabel( date )\n\t\t: getPostScheduleLabel( date, { isFloating } );\n}\n\nexport function getFullPostScheduleLabel( dateAttribute ) {\n\tconst date = getDate( dateAttribute );\n\n\tconst timezoneAbbreviation = getTimezoneAbbreviation();\n\tconst formattedDate = dateI18n(\n\t\t// translators: If using a space between 'g:i' and 'a', use a non-breaking space.\n\t\t_x( 'F j, Y g:i\\xa0a', 'post schedule full date format' ),\n\t\tdate\n\t);\n\treturn isRTL()\n\t\t? `${ timezoneAbbreviation } ${ formattedDate }`\n\t\t: `${ formattedDate } ${ timezoneAbbreviation }`;\n}\n\nexport function getPostScheduleLabel(\n\tdateAttribute,\n\t{ isFloating = false, now = new Date() } = {}\n) {\n\tif ( ! dateAttribute || isFloating ) {\n\t\treturn __( 'Immediately' );\n\t}\n\n\t// If the user timezone does not equal the site timezone then using words\n\t// like 'tomorrow' is confusing, so show the full date.\n\tif ( ! isTimezoneSameAsSiteTimezone( now ) ) {\n\t\treturn getFullPostScheduleLabel( dateAttribute );\n\t}\n\n\tconst date = getDate( dateAttribute );\n\n\tif ( isSameDay( date, now ) ) {\n\t\treturn sprintf(\n\t\t\t// translators: %s: Time of day the post is scheduled for.\n\t\t\t__( 'Today at %s' ),\n\t\t\t// translators: If using a space between 'g:i' and 'a', use a non-breaking space.\n\t\t\tdateI18n( _x( 'g:i\\xa0a', 'post schedule time format' ), date )\n\t\t);\n\t}\n\n\tconst tomorrow = new Date( now );\n\ttomorrow.setDate( tomorrow.getDate() + 1 );\n\n\tif ( isSameDay( date, tomorrow ) ) {\n\t\treturn sprintf(\n\t\t\t// translators: %s: Time of day the post is scheduled for.\n\t\t\t__( 'Tomorrow at %s' ),\n\t\t\t// translators: If using a space between 'g:i' and 'a', use a non-breaking space.\n\t\t\tdateI18n( _x( 'g:i\\xa0a', 'post schedule time format' ), date )\n\t\t);\n\t}\n\n\tif ( date.getFullYear() === now.getFullYear() ) {\n\t\treturn dateI18n(\n\t\t\t// translators: If using a space between 'g:i' and 'a', use a non-breaking space.\n\t\t\t_x( 'F j g:i\\xa0a', 'post schedule date format without year' ),\n\t\t\tdate\n\t\t);\n\t}\n\n\treturn dateI18n(\n\t\t// translators: Use a non-breaking space between 'g:i' and 'a' if appropriate.\n\t\t_x( 'F j, Y g:i\\xa0a', 'post schedule full date format' ),\n\t\tdate\n\t);\n}\n\nfunction getTimezoneAbbreviation() {\n\tconst { timezone } = getSettings();\n\n\tif ( timezone.abbr && isNaN( Number( timezone.abbr ) ) ) {\n\t\treturn timezone.abbr;\n\t}\n\n\tconst symbol = timezone.offset < 0 ? '' : '+';\n\treturn `UTC${ symbol }${ timezone.offset }`;\n}\n\nfunction isTimezoneSameAsSiteTimezone( date ) {\n\tconst { timezone } = getSettings();\n\n\tconst siteOffset = Number( timezone.offset );\n\tconst dateOffset = -1 * ( date.getTimezoneOffset() / 60 );\n\treturn siteOffset === dateOffset;\n}\n\nfunction isSameDay( left, right ) {\n\treturn (\n\t\tleft.getDate() === right.getDate() &&\n\t\tleft.getMonth() === right.getMonth() &&\n\t\tleft.getFullYear() === right.getFullYear()\n\t);\n}\n"]}
1
+ {"version":3,"names":["_i18n","require","_date","_data","_store","PostScheduleLabel","props","usePostScheduleLabel","full","date","isFloating","useSelect","select","editorStore","getEditedPostAttribute","isEditedPostDateFloating","getFullPostScheduleLabel","getPostScheduleLabel","dateAttribute","getDate","timezoneAbbreviation","getTimezoneAbbreviation","formattedDate","dateI18n","_x","isRTL","now","Date","__","isTimezoneSameAsSiteTimezone","isSameDay","sprintf","tomorrow","setDate","getFullYear","timezone","getSettings","abbr","isNaN","Number","symbol","offset","siteOffset","dateOffset","getTimezoneOffset","left","right","getMonth"],"sources":["@wordpress/editor/src/components/post-schedule/label.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf, isRTL } from '@wordpress/i18n';\nimport { getSettings, getDate, dateI18n } from '@wordpress/date';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function PostScheduleLabel( props ) {\n\treturn usePostScheduleLabel( props );\n}\n\nexport function usePostScheduleLabel( { full = false } = {} ) {\n\tconst { date, isFloating } = useSelect(\n\t\t( select ) => ( {\n\t\t\tdate: select( editorStore ).getEditedPostAttribute( 'date' ),\n\t\t\tisFloating: select( editorStore ).isEditedPostDateFloating(),\n\t\t} ),\n\t\t[]\n\t);\n\n\treturn full\n\t\t? getFullPostScheduleLabel( date )\n\t\t: getPostScheduleLabel( date, { isFloating } );\n}\n\nexport function getFullPostScheduleLabel( dateAttribute ) {\n\tconst date = getDate( dateAttribute );\n\n\tconst timezoneAbbreviation = getTimezoneAbbreviation();\n\tconst formattedDate = dateI18n(\n\t\t// translators: If using a space between 'g:i' and 'a', use a non-breaking space.\n\t\t_x( 'F j, Y g:i\\xa0a', 'post schedule full date format' ),\n\t\tdate\n\t);\n\treturn isRTL()\n\t\t? `${ timezoneAbbreviation } ${ formattedDate }`\n\t\t: `${ formattedDate } ${ timezoneAbbreviation }`;\n}\n\nexport function getPostScheduleLabel(\n\tdateAttribute,\n\t{ isFloating = false, now = new Date() } = {}\n) {\n\tif ( ! dateAttribute || isFloating ) {\n\t\treturn __( 'Immediately' );\n\t}\n\n\t// If the user timezone does not equal the site timezone then using words\n\t// like 'tomorrow' is confusing, so show the full date.\n\tif ( ! isTimezoneSameAsSiteTimezone( now ) ) {\n\t\treturn getFullPostScheduleLabel( dateAttribute );\n\t}\n\n\tconst date = getDate( dateAttribute );\n\n\tif ( isSameDay( date, now ) ) {\n\t\treturn sprintf(\n\t\t\t// translators: %s: Time of day the post is scheduled for.\n\t\t\t__( 'Today at %s' ),\n\t\t\t// translators: If using a space between 'g:i' and 'a', use a non-breaking space.\n\t\t\tdateI18n( _x( 'g:i\\xa0a', 'post schedule time format' ), date )\n\t\t);\n\t}\n\n\tconst tomorrow = new Date( now );\n\ttomorrow.setDate( tomorrow.getDate() + 1 );\n\n\tif ( isSameDay( date, tomorrow ) ) {\n\t\treturn sprintf(\n\t\t\t// translators: %s: Time of day the post is scheduled for.\n\t\t\t__( 'Tomorrow at %s' ),\n\t\t\t// translators: If using a space between 'g:i' and 'a', use a non-breaking space.\n\t\t\tdateI18n( _x( 'g:i\\xa0a', 'post schedule time format' ), date )\n\t\t);\n\t}\n\n\tif ( date.getFullYear() === now.getFullYear() ) {\n\t\treturn dateI18n(\n\t\t\t// translators: If using a space between 'g:i' and 'a', use a non-breaking space.\n\t\t\t_x( 'F j g:i\\xa0a', 'post schedule date format without year' ),\n\t\t\tdate\n\t\t);\n\t}\n\n\treturn dateI18n(\n\t\t// translators: Use a non-breaking space between 'g:i' and 'a' if appropriate.\n\t\t_x( 'F j, Y g:i\\xa0a', 'post schedule full date format' ),\n\t\tdate\n\t);\n}\n\nfunction getTimezoneAbbreviation() {\n\tconst { timezone } = getSettings();\n\n\tif ( timezone.abbr && isNaN( Number( timezone.abbr ) ) ) {\n\t\treturn timezone.abbr;\n\t}\n\n\tconst symbol = timezone.offset < 0 ? '' : '+';\n\treturn `UTC${ symbol }${ timezone.offset }`;\n}\n\nfunction isTimezoneSameAsSiteTimezone( date ) {\n\tconst { timezone } = getSettings();\n\n\tconst siteOffset = Number( timezone.offset );\n\tconst dateOffset = -1 * ( date.getTimezoneOffset() / 60 );\n\treturn siteOffset === dateOffset;\n}\n\nfunction isSameDay( left, right ) {\n\treturn (\n\t\tleft.getDate() === right.getDate() &&\n\t\tleft.getMonth() === right.getMonth() &&\n\t\tleft.getFullYear() === right.getFullYear()\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AAVA;AACA;AACA;;AAKA;AACA;AACA;;AAGe,SAASI,iBAAiBA,CAAEC,KAAK,EAAG;EAClD,OAAOC,oBAAoB,CAAED,KAAM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AACM,MAAM,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG;EAC7C,OAAQ,MAAMD,MAAQ,GAAGL,QAAQ,CAACM,MAAQ,EAAC;AAC5C;AAEA,SAASZ,4BAA4BA,CAAEpB,IAAI,EAAG;EAC7C,MAAM;IAAE0B;EAAS,CAAC,GAAG,IAAAC,iBAAW,EAAC,CAAC;EAElC,MAAMM,UAAU,GAAGH,MAAM,CAAEJ,QAAQ,CAACM,MAAO,CAAC;EAC5C,MAAME,UAAU,GAAG,CAAC,CAAC,IAAKlC,IAAI,CAACmC,iBAAiB,CAAC,CAAC,GAAG,EAAE,CAAE;EACzD,OAAOF,UAAU,KAAKC,UAAU;AACjC;AAEA,SAASb,SAASA,CAAEe,IAAI,EAAEC,KAAK,EAAG;EACjC,OACCD,IAAI,CAAC1B,OAAO,CAAC,CAAC,KAAK2B,KAAK,CAAC3B,OAAO,CAAC,CAAC,IAClC0B,IAAI,CAACE,QAAQ,CAAC,CAAC,KAAKD,KAAK,CAACC,QAAQ,CAAC,CAAC,IACpCF,IAAI,CAACX,WAAW,CAAC,CAAC,KAAKY,KAAK,CAACZ,WAAW,CAAC,CAAC;AAE5C"}
@@ -1,19 +1,16 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = PostSlugCheck;
9
-
10
8
  var _element = require("@wordpress/element");
11
-
12
9
  var _postTypeSupportCheck = _interopRequireDefault(require("../post-type-support-check"));
13
-
14
10
  /**
15
11
  * Internal dependencies
16
12
  */
13
+
17
14
  function PostSlugCheck({
18
15
  children
19
16
  }) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-slug/check.js"],"names":["PostSlugCheck","children"],"mappings":";;;;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGe,SAASA,aAAT,CAAwB;AAAEC,EAAAA;AAAF,CAAxB,EAAuC;AACrD,SACC,4BAAC,6BAAD;AAAsB,IAAA,WAAW,EAAC;AAAlC,KACGA,QADH,CADD;AAKA","sourcesContent":["/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\n\nexport default function PostSlugCheck( { children } ) {\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"slug\">\n\t\t\t{ children }\n\t\t</PostTypeSupportCheck>\n\t);\n}\n"]}
1
+ {"version":3,"names":["_postTypeSupportCheck","_interopRequireDefault","require","PostSlugCheck","children","_element","createElement","default","supportKeys"],"sources":["@wordpress/editor/src/components/post-slug/check.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\n\nexport default function PostSlugCheck( { children } ) {\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"slug\">\n\t\t\t{ children }\n\t\t</PostTypeSupportCheck>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGe,SAASC,aAAaA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACrD,OACC,IAAAC,QAAA,CAAAC,aAAA,EAACN,qBAAA,CAAAO,OAAoB;IAACC,WAAW,EAAC;EAAM,GACrCJ,QACmB,CAAC;AAEzB"}
@@ -1,28 +1,18 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = exports.PostSlug = void 0;
9
-
10
8
  var _element = require("@wordpress/element");
11
-
12
9
  var _data = require("@wordpress/data");
13
-
14
10
  var _i18n = require("@wordpress/i18n");
15
-
16
11
  var _compose = require("@wordpress/compose");
17
-
18
12
  var _url = require("@wordpress/url");
19
-
20
13
  var _components = require("@wordpress/components");
21
-
22
14
  var _check = _interopRequireDefault(require("./check"));
23
-
24
15
  var _store = require("../../store");
25
-
26
16
  /**
27
17
  * WordPress dependencies
28
18
  */
@@ -30,6 +20,7 @@ var _store = require("../../store");
30
20
  /**
31
21
  * Internal dependencies
32
22
  */
23
+
33
24
  class PostSlug extends _element.Component {
34
25
  constructor({
35
26
  postSlug,
@@ -42,7 +33,6 @@ class PostSlug extends _element.Component {
42
33
  };
43
34
  this.setSlug = this.setSlug.bind(this);
44
35
  }
45
-
46
36
  setSlug(event) {
47
37
  const {
48
38
  postSlug,
@@ -52,14 +42,11 @@ class PostSlug extends _element.Component {
52
42
  value
53
43
  } = event.target;
54
44
  const editedSlug = (0, _url.cleanForSlug)(value);
55
-
56
45
  if (editedSlug === postSlug) {
57
46
  return;
58
47
  }
59
-
60
48
  onUpdateSlug(editedSlug);
61
49
  }
62
-
63
50
  render() {
64
51
  const {
65
52
  editedSlug
@@ -77,11 +64,8 @@ class PostSlug extends _element.Component {
77
64
  className: "editor-post-slug"
78
65
  }));
79
66
  }
80
-
81
67
  }
82
-
83
68
  exports.PostSlug = PostSlug;
84
-
85
69
  var _default = (0, _compose.compose)([(0, _data.withSelect)(select => {
86
70
  const {
87
71
  getCurrentPost,
@@ -105,9 +89,7 @@ var _default = (0, _compose.compose)([(0, _data.withSelect)(select => {
105
89
  slug
106
90
  });
107
91
  }
108
-
109
92
  };
110
93
  })])(PostSlug);
111
-
112
94
  exports.default = _default;
113
95
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-slug/index.js"],"names":["PostSlug","Component","constructor","postSlug","postTitle","postID","arguments","state","editedSlug","setSlug","bind","event","onUpdateSlug","props","value","target","render","slug","setState","select","getCurrentPost","getEditedPostAttribute","editorStore","id","dispatch","editPost"],"mappings":";;;;;;;;;AAIA;;AADA;;AAEA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAdA;AACA;AACA;;AAQA;AACA;AACA;AAIO,MAAMA,QAAN,SAAuBC,kBAAvB,CAAiC;AACvCC,EAAAA,WAAW,CAAE;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AAEC,IAAAA;AAAF,MAASH,cAAc,EAA7B;AACA,SAAO;AACNjB,IAAAA,QAAQ,EAAEkB,sBAAsB,CAAE,MAAF,CAD1B;AAENjB,IAAAA,SAAS,EAAEiB,sBAAsB,CAAE,OAAF,CAF3B;AAGNhB,IAAAA,MAAM,EAAEkB;AAHF,GAAP;AAKA,CAVD,CADuB,EAYvB,wBAAgBC,QAAF,IAAgB;AAC7B,QAAM;AAAEC,IAAAA;AAAF,MAAeD,QAAQ,CAAEF,YAAF,CAA7B;AACA,SAAO;AACNV,IAAAA,YAAY,CAAEK,IAAF,EAAS;AACpBQ,MAAAA,QAAQ,CAAE;AAAER,QAAAA;AAAF,OAAF,CAAR;AACA;;AAHK,GAAP;AAKA,CAPD,CAZuB,CAAT,EAoBVjB,QApBU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { compose } from '@wordpress/compose';\nimport { safeDecodeURIComponent, cleanForSlug } from '@wordpress/url';\nimport { TextControl } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport PostSlugCheck from './check';\nimport { store as editorStore } from '../../store';\n\nexport class PostSlug extends Component {\n\tconstructor( { postSlug, postTitle, postID } ) {\n\t\tsuper( ...arguments );\n\n\t\tthis.state = {\n\t\t\teditedSlug:\n\t\t\t\tsafeDecodeURIComponent( postSlug ) ||\n\t\t\t\tcleanForSlug( postTitle ) ||\n\t\t\t\tpostID,\n\t\t};\n\n\t\tthis.setSlug = this.setSlug.bind( this );\n\t}\n\n\tsetSlug( event ) {\n\t\tconst { postSlug, onUpdateSlug } = this.props;\n\t\tconst { value } = event.target;\n\n\t\tconst editedSlug = cleanForSlug( value );\n\n\t\tif ( editedSlug === postSlug ) {\n\t\t\treturn;\n\t\t}\n\n\t\tonUpdateSlug( editedSlug );\n\t}\n\n\trender() {\n\t\tconst { editedSlug } = this.state;\n\t\treturn (\n\t\t\t<PostSlugCheck>\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Slug' ) }\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\tspellCheck=\"false\"\n\t\t\t\t\tvalue={ editedSlug }\n\t\t\t\t\tonChange={ ( slug ) =>\n\t\t\t\t\t\tthis.setState( { editedSlug: slug } )\n\t\t\t\t\t}\n\t\t\t\t\tonBlur={ this.setSlug }\n\t\t\t\t\tclassName=\"editor-post-slug\"\n\t\t\t\t/>\n\t\t\t</PostSlugCheck>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getCurrentPost, getEditedPostAttribute } =\n\t\t\tselect( editorStore );\n\n\t\tconst { id } = getCurrentPost();\n\t\treturn {\n\t\t\tpostSlug: getEditedPostAttribute( 'slug' ),\n\t\t\tpostTitle: getEditedPostAttribute( 'title' ),\n\t\t\tpostID: id,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonUpdateSlug( slug ) {\n\t\t\t\teditPost( { slug } );\n\t\t\t},\n\t\t};\n\t} ),\n] )( PostSlug );\n"]}
1
+ {"version":3,"names":["_element","require","_data","_i18n","_compose","_url","_components","_check","_interopRequireDefault","_store","PostSlug","Component","constructor","postSlug","postTitle","postID","arguments","state","editedSlug","safeDecodeURIComponent","cleanForSlug","setSlug","bind","event","onUpdateSlug","props","value","target","render","createElement","default","TextControl","__nextHasNoMarginBottom","label","__","autoComplete","spellCheck","onChange","slug","setState","onBlur","className","exports","_default","compose","withSelect","select","getCurrentPost","getEditedPostAttribute","editorStore","id","withDispatch","dispatch","editPost"],"sources":["@wordpress/editor/src/components/post-slug/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { compose } from '@wordpress/compose';\nimport { safeDecodeURIComponent, cleanForSlug } from '@wordpress/url';\nimport { TextControl } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport PostSlugCheck from './check';\nimport { store as editorStore } from '../../store';\n\nexport class PostSlug extends Component {\n\tconstructor( { postSlug, postTitle, postID } ) {\n\t\tsuper( ...arguments );\n\n\t\tthis.state = {\n\t\t\teditedSlug:\n\t\t\t\tsafeDecodeURIComponent( postSlug ) ||\n\t\t\t\tcleanForSlug( postTitle ) ||\n\t\t\t\tpostID,\n\t\t};\n\n\t\tthis.setSlug = this.setSlug.bind( this );\n\t}\n\n\tsetSlug( event ) {\n\t\tconst { postSlug, onUpdateSlug } = this.props;\n\t\tconst { value } = event.target;\n\n\t\tconst editedSlug = cleanForSlug( value );\n\n\t\tif ( editedSlug === postSlug ) {\n\t\t\treturn;\n\t\t}\n\n\t\tonUpdateSlug( editedSlug );\n\t}\n\n\trender() {\n\t\tconst { editedSlug } = this.state;\n\t\treturn (\n\t\t\t<PostSlugCheck>\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Slug' ) }\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\tspellCheck=\"false\"\n\t\t\t\t\tvalue={ editedSlug }\n\t\t\t\t\tonChange={ ( slug ) =>\n\t\t\t\t\t\tthis.setState( { editedSlug: slug } )\n\t\t\t\t\t}\n\t\t\t\t\tonBlur={ this.setSlug }\n\t\t\t\t\tclassName=\"editor-post-slug\"\n\t\t\t\t/>\n\t\t\t</PostSlugCheck>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getCurrentPost, getEditedPostAttribute } =\n\t\t\tselect( editorStore );\n\n\t\tconst { id } = getCurrentPost();\n\t\treturn {\n\t\t\tpostSlug: getEditedPostAttribute( 'slug' ),\n\t\t\tpostTitle: getEditedPostAttribute( 'title' ),\n\t\t\tpostID: id,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonUpdateSlug( slug ) {\n\t\t\t\teditPost( { slug } );\n\t\t\t},\n\t\t};\n\t} ),\n] )( PostSlug );\n"],"mappings":";;;;;;;AAIA,IAAAA,QAAA,GAAAC,OAAA;AADA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAdA;AACA;AACA;;AAQA;AACA;AACA;;AAIO,MAAMS,QAAQ,SAASC,kBAAS,CAAC;EACvCC,WAAWA,CAAE;IAAEC,QAAQ;IAAEC,SAAS;IAAEC;EAAO,CAAC,EAAG;IAC9C,KAAK,CAAE,GAAGC,SAAU,CAAC;IAErB,IAAI,CAACC,KAAK,GAAG;MACZC,UAAU,EACT,IAAAC,2BAAsB,EAAEN,QAAS,CAAC,IAClC,IAAAO,iBAAY,EAAEN,SAAU,CAAC,IACzBC;IACF,CAAC;IAED,IAAI,CAACM,OAAO,GAAG,IAAI,CAACA,OAAO,CAACC,IAAI,CAAE,IAAK,CAAC;EACzC;EAEAD,OAAOA,CAAEE,KAAK,EAAG;IAChB,MAAM;MAAEV,QAAQ;MAAEW;IAAa,CAAC,GAAG,IAAI,CAACC,KAAK;IAC7C,MAAM;MAAEC;IAAM,CAAC,GAAGH,KAAK,CAACI,MAAM;IAE9B,MAAMT,UAAU,GAAG,IAAAE,iBAAY,EAAEM,KAAM,CAAC;IAExC,IAAKR,UAAU,KAAKL,QAAQ,EAAG;MAC9B;IACD;IAEAW,YAAY,CAAEN,UAAW,CAAC;EAC3B;EAEAU,MAAMA,CAAA,EAAG;IACR,MAAM;MAAEV;IAAW,CAAC,GAAG,IAAI,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