@wordpress/editor 12.0.1 → 12.0.5

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 (331) hide show
  1. package/build/components/autocompleters/user.js +1 -1
  2. package/build/components/autosave-monitor/index.js +7 -1
  3. package/build/components/autosave-monitor/index.js.map +1 -1
  4. package/build/components/deprecated.js +6 -4
  5. package/build/components/deprecated.js.map +1 -1
  6. package/build/components/deprecated.native.js +26 -26
  7. package/build/components/document-outline/check.js +5 -4
  8. package/build/components/document-outline/check.js.map +1 -1
  9. package/build/components/document-outline/index.js +13 -9
  10. package/build/components/document-outline/index.js.map +1 -1
  11. package/build/components/document-outline/item.js +25 -22
  12. package/build/components/document-outline/item.js.map +1 -1
  13. package/build/components/editor-help/help-detail-navigation-screen.native.js +5 -4
  14. package/build/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
  15. package/build/components/editor-help/help-get-support-button.native.js +5 -4
  16. package/build/components/editor-help/help-get-support-button.native.js.map +1 -1
  17. package/build/components/editor-help/help-topic-row.native.js +6 -5
  18. package/build/components/editor-help/help-topic-row.native.js.map +1 -1
  19. package/build/components/editor-help/index.native.js +23 -18
  20. package/build/components/editor-help/index.native.js.map +1 -1
  21. package/build/components/editor-help/view-sections.native.js +16 -13
  22. package/build/components/editor-help/view-sections.native.js.map +1 -1
  23. package/build/components/editor-notices/index.js +5 -4
  24. package/build/components/editor-notices/index.js.map +1 -1
  25. package/build/components/entities-saved-states/entity-record-item.js +7 -6
  26. package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
  27. package/build/components/entities-saved-states/entity-type-list.js +30 -20
  28. package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
  29. package/build/components/entities-saved-states/index.js +51 -26
  30. package/build/components/entities-saved-states/index.js.map +1 -1
  31. package/build/components/error-boundary/index.js +5 -4
  32. package/build/components/error-boundary/index.js.map +1 -1
  33. package/build/components/global-keyboard-shortcuts/save-shortcut.js +4 -3
  34. package/build/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
  35. package/build/components/index.js +22 -22
  36. package/build/components/index.native.js +4 -4
  37. package/build/components/page-attributes/check.js +4 -3
  38. package/build/components/page-attributes/check.js.map +1 -1
  39. package/build/components/page-attributes/order.js +5 -4
  40. package/build/components/page-attributes/order.js.map +1 -1
  41. package/build/components/page-attributes/parent.js +6 -3
  42. package/build/components/page-attributes/parent.js.map +1 -1
  43. package/build/components/post-author/check.js +4 -3
  44. package/build/components/post-author/check.js.map +1 -1
  45. package/build/components/post-author/combobox.js +6 -3
  46. package/build/components/post-author/combobox.js.map +1 -1
  47. package/build/components/post-comments/index.js +6 -4
  48. package/build/components/post-comments/index.js.map +1 -1
  49. package/build/components/post-excerpt/index.js +5 -4
  50. package/build/components/post-excerpt/index.js.map +1 -1
  51. package/build/components/post-featured-image/index.js +51 -41
  52. package/build/components/post-featured-image/index.js.map +1 -1
  53. package/build/components/post-format/check.js +5 -4
  54. package/build/components/post-format/check.js.map +1 -1
  55. package/build/components/post-format/index.js +1 -1
  56. package/build/components/post-last-revision/check.js +7 -5
  57. package/build/components/post-last-revision/check.js.map +1 -1
  58. package/build/components/post-last-revision/index.js +5 -4
  59. package/build/components/post-last-revision/index.js.map +1 -1
  60. package/build/components/post-pending-status/check.js +7 -5
  61. package/build/components/post-pending-status/check.js.map +1 -1
  62. package/build/components/post-pending-status/index.js +6 -4
  63. package/build/components/post-pending-status/index.js.map +1 -1
  64. package/build/components/post-pingbacks/index.js +6 -4
  65. package/build/components/post-pingbacks/index.js.map +1 -1
  66. package/build/components/post-preview-button/index.js +11 -7
  67. package/build/components/post-preview-button/index.js.map +1 -1
  68. package/build/components/post-publish-button/index.js +12 -4
  69. package/build/components/post-publish-button/index.js.map +1 -1
  70. package/build/components/post-publish-button/label.js +15 -12
  71. package/build/components/post-publish-button/label.js.map +1 -1
  72. package/build/components/post-publish-panel/index.js +4 -3
  73. package/build/components/post-publish-panel/index.js.map +1 -1
  74. package/build/components/post-publish-panel/maybe-post-format-panel.js +11 -8
  75. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  76. package/build/components/post-publish-panel/maybe-tags-panel.js +7 -4
  77. package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  78. package/build/components/post-publish-panel/postpublish.js +6 -5
  79. package/build/components/post-publish-panel/postpublish.js.map +1 -1
  80. package/build/components/post-publish-panel/prepublish.js +4 -3
  81. package/build/components/post-publish-panel/prepublish.js.map +1 -1
  82. package/build/components/post-saved-state/index.js +6 -5
  83. package/build/components/post-saved-state/index.js.map +1 -1
  84. package/build/components/post-schedule/check.js +6 -4
  85. package/build/components/post-schedule/check.js.map +1 -1
  86. package/build/components/post-schedule/index.js +15 -10
  87. package/build/components/post-schedule/index.js.map +1 -1
  88. package/build/components/post-schedule/label.js +5 -4
  89. package/build/components/post-schedule/label.js.map +1 -1
  90. package/build/components/post-slug/check.js +4 -3
  91. package/build/components/post-slug/check.js.map +1 -1
  92. package/build/components/post-slug/index.js +6 -5
  93. package/build/components/post-slug/index.js.map +1 -1
  94. package/build/components/post-sticky/check.js +7 -5
  95. package/build/components/post-sticky/check.js.map +1 -1
  96. package/build/components/post-sticky/index.js +5 -4
  97. package/build/components/post-sticky/index.js.map +1 -1
  98. package/build/components/post-switch-to-draft-button/index.js +7 -6
  99. package/build/components/post-switch-to-draft-button/index.js.map +1 -1
  100. package/build/components/post-taxonomies/check.js +6 -5
  101. package/build/components/post-taxonomies/check.js.map +1 -1
  102. package/build/components/post-taxonomies/flat-term-selector.js +155 -211
  103. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  104. package/build/components/post-taxonomies/hierarchical-term-selector.js +6 -5
  105. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  106. package/build/components/post-taxonomies/index.js +6 -5
  107. package/build/components/post-taxonomies/index.js.map +1 -1
  108. package/build/components/post-taxonomies/most-used-terms.js +5 -4
  109. package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
  110. package/build/components/post-template/index.js +2 -1
  111. package/build/components/post-template/index.js.map +1 -1
  112. package/build/components/post-title/index.js +4 -2
  113. package/build/components/post-title/index.js.map +1 -1
  114. package/build/components/post-title/index.native.js +6 -5
  115. package/build/components/post-title/index.native.js.map +1 -1
  116. package/build/components/post-trash/check.js +8 -6
  117. package/build/components/post-trash/check.js.map +1 -1
  118. package/build/components/post-trash/index.js +8 -6
  119. package/build/components/post-trash/index.js.map +1 -1
  120. package/build/components/post-type-support-check/index.js +6 -5
  121. package/build/components/post-type-support-check/index.js.map +1 -1
  122. package/build/components/post-visibility/check.js +5 -4
  123. package/build/components/post-visibility/check.js.map +1 -1
  124. package/build/components/post-visibility/index.js +28 -24
  125. package/build/components/post-visibility/index.js.map +1 -1
  126. package/build/components/post-visibility/label.js +5 -3
  127. package/build/components/post-visibility/label.js.map +1 -1
  128. package/build/components/provider/index.js +9 -8
  129. package/build/components/provider/index.js.map +1 -1
  130. package/build/components/provider/index.native.js +17 -11
  131. package/build/components/provider/index.native.js.map +1 -1
  132. package/build/components/provider/use-block-editor-settings.js +1 -1
  133. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  134. package/build/components/table-of-contents/index.js +33 -26
  135. package/build/components/table-of-contents/index.js.map +1 -1
  136. package/build/components/table-of-contents/panel.js +5 -4
  137. package/build/components/table-of-contents/panel.js.map +1 -1
  138. package/build/components/template-validation-notice/index.js +6 -4
  139. package/build/components/template-validation-notice/index.js.map +1 -1
  140. package/build/components/theme-support-check/index.js +7 -6
  141. package/build/components/theme-support-check/index.js.map +1 -1
  142. package/build/hooks/custom-sources-backwards-compatibility.js +12 -8
  143. package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  144. package/build/hooks/default-autocompleters.js +2 -1
  145. package/build/hooks/default-autocompleters.js.map +1 -1
  146. package/build/index.js +4 -4
  147. package/build/store/actions.js +51 -30
  148. package/build/store/actions.js.map +1 -1
  149. package/build/store/actions.native.js +3 -2
  150. package/build/store/actions.native.js.map +1 -1
  151. package/build/store/constants.js +1 -1
  152. package/build/store/controls.js +10 -9
  153. package/build/store/controls.js.map +1 -1
  154. package/build/store/defaults.js +1 -1
  155. package/build/store/index.js +5 -3
  156. package/build/store/index.js.map +1 -1
  157. package/build/store/reducer.js +52 -22
  158. package/build/store/reducer.js.map +1 -1
  159. package/build/store/reducer.native.js +14 -4
  160. package/build/store/reducer.native.js.map +1 -1
  161. package/build/store/selectors.js +56 -37
  162. package/build/store/selectors.js.map +1 -1
  163. package/build/store/selectors.native.js +1 -1
  164. package/build/store/utils/notice-builder.js +1 -1
  165. package/build/utils/index.js +6 -6
  166. package/build/utils/media-upload/index.js +15 -11
  167. package/build/utils/media-upload/index.js.map +1 -1
  168. package/build/utils/url.js +1 -1
  169. package/build-module/components/autosave-monitor/index.js +7 -1
  170. package/build-module/components/autosave-monitor/index.js.map +1 -1
  171. package/build-module/components/deprecated.js +4 -3
  172. package/build-module/components/deprecated.js.map +1 -1
  173. package/build-module/components/document-outline/check.js +5 -4
  174. package/build-module/components/document-outline/check.js.map +1 -1
  175. package/build-module/components/document-outline/index.js +13 -9
  176. package/build-module/components/document-outline/index.js.map +1 -1
  177. package/build-module/components/document-outline/item.js +25 -22
  178. package/build-module/components/document-outline/item.js.map +1 -1
  179. package/build-module/components/editor-help/help-detail-navigation-screen.native.js +5 -4
  180. package/build-module/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
  181. package/build-module/components/editor-help/help-get-support-button.native.js +5 -4
  182. package/build-module/components/editor-help/help-get-support-button.native.js.map +1 -1
  183. package/build-module/components/editor-help/help-topic-row.native.js +6 -5
  184. package/build-module/components/editor-help/help-topic-row.native.js.map +1 -1
  185. package/build-module/components/editor-help/index.native.js +23 -19
  186. package/build-module/components/editor-help/index.native.js.map +1 -1
  187. package/build-module/components/editor-help/view-sections.native.js +15 -12
  188. package/build-module/components/editor-help/view-sections.native.js.map +1 -1
  189. package/build-module/components/editor-notices/index.js +5 -4
  190. package/build-module/components/editor-notices/index.js.map +1 -1
  191. package/build-module/components/entities-saved-states/entity-record-item.js +7 -6
  192. package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
  193. package/build-module/components/entities-saved-states/entity-type-list.js +31 -19
  194. package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
  195. package/build-module/components/entities-saved-states/index.js +50 -25
  196. package/build-module/components/entities-saved-states/index.js.map +1 -1
  197. package/build-module/components/error-boundary/index.js +5 -4
  198. package/build-module/components/error-boundary/index.js.map +1 -1
  199. package/build-module/components/global-keyboard-shortcuts/save-shortcut.js +4 -3
  200. package/build-module/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
  201. package/build-module/components/page-attributes/check.js +4 -3
  202. package/build-module/components/page-attributes/check.js.map +1 -1
  203. package/build-module/components/page-attributes/order.js +5 -4
  204. package/build-module/components/page-attributes/order.js.map +1 -1
  205. package/build-module/components/page-attributes/parent.js +5 -2
  206. package/build-module/components/page-attributes/parent.js.map +1 -1
  207. package/build-module/components/post-author/check.js +4 -3
  208. package/build-module/components/post-author/check.js.map +1 -1
  209. package/build-module/components/post-author/combobox.js +6 -3
  210. package/build-module/components/post-author/combobox.js.map +1 -1
  211. package/build-module/components/post-comments/index.js +6 -4
  212. package/build-module/components/post-comments/index.js.map +1 -1
  213. package/build-module/components/post-excerpt/index.js +5 -4
  214. package/build-module/components/post-excerpt/index.js.map +1 -1
  215. package/build-module/components/post-featured-image/index.js +51 -41
  216. package/build-module/components/post-featured-image/index.js.map +1 -1
  217. package/build-module/components/post-format/check.js +5 -4
  218. package/build-module/components/post-format/check.js.map +1 -1
  219. package/build-module/components/post-last-revision/check.js +7 -5
  220. package/build-module/components/post-last-revision/check.js.map +1 -1
  221. package/build-module/components/post-last-revision/index.js +5 -4
  222. package/build-module/components/post-last-revision/index.js.map +1 -1
  223. package/build-module/components/post-pending-status/check.js +7 -5
  224. package/build-module/components/post-pending-status/check.js.map +1 -1
  225. package/build-module/components/post-pending-status/index.js +6 -4
  226. package/build-module/components/post-pending-status/index.js.map +1 -1
  227. package/build-module/components/post-pingbacks/index.js +6 -4
  228. package/build-module/components/post-pingbacks/index.js.map +1 -1
  229. package/build-module/components/post-preview-button/index.js +11 -7
  230. package/build-module/components/post-preview-button/index.js.map +1 -1
  231. package/build-module/components/post-publish-button/index.js +12 -4
  232. package/build-module/components/post-publish-button/index.js.map +1 -1
  233. package/build-module/components/post-publish-button/label.js +15 -12
  234. package/build-module/components/post-publish-button/label.js.map +1 -1
  235. package/build-module/components/post-publish-panel/index.js +4 -3
  236. package/build-module/components/post-publish-panel/index.js.map +1 -1
  237. package/build-module/components/post-publish-panel/maybe-post-format-panel.js +11 -8
  238. package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  239. package/build-module/components/post-publish-panel/maybe-tags-panel.js +7 -4
  240. package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  241. package/build-module/components/post-publish-panel/postpublish.js +6 -5
  242. package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
  243. package/build-module/components/post-publish-panel/prepublish.js +4 -3
  244. package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
  245. package/build-module/components/post-saved-state/index.js +6 -5
  246. package/build-module/components/post-saved-state/index.js.map +1 -1
  247. package/build-module/components/post-schedule/check.js +6 -4
  248. package/build-module/components/post-schedule/check.js.map +1 -1
  249. package/build-module/components/post-schedule/index.js +15 -10
  250. package/build-module/components/post-schedule/index.js.map +1 -1
  251. package/build-module/components/post-schedule/label.js +6 -4
  252. package/build-module/components/post-schedule/label.js.map +1 -1
  253. package/build-module/components/post-slug/check.js +4 -3
  254. package/build-module/components/post-slug/check.js.map +1 -1
  255. package/build-module/components/post-slug/index.js +6 -5
  256. package/build-module/components/post-slug/index.js.map +1 -1
  257. package/build-module/components/post-sticky/check.js +7 -5
  258. package/build-module/components/post-sticky/check.js.map +1 -1
  259. package/build-module/components/post-sticky/index.js +5 -4
  260. package/build-module/components/post-sticky/index.js.map +1 -1
  261. package/build-module/components/post-switch-to-draft-button/index.js +7 -6
  262. package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
  263. package/build-module/components/post-taxonomies/check.js +6 -5
  264. package/build-module/components/post-taxonomies/check.js.map +1 -1
  265. package/build-module/components/post-taxonomies/flat-term-selector.js +157 -214
  266. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  267. package/build-module/components/post-taxonomies/hierarchical-term-selector.js +4 -3
  268. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  269. package/build-module/components/post-taxonomies/index.js +6 -5
  270. package/build-module/components/post-taxonomies/index.js.map +1 -1
  271. package/build-module/components/post-taxonomies/most-used-terms.js +5 -4
  272. package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
  273. package/build-module/components/post-template/index.js +2 -1
  274. package/build-module/components/post-template/index.js.map +1 -1
  275. package/build-module/components/post-title/index.js +4 -2
  276. package/build-module/components/post-title/index.js.map +1 -1
  277. package/build-module/components/post-title/index.native.js +6 -5
  278. package/build-module/components/post-title/index.native.js.map +1 -1
  279. package/build-module/components/post-trash/check.js +8 -6
  280. package/build-module/components/post-trash/check.js.map +1 -1
  281. package/build-module/components/post-trash/index.js +8 -6
  282. package/build-module/components/post-trash/index.js.map +1 -1
  283. package/build-module/components/post-type-support-check/index.js +6 -5
  284. package/build-module/components/post-type-support-check/index.js.map +1 -1
  285. package/build-module/components/post-visibility/check.js +5 -4
  286. package/build-module/components/post-visibility/check.js.map +1 -1
  287. package/build-module/components/post-visibility/index.js +28 -24
  288. package/build-module/components/post-visibility/index.js.map +1 -1
  289. package/build-module/components/post-visibility/label.js +5 -3
  290. package/build-module/components/post-visibility/label.js.map +1 -1
  291. package/build-module/components/provider/index.js +9 -8
  292. package/build-module/components/provider/index.js.map +1 -1
  293. package/build-module/components/provider/index.native.js +13 -9
  294. package/build-module/components/provider/index.native.js.map +1 -1
  295. package/build-module/components/provider/use-block-editor-settings.js +1 -1
  296. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  297. package/build-module/components/table-of-contents/index.js +33 -26
  298. package/build-module/components/table-of-contents/index.js.map +1 -1
  299. package/build-module/components/table-of-contents/panel.js +5 -4
  300. package/build-module/components/table-of-contents/panel.js.map +1 -1
  301. package/build-module/components/template-validation-notice/index.js +6 -4
  302. package/build-module/components/template-validation-notice/index.js.map +1 -1
  303. package/build-module/components/theme-support-check/index.js +7 -6
  304. package/build-module/components/theme-support-check/index.js.map +1 -1
  305. package/build-module/hooks/custom-sources-backwards-compatibility.js +12 -8
  306. package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  307. package/build-module/hooks/default-autocompleters.js +2 -1
  308. package/build-module/hooks/default-autocompleters.js.map +1 -1
  309. package/build-module/store/actions.js +27 -12
  310. package/build-module/store/actions.js.map +1 -1
  311. package/build-module/store/actions.native.js +2 -1
  312. package/build-module/store/actions.native.js.map +1 -1
  313. package/build-module/store/controls.js +8 -7
  314. package/build-module/store/controls.js.map +1 -1
  315. package/build-module/store/reducer.js +44 -14
  316. package/build-module/store/reducer.js.map +1 -1
  317. package/build-module/store/reducer.native.js +12 -3
  318. package/build-module/store/reducer.native.js.map +1 -1
  319. package/build-module/store/selectors.js +7 -4
  320. package/build-module/store/selectors.js.map +1 -1
  321. package/build-module/utils/media-upload/index.js +15 -11
  322. package/build-module/utils/media-upload/index.js.map +1 -1
  323. package/package.json +31 -31
  324. package/src/components/autosave-monitor/index.js +5 -0
  325. package/src/components/autosave-monitor/test/index.js +10 -4
  326. package/src/components/editor-help/index.native.js +116 -110
  327. package/src/components/entities-saved-states/entity-type-list.js +29 -10
  328. package/src/components/entities-saved-states/index.js +38 -8
  329. package/src/components/post-taxonomies/flat-term-selector.js +220 -254
  330. package/src/components/post-title/index.js +4 -2
  331. package/src/components/provider/use-block-editor-settings.js +0 -2
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-taxonomies/hierarchical-term-selector.js"],"names":["find","get","some","unescape","unescapeString","without","__","_n","_x","sprintf","useMemo","useState","Button","CheckboxControl","TextControl","TreeSelect","withFilters","useDispatch","useSelect","useDebounce","store","coreStore","speak","buildTermsTree","editorStore","DEFAULT_QUERY","per_page","orderby","order","_fields","context","MIN_TERMS_COUNT_FOR_FILTER","EMPTY_ARRAY","sortBySelected","termsTree","terms","treeHasSelection","termTree","indexOf","id","undefined","children","map","filter","child","length","termOrChildIsSelected","termA","termB","termASelected","termBSelected","newTermTree","sort","findTerm","parent","name","term","parseInt","toLowerCase","getFilterMatcher","filterValue","matchTermsForFilter","originalTerm","HierarchicalTermSelector","slug","adding","setAdding","formName","setFormName","formParent","setFormParent","showForm","setShowForm","setFilterValue","filteredTermsTree","setFilteredTermsTree","debouncedSpeak","hasCreateAction","hasAssignAction","loading","availableTerms","taxonomy","select","getCurrentPost","getEditedPostAttribute","getTaxonomy","getEntityRecords","isResolving","_taxonomy","rest_base","editPost","saveEntityRecord","availableTermsTree","addTerm","onUpdateTerms","termIds","onChange","termId","hasTerm","includes","newTerms","onChangeFormName","value","onChangeFormParent","parentId","onToggleForm","onAddTerm","event","preventDefault","existingTerm","newTerm","termAddedMessage","setFilter","newFilteredTermsTree","getResultCount","count","i","resultCount","resultsFoundMessage","renderTerms","renderedTerms","labelWithFallback","labelProperty","fallbackIsCategory","fallbackIsNotCategory","newTermButtonLabel","newTermLabel","parentSelectLabel","noParentOption","newTermSubmitLabel","filterLabel","groupLabel","showFilter"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,GAAf,EAAoBC,IAApB,EAA0BC,QAAQ,IAAIC,cAAtC,EAAsDC,OAAtD,QAAqE,QAArE;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,EAAb,EAAiBC,EAAjB,EAAqBC,OAArB,QAAoC,iBAApC;AACA,SAASC,OAAT,EAAkBC,QAAlB,QAAkC,oBAAlC;AACA,SACCC,MADD,EAECC,eAFD,EAGCC,WAHD,EAICC,UAJD,EAKCC,WALD,QAMO,uBANP;AAOA,SAASC,WAAT,EAAsBC,SAAtB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K,EAAGtE,WAHT;AAIC,IAAA,QAAQ,EAAGoD;AAJZ,IAFF,EASC;AACC,IAAA,SAAS,EAAC,iDADX;AAEC,IAAA,QAAQ,EAAC,GAFV;AAGC,IAAA,IAAI,EAAC,OAHN;AAIC,kBAAamB;AAJd,KAMGZ,WAAW,CACZ,OAAO3D,WAAP,GAAqBc,iBAArB,GAAyCkB,kBAD7B,CANd,CATD,EAmBG,CAAEb,OAAF,IAAaF,eAAb,IACD,cAAC,MAAD;AACC,IAAA,OAAO,EAAG4B,YADX;AAEC,IAAA,SAAS,EAAC,gDAFX;AAGC,qBAAgBlC,QAHjB;AAIC,IAAA,OAAO,EAAC;AAJT,KAMGsD,kBANH,CApBF,EA6BGtD,QAAQ,IACT;AAAM,IAAA,QAAQ,EAAGmC;AAAjB,KACC,cAAC,WAAD;AACC,IAAA,SAAS,EAAC,kDADX;AAEC,IAAA,KAAK,EAAGoB,YAFT;AAGC,IAAA,KAAK,EAAG3D,QAHT;AAIC,IAAA,QAAQ,EAAGkC,gBAJZ;AAKC,IAAA,QAAQ;AALT,IADD,EAQG,CAAC,CAAErB,cAAc,CAACnC,MAAlB,IACD,cAAC,UAAD;AACC,IAAA,KAAK,EAAGkF,iBADT;AAEC,IAAA,aAAa,EAAGC,cAFjB;AAGC,IAAA,QAAQ,EAAGzB,kBAHZ;AAIC,IAAA,UAAU,EAAGlC,UAJd;AAKC,IAAA,IAAI,EAAGuB;AALR,IATF,EAiBC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,WADT;AAEC,IAAA,IAAI,EAAC,QAFN;AAGC,IAAA,SAAS,EAAC;AAHX,KAKGqC,kBALH,CAjBD,CA9BF,CADD;AA2DA;;AAED,eAAejH,WAAW,CAAE,yBAAF,CAAX,CACd+C,wBADc,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { find, get, some, unescape as unescapeString, without } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __, _n, _x, sprintf } from '@wordpress/i18n';\nimport { useMemo, useState } from '@wordpress/element';\nimport {\n\tButton,\n\tCheckboxControl,\n\tTextControl,\n\tTreeSelect,\n\twithFilters,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useDebounce } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport { buildTermsTree } from '../../utils/terms';\nimport { store as editorStore } from '../../store';\n\n/**\n * Module Constants\n */\nconst DEFAULT_QUERY = {\n\tper_page: -1,\n\torderby: 'name',\n\torder: 'asc',\n\t_fields: 'id,name,parent',\n\tcontext: 'view',\n};\n\nconst MIN_TERMS_COUNT_FOR_FILTER = 8;\n\nconst EMPTY_ARRAY = [];\n\n/**\n * Sort Terms by Selected.\n *\n * @param {Object[]} termsTree Array of terms in tree format.\n * @param {number[]} terms Selected terms.\n *\n * @return {Object[]} Sorted array of terms.\n */\nexport function sortBySelected( termsTree, terms ) {\n\tconst treeHasSelection = ( termTree ) => {\n\t\tif ( terms.indexOf( termTree.id ) !== -1 ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( undefined === termTree.children ) {\n\t\t\treturn false;\n\t\t}\n\t\treturn (\n\t\t\ttermTree.children\n\t\t\t\t.map( treeHasSelection )\n\t\t\t\t.filter( ( child ) => child ).length > 0\n\t\t);\n\t};\n\tconst termOrChildIsSelected = ( termA, termB ) => {\n\t\tconst termASelected = treeHasSelection( termA );\n\t\tconst termBSelected = treeHasSelection( termB );\n\n\t\tif ( termASelected === termBSelected ) {\n\t\t\treturn 0;\n\t\t}\n\n\t\tif ( termASelected && ! termBSelected ) {\n\t\t\treturn -1;\n\t\t}\n\n\t\tif ( ! termASelected && termBSelected ) {\n\t\t\treturn 1;\n\t\t}\n\n\t\treturn 0;\n\t};\n\tconst newTermTree = [ ...termsTree ];\n\tnewTermTree.sort( termOrChildIsSelected );\n\treturn newTermTree;\n}\n\n/**\n * Find term by parent id or name.\n *\n * @param {Object[]} terms Array of Terms.\n * @param {number|string} parent id.\n * @param {string} name Term name.\n * @return {Object} Term object.\n */\nexport function findTerm( terms, parent, name ) {\n\treturn find( terms, ( term ) => {\n\t\treturn (\n\t\t\t( ( ! term.parent && ! parent ) ||\n\t\t\t\tparseInt( term.parent ) === parseInt( parent ) ) &&\n\t\t\tterm.name.toLowerCase() === name.toLowerCase()\n\t\t);\n\t} );\n}\n\n/**\n * Get filter matcher function.\n *\n * @param {string} filterValue Filter value.\n * @return {(function(Object): (Object|boolean))} Matcher function.\n */\nexport function getFilterMatcher( filterValue ) {\n\tconst matchTermsForFilter = ( originalTerm ) => {\n\t\tif ( '' === filterValue ) {\n\t\t\treturn originalTerm;\n\t\t}\n\n\t\t// Shallow clone, because we'll be filtering the term's children and\n\t\t// don't want to modify the original term.\n\t\tconst term = { ...originalTerm };\n\n\t\t// Map and filter the children, recursive so we deal with grandchildren\n\t\t// and any deeper levels.\n\t\tif ( term.children.length > 0 ) {\n\t\t\tterm.children = term.children\n\t\t\t\t.map( matchTermsForFilter )\n\t\t\t\t.filter( ( child ) => child );\n\t\t}\n\n\t\t// If the term's name contains the filterValue, or it has children\n\t\t// (i.e. some child matched at some point in the tree) then return it.\n\t\tif (\n\t\t\t-1 !==\n\t\t\t\tterm.name.toLowerCase().indexOf( filterValue.toLowerCase() ) ||\n\t\t\tterm.children.length > 0\n\t\t) {\n\t\t\treturn term;\n\t\t}\n\n\t\t// Otherwise, return false. After mapping, the list of terms will need\n\t\t// to have false values filtered out.\n\t\treturn false;\n\t};\n\treturn matchTermsForFilter;\n}\n\n/**\n * Hierarchical term selector.\n *\n * @param {Object} props Component props.\n * @param {string} props.slug Taxonomy slug.\n * @return {WPElement} Hierarchical term selector component.\n */\nfunction HierarchicalTermSelector( { slug } ) {\n\tconst [ adding, setAdding ] = useState( false );\n\tconst [ formName, setFormName ] = useState( '' );\n\t/**\n\t * @type {[number|'', Function]}\n\t */\n\tconst [ formParent, setFormParent ] = useState( '' );\n\tconst [ showForm, setShowForm ] = useState( false );\n\tconst [ filterValue, setFilterValue ] = useState( '' );\n\tconst [ filteredTermsTree, setFilteredTermsTree ] = useState( [] );\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\n\tconst {\n\t\thasCreateAction,\n\t\thasAssignAction,\n\t\tterms,\n\t\tloading,\n\t\tavailableTerms,\n\t\ttaxonomy,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentPost, getEditedPostAttribute } = select(\n\t\t\t\teditorStore\n\t\t\t);\n\t\t\tconst { getTaxonomy, getEntityRecords, isResolving } = select(\n\t\t\t\tcoreStore\n\t\t\t);\n\t\t\tconst _taxonomy = getTaxonomy( slug );\n\n\t\t\treturn {\n\t\t\t\thasCreateAction: _taxonomy\n\t\t\t\t\t? get(\n\t\t\t\t\t\t\tgetCurrentPost(),\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t'_links',\n\t\t\t\t\t\t\t\t'wp:action-create-' + _taxonomy.rest_base,\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t )\n\t\t\t\t\t: false,\n\t\t\t\thasAssignAction: _taxonomy\n\t\t\t\t\t? get(\n\t\t\t\t\t\t\tgetCurrentPost(),\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t'_links',\n\t\t\t\t\t\t\t\t'wp:action-assign-' + _taxonomy.rest_base,\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t )\n\t\t\t\t\t: false,\n\t\t\t\tterms: _taxonomy\n\t\t\t\t\t? getEditedPostAttribute( _taxonomy.rest_base )\n\t\t\t\t\t: EMPTY_ARRAY,\n\t\t\t\tloading: isResolving( 'getEntityRecords', [\n\t\t\t\t\t'taxonomy',\n\t\t\t\t\tslug,\n\t\t\t\t\tDEFAULT_QUERY,\n\t\t\t\t] ),\n\t\t\t\tavailableTerms:\n\t\t\t\t\tgetEntityRecords( 'taxonomy', slug, DEFAULT_QUERY ) ||\n\t\t\t\t\tEMPTY_ARRAY,\n\t\t\t\ttaxonomy: _taxonomy,\n\t\t\t};\n\t\t},\n\t\t[ slug ]\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\tconst availableTermsTree = useMemo(\n\t\t() => sortBySelected( buildTermsTree( availableTerms ), terms ),\n\t\t// Remove `terms` from the dependency list to avoid reordering every time\n\t\t// checking or unchecking a term.\n\t\t[ availableTerms ]\n\t);\n\n\tif ( ! hasAssignAction ) {\n\t\treturn null;\n\t}\n\n\t/**\n\t * Append new term.\n\t *\n\t * @param {Object} term Term object.\n\t * @return {Promise} A promise that resolves to save term object.\n\t */\n\tconst addTerm = ( term ) => {\n\t\treturn saveEntityRecord( 'taxonomy', slug, term );\n\t};\n\n\t/**\n\t * Update terms for post.\n\t *\n\t * @param {number[]} termIds Term ids.\n\t */\n\tconst onUpdateTerms = ( termIds ) => {\n\t\teditPost( { [ taxonomy.rest_base ]: termIds } );\n\t};\n\n\t/**\n\t * Handler for checking term.\n\t *\n\t * @param {number} termId\n\t */\n\tconst onChange = ( termId ) => {\n\t\tconst hasTerm = terms.includes( termId );\n\t\tconst newTerms = hasTerm\n\t\t\t? without( terms, termId )\n\t\t\t: [ ...terms, termId ];\n\t\tonUpdateTerms( newTerms );\n\t};\n\n\tconst onChangeFormName = ( value ) => {\n\t\tsetFormName( value );\n\t};\n\n\t/**\n\t * Handler for changing form parent.\n\t *\n\t * @param {number|''} parentId Parent post id.\n\t */\n\tconst onChangeFormParent = ( parentId ) => {\n\t\tsetFormParent( parentId );\n\t};\n\n\tconst onToggleForm = () => {\n\t\tsetShowForm( ! showForm );\n\t};\n\n\tconst onAddTerm = async ( event ) => {\n\t\tevent.preventDefault();\n\t\tif ( formName === '' || adding ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// check if the term we are adding already exists\n\t\tconst existingTerm = findTerm( availableTerms, formParent, formName );\n\t\tif ( existingTerm ) {\n\t\t\t// if the term we are adding exists but is not selected select it\n\t\t\tif ( ! some( terms, ( term ) => term === existingTerm.id ) ) {\n\t\t\t\tonUpdateTerms( [ ...terms, existingTerm.id ] );\n\t\t\t}\n\n\t\t\tsetFormName( '' );\n\t\t\tsetFormParent( '' );\n\n\t\t\treturn;\n\t\t}\n\t\tsetAdding( true );\n\n\t\tconst newTerm = await addTerm( {\n\t\t\tname: formName,\n\t\t\tparent: formParent ? formParent : undefined,\n\t\t} );\n\n\t\tconst termAddedMessage = sprintf(\n\t\t\t/* translators: %s: taxonomy name */\n\t\t\t_x( '%s added', 'term' ),\n\t\t\tget(\n\t\t\t\ttaxonomy,\n\t\t\t\t[ 'labels', 'singular_name' ],\n\t\t\t\tslug === 'category' ? __( 'Category' ) : __( 'Term' )\n\t\t\t)\n\t\t);\n\t\tspeak( termAddedMessage, 'assertive' );\n\t\tsetAdding( false );\n\t\tsetFormName( '' );\n\t\tsetFormParent( '' );\n\t\tonUpdateTerms( [ ...terms, newTerm.id ] );\n\t};\n\n\tconst setFilter = ( value ) => {\n\t\tconst newFilteredTermsTree = availableTermsTree\n\t\t\t.map( getFilterMatcher( value ) )\n\t\t\t.filter( ( term ) => term );\n\t\tconst getResultCount = ( termsTree ) => {\n\t\t\tlet count = 0;\n\t\t\tfor ( let i = 0; i < termsTree.length; i++ ) {\n\t\t\t\tcount++;\n\t\t\t\tif ( undefined !== termsTree[ i ].children ) {\n\t\t\t\t\tcount += getResultCount( termsTree[ i ].children );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn count;\n\t\t};\n\n\t\tsetFilterValue( value );\n\t\tsetFilteredTermsTree( newFilteredTermsTree );\n\n\t\tconst resultCount = getResultCount( newFilteredTermsTree );\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results */\n\t\t\t_n( '%d result found.', '%d results found.', resultCount ),\n\t\t\tresultCount\n\t\t);\n\n\t\tdebouncedSpeak( resultsFoundMessage, 'assertive' );\n\t};\n\n\tconst renderTerms = ( renderedTerms ) => {\n\t\treturn renderedTerms.map( ( term ) => {\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tkey={ term.id }\n\t\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-choice\"\n\t\t\t\t>\n\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\tchecked={ terms.indexOf( term.id ) !== -1 }\n\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\tconst termId = parseInt( term.id, 10 );\n\t\t\t\t\t\t\tonChange( termId );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ unescapeString( term.name ) }\n\t\t\t\t\t/>\n\t\t\t\t\t{ !! term.children.length && (\n\t\t\t\t\t\t<div className=\"editor-post-taxonomies__hierarchical-terms-subchoices\">\n\t\t\t\t\t\t\t{ renderTerms( term.children ) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t);\n\t\t} );\n\t};\n\n\tconst labelWithFallback = (\n\t\tlabelProperty,\n\t\tfallbackIsCategory,\n\t\tfallbackIsNotCategory\n\t) =>\n\t\tget(\n\t\t\ttaxonomy,\n\t\t\t[ 'labels', labelProperty ],\n\t\t\tslug === 'category' ? fallbackIsCategory : fallbackIsNotCategory\n\t\t);\n\tconst newTermButtonLabel = labelWithFallback(\n\t\t'add_new_item',\n\t\t__( 'Add new category' ),\n\t\t__( 'Add new term' )\n\t);\n\tconst newTermLabel = labelWithFallback(\n\t\t'new_item_name',\n\t\t__( 'Add new category' ),\n\t\t__( 'Add new term' )\n\t);\n\tconst parentSelectLabel = labelWithFallback(\n\t\t'parent_item',\n\t\t__( 'Parent Category' ),\n\t\t__( 'Parent Term' )\n\t);\n\tconst noParentOption = `— ${ parentSelectLabel } —`;\n\tconst newTermSubmitLabel = newTermButtonLabel;\n\tconst filterLabel = get(\n\t\ttaxonomy,\n\t\t[ 'labels', 'search_items' ],\n\t\t__( 'Search Terms' )\n\t);\n\tconst groupLabel = get( taxonomy, [ 'name' ], __( 'Terms' ) );\n\tconst showFilter = availableTerms.length >= MIN_TERMS_COUNT_FOR_FILTER;\n\n\treturn (\n\t\t<>\n\t\t\t{ showFilter && (\n\t\t\t\t<TextControl\n\t\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-filter\"\n\t\t\t\t\tlabel={ filterLabel }\n\t\t\t\t\tvalue={ filterValue }\n\t\t\t\t\tonChange={ setFilter }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<div\n\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-list\"\n\t\t\t\ttabIndex=\"0\"\n\t\t\t\trole=\"group\"\n\t\t\t\taria-label={ groupLabel }\n\t\t\t>\n\t\t\t\t{ renderTerms(\n\t\t\t\t\t'' !== filterValue ? filteredTermsTree : availableTermsTree\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t{ ! loading && hasCreateAction && (\n\t\t\t\t<Button\n\t\t\t\t\tonClick={ onToggleForm }\n\t\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-add\"\n\t\t\t\t\taria-expanded={ showForm }\n\t\t\t\t\tvariant=\"link\"\n\t\t\t\t>\n\t\t\t\t\t{ newTermButtonLabel }\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t\t{ showForm && (\n\t\t\t\t<form onSubmit={ onAddTerm }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-input\"\n\t\t\t\t\t\tlabel={ newTermLabel }\n\t\t\t\t\t\tvalue={ formName }\n\t\t\t\t\t\tonChange={ onChangeFormName }\n\t\t\t\t\t\trequired\n\t\t\t\t\t/>\n\t\t\t\t\t{ !! availableTerms.length && (\n\t\t\t\t\t\t<TreeSelect\n\t\t\t\t\t\t\tlabel={ parentSelectLabel }\n\t\t\t\t\t\t\tnoOptionLabel={ noParentOption }\n\t\t\t\t\t\t\tonChange={ onChangeFormParent }\n\t\t\t\t\t\t\tselectedId={ formParent }\n\t\t\t\t\t\t\ttree={ availableTermsTree }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-submit\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ newTermSubmitLabel }\n\t\t\t\t\t</Button>\n\t\t\t\t</form>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default withFilters( 'editor.PostTaxonomyType' )(\n\tHierarchicalTermSelector\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-taxonomies/hierarchical-term-selector.js"],"names":["find","get","some","unescape","unescapeString","without","__","_n","_x","sprintf","useMemo","useState","Button","CheckboxControl","TextControl","TreeSelect","withFilters","useDispatch","useSelect","useDebounce","store","coreStore","speak","buildTermsTree","editorStore","DEFAULT_QUERY","per_page","orderby","order","_fields","context","MIN_TERMS_COUNT_FOR_FILTER","EMPTY_ARRAY","sortBySelected","termsTree","terms","treeHasSelection","termTree","indexOf","id","undefined","children","map","filter","child","length","termOrChildIsSelected","termA","termB","termASelected","termBSelected","newTermTree","sort","findTerm","parent","name","term","parseInt","toLowerCase","getFilterMatcher","filterValue","matchTermsForFilter","originalTerm","HierarchicalTermSelector","slug","adding","setAdding","formName","setFormName","formParent","setFormParent","showForm","setShowForm","setFilterValue","filteredTermsTree","setFilteredTermsTree","debouncedSpeak","hasCreateAction","hasAssignAction","loading","availableTerms","taxonomy","select","getCurrentPost","getEditedPostAttribute","getTaxonomy","getEntityRecords","isResolving","_taxonomy","rest_base","editPost","saveEntityRecord","availableTermsTree","addTerm","onUpdateTerms","termIds","onChange","termId","hasTerm","includes","newTerms","onChangeFormName","value","onChangeFormParent","parentId","onToggleForm","onAddTerm","event","preventDefault","existingTerm","newTerm","termAddedMessage","setFilter","newFilteredTermsTree","getResultCount","count","i","resultCount","resultsFoundMessage","renderTerms","renderedTerms","labelWithFallback","labelProperty","fallbackIsCategory","fallbackIsNotCategory","newTermButtonLabel","newTermLabel","parentSelectLabel","noParentOption","newTermSubmitLabel","filterLabel","groupLabel","showFilter"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,GAAf,EAAoBC,IAApB,EAA0BC,QAAQ,IAAIC,cAAtC,EAAsDC,OAAtD,QAAqE,QAArE;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,EAAb,EAAiBC,EAAjB,EAAqBC,OAArB,QAAoC,iBAApC;AACA,SAASC,OAAT,EAAkBC,QAAlB,QAAkC,oBAAlC;AACA,SACCC,MADD,EAECC,eAFD,EAGCC,WAHD,EAICC,UAJD,EAKCC,WALD,QAMO,uBANP;AAOA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,WAAT,QAA4B,oBAA5B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,KAAT,QAAsB,iBAAtB;AAEA;AACA;AACA;;AACA,SAASC,cAAT,QAA+B,mBAA/B;AACA,SAASH,KAAK,IAAII,WAAlB,QAAqC,aAArC;AAEA;AACA;AACA;;AACA,MAAMC,aAAa,GAAG;AACrBC,EAAAA,QAAQ,EAAE,CAAC,CADU;AAErBC,EAAAA,OAAO,EAAE,MAFY;AAGrBC,EAAAA,KAAK,EAAE,KAHc;AAIrBC,EAAAA,OAAO,EAAE,gBAJY;AAKrBC,EAAAA,OAAO,EAAE;AALY,CAAtB;AAQA,MAAMC,0BAA0B,GAAG,CAAnC;AAEA,MAAMC,WAAW,GAAG,EAApB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,cAAT,CAAyBC,SAAzB,EAAoCC,KAApC,EAA4C;AAClD,QAAMC,gBAAgB,GAAKC,QAAF,IAAgB;AACxC,QAAKF,KAAK,CAACG,OAAN,CAAeD,QAAQ,CAACE,EAAxB,MAAiC,CAAC,CAAvC,EAA2C;AAC1C,aAAO,IAAP;AAC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T;AAEC,IAAA,aAAa,EAAGC,cAFjB;AAGC,IAAA,QAAQ,EAAGzB,kBAHZ;AAIC,IAAA,UAAU,EAAGlC,UAJd;AAKC,IAAA,IAAI,EAAGuB;AALR,IATF,EAiBC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,WADT;AAEC,IAAA,IAAI,EAAC,QAFN;AAGC,IAAA,SAAS,EAAC;AAHX,KAKGqC,kBALH,CAjBD,CA9BF,CADD;AA2DA;;AAED,eAAejH,WAAW,CAAE,yBAAF,CAAX,CACd+C,wBADc,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { find, get, some, unescape as unescapeString, without } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __, _n, _x, sprintf } from '@wordpress/i18n';\nimport { useMemo, useState } from '@wordpress/element';\nimport {\n\tButton,\n\tCheckboxControl,\n\tTextControl,\n\tTreeSelect,\n\twithFilters,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useDebounce } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport { buildTermsTree } from '../../utils/terms';\nimport { store as editorStore } from '../../store';\n\n/**\n * Module Constants\n */\nconst DEFAULT_QUERY = {\n\tper_page: -1,\n\torderby: 'name',\n\torder: 'asc',\n\t_fields: 'id,name,parent',\n\tcontext: 'view',\n};\n\nconst MIN_TERMS_COUNT_FOR_FILTER = 8;\n\nconst EMPTY_ARRAY = [];\n\n/**\n * Sort Terms by Selected.\n *\n * @param {Object[]} termsTree Array of terms in tree format.\n * @param {number[]} terms Selected terms.\n *\n * @return {Object[]} Sorted array of terms.\n */\nexport function sortBySelected( termsTree, terms ) {\n\tconst treeHasSelection = ( termTree ) => {\n\t\tif ( terms.indexOf( termTree.id ) !== -1 ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( undefined === termTree.children ) {\n\t\t\treturn false;\n\t\t}\n\t\treturn (\n\t\t\ttermTree.children\n\t\t\t\t.map( treeHasSelection )\n\t\t\t\t.filter( ( child ) => child ).length > 0\n\t\t);\n\t};\n\tconst termOrChildIsSelected = ( termA, termB ) => {\n\t\tconst termASelected = treeHasSelection( termA );\n\t\tconst termBSelected = treeHasSelection( termB );\n\n\t\tif ( termASelected === termBSelected ) {\n\t\t\treturn 0;\n\t\t}\n\n\t\tif ( termASelected && ! termBSelected ) {\n\t\t\treturn -1;\n\t\t}\n\n\t\tif ( ! termASelected && termBSelected ) {\n\t\t\treturn 1;\n\t\t}\n\n\t\treturn 0;\n\t};\n\tconst newTermTree = [ ...termsTree ];\n\tnewTermTree.sort( termOrChildIsSelected );\n\treturn newTermTree;\n}\n\n/**\n * Find term by parent id or name.\n *\n * @param {Object[]} terms Array of Terms.\n * @param {number|string} parent id.\n * @param {string} name Term name.\n * @return {Object} Term object.\n */\nexport function findTerm( terms, parent, name ) {\n\treturn find( terms, ( term ) => {\n\t\treturn (\n\t\t\t( ( ! term.parent && ! parent ) ||\n\t\t\t\tparseInt( term.parent ) === parseInt( parent ) ) &&\n\t\t\tterm.name.toLowerCase() === name.toLowerCase()\n\t\t);\n\t} );\n}\n\n/**\n * Get filter matcher function.\n *\n * @param {string} filterValue Filter value.\n * @return {(function(Object): (Object|boolean))} Matcher function.\n */\nexport function getFilterMatcher( filterValue ) {\n\tconst matchTermsForFilter = ( originalTerm ) => {\n\t\tif ( '' === filterValue ) {\n\t\t\treturn originalTerm;\n\t\t}\n\n\t\t// Shallow clone, because we'll be filtering the term's children and\n\t\t// don't want to modify the original term.\n\t\tconst term = { ...originalTerm };\n\n\t\t// Map and filter the children, recursive so we deal with grandchildren\n\t\t// and any deeper levels.\n\t\tif ( term.children.length > 0 ) {\n\t\t\tterm.children = term.children\n\t\t\t\t.map( matchTermsForFilter )\n\t\t\t\t.filter( ( child ) => child );\n\t\t}\n\n\t\t// If the term's name contains the filterValue, or it has children\n\t\t// (i.e. some child matched at some point in the tree) then return it.\n\t\tif (\n\t\t\t-1 !==\n\t\t\t\tterm.name.toLowerCase().indexOf( filterValue.toLowerCase() ) ||\n\t\t\tterm.children.length > 0\n\t\t) {\n\t\t\treturn term;\n\t\t}\n\n\t\t// Otherwise, return false. After mapping, the list of terms will need\n\t\t// to have false values filtered out.\n\t\treturn false;\n\t};\n\treturn matchTermsForFilter;\n}\n\n/**\n * Hierarchical term selector.\n *\n * @param {Object} props Component props.\n * @param {string} props.slug Taxonomy slug.\n * @return {WPElement} Hierarchical term selector component.\n */\nfunction HierarchicalTermSelector( { slug } ) {\n\tconst [ adding, setAdding ] = useState( false );\n\tconst [ formName, setFormName ] = useState( '' );\n\t/**\n\t * @type {[number|'', Function]}\n\t */\n\tconst [ formParent, setFormParent ] = useState( '' );\n\tconst [ showForm, setShowForm ] = useState( false );\n\tconst [ filterValue, setFilterValue ] = useState( '' );\n\tconst [ filteredTermsTree, setFilteredTermsTree ] = useState( [] );\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\n\tconst {\n\t\thasCreateAction,\n\t\thasAssignAction,\n\t\tterms,\n\t\tloading,\n\t\tavailableTerms,\n\t\ttaxonomy,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentPost, getEditedPostAttribute } = select(\n\t\t\t\teditorStore\n\t\t\t);\n\t\t\tconst { getTaxonomy, getEntityRecords, isResolving } = select(\n\t\t\t\tcoreStore\n\t\t\t);\n\t\t\tconst _taxonomy = getTaxonomy( slug );\n\n\t\t\treturn {\n\t\t\t\thasCreateAction: _taxonomy\n\t\t\t\t\t? get(\n\t\t\t\t\t\t\tgetCurrentPost(),\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t'_links',\n\t\t\t\t\t\t\t\t'wp:action-create-' + _taxonomy.rest_base,\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t )\n\t\t\t\t\t: false,\n\t\t\t\thasAssignAction: _taxonomy\n\t\t\t\t\t? get(\n\t\t\t\t\t\t\tgetCurrentPost(),\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t'_links',\n\t\t\t\t\t\t\t\t'wp:action-assign-' + _taxonomy.rest_base,\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t )\n\t\t\t\t\t: false,\n\t\t\t\tterms: _taxonomy\n\t\t\t\t\t? getEditedPostAttribute( _taxonomy.rest_base )\n\t\t\t\t\t: EMPTY_ARRAY,\n\t\t\t\tloading: isResolving( 'getEntityRecords', [\n\t\t\t\t\t'taxonomy',\n\t\t\t\t\tslug,\n\t\t\t\t\tDEFAULT_QUERY,\n\t\t\t\t] ),\n\t\t\t\tavailableTerms:\n\t\t\t\t\tgetEntityRecords( 'taxonomy', slug, DEFAULT_QUERY ) ||\n\t\t\t\t\tEMPTY_ARRAY,\n\t\t\t\ttaxonomy: _taxonomy,\n\t\t\t};\n\t\t},\n\t\t[ slug ]\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\tconst availableTermsTree = useMemo(\n\t\t() => sortBySelected( buildTermsTree( availableTerms ), terms ),\n\t\t// Remove `terms` from the dependency list to avoid reordering every time\n\t\t// checking or unchecking a term.\n\t\t[ availableTerms ]\n\t);\n\n\tif ( ! hasAssignAction ) {\n\t\treturn null;\n\t}\n\n\t/**\n\t * Append new term.\n\t *\n\t * @param {Object} term Term object.\n\t * @return {Promise} A promise that resolves to save term object.\n\t */\n\tconst addTerm = ( term ) => {\n\t\treturn saveEntityRecord( 'taxonomy', slug, term );\n\t};\n\n\t/**\n\t * Update terms for post.\n\t *\n\t * @param {number[]} termIds Term ids.\n\t */\n\tconst onUpdateTerms = ( termIds ) => {\n\t\teditPost( { [ taxonomy.rest_base ]: termIds } );\n\t};\n\n\t/**\n\t * Handler for checking term.\n\t *\n\t * @param {number} termId\n\t */\n\tconst onChange = ( termId ) => {\n\t\tconst hasTerm = terms.includes( termId );\n\t\tconst newTerms = hasTerm\n\t\t\t? without( terms, termId )\n\t\t\t: [ ...terms, termId ];\n\t\tonUpdateTerms( newTerms );\n\t};\n\n\tconst onChangeFormName = ( value ) => {\n\t\tsetFormName( value );\n\t};\n\n\t/**\n\t * Handler for changing form parent.\n\t *\n\t * @param {number|''} parentId Parent post id.\n\t */\n\tconst onChangeFormParent = ( parentId ) => {\n\t\tsetFormParent( parentId );\n\t};\n\n\tconst onToggleForm = () => {\n\t\tsetShowForm( ! showForm );\n\t};\n\n\tconst onAddTerm = async ( event ) => {\n\t\tevent.preventDefault();\n\t\tif ( formName === '' || adding ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// check if the term we are adding already exists\n\t\tconst existingTerm = findTerm( availableTerms, formParent, formName );\n\t\tif ( existingTerm ) {\n\t\t\t// if the term we are adding exists but is not selected select it\n\t\t\tif ( ! some( terms, ( term ) => term === existingTerm.id ) ) {\n\t\t\t\tonUpdateTerms( [ ...terms, existingTerm.id ] );\n\t\t\t}\n\n\t\t\tsetFormName( '' );\n\t\t\tsetFormParent( '' );\n\n\t\t\treturn;\n\t\t}\n\t\tsetAdding( true );\n\n\t\tconst newTerm = await addTerm( {\n\t\t\tname: formName,\n\t\t\tparent: formParent ? formParent : undefined,\n\t\t} );\n\n\t\tconst termAddedMessage = sprintf(\n\t\t\t/* translators: %s: taxonomy name */\n\t\t\t_x( '%s added', 'term' ),\n\t\t\tget(\n\t\t\t\ttaxonomy,\n\t\t\t\t[ 'labels', 'singular_name' ],\n\t\t\t\tslug === 'category' ? __( 'Category' ) : __( 'Term' )\n\t\t\t)\n\t\t);\n\t\tspeak( termAddedMessage, 'assertive' );\n\t\tsetAdding( false );\n\t\tsetFormName( '' );\n\t\tsetFormParent( '' );\n\t\tonUpdateTerms( [ ...terms, newTerm.id ] );\n\t};\n\n\tconst setFilter = ( value ) => {\n\t\tconst newFilteredTermsTree = availableTermsTree\n\t\t\t.map( getFilterMatcher( value ) )\n\t\t\t.filter( ( term ) => term );\n\t\tconst getResultCount = ( termsTree ) => {\n\t\t\tlet count = 0;\n\t\t\tfor ( let i = 0; i < termsTree.length; i++ ) {\n\t\t\t\tcount++;\n\t\t\t\tif ( undefined !== termsTree[ i ].children ) {\n\t\t\t\t\tcount += getResultCount( termsTree[ i ].children );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn count;\n\t\t};\n\n\t\tsetFilterValue( value );\n\t\tsetFilteredTermsTree( newFilteredTermsTree );\n\n\t\tconst resultCount = getResultCount( newFilteredTermsTree );\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results */\n\t\t\t_n( '%d result found.', '%d results found.', resultCount ),\n\t\t\tresultCount\n\t\t);\n\n\t\tdebouncedSpeak( resultsFoundMessage, 'assertive' );\n\t};\n\n\tconst renderTerms = ( renderedTerms ) => {\n\t\treturn renderedTerms.map( ( term ) => {\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tkey={ term.id }\n\t\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-choice\"\n\t\t\t\t>\n\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\tchecked={ terms.indexOf( term.id ) !== -1 }\n\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\tconst termId = parseInt( term.id, 10 );\n\t\t\t\t\t\t\tonChange( termId );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ unescapeString( term.name ) }\n\t\t\t\t\t/>\n\t\t\t\t\t{ !! term.children.length && (\n\t\t\t\t\t\t<div className=\"editor-post-taxonomies__hierarchical-terms-subchoices\">\n\t\t\t\t\t\t\t{ renderTerms( term.children ) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t);\n\t\t} );\n\t};\n\n\tconst labelWithFallback = (\n\t\tlabelProperty,\n\t\tfallbackIsCategory,\n\t\tfallbackIsNotCategory\n\t) =>\n\t\tget(\n\t\t\ttaxonomy,\n\t\t\t[ 'labels', labelProperty ],\n\t\t\tslug === 'category' ? fallbackIsCategory : fallbackIsNotCategory\n\t\t);\n\tconst newTermButtonLabel = labelWithFallback(\n\t\t'add_new_item',\n\t\t__( 'Add new category' ),\n\t\t__( 'Add new term' )\n\t);\n\tconst newTermLabel = labelWithFallback(\n\t\t'new_item_name',\n\t\t__( 'Add new category' ),\n\t\t__( 'Add new term' )\n\t);\n\tconst parentSelectLabel = labelWithFallback(\n\t\t'parent_item',\n\t\t__( 'Parent Category' ),\n\t\t__( 'Parent Term' )\n\t);\n\tconst noParentOption = `— ${ parentSelectLabel } —`;\n\tconst newTermSubmitLabel = newTermButtonLabel;\n\tconst filterLabel = get(\n\t\ttaxonomy,\n\t\t[ 'labels', 'search_items' ],\n\t\t__( 'Search Terms' )\n\t);\n\tconst groupLabel = get( taxonomy, [ 'name' ], __( 'Terms' ) );\n\tconst showFilter = availableTerms.length >= MIN_TERMS_COUNT_FOR_FILTER;\n\n\treturn (\n\t\t<>\n\t\t\t{ showFilter && (\n\t\t\t\t<TextControl\n\t\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-filter\"\n\t\t\t\t\tlabel={ filterLabel }\n\t\t\t\t\tvalue={ filterValue }\n\t\t\t\t\tonChange={ setFilter }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<div\n\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-list\"\n\t\t\t\ttabIndex=\"0\"\n\t\t\t\trole=\"group\"\n\t\t\t\taria-label={ groupLabel }\n\t\t\t>\n\t\t\t\t{ renderTerms(\n\t\t\t\t\t'' !== filterValue ? filteredTermsTree : availableTermsTree\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t{ ! loading && hasCreateAction && (\n\t\t\t\t<Button\n\t\t\t\t\tonClick={ onToggleForm }\n\t\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-add\"\n\t\t\t\t\taria-expanded={ showForm }\n\t\t\t\t\tvariant=\"link\"\n\t\t\t\t>\n\t\t\t\t\t{ newTermButtonLabel }\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t\t{ showForm && (\n\t\t\t\t<form onSubmit={ onAddTerm }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-input\"\n\t\t\t\t\t\tlabel={ newTermLabel }\n\t\t\t\t\t\tvalue={ formName }\n\t\t\t\t\t\tonChange={ onChangeFormName }\n\t\t\t\t\t\trequired\n\t\t\t\t\t/>\n\t\t\t\t\t{ !! availableTerms.length && (\n\t\t\t\t\t\t<TreeSelect\n\t\t\t\t\t\t\tlabel={ parentSelectLabel }\n\t\t\t\t\t\t\tnoOptionLabel={ noParentOption }\n\t\t\t\t\t\t\tonChange={ onChangeFormParent }\n\t\t\t\t\t\t\tselectedId={ formParent }\n\t\t\t\t\t\t\ttree={ availableTermsTree }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-submit\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ newTermSubmitLabel }\n\t\t\t\t\t</Button>\n\t\t\t\t</form>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default withFilters( 'editor.PostTaxonomyType' )(\n\tHierarchicalTermSelector\n);\n"]}
@@ -19,11 +19,12 @@ import { store as coreStore } from '@wordpress/core-data';
19
19
  import HierarchicalTermSelector from './hierarchical-term-selector';
20
20
  import FlatTermSelector from './flat-term-selector';
21
21
  import { store as editorStore } from '../../store';
22
- export function PostTaxonomies({
23
- postType,
24
- taxonomies,
25
- taxonomyWrapper = identity
26
- }) {
22
+ export function PostTaxonomies(_ref) {
23
+ let {
24
+ postType,
25
+ taxonomies,
26
+ taxonomyWrapper = identity
27
+ } = _ref;
27
28
  const availableTaxonomies = filter(taxonomies, taxonomy => includes(taxonomy.types, postType));
28
29
  const visibleTaxonomies = filter(availableTaxonomies, taxonomy => taxonomy.visibility.show_ui);
29
30
  return visibleTaxonomies.map(taxonomy => {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-taxonomies/index.js"],"names":["filter","identity","includes","Fragment","withSelect","compose","store","coreStore","HierarchicalTermSelector","FlatTermSelector","editorStore","PostTaxonomies","postType","taxonomies","taxonomyWrapper","availableTaxonomies","taxonomy","types","visibleTaxonomies","visibility","show_ui","map","TaxonomyComponent","hierarchical","slug","select","getCurrentPostType","getTaxonomies","per_page"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,EAAiBC,QAAjB,EAA2BC,QAA3B,QAA2C,QAA3C;AAEA;AACA;AACA;;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,UAAT,QAA2B,iBAA3B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,wBAAP,MAAqC,8BAArC;AACA,OAAOC,gBAAP,MAA6B,sBAA7B;AACA,SAASH,KAAK,IAAII,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,cAAT,CAAyB;AAC/BC,EAAAA,QAD+B;AAE/BC,EAAAA,UAF+B;AAG/BC,EAAAA,eAAe,GAAGb;AAHa,CAAzB,EAIH;AACH,QAAMc,mBAAmB,GAAGf,MAAM,CAAEa,UAAF,EAAgBG,QAAF,IAC/Cd,QAAQ,CAAEc,QAAQ,CAACC,KAAX,EAAkBL,QAAlB,CADyB,CAAlC;AAGA,QAAMM,iBAAiB,GAAGlB,MAAM,CAC/Be,mBAD+B,EAE7BC,QAAF,IAAgBA,QAAQ,CAACG,UAAT,CAAoBC,OAFL,CAAhC;AAIA,SAAOF,iBAAiB,CAACG,GAAlB,CAAyBL,QAAF,IAAgB;AAC7C,UAAMM,iBAAiB,GAAGN,QAAQ,CAACO,YAAT,GACvBf,wBADuB,GAEvBC,gBAFH;AAGA,WACC,cAAC,QAAD;AAAU,MAAA,GAAG,EAAI,YAAYO,QAAQ,CAACQ,IAAM;AAA5C,OACGV,eAAe,CAChB,cAAC,iBAAD;AAAmB,MAAA,IAAI,EAAGE,QAAQ,CAACQ;AAAnC,MADgB,EAEhBR,QAFgB,CADlB,CADD;AAQA,GAZM,CAAP;AAaA;AAED,eAAeX,OAAO,CAAE,CACvBD,UAAU,CAAIqB,MAAF,IAAc;AACzB,SAAO;AACNb,IAAAA,QAAQ,EAAEa,MAAM,CAAEf,WAAF,CAAN,CAAsBgB,kBAAtB,EADJ;AAENb,IAAAA,UAAU,EAAEY,MAAM,CAAElB,SAAF,CAAN,CAAoBoB,aAApB,CAAmC;AAAEC,MAAAA,QAAQ,EAAE,CAAC;AAAb,KAAnC;AAFN,GAAP;AAIA,CALS,CADa,CAAF,CAAP,CAOVjB,cAPU,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { filter, identity, includes } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Fragment } from '@wordpress/element';\nimport { withSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport HierarchicalTermSelector from './hierarchical-term-selector';\nimport FlatTermSelector from './flat-term-selector';\nimport { store as editorStore } from '../../store';\n\nexport function PostTaxonomies( {\n\tpostType,\n\ttaxonomies,\n\ttaxonomyWrapper = identity,\n} ) {\n\tconst availableTaxonomies = filter( taxonomies, ( taxonomy ) =>\n\t\tincludes( taxonomy.types, postType )\n\t);\n\tconst visibleTaxonomies = filter(\n\t\tavailableTaxonomies,\n\t\t( taxonomy ) => taxonomy.visibility.show_ui\n\t);\n\treturn visibleTaxonomies.map( ( taxonomy ) => {\n\t\tconst TaxonomyComponent = taxonomy.hierarchical\n\t\t\t? HierarchicalTermSelector\n\t\t\t: FlatTermSelector;\n\t\treturn (\n\t\t\t<Fragment key={ `taxonomy-${ taxonomy.slug }` }>\n\t\t\t\t{ taxonomyWrapper(\n\t\t\t\t\t<TaxonomyComponent slug={ taxonomy.slug } />,\n\t\t\t\t\ttaxonomy\n\t\t\t\t) }\n\t\t\t</Fragment>\n\t\t);\n\t} );\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostType: select( editorStore ).getCurrentPostType(),\n\t\t\ttaxonomies: select( coreStore ).getTaxonomies( { per_page: -1 } ),\n\t\t};\n\t} ),\n] )( PostTaxonomies );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-taxonomies/index.js"],"names":["filter","identity","includes","Fragment","withSelect","compose","store","coreStore","HierarchicalTermSelector","FlatTermSelector","editorStore","PostTaxonomies","postType","taxonomies","taxonomyWrapper","availableTaxonomies","taxonomy","types","visibleTaxonomies","visibility","show_ui","map","TaxonomyComponent","hierarchical","slug","select","getCurrentPostType","getTaxonomies","per_page"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,EAAiBC,QAAjB,EAA2BC,QAA3B,QAA2C,QAA3C;AAEA;AACA;AACA;;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,UAAT,QAA2B,iBAA3B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,wBAAP,MAAqC,8BAArC;AACA,OAAOC,gBAAP,MAA6B,sBAA7B;AACA,SAASH,KAAK,IAAII,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,cAAT,OAIH;AAAA,MAJ4B;AAC/BC,IAAAA,QAD+B;AAE/BC,IAAAA,UAF+B;AAG/BC,IAAAA,eAAe,GAAGb;AAHa,GAI5B;AACH,QAAMc,mBAAmB,GAAGf,MAAM,CAAEa,UAAF,EAAgBG,QAAF,IAC/Cd,QAAQ,CAAEc,QAAQ,CAACC,KAAX,EAAkBL,QAAlB,CADyB,CAAlC;AAGA,QAAMM,iBAAiB,GAAGlB,MAAM,CAC/Be,mBAD+B,EAE7BC,QAAF,IAAgBA,QAAQ,CAACG,UAAT,CAAoBC,OAFL,CAAhC;AAIA,SAAOF,iBAAiB,CAACG,GAAlB,CAAyBL,QAAF,IAAgB;AAC7C,UAAMM,iBAAiB,GAAGN,QAAQ,CAACO,YAAT,GACvBf,wBADuB,GAEvBC,gBAFH;AAGA,WACC,cAAC,QAAD;AAAU,MAAA,GAAG,EAAI,YAAYO,QAAQ,CAACQ,IAAM;AAA5C,OACGV,eAAe,CAChB,cAAC,iBAAD;AAAmB,MAAA,IAAI,EAAGE,QAAQ,CAACQ;AAAnC,MADgB,EAEhBR,QAFgB,CADlB,CADD;AAQA,GAZM,CAAP;AAaA;AAED,eAAeX,OAAO,CAAE,CACvBD,UAAU,CAAIqB,MAAF,IAAc;AACzB,SAAO;AACNb,IAAAA,QAAQ,EAAEa,MAAM,CAAEf,WAAF,CAAN,CAAsBgB,kBAAtB,EADJ;AAENb,IAAAA,UAAU,EAAEY,MAAM,CAAElB,SAAF,CAAN,CAAoBoB,aAApB,CAAmC;AAAEC,MAAAA,QAAQ,EAAE,CAAC;AAAb,KAAnC;AAFN,GAAP;AAIA,CALS,CADa,CAAF,CAAP,CAOVjB,cAPU,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { filter, identity, includes } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Fragment } from '@wordpress/element';\nimport { withSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport HierarchicalTermSelector from './hierarchical-term-selector';\nimport FlatTermSelector from './flat-term-selector';\nimport { store as editorStore } from '../../store';\n\nexport function PostTaxonomies( {\n\tpostType,\n\ttaxonomies,\n\ttaxonomyWrapper = identity,\n} ) {\n\tconst availableTaxonomies = filter( taxonomies, ( taxonomy ) =>\n\t\tincludes( taxonomy.types, postType )\n\t);\n\tconst visibleTaxonomies = filter(\n\t\tavailableTaxonomies,\n\t\t( taxonomy ) => taxonomy.visibility.show_ui\n\t);\n\treturn visibleTaxonomies.map( ( taxonomy ) => {\n\t\tconst TaxonomyComponent = taxonomy.hierarchical\n\t\t\t? HierarchicalTermSelector\n\t\t\t: FlatTermSelector;\n\t\treturn (\n\t\t\t<Fragment key={ `taxonomy-${ taxonomy.slug }` }>\n\t\t\t\t{ taxonomyWrapper(\n\t\t\t\t\t<TaxonomyComponent slug={ taxonomy.slug } />,\n\t\t\t\t\ttaxonomy\n\t\t\t\t) }\n\t\t\t</Fragment>\n\t\t);\n\t} );\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostType: select( editorStore ).getCurrentPostType(),\n\t\t\ttaxonomies: select( coreStore ).getTaxonomies( { per_page: -1 } ),\n\t\t};\n\t} ),\n] )( PostTaxonomies );\n"]}
@@ -25,10 +25,11 @@ const DEFAULT_QUERY = {
25
25
  _fields: 'id,name,count',
26
26
  context: 'view'
27
27
  };
28
- export default function MostUsedTerms({
29
- onSelect,
30
- taxonomy
31
- }) {
28
+ export default function MostUsedTerms(_ref) {
29
+ let {
30
+ onSelect,
31
+ taxonomy
32
+ } = _ref;
32
33
  const {
33
34
  _terms,
34
35
  showTerms
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-taxonomies/most-used-terms.js"],"names":["get","Button","useSelect","store","coreStore","unescapeTerms","MAX_MOST_USED_TERMS","DEFAULT_QUERY","per_page","orderby","order","hide_empty","_fields","context","MostUsedTerms","onSelect","taxonomy","_terms","showTerms","select","mostUsedTerms","getEntityRecords","slug","length","terms","label","map","term","id","name"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASC,aAAT,QAA8B,mBAA9B;AAEA,MAAMC,mBAAmB,GAAG,EAA5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A,OAAO,EAAG,MAAMb,QAAQ,CAAEY,IAAF;AAFzB,KAIGA,IAAI,CAACE,IAJR,CADD,CADC,CAJH,CATD,CADD;AA4BA","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unescapeTerms } from '../../utils/terms';\n\nconst MAX_MOST_USED_TERMS = 10;\nconst DEFAULT_QUERY = {\n\tper_page: MAX_MOST_USED_TERMS,\n\torderby: 'count',\n\torder: 'desc',\n\thide_empty: true,\n\t_fields: 'id,name,count',\n\tcontext: 'view',\n};\n\nexport default function MostUsedTerms( { onSelect, taxonomy } ) {\n\tconst { _terms, showTerms } = useSelect( ( select ) => {\n\t\tconst mostUsedTerms = select( coreStore ).getEntityRecords(\n\t\t\t'taxonomy',\n\t\t\ttaxonomy.slug,\n\t\t\tDEFAULT_QUERY\n\t\t);\n\t\treturn {\n\t\t\t_terms: mostUsedTerms,\n\t\t\tshowTerms: mostUsedTerms?.length === MAX_MOST_USED_TERMS,\n\t\t};\n\t}, [] );\n\n\tif ( ! showTerms ) {\n\t\treturn null;\n\t}\n\n\tconst terms = unescapeTerms( _terms );\n\tconst label = get( taxonomy, [ 'labels', 'most_used' ] );\n\n\treturn (\n\t\t<div className=\"editor-post-taxonomies__flat-term-most-used\">\n\t\t\t<h3 className=\"editor-post-taxonomies__flat-term-most-used-label\">\n\t\t\t\t{ label }\n\t\t\t</h3>\n\t\t\t{ /*\n\t\t\t * Disable reason: The `list` ARIA role is redundant but\n\t\t\t * Safari+VoiceOver won't announce the list otherwise.\n\t\t\t */\n\t\t\t/* eslint-disable jsx-a11y/no-redundant-roles */ }\n\t\t\t<ul\n\t\t\t\trole=\"list\"\n\t\t\t\tclassName=\"editor-post-taxonomies__flat-term-most-used-list\"\n\t\t\t>\n\t\t\t\t{ terms.map( ( term ) => (\n\t\t\t\t\t<li key={ term.id }>\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={ () => onSelect( term ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ term.name }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</li>\n\t\t\t\t) ) }\n\t\t\t</ul>\n\t\t\t{ /* eslint-enable jsx-a11y/no-redundant-roles */ }\n\t\t</div>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-taxonomies/most-used-terms.js"],"names":["get","Button","useSelect","store","coreStore","unescapeTerms","MAX_MOST_USED_TERMS","DEFAULT_QUERY","per_page","orderby","order","hide_empty","_fields","context","MostUsedTerms","onSelect","taxonomy","_terms","showTerms","select","mostUsedTerms","getEntityRecords","slug","length","terms","label","map","term","id","name"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASC,aAAT,QAA8B,mBAA9B;AAEA,MAAMC,mBAAmB,GAAG,EAA5B;AACA,MAAMC,aAAa,GAAG;AACrBC,EAAAA,QAAQ,EAAEF,mBADW;AAErBG,EAAAA,OAAO,EAAE,OAFY;AAGrBC,EAAAA,KAAK,EAAE,MAHc;AAIrBC,EAAAA,UAAU,EAAE,IAJS;AAKrBC,EAAAA,OAAO,EAAE,eALY;AAMrBC,EAAAA,OAAO,EAAE;AANY,CAAtB;AASA,eAAe,SAASC,aAAT,OAAiD;AAAA,MAAzB;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAyB;AAC/D,QAAM;AAAEC,IAAAA,MAAF;AAAUC,IAAAA;AAAV,MAAwBhB,SAAS,CAAIiB,MAAF,IAAc;AACtD,UAAMC,aAAa,GAAGD,MAAM,CAAEf,SAAF,CAAN,CAAoBiB,gBAApB,CACrB,UADqB,EAErBL,QAAQ,CAACM,IAFY,EAGrBf,aAHqB,CAAtB;AAKA,WAAO;AACNU,MAAAA,MAAM,EAAEG,aADF;AAENF,MAAAA,SAAS,EAAE,CAAAE,aAAa,SAAb,IAAAA,aAAa,WAAb,YAAAA,aAAa,CAAEG,MAAf,MAA0BjB;AAF/B,KAAP;AAIA,GAVsC,EAUpC,EAVoC,CAAvC;;AAYA,MAAK,CAAEY,SAAP,EAAmB;AAClB,WAAO,IAAP;AACA;;AAED,QAAMM,KAAK,GAAGnB,aAAa,CAAEY,MAAF,CAA3B;AACA,QAAMQ,KAAK,GAAGzB,GAAG,CAAEgB,QAAF,EAAY,CAAE,QAAF,EAAY,WAAZ,CAAZ,CAAjB;AAEA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAI,IAAA,SAAS,EAAC;AAAd,KACGS,KADH,CADD,EASC;AACC,IAAA,IAAI,EAAC,MADN;AAEC,IAAA,SAAS,EAAC;AAFX,KAIGD,KAAK,CAACE,GAAN,CAAaC,IAAF,IACZ;AAAI,IAAA,GAAG,EAAGA,IAAI,CAACC;AAAf,KACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,MADT;AAEC,IAAA,OAAO,EAAG,MAAMb,QAAQ,CAAEY,IAAF;AAFzB,KAIGA,IAAI,CAACE,IAJR,CADD,CADC,CAJH,CATD,CADD;AA4BA","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unescapeTerms } from '../../utils/terms';\n\nconst MAX_MOST_USED_TERMS = 10;\nconst DEFAULT_QUERY = {\n\tper_page: MAX_MOST_USED_TERMS,\n\torderby: 'count',\n\torder: 'desc',\n\thide_empty: true,\n\t_fields: 'id,name,count',\n\tcontext: 'view',\n};\n\nexport default function MostUsedTerms( { onSelect, taxonomy } ) {\n\tconst { _terms, showTerms } = useSelect( ( select ) => {\n\t\tconst mostUsedTerms = select( coreStore ).getEntityRecords(\n\t\t\t'taxonomy',\n\t\t\ttaxonomy.slug,\n\t\t\tDEFAULT_QUERY\n\t\t);\n\t\treturn {\n\t\t\t_terms: mostUsedTerms,\n\t\t\tshowTerms: mostUsedTerms?.length === MAX_MOST_USED_TERMS,\n\t\t};\n\t}, [] );\n\n\tif ( ! showTerms ) {\n\t\treturn null;\n\t}\n\n\tconst terms = unescapeTerms( _terms );\n\tconst label = get( taxonomy, [ 'labels', 'most_used' ] );\n\n\treturn (\n\t\t<div className=\"editor-post-taxonomies__flat-term-most-used\">\n\t\t\t<h3 className=\"editor-post-taxonomies__flat-term-most-used-label\">\n\t\t\t\t{ label }\n\t\t\t</h3>\n\t\t\t{ /*\n\t\t\t * Disable reason: The `list` ARIA role is redundant but\n\t\t\t * Safari+VoiceOver won't announce the list otherwise.\n\t\t\t */\n\t\t\t/* eslint-disable jsx-a11y/no-redundant-roles */ }\n\t\t\t<ul\n\t\t\t\trole=\"list\"\n\t\t\t\tclassName=\"editor-post-taxonomies__flat-term-most-used-list\"\n\t\t\t>\n\t\t\t\t{ terms.map( ( term ) => (\n\t\t\t\t\t<li key={ term.id }>\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={ () => onSelect( term ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ term.name }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</li>\n\t\t\t\t) ) }\n\t\t\t</ul>\n\t\t\t{ /* eslint-enable jsx-a11y/no-redundant-roles */ }\n\t\t</div>\n\t);\n}\n"]}
@@ -17,7 +17,8 @@ import { store as coreStore } from '@wordpress/core-data';
17
17
  */
18
18
 
19
19
  import { store as editorStore } from '../../store';
20
- export function PostTemplate({}) {
20
+ export function PostTemplate(_ref) {
21
+ let {} = _ref;
21
22
  const {
22
23
  availableTemplates,
23
24
  selectedTemplate,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-template/index.js"],"names":["isEmpty","map","__","SelectControl","useSelect","useDispatch","store","coreStore","editorStore","PostTemplate","availableTemplates","selectedTemplate","isViewable","select","getEditedPostAttribute","getEditorSettings","getCurrentPostType","getPostType","viewable","editPost","templateSlug","template","templateName","value","label"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,GAAlB,QAA6B,QAA7B;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,aAAT,QAA8B,uBAA9B;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,YAAT,CAAuB,EAAvB,EAA4B;AAClC,QAAM;AAAEC,IAAAA,kBAAF;AAAsBC,IAAAA,gBAAtB;AAAwCC,IAAAA;AAAxC,MAAuDR,SAAS,CACnES,MAAF,IAAc;AAAA;;AACb,UAAM;AACLC,MAAAA,sBADK;AAELC,MAAAA,iBAFK;AAGLC,MAAAA;AAHK,QAIFH,MAAM,CAAEL,WAAF,CAJV;AAKA,UAAM;AAAES,MAAAA;AAAF,QAAkBJ,MAAM,CAAEN,SAAF,CAA9B;AAEA,WAAO;AACNI,MAAAA,gBAAgB,EAAEG,sBAAsB,CAAE,UAAF,CADlC;AAENJ,MAAAA,kBAAkB,EAAEK,iBAAiB,GAAGL,kBAFlC;AAGNE,MAAAA,UAAU,2CACTK,WAAW,CAAED,kBAAkB,EAApB,CADF,iDACT,aAAqCE,QAD5B,yEACwC;AAJ5C,KAAP;AAMA,GAfoE,EAgBrE,EAhBqE,CAAtE;AAmBA,QAAM;AAAEC,IAAAA;AAAF,MAAed,WAAW,CAAEG,WAAF,CAAhC;;AAEA,MAAK,CAAEI,UAAF,IAAgBZ,OAAO,CAAEU,kBAAF,CAA5B,EAAqD;AACpD,WAAO,IAAP;AACA;;AAED,SACC,cAAC,aAAD;AACC,IAAA,KAAK,EAAGR,EAAE,CAAE,WAAF,CADX;AAEC,IAAA,KAAK,EAAGS,gBAFT;AAGC,IAAA,QAAQ,EAAKS,YAAF,IAAoB;AAC9BD,MAAAA,QAAQ,CAAE;AACTE,QAAAA,QAAQ,EAAED,YAAY,IAAI;AADjB,OAAF,CAAR;AAGA,KAPF;AAQC,IAAA,OAAO,EAAGnB,GAAG,CACZS,kBADY,EAEZ,CAAEY,YAAF,EAAgBF,YAAhB,MAAoC;AACnCG,MAAAA,KAAK,EAAEH,YAD4B;AAEnCI,MAAAA,KAAK,EAAEF;AAF4B,KAApC,CAFY;AARd,IADD;AAkBA;AAED,eAAeb,YAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty, map } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { SelectControl } from '@wordpress/components';\nimport { useSelect, useDispatch } 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 PostTemplate( {} ) {\n\tconst { availableTemplates, selectedTemplate, isViewable } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t\tgetEditorSettings,\n\t\t\t\tgetCurrentPostType,\n\t\t\t} = select( editorStore );\n\t\t\tconst { getPostType } = select( coreStore );\n\n\t\t\treturn {\n\t\t\t\tselectedTemplate: getEditedPostAttribute( 'template' ),\n\t\t\t\tavailableTemplates: getEditorSettings().availableTemplates,\n\t\t\t\tisViewable:\n\t\t\t\t\tgetPostType( getCurrentPostType() )?.viewable ?? false,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tif ( ! isViewable || isEmpty( availableTemplates ) ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<SelectControl\n\t\t\tlabel={ __( 'Template:' ) }\n\t\t\tvalue={ selectedTemplate }\n\t\t\tonChange={ ( templateSlug ) => {\n\t\t\t\teditPost( {\n\t\t\t\t\ttemplate: templateSlug || '',\n\t\t\t\t} );\n\t\t\t} }\n\t\t\toptions={ map(\n\t\t\t\tavailableTemplates,\n\t\t\t\t( templateName, templateSlug ) => ( {\n\t\t\t\t\tvalue: templateSlug,\n\t\t\t\t\tlabel: templateName,\n\t\t\t\t} )\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nexport default PostTemplate;\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-template/index.js"],"names":["isEmpty","map","__","SelectControl","useSelect","useDispatch","store","coreStore","editorStore","PostTemplate","availableTemplates","selectedTemplate","isViewable","select","getEditedPostAttribute","getEditorSettings","getCurrentPostType","getPostType","viewable","editPost","templateSlug","template","templateName","value","label"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,GAAlB,QAA6B,QAA7B;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,aAAT,QAA8B,uBAA9B;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,YAAT,OAA4B;AAAA,MAAL,EAAK;AAClC,QAAM;AAAEC,IAAAA,kBAAF;AAAsBC,IAAAA,gBAAtB;AAAwCC,IAAAA;AAAxC,MAAuDR,SAAS,CACnES,MAAF,IAAc;AAAA;;AACb,UAAM;AACLC,MAAAA,sBADK;AAELC,MAAAA,iBAFK;AAGLC,MAAAA;AAHK,QAIFH,MAAM,CAAEL,WAAF,CAJV;AAKA,UAAM;AAAES,MAAAA;AAAF,QAAkBJ,MAAM,CAAEN,SAAF,CAA9B;AAEA,WAAO;AACNI,MAAAA,gBAAgB,EAAEG,sBAAsB,CAAE,UAAF,CADlC;AAENJ,MAAAA,kBAAkB,EAAEK,iBAAiB,GAAGL,kBAFlC;AAGNE,MAAAA,UAAU,2CACTK,WAAW,CAAED,kBAAkB,EAApB,CADF,iDACT,aAAqCE,QAD5B,yEACwC;AAJ5C,KAAP;AAMA,GAfoE,EAgBrE,EAhBqE,CAAtE;AAmBA,QAAM;AAAEC,IAAAA;AAAF,MAAed,WAAW,CAAEG,WAAF,CAAhC;;AAEA,MAAK,CAAEI,UAAF,IAAgBZ,OAAO,CAAEU,kBAAF,CAA5B,EAAqD;AACpD,WAAO,IAAP;AACA;;AAED,SACC,cAAC,aAAD;AACC,IAAA,KAAK,EAAGR,EAAE,CAAE,WAAF,CADX;AAEC,IAAA,KAAK,EAAGS,gBAFT;AAGC,IAAA,QAAQ,EAAKS,YAAF,IAAoB;AAC9BD,MAAAA,QAAQ,CAAE;AACTE,QAAAA,QAAQ,EAAED,YAAY,IAAI;AADjB,OAAF,CAAR;AAGA,KAPF;AAQC,IAAA,OAAO,EAAGnB,GAAG,CACZS,kBADY,EAEZ,CAAEY,YAAF,EAAgBF,YAAhB,MAAoC;AACnCG,MAAAA,KAAK,EAAEH,YAD4B;AAEnCI,MAAAA,KAAK,EAAEF;AAF4B,KAApC,CAFY;AARd,IADD;AAkBA;AAED,eAAeb,YAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty, map } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { SelectControl } from '@wordpress/components';\nimport { useSelect, useDispatch } 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 PostTemplate( {} ) {\n\tconst { availableTemplates, selectedTemplate, isViewable } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t\tgetEditorSettings,\n\t\t\t\tgetCurrentPostType,\n\t\t\t} = select( editorStore );\n\t\t\tconst { getPostType } = select( coreStore );\n\n\t\t\treturn {\n\t\t\t\tselectedTemplate: getEditedPostAttribute( 'template' ),\n\t\t\t\tavailableTemplates: getEditorSettings().availableTemplates,\n\t\t\t\tisViewable:\n\t\t\t\t\tgetPostType( getCurrentPostType() )?.viewable ?? false,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tif ( ! isViewable || isEmpty( availableTemplates ) ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<SelectControl\n\t\t\tlabel={ __( 'Template:' ) }\n\t\t\tvalue={ selectedTemplate }\n\t\t\tonChange={ ( templateSlug ) => {\n\t\t\t\teditPost( {\n\t\t\t\t\ttemplate: templateSlug || '',\n\t\t\t\t} );\n\t\t\t} }\n\t\t\toptions={ map(\n\t\t\t\tavailableTemplates,\n\t\t\t\t( templateName, templateSlug ) => ( {\n\t\t\t\t\tvalue: templateSlug,\n\t\t\t\t\tlabel: templateName,\n\t\t\t\t} )\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nexport default PostTemplate;\n"]}
@@ -206,7 +206,7 @@ export default function PostTitle() {
206
206
  __unstableDisableFormats: true,
207
207
  preserveWhiteSpace: true
208
208
  });
209
- /* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-interactions */
209
+ /* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */
210
210
 
211
211
  return createElement(PostTypeSupportCheck, {
212
212
  supportKeys: "title"
@@ -215,12 +215,14 @@ export default function PostTitle() {
215
215
  contentEditable: true,
216
216
  className: className,
217
217
  "aria-label": decodedPlaceholder,
218
+ role: "textbox",
219
+ "aria-multiline": "true",
218
220
  onFocus: onSelect,
219
221
  onBlur: onUnselect,
220
222
  onKeyDown: onKeyDown,
221
223
  onKeyPress: onUnselect,
222
224
  onPaste: onPaste
223
225
  }));
224
- /* eslint-enable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-interactions */
226
+ /* eslint-enable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */
225
227
  }
226
228
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-title/index.js"],"names":["classnames","__","useEffect","useRef","useState","decodeEntities","ENTER","useSelect","useDispatch","pasteHandler","store","blockEditorStore","__unstableUseRichText","useRichText","useMergeRefs","PostTypeSupportCheck","editorStore","REGEXP_NEWLINES","PostTitle","ref","isSelected","setIsSelected","editPost","insertDefaultBlock","clearSelectedBlock","insertBlocks","isCleanNewPost","title","placeholder","isFocusMode","hasFixedToolbar","select","getEditedPostAttribute","_isCleanNewPost","getSettings","titlePlaceholder","focusMode","_hasFixedToolbar","current","ownerDocument","activeElement","body","focus","onEnterPress","undefined","onInsertBlockAfter","blocks","onUpdate","newTitle","selection","setSelection","onSelect","onUnselect","onChange","value","replace","onKeyDown","event","keyCode","preventDefault","onPaste","clipboardData","plainText","html","getData","error1","error2","window","console","log","content","HTML","length","firstBlock","name","attributes","slice","className","decodedPlaceholder","richTextRef","selectionStart","start","selectionEnd","end","onSelectionChange","newStart","newEnd","sel","__unstableDisableFormats","preserveWhiteSpace"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,EAAoBC,MAApB,EAA4BC,QAA5B,QAA4C,oBAA5C;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,KAAT,QAAsB,qBAAtB;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,YAAT,QAA6B,mBAA7B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AACA,SAASC,qBAA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AAF,CADnB;AAEC,IAAA,eAAe,MAFhB;AAGC,IAAA,SAAS,EAAG0D,SAHb;AAIC,kBAAaC,kBAJd;AAKC,IAAA,OAAO,EAAG3B,QALX;AAMC,IAAA,MAAM,EAAGC,UANV;AAOC,IAAA,SAAS,EAAGI,SAPb;AAQC,IAAA,UAAU,EAAGJ,UARd;AASC,IAAA,OAAO,EAAGQ;AATX,IADD,CADD;AAeA;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { ENTER } from '@wordpress/keycodes';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { pasteHandler } from '@wordpress/blocks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { __unstableUseRichText as useRichText } from '@wordpress/rich-text';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\n\n/**\n * Constants\n */\nconst REGEXP_NEWLINES = /[\\r\\n]+/g;\n\nexport default function PostTitle() {\n\tconst ref = useRef();\n\tconst [ isSelected, setIsSelected ] = useState( false );\n\tconst { editPost } = useDispatch( editorStore );\n\tconst {\n\t\tinsertDefaultBlock,\n\t\tclearSelectedBlock,\n\t\tinsertBlocks,\n\t} = useDispatch( blockEditorStore );\n\tconst {\n\t\tisCleanNewPost,\n\t\ttitle,\n\t\tplaceholder,\n\t\tisFocusMode,\n\t\thasFixedToolbar,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetEditedPostAttribute,\n\t\t\tisCleanNewPost: _isCleanNewPost,\n\t\t} = select( editorStore );\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst {\n\t\t\ttitlePlaceholder,\n\t\t\tfocusMode,\n\t\t\thasFixedToolbar: _hasFixedToolbar,\n\t\t} = getSettings();\n\n\t\treturn {\n\t\t\tisCleanNewPost: _isCleanNewPost(),\n\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t\tplaceholder: titlePlaceholder,\n\t\t\tisFocusMode: focusMode,\n\t\t\thasFixedToolbar: _hasFixedToolbar,\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( ! ref.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { ownerDocument } = ref.current;\n\t\tconst { activeElement, body } = ownerDocument;\n\n\t\t// Only autofocus the title when the post is entirely empty. This should\n\t\t// only happen for a new post, which means we focus the title on new\n\t\t// post so the author can start typing right away, without needing to\n\t\t// click anything.\n\t\tif ( isCleanNewPost && ( ! activeElement || body === activeElement ) ) {\n\t\t\tref.current.focus();\n\t\t}\n\t}, [ isCleanNewPost ] );\n\n\tfunction onEnterPress() {\n\t\tinsertDefaultBlock( undefined, undefined, 0 );\n\t}\n\n\tfunction onInsertBlockAfter( blocks ) {\n\t\tinsertBlocks( blocks, 0 );\n\t}\n\n\tfunction onUpdate( newTitle ) {\n\t\teditPost( { title: newTitle } );\n\t}\n\n\tconst [ selection, setSelection ] = useState( {} );\n\n\tfunction onSelect() {\n\t\tsetIsSelected( true );\n\t\tclearSelectedBlock();\n\t}\n\n\tfunction onUnselect() {\n\t\tsetIsSelected( false );\n\t\tsetSelection( {} );\n\t}\n\n\tfunction onChange( value ) {\n\t\tonUpdate( value.replace( REGEXP_NEWLINES, ' ' ) );\n\t}\n\n\tfunction onKeyDown( event ) {\n\t\tif ( event.keyCode === ENTER ) {\n\t\t\tevent.preventDefault();\n\t\t\tonEnterPress();\n\t\t}\n\t}\n\n\tfunction onPaste( event ) {\n\t\tconst clipboardData = event.clipboardData;\n\n\t\tlet plainText = '';\n\t\tlet html = '';\n\n\t\t// IE11 only supports `Text` as an argument for `getData` and will\n\t\t// otherwise throw an invalid argument error, so we try the standard\n\t\t// arguments first, then fallback to `Text` if they fail.\n\t\ttry {\n\t\t\tplainText = clipboardData.getData( 'text/plain' );\n\t\t\thtml = clipboardData.getData( 'text/html' );\n\t\t} catch ( error1 ) {\n\t\t\ttry {\n\t\t\t\thtml = clipboardData.getData( 'Text' );\n\t\t\t} catch ( error2 ) {\n\t\t\t\t// Some browsers like UC Browser paste plain text by default and\n\t\t\t\t// don't support clipboardData at all, so allow default\n\t\t\t\t// behaviour.\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// Allows us to ask for this information when we get a report.\n\t\twindow.console.log( 'Received HTML:\\n\\n', html );\n\t\twindow.console.log( 'Received plain text:\\n\\n', plainText );\n\n\t\tconst content = pasteHandler( {\n\t\t\tHTML: html,\n\t\t\tplainText,\n\t\t} );\n\n\t\tif ( typeof content !== 'string' && content.length ) {\n\t\t\tevent.preventDefault();\n\n\t\t\tconst [ firstBlock ] = content;\n\n\t\t\tif (\n\t\t\t\t! title &&\n\t\t\t\t( firstBlock.name === 'core/heading' ||\n\t\t\t\t\tfirstBlock.name === 'core/paragraph' )\n\t\t\t) {\n\t\t\t\tonUpdate( firstBlock.attributes.content );\n\t\t\t\tonInsertBlockAfter( content.slice( 1 ) );\n\t\t\t} else {\n\t\t\t\tonInsertBlockAfter( content );\n\t\t\t}\n\t\t}\n\t}\n\n\t// The wp-block className is important for editor styles.\n\t// This same block is used in both the visual and the code editor.\n\tconst className = classnames(\n\t\t'wp-block wp-block-post-title block-editor-block-list__block editor-post-title editor-post-title__input rich-text',\n\t\t{\n\t\t\t'is-selected': isSelected,\n\t\t\t'is-focus-mode': isFocusMode,\n\t\t\t'has-fixed-toolbar': hasFixedToolbar,\n\t\t}\n\t);\n\tconst decodedPlaceholder =\n\t\tdecodeEntities( placeholder ) || __( 'Add title' );\n\tconst { ref: richTextRef } = useRichText( {\n\t\tvalue: title,\n\t\tonChange,\n\t\tplaceholder: decodedPlaceholder,\n\t\tselectionStart: selection.start,\n\t\tselectionEnd: selection.end,\n\t\tonSelectionChange( newStart, newEnd ) {\n\t\t\tsetSelection( ( sel ) => {\n\t\t\t\tconst { start, end } = sel;\n\t\t\t\tif ( start === newStart && end === newEnd ) {\n\t\t\t\t\treturn sel;\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tstart: newStart,\n\t\t\t\t\tend: newEnd,\n\t\t\t\t};\n\t\t\t} );\n\t\t},\n\t\t__unstableDisableFormats: true,\n\t\tpreserveWhiteSpace: true,\n\t} );\n\n\t/* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-interactions */\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"title\">\n\t\t\t<h1\n\t\t\t\tref={ useMergeRefs( [ richTextRef, ref ] ) }\n\t\t\t\tcontentEditable\n\t\t\t\tclassName={ className }\n\t\t\t\taria-label={ decodedPlaceholder }\n\t\t\t\tonFocus={ onSelect }\n\t\t\t\tonBlur={ onUnselect }\n\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\tonKeyPress={ onUnselect }\n\t\t\t\tonPaste={ onPaste }\n\t\t\t/>\n\t\t</PostTypeSupportCheck>\n\t);\n\t/* eslint-enable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-interactions */\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-title/index.js"],"names":["classnames","__","useEffect","useRef","useState","decodeEntities","ENTER","useSelect","useDispatch","pasteHandler","store","blockEditorStore","__unstableUseRichText","useRichText","useMergeRefs","PostTypeSupportCheck","editorStore","REGEXP_NEWLINES","PostTitle","ref","isSelected","setIsSelected","editPost","insertDefaultBlock","clearSelectedBlock","insertBlocks","isCleanNewPost","title","placeholder","isFocusMode","hasFixedToolbar","select","getEditedPostAttribute","_isCleanNewPost","getSettings","titlePlaceholder","focusMode","_hasFixedToolbar","current","ownerDocument","activeElement","body","focus","onEnterPress","undefined","onInsertBlockAfter","blocks","onUpdate","newTitle","selection","setSelection","onSelect","onUnselect","onChange","value","replace","onKeyDown","event","keyCode","preventDefault","onPaste","clipboardData","plainText","html","getData","error1","error2","window","console","log","content","HTML","length","firstBlock","name","attributes","slice","className","decodedPlaceholder","richTextRef","selectionStart","start","selectionEnd","end","onSelectionChange","newStart","newEnd","sel","__unstableDisableFormats","preserveWhiteSpace"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,EAAoBC,MAApB,EAA4BC,QAA5B,QAA4C,oBAA5C;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,KAAT,QAAsB,qBAAtB;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,YAAT,QAA6B,mBAA7B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AACA,SAASC,qBAAqB,IAAIC,WAAlC,QAAqD,sBAArD;AACA,SAASC,YAAT,QAA6B,oBAA7B;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,4BAAjC;AACA,SAASL,KAAK,IAAIM,WAAlB,QAAqC,aAArC;AAEA;AACA;AACA;;AACA,MAAMC,eAAe,GAAG,UAAxB;AAEA,eAAe,SAASC,SAAT,GAAqB;AACnC,QAAMC,GAAG,GAAGhB,MAAM,EAAlB;AACA,QAAM,CAAEiB,UAAF,EAAcC,aAAd,IAAgCjB,QAAQ,CAAE,KAAF,CAA9C;AACA,QAAM;AAAEkB,IAAAA;AAAF,MAAed,WAAW,CAAEQ,WAAF,CAAhC;AACA,QAAM;AACLO,IAAAA,kBADK;AAELC,IAAAA,kBAFK;AAGLC,IAAAA;AAHK,MAIFjB,WAAW,CAAEG,gBAAF,CAJf;AAKA,QAAM;AACLe,IAAAA,cADK;AAELC,IAAAA,KAFK;AAGLC,IAAAA,WAHK;AAILC,IAAAA,WAJK;AAKLC,IAAAA;AALK,MAMFvB,SAAS,CAAIwB,MAAF,IAAc;AAC5B,UAAM;AACLC,MAAAA,sBADK;AAELN,MAAAA,cAAc,E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W;AACxB,cAAM;AAAEN,UAAAA,KAAF;AAASE,UAAAA;AAAT,YAAiBI,GAAvB;;AACA,YAAKN,KAAK,KAAKI,QAAV,IAAsBF,GAAG,KAAKG,MAAnC,EAA4C;AAC3C,iBAAOC,GAAP;AACA;;AACD,eAAO;AACNN,UAAAA,KAAK,EAAEI,QADD;AAENF,UAAAA,GAAG,EAAEG;AAFC,SAAP;AAIA,OATW,CAAZ;AAUA,KAjBwC;;AAkBzCE,IAAAA,wBAAwB,EAAE,IAlBe;AAmBzCC,IAAAA,kBAAkB,EAAE;AAnBqB,GAAF,CAAxC;AAsBA;;AACA,SACC,cAAC,oBAAD;AAAsB,IAAA,WAAW,EAAC;AAAlC,KACC;AACC,IAAA,GAAG,EAAG3E,YAAY,CAAE,CAAEiE,WAAF,EAAe5D,GAAf,CAAF,CADnB;AAEC,IAAA,eAAe,MAFhB;AAGC,IAAA,SAAS,EAAG0D,SAHb;AAIC,kBAAaC,kBAJd;AAKC,IAAA,IAAI,EAAC,SALN;AAMC,sBAAe,MANhB;AAOC,IAAA,OAAO,EAAG3B,QAPX;AAQC,IAAA,MAAM,EAAGC,UARV;AASC,IAAA,SAAS,EAAGI,SATb;AAUC,IAAA,UAAU,EAAGJ,UAVd;AAWC,IAAA,OAAO,EAAGQ;AAXX,IADD,CADD;AAiBA;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { ENTER } from '@wordpress/keycodes';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { pasteHandler } from '@wordpress/blocks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { __unstableUseRichText as useRichText } from '@wordpress/rich-text';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\n\n/**\n * Constants\n */\nconst REGEXP_NEWLINES = /[\\r\\n]+/g;\n\nexport default function PostTitle() {\n\tconst ref = useRef();\n\tconst [ isSelected, setIsSelected ] = useState( false );\n\tconst { editPost } = useDispatch( editorStore );\n\tconst {\n\t\tinsertDefaultBlock,\n\t\tclearSelectedBlock,\n\t\tinsertBlocks,\n\t} = useDispatch( blockEditorStore );\n\tconst {\n\t\tisCleanNewPost,\n\t\ttitle,\n\t\tplaceholder,\n\t\tisFocusMode,\n\t\thasFixedToolbar,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetEditedPostAttribute,\n\t\t\tisCleanNewPost: _isCleanNewPost,\n\t\t} = select( editorStore );\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst {\n\t\t\ttitlePlaceholder,\n\t\t\tfocusMode,\n\t\t\thasFixedToolbar: _hasFixedToolbar,\n\t\t} = getSettings();\n\n\t\treturn {\n\t\t\tisCleanNewPost: _isCleanNewPost(),\n\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t\tplaceholder: titlePlaceholder,\n\t\t\tisFocusMode: focusMode,\n\t\t\thasFixedToolbar: _hasFixedToolbar,\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( ! ref.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { ownerDocument } = ref.current;\n\t\tconst { activeElement, body } = ownerDocument;\n\n\t\t// Only autofocus the title when the post is entirely empty. This should\n\t\t// only happen for a new post, which means we focus the title on new\n\t\t// post so the author can start typing right away, without needing to\n\t\t// click anything.\n\t\tif ( isCleanNewPost && ( ! activeElement || body === activeElement ) ) {\n\t\t\tref.current.focus();\n\t\t}\n\t}, [ isCleanNewPost ] );\n\n\tfunction onEnterPress() {\n\t\tinsertDefaultBlock( undefined, undefined, 0 );\n\t}\n\n\tfunction onInsertBlockAfter( blocks ) {\n\t\tinsertBlocks( blocks, 0 );\n\t}\n\n\tfunction onUpdate( newTitle ) {\n\t\teditPost( { title: newTitle } );\n\t}\n\n\tconst [ selection, setSelection ] = useState( {} );\n\n\tfunction onSelect() {\n\t\tsetIsSelected( true );\n\t\tclearSelectedBlock();\n\t}\n\n\tfunction onUnselect() {\n\t\tsetIsSelected( false );\n\t\tsetSelection( {} );\n\t}\n\n\tfunction onChange( value ) {\n\t\tonUpdate( value.replace( REGEXP_NEWLINES, ' ' ) );\n\t}\n\n\tfunction onKeyDown( event ) {\n\t\tif ( event.keyCode === ENTER ) {\n\t\t\tevent.preventDefault();\n\t\t\tonEnterPress();\n\t\t}\n\t}\n\n\tfunction onPaste( event ) {\n\t\tconst clipboardData = event.clipboardData;\n\n\t\tlet plainText = '';\n\t\tlet html = '';\n\n\t\t// IE11 only supports `Text` as an argument for `getData` and will\n\t\t// otherwise throw an invalid argument error, so we try the standard\n\t\t// arguments first, then fallback to `Text` if they fail.\n\t\ttry {\n\t\t\tplainText = clipboardData.getData( 'text/plain' );\n\t\t\thtml = clipboardData.getData( 'text/html' );\n\t\t} catch ( error1 ) {\n\t\t\ttry {\n\t\t\t\thtml = clipboardData.getData( 'Text' );\n\t\t\t} catch ( error2 ) {\n\t\t\t\t// Some browsers like UC Browser paste plain text by default and\n\t\t\t\t// don't support clipboardData at all, so allow default\n\t\t\t\t// behaviour.\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// Allows us to ask for this information when we get a report.\n\t\twindow.console.log( 'Received HTML:\\n\\n', html );\n\t\twindow.console.log( 'Received plain text:\\n\\n', plainText );\n\n\t\tconst content = pasteHandler( {\n\t\t\tHTML: html,\n\t\t\tplainText,\n\t\t} );\n\n\t\tif ( typeof content !== 'string' && content.length ) {\n\t\t\tevent.preventDefault();\n\n\t\t\tconst [ firstBlock ] = content;\n\n\t\t\tif (\n\t\t\t\t! title &&\n\t\t\t\t( firstBlock.name === 'core/heading' ||\n\t\t\t\t\tfirstBlock.name === 'core/paragraph' )\n\t\t\t) {\n\t\t\t\tonUpdate( firstBlock.attributes.content );\n\t\t\t\tonInsertBlockAfter( content.slice( 1 ) );\n\t\t\t} else {\n\t\t\t\tonInsertBlockAfter( content );\n\t\t\t}\n\t\t}\n\t}\n\n\t// The wp-block className is important for editor styles.\n\t// This same block is used in both the visual and the code editor.\n\tconst className = classnames(\n\t\t'wp-block wp-block-post-title block-editor-block-list__block editor-post-title editor-post-title__input rich-text',\n\t\t{\n\t\t\t'is-selected': isSelected,\n\t\t\t'is-focus-mode': isFocusMode,\n\t\t\t'has-fixed-toolbar': hasFixedToolbar,\n\t\t}\n\t);\n\tconst decodedPlaceholder =\n\t\tdecodeEntities( placeholder ) || __( 'Add title' );\n\tconst { ref: richTextRef } = useRichText( {\n\t\tvalue: title,\n\t\tonChange,\n\t\tplaceholder: decodedPlaceholder,\n\t\tselectionStart: selection.start,\n\t\tselectionEnd: selection.end,\n\t\tonSelectionChange( newStart, newEnd ) {\n\t\t\tsetSelection( ( sel ) => {\n\t\t\t\tconst { start, end } = sel;\n\t\t\t\tif ( start === newStart && end === newEnd ) {\n\t\t\t\t\treturn sel;\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tstart: newStart,\n\t\t\t\t\tend: newEnd,\n\t\t\t\t};\n\t\t\t} );\n\t\t},\n\t\t__unstableDisableFormats: true,\n\t\tpreserveWhiteSpace: true,\n\t} );\n\n\t/* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"title\">\n\t\t\t<h1\n\t\t\t\tref={ useMergeRefs( [ richTextRef, ref ] ) }\n\t\t\t\tcontentEditable\n\t\t\t\tclassName={ className }\n\t\t\t\taria-label={ decodedPlaceholder }\n\t\t\t\trole=\"textbox\"\n\t\t\t\taria-multiline=\"true\"\n\t\t\t\tonFocus={ onSelect }\n\t\t\t\tonBlur={ onUnselect }\n\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\tonKeyPress={ onUnselect }\n\t\t\t\tonPaste={ onPaste }\n\t\t\t/>\n\t\t</PostTypeSupportCheck>\n\t);\n\t/* eslint-enable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */\n}\n"]}
@@ -56,11 +56,12 @@ class PostTitle extends Component {
56
56
  this.props.onSelect();
57
57
  }
58
58
 
59
- onPaste({
60
- value,
61
- onChange,
62
- plainText
63
- }) {
59
+ onPaste(_ref) {
60
+ let {
61
+ value,
62
+ onChange,
63
+ plainText
64
+ } = _ref;
64
65
  const content = pasteHandler({
65
66
  plainText,
66
67
  mode: 'INLINE',
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-title/index.native.js"],"names":["View","isEmpty","Component","__experimentalRichText","RichText","create","insert","decodeEntities","withDispatch","withSelect","withFocusOutside","withInstanceId","compose","__","sprintf","pasteHandler","store","blockEditorStore","editorStore","styles","PostTitle","constructor","props","setRef","bind","componentDidUpdate","prevProps","isSelected","isAnyBlockSelected","richTextRef","blur","onUnselect","componentDidMount","innerRef","handleFocusOutside","focus","onSelect","onPaste","value","onChange","plainText","content","mode","tagName","valueToInsert","html","richText","getTitle","title","postType","render","placeholder","style","focusedBorderColor","borderStyle","isDimmed","globalStyles","decodedPlaceholder","borderColor","titleStyles","text","color","placeholderColor","titleContainer","dimmed","onBlur","onUpdate","onEnterPress","select","isPostTitleSelected","getEditedPostAttribute","getSelectedBlockClientId","getBlockRootClientId","getSettings","selectedId","selectionIsNested","__experimentalGlobalStylesBaseStyles","dispatch","undo","redo","togglePostTitleSelection","clearSelectedBlock","insertDefaultBlock","undefined","onUndo","onRedo"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,cAArB;AACA,SAASC,OAAT,QAAwB,QAAxB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SACCC,sBAAsB,IAAIC,QAD3B,EAECC,MAFD,EAGCC,MAHD,QAIO,sBAJP;AAKA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,YA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D5D,gBAD0D,CAA3D;AAIA,SAAO;AACNkD,IAAAA,YAAY,GAAG;AACde,MAAAA,kBAAkB,CAAEC,SAAF,EAAaA,SAAb,EAAwB,CAAxB,CAAlB;AACA,KAHK;;AAINC,IAAAA,MAAM,EAAEN,IAJF;AAKNO,IAAAA,MAAM,EAAEN,IALF;;AAMN3C,IAAAA,QAAQ,GAAG;AACV4C,MAAAA,wBAAwB,CAAE,IAAF,CAAxB;AACAC,MAAAA,kBAAkB;AAClB,KATK;;AAUNlD,IAAAA,UAAU,GAAG;AACZiD,MAAAA,wBAAwB,CAAE,KAAF,CAAxB;AACA;;AAZK,GAAP;AAcA,CAvBW,CAxBS,EAgDrBrE,cAhDqB,EAiDrBD,gBAjDqB,CAAP,CAkDZU,SAlDY,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\nimport { isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport {\n\t__experimentalRichText as RichText,\n\tcreate,\n\tinsert,\n} from '@wordpress/rich-text';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { withFocusOutside } from '@wordpress/components';\nimport { withInstanceId, compose } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { pasteHandler } from '@wordpress/blocks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nclass PostTitle extends Component {\n\tconstructor( props ) {\n\t\tsuper( props );\n\n\t\tthis.setRef = this.setRef.bind( this );\n\t}\n\tcomponentDidUpdate( prevProps ) {\n\t\t// Unselect if any other block is selected and blur the RichText\n\t\tif (\n\t\t\tthis.props.isSelected &&\n\t\t\t! prevProps.isAnyBlockSelected &&\n\t\t\tthis.props.isAnyBlockSelected\n\t\t) {\n\t\t\tif ( this.richTextRef ) {\n\t\t\t\tthis.richTextRef.blur();\n\t\t\t}\n\t\t\tthis.props.onUnselect();\n\t\t}\n\t}\n\n\tcomponentDidMount() {\n\t\tif ( this.props.innerRef ) {\n\t\t\tthis.props.innerRef( this );\n\t\t}\n\t}\n\n\thandleFocusOutside() {\n\t\tthis.props.onUnselect();\n\t}\n\n\tfocus() {\n\t\tthis.props.onSelect();\n\t}\n\n\tonPaste( { value, onChange, plainText } ) {\n\t\tconst content = pasteHandler( {\n\t\t\tplainText,\n\t\t\tmode: 'INLINE',\n\t\t\ttagName: 'p',\n\t\t} );\n\n\t\tif ( typeof content === 'string' ) {\n\t\t\tconst valueToInsert = create( { html: content } );\n\t\t\tonChange( insert( value, valueToInsert ) );\n\t\t}\n\t}\n\n\tsetRef( richText ) {\n\t\tthis.richTextRef = richText;\n\t}\n\n\tgetTitle( title, postType ) {\n\t\tif ( 'page' === postType ) {\n\t\t\treturn isEmpty( title )\n\t\t\t\t? /* translators: accessibility text. empty page title. */\n\t\t\t\t __( 'Page title. Empty' )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: accessibility text. %s: text content of the page title. */\n\t\t\t\t\t\t__( 'Page title. %s' ),\n\t\t\t\t\t\ttitle\n\t\t\t\t );\n\t\t}\n\n\t\treturn isEmpty( title )\n\t\t\t? /* translators: accessibility text. empty post title. */\n\t\t\t __( 'Post title. Empty' )\n\t\t\t: sprintf(\n\t\t\t\t\t/* translators: accessibility text. %s: text content of the post title. */\n\t\t\t\t\t__( 'Post title. %s' ),\n\t\t\t\t\ttitle\n\t\t\t );\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tplaceholder,\n\t\t\tstyle,\n\t\t\ttitle,\n\t\t\tfocusedBorderColor,\n\t\t\tborderStyle,\n\t\t\tisDimmed,\n\t\t\tpostType,\n\t\t\tglobalStyles,\n\t\t} = this.props;\n\n\t\tconst decodedPlaceholder = decodeEntities( placeholder );\n\t\tconst borderColor = this.props.isSelected\n\t\t\t? focusedBorderColor\n\t\t\t: 'transparent';\n\t\tconst titleStyles = {\n\t\t\t...style,\n\t\t\t...( globalStyles?.text && {\n\t\t\t\tcolor: globalStyles.text,\n\t\t\t\tplaceholderColor: globalStyles.text,\n\t\t\t} ),\n\t\t};\n\n\t\treturn (\n\t\t\t<View\n\t\t\t\tstyle={ [\n\t\t\t\t\tstyles.titleContainer,\n\t\t\t\t\tborderStyle,\n\t\t\t\t\t{ borderColor },\n\t\t\t\t\tisDimmed && styles.dimmed,\n\t\t\t\t] }\n\t\t\t\taccessible={ ! this.props.isSelected }\n\t\t\t\taccessibilityLabel={ this.getTitle( title, postType ) }\n\t\t\t\taccessibilityHint={ __( 'Updates the title.' ) }\n\t\t\t>\n\t\t\t\t<RichText\n\t\t\t\t\tsetRef={ this.setRef }\n\t\t\t\t\taccessibilityLabel={ this.getTitle( title, postType ) }\n\t\t\t\t\ttagName={ 'p' }\n\t\t\t\t\ttagsToEliminate={ [ 'strong' ] }\n\t\t\t\t\tunstableOnFocus={ this.props.onSelect }\n\t\t\t\t\tonBlur={ this.props.onBlur } // always assign onBlur as a props\n\t\t\t\t\tmultiline={ false }\n\t\t\t\t\tstyle={ titleStyles }\n\t\t\t\t\tstyles={ styles }\n\t\t\t\t\tfontSize={ 24 }\n\t\t\t\t\tfontWeight={ 'bold' }\n\t\t\t\t\tdeleteEnter={ true }\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\tthis.props.onUpdate( value );\n\t\t\t\t\t} }\n\t\t\t\t\tonPaste={ this.onPaste }\n\t\t\t\t\tplaceholder={ decodedPlaceholder }\n\t\t\t\t\tvalue={ title }\n\t\t\t\t\tonSelectionChange={ () => {} }\n\t\t\t\t\tonEnter={ this.props.onEnterPress }\n\t\t\t\t\tdisableEditingMenu={ true }\n\t\t\t\t\t__unstableIsSelected={ this.props.isSelected }\n\t\t\t\t\t__unstableOnCreateUndoLevel={ () => {} }\n\t\t\t\t></RichText>\n\t\t\t</View>\n\t\t);\n\t}\n}\n\nexport default compose(\n\twithSelect( ( select ) => {\n\t\tconst { isPostTitleSelected, getEditedPostAttribute } = select(\n\t\t\teditorStore\n\t\t);\n\t\tconst {\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetBlockRootClientId,\n\t\t\tgetSettings,\n\t\t} = select( blockEditorStore );\n\n\t\tconst selectedId = getSelectedBlockClientId();\n\t\tconst selectionIsNested = !! getBlockRootClientId( selectedId );\n\t\tconst globalStyles = getSettings()?.__experimentalGlobalStylesBaseStyles\n\t\t\t?.color;\n\n\t\treturn {\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t\tisAnyBlockSelected: !! selectedId,\n\t\t\tisSelected: isPostTitleSelected(),\n\t\t\tisDimmed: selectionIsNested,\n\t\t\tglobalStyles,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { undo, redo, togglePostTitleSelection } = dispatch(\n\t\t\teditorStore\n\t\t);\n\n\t\tconst { clearSelectedBlock, insertDefaultBlock } = dispatch(\n\t\t\tblockEditorStore\n\t\t);\n\n\t\treturn {\n\t\t\tonEnterPress() {\n\t\t\t\tinsertDefaultBlock( undefined, undefined, 0 );\n\t\t\t},\n\t\t\tonUndo: undo,\n\t\t\tonRedo: redo,\n\t\t\tonSelect() {\n\t\t\t\ttogglePostTitleSelection( true );\n\t\t\t\tclearSelectedBlock();\n\t\t\t},\n\t\t\tonUnselect() {\n\t\t\t\ttogglePostTitleSelection( false );\n\t\t\t},\n\t\t};\n\t} ),\n\twithInstanceId,\n\twithFocusOutside\n)( PostTitle );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-title/index.native.js"],"names":["View","isEmpty","Component","__experimentalRichText","RichText","create","insert","decodeEntities","withDispatch","withSelect","withFocusOutside","withInstanceId","compose","__","sprintf","pasteHandler","store","blockEditorStore","editorStore","styles","PostTitle","constructor","props","setRef","bind","componentDidUpdate","prevProps","isSelected","isAnyBlockSelected","richTextRef","blur","onUnselect","componentDidMount","innerRef","handleFocusOutside","focus","onSelect","onPaste","value","onChange","plainText","content","mode","tagName","valueToInsert","html","richText","getTitle","title","postType","render","placeholder","style","focusedBorderColor","borderStyle","isDimmed","globalStyles","decodedPlaceholder","borderColor","titleStyles","text","color","placeholderColor","titleContainer","dimmed","onBlur","onUpdate","onEnterPress","select","isPostTitleSelected","getEditedPostAttribute","getSelectedBlockClientId","getBlockRootClientId","getSettings","selectedId","selectionIsNested","__experimentalGlobalStylesBaseStyles","dispatch","undo","redo","togglePostTitleSelection","clearSelectedBlock","insertDefaultBlock","undefined","onUndo","onRedo"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,cAArB;AACA,SAASC,OAAT,QAAwB,QAAxB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SACCC,sBAAsB,IAAIC,QAD3B,EAECC,MAFD,EAGCC,MAHD,QAIO,sBAJP;AAKA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,YAAT,EAAuBC,UAAvB,QAAyC,iBAAzC;AACA,SAASC,gBAAT,QAAiC,uBAAjC;AACA,SAASC,cAAT,EAAyBC,OAAzB,QAAwC,oBAAxC;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,YAAT,QAA6B,mBAA7B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,mBAArC;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,cAAnB;;AAEA,MAAMC,SAAN,SAAwBlB,SAAxB,CAAkC;AACjCmB,EAAAA,WAAW,CAAEC,KAAF,EAAU;AACpB,UAAOA,KAAP;AAEA,SAAKC,MAAL,GAAc,KAAKA,MAAL,CAAYC,IAAZ,CAAkB,IAAlB,CAAd;AACA;;AACDC,EAAAA,kBAAkB,CAAEC,SAAF,EAAc;AAC/B;AACA,QACC,KAAKJ,KAAL,CAAWK,UAAX,IACA,CAAED,SAAS,CAACE,kBADZ,IAEA,KAAKN,KA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AoB,CAAEE,UAAF,CAAjD;AACA,QAAMlB,YAAY,mBAAGiB,WAAW,EAAd,0EAAG,aAAeG,oCAAlB,0DAAG,sBAClBf,KADH;AAGA,SAAO;AACNZ,IAAAA,QAAQ,EAAEqB,sBAAsB,CAAE,MAAF,CAD1B;AAEN1C,IAAAA,kBAAkB,EAAE,CAAC,CAAE8C,UAFjB;AAGN/C,IAAAA,UAAU,EAAE0C,mBAAmB,EAHzB;AAINd,IAAAA,QAAQ,EAAEoB,iBAJJ;AAKNnB,IAAAA;AALM,GAAP;AAOA,CAtBS,CADW,EAwBrBhD,YAAY,CAAIqE,QAAF,IAAgB;AAC7B,QAAM;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,IAAR;AAAcC,IAAAA;AAAd,MAA2CH,QAAQ,CACxD3D,WADwD,CAAzD;AAIA,QAAM;AAAE+D,IAAAA,kBAAF;AAAsBC,IAAAA;AAAtB,MAA6CL,QAAQ,CAC1D5D,gBAD0D,CAA3D;AAIA,SAAO;AACNkD,IAAAA,YAAY,GAAG;AACde,MAAAA,kBAAkB,CAAEC,SAAF,EAAaA,SAAb,EAAwB,CAAxB,CAAlB;AACA,KAHK;;AAINC,IAAAA,MAAM,EAAEN,IAJF;AAKNO,IAAAA,MAAM,EAAEN,IALF;;AAMN3C,IAAAA,QAAQ,GAAG;AACV4C,MAAAA,wBAAwB,CAAE,IAAF,CAAxB;AACAC,MAAAA,kBAAkB;AAClB,KATK;;AAUNlD,IAAAA,UAAU,GAAG;AACZiD,MAAAA,wBAAwB,CAAE,KAAF,CAAxB;AACA;;AAZK,GAAP;AAcA,CAvBW,CAxBS,EAgDrBrE,cAhDqB,EAiDrBD,gBAjDqB,CAAP,CAkDZU,SAlDY,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\nimport { isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport {\n\t__experimentalRichText as RichText,\n\tcreate,\n\tinsert,\n} from '@wordpress/rich-text';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { withFocusOutside } from '@wordpress/components';\nimport { withInstanceId, compose } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { pasteHandler } from '@wordpress/blocks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nclass PostTitle extends Component {\n\tconstructor( props ) {\n\t\tsuper( props );\n\n\t\tthis.setRef = this.setRef.bind( this );\n\t}\n\tcomponentDidUpdate( prevProps ) {\n\t\t// Unselect if any other block is selected and blur the RichText\n\t\tif (\n\t\t\tthis.props.isSelected &&\n\t\t\t! prevProps.isAnyBlockSelected &&\n\t\t\tthis.props.isAnyBlockSelected\n\t\t) {\n\t\t\tif ( this.richTextRef ) {\n\t\t\t\tthis.richTextRef.blur();\n\t\t\t}\n\t\t\tthis.props.onUnselect();\n\t\t}\n\t}\n\n\tcomponentDidMount() {\n\t\tif ( this.props.innerRef ) {\n\t\t\tthis.props.innerRef( this );\n\t\t}\n\t}\n\n\thandleFocusOutside() {\n\t\tthis.props.onUnselect();\n\t}\n\n\tfocus() {\n\t\tthis.props.onSelect();\n\t}\n\n\tonPaste( { value, onChange, plainText } ) {\n\t\tconst content = pasteHandler( {\n\t\t\tplainText,\n\t\t\tmode: 'INLINE',\n\t\t\ttagName: 'p',\n\t\t} );\n\n\t\tif ( typeof content === 'string' ) {\n\t\t\tconst valueToInsert = create( { html: content } );\n\t\t\tonChange( insert( value, valueToInsert ) );\n\t\t}\n\t}\n\n\tsetRef( richText ) {\n\t\tthis.richTextRef = richText;\n\t}\n\n\tgetTitle( title, postType ) {\n\t\tif ( 'page' === postType ) {\n\t\t\treturn isEmpty( title )\n\t\t\t\t? /* translators: accessibility text. empty page title. */\n\t\t\t\t __( 'Page title. Empty' )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: accessibility text. %s: text content of the page title. */\n\t\t\t\t\t\t__( 'Page title. %s' ),\n\t\t\t\t\t\ttitle\n\t\t\t\t );\n\t\t}\n\n\t\treturn isEmpty( title )\n\t\t\t? /* translators: accessibility text. empty post title. */\n\t\t\t __( 'Post title. Empty' )\n\t\t\t: sprintf(\n\t\t\t\t\t/* translators: accessibility text. %s: text content of the post title. */\n\t\t\t\t\t__( 'Post title. %s' ),\n\t\t\t\t\ttitle\n\t\t\t );\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tplaceholder,\n\t\t\tstyle,\n\t\t\ttitle,\n\t\t\tfocusedBorderColor,\n\t\t\tborderStyle,\n\t\t\tisDimmed,\n\t\t\tpostType,\n\t\t\tglobalStyles,\n\t\t} = this.props;\n\n\t\tconst decodedPlaceholder = decodeEntities( placeholder );\n\t\tconst borderColor = this.props.isSelected\n\t\t\t? focusedBorderColor\n\t\t\t: 'transparent';\n\t\tconst titleStyles = {\n\t\t\t...style,\n\t\t\t...( globalStyles?.text && {\n\t\t\t\tcolor: globalStyles.text,\n\t\t\t\tplaceholderColor: globalStyles.text,\n\t\t\t} ),\n\t\t};\n\n\t\treturn (\n\t\t\t<View\n\t\t\t\tstyle={ [\n\t\t\t\t\tstyles.titleContainer,\n\t\t\t\t\tborderStyle,\n\t\t\t\t\t{ borderColor },\n\t\t\t\t\tisDimmed && styles.dimmed,\n\t\t\t\t] }\n\t\t\t\taccessible={ ! this.props.isSelected }\n\t\t\t\taccessibilityLabel={ this.getTitle( title, postType ) }\n\t\t\t\taccessibilityHint={ __( 'Updates the title.' ) }\n\t\t\t>\n\t\t\t\t<RichText\n\t\t\t\t\tsetRef={ this.setRef }\n\t\t\t\t\taccessibilityLabel={ this.getTitle( title, postType ) }\n\t\t\t\t\ttagName={ 'p' }\n\t\t\t\t\ttagsToEliminate={ [ 'strong' ] }\n\t\t\t\t\tunstableOnFocus={ this.props.onSelect }\n\t\t\t\t\tonBlur={ this.props.onBlur } // always assign onBlur as a props\n\t\t\t\t\tmultiline={ false }\n\t\t\t\t\tstyle={ titleStyles }\n\t\t\t\t\tstyles={ styles }\n\t\t\t\t\tfontSize={ 24 }\n\t\t\t\t\tfontWeight={ 'bold' }\n\t\t\t\t\tdeleteEnter={ true }\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\tthis.props.onUpdate( value );\n\t\t\t\t\t} }\n\t\t\t\t\tonPaste={ this.onPaste }\n\t\t\t\t\tplaceholder={ decodedPlaceholder }\n\t\t\t\t\tvalue={ title }\n\t\t\t\t\tonSelectionChange={ () => {} }\n\t\t\t\t\tonEnter={ this.props.onEnterPress }\n\t\t\t\t\tdisableEditingMenu={ true }\n\t\t\t\t\t__unstableIsSelected={ this.props.isSelected }\n\t\t\t\t\t__unstableOnCreateUndoLevel={ () => {} }\n\t\t\t\t></RichText>\n\t\t\t</View>\n\t\t);\n\t}\n}\n\nexport default compose(\n\twithSelect( ( select ) => {\n\t\tconst { isPostTitleSelected, getEditedPostAttribute } = select(\n\t\t\teditorStore\n\t\t);\n\t\tconst {\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetBlockRootClientId,\n\t\t\tgetSettings,\n\t\t} = select( blockEditorStore );\n\n\t\tconst selectedId = getSelectedBlockClientId();\n\t\tconst selectionIsNested = !! getBlockRootClientId( selectedId );\n\t\tconst globalStyles = getSettings()?.__experimentalGlobalStylesBaseStyles\n\t\t\t?.color;\n\n\t\treturn {\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t\tisAnyBlockSelected: !! selectedId,\n\t\t\tisSelected: isPostTitleSelected(),\n\t\t\tisDimmed: selectionIsNested,\n\t\t\tglobalStyles,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { undo, redo, togglePostTitleSelection } = dispatch(\n\t\t\teditorStore\n\t\t);\n\n\t\tconst { clearSelectedBlock, insertDefaultBlock } = dispatch(\n\t\t\tblockEditorStore\n\t\t);\n\n\t\treturn {\n\t\t\tonEnterPress() {\n\t\t\t\tinsertDefaultBlock( undefined, undefined, 0 );\n\t\t\t},\n\t\t\tonUndo: undo,\n\t\t\tonRedo: redo,\n\t\t\tonSelect() {\n\t\t\t\ttogglePostTitleSelection( true );\n\t\t\t\tclearSelectedBlock();\n\t\t\t},\n\t\t\tonUnselect() {\n\t\t\t\ttogglePostTitleSelection( false );\n\t\t\t},\n\t\t};\n\t} ),\n\twithInstanceId,\n\twithFocusOutside\n)( PostTitle );\n"]}
@@ -9,12 +9,14 @@ import { store as coreStore } from '@wordpress/core-data';
9
9
 
10
10
  import { store as editorStore } from '../../store';
11
11
 
12
- function PostTrashCheck({
13
- isNew,
14
- postId,
15
- canUserDelete,
16
- children
17
- }) {
12
+ function PostTrashCheck(_ref) {
13
+ let {
14
+ isNew,
15
+ postId,
16
+ canUserDelete,
17
+ children
18
+ } = _ref;
19
+
18
20
  if (isNew || !postId || !canUserDelete) {
19
21
  return null;
20
22
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-trash/check.js"],"names":["withSelect","store","coreStore","editorStore","PostTrashCheck","isNew","postId","canUserDelete","children","select","isEditedPostNew","getCurrentPostId","getCurrentPostType","getPostType","canUser","postType","resource","rest_base"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAT,QAA2B,iBAA3B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,aAArC;;AAEA,SAASC,cAAT,CAAyB;AAAEC,EAAAA,KAAF;AAASC,EAAAA,MAAT;AAAiBC,EAAAA,aAAjB;AAAgCC,EAAAA;AAAhC,CAAzB,EAAsE;AACrE,MAAKH,KAAK,IAAI,CAAEC,MAAX,IAAqB,CAAEC,aAA5B,EAA4C;AAC3C,WAAO,IAAP;AACA;;AAED,SAAOC,QAAP;AACA;;AAED,eAAeR,UAAU,CAAIS,MAAF,IAAc;AACxC,QAAM;AAAEC,IAAAA,eAAF;AAAmBC,IAAAA,gBAAnB;AAAqCC,IAAAA;AAArC,MAA4DH,MAAM,CACvEN,WADuE,CAAxE;AAGA,QAAM;AAAEU,IAAAA,WAAF;AAAeC,IAAAA;AAAf,MAA2BL,MAAM,CAAEP,SAAF,CAAvC;AACA,QAAMI,MAAM,GAAGK,gBAAgB,EAA/B;AACA,QAAMI,QAAQ,GAAGF,WAAW,CAAED,kBAAkB,EAApB,CAA5B;AACA,QAAMI,QAAQ,GAAG,CAAAD,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAEE,SAAV,KAAuB,EAAxC,CAPwC,CAOI;;AAE5C,SAAO;AACNZ,IAAAA,KAAK,EAAEK,eAAe,EADhB;AAENJ,IAAAA,MAFM;AAGNC,IAAAA,aAAa,EACZD,MAAM,IAAIU,QAAV,GAAqBF,OAAO,CAAE,QAAF,EAAYE,QAAZ,EAAsBV,MAAtB,CAA5B,GAA6D;AAJxD,GAAP;AAMA,CAfwB,CAAV,CAeVF,cAfU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { withSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction PostTrashCheck( { isNew, postId, canUserDelete, children } ) {\n\tif ( isNew || ! postId || ! canUserDelete ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default withSelect( ( select ) => {\n\tconst { isEditedPostNew, getCurrentPostId, getCurrentPostType } = select(\n\t\teditorStore\n\t);\n\tconst { getPostType, canUser } = select( coreStore );\n\tconst postId = getCurrentPostId();\n\tconst postType = getPostType( getCurrentPostType() );\n\tconst resource = postType?.rest_base || ''; // eslint-disable-line camelcase\n\n\treturn {\n\t\tisNew: isEditedPostNew(),\n\t\tpostId,\n\t\tcanUserDelete:\n\t\t\tpostId && resource ? canUser( 'delete', resource, postId ) : false,\n\t};\n} )( PostTrashCheck );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-trash/check.js"],"names":["withSelect","store","coreStore","editorStore","PostTrashCheck","isNew","postId","canUserDelete","children","select","isEditedPostNew","getCurrentPostId","getCurrentPostType","getPostType","canUser","postType","resource","rest_base"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAT,QAA2B,iBAA3B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,aAArC;;AAEA,SAASC,cAAT,OAAsE;AAAA,MAA7C;AAAEC,IAAAA,KAAF;AAASC,IAAAA,MAAT;AAAiBC,IAAAA,aAAjB;AAAgCC,IAAAA;AAAhC,GAA6C;;AACrE,MAAKH,KAAK,IAAI,CAAEC,MAAX,IAAqB,CAAEC,aAA5B,EAA4C;AAC3C,WAAO,IAAP;AACA;;AAED,SAAOC,QAAP;AACA;;AAED,eAAeR,UAAU,CAAIS,MAAF,IAAc;AACxC,QAAM;AAAEC,IAAAA,eAAF;AAAmBC,IAAAA,gBAAnB;AAAqCC,IAAAA;AAArC,MAA4DH,MAAM,CACvEN,WADuE,CAAxE;AAGA,QAAM;AAAEU,IAAAA,WAAF;AAAeC,IAAAA;AAAf,MAA2BL,MAAM,CAAEP,SAAF,CAAvC;AACA,QAAMI,MAAM,GAAGK,gBAAgB,EAA/B;AACA,QAAMI,QAAQ,GAAGF,WAAW,CAAED,kBAAkB,EAApB,CAA5B;AACA,QAAMI,QAAQ,GAAG,CAAAD,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAEE,SAAV,KAAuB,EAAxC,CAPwC,CAOI;;AAE5C,SAAO;AACNZ,IAAAA,KAAK,EAAEK,eAAe,EADhB;AAENJ,IAAAA,MAFM;AAGNC,IAAAA,aAAa,EACZD,MAAM,IAAIU,QAAV,GAAqBF,OAAO,CAAE,QAAF,EAAYE,QAAZ,EAAsBV,MAAtB,CAA5B,GAA6D;AAJxD,GAAP;AAMA,CAfwB,CAAV,CAeVF,cAfU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { withSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction PostTrashCheck( { isNew, postId, canUserDelete, children } ) {\n\tif ( isNew || ! postId || ! canUserDelete ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default withSelect( ( select ) => {\n\tconst { isEditedPostNew, getCurrentPostId, getCurrentPostType } = select(\n\t\teditorStore\n\t);\n\tconst { getPostType, canUser } = select( coreStore );\n\tconst postId = getCurrentPostId();\n\tconst postType = getPostType( getCurrentPostType() );\n\tconst resource = postType?.rest_base || ''; // eslint-disable-line camelcase\n\n\treturn {\n\t\tisNew: isEditedPostNew(),\n\t\tpostId,\n\t\tcanUserDelete:\n\t\t\tpostId && resource ? canUser( 'delete', resource, postId ) : false,\n\t};\n} )( PostTrashCheck );\n"]}
@@ -13,12 +13,14 @@ import { compose } from '@wordpress/compose';
13
13
 
14
14
  import { store as editorStore } from '../../store';
15
15
 
16
- function PostTrash({
17
- isNew,
18
- postId,
19
- postType,
20
- ...props
21
- }) {
16
+ function PostTrash(_ref) {
17
+ let {
18
+ isNew,
19
+ postId,
20
+ postType,
21
+ ...props
22
+ } = _ref;
23
+
22
24
  if (isNew || !postId) {
23
25
  return null;
24
26
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-trash/index.js"],"names":["__","Button","withSelect","withDispatch","compose","store","editorStore","PostTrash","isNew","postId","postType","props","onClick","trashPost","select","isEditedPostNew","getCurrentPostId","getCurrentPostType","dispatch"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;;AAEA,SAASC,SAAT,CAAoB;AAAEC,EAAAA,KAAF;AAASC,EAAAA,MAAT;AAAiBC,EAAAA,QAAjB;AAA2B,KAAGC;AAA9B,CAApB,EAA4D;AAC3D,MAAKH,KAAK,IAAI,CAAEC,MAAhB,EAAyB;AACxB,WAAO,IAAP;AACA;;AAED,QAAMG,OAAO,GAAG,MAAMD,KAAK,CAACE,SAAN,CAAiBJ,MAAjB,EAAyBC,QAAzB,CAAtB;;AAEA,SACC,cAAC,MAAD;AACC,IAAA,SAAS,EAAC,mBADX;AAEC,IAAA,aAAa,MAFd;AAGC,IAAA,OAAO,EAAC,UAHT;AAIC,IAAA,OAAO,EAAGE;AAJX,KAMGZ,EAAE,CAAE,eAAF,CANL,CADD;AAUA;;AAED,eAAeI,OAAO,CAAE,CACvBF,UAAU,CAAIY,MAAF,IAAc;AACzB,QAAM;AACLC,IAAAA,eADK;AAELC,IAAAA,gBAFK;AAGLC,IAAAA;AAHK,MAIFH,MAAM,CAAER,WAAF,CAJV;AAKA,SAAO;AACNE,IAAAA,KAAK,EAAEO,eAAe,EADhB;AAENN,IAAAA,MAAM,EAAEO,gBAAgB,EAFlB;AAGNN,IAAAA,QAAQ,EAAEO,kBAAkB;AAHtB,GAAP;AAKA,CAXS,CADa,EAavBd,YAAY,CAAIe,QAAF,KAAkB;AAC/BL,EAAAA,SAAS,EAAEK,QAAQ,CAAEZ,WAAF,CAAR,CAAwBO;AADJ,CAAlB,CAAF,CAbW,CAAF,CAAP,CAgBVN,SAhBU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button } 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 PostTrash( { isNew, postId, postType, ...props } ) {\n\tif ( isNew || ! postId ) {\n\t\treturn null;\n\t}\n\n\tconst onClick = () => props.trashPost( postId, postType );\n\n\treturn (\n\t\t<Button\n\t\t\tclassName=\"editor-post-trash\"\n\t\t\tisDestructive\n\t\t\tvariant=\"tertiary\"\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ __( 'Move to trash' ) }\n\t\t</Button>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\tisEditedPostNew,\n\t\t\tgetCurrentPostId,\n\t\t\tgetCurrentPostType,\n\t\t} = select( editorStore );\n\t\treturn {\n\t\t\tisNew: isEditedPostNew(),\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => ( {\n\t\ttrashPost: dispatch( editorStore ).trashPost,\n\t} ) ),\n] )( PostTrash );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-trash/index.js"],"names":["__","Button","withSelect","withDispatch","compose","store","editorStore","PostTrash","isNew","postId","postType","props","onClick","trashPost","select","isEditedPostNew","getCurrentPostId","getCurrentPostType","dispatch"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;;AAEA,SAASC,SAAT,OAA4D;AAAA,MAAxC;AAAEC,IAAAA,KAAF;AAASC,IAAAA,MAAT;AAAiBC,IAAAA,QAAjB;AAA2B,OAAGC;AAA9B,GAAwC;;AAC3D,MAAKH,KAAK,IAAI,CAAEC,MAAhB,EAAyB;AACxB,WAAO,IAAP;AACA;;AAED,QAAMG,OAAO,GAAG,MAAMD,KAAK,CAACE,SAAN,CAAiBJ,MAAjB,EAAyBC,QAAzB,CAAtB;;AAEA,SACC,cAAC,MAAD;AACC,IAAA,SAAS,EAAC,mBADX;AAEC,IAAA,aAAa,MAFd;AAGC,IAAA,OAAO,EAAC,UAHT;AAIC,IAAA,OAAO,EAAGE;AAJX,KAMGZ,EAAE,CAAE,eAAF,CANL,CADD;AAUA;;AAED,eAAeI,OAAO,CAAE,CACvBF,UAAU,CAAIY,MAAF,IAAc;AACzB,QAAM;AACLC,IAAAA,eADK;AAELC,IAAAA,gBAFK;AAGLC,IAAAA;AAHK,MAIFH,MAAM,CAAER,WAAF,CAJV;AAKA,SAAO;AACNE,IAAAA,KAAK,EAAEO,eAAe,EADhB;AAENN,IAAAA,MAAM,EAAEO,gBAAgB,EAFlB;AAGNN,IAAAA,QAAQ,EAAEO,kBAAkB;AAHtB,GAAP;AAKA,CAXS,CADa,EAavBd,YAAY,CAAIe,QAAF,KAAkB;AAC/BL,EAAAA,SAAS,EAAEK,QAAQ,CAAEZ,WAAF,CAAR,CAAwBO;AADJ,CAAlB,CAAF,CAbW,CAAF,CAAP,CAgBVN,SAhBU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button } 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 PostTrash( { isNew, postId, postType, ...props } ) {\n\tif ( isNew || ! postId ) {\n\t\treturn null;\n\t}\n\n\tconst onClick = () => props.trashPost( postId, postType );\n\n\treturn (\n\t\t<Button\n\t\t\tclassName=\"editor-post-trash\"\n\t\t\tisDestructive\n\t\t\tvariant=\"tertiary\"\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ __( 'Move to trash' ) }\n\t\t</Button>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\tisEditedPostNew,\n\t\t\tgetCurrentPostId,\n\t\t\tgetCurrentPostType,\n\t\t} = select( editorStore );\n\t\treturn {\n\t\t\tisNew: isEditedPostNew(),\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => ( {\n\t\ttrashPost: dispatch( editorStore ).trashPost,\n\t} ) ),\n] )( PostTrash );\n"]}
@@ -27,11 +27,12 @@ import { store as editorStore } from '../../store';
27
27
  * @return {WPComponent} The component to be rendered.
28
28
  */
29
29
 
30
- export function PostTypeSupportCheck({
31
- postType,
32
- children,
33
- supportKeys
34
- }) {
30
+ export function PostTypeSupportCheck(_ref) {
31
+ let {
32
+ postType,
33
+ children,
34
+ supportKeys
35
+ } = _ref;
35
36
  let isSupported = true;
36
37
 
37
38
  if (postType) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-type-support-check/index.js"],"names":["some","castArray","withSelect","store","coreStore","editorStore","PostTypeSupportCheck","postType","children","supportKeys","isSupported","key","supports","select","getEditedPostAttribute","getPostType"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,SAAf,QAAgC,QAAhC;AAEA;AACA;AACA;;AACA,SAASC,UAAT,QAA2B,iBAA3B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,aAArC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,oBAAT,CAA+B;AAAEC,EAAAA,QAAF;AAAYC,EAAAA,QAAZ;AAAsBC,EAAAA;AAAtB,CAA/B,EAAqE;AAC3E,MAAIC,WAAW,GAAG,IAAlB;;AACA,MAAKH,QAAL,EAAgB;AACfG,IAAAA,WAAW,GAAGV,IAAI,CACjBC,SAAS,CAAEQ,WAAF,CADQ,EAEfE,GAAF,IAAW,CAAC,CAAEJ,QAAQ,CAACK,QAAT,CAAmBD,GAAnB,CAFG,CAAlB;AAIA;;AAED,MAAK,CAAED,WAAP,EAAqB;AACpB,WAAO,IAAP;AACA;;AAED,SAAOF,QAAP;AACA;AAED,eAAeN,UAAU,CAAIW,MAAF,IAAc;AACxC,QAAM;AAAEC,IAAAA;AAAF,MAA6BD,MAAM,CAAER,WAAF,CAAzC;AACA,QAAM;AAAEU,IAAAA;AAAF,MAAkBF,MAAM,CAAET,SAAF,CAA9B;AACA,SAAO;AACNG,IAAAA,QAAQ,EAAEQ,WAAW,CAAED,sBAAsB,CAAE,MAAF,CAAxB;AADf,GAAP;AAGA,CANwB,CAAV,CAMVR,oBANU,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { some, castArray } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { withSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * A component which renders its own children only if the current editor post\n * type supports one of the given `supportKeys` prop.\n *\n * @param {Object} props Props.\n * @param {string} [props.postType] Current post type.\n * @param {WPElement} props.children Children to be rendered if post\n * type supports.\n * @param {(string|string[])} props.supportKeys String or string array of keys\n * to test.\n *\n * @return {WPComponent} The component to be rendered.\n */\nexport function PostTypeSupportCheck( { postType, children, supportKeys } ) {\n\tlet isSupported = true;\n\tif ( postType ) {\n\t\tisSupported = some(\n\t\t\tcastArray( supportKeys ),\n\t\t\t( key ) => !! postType.supports[ key ]\n\t\t);\n\t}\n\n\tif ( ! isSupported ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default withSelect( ( select ) => {\n\tconst { getEditedPostAttribute } = select( editorStore );\n\tconst { getPostType } = select( coreStore );\n\treturn {\n\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t};\n} )( PostTypeSupportCheck );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-type-support-check/index.js"],"names":["some","castArray","withSelect","store","coreStore","editorStore","PostTypeSupportCheck","postType","children","supportKeys","isSupported","key","supports","select","getEditedPostAttribute","getPostType"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,SAAf,QAAgC,QAAhC;AAEA;AACA;AACA;;AACA,SAASC,UAAT,QAA2B,iBAA3B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,aAArC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,oBAAT,OAAqE;AAAA,MAAtC;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,QAAZ;AAAsBC,IAAAA;AAAtB,GAAsC;AAC3E,MAAIC,WAAW,GAAG,IAAlB;;AACA,MAAKH,QAAL,EAAgB;AACfG,IAAAA,WAAW,GAAGV,IAAI,CACjBC,SAAS,CAAEQ,WAAF,CADQ,EAEfE,GAAF,IAAW,CAAC,CAAEJ,QAAQ,CAACK,QAAT,CAAmBD,GAAnB,CAFG,CAAlB;AAIA;;AAED,MAAK,CAAED,WAAP,EAAqB;AACpB,WAAO,IAAP;AACA;;AAED,SAAOF,QAAP;AACA;AAED,eAAeN,UAAU,CAAIW,MAAF,IAAc;AACxC,QAAM;AAAEC,IAAAA;AAAF,MAA6BD,MAAM,CAAER,WAAF,CAAzC;AACA,QAAM;AAAEU,IAAAA;AAAF,MAAkBF,MAAM,CAAET,SAAF,CAA9B;AACA,SAAO;AACNG,IAAAA,QAAQ,EAAEQ,WAAW,CAAED,sBAAsB,CAAE,MAAF,CAAxB;AADf,GAAP;AAGA,CANwB,CAAV,CAMVR,oBANU,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { some, castArray } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { withSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * A component which renders its own children only if the current editor post\n * type supports one of the given `supportKeys` prop.\n *\n * @param {Object} props Props.\n * @param {string} [props.postType] Current post type.\n * @param {WPElement} props.children Children to be rendered if post\n * type supports.\n * @param {(string|string[])} props.supportKeys String or string array of keys\n * to test.\n *\n * @return {WPComponent} The component to be rendered.\n */\nexport function PostTypeSupportCheck( { postType, children, supportKeys } ) {\n\tlet isSupported = true;\n\tif ( postType ) {\n\t\tisSupported = some(\n\t\t\tcastArray( supportKeys ),\n\t\t\t( key ) => !! postType.supports[ key ]\n\t\t);\n\t}\n\n\tif ( ! isSupported ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default withSelect( ( select ) => {\n\tconst { getEditedPostAttribute } = select( editorStore );\n\tconst { getPostType } = select( coreStore );\n\treturn {\n\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t};\n} )( PostTypeSupportCheck );\n"]}
@@ -13,10 +13,11 @@ import { withSelect } from '@wordpress/data';
13
13
  */
14
14
 
15
15
  import { store as editorStore } from '../../store';
16
- export function PostVisibilityCheck({
17
- hasPublishAction,
18
- render
19
- }) {
16
+ export function PostVisibilityCheck(_ref) {
17
+ let {
18
+ hasPublishAction,
19
+ render
20
+ } = _ref;
20
21
  const canEdit = hasPublishAction;
21
22
  return render({
22
23
  canEdit
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-visibility/check.js"],"names":["get","compose","withSelect","store","editorStore","PostVisibilityCheck","hasPublishAction","render","canEdit","select","getCurrentPost","getCurrentPostType","postType"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,UAAT,QAA2B,iBAA3B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,mBAAT,CAA8B;AAAEC,EAAAA,gBAAF;AAAoBC,EAAAA;AAApB,CAA9B,EAA6D;AACnE,QAAMC,OAAO,GAAGF,gBAAhB;AACA,SAAOC,MAAM,CAAE;AAAEC,IAAAA;AAAF,GAAF,CAAb;AACA;AAED,eAAeP,OAAO,CAAE,CACvBC,UAAU,CAAIO,MAAF,IAAc;AACzB,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,MAAyCF,MAAM,CAAEL,WAAF,CAArD;AACA,SAAO;AACNE,IAAAA,gBAAgB,EAAEN,GAAG,CACpBU,cAAc,EADM,EAEpB,CAAE,QAAF,EAAY,mBAAZ,CAFoB,EAGpB,KAHoB,CADf;AAMNE,IAAAA,QAAQ,EAAED,kBAAkB;AANtB,GAAP;AAQA,CAVS,CADa,CAAF,CAAP,CAYVN,mBAZU,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { compose } from '@wordpress/compose';\nimport { withSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function PostVisibilityCheck( { hasPublishAction, render } ) {\n\tconst canEdit = hasPublishAction;\n\treturn render( { canEdit } );\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getCurrentPost, getCurrentPostType } = select( editorStore );\n\t\treturn {\n\t\t\thasPublishAction: get(\n\t\t\t\tgetCurrentPost(),\n\t\t\t\t[ '_links', 'wp:action-publish' ],\n\t\t\t\tfalse\n\t\t\t),\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t} ),\n] )( PostVisibilityCheck );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-visibility/check.js"],"names":["get","compose","withSelect","store","editorStore","PostVisibilityCheck","hasPublishAction","render","canEdit","select","getCurrentPost","getCurrentPostType","postType"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,UAAT,QAA2B,iBAA3B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,mBAAT,OAA6D;AAAA,MAA/B;AAAEC,IAAAA,gBAAF;AAAoBC,IAAAA;AAApB,GAA+B;AACnE,QAAMC,OAAO,GAAGF,gBAAhB;AACA,SAAOC,MAAM,CAAE;AAAEC,IAAAA;AAAF,GAAF,CAAb;AACA;AAED,eAAeP,OAAO,CAAE,CACvBC,UAAU,CAAIO,MAAF,IAAc;AACzB,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,MAAyCF,MAAM,CAAEL,WAAF,CAArD;AACA,SAAO;AACNE,IAAAA,gBAAgB,EAAEN,GAAG,CACpBU,cAAc,EADM,EAEpB,CAAE,QAAF,EAAY,mBAAZ,CAFoB,EAGpB,KAHoB,CADf;AAMNE,IAAAA,QAAQ,EAAED,kBAAkB;AANtB,GAAP;AAQA,CAVS,CADa,CAAF,CAAP,CAYVN,mBAZU,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { compose } from '@wordpress/compose';\nimport { withSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function PostVisibilityCheck( { hasPublishAction, render } ) {\n\tconst canEdit = hasPublishAction;\n\treturn render( { canEdit } );\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getCurrentPost, getCurrentPostType } = select( editorStore );\n\t\treturn {\n\t\t\thasPublishAction: get(\n\t\t\t\tgetCurrentPost(),\n\t\t\t\t[ '_links', 'wp:action-publish' ],\n\t\t\t\tfalse\n\t\t\t),\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t} ),\n] )( PostVisibilityCheck );\n"]}