@wordpress/editor 13.15.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 (557) hide show
  1. package/CHANGELOG.md +4 -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 +11 -23
  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 +10 -27
  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 +11 -23
  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 +10 -23
  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 +8 -42
  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 +61 -130
  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 +170 -296
  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 +12 -19
  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 +11 -23
  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 +12 -19
  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 +14 -20
  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 +11 -39
  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 +63 -85
  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 +173 -223
  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-author/test/check.js +18 -12
  536. package/src/components/post-comments/index.js +11 -17
  537. package/src/components/post-excerpt/check.js +6 -2
  538. package/src/components/post-excerpt/index.js +10 -16
  539. package/src/components/post-featured-image/check.js +4 -2
  540. package/src/components/post-format/check.js +16 -11
  541. package/src/components/post-last-revision/check.js +12 -14
  542. package/src/components/post-last-revision/index.js +12 -10
  543. package/src/components/post-last-revision/test/check.js +28 -16
  544. package/src/components/post-pending-status/check.js +13 -19
  545. package/src/components/post-pending-status/index.js +9 -14
  546. package/src/components/post-pending-status/test/check.js +32 -10
  547. package/src/components/post-pingbacks/index.js +11 -15
  548. package/src/components/post-publish-panel/style.scss +12 -25
  549. package/src/components/post-sync-status/style.scss +4 -1
  550. package/src/components/post-type-support-check/index.js +8 -10
  551. package/src/components/post-type-support-check/test/index.js +36 -20
  552. package/src/components/provider/index.js +3 -2
  553. package/src/components/unsaved-changes-warning/index.js +22 -27
  554. package/src/hooks/custom-sources-backwards-compatibility.js +1 -25
  555. package/src/store/actions.js +1 -1
  556. package/src/store/selectors.js +2 -2
  557. package/src/store/test/selectors.js +13 -13
@@ -1,22 +1,21 @@
1
1
  import { createElement } from "@wordpress/element";
2
-
3
2
  /**
4
3
  * External dependencies
5
4
  */
6
5
  import { parseISO, endOfMonth, startOfMonth } from 'date-fns';
6
+
7
7
  /**
8
8
  * WordPress dependencies
9
9
  */
10
-
11
10
  import { getSettings } from '@wordpress/date';
12
11
  import { useDispatch, useSelect } from '@wordpress/data';
13
12
  import { __experimentalPublishDateTimePicker as PublishDateTimePicker } from '@wordpress/block-editor';
14
13
  import { useState, useMemo } from '@wordpress/element';
15
14
  import { store as coreStore } from '@wordpress/core-data';
15
+
16
16
  /**
17
17
  * Internal dependencies
18
18
  */
19
-
20
19
  import { store as editorStore } from '../../store';
21
20
  export default function PostSchedule({
22
21
  onClose
@@ -31,13 +30,12 @@ export default function PostSchedule({
31
30
  const {
32
31
  editPost
33
32
  } = useDispatch(editorStore);
34
-
35
33
  const onUpdateDate = date => editPost({
36
34
  date
37
35
  });
36
+ const [previewedMonth, setPreviewedMonth] = useState(startOfMonth(new Date(postDate)));
38
37
 
39
- const [previewedMonth, setPreviewedMonth] = useState(startOfMonth(new Date(postDate))); // Pick up published and schduled site posts.
40
-
38
+ // Pick up published and schduled site posts.
41
39
  const eventsByPostType = useSelect(select => select(coreStore).getEntityRecords('postType', postType, {
42
40
  status: 'publish,future',
43
41
  after: startOfMonth(previewedMonth).toISOString(),
@@ -51,13 +49,15 @@ export default function PostSchedule({
51
49
  }) => ({
52
50
  date: new Date(eventDate)
53
51
  })), [eventsByPostType]);
54
- const settings = getSettings(); // To know if the current timezone is a 12 hour time with look for "a" in the time format
55
- // We also make sure this a is not escaped by a "/"
52
+ const settings = getSettings();
56
53
 
54
+ // To know if the current timezone is a 12 hour time with look for "a" in the time format
55
+ // We also make sure this a is not escaped by a "/"
57
56
  const is12HourTime = /a(?!\\)/i.test(settings.formats.time.toLowerCase() // Test only the lower case a.
58
57
  .replace(/\\\\/g, '') // Replace "//" with empty strings.
59
58
  .split('').reverse().join('') // Reverse the string and test for "a" not followed by a slash.
60
59
  );
60
+
61
61
  return createElement(PublishDateTimePicker, {
62
62
  currentDate: postDate,
63
63
  onChange: onUpdateDate,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-schedule/index.js"],"names":["parseISO","endOfMonth","startOfMonth","getSettings","useDispatch","useSelect","__experimentalPublishDateTimePicker","PublishDateTimePicker","useState","useMemo","store","coreStore","editorStore","PostSchedule","onClose","postDate","postType","select","getEditedPostAttribute","getCurrentPostType","editPost","onUpdateDate","date","previewedMonth","setPreviewedMonth","Date","eventsByPostType","getEntityRecords","status","after","toISOString","before","exclude","getCurrentPostId","per_page","_fields","events","map","eventDate","settings","is12HourTime","test","formats","time","toLowerCase","replace","split","reverse","join"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,UAAnB,EAA+BC,YAA/B,QAAmD,UAAnD;AAEA;AACA;AACA;;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,mCAAmC,IAAIC,qBAAhD,QAA6E,yBAA7E;AACA,SAASC,QAAT,EAAmBC,OAAnB,QAAkC,oBAAlC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,aAArC;AAEA,eAAe,SAASC,YAAT,CAAuB;AAAEC,EAAAA;AAAF,CAAvB,EAAqC;AACnD,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAyBX,SAAS,CACrCY,MAAF,KAAgB;AACfF,IAAAA,QAAQ,EAAEE,MAAM,CAAEL,WAAF,CAAN,CAAsBM,sBAAtB,CAA8C,MAA9C,CADK;AAEfF,IAAAA,QAAQ,EAAEC,MAAM,CAAEL,WAAF,CAAN,CAAsBO,kBAAtB;AAFK,GAAhB,CADuC,EAKvC,EALuC,CAAxC;AAQA,QAAM;AAAEC,IAAAA;AAAF,MAAehB,WAAW,CAAEQ,WAAF,CAAhC;;AACA,QAAMS,YAAY,GAAKC,IAAF,IAAYF,QAAQ,CAAE;AAAEE,IAAAA;AAAF,GAAF,CAAzC;;AAEA,QAAM,CAAEC,cAAF,EAAkBC,iBAAlB,IAAwChB,QAAQ,CACrDN,YAAY,CAAE,IAAIuB,IAAJ,CAAUV,QAAV,CAAF,CADyC,CAAtD,CAZmD,CAgBnD;;AACA,QAAMW,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AGmB,YAHZ;AAIC,IAAA,MAAM,EAAGJ,MAJV;AAKC,IAAA,gBAAgB,EAAKd,IAAF,IAClBE,iBAAiB,CAAExB,QAAQ,CAAEsB,IAAF,CAAV,CANnB;AAQC,IAAA,OAAO,EAAGR;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":["parseISO","endOfMonth","startOfMonth","getSettings","useDispatch","useSelect","__experimentalPublishDateTimePicker","PublishDateTimePicker","useState","useMemo","store","coreStore","editorStore","PostSchedule","onClose","postDate","postType","select","getEditedPostAttribute","getCurrentPostType","editPost","onUpdateDate","date","previewedMonth","setPreviewedMonth","Date","eventsByPostType","getEntityRecords","status","after","toISOString","before","exclude","getCurrentPostId","per_page","_fields","events","map","eventDate","settings","is12HourTime","test","formats","time","toLowerCase","replace","split","reverse","join","createElement","currentDate","onChange","is12Hour","onMonthPreviewed"],"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={ onUp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E,CACpC;IACDR,OAAO,EAAGA;EAAS,CACnB,CAAC;AAEJ"}
@@ -4,10 +4,10 @@
4
4
  import { __, _x, sprintf, isRTL } from '@wordpress/i18n';
5
5
  import { getSettings, getDate, dateI18n } from '@wordpress/date';
6
6
  import { useSelect } from '@wordpress/data';
7
+
7
8
  /**
8
9
  * Internal dependencies
9
10
  */
10
-
11
11
  import { store as editorStore } from '../../store';
12
12
  export default function PostScheduleLabel(props) {
13
13
  return usePostScheduleLabel(props);
@@ -29,7 +29,8 @@ export function usePostScheduleLabel({
29
29
  export function getFullPostScheduleLabel(dateAttribute) {
30
30
  const date = getDate(dateAttribute);
31
31
  const timezoneAbbreviation = getTimezoneAbbreviation();
32
- const formattedDate = dateI18n( // translators: If using a space between 'g:i' and 'a', use a non-breaking space.
32
+ const formattedDate = dateI18n(
33
+ // translators: If using a space between 'g:i' and 'a', use a non-breaking space.
33
34
  _x('F j, Y g:i\xa0a', 'post schedule full date format'), date);
34
35
  return isRTL() ? `${timezoneAbbreviation} ${formattedDate}` : `${formattedDate} ${timezoneAbbreviation}`;
35
36
  }
@@ -39,53 +40,49 @@ export function getPostScheduleLabel(dateAttribute, {
39
40
  } = {}) {
40
41
  if (!dateAttribute || isFloating) {
41
42
  return __('Immediately');
42
- } // If the user timezone does not equal the site timezone then using words
43
- // like 'tomorrow' is confusing, so show the full date.
44
-
43
+ }
45
44
 
45
+ // If the user timezone does not equal the site timezone then using words
46
+ // like 'tomorrow' is confusing, so show the full date.
46
47
  if (!isTimezoneSameAsSiteTimezone(now)) {
47
48
  return getFullPostScheduleLabel(dateAttribute);
48
49
  }
49
-
50
50
  const date = getDate(dateAttribute);
51
-
52
51
  if (isSameDay(date, now)) {
53
- return sprintf( // translators: %s: Time of day the post is scheduled for.
54
- __('Today at %s'), // translators: If using a space between 'g:i' and 'a', use a non-breaking space.
52
+ return sprintf(
53
+ // translators: %s: Time of day the post is scheduled for.
54
+ __('Today at %s'),
55
+ // translators: If using a space between 'g:i' and 'a', use a non-breaking space.
55
56
  dateI18n(_x('g:i\xa0a', 'post schedule time format'), date));
56
57
  }
57
-
58
58
  const tomorrow = new Date(now);
59
59
  tomorrow.setDate(tomorrow.getDate() + 1);
60
-
61
60
  if (isSameDay(date, tomorrow)) {
62
- return sprintf( // translators: %s: Time of day the post is scheduled for.
63
- __('Tomorrow at %s'), // translators: If using a space between 'g:i' and 'a', use a non-breaking space.
61
+ return sprintf(
62
+ // translators: %s: Time of day the post is scheduled for.
63
+ __('Tomorrow at %s'),
64
+ // translators: If using a space between 'g:i' and 'a', use a non-breaking space.
64
65
  dateI18n(_x('g:i\xa0a', 'post schedule time format'), date));
65
66
  }
66
-
67
67
  if (date.getFullYear() === now.getFullYear()) {
68
- return dateI18n( // translators: If using a space between 'g:i' and 'a', use a non-breaking space.
68
+ return dateI18n(
69
+ // translators: If using a space between 'g:i' and 'a', use a non-breaking space.
69
70
  _x('F j g:i\xa0a', 'post schedule date format without year'), date);
70
71
  }
71
-
72
- return dateI18n( // translators: Use a non-breaking space between 'g:i' and 'a' if appropriate.
72
+ return dateI18n(
73
+ // translators: Use a non-breaking space between 'g:i' and 'a' if appropriate.
73
74
  _x('F j, Y g:i\xa0a', 'post schedule full date format'), date);
74
75
  }
75
-
76
76
  function getTimezoneAbbreviation() {
77
77
  const {
78
78
  timezone
79
79
  } = getSettings();
80
-
81
80
  if (timezone.abbr && isNaN(Number(timezone.abbr))) {
82
81
  return timezone.abbr;
83
82
  }
84
-
85
83
  const symbol = timezone.offset < 0 ? '' : '+';
86
84
  return `UTC${symbol}${timezone.offset}`;
87
85
  }
88
-
89
86
  function isTimezoneSameAsSiteTimezone(date) {
90
87
  const {
91
88
  timezone
@@ -94,7 +91,6 @@ function isTimezoneSameAsSiteTimezone(date) {
94
91
  const dateOffset = -1 * (date.getTimezoneOffset() / 60);
95
92
  return siteOffset === dateOffset;
96
93
  }
97
-
98
94
  function isSameDay(left, right) {
99
95
  return left.getDate() === right.getDate() && left.getMonth() === right.getMonth() && left.getFullYear() === right.getFullYear();
100
96
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-schedule/label.js"],"names":["__","_x","sprintf","isRTL","getSettings","getDate","dateI18n","useSelect","store","editorStore","PostScheduleLabel","props","usePostScheduleLabel","full","date","isFloating","select","getEditedPostAttribute","isEditedPostDateFloating","getFullPostScheduleLabel","getPostScheduleLabel","dateAttribute","timezoneAbbreviation","getTimezoneAbbreviation","formattedDate","now","Date","isTimezoneSameAsSiteTimezone","isSameDay","tomorrow","setDate","getFullYear","timezone","abbr","isNaN","Number","symbol","offset","siteOffset","dateOffset","getTimezoneOffset","left","right","getMonth"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,EAA0BC,KAA1B,QAAuC,iBAAvC;AACA,SAASC,WAAT,EAAsBC,OAAtB,EAA+BC,QAA/B,QAA+C,iBAA/C;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;AAEA,eAAe,SAASC,iBAAT,CAA4BC,KAA5B,EAAoC;AAClD,SAAOC,oBAAoB,CAAED,KAAF,CAA3B;AACA;AAED,OAAO,SAASC,oBAAT,CAA+B;AAAEC,EAAAA,IAAI,GAAG;AAAT,IAAmB,EAAlD,EAAuD;AAC7D,QAAM;AAAEC,IAAAA,IAAF;AAAQC,IAAAA;AAAR,MAAuBR,SAAS,CACnCS,MAAF,KAAgB;AACfF,IAAAA,IAAI,EAAEE,MAAM,CAAEP,WAAF,CAAN,CAAsBQ,sBAAtB,CAA8C,MAA9C,CADS;AAEfF,IAAAA,UAAU,EAAEC,MAAM,CAAEP,WAAF,CAAN,CAAsBS,wBAAtB;AAFG,GAAhB,CADqC,EAKrC,EALqC,CAAtC;AAQA,SAAOL,IAAI,GACRM,wBAAwB,CAAEL,IAAF,CADhB,GAERM,oBAAoB,CAAEN,IAAF,EAAQ;AAAEC,IAAAA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C,OAAN,EAAnB,IACAoC,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":["__","_x","sprintf","isRTL","getSettings","getDate","dateI18n","useSelect","store","editorStore","PostScheduleLabel","props","usePostScheduleLabel","full","date","isFloating","select","getEditedPostAttribute","isEditedPostDateFloating","getFullPostScheduleLabel","getPostScheduleLabel","dateAttribute","timezoneAbbreviation","getTimezoneAbbreviation","formattedDate","now","Date","isTimezoneSameAsSiteTimezone","isSameDay","tomorrow","setDate","getFullYear","timezone","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":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,EAAE,EAAEC,OAAO,EAAEC,KAAK,QAAQ,iBAAiB;AACxD,SAASC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,iBAAiB;AAChE,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAElD,eAAe,SAASC,iBAAiBA,CAAEC,KAAK,EAAG;EAClD,OAAOC,oBAAoB,CAAED,KAAM,CAAC;AACrC;AAEA,OAAO,SAASC,oBAAoBA,CAAE;EAAEC,IAAI,GAAG;AAAM,CAAC,GAAG,CAAC,CAAC,EAAG;EAC7D,MAAM;IAAEC,IAAI;IAAEC;EAAW,CAAC,GAAGR,SAAS,CACnCS,MAAM,KAAQ;IACfF,IAAI,EAAEE,MAAM,CAAEP,WAAY,CAAC,CAACQ,sBAAsB,CAAE,MAAO,CAAC;IAC5DF,UAAU,EAAEC,MAAM,CAAEP,WAAY,CAAC,CAACS,wBAAwB,CAAC;EAC5D,CAAC,CAAE,EACH,EACD,CAAC;EAED,OAAOL,IAAI,GACRM,wBAAwB,CAAEL,IAAK,CAAC,GAChCM,oBAAoB,CAAEN,IAAI,EAAE;IAAEC;EAAW,CAAE,CAAC;AAChD;AAEA,OAAO,SAASI,wBAAwBA,CAAEE,aAAa,EAAG;EACzD,MAAMP,IAAI,GAAGT,OAAO,CAAEgB,aAAc,CAAC;EAErC,MAAMC,oBAAoB,GAAGC,uBAAuB,CAAC,CAAC;EACtD,MA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 @@
1
1
  import { createElement } from "@wordpress/element";
2
-
3
2
  /**
4
3
  * Internal dependencies
5
4
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-slug/check.js"],"names":["PostTypeSupportCheck","PostSlugCheck","children"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,oBAAP,MAAiC,4BAAjC;AAEA,eAAe,SAASC,aAAT,CAAwB;AAAEC,EAAAA;AAAF,CAAxB,EAAuC;AACrD,SACC,cAAC,oBAAD;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","PostSlugCheck","children","createElement","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":";AAAA;AACA;AACA;AACA,OAAOA,oBAAoB,MAAM,4BAA4B;AAE7D,eAAe,SAASC,aAAaA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACrD,OACCC,aAAA,CAACH,oBAAoB;IAACI,WAAW,EAAC;EAAM,GACrCF,QACmB,CAAC;AAEzB"}
@@ -1,5 +1,4 @@
1
1
  import { createElement } from "@wordpress/element";
2
-
3
2
  /**
4
3
  * WordPress dependencies
5
4
  */
@@ -9,10 +8,10 @@ import { __ } from '@wordpress/i18n';
9
8
  import { compose } from '@wordpress/compose';
10
9
  import { safeDecodeURIComponent, cleanForSlug } from '@wordpress/url';
11
10
  import { TextControl } from '@wordpress/components';
11
+
12
12
  /**
13
13
  * Internal dependencies
14
14
  */
15
-
16
15
  import PostSlugCheck from './check';
17
16
  import { store as editorStore } from '../../store';
18
17
  export class PostSlug extends Component {
@@ -27,7 +26,6 @@ export class PostSlug extends Component {
27
26
  };
28
27
  this.setSlug = this.setSlug.bind(this);
29
28
  }
30
-
31
29
  setSlug(event) {
32
30
  const {
33
31
  postSlug,
@@ -37,14 +35,11 @@ export class PostSlug extends Component {
37
35
  value
38
36
  } = event.target;
39
37
  const editedSlug = cleanForSlug(value);
40
-
41
38
  if (editedSlug === postSlug) {
42
39
  return;
43
40
  }
44
-
45
41
  onUpdateSlug(editedSlug);
46
42
  }
47
-
48
43
  render() {
49
44
  const {
50
45
  editedSlug
@@ -62,7 +57,6 @@ export class PostSlug extends Component {
62
57
  className: "editor-post-slug"
63
58
  }));
64
59
  }
65
-
66
60
  }
67
61
  export default compose([withSelect(select => {
68
62
  const {
@@ -87,7 +81,6 @@ export default compose([withSelect(select => {
87
81
  slug
88
82
  });
89
83
  }
90
-
91
84
  };
92
85
  })])(PostSlug);
93
86
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-slug/index.js"],"names":["withDispatch","withSelect","Component","__","compose","safeDecodeURIComponent","cleanForSlug","TextControl","PostSlugCheck","store","editorStore","PostSlug","constructor","postSlug","postTitle","postID","arguments","state","editedSlug","setSlug","bind","event","onUpdateSlug","props","value","target","render","slug","setState","select","getCurrentPost","getEditedPostAttribute","id","dispatch","editPost"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,YAAT,EAAuBC,UAAvB,QAAyC,iBAAzC;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,sBAAT,EAAiCC,YAAjC,QAAqD,gBAArD;AACA,SAASC,WAAT,QAA4B,uBAA5B;AAEA;AACA;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A,SAAS,EAAC;AAVX,MADD,CADD;AAgBA;;AA7CsC;AAgDxC,eAAef,OAAO,CAAE,CACvBH,UAAU,CAAI4B,MAAF,IAAc;AACzB,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,MACLF,MAAM,CAAEnB,WAAF,CADP;AAGA,QAAM;AAAEsB,IAAAA;AAAF,MAASF,cAAc,EAA7B;AACA,SAAO;AACNjB,IAAAA,QAAQ,EAAEkB,sBAAsB,CAAE,MAAF,CAD1B;AAENjB,IAAAA,SAAS,EAAEiB,sBAAsB,CAAE,OAAF,CAF3B;AAGNhB,IAAAA,MAAM,EAAEiB;AAHF,GAAP;AAKA,CAVS,CADa,EAYvBhC,YAAY,CAAIiC,QAAF,IAAgB;AAC7B,QAAM;AAAEC,IAAAA;AAAF,MAAeD,QAAQ,CAAEvB,WAAF,CAA7B;AACA,SAAO;AACNY,IAAAA,YAAY,CAAEK,IAAF,EAAS;AACpBO,MAAAA,QAAQ,CAAE;AAAEP,QAAAA;AAAF,OAAF,CAAR;AACA;;AAHK,GAAP;AAKA,CAPW,CAZW,CAAF,CAAP,CAoBVhB,QApBU,CAAf","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":["withDispatch","withSelect","Component","__","compose","safeDecodeURIComponent","cleanForSlug","TextControl","PostSlugCheck","store","editorStore","PostSlug","constructor","postSlug","postTitle","postID","arguments","state","editedSlug","setSlug","bind","event","onUpdateSlug","props","value","target","render","createElement","__nextHasNoMarginBottom","label","autoComplete","spellCheck","onChange","slug","setState","onBlur","className","select","getCurrentPost","getEditedPostAttribute","id","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":";AAAA;AACA;AACA;AACA,SAASA,YAAY,EAAEC,UAAU,QAAQ,iBAAiB;AAC1D,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,sBAAsB,EAAEC,YAAY,QAAQ,gBAAgB;AACrE,SAASC,WAAW,QAAQ,uBAAuB;;AAEnD;AACA;AACA;AACA,OAAOC,aAAa,MAAM,SAAS;AACnC,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAElD,OAAO,MAAMC,QAAQ,SAAST,SAAS,CAAC;EACvCU,WAAWA,CAAE;IAAEC,QAAQ;IAAEC,SAAS;IAAEC;EAAO,CAAC,EAAG;IAC9C,KAAK,CAAE,GAAGC,SAAU,CAAC;IAErB,IAAI,CAACC,KAAK,GAAG;MACZC,UAAU,EACTb,sBAAsB,CAAEQ,QAAS,CAAC,IAClCP,YAAY,CAAEQ,SAAU,CAAC,IACzBC;IACF,CAAC;IAED,IAAI,CAACI,OAAO,GAAG,IAAI,CAACA,OAAO,CAACC,IAAI,CAAE,IAAK,CAAC;EACzC;EAEAD,OAAOA,CAAEE,KAAK,EAAG;IAChB,MAAM;MAAER,QAAQ;MAAES;IAAa,CAAC,GAAG,IAAI,CAACC,KAAK;IAC7C,MAAM;MAAEC;IAAM,CAAC,GAAGH,KAAK,CAACI,MAAM;IAE9B,MAAMP,UAA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10 +3,10 @@
3
3
  */
4
4
  import { compose } from '@wordpress/compose';
5
5
  import { withSelect } from '@wordpress/data';
6
+
6
7
  /**
7
8
  * Internal dependencies
8
9
  */
9
-
10
10
  import { store as editorStore } from '../../store';
11
11
  export function PostStickyCheck({
12
12
  hasStickyAction,
@@ -16,12 +16,10 @@ export function PostStickyCheck({
16
16
  if (postType !== 'post' || !hasStickyAction) {
17
17
  return null;
18
18
  }
19
-
20
19
  return children;
21
20
  }
22
21
  export default compose([withSelect(select => {
23
22
  var _post$_links$wpActio;
24
-
25
23
  const post = select(editorStore).getCurrentPost();
26
24
  return {
27
25
  hasStickyAction: (_post$_links$wpActio = post._links?.['wp:action-sticky']) !== null && _post$_links$wpActio !== void 0 ? _post$_links$wpActio : false,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-sticky/check.js"],"names":["compose","withSelect","store","editorStore","PostStickyCheck","hasStickyAction","postType","children","select","post","getCurrentPost","_links","getCurrentPostType"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,oBAAxB;AACA,SAASC,UAAT,QAA2B,iBAA3B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,eAAT,CAA0B;AAAEC,EAAAA,eAAF;AAAmBC,EAAAA,QAAnB;AAA6BC,EAAAA;AAA7B,CAA1B,EAAoE;AAC1E,MAAKD,QAAQ,KAAK,MAAb,IAAuB,CAAED,eAA9B,EAAgD;AAC/C,WAAO,IAAP;AACA;;AAED,SAAOE,QAAP;AACA;AAED,eAAeP,OAAO,CAAE,CACvBC,UAAU,CAAIO,MAAF,IAAc;AAAA;;AACzB,QAAMC,IAAI,GAAGD,MAAM,CAAEL,WAAF,CAAN,CAAsBO,cAAtB,EAAb;AACA,SAAO;AACNL,IAAAA,eAAe,0BAAEI,IAAI,CAACE,MAAL,GAAe,kBAAf,CAAF,uEAAyC,KADlD;AAENL,IAAAA,QAAQ,EAAEE,MAAM,CAAEL,WAAF,CAAN,CAAsBS,kBAAtB;AAFJ,GAAP;AAIA,CANS,CADa,CAAF,CAAP,CAQVR,eARU,CAAf","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 PostStickyCheck( { hasStickyAction, postType, children } ) {\n\tif ( postType !== 'post' || ! hasStickyAction ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\treturn {\n\t\t\thasStickyAction: post._links?.[ 'wp:action-sticky' ] ?? false,\n\t\t\tpostType: select( editorStore ).getCurrentPostType(),\n\t\t};\n\t} ),\n] )( PostStickyCheck );\n"]}
1
+ {"version":3,"names":["compose","withSelect","store","editorStore","PostStickyCheck","hasStickyAction","postType","children","select","_post$_links$wpActio","post","getCurrentPost","_links","getCurrentPostType"],"sources":["@wordpress/editor/src/components/post-sticky/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 PostStickyCheck( { hasStickyAction, postType, children } ) {\n\tif ( postType !== 'post' || ! hasStickyAction ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\treturn {\n\t\t\thasStickyAction: post._links?.[ 'wp:action-sticky' ] ?? false,\n\t\t\tpostType: select( editorStore ).getCurrentPostType(),\n\t\t};\n\t} ),\n] )( PostStickyCheck );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,UAAU,QAAQ,iBAAiB;;AAE5C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAElD,OAAO,SAASC,eAAeA,CAAE;EAAEC,eAAe;EAAEC,QAAQ;EAAEC;AAAS,CAAC,EAAG;EAC1E,IAAKD,QAAQ,KAAK,MAAM,IAAI,CAAED,eAAe,EAAG;IAC/C,OAAO,IAAI;EACZ;EAEA,OAAOE,QAAQ;AAChB;AAEA,eAAeP,OAAO,CAAE,CACvBC,UAAU,CAAIO,MAAM,IAAM;EAAA,IAAAC,oBAAA;EACzB,MAAMC,IAAI,GAAGF,MAAM,CAAEL,WAAY,CAAC,CAACQ,cAAc,CAAC,CAAC;EACnD,OAAO;IACNN,eAAe,GAAAI,oBAAA,GAAEC,IAAI,CAACE,MAAM,GAAI,kBAAkB,CAAE,cAAAH,oBAAA,cAAAA,oBAAA,GAAI,KAAK;IAC7DH,QAAQ,EAAEE,MAAM,CAAEL,WAAY,CAAC,CAACU,kBAAkB,CAAC;EACpD,CAAC;AACF,CAAE,CAAC,CACF,CAAC,CAAET,eAAgB,CAAC"}
@@ -1,5 +1,4 @@
1
1
  import { createElement } from "@wordpress/element";
2
-
3
2
  /**
4
3
  * WordPress dependencies
5
4
  */
@@ -7,10 +6,10 @@ import { __ } from '@wordpress/i18n';
7
6
  import { CheckboxControl } from '@wordpress/components';
8
7
  import { withSelect, withDispatch } from '@wordpress/data';
9
8
  import { compose } from '@wordpress/compose';
9
+
10
10
  /**
11
11
  * Internal dependencies
12
12
  */
13
-
14
13
  import PostStickyCheck from './check';
15
14
  import { store as editorStore } from '../../store';
16
15
  export function PostSticky({
@@ -35,7 +34,6 @@ export default compose([withSelect(select => {
35
34
  sticky: postSticky
36
35
  });
37
36
  }
38
-
39
37
  };
40
38
  })])(PostSticky);
41
39
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-sticky/index.js"],"names":["__","CheckboxControl","withSelect","withDispatch","compose","PostStickyCheck","store","editorStore","PostSticky","onUpdateSticky","postSticky","select","getEditedPostAttribute","dispatch","editPost","sticky"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,uBAAhC;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,OAAOC,eAAP,MAA4B,SAA5B;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,UAAT,CAAqB;AAAEC,EAAAA,cAAF;AAAkBC,EAAAA,UAAU,GAAG;AAA/B,CAArB,EAA8D;AACpE,SACC,cAAC,eAAD,QACC,cAAC,eAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAGV,EAAE,CAAE,8BAAF,CAFX;AAGC,IAAA,OAAO,EAAGU,UAHX;AAIC,IAAA,QAAQ,EAAG,MAAMD,cAAc,CAAE,CAAEC,UAAJ;AAJhC,IADD,CADD;AAUA;AAED,eAAeN,OAAO,CAAE,CACvBF,UAAU,CAAIS,MAAF,IAAc;AACzB,SAAO;AACND,IAAAA,UAAU,EACTC,MAAM,CAAEJ,WAAF,CAAN,CAAsBK,sBAAtB,CAA8C,QAA9C;AAFK,GAAP;AAIA,CALS,CADa,EAOvBT,YAAY,CAAIU,QAAF,IAAgB;AAC7B,SAAO;AACNJ,IAAAA,cAAc,CAAEC,UAAF,EAAe;AAC5BG,MAAAA,QAAQ,CAAEN,WAAF,CAAR,CAAwBO,QAAxB,CAAkC;AAAEC,QAAAA,MAAM,EAAEL;AAAV,OAAlC;AACA;;AAHK,GAAP;AAKA,CANW,CAPW,CAAF,CAAP,CAcVF,UAdU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { CheckboxControl } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport PostStickyCheck from './check';\nimport { store as editorStore } from '../../store';\n\nexport function PostSticky( { onUpdateSticky, postSticky = false } ) {\n\treturn (\n\t\t<PostStickyCheck>\n\t\t\t<CheckboxControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Stick to the top of the blog' ) }\n\t\t\t\tchecked={ postSticky }\n\t\t\t\tonChange={ () => onUpdateSticky( ! postSticky ) }\n\t\t\t/>\n\t\t</PostStickyCheck>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostSticky:\n\t\t\t\tselect( editorStore ).getEditedPostAttribute( 'sticky' ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\treturn {\n\t\t\tonUpdateSticky( postSticky ) {\n\t\t\t\tdispatch( editorStore ).editPost( { sticky: postSticky } );\n\t\t\t},\n\t\t};\n\t} ),\n] )( PostSticky );\n"]}
1
+ {"version":3,"names":["__","CheckboxControl","withSelect","withDispatch","compose","PostStickyCheck","store","editorStore","PostSticky","onUpdateSticky","postSticky","createElement","__nextHasNoMarginBottom","label","checked","onChange","select","getEditedPostAttribute","dispatch","editPost","sticky"],"sources":["@wordpress/editor/src/components/post-sticky/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { CheckboxControl } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport PostStickyCheck from './check';\nimport { store as editorStore } from '../../store';\n\nexport function PostSticky( { onUpdateSticky, postSticky = false } ) {\n\treturn (\n\t\t<PostStickyCheck>\n\t\t\t<CheckboxControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Stick to the top of the blog' ) }\n\t\t\t\tchecked={ postSticky }\n\t\t\t\tonChange={ () => onUpdateSticky( ! postSticky ) }\n\t\t\t/>\n\t\t</PostStickyCheck>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostSticky:\n\t\t\t\tselect( editorStore ).getEditedPostAttribute( 'sticky' ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\treturn {\n\t\t\tonUpdateSticky( postSticky ) {\n\t\t\t\tdispatch( editorStore ).editPost( { sticky: postSticky } );\n\t\t\t},\n\t\t};\n\t} ),\n] )( PostSticky );\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AAC1D,SAASC,OAAO,QAAQ,oBAAoB;;AAE5C;AACA;AACA;AACA,OAAOC,eAAe,MAAM,SAAS;AACrC,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAElD,OAAO,SAASC,UAAUA,CAAE;EAAEC,cAAc;EAAEC,UAAU,GAAG;AAAM,CAAC,EAAG;EACpE,OACCC,aAAA,CAACN,eAAe,QACfM,aAAA,CAACV,eAAe;IACfW,uBAAuB;IACvBC,KAAK,EAAGb,EAAE,CAAE,8BAA+B,CAAG;IAC9Cc,OAAO,EAAGJ,UAAY;IACtBK,QAAQ,EAAGA,CAAA,KAAMN,cAAc,CAAE,CAAEC,UAAW;EAAG,CACjD,CACe,CAAC;AAEpB;AAEA,eAAeN,OAAO,CAAE,CACvBF,UAAU,CAAIc,MAAM,IAAM;EACzB,OAAO;IACNN,UAAU,EACTM,MAAM,CAAET,WAAY,CAAC,CAACU,sBAAsB,CAAE,QAAS;EACzD,CAAC;AACF,CAAE,CAAC,EACHd,YAAY,CAAIe,QAAQ,IAAM;EAC7B,OAAO;IACNT,cAAcA,CAAEC,UAAU,EAAG;MAC5BQ,QAAQ,CAAEX,WAAY,CAAC,CAACY,QAAQ,CAAE;QAAEC,MAAM,EAAEV;MAAW,CAAE,CAAC;IAC3D;EACD,CAAC;AACF,CAAE,CAAC,CACF,CAAC,CAAEF,UAAW,CAAC"}
@@ -1,5 +1,4 @@
1
1
  import { createElement, Fragment } from "@wordpress/element";
2
-
3
2
  /**
4
3
  * WordPress dependencies
5
4
  */
@@ -8,12 +7,11 @@ import { __ } from '@wordpress/i18n';
8
7
  import { withSelect, withDispatch } from '@wordpress/data';
9
8
  import { compose } from '@wordpress/compose';
10
9
  import { useState } from '@wordpress/element';
10
+
11
11
  /**
12
12
  * Internal dependencies
13
13
  */
14
-
15
14
  import { store as editorStore } from '../../store';
16
-
17
15
  function PostSwitchToDraftButton({
18
16
  isSaving,
19
17
  isPublished,
@@ -21,24 +19,19 @@ function PostSwitchToDraftButton({
21
19
  onClick
22
20
  }) {
23
21
  const [showConfirmDialog, setShowConfirmDialog] = useState(false);
24
-
25
22
  if (!isPublished && !isScheduled) {
26
23
  return null;
27
24
  }
28
-
29
25
  let alertMessage;
30
-
31
26
  if (isPublished) {
32
27
  alertMessage = __('Are you sure you want to unpublish this post?');
33
28
  } else if (isScheduled) {
34
29
  alertMessage = __('Are you sure you want to unschedule this post?');
35
30
  }
36
-
37
31
  const handleConfirm = () => {
38
32
  setShowConfirmDialog(false);
39
33
  onClick();
40
34
  };
41
-
42
35
  return createElement(Fragment, null, createElement(Button, {
43
36
  className: "editor-post-switch-to-draft",
44
37
  onClick: () => {
@@ -56,7 +49,6 @@ function PostSwitchToDraftButton({
56
49
  onCancel: () => setShowConfirmDialog(false)
57
50
  }, alertMessage));
58
51
  }
59
-
60
52
  export default compose([withSelect(select => {
61
53
  const {
62
54
  isSavingPost,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-switch-to-draft-button/index.js"],"names":["Button","__experimentalConfirmDialog","ConfirmDialog","__","withSelect","withDispatch","compose","useState","store","editorStore","PostSwitchToDraftButton","isSaving","isPublished","isScheduled","onClick","showConfirmDialog","setShowConfirmDialog","alertMessage","handleConfirm","flexGrow","justifyContent","select","isSavingPost","isCurrentPostPublished","isCurrentPostScheduled","dispatch","editPost","savePost","status"],"mappings":";;AAAA;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AAGY,iBADV;AAEC,IAAA,SAAS,EAAGG,aAFb;AAGC,IAAA,QAAQ,EAAG,MAAMF,oBAAoB,CAAE,KAAF;AAHtC,KAKGC,YALH,CAZD,CADD;AAsBA;;AAED,eAAeX,OAAO,CAAE,CACvBF,UAAU,CAAIiB,MAAF,IAAc;AACzB,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA,sBAAhB;AAAwCC,IAAAA;AAAxC,MACLH,MAAM,CAAEZ,WAAF,CADP;AAEA,SAAO;AACNE,IAAAA,QAAQ,EAAEW,YAAY,EADhB;AAENV,IAAAA,WAAW,EAAEW,sBAAsB,EAF7B;AAGNV,IAAAA,WAAW,EAAEW,sBAAsB;AAH7B,GAAP;AAKA,CARS,CADa,EAUvBnB,YAAY,CAAIoB,QAAF,IAAgB;AAC7B,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAyBF,QAAQ,CAAEhB,WAAF,CAAvC;AACA,SAAO;AACNK,IAAAA,OAAO,EAAE,MAAM;AACdY,MAAAA,QAAQ,CAAE;AAAEE,QAAAA,MAAM,EAAE;AAAV,OAAF,CAAR;AACAD,MAAAA,QAAQ;AACR;AAJK,GAAP;AAMA,CARW,CAVW,CAAF,CAAP,CAmBVjB,uBAnBU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction PostSwitchToDraftButton( {\n\tisSaving,\n\tisPublished,\n\tisScheduled,\n\tonClick,\n} ) {\n\tconst [ showConfirmDialog, setShowConfirmDialog ] = useState( false );\n\n\tif ( ! isPublished && ! isScheduled ) {\n\t\treturn null;\n\t}\n\n\tlet alertMessage;\n\tif ( isPublished ) {\n\t\talertMessage = __( 'Are you sure you want to unpublish this post?' );\n\t} else if ( isScheduled ) {\n\t\talertMessage = __( 'Are you sure you want to unschedule this post?' );\n\t}\n\n\tconst handleConfirm = () => {\n\t\tsetShowConfirmDialog( false );\n\t\tonClick();\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tclassName=\"editor-post-switch-to-draft\"\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetShowConfirmDialog( true );\n\t\t\t\t} }\n\t\t\t\tdisabled={ isSaving }\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\tstyle={ { flexGrow: '1', justifyContent: 'center' } }\n\t\t\t>\n\t\t\t\t{ __( 'Switch to draft' ) }\n\t\t\t</Button>\n\t\t\t<ConfirmDialog\n\t\t\t\tisOpen={ showConfirmDialog }\n\t\t\t\tonConfirm={ handleConfirm }\n\t\t\t\tonCancel={ () => setShowConfirmDialog( false ) }\n\t\t\t>\n\t\t\t\t{ alertMessage }\n\t\t\t</ConfirmDialog>\n\t\t</>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { isSavingPost, isCurrentPostPublished, isCurrentPostScheduled } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tisSaving: isSavingPost(),\n\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\tisScheduled: isCurrentPostScheduled(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost, savePost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonClick: () => {\n\t\t\t\teditPost( { status: 'draft' } );\n\t\t\t\tsavePost();\n\t\t\t},\n\t\t};\n\t} ),\n] )( PostSwitchToDraftButton );\n"]}
1
+ {"version":3,"names":["Button","__experimentalConfirmDialog","ConfirmDialog","__","withSelect","withDispatch","compose","useState","store","editorStore","PostSwitchToDraftButton","isSaving","isPublished","isScheduled","onClick","showConfirmDialog","setShowConfirmDialog","alertMessage","handleConfirm","createElement","Fragment","className","disabled","variant","style","flexGrow","justifyContent","isOpen","onConfirm","onCancel","select","isSavingPost","isCurrentPostPublished","isCurrentPostScheduled","dispatch","editPost","savePost","status"],"sources":["@wordpress/editor/src/components/post-switch-to-draft-button/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction PostSwitchToDraftButton( {\n\tisSaving,\n\tisPublished,\n\tisScheduled,\n\tonClick,\n} ) {\n\tconst [ showConfirmDialog, setShowConfirmDialog ] = useState( false );\n\n\tif ( ! isPublished && ! isScheduled ) {\n\t\treturn null;\n\t}\n\n\tlet alertMessage;\n\tif ( isPublished ) {\n\t\talertMessage = __( 'Are you sure you want to unpublish this post?' );\n\t} else if ( isScheduled ) {\n\t\talertMessage = __( 'Are you sure you want to unschedule this post?' );\n\t}\n\n\tconst handleConfirm = () => {\n\t\tsetShowConfirmDialog( false );\n\t\tonClick();\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tclassName=\"editor-post-switch-to-draft\"\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetShowConfirmDialog( true );\n\t\t\t\t} }\n\t\t\t\tdisabled={ isSaving }\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\tstyle={ { flexGrow: '1', justifyContent: 'center' } }\n\t\t\t>\n\t\t\t\t{ __( 'Switch to draft' ) }\n\t\t\t</Button>\n\t\t\t<ConfirmDialog\n\t\t\t\tisOpen={ showConfirmDialog }\n\t\t\t\tonConfirm={ handleConfirm }\n\t\t\t\tonCancel={ () => setShowConfirmDialog( false ) }\n\t\t\t>\n\t\t\t\t{ alertMessage }\n\t\t\t</ConfirmDialog>\n\t\t</>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { isSavingPost, isCurrentPostPublished, isCurrentPostScheduled } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tisSaving: isSavingPost(),\n\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\tisScheduled: isCurrentPostScheduled(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost, savePost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonClick: () => {\n\t\t\t\teditPost( { status: 'draft' } );\n\t\t\t\tsavePost();\n\t\t\t},\n\t\t};\n\t} ),\n] )( PostSwitchToDraftButton );\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,MAAM,EACNC,2BAA2B,IAAIC,aAAa,QACtC,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AAC1D,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,QAAQ,QAAQ,oBAAoB;;AAE7C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAElD,SAASC,uBAAuBA,CAAE;EACjCC,QAAQ;EACRC,WAAW;EACXC,WAAW;EACXC;AACD,CAAC,EAAG;EACH,MAAM,CAAEC,iBAAiB,EAAEC,oBAAoB,CAAE,GAAGT,QAAQ,CAAE,KAAM,CAAC;EAErE,IAAK,CAAEK,WAAW,IAAI,CAAEC,WAAW,EAAG;IACrC,OAAO,IAAI;EACZ;EAEA,IAAII,YAAY;EAChB,IAAKL,WAAW,EAAG;IAClBK,YAAY,GAAGd,EAAE,CAAE,+CAAgD,CAAC;EACrE,CAAC,MAAM,IAAKU,WAAW,EAAG;IACzBI,YAAY,GAAGd,EAAE,CAAE,gDAAiD,CAAC;EACtE;EAEA,MAAMe,aAAa,GAAGA,CAAA,KAAM;IAC3BF,oBAAoB,CAAE,KAAM,CAAC;IAC7BF,OAAO,CAAC,CAAC;EACV,CAAC;EAED,OACC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 +7,10 @@ import { __ } from '@wordpress/i18n';
8
7
  import { PanelRow, Modal, Button, __experimentalHStack as HStack, __experimentalVStack as VStack, ToggleControl } from '@wordpress/components';
9
8
  import { useEffect, useState } from '@wordpress/element';
10
9
  import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
10
+
11
11
  /**
12
12
  * Internal dependencies
13
13
  */
14
-
15
14
  import { store as editorStore } from '../../store';
16
15
  import { unlock } from '../../lock-unlock';
17
16
  export default function PostSyncStatus() {
@@ -29,12 +28,10 @@ export default function PostSyncStatus() {
29
28
  postType: getEditedPostAttribute('type')
30
29
  };
31
30
  });
32
-
33
31
  if (postType !== 'wp_block') {
34
32
  return null;
35
- } // When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead.
36
-
37
-
33
+ }
34
+ // When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead.
38
35
  const currentSyncStatus = meta?.wp_pattern_sync_status === 'unsynced' ? 'unsynced' : syncStatus;
39
36
  return createElement(PanelRow, {
40
37
  className: "edit-post-sync-status"
@@ -62,11 +59,10 @@ export function PostSyncStatusModal() {
62
59
  useEffect(() => {
63
60
  if (isNewPost && postType === 'wp_block') {
64
61
  setIsModalOpen(true);
65
- } // We only want the modal to open when the page is first loaded.
62
+ }
63
+ // We only want the modal to open when the page is first loaded.
66
64
  // eslint-disable-next-line react-hooks/exhaustive-deps
67
-
68
65
  }, []);
69
-
70
66
  const setSyncStatus = () => {
71
67
  editPost({
72
68
  meta: {
@@ -74,11 +70,9 @@ export function PostSyncStatusModal() {
74
70
  }
75
71
  });
76
72
  };
77
-
78
73
  if (postType !== 'wp_block' || !isNewPost) {
79
74
  return null;
80
75
  }
81
-
82
76
  const {
83
77
  ReusableBlocksRenameHint
84
78
  } = unlock(blockEditorPrivateApis);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-sync-status/index.js"],"names":["useSelect","useDispatch","__","PanelRow","Modal","Button","__experimentalHStack","HStack","__experimentalVStack","VStack","ToggleControl","useEffect","useState","privateApis","blockEditorPrivateApis","store","editorStore","unlock","PostSyncStatus","syncStatus","postType","meta","select","getEditedPostAttribute","currentSyncStatus","wp_pattern_sync_status","PostSyncStatusModal","editPost","isModalOpen","setIsModalOpen","syncType","setSyncType","undefined","isNewPost","isCleanNewPost","setSyncStatus","ReusableBlocksRenameHint","event","preventDefault"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SACCC,QADD,EAECC,KAFD,EAGCC,MAHD,EAICC,oBAAoB,IAAIC,MAJzB,EAKCC,oBAAoB,IAAIC,MALzB,EAMCC,aAND,QAOO,uBAPP;AAQA,SAASC,SAAT,EAAoBC,QAApB,QAAoC,oBAApC;AACA,SAASC,WAAW,IAAIC,sBAAxB,QAAsD,yBAAtD;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;AACA,SAASC,MAAT,QAAuB,mBAAvB;AAEA,eAAe,SAASC,cAAT,GAA0B;AACxC,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA,QAAd;AAAwBC,IAAAA;AAAxB,MAAiCrB,SAAS,CAAIsB,MAAF,IAAc;AAC/D,UAAM;AAAEC,MAAAA;AAAF,QAA6BD,MAAM,CAAEN,WAAF,CAAzC;AACA,WAAO;AACNG,MAAAA,UAAU,EAAEI,sBAAsB,CAAE,wBAAF,CAD5B;AAENF,MAAAA,IAAI,EAAEE,sBAAsB,CAAE,MAAF,CAFtB;AAGNH,MAAAA,QAAQ,EAAEG,sBAAsB,CAAE,MAAF;AAH1B,KAAP;AAKA,GAP+C,CAAhD;;AASA,MAAKH,QAAQ,KAAK,UAAlB,EAA+B;AAC9B,WAAO,IAAP;AACA,GAZuC,CAaxC;;;AACA,QAAMI,iBAAiB,GACtBH,IAAI,EAAEI,sBAAN,KAAiC,UAAjC,GAA8C,UAA9C,GAA2DN,UAD5D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AAF,MAA+BnB,MAAM,CAAEH,sBAAF,CAA3C;AACA,SACC,8BACGc,WAAW,IACZ,cAAC,KAAD;AACC,IAAA,KAAK,EAAG1B,EAAE,CAAE,yBAAF,CADX;AAEC,IAAA,cAAc,EAAG,MAAM;AACtB2B,MAAAA,cAAc,CAAE,KAAF,CAAd;AACA,KAJF;AAKC,IAAA,gBAAgB,EAAC;AALlB,KAOC;AACC,IAAA,QAAQ,EAAKQ,KAAF,IAAa;AACvBA,MAAAA,KAAK,CAACC,cAAN;AACAT,MAAAA,cAAc,CAAE,KAAF,CAAd;AACAM,MAAAA,aAAa;AACb;AALF,KAOC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAC;AAAhB,KACC,cAAC,wBAAD,OADD,EAEC,cAAC,aAAD;AACC,IAAA,KAAK,EAAGjC,EAAE,CAAE,QAAF,CADX;AAEC,IAAA,IAAI,EAAGA,EAAE,CACR,yDADQ,CAFV;AAKC,IAAA,OAAO,EAAG,CAAE4B,QALb;AAMC,IAAA,QAAQ,EAAG,MAAM;AAChBC,MAAAA,WAAW,CACV,CAAED,QAAF,GAAa,UAAb,GAA0BE,SADhB,CAAX;AAGA;AAVF,IAFD,EAcC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAC;AAAhB,KACC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAC,SAAhB;AAA0B,IAAA,IAAI,EAAC;AAA/B,KACG9B,EAAE,CAAE,QAAF,CADL,CADD,CAdD,CAPD,CAPD,CAFF,CADD;AA0CA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tPanelRow,\n\tModal,\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tToggleControl,\n} from '@wordpress/components';\nimport { useEffect, useState } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport default function PostSyncStatus() {\n\tconst { syncStatus, postType, meta } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\treturn {\n\t\t\tsyncStatus: getEditedPostAttribute( 'wp_pattern_sync_status' ),\n\t\t\tmeta: getEditedPostAttribute( 'meta' ),\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t};\n\t} );\n\n\tif ( postType !== 'wp_block' ) {\n\t\treturn null;\n\t}\n\t// When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead.\n\tconst currentSyncStatus =\n\t\tmeta?.wp_pattern_sync_status === 'unsynced' ? 'unsynced' : syncStatus;\n\n\treturn (\n\t\t<PanelRow className=\"edit-post-sync-status\">\n\t\t\t<span>{ __( 'Sync status' ) }</span>\n\t\t\t<div>\n\t\t\t\t{ currentSyncStatus === 'unsynced'\n\t\t\t\t\t? __( 'Not synced' )\n\t\t\t\t\t: __( 'Fully synced' ) }\n\t\t\t</div>\n\t\t</PanelRow>\n\t);\n}\n\nexport function PostSyncStatusModal() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst [ syncType, setSyncType ] = useState( undefined );\n\n\tconst { postType, isNewPost } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute, isCleanNewPost } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t\tisNewPost: isCleanNewPost(),\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( isNewPost && postType === 'wp_block' ) {\n\t\t\tsetIsModalOpen( true );\n\t\t}\n\t\t// We only want the modal to open when the page is first loaded.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [] );\n\n\tconst setSyncStatus = () => {\n\t\teditPost( {\n\t\t\tmeta: {\n\t\t\t\twp_pattern_sync_status: syncType,\n\t\t\t},\n\t\t} );\n\t};\n\n\tif ( postType !== 'wp_block' || ! isNewPost ) {\n\t\treturn null;\n\t}\n\tconst { ReusableBlocksRenameHint } = unlock( blockEditorPrivateApis );\n\treturn (\n\t\t<>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Set pattern sync status' ) }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName=\"reusable-blocks-menu-items__convert-modal\"\n\t\t\t\t>\n\t\t\t\t\t<form\n\t\t\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\tsetSyncStatus();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<VStack spacing=\"5\">\n\t\t\t\t\t\t\t<ReusableBlocksRenameHint />\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Synced' ) }\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Editing the pattern will update it anywhere it is used.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tchecked={ ! syncType }\n\t\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\t\tsetSyncType(\n\t\t\t\t\t\t\t\t\t\t! syncType ? 'unsynced' : undefined\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t\t\t<Button variant=\"primary\" type=\"submit\">\n\t\t\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</form>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"names":["useSelect","useDispatch","__","PanelRow","Modal","Button","__experimentalHStack","HStack","__experimentalVStack","VStack","ToggleControl","useEffect","useState","privateApis","blockEditorPrivateApis","store","editorStore","unlock","PostSyncStatus","syncStatus","postType","meta","select","getEditedPostAttribute","currentSyncStatus","wp_pattern_sync_status","createElement","className","PostSyncStatusModal","editPost","isModalOpen","setIsModalOpen","syncType","setSyncType","undefined","isNewPost","isCleanNewPost","setSyncStatus","ReusableBlocksRenameHint","Fragment","title","onRequestClose","overlayClassName","onSubmit","event","preventDefault","spacing","label","help","checked","onChange","justify","variant","type"],"sources":["@wordpress/editor/src/components/post-sync-status/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tPanelRow,\n\tModal,\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tToggleControl,\n} from '@wordpress/components';\nimport { useEffect, useState } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport default function PostSyncStatus() {\n\tconst { syncStatus, postType, meta } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\treturn {\n\t\t\tsyncStatus: getEditedPostAttribute( 'wp_pattern_sync_status' ),\n\t\t\tmeta: getEditedPostAttribute( 'meta' ),\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t};\n\t} );\n\n\tif ( postType !== 'wp_block' ) {\n\t\treturn null;\n\t}\n\t// When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead.\n\tconst currentSyncStatus =\n\t\tmeta?.wp_pattern_sync_status === 'unsynced' ? 'unsynced' : syncStatus;\n\n\treturn (\n\t\t<PanelRow className=\"edit-post-sync-status\">\n\t\t\t<span>{ __( 'Sync status' ) }</span>\n\t\t\t<div>\n\t\t\t\t{ currentSyncStatus === 'unsynced'\n\t\t\t\t\t? __( 'Not synced' )\n\t\t\t\t\t: __( 'Fully synced' ) }\n\t\t\t</div>\n\t\t</PanelRow>\n\t);\n}\n\nexport function PostSyncStatusModal() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst [ syncType, setSyncType ] = useState( undefined );\n\n\tconst { postType, isNewPost } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute, isCleanNewPost } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t\tisNewPost: isCleanNewPost(),\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( isNewPost && postType === 'wp_block' ) {\n\t\t\tsetIsModalOpen( true );\n\t\t}\n\t\t// We only want the modal to open when the page is first loaded.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [] );\n\n\tconst setSyncStatus = () => {\n\t\teditPost( {\n\t\t\tmeta: {\n\t\t\t\twp_pattern_sync_status: syncType,\n\t\t\t},\n\t\t} );\n\t};\n\n\tif ( postType !== 'wp_block' || ! isNewPost ) {\n\t\treturn null;\n\t}\n\tconst { ReusableBlocksRenameHint } = unlock( blockEditorPrivateApis );\n\treturn (\n\t\t<>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Set pattern sync status' ) }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName=\"reusable-blocks-menu-items__convert-modal\"\n\t\t\t\t>\n\t\t\t\t\t<form\n\t\t\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\tsetSyncStatus();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<VStack spacing=\"5\">\n\t\t\t\t\t\t\t<ReusableBlocksRenameHint />\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Synced' ) }\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Editing the pattern will update it anywhere it is used.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tchecked={ ! syncType }\n\t\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\t\tsetSyncType(\n\t\t\t\t\t\t\t\t\t\t! syncType ? 'unsynced' : undefined\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t\t\t<Button variant=\"primary\" type=\"submit\">\n\t\t\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</form>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,QAAQ,EACRC,KAAK,EACLC,MAAM,EACNC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,aAAa,QACP,uBAAuB;AAC9B,SAASC,SAAS,EAAEC,QAAQ,QAAQ,oBAAoB;AACxD,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;;AAE/E;AACA;AACA;AACA,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAClD,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,eAAe,SAASC,cAAcA,CAAA,EAAG;EACxC,MAAM;IAAEC,UAAU;IAAEC,QAAQ;IAAEC;E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IAAC4C,OAAO,EAAC;EAAO,GACtBzB,aAAA,CAACrB,MAAM;IAAC+C,OAAO,EAAC,SAAS;IAACC,IAAI,EAAC;EAAQ,GACpCnD,EAAE,CAAE,QAAS,CACR,CACD,CACD,CACH,CACA,CAEP,CAAC;AAEL"}
@@ -4,10 +4,10 @@
4
4
  import { compose } from '@wordpress/compose';
5
5
  import { withSelect } from '@wordpress/data';
6
6
  import { store as coreStore } from '@wordpress/core-data';
7
+
7
8
  /**
8
9
  * Internal dependencies
9
10
  */
10
-
11
11
  import { store as editorStore } from '../../store';
12
12
  export function PostTaxonomiesCheck({
13
13
  postType,
@@ -15,11 +15,9 @@ export function PostTaxonomiesCheck({
15
15
  children
16
16
  }) {
17
17
  const hasTaxonomies = taxonomies?.some(taxonomy => taxonomy.types.includes(postType));
18
-
19
18
  if (!hasTaxonomies) {
20
19
  return null;
21
20
  }
22
-
23
21
  return children;
24
22
  }
25
23
  export default compose([withSelect(select => {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-taxonomies/check.js"],"names":["compose","withSelect","store","coreStore","editorStore","PostTaxonomiesCheck","postType","taxonomies","children","hasTaxonomies","some","taxonomy","types","includes","select","getCurrentPostType","getTaxonomies","per_page"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,oBAAxB;AACA,SAASC,UAAT,QAA2B,iBAA3B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,mBAAT,CAA8B;AAAEC,EAAAA,QAAF;AAAYC,EAAAA,UAAZ;AAAwBC,EAAAA;AAAxB,CAA9B,EAAmE;AACzE,QAAMC,aAAa,GAAGF,UAAU,EAAEG,IAAZ,CAAoBC,QAAF,IACvCA,QAAQ,CAACC,KAAT,CAAeC,QAAf,CAAyBP,QAAzB,CADqB,CAAtB;;AAGA,MAAK,CAAEG,aAAP,EAAuB;AACtB,WAAO,IAAP;AACA;;AAED,SAAOD,QAAP;AACA;AAED,eAAeR,OAAO,CAAE,CACvBC,UAAU,CAAIa,MAAF,IAAc;AACzB,SAAO;AACNR,IAAAA,QAAQ,EAAEQ,MAAM,CAAEV,WAAF,CAAN,CAAsBW,kBAAtB,EADJ;AAENR,IAAAA,UAAU,EAAEO,MAAM,CAAEX,SAAF,CAAN,CAAoBa,aAApB,CAAmC;AAAEC,MAAAA,QAAQ,EAAE,CAAC;AAAb,KAAnC;AAFN,GAAP;AAIA,CALS,CADa,CAAF,CAAP,CAOVZ,mBAPU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { compose } from '@wordpress/compose';\nimport { withSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function PostTaxonomiesCheck( { postType, taxonomies, children } ) {\n\tconst hasTaxonomies = taxonomies?.some( ( taxonomy ) =>\n\t\ttaxonomy.types.includes( postType )\n\t);\n\tif ( ! hasTaxonomies ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostType: select( editorStore ).getCurrentPostType(),\n\t\t\ttaxonomies: select( coreStore ).getTaxonomies( { per_page: -1 } ),\n\t\t};\n\t} ),\n] )( PostTaxonomiesCheck );\n"]}
1
+ {"version":3,"names":["compose","withSelect","store","coreStore","editorStore","PostTaxonomiesCheck","postType","taxonomies","children","hasTaxonomies","some","taxonomy","types","includes","select","getCurrentPostType","getTaxonomies","per_page"],"sources":["@wordpress/editor/src/components/post-taxonomies/check.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { compose } from '@wordpress/compose';\nimport { withSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function PostTaxonomiesCheck( { postType, taxonomies, children } ) {\n\tconst hasTaxonomies = taxonomies?.some( ( taxonomy ) =>\n\t\ttaxonomy.types.includes( postType )\n\t);\n\tif ( ! hasTaxonomies ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostType: select( editorStore ).getCurrentPostType(),\n\t\t\ttaxonomies: select( coreStore ).getTaxonomies( { per_page: -1 } ),\n\t\t};\n\t} ),\n] )( PostTaxonomiesCheck );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,UAAU,QAAQ,iBAAiB;AAC5C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,aAAa;AAElD,OAAO,SAASC,mBAAmBA,CAAE;EAAEC,QAAQ;EAAEC,UAAU;EAAEC;AAAS,CAAC,EAAG;EACzE,MAAMC,aAAa,GAAGF,UAAU,EAAEG,IAAI,CAAIC,QAAQ,IACjDA,QAAQ,CAACC,KAAK,CAACC,QAAQ,CAAEP,QAAS,CACnC,CAAC;EACD,IAAK,CAAEG,aAAa,EAAG;IACtB,OAAO,IAAI;EACZ;EAEA,OAAOD,QAAQ;AAChB;AAEA,eAAeR,OAAO,CAAE,CACvBC,UAAU,CAAIa,MAAM,IAAM;EACzB,OAAO;IACNR,QAAQ,EAAEQ,MAAM,CAAEV,WAAY,CAAC,CAACW,kBAAkB,CAAC,CAAC;IACpDR,UAAU,EAAEO,MAAM,CAAEX,SAAU,CAAC,CAACa,aAAa,CAAE;MAAEC,QAAQ,EAAE,CAAC;IAAE,CAAE;EACjE,CAAC;AACF,CAAE,CAAC,CACF,CAAC,CAAEZ,mBAAoB,CAAC"}