@wordpress/editor 13.11.0 → 13.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (369) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/autosave-monitor/index.js +1 -2
  3. package/build/components/autosave-monitor/index.js.map +1 -1
  4. package/build/components/deprecated.js +3 -4
  5. package/build/components/deprecated.js.map +1 -1
  6. package/build/components/document-outline/check.js +4 -5
  7. package/build/components/document-outline/check.js.map +1 -1
  8. package/build/components/document-outline/index.js +12 -16
  9. package/build/components/document-outline/index.js.map +1 -1
  10. package/build/components/document-outline/item.js +22 -25
  11. package/build/components/document-outline/item.js.map +1 -1
  12. package/build/components/editor-help/help-detail-navigation-screen.native.js +4 -5
  13. package/build/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
  14. package/build/components/editor-help/help-get-support-button.native.js +4 -5
  15. package/build/components/editor-help/help-get-support-button.native.js.map +1 -1
  16. package/build/components/editor-help/help-section-title.native.js +3 -4
  17. package/build/components/editor-help/help-section-title.native.js.map +1 -1
  18. package/build/components/editor-help/help-topic-row.native.js +6 -7
  19. package/build/components/editor-help/help-topic-row.native.js.map +1 -1
  20. package/build/components/editor-help/index.native.js +19 -24
  21. package/build/components/editor-help/index.native.js.map +1 -1
  22. package/build/components/editor-help/view-sections.native.js +16 -20
  23. package/build/components/editor-help/view-sections.native.js.map +1 -1
  24. package/build/components/editor-notices/index.js +12 -19
  25. package/build/components/editor-notices/index.js.map +1 -1
  26. package/build/components/editor-snackbars/index.js +3 -6
  27. package/build/components/editor-snackbars/index.js.map +1 -1
  28. package/build/components/entities-saved-states/entity-record-item.js +7 -10
  29. package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
  30. package/build/components/entities-saved-states/entity-type-list.js +6 -7
  31. package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
  32. package/build/components/entities-saved-states/hooks/use-is-dirty.js +84 -0
  33. package/build/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -0
  34. package/build/components/entities-saved-states/index.js +38 -110
  35. package/build/components/entities-saved-states/index.js.map +1 -1
  36. package/build/components/error-boundary/index.js +4 -5
  37. package/build/components/error-boundary/index.js.map +1 -1
  38. package/build/components/global-keyboard-shortcuts/save-shortcut.js +3 -4
  39. package/build/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
  40. package/build/components/index.js +9 -0
  41. package/build/components/index.js.map +1 -1
  42. package/build/components/media-categories/index.js +25 -42
  43. package/build/components/media-categories/index.js.map +1 -1
  44. package/build/components/page-attributes/check.js +4 -7
  45. package/build/components/page-attributes/check.js.map +1 -1
  46. package/build/components/page-attributes/order.js +5 -8
  47. package/build/components/page-attributes/order.js.map +1 -1
  48. package/build/components/page-attributes/parent.js +5 -12
  49. package/build/components/page-attributes/parent.js.map +1 -1
  50. package/build/components/post-author/check.js +6 -7
  51. package/build/components/post-author/check.js.map +1 -1
  52. package/build/components/post-author/combobox.js +3 -6
  53. package/build/components/post-author/combobox.js.map +1 -1
  54. package/build/components/post-author/index.js +1 -1
  55. package/build/components/post-author/index.js.map +1 -1
  56. package/build/components/post-comments/index.js +4 -6
  57. package/build/components/post-comments/index.js.map +1 -1
  58. package/build/components/post-excerpt/index.js +4 -5
  59. package/build/components/post-excerpt/index.js.map +1 -1
  60. package/build/components/post-featured-image/index.js +56 -69
  61. package/build/components/post-featured-image/index.js.map +1 -1
  62. package/build/components/post-format/check.js +4 -5
  63. package/build/components/post-format/check.js.map +1 -1
  64. package/build/components/post-format/index.js +1 -1
  65. package/build/components/post-format/index.js.map +1 -1
  66. package/build/components/post-last-revision/check.js +5 -7
  67. package/build/components/post-last-revision/check.js.map +1 -1
  68. package/build/components/post-last-revision/index.js +4 -5
  69. package/build/components/post-last-revision/index.js.map +1 -1
  70. package/build/components/post-locked-modal/index.js +1 -1
  71. package/build/components/post-locked-modal/index.js.map +1 -1
  72. package/build/components/post-pending-status/check.js +7 -9
  73. package/build/components/post-pending-status/check.js.map +1 -1
  74. package/build/components/post-pending-status/index.js +4 -6
  75. package/build/components/post-pending-status/index.js.map +1 -1
  76. package/build/components/post-pingbacks/index.js +4 -6
  77. package/build/components/post-pingbacks/index.js.map +1 -1
  78. package/build/components/post-preview-button/index.js +8 -12
  79. package/build/components/post-preview-button/index.js.map +1 -1
  80. package/build/components/post-publish-button/index.js +6 -13
  81. package/build/components/post-publish-button/index.js.map +1 -1
  82. package/build/components/post-publish-button/label.js +14 -17
  83. package/build/components/post-publish-button/label.js.map +1 -1
  84. package/build/components/post-publish-panel/index.js +6 -7
  85. package/build/components/post-publish-panel/index.js.map +1 -1
  86. package/build/components/post-publish-panel/maybe-category-panel.js +2 -4
  87. package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  88. package/build/components/post-publish-panel/maybe-post-format-panel.js +9 -12
  89. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  90. package/build/components/post-publish-panel/maybe-tags-panel.js +4 -7
  91. package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  92. package/build/components/post-publish-panel/postpublish.js +8 -11
  93. package/build/components/post-publish-panel/postpublish.js.map +1 -1
  94. package/build/components/post-publish-panel/prepublish.js +5 -6
  95. package/build/components/post-publish-panel/prepublish.js.map +1 -1
  96. package/build/components/post-saved-state/index.js +13 -8
  97. package/build/components/post-saved-state/index.js.map +1 -1
  98. package/build/components/post-schedule/check.js +6 -8
  99. package/build/components/post-schedule/check.js.map +1 -1
  100. package/build/components/post-schedule/index.js +8 -12
  101. package/build/components/post-schedule/index.js.map +1 -1
  102. package/build/components/post-schedule/label.js +7 -10
  103. package/build/components/post-schedule/label.js.map +1 -1
  104. package/build/components/post-slug/check.js +3 -4
  105. package/build/components/post-slug/check.js.map +1 -1
  106. package/build/components/post-slug/index.js +5 -6
  107. package/build/components/post-slug/index.js.map +1 -1
  108. package/build/components/post-sticky/check.js +7 -9
  109. package/build/components/post-sticky/check.js.map +1 -1
  110. package/build/components/post-sticky/index.js +4 -5
  111. package/build/components/post-sticky/index.js.map +1 -1
  112. package/build/components/post-switch-to-draft-button/index.js +6 -7
  113. package/build/components/post-switch-to-draft-button/index.js.map +1 -1
  114. package/build/components/post-taxonomies/check.js +6 -7
  115. package/build/components/post-taxonomies/check.js.map +1 -1
  116. package/build/components/post-taxonomies/flat-term-selector.js +12 -13
  117. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  118. package/build/components/post-taxonomies/hierarchical-term-selector.js +13 -14
  119. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  120. package/build/components/post-taxonomies/index.js +6 -11
  121. package/build/components/post-taxonomies/index.js.map +1 -1
  122. package/build/components/post-taxonomies/most-used-terms.js +5 -6
  123. package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
  124. package/build/components/post-template/index.js +6 -9
  125. package/build/components/post-template/index.js.map +1 -1
  126. package/build/components/post-title/index.js +2 -6
  127. package/build/components/post-title/index.js.map +1 -1
  128. package/build/components/post-title/index.native.js +8 -11
  129. package/build/components/post-title/index.native.js.map +1 -1
  130. package/build/components/post-trash/check.js +7 -9
  131. package/build/components/post-trash/check.js.map +1 -1
  132. package/build/components/post-type-support-check/index.js +5 -6
  133. package/build/components/post-type-support-check/index.js.map +1 -1
  134. package/build/components/post-url/check.js +4 -5
  135. package/build/components/post-url/check.js.map +1 -1
  136. package/build/components/post-url/index.js +8 -9
  137. package/build/components/post-url/index.js.map +1 -1
  138. package/build/components/post-visibility/check.js +6 -7
  139. package/build/components/post-visibility/check.js.map +1 -1
  140. package/build/components/post-visibility/index.js +10 -12
  141. package/build/components/post-visibility/index.js.map +1 -1
  142. package/build/components/post-visibility/label.js +1 -3
  143. package/build/components/post-visibility/label.js.map +1 -1
  144. package/build/components/provider/index.js +9 -10
  145. package/build/components/provider/index.js.map +1 -1
  146. package/build/components/provider/index.native.js +14 -20
  147. package/build/components/provider/index.native.js.map +1 -1
  148. package/build/components/provider/use-block-editor-settings.js +5 -9
  149. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  150. package/build/components/provider/use-block-editor-settings.native.js +1 -3
  151. package/build/components/provider/use-block-editor-settings.native.js.map +1 -1
  152. package/build/components/table-of-contents/index.js +26 -33
  153. package/build/components/table-of-contents/index.js.map +1 -1
  154. package/build/components/table-of-contents/panel.js +4 -5
  155. package/build/components/table-of-contents/panel.js.map +1 -1
  156. package/build/components/template-validation-notice/index.js +4 -6
  157. package/build/components/template-validation-notice/index.js.map +1 -1
  158. package/build/components/theme-support-check/index.js +7 -8
  159. package/build/components/theme-support-check/index.js.map +1 -1
  160. package/build/hooks/custom-sources-backwards-compatibility.js +16 -35
  161. package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  162. package/build/hooks/default-autocompleters.js +1 -2
  163. package/build/hooks/default-autocompleters.js.map +1 -1
  164. package/build/private-apis.js +4 -1
  165. package/build/private-apis.js.map +1 -1
  166. package/build/store/actions.js +147 -179
  167. package/build/store/actions.js.map +1 -1
  168. package/build/store/actions.native.js +1 -2
  169. package/build/store/actions.native.js.map +1 -1
  170. package/build/store/reducer.js +14 -44
  171. package/build/store/reducer.js.map +1 -1
  172. package/build/store/reducer.native.js +3 -12
  173. package/build/store/reducer.native.js.map +1 -1
  174. package/build/store/selectors.js +23 -54
  175. package/build/store/selectors.js.map +1 -1
  176. package/build/store/utils/notice-builder.js +3 -3
  177. package/build/store/utils/notice-builder.js.map +1 -1
  178. package/build/utils/media-upload/index.js +11 -15
  179. package/build/utils/media-upload/index.js.map +1 -1
  180. package/build/utils/terms.js +3 -6
  181. package/build/utils/terms.js.map +1 -1
  182. package/build-module/components/autosave-monitor/index.js +1 -2
  183. package/build-module/components/autosave-monitor/index.js.map +1 -1
  184. package/build-module/components/deprecated.js +3 -4
  185. package/build-module/components/deprecated.js.map +1 -1
  186. package/build-module/components/document-outline/check.js +4 -5
  187. package/build-module/components/document-outline/check.js.map +1 -1
  188. package/build-module/components/document-outline/index.js +12 -16
  189. package/build-module/components/document-outline/index.js.map +1 -1
  190. package/build-module/components/document-outline/item.js +22 -25
  191. package/build-module/components/document-outline/item.js.map +1 -1
  192. package/build-module/components/editor-help/help-detail-navigation-screen.native.js +4 -5
  193. package/build-module/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
  194. package/build-module/components/editor-help/help-get-support-button.native.js +4 -5
  195. package/build-module/components/editor-help/help-get-support-button.native.js.map +1 -1
  196. package/build-module/components/editor-help/help-section-title.native.js +3 -4
  197. package/build-module/components/editor-help/help-section-title.native.js.map +1 -1
  198. package/build-module/components/editor-help/help-topic-row.native.js +6 -7
  199. package/build-module/components/editor-help/help-topic-row.native.js.map +1 -1
  200. package/build-module/components/editor-help/index.native.js +19 -23
  201. package/build-module/components/editor-help/index.native.js.map +1 -1
  202. package/build-module/components/editor-help/view-sections.native.js +16 -20
  203. package/build-module/components/editor-help/view-sections.native.js.map +1 -1
  204. package/build-module/components/editor-notices/index.js +12 -19
  205. package/build-module/components/editor-notices/index.js.map +1 -1
  206. package/build-module/components/editor-snackbars/index.js +3 -6
  207. package/build-module/components/editor-snackbars/index.js.map +1 -1
  208. package/build-module/components/entities-saved-states/entity-record-item.js +7 -10
  209. package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
  210. package/build-module/components/entities-saved-states/entity-type-list.js +6 -7
  211. package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
  212. package/build-module/components/entities-saved-states/hooks/use-is-dirty.js +70 -0
  213. package/build-module/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -0
  214. package/build-module/components/entities-saved-states/index.js +39 -113
  215. package/build-module/components/entities-saved-states/index.js.map +1 -1
  216. package/build-module/components/error-boundary/index.js +4 -5
  217. package/build-module/components/error-boundary/index.js.map +1 -1
  218. package/build-module/components/global-keyboard-shortcuts/save-shortcut.js +3 -4
  219. package/build-module/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
  220. package/build-module/components/index.js +1 -0
  221. package/build-module/components/index.js.map +1 -1
  222. package/build-module/components/media-categories/index.js +25 -42
  223. package/build-module/components/media-categories/index.js.map +1 -1
  224. package/build-module/components/page-attributes/check.js +4 -7
  225. package/build-module/components/page-attributes/check.js.map +1 -1
  226. package/build-module/components/page-attributes/order.js +5 -8
  227. package/build-module/components/page-attributes/order.js.map +1 -1
  228. package/build-module/components/page-attributes/parent.js +5 -12
  229. package/build-module/components/page-attributes/parent.js.map +1 -1
  230. package/build-module/components/post-author/check.js +6 -7
  231. package/build-module/components/post-author/check.js.map +1 -1
  232. package/build-module/components/post-author/combobox.js +3 -6
  233. package/build-module/components/post-author/combobox.js.map +1 -1
  234. package/build-module/components/post-author/index.js +1 -1
  235. package/build-module/components/post-author/index.js.map +1 -1
  236. package/build-module/components/post-comments/index.js +4 -6
  237. package/build-module/components/post-comments/index.js.map +1 -1
  238. package/build-module/components/post-excerpt/index.js +4 -5
  239. package/build-module/components/post-excerpt/index.js.map +1 -1
  240. package/build-module/components/post-featured-image/index.js +56 -69
  241. package/build-module/components/post-featured-image/index.js.map +1 -1
  242. package/build-module/components/post-format/check.js +4 -5
  243. package/build-module/components/post-format/check.js.map +1 -1
  244. package/build-module/components/post-format/index.js +1 -1
  245. package/build-module/components/post-format/index.js.map +1 -1
  246. package/build-module/components/post-last-revision/check.js +5 -7
  247. package/build-module/components/post-last-revision/check.js.map +1 -1
  248. package/build-module/components/post-last-revision/index.js +4 -5
  249. package/build-module/components/post-last-revision/index.js.map +1 -1
  250. package/build-module/components/post-locked-modal/index.js +1 -1
  251. package/build-module/components/post-locked-modal/index.js.map +1 -1
  252. package/build-module/components/post-pending-status/check.js +7 -9
  253. package/build-module/components/post-pending-status/check.js.map +1 -1
  254. package/build-module/components/post-pending-status/index.js +4 -6
  255. package/build-module/components/post-pending-status/index.js.map +1 -1
  256. package/build-module/components/post-pingbacks/index.js +4 -6
  257. package/build-module/components/post-pingbacks/index.js.map +1 -1
  258. package/build-module/components/post-preview-button/index.js +8 -12
  259. package/build-module/components/post-preview-button/index.js.map +1 -1
  260. package/build-module/components/post-publish-button/index.js +6 -13
  261. package/build-module/components/post-publish-button/index.js.map +1 -1
  262. package/build-module/components/post-publish-button/label.js +14 -17
  263. package/build-module/components/post-publish-button/label.js.map +1 -1
  264. package/build-module/components/post-publish-panel/index.js +6 -7
  265. package/build-module/components/post-publish-panel/index.js.map +1 -1
  266. package/build-module/components/post-publish-panel/maybe-category-panel.js +2 -4
  267. package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  268. package/build-module/components/post-publish-panel/maybe-post-format-panel.js +9 -12
  269. package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  270. package/build-module/components/post-publish-panel/maybe-tags-panel.js +4 -7
  271. package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  272. package/build-module/components/post-publish-panel/postpublish.js +8 -11
  273. package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
  274. package/build-module/components/post-publish-panel/prepublish.js +5 -6
  275. package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
  276. package/build-module/components/post-saved-state/index.js +13 -8
  277. package/build-module/components/post-saved-state/index.js.map +1 -1
  278. package/build-module/components/post-schedule/check.js +6 -8
  279. package/build-module/components/post-schedule/check.js.map +1 -1
  280. package/build-module/components/post-schedule/index.js +8 -12
  281. package/build-module/components/post-schedule/index.js.map +1 -1
  282. package/build-module/components/post-schedule/label.js +7 -10
  283. package/build-module/components/post-schedule/label.js.map +1 -1
  284. package/build-module/components/post-slug/check.js +3 -4
  285. package/build-module/components/post-slug/check.js.map +1 -1
  286. package/build-module/components/post-slug/index.js +5 -6
  287. package/build-module/components/post-slug/index.js.map +1 -1
  288. package/build-module/components/post-sticky/check.js +7 -9
  289. package/build-module/components/post-sticky/check.js.map +1 -1
  290. package/build-module/components/post-sticky/index.js +4 -5
  291. package/build-module/components/post-sticky/index.js.map +1 -1
  292. package/build-module/components/post-switch-to-draft-button/index.js +6 -7
  293. package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
  294. package/build-module/components/post-taxonomies/check.js +6 -7
  295. package/build-module/components/post-taxonomies/check.js.map +1 -1
  296. package/build-module/components/post-taxonomies/flat-term-selector.js +12 -13
  297. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  298. package/build-module/components/post-taxonomies/hierarchical-term-selector.js +13 -14
  299. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  300. package/build-module/components/post-taxonomies/index.js +6 -11
  301. package/build-module/components/post-taxonomies/index.js.map +1 -1
  302. package/build-module/components/post-taxonomies/most-used-terms.js +5 -6
  303. package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
  304. package/build-module/components/post-template/index.js +6 -9
  305. package/build-module/components/post-template/index.js.map +1 -1
  306. package/build-module/components/post-title/index.js +2 -6
  307. package/build-module/components/post-title/index.js.map +1 -1
  308. package/build-module/components/post-title/index.native.js +8 -11
  309. package/build-module/components/post-title/index.native.js.map +1 -1
  310. package/build-module/components/post-trash/check.js +7 -9
  311. package/build-module/components/post-trash/check.js.map +1 -1
  312. package/build-module/components/post-type-support-check/index.js +5 -6
  313. package/build-module/components/post-type-support-check/index.js.map +1 -1
  314. package/build-module/components/post-url/check.js +4 -5
  315. package/build-module/components/post-url/check.js.map +1 -1
  316. package/build-module/components/post-url/index.js +8 -9
  317. package/build-module/components/post-url/index.js.map +1 -1
  318. package/build-module/components/post-visibility/check.js +6 -7
  319. package/build-module/components/post-visibility/check.js.map +1 -1
  320. package/build-module/components/post-visibility/index.js +10 -12
  321. package/build-module/components/post-visibility/index.js.map +1 -1
  322. package/build-module/components/post-visibility/label.js +1 -3
  323. package/build-module/components/post-visibility/label.js.map +1 -1
  324. package/build-module/components/provider/index.js +9 -10
  325. package/build-module/components/provider/index.js.map +1 -1
  326. package/build-module/components/provider/index.native.js +14 -20
  327. package/build-module/components/provider/index.native.js.map +1 -1
  328. package/build-module/components/provider/use-block-editor-settings.js +5 -9
  329. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  330. package/build-module/components/provider/use-block-editor-settings.native.js +1 -3
  331. package/build-module/components/provider/use-block-editor-settings.native.js.map +1 -1
  332. package/build-module/components/table-of-contents/index.js +26 -33
  333. package/build-module/components/table-of-contents/index.js.map +1 -1
  334. package/build-module/components/table-of-contents/panel.js +4 -5
  335. package/build-module/components/table-of-contents/panel.js.map +1 -1
  336. package/build-module/components/template-validation-notice/index.js +4 -6
  337. package/build-module/components/template-validation-notice/index.js.map +1 -1
  338. package/build-module/components/theme-support-check/index.js +7 -8
  339. package/build-module/components/theme-support-check/index.js.map +1 -1
  340. package/build-module/hooks/custom-sources-backwards-compatibility.js +16 -35
  341. package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  342. package/build-module/hooks/default-autocompleters.js +1 -2
  343. package/build-module/hooks/default-autocompleters.js.map +1 -1
  344. package/build-module/private-apis.js +3 -1
  345. package/build-module/private-apis.js.map +1 -1
  346. package/build-module/store/actions.js +147 -179
  347. package/build-module/store/actions.js.map +1 -1
  348. package/build-module/store/actions.native.js +1 -2
  349. package/build-module/store/actions.native.js.map +1 -1
  350. package/build-module/store/reducer.js +14 -44
  351. package/build-module/store/reducer.js.map +1 -1
  352. package/build-module/store/reducer.native.js +3 -12
  353. package/build-module/store/reducer.native.js.map +1 -1
  354. package/build-module/store/selectors.js +21 -54
  355. package/build-module/store/selectors.js.map +1 -1
  356. package/build-module/store/utils/notice-builder.js +3 -3
  357. package/build-module/store/utils/notice-builder.js.map +1 -1
  358. package/build-module/utils/media-upload/index.js +11 -15
  359. package/build-module/utils/media-upload/index.js.map +1 -1
  360. package/build-module/utils/terms.js +3 -6
  361. package/build-module/utils/terms.js.map +1 -1
  362. package/package.json +30 -30
  363. package/src/components/entities-saved-states/hooks/use-is-dirty.js +85 -0
  364. package/src/components/entities-saved-states/index.js +25 -106
  365. package/src/components/entities-saved-states/test/use-is-dirty.js +94 -0
  366. package/src/components/index.js +1 -0
  367. package/src/components/post-saved-state/index.js +6 -0
  368. package/src/components/post-title/index.js +2 -1
  369. package/src/private-apis.js +2 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/page-attributes/parent.js"],"names":["removeAccents","__","ComboboxControl","debounce","useState","useMemo","useSelect","useDispatch","decodeEntities","store","coreStore","buildTermsTree","editorStore","getTitle","post","title","rendered","id","getItemPriority","name","searchValue","normalizedName","toLowerCase","normalizedSearch","startsWith","length","Infinity","PageAttributesParent","editPost","fieldValue","setFieldValue","isHierarchical","parentPost","parentPostId","items","postType","select","getPostType","getEntityRecords","getEntityRecord","getCurrentPostId","getEditedPostAttribute","postTypeSlug","pageId","pType","postId","postIsHierarchical","hierarchical","query","per_page","exclude","parent_exclude","orderby","order","_fields","search","parentPageLabel","labels","parent_item_colon","pageItems","parentOptions","getOptionsFromTree","tree","level","mappedNodes","map","treeNode","value","label","repeat","rawName","children","sortedNodes","sort","a","b","priorityA","priorityB","flat","item","parent","opts","optsHasParent","find","unshift","handleKeydown","inputValue","handleChange","selectedPostId"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,aAAP,MAA0B,gBAA1B;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,uBAAhC;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,QAAT,EAAmBC,OAAnB,QAAkC,oBAAlC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASC,cAAT,QAA+B,mBAA/B;AACA,SAASF,KAAK,IAAIG,WAAlB,QAAqC,aAArC;;AAEA,SAASC,QAAT,CAAmBC,IAAnB,EAA0B;AAAA;;AACzB,SAAOA,IAAI,SAAJ,IAAAA,IAAI,WAAJ,mBAAAA,IAAI,CAAEC,KAAN,oDAAaC,QAAb,GACJR,cAAc,CAAEM,IAAI,CAACC,KAAL,CAAWC,QAAb,CADV,GAEH,IAAIF,IAAI,CAACG,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aAArB,EAAqC;AACpCD,MAAAA,IAAI,CAACG,OAAL,CAAc;AACbjB,QAAAA,KAAK,EAAElC,YADM;AAEbmC,QAAAA,KAAK,EAAEvD,QAAQ,CAAEmB,UAAF;AAFF,OAAd;AAIA;;AACD,WAAOiD,IAAP;AACA,GA7C4B,EA6C1B,CAAEtB,SAAF,EAAa9B,UAAb,CA7C0B,CAA7B;;AA+CA,MAAK,CAAEE,cAAF,IAAoB,CAAEyB,eAA3B,EAA6C;AAC5C,WAAO,IAAP;AACA;AACD;AACD;AACA;AACA;AACA;;;AACC,QAAM6B,aAAa,GAAKC,UAAF,IAAkB;AACvCxD,IAAAA,aAAa,CAAEwD,UAAF,CAAb;AACA,GAFD;AAIA;AACD;AACA;AACA;AACA;;;AACC,QAAMC,YAAY,GAAKC,cAAF,IAAsB;AAC1C5D,IAAAA,QAAQ,CAAE;AAAEoD,MAAAA,MAAM,EAAEQ;AAAV,KAAF,CAAR;AACA,GAFD;;AAIA,SACC,cAAC,eAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,SAAS,EAAC,gCAFX;AAGC,IAAA,KAAK,EAAGhC,eAHT;AAIC,IAAA,KAAK,EAAGvB,YAJT;AAKC,IAAA,OAAO,EAAG2B,aALX;AAMC,IAAA,mBAAmB,EAAGzD,QAAQ,CAAEkF,aAAF,EAAiB,GAAjB,CAN/B;AAOC,IAAA,QAAQ,EAAGE;AAPZ,IADD;AAWA;AAED,eAAe5D,oBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ComboboxControl } from '@wordpress/components';\nimport { debounce } from '@wordpress/compose';\nimport { useState, useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { buildTermsTree } from '../../utils/terms';\nimport { store as editorStore } from '../../store';\n\nfunction getTitle( post ) {\n\treturn post?.title?.rendered\n\t\t? decodeEntities( post.title.rendered )\n\t\t: `#${ post.id } (${ __( 'no title' ) })`;\n}\n\nexport const getItemPriority = ( name, searchValue ) => {\n\tconst normalizedName = removeAccents( name || '' ).toLowerCase();\n\tconst normalizedSearch = removeAccents( searchValue || '' ).toLowerCase();\n\tif ( normalizedName === normalizedSearch ) {\n\t\treturn 0;\n\t}\n\n\tif ( normalizedName.startsWith( normalizedSearch ) ) {\n\t\treturn normalizedName.length;\n\t}\n\n\treturn Infinity;\n};\n\nexport function PageAttributesParent() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst [ fieldValue, setFieldValue ] = useState( false );\n\tconst { isHierarchical, parentPost, parentPostId, items, postType } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst { getPostType, getEntityRecords, getEntityRecord } =\n\t\t\t\t\tselect( coreStore );\n\t\t\t\tconst { getCurrentPostId, getEditedPostAttribute } =\n\t\t\t\t\tselect( editorStore );\n\t\t\t\tconst postTypeSlug = getEditedPostAttribute( 'type' );\n\t\t\t\tconst pageId = getEditedPostAttribute( 'parent' );\n\t\t\t\tconst pType = getPostType( postTypeSlug );\n\t\t\t\tconst postId = getCurrentPostId();\n\t\t\t\tconst postIsHierarchical = pType?.hierarchical ?? false;\n\t\t\t\tconst query = {\n\t\t\t\t\tper_page: 100,\n\t\t\t\t\texclude: postId,\n\t\t\t\t\tparent_exclude: postId,\n\t\t\t\t\torderby: 'menu_order',\n\t\t\t\t\torder: 'asc',\n\t\t\t\t\t_fields: 'id,title,parent',\n\t\t\t\t};\n\n\t\t\t\t// Perform a search when the field is changed.\n\t\t\t\tif ( !! fieldValue ) {\n\t\t\t\t\tquery.search = fieldValue;\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tisHierarchical: postIsHierarchical,\n\t\t\t\t\tparentPostId: pageId,\n\t\t\t\t\tparentPost: pageId\n\t\t\t\t\t\t? getEntityRecord( 'postType', postTypeSlug, pageId )\n\t\t\t\t\t\t: null,\n\t\t\t\t\titems: postIsHierarchical\n\t\t\t\t\t\t? getEntityRecords( 'postType', postTypeSlug, query )\n\t\t\t\t\t\t: [],\n\t\t\t\t\tpostType: pType,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ fieldValue ]\n\t\t);\n\n\tconst parentPageLabel = postType?.labels?.parent_item_colon;\n\tconst pageItems = items || [];\n\n\tconst parentOptions = useMemo( () => {\n\t\tconst getOptionsFromTree = ( tree, level = 0 ) => {\n\t\t\tconst mappedNodes = tree.map( ( treeNode ) => [\n\t\t\t\t{\n\t\t\t\t\tvalue: treeNode.id,\n\t\t\t\t\tlabel:\n\t\t\t\t\t\t'— '.repeat( level ) + decodeEntities( treeNode.name ),\n\t\t\t\t\trawName: treeNode.name,\n\t\t\t\t},\n\t\t\t\t...getOptionsFromTree( treeNode.children || [], level + 1 ),\n\t\t\t] );\n\n\t\t\tconst sortedNodes = mappedNodes.sort( ( [ a ], [ b ] ) => {\n\t\t\t\tconst priorityA = getItemPriority( a.rawName, fieldValue );\n\t\t\t\tconst priorityB = getItemPriority( b.rawName, fieldValue );\n\t\t\t\treturn priorityA >= priorityB ? 1 : -1;\n\t\t\t} );\n\n\t\t\treturn sortedNodes.flat();\n\t\t};\n\n\t\tlet tree = pageItems.map( ( item ) => ( {\n\t\t\tid: item.id,\n\t\t\tparent: item.parent,\n\t\t\tname: getTitle( item ),\n\t\t} ) );\n\n\t\t// Only build a hierarchical tree when not searching.\n\t\tif ( ! fieldValue ) {\n\t\t\ttree = buildTermsTree( tree );\n\t\t}\n\n\t\tconst opts = getOptionsFromTree( tree );\n\n\t\t// Ensure the current parent is in the options list.\n\t\tconst optsHasParent = opts.find(\n\t\t\t( item ) => item.value === parentPostId\n\t\t);\n\t\tif ( parentPost && ! optsHasParent ) {\n\t\t\topts.unshift( {\n\t\t\t\tvalue: parentPostId,\n\t\t\t\tlabel: getTitle( parentPost ),\n\t\t\t} );\n\t\t}\n\t\treturn opts;\n\t}, [ pageItems, fieldValue ] );\n\n\tif ( ! isHierarchical || ! parentPageLabel ) {\n\t\treturn null;\n\t}\n\t/**\n\t * Handle user input.\n\t *\n\t * @param {string} inputValue The current value of the input field.\n\t */\n\tconst handleKeydown = ( inputValue ) => {\n\t\tsetFieldValue( inputValue );\n\t};\n\n\t/**\n\t * Handle author selection.\n\t *\n\t * @param {Object} selectedPostId The selected Author.\n\t */\n\tconst handleChange = ( selectedPostId ) => {\n\t\teditPost( { parent: selectedPostId } );\n\t};\n\n\treturn (\n\t\t<ComboboxControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tclassName=\"editor-page-attributes__parent\"\n\t\t\tlabel={ parentPageLabel }\n\t\t\tvalue={ parentPostId }\n\t\t\toptions={ parentOptions }\n\t\t\tonFilterValueChange={ debounce( handleKeydown, 300 ) }\n\t\t\tonChange={ handleChange }\n\t\t/>\n\t);\n}\n\nexport default PageAttributesParent;\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/page-attributes/parent.js"],"names":["removeAccents","__","ComboboxControl","debounce","useState","useMemo","useSelect","useDispatch","decodeEntities","store","coreStore","buildTermsTree","editorStore","getTitle","post","title","rendered","id","getItemPriority","name","searchValue","normalizedName","toLowerCase","normalizedSearch","startsWith","length","Infinity","PageAttributesParent","editPost","fieldValue","setFieldValue","isHierarchical","parentPost","parentPostId","items","postType","select","getPostType","getEntityRecords","getEntityRecord","getCurrentPostId","getEditedPostAttribute","postTypeSlug","pageId","pType","postId","postIsHierarchical","hierarchical","query","per_page","exclude","parent_exclude","orderby","order","_fields","search","parentPageLabel","labels","parent_item_colon","pageItems","parentOptions","getOptionsFromTree","tree","level","mappedNodes","map","treeNode","value","label","repeat","rawName","children","sortedNodes","sort","a","b","priorityA","priorityB","flat","item","parent","opts","optsHasParent","find","unshift","handleKeydown","inputValue","handleChange","selectedPostId"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,aAAP,MAA0B,gBAA1B;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AAMC,IAAA,mBAAmB,EAAGzD,QAAQ,CAAEkF,aAAF,EAAiB,GAAjB,CAN/B;AAOC,IAAA,QAAQ,EAAGE;AAPZ,IADD;AAWA;AAED,eAAe5D,oBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ComboboxControl } from '@wordpress/components';\nimport { debounce } from '@wordpress/compose';\nimport { useState, useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { buildTermsTree } from '../../utils/terms';\nimport { store as editorStore } from '../../store';\n\nfunction getTitle( post ) {\n\treturn post?.title?.rendered\n\t\t? decodeEntities( post.title.rendered )\n\t\t: `#${ post.id } (${ __( 'no title' ) })`;\n}\n\nexport const getItemPriority = ( name, searchValue ) => {\n\tconst normalizedName = removeAccents( name || '' ).toLowerCase();\n\tconst normalizedSearch = removeAccents( searchValue || '' ).toLowerCase();\n\tif ( normalizedName === normalizedSearch ) {\n\t\treturn 0;\n\t}\n\n\tif ( normalizedName.startsWith( normalizedSearch ) ) {\n\t\treturn normalizedName.length;\n\t}\n\n\treturn Infinity;\n};\n\nexport function PageAttributesParent() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst [ fieldValue, setFieldValue ] = useState( false );\n\tconst { isHierarchical, parentPost, parentPostId, items, postType } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst { getPostType, getEntityRecords, getEntityRecord } =\n\t\t\t\t\tselect( coreStore );\n\t\t\t\tconst { getCurrentPostId, getEditedPostAttribute } =\n\t\t\t\t\tselect( editorStore );\n\t\t\t\tconst postTypeSlug = getEditedPostAttribute( 'type' );\n\t\t\t\tconst pageId = getEditedPostAttribute( 'parent' );\n\t\t\t\tconst pType = getPostType( postTypeSlug );\n\t\t\t\tconst postId = getCurrentPostId();\n\t\t\t\tconst postIsHierarchical = pType?.hierarchical ?? false;\n\t\t\t\tconst query = {\n\t\t\t\t\tper_page: 100,\n\t\t\t\t\texclude: postId,\n\t\t\t\t\tparent_exclude: postId,\n\t\t\t\t\torderby: 'menu_order',\n\t\t\t\t\torder: 'asc',\n\t\t\t\t\t_fields: 'id,title,parent',\n\t\t\t\t};\n\n\t\t\t\t// Perform a search when the field is changed.\n\t\t\t\tif ( !! fieldValue ) {\n\t\t\t\t\tquery.search = fieldValue;\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tisHierarchical: postIsHierarchical,\n\t\t\t\t\tparentPostId: pageId,\n\t\t\t\t\tparentPost: pageId\n\t\t\t\t\t\t? getEntityRecord( 'postType', postTypeSlug, pageId )\n\t\t\t\t\t\t: null,\n\t\t\t\t\titems: postIsHierarchical\n\t\t\t\t\t\t? getEntityRecords( 'postType', postTypeSlug, query )\n\t\t\t\t\t\t: [],\n\t\t\t\t\tpostType: pType,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ fieldValue ]\n\t\t);\n\n\tconst parentPageLabel = postType?.labels?.parent_item_colon;\n\tconst pageItems = items || [];\n\n\tconst parentOptions = useMemo( () => {\n\t\tconst getOptionsFromTree = ( tree, level = 0 ) => {\n\t\t\tconst mappedNodes = tree.map( ( treeNode ) => [\n\t\t\t\t{\n\t\t\t\t\tvalue: treeNode.id,\n\t\t\t\t\tlabel:\n\t\t\t\t\t\t'— '.repeat( level ) + decodeEntities( treeNode.name ),\n\t\t\t\t\trawName: treeNode.name,\n\t\t\t\t},\n\t\t\t\t...getOptionsFromTree( treeNode.children || [], level + 1 ),\n\t\t\t] );\n\n\t\t\tconst sortedNodes = mappedNodes.sort( ( [ a ], [ b ] ) => {\n\t\t\t\tconst priorityA = getItemPriority( a.rawName, fieldValue );\n\t\t\t\tconst priorityB = getItemPriority( b.rawName, fieldValue );\n\t\t\t\treturn priorityA >= priorityB ? 1 : -1;\n\t\t\t} );\n\n\t\t\treturn sortedNodes.flat();\n\t\t};\n\n\t\tlet tree = pageItems.map( ( item ) => ( {\n\t\t\tid: item.id,\n\t\t\tparent: item.parent,\n\t\t\tname: getTitle( item ),\n\t\t} ) );\n\n\t\t// Only build a hierarchical tree when not searching.\n\t\tif ( ! fieldValue ) {\n\t\t\ttree = buildTermsTree( tree );\n\t\t}\n\n\t\tconst opts = getOptionsFromTree( tree );\n\n\t\t// Ensure the current parent is in the options list.\n\t\tconst optsHasParent = opts.find(\n\t\t\t( item ) => item.value === parentPostId\n\t\t);\n\t\tif ( parentPost && ! optsHasParent ) {\n\t\t\topts.unshift( {\n\t\t\t\tvalue: parentPostId,\n\t\t\t\tlabel: getTitle( parentPost ),\n\t\t\t} );\n\t\t}\n\t\treturn opts;\n\t}, [ pageItems, fieldValue ] );\n\n\tif ( ! isHierarchical || ! parentPageLabel ) {\n\t\treturn null;\n\t}\n\t/**\n\t * Handle user input.\n\t *\n\t * @param {string} inputValue The current value of the input field.\n\t */\n\tconst handleKeydown = ( inputValue ) => {\n\t\tsetFieldValue( inputValue );\n\t};\n\n\t/**\n\t * Handle author selection.\n\t *\n\t * @param {Object} selectedPostId The selected Author.\n\t */\n\tconst handleChange = ( selectedPostId ) => {\n\t\teditPost( { parent: selectedPostId } );\n\t};\n\n\treturn (\n\t\t<ComboboxControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tclassName=\"editor-page-attributes__parent\"\n\t\t\tlabel={ parentPageLabel }\n\t\t\tvalue={ parentPostId }\n\t\t\toptions={ parentOptions }\n\t\t\tonFilterValueChange={ debounce( handleKeydown, 300 ) }\n\t\t\tonChange={ handleChange }\n\t\t/>\n\t);\n}\n\nexport default PageAttributesParent;\n"]}
@@ -12,21 +12,20 @@ import { store as coreStore } from '@wordpress/core-data';
12
12
  import PostTypeSupportCheck from '../post-type-support-check';
13
13
  import { store as editorStore } from '../../store';
14
14
  import { AUTHORS_QUERY } from './constants';
15
- export default function PostAuthorCheck(_ref) {
16
- let {
17
- children
18
- } = _ref;
15
+ export default function PostAuthorCheck({
16
+ children
17
+ }) {
19
18
  const {
20
19
  hasAssignAuthorAction,
21
20
  hasAuthors
22
21
  } = useSelect(select => {
23
- var _post$_links$wpActio, _post$_links;
22
+ var _post$_links$wpActio;
24
23
 
25
24
  const post = select(editorStore).getCurrentPost();
26
25
  const authors = select(coreStore).getUsers(AUTHORS_QUERY);
27
26
  return {
28
- hasAssignAuthorAction: (_post$_links$wpActio = (_post$_links = post._links) === null || _post$_links === void 0 ? void 0 : _post$_links['wp:action-assign-author']) !== null && _post$_links$wpActio !== void 0 ? _post$_links$wpActio : false,
29
- hasAuthors: (authors === null || authors === void 0 ? void 0 : authors.length) >= 1
27
+ hasAssignAuthorAction: (_post$_links$wpActio = post._links?.['wp:action-assign-author']) !== null && _post$_links$wpActio !== void 0 ? _post$_links$wpActio : false,
28
+ hasAuthors: authors?.length >= 1
30
29
  };
31
30
  }, []);
32
31
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-author/check.js"],"names":["useSelect","store","coreStore","PostTypeSupportCheck","editorStore","AUTHORS_QUERY","PostAuthorCheck","children","hasAssignAuthorAction","hasAuthors","select","post","getCurrentPost","authors","getUsers","_links","length"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,4BAAjC;AACA,SAASF,KAAK,IAAIG,WAAlB,QAAqC,aAArC;AACA,SAASC,aAAT,QAA8B,aAA9B;AAEA,eAAe,SAASC,eAAT,OAAyC;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACvD,QAAM;AAAEC,IAAAA,qBAAF;AAAyBC,IAAAA;AAAzB,MAAwCT,SAAS,CAAIU,MAAF,IAAc;AAAA;;AACtE,UAAMC,IAAI,GAAGD,MAAM,CAAEN,WAAF,CAAN,CAAsBQ,cAAtB,EAAb;AACA,UAAMC,OAAO,GAAGH,MAAM,CAAER,SAAF,CAAN,CAAoBY,QAApB,CAA8BT,aAA9B,CAAhB;AACA,WAAO;AACNG,MAAAA,qBAAqB,0CACpBG,IAAI,CAACI,MADe,iDACpB,aAAe,yBAAf,CADoB,uEAC0B,KAFzC;AAGNN,MAAAA,UAAU,EAAE,CAAAI,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO,CAAEG,MAAT,KAAmB;AAHzB,KAAP;AAKA,GARsD,EAQpD,EARoD,CAAvD;;AAUA,MAAK,CAAER,qBAAF,IAA2B,CAAEC,UAAlC,EAA+C;AAC9C,WAAO,IAAP;AACA;;AAED,SACC,cAAC,oBAAD;AAAsB,IAAA,WAAW,EAAC;AAAlC,KACGF,QADH,CADD;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\nimport { AUTHORS_QUERY } from './constants';\n\nexport default function PostAuthorCheck( { children } ) {\n\tconst { hasAssignAuthorAction, hasAuthors } = useSelect( ( select ) => {\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\tconst authors = select( coreStore ).getUsers( AUTHORS_QUERY );\n\t\treturn {\n\t\t\thasAssignAuthorAction:\n\t\t\t\tpost._links?.[ 'wp:action-assign-author' ] ?? false,\n\t\t\thasAuthors: authors?.length >= 1,\n\t\t};\n\t}, [] );\n\n\tif ( ! hasAssignAuthorAction || ! hasAuthors ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"author\">\n\t\t\t{ children }\n\t\t</PostTypeSupportCheck>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-author/check.js"],"names":["useSelect","store","coreStore","PostTypeSupportCheck","editorStore","AUTHORS_QUERY","PostAuthorCheck","children","hasAssignAuthorAction","hasAuthors","select","post","getCurrentPost","authors","getUsers","_links","length"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,4BAAjC;AACA,SAASF,KAAK,IAAIG,WAAlB,QAAqC,aAArC;AACA,SAASC,aAAT,QAA8B,aAA9B;AAEA,eAAe,SAASC,eAAT,CAA0B;AAAEC,EAAAA;AAAF,CAA1B,EAAyC;AACvD,QAAM;AAAEC,IAAAA,qBAAF;AAAyBC,IAAAA;AAAzB,MAAwCT,SAAS,CAAIU,MAAF,IAAc;AAAA;;AACtE,UAAMC,IAAI,GAAGD,MAAM,CAAEN,WAAF,CAAN,CAAsBQ,cAAtB,EAAb;AACA,UAAMC,OAAO,GAAGH,MAAM,CAAER,SAAF,CAAN,CAAoBY,QAApB,CAA8BT,aAA9B,CAAhB;AACA,WAAO;AACNG,MAAAA,qBAAqB,0BACpBG,IAAI,CAACI,MAAL,GAAe,yBAAf,CADoB,uEAC0B,KAFzC;AAGNN,MAAAA,UAAU,EAAEI,OAAO,EAAEG,MAAT,IAAmB;AAHzB,KAAP;AAKA,GARsD,EAQpD,EARoD,CAAvD;;AAUA,MAAK,CAAER,qBAAF,IAA2B,CAAEC,UAAlC,EAA+C;AAC9C,WAAO,IAAP;AACA;;AAED,SACC,cAAC,oBAAD;AAAsB,IAAA,WAAW,EAAC;AAAlC,KACGF,QADH,CADD;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\nimport { AUTHORS_QUERY } from './constants';\n\nexport default function PostAuthorCheck( { children } ) {\n\tconst { hasAssignAuthorAction, hasAuthors } = useSelect( ( select ) => {\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\tconst authors = select( coreStore ).getUsers( AUTHORS_QUERY );\n\t\treturn {\n\t\t\thasAssignAuthorAction:\n\t\t\t\tpost._links?.[ 'wp:action-assign-author' ] ?? false,\n\t\t\thasAuthors: authors?.length >= 1,\n\t\t};\n\t}, [] );\n\n\tif ( ! hasAssignAuthorAction || ! hasAuthors ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"author\">\n\t\t\t{ children }\n\t\t</PostTypeSupportCheck>\n\t);\n}\n"]}
@@ -61,12 +61,9 @@ function PostAuthorCombobox() {
61
61
  };
62
62
  }); // Ensure the current author is included in the dropdown list.
63
63
 
64
- const foundAuthor = fetchedAuthors.findIndex(_ref => {
65
- let {
66
- value
67
- } = _ref;
68
- return (postAuthor === null || postAuthor === void 0 ? void 0 : postAuthor.id) === value;
69
- });
64
+ const foundAuthor = fetchedAuthors.findIndex(({
65
+ value
66
+ }) => postAuthor?.id === value);
70
67
 
71
68
  if (foundAuthor < 0 && postAuthor) {
72
69
  return [{
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-author/combobox.js"],"names":["debounce","useState","useMemo","useSelect","useDispatch","__","ComboboxControl","decodeEntities","store","coreStore","editorStore","AUTHORS_QUERY","PostAuthorCombobox","fieldValue","setFieldValue","authorId","isLoading","authors","postAuthor","select","getUser","getUsers","isResolving","getEditedPostAttribute","author","context","query","search","editPost","authorOptions","fetchedAuthors","map","value","id","label","name","foundAuthor","findIndex","handleSelect","postAuthorId","handleKeydown","inputValue"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,oBAAzB;AACA,SAASC,QAAT,EAAmBC,OAAnB,QAAkC,oBAAlC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,uBAAhC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA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A,OAAO,EAAGwB,aAHX;AAIC,IAAA,KAAK,EAAGd,QAJT;AAKC,IAAA,mBAAmB,EAAGf,QAAQ,CAAEwC,aAAF,EAAiB,GAAjB,CAL/B;AAMC,IAAA,QAAQ,EAAGF,YANZ;AAOC,IAAA,SAAS,EAAGtB,SAPb;AAQC,IAAA,UAAU,EAAG;AARd,IADD;AAYA;;AAED,eAAeJ,kBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { debounce } from '@wordpress/compose';\nimport { useState, useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { ComboboxControl } from '@wordpress/components';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { AUTHORS_QUERY } from './constants';\n\nfunction PostAuthorCombobox() {\n\tconst [ fieldValue, setFieldValue ] = useState();\n\n\tconst { authorId, isLoading, authors, postAuthor } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getUser, getUsers, isResolving } = select( coreStore );\n\t\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\t\tconst author = getUser( getEditedPostAttribute( 'author' ), {\n\t\t\t\tcontext: 'view',\n\t\t\t} );\n\t\t\tconst query = { ...AUTHORS_QUERY };\n\n\t\t\tif ( fieldValue ) {\n\t\t\t\tquery.search = fieldValue;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tauthorId: getEditedPostAttribute( 'author' ),\n\t\t\t\tpostAuthor: author,\n\t\t\t\tauthors: getUsers( query ),\n\t\t\t\tisLoading: isResolving( 'core', 'getUsers', [ query ] ),\n\t\t\t};\n\t\t},\n\t\t[ fieldValue ]\n\t);\n\tconst { editPost } = useDispatch( editorStore );\n\n\tconst authorOptions = useMemo( () => {\n\t\tconst fetchedAuthors = ( authors ?? [] ).map( ( author ) => {\n\t\t\treturn {\n\t\t\t\tvalue: author.id,\n\t\t\t\tlabel: decodeEntities( author.name ),\n\t\t\t};\n\t\t} );\n\n\t\t// Ensure the current author is included in the dropdown list.\n\t\tconst foundAuthor = fetchedAuthors.findIndex(\n\t\t\t( { value } ) => postAuthor?.id === value\n\t\t);\n\n\t\tif ( foundAuthor < 0 && postAuthor ) {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tvalue: postAuthor.id,\n\t\t\t\t\tlabel: decodeEntities( postAuthor.name ),\n\t\t\t\t},\n\t\t\t\t...fetchedAuthors,\n\t\t\t];\n\t\t}\n\n\t\treturn fetchedAuthors;\n\t}, [ authors, postAuthor ] );\n\n\t/**\n\t * Handle author selection.\n\t *\n\t * @param {number} postAuthorId The selected Author.\n\t */\n\tconst handleSelect = ( postAuthorId ) => {\n\t\tif ( ! postAuthorId ) {\n\t\t\treturn;\n\t\t}\n\t\teditPost( { author: postAuthorId } );\n\t};\n\n\t/**\n\t * Handle user input.\n\t *\n\t * @param {string} inputValue The current value of the input field.\n\t */\n\tconst handleKeydown = ( inputValue ) => {\n\t\tsetFieldValue( inputValue );\n\t};\n\n\tif ( ! postAuthor ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ComboboxControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ __( 'Author' ) }\n\t\t\toptions={ authorOptions }\n\t\t\tvalue={ authorId }\n\t\t\tonFilterValueChange={ debounce( handleKeydown, 300 ) }\n\t\t\tonChange={ handleSelect }\n\t\t\tisLoading={ isLoading }\n\t\t\tallowReset={ false }\n\t\t/>\n\t);\n}\n\nexport default PostAuthorCombobox;\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-author/combobox.js"],"names":["debounce","useState","useMemo","useSelect","useDispatch","__","ComboboxControl","decodeEntities","store","coreStore","editorStore","AUTHORS_QUERY","PostAuthorCombobox","fieldValue","setFieldValue","authorId","isLoading","authors","postAuthor","select","getUser","getUsers","isResolving","getEditedPostAttribute","author","context","query","search","editPost","authorOptions","fetchedAuthors","map","value","id","label","name","foundAuthor","findIndex","handleSelect","postAuthorId","handleKeydown","inputValue"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,oBAAzB;AACA,SAASC,QAAT,EAAmBC,OAAnB,QAAkC,oBAAlC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,uBAAhC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,aAArC;AACA,SAASC,aAAT,QAA8B,aAA9B;;AAEA,SAASC,kBAAT,GAA8B;AAC7B,QAAM,CAAEC,UAAF,EAAcC,aAAd,IAAgCb,QAAQ,EAA9C;AAEA,QAAM;AAAEc,IAAAA,QAAF;AAAYC,IAAAA,SAAZ;AAAuBC,IAAAA,OAAvB;AAAgCC,IAAAA;AAAhC,MAA+Cf,SAAS,CAC3DgB,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,OAAF;AAAWC,MAAAA,QAAX;AAAqBC,MAAAA;AAArB,QAAqCH,MAAM,CAAEV,SAAF,CAAjD;AACA,UAAM;AAAEc,MAAAA;AAAF,QAA6BJ,MAAM,CAAET,WAAF,CAAzC;AACA,UAAMc,MAAM,GAAGJ,OAAO,CAAEG,sBAAsB,CAAE,QAAF,CAAxB,EAAsC;AAC3DE,MAAAA,OAAO,EAAE;AADkD,KAAtC,CAAtB;AAGA,UAAMC,KAAK,GAAG,EAAE,GAAGf;AAAL,KAAd;;AAEA,QAAKE,UAAL,EAAkB;AACjBa,MAAAA,KAAK,CAACC,MAAN,GAAed,UAAf;AACA;;AAED,WAAO;AACNE,MAAAA,QAAQ,EAAEQ,sBAAsB,CAAE,QAAF,CAD1B;AAENL,MAAAA,UAAU,EAAEM,MAFN;AAGNP,MAAAA,OAAO,EAAEI,QAAQ,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,GAAKC,UAAF,IAAkB;AACvC3B,IAAAA,aAAa,CAAE2B,UAAF,CAAb;AACA,GAFD;;AAIA,MAAK,CAAEvB,UAAP,EAAoB;AACnB,WAAO,IAAP;AACA;;AAED,SACC,cAAC,eAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAGb,EAAE,CAAE,QAAF,CAFX;AAGC,IAAA,OAAO,EAAGwB,aAHX;AAIC,IAAA,KAAK,EAAGd,QAJT;AAKC,IAAA,mBAAmB,EAAGf,QAAQ,CAAEwC,aAAF,EAAiB,GAAjB,CAL/B;AAMC,IAAA,QAAQ,EAAGF,YANZ;AAOC,IAAA,SAAS,EAAGtB,SAPb;AAQC,IAAA,UAAU,EAAG;AARd,IADD;AAYA;;AAED,eAAeJ,kBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { debounce } from '@wordpress/compose';\nimport { useState, useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { ComboboxControl } from '@wordpress/components';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { AUTHORS_QUERY } from './constants';\n\nfunction PostAuthorCombobox() {\n\tconst [ fieldValue, setFieldValue ] = useState();\n\n\tconst { authorId, isLoading, authors, postAuthor } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getUser, getUsers, isResolving } = select( coreStore );\n\t\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\t\tconst author = getUser( getEditedPostAttribute( 'author' ), {\n\t\t\t\tcontext: 'view',\n\t\t\t} );\n\t\t\tconst query = { ...AUTHORS_QUERY };\n\n\t\t\tif ( fieldValue ) {\n\t\t\t\tquery.search = fieldValue;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tauthorId: getEditedPostAttribute( 'author' ),\n\t\t\t\tpostAuthor: author,\n\t\t\t\tauthors: getUsers( query ),\n\t\t\t\tisLoading: isResolving( 'core', 'getUsers', [ query ] ),\n\t\t\t};\n\t\t},\n\t\t[ fieldValue ]\n\t);\n\tconst { editPost } = useDispatch( editorStore );\n\n\tconst authorOptions = useMemo( () => {\n\t\tconst fetchedAuthors = ( authors ?? [] ).map( ( author ) => {\n\t\t\treturn {\n\t\t\t\tvalue: author.id,\n\t\t\t\tlabel: decodeEntities( author.name ),\n\t\t\t};\n\t\t} );\n\n\t\t// Ensure the current author is included in the dropdown list.\n\t\tconst foundAuthor = fetchedAuthors.findIndex(\n\t\t\t( { value } ) => postAuthor?.id === value\n\t\t);\n\n\t\tif ( foundAuthor < 0 && postAuthor ) {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tvalue: postAuthor.id,\n\t\t\t\t\tlabel: decodeEntities( postAuthor.name ),\n\t\t\t\t},\n\t\t\t\t...fetchedAuthors,\n\t\t\t];\n\t\t}\n\n\t\treturn fetchedAuthors;\n\t}, [ authors, postAuthor ] );\n\n\t/**\n\t * Handle author selection.\n\t *\n\t * @param {number} postAuthorId The selected Author.\n\t */\n\tconst handleSelect = ( postAuthorId ) => {\n\t\tif ( ! postAuthorId ) {\n\t\t\treturn;\n\t\t}\n\t\teditPost( { author: postAuthorId } );\n\t};\n\n\t/**\n\t * Handle user input.\n\t *\n\t * @param {string} inputValue The current value of the input field.\n\t */\n\tconst handleKeydown = ( inputValue ) => {\n\t\tsetFieldValue( inputValue );\n\t};\n\n\tif ( ! postAuthor ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ComboboxControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ __( 'Author' ) }\n\t\t\toptions={ authorOptions }\n\t\t\tvalue={ authorId }\n\t\t\tonFilterValueChange={ debounce( handleKeydown, 300 ) }\n\t\t\tonChange={ handleSelect }\n\t\t\tisLoading={ isLoading }\n\t\t\tallowReset={ false }\n\t\t/>\n\t);\n}\n\nexport default PostAuthorCombobox;\n"]}
@@ -17,7 +17,7 @@ const minimumUsersForCombobox = 25;
17
17
  function PostAuthor() {
18
18
  const showCombobox = useSelect(select => {
19
19
  const authors = select(coreStore).getUsers(AUTHORS_QUERY);
20
- return (authors === null || authors === void 0 ? void 0 : authors.length) >= minimumUsersForCombobox;
20
+ return authors?.length >= minimumUsersForCombobox;
21
21
  }, []);
22
22
 
23
23
  if (showCombobox) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-author/index.js"],"names":["useSelect","store","coreStore","PostAuthorCombobox","PostAuthorSelect","AUTHORS_QUERY","minimumUsersForCombobox","PostAuthor","showCombobox","select","authors","getUsers","length"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,kBAAP,MAA+B,YAA/B;AACA,OAAOC,gBAAP,MAA6B,UAA7B;AACA,SAASC,aAAT,QAA8B,aAA9B;AAEA,MAAMC,uBAAuB,GAAG,EAAhC;;AAEA,SAASC,UAAT,GAAsB;AACrB,QAAMC,YAAY,GAAGR,SAAS,CAAIS,MAAF,IAAc;AAC7C,UAAMC,OAAO,GAAGD,MAAM,CAAEP,SAAF,CAAN,CAAoBS,QAApB,CAA8BN,aAA9B,CAAhB;AAEA,WAAO,CAAAK,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO,CAAEE,MAAT,KAAmBN,uBAA1B;AACA,GAJ6B,EAI3B,EAJ2B,CAA9B;;AAMA,MAAKE,YAAL,EAAoB;AACnB,WAAO,cAAC,kBAAD,OAAP;AACA;;AACD,SAAO,cAAC,gBAAD,OAAP;AACA;;AAED,eAAeD,UAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostAuthorCombobox from './combobox';\nimport PostAuthorSelect from './select';\nimport { AUTHORS_QUERY } from './constants';\n\nconst minimumUsersForCombobox = 25;\n\nfunction PostAuthor() {\n\tconst showCombobox = useSelect( ( select ) => {\n\t\tconst authors = select( coreStore ).getUsers( AUTHORS_QUERY );\n\n\t\treturn authors?.length >= minimumUsersForCombobox;\n\t}, [] );\n\n\tif ( showCombobox ) {\n\t\treturn <PostAuthorCombobox />;\n\t}\n\treturn <PostAuthorSelect />;\n}\n\nexport default PostAuthor;\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-author/index.js"],"names":["useSelect","store","coreStore","PostAuthorCombobox","PostAuthorSelect","AUTHORS_QUERY","minimumUsersForCombobox","PostAuthor","showCombobox","select","authors","getUsers","length"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,kBAAP,MAA+B,YAA/B;AACA,OAAOC,gBAAP,MAA6B,UAA7B;AACA,SAASC,aAAT,QAA8B,aAA9B;AAEA,MAAMC,uBAAuB,GAAG,EAAhC;;AAEA,SAASC,UAAT,GAAsB;AACrB,QAAMC,YAAY,GAAGR,SAAS,CAAIS,MAAF,IAAc;AAC7C,UAAMC,OAAO,GAAGD,MAAM,CAAEP,SAAF,CAAN,CAAoBS,QAApB,CAA8BN,aAA9B,CAAhB;AAEA,WAAOK,OAAO,EAAEE,MAAT,IAAmBN,uBAA1B;AACA,GAJ6B,EAI3B,EAJ2B,CAA9B;;AAMA,MAAKE,YAAL,EAAoB;AACnB,WAAO,cAAC,kBAAD,OAAP;AACA;;AACD,SAAO,cAAC,gBAAD,OAAP;AACA;;AAED,eAAeD,UAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostAuthorCombobox from './combobox';\nimport PostAuthorSelect from './select';\nimport { AUTHORS_QUERY } from './constants';\n\nconst minimumUsersForCombobox = 25;\n\nfunction PostAuthor() {\n\tconst showCombobox = useSelect( ( select ) => {\n\t\tconst authors = select( coreStore ).getUsers( AUTHORS_QUERY );\n\n\t\treturn authors?.length >= minimumUsersForCombobox;\n\t}, [] );\n\n\tif ( showCombobox ) {\n\t\treturn <PostAuthorCombobox />;\n\t}\n\treturn <PostAuthorSelect />;\n}\n\nexport default PostAuthor;\n"]}
@@ -13,12 +13,10 @@ import { withSelect, withDispatch } from '@wordpress/data';
13
13
 
14
14
  import { store as editorStore } from '../../store';
15
15
 
16
- function PostComments(_ref) {
17
- let {
18
- commentStatus = 'open',
19
- ...props
20
- } = _ref;
21
-
16
+ function PostComments({
17
+ commentStatus = 'open',
18
+ ...props
19
+ }) {
22
20
  const onToggleComments = () => props.editPost({
23
21
  comment_status: commentStatus === 'open' ? 'closed' : 'open'
24
22
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-comments/index.js"],"names":["__","CheckboxControl","compose","withSelect","withDispatch","store","editorStore","PostComments","commentStatus","props","onToggleComments","editPost","comment_status","select","getEditedPostAttribute","dispatch"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,uBAAhC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;;AAEA,SAASC,YAAT,OAA8D;AAAA,MAAvC;AAAEC,IAAAA,aAAa,GAAG,MAAlB;AAA0B,OAAGC;AAA7B,GAAuC;;AAC7D,QAAMC,gBAAgB,GAAG,MACxBD,KAAK,CAACE,QAAN,CAAgB;AACfC,IAAAA,cAAc,EAAEJ,aAAa,KAAK,MAAlB,GAA2B,QAA3B,GAAsC;AADvC,GAAhB,CADD;;AAKA,SACC,cAAC,eAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAGR,EAAE,CAAE,gBAAF,CAFX;AAGC,IAAA,OAAO,EAAGQ,aAAa,KAAK,MAH7B;AAIC,IAAA,QAAQ,EAAGE;AAJZ,IADD;AAQA;;AAED,eAAeR,OAAO,CAAE,CACvBC,UAAU,CAAIU,MAAF,IAAc;AACzB,SAAO;AACNL,IAAAA,aAAa,EACZK,MAAM,CAAEP,WAAF,CAAN,CAAsBQ,sBAAtB,CACC,gBADD;AAFK,GAAP;AAMA,CAPS,CADa,EASvBV,YAAY,CAAIW,QAAF,KAAkB;AAC/BJ,EAAAA,QAAQ,EAAEI,QAAQ,CAAET,WAAF,CAAR,CAAwBK;AADH,CAAlB,CAAF,CATW,CAAF,CAAP,CAYVJ,YAZU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { CheckboxControl } from '@wordpress/components';\nimport { compose } from '@wordpress/compose';\nimport { withSelect, withDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction PostComments( { commentStatus = 'open', ...props } ) {\n\tconst onToggleComments = () =>\n\t\tprops.editPost( {\n\t\t\tcomment_status: commentStatus === 'open' ? 'closed' : 'open',\n\t\t} );\n\n\treturn (\n\t\t<CheckboxControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ __( 'Allow comments' ) }\n\t\t\tchecked={ commentStatus === 'open' }\n\t\t\tonChange={ onToggleComments }\n\t\t/>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\tcommentStatus:\n\t\t\t\tselect( editorStore ).getEditedPostAttribute(\n\t\t\t\t\t'comment_status'\n\t\t\t\t),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => ( {\n\t\teditPost: dispatch( editorStore ).editPost,\n\t} ) ),\n] )( PostComments );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-comments/index.js"],"names":["__","CheckboxControl","compose","withSelect","withDispatch","store","editorStore","PostComments","commentStatus","props","onToggleComments","editPost","comment_status","select","getEditedPostAttribute","dispatch"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,uBAAhC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;;AAEA,SAASC,YAAT,CAAuB;AAAEC,EAAAA,aAAa,GAAG,MAAlB;AAA0B,KAAGC;AAA7B,CAAvB,EAA8D;AAC7D,QAAMC,gBAAgB,GAAG,MACxBD,KAAK,CAACE,QAAN,CAAgB;AACfC,IAAAA,cAAc,EAAEJ,aAAa,KAAK,MAAlB,GAA2B,QAA3B,GAAsC;AADvC,GAAhB,CADD;;AAKA,SACC,cAAC,eAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAGR,EAAE,CAAE,gBAAF,CAFX;AAGC,IAAA,OAAO,EAAGQ,aAAa,KAAK,MAH7B;AAIC,IAAA,QAAQ,EAAGE;AAJZ,IADD;AAQA;;AAED,eAAeR,OAAO,CAAE,CACvBC,UAAU,CAAIU,MAAF,IAAc;AACzB,SAAO;AACNL,IAAAA,aAAa,EACZK,MAAM,CAAEP,WAAF,CAAN,CAAsBQ,sBAAtB,CACC,gBADD;AAFK,GAAP;AAMA,CAPS,CADa,EASvBV,YAAY,CAAIW,QAAF,KAAkB;AAC/BJ,EAAAA,QAAQ,EAAEI,QAAQ,CAAET,WAAF,CAAR,CAAwBK;AADH,CAAlB,CAAF,CATW,CAAF,CAAP,CAYVJ,YAZU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { CheckboxControl } from '@wordpress/components';\nimport { compose } from '@wordpress/compose';\nimport { withSelect, withDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction PostComments( { commentStatus = 'open', ...props } ) {\n\tconst onToggleComments = () =>\n\t\tprops.editPost( {\n\t\t\tcomment_status: commentStatus === 'open' ? 'closed' : 'open',\n\t\t} );\n\n\treturn (\n\t\t<CheckboxControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ __( 'Allow comments' ) }\n\t\t\tchecked={ commentStatus === 'open' }\n\t\t\tonChange={ onToggleComments }\n\t\t/>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\tcommentStatus:\n\t\t\t\tselect( editorStore ).getEditedPostAttribute(\n\t\t\t\t\t'comment_status'\n\t\t\t\t),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => ( {\n\t\teditPost: dispatch( editorStore ).editPost,\n\t} ) ),\n] )( PostComments );\n"]}
@@ -13,11 +13,10 @@ import { compose } from '@wordpress/compose';
13
13
 
14
14
  import { store as editorStore } from '../../store';
15
15
 
16
- function PostExcerpt(_ref) {
17
- let {
18
- excerpt,
19
- onUpdateExcerpt
20
- } = _ref;
16
+ function PostExcerpt({
17
+ excerpt,
18
+ onUpdateExcerpt
19
+ }) {
21
20
  return createElement("div", {
22
21
  className: "editor-post-excerpt"
23
22
  }, createElement(TextareaControl, {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-excerpt/index.js"],"names":["__","ExternalLink","TextareaControl","withSelect","withDispatch","compose","store","editorStore","PostExcerpt","excerpt","onUpdateExcerpt","value","select","getEditedPostAttribute","dispatch","editPost"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,YAAT,EAAuBC,eAAvB,QAA8C,uBAA9C;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;;AAEA,SAASC,WAAT,OAAqD;AAAA,MAA/B;AAAEC,IAAAA,OAAF;AAAWC,IAAAA;AAAX,GAA+B;AACpD,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,eAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAGV,EAAE,CAAE,6BAAF,CAFX;AAGC,IAAA,SAAS,EAAC,+BAHX;AAIC,IAAA,QAAQ,EAAKW,KAAF,IAAaD,eAAe,CAAEC,KAAF,CAJxC;AAKC,IAAA,KAAK,EAAGF;AALT,IADD,EAQC,cAAC,YAAD;AACC,IAAA,IAAI,EAAGT,EAAE,CACR,iFADQ;AADV,KAKGA,EAAE,CAAE,kCAAF,CALL,CARD,CADD;AAkBA;;AAED,eAAeK,OAAO,CAAE,CACvBF,UAAU,CAAIS,MAAF,IAAc;AACzB,SAAO;AACNH,IAAAA,OAAO,EAAEG,MAAM,CAAEL,WAAF,CAAN,CAAsBM,sBAAtB,CAA8C,SAA9C;AADH,GAAP;AAGA,CAJS,CADa,EAMvBT,YAAY,CAAIU,QAAF,KAAkB;AAC/BJ,EAAAA,eAAe,CAAED,OAAF,EAAY;AAC1BK,IAAAA,QAAQ,CAAEP,WAAF,CAAR,CAAwBQ,QAAxB,CAAkC;AAAEN,MAAAA;AAAF,KAAlC;AACA;;AAH8B,CAAlB,CAAF,CANW,CAAF,CAAP,CAWVD,WAXU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ExternalLink, TextareaControl } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction PostExcerpt( { excerpt, onUpdateExcerpt } ) {\n\treturn (\n\t\t<div className=\"editor-post-excerpt\">\n\t\t\t<TextareaControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Write an excerpt (optional)' ) }\n\t\t\t\tclassName=\"editor-post-excerpt__textarea\"\n\t\t\t\tonChange={ ( value ) => onUpdateExcerpt( value ) }\n\t\t\t\tvalue={ excerpt }\n\t\t\t/>\n\t\t\t<ExternalLink\n\t\t\t\thref={ __(\n\t\t\t\t\t'https://wordpress.org/documentation/article/page-post-settings-sidebar/#excerpt'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t{ __( 'Learn more about manual excerpts' ) }\n\t\t\t</ExternalLink>\n\t\t</div>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\texcerpt: select( editorStore ).getEditedPostAttribute( 'excerpt' ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => ( {\n\t\tonUpdateExcerpt( excerpt ) {\n\t\t\tdispatch( editorStore ).editPost( { excerpt } );\n\t\t},\n\t} ) ),\n] )( PostExcerpt );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-excerpt/index.js"],"names":["__","ExternalLink","TextareaControl","withSelect","withDispatch","compose","store","editorStore","PostExcerpt","excerpt","onUpdateExcerpt","value","select","getEditedPostAttribute","dispatch","editPost"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,YAAT,EAAuBC,eAAvB,QAA8C,uBAA9C;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;;AAEA,SAASC,WAAT,CAAsB;AAAEC,EAAAA,OAAF;AAAWC,EAAAA;AAAX,CAAtB,EAAqD;AACpD,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,eAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAGV,EAAE,CAAE,6BAAF,CAFX;AAGC,IAAA,SAAS,EAAC,+BAHX;AAIC,IAAA,QAAQ,EAAKW,KAAF,IAAaD,eAAe,CAAEC,KAAF,CAJxC;AAKC,IAAA,KAAK,EAAGF;AALT,IADD,EAQC,cAAC,YAAD;AACC,IAAA,IAAI,EAAGT,EAAE,CACR,iFADQ;AADV,KAKGA,EAAE,CAAE,kCAAF,CALL,CARD,CADD;AAkBA;;AAED,eAAeK,OAAO,CAAE,CACvBF,UAAU,CAAIS,MAAF,IAAc;AACzB,SAAO;AACNH,IAAAA,OAAO,EAAEG,MAAM,CAAEL,WAAF,CAAN,CAAsBM,sBAAtB,CAA8C,SAA9C;AADH,GAAP;AAGA,CAJS,CADa,EAMvBT,YAAY,CAAIU,QAAF,KAAkB;AAC/BJ,EAAAA,eAAe,CAAED,OAAF,EAAY;AAC1BK,IAAAA,QAAQ,CAAEP,WAAF,CAAR,CAAwBQ,QAAxB,CAAkC;AAAEN,MAAAA;AAAF,KAAlC;AACA;;AAH8B,CAAlB,CAAF,CANW,CAAF,CAAP,CAWVD,WAXU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ExternalLink, TextareaControl } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction PostExcerpt( { excerpt, onUpdateExcerpt } ) {\n\treturn (\n\t\t<div className=\"editor-post-excerpt\">\n\t\t\t<TextareaControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Write an excerpt (optional)' ) }\n\t\t\t\tclassName=\"editor-post-excerpt__textarea\"\n\t\t\t\tonChange={ ( value ) => onUpdateExcerpt( value ) }\n\t\t\t\tvalue={ excerpt }\n\t\t\t/>\n\t\t\t<ExternalLink\n\t\t\t\thref={ __(\n\t\t\t\t\t'https://wordpress.org/documentation/article/page-post-settings-sidebar/#excerpt'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t{ __( 'Learn more about manual excerpts' ) }\n\t\t\t</ExternalLink>\n\t\t</div>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\texcerpt: select( editorStore ).getEditedPostAttribute( 'excerpt' ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => ( {\n\t\tonUpdateExcerpt( excerpt ) {\n\t\t\tdispatch( editorStore ).editPost( { excerpt } );\n\t\t},\n\t} ) ),\n] )( PostExcerpt );\n"]}
@@ -27,7 +27,7 @@ const DEFAULT_SET_FEATURE_IMAGE_LABEL = __('Set featured image');
27
27
  const instructions = createElement("p", null, __('To edit the featured image, you need permission to upload media.'));
28
28
 
29
29
  function getMediaDetails(media, postId) {
30
- var _media$media_details$, _media$media_details, _media$media_details$2, _media$media_details2;
30
+ var _media$media_details$, _media$media_details$2;
31
31
 
32
32
  if (!media) {
33
33
  return {};
@@ -35,7 +35,7 @@ function getMediaDetails(media, postId) {
35
35
 
36
36
  const defaultSize = applyFilters('editor.PostFeaturedImage.imageSize', 'large', media.id, postId);
37
37
 
38
- if (defaultSize in ((_media$media_details$ = media === null || media === void 0 ? void 0 : (_media$media_details = media.media_details) === null || _media$media_details === void 0 ? void 0 : _media$media_details.sizes) !== null && _media$media_details$ !== void 0 ? _media$media_details$ : {})) {
38
+ if (defaultSize in ((_media$media_details$ = media?.media_details?.sizes) !== null && _media$media_details$ !== void 0 ? _media$media_details$ : {})) {
39
39
  return {
40
40
  mediaWidth: media.media_details.sizes[defaultSize].width,
41
41
  mediaHeight: media.media_details.sizes[defaultSize].height,
@@ -46,7 +46,7 @@ function getMediaDetails(media, postId) {
46
46
 
47
47
  const fallbackSize = applyFilters('editor.PostFeaturedImage.imageSize', 'thumbnail', media.id, postId);
48
48
 
49
- if (fallbackSize in ((_media$media_details$2 = media === null || media === void 0 ? void 0 : (_media$media_details2 = media.media_details) === null || _media$media_details2 === void 0 ? void 0 : _media$media_details2.sizes) !== null && _media$media_details$2 !== void 0 ? _media$media_details$2 : {})) {
49
+ if (fallbackSize in ((_media$media_details$2 = media?.media_details?.sizes) !== null && _media$media_details$2 !== void 0 ? _media$media_details$2 : {})) {
50
50
  return {
51
51
  mediaWidth: media.media_details.sizes[fallbackSize].width,
52
52
  mediaHeight: media.media_details.sizes[fallbackSize].height,
@@ -62,19 +62,16 @@ function getMediaDetails(media, postId) {
62
62
  };
63
63
  }
64
64
 
65
- function PostFeaturedImage(_ref) {
66
- var _media$media_details$3, _media$media_details$4, _postType$labels;
67
-
68
- let {
69
- currentPostId,
70
- featuredImageId,
71
- onUpdateImage,
72
- onRemoveImage,
73
- media,
74
- postType,
75
- noticeUI,
76
- noticeOperations
77
- } = _ref;
65
+ function PostFeaturedImage({
66
+ currentPostId,
67
+ featuredImageId,
68
+ onUpdateImage,
69
+ onRemoveImage,
70
+ media,
71
+ postType,
72
+ noticeUI,
73
+ noticeOperations
74
+ }) {
78
75
  const toggleRef = useRef();
79
76
  const [isLoading, setIsLoading] = useState(false);
80
77
  const mediaUpload = useSelect(select => {
@@ -91,10 +88,8 @@ function PostFeaturedImage(_ref) {
91
88
  allowedTypes: ['image'],
92
89
  filesList,
93
90
 
94
- onFileChange(_ref2) {
95
- let [image] = _ref2;
96
-
97
- if (isBlobURL(image === null || image === void 0 ? void 0 : image.url)) {
91
+ onFileChange([image]) {
92
+ if (isBlobURL(image?.url)) {
98
93
  setIsLoading(true);
99
94
  return;
100
95
  }
@@ -118,52 +113,47 @@ function PostFeaturedImage(_ref) {
118
113
  className: "hidden"
119
114
  }, media.alt_text && sprintf( // Translators: %s: The selected image alt text.
120
115
  __('Current image: %s'), media.alt_text), !media.alt_text && sprintf( // Translators: %s: The selected image filename.
121
- __('The current image has no alternative text. The file name is: %s'), ((_media$media_details$3 = media.media_details.sizes) === null || _media$media_details$3 === void 0 ? void 0 : (_media$media_details$4 = _media$media_details$3.full) === null || _media$media_details$4 === void 0 ? void 0 : _media$media_details$4.file) || media.slug)), createElement(MediaUploadCheck, {
116
+ __('The current image has no alternative text. The file name is: %s'), media.media_details.sizes?.full?.file || media.slug)), createElement(MediaUploadCheck, {
122
117
  fallback: instructions
123
118
  }, createElement(MediaUpload, {
124
- title: (postType === null || postType === void 0 ? void 0 : (_postType$labels = postType.labels) === null || _postType$labels === void 0 ? void 0 : _postType$labels.featured_image) || DEFAULT_FEATURE_IMAGE_LABEL,
119
+ title: postType?.labels?.featured_image || DEFAULT_FEATURE_IMAGE_LABEL,
125
120
  onSelect: onUpdateImage,
126
121
  unstableFeaturedImageFlow: true,
127
122
  allowedTypes: ALLOWED_MEDIA_TYPES,
128
123
  modalClass: "editor-post-featured-image__media-modal",
129
- render: _ref3 => {
130
- var _postType$labels2;
131
-
132
- let {
133
- open
134
- } = _ref3;
135
- return createElement("div", {
136
- className: "editor-post-featured-image__container"
137
- }, createElement(Button, {
138
- ref: toggleRef,
139
- className: !featuredImageId ? 'editor-post-featured-image__toggle' : 'editor-post-featured-image__preview',
140
- onClick: open,
141
- "aria-label": !featuredImageId ? null : __('Edit or replace the image'),
142
- "aria-describedby": !featuredImageId ? null : `editor-post-featured-image-${featuredImageId}-describedby`
143
- }, !!featuredImageId && media && createElement(ResponsiveWrapper, {
144
- naturalWidth: mediaWidth,
145
- naturalHeight: mediaHeight,
146
- isInline: true
147
- }, createElement("img", {
148
- src: mediaSourceUrl,
149
- alt: ""
150
- })), isLoading && createElement(Spinner, null), !featuredImageId && !isLoading && ((postType === null || postType === void 0 ? void 0 : (_postType$labels2 = postType.labels) === null || _postType$labels2 === void 0 ? void 0 : _postType$labels2.set_featured_image) || DEFAULT_SET_FEATURE_IMAGE_LABEL)), !!featuredImageId && createElement(HStack, {
151
- className: "editor-post-featured-image__actions"
152
- }, createElement(Button, {
153
- className: "editor-post-featured-image__action",
154
- onClick: open // Prefer that screen readers use the .editor-post-featured-image__preview button.
155
- ,
156
- "aria-hidden": "true"
157
- }, __('Replace')), createElement(Button, {
158
- className: "editor-post-featured-image__action",
159
- onClick: () => {
160
- onRemoveImage();
161
- toggleRef.current.focus();
162
- }
163
- }, __('Remove'))), createElement(DropZone, {
164
- onFilesDrop: onDropFiles
165
- }));
166
- },
124
+ render: ({
125
+ open
126
+ }) => createElement("div", {
127
+ className: "editor-post-featured-image__container"
128
+ }, createElement(Button, {
129
+ ref: toggleRef,
130
+ className: !featuredImageId ? 'editor-post-featured-image__toggle' : 'editor-post-featured-image__preview',
131
+ onClick: open,
132
+ "aria-label": !featuredImageId ? null : __('Edit or replace the image'),
133
+ "aria-describedby": !featuredImageId ? null : `editor-post-featured-image-${featuredImageId}-describedby`
134
+ }, !!featuredImageId && media && createElement(ResponsiveWrapper, {
135
+ naturalWidth: mediaWidth,
136
+ naturalHeight: mediaHeight,
137
+ isInline: true
138
+ }, createElement("img", {
139
+ src: mediaSourceUrl,
140
+ alt: ""
141
+ })), isLoading && createElement(Spinner, null), !featuredImageId && !isLoading && (postType?.labels?.set_featured_image || DEFAULT_SET_FEATURE_IMAGE_LABEL)), !!featuredImageId && createElement(HStack, {
142
+ className: "editor-post-featured-image__actions"
143
+ }, createElement(Button, {
144
+ className: "editor-post-featured-image__action",
145
+ onClick: open // Prefer that screen readers use the .editor-post-featured-image__preview button.
146
+ ,
147
+ "aria-hidden": "true"
148
+ }, __('Replace')), createElement(Button, {
149
+ className: "editor-post-featured-image__action",
150
+ onClick: () => {
151
+ onRemoveImage();
152
+ toggleRef.current.focus();
153
+ }
154
+ }, __('Remove'))), createElement(DropZone, {
155
+ onFilesDrop: onDropFiles
156
+ })),
167
157
  value: featuredImageId
168
158
  }))));
169
159
  }
@@ -187,13 +177,11 @@ const applyWithSelect = withSelect(select => {
187
177
  featuredImageId
188
178
  };
189
179
  });
190
- const applyWithDispatch = withDispatch((dispatch, _ref4, _ref5) => {
191
- let {
192
- noticeOperations
193
- } = _ref4;
194
- let {
195
- select
196
- } = _ref5;
180
+ const applyWithDispatch = withDispatch((dispatch, {
181
+ noticeOperations
182
+ }, {
183
+ select
184
+ }) => {
197
185
  const {
198
186
  editPost
199
187
  } = dispatch(editorStore);
@@ -209,8 +197,7 @@ const applyWithDispatch = withDispatch((dispatch, _ref4, _ref5) => {
209
197
  allowedTypes: ['image'],
210
198
  filesList,
211
199
 
212
- onFileChange(_ref6) {
213
- let [image] = _ref6;
200
+ onFileChange([image]) {
214
201
  editPost({
215
202
  featured_media: image.id
216
203
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-featured-image/index.js"],"names":["__","sprintf","applyFilters","DropZone","Button","Spinner","ResponsiveWrapper","withNotices","withFilters","__experimentalHStack","HStack","isBlobURL","useState","useRef","compose","useSelect","withDispatch","withSelect","MediaUpload","MediaUploadCheck","store","blockEditorStore","coreStore","PostFeaturedImageCheck","editorStore","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","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","getCurrentPostId","getEditedPostAttribute","context","applyWithDispatch","dispatch","editPost","featured_media","onDropImage"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,YAAT,QAA6B,kBAA7B;AACA,SACCC,QADD,EAECC,MAFD,EAGCC,OAHD,EAICC,iBAJD,EAKCC,WALD,EAMCC,WAND,EAOCC,oBAAoB,IAAIC,MAPzB,QAQO,uBARP;AASA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,QAAT,EAAmBC,MAAnB,QAAiC,oBAAjC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,SAAT,EAAoBC,YAAp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AAEe,KAAF,EAAU;AACtBwB,MAAAA,QAAQ,CAAE;AAAEC,QAAAA,cAAc,EAAEzB,KAAK,CAAC5B;AAAxB,OAAF,CAAR;AACA,KAHK;;AAINsD,IAAAA,WAAW,CAAE7B,SAAF,EAAc;AACxBH,MAAAA,MAAM,CAAElC,gBAAF,CAAN,CACEmC,WADF,GAEEF,WAFF,CAEe;AACbK,QAAAA,YAAY,EAAE,CAAE,OAAF,CADD;AAEbD,QAAAA,SAFa;;AAGbE,QAAAA,YAAY,QAAc;AAAA,cAAZ,CAAEC,KAAF,CAAY;AACzBwB,UAAAA,QAAQ,CAAE;AAAEC,YAAAA,cAAc,EAAEzB,KAAK,CAAC5B;AAAxB,WAAF,CAAR;AACA,SALY;;AAMb8B,QAAAA,OAAO,CAAEC,OAAF,EAAY;AAClBd,UAAAA,gBAAgB,CAACe,gBAAjB;AACAf,UAAAA,gBAAgB,CAACgB,iBAAjB,CAAoCF,OAApC;AACA;;AATY,OAFf;AAaA,KAlBK;;AAmBNjB,IAAAA,aAAa,GAAG;AACfsC,MAAAA,QAAQ,CAAE;AAAEC,QAAAA,cAAc,EAAE;AAAlB,OAAF,CAAR;AACA;;AArBK,GAAP;AAuBA,CA1BoC,CAAtC;AA6BA,eAAexE,OAAO,CACrBP,WADqB,EAErBsE,eAFqB,EAGrBM,iBAHqB,EAIrB3E,WAAW,CAAE,0BAAF,CAJU,CAAP,CAKZmC,iBALY,CAAf","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,"sources":["@wordpress/editor/src/components/post-featured-image/index.js"],"names":["__","sprintf","applyFilters","DropZone","Button","Spinner","ResponsiveWrapper","withNotices","withFilters","__experimentalHStack","HStack","isBlobURL","useState","useRef","compose","useSelect","withDispatch","withSelect","MediaUpload","MediaUploadCheck","store","blockEditorStore","coreStore","PostFeaturedImageCheck","editorStore","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","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","getCurrentPostId","getEditedPostAttribute","context","applyWithDispatch","dispatch","editPost","featured_media","onDropImage"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,YAAT,QAA6B,kBAA7B;AACA,SACCC,QADD,EAECC,MAFD,EAGCC,OAHD,EA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AAAA,cAAc,EAAEzB,KAAK,CAAC5B;AAAxB,OAAF,CAAR;AACA,KAHK;;AAINsD,IAAAA,WAAW,CAAE7B,SAAF,EAAc;AACxBH,MAAAA,MAAM,CAAElC,gBAAF,CAAN,CACEmC,WADF,GAEEF,WAFF,CAEe;AACbK,QAAAA,YAAY,EAAE,CAAE,OAAF,CADD;AAEbD,QAAAA,SAFa;;AAGbE,QAAAA,YAAY,CAAE,CAAEC,KAAF,CAAF,EAAc;AACzBwB,UAAAA,QAAQ,CAAE;AAAEC,YAAAA,cAAc,EAAEzB,KAAK,CAAC5B;AAAxB,WAAF,CAAR;AACA,SALY;;AAMb8B,QAAAA,OAAO,CAAEC,OAAF,EAAY;AAClBd,UAAAA,gBAAgB,CAACe,gBAAjB;AACAf,UAAAA,gBAAgB,CAACgB,iBAAjB,CAAoCF,OAApC;AACA;;AATY,OAFf;AAaA,KAlBK;;AAmBNjB,IAAAA,aAAa,GAAG;AACfsC,MAAAA,QAAQ,CAAE;AAAEC,QAAAA,cAAc,EAAE;AAAlB,OAAF,CAAR;AACA;;AArBK,GAAP;AAuBA,CA1BoC,CAAtC;AA6BA,eAAexE,OAAO,CACrBP,WADqB,EAErBsE,eAFqB,EAGrBM,iBAHqB,EAIrB3E,WAAW,CAAE,0BAAF,CAJU,CAAP,CAKZmC,iBALY,CAAf","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"]}
@@ -12,11 +12,10 @@ import { withSelect } from '@wordpress/data';
12
12
  import PostTypeSupportCheck from '../post-type-support-check';
13
13
  import { store as editorStore } from '../../store';
14
14
 
15
- function PostFormatCheck(_ref) {
16
- let {
17
- disablePostFormats,
18
- ...props
19
- } = _ref;
15
+ function PostFormatCheck({
16
+ disablePostFormats,
17
+ ...props
18
+ }) {
20
19
  return !disablePostFormats && createElement(PostTypeSupportCheck, _extends({}, props, {
21
20
  supportKeys: "post-formats"
22
21
  }));
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-format/check.js"],"names":["withSelect","PostTypeSupportCheck","store","editorStore","PostFormatCheck","disablePostFormats","props","select","editorSettings","getEditorSettings"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,UAAT,QAA2B,iBAA3B;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,4BAAjC;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;;AAEA,SAASC,eAAT,OAA6D;AAAA,MAAnC;AAAEC,IAAAA,kBAAF;AAAsB,OAAGC;AAAzB,GAAmC;AAC5D,SACC,CAAED,kBAAF,IACC,cAAC,oBAAD,eAA2BC,KAA3B;AAAmC,IAAA,WAAW,EAAC;AAA/C,KAFF;AAKA;;AAED,eAAeN,UAAU,CAAIO,MAAF,IAAc;AACxC,QAAMC,cAAc,GAAGD,MAAM,CAAEJ,WAAF,CAAN,CAAsBM,iBAAtB,EAAvB;AACA,SAAO;AACNJ,IAAAA,kBAAkB,EAAEG,cAAc,CAACH;AAD7B,GAAP;AAGA,CALwB,CAAV,CAKVD,eALU,CAAf","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,"sources":["@wordpress/editor/src/components/post-format/check.js"],"names":["withSelect","PostTypeSupportCheck","store","editorStore","PostFormatCheck","disablePostFormats","props","select","editorSettings","getEditorSettings"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,UAAT,QAA2B,iBAA3B;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,4BAAjC;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;;AAEA,SAASC,eAAT,CAA0B;AAAEC,EAAAA,kBAAF;AAAsB,KAAGC;AAAzB,CAA1B,EAA6D;AAC5D,SACC,CAAED,kBAAF,IACC,cAAC,oBAAD,eAA2BC,KAA3B;AAAmC,IAAA,WAAW,EAAC;AAA/C,KAFF;AAKA;;AAED,eAAeN,UAAU,CAAIO,MAAF,IAAc;AACxC,QAAMC,cAAc,GAAGD,MAAM,CAAEJ,WAAF,CAAN,CAAsBM,iBAAtB,EAAvB;AACA,SAAO;AACNJ,IAAAA,kBAAkB,EAAEG,cAAc,CAACH;AAD7B,GAAP;AAGA,CALwB,CAAV,CAKVD,eALU,CAAf","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"]}
@@ -84,7 +84,7 @@ export default function PostFormat() {
84
84
  const formats = POST_FORMATS.filter(format => {
85
85
  // Ensure current format is always in the set.
86
86
  // The current format may not be a format supported by the theme.
87
- return (supportedFormats === null || supportedFormats === void 0 ? void 0 : supportedFormats.includes(format.id)) || postFormat === format.id;
87
+ return supportedFormats?.includes(format.id) || postFormat === format.id;
88
88
  });
89
89
  const suggestion = formats.find(format => format.id === suggestedFormat);
90
90
  const {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-format/index.js"],"names":["__","sprintf","Button","SelectControl","useDispatch","useSelect","useInstanceId","store","coreStore","PostFormatCheck","editorStore","POST_FORMATS","id","caption","sort","a","b","normalizedA","toUpperCase","normalizedB","PostFormat","instanceId","postFormatSelectorId","postFormat","suggestedFormat","supportedFormats","select","getEditedPostAttribute","getSuggestedPostFormat","_postFormat","themeSupports","getThemeSupports","formats","filter","format","includes","suggestion","find","editPost","onUpdatePostFormat","map","label","value"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,MAAT,EAAiBC,aAAjB,QAAsC,uBAAtC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,eAAP,MA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ACtB,EAAP,KAAcY,eADV,CAAnB;AAIA,QAAM;AAAEc,IAAAA;AAAF,MAAelC,WAAW,CAAEM,WAAF,CAAhC;;AAEA,QAAM6B,kBAAkB,GAAKL,MAAF,IAAcI,QAAQ,CAAE;AAAEJ,IAAAA;AAAF,GAAF,CAAjD;;AAEA,SACC,cAAC,eAAD,QACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,aAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAGlC,EAAE,CAAE,aAAF,CAFX;AAGC,IAAA,KAAK,EAAGuB,UAHT;AAIC,IAAA,QAAQ,EAAKW,MAAF,IAAcK,kBAAkB,CAAEL,MAAF,CAJ5C;AAKC,IAAA,EAAE,EAAGZ,oBALN;AAMC,IAAA,OAAO,EAAGU,OAAO,CAACQ,GAAR,CAAeN,MAAF,KAAgB;AACtCO,MAAAA,KAAK,EAAEP,MAAM,CAACrB,OADwB;AAEtC6B,MAAAA,KAAK,EAAER,MAAM,CAACtB;AAFwB,KAAhB,CAAb;AANX,IADD,EAYGwB,UAAU,IAAIA,UAAU,CAACxB,EAAX,KAAkBW,UAAhC,IACD;AAAG,IAAA,SAAS,EAAC;AAAb,KACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,MADT;AAEC,IAAA,OAAO,EAAG,MACTgB,kBAAkB,CAAEH,UAAU,CAACxB,EAAb;AAHpB,KAMGX,OAAO;AACR;AACAD,EAAAA,EAAE,CAAE,4BAAF,CAFM,EAGRoC,UAAU,CAACvB,OAHH,CANV,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,"sources":["@wordpress/editor/src/components/post-format/index.js"],"names":["__","sprintf","Button","SelectControl","useDispatch","useSelect","useInstanceId","store","coreStore","PostFormatCheck","editorStore","POST_FORMATS","id","caption","sort","a","b","normalizedA","toUpperCase","normalizedB","PostFormat","instanceId","postFormatSelectorId","postFormat","suggestedFormat","supportedFormats","select","getEditedPostAttribute","getSuggestedPostFormat","_postFormat","themeSupports","getThemeSupports","formats","filter","format","includes","suggestion","find","editPost","onUpdatePostFormat","map","label","value"],"mappings":";;AAAA;AACA;AACA;AACA,S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@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"]}