@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
@@ -19,13 +19,10 @@ var _store = require("../../store");
19
19
  /**
20
20
  * Internal dependencies
21
21
  */
22
- function PageAttributesCheck(_ref) {
23
- let {
24
- children
25
- } = _ref;
22
+ function PageAttributesCheck({
23
+ children
24
+ }) {
26
25
  const supportsPageAttributes = (0, _data.useSelect)(select => {
27
- var _postType$supports;
28
-
29
26
  const {
30
27
  getEditedPostAttribute
31
28
  } = select(_store.store);
@@ -33,7 +30,7 @@ function PageAttributesCheck(_ref) {
33
30
  getPostType
34
31
  } = select(_coreData.store);
35
32
  const postType = getPostType(getEditedPostAttribute('type'));
36
- return !!(postType !== null && postType !== void 0 && (_postType$supports = postType.supports) !== null && _postType$supports !== void 0 && _postType$supports['page-attributes']);
33
+ return !!postType?.supports?.['page-attributes'];
37
34
  }, []); // Only render fields if post type supports page attributes or available templates exist.
38
35
 
39
36
  if (!supportsPageAttributes) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/page-attributes/check.js"],"names":["PageAttributesCheck","children","supportsPageAttributes","select","getEditedPostAttribute","editorStore","getPostType","coreStore","postType","supports"],"mappings":";;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGO,SAASA,mBAAT,OAA6C;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACnD,QAAMC,sBAAsB,GAAG,qBAAaC,MAAF,IAAc;AAAA;;AACvD,UAAM;AAAEC,MAAAA;AAAF,QAA6BD,MAAM,CAAEE,YAAF,CAAzC;AACA,UAAM;AAAEC,MAAAA;AAAF,QAAkBH,MAAM,CAAEI,eAAF,CAA9B;AACA,UAAMC,QAAQ,GAAGF,WAAW,CAAEF,sBAAsB,CAAE,MAAF,CAAxB,CAA5B;AAEA,WAAO,CAAC,EAAEI,QAAF,aAAEA,QAAF,qCAAEA,QAAQ,CAAEC,QAAZ,+CAAE,mBAAsB,iBAAtB,CAAF,CAAR;AACA,GAN8B,EAM5B,EAN4B,CAA/B,CADmD,CASnD;;AACA,MAAK,CAAEP,sBAAP,EAAgC;AAC/B,WAAO,IAAP;AACA;;AAED,SAAOD,QAAP;AACA;;eAEcD,mB","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 { store as editorStore } from '../../store';\n\nexport function PageAttributesCheck( { children } ) {\n\tconst supportsPageAttributes = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\tconst postType = getPostType( getEditedPostAttribute( 'type' ) );\n\n\t\treturn !! postType?.supports?.[ 'page-attributes' ];\n\t}, [] );\n\n\t// Only render fields if post type supports page attributes or available templates exist.\n\tif ( ! supportsPageAttributes ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default PageAttributesCheck;\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/page-attributes/check.js"],"names":["PageAttributesCheck","children","supportsPageAttributes","select","getEditedPostAttribute","editorStore","getPostType","coreStore","postType","supports"],"mappings":";;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGO,SAASA,mBAAT,CAA8B;AAAEC,EAAAA;AAAF,CAA9B,EAA6C;AACnD,QAAMC,sBAAsB,GAAG,qBAAaC,MAAF,IAAc;AACvD,UAAM;AAAEC,MAAAA;AAAF,QAA6BD,MAAM,CAAEE,YAAF,CAAzC;AACA,UAAM;AAAEC,MAAAA;AAAF,QAAkBH,MAAM,CAAEI,eAAF,CAA9B;AACA,UAAMC,QAAQ,GAAGF,WAAW,CAAEF,sBAAsB,CAAE,MAAF,CAAxB,CAA5B;AAEA,WAAO,CAAC,CAAEI,QAAQ,EAAEC,QAAV,GAAsB,iBAAtB,CAAV;AACA,GAN8B,EAM5B,EAN4B,CAA/B,CADmD,CASnD;;AACA,MAAK,CAAEP,sBAAP,EAAgC;AAC/B,WAAO,IAAP;AACA;;AAED,SAAOD,QAAP;AACA;;eAEcD,mB","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 { store as editorStore } from '../../store';\n\nexport function PageAttributesCheck( { children } ) {\n\tconst supportsPageAttributes = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\tconst postType = getPostType( getEditedPostAttribute( 'type' ) );\n\n\t\treturn !! postType?.supports?.[ 'page-attributes' ];\n\t}, [] );\n\n\t// Only render fields if post type supports page attributes or available templates exist.\n\tif ( ! supportsPageAttributes ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default PageAttributesCheck;\n"]}
@@ -28,20 +28,17 @@ var _store = require("../../store");
28
28
  /**
29
29
  * Internal dependencies
30
30
  */
31
- const PageAttributesOrder = _ref => {
32
- let {
33
- onUpdateOrder,
34
- order = 0
35
- } = _ref;
31
+ const PageAttributesOrder = ({
32
+ onUpdateOrder,
33
+ order = 0
34
+ }) => {
36
35
  const [orderInput, setOrderInput] = (0, _element.useState)(null);
37
36
 
38
37
  const setUpdatedOrder = value => {
39
- var _value$trim;
40
-
41
38
  setOrderInput(value);
42
39
  const newOrder = Number(value);
43
40
 
44
- if (Number.isInteger(newOrder) && ((_value$trim = value.trim) === null || _value$trim === void 0 ? void 0 : _value$trim.call(value)) !== '') {
41
+ if (Number.isInteger(newOrder) && value.trim?.() !== '') {
45
42
  onUpdateOrder(Number(value));
46
43
  }
47
44
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/page-attributes/order.js"],"names":["PageAttributesOrder","onUpdateOrder","order","orderInput","setOrderInput","setUpdatedOrder","value","newOrder","Number","isInteger","trim","PageAttributesOrderWithChecks","props","select","editorStore","getEditedPostAttribute","dispatch","editPost","menu_order"],"mappings":";;;;;;;;;AAWA;;AARA;;AACA;;AAKA;;AACA;;AAMA;;A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AGA,CAJD,CADuB,EAMvB,wBAAgBC,QAAF,KAAkB;AAC/Bf,EAAAA,aAAa,CAAEC,KAAF,EAAU;AACtBc,IAAAA,QAAQ,CAAEF,YAAF,CAAR,CAAwBG,QAAxB,CAAkC;AACjCC,MAAAA,UAAU,EAAEhB;AADqB,KAAlC;AAGA;;AAL8B,CAAlB,CAAd,CANuB,CAAT,EAaVS,6BAbU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tFlex,\n\tFlexBlock,\n\t__experimentalNumberControl as NumberControl,\n} from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\n\nexport const PageAttributesOrder = ( { onUpdateOrder, order = 0 } ) => {\n\tconst [ orderInput, setOrderInput ] = useState( null );\n\n\tconst setUpdatedOrder = ( value ) => {\n\t\tsetOrderInput( value );\n\t\tconst newOrder = Number( value );\n\t\tif ( Number.isInteger( newOrder ) && value.trim?.() !== '' ) {\n\t\t\tonUpdateOrder( Number( value ) );\n\t\t}\n\t};\n\tconst value = orderInput === null ? order : orderInput;\n\treturn (\n\t\t<Flex>\n\t\t\t<FlexBlock>\n\t\t\t\t<NumberControl\n\t\t\t\t\tlabel={ __( 'Order' ) }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ setUpdatedOrder }\n\t\t\t\t\tlabelPosition=\"side\"\n\t\t\t\t\tonBlur={ () => {\n\t\t\t\t\t\tsetOrderInput( null );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</FlexBlock>\n\t\t</Flex>\n\t);\n};\n\nfunction PageAttributesOrderWithChecks( props ) {\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"page-attributes\">\n\t\t\t<PageAttributesOrder { ...props } />\n\t\t</PostTypeSupportCheck>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\torder: select( editorStore ).getEditedPostAttribute( 'menu_order' ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => ( {\n\t\tonUpdateOrder( order ) {\n\t\t\tdispatch( editorStore ).editPost( {\n\t\t\t\tmenu_order: order,\n\t\t\t} );\n\t\t},\n\t} ) ),\n] )( PageAttributesOrderWithChecks );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/page-attributes/order.js"],"names":["PageAttributesOrder","onUpdateOrder","order","orderInput","setOrderInput","setUpdatedOrder","value","newOrder","Number","isInteger","trim","PageAttributesOrderWithChecks","props","select","editorStore","getEditedPostAttribute","dispatch","editPost","menu_order"],"mappings":";;;;;;;;;AAWA;;AARA;;AACA;;AAKA;;AACA;;AAMA;;AACA;;AAjBA;AACA;AACA;;AAWA;AACA;AACA;AAIO,MAAMA,mBAAmB,GAAG,CAAE;AAAEC,EAAAA,aAAF;AAAiBC,EAAAA,KAAK,GAAG;AAAzB,CAAF,KAAoC;AACtE,QAAM,CAAEC,UAAF,EAAcC,aAAd,IAAgC,uBAAU,IAAV,CAAtC;;AAEA,QAAMC,eAAe,GAAKC,KAAF,IAAa;AACpCF,IAAAA,aAAa,CAAEE,KAAF,CAAb;AACA,UAAMC,QAAQ,GAAGC,MAAM,CAAEF,KAAF,CAAvB;;AACA,QAAKE,MAAM,CAACC,SAAP,CAAkBF,QAAlB,KAAgCD,KAAK,CAACI,IAAN,SAAmB,EAAxD,EAA6D;AAC5DT,MAAAA,aAAa,CAAEO,MAAM,CAAEF,KAAF,CAAR,CAAb;AACA;AACD,GAND;;AAOA,QAAMA,KAAK,GAAGH,UAAU,KAAK,IAAf,GAAsBD,KAAtB,GAA8BC,UAA5C;AACA,SACC,4BAAC,gBAAD,QACC,4BAAC,qBAAD,QACC,4BAAC,uCAAD;AACC,IAAA,KAAK,EAAG,cAAI,OAAJ,CADT;AAEC,IAAA,KAAK,EAAGG,KAFT;AAGC,IAAA,QAAQ,EAAGD,eAHZ;AAIC,IAAA,aAAa,EAAC,MAJf;AAKC,IAAA,MAAM,EAAG,MAAM;AACdD,MAAAA,aAAa,CAAE,IAAF,CAAb;AACA;AAPF,IADD,CADD,CADD;AAeA,CA1BM;;;;AA4BP,SAASO,6BAAT,CAAwCC,KAAxC,EAAgD;AAC/C,SACC,4BAAC,6BAAD;AAAsB,IAAA,WAAW,EAAC;AAAlC,KACC,4BAAC,mBAAD,EAA0BA,KAA1B,CADD,CADD;AAKA;;eAEc,sBAAS,CACvB,sBAAcC,MAAF,IAAc;AACzB,SAAO;AACNX,IAAAA,KAAK,EAAEW,MAAM,CAAEC,YAAF,CAAN,CAAsBC,sBAAtB,CAA8C,YAA9C;AADD,GAAP;AAGA,CAJD,CADuB,EAMvB,wBAAgBC,QAAF,KAAkB;AAC/Bf,EAAAA,aAAa,CAAEC,KAAF,EAAU;AACtBc,IAAAA,QAAQ,CAAEF,YAAF,CAAR,CAAwBG,QAAxB,CAAkC;AACjCC,MAAAA,UAAU,EAAEhB;AADqB,KAAlC;AAGA;;AAL8B,CAAlB,CAAd,CANuB,CAAT,EAaVS,6BAbU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tFlex,\n\tFlexBlock,\n\t__experimentalNumberControl as NumberControl,\n} from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\n\nexport const PageAttributesOrder = ( { onUpdateOrder, order = 0 } ) => {\n\tconst [ orderInput, setOrderInput ] = useState( null );\n\n\tconst setUpdatedOrder = ( value ) => {\n\t\tsetOrderInput( value );\n\t\tconst newOrder = Number( value );\n\t\tif ( Number.isInteger( newOrder ) && value.trim?.() !== '' ) {\n\t\t\tonUpdateOrder( Number( value ) );\n\t\t}\n\t};\n\tconst value = orderInput === null ? order : orderInput;\n\treturn (\n\t\t<Flex>\n\t\t\t<FlexBlock>\n\t\t\t\t<NumberControl\n\t\t\t\t\tlabel={ __( 'Order' ) }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ setUpdatedOrder }\n\t\t\t\t\tlabelPosition=\"side\"\n\t\t\t\t\tonBlur={ () => {\n\t\t\t\t\t\tsetOrderInput( null );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</FlexBlock>\n\t\t</Flex>\n\t);\n};\n\nfunction PageAttributesOrderWithChecks( props ) {\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"page-attributes\">\n\t\t\t<PageAttributesOrder { ...props } />\n\t\t</PostTypeSupportCheck>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\torder: select( editorStore ).getEditedPostAttribute( 'menu_order' ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => ( {\n\t\tonUpdateOrder( order ) {\n\t\t\tdispatch( editorStore ).editPost( {\n\t\t\t\tmenu_order: order,\n\t\t\t} );\n\t\t},\n\t} ) ),\n] )( PageAttributesOrderWithChecks );\n"]}
@@ -40,9 +40,7 @@ var _store = require("../../store");
40
40
  * Internal dependencies
41
41
  */
42
42
  function getTitle(post) {
43
- var _post$title;
44
-
45
- return post !== null && post !== void 0 && (_post$title = post.title) !== null && _post$title !== void 0 && _post$title.rendered ? (0, _htmlEntities.decodeEntities)(post.title.rendered) : `#${post.id} (${(0, _i18n.__)('no title')})`;
43
+ return post?.title?.rendered ? (0, _htmlEntities.decodeEntities)(post.title.rendered) : `#${post.id} (${(0, _i18n.__)('no title')})`;
46
44
  }
47
45
 
48
46
  const getItemPriority = (name, searchValue) => {
@@ -63,8 +61,6 @@ const getItemPriority = (name, searchValue) => {
63
61
  exports.getItemPriority = getItemPriority;
64
62
 
65
63
  function PageAttributesParent() {
66
- var _postType$labels;
67
-
68
64
  const {
69
65
  editPost
70
66
  } = (0, _data.useDispatch)(_store.store);
@@ -91,7 +87,7 @@ function PageAttributesParent() {
91
87
  const pageId = getEditedPostAttribute('parent');
92
88
  const pType = getPostType(postTypeSlug);
93
89
  const postId = getCurrentPostId();
94
- const postIsHierarchical = (_pType$hierarchical = pType === null || pType === void 0 ? void 0 : pType.hierarchical) !== null && _pType$hierarchical !== void 0 ? _pType$hierarchical : false;
90
+ const postIsHierarchical = (_pType$hierarchical = pType?.hierarchical) !== null && _pType$hierarchical !== void 0 ? _pType$hierarchical : false;
95
91
  const query = {
96
92
  per_page: 100,
97
93
  exclude: postId,
@@ -113,19 +109,16 @@ function PageAttributesParent() {
113
109
  postType: pType
114
110
  };
115
111
  }, [fieldValue]);
116
- const parentPageLabel = postType === null || postType === void 0 ? void 0 : (_postType$labels = postType.labels) === null || _postType$labels === void 0 ? void 0 : _postType$labels.parent_item_colon;
112
+ const parentPageLabel = postType?.labels?.parent_item_colon;
117
113
  const pageItems = items || [];
118
114
  const parentOptions = (0, _element.useMemo)(() => {
119
- const getOptionsFromTree = function (tree) {
120
- let level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
115
+ const getOptionsFromTree = (tree, level = 0) => {
121
116
  const mappedNodes = tree.map(treeNode => [{
122
117
  value: treeNode.id,
123
118
  label: '— '.repeat(level) + (0, _htmlEntities.decodeEntities)(treeNode.name),
124
119
  rawName: treeNode.name
125
120
  }, ...getOptionsFromTree(treeNode.children || [], level + 1)]);
126
- const sortedNodes = mappedNodes.sort((_ref, _ref2) => {
127
- let [a] = _ref;
128
- let [b] = _ref2;
121
+ const sortedNodes = mappedNodes.sort(([a], [b]) => {
129
122
  const priorityA = getItemPriority(a.rawName, fieldValue);
130
123
  const priorityB = getItemPriority(b.rawName, fieldValue);
131
124
  return priorityA >= priorityB ? 1 : -1;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/page-attributes/parent.js"],"names":["getTitle","post","title","rendered","id","getItemPriority","name","searchValue","normalizedName","toLowerCase","normalizedSearch","startsWith","length","Infinity","PageAttributesParent","editPost","editorStore","fieldValue","setFieldValue","isHierarchical","parentPost","parentPostId","items","postType","select","getPostType","getEntityRecords","getEntityRecord","coreStore","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":";;;;;;;;;;AAWA;;AARA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AAKA;;AACA;;AApBA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;AAIA,SAASA,QAAT,CAAmBC,IAAnB,EAA0B;AAAA;;AACzB,SAAOA,IAAI,SAAJ,IAAAA,IAAI,WAAJ,mBAAAA,IAAI,CAAEC,KAAN,oDAAaC,QAAb,GACJ,kCAAgBF,IAAI,CAACC,KAAL,CAAWC,QAA3B,CADI,GAEH,IAAIF,IAAI,CAACG,EAAI,KAAK,cAAI,UAAJ,CAAkB,GAFxC;AAGA;;AAEM,MAAMC,eAAe,GAAG,CAAEC,IAAF,EAAQC,WAAR,KAAyB;AACvD,QAAMC,cAAc,GAAG,4BAAeF,IAAI,IAAI,EAAvB,EAA4BG,WAA5B,EAAvB;AACA,QAAMC,gBAAgB,GAAG,4BAAeH,WAAW,IAAI,EAA9B,EAAmCE,WAAnC,EAAzB;;AACA,MAAKD,cAAc,KAAKE,gBAAxB,EAA2C;AAC1C,WAAO,CAAP;AACA;;AAED,MAAKF,cAAc,CAACG,UAAf,CAA2BD,gBAA3B,CAAL,EAAqD;AACpD,WAAOF,cAAc,CAACI,MAAtB;AACA;;AAED,SAAOC,QAAP;AACA,CAZM;;;;AAcA,SAAS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AAEQ;AAAV,KAAF,CAAR;AACA,GAFD;;AAIA,SACC,4BAAC,2BAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,SAAS,EAAC,gCAFX;AAGC,IAAA,KAAK,EAAGhC,eAHT;AAIC,IAAA,KAAK,EAAGxB,YAJT;AAKC,IAAA,OAAO,EAAG4B,aALX;AAMC,IAAA,mBAAmB,EAAG,uBAAUyB,aAAV,EAAyB,GAAzB,CANvB;AAOC,IAAA,QAAQ,EAAGE;AAPZ,IADD;AAWA;;eAEc9D,oB","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":["getTitle","post","title","rendered","id","getItemPriority","name","searchValue","normalizedName","toLowerCase","normalizedSearch","startsWith","length","Infinity","PageAttributesParent","editPost","editorStore","fieldValue","setFieldValue","isHierarchical","parentPost","parentPostId","items","postType","select","getPostType","getEntityRecords","getEntityRecord","coreStore","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":";;;;;;;;;;AAWA;;AARA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AAKA;;AACA;;AApBA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;AAIA,SAASA,QAAT,CAAmBC,IAAnB,EAA0B;AACzB,SAAOA,IAAI,EAAEC,KAAN,EAAaC,QAAb,GACJ,kCAAgBF,IAAI,CAACC,KAAL,CAAWC,QAA3B,CADI,GAEH,IAAIF,IAAI,CAACG,EAAI,KAAK,cAAI,UAAJ,CAAkB,GAFxC;AAGA;;AAEM,MAAMC,eAAe,GAAG,CAAEC,IAAF,EAAQC,WAAR,KAAyB;AACvD,QAAMC,cAAc,GAAG,4BAAeF,IAAI,IAAI,EAAvB,EAA4BG,WAA5B,EAAvB;AACA,QAAMC,gBAAgB,GAAG,4BAAeH,WAAW,IAAI,EAA9B,EAAmCE,WAAnC,EAAzB;;AACA,MAAKD,cAAc,KAAKE,gBAAxB,EAA2C;AAC1C,WAAO,CAAP;AACA;;AAED,MAAKF,cAAc,CAACG,UAAf,CAA2BD,gBAA3B,CAAL,EAAqD;AACpD,WAAOF,cAAc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GAFD;;AAIA,SACC,4BAAC,2BAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,SAAS,EAAC,gCAFX;AAGC,IAAA,KAAK,EAAGhC,eAHT;AAIC,IAAA,KAAK,EAAGxB,YAJT;AAKC,IAAA,OAAO,EAAG4B,aALX;AAMC,IAAA,mBAAmB,EAAG,uBAAUyB,aAAV,EAAyB,GAAzB,CANvB;AAOC,IAAA,QAAQ,EAAGE;AAPZ,IADD;AAWA;;eAEc9D,oB","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"]}
@@ -26,21 +26,20 @@ var _constants = require("./constants");
26
26
  /**
27
27
  * Internal dependencies
28
28
  */
29
- function PostAuthorCheck(_ref) {
30
- let {
31
- children
32
- } = _ref;
29
+ function PostAuthorCheck({
30
+ children
31
+ }) {
33
32
  const {
34
33
  hasAssignAuthorAction,
35
34
  hasAuthors
36
35
  } = (0, _data.useSelect)(select => {
37
- var _post$_links$wpActio, _post$_links;
36
+ var _post$_links$wpActio;
38
37
 
39
38
  const post = select(_store.store).getCurrentPost();
40
39
  const authors = select(_coreData.store).getUsers(_constants.AUTHORS_QUERY);
41
40
  return {
42
- 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,
43
- hasAuthors: (authors === null || authors === void 0 ? void 0 : authors.length) >= 1
41
+ hasAssignAuthorAction: (_post$_links$wpActio = post._links?.['wp:action-assign-author']) !== null && _post$_links$wpActio !== void 0 ? _post$_links$wpActio : false,
42
+ hasAuthors: authors?.length >= 1
44
43
  };
45
44
  }, []);
46
45
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-author/check.js"],"names":["PostAuthorCheck","children","hasAssignAuthorAction","hasAuthors","select","post","editorStore","getCurrentPost","authors","coreStore","getUsers","AUTHORS_QUERY","_links","length"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AAXA;AACA;AACA;;AAIA;AACA;AACA;AAKe,SAASA,eAAT,OAAyC;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACvD,QAAM;AAAEC,IAAAA,qBAAF;AAAyBC,IAAAA;AAAzB,MAAwC,qBAAaC,MAAF,IAAc;AAAA;;AACtE,UAAMC,IAAI,GAAGD,MAAM,CAAEE,YAAF,CAAN,CAAsBC,cAAtB,EAAb;AACA,UAAMC,OAAO,GAAGJ,MAAM,CAAEK,eAAF,CAAN,CAAoBC,QAApB,CAA8BC,wBAA9B,CAAhB;AACA,WAAO;AACNT,MAAAA,qBAAqB,0CACpBG,IAAI,CAACO,MADe,iDACpB,aAAe,yBAAf,CADoB,uEAC0B,KAFzC;AAGNT,MAAAA,UAAU,EAAE,CAAAK,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO,CAAEK,MAAT,KAAmB;AAHzB,KAAP;AAKA,GAR6C,EAQ3C,EAR2C,CAA9C;;AAUA,MAAK,CAAEX,qBAAF,IAA2B,CAAEC,UAAlC,EAA+C;AAC9C,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,6BAAD;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":["PostAuthorCheck","children","hasAssignAuthorAction","hasAuthors","select","post","editorStore","getCurrentPost","authors","coreStore","getUsers","AUTHORS_QUERY","_links","length"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AAXA;AACA;AACA;;AAIA;AACA;AACA;AAKe,SAASA,eAAT,CAA0B;AAAEC,EAAAA;AAAF,CAA1B,EAAyC;AACvD,QAAM;AAAEC,IAAAA,qBAAF;AAAyBC,IAAAA;AAAzB,MAAwC,qBAAaC,MAAF,IAAc;AAAA;;AACtE,UAAMC,IAAI,GAAGD,MAAM,CAAEE,YAAF,CAAN,CAAsBC,cAAtB,EAAb;AACA,UAAMC,OAAO,GAAGJ,MAAM,CAAEK,eAAF,CAAN,CAAoBC,QAApB,CAA8BC,wBAA9B,CAAhB;AACA,WAAO;AACNT,MAAAA,qBAAqB,0BACpBG,IAAI,CAACO,MAAL,GAAe,yBAAf,CADoB,uEAC0B,KAFzC;AAGNT,MAAAA,UAAU,EAAEK,OAAO,EAAEK,MAAT,IAAmB;AAHzB,KAAP;AAKA,GAR6C,EAQ3C,EAR2C,CAA9C;;AAUA,MAAK,CAAEX,qBAAF,IAA2B,CAAEC,UAAlC,EAA+C;AAC9C,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,6BAAD;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"]}
@@ -74,12 +74,9 @@ function PostAuthorCombobox() {
74
74
  };
75
75
  }); // Ensure the current author is included in the dropdown list.
76
76
 
77
- const foundAuthor = fetchedAuthors.findIndex(_ref => {
78
- let {
79
- value
80
- } = _ref;
81
- return (postAuthor === null || postAuthor === void 0 ? void 0 : postAuthor.id) === value;
82
- });
77
+ const foundAuthor = fetchedAuthors.findIndex(({
78
+ value
79
+ }) => postAuthor?.id === value);
83
80
 
84
81
  if (foundAuthor < 0 && postAuthor) {
85
82
  return [{
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-author/combobox.js"],"names":["PostAuthorCombobox","fieldValue","setFieldValue","authorId","isLoading","authors","postAuthor","select","getUser","getUsers","isResolving","coreStore","getEditedPostAttribute","editorStore","author","context","query","AUTHORS_QUERY","search","editPost","authorOptions","fetchedAuthors","map","value","id","label","name","foundAuthor","findIndex","handleSelect","postAuthorId","handleKeydown","inputValue"],"mappings":";;;;;;;AAIA;;AADA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAfA;AACA;AACA;;AASA;AACA;AACA;AAIA,SAASA,kBAAT,GAA8B;AAC7B,QAAM,CAAEC,UAAF,EAAcC,aAAd,IAAgC,wBAAtC;AAEA,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,SAAZ;AAAuBC,IAAAA,OAAvB;AAAgCC,IAAAA;AAAhC,MAA+C,qBAClDC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,OAAF;AAAWC,MAAAA,QAAX;AAAqBC,MAAAA;AAArB,QAAqCH,MAAM,CAAEI,eAAF,CAAjD;AACA,UAAM;AAAEC,MAAAA;AAAF,QAA6BL,MAAM,CAAEM,YAAF,CAAzC;AACA,UAAMC,MAAM,GAAGN,OAAO,CAAEI,sBAAsB,CAA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,UAAU,CAACoB,IAA3B;AAFR,OADM,EAKN,GAAGL,cALG,CAAP;AAOA;;AAED,WAAOA,cAAP;AACA,GAxBqB,EAwBnB,CAAEhB,OAAF,EAAWC,UAAX,CAxBmB,CAAtB;AA0BA;AACD;AACA;AACA;AACA;;AACC,QAAMuB,YAAY,GAAKC,YAAF,IAAoB;AACxC,QAAK,CAAEA,YAAP,EAAsB;AACrB;AACA;;AACDX,IAAAA,QAAQ,CAAE;AAAEL,MAAAA,MAAM,EAAEgB;AAAV,KAAF,CAAR;AACA,GALD;AAOA;AACD;AACA;AACA;AACA;;;AACC,QAAMC,aAAa,GAAKC,UAAF,IAAkB;AACvC9B,IAAAA,aAAa,CAAE8B,UAAF,CAAb;AACA,GAFD;;AAIA,MAAK,CAAE1B,UAAP,EAAoB;AACnB,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,2BAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAG,cAAI,QAAJ,CAFT;AAGC,IAAA,OAAO,EAAGc,aAHX;AAIC,IAAA,KAAK,EAAGjB,QAJT;AAKC,IAAA,mBAAmB,EAAG,uBAAU4B,aAAV,EAAyB,GAAzB,CALvB;AAMC,IAAA,QAAQ,EAAGF,YANZ;AAOC,IAAA,SAAS,EAAGzB,SAPb;AAQC,IAAA,UAAU,EAAG;AARd,IADD;AAYA;;eAEcJ,kB","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":["PostAuthorCombobox","fieldValue","setFieldValue","authorId","isLoading","authors","postAuthor","select","getUser","getUsers","isResolving","coreStore","getEditedPostAttribute","editorStore","author","context","query","AUTHORS_QUERY","search","editPost","authorOptions","fetchedAuthors","map","value","id","label","name","foundAuthor","findIndex","handleSelect","postAuthorId","handleKeydown","inputValue"],"mappings":";;;;;;;AAIA;;AADA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAfA;AACA;AACA;;AASA;AACA;AACA;AAIA,SAASA,kBAAT,GAA8B;AAC7B,QAAM,CAAEC,UAAF,EAAcC,aAAd,IAAgC,wBAAtC;AAEA,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,SAAZ;AAAuBC,IAAAA,OAAvB;AAAgCC,IAAAA;AAAhC,MAA+C,qBAClDC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,OAAF;AAAWC,MAAAA,QAAX;AAAqBC,MAAAA;AAArB,QAAqCH,MAAM,CAAEI,eAAF,CAAjD;AACA,UAAM;AAAEC,MAAAA;AAAF,QAA6BL,MAAM,CAAEM,YAAF,CAAzC;AACA,UAAMC,MAAM,GAAGN,OAAO,CAAEI,sBAAsB,CAAE,QAAF,CAAxB,EAAsC;AAC3DG,MAAAA,OAAO,EAAE;AADkD,KAAtC,CAAtB;AAGA,UAAMC,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;AACD;AACA;AACA;AACA;;AACC,QAAMuB,YAAY,GAAKC,YAAF,IAAoB;AACxC,QAAK,CAAEA,YAAP,EAAsB;AACrB;AACA;;AACDX,IAAAA,QAAQ,CAAE;AAAEL,MAAAA,MAAM,EAAEgB;AAAV,KAAF,CAAR;AACA,GALD;AAOA;AACD;AACA;AACA;AACA;;;AACC,QAAMC,aAAa,GAAKC,UAAF,IAAkB;AACvC9B,IAAAA,aAAa,CAAE8B,UAAF,CAAb;AACA,GAFD;;AAIA,MAAK,CAAE1B,UAAP,EAAoB;AACnB,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,2BAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAG,cAAI,QAAJ,CAFT;AAGC,IAAA,OAAO,EAAGc,aAHX;AAIC,IAAA,KAAK,EAAGjB,QAJT;AAKC,IAAA,mBAAmB,EAAG,uBAAU4B,aAAV,EAAyB,GAAzB,CALvB;AAMC,IAAA,QAAQ,EAAGF,YANZ;AAOC,IAAA,SAAS,EAAGzB,SAPb;AAQC,IAAA,UAAU,EAAG;AARd,IADD;AAYA;;eAEcJ,kB","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"]}
@@ -31,7 +31,7 @@ const minimumUsersForCombobox = 25;
31
31
  function PostAuthor() {
32
32
  const showCombobox = (0, _data.useSelect)(select => {
33
33
  const authors = select(_coreData.store).getUsers(_constants.AUTHORS_QUERY);
34
- return (authors === null || authors === void 0 ? void 0 : authors.length) >= minimumUsersForCombobox;
34
+ return authors?.length >= minimumUsersForCombobox;
35
35
  }, []);
36
36
 
37
37
  if (showCombobox) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-author/index.js"],"names":["minimumUsersForCombobox","PostAuthor","showCombobox","select","authors","coreStore","getUsers","AUTHORS_QUERY","length"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AAXA;AACA;AACA;;AAIA;AACA;AACA;AAKA,MAAMA,uBAAuB,GAAG,EAAhC;;AAEA,SAASC,UAAT,GAAsB;AACrB,QAAMC,YAAY,GAAG,qBAAaC,MAAF,IAAc;AAC7C,UAAMC,OAAO,GAAGD,MAAM,CAAEE,eAAF,CAAN,CAAoBC,QAApB,CAA8BC,wBAA9B,CAAhB;AAEA,WAAO,CAAAH,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO,CAAEI,MAAT,KAAmBR,uBAA1B;AACA,GAJoB,EAIlB,EAJkB,CAArB;;AAMA,MAAKE,YAAL,EAAoB;AACnB,WAAO,4BAAC,iBAAD,OAAP;AACA;;AACD,SAAO,4BAAC,eAAD,OAAP;AACA;;eAEcD,U","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":["minimumUsersForCombobox","PostAuthor","showCombobox","select","authors","coreStore","getUsers","AUTHORS_QUERY","length"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AAXA;AACA;AACA;;AAIA;AACA;AACA;AAKA,MAAMA,uBAAuB,GAAG,EAAhC;;AAEA,SAASC,UAAT,GAAsB;AACrB,QAAMC,YAAY,GAAG,qBAAaC,MAAF,IAAc;AAC7C,UAAMC,OAAO,GAAGD,MAAM,CAAEE,eAAF,CAAN,CAAoBC,QAApB,CAA8BC,wBAA9B,CAAhB;AAEA,WAAOH,OAAO,EAAEI,MAAT,IAAmBR,uBAA1B;AACA,GAJoB,EAIlB,EAJkB,CAArB;;AAMA,MAAKE,YAAL,EAAoB;AACnB,WAAO,4BAAC,iBAAD,OAAP;AACA;;AACD,SAAO,4BAAC,eAAD,OAAP;AACA;;eAEcD,U","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"]}
@@ -24,12 +24,10 @@ var _store = require("../../store");
24
24
  /**
25
25
  * Internal dependencies
26
26
  */
27
- function PostComments(_ref) {
28
- let {
29
- commentStatus = 'open',
30
- ...props
31
- } = _ref;
32
-
27
+ function PostComments({
28
+ commentStatus = 'open',
29
+ ...props
30
+ }) {
33
31
  const onToggleComments = () => props.editPost({
34
32
  comment_status: commentStatus === 'open' ? 'closed' : 'open'
35
33
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-comments/index.js"],"names":["PostComments","commentStatus","props","onToggleComments","editPost","comment_status","select","editorStore","getEditedPostAttribute","dispatch"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AAXA;AACA;AACA;;AAMA;AACA;AACA;AAGA,SAASA,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,4BAAC,2BAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAG,cAAI,gBAAJ,CAFT;AAGC,IAAA,OAAO,EAAGA,aAAa,KAAK,MAH7B;AAIC,IAAA,QAAQ,EAAGE;AAJZ,IADD;AAQA;;eAEc,sBAAS,CACvB,sBAAcG,MAAF,IAAc;AACzB,SAAO;AACNL,IAAAA,aAAa,EACZK,MAAM,CAAEC,YAAF,CAAN,CAAsBC,sBAAtB,CACC,gBADD;AAFK,GAAP;AAMA,CAPD,CADuB,EASvB,wBAAgBC,QAAF,KAAkB;AAC/BL,EAAAA,QAAQ,EAAEK,QAAQ,CAAEF,YAAF,CAAR,CAAwBH;AADH,CAAlB,CAAd,CATuB,CAAT,EAYVJ,YAZU,C","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":["PostComments","commentStatus","props","onToggleComments","editPost","comment_status","select","editorStore","getEditedPostAttribute","dispatch"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AAXA;AACA;AACA;;AAMA;AACA;AACA;AAGA,SAASA,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,4BAAC,2BAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAG,cAAI,gBAAJ,CAFT;AAGC,IAAA,OAAO,EAAGA,aAAa,KAAK,MAH7B;AAIC,IAAA,QAAQ,EAAGE;AAJZ,IADD;AAQA;;eAEc,sBAAS,CACvB,sBAAcG,MAAF,IAAc;AACzB,SAAO;AACNL,IAAAA,aAAa,EACZK,MAAM,CAAEC,YAAF,CAAN,CAAsBC,sBAAtB,CACC,gBADD;AAFK,GAAP;AAMA,CAPD,CADuB,EASvB,wBAAgBC,QAAF,KAAkB;AAC/BL,EAAAA,QAAQ,EAAEK,QAAQ,CAAEF,YAAF,CAAR,CAAwBH;AADH,CAAlB,CAAd,CATuB,CAAT,EAYVJ,YAZU,C","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"]}
@@ -24,11 +24,10 @@ var _store = require("../../store");
24
24
  /**
25
25
  * Internal dependencies
26
26
  */
27
- function PostExcerpt(_ref) {
28
- let {
29
- excerpt,
30
- onUpdateExcerpt
31
- } = _ref;
27
+ function PostExcerpt({
28
+ excerpt,
29
+ onUpdateExcerpt
30
+ }) {
32
31
  return (0, _element.createElement)("div", {
33
32
  className: "editor-post-excerpt"
34
33
  }, (0, _element.createElement)(_components.TextareaControl, {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-excerpt/index.js"],"names":["PostExcerpt","excerpt","onUpdateExcerpt","value","select","editorStore","getEditedPostAttribute","dispatch","editPost"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AAXA;AACA;AACA;;AAMA;AACA;AACA;AAGA,SAASA,WAAT,OAAqD;AAAA,MAA/B;AAAEC,IAAAA,OAAF;AAAWC,IAAAA;AAAX,GAA+B;AACpD,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,2BAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAG,cAAI,6BAAJ,CAFT;AAGC,IAAA,SAAS,EAAC,+BAHX;AAIC,IAAA,QAAQ,EAAKC,KAAF,IAAaD,eAAe,CAAEC,KAAF,CAJxC;AAKC,IAAA,KAAK,EAAGF;AALT,IADD,EAQC,4BAAC,wBAAD;AACC,IAAA,IAAI,EAAG,cACN,iFADM;AADR,KAKG,cAAI,kCAAJ,CALH,CARD,CADD;AAkBA;;eAEc,sBAAS,CACvB,sBAAcG,MAAF,IAAc;AACzB,SAAO;AACNH,IAAAA,OAAO,EAAEG,MAAM,CAAEC,YAAF,CAAN,CAAsBC,sBAAtB,CAA8C,SAA9C;AADH,GAAP;AAGA,CAJD,CADuB,EAMvB,wBAAgBC,QAAF,KAAkB;AAC/BL,EAAAA,eAAe,CAAED,OAAF,EAAY;AAC1BM,IAAAA,QAAQ,CAAEF,YAAF,CAAR,CAAwBG,QAAxB,CAAkC;AAAEP,MAAAA;AAAF,KAAlC;AACA;;AAH8B,CAAlB,CAAd,CANuB,CAAT,EAWVD,WAXU,C","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":["PostExcerpt","excerpt","onUpdateExcerpt","value","select","editorStore","getEditedPostAttribute","dispatch","editPost"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AAXA;AACA;AACA;;AAMA;AACA;AACA;AAGA,SAASA,WAAT,CAAsB;AAAEC,EAAAA,OAAF;AAAWC,EAAAA;AAAX,CAAtB,EAAqD;AACpD,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,2BAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAG,cAAI,6BAAJ,CAFT;AAGC,IAAA,SAAS,EAAC,+BAHX;AAIC,IAAA,QAAQ,EAAKC,KAAF,IAAaD,eAAe,CAAEC,KAAF,CAJxC;AAKC,IAAA,KAAK,EAAGF;AALT,IADD,EAQC,4BAAC,wBAAD;AACC,IAAA,IAAI,EAAG,cACN,iFADM;AADR,KAKG,cAAI,kCAAJ,CALH,CARD,CADD;AAkBA;;eAEc,sBAAS,CACvB,sBAAcG,MAAF,IAAc;AACzB,SAAO;AACNH,IAAAA,OAAO,EAAEG,MAAM,CAAEC,YAAF,CAAN,CAAsBC,sBAAtB,CAA8C,SAA9C;AADH,GAAP;AAGA,CAJD,CADuB,EAMvB,wBAAgBC,QAAF,KAAkB;AAC/BL,EAAAA,eAAe,CAAED,OAAF,EAAY;AAC1BM,IAAAA,QAAQ,CAAEF,YAAF,CAAR,CAAwBG,QAAxB,CAAkC;AAAEP,MAAAA;AAAF,KAAlC;AACA;;AAH8B,CAAlB,CAAd,CANuB,CAAT,EAWVD,WAXU,C","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"]}
@@ -43,7 +43,7 @@ const DEFAULT_SET_FEATURE_IMAGE_LABEL = (0, _i18n.__)('Set featured image');
43
43
  const instructions = (0, _element.createElement)("p", null, (0, _i18n.__)('To edit the featured image, you need permission to upload media.'));
44
44
 
45
45
  function getMediaDetails(media, postId) {
46
- var _media$media_details$, _media$media_details, _media$media_details$2, _media$media_details2;
46
+ var _media$media_details$, _media$media_details$2;
47
47
 
48
48
  if (!media) {
49
49
  return {};
@@ -51,7 +51,7 @@ function getMediaDetails(media, postId) {
51
51
 
52
52
  const defaultSize = (0, _hooks.applyFilters)('editor.PostFeaturedImage.imageSize', 'large', media.id, postId);
53
53
 
54
- 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$ : {})) {
54
+ if (defaultSize in ((_media$media_details$ = media?.media_details?.sizes) !== null && _media$media_details$ !== void 0 ? _media$media_details$ : {})) {
55
55
  return {
56
56
  mediaWidth: media.media_details.sizes[defaultSize].width,
57
57
  mediaHeight: media.media_details.sizes[defaultSize].height,
@@ -62,7 +62,7 @@ function getMediaDetails(media, postId) {
62
62
 
63
63
  const fallbackSize = (0, _hooks.applyFilters)('editor.PostFeaturedImage.imageSize', 'thumbnail', media.id, postId);
64
64
 
65
- 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 : {})) {
65
+ if (fallbackSize in ((_media$media_details$2 = media?.media_details?.sizes) !== null && _media$media_details$2 !== void 0 ? _media$media_details$2 : {})) {
66
66
  return {
67
67
  mediaWidth: media.media_details.sizes[fallbackSize].width,
68
68
  mediaHeight: media.media_details.sizes[fallbackSize].height,
@@ -78,19 +78,16 @@ function getMediaDetails(media, postId) {
78
78
  };
79
79
  }
80
80
 
81
- function PostFeaturedImage(_ref) {
82
- var _media$media_details$3, _media$media_details$4, _postType$labels;
83
-
84
- let {
85
- currentPostId,
86
- featuredImageId,
87
- onUpdateImage,
88
- onRemoveImage,
89
- media,
90
- postType,
91
- noticeUI,
92
- noticeOperations
93
- } = _ref;
81
+ function PostFeaturedImage({
82
+ currentPostId,
83
+ featuredImageId,
84
+ onUpdateImage,
85
+ onRemoveImage,
86
+ media,
87
+ postType,
88
+ noticeUI,
89
+ noticeOperations
90
+ }) {
94
91
  const toggleRef = (0, _element.useRef)();
95
92
  const [isLoading, setIsLoading] = (0, _element.useState)(false);
96
93
  const mediaUpload = (0, _data.useSelect)(select => {
@@ -107,10 +104,8 @@ function PostFeaturedImage(_ref) {
107
104
  allowedTypes: ['image'],
108
105
  filesList,
109
106
 
110
- onFileChange(_ref2) {
111
- let [image] = _ref2;
112
-
113
- if ((0, _blob.isBlobURL)(image === null || image === void 0 ? void 0 : image.url)) {
107
+ onFileChange([image]) {
108
+ if ((0, _blob.isBlobURL)(image?.url)) {
114
109
  setIsLoading(true);
115
110
  return;
116
111
  }
@@ -134,52 +129,47 @@ function PostFeaturedImage(_ref) {
134
129
  className: "hidden"
135
130
  }, media.alt_text && (0, _i18n.sprintf)( // Translators: %s: The selected image alt text.
136
131
  (0, _i18n.__)('Current image: %s'), media.alt_text), !media.alt_text && (0, _i18n.sprintf)( // Translators: %s: The selected image filename.
137
- (0, _i18n.__)('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)), (0, _element.createElement)(_blockEditor.MediaUploadCheck, {
132
+ (0, _i18n.__)('The current image has no alternative text. The file name is: %s'), media.media_details.sizes?.full?.file || media.slug)), (0, _element.createElement)(_blockEditor.MediaUploadCheck, {
138
133
  fallback: instructions
139
134
  }, (0, _element.createElement)(_blockEditor.MediaUpload, {
140
- 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,
135
+ title: postType?.labels?.featured_image || DEFAULT_FEATURE_IMAGE_LABEL,
141
136
  onSelect: onUpdateImage,
142
137
  unstableFeaturedImageFlow: true,
143
138
  allowedTypes: ALLOWED_MEDIA_TYPES,
144
139
  modalClass: "editor-post-featured-image__media-modal",
145
- render: _ref3 => {
146
- var _postType$labels2;
147
-
148
- let {
149
- open
150
- } = _ref3;
151
- return (0, _element.createElement)("div", {
152
- className: "editor-post-featured-image__container"
153
- }, (0, _element.createElement)(_components.Button, {
154
- ref: toggleRef,
155
- className: !featuredImageId ? 'editor-post-featured-image__toggle' : 'editor-post-featured-image__preview',
156
- onClick: open,
157
- "aria-label": !featuredImageId ? null : (0, _i18n.__)('Edit or replace the image'),
158
- "aria-describedby": !featuredImageId ? null : `editor-post-featured-image-${featuredImageId}-describedby`
159
- }, !!featuredImageId && media && (0, _element.createElement)(_components.ResponsiveWrapper, {
160
- naturalWidth: mediaWidth,
161
- naturalHeight: mediaHeight,
162
- isInline: true
163
- }, (0, _element.createElement)("img", {
164
- src: mediaSourceUrl,
165
- alt: ""
166
- })), isLoading && (0, _element.createElement)(_components.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 && (0, _element.createElement)(_components.__experimentalHStack, {
167
- className: "editor-post-featured-image__actions"
168
- }, (0, _element.createElement)(_components.Button, {
169
- className: "editor-post-featured-image__action",
170
- onClick: open // Prefer that screen readers use the .editor-post-featured-image__preview button.
171
- ,
172
- "aria-hidden": "true"
173
- }, (0, _i18n.__)('Replace')), (0, _element.createElement)(_components.Button, {
174
- className: "editor-post-featured-image__action",
175
- onClick: () => {
176
- onRemoveImage();
177
- toggleRef.current.focus();
178
- }
179
- }, (0, _i18n.__)('Remove'))), (0, _element.createElement)(_components.DropZone, {
180
- onFilesDrop: onDropFiles
181
- }));
182
- },
140
+ render: ({
141
+ open
142
+ }) => (0, _element.createElement)("div", {
143
+ className: "editor-post-featured-image__container"
144
+ }, (0, _element.createElement)(_components.Button, {
145
+ ref: toggleRef,
146
+ className: !featuredImageId ? 'editor-post-featured-image__toggle' : 'editor-post-featured-image__preview',
147
+ onClick: open,
148
+ "aria-label": !featuredImageId ? null : (0, _i18n.__)('Edit or replace the image'),
149
+ "aria-describedby": !featuredImageId ? null : `editor-post-featured-image-${featuredImageId}-describedby`
150
+ }, !!featuredImageId && media && (0, _element.createElement)(_components.ResponsiveWrapper, {
151
+ naturalWidth: mediaWidth,
152
+ naturalHeight: mediaHeight,
153
+ isInline: true
154
+ }, (0, _element.createElement)("img", {
155
+ src: mediaSourceUrl,
156
+ alt: ""
157
+ })), isLoading && (0, _element.createElement)(_components.Spinner, null), !featuredImageId && !isLoading && (postType?.labels?.set_featured_image || DEFAULT_SET_FEATURE_IMAGE_LABEL)), !!featuredImageId && (0, _element.createElement)(_components.__experimentalHStack, {
158
+ className: "editor-post-featured-image__actions"
159
+ }, (0, _element.createElement)(_components.Button, {
160
+ className: "editor-post-featured-image__action",
161
+ onClick: open // Prefer that screen readers use the .editor-post-featured-image__preview button.
162
+ ,
163
+ "aria-hidden": "true"
164
+ }, (0, _i18n.__)('Replace')), (0, _element.createElement)(_components.Button, {
165
+ className: "editor-post-featured-image__action",
166
+ onClick: () => {
167
+ onRemoveImage();
168
+ toggleRef.current.focus();
169
+ }
170
+ }, (0, _i18n.__)('Remove'))), (0, _element.createElement)(_components.DropZone, {
171
+ onFilesDrop: onDropFiles
172
+ })),
183
173
  value: featuredImageId
184
174
  }))));
185
175
  }
@@ -203,13 +193,11 @@ const applyWithSelect = (0, _data.withSelect)(select => {
203
193
  featuredImageId
204
194
  };
205
195
  });
206
- const applyWithDispatch = (0, _data.withDispatch)((dispatch, _ref4, _ref5) => {
207
- let {
208
- noticeOperations
209
- } = _ref4;
210
- let {
211
- select
212
- } = _ref5;
196
+ const applyWithDispatch = (0, _data.withDispatch)((dispatch, {
197
+ noticeOperations
198
+ }, {
199
+ select
200
+ }) => {
213
201
  const {
214
202
  editPost
215
203
  } = dispatch(_store.store);
@@ -225,8 +213,7 @@ const applyWithDispatch = (0, _data.withDispatch)((dispatch, _ref4, _ref5) => {
225
213
  allowedTypes: ['image'],
226
214
  filesList,
227
215
 
228
- onFileChange(_ref6) {
229
- let [image] = _ref6;
216
+ onFileChange([image]) {
230
217
  editPost({
231
218
  featured_media: image.id
232
219
  });