@wordpress/editor 13.16.0 → 13.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (549) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/autocompleters/index.js +0 -2
  3. package/build/components/autocompleters/index.js.map +1 -1
  4. package/build/components/autocompleters/user.js +2 -9
  5. package/build/components/autocompleters/user.js.map +1 -1
  6. package/build/components/autosave-monitor/index.js +0 -24
  7. package/build/components/autosave-monitor/index.js.map +1 -1
  8. package/build/components/character-count/index.js +1 -4
  9. package/build/components/character-count/index.js.map +1 -1
  10. package/build/components/deprecated.js +1 -11
  11. package/build/components/deprecated.js.map +1 -1
  12. package/build/components/deprecated.native.js +0 -1
  13. package/build/components/deprecated.native.js.map +1 -1
  14. package/build/components/document-outline/check.js +1 -7
  15. package/build/components/document-outline/check.js.map +1 -1
  16. package/build/components/document-outline/index.js +7 -24
  17. package/build/components/document-outline/index.js.map +1 -1
  18. package/build/components/document-outline/item.js +1 -5
  19. package/build/components/document-outline/item.js.map +1 -1
  20. package/build/components/editor-help/add-blocks.native.js +1 -8
  21. package/build/components/editor-help/add-blocks.native.js.map +1 -1
  22. package/build/components/editor-help/customize-blocks.native.js +1 -8
  23. package/build/components/editor-help/customize-blocks.native.js.map +1 -1
  24. package/build/components/editor-help/help-detail-navigation-screen.native.js +5 -13
  25. package/build/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
  26. package/build/components/editor-help/help-get-support-button.native.js +1 -7
  27. package/build/components/editor-help/help-get-support-button.native.js.map +1 -1
  28. package/build/components/editor-help/help-section-title.native.js +1 -7
  29. package/build/components/editor-help/help-section-title.native.js.map +1 -1
  30. package/build/components/editor-help/help-topic-row.native.js +1 -8
  31. package/build/components/editor-help/help-topic-row.native.js.map +1 -1
  32. package/build/components/editor-help/icon-move-blocks.native.js +0 -4
  33. package/build/components/editor-help/icon-move-blocks.native.js.map +1 -1
  34. package/build/components/editor-help/index.native.js +8 -29
  35. package/build/components/editor-help/index.native.js.map +1 -1
  36. package/build/components/editor-help/intro-to-blocks.native.js +1 -9
  37. package/build/components/editor-help/intro-to-blocks.native.js.map +1 -1
  38. package/build/components/editor-help/move-blocks.native.js +1 -8
  39. package/build/components/editor-help/move-blocks.native.js.map +1 -1
  40. package/build/components/editor-help/remove-blocks.native.js +1 -8
  41. package/build/components/editor-help/remove-blocks.native.js.map +1 -1
  42. package/build/components/editor-help/view-sections.native.js +1 -12
  43. package/build/components/editor-help/view-sections.native.js.map +1 -1
  44. package/build/components/editor-history/redo.js +6 -14
  45. package/build/components/editor-history/redo.js.map +1 -1
  46. package/build/components/editor-history/undo.js +6 -14
  47. package/build/components/editor-history/undo.js.map +1 -1
  48. package/build/components/editor-notices/index.js +1 -10
  49. package/build/components/editor-notices/index.js.map +1 -1
  50. package/build/components/editor-snackbars/index.js +1 -5
  51. package/build/components/editor-snackbars/index.js.map +1 -1
  52. package/build/components/entities-saved-states/entity-record-item.js +3 -10
  53. package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
  54. package/build/components/entities-saved-states/entity-type-list.js +3 -15
  55. package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
  56. package/build/components/entities-saved-states/hooks/use-is-dirty.js +5 -14
  57. package/build/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
  58. package/build/components/entities-saved-states/index.js +8 -27
  59. package/build/components/entities-saved-states/index.js.map +1 -1
  60. package/build/components/error-boundary/index.js +1 -18
  61. package/build/components/error-boundary/index.js.map +1 -1
  62. package/build/components/global-keyboard-shortcuts/index.js +5 -9
  63. package/build/components/global-keyboard-shortcuts/index.js.map +1 -1
  64. package/build/components/global-keyboard-shortcuts/register-shortcuts.js +1 -8
  65. package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  66. package/build/components/index.js +4 -76
  67. package/build/components/index.js.map +1 -1
  68. package/build/components/index.native.js +0 -9
  69. package/build/components/index.native.js.map +1 -1
  70. package/build/components/local-autosave-monitor/index.js +6 -31
  71. package/build/components/local-autosave-monitor/index.js.map +1 -1
  72. package/build/components/media-categories/index.js +30 -45
  73. package/build/components/media-categories/index.js.map +1 -1
  74. package/build/components/page-attributes/check.js +3 -7
  75. package/build/components/page-attributes/check.js.map +1 -1
  76. package/build/components/page-attributes/order.js +17 -42
  77. package/build/components/page-attributes/order.js.map +1 -1
  78. package/build/components/page-attributes/parent.js +8 -34
  79. package/build/components/page-attributes/parent.js.map +1 -1
  80. package/build/components/post-author/check.js +1 -11
  81. package/build/components/post-author/check.js.map +1 -1
  82. package/build/components/post-author/combobox.js +7 -23
  83. package/build/components/post-author/combobox.js.map +1 -1
  84. package/build/components/post-author/constants.js +0 -1
  85. package/build/components/post-author/constants.js.map +1 -1
  86. package/build/components/post-author/index.js +1 -12
  87. package/build/components/post-author/index.js.map +1 -1
  88. package/build/components/post-author/select.js +1 -12
  89. package/build/components/post-author/select.js.map +1 -1
  90. package/build/components/post-comments/index.js +1 -10
  91. package/build/components/post-comments/index.js.map +1 -1
  92. package/build/components/post-excerpt/check.js +6 -8
  93. package/build/components/post-excerpt/check.js.map +1 -1
  94. package/build/components/post-excerpt/index.js +1 -7
  95. package/build/components/post-excerpt/index.js.map +1 -1
  96. package/build/components/post-featured-image/check.js +6 -9
  97. package/build/components/post-featured-image/check.js.map +1 -1
  98. package/build/components/post-featured-image/index.js +13 -42
  99. package/build/components/post-featured-image/index.js.map +1 -1
  100. package/build/components/post-format/check.js +9 -18
  101. package/build/components/post-format/check.js.map +1 -1
  102. package/build/components/post-format/index.js +2 -20
  103. package/build/components/post-format/index.js.map +1 -1
  104. package/build/components/post-last-revision/check.js +15 -22
  105. package/build/components/post-last-revision/check.js.map +1 -1
  106. package/build/components/post-last-revision/index.js +17 -28
  107. package/build/components/post-last-revision/index.js.map +1 -1
  108. package/build/components/post-locked-modal/index.js +8 -28
  109. package/build/components/post-locked-modal/index.js.map +1 -1
  110. package/build/components/post-pending-status/check.js +16 -24
  111. package/build/components/post-pending-status/check.js.map +1 -1
  112. package/build/components/post-pending-status/index.js +10 -28
  113. package/build/components/post-pending-status/index.js.map +1 -1
  114. package/build/components/post-pingbacks/index.js +1 -10
  115. package/build/components/post-pingbacks/index.js.map +1 -1
  116. package/build/components/post-preview-button/index.js +11 -22
  117. package/build/components/post-preview-button/index.js.map +1 -1
  118. package/build/components/post-publish-button/index.js +6 -32
  119. package/build/components/post-publish-button/index.js.map +1 -1
  120. package/build/components/post-publish-button/label.js +1 -10
  121. package/build/components/post-publish-button/label.js.map +1 -1
  122. package/build/components/post-publish-panel/index.js +1 -22
  123. package/build/components/post-publish-panel/index.js.map +1 -1
  124. package/build/components/post-publish-panel/maybe-category-panel.js +4 -14
  125. package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  126. package/build/components/post-publish-panel/maybe-post-format-panel.js +2 -18
  127. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  128. package/build/components/post-publish-panel/maybe-tags-panel.js +2 -17
  129. package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  130. package/build/components/post-publish-panel/maybe-upload-media.js +1 -18
  131. package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  132. package/build/components/post-publish-panel/postpublish.js +3 -27
  133. package/build/components/post-publish-panel/postpublish.js.map +1 -1
  134. package/build/components/post-publish-panel/prepublish.js +1 -26
  135. package/build/components/post-publish-panel/prepublish.js.map +1 -1
  136. package/build/components/post-saved-state/index.js +12 -29
  137. package/build/components/post-saved-state/index.js.map +1 -1
  138. package/build/components/post-schedule/check.js +1 -8
  139. package/build/components/post-schedule/check.js.map +1 -1
  140. package/build/components/post-schedule/index.js +7 -13
  141. package/build/components/post-schedule/index.js.map +1 -1
  142. package/build/components/post-schedule/label.js +18 -29
  143. package/build/components/post-schedule/label.js.map +1 -1
  144. package/build/components/post-slug/check.js +1 -4
  145. package/build/components/post-slug/check.js.map +1 -1
  146. package/build/components/post-slug/index.js +1 -19
  147. package/build/components/post-slug/index.js.map +1 -1
  148. package/build/components/post-sticky/check.js +1 -8
  149. package/build/components/post-sticky/check.js.map +1 -1
  150. package/build/components/post-sticky/index.js +1 -12
  151. package/build/components/post-sticky/index.js.map +1 -1
  152. package/build/components/post-switch-to-draft-button/index.js +1 -14
  153. package/build/components/post-switch-to-draft-button/index.js.map +1 -1
  154. package/build/components/post-sync-status/index.js +5 -18
  155. package/build/components/post-sync-status/index.js.map +1 -1
  156. package/build/components/post-taxonomies/check.js +1 -9
  157. package/build/components/post-taxonomies/check.js.map +1 -1
  158. package/build/components/post-taxonomies/flat-term-selector.js +15 -50
  159. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  160. package/build/components/post-taxonomies/hierarchical-term-selector.js +27 -79
  161. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  162. package/build/components/post-taxonomies/index.js +3 -13
  163. package/build/components/post-taxonomies/index.js.map +1 -1
  164. package/build/components/post-taxonomies/most-used-terms.js +1 -9
  165. package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
  166. package/build/components/post-template/index.js +1 -11
  167. package/build/components/post-template/index.js.map +1 -1
  168. package/build/components/post-text-editor/index.js +3 -17
  169. package/build/components/post-text-editor/index.js.map +1 -1
  170. package/build/components/post-title/index.js +14 -46
  171. package/build/components/post-title/index.js.map +1 -1
  172. package/build/components/post-title/index.native.js +7 -44
  173. package/build/components/post-title/index.native.js.map +1 -1
  174. package/build/components/post-trash/check.js +1 -7
  175. package/build/components/post-trash/check.js.map +1 -1
  176. package/build/components/post-trash/index.js +1 -8
  177. package/build/components/post-trash/index.js.map +1 -1
  178. package/build/components/post-type-support-check/index.js +0 -9
  179. package/build/components/post-type-support-check/index.js.map +1 -1
  180. package/build/components/post-url/check.js +1 -12
  181. package/build/components/post-url/check.js.map +1 -1
  182. package/build/components/post-url/index.js +3 -15
  183. package/build/components/post-url/index.js.map +1 -1
  184. package/build/components/post-url/label.js +1 -5
  185. package/build/components/post-url/label.js.map +1 -1
  186. package/build/components/post-visibility/check.js +1 -7
  187. package/build/components/post-visibility/check.js.map +1 -1
  188. package/build/components/post-visibility/index.js +1 -17
  189. package/build/components/post-visibility/index.js.map +1 -1
  190. package/build/components/post-visibility/label.js +1 -5
  191. package/build/components/post-visibility/label.js.map +1 -1
  192. package/build/components/post-visibility/utils.js +1 -2
  193. package/build/components/post-visibility/utils.js.map +1 -1
  194. package/build/components/provider/index.js +13 -27
  195. package/build/components/provider/index.js.map +1 -1
  196. package/build/components/provider/index.native.js +18 -70
  197. package/build/components/provider/index.native.js.map +1 -1
  198. package/build/components/provider/use-block-editor-settings.js +9 -20
  199. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  200. package/build/components/provider/use-block-editor-settings.native.js +5 -11
  201. package/build/components/provider/use-block-editor-settings.native.js.map +1 -1
  202. package/build/components/provider/with-registry-provider.js +5 -12
  203. package/build/components/provider/with-registry-provider.js.map +1 -1
  204. package/build/components/table-of-contents/index.js +4 -14
  205. package/build/components/table-of-contents/index.js.map +1 -1
  206. package/build/components/table-of-contents/panel.js +1 -13
  207. package/build/components/table-of-contents/panel.js.map +1 -1
  208. package/build/components/template-validation-notice/index.js +3 -12
  209. package/build/components/template-validation-notice/index.js.map +1 -1
  210. package/build/components/theme-support-check/index.js +3 -12
  211. package/build/components/theme-support-check/index.js.map +1 -1
  212. package/build/components/time-to-read/index.js +2 -10
  213. package/build/components/time-to-read/index.js.map +1 -1
  214. package/build/components/unsaved-changes-warning/index.js +21 -35
  215. package/build/components/unsaved-changes-warning/index.js.map +1 -1
  216. package/build/components/word-count/index.js +2 -7
  217. package/build/components/word-count/index.js.map +1 -1
  218. package/build/hooks/custom-sources-backwards-compatibility.js +7 -18
  219. package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  220. package/build/hooks/default-autocompleters.js +3 -4
  221. package/build/hooks/default-autocompleters.js.map +1 -1
  222. package/build/hooks/index.js +0 -1
  223. package/build/hooks/index.js.map +1 -1
  224. package/build/hooks/index.native.js.map +1 -1
  225. package/build/index.js +0 -9
  226. package/build/index.js.map +1 -1
  227. package/build/index.native.js +0 -11
  228. package/build/index.native.js.map +1 -1
  229. package/build/lock-unlock.js +1 -2
  230. package/build/lock-unlock.js.map +1 -1
  231. package/build/private-apis.js +1 -4
  232. package/build/private-apis.js.map +1 -1
  233. package/build/store/actions.js +60 -129
  234. package/build/store/actions.js.map +1 -1
  235. package/build/store/actions.native.js +1 -8
  236. package/build/store/actions.native.js.map +1 -1
  237. package/build/store/constants.js +1 -2
  238. package/build/store/constants.js.map +1 -1
  239. package/build/store/defaults.js +2 -3
  240. package/build/store/defaults.js.map +1 -1
  241. package/build/store/index.js +3 -11
  242. package/build/store/index.js.map +1 -1
  243. package/build/store/local-autosave.js +0 -4
  244. package/build/store/local-autosave.js.map +1 -1
  245. package/build/store/reducer.js +19 -49
  246. package/build/store/reducer.js.map +1 -1
  247. package/build/store/reducer.native.js +3 -17
  248. package/build/store/reducer.native.js.map +1 -1
  249. package/build/store/selectors.js +169 -295
  250. package/build/store/selectors.js.map +1 -1
  251. package/build/store/selectors.native.js +4 -11
  252. package/build/store/selectors.native.js.map +1 -1
  253. package/build/store/utils/notice-builder.js +13 -24
  254. package/build/store/utils/notice-builder.js.map +1 -1
  255. package/build/utils/get-template-part-icon.js +0 -3
  256. package/build/utils/get-template-part-icon.js.map +1 -1
  257. package/build/utils/index.js +0 -4
  258. package/build/utils/index.js.map +1 -1
  259. package/build/utils/index.native.js +0 -2
  260. package/build/utils/index.native.js.map +1 -1
  261. package/build/utils/media-upload/index.js +2 -6
  262. package/build/utils/media-upload/index.js.map +1 -1
  263. package/build/utils/media-upload/index.native.js +0 -1
  264. package/build/utils/media-upload/index.native.js.map +1 -1
  265. package/build/utils/terms.js +8 -18
  266. package/build/utils/terms.js.map +1 -1
  267. package/build/utils/url.js +0 -4
  268. package/build/utils/url.js.map +1 -1
  269. package/build-module/components/autocompleters/index.js.map +1 -1
  270. package/build-module/components/autocompleters/user.js +2 -5
  271. package/build-module/components/autocompleters/user.js.map +1 -1
  272. package/build-module/components/autosave-monitor/index.js +2 -17
  273. package/build-module/components/autosave-monitor/index.js.map +1 -1
  274. package/build-module/components/character-count/index.js +1 -1
  275. package/build-module/components/character-count/index.js.map +1 -1
  276. package/build-module/components/deprecated.js +0 -4
  277. package/build-module/components/deprecated.js.map +1 -1
  278. package/build-module/components/deprecated.native.js +0 -1
  279. package/build-module/components/deprecated.native.js.map +1 -1
  280. package/build-module/components/document-outline/check.js +0 -4
  281. package/build-module/components/document-outline/check.js.map +1 -1
  282. package/build-module/components/document-outline/index.js +9 -13
  283. package/build-module/components/document-outline/index.js.map +1 -1
  284. package/build-module/components/document-outline/item.js +0 -3
  285. package/build-module/components/document-outline/item.js.map +1 -1
  286. package/build-module/components/editor-help/add-blocks.native.js +2 -5
  287. package/build-module/components/editor-help/add-blocks.native.js.map +1 -1
  288. package/build-module/components/editor-help/customize-blocks.native.js +2 -5
  289. package/build-module/components/editor-help/customize-blocks.native.js.map +1 -1
  290. package/build-module/components/editor-help/help-detail-navigation-screen.native.js +6 -8
  291. package/build-module/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
  292. package/build-module/components/editor-help/help-get-support-button.native.js +2 -5
  293. package/build-module/components/editor-help/help-get-support-button.native.js.map +1 -1
  294. package/build-module/components/editor-help/help-section-title.native.js +2 -5
  295. package/build-module/components/editor-help/help-section-title.native.js.map +1 -1
  296. package/build-module/components/editor-help/help-topic-row.native.js +1 -6
  297. package/build-module/components/editor-help/help-topic-row.native.js.map +1 -1
  298. package/build-module/components/editor-help/icon-move-blocks.native.js +0 -1
  299. package/build-module/components/editor-help/icon-move-blocks.native.js.map +1 -1
  300. package/build-module/components/editor-help/index.native.js +9 -9
  301. package/build-module/components/editor-help/index.native.js.map +1 -1
  302. package/build-module/components/editor-help/intro-to-blocks.native.js +2 -5
  303. package/build-module/components/editor-help/intro-to-blocks.native.js.map +1 -1
  304. package/build-module/components/editor-help/move-blocks.native.js +2 -5
  305. package/build-module/components/editor-help/move-blocks.native.js.map +1 -1
  306. package/build-module/components/editor-help/remove-blocks.native.js +2 -5
  307. package/build-module/components/editor-help/remove-blocks.native.js.map +1 -1
  308. package/build-module/components/editor-help/view-sections.native.js +2 -4
  309. package/build-module/components/editor-help/view-sections.native.js.map +1 -1
  310. package/build-module/components/editor-history/redo.js +6 -8
  311. package/build-module/components/editor-history/redo.js.map +1 -1
  312. package/build-module/components/editor-history/undo.js +6 -8
  313. package/build-module/components/editor-history/undo.js.map +1 -1
  314. package/build-module/components/editor-notices/index.js +1 -2
  315. package/build-module/components/editor-notices/index.js.map +1 -1
  316. package/build-module/components/editor-snackbars/index.js +0 -1
  317. package/build-module/components/editor-snackbars/index.js.map +1 -1
  318. package/build-module/components/entities-saved-states/entity-record-item.js +3 -4
  319. package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
  320. package/build-module/components/entities-saved-states/entity-type-list.js +3 -10
  321. package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
  322. package/build-module/components/entities-saved-states/hooks/use-is-dirty.js +4 -7
  323. package/build-module/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
  324. package/build-module/components/entities-saved-states/index.js +8 -16
  325. package/build-module/components/entities-saved-states/index.js.map +1 -1
  326. package/build-module/components/error-boundary/index.js +1 -12
  327. package/build-module/components/error-boundary/index.js.map +1 -1
  328. package/build-module/components/global-keyboard-shortcuts/index.js +5 -6
  329. package/build-module/components/global-keyboard-shortcuts/index.js.map +1 -1
  330. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +0 -3
  331. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  332. package/build-module/components/index.js +6 -3
  333. package/build-module/components/index.js.map +1 -1
  334. package/build-module/components/index.native.js +4 -2
  335. package/build-module/components/index.native.js.map +1 -1
  336. package/build-module/components/local-autosave-monitor/index.js +6 -21
  337. package/build-module/components/local-autosave-monitor/index.js.map +1 -1
  338. package/build-module/components/media-categories/index.js +31 -41
  339. package/build-module/components/media-categories/index.js.map +1 -1
  340. package/build-module/components/page-attributes/check.js +3 -3
  341. package/build-module/components/page-attributes/check.js.map +1 -1
  342. package/build-module/components/page-attributes/order.js +17 -31
  343. package/build-module/components/page-attributes/order.js.map +1 -1
  344. package/build-module/components/page-attributes/parent.js +9 -23
  345. package/build-module/components/page-attributes/parent.js.map +1 -1
  346. package/build-module/components/post-author/check.js +1 -5
  347. package/build-module/components/post-author/check.js.map +1 -1
  348. package/build-module/components/post-author/combobox.js +7 -16
  349. package/build-module/components/post-author/combobox.js.map +1 -1
  350. package/build-module/components/post-author/constants.js +0 -1
  351. package/build-module/components/post-author/constants.js.map +1 -1
  352. package/build-module/components/post-author/index.js +1 -6
  353. package/build-module/components/post-author/index.js.map +1 -1
  354. package/build-module/components/post-author/select.js +1 -6
  355. package/build-module/components/post-author/select.js.map +1 -1
  356. package/build-module/components/post-comments/index.js +1 -7
  357. package/build-module/components/post-comments/index.js.map +1 -1
  358. package/build-module/components/post-excerpt/check.js +5 -6
  359. package/build-module/components/post-excerpt/check.js.map +1 -1
  360. package/build-module/components/post-excerpt/index.js +1 -4
  361. package/build-module/components/post-excerpt/index.js.map +1 -1
  362. package/build-module/components/post-featured-image/check.js +5 -6
  363. package/build-module/components/post-featured-image/check.js.map +1 -1
  364. package/build-module/components/post-featured-image/index.js +13 -31
  365. package/build-module/components/post-featured-image/index.js.map +1 -1
  366. package/build-module/components/post-format/check.js +10 -15
  367. package/build-module/components/post-format/check.js.map +1 -1
  368. package/build-module/components/post-format/index.js +4 -12
  369. package/build-module/components/post-format/index.js.map +1 -1
  370. package/build-module/components/post-last-revision/check.js +17 -17
  371. package/build-module/components/post-last-revision/check.js.map +1 -1
  372. package/build-module/components/post-last-revision/index.js +18 -21
  373. package/build-module/components/post-last-revision/index.js.map +1 -1
  374. package/build-module/components/post-locked-modal/index.js +8 -22
  375. package/build-module/components/post-locked-modal/index.js.map +1 -1
  376. package/build-module/components/post-pending-status/check.js +17 -20
  377. package/build-module/components/post-pending-status/check.js.map +1 -1
  378. package/build-module/components/post-pending-status/index.js +11 -20
  379. package/build-module/components/post-pending-status/index.js.map +1 -1
  380. package/build-module/components/post-pingbacks/index.js +1 -7
  381. package/build-module/components/post-pingbacks/index.js.map +1 -1
  382. package/build-module/components/post-preview-button/index.js +11 -17
  383. package/build-module/components/post-preview-button/index.js.map +1 -1
  384. package/build-module/components/post-publish-button/index.js +7 -23
  385. package/build-module/components/post-publish-button/index.js.map +1 -1
  386. package/build-module/components/post-publish-button/label.js +1 -4
  387. package/build-module/components/post-publish-button/label.js.map +1 -1
  388. package/build-module/components/post-publish-panel/index.js +1 -8
  389. package/build-module/components/post-publish-panel/index.js.map +1 -1
  390. package/build-module/components/post-publish-panel/maybe-category-panel.js +4 -8
  391. package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  392. package/build-module/components/post-publish-panel/maybe-post-format-panel.js +2 -12
  393. package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  394. package/build-module/components/post-publish-panel/maybe-tags-panel.js +2 -9
  395. package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  396. package/build-module/components/post-publish-panel/maybe-upload-media.js +1 -12
  397. package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  398. package/build-module/components/post-publish-panel/postpublish.js +3 -16
  399. package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
  400. package/build-module/components/post-publish-panel/prepublish.js +1 -10
  401. package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
  402. package/build-module/components/post-saved-state/index.js +15 -23
  403. package/build-module/components/post-saved-state/index.js.map +1 -1
  404. package/build-module/components/post-schedule/check.js +1 -3
  405. package/build-module/components/post-schedule/check.js.map +1 -1
  406. package/build-module/components/post-schedule/index.js +8 -8
  407. package/build-module/components/post-schedule/index.js.map +1 -1
  408. package/build-module/components/post-schedule/label.js +18 -22
  409. package/build-module/components/post-schedule/label.js.map +1 -1
  410. package/build-module/components/post-slug/check.js +0 -1
  411. package/build-module/components/post-slug/check.js.map +1 -1
  412. package/build-module/components/post-slug/index.js +1 -8
  413. package/build-module/components/post-slug/index.js.map +1 -1
  414. package/build-module/components/post-sticky/check.js +1 -3
  415. package/build-module/components/post-sticky/check.js.map +1 -1
  416. package/build-module/components/post-sticky/index.js +1 -3
  417. package/build-module/components/post-sticky/index.js.map +1 -1
  418. package/build-module/components/post-switch-to-draft-button/index.js +1 -9
  419. package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
  420. package/build-module/components/post-sync-status/index.js +5 -11
  421. package/build-module/components/post-sync-status/index.js.map +1 -1
  422. package/build-module/components/post-taxonomies/check.js +1 -3
  423. package/build-module/components/post-taxonomies/check.js.map +1 -1
  424. package/build-module/components/post-taxonomies/flat-term-selector.js +17 -39
  425. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  426. package/build-module/components/post-taxonomies/hierarchical-term-selector.js +29 -66
  427. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  428. package/build-module/components/post-taxonomies/index.js +3 -5
  429. package/build-module/components/post-taxonomies/index.js.map +1 -1
  430. package/build-module/components/post-taxonomies/most-used-terms.js +1 -4
  431. package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
  432. package/build-module/components/post-template/index.js +1 -5
  433. package/build-module/components/post-template/index.js.map +1 -1
  434. package/build-module/components/post-text-editor/index.js +4 -9
  435. package/build-module/components/post-text-editor/index.js.map +1 -1
  436. package/build-module/components/post-title/index.js +17 -35
  437. package/build-module/components/post-title/index.js.map +1 -1
  438. package/build-module/components/post-title/index.native.js +8 -33
  439. package/build-module/components/post-title/index.native.js.map +1 -1
  440. package/build-module/components/post-trash/check.js +1 -4
  441. package/build-module/components/post-trash/check.js.map +1 -1
  442. package/build-module/components/post-trash/index.js +1 -4
  443. package/build-module/components/post-trash/index.js.map +1 -1
  444. package/build-module/components/post-type-support-check/index.js +3 -6
  445. package/build-module/components/post-type-support-check/index.js.map +1 -1
  446. package/build-module/components/post-url/check.js +1 -9
  447. package/build-module/components/post-url/check.js.map +1 -1
  448. package/build-module/components/post-url/index.js +3 -8
  449. package/build-module/components/post-url/index.js.map +1 -1
  450. package/build-module/components/post-url/label.js +1 -1
  451. package/build-module/components/post-url/label.js.map +1 -1
  452. package/build-module/components/post-visibility/check.js +1 -2
  453. package/build-module/components/post-visibility/check.js.map +1 -1
  454. package/build-module/components/post-visibility/index.js +1 -10
  455. package/build-module/components/post-visibility/index.js.map +1 -1
  456. package/build-module/components/post-visibility/label.js +1 -1
  457. package/build-module/components/post-visibility/label.js.map +1 -1
  458. package/build-module/components/post-visibility/utils.js.map +1 -1
  459. package/build-module/components/provider/index.js +13 -14
  460. package/build-module/components/provider/index.js.map +1 -1
  461. package/build-module/components/provider/index.native.js +21 -52
  462. package/build-module/components/provider/index.native.js.map +1 -1
  463. package/build-module/components/provider/use-block-editor-settings.js +9 -12
  464. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  465. package/build-module/components/provider/use-block-editor-settings.native.js +5 -5
  466. package/build-module/components/provider/use-block-editor-settings.native.js.map +1 -1
  467. package/build-module/components/provider/with-registry-provider.js +5 -8
  468. package/build-module/components/provider/with-registry-provider.js.map +1 -1
  469. package/build-module/components/table-of-contents/index.js +4 -7
  470. package/build-module/components/table-of-contents/index.js.map +1 -1
  471. package/build-module/components/table-of-contents/panel.js +1 -5
  472. package/build-module/components/table-of-contents/panel.js.map +1 -1
  473. package/build-module/components/template-validation-notice/index.js +2 -6
  474. package/build-module/components/template-validation-notice/index.js.map +1 -1
  475. package/build-module/components/theme-support-check/index.js +3 -7
  476. package/build-module/components/theme-support-check/index.js.map +1 -1
  477. package/build-module/components/time-to-read/index.js +4 -7
  478. package/build-module/components/time-to-read/index.js.map +1 -1
  479. package/build-module/components/unsaved-changes-warning/index.js +22 -31
  480. package/build-module/components/unsaved-changes-warning/index.js.map +1 -1
  481. package/build-module/components/word-count/index.js +2 -4
  482. package/build-module/components/word-count/index.js.map +1 -1
  483. package/build-module/hooks/custom-sources-backwards-compatibility.js +9 -15
  484. package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  485. package/build-module/hooks/default-autocompleters.js +3 -4
  486. package/build-module/hooks/default-autocompleters.js.map +1 -1
  487. package/build-module/hooks/index.js.map +1 -1
  488. package/build-module/hooks/index.native.js.map +1 -1
  489. package/build-module/index.js +1 -1
  490. package/build-module/index.js.map +1 -1
  491. package/build-module/index.native.js +1 -1
  492. package/build-module/index.native.js.map +1 -1
  493. package/build-module/lock-unlock.js.map +1 -1
  494. package/build-module/private-apis.js.map +1 -1
  495. package/build-module/store/actions.js +62 -84
  496. package/build-module/store/actions.js.map +1 -1
  497. package/build-module/store/actions.native.js +2 -2
  498. package/build-module/store/actions.native.js.map +1 -1
  499. package/build-module/store/constants.js +1 -1
  500. package/build-module/store/constants.js.map +1 -1
  501. package/build-module/store/defaults.js +3 -2
  502. package/build-module/store/defaults.js.map +1 -1
  503. package/build-module/store/index.js +5 -4
  504. package/build-module/store/index.js.map +1 -1
  505. package/build-module/store/local-autosave.js +0 -1
  506. package/build-module/store/local-autosave.js.map +1 -1
  507. package/build-module/store/reducer.js +21 -33
  508. package/build-module/store/reducer.js.map +1 -1
  509. package/build-module/store/reducer.native.js +4 -10
  510. package/build-module/store/reducer.native.js.map +1 -1
  511. package/build-module/store/selectors.js +172 -222
  512. package/build-module/store/selectors.js.map +1 -1
  513. package/build-module/store/selectors.native.js +6 -8
  514. package/build-module/store/selectors.native.js.map +1 -1
  515. package/build-module/store/utils/notice-builder.js +15 -21
  516. package/build-module/store/utils/notice-builder.js.map +1 -1
  517. package/build-module/utils/get-template-part-icon.js +0 -2
  518. package/build-module/utils/get-template-part-icon.js.map +1 -1
  519. package/build-module/utils/index.js.map +1 -1
  520. package/build-module/utils/index.native.js.map +1 -1
  521. package/build-module/utils/media-upload/index.js +2 -4
  522. package/build-module/utils/media-upload/index.js.map +1 -1
  523. package/build-module/utils/media-upload/index.native.js.map +1 -1
  524. package/build-module/utils/terms.js +9 -11
  525. package/build-module/utils/terms.js.map +1 -1
  526. package/build-module/utils/url.js +1 -1
  527. package/build-module/utils/url.js.map +1 -1
  528. package/build-style/style-rtl.css +10 -17
  529. package/build-style/style.css +10 -17
  530. package/package.json +32 -31
  531. package/src/components/editor-help/index.native.js +1 -1
  532. package/src/components/editor-help/style.scss +5 -0
  533. package/src/components/page-attributes/order.js +15 -23
  534. package/src/components/page-attributes/test/order.js +46 -15
  535. package/src/components/post-excerpt/check.js +6 -2
  536. package/src/components/post-featured-image/check.js +4 -2
  537. package/src/components/post-format/check.js +16 -11
  538. package/src/components/post-last-revision/check.js +12 -14
  539. package/src/components/post-last-revision/index.js +12 -10
  540. package/src/components/post-last-revision/test/check.js +28 -16
  541. package/src/components/post-pending-status/check.js +13 -19
  542. package/src/components/post-pending-status/index.js +9 -14
  543. package/src/components/post-pending-status/test/check.js +32 -10
  544. package/src/components/post-publish-panel/style.scss +12 -25
  545. package/src/components/post-sync-status/style.scss +4 -1
  546. package/src/components/post-type-support-check/index.js +1 -1
  547. package/src/components/post-type-support-check/test/index.js +1 -1
  548. package/src/components/provider/index.js +3 -2
  549. package/src/components/unsaved-changes-warning/index.js +22 -27
@@ -1,34 +1,21 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _element = require("@wordpress/element");
11
-
12
9
  var _i18n = require("@wordpress/i18n");
13
-
14
10
  var _hooks = require("@wordpress/hooks");
15
-
16
11
  var _components = require("@wordpress/components");
17
-
18
12
  var _blob = require("@wordpress/blob");
19
-
20
13
  var _compose = require("@wordpress/compose");
21
-
22
14
  var _data = require("@wordpress/data");
23
-
24
15
  var _blockEditor = require("@wordpress/block-editor");
25
-
26
16
  var _coreData = require("@wordpress/core-data");
27
-
28
17
  var _check = _interopRequireDefault(require("./check"));
29
-
30
18
  var _store = require("../../store");
31
-
32
19
  /**
33
20
  * WordPress dependencies
34
21
  */
@@ -36,48 +23,44 @@ var _store = require("../../store");
36
23
  /**
37
24
  * Internal dependencies
38
25
  */
39
- const ALLOWED_MEDIA_TYPES = ['image']; // Used when labels from post type were not yet loaded or when they are not present.
40
26
 
27
+ const ALLOWED_MEDIA_TYPES = ['image'];
28
+
29
+ // Used when labels from post type were not yet loaded or when they are not present.
41
30
  const DEFAULT_FEATURE_IMAGE_LABEL = (0, _i18n.__)('Featured image');
42
31
  const DEFAULT_SET_FEATURE_IMAGE_LABEL = (0, _i18n.__)('Set featured image');
43
32
  const instructions = (0, _element.createElement)("p", null, (0, _i18n.__)('To edit the featured image, you need permission to upload media.'));
44
-
45
33
  function getMediaDetails(media, postId) {
46
34
  var _media$media_details$, _media$media_details$2;
47
-
48
35
  if (!media) {
49
36
  return {};
50
37
  }
51
-
52
38
  const defaultSize = (0, _hooks.applyFilters)('editor.PostFeaturedImage.imageSize', 'large', media.id, postId);
53
-
54
39
  if (defaultSize in ((_media$media_details$ = media?.media_details?.sizes) !== null && _media$media_details$ !== void 0 ? _media$media_details$ : {})) {
55
40
  return {
56
41
  mediaWidth: media.media_details.sizes[defaultSize].width,
57
42
  mediaHeight: media.media_details.sizes[defaultSize].height,
58
43
  mediaSourceUrl: media.media_details.sizes[defaultSize].source_url
59
44
  };
60
- } // Use fallbackSize when defaultSize is not available.
61
-
45
+ }
62
46
 
47
+ // Use fallbackSize when defaultSize is not available.
63
48
  const fallbackSize = (0, _hooks.applyFilters)('editor.PostFeaturedImage.imageSize', 'thumbnail', media.id, postId);
64
-
65
49
  if (fallbackSize in ((_media$media_details$2 = media?.media_details?.sizes) !== null && _media$media_details$2 !== void 0 ? _media$media_details$2 : {})) {
66
50
  return {
67
51
  mediaWidth: media.media_details.sizes[fallbackSize].width,
68
52
  mediaHeight: media.media_details.sizes[fallbackSize].height,
69
53
  mediaSourceUrl: media.media_details.sizes[fallbackSize].source_url
70
54
  };
71
- } // Use full image size when fallbackSize and defaultSize are not available.
72
-
55
+ }
73
56
 
57
+ // Use full image size when fallbackSize and defaultSize are not available.
74
58
  return {
75
59
  mediaWidth: media.media_details.width,
76
60
  mediaHeight: media.media_details.height,
77
61
  mediaSourceUrl: media.source_url
78
62
  };
79
63
  }
80
-
81
64
  function PostFeaturedImage({
82
65
  currentPostId,
83
66
  featuredImageId,
@@ -98,37 +81,33 @@ function PostFeaturedImage({
98
81
  mediaHeight,
99
82
  mediaSourceUrl
100
83
  } = getMediaDetails(media, currentPostId);
101
-
102
84
  function onDropFiles(filesList) {
103
85
  mediaUpload({
104
86
  allowedTypes: ['image'],
105
87
  filesList,
106
-
107
88
  onFileChange([image]) {
108
89
  if ((0, _blob.isBlobURL)(image?.url)) {
109
90
  setIsLoading(true);
110
91
  return;
111
92
  }
112
-
113
93
  onUpdateImage(image);
114
94
  setIsLoading(false);
115
95
  },
116
-
117
96
  onError(message) {
118
97
  noticeOperations.removeAllNotices();
119
98
  noticeOperations.createErrorNotice(message);
120
99
  }
121
-
122
100
  });
123
101
  }
124
-
125
102
  return (0, _element.createElement)(_check.default, null, noticeUI, (0, _element.createElement)("div", {
126
103
  className: "editor-post-featured-image"
127
104
  }, media && (0, _element.createElement)("div", {
128
105
  id: `editor-post-featured-image-${featuredImageId}-describedby`,
129
106
  className: "hidden"
130
- }, media.alt_text && (0, _i18n.sprintf)( // Translators: %s: The selected image alt text.
131
- (0, _i18n.__)('Current image: %s'), media.alt_text), !media.alt_text && (0, _i18n.sprintf)( // Translators: %s: The selected image filename.
107
+ }, media.alt_text && (0, _i18n.sprintf)(
108
+ // Translators: %s: The selected image alt text.
109
+ (0, _i18n.__)('Current image: %s'), media.alt_text), !media.alt_text && (0, _i18n.sprintf)(
110
+ // Translators: %s: The selected image filename.
132
111
  (0, _i18n.__)('The current image has no alternative text. The file name is: %s'), media.media_details.sizes?.full?.file || media.slug)), (0, _element.createElement)(_blockEditor.MediaUploadCheck, {
133
112
  fallback: instructions
134
113
  }, (0, _element.createElement)(_blockEditor.MediaUpload, {
@@ -158,7 +137,8 @@ function PostFeaturedImage({
158
137
  className: "editor-post-featured-image__actions"
159
138
  }, (0, _element.createElement)(_components.Button, {
160
139
  className: "editor-post-featured-image__action",
161
- onClick: open // Prefer that screen readers use the .editor-post-featured-image__preview button.
140
+ onClick: open
141
+ // Prefer that screen readers use the .editor-post-featured-image__preview button.
162
142
  ,
163
143
  "aria-hidden": "true"
164
144
  }, (0, _i18n.__)('Replace')), (0, _element.createElement)(_components.Button, {
@@ -173,7 +153,6 @@ function PostFeaturedImage({
173
153
  value: featuredImageId
174
154
  }))));
175
155
  }
176
-
177
156
  const applyWithSelect = (0, _data.withSelect)(select => {
178
157
  const {
179
158
  getMedia,
@@ -207,36 +186,28 @@ const applyWithDispatch = (0, _data.withDispatch)((dispatch, {
207
186
  featured_media: image.id
208
187
  });
209
188
  },
210
-
211
189
  onDropImage(filesList) {
212
190
  select(_blockEditor.store).getSettings().mediaUpload({
213
191
  allowedTypes: ['image'],
214
192
  filesList,
215
-
216
193
  onFileChange([image]) {
217
194
  editPost({
218
195
  featured_media: image.id
219
196
  });
220
197
  },
221
-
222
198
  onError(message) {
223
199
  noticeOperations.removeAllNotices();
224
200
  noticeOperations.createErrorNotice(message);
225
201
  }
226
-
227
202
  });
228
203
  },
229
-
230
204
  onRemoveImage() {
231
205
  editPost({
232
206
  featured_media: 0
233
207
  });
234
208
  }
235
-
236
209
  };
237
210
  });
238
-
239
211
  var _default = (0, _compose.compose)(_components.withNotices, applyWithSelect, applyWithDispatch, (0, _components.withFilters)('editor.PostFeaturedImage'))(PostFeaturedImage);
240
-
241
212
  exports.default = _default;
242
213
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-featured-image/index.js"],"names":["ALLOWED_MEDIA_TYPES","DEFAULT_FEATURE_IMAGE_LABEL","DEFAULT_SET_FEATURE_IMAGE_LABEL","instructions","getMediaDetails","media","postId","defaultSize","id","media_details","sizes","mediaWidth","width","mediaHeight","height","mediaSourceUrl","source_url","fallbackSize","PostFeaturedImage","currentPostId","featuredImageId","onUpdateImage","onRemoveImage","postType","noticeUI","noticeOperations","toggleRef","isLoading","setIsLoading","mediaUpload","select","blockEditorStore","getSettings","onDropFiles","filesList","allowedTypes","onFileChange","image","url","onError","message","removeAllNotices","createErrorNotice","alt_text","full","file","slug","labels","featured_image","open","set_featured_image","current","focus","applyWithSelect","getMedia","getPostType","coreStore","getCurrentPostId","getEditedPostAttribute","editorStore","context","applyWithDispatch","dispatch","editPost","featured_media","onDropImage","withNotices"],"mappings":";;;;;;;;;AAeA;;AAZA;;AACA;;AACA;;AASA;;AAEA;;AACA;;AACA;;AAKA;;AAKA;;AACA;;AA7BA;AACA;AACA;;AAuBA;AACA;AACA;AAIA,MAAMA,mBAAmB,GAAG,CAAE,OAAF,CAA5B,C,CAEA;;AACA,MAAMC,2BAA2B,GAAG,cAAI,gBAAJ,CAApC;AACA,MAAMC,+BAA+B,GAAG,cAAI,oBAAJ,CAAxC;AAEA,MAAMC,YAAY,GACjB,uCACG,cACD,kEADC,CADH,CADD;;AAQA,SAASC,eAAT,CAA0BC,KAA1B,EAAiCC,MAAjC,EAA0C;AAAA;;AACzC,MAAK,CAAED,KAAP,EAAe;AACd,WAAO,EAAP;AACA;;AAED,QAAME,WAAW,GAAG,yBACnB,oCADmB,EAEnB,OAFmB,EAGnBF,KAAK,CAACG,EAHa,EAInBF,MAJmB,CAApB;;AAMA,MAAKC,WAAW,8BAAMF,KAAK,EAAEI,aAAP,EAAsBC,KAA5B,yEAAqC,EAArC,CAAhB,EAA4D;AAC3D,WAAO;AACNC,MAAAA,UAAU,EAAEN,KAAK,CAACI,aAAN,CAAoBC,KAApB,CAA2BH,WAA3B,EAAyCK,KAD/C;AAENC,MAAAA,WAAW,EAAER,KAAK,CAACI,aAAN,CAAoBC,KAApB,CAA2BH,WAA3B,EAAyCO,MAFhD;AAGNC,MAAAA,cAAc,EAAEV,KAAK,CAACI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AM,CAAEC,kBAAF,CAAN,CACEC,WADF,GAEEH,WAFF,CAEe;AACbM,QAAAA,YAAY,EAAE,CAAE,OAAF,CADD;AAEbD,QAAAA,SAFa;;AAGbE,QAAAA,YAAY,CAAE,CAAEC,KAAF,CAAF,EAAc;AACzB0B,UAAAA,QAAQ,CAAE;AAAEC,YAAAA,cAAc,EAAE3B,KAAK,CAAC7B;AAAxB,WAAF,CAAR;AACA,SALY;;AAMb+B,QAAAA,OAAO,CAAEC,OAAF,EAAY;AAClBf,UAAAA,gBAAgB,CAACgB,gBAAjB;AACAhB,UAAAA,gBAAgB,CAACiB,iBAAjB,CAAoCF,OAApC;AACA;;AATY,OAFf;AAaA,KAlBK;;AAmBNlB,IAAAA,aAAa,GAAG;AACfyC,MAAAA,QAAQ,CAAE;AAAEC,QAAAA,cAAc,EAAE;AAAlB,OAAF,CAAR;AACA;;AArBK,GAAP;AAuBA,CA1BwB,CAA1B;;eA6Be,sBACdE,uBADc,EAEdb,eAFc,EAGdQ,iBAHc,EAId,6BAAa,0BAAb,CAJc,EAKZ3C,iBALY,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { applyFilters } from '@wordpress/hooks';\nimport {\n\tDropZone,\n\tButton,\n\tSpinner,\n\tResponsiveWrapper,\n\twithNotices,\n\twithFilters,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { isBlobURL } from '@wordpress/blob';\nimport { useState, useRef } from '@wordpress/element';\nimport { compose } from '@wordpress/compose';\nimport { useSelect, withDispatch, withSelect } from '@wordpress/data';\nimport {\n\tMediaUpload,\n\tMediaUploadCheck,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostFeaturedImageCheck from './check';\nimport { store as editorStore } from '../../store';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\n\n// Used when labels from post type were not yet loaded or when they are not present.\nconst DEFAULT_FEATURE_IMAGE_LABEL = __( 'Featured image' );\nconst DEFAULT_SET_FEATURE_IMAGE_LABEL = __( 'Set featured image' );\n\nconst instructions = (\n\t<p>\n\t\t{ __(\n\t\t\t'To edit the featured image, you need permission to upload media.'\n\t\t) }\n\t</p>\n);\n\nfunction getMediaDetails( media, postId ) {\n\tif ( ! media ) {\n\t\treturn {};\n\t}\n\n\tconst defaultSize = applyFilters(\n\t\t'editor.PostFeaturedImage.imageSize',\n\t\t'large',\n\t\tmedia.id,\n\t\tpostId\n\t);\n\tif ( defaultSize in ( media?.media_details?.sizes ?? {} ) ) {\n\t\treturn {\n\t\t\tmediaWidth: media.media_details.sizes[ defaultSize ].width,\n\t\t\tmediaHeight: media.media_details.sizes[ defaultSize ].height,\n\t\t\tmediaSourceUrl: media.media_details.sizes[ defaultSize ].source_url,\n\t\t};\n\t}\n\n\t// Use fallbackSize when defaultSize is not available.\n\tconst fallbackSize = applyFilters(\n\t\t'editor.PostFeaturedImage.imageSize',\n\t\t'thumbnail',\n\t\tmedia.id,\n\t\tpostId\n\t);\n\tif ( fallbackSize in ( media?.media_details?.sizes ?? {} ) ) {\n\t\treturn {\n\t\t\tmediaWidth: media.media_details.sizes[ fallbackSize ].width,\n\t\t\tmediaHeight: media.media_details.sizes[ fallbackSize ].height,\n\t\t\tmediaSourceUrl:\n\t\t\t\tmedia.media_details.sizes[ fallbackSize ].source_url,\n\t\t};\n\t}\n\n\t// Use full image size when fallbackSize and defaultSize are not available.\n\treturn {\n\t\tmediaWidth: media.media_details.width,\n\t\tmediaHeight: media.media_details.height,\n\t\tmediaSourceUrl: media.source_url,\n\t};\n}\n\nfunction PostFeaturedImage( {\n\tcurrentPostId,\n\tfeaturedImageId,\n\tonUpdateImage,\n\tonRemoveImage,\n\tmedia,\n\tpostType,\n\tnoticeUI,\n\tnoticeOperations,\n} ) {\n\tconst toggleRef = useRef();\n\tconst [ isLoading, setIsLoading ] = useState( false );\n\tconst mediaUpload = useSelect( ( select ) => {\n\t\treturn select( blockEditorStore ).getSettings().mediaUpload;\n\t}, [] );\n\tconst { mediaWidth, mediaHeight, mediaSourceUrl } = getMediaDetails(\n\t\tmedia,\n\t\tcurrentPostId\n\t);\n\n\tfunction onDropFiles( filesList ) {\n\t\tmediaUpload( {\n\t\t\tallowedTypes: [ 'image' ],\n\t\t\tfilesList,\n\t\t\tonFileChange( [ image ] ) {\n\t\t\t\tif ( isBlobURL( image?.url ) ) {\n\t\t\t\t\tsetIsLoading( true );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tonUpdateImage( image );\n\t\t\t\tsetIsLoading( false );\n\t\t\t},\n\t\t\tonError( message ) {\n\t\t\t\tnoticeOperations.removeAllNotices();\n\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn (\n\t\t<PostFeaturedImageCheck>\n\t\t\t{ noticeUI }\n\t\t\t<div className=\"editor-post-featured-image\">\n\t\t\t\t{ media && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tid={ `editor-post-featured-image-${ featuredImageId }-describedby` }\n\t\t\t\t\t\tclassName=\"hidden\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ media.alt_text &&\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// Translators: %s: The selected image alt text.\n\t\t\t\t\t\t\t\t__( 'Current image: %s' ),\n\t\t\t\t\t\t\t\tmedia.alt_text\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! media.alt_text &&\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// Translators: %s: The selected image filename.\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'The current image has no alternative text. The file name is: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tmedia.media_details.sizes?.full?.file ||\n\t\t\t\t\t\t\t\t\tmedia.slug\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<MediaUploadCheck fallback={ instructions }>\n\t\t\t\t\t<MediaUpload\n\t\t\t\t\t\ttitle={\n\t\t\t\t\t\t\tpostType?.labels?.featured_image ||\n\t\t\t\t\t\t\tDEFAULT_FEATURE_IMAGE_LABEL\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonSelect={ onUpdateImage }\n\t\t\t\t\t\tunstableFeaturedImageFlow\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\tmodalClass=\"editor-post-featured-image__media-modal\"\n\t\t\t\t\t\trender={ ( { open } ) => (\n\t\t\t\t\t\t\t<div className=\"editor-post-featured-image__container\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tref={ toggleRef }\n\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? 'editor-post-featured-image__toggle'\n\t\t\t\t\t\t\t\t\t\t\t: 'editor-post-featured-image__preview'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? null\n\t\t\t\t\t\t\t\t\t\t\t: __( 'Edit or replace the image' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? null\n\t\t\t\t\t\t\t\t\t\t\t: `editor-post-featured-image-${ featuredImageId }-describedby`\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ !! featuredImageId && media && (\n\t\t\t\t\t\t\t\t\t\t<ResponsiveWrapper\n\t\t\t\t\t\t\t\t\t\t\tnaturalWidth={ mediaWidth }\n\t\t\t\t\t\t\t\t\t\t\tnaturalHeight={ mediaHeight }\n\t\t\t\t\t\t\t\t\t\t\tisInline\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\t\t\tsrc={ mediaSourceUrl }\n\t\t\t\t\t\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</ResponsiveWrapper>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ isLoading && <Spinner /> }\n\t\t\t\t\t\t\t\t\t{ ! featuredImageId &&\n\t\t\t\t\t\t\t\t\t\t! isLoading &&\n\t\t\t\t\t\t\t\t\t\t( postType?.labels\n\t\t\t\t\t\t\t\t\t\t\t?.set_featured_image ||\n\t\t\t\t\t\t\t\t\t\t\tDEFAULT_SET_FEATURE_IMAGE_LABEL ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t{ !! featuredImageId && (\n\t\t\t\t\t\t\t\t\t<HStack className=\"editor-post-featured-image__actions\">\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-post-featured-image__action\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t\t\t\t\t\t\t// Prefer that screen readers use the .editor-post-featured-image__preview button.\n\t\t\t\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Replace' ) }\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-post-featured-image__action\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tonRemoveImage();\n\t\t\t\t\t\t\t\t\t\t\t\ttoggleRef.current.focus();\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Remove' ) }\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<DropZone onFilesDrop={ onDropFiles } />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tvalue={ featuredImageId }\n\t\t\t\t\t/>\n\t\t\t\t</MediaUploadCheck>\n\t\t\t</div>\n\t\t</PostFeaturedImageCheck>\n\t);\n}\n\nconst applyWithSelect = withSelect( ( select ) => {\n\tconst { getMedia, getPostType } = select( coreStore );\n\tconst { getCurrentPostId, getEditedPostAttribute } = select( editorStore );\n\tconst featuredImageId = getEditedPostAttribute( 'featured_media' );\n\n\treturn {\n\t\tmedia: featuredImageId\n\t\t\t? getMedia( featuredImageId, { context: 'view' } )\n\t\t\t: null,\n\t\tcurrentPostId: getCurrentPostId(),\n\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t\tfeaturedImageId,\n\t};\n} );\n\nconst applyWithDispatch = withDispatch(\n\t( dispatch, { noticeOperations }, { select } ) => {\n\t\tconst { editPost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonUpdateImage( image ) {\n\t\t\t\teditPost( { featured_media: image.id } );\n\t\t\t},\n\t\t\tonDropImage( filesList ) {\n\t\t\t\tselect( blockEditorStore )\n\t\t\t\t\t.getSettings()\n\t\t\t\t\t.mediaUpload( {\n\t\t\t\t\t\tallowedTypes: [ 'image' ],\n\t\t\t\t\t\tfilesList,\n\t\t\t\t\t\tonFileChange( [ image ] ) {\n\t\t\t\t\t\t\teditPost( { featured_media: image.id } );\n\t\t\t\t\t\t},\n\t\t\t\t\t\tonError( message ) {\n\t\t\t\t\t\t\tnoticeOperations.removeAllNotices();\n\t\t\t\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t},\n\t\t\tonRemoveImage() {\n\t\t\t\teditPost( { featured_media: 0 } );\n\t\t\t},\n\t\t};\n\t}\n);\n\nexport default compose(\n\twithNotices,\n\tapplyWithSelect,\n\tapplyWithDispatch,\n\twithFilters( 'editor.PostFeaturedImage' )\n)( PostFeaturedImage );\n"]}
1
+ {"version":3,"names":["_element","require","_i18n","_hooks","_components","_blob","_compose","_data","_blockEditor","_coreData","_check","_interopRequireDefault","_store","ALLOWED_MEDIA_TYPES","DEFAULT_FEATURE_IMAGE_LABEL","__","DEFAULT_SET_FEATURE_IMAGE_LABEL","instructions","createElement","getMediaDetails","media","postId","_media$media_details$","_media$media_details$2","defaultSize","applyFilters","id","media_details","sizes","mediaWidth","width","mediaHeight","height","mediaSourceUrl","source_url","fallbackSize","PostFeaturedImage","currentPostId","featuredImageId","onUpdateImage","onRemoveImage","postType","noticeUI","noticeOperations","toggleRef","useRef","isLoading","setIsLoading","useState","mediaUpload","useSelect","select","blockEditorStore","getSettings","onDropFiles","filesList","allowedTypes","onFileChange","image","isBlobURL","url","onError","message","removeAllNotices","createErrorNotice","default","className","alt_text","sprintf","full","file","slug","MediaUploadCheck","fallback","MediaUpload","title","labels","featured_image","onSelect","unstableFeaturedImageFlow","modalClass","render","open","Button","ref","onClick","ResponsiveWrapper","naturalWidth","naturalHeight","isInline","src","alt","Spinner","set_featured_image","__experimentalHStack","current","focus","DropZone","onFilesDrop","value","applyWithSelect","withSelect","getMedia","getPostType","coreStore","getCurrentPostId","getEditedPostAttribute","editorStore","context","applyWithDispatch","withDispatch","dispatch","editPost","featured_media","onDropImage","_default","compose","withNotices","withFilters","exports"],"sources":["@wordpress/editor/src/components/post-featured-image/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { applyFilters } from '@wordpress/hooks';\nimport {\n\tDropZone,\n\tButton,\n\tSpinner,\n\tResponsiveWrapper,\n\twithNotices,\n\twithFilters,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { isBlobURL } from '@wordpress/blob';\nimport { useState, useRef } from '@wordpress/element';\nimport { compose } from '@wordpress/compose';\nimport { useSelect, withDispatch, withSelect } from '@wordpress/data';\nimport {\n\tMediaUpload,\n\tMediaUploadCheck,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostFeaturedImageCheck from './check';\nimport { store as editorStore } from '../../store';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\n\n// Used when labels from post type were not yet loaded or when they are not present.\nconst DEFAULT_FEATURE_IMAGE_LABEL = __( 'Featured image' );\nconst DEFAULT_SET_FEATURE_IMAGE_LABEL = __( 'Set featured image' );\n\nconst instructions = (\n\t<p>\n\t\t{ __(\n\t\t\t'To edit the featured image, you need permission to upload media.'\n\t\t) }\n\t</p>\n);\n\nfunction getMediaDetails( media, postId ) {\n\tif ( ! media ) {\n\t\treturn {};\n\t}\n\n\tconst defaultSize = applyFilters(\n\t\t'editor.PostFeaturedImage.imageSize',\n\t\t'large',\n\t\tmedia.id,\n\t\tpostId\n\t);\n\tif ( defaultSize in ( media?.media_details?.sizes ?? {} ) ) {\n\t\treturn {\n\t\t\tmediaWidth: media.media_details.sizes[ defaultSize ].width,\n\t\t\tmediaHeight: media.media_details.sizes[ defaultSize ].height,\n\t\t\tmediaSourceUrl: media.media_details.sizes[ defaultSize ].source_url,\n\t\t};\n\t}\n\n\t// Use fallbackSize when defaultSize is not available.\n\tconst fallbackSize = applyFilters(\n\t\t'editor.PostFeaturedImage.imageSize',\n\t\t'thumbnail',\n\t\tmedia.id,\n\t\tpostId\n\t);\n\tif ( fallbackSize in ( media?.media_details?.sizes ?? {} ) ) {\n\t\treturn {\n\t\t\tmediaWidth: media.media_details.sizes[ fallbackSize ].width,\n\t\t\tmediaHeight: media.media_details.sizes[ fallbackSize ].height,\n\t\t\tmediaSourceUrl:\n\t\t\t\tmedia.media_details.sizes[ fallbackSize ].source_url,\n\t\t};\n\t}\n\n\t// Use full image size when fallbackSize and defaultSize are not available.\n\treturn {\n\t\tmediaWidth: media.media_details.width,\n\t\tmediaHeight: media.media_details.height,\n\t\tmediaSourceUrl: media.source_url,\n\t};\n}\n\nfunction PostFeaturedImage( {\n\tcurrentPostId,\n\tfeaturedImageId,\n\tonUpdateImage,\n\tonRemoveImage,\n\tmedia,\n\tpostType,\n\tnoticeUI,\n\tnoticeOperations,\n} ) {\n\tconst toggleRef = useRef();\n\tconst [ isLoading, setIsLoading ] = useState( false );\n\tconst mediaUpload = useSelect( ( select ) => {\n\t\treturn select( blockEditorStore ).getSettings().mediaUpload;\n\t}, [] );\n\tconst { mediaWidth, mediaHeight, mediaSourceUrl } = getMediaDetails(\n\t\tmedia,\n\t\tcurrentPostId\n\t);\n\n\tfunction onDropFiles( filesList ) {\n\t\tmediaUpload( {\n\t\t\tallowedTypes: [ 'image' ],\n\t\t\tfilesList,\n\t\t\tonFileChange( [ image ] ) {\n\t\t\t\tif ( isBlobURL( image?.url ) ) {\n\t\t\t\t\tsetIsLoading( true );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tonUpdateImage( image );\n\t\t\t\tsetIsLoading( false );\n\t\t\t},\n\t\t\tonError( message ) {\n\t\t\t\tnoticeOperations.removeAllNotices();\n\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn (\n\t\t<PostFeaturedImageCheck>\n\t\t\t{ noticeUI }\n\t\t\t<div className=\"editor-post-featured-image\">\n\t\t\t\t{ media && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tid={ `editor-post-featured-image-${ featuredImageId }-describedby` }\n\t\t\t\t\t\tclassName=\"hidden\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ media.alt_text &&\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// Translators: %s: The selected image alt text.\n\t\t\t\t\t\t\t\t__( 'Current image: %s' ),\n\t\t\t\t\t\t\t\tmedia.alt_text\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! media.alt_text &&\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// Translators: %s: The selected image filename.\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'The current image has no alternative text. The file name is: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tmedia.media_details.sizes?.full?.file ||\n\t\t\t\t\t\t\t\t\tmedia.slug\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<MediaUploadCheck fallback={ instructions }>\n\t\t\t\t\t<MediaUpload\n\t\t\t\t\t\ttitle={\n\t\t\t\t\t\t\tpostType?.labels?.featured_image ||\n\t\t\t\t\t\t\tDEFAULT_FEATURE_IMAGE_LABEL\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonSelect={ onUpdateImage }\n\t\t\t\t\t\tunstableFeaturedImageFlow\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\tmodalClass=\"editor-post-featured-image__media-modal\"\n\t\t\t\t\t\trender={ ( { open } ) => (\n\t\t\t\t\t\t\t<div className=\"editor-post-featured-image__container\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tref={ toggleRef }\n\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? 'editor-post-featured-image__toggle'\n\t\t\t\t\t\t\t\t\t\t\t: 'editor-post-featured-image__preview'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? null\n\t\t\t\t\t\t\t\t\t\t\t: __( 'Edit or replace the image' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? null\n\t\t\t\t\t\t\t\t\t\t\t: `editor-post-featured-image-${ featuredImageId }-describedby`\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ !! featuredImageId && media && (\n\t\t\t\t\t\t\t\t\t\t<ResponsiveWrapper\n\t\t\t\t\t\t\t\t\t\t\tnaturalWidth={ mediaWidth }\n\t\t\t\t\t\t\t\t\t\t\tnaturalHeight={ mediaHeight }\n\t\t\t\t\t\t\t\t\t\t\tisInline\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\t\t\tsrc={ mediaSourceUrl }\n\t\t\t\t\t\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</ResponsiveWrapper>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ isLoading && <Spinner /> }\n\t\t\t\t\t\t\t\t\t{ ! featuredImageId &&\n\t\t\t\t\t\t\t\t\t\t! isLoading &&\n\t\t\t\t\t\t\t\t\t\t( postType?.labels\n\t\t\t\t\t\t\t\t\t\t\t?.set_featured_image ||\n\t\t\t\t\t\t\t\t\t\t\tDEFAULT_SET_FEATURE_IMAGE_LABEL ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t{ !! featuredImageId && (\n\t\t\t\t\t\t\t\t\t<HStack className=\"editor-post-featured-image__actions\">\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-post-featured-image__action\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t\t\t\t\t\t\t// Prefer that screen readers use the .editor-post-featured-image__preview button.\n\t\t\t\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Replace' ) }\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-post-featured-image__action\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tonRemoveImage();\n\t\t\t\t\t\t\t\t\t\t\t\ttoggleRef.current.focus();\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Remove' ) }\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<DropZone onFilesDrop={ onDropFiles } />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tvalue={ featuredImageId }\n\t\t\t\t\t/>\n\t\t\t\t</MediaUploadCheck>\n\t\t\t</div>\n\t\t</PostFeaturedImageCheck>\n\t);\n}\n\nconst applyWithSelect = withSelect( ( select ) => {\n\tconst { getMedia, getPostType } = select( coreStore );\n\tconst { getCurrentPostId, getEditedPostAttribute } = select( editorStore );\n\tconst featuredImageId = getEditedPostAttribute( 'featured_media' );\n\n\treturn {\n\t\tmedia: featuredImageId\n\t\t\t? getMedia( featuredImageId, { context: 'view' } )\n\t\t\t: null,\n\t\tcurrentPostId: getCurrentPostId(),\n\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t\tfeaturedImageId,\n\t};\n} );\n\nconst applyWithDispatch = withDispatch(\n\t( dispatch, { noticeOperations }, { select } ) => {\n\t\tconst { editPost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonUpdateImage( image ) {\n\t\t\t\teditPost( { featured_media: image.id } );\n\t\t\t},\n\t\t\tonDropImage( filesList ) {\n\t\t\t\tselect( blockEditorStore )\n\t\t\t\t\t.getSettings()\n\t\t\t\t\t.mediaUpload( {\n\t\t\t\t\t\tallowedTypes: [ 'image' ],\n\t\t\t\t\t\tfilesList,\n\t\t\t\t\t\tonFileChange( [ image ] ) {\n\t\t\t\t\t\t\teditPost( { featured_media: image.id } );\n\t\t\t\t\t\t},\n\t\t\t\t\t\tonError( message ) {\n\t\t\t\t\t\t\tnoticeOperations.removeAllNotices();\n\t\t\t\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t},\n\t\t\tonRemoveImage() {\n\t\t\t\teditPost( { featured_media: 0 } );\n\t\t\t},\n\t\t};\n\t}\n);\n\nexport default compose(\n\twithNotices,\n\tapplyWithSelect,\n\tapplyWithDispatch,\n\twithFilters( 'editor.PostFeaturedImage' )\n)( PostFeaturedImage );\n"],"mappings":";;;;;;;AAeA,IAAAA,QAAA,GAAAC,OAAA;AAZA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AASA,IAAAI,KAAA,GAAAJ,OAAA;AAEA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AAKA,IAAAQ,SAAA,GAAAR,OAAA;AAKA,IAAAS,MAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AA7BA;AACA;AACA;;AAuBA;AACA;AACA;;AAIA,MAAMY,mBAAmB,GAAG,CAAE,OAAO,CAAE;;AAEvC;AACA,MAAMC,2BAA2B,GAAG,IAAAC,QAAE,EAAE,gBAAiB,CAAC;AAC1D,MAAMC,+BAA+B,GAAG,IAAAD,QAAE,EAAE,oBAAqB,CAAC;AAElE,MAAME,YAAY,GACjB,IAAAjB,QAAA,CAAAkB,aAAA,aACG,IAAAH,QAAE,EACH,kEACD,CACE,CACH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ACoB,gBAAgB,CAAC,CAAC;UACnCpB,gBAAgB,CAACqB,iBAAiB,CAAEF,OAAQ,CAAC;QAC9C;MACD,CAAE,CAAC;IACL,CAAC;IACDtB,aAAaA,CAAA,EAAG;MACfwE,QAAQ,CAAE;QAAEC,cAAc,EAAE;MAAE,CAAE,CAAC;IAClC;EACD,CAAC;AACF,CACD,CAAC;AAAC,IAAAE,QAAA,GAEa,IAAAC,gBAAO,EACrBC,uBAAW,EACXjB,eAAe,EACfS,iBAAiB,EACjB,IAAAS,uBAAW,EAAE,0BAA2B,CACzC,CAAC,CAAElF,iBAAkB,CAAC;AAAAmF,OAAA,CAAAtD,OAAA,GAAAkD,QAAA"}
@@ -1,20 +1,14 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _element = require("@wordpress/element");
11
-
12
9
  var _data = require("@wordpress/data");
13
-
14
10
  var _postTypeSupportCheck = _interopRequireDefault(require("../post-type-support-check"));
15
-
16
11
  var _store = require("../../store");
17
-
18
12
  /**
19
13
  * WordPress dependencies
20
14
  */
@@ -22,21 +16,18 @@ var _store = require("../../store");
22
16
  /**
23
17
  * Internal dependencies
24
18
  */
19
+
25
20
  function PostFormatCheck({
26
- disablePostFormats,
27
- ...props
21
+ children
28
22
  }) {
29
- return !disablePostFormats && (0, _element.createElement)(_postTypeSupportCheck.default, { ...props,
23
+ const disablePostFormats = (0, _data.useSelect)(select => select(_store.store).getEditorSettings().disablePostFormats, []);
24
+ if (disablePostFormats) {
25
+ return null;
26
+ }
27
+ return (0, _element.createElement)(_postTypeSupportCheck.default, {
30
28
  supportKeys: "post-formats"
31
- });
29
+ }, children);
32
30
  }
33
-
34
- var _default = (0, _data.withSelect)(select => {
35
- const editorSettings = select(_store.store).getEditorSettings();
36
- return {
37
- disablePostFormats: editorSettings.disablePostFormats
38
- };
39
- })(PostFormatCheck);
40
-
31
+ var _default = PostFormatCheck;
41
32
  exports.default = _default;
42
33
  //# sourceMappingURL=check.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-format/check.js"],"names":["PostFormatCheck","disablePostFormats","props","select","editorSettings","editorStore","getEditorSettings"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIA,SAASA,eAAT,CAA0B;AAAEC,EAAAA,kBAAF;AAAsB,KAAGC;AAAzB,CAA1B,EAA6D;AAC5D,SACC,CAAED,kBAAF,IACC,4BAAC,6BAAD,OAA2BC,KAA3B;AAAmC,IAAA,WAAW,EAAC;AAA/C,IAFF;AAKA;;eAEc,sBAAcC,MAAF,IAAc;AACxC,QAAMC,cAAc,GAAGD,MAAM,CAAEE,YAAF,CAAN,CAAsBC,iBAAtB,EAAvB;AACA,SAAO;AACNL,IAAAA,kBAAkB,EAAEG,cAAc,CAACH;AAD7B,GAAP;AAGA,CALc,EAKVD,eALU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { withSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\n\nfunction PostFormatCheck( { disablePostFormats, ...props } ) {\n\treturn (\n\t\t! disablePostFormats && (\n\t\t\t<PostTypeSupportCheck { ...props } supportKeys=\"post-formats\" />\n\t\t)\n\t);\n}\n\nexport default withSelect( ( select ) => {\n\tconst editorSettings = select( editorStore ).getEditorSettings();\n\treturn {\n\t\tdisablePostFormats: editorSettings.disablePostFormats,\n\t};\n} )( PostFormatCheck );\n"]}
1
+ {"version":3,"names":["_data","require","_postTypeSupportCheck","_interopRequireDefault","_store","PostFormatCheck","children","disablePostFormats","useSelect","select","editorStore","getEditorSettings","_element","createElement","default","supportKeys","_default","exports"],"sources":["@wordpress/editor/src/components/post-format/check.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\n\nfunction PostFormatCheck( { children } ) {\n\tconst disablePostFormats = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getEditorSettings().disablePostFormats,\n\t\t[]\n\t);\n\n\tif ( disablePostFormats ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"post-formats\">\n\t\t\t{ children }\n\t\t</PostTypeSupportCheck>\n\t);\n}\n\nexport default PostFormatCheck;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,qBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AATA;AACA;AACA;;AAGA;AACA;AACA;;AAIA,SAASI,eAAeA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACxC,MAAMC,kBAAkB,GAAG,IAAAC,eAAS,EACjCC,MAAM,IACPA,MAAM,CAAEC,YAAY,CAAC,CAACC,iBAAiB,CAAC,CAAC,CAACJ,kBAAkB,EAC7D,EACD,CAAC;EAED,IAAKA,kBAAkB,EAAG;IACzB,OAAO,IAAI;EACZ;EAEA,OACC,IAAAK,QAAA,CAAAC,aAAA,EAACX,qBAAA,CAAAY,OAAoB;IAACC,WAAW,EAAC;EAAc,GAC7CT,QACmB,CAAC;AAEzB;AAAC,IAAAU,QAAA,GAEcX,eAAe;AAAAY,OAAA,CAAAH,OAAA,GAAAE,QAAA"}
@@ -1,29 +1,19 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.POST_FORMATS = void 0;
9
8
  exports.default = PostFormat;
10
-
11
9
  var _element = require("@wordpress/element");
12
-
13
10
  var _i18n = require("@wordpress/i18n");
14
-
15
11
  var _components = require("@wordpress/components");
16
-
17
12
  var _data = require("@wordpress/data");
18
-
19
13
  var _compose = require("@wordpress/compose");
20
-
21
14
  var _coreData = require("@wordpress/core-data");
22
-
23
15
  var _check = _interopRequireDefault(require("./check"));
24
-
25
16
  var _store = require("../../store");
26
-
27
17
  /**
28
18
  * WordPress dependencies
29
19
  */
@@ -31,6 +21,7 @@ var _store = require("../../store");
31
21
  /**
32
22
  * Internal dependencies
33
23
  */
24
+
34
25
  // All WP post formats, sorted alphabetically by translated name.
35
26
  const POST_FORMATS = [{
36
27
  id: 'aside',
@@ -65,19 +56,15 @@ const POST_FORMATS = [{
65
56
  }].sort((a, b) => {
66
57
  const normalizedA = a.caption.toUpperCase();
67
58
  const normalizedB = b.caption.toUpperCase();
68
-
69
59
  if (normalizedA < normalizedB) {
70
60
  return -1;
71
61
  }
72
-
73
62
  if (normalizedA > normalizedB) {
74
63
  return 1;
75
64
  }
76
-
77
65
  return 0;
78
66
  });
79
67
  exports.POST_FORMATS = POST_FORMATS;
80
-
81
68
  function PostFormat() {
82
69
  const instanceId = (0, _compose.useInstanceId)(PostFormat);
83
70
  const postFormatSelectorId = `post-format-selector-${instanceId}`;
@@ -90,9 +77,7 @@ function PostFormat() {
90
77
  getEditedPostAttribute,
91
78
  getSuggestedPostFormat
92
79
  } = select(_store.store);
93
-
94
80
  const _postFormat = getEditedPostAttribute('format');
95
-
96
81
  const themeSupports = select(_coreData.store).getThemeSupports();
97
82
  return {
98
83
  postFormat: _postFormat !== null && _postFormat !== void 0 ? _postFormat : 'standard',
@@ -109,11 +94,9 @@ function PostFormat() {
109
94
  const {
110
95
  editPost
111
96
  } = (0, _data.useDispatch)(_store.store);
112
-
113
97
  const onUpdatePostFormat = format => editPost({
114
98
  format
115
99
  });
116
-
117
100
  return (0, _element.createElement)(_check.default, null, (0, _element.createElement)("div", {
118
101
  className: "editor-post-format"
119
102
  }, (0, _element.createElement)(_components.SelectControl, {
@@ -131,8 +114,7 @@ function PostFormat() {
131
114
  }, (0, _element.createElement)(_components.Button, {
132
115
  variant: "link",
133
116
  onClick: () => onUpdatePostFormat(suggestion.id)
134
- }, (0, _i18n.sprintf)(
135
- /* translators: %s: post format */
117
+ }, (0, _i18n.sprintf)( /* translators: %s: post format */
136
118
  (0, _i18n.__)('Apply suggested format: %s'), suggestion.caption)))));
137
119
  }
138
120
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-format/index.js"],"names":["POST_FORMATS","id","caption","sort","a","b","normalizedA","toUpperCase","normalizedB","PostFormat","instanceId","postFormatSelectorId","postFormat","suggestedFormat","supportedFormats","select","getEditedPostAttribute","getSuggestedPostFormat","editorStore","_postFormat","themeSupports","coreStore","getThemeSupports","formats","filter","format","includes","suggestion","find","editPost","onUpdatePostFormat","map","label","value"],"mappings":";;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAbA;AACA;AACA;;AAOA;AACA;AACA;AAIA;AACO,MAAMA,YAAY,GAAG,CAC3B;AAAEC,EAAAA,EAAE,EAAE,OAAN;AAAeC,EAAAA,OAAO,EAAE,cAAI,OAAJ;AAAxB,CAD2B,EAE3B;AAAED,EAAAA,EAAE,EAAE,OAAN;AAAeC,EAAAA,OAAO,EAAE,cAAI,OAAJ;AAAxB,CAF2B,EAG3B;AAAED,EAAAA,EAAE,EAAE,MAAN;AAAcC,EAAAA,OAAO,EAAE,cAAI,MAAJ;AAAvB,CAH2B,EAI3B;AAAED,EAAAA,EAAE,EAAE,SAAN;AAAiBC,EAAAA,OAAO,EAAE,cAAI,SAAJ;AAA1B,CAJ2B,EAK3B;AAAED,EAAAA,EAAE,EAAE,OAAN;AAAeC,EAAAA,OAAO,EAAE,cAAI,OAAJ;AAAxB,CAL2B,EAM3B;AAAED,EAAAA,EAAE,EAAE,MAAN;AAAcC,EAAAA,OAAO,EAAE,cAAI,MAAJ;AAAvB,CAN2B,EAO3B;AAAED,E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,kBAAkB,CAAEH,UAAU,CAAC1B,EAAb;AAHpB,KAMG;AACD;AACA,gBAAI,4BAAJ,CAFC,EAGD0B,UAAU,CAACzB,OAHV,CANH,CADD,CAbF,CADD,CADD;AAiCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button, SelectControl } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostFormatCheck from './check';\nimport { store as editorStore } from '../../store';\n\n// All WP post formats, sorted alphabetically by translated name.\nexport const POST_FORMATS = [\n\t{ id: 'aside', caption: __( 'Aside' ) },\n\t{ id: 'audio', caption: __( 'Audio' ) },\n\t{ id: 'chat', caption: __( 'Chat' ) },\n\t{ id: 'gallery', caption: __( 'Gallery' ) },\n\t{ id: 'image', caption: __( 'Image' ) },\n\t{ id: 'link', caption: __( 'Link' ) },\n\t{ id: 'quote', caption: __( 'Quote' ) },\n\t{ id: 'standard', caption: __( 'Standard' ) },\n\t{ id: 'status', caption: __( 'Status' ) },\n\t{ id: 'video', caption: __( 'Video' ) },\n].sort( ( a, b ) => {\n\tconst normalizedA = a.caption.toUpperCase();\n\tconst normalizedB = b.caption.toUpperCase();\n\n\tif ( normalizedA < normalizedB ) {\n\t\treturn -1;\n\t}\n\tif ( normalizedA > normalizedB ) {\n\t\treturn 1;\n\t}\n\treturn 0;\n} );\n\nexport default function PostFormat() {\n\tconst instanceId = useInstanceId( PostFormat );\n\tconst postFormatSelectorId = `post-format-selector-${ instanceId }`;\n\n\tconst { postFormat, suggestedFormat, supportedFormats } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostAttribute, getSuggestedPostFormat } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst _postFormat = getEditedPostAttribute( 'format' );\n\t\t\tconst themeSupports = select( coreStore ).getThemeSupports();\n\t\t\treturn {\n\t\t\t\tpostFormat: _postFormat ?? 'standard',\n\t\t\t\tsuggestedFormat: getSuggestedPostFormat(),\n\t\t\t\tsupportedFormats: themeSupports.formats,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst formats = POST_FORMATS.filter( ( format ) => {\n\t\t// Ensure current format is always in the set.\n\t\t// The current format may not be a format supported by the theme.\n\t\treturn (\n\t\t\tsupportedFormats?.includes( format.id ) || postFormat === format.id\n\t\t);\n\t} );\n\tconst suggestion = formats.find(\n\t\t( format ) => format.id === suggestedFormat\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tconst onUpdatePostFormat = ( format ) => editPost( { format } );\n\n\treturn (\n\t\t<PostFormatCheck>\n\t\t\t<div className=\"editor-post-format\">\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Post Format' ) }\n\t\t\t\t\tvalue={ postFormat }\n\t\t\t\t\tonChange={ ( format ) => onUpdatePostFormat( format ) }\n\t\t\t\t\tid={ postFormatSelectorId }\n\t\t\t\t\toptions={ formats.map( ( format ) => ( {\n\t\t\t\t\t\tlabel: format.caption,\n\t\t\t\t\t\tvalue: format.id,\n\t\t\t\t\t} ) ) }\n\t\t\t\t/>\n\t\t\t\t{ suggestion && suggestion.id !== postFormat && (\n\t\t\t\t\t<p className=\"editor-post-format__suggestion\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\tonUpdatePostFormat( suggestion.id )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: post format */\n\t\t\t\t\t\t\t\t__( 'Apply suggested format: %s' ),\n\t\t\t\t\t\t\t\tsuggestion.caption\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</PostFormatCheck>\n\t);\n}\n"]}
1
+ {"version":3,"names":["_i18n","require","_components","_data","_compose","_coreData","_check","_interopRequireDefault","_store","POST_FORMATS","id","caption","__","sort","a","b","normalizedA","toUpperCase","normalizedB","exports","PostFormat","instanceId","useInstanceId","postFormatSelectorId","postFormat","suggestedFormat","supportedFormats","useSelect","select","getEditedPostAttribute","getSuggestedPostFormat","editorStore","_postFormat","themeSupports","coreStore","getThemeSupports","formats","filter","format","includes","suggestion","find","editPost","useDispatch","onUpdatePostFormat","_element","createElement","default","className","SelectControl","__nextHasNoMarginBottom","label","value","onChange","options","map","Button","variant","onClick","sprintf"],"sources":["@wordpress/editor/src/components/post-format/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button, SelectControl } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostFormatCheck from './check';\nimport { store as editorStore } from '../../store';\n\n// All WP post formats, sorted alphabetically by translated name.\nexport const POST_FORMATS = [\n\t{ id: 'aside', caption: __( 'Aside' ) },\n\t{ id: 'audio', caption: __( 'Audio' ) },\n\t{ id: 'chat', caption: __( 'Chat' ) },\n\t{ id: 'gallery', caption: __( 'Gallery' ) },\n\t{ id: 'image', caption: __( 'Image' ) },\n\t{ id: 'link', caption: __( 'Link' ) },\n\t{ id: 'quote', caption: __( 'Quote' ) },\n\t{ id: 'standard', caption: __( 'Standard' ) },\n\t{ id: 'status', caption: __( 'Status' ) },\n\t{ id: 'video', caption: __( 'Video' ) },\n].sort( ( a, b ) => {\n\tconst normalizedA = a.caption.toUpperCase();\n\tconst normalizedB = b.caption.toUpperCase();\n\n\tif ( normalizedA < normalizedB ) {\n\t\treturn -1;\n\t}\n\tif ( normalizedA > normalizedB ) {\n\t\treturn 1;\n\t}\n\treturn 0;\n} );\n\nexport default function PostFormat() {\n\tconst instanceId = useInstanceId( PostFormat );\n\tconst postFormatSelectorId = `post-format-selector-${ instanceId }`;\n\n\tconst { postFormat, suggestedFormat, supportedFormats } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostAttribute, getSuggestedPostFormat } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst _postFormat = getEditedPostAttribute( 'format' );\n\t\t\tconst themeSupports = select( coreStore ).getThemeSupports();\n\t\t\treturn {\n\t\t\t\tpostFormat: _postFormat ?? 'standard',\n\t\t\t\tsuggestedFormat: getSuggestedPostFormat(),\n\t\t\t\tsupportedFormats: themeSupports.formats,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst formats = POST_FORMATS.filter( ( format ) => {\n\t\t// Ensure current format is always in the set.\n\t\t// The current format may not be a format supported by the theme.\n\t\treturn (\n\t\t\tsupportedFormats?.includes( format.id ) || postFormat === format.id\n\t\t);\n\t} );\n\tconst suggestion = formats.find(\n\t\t( format ) => format.id === suggestedFormat\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tconst onUpdatePostFormat = ( format ) => editPost( { format } );\n\n\treturn (\n\t\t<PostFormatCheck>\n\t\t\t<div className=\"editor-post-format\">\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Post Format' ) }\n\t\t\t\t\tvalue={ postFormat }\n\t\t\t\t\tonChange={ ( format ) => onUpdatePostFormat( format ) }\n\t\t\t\t\tid={ postFormatSelectorId }\n\t\t\t\t\toptions={ formats.map( ( format ) => ( {\n\t\t\t\t\t\tlabel: format.caption,\n\t\t\t\t\t\tvalue: format.id,\n\t\t\t\t\t} ) ) }\n\t\t\t\t/>\n\t\t\t\t{ suggestion && suggestion.id !== postFormat && (\n\t\t\t\t\t<p className=\"editor-post-format__suggestion\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\tonUpdatePostFormat( suggestion.id )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: post format */\n\t\t\t\t\t\t\t\t__( 'Apply suggested format: %s' ),\n\t\t\t\t\t\t\t\tsuggestion.caption\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</PostFormatCheck>\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAbA;AACA;AACA;;AAOA;AACA;AACA;;AAIA;AACO,MAAMQ,YAAY,GAAG,CAC3B;EAAEC,EAAE,EAAE,OAAO;EAAEC,OAAO,EAAE,IAAAC,QAAE,EAAE,OAAQ;AAAE,CAAC,EACvC;EAAEF,EAAE,EAAE,OAAO;EAAEC,OAAO,EAAE,IAAAC,QAAE,EAAE,OAAQ;AAAE,CAAC,EACvC;EAAEF,EAAE,EAAE,MAAM;EAAEC,OAAO,EAAE,IAAAC,QAAE,EAAE,MAAO;AAAE,CAAC,EACrC;EAAEF,EAAE,EAAE,SAAS;EAAEC,OAAO,EAAE,IAAAC,QAAE,EAAE,SAAU;AAAE,CAAC,EAC3C;EAAEF,EAAE,EAAE,OAAO;EAAEC,OAAO,EAAE,IAAAC,QAAE,EAAE,OAAQ;AAAE,CAAC,EACvC;EAAEF,EAAE,EAAE,MAAM;EAAEC,OAAO,EAAE,IAAAC,QAAE,EAAE,MAAO;AAAE,CAAC,EACrC;EAAEF,EAAE,EAAE,OAAO;EAAEC,O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AAGE,SAAS,EAAC;EAAgC,GAC5C,IAAAH,QAAA,CAAAC,aAAA,EAAC5C,WAAA,CAAAsD,MAAM;IACNC,OAAO,EAAC,MAAM;IACdC,OAAO,EAAGA,CAAA,KACTd,kBAAkB,CAAEJ,UAAU,CAAC9B,EAAG;EAClC,GAEC,IAAAiD,aAAO,GACR;EACA,IAAA/C,QAAE,EAAE,4BAA6B,CAAC,EAClC4B,UAAU,CAAC7B,OACZ,CACO,CACN,CAEA,CACW,CAAC;AAEpB"}
@@ -1,21 +1,14 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
- exports.PostLastRevisionCheck = PostLastRevisionCheck;
9
7
  exports.default = void 0;
10
-
11
8
  var _element = require("@wordpress/element");
12
-
13
9
  var _data = require("@wordpress/data");
14
-
15
10
  var _postTypeSupportCheck = _interopRequireDefault(require("../post-type-support-check"));
16
-
17
11
  var _store = require("../../store");
18
-
19
12
  /**
20
13
  * WordPress dependencies
21
14
  */
@@ -23,30 +16,30 @@ var _store = require("../../store");
23
16
  /**
24
17
  * Internal dependencies
25
18
  */
19
+
26
20
  function PostLastRevisionCheck({
27
- lastRevisionId,
28
- revisionsCount,
29
21
  children
30
22
  }) {
23
+ const {
24
+ lastRevisionId,
25
+ revisionsCount
26
+ } = (0, _data.useSelect)(select => {
27
+ const {
28
+ getCurrentPostLastRevisionId,
29
+ getCurrentPostRevisionsCount
30
+ } = select(_store.store);
31
+ return {
32
+ lastRevisionId: getCurrentPostLastRevisionId(),
33
+ revisionsCount: getCurrentPostRevisionsCount()
34
+ };
35
+ }, []);
31
36
  if (!lastRevisionId || revisionsCount < 2) {
32
37
  return null;
33
38
  }
34
-
35
39
  return (0, _element.createElement)(_postTypeSupportCheck.default, {
36
40
  supportKeys: "revisions"
37
41
  }, children);
38
42
  }
39
-
40
- var _default = (0, _data.withSelect)(select => {
41
- const {
42
- getCurrentPostLastRevisionId,
43
- getCurrentPostRevisionsCount
44
- } = select(_store.store);
45
- return {
46
- lastRevisionId: getCurrentPostLastRevisionId(),
47
- revisionsCount: getCurrentPostRevisionsCount()
48
- };
49
- })(PostLastRevisionCheck);
50
-
43
+ var _default = PostLastRevisionCheck;
51
44
  exports.default = _default;
52
45
  //# sourceMappingURL=check.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-last-revision/check.js"],"names":["PostLastRevisionCheck","lastRevisionId","revisionsCount","children","select","getCurrentPostLastRevisionId","getCurrentPostRevisionsCount","editorStore"],"mappings":";;;;;;;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIO,SAASA,qBAAT,CAAgC;AACtCC,EAAAA,cADsC;AAEtCC,EAAAA,cAFsC;AAGtCC,EAAAA;AAHsC,CAAhC,EAIH;AACH,MAAK,CAAEF,cAAF,IAAoBC,cAAc,GAAG,CAA1C,EAA8C;AAC7C,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,6BAAD;AAAsB,IAAA,WAAW,EAAC;AAAlC,KACGC,QADH,CADD;AAKA;;eAEc,sBAAcC,MAAF,IAAc;AACxC,QAAM;AAAEC,IAAAA,4BAAF;AAAgCC,IAAAA;AAAhC,MACLF,MAAM,CAAEG,YAAF,CADP;AAEA,SAAO;AACNN,IAAAA,cAAc,EAAEI,4BAA4B,EADtC;AAENH,IAAAA,cAAc,EAAEI,4BAA4B;AAFtC,GAAP;AAIA,CAPc,EAOVN,qBAPU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { withSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\n\nexport function PostLastRevisionCheck( {\n\tlastRevisionId,\n\trevisionsCount,\n\tchildren,\n} ) {\n\tif ( ! lastRevisionId || revisionsCount < 2 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"revisions\">\n\t\t\t{ children }\n\t\t</PostTypeSupportCheck>\n\t);\n}\n\nexport default withSelect( ( select ) => {\n\tconst { getCurrentPostLastRevisionId, getCurrentPostRevisionsCount } =\n\t\tselect( editorStore );\n\treturn {\n\t\tlastRevisionId: getCurrentPostLastRevisionId(),\n\t\trevisionsCount: getCurrentPostRevisionsCount(),\n\t};\n} )( PostLastRevisionCheck );\n"]}
1
+ {"version":3,"names":["_data","require","_postTypeSupportCheck","_interopRequireDefault","_store","PostLastRevisionCheck","children","lastRevisionId","revisionsCount","useSelect","select","getCurrentPostLastRevisionId","getCurrentPostRevisionsCount","editorStore","_element","createElement","default","supportKeys","_default","exports"],"sources":["@wordpress/editor/src/components/post-last-revision/check.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\n\nfunction PostLastRevisionCheck( { children } ) {\n\tconst { lastRevisionId, revisionsCount } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostLastRevisionId, getCurrentPostRevisionsCount } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tlastRevisionId: getCurrentPostLastRevisionId(),\n\t\t\trevisionsCount: getCurrentPostRevisionsCount(),\n\t\t};\n\t}, [] );\n\n\tif ( ! lastRevisionId || revisionsCount < 2 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"revisions\">\n\t\t\t{ children }\n\t\t</PostTypeSupportCheck>\n\t);\n}\n\nexport default PostLastRevisionCheck;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,qBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AATA;AACA;AACA;;AAGA;AACA;AACA;;AAIA,SAASI,qBAAqBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EAC9C,MAAM;IAAEC,cAAc;IAAEC;EAAe,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACnE,MAAM;MAAEC,4BAA4B;MAAEC;IAA6B,CAAC,GACnEF,MAAM,CAAEG,YAAY,CAAC;IACtB,OAAO;MACNN,cAAc,EAAEI,4BAA4B,CAAC,CAAC;MAC9CH,cAAc,EAAEI,4BAA4B,CAAC;IAC9C,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAEL,cAAc,IAAIC,cAAc,GAAG,CAAC,EAAG;IAC7C,OAAO,IAAI;EACZ;EAEA,OACC,IAAAM,QAAA,CAAAC,aAAA,EAACb,qBAAA,CAAAc,OAAoB;IAACC,WAAW,EAAC;EAAW,GAC1CX,QACmB,CAAC;AAEzB;AAAC,IAAAY,QAAA,GAEcb,qBAAqB;AAAAc,OAAA,CAAAH,OAAA,GAAAE,QAAA"}
@@ -1,28 +1,18 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _element = require("@wordpress/element");
11
-
12
9
  var _i18n = require("@wordpress/i18n");
13
-
14
10
  var _components = require("@wordpress/components");
15
-
16
11
  var _data = require("@wordpress/data");
17
-
18
12
  var _icons = require("@wordpress/icons");
19
-
20
13
  var _url = require("@wordpress/url");
21
-
22
14
  var _check = _interopRequireDefault(require("./check"));
23
-
24
15
  var _store = require("../../store");
25
-
26
16
  /**
27
17
  * WordPress dependencies
28
18
  */
@@ -30,10 +20,21 @@ var _store = require("../../store");
30
20
  /**
31
21
  * Internal dependencies
32
22
  */
33
- function LastRevision({
34
- lastRevisionId,
35
- revisionsCount
36
- }) {
23
+
24
+ function LastRevision() {
25
+ const {
26
+ lastRevisionId,
27
+ revisionsCount
28
+ } = (0, _data.useSelect)(select => {
29
+ const {
30
+ getCurrentPostLastRevisionId,
31
+ getCurrentPostRevisionsCount
32
+ } = select(_store.store);
33
+ return {
34
+ lastRevisionId: getCurrentPostLastRevisionId(),
35
+ revisionsCount: getCurrentPostRevisionsCount()
36
+ };
37
+ }, []);
37
38
  return (0, _element.createElement)(_check.default, null, (0, _element.createElement)(_components.Button, {
38
39
  href: (0, _url.addQueryArgs)('revision.php', {
39
40
  revision: lastRevisionId,
@@ -41,21 +42,9 @@ function LastRevision({
41
42
  }),
42
43
  className: "editor-post-last-revision__title",
43
44
  icon: _icons.backup
44
- }, (0, _i18n.sprintf)(
45
- /* translators: %d: number of revisions */
45
+ }, (0, _i18n.sprintf)( /* translators: %d: number of revisions */
46
46
  (0, _i18n._n)('%d Revision', '%d Revisions', revisionsCount), revisionsCount)));
47
47
  }
48
-
49
- var _default = (0, _data.withSelect)(select => {
50
- const {
51
- getCurrentPostLastRevisionId,
52
- getCurrentPostRevisionsCount
53
- } = select(_store.store);
54
- return {
55
- lastRevisionId: getCurrentPostLastRevisionId(),
56
- revisionsCount: getCurrentPostRevisionsCount()
57
- };
58
- })(LastRevision);
59
-
48
+ var _default = LastRevision;
60
49
  exports.default = _default;
61
50
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-last-revision/index.js"],"names":["LastRevision","lastRevisionId","revisionsCount","revision","gutenberg","backup","select","getCurrentPostLastRevisionId","getCurrentPostRevisionsCount","editorStore"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAbA;AACA;AACA;;AAOA;AACA;AACA;AAIA,SAASA,YAAT,CAAuB;AAAEC,EAAAA,cAAF;AAAkBC,EAAAA;AAAlB,CAAvB,EAA4D;AAC3D,SACC,4BAAC,cAAD,QACC,4BAAC,kBAAD;AACC,IAAA,IAAI,EAAG,uBAAc,cAAd,EAA8B;AACpCC,MAAAA,QAAQ,EAAEF,cAD0B;AAEpCG,MAAAA,SAAS,EAAE;AAFyB,KAA9B,CADR;AAKC,IAAA,SAAS,EAAC,kCALX;AAMC,IAAA,IAAI,EAAGC;AANR,KAQG;AACD;AACA,gBAAI,aAAJ,EAAmB,cAAnB,EAAmCH,cAAnC,CAFC,EAGDA,cAHC,CARH,CADD,CADD;AAkBA;;eAEc,sBAAcI,MAAF,IAAc;AACxC,QAAM;AAAEC,IAAAA,4BAAF;AAAgCC,IAAAA;AAAhC,MACLF,MAAM,CAAEG,YAAF,CADP;AAEA,SAAO;AACNR,IAAAA,cAAc,EAAEM,4BAA4B,EADtC;AAENL,IAAAA,cAAc,EAAEM,4BAA4B;AAFtC,GAAP;AAIA,CAPc,EAOVR,YAPU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { sprintf, _n } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { withSelect } from '@wordpress/data';\nimport { backup } from '@wordpress/icons';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport PostLastRevisionCheck from './check';\nimport { store as editorStore } from '../../store';\n\nfunction LastRevision( { lastRevisionId, revisionsCount } ) {\n\treturn (\n\t\t<PostLastRevisionCheck>\n\t\t\t<Button\n\t\t\t\thref={ addQueryArgs( 'revision.php', {\n\t\t\t\t\trevision: lastRevisionId,\n\t\t\t\t\tgutenberg: true,\n\t\t\t\t} ) }\n\t\t\t\tclassName=\"editor-post-last-revision__title\"\n\t\t\t\ticon={ backup }\n\t\t\t>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t/* translators: %d: number of revisions */\n\t\t\t\t\t_n( '%d Revision', '%d Revisions', revisionsCount ),\n\t\t\t\t\trevisionsCount\n\t\t\t\t) }\n\t\t\t</Button>\n\t\t</PostLastRevisionCheck>\n\t);\n}\n\nexport default withSelect( ( select ) => {\n\tconst { getCurrentPostLastRevisionId, getCurrentPostRevisionsCount } =\n\t\tselect( editorStore );\n\treturn {\n\t\tlastRevisionId: getCurrentPostLastRevisionId(),\n\t\trevisionsCount: getCurrentPostRevisionsCount(),\n\t};\n} )( LastRevision );\n"]}
1
+ {"version":3,"names":["_i18n","require","_components","_data","_icons","_url","_check","_interopRequireDefault","_store","LastRevision","lastRevisionId","revisionsCount","useSelect","select","getCurrentPostLastRevisionId","getCurrentPostRevisionsCount","editorStore","_element","createElement","default","Button","href","addQueryArgs","revision","gutenberg","className","icon","backup","sprintf","_n","_default","exports"],"sources":["@wordpress/editor/src/components/post-last-revision/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { sprintf, _n } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { backup } from '@wordpress/icons';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport PostLastRevisionCheck from './check';\nimport { store as editorStore } from '../../store';\n\nfunction LastRevision() {\n\tconst { lastRevisionId, revisionsCount } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostLastRevisionId, getCurrentPostRevisionsCount } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tlastRevisionId: getCurrentPostLastRevisionId(),\n\t\t\trevisionsCount: getCurrentPostRevisionsCount(),\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<PostLastRevisionCheck>\n\t\t\t<Button\n\t\t\t\thref={ addQueryArgs( 'revision.php', {\n\t\t\t\t\trevision: lastRevisionId,\n\t\t\t\t\tgutenberg: true,\n\t\t\t\t} ) }\n\t\t\t\tclassName=\"editor-post-last-revision__title\"\n\t\t\t\ticon={ backup }\n\t\t\t>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t/* translators: %d: number of revisions */\n\t\t\t\t\t_n( '%d Revision', '%d Revisions', revisionsCount ),\n\t\t\t\t\trevisionsCount\n\t\t\t\t) }\n\t\t\t</Button>\n\t\t</PostLastRevisionCheck>\n\t);\n}\n\nexport default LastRevision;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA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